Skip to main content

Posts

Showing posts from December, 2011

Developing Applications with WebLogic Workshop

The WebLogic Workshop IDE builds enterprise-class applications that run in the WebLogic Workshop runtime. The applications you build in WebLogic Workshop typically expose systems and data within or between enterprises, typically via web applications and/or web services. As an example, considering an express shipping company. Such a company might want to expose shipment scheduling, tracking and billing data to its business partners via web services so that partners' applications can access the data directly. The company also might want to expose tracking information via one or more web applications so that shipment originators and recipients can check the status of shipments from a web browser. WebLogic Workshop makes it easy to construct common functionality for both applications and then expose that functionality with appropriate interfaces.

Tricky Interview Questions in Java Collections

What is difference between ArrayList and vector? Ans) 1) Synchronization - ArrayList is not thread-safe whereas Vector is thread-safe. In Vector class each method like add(), get(int i) is surrounded with a synchronized block and thus making Vector class thread-safe. 2) Data growth - Internally, both the ArrayList and Vector hold onto their contents using an Array. When an element is inserted into an ArrayList or a Vector, the object will need to expand its internal array if it runs out of room. A Vector defaults to doubling the size of its array, while the ArrayList increases its array size by 50 percent. How can Arraylist be synchronized without using Vector? Ans) Arraylist can be synchronized using: • Collection.synchronizedList(List list) Other collections can be synchronized: • Collection.synchronizedMap(Map map) • Collection.synchronizedCollection(Collection c)

Difference between Enumeration and Iterator

Use Iterator always for better programming. One big difference between Iterator and Enumeration is (apart from what Pallav has already mentioned), iterator is fail-safe. If you are using an iterator to go through a collection you can be sure of no concurrent modifications in the underlying collection which may happen in multi-threaded environments. Well, apart from being an advantage this also is said to decrease performance by a tad. However, that's negligible. (Some amount of processing is involved in checking for modifications). If you see the docs it says about "well defined semantics" for the iterator, the fail-safe property adds to that. Enumeration and Iterator are interfaces in java.util package. Enumeration is the old Interface(for legacy classes like Hashtable). Iterator is for the new classes like HashSet,HashMap.. Enumeration and Iterator are used to just count the no of elements and view it. But Iterator has an additional method for deleting elements

Free AJAX Resources Online

This is a user-contributed list of AJAX tutorials for those new to Asynchronous JavaScript with or without XML. Feel free to leave a comment if you feel an important tutorial has been omitted. AJAX security - read about AJAX security issues and vulnerability postings jQuery plugins - a directory of plugins for jQuery. How jQuery works - a basic jQuery tutorial. Tutorial: AJAX Made Easy - On the heels of two very successful tutorials on creating a collapsible div and an animated sliding div, I̢۪ve decided to write another. It seems my last few helped a number of programmers learn a simple trick, and hopefully this one will do the same. Efficient JavaScript code - Opera has one of the fastest and most efficient JavaScript engines of any browser, but when you have multiple User JavaScripts installed, it is important that they run efficiently to keep Opera's performance as high as possible. Well written code will help to minimise the performance impact of User JavaScripts.

Weblogic Applications And Projects

In WebLogic Workshop you create and build an application . A WebLogic Workshop application is a J2EE Enterprise Application and ultimately produces a J2EE Enterprise Application Archive (EAR) file. An application may contain: one or more projects libraries and modules security roles This topic introduces applications and their contents. Applications An application in WebLogic Workshop is the collection of all resources and components that are deployed as a unit to an instance of WebLogic Server. It is also the top-level unit of work that you manipulate with WebLogic Workshop IDE. In the IDE, you may have at most one application open at a time.

Weblogic Server Workshop File Types

This topic lists the file types you will encounter in your use of WebLogic Workshop. WebLogic Workshop Application Developer Edition File Types You may use a variety of files to create your application in WebLogic Workshop, some of which you may not be familiar with. The key file types you may encounter in WebLogic Workshop Application Developer Edition are: EJB file, or Enterprise Java Bean. An EJB file contains the Java implementation class for an EJB, with Javadoc annotations that configure the EJB. To learn more about building EJBs in WebLogic Workshop, see Developing Enterprise Java Beans. JCS file, or Java Control Source. A JCS file contains the Java implementation class for a Java control type. There is only one JCS file per Java control. If the Java control is extensible, there may be many JCX files that extend the Java control.

How To Create A Simple Webservice In Java?

