Feeds:
Posts
Comments

Its been almost two weeks since we moved in to Sydney. I had planned to write here about every little adventure that we experience. Not that my plan have changed, its only that I have not been able to execute my plan so far. Well, no worries! (as they say here in Australia). I am gonna be regular as soon as I manage an Internet connection in this laptop, which is hopefully very soon.

We are in search of an accommodation now which apparently seems tougher to get than a job! God, where have we come! :-p

Sydney so far seemed very beautiful to me. The residential area has a calmness that just resembles a peaceful feeling while the tall towers in the city are so beautiful, you just can’t stop staring at them. I really really need to buy a camera! I have already been to few places where I wished if I had a camera. Anyways, no worries, I plan to buy one soon.

Thats it for now, gotta go, search apartments!

It is time

Things are getting wrapped up here. Bags are almost packed. I was given farewell from my current office today. For the first time in my life, I am about to make a journey beyond my country and it should be a long one. A kind of saddening emotion tries to grip in every now and then. Trying to keep myself busy to avoid those thoughts. This morning felt really sad while I was going through my old stuff at home. For the first time, among all these rush and running, I realized that I am actually leaving my home. Where I grew up, played, studied, ran around, sat hours on the computer. I will miss my family. I will miss my office desk where I spent most part of my last two and a half years.

Hey, sad thoughts are making their way in. Need a shake on the head to throw those away! Hopefully this is for the best. Hopefully things will turn out well. Hopefully our family will not miss us much. Hopefully this is all for the better.

It is time, for an ordinary Bangladeshi couple to make their way towards Sydney. How would things turn out for them there? To know, keep visiting this blog! :)

Good bye for now.

We’ll be back!

Last scrum!

I didn’t realize until I was told, today’s scrum was my last scrum at Therap! Since Sunday is the start of the week, we have a long scrum every Sunday. We all look forward to it every week. It has been told that no programmers actually start their work until they are done with this scrum! ;)

It was quite a moment for me when our scrum conductor, our team leader and guru informed everyone officially that this is my last week at Therap. He then went on to regard me as one of the top programmers of Therap. It was quite an honor to have receive such an acknowledgment from the ultimate boss. When I went on to thank him after the scrum, I couldn’t say what I really wanted to say – ” .. and I thought you never noticed me! How did I … when did I catch your attention?:)

I had to conduct some JMS experiment few days ago, wrote a simple command line application using Spring for that purpose. I was using Swiftmq 7.0.0 as the JMS provider. Although I took the help of Spring documentation for JMS, I still had hard time putting it all together the way I wanted. So here I am trying to put up a kick start guide to Spring JMS. For people who have just started learning JMS, I would recommend getting a good look at Sun’s documentation on JMS first.

Anyway, lets not waste time and dive into the configuration file of Spring. Here is what you need to do -

Define a JNDI template that other beans will be using for retrieving JNDI objects.
<bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">
<property name="environment">
<props>
<prop key="java.naming.provider.url">smqp://localhost:4001/timeout=10000</prop>
<prop key="java.naming.factory.initial">com.swiftmq.jndi.InitialContextFactoryImpl</prop>
</props>
</property>
</bean>

Create a connection factory. I used Topic instead of Queue for my experiment.

<bean id="connectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiTemplate" ref ="jndiTemplate"/>
<property name="jndiName" value="TopicConnectionFactory"/>
</bean>

Create a Spring specific JMS template that will be used for sending JMS messages. Note that we are providing connection factory and a destination to the template. Destination is the message destination which is in our case named ‘testtopic’.

<bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
<property name="connectionFactory" ref="connectionFactory"/>
<property name="defaultDestination" ref="destination"/>
<property name="pubSubDomain" value="true"/>
<property name="deliveryPersistent" value="true"/>
<property name="deliveryMode" value="2"/>
</bean>

<bean id="destination" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiTemplate" ref="jndiTemplate"/>
<property name="jndiName" value="testtopic"/>
</bean>

I create a MsgSender class and inject jmsTemplate and destination to it. This class simply sends a number of JMS messages to the provided destination using the template.

<bean id="sender" class="myexp.spring.MsgSender">
<property name="destination" ref="destination"/>
<property name="jmsTemplate" ref="jmsTemplate"/>
</bean>

After sending the messages, we need to receive it right? :) So here we are defining a Spring specific message listener container and providing a message listener to the container. For each message received, the onMessage method of the message listener will be called. In my experiment I simply printout the message in console.

<bean id="messageListener" class="myexp.spring.ExampleListener"/>

<bean id="jmsContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer">
<property name="connectionFactory" ref="connectionFactory"/>
<property name="destination" ref="destination"/>
<property name="messageListener" ref="messageListener"/>
<property name="sessionAcknowledgeModeName" value="AUTO_ACKNOWLEDGE"/>
</bean>

My message sender is simple, it sends Text Messages a number of times, like this -

jmsTemplate.send(destination, new MessageCreator() {
public Message createMessage(Session session) throws JMSException {
String msgText = "Message " + messageIndex;
System.out.println("Publishing - " + msgText);
Message message = session.createTextMessage(msgText);
message.setLongProperty("startTime", System.currentTimeMillis());
return message;
}
});

I an addition to a String message, I am also adding additional property into the message. The listener class must implement javax.jms.MessageListener and implement the following method -

public void onMessage(Message message) {
TextMessage msg = (TextMessage) message;
System.out.println("Reading - " + msg.getText());
}

That is pretty much it! In this simple example, we have configured Spring to send and receive JMS messages. This was a short and example driven post for configuring JMS in Spring. But to properly use it, I would recommend everyone to study the JMS documentation of Sun and Spring properly. In addition study the API docs of some of the classes such as AbstractMessageListenerContainer, JmsTemplate, MessageListener, Destination etc.

I am literally astonished to see the date of my last blog post. I have not written a blog for over a month and a half, time really is passing away pretty fast! My wife came back from Germany on 26th of last month and since then I have lost the habit of staying late at office (duh!). We have a Wedding Reception Ceremony to host on 26th of this month and all of us were pretty busy with it. It is really a huge task – the food selection, guest list, invitations, shopping are just quite a few to name. On top of these, we have to plan our migration process to Sydney. Although among all these, we have managed to have a trip to Saint Martin’s Island recently. It was a group trip organized by our office. As always, we have thoroughly enjoyed the company of sand and water!

Sorry for the hurried post but gotta run now! :)

I have been coding a lot in Flex Builder for the past couple of days. I have left the server side alone for a while and designing the client end now. Flex Builder saves a lot of time even when you are not using the drag and drop GUI builder. Have learned quite a few interesting things about Actions script during this period. Most notable of them are perhaps these two – Closure and Dynamic class. With closure, you can pass a method as an argument to another method and with dynamic class, well you can add properties to that class at runtime! I am hoping I will be able to utilize this dynamic nature into good use. Some of my other resent findings are -

  • The tags inside the mxml file can implement an Interface. While this is natural since a tag always refers to a class, at first I found it really interesting.
  • There is a nice flash debugger plugin that lets you debug your code.
  • To override a method, you have to mention override keyword in the method definition.
  • Setter getter methods – you write function set methodName() or function get methodName() to define setter and getter methods That was really new to me! :)

I found the Action script reference PDF really useful for learning the bits and pieces of Action script. However I am having real difficulty in adjusting to some of the syntaxes, specially while declaring a variable. I keep on doing it using the Java way and the compiler keeps on reminding me! :)

Thats it for today, hopefully more will come soon..

Step two in Flex

Yet another busy day with Flex. Started the day with the intention of concentrating full time in Flex and still it wasn’t until 8 PM that I did what I wanted to do! Nevertheless, at least I have achieved my target before going home for the weekend. :)

After my successful integration of BlazeDS with our Spring application, this time I tried to go further. Wanted to fetch live data from database and show them in Flex data grid. First I created an action script object equivalent to my Java Object and tried to access its properties in data grid. I learnt that data grid accesses properties directly, not using getter methods, so had to change my class properties to public. I have to study action script further to find out if its really the convention.

Anyway, then I remembered, since I am using action script object from my mxml file, I will have to tell the compiler about the class when I compile it using Ant. After a lot of hassle, turns out ant tasks that adobe provides are for Flex 2 and the command parameters mentioned in the document for mxmlc doesn’t work with ant tasks! To be sure, I ran the mxmlc command manually and it worked. So now I replace the ant task for compiling with this -

<target name=”compileflex”>
<exec command=”${FLEX_HOME}/bin/mxmlc
${web.dir}/mxml/main.mxml
-source-path ${web.dir}/flexsrc
-services ${web.dir}/WEB-INF/flex/services-config.xml
-context-root /ma
-output ${build.dir}/main.swf”>
</exec>
</target>

This ant target executes the mxmlc command directly with the necessary parameters. Before reaching at this point though, I had to fight through Spring+Hibernate issues in my Dao class. The new Dao class I created couldn’t get hibernate session and had to replaced it with Spring’s jdbc template. Most probably the hibernate issue was related to OpenSessionInViewInterceptor, I will investigate it later. For now, I am really relieved and happy to see my data grid getting filled with data from server. :)

7w6ipsi.jpg

8fx4gif.jpg

6uhs61d.jpg

721foqr.jpg

6tneahh.jpg

86ewx77.jpg

6z6hy50.jpg
6kk4y2v.jpg

81hhdfs.jpg

834vtp5.jpg

Just finished configuring BlazeDS with Spring! :)

We have been thinking to include Flex in our J2EE application for a few months now. We believe integrating Flex as a client end application will vastly improve user experience and also improve on the code separation if we can design properly. BlazeDS is a server-based Java remoting and web messaging technology that enables developers to easily connect to back-end distributed data and push data in real-time to Flex applications. Both BlazeDS and Flex are open source products from Adobe.

After running the samples provided with BlazeDS download, I decided to have a go at it by trying to integrate it with Spring. Unfortunately I could not find any straight forward tutorial that could have guided me step by step. The closest I got was this tutorial that talks about integration of Spring with Adobe LiveCycle Data Service. Although I had to customize in few places, the tutorial was really helpful for my purpose.

BlazeDS download comes with a configured tomcat ready to run, which is pretty cool by the way! :) Anyway, I chose to integrate Spring in the already deployed blazeds application under {blazeds}/tomcat/webapps. I followed all the steps of Example 1 in that tutorial considering my context root is {blazeds}/tomcat/webapps/blazeds. For example, when it asked me to copy jar files of Spring, I copied them to {blazeds}/tomcat/webapps/blazeds/WEB-INF/lib directory.

When it was time to run the application, as mentioned in Step 4, that didn’t work. The step asks to directly invoke the mxml file and assumes the Data Services application will compile it. I don’t think BlazeDS was configured for that feature yet. Therefore I had to take the help of Flex Builder 3 to compile the mxml file. I took the help of this tutorial to configure and create a J2EE project in Flex Builder. I followed all the 14 steps mentioned at the bottom of the page to create the project. I had to start my tomcat server to successfully validate the project configuration. Once that was done, rest was a piece of cake! The run button in Flex Builder automatically deploys the compiled swf file and opens it in browser.

Once my initial experiment was successful, I decided to create a formal project where I can work and use Ant to build and deploy my work. This is where things started to get rough! More on that later. So my first task was to write an Ant script that would deploy the necessary files in web server so that BlazeDS is deployed along with my project. I took the help of this nice and simple page to quickly get started with Ant. Then I had to install and configure Flex Ant Tasks and use it inside my build.xml to compile the mxml files. Once my script was ready, I thought I was done. But alas! the application was not working anymore. Remoting from my swf failed, it could not connect to the Spring service bean. After couple of hours of hair pulling time, I finally figured that the only difference between my current work and previous work (which ran successfully) is the compiled swf. Since we have to show the data service while creating a data service project, the Flex Builder must be doing something while compiling that my simple compile command was not doing. Once the problem was found, I looked into the compile command (mxmlc) in detail and found that I had to add -services and -context-root parameters to my mxmlc command. -services points to the services-config.xml file while context-root is the name of the context root, in my case – /blazeds. Then I used another build in ant task named html-wrapper that creates an html file for the corresponding swf, which makes it easier to view when deployed in web server. My Ant tasks now looks like this -

<target name=”compileflex”>
<mxmlc
file=”${web.dir}/mxml/main.mxml”
output=”${build.dir}/main.swf”
services=”${web.dir}/WEB-INF/flex/services-config.xml”
context-root=”/blazeds”
keep-generated-actionscript=”true”>
</mxmlc>
</target>

<target name=”wrapper” depends=”compileflex”>
<html-wrapper
title=”Welcome to My Flex App”
height=”300″
width=”400″
bgcolor=”red”
application=”app”
swf=”main”
version-major=”9″
version-minor=”0″
version-revision=”0″
history=”true”
template=”express-installation”
output=”${build.dir}”/>
</target>

Flex is cool to work with and I can’t wait to dive in deeper! Next stop is to find out how BlazeDS handles authentication and how can I get access to HttpSession.

After a long time, my dzone rss finally got me a cool article. It was titled as Ten things that will change your future. The title was catchy enough to follow the link and start reading it. The article is really nicely written and although I am not sure about the future but I certainly got to know a lot about the various services web is providing now-a-days. But the most interesting of all to me was this website called 23AndMe. The website read -

With the tagline “genetics just got personal”, 23AndMe allows anyone to unlock their own genetic history – and likely future. For $US1000 the service (named after the 23 pairs of human chromosomes) will reveal whether you have a predisposition to arthritis or Alzheimer’s or, more frivolously, why you can’t stand tomatoes.

Wo wo! why I can’t stand tomatoes? Is it really my gene, not me, who dislikes this beautiful fruit? And I am not the only one, there are others like me? (A line you will constantly hear in heroes!) Cool! :D

23AndMe customers provide a sample of saliva from which technicians extract the DNA for analysis. When the results are in, customers are given a secure login that allows them to explore their own genome at their leisure, revealing their genetic “family” around the world as well as their likely future health.

I first heard about this genetic family tracing in the Operah prime time. In one show the lead actor of the movie Last king of Scotland was there and he mentioned that he had gone through this DNA test and found his origin is from Nigeria (I think). Although the idea seemed interesting to me, I couldn’t understand how it was possible to trace back generation like that. Well 23AndMe seems to be providing this service and they also have some nice tutorials on how these chromosome and nucleus stuff works. Maybe someday I will do the test .. I wonder how far they can trace back.

« Newer Posts - Older Posts »