Wednesday, December 15, 2010

Lesson4 - Some tips

  • Java is case sensitive. Syntax words need to be declared or written in the required cases. For eg. String has to be written in INIT CAPs. 'if else' statements the words have to be in lower case.
  • '+' is the string connector operator.
  • Every application has to have a main method.
  • PATH - is the system parameter where the JDK exists along with the other JAVA libraries which contain apis or methods that can be used in your programming. System.out.println is one such method.
  • CLASS PATH - is the system variable where the .class files are stored. For any method to invoke a method of some other class, both the classes need to be stored in the same class path.
  • public static void main - public : method has to be defined as public if you want other applications to call the method.
  • void - void signifies that the method doesn't return any data.
  • static - static signifies that the method can be invoked without object. Generally methods are called as object.method, but if declared as static then you can just invoke the method without the object.

Tuesday, December 14, 2010

Lesson3

BASIC CONCEPTS Of OOP (Object Oriented Programming)

Objects - You can say that Objects are representations of physical elements. For eg. Bicycle. A complete status or Objects will have properties and states. This is similar to objects in pl/sql; in pl/sql we define the objects in terms of the attributes or columns.

Bicycle states (current speed, current pedal cadence, and current gear).

Methods - Method is the process by which the states are changed. This is analogous to a procedure in pl/sql.

Classes - You can think of class as a collection of methods and object properties.
For eg. In the below Bicycle class pedal cadence, speed and gear are the properties/states.
changeCadence, changeGear, etc are methods to bring about changes in the
states or properties.
class Bicycle {         int cadence = 0;        int speed = 0;        int gear = 1;         void changeCadence(int newValue) {             cadence = newValue;        }         void changeGear(int newValue) {             gear = newValue;        }         void speedUp(int increment) {             speed = speed + increment;           }         void applyBrakes(int decrement) {             speed = speed - decrement;        }         void printStates() {             System.out.println("cadence:"+cadence+" speed:"+speed+" gear:"+gear);        } }

Inheritance - In reality there are many kinds of bikes like mountain bikes, dirt bikes, etc ... Each of the above can be classified as a class in its own due to some unique features while some features would be same in all the bikes. Say the properties of the class Bicycle would apply to both MountainBikes and DirtBikes hence you would like to extend the properties and methods of class Bicycle to Classed MountainBikes and DirtBikes - this lending of a properties and methods of a class to another is called inheritance.

Syntax ...
class MountainBike extends Bicycle {       // new fields and methods defining a mountain bike would go here 
}

Interfaces - collection of methods without bodies. In analogy with pl/sql you can say its a package specification.
interface Bicycle {         void changeCadence(int newValue);   // wheel revolutions per minute         void changeGear(int newValue);         void speedUp(int increment);         void applyBrakes(int decrement); } 
To implement this interface, the name of your class would change (to a particular brand of bicycle, for example, such as ACMEBicycle), and you'd use the implements keyword in the class declaration:
class ACMEBicycle implements Bicycle {     // remainder of this class implemented as before  } 
Implementing an interface allows a class to become more formal about the behavior it promises to provide. Interfaces form a contract between the class and the outside world, and this contract is enforced at build time by the compiler. If your class claims to implement an interface, all methods defined by that interface must appear in its source code before the class will successfully compile.

Packages - A package is a namespace that organizes a set of related classes and interfaces.


  • Real-world objects contain state and behavior.

  • A software object's state is stored in fields.

  • A software object's behavior is exposed through methods.

  • Hiding internal data from the outside world, and accessing it only through publicly exposed methods is known as data encapsulation.

  • A blueprint for a software object is called a class.

  • Common behavior can be defined in a superclass and inherited into a subclass using the extends keyword.

  • A collection of methods with no implementation is called an interface.

  • A namespace that organizes classes and interfaces by functionality is called a package.

  • The term API stands for Application Programming Interface.
  • Saturday, December 11, 2010

    Lesson2

