Thursday, March 27, 2008

AIR for the mind

These days its a steep learning curve of me. I have been fiddling around with Adobe AIR for some time now and I'll say every second of it has been great. Manish has been insisting that I document the things I have done. But I find it better to do than to document. Of course in that case what you know is bottled and not useful to others. I'll try to jot down the stuff (though very little) that I understand after 3 weeks of AIR.

The reason why I looked at Adobe AIR was for Workstreamr. The first thing that I found was documentation provided by Adobe. These livedocs were extremely helpful. I installed the runtime environment from Adobe and then the sdk. Before looking at the sdk I saw an Eclipse based IDE called Flex Builder provided by Adobe. I downloaded this and started my work on this.

There are 3 ways you could make an Adobe AIR app. Using HTML/Javascript, Flex or Flash. I was always interested in Actionscript and thats why I tried out Flex Developer. Here it is required that you write xml file which will be converted into Actionscripts (swf files at last) and will be run by AIR. The xml file creation for this was greatly simplified by Flex builder but I had to learn some Actionscript within a short frame of time. I fiddled wit hthis for some time after which I decided to go and check out the HTML/Javascript based approach. Aptana was used here as it had a great support for building AIR apps.

It took me less time to get used to all the nifty stuff that AIR had provided to make the HTML based approach work. The base is just an Html file which includes a main Javascript file called AIRAliases. It contains all the aliases that you need to access the Runtime Environment. The AIRIntrospector Javascript file is another thing that is required for debugging purposes. When the app is running press F11 and you will see the Introspector pop up.

Now comes the UI based stuff. I loved what Snitter, Twhirl, Spaz and Pownce had done with their AIR applications. The shadows and stuff. In Flex this was easy. Just create a shadow object and give that to the main window. For the Html part this was done making use of a semi transparent image ( dot fading out ) being repeated through out a div with a large border. I had done most of my work using the prototype and scriptaculous libraries, so I chose them as the main Javascript libraries for the AIR app too. The other options include EXT, Jquery, Spry, MochiKit etc.

The documentation for the various methods that AIR has was taken as a reference. Some of the stuff like Effect queuing did not work for me using Scriptaculous. I am also told that JQuery is the most used library for the HTML based development. I'll probably shift to JQuery once I get a feel of it. [:)] .

The notifications is another thing that I was trying to do. Those small notifications that come up on the right bottom of your screen when ever someone messages you. It took me sometime to find out that this 'purr' was indeed an Actionscript that is included with the main Html file in snitter as well as Spaz. I decompiled this swf file ( sorry but I had to) and looked inside the code, managed to find the notifier, the notifier queue and the actual 'purr'. The color theme must be changed, so Ill have to hack the whole code (I think).

The Javascript that is made has been done with Object Orientation in mind. The Html / Javascript and CSS are decoupled. Another aspect I like about doing this in Html is that a single change of CSS changed the UI completely. Talk of decoupled UI and Functionality.

Still working on this and hope it will end good. I would like to thank all these apps made in Adobe AIR which I took as reference (both the Html ones and the Swf ones I managed to hack).

Tuesday, March 25, 2008

Workstreamflow

This one is all about the perspective changing project that I am currently a part of. Workstreamr .The work done in this application has been tremendous. Though I am not in the development team for this project, I have done tit bits for it and I feel I have accomplished more than I ever thought of accomplishing.

The project is an entire shift of the thought process that a normal person undergoes. The original idea conceivers, Stowe, Ben and Sam, had a great thought in mind. To give the users the power to manage , maintain and view data. A truly Open Source oriented concept with Web 2.0 backup. The data has been categorized into groups so that the users could distinguish and relate. The data flows as streams of information and the user has the power to choose to view, respond or ignore.

The feature that I find very intriguing is 'the handing over the power to the user'. Many applications that is web oriented don' do that. They have a fixed way of doing things and the users are happy with it. This lets the users be dumb (like those early days of internet). A wiki based structure with collaboration and information passing is the core 'funda' of this application.

Time based. This is a great shift in perception. The information you see is time based. It shows up taking into consideration the time factor.. It does not have a state maintained. 'Backtracking becomes tricky here and tedious' is a statement that would come into ones mind after this. Versioning is a great system that is used by many Web2.0 based systems to handle this. The change triggers a version which could be backtracked and changes reviewed. The Configuration Management Systems work in this fashion and they work perfectly fine.

