Hello and Welcome to Sugar Mountain!

....a place of random thoughts

Shorten URL in Flex using bit.ly

Filed Under (Coding) by Olle on 02-08-2009

I have been starting to plan for my next project to come, and felt the need for a function that would use the bit.ly API to shorten URLs for me.
I found a nice Python example over at http://tux-log.blogspot.com, but was not possible to find any AS3 examples. So I spent the evening making my own.

Hope you like it, it’s way from perfect so please feel free to comment!

/**

* Class ShortenURL

* Author: Olle Dahlstrom(olle.dahlstrom@gmail.com)

* Takes a URL and calls the bit.ly API to shorten it.

* You need to have a bit.ly username and API Key(get it at http://bit.ly/), I have my stored in a Config class file.

*

* Example Code

* import net.subelement17.ShortenURL

* var _url:ShortenURL = new ShortenURL();

* _url.call('http://subelement17.net/blog', giveMeTheUrl);

* function giveMeTheUrl(res:String):void)

* {

*    //do something with the result....

* }

*/

package net.subelement17

{

import mx.rpc.events.ResultEvent;

import mx.rpc.http.HTTPService;

public class ShortenURL

{

private var apiKey:String = new Config().bitly_APIKKEY;

private var userName:String = new Config().bitly_USERNAME;

private var apiVersion:String = new Config().bitly_APIVERSION;

public var longURL:String = ''

private var resultReturn:Function;

public function ShortenURL(){}

public function call(URL:String,resultHandler:Function):void

{

resultReturn = resultHandler;

longURL = URL;

var htService:HTTPService = new HTTPService();

htService.method = 'GET';

htService.resultFormat = 'array';

htService.url = 'http://api.bit.ly/shorten';

var params:Object = new Object();

params.longUrl = URL;

params.login = userName;

params.apiKey = apiKey;

params.version = apiVersion;

params.format = 'xml';

htService.addEventListener(ResultEvent.RESULT,resutlHander);

htService.send(params);

}

private function resutlHander(resultEV:ResultEvent):String

{

var shortXML:XML = new XML(resultEV.message.body);

if(shortXML.child("errorCode").toString() == 0)

{

return resultReturn(shortXML.child("results").child('nodeKeyVal').child("shortUrl").toString());

}

else

return resultReturn(longURL);

}

}

}

The Bangalore Report – Day 3

Filed Under (Projectplace, Social) by Olle on 27-05-2009

Wednesday
The plan today was to have a bit of a slow day, focusing on unit-tests, some Javascript sessions and such.. But (as usual it seems) things did not turn out as planned.

We started the day with the morning stand-up meeting. We quickly handled the issues at hand between all of use(well except me since I’m the boss) and got started fixing the stuff found by UxD late yesterday afternoon swedish time.
We had our goal set to finish all the reported issues before the Stockholm stand-up meeting, but some of the issues took time, so we did not reach our goal.
During the meeting with Stockholm the scrum master was screaming more then ever, maybe she wanted to make point. I don’t think so, she has a good sense of humor, so no worries.

Well after that I started to go through a lot of bugs that are prioritized for the next spring by Mr Irish. Me, Mr UxD and the loud Scrum Master will have a chat regarding my conclusions tomorrow. Hopefully Bangalore Earth Hour will not happen during our meeting.
As I tweeted previously today, Jayesh is spot on with his skepticism regarding Earth Hour that toke place on the 28th of March. In Bangalore Earth Hour happens several times a day automatically… Luckily Blue Star has filled the basement with batteries that kick in, so Internet never goes down. I wonder what happens with the elevator, since the light go down? Shit, I need to remember to take the stairs tomorrow!

Durring the day our beloved boss sent approximately 15 mail regarding a failing in-development feature and kick-started Rams sweeting. We will handle the issue next week when Ram can have a partner in Mr New York(samcyp).

