C,C++/JAVA/BASH/ASM ARENA

वह प्रदीप जो दीख रहा है झिलमिल दूर नही है थक कर बैठ गये क्या भाई मन्जिल दूर नही है चिन्गारी बन गयी लहू की बून्द गिरी जो पग से चमक रहे पीछे मुड देखो चरण-चिनह जगमग से बाकी होश तभी तक, जब तक जलता तूर नही है थक कर बैठ गये क्या भाई मन्जिल दूर नही है अपनी हड्डी की मशाल से हृदय चीरते तम का, सारी रात चले तुम दुख झेलते कुलिश का। एक खेय है शेष, किसी विध पार उसे कर जाओ; वह देखो, उस पार चमकता है मन्दिर प्रियतम का। आकर इतना पास फिरे, वह सच्चा शूर नहीं है; थककर बैठ गये क्या भाई! मंज़िल दूर नहीं है। दिशा दीप्त हो उठी प्राप्त कर पुण्य-प्रकाश तुम्हारा, लिखा जा चुका अनल-अक्षरों में इतिहास तुम्हारा। जिस मिट्टी ने लहू पिया, वह फूल खिलाएगी ही, अम्बर पर घन बन छाएगा ही उच्छ्वास तुम्हारा। और अधिक ले जाँच, देवता इतन क्रूर नहीं है। थककर बैठ गये क्या भाई! मंज़िल दूर नहीं है।

Implementing Raid on PenDrive May 20, 2010

Filed under: LINUX — whoami @ 11:00
Tags: ,

Just like USB hard drive , we can implemnt RAID (level 0 or 1 )in LINUX in Pendrive
Here is the implementation details on my system
[root@localhost ~]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0xa515f612.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won’t be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): d
No partition is defined yet!

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1024, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-1024, default 1024): 300

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (301-1024, default 301): 500
Last cylinder, +cylinders or +size{K,M,G} (500-1024, default 1024): ^C
[root@localhost ~]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x96275f3e.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won’t be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): p

Disk /dev/sdb: 4063 MB, 4063232000 bytes
125 heads, 62 sectors/track, 1024 cylinders
Units = cylinders of 7750 * 512 = 3968000 bytes
Disk identifier: 0x96275f3e

Device Boot Start End Blocks Id System

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1024, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-1024, default 1024): 300

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (301-1024, default 301):
Using default value 301
Last cylinder, +cylinders or +size{K,M,G} (301-1024, default 1024): 506

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 3
First cylinder (507-1024, default 507):
Using default value 507
Last cylinder, +cylinders or +size{K,M,G} (507-1024, default 1024): 800

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Selected partition 4
First cylinder (801-1024, default 801):
Using default value 801
Last cylinder, +cylinders or +size{K,M,G} (801-1024, default 1024):
Using default value 1024

Command (m for help): p

Disk /dev/sdb: 4063 MB, 4063232000 bytes
125 heads, 62 sectors/track, 1024 cylinders
Units = cylinders of 7750 * 512 = 3968000 bytes
Disk identifier: 0x96275f3e

Device Boot Start End Blocks Id System
/dev/sdb1 1 300 1162469 83 Linux
/dev/sdb2 301 506 798250 83 Linux
/dev/sdb3 507 800 1139250 83 Linux
/dev/sdb4 801 1024 868000 83 Linux

Command (m for help): t
Partition number (1-4): 1
Hex code (type L to list codes): fd
Changed system type of partition 1 to fd (Linux raid autodetect)

Command (m for help): t
Partition number (1-4): fd
Partition number (1-4): 2
Hex code (type L to list codes): fd
Changed system type of partition 2 to fd (Linux raid autodetect)

Command (m for help): t
Partition number (1-4): 3
Hex code (type L to list codes): fd
Changed system type of partition 3 to fd (Linux raid autodetect)

Command (m for help): t
Partition number (1-4): 3
Hex code (type L to list codes): fd

Command (m for help): t
Partition number (1-4): 4
Hex code (type L to list codes): fd
Changed system type of partition 4 to fd (Linux raid autodetect)

Command (m for help): p

Disk /dev/sdb: 4063 MB, 4063232000 bytes
125 heads, 62 sectors/track, 1024 cylinders
Units = cylinders of 7750 * 512 = 3968000 bytes
Disk identifier: 0x96275f3e

