Ubuntu Lucid Lynx 10.04 is here!

Posted April 29th, 2010 in News by admin

Hello, I am using Ubuntu since last 1+ year. And It just works. Ubuntu gives lots of new stuff every 6 month :-) , Yes, Ubuntu release newer version  every 6 month.

New Release of Ubuntu Lucid Lynx 10.04 is available for download.
Its having social application capabilities (twitter, chat, digg, facebook etc) in OS itself.
Atleast Try it, and if you like it (I am sure you are gonna like it), than use it.

Response to HTML5 vs Flash technologies blog article

Posted January 20th, 2010 in Article by admin

Hello guys,

A post after long time. you know I am really lazy.

Anyways,

I stumbled upon a Blog entry, Does HTML5 stand a chance against Flash technologies?. I think Blog Author has done hardwork and research in gathering data and writting a very good article. so I decided to give a reply, and so while writing I felt that it can be a good blog post.

IMHO, I don’t think HTML5 and Adobe Flash Technologies can be compared?

My Counter-Arguments:

  1. Does comparison chart (shown in the article) shows HTML 5? no, why? May be because HTML 5 is not that famous now. But what about the same chart after 2 years? I believe that after 2 years also there will not be HTML 5. Why? Because its a standard, not a company or a technology.. And everyone (every browser) has to implement it sooner or later even Microsoft IE. For example new phones (i.e. IPhone or Android or Palm pre) comes with HTML 4 capability by default . Why? because it is standard. And still Iphone do not support flash. why? because its a company.
  2. Lets say after 2 or 5 years once it is implemented widely, Will you prefer to add your video by <video> </video> or you will embed flash video component in your blog entry?? what you do today for Image? you add <img> or added a flash component for image ???
  3. Is Flash for full websites? No. Why? I dont think I need to tell why this blog or website is not in Flash but in HTML (perhaps HTML 4)? Or why there are no blog platform written in Flash? Because, we already know that flash is not for development of full website, Although it is very practical and feasible to use it in GMail kind personal(hidden from web crawlers) full ajax application, but its may be about 5% of the world’s website, and at other 95% HTML rocks.. and HTML 5 will too..

I believe that HTML 5 is great. but I really don’t have any idea when it will be implemented widely. It may take 3 to 5 years :D OR 5 to 7 years :| OR 7 to 10 years :(

If you are a web developer, then you must watch Google IO 2009 Keynote. I think many of you already watched it. It explains all major features of HTML 5 very well. And, If you are  enterprise Intranet application developer or RIA application developer (GMail like) an try Flash (Flex-Air)  too.

By the way, I am java developer, right now working on Flex/As3 too . And Its feel like home (for Java developer).

These are my personal opinion, and I am no expert. :)

Cheers,

GWT 2.0 RC1 has been released and available for download!

Posted November 19th, 2009 in News by admin

Hello guys,

GWT 2.0 (I am eagerly waiting for it) RC1 is now available for download. (Available around before 40 hours from this post time) .

And also,  there is Getting Started page in Wiki (link) for (umm..) getting started :)

Summary of New Features in GWT 2.o (from Wiki Link)

  • In-Browser Development Mode
  • Developer-guided Code Splitting
  • Declarative User Interfaces with UiBinder
  • Bundling of Resources via ClientBundle
  • Simplified Unit Testing with HtmlUnit

You can get details of New features from Wiki page.

So get started, enjoy!

Yet another Spring Framework Introduction [level: beginner]

Posted November 16th, 2009 in Article, Tutorial by admin

Yet Another Spring Framework Introduction

Spring framework is not new and is used widely, this article addresses very basic of core component of Spring which works on Dependency Injection (DI) concept. Spring was invented by Rod Johnson. It was released with its book “Expert One-on-One J2EE Design and Development” in October 2002. Now Spring Framework is also available for MS .Net Platform.

Spring Framework is truly modular framework and it contains multiple components i.e. Spring-core, Spring AOP, Spring ORM etc. if you want to use only Spring MVC component, you can remove all other packages and use only required packages (spring-core and spring-MVC). All components of spring are built on/around Spring-core (Although some components/classes can be used without Spring-core i.e. Spring JDBC Component) .


