Oracle Messages - Just for Fun

Some of the Oracle messages...

Q. What if your Dad loses his car keys?
A. 'Parent keys not found!'
Q. What if your old girl friend spots you with your new one?
A. 'Duplicate value on index!'
Q. What if the golf ball doesn't get into the hole at all?
A. 'Value larger than specified precision!'
Q. What if you try to freak out with somebody else's girlfriend and being kicked out?
A. 'Insufficient privileges on the specified object!'
Q. What if you don't get any response from the girl next door?
A. 'No data found!' or ' Query caused no rows retrieved!'
Q. What if you get response from the girl next door and her Mom too?
A. 'SELECT INTO returns too many rows!'
Q. What if you dial a wrong number?
A. 'Invalid number' or ' Object doesn't exist!'
Q. What if you try to beat your own trumpet?
A. 'Object is found mutating!'
Q. What if you are too late to office and the boss catches you?
A. 'Discrete transaction failed!'
Q. What if you see 'theatre full' when you go to a movie?
A. 'Maximum number of users exceeded!'
Q. What if you don't get table in the lunch room?
A. 'System out of tablespace!'
Q. What if you need to go on a diet?
A. ‘Invalid Body Size’

Kochi Get GDG Chapter

Google Developers Group (GDG), the non-profit community initiative supported by Google Inc.. It will be soon launched at the Startup Village here in Kochi this Statuday.

What will GDG Kochi do ?

The group once fired up will be catering to the software developers community with events such as tech talks, code contests and hack-athons.

This would be the second GDG in Kerala Trivandrum already has one and is the  and the 380th on the planet.

The first event will be  "Android Bootcamp" its said.

The activities of GDG Kochi is supported by Uttam Tripathi, Programme Manager for Developer Relations at Google India and Bhumika Kaushik, Developer Community Coordinator at Google India.

Pascal Notes. Getting started.

Var declaration

var,var,var .... : Type ;

PChar = > Far ptr ( use for win call in API)

GetMem = > malloc

StrPcopy = > Copy String to Pointer

StrCat() => Concatenates

+  => Concatenate strings

FreeMem => free()

A: Array [1..8] of integer;

int A[8];

 MyRec= record
i: integer;
d: Double;

accessing a record( structures)

var N: MyRec
N.i = 1000.1
N.d = 333.4

Pointer is untyped

Declare Pointers

Declare Typed pointers (like C's *)


PInt = ^Integer
PMyClass = ^MyClass


Program PtrTest

MyRec = record
I: integer

PMyRrec = ^MyRec

Rec : PMyRec

 New(Rec)  -> allocate c++ new

Rec^.I:= 10; // ^. in pascal  is the same as    ->  in C
rec^.R:= 6.384

Dispose (Rec) // free(ptr)


Some SCJP Notes

Java Rules

class level variables are inited to  default values

&& or ||
 are called Short circuit because
they do not evaluate the next expression if the condtion is false

array length  is  0 based
String length is 1 based 


ALL *case* statements,
  that are palced after the first case statment that evalautes to
*true*   , will evaluates to true


switch (i)
case 1 :

case 2:
    // assume this evalutes     //to true
case 3:

case default :
        //evalautes to         // true 

1) -source 1.4 to enable assertions

2)  assert :false  makes disables assertiosn at runtime

3) The assertion statement is defined in the form of Expression1 : Expression2;  where Expression1 is a boolean expression and Expression2 is an expression that has a value

4)Assertion are not to be  used for  argument checking in public methods as it is typically part of the published specifications of a method, and these specifications must be obeyed whether or not assertions are enabled or disabled.

It is aslo not be used do any work that your application requires for correct operation.

5) Switch can use only short and INT

        ONE LINE statments after WHILE or FOR

!!!!!!!!EXAM WATCH
        SWITCH inside a (WHILE or FOR) that does NOT use the LOOP counter

6) Local variable get stored on the stack ,Other objects on the STACK

7) An object is can garbage colelcted When an object becomes unreachable by any code NOT JUST OUT OF SCOPE because there can be objects in the outer loop that could be referecing it .


               all primitives are a java keywords
        String is an OBJECT and is not a keyword.

!!Exam watch

double cant be used with << opertor

9 )if you yeald a thread it is stopped and goes into ready state

