Ask Google

Custom Search

Sunday, January 30, 2011

Inversion of Control container (IoC)

Inversion of Control container Part I

Central to the Spring Framework is its Inversion of Control container or ususally we called IoC , which supply a consistent ways of configuring and managing Java objects using callbacks. The container is responsible for managing object lifecycles: creating objects, calling initialization methods, and configuring objects by wiring them together.

Objects created by the container are also called Beans or Managed Objects . Usually, the container is configured by loading XML files containing Bean definitions which provide the information required to create the beans.

Saturday, January 29, 2011

LISP Programming

Lisp (or LISP) is a family of computer programming languages with a long history and a distinctive, fully parenthesized syntax. Originally specified in 1958, Lisp is the second-oldest high-level programming language in widespread use today; only Fortran is older (by one year). Like Fortran, Lisp has changed a great deal since its early days, and a number of dialects have existed over its history. Today, the most widely known general-purpose Lisp dialects are Common Lisp and Scheme.

Lisp was originally created as a practical mathematical notation for computer programs, influenced by the notation of Alonzo Church's lambda calculus. It quickly became the favored programming language for artificial intelligence (AI) research. As one of the earliest programming languages, Lisp pioneered many ideas in computer science, including tree data structures, automatic storage management, dynamic typing, and the self-hosting compiler.

The name LISP derives from "LISt Processing". Linked lists are one of Lisp languages' major data structures, and Lisp source code is itself made up of lists. As a result, Lisp programs can manipulate source code as a data structure, giving rise to the macro systems that allow programmers to create new syntax or even new domain-specific languages embedded in Lisp.

The interchangeability of code and data also gives Lisp its instantly recognizable syntax. All program code is written as s-expressions, or parenthesized lists. A function call or syntactic form is written as a list with the function or operator's name first, and the arguments following; for instance, a function f that takes three arguments might be called using (f arg1 arg2 arg3).

Source from

Friday, January 28, 2011

Semantics Tecnology

Semantics Tecnology Part I

Semantics  is the study of meaning. It basically focuses on the relation between signifiers, such as words, phrases, signs and symbols, and what they refer to , their denotata.Semantics is the research of meaning that is used by humans to express themselves through language. Other types of semantics include the semantics of programming languages, formal logics, and semiotics.

The term "semantics" itself reflects a range of ideas, from the popular to the highly technical. It is always used in ordinary language to denote a problem/issues of understanding that comes down to word selection or connotation.This issues of understanding has been the subject or ideas of many formal inquiries,over a long period of time, most notably in the field of formal semantics.

In linguistics, it is the study of interpretation of signs or symbols as used by agents or communities within specific circumstances and contexts.Within this view, sounds, facial expressions, body language,proxemics have semantic (meaningful) content or informations, and each has many branches of study. In written , such things as paragraph structure and punctuation have semantic content; in other forms of language, there is
other semantic content.

 The formal research of semantics intersects with many other fields of inquiry,including lexicology, syntax, pragmatics, etymology and others, although semantics is a well-defined field in its own right, often with synthetic properties.In philosophy of language, semantics and reference are related fields. Further related fields include philology, communication, and semiotics.

Thursday, January 27, 2011

Java J2EE

Java 2 Platform Enterprise Edition. J2EE is a platform-independent, Java-centric environment from Sun for developing, building and deploying Web-based enterprise applications online. The J2EE platform consists of a set of services, APIs, and protocols that provide the functionality for developing multitiered, Web-based applications.

Some of the key features and services of J2EE:
At the client tier, J2EE supports pure HTML, as well as Java applets or applications. It relies on Java Server

Pages and servlet code to create HTML or other formatted data for the client.
 Enterprise JavaBeans (EJBs) provide another layer where the platform's logic is stored. An EJB server provides functions such as threading, concurrency, security and memory management. These services are transparent to the author. Java Database Connectivity (JDBC), which is the Java equivalent to ODBC, is the standard interface for Java databases.The Java servlet API enhances consistency for developers without requiring a graphical user interface.

J2EE is yet another acronym in the world of computing. This one stands for Java 2 Platform, Enterprise Edition. Its significance will become clear once we trace its lineage. First of all, Java is a programming language developed by Sun Microsystems, one of the giants of the industry. The Java Platform is a virtual machine, a processor look-alike that translates computerized instructions into functions.

