Sunday, December 22, 2013

Start learning Ruby- Installation and Introduction (Republishing)

Start learning Ruby- Installation and Introduction

         Ruby is a programming language which were born in Japan and Japanese human language and adopted to English.
Rather than telling about history I'll move to practical stuff now.
Installing Ruby
If your using Windows OS download the setup from http://www.ruby-lang.org/en/downloads/ else if your using Linux OS install using "yum install ruby"
 In Windows you may need to add the RUBY_PATH to classpath enviornment variable.
Once you have installed the rupy you can check it using following command by opening your terminal.
ruby -v
Hello World Program
Here we are going to run our first hello world program
Open your favorite text editor
Here is the butyl, you may remember your first Java/c#/etc Hello World program which having more than 4 lines. See the ruby hello world
Type following code:
puts "Hello World";
Save it as any name you wish(mine is first.rb) with .rb extension.

From your comman prompt/terminal cd to the file location execute using following command,
$> ruby first.rb
This print 'Hello World' on your terminal.
Thats it for the moment in future i'll come up with some more ruby programming.

Useful Linux/Unix Commands

Useful Linux/Unix Commands

Ruby - OOP (Republish)

Ruby - OOP

Ruby is a 100% object oriented programming language. When i make this statement you may question me "Your now saying the Ruby is a 100% oop language, but you haven't create a even single object in your hello world demo? ". Here is the answer.

puts "Hello World";

When you run the above code a default main object is created on the memory and puts method is invoked with "Hello World" argument.

Now i briefly explain how to create your own class, method and object.

class MyClass
def saysomething
puts("Hello")
end
end

my_class = MyClass.new
puts my_class.class
my_class.saysomething

Note on the code
-----------------
* class declaration started by class MyClass and ends with end.
* methods are declared using def keyword following method name, ends with end.
* Object is created by invoking the new method of the class. new method is inherited from top most parent class.

Saturday, December 21, 2013

Professionalism


NOTE for readers : This blog is not edited

What we should have learnt in our know before we entering in to professional life

We are learnig several profession related stuffs but the mostly missing stuff in course meterial in the professional/accadamic studies are professional discipline or professional ethics.

Professional Ethics
How they should handle the discipline ? What are the stuffs effecting a persons discipline ?
    Family/Personal background and Area there living and many more.

Profession and Personal
  What and why the professional/accadamic studies should teach ethics and  discipline ?

My father says in my child hood - "First discipline, next is the Education", today I can feel what is it.

Professionals need a self assestment about there attitute/behavior/discipline

Notifications of bad behaviors.
  Affecting self respect.
  Destroying the good working enviornment.
  Hurting others mentally.


In my profiessional life I am watching many fresh professionals, many kind of. When traing fresh people we are considering to improve there soft and techinal skills.
So the professional skill diviated to two categories Soft skills and Techical skills.

To develop soft skills there are several sources, based on the persons capacity it improves automaticaly with experiance which the person gain.
But when we consider to develop soft skills there are several things to be consider.
1st school level deciplin
  If shcools level deciplin is missing in professional level in a comapny we can do anything, actual those kind of people are must be eliminated in the interview befor the intake.

  Sports, Chines Marcial Arts(Kun fu), Meditation are helps to improve pations that allso helps to improve the attitute.

  What is attitute
 1 Positive attitute.
  Behaviours that may improve your self and helps others too.
 2 Negative attitute
  Behaviours which affects others badly.
  THis needs further discussions since which affects others, it is a public offence in professional level it is a professional offence and it discurage the profession and the person is not eligible to be in this profession. A professional is an entity of the profession who represents the profession. For example  when you do a project, you are meeting the customer. First you represent your company next you represent your profession. From your behaviour there will be an assesment on your company and profession. Bad behaviours or un-professional behaviours destroys the reputation of your company and the responsibility also shared to other professionals under that profession. Every persona in the profession have responsibilities to chase harm full people out of the profession.


Hibernate the Persistence Provider

Hibernate the Persistence Provider

Hibernate is a most interesting framework I'm using and used.

This is an implementation of JPA(Java persistence API) standards. There are several other implementations like EclipseJPA.
This to recap the important points of the Hibernate/JPA. This writing would be more into conceptual rather than technical.

Set-up
Setting up the Hibernate to over project is the first step everybody do/ need to do.
Choosing database driver, setting up the data source, connection pool and transaction manager with username password, driver class, dialect, etc. Finally introducing the persistence unit for the application.
This depends on the technology stack, if the application plan is to deploy it in a application server the set-up would be creating the data source in whatever application server and pointing the JNDI name in the persistence.xml.

ORM starts...
Starting to write the entity classes and relationship between them. Entity classes are nothing but a set of POJO's, and in additionally which contains mapping metadata.
Here where the mapping starts. The ORM step is building a mapping/contract between the Java code and the database. Telling that I'm representing this POJO for this particular database table and relationship between table.

When doing the mappings developers should notice a point her, each implementations of JPA provides its own annotations. What if you decided to change your persistence provider from Hibernate to OpenJPA?
Trick is never use implementation API's, always use standard JPA API's which is available under package javax.persistence.* so the you can swap your provider any time.

Under ORM mapping interesting part is relationship mapping...
@OneToOne
@OneToMany
@ManyToOne
@ManyToMany

Each can be bidirectional or unidirectional, bidirectional means both party knows each other in other word both side reference mapping would be there. Unnecessary bidirectional is not recommended.
Mapping needs to be discussed in detail, may be in another separate time.

Query Writing
JPQL Java Persistence Query language is the alternative for SQL which is used for query the database when JPA is used.

In my past experiences I consider following is an important points that an Hibernate expert would know rather than basics

+ What is the output type of the JPA/Hibernate native query?
Answer : Object / Array of object types

+ What is the mapping should be used if the relation should be deleted while updating with detached?
Answer : orphanRemoval=true