Device Boot Start End Blocks Id System
/dev/sdb1 1 300 1162469 fd Linux raid autodetect
/dev/sdb2 301 506 798250 fd Linux raid autodetect
/dev/sdb3 507 800 1139250 fd Linux raid autodetect
/dev/sdb4 801 1024 868000 fd Linux raid autodetect

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@localhost ~]# mdadm –create –verbose /dev/md0 –level=0 –raid-devices=2 /dev/sdb1 /dev/sdb2
mdadm: chunk size defaults to 64K
mdadm: array /dev/md0 started.
[root@localhost ~]# mdadm –create –verbose /dev/md0 –level=1 –raid-devices=2 /dev/sdb3 /dev/sdb4
mdadm: size set to 867904K
mdadm: largest drive (/dev/sdb3) exceeds size (867904K) by more than 1%
Continue creating array? y
mdadm: /dev/md0 is already in use.
[root@localhost ~]# mdadm –create –verbose /dev/md1 –level=1 –raid-devices=2 /dev/sdb3 /dev/sdb4
mdadm: size set to 867904K
mdadm: largest drive (/dev/sdb3) exceeds size (867904K) by more than 1%
Continue creating array? y
mdadm: array /dev/md1 started.
[root@localhost ~]# mkfs.ext3 /dev/md0
mke2fs 1.41.9 (22-Aug-2009)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
122640 inodes, 490128 blocks
24506 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=503316480
15 block groups
32768 blocks per group, 32768 fragments per group
8176 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912

Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 25 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@localhost ~]# mkfs.ext3 /dev/md1
mke2fs 1.41.9 (22-Aug-2009)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
54320 inodes, 216976 blocks
10848 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=222298112
7 block groups
32768 blocks per group, 32768 fragments per group
7760 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840

Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 21 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.

 

kill any process Forcibly in Unix March 18, 2010

Filed under: fedora,LINUX,Top Coder,TOPCODER — whoami @ 19:18
Tags: , , ,

Often it happens that some programs hangs and it doesnot close by clicking the “X ” button.In that case we can use “$kill ” command to kill the process.”$Kill” has several options attached with it. To kill something forcibly we use “-9” option. I show u some example.
——————
step1:->
$ps -a
-> this will list all process (but not that which runs in the background)
$ps -e
->this will list all process , evem those that runs in the background

—————————————
step2->
Now that we have listed the process by above two methods, chose the “pid” of that process which u want to kill
$kill “pidnumber”
->where pidnumber is the one u noted from above which u want to stop.
**this may not kill some process. So for this use -9 option
$kill -9 “pidnumber”
-> now ur required process will be closed
———————————–
Actually sometimes while using TopCoder Arena, the applet didnot closes or it Hangs, To stop it either i has to restart the system or i had to log off and then log in. Now through theses commnads with -9 option i can close it.
sample:->

[abc@localhost ~]$ ps 
  PID TTY          TIME CMD
 3564 pts/0    00:00:00 bash
 3857 pts/0    00:00:00 ps
[abc@localhost ~]$ ps -a
  PID TTY          TIME CMD
 3858 pts/0    00:00:00 ps
