Feb 26, 2013

How to find a system 32 or 64 bit

In any Linux variants either one of this should work ( Redhat, Cent-Os, Ubuntu, Hp-ux, Solaris etc )

[mohan@chinna ~]$ arch
x86_64
[mohan@chinna ~]$ uname -m
x86_64
[mohan@chinna ~]$ getconf LONG_BIT
64


As you can guess, 64 / x86_64 is 64bit system, whereas 32 / i386 / i686  denotes its a 32 bit sytem.


For windows
Right-click MyComputer->Properties

It will bring a window like below image, from that you can check the system type

Feb 25, 2013

How to edit iptables in linux

Problem:
sometimes you may receive below error like

The description for Event ID ( 0 ) in Source ( sshd ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. You may be able to use the /AUXSOURCE= flag to retrieve this description; see Help and Support for details. The following information is part of the event: sshd: PID 2992: Accepted publickey for build from 10.69.250.31 port 33344 ssh2.

Solution :
Either Turn off the firewall in linux or add the port 22 as exception in iptables

To disable selinux  edit /etc/sysconfig/selinux    and set SELINUX to disabled.

SELINUX=disabled

I've encountered such problems when the binaries and libraries were not
executable by SYSTEM.
"chmod 755 /usr/sbin/* /usr/bin/*" fixed the problem.

If the problem still exists, add the port to the iptables.

For adding port 22 to the iptables, from shell run

iptables -A INPUT -p tcp --dport 22 -j ACCEPT

or

edit /etc/sysconfig/iptables
and append this line

-A INPUT -p tcp --dport 22 -j ACCEPT
Save and close the file. Restart iptables:
/etc/init.d/iptables restart
or
service iptables restart
Learn more about iptables by
man iptables

Feb 24, 2013

How to add Gnome to a CentOS 6 minimal install

Problem:
sometimes you may receive below error like

The description for Event ID ( 0 ) in Source ( sshd ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. You may be able to use the /AUXSOURCE= flag to retrieve this description; see Help and Support for details. The following information is part of the event: sshd: PID 2992: Accepted publickey for build from 10.69.250.31 port 33344 ssh2.

Solution :
Either Turn off the firewall in linux or add the port 22 as exception in iptables

To disable selinux  edit /etc/sysconfig/selinux    and set SELINUX to disabled.

SELINUX=disabled

I've encountered such problems when the binaries and libraries were not
executable by SYSTEM.
"chmod 755 /usr/sbin/* /usr/bin/*" fixed the problem.

If the problem still exists, add the port to the iptables.

For adding port 22 to the iptables, from shell run

iptables -A INPUT -p tcp --dport 22 -j ACCEPT

or

edit /etc/sysconfig/iptables
and append this line

-A INPUT -p tcp --dport 22 -j ACCEPT

Feb 23, 2013

How to Sync Google Calendar, Outlook and iPhone Calendar

Please refer the below url
http://email.about.com/od/googlecalendartips/qt/Sync_Outlook_Google_Calendar_and_iPhone_Calendar.htm

Feb 22, 2013

How to create checksums for all files recursively

To create checksums for all files recursively

find . -type f -exec md5sum "{}" +;

Feb 21, 2013

How to find a machine whether its a physical machine or a Virtual machine in linux.

You can get this information by using a tool called dmidecode. dmidecode  is a tool for dumping a computerâs DMI (some say SMBIOS) ta-
       ble contents in a human-readable format. This table contains a descrip-
       tion  of  the  systemâs  hardware  components,  as well as other useful
       pieces of information such as serial numbers and BIOS revision.  Thanks
       to  this  table,  you  can  retrieve this information without having to
       probe for the actual hardware.

[root@server2 tmp]# /usr/sbin/dmidecode |grep -i "vm"
                Manufacturer: VMware, Inc.
                Product Name: VMware Virtual Platform
                Serial Number: VMware-24 34 c4 76 3b 1a 94 8d-99 08 5d cc 81 04                            17 25
                        VME (Virtual mode extension)
                        VME (Virtual mode extension)
                Description: VMware SVGA II
                String 1: [MS_VM_CERT/SHA1/27d66596a61c48dd323409dfd5126e33f59                           ae7]
               

               
For a physical machine it will be like below

[mohan@server2 storage]# sudo /usr/sbin/dmidecode |grep -i "vm"
                VME (Virtual mode extension)
                VME (Virtual mode extension)
               

Feb 20, 2013

Different options of reverting files in Perforce


p4 revert //...
Revert every file you have open, in every one of your pending changelists, to its pre-opened state.

p4 revert -c default //...
Revert every file open in the default changelist to its pre-opened state.

p4 revert -n *.txt
Preview a reversion of all open .txt files in the current directory, but don't actually perform the revert.

p4 revert -c 31 *.txt
Revert all .txt files in the current directory that were open in changelist 31.

p4 revert -a
Revert all unchanged files. This command is often used before submitting a changelist.

Feb 19, 2013

File checksum utility for windows Xp

File checksum utility for windows Xp






Refer -  http://support.microsoft.com/kb/841290

Feb 18, 2013

This e-mail address is associated with a Nokia Messaging account

Problem
This e-mail address is associated with a Nokia Messaging account


Solution
If you configure mails in Nokia mobiles, your mail address will be linked with your nokia accout. The same email address cannot be configured in another nokia mobile. The solution is to call Nokia customer care and request them to remove the linking for your mail address.

Feb 17, 2013

How to count occurrences of a number or text in Excel

To count occurances of a particular number or words in a range of excel cells use formula

=COUNTIF(range,"pattern")
where range is the excel cells range where you want to search for the pattern. pattern can be numbers or words but it should be within double quotes "".

Example - To count number of occurance of word "present" in cells between A1 to A10. frame the formula like below

ex - COUNTIF(A1:A10,"Present")

also you can wildcard characters in the pattern.
Example   =COUNTIF(A1:A9,"*sent")

Feb 16, 2013

How to find filetype in windows


There is a utility called "file" in unix which determines filetype  of a file. There is no default similar utility available in windows.  After trying few utilities available online, I found this one more helpful.

http://home.fnal.gov/~jklemenc/dl/filetype.zip

Find more description about the tool at http://home.fnal.gov/~jklemenc/filetype.html

I have posted screenshot of an example

C:\Documents and Settings\tig\Desktop>filetype.exe
FileType.exe
  by: Joe Klemencic
  Copyright 2004

Usage:
   FILETYPE.EXE -i [-r] [-o ] [-v] [-?]

                -i - Inspect a single file or all files in a directory
                -r  - Rename the file with the correct extension (-o ignored)
                -o  - Output path for file copies (creates if not exist)
                -v  - Verbose output
                -?  - This help text


C:\Documents and Settings\tig\Desktop>filetype.exe -i  "Reach Out-participants.pdf"
Reach Out-participants.pdf (.pdf) "Adobe PDF File"

C:\Documents and Settings\tig\Desktop>filetype.exe -i  "Perl One Liners.htm"
Perl One Liners.htm (.txt) "Text file"

C:\Documents and Settings\tig\Desktop>filetype.exe -i  SyncToySetupPackage_v21_x86.exe
SyncToySetupPackage_v21_x86.exe (.exe) "Executable File"

C:\Documents and Settings\tig\Desktop>filetype.exe -i  toolsmanual.dvi
Could not identify toolsmanual.dvi, skipping....

C:\Documents and Settings\tig\Desktop>filetype.exe -i  quickCooking.do
quickCooking.do (.pdf) "Adobe PDF File"

Feb 15, 2013

mount error: can not change directory into mount target /mnt/server/


Problem:
mount error: can not change directory into mount target /mnt/server/

Reason:
Either you didn't create your /mnt/server directory or specified it wrong in your mount command.
check the existence of the directory and try the mount command again

Example:
[root@library 20100813143931]# mount -t cifs //192.168.1.2/Release -o username=mohan,domain=priv  /mnt/server/
mount error: can not change directory into mount target /mnt/server/
[root@library 20100813143931]# cd /mnt/server
-bash: cd: /mnt/server: No such file or directory
[root@library 20100813143931]# ls /mnt/
[root@library 20100813143931]# mkdir /mnt/server
[root@library 20100813143931]# mount -t cifs //192.168.1.2/Release -o username=mohan,domain=priv  /mnt/server/
Password:

Feb 14, 2013

Maximum length for naming a file in windows


In the Windows explorer the maximum length for naming a file is 260 characters including the drive letter and folders name.
Because windows has a predefined variable called MAX_PATH and its value is set to 260.


So when you try to create or copy a file it will return below error

cp: cannot create regular file    File name too long

sample filename :
C:\hudson\workspace\dev-project-eventsourcelibrary\project\initial\eventsourcelibrary\tmp\normaliser\etc\devices\nsm\reports\Network\Configuration and Policy Management\viewScreen-Security Management\NetScreen-Security Manager - Authentication and Login Events.xml 

So to avoid either you can reduce the characters by trimming the directories name length or use the "\\?\" prefix so that it will allow upto 32,767 characters.

To know more about this, refer microsoft's naming guide.
url-
http://msdn.microsoft.com/en-us/library/windows/desktop/aa365247%28v=vs.85%29.aspx#maxpath
----------------

Unicode clients require a unicode enabled server.

Problem: Unicode clients require a unicode enabled server.

If P4CHARSET is set in the client , but the service is not operating in internationalized mode, the service returns the following error message:

Unicode clients require a unicode enabled server.

Solution:
For Perforce services operating in the default (non-Unicode mode), P4CHARSET must be left unset (or set to none) on user workstations.P4CHARSET only affects files of type unicode and utf16; non-unicode files are never translated.

Example:

c:\p4\project\>p4 edit startbuild
Unicode clients require a unicode enabled server.

c:\p4\project>set P4CHARSET=none
c:\p4\project>p4 edit startbuild
//project/startbuild#1 - opened for edit



For Perforce services operating in Unicode mode, P4CHARSET must be set on user machines. If P4CHARSET is unset, but the service is operating in Unicode mode, Perforce applications return the following error message:
Unicode server permits only unicode enabled clients.

c:\p4\project\>set P4CHARSET=UTF-8
c:\p4\project\>p4 edit startbuild
Character set must be one of:
none, utf8, utf8-bom, iso8859-1, shiftjis, eucjp, iso8859-15,
iso8859-5, macosroman, winansi, koi8-r, cp949, cp1251,
utf16, utf16-nobom, utf16le, utf16le-bom, utf16be,
utf16be-bom, utf32, utf32-nobom, utf32le, utf32le-bom, utf32be,
or utf32be-bom
Check P4CHARSET and your '-C' option.

c:\p4\project\>set P4CHARSET=utf8

For further information refer http://www.perforce.com/perforce/r12.2/manuals/cmdref/env.P4CHARSET.html

Feb 13, 2013

How to perform shutdown from command prompt or to schedule shutdown/reboot/logoff in windows

There is a executable which comes default with windows namely, shutdown.exe which can be called in command prompt to shutdown the system.

To perform shutdown immediatly
c:\>shutdown /s /t 00

In this /s if for shutdown, similarly you can use /r for reboot /l for logoff etc.


To shutdown windows in 1 hour
c:\>shutdown /s /t 3600

refer manual for additional options

c:\>shutdown /?