Dec 22, 2008

How To Install, Compile, Run Java On iPhone

How To Install, Compile, Run Java On iPhone

iPhone doesn't natively support Java / J2ME. However as a J2ME developer there are two good ways to develop iPhone applications using Java / J2ME. Read below for details and also to know how you can upload, compile and run Java applications on iPhone.


alcheMo-for-iPhone - Automated J2ME to iPhone porting solution

alcheMo for iPhone contains translator to convert J2ME application source code to equivalent C++ source code for iPhone.

No manual adjustments to the translated source code is required. Compiled using the standard Xcode toolchain and linked with alcheMo's optimized run-time library, a native iPhone application is produced.

alcheMo for iPhone is capable of converting J2ME applications utilizing an extensive subset of Java ME CLDC 1.1 and MIDP 2.0 (including touch screen support) and supports several JSR extension APIs including the JSR-256 mobile sensor API. This automatic translation process is instantaneous, repeatable and doesn't require iPhone specific experience.

Garbage collection and automatic memory management is one of the strengths of the J2ME environment. Unlike on Macintosh OS X, Objective C on iPhone does not support garbage collection. By incorporating an advanced garbage collector, alcheMo eliminates the need for manual memory management. Whole classes of common programming errors such as dangling pointers are thus prevented.

The initial version of alcheMo for iPhone is optimized for mobile games.

The bad news is that their beta program has closed on April 24th, while they are preparing for commercial release. alcheMo for iPhone has backing from Sun Microsystem.

BTW: During Java One 2008, Sun officials repeatedly mentioned that they successfully ran Java on iPhone but are thwarted only by Apple's licensing restrictions in publicly announcing it. alcheMo circumvents Apple's licensing restrictions with their language translator.
Using Java on Unlocked & Jailbraked iPhone with Installer

Note: The legality of the procedure below is dubious. IANAL.

First you need to unlock and jailbrake you iPhone. You can use the windows user interface for ZiPhone to jailbreak, unlock and activate any verion of iPhone.

Then you need to have the installer app on iPhone. Installer.app is a UIKit based package manager for the iPhone. It works by downloading packages over WiFi (wireless networking) or EDGE. It supports installing, updating and uninstalling applications from multiple sources.

winpwn can simplify the above steps for you.

Now go to Installer and install Mobile Terminal and Cydia Installer. Restart iPhone.

Run Cydia Installer and go to Java section and select iPhone/Java which will install the virtual machine, libraries etc. Then install Jikes (java compiler). Now restart iPhone again.

That's it, you are done.
How to load, compile & run Java applications on iPhone

First install Java on iPhone following instructions in the section above before reading this.

You can upload Java files to iPhone using iPhone Browser.
Run Terminal (installed above) and use java (jikes) compiler to compiler your program. For example:
jikes -cp /usr/lib/rt.jar MyFirstJavaProgramForIPhone.java

You can run the class file as usual:
java MyFirstJavaProgramForIPhone
Java on iPhone - Concluding thoughts

The second method (using jailbraked iPhone) suffers from three major problems.
1. To use your Java applications, your user will also have to jailbrake their iPhone. As such its usage will be limited to highly technical people who are not afraid of tinkering with their costly iPhone and potentially even risk damaging it permanently!

2. While it may be fine for experimenting, the legality is dubious. You may run into problem with Apple for selling or even distributing such applications.

3. The jailbraked versions of iPhone may not be compatible with future firmware updates, and Apple will try their best to disable them at every opportunity and had done so in the past.

All of the above makes method 2 unsuitable for commercial use.

Commercial J2ME developers have to wait for commercial release of alcheMo-for-iPhone. Innaworks is well known for porting standards compliant J2ME to BREW mobile platform. I expect their solution to be ready in 2-3 months time. If you do not have the time then download Apple's iPhone SDK and start coding in Objective C.
BTW: Make sure you read the iPhone SDK agreement carefully before you invest huge sums in iPhone development.

Dec 19, 2008

Removing Autorun.inf Virus & Viruses that uses Autorun.INF

How to delete autorun.inf with command prompt

attrib -s -h -r autorun.inf
del autorun.inf

Removing Autorun.inf Virus & Viruses that uses Autorun.INF


