Skip to main content

Posts

Showing posts from 2011

IT Skills Re-Trainee Program Story

Structural Engineer friend of mine lost is his job 2 years ago and after applying for 600+ jobs during this time he was still jobless, later he got retrained in Data-Warehousing tool and found a full-time position with EBay Inc. Presently there are some sectors which are shrinking and some are booming, specially the IT with unemployment under 4% and jobs remaining open for months and if we can't produce enough people to work for this sector they will look somewhere else and it has already started and a lot many start-ups are outsourcing their products and even big enterprises are simply getting a lot of their work done offsite.


As you can see there is huge demand in IT sector, since we are in a process of rewriting the entire WWW for Touch devices and IT is no longer an option its the business now. Currently there is a huge demand for right skills in IT and on the other hand University education doesn't really produces right skills for the real market at right time as their e…

10 Best Practices for Successful Web Apps

Speed - How fast product responses to user actions.Instant Utility - Instantly be useful, people don't like lot of configurations. Populate the service with default data, let user get up and started in no time.Voice - Software has to have a personality, people have to feel they are consuming media. Less Is More - Simplicity is for startup and gives a platform to ultimately grow from their.Programmer - API's for others to usePersonal - Customer should feel more personal or more ownership of the application, by putting more of their data, avatar or names, people should invest more time and energyRESTFul - clean urlsSEO - Discoverable by google, social media etcClean - Make very inviting, not too much of data on pages.Mobile, Social, Intelligent, Playful

Why Re-Training Programs may create/fix Jobs in US

Proven: Re-Training Programs Institutes has worked for India. The IT boom started decade ago in India and has employed several millions of its workforce and many of these folks has acquired required skills in these institutes.


When I say it worked it means people are trained cheaply and quickly in skills which are highly desired in the job market and are able to get a job without having any formal degree in Computers.

Most of the job's advertised requires a degree and some skills, and at the same time these organization's don't have enough resources to train their new hires who lacks needed skills so its a balance they look for some degree (not necessarily a formal degree in Computers) with right skills are preferred. 


Lets compare Re-Training Program Institutes with University Education.


University Education
Opportunity to be a student for a long time which helps us listen, observe and learn from others, and this is not possible at the workplace.Very expensiveRequires longer c…

Use Java Melody to see into Production JVM and DB Stat's

Java Melody is an open source and production ready JVM and DB Monitoring tool, use it in QA, Stage, or  Production environments and it's similar to most other profiler's. Just drop couple of jar files into your war and monitor your application in real time.

Alternatives to Java Melody
JProfilerLambdaProbe, JConsole psi-probe (Lambda Probe fork)
Memory
Heap - helps you understand how much heap your application may need depending on the load and set -Xms and -Xmx appropriately


   Perm Gem, configure -XX:PermSize=128m correctly to avoid JVM Out of Memory Exceptions 



CPU - Understand how much CPU cycles your application used under different load so you can add more CPU's or Memory accordingly



1. Ehcache - 


Ability to see all created caches, their configuration, total objects in them, hits, and efficiency, this is really nice since you can monitor it in real time and keep tweaking until you achieve perfect configuration.


Monitor JDBC, JPA, Hibernate
SQL Hit Rate

SQL or Hibernate Query P…

Who is Qualified to Interview new Hire ?

This article is very specific to IT Industry.

 1. Focus
We all focus on how to find the best hire and if we don't have qualified people to find them then we never gonna find good people.


2. Problem
I believe not everyone is qualified for this job. "Non-Qualified" people are not qualified only in interviewing new hires and they might be good for what they were brought in. So what is the impact of having Non-Qualified people in an interview process ?
They will add no value to itThey will waste their and someone else timeIf there are more non-qualified people in the process they will certainly end-up with one moreIn a democratic process their bad vote weaken's a good oneTheir contribution most of the time will be negative*
3. So why Non-Qualified people are part of the process ? Management takes this too casually Too busyDon't realize the high cost of hiring and firing *
4. How to spot Non-Qualified People ?
Often they take things personally and screw conversationNo respe…
         Top 10 Apps missing in HP TouchPad