Extensibility is another thing I like. How could you be happy with a product which you can't play around with ? (emm ... Windows ? ) . And all platforms are not like the OS-X anyway ! This application lets you fool around with it. I guess the users will love that.

Grouping of data has been a core factor of all databases. Think of a world where you cant correlate or group data. You can't bundle stuff together. That makes a very unrelated series of events which is useless and odd. This grouping is another characteristic that makes this application stand apart from any other one.

Filters. Again a database oriented concept but a general computer science one. Why would I see unwanted information again ? I would rather see filtered information than see all information, even irrelevant ones. If I have a filter already , it is very likely that I will use it again. So I'll store the filter and share them (Web 2.0 comes in again) so that other people with similar tastes could use it.

User management is a main ingredient in any project management system. Assigning, Owning, Tracking Progress are all factors that a Manager would like to do in his Project Management Tool. Versioning also comes into picture here as the application is intended to be stateless.

The Open API is the last thing I would like to write about. In the modern world, a high end graphically excellent functionally proficient web application is doomed if it does not expose a public api for the users to fiddle with. This a part of passing the power on to the user. Workstreamr has this factor in mind and exposes an API which is simple to use. A client will also be created in Adobe AIR ( and that where I come in ) which will let the users request and respond to their data which comes as streams of information.

The first cut will be out in some time but until then it all wait and watch.

Sunday, March 23, 2008

The Motorcycle Diaries

'Before he changed the world the world changed him' - The Motorcycle Diaries

Before the last Friday, I thought this week was going wasted. But a sudden impulse to explore and enjoy changed it all. I was planning on doing some work on my MAC when Sam came home after his church visit. If was Friday afternoon and was hot. He asked me whether I wanted to come for a short trip. There were a set of guys and they were going to travel on bikes. This first seemed to me like a bad idea but something made me go. There were 9 guys including me. We had not decided where to go up until 11 pm after a couple of beers. 'Mukteshwar' said Shyam and we conceded. Shyam knew the place and we believed that he would deliver.

We started at about 12:30 am, Saturday (midnight). I had a 3 hour sleep prior to it so was in a good shape to drive. The distance we had to travel was a tall 360 odd kilometers. It was not easy task. The roads were supposedly dirty, rough and BAD. Sam and MC had pulsars, I brought Gitesh's Victor, Shyam had an Apache and we got a CT 100 from Moi's friend. The first 150 kms were daunting. None of us had traveled this must at one stretch. We stopped at 2 dhabas after 50 kilometers each at first. Had tea and some rest. The road was work in progress and we had to take it easy for a while. But after reaching Moradabad, it felt like heaven. The straightest stretch of road I have seen, decorated with luscious trees and crops on both sides. With the exception of a sugar factory which dumped waste materials into a small puddle, the place was awesome. We were constantly maintaining a 80-90 km/hour rate during those rides.

I started out with the Victor but after hundred kms, Roshith wanted to try his hand with the Victor. I then was the passenger for Shyam on his Apache. Roshi developed a liking for the bike after that ride. It was Saturday morning when we were traveling through Moradabad. It was also Holi and there people were scarce to see on the roads and sides. This was to change pretty fast though.

We reached the notorious place called Rampur after that. We saw a mob carrying colors in their hands and tin cans of some kind. MC went first and was scarcely attacked. Sam followed MC followed by Shyam and Shiju. Sam stopped before the mob and then Moi stepped down the vehicle. Shyam also stopped on seeing a Toyota Innova being sprayed on and I was quick to get down and follow Moi. Sam was surrounded by the mob who literally bathed him with colors. Moi and I were spared as the mob seemed to be into cars and bikes. Shyam was the next to get ploughed. Shiju did the right thing by just accelerated and breaking through the crowd. It seems that there were religious tensions surrounding that place and the mob was retaliating to that. The victims were the poor drivers and their vehicles anyway.

After this we reached a place called Haldwani. MC had to have some petrol filled up. It was Holi and not bunks were open. He had a stroll on his bike for a bunk only to return with a flat tire. We saw a small mob forming who were constantly watched us 'Clean People'. The search for a mechanic was going in vain untol we got hold of someone who fixed the puncture. Even after the warning from the police about the mob, we decided to start our ascent. We came across drunken people who even tried to stand in front of the bikes.

