Sunday, February 6, 2011

Update JAVA and Install NetBeans in Mac OS X 10.5

Mac OS X:
Check Mac OS X version by executing
> sw_vers
ProductName: Mac OS X
ProductVersion: 10.5.8
BuildVersion: 9L31a

Version 10.5.x

Java Version:
Check Java version in your system by executing

>java -version
java version "1.5.0_13"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_13-b05-237)
Java HotSpot(TM) Client VM (build 1.5.0_13-119, mixed mode, sharing)

This is J2SE 5.0


[On the top right corner, there is spotlight/search. Search for "Java Preferences". Open that application. It allows you to select/de-select various versions of Java in your system ]

Our task: Update J2SE 5.0 to Java 6 [ Java SE 6] :
[ Java replaced name J2SE with Java SE starting from version 6 ]


Step 1: Go to http://support.apple.com/downloads/ and search for " java for mac os x 10.5 "

Step 2: Download the Java for Mac OS X 10.5 update 4
http://support.apple.com/kb/DL848

Java for Mac OS X 10.5 Update 4 delivers improved reliability, security, and compatibility for Java SE 6, J2SE 5.0 and J2SE 1.4.2 on Mac OS X 10.5.7 and later. This release updates Java SE 6 to version 1.6.0_13, J2SE 5.0 to version 1.5.0_19, and J2SE 1.4.2 to 1.4.2_21.

Check java version:

>java -version
java version "1.6.0_13"
Java(TM) SE Runtime Environment (build 1.6.0_13-b03-211)
Java HotSpot(TM) 64-Bit Server VM (build 11.3-b02-83, mixed mode)


Step 3: Download the Java for Mac OS X 10.5 update 5
http://support.apple.com/kb/DL924

Caution: After installation of update 5, you have to restart the system.

Java for Mac OS X 10.5 Update 5 delivers improved reliability, security, and compatibility for Java SE 6, J2SE 5.0 and J2SE 1.4.2 on Mac OS X 10.5 .8 and later. This release updates Java SE 6 to version 1.6.0_15, J2SE 5.0 to version 1.5.0_20, and J2SE 1.4.2 to 1.4.2_22.

Check Java Version:

>java -version
java version "1.6.0_15"
Java(TM) SE Runtime Environment (build 1.6.0_15-b03-226)
Java HotSpot(TM) 64-Bit Server VM (build 14.1-b02-92, mixed mode)

Step 4: Download the Java for Mac OS X 10.5 update 8
http://support.apple.com/kb/DL971

Java for Mac OS X 10.5 Update 8 delivers improved compatibility, security, and reliability by updating J2SE 5.0 to 1.5.0_26, and updating Java SE 6 to 1.6.0_22 for 64-bit capable Intel-based Macs . J2SE 1.4.2 is no longer being updated to fix bugs or security issues and remains disabled by default in this update.

Check Java version
>java -version
java version "1.6.0_22"
Java(TM) SE Runtime Environment (build 1.6.0_22-b04-307-9M3263)
Java HotSpot(TM) 64-Bit Server VM (build 17.1-b03-307, mixed mode)


After updating Java from J2SE 5.0 to Java SE 6.0 with latest updates, we are now ready to install NetBeans ( IDE for Java,C,PHP.. more Programming)

Go to http://netbeans.org/downloads/index.html
and download your desired bundle for the Mac OS. It has pretty neat chart showing the NetBeans IDE support integration.

Since I am going to do basic Java SE programming, I will download very basic NetBeans IDE.

Install the downloaded .dmg file for NetBeans IDE and you are good to go.



