Friday, February 27, 2009

I/O in Java

To read Float from command line:

import java.util.Scanner;
Scanner s=new Scanner(System.in);
float f=s.nextFloat();

Scanner: To scan the text
System.in: To receive data from standard input stream

Tuesday, February 3, 2009

Load Knoppix In Windows Environment

Here is a small tutorial for how to load knoppix (it works for anyother live cd's) in windows environment.

Required :

1) VMware player
2) Knoppix .iso file , (it works for any live cd)
3) .vmx file 


1)Download  VMware player which is compatible to windows. Here are the links and it is free software.
It is small software used to create Virtual Memory.
Current version is: VMware Player 1.0.3
http://www.vmware.com/download/player/

 2)  You can search Google for knoppix or any type of  live cd’s which is of type .iso. if you have knoppix or any other live cd , create image of it of extension .iso .


 3)  save the below given text into “.vmx “extension file, you can give any name to the file.
Example: knop.vmx, fun.vmx,

config.version = "8"
virtualHW.version = "4"
displayName = "Live CD ISO"
annotation = "Live CD ISO "
guestinfo.vmware.product.long = "Live CD ISO"
guestinfo.vmware.product.url = "http://.com"
guestinfo.vmware.product.short = "LCDI"
guestinfo.vmware.product.version.major = "1"
guestinfo.vmware.product.version.minor = "0"
guestinfo.vmware.product.version.revision = "0"
guestinfo.vmware.product.version.type = "release"
guestinfo.vmware.product.class = "virtual machine"
guestinfo.vmware.product.build = "1.0.0rc8-20051212"
uuid.action = "create"
guestOS = "winxppro"
#####
# Memory
#####
memsize = "126"
# memsize = "256"
# memsize = "512"
# memsize = "768"
#
# Alternative larger memory allocations
#####
# USB
#####
usb.present = "TRUE"
#####
# Floppy
#####
floppy0.present = "FALSE"
#####
# IDE Storage
#####
ide1:0.present = "TRUE"
#Edit line below to change ISO to boot from
ide1:0.fileName = "My_iso.iso"
ide1:0.deviceType = "cdrom-image"
ide1:0.startConnected = "TRUE"
ide1:0.autodetect = "TRUE"
#####
# Network
#####
ethernet0.present = "TRUE"
ethernet0.connectionType = "nat"
# ethernet0.connectionType = "bridged"
#
# Switch these two to enable "Bridged" vs. "NAT"
#####
# Sound
#####
sound.present = "TRUE"
sound.virtualDev = "es1371"
sound.autoDetect = "TRUE"
sound.fileName = "-1"
#####
# Misc.
#
# (normal)  high
priority.grabbed = "high"
tools.syncTime = "TRUE"
workingDir = "."
#
# (16)  32  64
sched.mem.pShare.checkRate = "32"
#
# (32)  64  128
sched.mem.pshare.scanRate = "64"
#
# Higher resolution lockout, adjust values to exceed 800x600
svga.maxWidth = "800"
svga.maxHeight = "600"
#
# (F) T
isolation.tools.dnd.disable = "FALSE"
#
# (F) T
isolation.tools.hgfs.disable = "FALSE"
#
# (F) T
isolation.tools.copy.disable = "FALSE"
#
# (F) T
isolation.tools.paste.disable = "FALSE"
#
# (T) F
logging = "TRUE"
#
#
# (F) T
log.append = "FALSE"
#
# (3) number of older files kept
log.keepOld = "1"
#
# (0) microseconds
keyboard.typematicMinDelay = 1000000
uuid.location = "56 4d 1f 5d c1 12 e8 02-ed e4 b0 ec ac 96 b8 d0"
uuid.bios = "56 4d 1f 5d c1 12 e8 02-ed e4 b0 ec ac 96 b8 d0"
ethernet0.addressType = "generated"
ethernet0.generatedAddress = "00:0c:29:96:b8:d0"
ethernet0.generatedAddressOffset = "0"
checkpoint.vmState = "live-cd-iso.vmss"

tools.remindInstall = "TRUE"



Procedure to load Linux for Newbie’s 

1) Install the VMware player

2) Put .vmx file and .iso in same folder, what ever drive it may be.

3) Change your live cd file name to “My_iso.iso” without quotes.

3) Double click on .vmx file the linux will load in windows environment. 


4) While loading the linux it will ask to choose the resolution by showing some options. Chose one.

5)Enter into Virtual machine mode (press ctrl+G), to come out of it(press ctrl+alt)
This message will show on bottom left corner.


6) Once you are familiar with this and you want to do some more changes, you can proceed to advance users


Procedure for Advance users

1) Follow the above procedure to load Linux live cd from windows environment.

2) Look at the “.vmx”  code , or drag and drop in notepad.

3) # - are used for comments

4) You can change the memory size.
#####
# Memory
#####
memsize = "126"   (Here you can give any value in quotations, below you can see the examples)
# memsize = "256"
# memsize = "512"
# memsize = "768"

5) File name
#####
# IDE Storage
#####
ide1:0.present = "TRUE"
#Edit line below to change ISO to boot from
ide1:0.fileName = "My_iso.iso" (here you can give the .iso file name ,my file name is “My_iso.iso"”)
ide1:0.deviceType = "cdrom-image"
ide1:0.startConnected = "TRUE"
ide1:0.autodetect = "TRUE"

6) Screen resolution
# Higher resolution lockout, adjust values to exceed 800x600
svga.maxWidth = "800"
svga.maxHeight = "600"

Here also you can change your resolution screen.

if load at 800x600 resolution , it will ask again the resolution while loading, choose any option.

If adjust to higher resolution, it will load silently.

7) Network
 
#####
# Network
#####
ethernet0.present = "TRUE"
ethernet0.connectionType = "nat"
# ethernet0.connectionType = "bridged"
#
# Switch these two to enable "Bridged" vs. "NAT"

Here you can change nat or bridged


Tip:

1)You can load more than one Linux depending on your system speed.
Create two .vmx files with different names and double click on both of them. So you can load knoppix and ubantu in different virtual machines. 
Only thing is both the “.iso” and “.vmx “files should be in same directory

2)This method also works in Linux Operation System to load live cd , so you should have VMware player which is compatible to Linux, as usual “.vmx” file changes and don’t ask about it ,I don’t know. If anybody put the “.vmx” which is compatible to Linux I will appreciate your work.

Pros
You can directly close the VMware player ( Come out of Virtual Memory mode by pressing ctrl+alt, and close the VMware Player) . When you restart ,it will resume from where you left off.

Cons
It cannot able to access the other drives.





I will appreciate you guys if you add some more tips to it.

Falconry