Expert views on MBA:
Found this interesting article on Forbes.com
Arthur Blank
Education is a lifetime process. This is just one step along the way.
Tim Blixseth
That is one approach to success, but most people I know with a substantial net worth do not have one.
Otis Booth
Yes, many. Teaches the conventions by which businesses are conducted
Mark Cuban
Only if someone else is paying for it and you are going to a school where you can have a lot of fun.
Gerald Ford
Probably.
Danny Gilbert
What's an "MBA"?
Kenneth Hendricks
I don't know of any reason. I believe you can be successful without an MBA (i.e. Ted Turner and Bill Gates).
Wayne Huizenga
Yes, education is the most important thing to obtain the edge.
George Kaiser
Not for entrepreneurial business
Michael Ilitch
I don't have one myself, but I think it's a good idea today for people to get them. There's plenty to learn both in school and out. Always be open to learning.
William Moncrief
No.
Phillip Ruffin
It can't hurt but it's not essential.
Jorge Perez
Never got one, so I would not know. Nevertheless, the better the educational credentials, the greater the chance of getting a better start and the foundation to allow you to succeed.
James Sorensen
Yes, it would be nice to have the information it provides, but that is only the beginning. The real degree is earned after the formal degree.
Nice thoughts... and questions to ask yourself :)
-Nita
Wednesday, May 21, 2008
Tuesday, May 6, 2008
Spring Batch Update Code
Code snippet to execute batch operations using spring
Collection vBatchUtilitySlotModelCollection = batchSlotUtilityBusinessService.getCollection();
if(vBatchUtilitySlotModelCollection != null && vBatchUtilitySlotModelCollection.size()>0)
{
BatchSqlUpdate batchUpdater = new BatchSqlUpdate(getDataSource(),"UPDATE slot SET location_seq_num = ?, facility_seq_num = ? WHERE seq_num = ?");
batchUpdater.declareParameter(new SqlParameter(Types.BIGINT));
batchUpdater.declareParameter(new SqlParameter(Types.BIGINT));
batchUpdater.declareParameter(new SqlParameter(Types.BIGINT));
batchUpdater.compile();
for (Iterator iter = vBatchUtilitySlotModelCollection.iterator(); iter.hasNext(); ) {
VBatchUtilitySlotModel vBatchUtilitySlotModel = (VBatchUtilitySlotModel)iter.next();
batchUpdater.update(new Object[] {vBatchUtilitySlotModel.getLocationSeqNum(), vBatchUtilitySlotModel.getFacilitySeqNum(), vBatchUtilitySlotModel.getSeqNum()});
}
batchUpdater.flush();
}
It worked like a flash..!!!!
-Happy Coding
--Sunny
Collection vBatchUtilitySlotModelCollection = batchSlotUtilityBusinessService.getCollection();
if(vBatchUtilitySlotModelCollection != null && vBatchUtilitySlotModelCollection.size()>0)
{
BatchSqlUpdate batchUpdater = new BatchSqlUpdate(getDataSource(),"UPDATE slot SET location_seq_num = ?, facility_seq_num = ? WHERE seq_num = ?");
batchUpdater.declareParameter(new SqlParameter(Types.BIGINT));
batchUpdater.declareParameter(new SqlParameter(Types.BIGINT));
batchUpdater.declareParameter(new SqlParameter(Types.BIGINT));
batchUpdater.compile();
for (Iterator iter = vBatchUtilitySlotModelCollection.iterator(); iter.hasNext(); ) {
VBatchUtilitySlotModel vBatchUtilitySlotModel = (VBatchUtilitySlotModel)iter.next();
batchUpdater.update(new Object[] {vBatchUtilitySlotModel.getLocationSeqNum(), vBatchUtilitySlotModel.getFacilitySeqNum(), vBatchUtilitySlotModel.getSeqNum()});
}
batchUpdater.flush();
}
It worked like a flash..!!!!
-Happy Coding
--Sunny
Friday, May 2, 2008
Singleton across JVM's
When you make an Object singleton, we all know its just unique per jvm or per class loader.
So what if you want to make an object unique in a clustered environment. One way of doing it is using JNDI object binding. Here is some sample code try to run on ur server.
private void jndiObjTest(){
try{
System.out.println("Teting jndi object cache");
NotchClient nc=new NotchClient("Sunny","T");
Hashtable ht = new Hashtable();
ht.put(Context.PROVIDER_URL, "http://localhost:7001");
ht.put(Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFactory");
ht.put(Context.REFERRAL,"throw");
InitialContext ctx = new InitialContext(ht);
ctx.bind("sam_name",nc);
System.out.println("Reading Object from JNDI lookup");
Object o=ctx.lookup("sam_name");
NotchClient n=(NotchClient)o;
System.out.println("Value of obj retrieved from jndi"+n.getName());
}catch(Exception e){
e.printStackTrace();
throw new RuntimeException(e);
}
}
Note: Please deploy the above code to ur local server to test, standalone java app wont work.
--Sunny
So what if you want to make an object unique in a clustered environment. One way of doing it is using JNDI object binding. Here is some sample code try to run on ur server.
private void jndiObjTest(){
try{
System.out.println("Teting jndi object cache");
NotchClient nc=new NotchClient("Sunny","T");
Hashtable ht = new Hashtable();
ht.put(Context.PROVIDER_URL, "http://localhost:7001");
ht.put(Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFactory");
ht.put(Context.REFERRAL,"throw");
InitialContext ctx = new InitialContext(ht);
ctx.bind("sam_name",nc);
System.out.println("Reading Object from JNDI lookup");
Object o=ctx.lookup("sam_name");
NotchClient n=(NotchClient)o;
System.out.println("Value of obj retrieved from jndi"+n.getName());
}catch(Exception e){
e.printStackTrace();
throw new RuntimeException(e);
}
}
Note: Please deploy the above code to ur local server to test, standalone java app wont work.
--Sunny
Monday, April 28, 2008
Recursion in Java
public void handleParent(int parentOid){
List clientBVOList=this.getClients(parentOid);
for(int i=0;i Lessthan clientBVOList.size();i++){
NcClient nc=(NcClient)clientBVOList.get(i);
if(nc.getNotchParentFl().equalsIgnoreCase("T")){
handleParent(parentOid-1);
resetFacs(nc);
}else{
resetFacs(nc);
}
}
}
private void resetFacs(NcClient nc) {
// TODO Auto-generated method stub
System.out.println("Resetting facilities for Client:"+nc.getName());
}
private List getClients(int parentOid) {
// TODO Auto-generated method stub
List ncList=new ArrayList();
if(parentOid==3){
System.out.println("Get clients for Parent 3");
NcClient nc=new NcClient("client1","F");
NcClient nc2=new NcClient("Client2","T");
NcClient nc3=new NcClient("Client3","F");
ncList.add(nc);
ncList.add(nc2);
ncList.add(nc3);
return ncList;
}
if(parentOid==2){
System.out.println("Get clients for Parent 2");
NcClient nc=new NcClient("client2.1","F");
NcClient nc2=new NcClient("Client2.2","T");
ncList.add(nc);
ncList.add(nc2);
return ncList;
}
if(parentOid==1){
System.out.println("Get clients for Parent 1");
NcClient nc =new NcClient("Client2.2.1","F");
NcClient nc2=new NcClient("Client2.2.2","F");
ncList.add(nc);
ncList.add(nc2);
return ncList;
}
return null;
}
NC Client:
public class NClient {
String nParentFl;
String name;
public NClient(String name,String parentFl){
this.name=name;
this.nParentFl=parentFl;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getNParentFl() {
return nParentFl;
}
public void setNParentFl(String nParentFl) {
this.nParentFl = nParentFl;
}
}
Result:
Get clients for Parent 3
Resetting facilities for Client:client1
Get clients for Parent 2
Resetting facilities for Client:client2.1
Get clients for Parent 1
Resetting facilities for Client:Client2.2.1
Resetting facilities for Client:Client2.2.2
Resetting facilities for Client:Client2.2
Resetting facilities for Client:Client2
Resetting facilities for Client:Client3
List clientBVOList=this.getClients(parentOid);
for(int i=0;i Lessthan clientBVOList.size();i++){
NcClient nc=(NcClient)clientBVOList.get(i);
if(nc.getNotchParentFl().equalsIgnoreCase("T")){
handleParent(parentOid-1);
resetFacs(nc);
}else{
resetFacs(nc);
}
}
}
private void resetFacs(NcClient nc) {
// TODO Auto-generated method stub
System.out.println("Resetting facilities for Client:"+nc.getName());
}
private List getClients(int parentOid) {
// TODO Auto-generated method stub
List ncList=new ArrayList();
if(parentOid==3){
System.out.println("Get clients for Parent 3");
NcClient nc=new NcClient("client1","F");
NcClient nc2=new NcClient("Client2","T");
NcClient nc3=new NcClient("Client3","F");
ncList.add(nc);
ncList.add(nc2);
ncList.add(nc3);
return ncList;
}
if(parentOid==2){
System.out.println("Get clients for Parent 2");
NcClient nc=new NcClient("client2.1","F");
NcClient nc2=new NcClient("Client2.2","T");
ncList.add(nc);
ncList.add(nc2);
return ncList;
}
if(parentOid==1){
System.out.println("Get clients for Parent 1");
NcClient nc =new NcClient("Client2.2.1","F");
NcClient nc2=new NcClient("Client2.2.2","F");
ncList.add(nc);
ncList.add(nc2);
return ncList;
}
return null;
}
NC Client:
public class NClient {
String nParentFl;
String name;
public NClient(String name,String parentFl){
this.name=name;
this.nParentFl=parentFl;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getNParentFl() {
return nParentFl;
}
public void setNParentFl(String nParentFl) {
this.nParentFl = nParentFl;
}
}
Result:
Get clients for Parent 3
Resetting facilities for Client:client1
Get clients for Parent 2
Resetting facilities for Client:client2.1
Get clients for Parent 1
Resetting facilities for Client:Client2.2.1
Resetting facilities for Client:Client2.2.2
Resetting facilities for Client:Client2.2
Resetting facilities for Client:Client2
Resetting facilities for Client:Client3
Friday, April 25, 2008
So Small Lyrics
Carrie Underwood So Small Lyrics
While working lost in a busy day.. this song came from ipod like a refreshing spring shower ...quickly looked up lyrics on the internet..and pasting here. Another reason why I love my ipod so much.. :)).. sometimes it brings me out of my lostness.
Yeah, Yeah
What you got if you ain't got love
the kind that you just want to give away
its okay to open up
go ahead and let the light shine through
I know it's hard on a rainy day
you want to shut the world out and just be left alone
but don't run out on your faith
'cause sometimes that mountain you've been climbing
is just a grain of sand
and what you've been up there searching for forever
is in your hands
when you figure out love is all that matters after all
it sure makes everything else seem so small
it's so easy to get lost inside
a problem that seems so big at the time
it's like a river thats so wide
it swallows you whole
while you siting 'round thinking 'bout what you can't change
and worrying about all the wrong things
time's flying by
moving so fast
you better make it count 'cause you cant get it back
sometimes that mountain you've been climbing
is just a grain of sand
and what you've been up there searching for forever
is in your hands
oh when you figure out love is all that matters after all
it sure makes everything else seem so small
sometimes that mountain you've been climbing
is just a grain of sand
and what you've been up there searching for forever
is in your hands
oh when you figure out love is all that matters after all
it sure makes everything else...
oh it sure makes everything else seem so small
Yeah, Yeah
-- Playin the song agin. :D
While working lost in a busy day.. this song came from ipod like a refreshing spring shower ...quickly looked up lyrics on the internet..and pasting here. Another reason why I love my ipod so much.. :)).. sometimes it brings me out of my lostness.
Yeah, Yeah
What you got if you ain't got love
the kind that you just want to give away
its okay to open up
go ahead and let the light shine through
I know it's hard on a rainy day
you want to shut the world out and just be left alone
but don't run out on your faith
'cause sometimes that mountain you've been climbing
is just a grain of sand
and what you've been up there searching for forever
is in your hands
when you figure out love is all that matters after all
it sure makes everything else seem so small
it's so easy to get lost inside
a problem that seems so big at the time
it's like a river thats so wide
it swallows you whole
while you siting 'round thinking 'bout what you can't change
and worrying about all the wrong things
time's flying by
moving so fast
you better make it count 'cause you cant get it back
sometimes that mountain you've been climbing
is just a grain of sand
and what you've been up there searching for forever
is in your hands
oh when you figure out love is all that matters after all
it sure makes everything else seem so small
sometimes that mountain you've been climbing
is just a grain of sand
and what you've been up there searching for forever
is in your hands
oh when you figure out love is all that matters after all
it sure makes everything else...
oh it sure makes everything else seem so small
Yeah, Yeah
-- Playin the song agin. :D
Thursday, April 24, 2008
JConsole
Using JConsole
The JConsole graphical user interface is a monitoring tool that complies to the Java Management Extensions (JMX) specification. JConsole uses the extensive instrumentation of the Java Virtual Machine (Java VM) to provide information about the performance and resource consumption of applications running on the Java platform.
In the Java Platform, Standard Edition (Java SE platform) 6, JConsole has been updated to present the look and feel of the Windows and GNOME desktops (other platforms will present the standard Java graphical look and feel). The screen captures presented in this document were taken from an instance of the interface running on Windows XP.
1) You can use JConsole to monitor both local applications, namely those running on the same system as JConsole, as well as remote applications, namely those running on other systems
2) For monitoring production systems, use remote monitoring
3) Configure your jvm to run with JMX
3) Starting JConsole:
1) Have java Home in ur class path or open ur cmd prompt at C:\bea92\jrockit90_150_06\bin
2) type jconsole [processId] ex: jconsole 7280
4) Start remote JVM
type jconsole hostName:portNum