The Java language is such that it allows cross-platform communication between multiple kinds of devices. For example, a programmer can develop Java code on a desktop computer and expect it to run on other computers, routers, and even mobile phones, as long as those devices are Java-enabled. This portability is described by the Sun acronym WORA, which stands for "Write once, run anywhere." A large number of mainframes, computers, mobile phones, and other electronic devices operate using the Java Platform.

Wednesday, January 26, 2011

Web Services

Web Services can convert your application into a Web-application, which can publish its function or message to the rest of the world.

The basic Web Services platform is XML + HTTP.
The term Web services describes a standardized way of integrating Web-based applications using the XML, SOAP, WSDL and UDDI open standards over an Internet protocol backbone. XML is used to tag the data, SOAP is used to transfer the data, WSDL is used for describing the services available and UDDI is used for listing what services are available. Used primarily as a means for businesses to communicate with each other and with clients, Web services allow organizations to communicate data without intimate knowledge of each other's IT systems behind the firewall.

Users can access some Web services through a peer-to-peer arrangement rather than by going to a central server. Some services can communicate with other services and this exchange of procedures and data is generally enabled by a class of software known as middleware. Services previously possible only with the older standardized service known as Electronic Data Interchange (EDI) increasingly are likely to become Web services. Besides the standardization and wide availability to users and businesses of the Internet itself, Web services are also increasingly enabled by the use of the Extensible Markup Language (XML) as a means of standardizing data formats and exchanging data. XML is the foundation for the Web Services Description Language (WSDL).

iReport Jasper

Introduction of  iReport
iReport is a program that helps users and developers that use the JasperReports library to visually design reports.

Through a rich and very simple to use GUI, iReport provides all the most important functions to create nice reports in little time. iReport can help people that don't know the JasperReports library create complex reports and learn the XML syntax, taking a look to the generated code. iReport can help skilled report designers compose very complex pages, saving a lot of time. iReport is written in Java.

History  iReport

iReport is a visual designer for JasperReports. But What's JasperReports? JasperReports is the best (IMHO) open source reporting engine available for java community. It is developed by a small big genius called Teodor Danciu. JasperReports has always had one lack: it doesn't provide an adapted tool to visually design reports. JasperReports has hundred of features; possibilities of use are infinitely... a person that does not have much confidence with the XML could have some problems to take fully advantage from the JasperReports library.

What it can do?

The following list describes some of the important characteristics of iReport:
• 98% of JasperReports tags supported
• Visual designer wysiwyg with tools for draw rectangles, lines, ellipses, text fields fields, charts, sub reports...
• Built-in editor with syntax highlighting for write expression
• Support for Unicode and non Latin language (Russian, Chinese, Korean,...)
• Document structure browser
• Integrated compiler and exporter
• Support of all JDBC compliant databases
• Support of all kind of JRDataSource
• Wizard to create automatically reports
• Support for sub reports
• Save backup
• Support for templates
• Facilities for fonts

Sunday, January 23, 2011

Liferay Portal

Over the past couple of months I’ve seen an increase in the number of customers who have shown interest in Open Source products as an alternate to commercial products. In Portal and Social networking space, Liferay Portal has been a clear leader – in most cases customer has already made their choice, while in others we’ve found Liferay portal to be a good fit for our customer requirements. As a result I have been playing around with the product for some time now, so thought of putting my together for interest of others. Since Liferay Portal 5.2 also got released while I’m putting this together, I’ve made an attempt to capture the key enhancements that have been made in this release.
With over 75000 download per month, Liferay is the leading Open Source portal server which supports operating system like Linux, UNIX, Mac OS as well as Window. The Application server support is even more impressive with support for 14 application servers including the leading ones like WebLogic, WebSphere, Tomcat, JBoss, Oracle AS etc.
Gartner, in its 2008 Magic Quadrant for Horizontal Portal Products has recognized Liferay portal as Visionary for its strengths in innovation, market understanding and product development strategy.
Although the Liferay portal’s key strengths and focus has been on Collaborative as well as Intranet Portals solutions, its capabilities extend far beyond and it is now emerging as a reliable & a cost effective enterprise portal product.
Portal Architecture
Liferay is based on the J2EE platform thus available on almost all leading application server; it is compatible will all leading databases; run on UNIX, Windows, Linux as well as Mac OS – resulting in over 700 configurations to choose from, with the various combinations of middleware and database platforms. It also provides support for open standards like JSR 168, JSR 268, JSF 128, JSR 170, JSF 314; WSRP, Web Services, AJAX, Springs, Struts, Tiles, Hibernate etc making it must have in any portal evaluation.
The Portal architecture of Liferay has been built around Users, Organizations, Communities, Roles, Pages and Portlet that enables user to build flexible yet robust collaborative portal. 