10) you can not start a  dead thread
!! EXAM WATCH ....
                SHORT does not have a declararion such as
        Short k = 35 S ; /// S ??? where did youget that

7) inteface def constants must public static and final

  all methods of the  if needs to be declared by the NOn abstract class.

8)default type of decimal in java is double

9) benefit of encapslation is to that the implementation of a class can be changed without breaking code that uses it.

10) + and - are unary operators

11) use left to right eval for ++ -- opertators .

12) Objective of oops is encapsulation, inheritance, polymorphism


 An unsigned right shift >>> by a smaller positive amount (< total of bits of type) of a
 small negative number will result in a large positive number.


   While assigning one type to the other the value should be in range and the precision of the type should not be lost.
   Precision includes sign and decimals.

  Construction of a sub class whose Parent Does Not have a Public-Default-Constructor.

  CompileTime Error

13)  The default contstructors modifier is the same as the access to the class

14) Transient and Static Vaiable are not Serializable

15) String Class overrides the equals menthod. StringBuffer does NOT.

15) Constructors and Static methods can not be overridden

16) Static and private methods do not participate in polymorphism .
        Private - > Not Accessible .Static -> Can not be overriden

17) The constructor of the base class is executed first.

18) writing your own DEFAULT CONSTRRUCTOR has NO EFFECT.

19) Nested classes can not be transient.

20) Strangely enough you can define an inner class in an interface.
interface IFace {
   public class X { //It is not member inner class
      void method_Of_X() {
         System.out.println("Without static modifier, it is still static nested class.");

21) anonymous class has one and only one constructor.
    You cannot explicitly define constructors for anonymous class, but compiler generates
    an constructor for it with the same signature as its parent constructor called.

22) Evaluations in java is from left to right . Beware of the i++  and the ++i operators.

23) Math class and Arrays are not serialzeable

24) Class level variables are inited to  default values

&& or ||
 are called Short circuit because
they do not evaluate the next expression if the condtion is false

26)Length of strings and arrays are 1 based and the array indexes satrt from 0.



ALL *case* statements,
  that are palced after the first case statment that evalautes to
*true*   , will evaluates to true


switch (i)
case 1 :

case 2:
    // assume this evalutes     //to true
case 3:

case default :
        //evalautes to         // true 

Getting OLD web Logic to start on XP - Loads Posix

Recently had to visit a client get his old weblogic server to start on his Enterpirse network.

 He said "I just tried _07 (on WinXP) and I not sure but I think the error I'm getting now about 'libmuxer not found' didn' happen with _06. Is that a known problem?

Got it form my memory. The WLS was trying to load the Posix performance pack
So I told him this

"You should be able to correct this with a  vm arg:"windows 2000".

Well, it feels good to have save a company and some good developers some valuable development time.

Java Newbe - Code based interview questions

. 1) class Super{

2) public float getNum(){return 3.0f;}

3) }


5) public class Sub extends Super{


7) }

which method, placed at line 6, will cause a compiler error?

A. public float getNum(){return 4.0f;}

B. public void getNum(){}

C. public void getNum(double d){}

D. public double getNum(float d){return 4.0d;}