I was searching over internet for a simple tutorial how to create a webservice. I think this best tutorial I have found. This tutorial shows how to create a simple Web service and Web service client from a Java class. The Java class in this scenario converts between the Celsius and Farenheit temperature scales. Example 1       |       Exapmle 2  

WebServices & It's Features

What are web services? A web service is a business function that is self-contained and operates over the internet. The W3C defined web service as "a software system designed to support interoperable machine-to-machine interaction over a network". XML is the base for the web services. They communicate using open protocols. Web services are more frequently like Web APIs. These services accessibility can be from internet. A remote system can host these services for different web services. A web service can convert a stand alone / desktop application into a web based / web application. A web services are published or found and utilized through the internet. The web services works on the XML + HTTP platform. Explain each web service technologies - SOAP, WSDL, UDDI, eBXML and JAX pack.

40 Excellent Resources for JavaScript Coders

Are you an advanced JavaScript coder looking for more sites to sharpen your coding prowess? Maybe you're a web designer wanting to double as a developer (or at least know enough to add a bit of rich content into your designs). Either way, if you're looking for more information on the topic of JavaScript , the following resources are worth a gander. Reference, Resources, & Tutorials DevGuru - JavaScript Quick Reference DevGuru provides an extensive list of JavaScript syntax, alphabetized similar to a glossary for easy scanning and searching.

Behavioral Patterns - Interpreter Pattern

The Interpreter Pattern defines a grammatical representation for a language and an interpreter to interpret the grammar. The best example you can get for this is Java itself which is an interpreted language. It converts the code written in English to a byte code format so as to make possible for all the operating systems to understand it. This quality of it makes it platform independent. The development of languages can be done when you find different cases but, somewhat similar, it is advantageous to use a simple language which can be interpreted by the system and can deal with all these cases at the same time. To make this interpreter clearer, let’s take an example. The “musical notes” is an “Interpreted Language”. The musicians read the notes, interpret them according to “Sa, Re, Ga, Ma…” or “Do, Re, Me… ” etc and play the instruments, what we get in output is musical sound waves. Think of a program which can take the Sa, Re, Ga, Ma etc and produce the sounds for the frequenc

How To Improve Performance of A Java Application?

􀂃 Pool valuable system resources like threads, database connections, socket connections etc. Emphasize on reuse of threads from a pool of threads. Creating new threads and discarding them after use can adversely affect performance. Also consider using multi-threading in your single-threaded applications where possible to enhance performance. Optimize the pool sizes based on system and application specifications and requirements. Having too many threads in a pool also can result in performance and scalability problems due to consumption of memory stacks (i.e. each thread has its own stack.) and CPU context switching (i.e. switching between threads as opposed to doing real computation.). 􀂃 Minimize network overheads by retrieving several related items simultaneously in one remote invocation if possible. Remote method invocations involve a network round-trip, marshaling and unmarshaling of parameters, which can cause huge performance problems if the remote interface is poorly desig

How To Write a Build File Using ANT?

Introduction: This is an introductory tutorial to the Ant build tool, a free tool under GNU License and is available at http://jakarta.apache.org/ant/ . Ant allows the developer to automate the repeated process involved in the development of J2EE application. Developers can easily write the script to automate the build process like compilation, archiving and deployment. It is intended for people starting out with Ant and Java development, and aims to provide enough detail to get started.   What is Ant? Ant is a platform-independent scripting tool that lets you construct your build scripts in much the same fashion as the "make" tool in C or C++. You can use a large number of built-in tasks in Ant without any customization. Some of the most important tasks and related commands are built in the Ant distribution.

What Is The Difference Between 'bit-wise AND' and 'conditional AND' ?

The & and || operators are defined for two integer operands or two boolean operands. The && and || operators are not defined for anything but two boolean operands. For all other operand types and combinations, a compile-time error shall occur. The Integer Type Operands The & operator is the "bit-wise AND" operator and | is the "bit-wise OR" operator.  This permits you to manipulate individual bits in a number. The Boolean Type Operands The && is the "conditional AND" operator and  || is the "conditional OR" operator. The && and || operators are evaluated in short circuit fashion. This means that when you have an expression like:   e1 && e2

What Is IOC Container in Spring Framework?

