Tuesday, March 20, 2012

Tutorials on ruby

The most intresting language after java is ruby , may be something more than java. Honestly I do not want to hurt the java developer anyway. Here is a below sample program which will give you a sample IDEA of ruby language. It is really a pure object oriented language.

class TestClass
 @@fname=""
 @@lname=""
 @@val="Bhubaneswar"
 
 def initialize(fname,lname)
  @fname=fname
  @lname=lname
 end

 def testMethod(val)
  puts("Inside the Method")
  puts("The Global Value is '#{@fname}' and '#{@lname}'")
  @val=val
  puts("The Local Value is '#{@val}'")
  puts("The Local Value is '#{@@val}'")
 end
end
obj=TestClass.new("khirod","Patra")
obj.testMethod("Delhi")


Description: TestClass is the name of the class must be stared with a capital letter. @@fname,@@lname,@@val are the class variable. The class variab;e declared with @@ symbol and the instance variable declared with single @ symbol. In the method testMethod you can see the instance variable i.e. @val . So if you want to access the class variable or the instance variable , you have to prefix with @@ or @ symbol with variable name, Incase if you have same variable name

Questions are welcome...

Friday, November 12, 2010

Tips on Virtual Box

If you are using any Virtual box , then you mustt add your user name to the vboxgusers group, So that you get access to the USB system in Windows XP i.e.

usermod -A vboxusers

Sunday, July 18, 2010

Install Oracle 10g XE on ubuntu

1) download oracle  oracle-xe-universal_10.2.0.1-1.0_i386.deb from the oracle official website


Then

sudo dpkg -i oracle-xe-universal_10.2.0.1-1.0_i386.deb



2) sudo /etc/init.d/oracle-xe configure

It will ask the value for some option like

Specify the HTTP port that will be used for Oracle Application Express [8080]:7070


By default the port number is 8080, be care full make sure the same port is not used by any other process, In my case tomcat is already on 8080 so i changed to 7070.

Similarly :
Specify a port that will be used for the database listener [1521]:1521

Then Specify the Password and confirm password  and restart the datatabase like

Specify a password to be used for database accounts.  Note that the same
password will be used for SYS and SYSTEM.  Oracle recommends the use of
different passwords for each database account.  This can be done after
initial configuration:
Confirm the password:

Do you want Oracle Database 10g Express Edition to be started on boot (y/n) [y]:y








It Will restart the oracle and now oracle ready to use

You can try it from SQL command line or from http://127.0.0.1:7070/apex

In the above link change the port number accordingly ,what ever you mentioned in the configuration file

from the command line  of SQL, give the command
connect system/manager   i.e

Note: The default database name of 10g is xe.

Tuesday, July 6, 2010

Size of a Symbolic Link In UNIX

Check the Below Example:

lrwxrwxrwx 1 root root 8 Dec 8 2008 swbt -> /nas/usr
lrwxrwxrwx 1 root root 10 Dec 5 2008 tmp -> ../var/tmp

In the above llinks the sizes are 8 and 10 respectively . The Symbolic calculate the size according to the
number of the charaters in the link Path i.e

/nas/usr has 8 characters So the Size is 8

../var/tmp has 10 character So the Size is 10

Tuesday, June 15, 2010

Installing Sun Java On Ubuntu/Debian

Installing Sun Java On Ubuntu/Debian




Download latest Java JDK from http://java.sun.com/j2se/1.5.0/download.jsp

(being sure not to download the .rpm, but rather the .bin)

install java-package with apt-get

(that includes binutils, fakeroot)

(Note also that java-package is in “multiverse”, so your repository list /etc/apt/sources.list needs to have that enabled)

make debian java package:

Disregarding the errors, in a tmp dir where we have copied the downloaded jdk, we do (without using sudo):



fakeroot make-jpkg jdk-1_5_0_05-linux-i586.binwhich, after ok’ing the license and extracting stuff, and trundling,after a while creates sun-j2sdk1.5_1.5.0+update06_i386.deb

then we install our newly made package, this time with sudo:



sudo dpkg -i sun-j2sdk1.5_1.5.0+update06_i386.deb“Once you’ve installed it, you’ll be up and running with the latest jdk: your JAVA_HOME is now, for example, /usr/lib/j2sdk1.5-sun. Get a command line, and enter java -version: you should see something like:


Now you have java :)

Friday, May 7, 2010

How To Restore Grub In Ubuntu

Boot up your live CD


In the desktop, open terminal (Applications -> Accessories -> Terminal).





sudo grub





This will set it to grub mode





find /boot/grub/stage1





This will locate your boot partition. If you already know the location, you can ignore this step.

root (hd0,0)

Replace the (hd0,0) by your boot partition number. If your Ubuntu is installed in the second partition, then change it to (hd0,1)

setup (hd0)
quit

Reboot your system. You should be able to access the Grub bootloader now.

How To Restore Grub In Ubuntu

Boot up your live CD


In the desktop, open terminal (Applications -> Accessories -> Terminal).





sudo grub





This will set it to grub mode





find /boot/grub/stage1





This will locate your boot partition. If you already know the location, you can ignore this step.

root (hd0,0)

Replace the (hd0,0) by your boot partition number. If your Ubuntu is installed in the second partition, then change it to (hd0,1)

setup (hd0)
quit

Reboot your system. You should be able to access the Grub bootloader now.