There are several viruses that uses the autorun.inf to spread itself such as the Bacalid (hides itself in ctfmon.exe) and the RavMon.EXE. These viruses set its file attributes to System+Hidden+Read-Only attributes so some anti-viruses will have a hard time detecting or finding them. These viruses save itself in the root directory of every available drives of the current infected computer and runs itself every time you Double-Click the drive. In USB Sticks and CDs that are infected by the virus runs automatically especially if drive autorun is enabled for the current drives (which is usually by default, autorun for drives are enabled).

Autorun.INF is usually used by CD Installers to autoplay their installations but Hard disks by default should not have AUTORUN.INF in the drive.

Now, it is possible that your computer is infected by those viruses if you try to display the content of the your computer through command prompt, using the dir /ah command. You will see the following window if you try this:


You will see from this window that drive C contains a hidden file autorun.inf, this is a possibility that the computer is infected. Now to erase this, restart your window to Safe Mode Command Prompt. (Do this by rebooting your computer and pressing F8 before windows go out and select from the boot menu). On drive C and other drives type the following commands: 1. attrib -h -r -s autorun.inf 2. del autorun.inf

Do this steps to other drives to disable the autorun.inf .

Disable AUTORUN from Registry

Now you can disable the AUTORUN for all drives by configuring the registry. Open the registry by typing regedit.exe to the command prompt (if your still at the command prompt) or execute it in Run. Look for the HKEY_CURRENT_USER\Software\ Microsoft\Windows\CurrentVersion\Policies\Explorer as shown below:




Double-click the NoDriveAutorun DWORD entry and type the value HEX: FF (255 in Decimal). (If the NoDriveAutorun does not exists, you can creat it by right-clicking the right side area of the regedit window, then click New->DWord Value -> type NoDriveAutorun) Close the registry and restart the computer. This procedure will disable all the autorun for all drives of your computer and at least will prevent the autorun function of infected USB drives or CDs and avoid the infection of viruses like the Bacalid and RavMon.exe.

Update:

If you want to prevent viruses that uses autorun.inf to infect your USB flash drive, try to do this:

1. Open your flash drive via Command Prompt (do this via Start->Run->cmd.exe)

2. Change your logged drive to your USB flash drive (e.g. if your drive is at drive E: then type E: on the command prompt then press enter)

3. Create a folder named: AUTORUN.INF on the root directory of your flash drive. (to do this type the command: MD\AUTORUN.INF). If an error: a subdirectory already exists… shows, try to follow the instruction above to remove existing autorun.inf before doing this instruction.

The reason why this will avoid future infection is that autorun.inf viruses usually generates a file autorun.inf. Having an AUTORUN.INF folder on the root directory of your drives will make virus programs unable to create their own autorun.inf file, virus can’t even overwrite

FIX:Drive opens in new window on double click in windows XP Full Why drive opens in new window?

FIX:Drive opens in new window on double click in windows XP Full

Why drive opens in new window?

It happens when a program or virus tries to edit the File Folder or Drive shell entries to add more context menu items and set them as default for double click action.

Lets see how we can fix this.


Fix:

First Method:

1. Open Start >> Run and type regsvr32 /i shell32.dll

2. press ok

3. You will see a message DllRegisterServer and DllInstall in shell32.dll succeeded

4. that’s it

Second Method:

1. Open Start >> Run and type regedit

2. Navigate to HKEY_CLASSES_ROOT/Directory/Shell

3. Double click the default key type none and press ok.

4. now navigate to HKEY_CLASSES_ROOT/Drive/Shell.

5. Double click the default key type none and press ok.

Third Method:

If you don’t want to play with the registry ,you can run the following command instead at

Run Prompt: ( Open Start >> Run )

“reg add hkcr\drive\shell /ve /d none /f” (without double quotes)

We hope at least one of the above method may work for you to fix the trouble, if not please let us know.

Note: If still after following the above you are not able to solve the problem then update your antivirus and run a complete scan and make your system virus free.
Please Download this file...If u Like my Work. This file is Less than 1Kb...It is just a Text file with thanks.
Link: http://www.ziddu.com/downloadlink/2529657/Thanks.txt

Nov 26, 2008

Sep 28, 2008

MOBILE TECHNOLOGIES" Java - Interview Questions

1. Which two of the following legal objectives for non tested clauses and interfaceA. final abstract class test {}
B. public static interface test {}
C. final public class test {}
D. procted abstract class test {}
E. procted interface class test{}
F. abstract public class test {}

ANSWER: C & F

2. There should be one public class in a file : True/False