I love the idea of Liferay portal, its a self sustaining portal and content management system that comes with many applications out of the box that enable you to shape your site as you wish without seeking a third party applications or plug-ins. The portal supports the JSR 168 and 286 for portlet development allowing you to develop a very elaborate applications on top of it with the power of Java, Spring, Hibernate, EJB, JSF and more.
The position of this Portal as of all portals is more in the mid-size business more then the personal site developer.
But with this positioning comes some software design and architecture responsibilities.
The portal should be able to cluster easily and be able to give better performance using caching.
The good news is that although clustering is not a simple switch in the configuration it is not allot more complex then a configuration of the web server, cache and Liferay. caching is also OOTB and has the benefits of the Hibernate.
Having this is very good and very reassuring for the business that sets its eyes on establishing a portal as their website.
The other great feature in the portal is the CMS based on the popular Journal portlet. though it is not a really great and flexible CMS with many of an enterprise CMS features it does get the job with simple content like Articles and so on. Dont expect to get the Vignette Content Management server out of it. ;-)
I do have some problems with the portal, especially GUI design and the separation of interfaces.
My first trouble started with the lack of a backend administrative application. i am used to this type of mechanism in most of my web applications including the WordPress i am using now. the separation of preview and management is some thing i find very important for applications.
For an example i would bring the page template management. though i have chosen a very arguable example i believe that this should be a part of the navigation tree and it should be possible to make a selection of several pages and change their templates collectively.
Liferay Layout Management
But this is not the end of the problems with the lack of administrative application, the administration is done by pages in the system that make it very elaborate to make it clear what is user controlled and what is administrative.
Now i have not gone beyond the simple install and have not tried to integrate it with any LDAP for users and groups or any other integration to Caching mechanisms but it appears that there is some community out there that will be happy to try and help and you might be able to archive your goal.
So if your company is in the route to get a portal and you want to go the open source way you probably should consider Liferay Portal. if you want an enterprise portal Come to Vignette.

Writing JDBC Applications with MySQL - Error Handling

If you want to trap errors, execute your JDBC operations within a try block and use an exception handler to display information about the cause of any problems that occur. JDBC provides getMessage() and getErrorCode() methods that may be invoked when an exception occurs to obtain the error message and the numeric error code. The following example deliberately issues a malformed query. When it runs, the executeQuery() method fails and raises an exception that is handled in the catch block:

       Statement s = conn.createStatement ();
       s.executeQuery ("XYZ"); // issue invalid query
       s.close ();
   catch (SQLException e)
       System.err.println ("Error message: " + e.getMessage ());
       System.err.println ("Error number: " + e.getErrorCode ());

Writing JDBC Applications with MySQL - Using Placeholders

Sometimes it's necessary to construct queries from values containing characters that require special treatment. For example, in queries, string values are written enclosed within quotes, but any quote characters in the string itself should be doubled or escaped with a backslash to avoid creating malformed SQL. In this case, it's much easier to let JDBC handle the escaping for you, rather than fooling around trying to do so yourself. To use this approach, create a different kind of statement (a PreparedStatement), and refer to the data values in the query string by means of placeholder characters. Then tell JDBC to bind the data values to the placeholders and it will handle any special characters automatically.

Suppose you have two variables nameVal and catVal from which you want to create a new record in the animal table. To do so without regard to whether or not the values contain special characters, issue the query like this:

PreparedStatement s;
   s = conn.prepareStatement (
               "INSERT INTO animal (name, category) VALUES(?,?)");
   s.setString (1, nameVal);
   s.setString (2, catVal);
   int count = s.executeUpdate ();
   s.close ();
   System.out.println (count + " rows were inserted");