    Code Snippet provided earlier -
    /**
    * The HelloWorldApp class implements an application that
    * simply prints "Hello World!" to standard output.
    */
    class HelloWorldApp {
    public static void main(String[] args) {
    System.out.println("Hello World!"); // Display the string.
    }
    }
    -------------------------------------------------------------------------

    Comments - text to be ignored by compiler
    have to written between /*

    'class' is like a package name in PL/SQL and is always a must. Begin and End of a class are denoted by curly brazes.
    class followed by application name is the general convention.

    Every application must contain a main method - this is similar to a procedure in pl/sql.

    public static void main(String[] args) {
    System.out.println("Hello World!");
    }
    Note the declaration - enclosed within the round bracket are the parameters passed to the method.
    String[] args -- is a declaration for an array of input strings; 'args' is just a name to the input array and not a key word.

    System.out.println("Hello World!") - syntax to print messages on the screen. println method exists in the System class and hence called using the mentioned syntax.

    That concludes Lesson2

    Lesson

    Suddenly Started learning Java . have been thinking to do this since long. I have decided to pen all my learnings and what better place than my own blog. Here goes the first day learnings.


    I am not using any IDE (some Development Environ.) hence have to go through the hassles of downloading JDK and setting the compiler path also called as CLASS PATH.

    JDK is the Java Compiler. You need to install the JDK in your machine.
    The source code files are to be saved with an extension .java. After compilation a new file (which is the executable) gets created and has the same file name as the source code file but has a new extension called .class. You can take this .class file to any machine and run your program, the machine need not contain your source code.


    After installing JDK you need to set the Class Path. Locate the JDK Bin folder and note/copy the path.
    Go to Control Panel > System > Advanced Tab > Environment variable; in system variables you will find a variable called path - edit this; to the existing text add a ';' and paste the class path.

    Now that the class path is set, you are ready for compiling your source code. Go to Command Prompt (Run > CMD) and traverse to the folder where you have saved your .java file. From here type javac and then hit enter. This should create your executable.

    Now to run the program. From command prompt type java then hit enter.

    Lesson1 Over.

    BTW here is the snippet of HelloWorldApp -
    /**
    * The HelloWorldApp class implements an application that
    * simply prints "Hello World!" to standard output.
    */
    class HelloWorldApp {
    public static void main(String[] args) {
    System.out.println("Hello World!"); // Display the string.
    }
    }

    Monday, November 15, 2010

    Arrow vs Letter

    This one's picked off a movie.

    A letter thats posted is like an arrow which has left the bow for like the arrow you can not retrieve it back till it.

    Monday, October 18, 2010

    Smirnoff

    When I close my eyes, I see you as clear as the crystal sky
    With you in me I feel no pain as there is nothing to gain
    With you around there is nothing to fear as there is no chasing spear
    When drinking you, there are no shameful dots around as you just blot the world around

    People around dont take thee words for real...
    For these are words of a shaken soul which is just on a roll
    For these are just a farse that is sure to fade at the dawn ...

    Thursday, September 2, 2010

    Alif Allah, Arif Lohar & Meesha - Coke Studio

    Nice Recording - was amazed the whole recording seems to be done in one take

    Sunday, July 18, 2010

    Trust

    Just wondering what is trust?

    These were the n number of definitions that I got after googling.

    Trust 1

    Trust 2

    Definition: Credit given; especially, delivery of property or merchandise inreliance upon future payment; exchange without immediate receipt of anequivalent; as, to sell or buy goods on trust.

    Trust 3

    Definition: Assured anticipation; dependence upon something future orcontingent, as if present or actual; hope; belief.

    Trust 4

    Definition: That which is committed or intrusted to one; somethingreceived in confidence; charge; deposit.

    Trust 5

    Definition: The condition or obligation of one to whom anything isconfided; responsible charge or office.

    Trust 6

    Definition: That upon which confidence is reposed; ground of reliance;hope.

    Trust 7