4. public class Foo{

public static void main(String args[]){


finally{ System.out.println("Finally");}



what is the result?

A. print out nothing

B. print out "Finally"

C. compile error


12. public class Test{

public static void main(String[] args){

String foo=args[1];

Sring bar=args[2];

String baz=args[3];



java Test Red Green Blue

what is the value of baz?

A. baz has value of ""

B. baz has value of null

C. baz has value of "Red"

D. baz has value of "Blue"

E. baz has value of "Green"

F. the code does not compile

G. the program throw an exception



27. public class SychTest{

private int x;

private int y;

public void setX(int i){ x=i;}

public void setY(int i){y=i;}

public Synchronized void setXY(int i){




public Synchronized boolean check(){

return x!=y;



Under which conditions will check() return true when called from a different class?

A.check() can never return true.

B.check() can return true when setXY is callled by multiple threads.

C.check() can return true when multiple threads call setX and setY separately.

D.check() can only return true if SychTest is changed allow x and y to be set separately.


public class Foo{

public static void main(String[] args){

StringBuffer a = new StringBuffer("A");

StringBuffer b = new StringBuffer("B");


System.out.println(a + "," + b);


static void operate(StringBuffer x,StringBuffer y){


y = x;

} // end operate


What print?

a. "A,B" b. "A,A" c. "B,B"

d. "AB,B" e. "AB,AB" f, "A,AB"



public class x implements Runnable{

private int x;

private int y;

public static void main(String args[] ){

x that = new x();

(new Thread(that)).start();

(new Thread(that)).start();


public synchronized void run(){

for( ; ; ){



System.out.Println("x=" + x + ", y=" +y);



a. An error at line 11

b. An error at line 7, 8

c. The program prints pairs of values for x and y that might not always be the same on the same line (for example "x=2, y=1")

d. The program prints pairs of values for x and y that are always the same on the same line (for example "x=1, y=1") in addition, each value appears twice (for example "x=1, y=1" followed by "x=1, y=1")

e. The program prints pairs of values for x and y that are always the same on the same line (for example "x=1, y=1") in addition, each value appears only once (for example "x=1, y=1", followed by "x=2, y=2)

1. public class x{

2. public object m(){

3. Object o=new Float(2.14F);

4. Object [] oa=new Object[1];

5. oa[0]=o;

6. o=null;

7. return o;

8. } // end m() method.

9. }

When is the Float object creation in line 3 eligible for garbage collection ?

a. just after line 5

b. just after line 6

c. just after line 7 (that is , as the method returns)

d. just after line 8 (that is, as the method ends)

1. abstract class AbstractIt{

2. abstract float getFloat();

3. }

4. public class AbstractTest extends AbstractIt{

5. private float f1 = 1.0f;

6. private float getFloat(){return f1}

7. }

what result?

a. compile success

b. An error at line 6

c. An error at line 4

d. An error at line 2



2. import;

public class ExceptionTest{

public static void main(String[] args){



}catch(IOException io){

System.out.println("caught IOException");

}catch(Exception e){

System.out.println("caught Exception");



public void methodA(){

throw new IOException();



what result?

a. The code will not compile

b. Output is "caught Exception"

c. Output is "caught IOException"

d. The program execute nomally whihout print a message



non-static method methodA() cannot be refereced from a static context.

3. public class Foo{

public static void main(String[] args)[

try{ return;}

finally{ System.out.println("Finally");}



what result?

a. Print nothing

b. Print "Finally"

c. Not compiled and will Exception thrown

d. Not compile because catch block missing



4. 1. class A implements Runnable {

2. int I;

3. public void run () {

4. try {

5. Thread.sleep(5000);

6. i=10;

7. }catch(InterruptedException e) {}

8. }

9. }


11. public class Test {

12. public static void main (String args[]) {

13. try {

14. A a = new A();

15. Thread t = new Thread(a);

16. t.start();


18. int j= a.i;


20. }catch (Exception e) {}

21. }

22. }

Which statement at line 17 will ensure that j=10 at line 19

A. a.wait(); B. t.wait(); C. t.join(); D. t.yield();

E. t.notify(); F. a.notify(); G. t.interrupt();



5. 1. public class SyncTest {

2. private int x;

3. private int y;

4. private synchronized void set X (int i){ x=i; }

5. private synchronized void set Y (int i){ y=i; }

6. public void setXY (int i) {set X(i); set Y(i); }

7. public synchronized boolean check() {return X != Y; }

8. }

Under which conditions will check() return when called from a different class. Choose one

A. check() can never return true

B. check() can return true when set XY is called by multiple threads

C. check() can true when multiple threads call set X and set Y separately

D. check() can only return true if synchTest is changed to allow x and y to be set separately



6. Which is a method of the MouseMotionListener interface

A. public void mouseDragged(MouseEvent)

B. public boolean mouseDragged(MouseEvent)

C. public void mouseDragged(MouseMotionEvent)

D. public boolean mouseDragged(MouseMotionEvent)

E. public boolean mouseDragged(MouseMotionEvent)



7. AnInterface is an interface.

AnAdapter0 is an non-Abstract, not-final with zero argument construter

AnAdapter1 is an non-Abstract, not-final without zero argument construter, but with a constructor to take one argument.

Which will create Anonymous class (choose two)

a)AnAdapter0 a = new AnAdapter0();

b)AnAdapter1 a = new AnAdapter1();

c)AnAdapter0 a = new AnAdapter0(5);

d)AnAdapter1 a = new AnAdapter1(5);

e)AnInterface a = new AnInterface(5);


a and d are correct. B, c and e are wrong.

8. What is true about java.util.Arraylist (choose one)

a)The elements in the collection are ordered

b)The collection is guaranteed to be immutable.

c)The elements in the collection are guaranteed to be unique.

d)The elements in the collection are accessed using a unique key

e)The elements in the collection are guaranteed to be synchronized


A is correct.

ArrayList implemnets all optional List operation.

b is wrong because lists typically allow duplicate elements. C is wrong this is Set facility. D is wrong because this is Map facility.

E is wrong, Note that this implementation is not synchronized. If multiple threads access an ArrayList instance concurrently, and at least one of the threads modifies the list structurally, it must be synchronized externally ( refer documents )

9. 1.class A{

2. public int getNumber(int a){

3. return a +1;

4. }


6.class B extends A{

7. public int getNumber(int a){

8. return a + 2;

9. }

10. public static void main(String args[]){

11. B b = new B();

12. System.out.println(b.getNumber(0));

13. }


a)compilation succeed and 1 is printed

b)compilation succeed and 2 is printed

c)An error at line 8 cause compilation fail

d)An error at line 12 cause compilation fail


B is correct.

10. Which two are equivelant







b and c are correct.

11. public class TestAnonymous {

public static void main(String []args){

final StringBuffer s1=new StringBuffer();

final StringBuffer s2=new StringBuffer();

new Thread(){

//Anonymous class

public void run(){







} // end synch..(s2)

} // end synch..(s1)

} // end run

}.start(); // end anonymous class

new Thread(){

//Anonymous class

public void run(){







} // end synch..(s1)

} // end synch..(s2)

} // end run

}.start(); // end anonymous class

} // end main

} // end Test class

What is the result? ( choose two )

a)print ABBCAD

b)print CDDACB

c)print ADCBADBC

