Archive for August, 2009

Checked vs Unchecked exception

Checked Exception Unchecked Exception
Forces clients to handle it Clients may not handle it
All exceptions except RuntimeException , Error and their subclasses come under checked exception All RuntimeException , Error and their subclasses come under unchecked exception
Advertisements

Difference between C++ references and Java references

Many people who learn Java with a background of C++ often get confused between reference of C++ and reference of Java. Even if they share same phrase there is not much similarity between them. You might wonder that C++ pointers share the similar functionality that of Java references.

Here is the similarity between C++ pointers and Java references.

C++ Pointers Java references
Declaration and assignment:
Obj* o1;//Uptil now no memory is allocated on heap
o1=new Obj();//Now we have o1 pointing to object on heap
Declaration and assignment:Obj o1;//Uptil now no memory is allocated
o1=new Obj();//Now we have o1 pointing to object on heap
Base class pointer can point to derived class object Base claas reference pointes to derived class object
Obj* o1,o2; o1=new Obj();
o2=o1;
o1 and o2 now point to same object
Obj o1,o2; o1=new Obj();
o2=o1;
o1 and o2 now point to same object



In C++ if we try to assign derived class object to base class reference, object slicing will occur.
From this you can get a idea about how much strong the references are, they allow runtime polymorphism without dealing with pointers. In case of pointers you need to free the memory allocated for pointers. In Java we do not need to wory about freeing allocated memory because system(JVM) takes care of it. So Java tried to achive best of both the worlds. This all comes at the price. As garbage collection ( name of background thread responsible for releasing allocated memory ) run as a background process it slows down the system.

Creating your first website

Just follow following steps and get full fledged website running for you

  • Get an account with web host (you can use http://110mb.com)
  • Domain name(optional if webhost provides it or you can get friendly name at http://co.cc )
  • Website written in PHP (Or you can use CMS i.e. Content management system) Many CMS’s provided by 110mb. you have to just click on ‘one click application installer’ and select appropriate CMS (Before installing CMS delete index.html file through file manager through 110mb controle panel)
  • If you want to have email addresses with your domain you can open google apps account at http://www.google.com/a/cpanel/domain/new
  • If your website/CMS requires a database you can get free database here http://db4free.net (It may take one or two days to activate)
After completing all the above steps I assume:
  • You have an account with web host provider
  • You have domain name with co.cc
  • If you are using CMS ,CMS files uploaded to your root of website.
  • If your website/CMS requires database you have database account with you.
  • If you want friendly domain name you have co.cc domain name. And if you want emails with your websites you have google apps account.

Now let us start setting things up.
  • Log into your google apps account you will get instructions to select verification method, select ‘Change .co.cc CNAME recordoption, press continue
  • Copy the unique string provided to you.
  • Open another tab and navigate to co.cc website, login to your account, select manage your domain name, press set up. Click on “url forwarding” , Select check box “Google apps email setup”, Paste this string to text box. Enter the title. press “Set Up”.
  • Switch back to your google apps tab press “I have completed steps above”
  • You will be prompted to follow guid, Go through the guid if you want to. It will open in different tab. When you complete exploring switch back to prev google apps tab.
  • Press activate email under Email link
  • You will get list of instructions for changing mail extensions. Don’t worry no need to follow those as co.cc has already done that for us. just press “I have completed these steps”
You have just set up an email account for your custom domain. It will take around one or two days to activate depending on your location.
Now let us come back to your website at 110mb.com
You will have a domain name with your website like [xxxxxx].110mb.com. Now you have to configure your domain name with 110mb.
  • Log into your 110mb account
  • Click on- Account management and Upgrade section – Account profile
  • Under Add new domain enter your domain name [ DO NOT PREFIX WITH www] i.e. do not enter http://www..co.cc just enter .co.cc
  • Press “Add or remove My domain now”
  • Go to http://www.110mb.com/check_your_site.php enter your 110mb domain i.e. .110mb.com
  • Copy the ip address.
  • Go to your co.cc domain manager settings as explained previously. Press set up.
  • Press zonal records, there you will have all the configuration for your domain
  • Delete the record having

    <yourname>.co.cc 1 H A

  • Under add arecord click on textbox next to host.(Do not enter anything)
  • Select Type as “A”
  • Paste the ip address you had copied from 110mb domain doctor website
  • Press Set up
Thats it. you have now configured your domain name to point to 110mb domain. This may take two days two take efect.
Now considering that your database is active.
Navigate to your address .110mb.com
You will be prompted to enter information depending on your CMS. Enter database username, password, database name given to you by db4free.net. Enter Server name as db4free.net:3307
And just follow the steps.

I hope this information was useful