[abc@localhost ~]$ ps -e
  PID TTY          TIME CMD
    1 ?        00:00:00 init
    2 ?        00:00:00 kthreadd
    3 ?        00:00:00 migration/0
    4 ?        00:00:00 ksoftirqd/0
    5 ?        00:00:00 watchdog/0
    6 ?        00:00:00 migration/1
    7 ?        00:00:00 ksoftirqd/1
    8 ?        00:00:00 watchdog/1
    9 ?        00:00:01 events/0
   10 ?        00:00:00 events/1
   11 ?        00:00:00 cpuset
   12 ?        00:00:00 khelper
   13 ?        00:00:00 netns
   14 ?        00:00:00 async/mgr
   15 ?        00:00:00 kintegrityd/0
   16 ?        00:00:00 kintegrityd/1
   17 ?        00:00:00 kblockd/0
   18 ?        00:00:00 kblockd/1
   19 ?        00:00:00 kacpid
   20 ?        00:00:00 kacpi_notify
   21 ?        00:00:00 ata/0
   22 ?        00:00:00 ata/1
   23 ?        00:00:00 ata_aux
   24 ?        00:00:00 ksuspend_usbd
   25 ?        00:00:00 khubd
   26 ?        00:00:00 kseriod
   27 ?        00:00:00 khungtaskd
   28 ?        00:00:00 pdflush
   29 ?        00:00:00 pdflush
   30 ?        00:00:00 kswapd0
   31 ?        00:00:00 aio/0
   32 ?        00:00:00 aio/1
   33 ?        00:00:00 crypto/0
   34 ?        00:00:00 crypto/1
   40 ?        00:00:00 scsi_eh_0
   41 ?        00:00:00 scsi_eh_1
   43 ?        00:00:00 kpsmoused
   44 ?        00:00:00 kstriped
   45 ?        00:00:00 ksnapd
   46 ?        00:00:00 usbhid_resumer
   69 ?        00:00:00 kdmflush
   70 ?        00:00:00 kdmflush
   71 ?        00:00:00 kjournald2
   80 ?        00:00:00 kauditd
  158 ?        00:00:00 udevd
  776 ?        00:00:00 kmmcd
  795 ?        00:00:00 tifm
  863 ?        00:01:23 phy0
  894 ?        00:00:00 pccardd
  989 ?        00:00:00 hd-audio0
 1063 ?        00:00:00 kmpathd/0
 1064 ?        00:00:00 kmpathd/1
 1065 ?        00:00:00 kmpath_handlerd
1093 ?        00:00:00 kjournald
 1179 ?        00:00:00 kondemand/0
 1180 ?        00:00:00 kondemand/1
 1212 ?        00:00:00 auditd
 1214 ?        00:00:00 audispd
 1215 ?        00:00:00 sedispatch
 1239 ?        00:00:00 rsyslogd
 1262 ?        00:00:00 rpcbind
 1281 ?        00:00:03 dbus-daemon
 1291 ?        00:00:00 avahi-daemon
 1292 ?        00:00:00 avahi-daemon
 1301 ?        00:00:00 cupsd
 1322 ?        00:00:00 acpid
 1330 ?        00:00:01 hald
 1333 ?        00:00:00 console-kit-dae
 1334 ?        00:00:00 hald-runner
 1424 ?        00:00:04 hald-addon-inpu
 1442 ?        00:00:00 hald-addon-gene
 1458 ?        00:00:00 hald-addon-cpuf
 1459 ?        00:00:00 hald-addon-acpi
 1475 ?        00:00:00 pcscd
 1489 ?        00:00:00 NetworkManager
 1495 ?        00:00:00 nm-system-setti
 1499 ?        00:00:00 wpa_supplicant
 1507 ?        00:00:00 rpc.statd
 1533 ?        00:00:00 rpciod/0
 1536 ?        00:00:00 rpciod/1
 1543 ?        00:00:00 rpc.idmapd
 1551 ?        00:00:00 bluetoothd
 1565 ?        00:00:00 bluetooth
 1578 ?        00:00:00 sshd
 1618 ?        00:00:00 gpm
 1629 ?        00:00:00 crond
 1640 ?        00:00:00 atd
 1648 ?        00:00:00 gdm-binary
 1649 tty4     00:00:00 mingetty
 1650 tty5     00:00:00 mingetty
 1651 tty2     00:00:00 mingetty
 1652 tty3     00:00:00 mingetty
 1653 tty6     00:00:00 mingetty
 1694 ?        00:00:00 gdm-simple-slav
 1695 tty1     00:05:29 Xorg
 1724 ?        00:00:00 dbus-launch
 1772 ?        00:00:00 sendmail
 1773 ?        00:00:00 sendmail
 1840 ?        00:00:01 devkit-power-da
 1842 ?        00:00:00 devkit-daemon
 1895 ?        00:00:00 gdm-session-wor
 1920 ?        00:00:00 gnome-keyring-d
 1934 ?        00:00:00 gnome-session
 1949 ?        00:00:00 dbus-launch
 1951 ?        00:00:00 dbus-daemon
 2032 ?        00:00:02 gconfd-2
 2037 ?        00:00:00 gnome-settings-
 2050 ?        00:00:04 metacity
 2055 ?        00:00:24 pulseaudio
 2056 ?        00:00:02 gnome-panel
 2059 ?        00:00:00 gconf-helper
 2061 ?        00:00:00 gvfsd
 2073 ?        00:00:00 gvfs-fuse-daemo
 2077 ?        00:00:02 nautilus
 2079 ?        00:00:00 bonobo-activati
 2084 ?        00:00:00 seapplet
 2085 ?        00:00:00 nm-applet
 2086 ?        00:00:00 bluetooth-apple
 2090 ?        00:00:00 python
 2091 ?        00:00:00 notification-da
 2093 ?        00:00:00 gnome-volume-co
 2096 ?        00:00:00 im-settings-dae
 2098 ?        00:00:00 kerneloops-appl
 2105 ?        00:00:01 gpk-update-icon
 2116 ?        00:00:01 gnome-power-man
 2129 ?        00:00:02 kerneloops
 2314 ?        00:00:00 gconf-im-settin
 2348 ?        00:00:00 gvfsd-trash
 2351 ?        00:00:00 gvfs-gdu-volume
 2353 ?        00:00:01 devkit-disks-da
 2354 ?        00:00:00 devkit-disks-da
 2364 ?        00:00:00 trashapplet
 2365 ?        00:00:03 wnck-applet
 2368 ?        00:00:00 gvfs-gphoto2-vo
 2373 ?        00:00:01 clock-applet
 2377 ?        00:00:01 tomboy
 2378 ?        00:00:00 notification-ar
 2380 ?        00:00:00 gdm-user-switch
 2388 ?        00:00:00 gvfsd-burn
 2398 ?        00:00:00 run-mozilla.sh
 2413 ?        00:04:51 firefox
 2432 ?        00:00:01 gnome-screensav
 2753 ?        00:00:02 gedit
 3562 ?        00:00:00 gnome-terminal
 3563 ?        00:00:00 gnome-pty-helpe
 3564 pts/0    00:00:00 bash
 3718 ?        00:00:01 javaws ->this is TopCoder application running
 3763 ?        00:00:18 javaws->--do--
 3860 pts/0    00:00:00 ps
