Saturday, April 14, 2018

AOP Concepts

AOP Concepts

Aspect
Central unit
contains the code that explains the weaving rules

Join Point
Points in the execution of an application (Execution points)
Places where the crosscutting actions taken place

Pointcut
A mechanism for selecting join points
Program construct that selects join points and collects context at those points.
Collect the join point context
Eg : execution(public * *.*(..))

Advice
Before
Around
After

BeforeReturn
AfterReturn

BeforeThrow
AfterThrow

Saturday, October 21, 2017

Synchronizing with Public/Open Source source code

Usecase/Problem Scenario :
- I am using an opensource source project as a base for my project.
- I need to make my custom implementation/changes.
- But the open source project is still under active development.
- I need to merge the changes from public project to private project which is in another repo.

Solutions is:
1. Clone the public project in local.
git clone -o https://github.com/sample_project.git

2. cd into the your project, which you have clonned already.
cd my_project

3. add the base project as a remote reference to your repository
git remote add -f base_project C:\sample_project

4. Pull the changes.
git pull base_project master --allow-unrelated-histories

5. Resolve the conflicts & commit

Limitations:
- Need to perform the pull manually each time. Which is in another way is safe.

Above is the solution which I formulated based on the references I made. Please let me know is there any further limitations in this approach.
Welcome if there any better alternative of this use-case.

Make use of Subversion (SVN)

NOTE : THIS IS AN UNFINISHED ARTICLE. PLEASE EXPECT ERRORS

What is version control?
What is SVN?
Why you need a version controller?
How to use a version controller?
My intrest on start this blog is to discuss about How to use a version controller. But to give more clarity, I have started with some concepts as well.
A version controller is a tool that manages the versioning of your source code(my point is versioning the source code; there are several tools that manages other stuff also; eg. Document version control).
This enables you to go privious and forward in your change history.
Each change commit will be given a unique version.
When a version controler is useful. Does it useful for a single man project; a univercity project. 
I have experiance of deleting source code and searching for a backup. Situation like confuced among two backups, which is latest?
So yes. Its useful for even single man, 5 files project.
To agree on me you need to know advantages of it. Ask Google.... it will tell you more than this.
Hurre im using a version controller, version management of my code is cool. NO!
He he, this is ware the intreresting poit comes. Any version management tool will helps you to manage your code versioning, it ONLY helps.
What ever tool you use version manageent of our code is purely depends on your practice.
Your update and commit practice.
Ah at least now came to the point i wanted to talk about.
How to use svn.
Always keep your code updated. Referances saying that every 10 to 20 minuits the source code should be updated.
This is very important in multy player projects. 
Actually the concept is 
Repository should always have wroking code.
Commit practice it very important part and debeatable part. When and what should i commit to the repo.
Your commit practice is depends on your coding practice. 
Actually recommended way as i think is each time when you completed a unit it has to be commited. Several units togather builds a feature or function. A unit is a pice of code which is testable and which adds value the the project.
All version controller allows to add a commit message while commiting. This is a very importent point. This is what helps us to understand what has been commited in this revesion. So make use of it. Usual recommendation is keep it short and meaningful.

PS :
6Published with Blogger-droid v2.0.10

Friday, July 15, 2016



Less IFs, more power.

Have you ever wondered how IFs impact on your code? Avoid dangerous IFs and use Objects to build a code that is flexible, changeable and easily testable, and will help avoid a lot of headaches and weekends spent debugging! Share how to write effective code the easy way!

The goal of the Anti-IF Campaign is to raise awareness of the effective use of software design principles and practices, by first of all removing bad, dangerous IFs.

Friday, February 7, 2014

Oracle DB Character set

We had a problem last week in our project environments, which is related to database.
Some persistent operation (Same text insertion ) working on SIT db and the same is not working on UAT db : 

So did checked the difference and found that their character set used is different.

This results in different length check for same input text.

The problem happened with VARCHAR column type and the UI for particular field is a free text element.

Executed the following query in both the environment to get some information on character sets.

SELECT * FROM NLS_DATABASE_Parameters WHERE parameter = 'NLS_CHARACTERSET';
SELECT * FROM NLS_DATABASE_Parameters WHERE parameter = 'NLS_NCHAR_CHARACTERSET';

Found the following information regarding that :

NLS_CHARACTERSET is used for CHAR, VARCHAR2, CLOB, columns and NLS_NCHAR_CHARACTERSET used for NCHAR, NVARCHAR2, NCLOB columns.

The output of the above queries matters on low level encoding of column values in the DB.

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

Friday, April 20, 2012

Symfony Setup In Simple Steps



1. Symfony installation
1. Download the Symfony zip file symfony-1.4.17.zip
2. Create project directory
mkdir sfprojects/jobeet
3. create lib/vendor directories inside project root
mkdir -p sfprojects/jobeet/lib/vendor
4. copy the downloaded ZIP to [project_root]/lib/vendor, unzip it and rename to symfony
cp [zip_name].zip sfprojects/jobeet/lib/vendor
unzip [zip_name].zip
mv [unziped_zip_name] symfony
rm -f *.zip
5. Verify the installation
php lib/vendor/symfony/data/bin/symfony -V


2. Project Creation
1. Generate the project using "symfony generate:project [project name]"
php lib/vendor/symfony/data/bin/symfony generate:project jobeet


3. Application Creation
1. Generate application using "symfony generate:app [app_name]"
php symfony generate:app frontend


4. Web Server Configuration
1. Adding Virtual host
In /etc/httpd/conf/httpd.conf, end of the file


<VirtualHost 127.0.0.1:80>
 ServerName www.jobeet.localhost.com


   DocumentRoot "/home/sfprojects/jobeet/web"
 DirectoryIndex index.php
 <Directory "/home/sfprojects/jobeet/web">
   AllowOverride All
   Allow from All
 </Directory>
 Alias /sf /home/sfprojects/jobeet/lib/vendor/symfony/data/web/sf
 <Directory "/home/sfprojects/jobeet/lib/vendor/symfony/data/web/sf">
   AllowOverride All
   Allow from All
 </Directory>
</VirtualHost>


2. Adding host configurations
In /etc/hosts
        127.0.0.1 www.jobeet.localhost.com


5. Checking new configurations
Check the url in the browser www.jobeet.localhost.com

Saturday, November 12, 2011

Management

A manager is like a chess player, for a better play you win together.
In order to manage people those people must know your management powers.