cscope -b
Monday, January 10, 2011
Cscope commands to build database
cscope -b
Thursday, April 29, 2010
NFS a Remote File System on Solaris
You must be logged into Solaris as the root user account.
The syntax to mount a remote file system using NFS is as follows:
mount -F nfs <remote file system> <mount point>The following example will mount the file system /share2 located on the host cartman to the mount point /cartman:
<b>mount -F nfs cartman:/share2 /cartman</b>
Source: http://www.idevelopment.info/data/Unix/Solaris/SOLARIS_NFSaRemoteFileSystemonSolaris.shtml

Thursday, December 17, 2009
How to mount a CD ROM in Solaris
ls -al /dev/sr* |awk '{print "/" $11}'
This command returns the name of the CD-ROM device. In this example, the command returns the string /dev/dsk/c0t6d0s2.
Enter the following commands to mount the CD-ROM:
mkdir -p /cdrom/unnamed_cdrom
mount -F hsfs -o ro /dev/dsk/c0t6d0s2 /cdrom/unnamed_cdrom
where /dev/dsk/c0t6d0s2 represents the name of the device that was returned in the preceding step and /cdrom/unnamed_cdrom represents the CD-ROM 3 mount directory.

Monday, October 12, 2009
Funny Linux
cat: can't open food in cans
% nice man woman
No manual entry for woman.
% "How would you rate Quayle's incompetence?
Unmatched ".
% Unmatched ".
Unmatched ".
% [Where is Jimmy Hoffa?
Missing ].
% ^How did the sex change operation go?^
Modifier failed.
% If I had a ( for every $ the Congress spent, what would I have?
Too many ('s.
% make love
Make: Don't know how to make love. Stop.
% sleep with me
bad character
% got a light?
No match.
% man: why did you get a divorce?
man:: Too many arguments.
% !:say, what is saccharine?
Bad substitute.
% %blow
%blow: No such job.
% \(-
(-: Command not found.
$ PATH=pretending! /usr/ucb/which sense
no sense in pretending!
$ drink matter
matter: cannot create
Source: Gizmodo

Friday, September 25, 2009
How to open port 80/http and 443/https on Fedora Core 10
Login as root
# vi /etc/sysconfig/iptables
Add these lines
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT
Restart iptables
# /etc/init.d/iptables restart

Wednesday, August 12, 2009
Ignore Ctrl-C in perl and shell scripts
Add to code :
$SIG{'INT'} = 'IGNORE';
Shell scripts
Add to code :
trap "" 1 2 3 15
Simple Logging in Perl
Set a Logging Variable
my $logging=1
Conditionally Open and Close the Logfile
At the earliest reasonable time, open the logfile in append mode:if($logging){open FILE , ">>./my.log";}At the latest possible time, close the logfileif($logging){close FILE};Don'tforget to close the logfile as part of your error handling routines as
well. Perl cleans things up nicely for you, but there are always
exceptions to those kinds of rules.
Logging Subroutine
A simple subroutine to enable logging as follows:sub logit{
if ($logging){
print FILE "$_[0]\n";
}
}Itprints whatever it receives in the first parameter to the log file. If
you need to print something simple, just call "logit('text to log');"
and your log entry will be created.
Source : http://www.stevekallestad.com/blog/simple_logging_in_perl.html
Simple Logging in Perl
Set a Logging Variable
my $logging=1
Conditionally Open and Close the Logfile
At the earliest reasonable time, open the logfile in append mode:if($logging){open FILE , ">>./my.log";}At the latest possible time, close the logfileif($logging){close FILE};Don'tforget to close the logfile as part of your error handling routines as
well. Perl cleans things up nicely for you, but there are always
exceptions to those kinds of rules.
Logging Subroutine
A simple subroutine to enable logging as follows:sub logit{
if ($logging){
print FILE "$_[0]\n";
}
}Itprints whatever it receives in the first parameter to the log file. If
you need to print something simple, just call "logit('text to log');"
and your log entry will be created.
Source : http://www.stevekallestad.com/blog/simple_logging_in_perl.html
Friday, August 7, 2009
Perl : Check if directory is empty
#!/usr/bin/perl -w
my $path="/var/tmp/zt/a";
opendir DIR, $path;
if(scalar(grep( !/^\.\.?$/, readdir(DIR))) == 0){
printf("Dir empty\n");
}
else {
printf("Dir not empty\n");
}
closedir DIR;
Thursday, July 23, 2009
Temporarily Disable "Restart Now" Dialog from XP’s Automatic Updates
Run :
net stop “automatic updates”
Make sure you use the quotes.
Thursday, July 9, 2009
Robe and Wizard hat
BritneySpears14: Aight.
bloodninja: Slip out of those pants baby, yeah.
BritneySpears14: I slip out of my pants, just for you, bloodninja.
bloodninja: Oh yeah, aight. Aight, I put on my robe and wizard hat.
BritneySpears14: Oh, I like to play dress up.
bloodninja: Me too baby.
BritneySpears14: I kiss you softly on your chest.
bloodninja: I cast Lvl. 3 Eroticism. You turn into a real beautiful woman.
BritneySpears14: Hey...
bloodninja: I meditate to regain my mana, before casting Lvl. 8 Cock of the Infinite.
BritneySpears14: Funny I still don't see it.
bloodninja: I spend my mana reserves to cast Mighty F*ck of the Beyondness.
BritneySpears14: You are the worst cyber partner ever. This is ridiculous.
bloodninja: Don't f*ck with me bitch, I'm the mightiest sorcerer of the lands.
bloodninja: I steal yo soul and cast Lightning Lvl. 1,000,000 Your body explodes into a fine bloody mist, because you are only a Lvl. 2 Druid.
BritneySpears14: Don't ever message me again you piece of ****.
bloodninja: Robots are trying to drill my brain but my lightning shield inflicts DOA attack, leaving the robots as flaming piles of metal.
bloodninja: King Arthur congratulates me for destroying Dr. Robotnik's evil army of Robot Socialist Republics. The cold war ends. Reagan steals my accomplishments and makes like it was cause of him.
bloodninja: You still there baby? I think it's getting hard now.
bloodninja: Baby?
-------------------
bloodninja: Ok baby, we got to hurry, I don't know how long I can keep it ready for you.
j_gurli3: thats ok. ok i'm a japanese schoolgirl, what r u.
bloodninja: A Rhinocerus. Well, hung like one, thats for sure.
j_gurli3: haha, ok lets go.
j_gurli3: i put my hand through ur hair, and kiss u on the neck.
bloodninja: I stomp the ground, and snort, to alert you that you are in my breeding territory.
j_gurli3: haha, ok, u know that turns me on.
j_gurli3: i start unbuttoning ur shirt.
bloodninja: Rhinoceruses don't wear shirts.
j_gurli3: No, ur not really a Rhinocerus silly, it's just part of the game.
bloodninja: Rhinoceruses don't play games. They f*cking charge your ass.
j_gurli3: stop, cmon be serious.
bloodninja: It doesn't get any more serious than a Rhinocerus about to charge your ass.
bloodninja: I stomp my feet, the dust stirs around my tough skinned feet.
j_gurli3: thats it.
bloodninja: Nostrils flaring, I lower my head. My horn, like some phallic symbol of my potent virility, is the last thing you see as skulls collide and mine remains the victor. You are now a bloody red ragdoll suspended in the air on my mighty horn.
bloodninja: Goddam am I hard now.
--------------
BritneySpears14: Ok, are you ready?
eminemBNJA: Aight, yeah I'm ready.
BritneySpears14: I like your music Em... Tee hee.
eminemBNJA: huh huh, yeah, I make it for the ladies.
BritneySpears14: Mmm, we like it a lot. Let me show you.
BritneySpears14: I take off your pants, slowly, and massage your muscular physique.
eminemBNJA: Oh I like that Baby. I put on my robe and wizard hat.
BritneySpears14: What the f*ck, I told you not to message me again.
eminemBNJA: Oh ****
BritneySpears14: I swear if you do it one more time I'm gonna report your ISP and say you were sending me kiddie porn you f*ck up.
eminemBNJA: Oh ****
eminemBNJA: damn I gotta write down your names or something
Awesome awesome :) I crack up every time I read this. :D
Source:
http://www.albinoblacksheep.com/text/bloodninja
http://bash.org/?104383
Friday, June 26, 2009
C++ Convert string to upper/lower case
To convert an std::string to upper case you can use the following:
#include <algorithm>
#include <string>
…
std::string data = “Abc”;
std::transform(data.begin(), data.end(),
data.begin(), ::toupper);
For converting to lower case, you need to replace ::toupper with ::tolower.
Thursday, June 25, 2009
HOW TO run explorer in Sun Solaris
first time run this:
# /opt/SUNWexplo/bin/explorer -g
from then on, run this;
# /opt/SUNWexplo/bin/explorer
Sunday, June 14, 2009
Why is Microsoft running ads for BING via Google ??????

While watching Top Gear today I stumbled onto something rather "special" as I would like to call it.
Its an ad for Microsofts new search engine "Bing" on Youtube which is owned by Google.
The situation is special in more than one way though if you really think about it.
A. Microsoft is trying to gain visibility via a source it knows is used my most people. So by displaying an ad there most earthlings like me who use various services of Google get to know that there exists something called Bing.
B. Google gets nothing by displaying the ad (assuming its under AdSense sort of arrangement) unless someone clicks on the advertisement. So this means that if Microsofts Bing is not popular enough and most people do not click its ad, Google will not generate revenue which is the sole purpose for Googles interest in displaying ads.
C. If people start clicking on ads for Bing via Google, then Google will generate revenue for itself at the cost of losing people who may potentially like Bing and may possibly start using it actively ditching Google.
So should Google display ads for Microsoft ?
Should Microsoft display ads on Google ?
I don't know .. but its sure that things like these keep the humor going.
Tuesday, June 2, 2009
How to Enable or Disable a processor in Sun Solaris
disabling Processors. This although is not something that we would do
all the time but can come handy when troubleshooting hardware issues.
Sun
Solaris has the psradm utility which allows enabling or disabling a
Processor on the system. The psradm utility changes the operational
status of processors. The legal states for the processor are on-line,
offline, spare, Faulted, and no-intr. An online processor processes
LWPs (lightweight processes) and can be interrupted by I/O devices in
the system.
To enable or disable
a processor on the system we need to know the Processor ID. This can be
found using the psrinfo utility as follows:
sunsolaris# psrinfo
0 on-line since 05/09/2008 19:41:32
where 0 is the processor ID.
To know the path of the psradm command
sunsolaris# which psradm
/usr/sbin/psradm
To disable a processor
sunsolaris# psradm -f 0
where ‘0′ is the processor ID and ‘-f’ indicates the processor is taken offline (disable)
To enable a processor
sunsolaris# psradm -n 0
where ‘0′ is the processor ID and ‘-n’ indicates the processor is brought online (enable)
Source: http://www.sunsolarisadmin.com/hardware/how-to-enable-or-disable-a-processor-in-sun-solaris/#more-57
Wednesday, May 27, 2009
Solaris Routing
- Add a route
# route add net 128.50.3.0 bigbox
- Add a default route [host|net] dest. [ gateway]
# route add default maingw
- Delete a route
# route delete net 128.50.3.0 sword-r - Lookup and display the route for a destination:
# route get 128.50.2.0 - Get routing reports continuously
# route monitor - Flush the routing table:
# route flush - Add the multicast path for 224.0.0.0:
# route add 224.0.0.0 `uname -n` 0 - Use
the "route add net" command with the -netmask option to make the route
command to take the netmask specified on the command line
# route add net 192.168.68.0 128.50.1.250 1 -netmask 255.255.255.192
Q1. Which command manipulates the routing table ?
A: route
Q2: Command to add a route to server1 via router1:
A: route add host server1 router1
Q3. Which command will add a route to the network 128.251.0.0 via 128.144.1.254 ?
A: route add net 128.251.0.0 128.144.1.254
Q4. Which command would delete a route to host server1 via router1 ?
A: route delete host server1 router1
Q5. Which command will delete the route to the network 128.251.0.0 via 128.144.1.254 ?
A: route delete net 128.251.0.0 128.144.1.254
Q6. Which command will remove all entries from the routing table ?
A: route flush
Q7. Which command allows you to monitor the routing requests that are not getting resolved from the routing table ?
A7: route monitor
Q8. Which script starts the in.named daemon ?
A: Depend on the Solaris version:
/etc/init.d/inetsvc
Source: http://www.softpanorama.org/Net/Netutils/route.shtml
Sunday, May 17, 2009
Review: Angels and Demons
Well I went to watch this movie today. Having read the book 4 times I come to the conclusion that it wasn't what Dan Brown wrote. The story was changed quite a bit to adapt it for the screen. However I liked the movie.
I know people are going to judge the movie based on the book but if you watch the movie from a standpoint where you don't expect whats in the book to happen and let the story unfold its a good watch. The story made sense and the reinterpretation of events from the book was fluent. However I would have loved it if they kept it the same way and made an 8-10 hr movie covering everything.
The major reason I wanted to watch this movie was to get a sense of vatican architecture which is covered extensively in the book. I thought the filming of churches was good and presented the sense of grandeur which I imagined through the eyes of the book having never been there. I do have a wish now to visit vatican. The acting was fine and not the best i've seen. I think the hassasins character was a bit week than whats in the book and could have been a potential improvement. Also CERN should have been covered in more detail which I was actually looking forward to.
Anyways I cannot say that the movie did justice to the book but I can say it was an above average effort. I'd highly recommend the book though to all the people whether they have watched the movie or not.
Friday, May 8, 2009
Extract files from a Solaris 10 .pkg Package
mkdir tmp
pkgtrans pkgfile tmp
All the files will be extracted without any package installation
Readd files
pkgtrans -s /tmp /tmp/name.pkg

Thursday, April 30, 2009
Add and change a default route in Solaris 10
Add a default route (gateway).
Create an /etc/defaultrouter file with the IP to have it set to this for each boot.
route add default xxx.xxx.xxx.xxx
Change the default route
Step 1: edit /etc/defaultrouter
Using the editor of your choice, edit the file /etc/defaultrouter — the only line in the file should be the default route of the system, for example: 192.168.1.1. This change will not take effect until the system is rebooted.
Step 2: Delete the current default route
To make the route change take effect immediately, you must first delete the default route. If the current default route is 192.168.254.1, then the command would be:
route delete default 192.168.254.1
Step 3: Assign the current default route
To implement the new default route without rebooting the system, use the following command substituting your default route for 192.168.1.1:
route add default 192.168.1.1

Saturday, April 25, 2009
Photographic Evidence of Mac OS X Leopard on my HP Laptop
After brutal killings of my boot sector, multiple rounds of saves by ubuntu live CD and Vista DVD, several partitioning plans that failed to work, in-depth encounters with Grub, NTLDR and Darwin, inspiration drawn by Wozniak and 2 sleepless nights later, I managed to install Macintosh OS X 10.5.6 Leopard on my HP laptop.
Now I am the happy owner of a laptop with
Windows Vista 32-bit
Windows 7 64 bit
Ubuntu 9.04 32 bit
Machintosh OS X 10.5.6 Leopard
all working in harmony with three bootloaders greeting me when I start my machine.
Eye candy :)


The battery info in OS X gives the final proof of the fact that its indeed a hacked install and not an painted linux install which I have tried and it comes very close to the real thing.

