Monday, February 25, 2013

How to maximize the Windows Remote Desktop viewer

Suddenly  I started facing this issue that my Remote Desktop viewer is not maximizing. I don't know the root cause, may be some how the resolution of RDP viewer changed to less resolution. It is so annoying to work in the limited size !!! Always you have to scroll down/up to view properly.

The solution is very simple.

1. Open your Remote Desktop Connection dialog box (run -> mstsc).
2. There in the left hand down corner Click Options
3.  Now click the Display tab and pull the slider to max to get the Full Screen option

You are done ! Now connect.

Friday, February 8, 2013

How to create a Windows 7, Windows 8 bootable USB/Pendrive

There are lots of guidance you can get from google to make a bootable USBdrive. But be careful ! They can lead you to a corrupted OS or USB drive.

This procedure is safe and you can install Windows faster than discs and without any hassles.

Requirements:

1. USB Drive (Minimum 4GB)
2. Windows installation files. You can copy this files in your machine from the windows CD/DVD.

Procedure:

1. Go to Start menu > All programs > Accessories, right click on Command Prompt and select Run as
administrator.

2. Now type the following commands one by one
 
You will now enter into the DISKPART utility.
    i)  DISKPART 

Now note down the Disk number (eg: Disk 2) of your USB flash drive. In the below screenshot my Flash Drive Disk no is Disk 2.
    ii) LIST DISK

Select your USB disk
   iii) SELECT DISK 2

Clean the disk
   iv) CLEAN

Create a primary partition in the USB drive
   v) CREATE PARTITION PRIMARY

Now select the partition
   vi) SELECT PARTITION 1 

Make the partition as active

   vii) ACTIVE

Attention: This process can take almost an hour to format depending upon the size of the USB drive. Better right click on the USB drive and select NTFS and Quick format. And don't execute command no. viii)
   viii) FORMAT FS=NTFS





After completing FORMAT now Assign it and exit from DISKPART utility
   ix) ASSIGN
   x)  EXIT 



Now you'll again come back to C:\Windows\system32>. Don't close the Command prompt just minimize it.

3. Now the actual location of the Windows installer files could be a CD/DVD or it can be in your Local Disk)
I assume it is in CD/DVD and the drive then the path should look like F:\boot (Drive can be anything D, E as per your machine)
Or if it is in Local disk then I assume the path  looks like :   D:\<windows7 folder>\boot 

4.  Now again maximize the command prompt. and got to the \boot  folder location


     C:\Windows\system32> cd F:\boot
     F:\boot> bootsect.exe /NT60 G:

Where G: is your USB drive letter (in my case). We are actually updating the USB drive with the BOOTMGR. 


5. Now Copy the Windows installer files in the USB drive.


Your Bootable USB drive is now ready. From BIOS change the boot order to USB and install Windows.

Thursday, February 7, 2013

How to undo a sent mail from Gmail

Oooopss !!! sent a mail to wrong person ? Don't worry there is a option to undo the sent message within maximum 30 second. 
1. In your Gmail account click the gear icon  in the upper right, then select Settings
2. Select the 'Labs' tab and identify the labs you want to enable. Click the 'Enable' radio button to turn on a lab (Undo Send ) and click 'Save Changes' at the bottom of the page. Your page may refresh but after the refresh, the lab you just turned on will be available in Gmail.

You can also set the time to undo the sent message. Maximum is 30 second.

Delete .lock files faster than SVN commands


A lock file used to generate in the .svn directory if any fatal error occurs during any SVN operations.  So there can be thousands of directories and sub directories inside that. The .lck file will be generated in all the .svn folder for all the directories and sub directories.

You can simply use SVN GUI (right click on the parent folder and clean) or command line (svn cleanup) arguments to clean up the lock file. But if your code is very large i.e if number of nested directories and sub directories is huge then most of the time the cleanup process becomes unresponsive.

In windows simply open the parent directory from command prompt and delete the lock files by giving this command:

del /s lock

Where del is to delete the lock file and /s to delete all the lock file in the sub directories.

Actual location of static variables in Java


Static variable is allocated for the entire duration of program's execution, so neither stack nor heap are convenient for it. Static fields are initialized when a class is loaded and and are discarded when the class loader for that class is unloaded.
The memory is allocated at the start of the program, in regular memory, instead of the stack . The advantage of this is that it makes your variable or procedure totally constant, and you can't accidentally change the value. The disadvantage of this is that the memory is not deallocated until the program is terminated.

Maximum size of a method in Java


The maximum size of a method in java is 64k. If it exceeds, we'll get a compiler warning like "Code too large to compile" . It's not a bug but known limitation found in Java 1.3. It was requested as an enhancement on 12-Aug-1999 by the engineers of Sun Microsystem. The information was updated on 09-Oct-2012 but there is no news so far that the issue is fixed or not.

Have a look at this http://bugs.sun.com/view_bug.do?bug_id=4262078 

In well structured code, each method is a manageable length and is much smaller than this limit. Large pieces of data, to be loaded into arrays, can be read from a non Java files like a text or binary file.

But  the 64KB limit is only a problem for generated code especially  when initializing large arrays.

Monday, February 4, 2013

GUI is not coming in SuSE Linux, only CLI

I faced this weird problem in my SuSE Linux machines. After booting only the CLI is coming instead of GUI. So to bring back the GUI as a root user type: sax2 -m 0=vesa

After that a GUI window will appear and will ask you to manage the resolution. Change that according to your need and reboot.

BINGO !!!

Eclipse Error : Failed to load JNI shared library



You are facing this error means eclipse is not able to locate the jvm.dll so check the <Java installation dir>/jdkxxx/jre/bin/server/jvm.dll path is proper or not. Also check the Java path settings.
 If you google for it, then you can get some solutions but they are confusing and might not work for all machines. 

But in the most cases you can face this problem if your eclipse is 32 bit and you have installed a 64 bit Java. I have many applications which required a 64 bit Java so I upgraded it from 32 to 64 bit without knowing that my eclipse is 32 bit. So I got this error. Now you can't change the Java path for 32 bit Java, because other applications are using 64 bit Java.

Solution:

Step 1:
Install both 32 bit and 64 bit Java . Set the environment varibale path for 64 bit Java So that all other applications can use it. Now right click on the eclipse shortcut icon and click Properties In the Target text field add the jvm.dll location with the -vm arg. So It should look like this :

Target:
"D:\eclipse_indigo\eclipse\eclipse2.exe" -vm "C:\eclipseJava7\jdk1.7.0_13\jre\bin\server\jvm.dll"

Step 2:
Now click Open file location and edit the eclipse.ini file with the same -vm arg and its value. Given below is my eclipse.ini
-startup
plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.100.v20110502
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
1024m
--launcher.defaultAction
openFile
-vm
C:\eclipseJava7\jdk1.7.0_13\jre\bin\server\jvm.dll
-vmargs
-Xms512m
-Xmx1024m

So now your eclipse will use the 32 bit Java and all other applications will use 64 bit java as it is set as the Java path.