The 70+ kms of treacherous twists and turns where awesome. As a person, to see something conserved with all its might and to explore such a thing is a great feat. After a 14 hour journey through bad/ good roads, mob attacks, cold winds, twists and turns we reached our destination. A mesmirising 7513 feet above the sea level. Calm and serene. The resort was excellent. The hospitality was great, the owners were courteous. The guy was a Merchant Navy Ex. The mountains covered the vast horizon. We were unable to see the 180 degree view of the Himalayas because of the dense mist that engulfed it. The rooms resembled the artistics of a small French cabin.

It was 2:30 and food was served. Had a good vegetarian meal and went to bad almost immediately. The night was filled with stories. We had whiskey but most of us were too ploughed to even drink. We slept at about 12 after the riot of laughter caused by the stories deteriorated. We woke up at about 8 in the morning, had our breakfast and started our descent at about 10.

We decided to take a detour and goto Nainital and spend some time there. A small lake was past when we came up called BheemTal by our diversion stopped us from spending some time there. The route that we followed on the way down had a great road. The traffic was a bit more, as it was a standard route, but the way we co-ordinated, one guy going in the front with the passenger giving signal about oncoming vehicles to the followers, was great. We reached Nainital, took some photos, looked at the babes and headed off. The way onwards was through the Corbett Park. The scenic beauty just takes the breath away. Forest on your left and right and a straight road piercing the jungle was a treat to the eyes. We then reached Moradabad again and took up speeds at about 90 km/hour. Even Roshi with the Victor managed to keep up with the Pulsars and Apaches.

We had to face a violent mob once again in Rampur, but this time we took a side route to avoid them. We took the Delhi - Lucknow bypass and tested the bikes once again by flaunting with speeds in the range of 90 -100 km/hour. It was dim when we reached the bad raods enroute to Delhi. After after a heavy dinner from a Dhabha , we reached Noida. This is where I stayed allowing the rest of the gang to continue to Delhi. I dropped 'X' off his home, came back to teh flat had a bath, slept and came back to the office.

My eyes are swollen and red as I write this. But it was worth it. The only thing I regret is the fact that I did not take my Camera. The pics and Videos below are from my Nokia. Many more pics are available here.















Friday, March 14, 2008

Hectic Schedule

The last 2 days just took the juice from me. After the Workstreamr 0.1 iteration, the focus was towards getting the initial page in html just right. I am a great believer in doing things accurately the first time around so that even if there are changes we would have to do a lot of them. The usage of only divs as the components were one of them. And Joydeep found it very hard to design the html in that way. We fixed a lot of issues, including the floating divs, the problems with the 'IE' engine. And the result looks great. It has all the ingredients which makes a great web application.

The developers in Workstreamr have also done a great job. To look at a working product, even though it has not finished, is a great sight. The processes followed, which by the way I never followed before, is great. Its a little tedious, but worth the time. I still have to get used to logging my work !! Javascript is the core area in this project and I feel the Object Oriented aspects of Javascript should be implemented more consistently.

But the new role, even if the 'official role' does not change works great for me. I like to visualize stuff and thats what I am doing here. Suggesting ideas, listening to new stuff and trying to implement them. For me it doesn't matter if I log work because I develop anyway and the people I talk to know what I am about.

We had a pizza party today and reflected on the great things that happened. Appreciated all the team members, from HR to me. I consider that this is a very important thing to do. This boosts the morale of the team members. More over it generates the feeling of oneness.

The next week would also be pretty hectic as the html has to go in for integration along with other stuff. The rest of the html must be implemented. Javascript must be written. I dont know how Abhijat, Abhilash and Rohan do it !! Kudos to them.

Monday, March 10, 2008

Reflection

'I' is the most used word. This is all about 'I'.

Its all about knowing who you are and what you are capable of doing. Thats what one must understand when one works in a place that demands results with in a short duration of time. Some times one gets away with a bad decision but not to go unnoticed.

I consider to be very bad with decisions. I like guidance, to be the follower rather than the leader. I give views but don't try to force them (or rather I have stopped forcing). I think to give the other a taste of what I feel is more important. A pessimist by nature, I like to expect the worst, therefore success is very heart warming and enjoyable for me. Thats my nature, I cant change it. And I stick with it (For hopefully the worst !!).