ANSWER: True

3. Interface variable are implicity public static final : True/False

ANSWER: True

4. Which two are equal

A. 32/2
B. (82>>2)<<4
C. 2^5
D. 128>>>2
E. (2>>1)*(32>>3)
F. 2>>5

ANSWER
: B & E

5. Public class test
{
Public static void main (string args[])
{
signed int x=10;
for (int y=0 ;y<5;y+1,x--)
}
system.out.print(""+x);
}

ANSWER: Compililation fails signed is not keyword

6. Which is the reserved word in jav programming lang

A. method
B. native
C. sublance
D. reference
E. array

ANSWER: B

7. Which class does not orerride the equal and hash coder methods inheriting thisA. java.long.string
B. java.long.double
C. java.long.string buffer
D. java.long.character
E. java.util.arrays

ANSWER: C

8. Which collections class allows you to grow or shrink size and provides indexed access to elements but whose methods are not sync.A. java.util.hashset
B. java.util.linkedhashset
C. java.util.list
D. java.util.Arryalist
E. java.util.vectar

ANSWER: D

9. Which state is true

A. calling runtime.g © will cause objects 1 to be grabage collects
B. the garbge collector uses a marce and sweep alga.
C. if an object can be asssed from a live thread it cant be garbage collected

ANSWER: B & C

9. What is the numerical range of occur

A. -128 to 127
B. -(2^15) to (2^15)-1
C. 0 to 32767
D. platform deiendent
E. 0 to 65535

ANSWER: E

10. What is the most restrictive access modifer that will allow members of one class to have access to membersof another class in same packageA. public
B. abstract
C. protected
D. synchronized
E. defaut acccess

ANSWER: E

11. Given a methed proctected, class what access modifer do you use to restrict access that method to only the other members of the same classA. final
B. static
C. private
D. protected
E. volatile
F. defaut access

ANSWER: C

12. int I= 0
label
if(I<2)
system.out.print("I is" +I);
I++;
continue label


ANSWER: Complution error.

Some imp Java Faq's

1. what’s the difference between an interface and an abstract class?
Ans: Interface is pure abstract class that is all the methods are abstract.
In abstract class all the methods need not be abstract.
2. why would you use a synchronized block vs. synchronized method?3. Explain the usage of the keyboard transient?
4. How can you force garbage collection?
Ans: By using the method runtime.gc()
5. what’s the difference between the method sleep( )and wait( )?
Ans:wait() can be used only for synchronized sleep() is irrespective of it.
6. Can you write a java class that could be used both as an applet as well as an application?Ans:Yes
7. what’s the difference between constructors and other methods?Ans: Constructors don’t have any return type whereas methods have.
8. Can you call one constructor from another if a class has multiple constructors?Ans:Yes using the key word “this”.
9. If a class is located in a package , what do you need to change in the OS environment to be able to use it?Ans:We need to change the “ClassPath” variable
10. what would you use to compare two string variables –the operator= = or the method equals?Ans: “equals” (= = is used to compare # code)
11. Does it matter in what order catch statements for FileNotFoundException and IOexception are written?
Ans:Yes.(super class exception should succeed sub class exception so FileNotFoundException should placed before IOexception)
12. what can go wrong if you replace && with & in the following code:
string a = null: if (a!=null && a. length ()>10){…}
Ans: (&& is logical operator whereas & bitwise operator)
13. How can a subclass call a method or a constructor defined in a superclass?
Ans:Using the super keyword.
14. Can there be an abstract class with no abstract methods in it?Ans:Yes if the clas itself is declared Abstract.
15. Can an interface have be final?Ans: No.If it is final it can’t be implemented at all.
16. Can an interface have an inner class?Ans: Yes.
17. Can we define private and protected modifiers for variables in interface?Ans:No it has to be public
18. What is a local, member and a class variable?19. what does it mean that a method or fields is “static”?
20. what is synchronization and why is it important?21. Is null a keyword?
Ans: No it is the reserved word
22. what is the range of the char type?Ans: ( 0-2^16-1)
23. what is similarities/difference between an abstract class and interface?
24. Explain the user defined exceptions?
25. Differentiate between java and c++?
26. what is a Expression?
27. Is main a keyword in java?
28. If I write system . exit (0); at the end of the try block, will the finally block still execute?
29. what are wrapper classes?
30. what if the static modifier is removed from the signature of the main method?