Me and Ram went for a late lunch around 2 PM, since he just needed five minutes more for about two hours, at the same restaurant as yesterdays dinner and lunch. But what the heck, it dame good food.

During lunch me and Ram also went to Total, a big shopping mall near by the office. I found some nice clothes for the kids. On the way to Total Ram asked me what I thought was the best and worst thing in India. The worst thing is easy I said, the contrast between those who have(and they seem to have a lot) and those who has none is really striking. The best thing would probably be meeting Ram and the rest of the crew, and of cause the food.

After lunch I got a mail from Mr UxD asking if I had started investigating the feature I had promised to do until monday. He thought that it was a good thing for me to start with tonight, since it would prevent me from falling asleep until CL final tonight. I know it was a joke so no harm taken:) But this brings a thought to mind, if possibly anyone who reads this blog is living at Nandhan Grand in Bangalore and could tell me what channel the game is on. All I can find are programs with 15.000 people dancing and singing.. It’s really strange, but true! It’s like all channels are directly liked to Bollywood!

After work me and Ram walked over to the Forum, and got some more stuff for the kids back home. On the way to the Forum I say the most stressful job in the world, a traffic cop in Bangalore. He was sitting in some cage and was occasionally screaming at some Auto-richa who was on the verge of going the wrong way one a one way street at rush hour. He once tried to hand out a fine but the Auto-richa driver got away.

At 9PM I had dinner at the Hotel, shiploads(as the spellcheck want’s it to be) of rice, chicken and naan. During dinner I watched the Zoom channel in hindi. Since I say a picture of Paris Hilton every five seconds, I knew I wasn’t missing much.

Tomorrow is the last day for me here in Bangalore, it’s true that time flies when you are having fun. Since this is my fourth trip to Bangalore one might imagine that I would get used to the traffic, the noise and the massive amount of people, but I think I never will.
But the week before I went down here, I finally figured out what is so special about Bangalore at night, it’s the darkness. Bangalore is a city of 5 million people (according to wikipedia) but is still really really dark. It’s just the main streets that have light, the rest is dark.

And now it’s 11:55PM 00:10 AM, and the game is soon to start. But Star Sports, which will be airing the game tonight, I think, is still showing tennis!

The Bangalore Report – Day 2

Filed Under (Projectplace, Social) by Olle on 26-05-2009

Tuesday

Today nothing really exciting happened, I woke up and went to the office. Unfortunately I had forgotten the AC on all night, so I was freezing cold when I woke up. Luckily freezing can easily be fixed here in India, step outside for two minutes and your fine.

At the office we started the day with the daily stand-up meeting, after that we started fixing the issues found by UxD(two still to be nailed tomorrow). Me, Ganesh and Kashif fixed some easy bugs after the stand-up meeting.

At 12:30 it was time for the Stockholm “morning” stand-up meetings. It’s kind of fun to take part in meetings with Stockholm from down here. I will not name any names, but the Scrum Master in Stockholm really screams during the meetings whenever she talks to us. Luckily everyone knows she is not upset but is compensating for the distance.

I participated in the sprint follow up of the April sprint with Stockholm, unfortunately Internet was behaving badly. Rumors has it that some router was killed apparently(possibly nevdull77 testing something?!)
While I was in the meeting, Ram was kind enough to pick up some food for me. All I can say is that it’s lucky that I do not live here in India, it was a massive amount of food(and hot as usual). I would look like a big red balloon after a couple of months!(Music tip: Black balloon by Monster Magnet )

In the afternoon we did some ruff estimations of coming projects in the June sprint, as well as we had a little meeting regarding testing of our own code and quality contra quantity, it was good. Quality still rules!

During the whole day I have been trying to get some time to prepare the Javascript Event Chain/Namespaces session we have planned for tomorrow, but have not really succeeded. But what the heck, how hard can it be. I’ll shoot from the hip on this one.