Without these Apps my experience is only limited to browsing web pages, though WebOS is really better multitasking device than iOS but without commonly used Apps it's only limited.
1. Native YouTube App  - You can't just use finger to do everything on 60% YouTube.com                    



  2. Netflix - I love to do multitasking, with Netflix running and ability to do other stuff























3 Facebook - Most of the people always like to be connected all the time here



























  My Mistake Skype Video is working
4  Skype - Ability to do voice and video chat, and without this I need to keep my Mac on.























  5 Google Talk - Ability to do voice, video chat with Gmail contacts




















   6 Yahoo Messenger - I need at least text chat
























  7 Yelp - Yelp should have their App here




















8  Dropbox - Convince Dropbox to make a native App



















  9  Hulu Plus




















  10  WebEx - I can join meeting right from my couch

What I like in Spring

What I like in Spring 
Spring IOC - Its all about programming to Interfaces, Though some people argue its a over killSpring Security - Protects URL's and Object Methods Spring JPA - Spring DataSpring TransactionsSpring SchedulingSpring support for JAX-WSSpring AOPSpring Testing - Ability to test Transactional objects and rollback


What is like most in Spring 3.x
Annotations - I hate XML, i don't have to switch files (xml and java) to finish my java class and bug free.@Async - love this, you can use this in many situations specially sending Emails. @Timer - Simple and great Timer implementation,@Cacheable - Dead simple method cache implementation, other alternative is to use Spring Modules framework's which has little complex configuration

What I like about ORM vs JDBC

Remember not one tool is right for all the problems, for instance if you are building something simple as Twitter which has couple of tables, and you have never used ORM, then its waste of time to learn ORM and do things, on the other hand if you are building something complex, evolving application and need more time to spend on solving business problems and UX then you can't effort to spend extra time on just figuring out how to store and retrieve data into a DB.

And here are the few things I like about ORM
Domain Model - Think data as Domain Object not as Tables and RelationshipsStandard Query Language - with JDBC we still get locked-in with proprietary SQL, whereas ORM provides great Query Language which is performance tuned for all supported DB'sLess Code - less testing, less complexity, and less time Concurrency and Locking - easily version data and protect data integrity in a concurrent environmentCaching - Great support for standalone and distributed cachingRe-Use - cons…

JQuery Mobile Split Screen 20-80 hack

Use JQuery Mobile's Grid Layout and just override "width" on "ui-block-a" and "ui-block-b" to split screen as per your need.

Tested on : iPad, iPhone, and PC


Below is fully functional page, you can download and open it in a browser to see the live demo. 

<!DOCTYPE html>
<html>
    <head>
        <title></title>
        <meta http-equiv="Content-Type" content="text/html; charset=MacRoman">
        <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0b2/jquery.mobile-1.0b2.min.css" />
        <script src="http://code.jquery.com/jquery-1.6.2.min.js"></script>
        <script src="http://code.jquery.com/mobile/1.0b2/jquery.mobile-1.0b2.min.js"></script>
    </head>
    <body>
        <div data-role="page" id="foo">
            <div data-role="header">
                <…

Validating CSV Files

What is CsvValidator ?
  A Java framework which validates any CSV files something similar to XML validation using XSD.

Why should I use this ?
  You don't have to use this and in fact its easy to write something your own and also checkout its source code for reference.

Why did I write this ?
  Some of our projects integrate with third party application which exchanges information in CSV files so I thought of writing a generic validator which can be hooked in multiple projects or can be used by QA for integration testing.

What is the license clause ?
GNU GPL v2

Are there any JUnit test cases for me checkout ?
 Yes, source

How to integrate in my existing project ?

Just add the Jar which can be downloaded from here CsvValidator.jar and you are good.

Instantiate CsvValidator constructor which takes these 3 arguements

         // filename is the the file to be validated and here is a sample         // list - defines all the fields in the above csv file ( a field has index, type, isOptional, rege…