The '?' characters in the query string act as placeholders--special markers indicating where data values should be placed. The setString() method takes a placeholder position and a string value and binds the value to the appropriate placeholder, performing any special-character escaping that may be necessary. The method you use to bind a value depends on the data type. For example, setString() binds string values and setInt() binds integer values.

Error Handling

Writing JDBC Applications with MySQL - Issuing Queries

Issuing Queries

To process SQL statements in a JDBC-based application, create a Statement object from your Connection object. Statement objects support an executeUpdate() method for issuing queries that modify the database and return no result set, and an executeQuery() method for queries that do return a result set. The query-processing examples in this article use the following table, animal, which contains an integer id column and two string columns, name and category:

       PRIMARY KEY (id),
       name        CHAR(40),
       category    CHAR(40)
id is an AUTO_INCREMENT column, so MySQL automatically assigns successive values 1, 2, 3, ... as records are added to the table.

Issuing Queries That Return No Result Set

The following example obtains a Statement object from the Connection object, then uses it to create and populate the animal table. DROP TABLE, CREATE TABLE, and INSERT all are statements that modify the database, so executeUpdate() is the appropriate method for issuing them:

Statement s = conn.createStatement ();
   int count;
   s.executeUpdate ("DROP TABLE IF EXISTS animal");
   s.executeUpdate (
               "CREATE TABLE animal ("
               + "PRIMARY KEY (id),"
               + "name CHAR(40), category CHAR(40))");
   count = s.executeUpdate (
               "INSERT INTO animal (name, category)"
               + " VALUES"
               + "('snake', 'reptile'),"
               + "('frog', 'amphibian'),"
               + "('tuna', 'fish'),"
               + "('racoon', 'mammal')");
   s.close ();
   System.out.println (count + " rows were inserted");
The executeUpdate() method returns the number of rows affected by a query. As shown above, the count is used to report how many rows the INSERT statement added to the animal table.
A Statement object may be used to issue several queries. When you're done with it, invoke its close() method to dispose of the object and free any resources associated with it.

Issuing Queries That Return a Result Set

For statements such as SELECT queries that retrieve information from the database, use executeQuery(). After calling this method, create a ResultSet object and use it to iterate through the rows returned by your query. The following example shows one way to retrieve the contents of the animal table:

Statement s = conn.createStatement ();
   s.executeQuery ("SELECT id, name, category FROM animal");
   ResultSet rs = s.getResultSet ();
   int count = 0;
   while ( ())
       int idVal = rs.getInt ("id");
       String nameVal = rs.getString ("name");
       String catVal = rs.getString ("category");
       System.out.println (
               "id = " + idVal
               + ", name = " + nameVal
               + ", category = " + catVal);
   rs.close ();
   s.close ();
   System.out.println (count + " rows were retrieved");
executeQuery() does not return a row count, so if you want to know how many rows a result set contains, you should count them yourself as you fetch them.
To obtain the column values from each row, invoke getXXX() methods that match the column data types. The getInt() and getString() methods used in the preceding example return integer and string values. As the example shows, these methods may be called using the name of a result set column. You can also fetch values by position. For the result set retrieved by the SELECT query in the example, id, name, and category are at column positions 1, 2 and 3 and thus could have been obtained like this:

int idVal = rs.getInt (1);
   String nameVal = rs.getString (2);
   String catVal = rs.getString (3);
ResultSet objects, like Statement objects, should be closed when you're done with them.
To check whether or not a column value is NULL, invoke the result set object's wasNull() method after fetching the value. For example, you could check for a NULL value in the name column like this:

String nameVal = rs.getString ("name");
   if (rs.wasNull ())
       nameVal = "(no name available)";

Writing JDBC Applications with MySQL - Connecting to the MySQL Server

To connect to the MySQL server, register the JDBC driver you plan to use, then invoke its getConnection() method. The following short program,, shows how to connect to and disconnect from a server running on the local host. It accesses a database named test, using a MySQL account with a user name and password of testuser and testpass:

import java.sql.*;

   public class Connect
       public static void main (String[] args)
           Connection conn = null;

               String userName = "testuser";
               String password = "testpass";
               String url = "jdbc:mysql://localhost/test";
               Class.forName ("com.mysql.jdbc.Driver").newInstance ();
               conn = DriverManager.getConnection (url, userName, password);
               System.out.println ("Database connection established");
           catch (Exception e)
               System.err.println ("Cannot connect to database server");
               if (conn != null)
                       conn.close ();
                       System.out.println ("Database connection terminated");
                   catch (Exception e) { /* ignore close errors */ }
