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

to run explorer..

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

In multiprocessor environments, Sun Solaris can allow enabling or
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