Friday, October 29, 2010

List of Tibco RV, EMS Tutorials , Tips from Javarevisited

Hi guys , just thought about some more topics to explain on this tibco tutorial series , let me know out of below which Tibco topics you would like to me cover first , please suggest if you have other topics in mind. I am now updating this post as most of the topics are already covered but I forgot to update this post.

I have covered difference between routing daemon and Tibco daemon in this part. basically main difference between both of them is the purpose. RVD is mainly for sending and receiving message in same network between two Tibco RV publisher and subscriber while RVRD is used to bridge two different network from two different countries, cities or even continent. Most of the investment banks has RVRD bridging there London to New-york traffic or London to Tokyo traffic. Bandwidth of these WAN networks are very important because if  you have just one slow Tibco subscriber that can bring down whole network link between two regions. We had an incident when one of out application is publishing huge amount of updates in MB and on other side we had a GUI on a slow desktop which is keep asking for resend, this problem is often referred as Tibco RV storm and its very serious issue while working with Tibco messaging. One important thing to note here is reliability parameter of tibco rv which actually defines how long publisher should hold the message if set very low can cause frequent retransmission request.

Friday, October 22, 2010

Tibco tutorial : Certified Messagging

This is in continuation of my previous tibco tutorial. tibco rv is most widely used middleware in enterprise world heavily used in banking and many global investment bank rely on tibco rv for there high speed messaging requirement. its used by many trading application to receive high speed data e.g. Market data. in reliable mode tibco provide reliable delivery of data but not guaranteed means if sender sends data to receiver via tibco multicast network , tibco tries best to deliver that data to receiver but there is no guarantee, data could be lost if receiver is too busy to receive it , if receiver is not running or receiver is hang. In some cases its possible to recover lost data by sending "Resend Request".

Tuesday, October 12, 2010

What are builtin Properties in ANT >> Tutorial Example

This is the fourth article of series "ant tutorial for beginners" here I have included some more fundamental concept in form of Q/A to provide you clear and concise description and situation where you apply these concept. Please let me know if you have any questions , comments I will be happy to reply those .

What are built in properties available in ant ?
Built in properties are those which ant provides by default , you need not have to declare these property you can just use it. You can divide them in two parts

Sunday, October 10, 2010

Top 30 Eclipse Keyboard Shortcuts for Java Programmer

This tutorial is about 30 Eclipse keyboard shortcuts, this list is by no means complete and I will suggest you guys to share eclipse shortcuts listed other than here to make this more useful. Eclipse is the most used Java development IDE and knowing Eclipse shortcuts not only improve your productivity but also makes you more efficient. You will have more time for things you like to do. Using keyboard shortcuts also helps to impress colleagues and shows that you have a good hold on tools you used for Java Development. If you are a Java developer, who use Eclipse as its main IDE for all coding, development, and debugging purpose, then I also suggest you to take a look at The Java Developer's Guide to Eclipse, 2nd Edition, one of the best book to learn how to use Eclipse from Java programmer's perspective.

Saturday, October 9, 2010

How to write build.xml and run build in Apache ANT

This is the second article on Apache ANT tutorials for beginners series As I have always said that I like the short , clear and concise tutorial which tells about few concept but in a clear and concise manner and put weight on fundamentals . I try to adopt same theory while writing my blog post while writing my experience coupled with the concept which is important for a software developer point of view.

Friday, October 8, 2010

Hot to build project using Apache ANT ? ANT Build Tutorials for Beginners

Apache Ant tutorials for beginners

Hi Guys, today I would like to share some of my experience while working with ant build tool in form of short ant tutorials, ant is one tool which has gained its place in almost everywhere, it’s integral part of any project’s build system and provide foundation for complex, extensible build environment. I have been using ANT from my early programming days and I have seen some of the best designed build environments around ANT. In these ant tutorials for beginners we will see what is ant build tool? How to use ANT for building project? Fundamentals of ANT build tool, setting up ant build environment etc. I have created a series of ant tutorials and you can check next part of ant tutorials by following links ant tutorial part 2 and ant tutorial part 3

Thursday, October 7, 2010

MySql Tutorial : mysqldump utility in mysql

The mysqldump client is a backup program o It can be used to dump a database or a collection of databases for backup or transfer to another SQL server (not necessarily a MySQL server). The dump typically contains SQL statements to create the table, populate it, or both. However, mysqldump can also be used to generate files in CSV, other delimited text, or XML format.

MySQL tutorial and commands part 3

Hi Guys , here are some more mysql commands which is useful in day 2 day work.

Method for converting current time stamp to date:
select from_unixtime(left(1201159475416, 10));
this  method is used to convert the timestamp to the date time format in mysql ,left() method will return 10 char from the specified string  if we store time stamp value in millisecond.

Wednesday, October 6, 2010

MySQL tutorial and commands part 2