    Definition: An estate devised or granted in confidence that the devisee orgrantee shall convey it, or dispose of the profits, at the will, or for thebenefit, of another; an estate held for the use of another; a confidencerespecting property reposed in one person, who is termed the trustee, forthe benefit of another, who is called the cestui que trust.

    Trust 8

    Definition: An organization formed mainly for the purpose of regulatingthe supply and price of commodities, etc.; as, a sugar trust.

    Trust 9

    Definition: Held in trust; as, trust property; trustmoney.

    Trust 10

    Definition: To place confidence in; to rely on, to confide, or repose faith,in; as, we can not trust those who have deceived us.

    Trust 11

    Definition: To give credence to; to believe; to credit.

    Trust 12

    Definition: To hope confidently; to believe; usually with a phrase orinfinitive clause as the object.

    Trust 13

    Definition: to show confidence in a person by intrusting (him) withsomething.

    Trust 14

    Definition: To give credit to; to sell to upon credit, or in confidence offuture payment; as, merchants and manufacturers trust their customersannually with goods.

    Trust 15

    Definition: To risk; to venture confidently.

    Trust 16

    Definition: To have trust; to be credulous; to be won to confidence; toconfide.

    Trust 17

    Definition: To be confident, as of something future; to hope.

    Trust 18

    Definition: To sell or deliver anything in reliance upon a promise ofpayment; to give credit.

    trust 19

    Definition: the trait of trusting; of believing in the honesty and reliability ofothers; "the experience destroyed his trust and personal dignity"

    trust 20

    Definition: certainty based on past experience; "he wrote the paper withconsiderable reliance on the work of other scientists"; "he put more trustin his own two legs than in the gun"

    trust 21

    Definition: complete confidence in a person or plan etc; "he cherished thefaith of a good woman"; "the doctor-patient relationship is based on trust"

    trust 22

    Definition: a consortium of independent organizations formed to limitcompetition by controlling the production and distribution of a product orservice; "they set up the trust in the hope of gaining a monopoly"

    trust 23

    Definition: something (as property) held by one party (the trustee) for thebenefit of another (the beneficiary); "he is the beneficiary of a generoustrust set up by his father"

    trust 24

    Definition: a trustful relationship; "he took me into his confidence"; "hebetrayed their trust"

    trust 25

    Definition: have confidence or faith in; "We can trust in God"; "Rely onyour friends"; "bank on your good education"; "I swear by mygrandmother''s recipes"

    trust 26

    Definition: be confident about something; "I believe that he will comeback from the war"

    trust 27

    Definition: expect and wish; "I trust you wil behave better from now on";"I hope she understands that she cannot expect a raise"

    trust 28

    Definition: extend credit to

    trust 29

    Definition: confer a trust upon; "The messenger was entrusted with thegeneral''s secret"; "I commit my soul to God"

    trust 30

    Definition: allow without fear


    Believe me in someway or the other with so many humans around us it is shattered to pieces daily.

    But daily morning I see it back in its shining beautiful shape to be broken yet again.


    Sunday, June 6, 2010

    Sarab Kavita

    Thank God for making alchohol it helps you forget pain - physical as well as mental.

    Saturday, May 22, 2010

    Sharab

    Phir Haath mein Sharaab hain Sach Bolta hoon main - this Pankaj Udhaas ghazal touches your heart no matter in which part of the universe u r in and fi you are drunk then dont even ask - this ghazal seems so true that u completely immerse in the soul of the song.

    You start to remember the small things - the times when you dropped her to the various places she asked you to drop her. Then you remember of the times when you went to her work place on some behest and she came to yours on some but deep down both of us knew we were there just to have glimpse of each other.

    Then you realise that she completes you then why am I alone here with a glass filled with 200 ml of JD.

    Enjoy the song ..

    Sunday, May 16, 2010

    Quotes ...

    Below Quotes made my parents anxious ---

    I have a question - why do people have so many questions?

    In a relationship no matter whoso ever's fault it is, the distaance between the two is what icreases.


    Life - The Journey Never Ends

    This is the topic of my book - btw I do plan to author a book, when this happens you will know...