Using JConsole
The JConsole graphical user interface is a monitoring tool that complies to the Java Management Extensions (JMX) specification. JConsole uses the extensive instrumentation of the Java Virtual Machine (Java VM) to provide information about the performance and resource consumption of applications running on the Java platform.
In the Java Platform, Standard Edition (Java SE platform) 6, JConsole has been updated to present the look and feel of the Windows and GNOME desktops (other platforms will present the standard Java graphical look and feel). The screen captures presented in this document were taken from an instance of the interface running on Windows XP.
1) You can use JConsole to monitor both local applications, namely those running on the same system as JConsole, as well as remote applications, namely those running on other systems
2) For monitoring production systems, use remote monitoring
3) Configure your jvm to run with JMX
3) Starting JConsole:
1) Have java Home in ur class path or open ur cmd prompt at C:\bea92\jrockit90_150_06\bin
2) type jconsole [processId] ex: jconsole 7280
4) Start remote JVM
type jconsole hostName:portNum

Using JConsole
Performance issues and Tools to use
Insufficient Memory
The Java Virtual Machine (JVM)* has the following types of memory: heap, non-heap, and native.
3 Types:
1) Heap Memory Error
2) Non Heap Memory Error
3) Native Memory Error
Memory Leaks
The JVM is responsible for automatic memory management, which reclaims the unused memory for the application. However, if an application keeps a reference to an object that it no longers needs, the object cannot be garbage collected and will occupy space in the heap until the object is removed. Such unintentional object retention is referred to as a memory leak. If the application leaks large amounts of memory, it will eventually run out of memory, and an OutOfMemoryError will be thrown. In addition, garbage collection may take place more frequently as the application attempts to free up space, thus causing the application to slow down.
Finalizers
Another possible cause of an OutOfMemoryError is the excessive use of finalizers. The java.lang.Object class has a protected method called finalize. A class can override this finalize method to dispose of system resources or to perform cleanup before an object of that class is reclaimed by garbage collection. The finalize method that can be invoked for an object is called a finalizer of that object. There is no guarantee when a finalizer will be run or that it will be run at all. An object that has a finalizer will not be garbage collected until its finalizer is run. Thus, objects that are pending for finalization will retain memory even though the objects are no longer referenced by the application, and this could lead to a problem similar to a memory leak.
Deadlocks
A deadlock occurs when two or more threads are each waiting for another to release a lock. The Java programming language uses monitors to synchronize threads. Each object is associated with a monitor, which can also be referred as an object monitor. If a thread invokes a synchronized method on an object, that object is locked. Another thread invoking a synchronized method on the same object will block until the lock is released. Besides the built-in synchronization support, the java.util.concurrent.locks package that was introduced in J2SE 5.0 provides a framework for locking and waiting for conditions. Deadlocks can involve object monitors as well as java.util.concurrent locks.
Typically, a deadlock causes the application or part of the application to become unresponsive. For example, if a thread responsible for the graphical user interface (GUI) update is deadlocked, the GUI application freezes and does not respond to any user action.
Looping Threads
Looping threads can also cause an application to hang. When one or more threads are executing in an infinite loop, that loop may consume all available CPU cycles and cause the rest of the application to be unresponsive.
High Lock Contention
Synchronization is heavily used in multithreaded applications to ensure mutually exclusive access to a shared resource or to coordinate and complete tasks among multiple threads. For example, an application uses an object monitor to synchronize updates on a data structure. When two threads attempt to update the data structure at the same time, only one thread is able to acquire the object monitor and proceed to update the data structure. Meanwhile, the other thread blocks as it waits to enter the synchronized block until the first thread finishes its update and releases the object monitor. Contended synchronization impacts application performance and scalability.
Problem: Insufficient memory
Symptom: OutOfMemoryError
Tool: Java Heap Analysis Tool (jhat)
Problem: Memory leaks Growing use of memory
Symptom: Frequent garbage collection Java Monitoring and Management Console (jconsole)
Tool: JVM Statistical Monitoring Tool (jstat)
Symptom: A class with a high growth rate. A class with an unexpected number of instances Memory Map (jmap)
An object is being referenced unintentionally jconsole or jmap with jhat
Tool: See jmap -histo option
See jmap -dump option
Problem: Finalizers
Symptom: Objects are pending for finalization jconsole
Tool: jmap -dump with jhat
Problem: Deadlocks Threads block on object monitor or
Symptom: java.util.concurrent locks jconsole
Tool: Stack Trace (jstack)
Problem: Looping threads
Symptom: Thread CPU time is continuously increasing
Tool: jconsole with JTop
Problem: High lock contention
Symptom: Thread with high contention statistics
Tool: jconsole
Had a great time exploring performance monitors.
-Knowledge is power.
The Java Virtual Machine (JVM)* has the following types of memory: heap, non-heap, and native.
3 Types:
1) Heap Memory Error
2) Non Heap Memory Error
3) Native Memory Error
Memory Leaks
The JVM is responsible for automatic memory management, which reclaims the unused memory for the application. However, if an application keeps a reference to an object that it no longers needs, the object cannot be garbage collected and will occupy space in the heap until the object is removed. Such unintentional object retention is referred to as a memory leak. If the application leaks large amounts of memory, it will eventually run out of memory, and an OutOfMemoryError will be thrown. In addition, garbage collection may take place more frequently as the application attempts to free up space, thus causing the application to slow down.
Finalizers
Another possible cause of an OutOfMemoryError is the excessive use of finalizers. The java.lang.Object class has a protected method called finalize. A class can override this finalize method to dispose of system resources or to perform cleanup before an object of that class is reclaimed by garbage collection. The finalize method that can be invoked for an object is called a finalizer of that object. There is no guarantee when a finalizer will be run or that it will be run at all. An object that has a finalizer will not be garbage collected until its finalizer is run. Thus, objects that are pending for finalization will retain memory even though the objects are no longer referenced by the application, and this could lead to a problem similar to a memory leak.
Deadlocks
A deadlock occurs when two or more threads are each waiting for another to release a lock. The Java programming language uses monitors to synchronize threads. Each object is associated with a monitor, which can also be referred as an object monitor. If a thread invokes a synchronized method on an object, that object is locked. Another thread invoking a synchronized method on the same object will block until the lock is released. Besides the built-in synchronization support, the java.util.concurrent.locks package that was introduced in J2SE 5.0 provides a framework for locking and waiting for conditions. Deadlocks can involve object monitors as well as java.util.concurrent locks.
Typically, a deadlock causes the application or part of the application to become unresponsive. For example, if a thread responsible for the graphical user interface (GUI) update is deadlocked, the GUI application freezes and does not respond to any user action.
Looping Threads
Looping threads can also cause an application to hang. When one or more threads are executing in an infinite loop, that loop may consume all available CPU cycles and cause the rest of the application to be unresponsive.
High Lock Contention
Synchronization is heavily used in multithreaded applications to ensure mutually exclusive access to a shared resource or to coordinate and complete tasks among multiple threads. For example, an application uses an object monitor to synchronize updates on a data structure. When two threads attempt to update the data structure at the same time, only one thread is able to acquire the object monitor and proceed to update the data structure. Meanwhile, the other thread blocks as it waits to enter the synchronized block until the first thread finishes its update and releases the object monitor. Contended synchronization impacts application performance and scalability.
Problem: Insufficient memory
Symptom: OutOfMemoryError
Tool: Java Heap Analysis Tool (jhat)
Problem: Memory leaks Growing use of memory
Symptom: Frequent garbage collection Java Monitoring and Management Console (jconsole)
Tool: JVM Statistical Monitoring Tool (jstat)
Symptom: A class with a high growth rate. A class with an unexpected number of instances Memory Map (jmap)
An object is being referenced unintentionally jconsole or jmap with jhat
Tool: See jmap -histo option
See jmap -dump option
Problem: Finalizers
Symptom: Objects are pending for finalization jconsole
Tool: jmap -dump with jhat
Problem: Deadlocks Threads block on object monitor or
Symptom: java.util.concurrent locks jconsole
Tool: Stack Trace (jstack)
Problem: Looping threads
Symptom: Thread CPU time is continuously increasing
Tool: jconsole with JTop
Problem: High lock contention
Symptom: Thread with high contention statistics
Tool: jconsole
Had a great time exploring performance monitors.
-Knowledge is power.
Subscribe to:
Posts (Atom)