Monday, June 30, 2008

Console window appears & immediately disappers on running code

When you run a code, the console window appears and immediately disappears. So you don't get a chance to see the result or enter and user inputs. This happens with some Windows based compilers.
The solution to this problem is to include either of the following statements at the end of your C/C++ code.

getch(); (Press any key to exit)
getchar(); (Press Enter to exit)
getc(stdin); (Press Enter to exit)
fgetc(stdin); (Press Enter to exit)
#include <stdlib.h>
(Not recommended)


#include <stdio.h>
printf("Hello, World");

Online C/C++ compiler:

Wednesday, June 25, 2008

Format drives larger than 32GB using FAT32 in Windows

Microsoft states
"You cannot format a volume larger than 32 gigabytes (GB) in size using the FAT32 file system during the Windows XP installation process. Windows XP can mount and support FAT32 volumes larger than 32 GB (subject to the other limits), but you cannot create a FAT32 volume larger than 32 GB by using the Format tool during Setup. If you need to format a volume that is larger than 32 GB, use the NTFS file system to format it. Another option is to start from a Microsoft Windows 98 or Microsoft Windows Millennium Edition (Me) Startup disk and use the Format tool included on the disk.

NOTE: When you attempt to format a FAT32 partition that is larger than 32 GB during the Windows XP installation process, the format operation fails near the end of the process, and you may receive the following error message:
Logical Disk Manager: Volume size too big."


To format a drive/volume larger than 32GB use the following tools

1. fat32format

1. Download it HERE
2. Extract the fat32format.exe file to somewhere suitable
3. Open command/DOS prompt and navugate to where you extracted fat32format.exe
4. Use the command "fat32format X:" (where "X" is the drive label of the drive)

2. Linux mkdosfs for Windows NT/2K/XP

1. Download it HERE
2. Exctract the downloaded to somewhere
3. Open command/DOS prompt and navigate to "mkdosfs" folder
4. Use the command "mkdosfs -v -F 32 X:"(where "X" is the drive label of the drive)

3. Fat32Formatter

1. Download it HERE
2. Exctract the downloaded to somewhere
3. Run the exe

4. H2Format

1. Download it HERE
2. Exctract the downloaded to somewhere
3. Run the exe

NB: You can also convert a FAT16 volume or a FAT32 volume to an NTFS file system in Windows XP retaining all your data.

Monday, June 23, 2008

Access or Delete folder created when you merge partitions using Partition Magic

When you merge two partitions using Partition Magic you have to create a folder where you have the option to copy all the contents of the partition to be merged. After the partitions have been merged you cannot access that folder or do anything with it.
The reason behind this is Partition Magic reassigns permissions on that folder.
To solve it do the following:-

1. Goto "Start->Settings->Control Panel->Folder Options"
2. Goto View Tab
3. Put a check on "Show hidden files and folders"
4. Uncheck "Use simple file sharing (Recommended)"
5. Right click on the folder that you which to access and select "Properties"
6. Goto Security Tab
7. Click on your user type and select "Full Control" under "Permissions"
8. Click Apply & OK

Now you will be able to access the folder and do whatever you want with it.

Thursday, June 12, 2008

Install boot loaders to MBR of a disk/drive from within Windows/DOS

This tutorial explains the steps to install Syslinux and GRUB to the MBR of a drive to make it bootable.


1. Extract the contents of syslinux to a folder
2. Open command prompt and navigate to the syslinux folder
3. Run "syslinux -sfma X:" [where "X" is the drive letter as seen in Disk Manager]
-s = Safe, slow, stupid; uses simpler code that boots better
-f = Force installing
-m = Mbr; install a bootable MBR sector to the beginning of the drive
-a = Active; marks the partition used active (=bootable)

Download: Link
Faq: Link


Download stable version (grub4dos, grubinst, wingrub): Link
Download latest version (grub4dos): Link1 Link2
Download latest version (grubinst): Link
Faq: Link

grubinst (FreeBSD, Windows NT family OSs (Windows NT/2000/XP/2003/Vista) and Linux)
1. Extract the contents of grubinst to a folder
2. Open command prompt and navigate to the grubinst folder
3. Run "grubinst (hdX)" [where "X" is the disk number as seen in Disk Manager] (DOS, Pre Windows NT family OSs (Windows 95/98/Me) and Linux)
1. Extract the contents of grub4dos to a folder
2. Navigate to the grub4dos folder
3. Run " 0x8Y" [where "0x8Y" is the BIOS drive number(hex 0xHH or decimal DDD), and where "Y" is the disk number as seen in Disk Manager]. It is 0 for the first floppy, 1 for the second floppy; 0x80 for the first hard drive, 0x81 for the second hard drive, etc.