I have complexes. Major ones. Not a looking guy is one of them. I find it important to have a open face when sharing an idea. This is one complex I cant do away with.

I love the movies. I love to direct. I have made some short movies during my college days and I love them all. The art of cinema intrigues me. The art of making people listen, laugh, think, cry using a medium as strong as cinema is mind blowing. I also like stories which are told from different angles (perspectives). How does the character come to become who he is ? Why does he act to the situation like this ? I agree to Tarantino's quote 'I make movies I like' because if one is good enough, he would make movies thats universally liked. My IMDB account and stuff are shown in the sidebar.

I like to spend time with friends. I think of myself as a listener and dislike being ignored. I let it go like all the others but theres a limit to my endurance. A short tempered guy by nature, I like to left alone when in desperation. I get very gloomy at those times and feel not worth it.

I constantly get the feeling that I am being disliked. Acknowledgment is not a necessity for me but once a while that help to boost the confidence ( the very little amount). I love my working atmosphere and thrive for isolation once a while (esp. at work). I don't like to be bugged when doing important things ( generally everyone cames at the apt time).

I love music and A.R Rehman. I like english classics too but I am more into my lingo. Mallu songs really rule. I consider Yesudas and Chitra to be the best singers in the world.
I consider Mammootty to be one of the best actors of all time.

And remember, no matter where you go, there you are. ~Confucius

Tuesday, March 4, 2008

Alternate Comet Ruby On Rails

I happened to have a talk about the previous post to Raja. The implementation had its own problems and changes.

Firstly : The Service Layer of the app, the part which communicates with the queue, must be separated from the controller. We don't want the controller to have a heavy load. The service layer will not know the part of the application that communicates with it and the controller will not know who its contacts. This ensures that even if the service layer has implementation changes, it will not affect the controller thus making it entirely a different entity. I guess this kind of distinction will only come with age and experience. The Facade Pattern is the base.

Secondly: The application is better off with cache implementations. Mainly because the queues are designed to serve a purpose. Communication between apps. The Cache will also be maintained by a service layer and the access via the controller will either be fetched from the cache or if expired from the database. To have a uniformity between the kind of platforms accessing the application (say Adobe AIR and the browser accessing the Mongrel server), we could have an identifying parameter parameter passed along with the url which tells the controller the type of client and the resultant format of output (say XML/ JSON/RHTML).

I feel I have lifted myself a step now !! Thanks Raja .

Monday, March 3, 2008

Comet Ruby On Rails

The stuff that we do in the company is quite cool. It lets me, personally, to go through many technologies and implement many ideas. Concepts in theory is not great unless you start to implement those. A new thing that we are trying to accomplish is the functionality that a Comet Server gives, an HTTP push. This must be implemented in Ruby On Rails. Now the point here is that as HTTP is a connectionless protocol, we cannot pass stuff from the server to the client (unless the client requests). To have this functionality, we must either do a polling technique, where in the client constantly accesses the server for information or a live connection (may be a flash connection). Now another techniques which goes against this HTTP connectionless concept is the one that Comet deals with. A long lasting HTTP connection, either streaming or long.

Juggernaut is a Ruby On Rails plug-in which has this kind of functionality. It uses a flash open socket connection to get this server side push. Now this is great but the main problem that I felt is the firewall problem. Most of the firewalls do allows connections from other ports to go through them. Juggernaut also say that we could connect through the 443 port (http ssl) and that would solve the firewall issue. For a general need this is great.

My requirement was a little specific and I needed more stuff to get this stuff working. That was when I got to see the Active Messaging plug-in that Ruby On Rails had. A plug-in which could take in data from an Event Driven Architecture based product (say Queue / Messaging) and consume results in a Provider/ Subscriber model. The application also needed a lot of database optimization ( it will have to survive a lot of select statements). So an intermediated queue is perfect.

This is what it might look like.






















The only problem that I am facing is that by default the Active MQ is supposed to be a first Come First Serve queue. Now this does not serve my purpose as there might be many clients subscribing to the out queue. What I need is durable subscribers and that problem has been addressed in their thread.

This is a great way of accessing data (messages) as it is inherently the publisher/subscriber pattern (which I need) and the interoperability between different application could also be possible (a flex app accessing not HTTP information ?). Load balancing could also be done on queues !!