java

How to Convert Map to Object

I have a Map Object and the data in map is like col1 -> data1, col2 -> data2, col3 -> data3 ... Is it possible to convert this Map to Java Object like class MapObj { String col1 = "data1"; String col2 = "data2"; String col3 = "data3"; } ...

Process android

Hi , I want to check whether the process is still alive or not through programmatically ,Can i do that i am trying to do it by process name in onCreate method but the issue is that the onCreate method is called always .When i check that in onCreate method i always get the process name and i can not kill the current app and switch to ...

XMPP server in Java

Hey any body please help me to implement a simple XMPP server using Java. Thanks, KC. ...

Java 2D Graphics Question

I'm attempting to make a Java Applet which will allow me to draw a graph data structure in a canvas by clicking where I want to create nodes, and clicking the nodes to connect them. The problem is I cannot get the paint() method to behave correctly. I add new nodes to the graph (and squares on the canvas) inside the mousePressed(MouseEve...

How do I change the location of index.jsp in a war file

I have the following project structure: myproject - src - WebContent    - META-INF    - WEB-INF       - jsp         - index.jsp       - lib         - web.xml If my index.jsp comes under the WebContent directory then all is well, but I want it to be under WebContent/WEB-INF/jsp with all the other jsps. What do I have to add to do this. ...

Applets failing to load

While testing our setup for user acceptance testing, we got some reports that java applets in our web application would occasionally fail to load. The envt where it was reported was WinXP/IE6, and there were no errors found in the java console. Obviously we'd like to avoid it. What sort of things should we be checking for here? On our l...

how to encode the ciphertext

the file abc.txt has several lines of ciphertext. i want to encode the line of ciphertext into hex encode or base64 before putting in string srr . is there any way i can do it ? bufferedReader = new BufferedReader(new FileReader("abc.txt")); String srr = null; srr = bufferedRea...

Joda Time: First day of week??

How do you get the first day of week given a Locale using Joda Time? Point: Most countries use the international standard Monday as first day of week (!). A bunch others use Sunday (notably USA). Others apparently Saturday. Some apparently Wednesday?! Wikipedia "Seven-day week"#Week_number ...

Best practises to convey parameters from JavaScript (jQuery) to a Java based REST service?

I have made a jQuery based widget which is configured a bit like this: jQuery("#foo").widget("service", { output : "test_output_field", parameters : {'format' : 'json', 'limit' : 20, 'services' : {'service1' : {}, 'service2' : {'language' : 'en', 'type' : 'solid', 'parent' : 'father'}, 'service3' : {...

Why do only certain feeds get recovered from google reader?

I want to parse the results of a public google reader feed of mine. I am writing an app in gwt and up to this point I had been following an example with the line: String gdata = "http://www.google.com/base/feeds/snippets?alt=json-in-script&callback="; The feed is retrieved, public void handle(JavaScriptObject jso) { JSO...

Java Tree Node selection

I have a tree and a TreePath to one of its nodes. How do I programatically select this node? Will setSelectionPath of the JTree object alone work? ...

HTTPS hostname wrong: should be <sub.domain.com>. What causes this?

I am getting this 'HTTPS hostname wrong:' error when trying to connect to a server using https. My url looks something like this https://sub.domain.com/tamnode/webapps/app/servlet. I connect using the following code // Create a URLConnection object for a URL URL url = new URL(requestedURL); HttpURLConnection.setFollowRedirects(fal...

Can we convert a byte array into an InputStream in Java?

Can we convert a byte array into an InputStream in Java? I have been looking on the internet but couldn't find it. I have a method that has an InputStream as argument. The InputStream cph I have is base64 encoded so I had to decode it using BASE64Decoder decoder = new BASE64Decoder(); byte[] decodedBytes = decoder.decodeBuffer(cph); ...

What the mechanism use to integrate python with other languages (.Net, Java ....)

Hi everybody, Somebody talking the python's code can embed into C#'s code. What the mechanism to do that? please explain for me. Thanks a lot ...

Lucene seems to be caching search results - why?

In my project we use Lucene 2.4.1 for fulltext search. This is a J2EE project, IndexSearcher is created once. In the background, the index is refreshed every couple of minutes (when the content changes). Users can search the index through a search mechanism on the page. The problem is, the results returned by Lucene seem to be cached so...

How to use an Interface as Map’s Key

I am looking for help on the subject how to use an Interface as Maps Key. I tried to implement a solution, and get no compiletime errors but runtime errors when running my integration tests. Is it not possible to use an Interface as a Key, or is it my tests there is something wrong with? My code looks something like this private Map<AI...

JSTL Taglib uri for Tomcat 6.0

Can anybody help me oput by letting me know the "taglib uri" for JSTL tags in TOMCAT 6.0 ...

Java - Base64 string in and out of a text

I need to write string containing base64 encoded text to a text file and then later read that string back from the text file to a string variable. How can i do it so that there is no data loss due to encoding issues? ...

is there a way to embed flv files in java forms?

I want to play some flash videos in my desktop application are there any tools (library,jar file, class... etc) to embed flvs in any java forms? ...

Is there an elegant way to remove nulls while transforming a Collection using Google Collections?

I have a question about simplifying some Collection handling code, when using Google Collections. I've got a bunch of "Computer" objects, and I want to end up with a Collection of their "resource id"s. This is done like so: Collection<Computer> matchingComputers = findComputers(); Collection<String> resourceIds = Lists.newArrayLi...