grubinst GUI (Windows NT family OSs (Windows NT/2000/XP/2003/Vista))
1. Run grubinstGUI.exe
2. Select the drive you want to install grub
3. Leave everything as default
3. Click OK

Install gfx enabled grub4dos to the MBR of a drive
1. Download grub-gfx from Here or Here
2. Install grub4dos either using grubinst, grubinst GUI or
3. Delete grldr that was present by default in the drive
4. Copy & paste grldr from the downloaded grub-gfx to the root of the drive
5. Copy & paste menu.lst to the root of the drive
6. Boot

You could also try grub2
Download: Link
Faq: Link

Graphical boot menu with various boot loaders

Boot LoaderConfig FileGraphicsImage/Graphics FileSyntax in Config File
display <path to message.msg>
display=<path to message.msg>
Syslinuxsyslinux.cfg defaultvesamenu.c32display <path to vesamenu.c32>
display=<path to vesamenu.c32>
menu backgroundsplash.c32
menu background <path to *.png>
menu background=<path to *.png>
GRUBmenu.lst splashimage*.xpm.gzgfxmenu <path to *.xpm.gz>
gfxmenu=<path to *.xpm.gz>
gfxmenumessage (cpio)gfxmenu <path to message>
gfxmenu=<path to message>
gfxbootbootlogo (cpio)gfxboot <path to bootlogo>
gfxboot=<path to bootlogo>
LILOlilo.conf bitmap*.bmpbitmap <path to *.bmp>
bitmap=<path to *.bmp>
messagemessage (pcx)message <path to message>
message=<path to message>

Image Constraints

Boot LoaderImage SizeNo of ColorsFile Size
LILO640 x 480 pixels255??
GRUB640 x 480 pixels255??
Syslinux640 x 480 pixels255??
Isolinux640 x 480 pixels255??

Saturday, June 7, 2008

My Linux Notes

Frequently used commands
cat /proc/asound/modules
cat /proc/asound/cards
aplay -l
chmod a+rwx
rpm -qpil {filename}.rpm
./configure && make
make install
modprobe {modulename}
Untar commands
tar -yxf {filename}.tar.bz2
tar -xvf {filename}.tar
tar -xvzf {filename}.tar.gz
tar -lxvf
tar -jxvf
Program to remove application in Slackware based distros
Program to convert tgz to lzm
Installing and uninstalling a program
sudo apt-get install {programname}
sudo apt-get remove {programname}
sudo apt-get --purge remove {programname}
sudo apt-get autoremove {programname}
Path to firefox
Path to fonts
Grub Install
sudo grub
device (hd3) /dev/sda
root (hd3,0)
setup (hd3)
Realplayer Issue
Embedded Realmedia doesn't work with Firefox. The pop-up player opens and keeps loading for ever, but never starts to play.
Path to Realplayer
Open realplayer executable from 
in text editor and edit the following line
"REALPLAYBIN="/usr/bin/aoss $HELIX_LIBS/realplay.bin"
Then run the command

Choppy audio I am experiencing choppy audio/video or no audio at all. How do i fix this? RealPlayer currently uses OSS to output sound to the speakers from the sound card. ALSA is an alternative that does the same job for applications in a slighty better way. AOSS is a script for OSS emulation through ALSA. You will need to install the RPM for alsa-oss through Yast or from your media if available. Once you've done that, launch RealPlayer using the following syntax

/usr/bin/aoss RealPlayer.

To make this change permanent, open /usr/bin/realplay in your favorite text editor (an example i use is vi)
vi /usr/bin/realplay

Locate the section in the file that has the following line of text:
REALPLAYBIN=$HELIX_LIBS/realplay.bin and replace it with REALPLAYBIN="/usr/bin/aoss $HELIX_LIBS/realplay.bin" Q. How do i uninstall RealPlayer? Uninstalling an RPM RealPlayer installation: To uninstall, run the following command as root: rpm -e RealPlayer Uninstalling a BIN RealPlayer installation: To uninstall, download and run the following script:
The uninstaller script is currently unsupported. Use it at your own risk. No Audio Issue
Scroll using the right arrow key to "External Amplifier". Mute or Unmute using the "M" button in keyboard.

sudo convert -resize 640×480 -colors 14 7samurai1.jpg splashimage.xpm
sudo gzip splashimage.xpm

convert -resize 640×480 -colors 14 wallpaper.png splashimage.xpm && gzip splashimage.xpm

convert -resize 640x480 -colors 14 wallpaper.png splashimage.xpm && gzip splashimage.xpm