[I have assumed that you know how to install the download .dmg file for Mac. It's easy. Just double click the respective downloaded .dmg file, the wizard will automatically walk you through the installation process]





Sunday, October 10, 2010

How e-mail works? .. even a caveman can understand, yes even a caveman

SMTP (Port 25): handles outgoing mail
POP3/IMAP (Port 110/143): handles incoming mail

Let's have scenario: John Doe at hotmail.com sends email to Laura Johnson at gmail.com. John Doe uses Outlook to send an email. Laura uses web interface for gmail.com to access the email from John. 
(Outlook, web interface are the front end for the users. Those are just the GUI interface)

John uses Outlook--> sends email from Hotmail.com account to Laura Johnson at Gmail.com account--> Laura checks email at www.gmail.com

1. Outlook connects to SMTP server at hotmail.com using Port 25
John writes an email to Laura

From: John.Doe@hotmail.com
To: Laura.Johnson@gmail.com
Subject: Hi Laura
Body: Hi Laura, How are you? What's your plan for this weekend? Let's go to the state fair at Dallas.

2. SMTP server at hotmail.com reads "TO" field and breaks it into two parts e.g Laura.Johnson@gmail.com is broken into "Laura.Johnson" and "gmail.com"

3. SMTP server at hotmail.com queries to DNS server; Who is SMTP server at gmail.com?
DNS server looks into MX records and replies back with one or more SMTP servers at gmail.com

4. SMTP server at hotmail.com connects to one of the SMTP server at gmail.com and handles the message. SENDMAIL and POSTFIX are the most popular MTA (Mail Transfer Agent) to deliver mail from one SMTP server to another another SMTP server. My preference is POSTFIX as it's free, easy, secure, customizable and popular too.

5. SMTP server at gmail.com recognizes that "Laura.Johnson" is the user at gmail.com and it handover the message to gmail POP3/IMAP server which puts the message in the Laura.Johnson's INBOX.

6. Laura logs in to www.gmail.com and checks her email.

It's that easy. Remember, we didn't talk about handling the junk emails.
It goes little bit complex for handling the junk emails. Please google about that if you want to know more...

Extra Treat:

SMTP commands:
HELO
EHLO
MAIL FROM
RCPT TO
DATA
RESET
QUIT
HELP
VRFY
EXPN
VERB

POP3 commands:
USER
PASS
QUIT
LIST
RETR
DELE
TOP

Wednesday, October 6, 2010

How can I setup VLAN on my Windows XP or Workstation?

If you have Intel NIC card, you are lucky. Intel PROset utility/driver allows you to add/remove VLAN on your workstation.

You could download Intel PROset from http://downloadcenter.intel.com/
Go to Downloads and Drivers and search for Intel PROset and choose your operating system

Install the downloaded executable file
(While installing it will prompt if you want to use MMC for the management, select YES)

It will also ask if you want to remove old drivers and settings, you can say NO

Once it is installed, Right Click "My Computer" --> Manage --> Device Manager --> Network Adapters --> Right Click "Inter(R) XXXX whatever it shows " --> Properties --> VLAN and add your desired VLAN ID

Try to access other devices on the same VLAN. It should work. If not contact your network administrator.

Other TIPS:
1. Start --> Run --> winmsd

if Processor properties has x86, your OS is 32 bit
if Processor properties has ia64, your OS is 64 bit

2. Device manager will show you the vendor of your NIC card. It could be Realtek, INTEL, Broadcom. The above procedure for VLAN will only work for INTEL NIC.

Monday, October 4, 2010

Remote Desktop in console mode

If you are using Windows XP RDP client, for RDP in console mode

mstsc /console

If you are using Windows Vista or above, it doesn't use /console session, it uses /admin session

mstsc /admin

Thursday, September 23, 2010

Rename multiple files in Linux

Lets' change all files with extension ‘.html’ to ‘.php’.

Rename all *.html files in one folder

rename

#rename .html .php *.html



Do the same operation recursively in a directory tree

find . -name "*.html" -exec rename .html .php {} \;

Those double quotes around *.info are important



If you want to be expert go to following link and don't forget to read all the comments :)
http://www.thegeekstuff.com/2009/06/how-to-rename-files-in-group/

Monday, August 30, 2010

Basic tutorial on Logrotate

Log files in Linux usually reside at /var/log... It keeps on growing so log management is essential. Log management is usually achieved using logrotate. Logrotate is managed by cronjobs in Linux.

For logrotate, you can configure /etc/logrotate.conf or create the individual configuration files for each application or each log file in /etc/logrotate.d

step 1:

Let's say, I have VOIP application 'asterisk' running on my system. Asterisk generates various log files under /var/log/asterisk directory. I would create astlog under /etc/logrotate.d to manage the log files.

#cd /etc/logrotate.d
#vi astlog
/var/log/asterisk/full /var/log/asterisk/messages /var/log/asterisk/debug /var/log/asterisk/*.log {
nocompress
daily
rotate 5
missingok
copytruncate
}

Here we listed all the log files to be managed and provided the attributes of the log management. Don't compress the log file, rotate the log file daily, max number of log rotation 5 ( i.e logfilexxx.1, logfilexxx.2, .... , logfilexxx.5). It only keeps 5 log files. With copytruncate option, the original log file is truncated in place after creating a copy, instead of moving the old log file and optionally creating a new one. It is useful when some program cannot be told its logfile and thus might continue writing(apending) to the previous log file.

[you can use #stat < filename > or # ls -l < filename > to check the inode number
copytruncate helps the log file to preserver it's inode(unique file number) ]

If you don't want to use copytruncate option, then you have to tell the program that log file has been recreated (with new INODE number). For example, in my case I could have done

#cd /etc/logrotate.d
#vi astlog
/var/log/asterisk/full /var/log/asterisk/messages /var/log/asterisk/debug /var/log/asterisk/*.log {
nocompress
daily
rotate 5
missingok
create
        postrotate
/usr/sbin/asterisk -rx 'logger reload' > /dev/null 2> /dev/null
endscript

}

Here, we are telling our program 'asterisk' to reload logger as new log file has been created after log rotation.

step 2:

By default, Logrotate is scheduled daily. You can find 'logrotate' under /etc/cron.daily

Let's look at /etc/crontab

# less /etc/crontab
SHELL=/bin/sh
PATH=/usr/bin:/usr/sbin:/sbin:/bin:/usr/lib/news/bin
MAILTO=root
#
# check scripts in cron.hourly, cron.daily, cron.weekly, and cron.monthly
#
-*/15 * * * * root test -x /usr/lib/cron/run-crons && /usr/lib/cron/run-crons >/dev/null 2>&1


The time to execute the scripts is managed by crontab. /usr/lib/cron/run-crons script controls the cron.hourly, cron.daily, cron.weekly and cron.monthly. run_crons runs every 15 minutes and ensures that cron jobs are taken care of.

In SLES, if you need to change the default daily time , you can go to YAST --> System --> /etc/sysconfig editor --> System --> Cron --> DAILY_TIME and change the time.

Let's say, I want logrotation to be done at OFF hours (10:30 pm) to avoid the possible load on the server, then, I can change DAILY_TIME to 22:30


Tips:

To run the logrotate manually, you can try
#logrotate astlog


For more information:

http://www.linuxtopia.org/online_books/suse_linux_guides/SLES10/suse_enterprise_linux_server_installation_admin/sec_suse_pakete.html


http://www.thegeekstuff.com/2010/07/logrotate-examples/

Tuesday, July 13, 2010

CAT3 vs CAT4 vs CAT5 vs CAT5e vs CAT6

CAT3- contains 4 pairs of wires and can carry up to 10Mbps with a possible bandwidth of 16MHz. (UTP)

CAT4- contains 4 pairs of wires and can carry up to 16Mbps with a possible bandwidth of 20MHz. (UTP)

CAT5- contains 4 pairs of wires and cancarry up to 100Mbps with a possible bandwidth of100MHz. However there is more than one variety. There is also FastCAT which has a possible bandwidth of up to 350MHz. (UTP)

CAT5e- a higher grade of CAT5 that contains high-quality copper, offers a higher twist ratio (to eliminate cross-talk) and can support a bandwidth of 200MHz (2x that of REGULAR CAT5) (UTP)

CAT6- a twisted pair cable that contains 4 wire pairs each wrapped in foil insulation (to eliminate cross-talk). Additional foil covers the bundle of wires (to eliminate cross-talk further, and shield it from other interference ie. EMF from flourescent lights) and a fire-resistant plastic sheath covers the second foil layer. CAT6 supports at least six times the throughput of regular CAT5, but it is also 3-4x the price of CAT5. (STP)

UTP=Unshielded Twisted Pair
STP=Shielded Twisted Pair