For the evening we had planned to leave the office at 7pm, to celebrate the Bangalore Star-of-the-Sprint. But due to reasons out of our hands, bug fixing, mailing an such, we left at around 8pm. We went to a nice restaurant close by the office where JoJo handed out the “voting cards” with a company logo and all. The focus for the Star-of-the-Sprint is to find the person who have been living the core values best for the past three-four weeks. The victory went to Adarsh, with Appa as a close runner up and Durgesh taking the bronze medal! Congratulations all of you! The prize Adarsh won was a lovely little silver star, it looks great!
Unfortunately JoJo forgot to say that is was not allowed to vote for yourself, but luckily Ram only got one vote.

The food was great and somehow the conversation always seemed to end up around the things Jon ate when he was down here in Bangalore. Jon, I tell you, the Bangers are really impressed. I’ve heard stories about how chilies being eaten and more, and they say “that you boldly went where no mans gone before in the wilderness of food”! They also say that Jalle is more like me, a bit more sensitive. I think what they mean is, a bit more sweaty.

Today I learnt that there is a real Ramesh around, and not only our own. Ramesh apparently works for Blue Star in Bangalore. Unfortunately he’s in the hospital right now because a big tree outside the office fell on him during some heavy rains some time back. How much bad luck can a guy have, we hope that his broken legs heal soon.

After the dinner Ram and Durgesh took me home in Rams new car. A great thing that has happened since my last visit is that Ram now has removed the plastic covers from the seats! I like Ram car, its great. Or it’s probably like this, I like to ride in Rams new car much more then behind him on his scooter. I don’t have a death wish you know :-)

The Bangalore Report – Day 1

Filed Under (Projectplace, Social) by Olle on 26-05-2009

It was really close that I did not continue with the Bangalore reporting thing, but why stop a loved tradition :-), so here we go

Sunday

The trip started out really bad, I stood in the wrong check in line for 30minutes at Arlanda, and I hate that. Me, I’m a guy how likes to have control, if I stand in the wrong line that’s an evidence of me not having control.. Puts me in a bad mood one could say. And for christ sake, it’s 04:30 in the morning.

Question: Is Sweden on leave or something? At 4:30 Arlanda looked like Bangalore, people all over, I promise. It was insane.

I eventually ended up in Frankfurt, and Frankfurt is Frankfurt.. ..Dark and grey, no fun at all.
But I did the good thing of the day in Frankfurt; I helped a small young guy, possibly 13years old, find his way to the Bangalore flight. He was a Swedish consultant working for Cap Gemini going down to Bangalore to attend some 2 week course. Apparently Cap Gemini has 20k developers working in India. But back to the good thing, he tagged along with me through Frankfurt Airport, this of cause due to that I’m such an experienced traveler and a real business man. I even waited for him when he went to the toilet. Even on the flight to Frankfurt I had noticed that this guy kept running back and forth to the toilet, and he later explained to me that he was afraid of flying, and of cause that was the cause of all the visit to the toilet. I told him, “you will have no problems on the flight to Bangalore, it’s a big 747 and the flight will be smooth”. Boy, where I wrong, we had a really bumpy road down to Bangalore, I hope the kid survived!

The flight to Bangalore went well beside the bumps, I had this really interesting Mr and Mrs Something who had been living in the US for 6 months and where now moving back to Bangalore, they were really nice talking to. The Mr in the family was working for a big Indian consultancy firm, and was a bit feed up with not being able to change anything. “We are not very agile” he said, I tipped him to contact Blue Star and see what they could offer..

Entering customs in Bangalore was a new experience, thank you Swine Flu!
Previously it has taken a long time to go through customs, but now thanks to the flu it takes ages, first one need to fill in a form regarding your physical health. I lied a lot as you might understand, since I really need to start running or something. After that you need to state where you have been the last 6 months, easy for me, I could even state the street addresses, Klarabergsgatan 60 and Allfarvägen 21 Täby. The people in customs did not understand my joke so I had to change it to Sweden.
The only problem here was really the massive amount of people that needed to pas the 3 doctors asking the same questions as one previously has answered in the form..