Here are some more mysql commands from which is very useful for anyone working with mysql database.
this are very useful for application developer which is going to use mysql database for there applications.

Increasing no of connections for mysql
You can increase this value in main config file (e.g., /etc/my.cnf) using this syntax:


Tuesday, October 5, 2010

MySQL tutorial and commands Part 1

Here is first set of my basic mysql commands which I have used in my day to day life while working with mysql database.

For Checking Wheather MySQL Server is running or not
ps -auxwww | grep mysql

Starting mysql
go to mysql installation directory and execute below command

How to use Regular Expression in Unix Linux

One of the most powerful tools available to programmers are Regular Expressions, if you are good with regular expressions you can solve many day to day problem extremely quickly e.g. find all the lines with ERROR in the log file , find the count of any particular ID in the log file , find exceptions etc.

Monday, October 4, 2010

Improving Performance of java application

This is a big topic to discuss as there are many approaches which involve analyzing performance of an application starting from profiling application to finding the bottleneck.

here I am putting some of the basic tricks for improving performance which I learned in my early days in java , I will keep posted some approach , experience on performance improvement as and when time allows.

for now here are naive's tips for making your program run faster.

Networking Basics for FIX Connection in Unix Linux

Knowledge of networking basics are extremely important if you are dealing with FIX connection , FIX stands for Financial Information Exchange protocol and its the most popular protocol for electronic trading and supported by many brokers , exchanges etc.

here I am discussing few important network related information which is quite useful for FIX connection establishment.

Sunday, October 3, 2010

How to avoid deadlock in Java Threads

How to avoid deadlock in Java? is one of the question which is flavor of the season for multi-threading, asked more at a senior level and with lots of follow up questions. Even though question looks very basic but most of developer get stuck once you start going deep.

Interview questions starts with "What is deadlock?"
Answer is simple, when two or more threads are waiting for each other to release lock and get stuck for infinite time, situation is called deadlock . It will only happen in case of multitasking.

Top 10 Most useful cvs commands in linux/unix

This article is in continuation of my earlier article Top 10 basic networking Commands in Unix  and 10 tips of working fast in unix  to read more see here 10 tips of using find command in linux.

Here is my list of most useful commands in Linux , its important that we know this and use it regularly while working with files folders which is in CVS.

Saturday, October 2, 2010

Tibco tutorial : Tibco RV tips and commands

This is third post on series of "tibco tutorial" , In this article I am posting some of the most useful command which I used while working in tibco rv in many application , they are extremely useful and must be in developers top of head who is working in tibco rv.

Before writing these "tibco tutorial" series I looked for some introductory simple tibco tutorial which explains concept of tibco rv in simple word and give us working knowledge of tibco but I did not found any. tibco is most heavily used middleware solution on enterprise world and form backbone of many large enterprise including global banks.

Tibco Tutorial: Fundamentals of Tibco RV messagging.

This is in continuation of my  tibco tutorial series where I will discuss tibco rv on application developer point of view as middle ware or messaging solution.As discussed in earlier tibco tutorials, tibco is used for communicating between two systems e.g. client and server or server to server , here we will see some of the basic terms used in tibco rv  world.

TIBCO Tutorial : TIBCO Rendezvous or TIBCO RV messaging

TIBCO Tutorial:  TIBCO RV messaging
When I started working with a big investment bank I come across a new messaging technology called TIBCO Rendezvous or commonly called as TIBCO RV, I have heard Java Messaging Service (JMS) before but never heard about this TIBCO Rendezvous and it was so extensively used in my application that most of support issue was caused by this mysterious TIBCO RV. We had several TIBCO Topics also called TIBCO Subject separate for both Production and Non PRODUCTION environment but still since I don’t had basic knowledge of this technology I was afraid to do some experiment because there was always a risk to affect production environment.
At that time I have searched for TIBCO tutorial and I didn't find anything which can help an application developer who wants to use TIBCO as middleware solution, so I decided to write my own experience in a form of short , concise and clear  TIBCO tutorial  Every post of this series will have something to offer in a short and clear format which I like and I hope you too for details you can always refer to TIBCO Rendezvous or TIBCO EMS specification or documentation .

What is Abstraction in Java? Abstract Class or Interface

What is abstraction?
Abstraction in Java or Object oriented programming is a way to segregate implementation from an interface and one of the five fundamentals along with Encapsulation, Inheritance, Polymorphism, Class, and Object.  Abstraction in Java is achieved by  using interface and abstract class in Java. An interface or abstract class is something which is not concrete , something which is incomplete. In order to use interface or abstract class, we need to extend and implement an abstract method with concrete behavior. One example of Abstraction is creating interface to denote common behavior without specifying any details about how that behavior works e.g. You create an interface called Server which has the start() and stop() method. This is called abstraction of Server because every server should have a way to start and stop and details may differ. 

Fundamentals of Object Oriented Programming in Java