Compile to produce a class file Connect.class that contains executable Java code:
% javac
Then invoke the class file as follows and it should connect to and disconnect from your MySQL server:
% java Connect
   Database connection established
   Database connection terminated
If you have trouble compiling, double check that you have a Java Software Development Kit installed and make sure that the MySQL Connector/J driver is listed in your CLASSPATH environment variable.
The arguments to getConnection() are the connection URL and the user name and password of a MySQL account. As illustrated by, JDBC URLs for MySQL consist of jdbc:mysql:// followed by the name of the MySQL server host and the database name. An alternate syntax for specifying the user and password is to add them as parameters to the end of the connection URL:

When you specify a URL using this second format, getConnection() requires only one argument. For example, the code for connecting to the MySQL server in could have been written like this:
String userName = "testuser";
   String password = "testpass";
   String url = "jdbc:mysql://localhost/test?user="
                   + userName
                   + "&password="
                   + password;
   Class.forName ("com.mysql.jdbc.Driver").newInstance ();
   conn = DriverManager.getConnection (url);
getConnect() returns a Connection object that may be used to interact with MySQL by issuing queries and retrieving their results. (The next section describes how to do this.) When you're done with the connection, invoke its close() method to disconnect from the MySQL server.
To increase the portability of your applications, you can store the connection parameters (host, database, user name, and password) in a Java properties file and read the properties at runtime. Then they need not be listed in the program itself. This allows you to change the server to which the program connects by editing the properties file, rather than by having to recompile the program.

Writing JDBC Applications with MySQL -Preliminary Requirements

To use Java applications with MySQL, you may need to install some additional software:

  • If you want to compile and run Java programs, you'll need a Java compiler (such as javac or jikes) and a runtime environment. If these are not already installed on your system, you can get them by obtaining a Java Software Development Kit (SDK) from
  • If you want only to run precompiled applications, no compiler is necessary, but you'll still need a Java Runtime Environment (JRE). This too may be obtained from
This article assumes that you'll write and compile your own programs, and thus that you have a Java SDK installed. Once you compile a Java program, however, you can deploy it to other machines, even ones that have only a runtime environment. This works even in heterogenous installations, because Java is platform-independent. Applications compiled on one platform can be expected to work on other platforms. For example, you can develop on a Linux box and deploy on Windows.

Writing JDBC Applications with MySQL

You can write MySQL applications in a variety of languages. The languages that most people use with MySQL are PHP and Perl, but a sometimes overlooked option is the MySQL Connector/J driver, which allows you to develop Java applications that interact with your MySQL server.

MySQL Connector/J works within the framework of the Java JDBC interface, an API that allows Java programs to use database servers in a portable way. JDBC is based on an approach similar to that used in the design of Perl and Ruby DBI modules, Python's DB-API module, and PHP's PEAR::DB class. This approach uses a two-tier architecture:

  • The top level is visible to application programs and presents an abstract interface for connecting to and using database engines. The application interface does not depend on details specific to particular engines.
  • The lower level consists of drivers for individual database engines. Each driver handles the details necessary to map the abstract application interface onto operations that a specific engine will understand.
The JDBC interface allows developers to write applications that can be used with different databases with a minimum of porting effort. Once a driver for a given server engine is installed, JDBC applications can communicate with any server of that type. By using MySQL Connector/J, your Java programs can access MySQL databases.
Note: MySQL Connector/J is the successor to the MM.MySQL driver. If you have JDBC programs written for MM.MySQL, they should work with MySQL Connector/J as well, although you may want to update the driver class name used in your programs. Just replace instances of in your Java source files with com.mysql.jdbc and recompile.

Java Hibernate

HIBERNATE - Introduction to Hibernate

Hibernate is an open source object/relational mapping tool for Java. Hibernate lets you develop persistent classes following common Java idiom - including association, inheritance, polymorphism, composition and the Java collections framework.

Hibernate not only takes care of the mapping from Java classes to database tables (and from Java data types to SQL data types), but also provides data query and retrieval facilities and can significantly reduce development time otherwise spent with manual data handling in SQL and JDBC.