Why I bought iPad1 after buying iPad2 ?

I needed a new Touch device for my 2yr old girl, though she already has an iPod Touch but she likes playing games and YouTube on my iPad 2 (bigger screen), so I thought of buying her a new touch device like an iPad.

Following were my requirements and options.

Requirements
Touch device (bigger than iPod) with Toddler games and YouTube.Liter (Ultra Portable) and Durable (should last an year with ruff usage).Don't care for - Camera, Multitasking, Big CPU, RAM.Options


Device                    Price  Weight     Pros / Cons
iPad1                       349      680 g       Less expensive then others                          
                                                          Transfer purchased apps from iTunes
                                                          Same OS of iPad2 
Slower CPU, RAM

iPad2                       499      601 g     Transfer purchased apps from iTunes                                         
                                                          Great U…

Why companies don't launch Mobile/Touch products at same time in Asia ?

This question came recently in our daily meeting and my colleagues were explaining all the benefits of launching Mobile/Touch Products same time in US and in Asia (China, India, Middle East). These are the few points/advantages of introducing products same time in Asia.
Huge Consumer market ( 600 Millions) and is as mature as US.People love/admire for great products (Apple, Android, Samsung etc)Duty/Tax free destinations (Dubai etc)Seems a very potential market for launching products same time.So why biggies hold off their product for atleast 6 months before they really enter these markets and some people might argue its because of import/export regulations and shipment on the contrary all these products are assembled in Asia and these companies have bigger footprint in these markets.
People directly involved in these decisions are the right person the give us inside but here is my opinion.
Brand Building  Silicon Valley/USA is the best place to Build Brand cheaply i.e. you don't h…

How to use Jpa Hibernate Lifecycle Events Feature

Consider two possibilities to understand a typical usage and its not about Validation its all about Integration.      1. You wrote a Bug Tracking Application and deployed it at your client, client has a new requirement that when a new bug is created it wants to send its information to other internal System via Web Service.
   2. You wrote an Enterprise Application and a new features requires that when a new Product is added to database via JPA Hibernate its details should be sent to other departments via Web Service call.
And this is where the feature kick-ins.   We need to design and implement the capability with these features Scalable (should be able to use separate threat to do its job).Simple Design and Usable.Extendable i.e. No procedural junk code.Consider following design and Code snippet where Manufacturer and Product are JPA Entities and PartnerXNotifier and PartnerYNotifier are Web Service Clients.




@EntityListeners({EventListener.class})
@Entity
public class Product implements S…

JPA Hibernate Lifecycle Callback Events Simple Explanation

Typical Entity Life-cycle

Persist   - Creating Entity for the first time.Merge    - Saving detached EntityLoad      - Loading Entity from DatabaseDelete    - Deleting Entity from Database

JPA provides total of 6 Annotations for Life-Cycle Callback events.

@PrePersist@PostPersist@PreUpdate@PostUpdate@PreRemove@PostLoad

This is how we can use the above annotations.

Solution 1: Defining inside Entity class

Any method can be annotated with one or all annotations, though they should follow these rules.
 Method can have any name No parameters Return type of void Method should not be final or static No Checked exceptions should be thrown Any annotation can be only used on one method

Example Code Snippet - 1

@Entity
public class Employee implements Serializable {
...

@PrePersist
@PostPersist
@PreUpdate
@PostUpdate
@PreRemove
@PostLoad
public void updateDate() {
    // this method will executed on all the lifecycle events.
}
}

Solution 2 : Using Entity Listeners Classes
This is very nice way of usin…

Log4j - Email errors using Gmail

Most of the small projects doesn't have a dedicated person to monitor log file all the times, and its handy to send these errors as email to an email list.

Pros

