java

Make a website adaptable for iphone

I am owning some websites, in php, java and html coded. I want them to be viewed comfortably using iphones. ie, the site has to first check whether the site is hit from a pc or mobile (iphone). If its from a mobile, it has to be redirected to another server which loads the mobile view. Some sites i've recently found of doing the same is ...

How can we software-engineering antler walker, and its related java codes?

Antlr users usually create a parser that generates the AST(Abstract syntax tree), and a walker that walks through the AST and generate the desired outcomes. As we know, java(C++, python...etc) codes has to be injected into the .g walker files to carry out the execution. However, when the target gets complicated, say we are to develop a w...

How to create a .jar file or export jar on IntelliJ (like eclipse java archive export)

I was using IntelliJ-IDEA IDE , I want to create a jar file from java compiled class files. but I not found command or file, How to create a jar file (like eclipse java archive export) ...

Why does Exception.fillInStackTrace return Throwable?

I think Exception.fillInStackTrace should return Exception or derived Exception objects. Considering the two functions below, public static void f() throws Throwable { try { throw new Throwable(); } catch (Exception e) { System.out.println("catch exception e"); e.printStackTrace(); } } public static ...

How to configure jmf in net beans

I am doing video capturing through webcam using jmf. i am very new to this and dont know how to use jmf. I downloaded and installed jmf,it detects my video devise but now i want to run java code to detect the same. Please help. ...

Java: MiGLayout: How to use `hidemode`?

Hi, I am starting out using MiGLayout for my GUI design, and one of the feature I would need is to show/hide certain components based on the state of other components. I was going to code this myself, when I noticed that one of the Component Constraints supported by MiGLayoutis hidemode. Does this do what I think it does? If so, how d...

displaying an image in swing

I'm developing a Snake game. Instead of showing moving rectangle, I'm planning to show a picture and want to move it with keystrokes. but I can't do it with Jlabel. since labels are static in position. Is there any way to display them as a image only?? thanx. ...

Comment lines in manifest of a jar

Is there a way to insert a comment line in the manifest of a jar file? ...

Is it possible to use JSP and PHP at the same time?

1 function is written in Java while the API of another function is written in PHP. So, is it possible to use JSP and PHP at the same time? ...

How to convert Latitude and longitude to Location name

Hi, How can we get address or location name from latitude and longitude using any API in java? In my applicaiton I have set of latitude and longitude, But I need an API which will return me the location name corresponding to the latitude and longitude. thanks. ...

com.google.gdata.client.GoogleService.setUserToken(android.accounts.AccountManager.getAuthToken(???))

Hello, I've got working code that uses the gdata to retrieve feeds from my user's Google Finance portfolios, but I had to use setUserCredentials(username,password). What I'd like to do is avoid asking the user for their username/password since the Android device already has access to their Google account. I believe I should be able to ...

Google Guice vs. PicoContainer for Dependency Injection

My team is researching dependency injection frameworks and is trying to decide between using Google-Guice and PicoContainer. We are looking for several things in our framework: A small code footprint - What I mean by a small code footprint is we don't want to have dependency injection code litter everywhere in our code base. If we ne...

Working with Java arrays

/** * Testing Arrays * @author N002213F * @version 1.0 */ public class JavaArrays { public void processNames(String[] arg) { //-- patented method, stop, do not read ;) } public void test() { // works fine String[] names1 = new String[] { "Jane", "John" }; processNames(names1); /...

Reflect a list value into another list?

List <ClassA> listA; List <ClassB> listB; Can I use reflection to reflect listA into listB? I got below code but only reflect an object public static <A, B> B convert(A instance, Class<B> targetClass) throws Exception { B target = (B)targetClass.newInstance(); for (Field targetField : targetClas...

Is JVM open source code ? If not how can I get code of JVM?

Hi I like to know is JVM open source code? If not then how can I get the code of JVM? ...

Spring - Show dynamic errors based on specific form field

In my Spring application, I have a form that has multiple inputs of the same field (the user can enter several user names at once). In the validator, I check for the existance of each user name and I want to show an error on the form next to each invalid user name. I can set an error in the validator that will show on the form, but thi...

Hashmap.keySet(), foreach, and remove

I know that it's typically a big no-no to remove from a list using java's "foreach" and that one should use iterator.remove(). But is it safe to remove() if I'm looping over a HashMap's keySet()? Like this: for(String key : map.keySet()) { Node n = map.get(key).optimize(); if(n == null) { map.remove(key); } else { map.put(...

can anybody show me where to find online Java labs?

I am a novice/intermediate Java programmer. I am looking for Java labs to help me improve my programming fundamentals. Please help. ...

Java EE: Where could I read about dao, services and why they're used?

Ok I'm new at my job, and now I'm assigned to a project which uses Spring, Hibernate and Wicket. And I see a lot of DAO and Services packages and I want to understand why they're used and what is advantajes of this. I understand that DAO it's need for working with the databases, but I want more information. I need an overall, a BIG PIC...

Java: how to use UrlConnection to post request with authorization?

Hi, I would lake to generate POST request to a server which requires authentication. I tried to use the following method: private synchronized String CreateNewProductPOST (String urlString, String encodedString, String title, String content, Double price, String tags) { String data = "product[title]=" + URLEncoder.encode(title) + ...