Major Components of Spring Framework

modules

The above figure show major components of Spring (There are many more components under Spring umbrella, but I have specified major components as per my understanding). As I said you can use any components as and when required. Rather than explaining about all components briefly, I’ll explain Spring-core only.

Please note that any of these components (except Spring MVC) do not provide something which already exists. For example Spring ORM is not another ORM library but it allows you to plug any ORM like JBoss Hibernate, Oracle TopLink, JPA etc. So what does Spring ORM do??? Spring ORM with Spring-core capability provides easy, flexible and convenient way to use desired ORM in Spring enabled application, it also reduces boiler-plate code.

So you can consider Spring as an integration framework.

In my opinion, working or practical example always helps in understanding new technology better. So for this article, consider we have “BookProvider” class which provides details of “Book” by its ISBN number, “BookService” interface can be considered as DAO (Data Access Object) interface, and its implementations “AmazonBookService” and “LocalBookService” which can fetch book from Amazon web service or Local book database.

Have a look at the source structure.

Source structure

Spring can be configured by either XML or annotations. But in this example we will stick to xml based configuration (which is actually preferred and promoted by Spring community). In this structure config/spring.xml is Spring configuration file.

Before moving ahead, we should understand what is DI.

Dependency Injection (DI):

Dependency injection (DI) is also known as IoC (Inversion of Control).  DI is very basic concept, yet very powerful. BookProvider requires BookService. Can you think how BookProvider will get instance of BookService?

One way is BookProvider will ask some service locator (static or singleton) class to locate BookService instance typically ServiceLocator.getBookService();, But the problem is now BookProvider is coupled with ServiceLocator’s getBookService() method. So while testing (unit testing) BookProvider you have to provide implementation of BookService ServiceLocator. Not that only, now your BookProvider is not reusable without reusing ServiceLocator.

Another option is having method “void setBookService(BookService service)” in BookProvider class or passing BookService instance in constructor. And parent class which creates BookProvider instance will provider BookService instance also. Understanding problem here may be bit tricky or hard, so concentrate on each word. So in this case, BookProvider dependency of BookService is moved to parent class (For example Library) as parent class is now dependent on BookService, reusing or testing parent class becomes hard or infeasible.

So if we use DI pattern, these kinds of unwanted dependencies can be injected by DI tool or container when object (which requires services/instances of other object, i.e. BookProvider) is created.

I hope you understand fundamentals of DI. If you are not clear you can try googling Dependency Injection Introduction or Tutorial.  (Lazy guys like me, click here )

Example with explanation:

I highly recommended trying it out while reading or after reading. I have provided most of the code here OR you can download code (with Netbeans IDE  project files); I omitted trivial java code only. If you are using Netbeans as IDE, Spring-core is already available as in-built library, so no need to download it, otherwise you have to download it from Spring Source Community Website .

Spring’s configuration file: spring.xml ( Sorry, Its image instead of text, I will take care from next time, you know I am new to blogging and authoring )

dd3bspmq_37tzc99vh_b

<beans> </beans> is parent/container for all <bean> </bean> definition.

Spring container (Spring-core manages object instances) loads each <bean> as a singleton (this behavior is configurable, but out of this article’s scope). In <bean>, “id” must be unique. And object of class specified in “class” property will be instantiate and maintained by spring.  If class is not having zero-arg constructor, then required reference or value must be specified in <constructor-arg> .

i.e.

[sourcecode language="xml"]

[/sourcecode]
In above example, value (Baleno) is of type String. If constructor requires other object as argument then instead of “value”, “ref” should be used, “ref” is used for referring to other beans. You can see usage of “ref” in example spring.xml‘s “bookProvider” bean. So Spring allows us to use classes without changing any of its code, very helpful when you want to use external libraries or legacy code/classes.

