Saturday, October 27, 2012

What is NAT (Network Address Translation)?


When your firewall or router is configured so that all other devices on internet recognize your home/office servers as having a valid Public IP Address then such a configuration is said to be using NAT or IP masquerading. 

Why NAT?

1.  No one on the Internet knows your true IP address. Thus it protects your PCs by assigning them IP addresses from "private" IP address space that cannot be routed over the Internet. This prevents hackers from directly attacking your home systems because packets sent to the "private" IP will never pass over the Internet.

2.  Hundreds of PCs and servers behind a NAT device can masquerade as a single public IP address. This greatly increases the number of devices that can access the Internet without running out of "public" IP addresses.


NAT Configurations? 

You can configure NAT to be one to one in which you request your ISP to assign you a number of public IP addresses to be used by the Internet-facing interface of your firewall and then you pair each of these addresses to a corresponding server on your protected private IP network. You can also use many to one NAT, in which the firewall maps a single IP address to multiple servers on the network.





What are Private IP Addresses and what are their ranges?


Some IP Address ranges are meant only for private networks. These are never used or routed on the internet... these IP Address are called as Private IP address. 

Here are the IP ranges which are private:


10.0.0.0 - 10.255.255.255

172.16.0.0 - 172.31.255.255
192.168.0.0 - 192.168.255.255

There is one special IP address which is called the localhost IP Address. This IP address is defined as 127.0.0.1. Whether or not your computer have a network decide, your system will always have this IP address assigned to it.

Tuesday, October 23, 2012

Installing tomcat 7 on Ubuntu Server 12.04 (Precise Pangolin)


The easiest way to install tomcat7 on ubuntu Server 12.04 or Precise Pangolin is to use apt-get. 

Here is the command: 


sudo apt-get install tomcat7


If you already had tomcat6 earlier on this machine there might be issues with tomcat6-commons when running this. Make sure you remove tomcat6-common before running the above command. 


sudo apt-get remove tomcat6-common


Manual Install: 

1. Make sure you have JRE Installed on your machine. 

2.  Download Tomcat 7 tar.gz binary distribution

3.  Unpack it using tar xvzf apache-tomcat-7.0.29.tar.gz

4. Create a directory where you want to install it and them move the unpacked stuff there. For e.g., I've created a directory named /usr/share/tomcat7. Use below command to move it: 

sudo mv apache-tomcat-7.0.29/ /usr/share/tomcat7


5. Edit catalina.sh and add following lines: 

JAVA_HOME="/usr/lib/jvm/jdk-6u32"
JRE_HOME="/usr/lib/jvm/jdk-6u32/jre" 


6.  Start tomcat using below command 

sudo /usr/share/tomcat7/bin/catalina.sh run


That's It... Simply Isn't It?

Thursday, October 18, 2012

ubuntu 12.04 features list


Head Up Display (or HUD)

HUD integrates application menus into the desktop UI. With an application open, hit the Alt key to bring up the HUD. When the HUD is open, you can easily search your application menus based on keywords. This means you will not have to poke through application menus.

New privacy tool

With this tool you can figure out what exactly Unity records and what it doesn’t. You can turn recording off to completely disable the feature or you can specify what files and applications it can record.

Launchbar

It can now be set to auto-hide. Icons can be resized now. It is no longer set with the dodge window behavior. This caused a lot of issues when interacting with certain applications. The default behavior now is always on top.

Change to Unity Dash

Now, the Dash shows Recent Apps first, Recent Files next, and finally, Recent Downloads.

Video Lens

Unity Lenses allow you to easily organize items in the Unity Dash. If you open the Video Lens, you can select and play videos from a variety of sources, such as those from your local collection, YouTube movies, BBC iPlayer, and TED Talks. Open the Lens, do a search, and click on the video you want to view.

Rhythmbox default

Ubuntu is returning to Rhythmbox as the default music player. 

MyUnity

Ubuntu Unity will finally include a configuration tool for the desktop. This application was developed to provide full customization of Unity features, including the Unity Launcher, Dash, Panel, Desk, and Font. This tool was available for 11.04 and 11.10, but had to be installed from the Software Center. Now, MyUnity will be installed and ready for configuration by default.

Trackpad support

Owners of trackpads whose clickable button is built into the surface can now enjoy support for their device. Most new Synaptics trackpads are supported, as are Apple Macbook trackpads. Ubuntu 12.10 should also include support for Apple’s Magic Trackpads.

Wednesday, October 17, 2012

How do i know if my macbook has usb 3.0 Support?

USB 3 (also known as "SuperSpeed USB") is the latest USB standard which offers significant performance improvements over USB 2 ("Hi-Speed USB").

USB Transfer Rate Comparison: 

  • USB 3 - transfer data up to 5 Gbps.
  • USB 2 - transfer data up to 480 Mbps.  
  • USB 1.1 - transfer data up to 12 Mbps.

Use the System Information utility to find out if your MAC has USB 3.0 Support or not. 
  1. From the Apple () menu, choose About this Mac.  
  2. Click More Info.
  3. Click System Report.
  4. In the Hardware section of the System Report, click USB.
  5. You will see a USB 3 section and a USB 2 section. USB 3 devices will appear in the "USB 3.0 SuperSpeed" section. Other devices will appear in the "USB Hi-Speed" section.

Thursday, October 11, 2012

How can i tell if a MySQL query returned nothing in PHP?


Its simple.. use mysql_num_rows as shown below....


$query_req="SELECT * FROM customer";
$query_result=mysql_query($query_req);

if (mysql_num_rows($query_result) != 0)
{
   echo "More than 0 records were returned.";
}

Wednesday, October 3, 2012

mysql_connect() [function.mysql-connect]: [2002] No such file or directory (trying to connect via unix:///var/mysql/mysql.sock)

I had my website running on CentOS.. but when I moved it to MAC OS X I started getting this weird error. After having spent a lot of time on troubleshooting.. I found a very simple solution to it... 

The problem is that mysql get's the location of socket file to use incorrect. In my case it was trying for socket file at /var/mysql however on my MAC the socket file are created at /tmp. 

All that I did to correct this problem was: 

1.  Goto /var
2.  Create a directory named mysql
3.  Create symbolic link named mysql.sock to /tmp/mysql.sock
     sudo ln -s /tmp/mysql.sock mysql.sock


Monday, October 1, 2012

How to Install PHP on a Mac


To install PHP on a MAC you first need to enable apache. Enabling apache on MAC OS X is pretty simply... All you need to do is go into System Preferences and enable "Web Sharing".

Once you do that... you need to change your apache configuration file to enable it to load the php module. Here are the 3 simply steps you need to follow:

1.  Navigate to /etc/apache2/
2.  vi httpd.conf and Uncomment #LoadModule php5_module libexec/apache2/libphp5.so
3.  Restart apache. 

This is it.. but you may want to backup your php.ini file before you make any changes to it. You can find php.ini in /private/etc.