The bean factory concept is foundation of Spring as an IOC container. IOC takes the responsibility for making things happen into the framework away from application code. Programmer needs to just configure which dependencies should be set. BeanFactory interface, an implementation of the Factory design pattern enables objects to be created and retrieved by name. Relationships between objects can also be managed. BeanFactory supports two object modes: 1.      Singleton mode provides a shared instance of the object with a particular name, which will be retrieved on lookup. Singleton is the default and most often used object mode. It is ideal for stateless service objects. 2.      Prototype mode ensures that each retrieval will result in the creation of an independent object. Prototype mode would be best used in a case where each user needed to have his own object.

Passing Unspecified Number of Arguments To A Method

We didn't have feature that passing unspecified number of arguments to method, but this feature has been introduced with JDK 5.0. Java considers the variable-length argument list as an array. This is represented by argument type followed by three dots in the declaration of the Method. The following example can explain about this The method int sum(int…numbers) can take any number of parameters of type integer. public  int  sum ( int ...numbers ) {          int  sum= 0 ;          for  ( int  d : numbers  )                       sum =sum + d;          return  sum;      }      public static  void  main ( String []  args ) {          int  i= 3 ;          int  j= 6 ;          int  k= 9 ;          System.out.println ( "Sum  of two numbers" +sum ( i,j )) ;          System.out.println ( "Sum of three number" +sum ( i,j,k )) ;      } }

The J2EE Architect's Free Handbook

-- This book is written for technical architects and senior developers tasked with designing and leading the development of J2EE java applications. This book will guide the architect through the entire process of delivering a project from analysis through application deployment providing numerous tips, tricks, and “best practices” along the way. Download it for free. Just click below download link. Download..

Why Marker Interface Does Not Have Method Declarations?

Every Java programmer knows that Marker Interface does not have any methods in it. Some of you confused if there are no any method declarations, and then what is the use of Marker Interface or Tagged Interface. But very few people know why we use Marker Interface and its use in our programs. Whenever any class implementing some Marker Interface, just we are telling to JVM to do that particular functionality of interface. So JVM checks that class or it's super class is implementing the Serializable interface or not. That means serialization process is taken care by JVM itself. So you no need to write any code for serialization. Then what is the use of method declarations in Serializable interface when JVM is going to do everything for us.

How To Use Initializer Blocks in Java?

Initializer Blocks - what are they, why & how are they used? These blocks are similar to the static initialization blocks with the only difference being the absence of the 'static' keyword. The Java compiler copies all the initializer blocks in the same order as they are in the source code in every constructor before any executable statement in that constructor. public class InitializationWithInitializerBlock{ public static int staticIntField = 100; private boolean instanceBoolField; {      boolean y;                 y = true; //or, y = <some expression returning a boolean value>;      instanceBoolField = y; } } So if you see all your constructors having same code-segment at the top then you will probably be better off keeping that in an initializer block as anyway the compiler would copy the block in every constructor at the top. This way you can at least make the code more readable, maintainable (as the common code will only

Frequently Asked Hibernate Interview Questions

1. What is Hibernate? Hibernate is a powerful, high performance object/relational persistence and query service. This lets the users to develop persistent classes following object-oriented principles such as association, inheritance, polymorphism, composition, and collections. 2. What is ORM? ORM stands for Object/Relational mapping. It is the programmed and translucent perseverance of objects in a Java application in to the tables of a relational database using the metadata that describes the mapping between the objects and the database. It works by transforming the data from one representation to another.

Hibernate Meta Model

The meta model is the model used by Hibernate core to perform its object relational mapping. The model includes information about tables, columns, classes, properties, components, values, collections etc. The API is in org.hibernate.mapping and its main entry point is the Configuration class, the same class that is used to build a session factory. The model represented by the Configuration class can be build in many ways. The following list the currently supported ones in Hibernate Tools. A Core configuration uses Hibernate Core and supports reading hbm.xml files, requires a hibernate.cfg.xml. Named core in Eclipse and <configuration> in ant.

Hibernate Object States

Hibernate defines and supports the following object states. Transient - an object is transient if it has just been instantiated using the new operator, and it is not associated with a Hibernate Session. It has no persistent representation in the database and no identifier value has been assigned. Transient instances will be destroyed by the garbage collector if the application doesn't hold a reference anymore. Use the Hibernate Session to make an object persistent (and let Hibernate take care of the SQL statements that need to be executed for this transition. Persistent - a persistent instance has a representation in the database and an identifier value. It might just have been saved or loaded, however, it is by definition in the scope of a Session. Hibernate will detect any changes made to an object in persistent state and synchronize the state with the database when the unit of work completes. Developers don't execute manual UPDATE statements, or DELETE statements when