Never miss an error.Delete Emails which you want to ignore because of invalid inputs or connectivity issues etc.Proactively identify bugs and fix them.Email list is handy i.e. multiple person can receive emails.If you have different modules in your project and different teams work on them, adding a Labels to your log can by handy since most of the Email Servers can Label emails and redirect them to different folders.Cons    Sending email from code takes few seconds, workaround is the create Logger wrapper which logs in a separate thread.
log4j.properties
log4j.rootLogger=ERROR, gmail log4j.appender.gmail=org.apache.log4j.net.SMTPAppender log4j.appender.gmail.SMTPProtocol=smtps log4j.appender.gmail.SMTPUsername=username@gmail.com log4j.appender.gmail.SMTPPassword=password log4j.appender.gmail.SMTPHost=smtp.gmail.com log4j.appender.gm…

Data Types in Java

Session 1 - Data Types in Java
What is Data ?
 Most of you have shopped online and this is what a typical purchase looks like

    You select a product which has a Price, Tax, Quantity    You pay using your Credit Card by entering Name, CC Number, Expiration Date, Billing    Address, ZipcodeWords above in Bold are data.

What is then Data Type ?    Can we say Price, Tax, Quantity is of type Number because we can apply Arithmetic (+, -, /, *, %) Operations on them, i.e. we multiply Price Quantity and than add Tax.
Similarly Your Name, Address are text because it doesn't make sense to have Arithmetic Operation on them and in Java we call them String.


Supported Data Types in Java   String   -  Text   double  - Real Numbers i.e. 33.2, 20.0 etc   int         - Non-Real Numbers i.e. 10, 30, 3453 etc


Typical Java Programs using the above Data Types
public class DataTypesDemo {     public static void main(String[] args) {

        // define a Data Variable message of type String         String mes…

How I teach Java in 1hr 5 sessions

I know a lot of people can disagree with this but I am trying to keep it simple and as only my own opinion.

It took me more than 5 yrs to design this syllabus to help beginners learn and get motivated to program in Java. When I started teaching I use to take 10-15 days to teach java and I can clearly see on participants faces that they were not confident even after spending so much time with them. However recently I was able to successfully use a shorter And I am sure this won't be the final one and it will change a lot after few more batches. And the only way I do this is by
focusing on important concepts and cutting dumb one's in a language to accomplish my objectives.

Session 1
  Data Types (int, double, String )  Class Notes  Operators (Arithmatic - +,-,*,/ )  Functions  Homework -

 Write 50 functions and execute them from main method             Write functions with 0 or more input parameters Write functions that returns a value


Session 2 (Point here is to introduce Objects e…

How to Schema Validate Metro SOAP Request

@SchemaValidation does the trick checkout the sample code below

package com.palm.appstore.wsc;


import javax.jws.WebService;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import com.sun.xml.ws.developer.SchemaValidation;

/**
*
* @author Intesar Mohammed
*/
@WebService(serviceName = "Echo")
@SchemaValidation
public class Echo {

    /** This is a sample web service operation */
    @WebMethod(operationName = "hello")
    public String hello(@WebParam(name = "no") int txt) {
        return "Hello " + txt + " !";
    }
}

Valid Request
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsc="http://wsc.appstore.palm.com/">
   <soapenv:Header/>
   <soapenv:Body>
      <wsc:hello>
         <no>33</no>
      </wsc:hello>
   </soapenv:Body>
</soapenv:Envelope>

Response
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/…

Enterprise Application's Logical Layers and where to manage Transactions

Recently I came across an application which manage transaction's at Dao layer that means there is no proper transaction management and if an exception occurs during runtime will leave inappropriate data in database.


Consider this simple Architectural layers





Brief description of each block starting from the bottom.

DB1 .. DBn → Databases, an application sometimes refers to multiple databases and simple application has one.

Dao Layer →  Encapsulates logic to add, update, delete and read data from Databases using JPA, Hibernate or JDBC.

Entity/Dto → Simple Pojo classes which encapsulate database entities

WebServices Client → Another Integration Layers like Dao which communicates with other systems via SOAP, JMS etc.

Service Layer → This layer contains business logic which encapsulate the data (Dao & Webservices client) they operate on and provide hardened interfaces as the only way to access their functionality. This approach reduces side effects and allows services to evolve at their o…