Hibernates goal is to relieve the developer from 95 percent of common data persistence related programming tasks.

Hibernate is Free Software. The LGPL license is sufficiently flexible to allow the use of Hibernate in both open source and commercial projects (see the LicenseFAQ for details). Hibernate is available for download at This tutorial aims to provide insight into Hibernate version 3.0RC and its usage
Some of the main features of hibernate are listed below and we have tried to explain some of them in detail later in this tutorial.

  Transparent persistence without byte code processing
    Transparent persistence
    JavaBeans style properties are persisted
    No build-time source or byte code generation / processing
    Support for extensive subset of Java collections API
    Collection instance management
    Extensible type system
    Constraint transparency
    Automatic Dirty Checking
    Detached object support
  Object-oriented query language
    Powerful object-oriented query language
    Full support for polymorphic queries
    New Criteria queries
    Native SQL queries
  Object / Relational mappings
    Three different O/R mapping strategies

Agile Java Development

                                                               Agile Java Development

Agile Java™ Development With Spring, Hibernate and Eclipse is a book about robust technologies and effective methods which help bring simplicity back into the world of enterprise Java development. The three key technologies covered in this book, the Spring Framework, Hibernate and Eclipse, help reduce the complexity of enterprise Java development significantly. Furthermore, these technologies enable plain old Java objects (POJOs) to be deployed in light-weight containers versus heavy-handed remote objects that require heavy EJB containers.
This book also extensively covers technologies such as Ant, JUnit, JSP tag libraries and touches upon other areas such as such logging, GUI based debugging, monitoring using JMX, job scheduling, emailing, and more. Also, Extreme Programming (XP), Agile Model Driven Development (AMDD) and refactoring are methods that can expedite the software development projects by reducing the amount of up front requirements and design; hence these methods are embedded throughout the book but with just enough details and examples to not sidetrack the focus of this book. In addition, this book contains well separated, subjective material (opinion sidebars), comic illustrations, tips and tricks, all of which provide real-world and practical perspectives on relevant topics. Last but not least, this book demonstrates the complete lifecycle by building and following a sample application, chapter-by-chapter, starting from conceptualization to production using the technology and processes covered in this book. In summary, by using the technologies and methods covered in this book, the reader will be able to effectively develop enterprise-class Java applications, in an agile manner!
About the Author
Anil Hemrajani has been working with Java technology since late 1995 as a developer, entrepreneur, author, and trainer. He is the founder of Isavix Corporation, a successful IT service company, and (formerly, an award-winning online developer community that grew to over 100,000 registered members. He has twenty years of experience in the information technology community working with several Fortune 100 companies and also smaller organizations. He has published numerous articles in well-known trade journals, presented at conferences and seminars around the world, and has received the “Outstanding Contribution to the Growth of the Java Community” award from Sun Microsystems, the “Best Java Client” award at JavaOne for BackOnline, a Java-based online backup client/server product, and was nominated for a Computerworld-Smithsonian award for a free online file storage service website.

Saturday, January 22, 2011

Blackberrys To Bunnies

The next time you place a call on your blackberry or play a game on your Nintendo Wii, you may have the IEEE 802.11 working group to thank.The latest BlackBerry models build upon the strength of the Wireless LAN  standard to create communication network that saves company money keeping employee better connected.

Tuesday, January 4, 2011


iPhone 4 problem will never be solved

Step taken by Apple to cater the iPhone4 deserved to be praised.
However,solution efferct offered by Apple has to be monitored
in the future.

Monday, January 3, 2011

Today is Tuesday

Today is a third day in a week and is placed betweem monday and wednesday.The word "Selasa" came from Arabic word which mean three day .Wheras tuesday came from the name of saxon's god which is Tyr.

Sunday, January 2, 2011


Today is second day of year counting day which is 2011.What the different between last year and this year?
Nothing much change i guess if we look back for past few years.It just same stories we heard in the
newspaper and televisyen.What's more important is, what we gonna be in the future?So we much start from
now and dont even look back your mistake.Leave all that behind and heads up.
Tomorrow gonna be first day of working in this, so lets start new chapter ya!!


  © Blogger template The Beach by 2009

Back to TOP