[abc@localhost ~]$ kill -9 3718
[abc@localhost ~]$ kill -9 3763
[abc@localhost ~]$ kill -9 2413
[abc@localhost ~]$ ps -e


 

Execute .jar file on Double Click -Linux March 2, 2010

Filed under: JAVA,LINUX,Top Coder — whoami @ 09:08
Tags: , ,

Read this link.

Actually u have to change 2 things- in properties of .jar file-
1. set the permission to run it as a program
2.then open with – use custom command , there find the location of jexec and press open.
Now ur file directly open with this jexec command after pressing double click…..
I am using it run The Editors for TopCoder
Thanks

 

CLearing Search History from Ktorrent February 8, 2010

Filed under: fedora,LINUX — whoami @ 16:54
Tags: ,

This facility is not available in ktorrent that comes bundled with fedora.

so how to delete search history from ktorrent ?
=> U can proceed this way
command
[1](root mode)#gedit /home/username/.kde/share/apps/ktorrent/search_history

[2]Now here delete the history from here

Thanks….

 

How to unlock yum in fedora February 7, 2010

Filed under: fedora,LINUX — whoami @ 18:46
Tags: , ,

are u trying to install something on feodra and command “yum install something” displays
that “yum is currently busy with other application”.
—>Then u need to kill or remove that peocess from this file
1.check for pid that yum in busy with.
2. check file #gedit /var/run/yum.pid
(i) U can delete that pid number from file. This will Unlock yum
Now u can use yum

 

Compile Linux kernel fedora 11 January 26, 2010

Filed under: fedora,LINUX — whoami @ 09:10
Tags: , ,

steps:-

[1] download kernel from kernel.org
now u have linux-2.6.X.tar.gz or linux-2.6.X.tar.bz2 in home folder
[3]$tar tar zxvf linux-2.6.x.tar.gz
[4]$cd linux-2.6.x
[5]$make defconfig
it will take less than 5 minutes
note**- if u use defconfig, it will take very less around 30 minutes to complete the whole process.

but i issued $make oldconfig, and the whole compilation and making modules took around 2.30 hrs.