d)The output is a not-deterministic point because of a possible deadlock condition

e)The output is dependent on the threading model of the system the program is running on.


a and b are the correct answer

int i=1;

int j=i++;

if( (i>++j) && (i++==j) )

i += j;

What is the value of i after this code is finished?


i = 2 is the correct answer.

which two CANNOT directly cause a thread to stop executing?

a. exiting from a synchronized block

b. calling the wait method

c. calling the notify method on an object

d. calling a read method on an InputStream object

e. calling the setPriority method on a Thread object


I choose d and e

which is correct for declaring a character

a. char c = "a";

b. char c = '\'';

c. char c = ‘cafĂ©’

d. char c = '\ucafe';

e. char c = 'u10100';

f. char c = (char)true;


b, d

public interface Foo {

( ) int k=4;


which one the right to describe int k = 4 in interface foo? (choose three)

a. abstract

b. private

c. volatile

d. protected

e. static

f. public

g. transient

h. final


I choose e,f and h

switch(i) {}

which one i will accept it?

a. byte

b. long

c. duoble

d. float



The accepted values for I are: byte, int, short, char

Given an Action Event which method allows you to identify the affected Component?

a. public Component getClass() b. pubilc Object getSource()

c. public Component getSource() d. public component getTarget()



int i=1; int j=10;


if(i>j) continue;


}while(++i<6 br="">

After execution, what are the value for i and j?

a. i=6 and j=5

b.i=5 and j=5

c.i=6 and j=4

d.i=5 and j=6

e.i=6 and j=6


correct answer is ( a ): i = 6 and j = 5

String s="base";




What is the result of s? (note: there was a TextField to write your answer into it )



which statement is true? ( choose one )

a. the Error class is a RuntimeException

b. No exceptions are subclass of Error

c. Any statement that may throw an Error must be enclosed in a try block

d. Any statement that may throw an Exception must be enclosed in a try block

e. Any statement that may throw a RuntimeException must be enclosed in a try block


I am not sure if < b > is correct or not.

byte b = 127;

byte c = 126;

byte a = b + c;

what is the result?

a. a will equal to 253

b. compile error

c. exception at 1

d. exception at 2


b is correct. compile error: possible loss of precision. To solve this problem, cast it

byte a = (byte)(b + c);


import java.awt.*;

public class Test extends Frame {

public static void main(String [] args) {

new Test();


Test () {

add( new Label(“Hello? );

add( new TextField(“World? );

add( new Button(“Ok? );





what is the result?

a. compile error

b. three components will appear, Label at North, TextField at South and Button at Center.

c. only one Button at the Center

d. Frame will appear, but nothing there

e. exception will be thrown



String foo = “blue?

boolean [] b = new boolean[10];


foo = “green?

System.out.println(“foo: ?+ foo);

What will foo print?


Foo: blue

String s = “hello?



System.out.println(“s: ?+ s);

What is the result?


S: hello

Strings are immutable.

private class Test {………}

public class Test2 extends Test {……..}

what is the result? (there are options to choose)


Compile error because private not allowed to declare classes.


protected class Test {……?}

public class Test2 extends Test {……..}

what is the result? (there are options to choose)


Compile error because protected not allowed to declare classes.

78. Which will return an int value very nearer to and not greater than

the given double value?

a) int a=(int)Math.max(double)

b) int a=(int)Math.min(double)

c) int a=(int)Math.ceil(double)

d) int a=(int)Math.floor(double)

e) int a=(int)Math.round(double)

Ans d

83. public static void main(String args[]) {

int i=1;

int j=10;




j - -;

} while(++i<6 br="">
System.out.println("i= "+i+" j= "+j);


What will be the output?

a) i=4 , j=5

b) i=5 , j=6

c) i=5 , j=5

