Sunday, September 7, 2008
Not having aggregator is a real struggle !
Planned to make this blog as a set of feed reader gadgets. But it isn't fair for everybody as first blog will always be displayed first.
And since my last post from here, I had blogged number of posts in mine. Please do visit here :)
http://jk-blogging.blogspot.com/
Friday, May 30, 2008
0 How To Run Ant FTP / Telnet / Rexec Task
Included in Ant are optional tasks like FTP & Telnet. For example the FTP Task allows you to communicate with FTP servers (get / put / list etc.).
Unfortunately they don’t work out of box and not well documented. In this article we will explain the whole procedure in six simple steps.
To use them follow the steps below:
- Download jakarta-oro and commons-net library.
Note: The links above allow you to download the version I tested them with. - Create a lib directory for your project if you have not already done so.
- Extract the jar file jakarta-oro*.jar from jakarta-oro library you have downloaded and copy it to the lib directory you created.
Note:- If you have downloaded from the links in step 1 then the exact file name is jakarta-oro-2.0.8.jar
- Ensure that the file is copied to the lib directory and not to any of its sub-directories
- Extract the jar file commons-net*.jar file from commons-net library you have downloaded and copy it to the lib directory.
Note:- If you have downloaded from the links in step 1 then the exact file name is commons-net-1.4.0.jar
- Ensure that the file is copied to the lib directory and not to any of its sub-directories
- Add the ftp taskdef at the top:
- Add the appropriate task to your build.xml file. An example task to upload a directory is as follows:
description="Upload the files to WordPress Installation" >
remotedir="/test" server="taragana.com"
userid="ftp_login" password="ftp_password">
- Run Ant by including the lib directory in classpath. An example would be:
ant -lib lib upload
Note: I just had to include the lib directory to ensure all its jar files are automatically included.
Note:
- The same procedure can be used to run Ant Telnet and RExec Tasks. Only the task name and parameters in build.xml file will change. Check the corresponding manuals for details.
- I have promoted the use of lib directory (within project) to keep your jar files. This makes your jar files available only to your project. There are two other alternatives. First you can keep them in %ANT_HOME%\lib directory. This makes them available to all projects for all users in that machine.
You can also keep them in ${user.home}/.ant/lib.
Tuesday, March 4, 2008
Feb 29, A bad day for apache ftpclient users
I am writing this blog after being severely hit by apache ftpclient bug on February 29.
Unsurprisingly the bug has hit the whole world of apache ftpclient users and there were number blogs immediately started popping up.
By abstract this is the bug all about. When the ftpclient parses the files one by one, it validates the file timestamp. In Unix system it gets the file properties and the date will have the MMM HH:mm if the file is less than 6 months old. Since there is no year in the time stamp string, ftpclient parses it with year 1970 (Well done !) which of course is not a leap year. So Feb 29 is not a valid date in 1970 hence this code segment in class UnixFTPEntryParser returns null.
try{
file.setTimestamp(super.parseTimestamp(datestr));
}catch (ParseException e){
return null; // this is a parsing failure too.
}
There are many temporary ugly fixes based on your requirements ;) For me , I just needed the files to be downloaded, so I catch the exception and if the date string has "Feb 29" and the current year is leap, I just set a Feb 29 time and return the File instead of NULL.
But people who needs correct time stamp will have to a bit of extra work. This link discusses about possible fixes and implications.
The good thing is we have another four year time to fix this problem !!!
Friday, February 29, 2008
More on spring integration
Like I mentioned in my previous post, I in fact had a shot at spring integration. And I asked my buddy Lahiru to have a work on it. And unsurprisingly he found no time to get familiar with the model.
This is a one major reason why I favor spring integration even though it is far away from being matured.
I don't find any other proper open source EIP solutions alive. Two possible solutions which come across are ActiveMQ and Apache Camel.
So why I prefer spring integration over these solutions ? Here are my points.
1) The AOP support.
Just imagine the beauty of designing the AOP based integration solution. It will be a treat to do and follow.
2) What most of us are doing with Mule (or other opensource ESB) now ? We just use spring every where in it. 9 out of 10 times this is spring on Mule. So being persisted with one framework (which is of course spring! ) will be much more easier for the developers.
3) Spring documentation.
Many times I have mentioned this in my blog. Spring documentation and examples give us no time to understand the solutions easily. I haven't see any other documentations which can get closer to this. Spring addresses its documentation is a user's point of view where most of other open source documentations are done on the developer's(I mean the developers involved in the particular open source product) point of view.
4) The IOC model.
The same I mention again. It will be easy to plug in the third party adapters with less fuss. I think it is pretty obvious advantage.
So what I am looking for in the near future on this.
1) WS support
Desperately need this. I think they will have it before the 1.0 release. SOA is becoming a marketing term these days and it is vital for the designers to have the WS support. So it is so important that spring integration must be released with WS support. But even now it will not be difficult to have a such adapter anyway.
2) Facility to make hot configuration.
When it comes to production environment, application providers will see easy way of plugging their applications. So a kind of JMX based admin console would be handy. Then again exposing a bean MBean is very easy in spring and you can still self cook.
Now few hiccups on using Mule which is a tested ESB solution and you can still use it for EIP. To be honest, I had a bit of confused wrong view on ESB against EIP and tried Mule for the purpose of EIP. Surely you can do. But its like using hammer to smash a mosquito. Mule is intended to be used for ESB. Though it pretty tough call to use it for typical SDP solutions, you can still use it. But I differ for using it solely for EIP. Because you will put unnecessary efforts to make it working (Actually I did) and its documentation will never be helping that much.
But I am pretty confident that a good EIP framework can turn out be a good ESB solution. When you do that, you will have your own flavor and you will have nothing more than what you need. Spring integration has its potential. I wish they have a spring integration (EIP framework) and separate ESB framework so
So the morale of the post having two points.
1) Like Americal Idol judge Rendy says "Spring integration, Check it out baby, check it out ! "
2) If you have any butterflies regarding to EIP, ESB and SOA, work on it. Read hell lot of documents and get the clear picture of them. I still am working on !!!
Monday, January 28, 2008
Hang on ! Spring integration is due
But spring integration framework must be much better option with time. Not just because it is spring, but it is because of its IOC. Even before you dig in to this Reference Manual you can think of how easy the applications could be wired using spring. And with spring web services and Spring integration , you can model a good SOA architecture in your applications.
I am going to have a try on this. Will update you with progress.
Monday, January 21, 2008
IVY 2.0 is released as apache project
Delighted to see Apache IVY released its 2.0 version under apache. IVY is a long time sitter under incubator and I surprised about it in this post. Good to see IVY is under apache label now. Even better I see it under ant which will definitely help promoting IVY. I always feel that ivy + ant will always a better option over maven for small and medium proprietary projects. We at hsenid use ivy heavily and it is our major dependency management setup.
Click here to see the release notes.
Congratulations IVY.
Monday, January 14, 2008
Is Your HTML Good Enough?
IE NetRenderer will show your page in IE 5.5, 6, or 7, to give Mac and Linux-based designers a quick sanity check. It’s free and quick.
BrowsrCamp is designed to show off how your page looks under the various Mac browser out there. You can view Safari screenshots for free, or take VNC control of a live Mac loaded with 11 different browser for prices starting at $3 for 2 days.
Browsershots is the most comprehensive of the free services, offering screen captures of your site under dozens of different Linux, Mac, and Windows browsers. It’s also popular, and it can take quite a while for requests to work to the head of the queue to be rendered. They’ve recently introduced a $15 per month priority processing program to jump requests to the head of the queue.
BrowserCam offers an online interface for managing screenshots across a variety of recent browsers and operating systems including Linux, Mac, and Windows; their coverage is excellent. You can get a 24-hour free trial; after that, plans range from $19.95 for one-day access to $399.95 for a full year. Their separate Device Capture service is the only one I know that will do screenshots of your site on Blackberry and Windows Mobile devices.
Litmus covers a variety of Windows browser, from IE 5.0 up to the alpha of Firefox 3, and say they’re adding Mac browsers soon. Results are returned via screenshots. They also integrate bug tracking, version management, and private URLs you can use to share compatibility results with clients. These features come at a price after the initial 30-day trial: 39 euros monthly for an individual account, or 129 euros monthly for a team account.
Browser Photo comes from Keynote NetMechanic. They promise screenshots from Windows, Mac and Linux systems for a $15 one-time fee or $150 per year, but don’t offer any details on which browsers or versions they cover in advance of sign-up, or any trial program.
BrowserPool takes the VNC approach to provide access to Mac, Windows, and Linux systems. Their pricing starts at 29.99 euros for one month, but unfortunately their software versions are a bit out of date.
Monday, December 24, 2007
Deploying mobicents services on startup
I had spent about 20 minutes to search in the mobicents documentation to find out the way to make the mobicents deployments permanent. But unfortunately I could not find in the documents which I thought should be a important documentation for any such servers. It might be my mistake to look out the wrong documents or I am afraid, it might have missed in their documents.
But fortunately I didn't spend too much of time to find the way. It is of course an easy and straightforward task. but I wonder how this good procedure made unnoticed and not documented properly. My apologizes to mobicents community if I didn't really look into the correct documentations.
You just have to use a template BSH script to make it working .. thats it.
For example I need my http-servlet-ra to be deployed on server startup and make it permanent.
Here are the steps I followed.
- Copy the
/resources/http-servlet-ra/*.jars into server/server/all/deploy-mobicents/ Copy the
/resources/http-servlet-ra/deploy-http-servlet-ra.bsh into server/server/all/deploy-mobicents/scripts/
Thats it. Your resource adapter will be installed on server startup. You don't have to do ant ra-deploy from ra folder anymore !
Now how about installing and activating our own sbb jars on startup? Simple .. I have a http connector sbb to be deployed and activated upon startup. These are the steps I followed to do so.
Copy the httpconnectorsbb-DU.jar into
server/server/all/deploy-mobicents/ Now you have to write a httpconnectorsbb-DU.bsh file and copy in to
server/server/all/deploy-mobicents/scripts/
Use the following sample bsh file and modify it for your service. Make sure you have the same name as your DU jar file name.
You may just have to modify these two variables. Add your sbb name, sbb vendor and the version mentioned in your sbb jar xml.
String thirdPCCTriggerURL = "${jboss.server.home.url}deploy-mobicents/ThirdPCCTrigger-DU.jar";
ServiceIDImpl serviceId = new ServiceIDImpl("se.jayway.sip.slee.service.ThirdPCCTrigger-service", "Jayway", "0.1");
Now start your mobicnets server and you will see your RAs and SBBs installed and activated there.
Coool !!!
Wednesday, November 28, 2007
Observer pattern using spring AOP
Visit here to have a look !
Friday, November 16, 2007
Pattern Oriented Frameworks - Need for the hour
What I really wanted is little different approach. The architect should do more than the design. Every chief architect of any company should bring a pattern oriented framework for their company. I doubt we can use the above mentioned java.net project or x-rad . Because if we use a common framework for this kind of things it will often bring confusions by the garbage stuffs in there. But you can use it as a reference and build your own model for your company. That will really help the RAD approach. How many times we have seen dev teams stuck in getting the basic things right ? Plenty. The main reason is that every engineer is reinventing the wheel all the time which would affect the team efficient heavily.
Think about Ruby. It has gone to it's hype (Yes hype ! ) after the arrival of Rails. See Grails for how easy to do a project there. You will spend no time to get the basic setup done, your designs done etc.
So you need a Grails like model for J2EE. You have a build.xml or maven to create the project. Create what ever model you want. I want a MVC setup with spring MVC, DAOs with hibernate, Mysql back end .. woof .. the build will do the rest. It will create the model with basic stuffs. So you only need to consider on your business domain, not the technical domain. Because you will have the reference implementations for your companies flavor already.
Yes it is pretty hard for a service provider, every time you need to changes your technologies, designs, models etc etc. But thats what the industry is all about. Like the maven ibiblio, have a framework ibiblio repository And every time you have a model in place, just do the prototype work and commit to your framework ibiblio repository
So the need for the hour is an architect (framework architect or infrastructure architect) who should design the prototypes with every patters a company use and maintain a ibibilio like repository in the company.
RAD will be RRRRAD then I am sure !
Wednesday, November 14, 2007
Mixed reviews on Google's Android
Recently Ruchith posted about Google phone and it's new SDK. Eventually the released happened and here is a little post on it.
After the initial delightment of the announcement on Android release, people seemed giving mixed reviews on it's Dalvik virtual machine. Impressed with the linux2.8 kernel , libraries and the application stack. But the eyebrows are raised when it comes to the runtime engine Dalvik.
When I saw that the Dalvik's limited support to standard java ( Ok Sun java !) , suddenly GWT came to my mind where GWT supports core java like java.lang , still it is a different JRE and compiler. But it is understandable for GWT as end of the day you create java scripts out of it.
But here Dalvik's attempts to become a standard for mobile devices. Of course we often have enough troubles and limitations with J2ME. So Google would want to have its own standard. But it will take a bit long while to be available and compatible in the market phones.
But IPhone is yet to arrive in Asian market and Google is planning to release its own model, it won't be too long Android dominating the arena.
And since Google's lack of intention to go along with Open JDK on this, I think slowly Google is moving to its own Google JDK. So be ready !!!
Good articles found on Info Q and oreillynet .
Tuesday, November 6, 2007
Google enters into mobile

Google takes a big step forward by moving into mobile and introducing Open Hanset Alliance(OHA) which includes 34 powerful companies such as Qualcomm, Motorola, Samsung, T-Mobile, Sprint, Skype, LG, HTC, KDDI, DoCoMo and China Mobile,etc. Goal of this alliance is to develop an open source operating system for mobile phones, in other words "an alternative to Symbian OS, Windows mobile and iPhone". (I'm sure Apple will think about opening their OS and Symbian too).
Google's mobile OS will be called "Android" (No "Google" word/logo attached at all .... how humble they are .... ) which is an open source OS built on Linux and Java.
Since this mobile OS is available for free of charge for OEM vendors, this will be a major hit for proprietary mobile OS vendors.
Further it will give more flexible environment for mobile application developers.
And I'm sure ......... this will lead to come up with some more mobile OS distro like in linux desktop.
Surprise ........... this Android SDK will be available from Nov 12th, and mobile phones will be available from mid of 2008 [Not sure how fast it going to come here , since it will be launched initially USA, Europe, Japan and China ].
I think this is a great news to mobile application development companies like us, it will eliminate some of the barrier currently we have because of the closeness of the mobile operating systems.
Finally.........mobile application developers are getting more flexibility and more open environment.
Sources :
image from http://www.dailytechrag.com
info from here
Monday, November 5, 2007
commons logging and log4j
Yesterday my friend Thayapavan was asking a related question on what's the different between log4j and commons-logging. Interestingly it was asked by a an interviewer which is clear now that people start thinking on why we use these two jars just because they are there !
First question is why we need commons logging? The idea of commons logging must have come from the concept that logging implementation is an integration feature, not a development feature. Developers use commons logging in their code without worrying of what the implementation is. It is the integration people to decide whether to use log4j, or jdk logger or any other proprietary ones.
So I think it is a development choice. You would not like to tie log4j in to your source in case you want to change it in future (example jdk one) . But I think 8 out of 10 times people wouldn't do it. And people who have tasted writing the Appenders and the other fancies what log4j has (specially after log4j 1.2) wouldn't even think of it ! So if you are comfortable using it then go for it instead wrap it with commons-logging. Or want be too smart and depend on integrators to decide then go for commons-logging !
Sunday, September 23, 2007
Google's code review
Friday, September 21, 2007
Robert Hanson on my million dollar Q
I think it is the question of how the existing technology meet our expectations and how good the new technology would help to improve our solutions. I think our temptation to learn new technology (Or on our thrill on use new technologies) often beats and we skip to answer those questions and just do it.
Any comments ?
Wednesday, September 19, 2007
Eric Evans' interview on InfoQ
He talks about the ubiquitous languages which have been used in such designs. The concern I have is, who is the right person to do such domain driven design. Is he the domain driven architect , project leader, tech lead or the pre sales person? And at which point this phase will fall in the process cycle? because we often have the communication gap on the domain driven design when it comes to the development life cycle. So we need to make sure the model and the ubiquitous language are properly conveyed through out the software life cycle.
Another important aspect I found is about on which areas of domain you have to model. Evans says, you should not model everything in the domain. It is very important to isolate the models and only focus on the complicated areas. Obviously overuse of DDD will probably affect the design as well as the business value.
Want to find more .. visit this interesting site on DDD
Thursday, September 13, 2007
Spring web services
Monday, September 10, 2007
Interview on SOA and Web services
Lasantha : Hi JK, would you spend some time on a interview with me.
JK : Me ? With you, oh no, you are a very dangerous guy !
Lasantha : That's all past JK, Now I moved in to interview about these more safer WS vs REST arguments !
JK : Oh god, You will find it more difficult than your political interviews man. Anyway go ahead.
Lasantha : People are arguing on WS-* vs REST , SOA vs ROA etc etc. What's your opinion on this.
JK : First of all Lasantha, I do not belong SOA republican party or ROA conservative party. I am non-aligned guy or rather I know neither of these technologies very much.
Lasantha : Thats ok, what do you think about the SOA and ROA?
JK : Well, SOA is an attempt to approach a design on a service oriented way. You define the services independently first and then provide a way to the designer on how these services can talk each other. Basically it is an evolution of traditional modular programming. But different is , you embed the service call inside the codes in the traditional distributed programming, where in SOA you treat them as services and provide the meta data about a service to another service instead calling it from source code.
Lasantha : What's the point doing it ?
JK : There is a point. First of all you see a business driven design (Is it a new term or an obvious one ? ). Designers will start looking the system in a services oriented way. So reusability will become easy and sensible I suppose. Atomic level of modularity becomes larger and the a service it self will become an application you can see.
Lasantha : Yes I see a point.
JK : There is another important point as well. Remember I told you, a service will offer a meta data of it, where another service can use the meta data to know how to talk with that service. So just think like if that meta data becomes a standard one then every body will start using it. The so called interoperability will become easy then.
Lasantha : Isn't it the CORBA or DCOM trying to archive ?
JK : You started asking your political questions now. Well I didn't tell you that CORBA is different from SOA. You see, SOA is a concept. CORBA or DCOM or web services are technologies which can be used to implement a SOA application.
Lasantha : So SOA is not web service then ?
JK : Correct, no way both can be same. In your terms, SOA is like communism and web service is like Marxism . But you know there are Leninism or Maoism where all these are trying to archive communism in different ways.
Lasantha : oh Ok .. So SOA is more of a methodology while web service is a kind of representation or rather implementation right ?
JK : Yes great.
Lasantha : Then why people confuse on web service and SOA are same.
JK : It is like how REST people forgot about the origin of REST. REST was there even before, but now only it becomes a buzz word. Like wise the SOA concept is there even before these CORBA and DCOM came, but now only it shapes up well with web services. And full credit to the companies who successfully faltered people for make them believing SOA and web service are same !
Lasantha : That means web service is not the sole representation of SOA ?
JK : It cannot be sole ... but it is the best option available for now. Something like 'Dravid is the best currently available option for Indian captaincy !, but of course not the best '
Lasantha : Why do you think so ?
JK : Because Ganguly has just come back in ! Just kidding. Ok get back to the point. This is one thing I am also looking for. I think web services adopt SOA really well. Probably when web service was introduced there must be a good understanding on SOA. So web services concept or rather specs might have developed with SOA in mind.
Lasantha : Can you describe more please ...
JK : The key success for the SOA is on how you define the contract. That is very important since here machines talks each other without any manual intervention. The contract specified in web services is more clear , understandable which is in XML. More over CORBA is a an object oriented model. The client server coupling is very tight opposed to the web service's loose coupling. The wire protocol is SOAP which is much easier to work with than the binary format in CORBA. And I see CORBA as an underlying technology as it doesn't address the SOA approach in a broad way. But web service is giving is a big picture and it is very easy to design a SOA flavored application using web service than the CORBA. I think these days these kind arguments are not raising much after WS-I drops the RPC concept in web services.
Lasantha : Why is that ... RPC is a good model though.
JK : Thats the thing. You need to come out from the object oriented model which CORBA posts. SOA is more to do with services not operations. Traditional web services used to create the web service methods and functions at the source code level and the transform them is WSDL. For example you write method called foo in a class and create the WSDL from that java class.
Lasantha : What's wrong with it ?
JK : Every thing is wrong. You have to focus on the contract first, Otherwise you will often change your contract when ever you change the server classes. The RPC feature in WS had this impact. People often looked at the RPC web service as a replacement of CORBA. And they forgot to think about the “service” orientation there. Otherwise you would fall in to the reverse engineering I suppose.
Lasantha : So you think the contract first is very important ?
JK : I think thats entry point for SOA. It's like you have to design first without worrying about the underlying implementation. And when it comes to interoperability, it is even more important. You have to define the contract of your service properly. You got to implement the WSDL. This is all about messaging and services not operations.
JK : Beside that web services adopts the www very well as how it's name suggests. I think thats where it stands tall. Its focus on security and trust like features go beyond what http provides. It tries to standardize these features very well. For example, you can sign a SOAP message and send in a much secure way than what standard HTTP promises. Most of the times http can be safe enough but there are situations when you need more that what http addresses.
Lasantha : I think, we need to discuss this in details and should bring ROA or rather REST in this conversation. We will continue soon
JK : Yes true. It would be better if we continue this with REST later. See u then bye.
Friday, September 7, 2007
My blog on Spring
Some of real life metaphors can be confusing or argued other way. But I just tried to use it.
Your comments are welcome.
Click here to read and discuss it.
Tuesday, August 28, 2007
TIOBE Programming Community Index for August 2007...
Seems Java is still leading.
Source : http://www.tiobe.com