u can use and experiment with:
$make xconfig
[6]$make bzImage
this will take around 20 minutes
[7]$make modules
if u used defconfig, then it may take 1 or 2 minutes.
But i used oldconfig, and it tool 1.20 hrs to make modules
COMPILATION AND MODULES COMPILING IS COMPLETE NOW

[8]$make modules_install
This step may deny permission
so make entry in root mode mode
$su –
password
$cd /home/username
$cd linux-2.6.x
$make modules_install

same thing happened as i discussed in step 7
[9]$ mkinitrd /boot/initrd-2.6.x.img 2.6.x
[10] $ cp arch/i386/boot/bzImage /boot/bzImage-KERNEL_VERSION
$ cp System.map /boot/System.map-KERNEL_VERSION
$ ln -s /boot/System.map-KERNEL_VERSION /boot/System.map
follow this link
[11]$cp cp .config /boot/config-2.6.x
[12]cp arch/i386/boot/bzImage /boot/vmlinuz-2.6.29
[13]now edit grub.conf
$gedit /boot/grub/menu.lst
edit it as written in link
my grub.conf is below after editing, though its not booting
———————————–
my grub.conf
——————————-
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,8)
# kernel /vmlinuz-version ro root=/dev/mapper/VolGroup-lv_root
# initrd /initrd-version.img
#boot=/dev/sda
default=0
timeout=20
splashimage=(hd0,8)/grub/splash.xpm.gz
hiddenmenu
title Fedora (2.6.30.9-96.fc11.i686.PAE)
root (hd0,8)
kernel /vmlinuz-2.6.30.9-96.fc11.i686.PAE ro root=/dev/mapper/VolGroup-lv_root rhgb quiet
initrd /initrd-2.6.30.9-96.fc11.i686.PAE.img
title Fedora (2.6.30.9-90.fc11.i686.PAE)
root (hd0,8)
kernel /vmlinuz-2.6.30.9-90.fc11.i686.PAE ro root=/dev/mapper/VolGroup-lv_root rhgb quiet
initrd /initrd-2.6.30.9-90.fc11.i686.PAE.img
title Fedora (2.6.30.8-64.fc11.i686.PAE)
root (hd0,8)
kernel /vmlinuz-2.6.30.8-64.fc11.i686.PAE ro root=/dev/mapper/VolGroup-lv_root rhgb quiet
initrd /initrd-2.6.30.8-64.fc11.i686.PAE.img
title Test Kernel (2.6.29)
root (hd0,8)
kernel /vmlinuz-2.6.29 ro root=/dev/mapper/VolGroup-lv_root rhgb quiet
initrd /boot/initrd-2.6.29.img

title Xp
rootnoverify (hd0,0)
chainloader +1
===================================
Though this kernel is not booting, i will try to fix it soon

Thanks
njoooy linuxxxxxxxxx

 

Linux logging problems &Solutions January 20, 2010

Filed under: fedora,LINUX — whoami @ 20:13
Tags: , ,

[1]Get access of root by:
adding a line to kernel line- write “single” then press “enter” to save and then press “b” to boot.
follow
U will directly enter into command line as root . Now u can change the root password by:
$passwd

[2]Now suppose u forgot the passwords of users Or in some version of linux U cannot graphically boot as root. Then u can do following things:-

**Add new users and their password** for this :
root#adduser -m username -ppass
root#passwd username
follow this link

***to graphically boot for root*** do as:-
#vi /etc/pam.d/gdm
and comment “#” one line
follow this link

 

Removing Installed Packages(Fedora) January 12, 2010

Filed under: fedora,LINUX — whoami @ 10:22
Tags: ,

Search for the all installed packages first:-
$ rpm -qa
this will display the installed packages

Today i remove oracle 10g to free the space by issuiing:
$yum erase oracle-xe-univ-10.2.0.1-1.0.i386

i got around 1.5 gb freed.

 

Linux-kernel Statistics October 18, 2009

Filed under: LINUX — whoami @ 11:51
Tags:

Visit

 

Linux kernel Map October 11, 2009

Filed under: LINUX — whoami @ 05:37
Tags:

 

Linus October 9, 2009

Filed under: LINUX — whoami @ 16:50
 

17 Yrs of linux

Filed under: LINUX — whoami @ 16:37
Tags: