Theme Graphic
Theme Graphic

Pawan's blog

Welcome to my blog! Here you will find Java tutorials.

Subscribe

Author

I am currently staying in Ghaziabad and Working as a Technical consultant with Fujitsu, noida. I am working in Java , J2EE technologies and BPM domain.

Archive

Tags

Posted on Wednesday, April 07, 2010 at 2:50 PM

Singleton Aspects

Make constructor private or Make that class final

Make a static reference initialize that in a static method is it object does not exist.

Loop Holes:

If classes loaded by different class loaders access the Singleton then you will have multiple instances of same object.

If Singleton object is Serializable after deserialization you will get different instance of Singleton object.

If the method which is constructing object of Singleton class is not thread-safe then two threads can access that method and create multiple instance.

Double Checked Locking:

public static Singleton getInstance() {
if(singleton == null) {
synchronized(Singleton.class)
if(singleton == null) {
singleton = new Singleton();
}
}
}
return singleton;
}
Comments: 1 Tags: Java

Posted on Wednesday, April 07, 2010 at 2:48 PM

MVC 1 versus MVC 2

I was reading on internet about MVC 1 and MVC 2. I got this difference for quick learners I hope this will be helpful.

MVC is a design pattern. It contains two models. MVC Model 1 MVC Model 2.

Struts framework implements MVC Design Pattern. Struts can implement Model 1 and Model 2.



Model 2 most properly describes the application of MVC in a Web-Application context.

Following are the important feature of MVC1 architecture:

HTML or JSP files are used to code the presentation. JSP files use java beans to retrieve data if required.

MVC1 architecture is page-centric design all the business and processing logic means any JSP page can either present in the JSP or may be called directly from the JSP page.

Data access is usually done using Custom tag or through java bean call.Therefore we can say that in MVC1 there is tight coupling between page and model.

Following are the important feature of MVC2 architecture: ...
Comments: 0 Tags: Java

Posted on Wednesday, April 07, 2010 at 2:20 PM

JavaFX Basics

Hello Friends ,

Few days ago I thought of learning something new in Java. I came across JavaFX. I have noted down few basic things related to JavaFX. I hope someone somewhere will find them helpful.

Basics

JavaFX is a scripting language for creating RIAs (Rich Internet Applications). The JavaFX Script programming language is an object-oriented language. def and var are two ways to define a variable difference between both is def is like final in java and var is like any other simple declaration. You do not need to declare any kind of datatype with variables (JavaFX compiler is smart enough to understand the datatype from the context where the variable is used.) You can use netbeans for development and compilation of JavaFX programs.

From command Line you can use : JavaFXc for compilation and JavaFX for running the code. JavaFX process code using functions not methods like java

run(args:String[]) is equivalent to main(String[] args) method in Java...
Comments: 2 Tags: JavaFX

Posted on Tuesday, March 17, 2009 at 1:23 PM

Remove all hyperlinks in Microsoft word in one step.

You can remove it eaily with the help of Macros. Just follow some simple steps given below and see the magic.

Open your MS word Document. Press "Alt+F11" - it will open the Visual Basic Editor Click Insert on Menu bar Click Module In the new pop-up window copy following:

Sub RemoveHyperlinks()
Dim oField As Field
For Each oField In ActiveDocument.Fields
If oField.Type = wdFieldHyperlink Then
oField.Unlink
End If
Next
Set oField = Nothing
End Sub


Then click File and Close and return to Microsoft Word

After that Run Macro - Tools > Macro > Macro and then Run “RemoveAllHyperlinks”

Regards, Pawan Chopra.

Comments: 2 Tags: General

Posted on Sunday, March 15, 2009 at 12:09 PM

XML parsers: Push versus Pull parsers

I have used XML in spring, hibernate and some other frameworks. I didn’t get pain to parse and read those configuration files ever because framework’s API was doing that for me. Just before 10 days I had attended a training of AXIOM in my organization, I was sitting like a dumb person because I was completely unaware of things like Push parsing and Pull parsing. Any how I had to complete that training and I did it (But I don’t even remember what is AXIOM ;) ).

Then, I started learning about these two things Push and Pull parsing, and I found them very interesting. So, I thought of writing a Tutorial on this topic. This is my very first tutorial in my life so please give suggestions on improvements. Basic Introduction:

Streaming(Event-based) versus DOM(Tree-based)


Generally speaking, there are two programming models for working with XML infosets: streaming and the document object model (DOM)...
Comments: 14 Tags: Java XML

 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.