java

red5 actionscript and LoadVars

is there any equivalent of LoadVars class for red5 ? if there is no equivalent, how to have a have same behaviour as functions load and sendandload of LoadVars ? ...

AspectJ load-time weaving in production systems

Does anyone have an experience with pure AspectJ load time weaving in production systems (mostly interesting Tomcat related activities)? I'm slightly worrying regarding memory footprint and cpu overhead. ...

Need a way to scale a font to fit a rectangle.

I just wrote some code to scale a font to fit within (the length of) a rectangle. It starts at 18 width and iterates down until it fits. This seems horribly inefficient, but I can't find a non-looping way to do it. This line is for labels in a game grid that scales, so I can't see a work-around solution (wrapping, cutting off and exten...

how to send and then read \n using SocketChannel in Java

I am using the SocketChannel Java class for a client/server application. I can send and retrieve data. But if my data contains '\n' then I do not read the correct data. For example sending data = "Hi dear" receiving data = "Hi dear" sending data = "Hi dear\n\n i am fine" receiving data = "Hi dear" sending data = "Hi dear\\n\\n i am f...

XPath can't find a table by id

I'm doing some screen scraping using WATIJ, but it can't read HTML tables (throws NullPointerExceptions or UnknownObjectExceptions). To overcome this I read the HTML and run it through JTidy to get well-formed XML. I want to parse it with XPath, but it can't find a <table ...> by id even though the table is there in the XML plain as da...

Calling servlet from another servlet

I have two servlets which are running on different tomcat servers. I and trying to call a servlet1 from servlet2 in the following way and wanted to write an object to output stream. URL url=new URL("http://msyserver/abc/servlet1"); URLConnection con=url.openConnection(); con.setDoOutput(true); con.setDoInput(true); OutputStream os=con...

Setting default profile CPU to true in Java VisualVM

I want to use Java VisualVM to also profile the application even when it is starting. By default, it is set as false. Is there any way to change the profiling to be enabled by default? Thanks, Aakash ...

problem with writing large data using java nio socket channel

I can sent small data using java nio. But If I want to send a very large data then my socket channel did not work fine. message = "very large data"+"\n"; ByteBuffer buf = ByteBuffer.wrap(message.getBytes()); int nbytes = channel.write(buf); all the data is sent. I want to read data from server so i am using BufferedInputStreaReader....

open temp file in java

I'm writing string to temperoray file(temp.txt) and I want that file should open after clicking button of my awt window it should delete when I close that file (after opening that file), how can do this please help me. This is code what i have used to create temporary file in java File temp = File.createTempFile("temp",".txt"); FileWr...

Ant loadproperties failed (bcel error?)

I'm working on a simple build script that should get some constants from a java class file and use them as the version numbers in my file names. I use Eclipse and its own Ant, but put bcel-5.2.jar in my libs folder and into the classpath for the Ant call. <target name="generate_version" depends="compile"> <loadproperties srcfile="${dir...

Higher-kinded generics in Java

Suppose I have the following class: public class FixExpr { Expr<FixExpr> in; } Now I want to introduce a generic argument, abstracting over the use of Expr: public class Fix<F> { F<Fix<F>> in; } But Eclipse doesn't like this: The type F is not generic; it cannot be parametrized with arguments <Fix<F>> Is this possible at ...

Mock svn instance for testing svnkit tests

Hi all A project I'm working on interacts heavily with Subversion, using svnkit. Are there any examples on running a mock in-memory svn instance, to help facilitate testing etc? Cheers Marty ...

Changing cookie JSESSIONID name

I have a requirement of having to run multiple tomcat server in single physical box. While accessing these from a browser, when user switches between the applications, it results in logging out the user previously access application. This is because of JSESSIONID cookie conflict. One possible solution is to run each applications in diff...

DWR 3 comet

Hi all, I currently develop with DWR 2, but I now want to try DWR 3. I don't understand how is possible to make comet with DWR 3. I've searched on Google many many times but I've not found any good examples. Could anyone help me? Thanks, Tom ...

Java Threading pass parameter to a thread

Greetings , Can anyone suggest to me how I can pass a parameter to a thread. I can't seem to find anything about it! I'm sure this is quite simple. [Edit] Apologies I was using anonymous classes (Which was the problem) Hit the refactor button :) [/Edit] ...

Refer the URL for Free Download Desktop Gadgets ?

I want desktop gadgets for my vista . If i go to any download gadgets site then asked cost. so tell me any free download site ? Do you know which technology based to create desktop gedgets ? . i want more information about gadets . anybody help me ...

What is Spring's Minimum Dependencies for Dependency Injection?

What are the minimum dependencies required to just use Spring's dependency injection (core framework only)? I'm using Spring for a standalone application, and I'd like to minimize the number of dependencies that I have to ship with the application. I suppose I could systematically remove a Jar and see if the application breaks, but it ...

Cracking a N bit RSA modulo numbers

This is related to my previous post, where my only option was to have a RSA algorithm which seemed relatively weak. Let us assume that I want to encode a 35 bit number (From 0 upto 34359738367) with a 36 bit modulo (between 34359738368 upto 68719476735). Referring to http://en.wikipedia.org/wiki/RSA I can see that my n is between 34359...

EntityInterceptor

Hi all, i need to put some code in the EntityInterceptor, but when i try to recover collections asociated with my object (aggregations) i can't, is like Entity doesn't take care about collections . Why? Thx ...

Deploying multiple Java web apps to Glassfish in one go

I have multiple (8) WAR files and 1 EAR file that I want to deploy to Glassfish without having to redeploy each application through the Admin Console. Previously in Tomcat the WAR files could just be dropped into the webapps directory, is there something similar for Glassfish? Using the asadmin command to grab a bunch of apps to dpeloy?...