I remember when I was doing my engineering , OOPS concept was in first semester. Back then it looks like some alien things to me, because I have never done programming and even the smallest program we get to write e.g. checking whether number is palindrome or not , or printing Fibonacci series , we never really needed to use OOPS. When needed, I just memorize things and written down in exam :). That worked, I passed the exam but effectively I didn't learn OOP or Object Oriented Programming on those days. It's when, I started learning java (an almost truly object oriented programming language) and introduced to concept like abstract classes, interface, and method overriding; some thing started to going in my mind. This blog post is very basic in nature, but I really hope it could help beginners on understanding things like class, object, abstraction , polymorphism, inheritance ,encapsulation , composition, cohesion, coupling, interface programming etc.

What is difference between Enumeration and Iterator in Java?

Though both Iterator and Enumeration allows you to traverse over elements of Collections in Java, there is some significant difference between them e.g. Iterator also allows you to remove elements from collection during traversal but Enumeration doesn't allow that, it doesn't got the remove() method. Enumeration is also a legacy class and not all Collection supports it e.g. Vector supports Enumeration but ArrayList doesn't. On the other hand Iterator is the standard class for iteration and traversal. By the way,  what is difference between Enumeration and Iterator in Java?  This question is from early ages of  Java interview , I have not seen this question on recent interviews but it was quite common during 2000 to 2007 period, now days questions like implementation of HashMap or ConcurrentHashMap etc has taken its place, nonetheless its very important to know the fundamental difference between Iterator and Enumeration. Some time its also asked as Iterator vs Enumeration or Enumeration vs Iterator which is same. Important point to note is that both Iterator and Enumeration provides way to traverse or navigate through entire collection in Java.

What is difference between HashMap and Hashtable in Java?

HashMap vs Hashtable in Java
Though both Hashtable and HashMap are data-structure based upon hashing and implementation of Map interface, the main difference between them is that HashMap is not thread-safe but Hashtable is thread-safe. Which means you cannot use HashMap in multi-threaded Java application without external synchronization. Another difference is HashMap allows one null key and null values but Hashtable doesn't allow null key or values. Also, thread-safety of the hash table is achieved using internal synchronization, which makes it slower than HashMap. By the way, difference between HashMap and Hashtable in Java is one of the frequently asked in core Java interviews to check whether the candidate understands correct usage of collection classes and aware of alternative solutions available.

Friday, October 1, 2010

What is the use of class “java.lang.Class” in Java?

java.lang.Class is one of the most important class in java but mostly overlooked by Java developers. It is very useful in the sense that it provides several utility methods e.g. getClass(), forName() which is used to find and load a class, you might have used to load Oracle or MySQL drivers. It also provides methods like Class.newInstance() which is the backbone of reflection and allow you to create an instance of a class without using new() operator.  The class has no public constructor and its instance is created by JVM when a class is loaded. The object of class Class is also used to represent classes, enum, interfaces and annotation in a running Java application. The primitive types e.g. byte, short, char, int, float, double and boolean are also represented by Class instances.

Why Comparing Integer using == in Java 5 is Bad?

Java 5 introduced auto-boxing which automatically converts int to Integer and because of that many Java developers started writing code for comparing int variable to Integer object and Integer to Integer using == operator. You should avoid that because it can create subtle bugs in your program because it only works for a particular range of integers and not for all. There is another problem as well when you compare int variable to Integer object using == operator, the Integer object is converted to a primitive value. This can throw null pointer exception if the Integer object is null, which can crash your program. Now when you compare two Integer object using a == operator, Java doesn't compare them by value, but it does reference comparison. When means even if the two integer has the same value, == can return false because they are two different objects in the heap. That's why you should use equals() method to compare objects.

How to check if a thread holds lock on a particular object in Java

Think about a scenario where you would have to find at the run time that whether a Java thread has a lock on a particular object e.g. find out whether thread NewsReader has a lock on NewsPaper object or not ? If this questions came in any core java interview then I would automatically assume that there could be at least two answers one is hard earned raw answer which programmer would like to figure out based on fundamentals and other could be some rarely used API calls which are available in Java , by the way, this is actually asked to me in an interview of one of the biggest global Investment bank. Investment banking world, particularly Cash Equities requires strong core Java and Multithreading skills to build high performance, low latency Java application to process millions of orders per day.

Why String is Immutable or Final in Java

The string is Immutable in Java because String objects are cached in String pool. Since cached String literals are shared between multiple clients there is always a risk, where one client's action would affect all another client. For example, if one client changes the value of String "Test" to "TEST", all other clients will also see that value as explained in the first example. Since caching of String objects was important from performance reason this risk was avoided by making String class Immutable. At the same time, String was made final so that no one can compromise invariant of String class e.g. Immutability, Caching, hashcode calculation etc by extending and overriding behaviors. Another reason of why String class is immutable could die due to HashMap.