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)
or
getchar(); (Press Enter to exit)
or
getc(stdin); (Press Enter to exit)
or
fgetc(stdin); (Press Enter to exit)
or
#include <stdlib.h>
system("pause");
(Not recommended)

Example

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


Online C/C++ compiler: http://www.techbugs.org/wiki/OnlineCompiler

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."

Ref: http://support.microsoft.com/kb/314463

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

1. fat32format

Steps:
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

Steps:
1. Download it HERE
2. Exctract the downloaded mkdosfs.zip 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

Steps:
1. Download it HERE
2. Exctract the downloaded Fat32FormatterEN.zip to somewhere
3. Run the exe

4. H2Format

Steps:
1. Download it HERE
2. Exctract the downloaded h2format.zip 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.
Read HERE

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:-

Steps:
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.

Syslinux

Steps:
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

grub4dos

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

Commandline
grubinst (FreeBSD, Windows NT family OSs (Windows NT/2000/XP/2003/Vista) and Linux)
Steps:
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]

bootlace.com (DOS, Pre Windows NT family OSs (Windows 95/98/Me) and Linux)
Steps:
1. Extract the contents of grub4dos to a folder
2. Navigate to the grub4dos folder
3. Run "bootlace.com 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.

GUI
grubinst GUI (Windows NT family OSs (Windows NT/2000/XP/2003/Vista))
Steps:
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
Steps:
1. Download grub-gfx from Here or Here
2. Install grub4dos either using grubinst, grubinst GUI or bootlace.com
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
Isolinuxisolinux.cfgdisplaymessage.msg/boot.msg
or
splash.lss
display <path to message.msg>
or
display=<path to message.msg>
Syslinuxsyslinux.cfg defaultvesamenu.c32display <path to vesamenu.c32>
or
display=<path to vesamenu.c32>
menu backgroundsplash.c32
or
*.png
or
*.jpg
menu background <path to *.png>
or
menu background=<path to *.png>
GRUBmenu.lst splashimage*.xpm.gzgfxmenu <path to *.xpm.gz>
or
gfxmenu=<path to *.xpm.gz>
gfxmenumessage (cpio)gfxmenu <path to message>
or
gfxmenu=<path to message>
gfxbootbootlogo (cpio)gfxboot <path to bootlogo>
or
gfxboot=<path to bootlogo>
LILOlilo.conf bitmap*.bmpbitmap <path to *.bmp>
or
bitmap=<path to *.bmp>
messagemessage (pcx)message <path to message>
or
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
mount 
umount
autoexec=xconf;kdm
./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
pkgtool
removepkg
Program to convert tgz to lzm
tgz2lzm
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
/usr/lib/mozilla
/usr/lib/firefox
/usr/lib/mozilla-firefox
Path to fonts
/usr/local/share/fonts
Grub Install
sudo grub
device (hd3) /dev/sda
root (hd3,0)
setup (hd3)
quit
sync
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
/usr/local/Realplayer
Open realplayer executable from 
/usr/local/bin/realplay
in text editor and edit the following line
"REALPLAYBIN="/usr/bin/aoss $HELIX_LIBS/realplay.bin"
LD_PRELOAD="$LDPRELOAD:/usr/lib/libaoss.so"
export LD_PRELOAD
Then run the command
sh postinst.sh

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: https://player.helixcommunity.org/2005/downloads/uninst.sh
The uninstaller script is currently unsupported. Use it at your own risk. No Audio Issue
Type
alsamixer
Scroll using the right arrow key to "External Amplifier". Mute or Unmute using the "M" button in keyboard.

/usr/bin/aoss
audio/x-pm-windows-acm
audio/x-wav
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


http://www.slax.org/forum.php?action=view&parentID=8629