In spring.xml, we have created two beans one is “bookService” which is instance of AmazonBookService class. Another bean “bookProvider” is instance of BookProvider class, and we injected “bookService bean” into “bookService property of BookProvider”. Understand the difference here, “bookService property of BookProvider” means that there is a setBookService(BookService service) method in BookProvider, where “bookservice bean” which is instance of AmazonBookService will be injected.

BookProvider.java

[sourcecode language="java"]

public class BookProvider {

private BookService bookService;

//BookService will be set by Spring using this method.

public void setBookService(BookService bookService) {

this.bookService = bookService;

}

public BookProvider() {

}

public Book getBook(String isbnNo) {

return bookService.getBook(isbnNo);

}

}

[/sourcecode]

BookService.java

[sourcecode language="java"]

public interface BookService {

public Book getBook(String isbnNo) throws IllegalArgumentException;

}

}
[/sourcecode]

AmazonBookService.java

[sourcecode language="java"]

public class AmazonBookService implements BookService{

public Book getBook(String isbnNo) {

//Web service call goes here, or use this dummy implementation.

if(!”1-933988-13-4″.equals(isbnNo)) {

throw new IllegalArgumentException(“Dummy impl: Book not found with ISBN: ” + isbnNo +”, use 1-933988-13-4 only.”);

}

System.out.println(“Fetching Book [ISBN: " + isbnNo + "] from Amazon”);

return new Book(“Spring In Action – Second Edition”, “1-933988-13-4″, “CRAIG WALLS”);

}

}

[/sourcecode]

main() method

dd3bspmq_4gzc74s8k_b

For brevity, I have not shown Book and LocalBookService implementation. BookProvider and LocalBookService are very simple POJO (Plain Old Java Object), so I am omitting its explaination. In main() method, first statement creates instance of ClassPathXmlApplicationContext instance, which will load spring.xml. ClassPathXmlApplicationContext is nothing but specialized sub class of BeanFactory. Second statement retrieves “bookProvider” bean from BeanFactory. Now you can call (as shown in main() method) getBook(isbnNo) method, because BookService (actually ) instance is automatically injected to BookProvider by Spring.

Output of execution is

—————————–

Fetching Book [ISBN: 1-933988-13-4] from Amazon

Book found: Spring In Action – Second Edition, ISBN: 1-933988-13-4, Author: CRAIG WALLS

—————————–

This is the core functionality of Spring framework, on top of this, other features and components are implemented.

Spring DI is powerful technique, let me just give you one example, say now we want to change BookService, instead of Amazon web service we want to use our own book information database for book details. So you just need to change value of “bookService” bean’s class attribute to LocalBookService from AmazonBookService in spring.xml. Thats all. If you run the program, output will show that data is fetched from Local database.

Output of execution is

—————————–

Fetching Book [ISBN: 1-933988-13-4] from Local Database

Book found: Spring In Action – Second Edition, ISBN: 1-933988-13-4, Author: CRAIG WALLS

—————————–

Conclusion:

If you are not clear with overall usage and benefit of Spring, it is okay. Because this article is an attempt to get started with Spring. In Spring intensive production application, all beans are wired with each other, so in application you will not need to get any beans manually.

Spring

  • Decouples classes which allow their testing independently and reusing them.
  • Encourages “Programming to interface” principle.
  • Allows POJO programming, by not adding any spring specific code in spring beans.
  • Allows legacy classes to be used.

If you found Spring Framework interesting and useful, please try it out.

You can download spring framework from www.springsource.org, Also there is plenty of documentation available to get started.

Source code of this article : Download as Zip

Please feel free to comment for any query, suggestion, compliments or complaints.

Stay tuned for next post. :)

Cheers,

Hello world (from LogicWind)!

Posted July 20th, 2009 in News by admin

Hi, This is third time I have start writing a blog. But this time reason and purpose is very important.

Because, I am starting a new life with new goals..

Friends I am starting my own software company.. LogicWind.

Spent last 10 hours out of 12 hours behind understanding Wordpress, searching themes, plugins, finding free host etc. And finally you are looking at the result “this blog”.

Still I am confused, what should I write in this blog platform of my company.

Anyways, Cross your fingers for my new venture.

Regards,