d) i=4 , j=6

e) i=6 , j=5

Ans e

Q#14 method of mousemotionlistener interface

A. public void mouseDragged(MouseEvent)

B. public boolean mouseDragged(MouseEvent)

C. public void mouseDragged(MouseMotionEvent)

D. public boolean mouseDragged(MouseMotionEvent)

E. public boolean mouseDragged(MouseMotionEvent)



Q#19 output of the following program

String foo = "blue";

boolean [] b = new boolean[10];

if(b[0]) {




246. Which of the following two declarations used to read a file

called ‘Test.txt?

a) RandomAcceesFile raf=new RandomAcceesFile(“Test.txt?;

b) InputStream is = new FileInputStream(“Test.txt?;

c) InputStream is = new


d) FileInputStream fis = new FileInputStream(new File(“Test.txt?);

e) FileoutputStream fos = new FileoutputStream(new File(“Test.txt?);

f) OutputStream os = new FileoutputStream(new File(“Test.txt?false));

Ans BD

252. How to append to file “Test.txt? (Select two)

a) FileOutputStream fis = new FileOutputStream ( “Test.txt? true);

b) OutputStream os = new FileOutputStream ( “Test.txt? “append?;

c) FileOutputStream fis = new FileOutputStream ( “Test.txt? “true?;

d) FileOutputStream fis = new FileOutputStream (new File( “Test.txt?);

e) OutputStream os = new OutputStream (new File( “Test.txt?, true);

Ans AD

27.A socket object has been created and connected to a standard intern

et sevice on a remote network server.Which construction give the most

suitable means for reading ASCII data one line at a time from the sock


A.InputStream in=s.getInputStream();

B.DataInputStream in=new DataInputstream(s.getInputStream());

C.ByteArrayInputStream in=new ByteArrayInputStream(s.getInputStream())


D.BufferedReader in=new BufferedReader(new InputStreamReader(s.getInpu


E.BufferedReader in=new BufferedReader(new InputStreamReader(s.getInpu


2. Which gets the name of the parent directory of file "file.txt"?

a. String name = File.getParentName("file.txt")

b. String name = (new File ("file.txt").getParent());

c. String name = (new File ("file.txt").getParentName());

d. String name = (new File ("file.txt").getParentFile());

e. Directory dir = (new File ("file.txt").getParentDir());

String name = dir.getName();

2. What are the range of values for a variable of type byte ?

   a. 2^7 to 2^7 -1
   b. 0 to 2^8
   c. -2^8 to 2^8
   d. -2^7 to 2^7 -1
   e. -2^8 - 1 to 2^8

14? ???? ?? c

int i=1;
int j = 2;
if(i ==1 || j==2)

?? || ???? | ???? ??? ??? ????.

55. Which can not be added to a Container ? (Choose two)

? a. an Applet
? b. a Button
? c. a Window
? d. a Menu
? e. a Panel

03] Which three are valid declare of a float?(Choose three)

? a. float f=-1;
? b. float f=1.0;
? c. float f=42e1;
? d. float f=0.02f;
? e. float f=3.03d;
? f. float f=0x0123;

Hotmail User Get Scroogled?

Did you know :

Hotmail, Outlook Outage Of 2013 is still on. Rest of the services work Calendar is still down. The word on the street is Microsoft is still experimenting. Way to go guys. I guess this is one of those great things that MS is doing for the network admin community. Now every admin can say if MS whole system can go down so can our! Like they made customers accept bugs with the launch of 97. That cycle was not broken until they launched Win XP. Will there be repeats of this , who the heck knows. I pitty all those people who are running their office on office 360. Too bad. 

This is not to say this can not happen with Google 'cause it has.   Lets me know if  and when you calendar and other services come back online!

Gmail is Back in the Apple App Store

Hello All iOS Users

Gmail app is back with lots of fixes on notification. You will need iOS 4 + to use this app.

A Simple Guide to Migrating your Hosting to server such as EC2 or Rackspace Cloud..

Weather you are doing this for the fun of it or doing for better availability, scalability or pricing; your domain may have the same importance.

Here is a list of steps that can help and may not a be prefect solution all the time but covers many 'oh I should have thought about that stories'.

Stage one:

Ensure that your DNS service allows you to lower you TTL to x seconds / minutes. DYNDNS 
is one such service that allows you to do that.  If you are asking yourself why this should be done the reason is simple. TTL is how long before that new value is queried for. What this means is if your TTL is 30 Seconds, every 30 Seconds you can change your server address. So you potential loss of data is limited to that.

Stage two : 
Migrate your email before hand to google apps free or live. Before you set up this forward all mail to new box. This way all mail will still come to your email and will still be live during migration.

Stage 3:
Before you start:
  • Get All your passwords and access mechanisms such as VPN key etc ready and active.
  • Create a situation specific check list which you will need to check in the and before shouting "Im going home !!".

Copy all data and code and the works to new location and test it.  Recommendation use server to server transfer servers are on high bandwidth so its usually faster. Also saves you one step.
Useful commands on Linux.

  • scp
  • ssh
  • rsync
On Amazon EC2, you will need to allow port wise access to get the server accessible via you aws console.

Stage 4: 
 Notify users on upcoming maintenance.

Stage 5: 
Put the old site on maintenance so that new data does not get added during migration after and repeat stage 3  for new data and files.

Have a team check and double check every thing. Get your bosses to sign off on working status so that the responsibility is joint.  Expect migration issues due to human error. Address it pro-actively as far as possible.

Just one more thing have monitoring tools  automatically notify you of downtime as you are in a new setup may be text or email you. Having a blackberry will help for push mails. It better for you to handle it before someone says hey server is down. Media Temple is infamous for unannounced downtime.

Plan for the worst because the best will take care of itself.

All the best for a safe migration!


IOS 5.01 Update Released

Hello iOS Lovers. iOS 5.0.1 is available for download.

  • Fixes Batter life 
  • iCould 
  • Voice over (Australian)
Let us see if Battery Life is better. But  I will tell you what . Looks like WIFI is more active now.

Let me know your experience.

Apple Filesystem HFS+ is cool becase .....

Here are some reasons why HFS is cool

1) It has built in defgrag ( works when needed / possible )

2) Shrink you Filesystem when need. This is a really cool feature!!! Microsoft must learn this trick. But for now MS can depend on GParted under Linux ;P. What is better it moves the recovery partition when system partition resizing! Intelligent resize! MS are you listening!!

3) It can act as a version control system for your files ( want to go back to the old one 2 hours ago? 2 days  or 2 months. Sure Time machine will allow you to do that )!

Note: TM need HFS.

IOS 5.0.1 is in Beta

iOS 5.0.1 is now in Beta.

Download from.

Apple says "

iOS 5.0.1 beta is now available on the iOS Dev Center. It introduces a new way for developers to specify files that should remain on device, even in low storage situations.


Does this mean another XCode update ? God Forbid.

I also feel that Apple has started releasing unstable products. Is this a way to tell the world that the are still some capable hands in Apple. If it is, its definitely not working now!