    Saturday, May 15, 2010

    Robin Hood

    Another Ridley Scott movie...
    Well... if you expect this movie to be comparable to Gladiator then you are going to be dissappointed. If you are planning on going for the movie then get this stright - this movie is about The Making of Robin Hood and not about Robin Hood and his merry men. This is a 2 hours 20 mins movie with all kinds of masala that is you find in a typical Boolywood movie from Romance to Dance.

    You will not come across any titilating fight sequences as in Gladiator. This movie more or less revolves around then fact that corruption and greed of men lead to a rise of an revolution. As in this case its the greed of the King John and the Philip (French king) that led to the rise of Robin Hood.

    I will not tell you the story here as I feel the movie is worth watching, some might feel other wise. You should watch it for the elaborate sets and planning thats behind the making of the movie and also the little bit of history which tell how Robin Longstride, an archer in the English army turned into an outlaw called Robin of the Hood.

    Enjoy... the show...

    Monday, February 15, 2010

    My Name is Khan

    Didnt live upto expectations. Surely the green must onto work here for it made to the A list of most of the reviewers.

    Dont waste ur time; invest the 3 hours doing something even throwing stones into a still water will get u more excited than the movie.


    Thursday, February 11, 2010

    Introduction to Materials Management (6th Edition)

    Looking to Buy


    Introduction to Materials Management (6th Edition)

    Tony Arnold, Stephen N Chapman ...

    Any one selling this please mail me .......

    Sunday, January 31, 2010

    Hanuman Temple Gilroy.



    Today I went to this Hanuman temple at Mt.Madonna, Gilroy CA.

    This temple is within a nice private community called the Mount Madonna Center.
    Address - 445 Summit Road Mount Madonna, CA 95076. Ph. 408 722 0226.

    The Sankat Mochan Hanuman Temple is located within the grounds of the Mount Madonna Center. The center is located in the Santa Cruz Mountains about 15 miles from the town of Gilroy and about 12 miles from the town of Watsonville.

    The temple is open from morning 6 to evening 6 from Monday to Saturday and on Sundays from 4 PM to 7PM. Aarti time is morning 6AM and one on evening 6 PM.


    Reaching this place is quite a challenge as the GPS shows a route which is quite narrow and the roads are so bad, ladden with pot holes that you can't travel on them on a rainy day.

    Either follow the instructions here - http://www.mountmadonna.org/directions/bycar.html

    OR

    Please follow the instructions below to reach the place - (note the instructions fromt he above link - I need to confirm this route after next visit.)
    1. Reach Gilroy Gardens: 3050 Hecker Pass Hwy, Gilroy, CA 95020 (Gilroy Gardens) using your GPS.
    2. Turn off your GPS and keep going straight on Hecker Pass Rd - at a T junct (note T-junction) turn right onto Pole Line Road.
    3. Go on Pole Line Road and then merge onto the Summit Road.
    4. After around one mile or so you will see the Mount Madonna Center onto the left. Take a small left and enter the gate of the community and go ahead you will see the temple arch there.

    Please the note the road from Gilroy Gardens would be a single lane road with the hard yellow line separation for vehicle in the opposite direction.

    Enjoy your ride and drive safe.

    Some pics -



    Sunday, January 3, 2010

    Ch1 - SFTG - Confidence

    Welcoming the New Year with a new read (Straight From the Gut - Jack Welch).

    Read chapter one in which he talks abt how confidence was built in him by his father and mother and then through his teachers during his formative years.

    I liked the part in which his mom comes storming into the locker room to reprimand Jack on his reaction on loosing the game - which tells how important it is to know how to take failure gracefully as a steeping stone.

    In the end of the chapter where he mentions after joining GE as an assistant in the Chemical Lab. that he realizes about the bureaucracy that has set in GE (which seems true about every company that scales up) - it seems the initial ideology with which the FOUNDERS start enterprises is lost somewhere in the path as it scales up.

    I guess it would be interesting to find out how he was able to put up with the bureaucracy and bring about the change.