After that I was planning to fast as a shark pick up my bag and get out to Prasad from Blue Star who was waiting for me outside. One could guess that the bags would be waiting since passing the doctors took about an hour. But no, I waited 53 minutes for my bag, and when I finally got it I got grabbed in Customs by Mr Sunshine himself. He wanted me to open my bag, since someone had marked the bag with a big X on the side. So I open the bag, and showed the lap top I had brought from Sweden to JoJo . Well about here the discussion starts, Mr sunshine informs me that is only allowed to bring one computer into India and he thinks the laptop is worth 40.000 rupees, which is probably 35.000 rupees to much, I said “no way, I’ll leave the computer here with you and you can do whatever you want with it”. So then he said, “but I can give you a discount” , I said, “are you real(that is a translation of “är du riktig” in Swedish) can the customs give me a discount, that sounds insane! “. Mr sunshine did not react positive to my comment, and I should have kept my mouth shut! But to end this part of the story, we “agreed” on 33.000 rupees as the computers value, and I paid 9013 rupees as some kind of tax.. it’s hard to believe but I can show you the receipt.

The day ended on a really good note though, when Prasad had taken me to the hotel, the hotel had decided to upgrade me into a suite instead of my ordinary room. Suite == Sweet.

Monday

I had talked to Ram during the nightly adventures in customs, and we had agreed a pone meeting at the office around 09. And so we did, it was really great meeting the nice people in D&M Bangalore! For me the day mostly consisted of meeting, and meetings held in Stockholm, so I did not really have the time to take part in any cool stuff that the Bangalore team is working on. Me and Ram had a nice, but short, lunch with some Blue Star people.

In the afternoon we all got the chance to celebrate Ganesh’s birthday. They do have some strange traditions here in the far east, the guy’s getting older get’s cake all over his face, and he seems to like it.. Must be some Hindu tradition, “go to the local baker, get a ‘cream cake’ and put it in the face of your friend”. Strange, but fun!

I spent the evening at the hotel restaurant, sweating and speed eating due to the fact that two people were constantly filling my plate with Chicken tikka masala. Or possibly it could be due to the Kingfisher beers.

Ps, forgot one thing, my shoe touched some cow shit today, does this make me holy or just my shoe? Ds.

So you wanna be a front end developer?

Filed Under (Coding) by Olle on 13-05-2009

Back in the day when I was a young boy in the big IT-industry I wanted to become the greatest front end developer the web had seen. Due to circumstances, out of my hands of course, I did not reach my goal, but I did get to “know” some great ones along the way!

So I guess you possibly have some schooling to bring to the table, or you have been working with back-end stuff stuff for quite some time, you know what object oriented programming is or at least want to learn, and most importantly you have the will to learn!

When I started to become really interested in front end development back in the late 90′s, front end development was not looked upon as real programming, real programming was C++, Java and the likes. But now, we have job titles like Senior Front End Developer at for instance Yahoo and Google, so I guess that the understanding of the importance of good front end code has really elevated.

So my way of learning the craftsmanship, was to study the masters below, downloaded their code, read it, and then write my own! If it worked for me, I’m sure it will for you!

Scott Andrew LePera
What really got me started was a guy named Scott Andrew LePera(http://www.scottandrew.com/). He got me all warm and fuzzy talking about for instance event handlers in javascript and how event bubbles

Aaron Boodman
After that I stumbled over Aaron Boodman, the youngpup (and creator of Greasemonky among things) showed me all about how to create the menus that we love to have, how to make the Javascripts run smooth in animations, and how drag of elements shall be done. Back in the beginning of the 2000 he had the coolest UI on his blog, and nothing I have seen since has turned me on as much as viewing youngpup.net for the first time(except possibly 13thparallel)!

13thparallel
13thparallel made me think about coding for portability, introduced me to the concept of the Viewport among other things.

WebFX
Emil A Eklund and Erik Arvidsson at WebFX showed me that it was possible to create a forum on the web with outstanding functionality and speed(unfortunately it only looks good in MS IE), how to work with XML in advanced Javascript.

Peter-Paul Koch @Quirksmode
Quirksmode helped me really understand the differences between browsers and what do do about it. He also really introduced me to Unobtrusive JavaScript.

Remember that most of the examples above have been written back in 2001-2002, and they still work..What does this tell us, well to use the standards, and no browser specific hack, because browsers change and you will end up chasing your own tail to make things work in new browsers.

Promoting: Using an Agile Software Process with Offshore Development

Filed Under (Social) by Olle on 25-04-2009

This one is still very “current” even though is was last updated in July 2006, in regards of what we currently are trying/working on in Bangalore.

Using an Agile Software Process with Offshore Development.

Bangalore – 8 months and counting….

Filed Under (Social) by Olle on 19-04-2009

Tagged Under : , , ,

… or “What have we learnt so far?”

So, I feel it’s time to get down on “paper”, what we Projectplace and especially the R&D department,  have learnt so far from working with a remote development team in Bangalore.

First of all, what is the set up and starting point?

We have one team of developers in Stockholm Sweden together with a team of Interaction and Visual Designers, a team of Testers, a Scrum Master, a Product Council and the Project Owner.

In Bangalore we have a team of developers, a tester and (soon) a Scrum Master.

Early yet, but we can learn a few things anyway

A developer is a developer is a developer.

Yes there are culture differences and we embrace  them, but most of the stuff is the same all over the globe it seems. A developer needs to feel part of the team, have the possibility to learn and grow, be able to raise issues and be listened to. Let the developers in Bangalore find their own way of going by their work, but be crystal clear about the core values and the company strategy! This is not something that is negotiable, if we have agreed on something, stick to it!.

Have someone from the head office onsite, values applies for all!

We have learned that is is vital that someone who knows the company, has deep knowledge about the product and is an ambassador of the core values, is working in the remote site. All the meetings, mails and all can never replace the daily conversations and good examples of behavior.

The core values must of course be implemented everywhere the company operates, they are global for all working for Projectplace. We are on the same team!

Meet as often as possible.

Online meetings, video conferences, telephone calls, however plenty, can never replace in real life meetings! The developers needs to connect with each other, the most efficient way of doing this is face to face. We have had developers in Stockholm going to Bangalore and Bangalore developers going to Stockholm. The longer the stay the deeper and better the results.

Make the remote team independent.

To make the remote team perform, make sure that they feel they have the power to take decisions, especially things that impact their working day. Remove all the obstacles that make decision-making hard and slow.

Communications channels needs to be up and running.

The remote team needs to know what is happening, and especially things that affects their work. It’s frustrating to wait for answers or feedback.

We have tried using Skype, gTalk, MSN, Yammer etc to stay in contact, but we still have a long-way to go.

“Hire the best and set them free” is still the way to do it.

By the best I do not mean the developer that can write the smartest or fastest piece of code. The best in my mind is the developer with the best drive and attitude, the will to share and lead or really any other trait that will make the group perform and become best. It is totally true that the group will always outrun the best individual, so make sure that the group is happy and performing!

In Bangalore there are a lot of developers and Scrum Masters that have done this before, listen to them, they have the experience that you have not (if you are new to this as we are).

Be crystal clear about the purpose of outsourcing.

The remote team needs to know the agenda! Are we looking long term or is this a short venture? Can you expect more commitment from developers if the company is looking for a long-term relationship? Hell yes!

My impression is that many Indian developers working for medium sized service companies are usually tired of bureaucracy, so they love to be treated as any other employee of the offshoring company rather than as mere consultants. So give them the freedom they need and treat them as you would any other employee. Now you can expect and, and in the long run demand, commitment.

…. to be continued.