Tuesday, November 10, 2009
Administrative Note: Moving away tech posts
| Reactions: |
Sunday, September 20, 2009
Next JUG SIngapore meeting and introducing a new hack
| Reactions: |
Wednesday, September 02, 2009
[Hack]: Chess runner
The easy part is to take the data, store it, parse it and the simple UI I built for making the moves work. What is infinitely more complex is to understand the moves in the algebraic notation and changing the status of the board. The problem is that the notation only tells you where something is to end up at, not where it originates from - and that has to be computed by you based on your previous board state and a complex set of rules.
The one that I built looks ugly in code presently (and hence not sharing right away), but it works, including moves like castles and en passants. The UI itself is just two pages - one to feed your game and another to run it. If you want to embed the "run" page, you can do that too by adding "&nfh=1" to the end of the page URL.
So check it out at http://www.shreeni.info/chess/index.jsp or check out one of my wins.
| Reactions: |
Sunday, August 23, 2009
Inaugural Geekcamp Singapore
| Reactions: |
Saturday, August 22, 2009
JUG Singapore
- Tech Culture in Singapore
- Tech best practices (Test Driven Development, Continuous Integration)
- Entrepreneurial Opportunities in Singapore
- Startup ecosystem in Singapore
- Cloud Computing growth, both Singapore specific and otherwise
- And some personal anecdotes
| Reactions: |
Tuesday, August 11, 2009
iPhone Free Chess Roundup: Glaurung is my pick
So, I basically did a round up of all the free chess apps I could find on the AppStore and this article does a summary-review of all of them.
a1 chess Free: Too bad that it has only two levels (and I am guessing the paid versions might have more - but I only tried free ones). The level 2 (highest) plays too naively and you can pretty much defeat it every time with either white or black. You will pretty soon get bored of this app.
Rating: * (1/5)
Chess Free: Neat interface and good level of chess, but has a hard limitation of the games being 10-min a player only. What if I don't want that restriction? Time limit chess is only one of the forms of chess and not one that I fancy. It would have been nicer to have at least have the option of changing the time limit.
Rating: ** (2/5)
Chess O: I could never properly test this - because into a minute of using this, it starts complaining of the iPhone running on low memory, while everything else seems to be working fine. God knows how to make this work.
Rating: (0/5)
Deep Green Chess Lite: Very glib interface and good level of chess game, but no adjustments on the game possible. If that were possible, then this would be quite a good app to use.
Rating: ** (2/5)
Glaurung Chess: This is by far the best free chess app I have seen. It has loads of cool features. It has a timer - but it doesn't not stop the game after the time has lapsed but just indicates it in red on the top. If you want to make the time limit strict, you can finish the game then. It has easy ways to control the level - it has levels between 1-199 which means you can set it at multiple levels as you increase. It has the option of taking a move very easily - just swipe right to left at the moves section (and left to right to see what happened from a point in the past). Ability to look at your moves is a great way to learn. Finally, what makes it quite awesome is the ability to send emails to yourself when the game finishes. I have recorded a bunch of the games that I thought were interesting. If I find a simulator to run through the moves as a video, then that would make this feature the rock star feature. [Update: I built the Chess Runner]
Rating: ***** (5/5)
Free Chess: Has levels (discrete numbering 6), the interface is snazzy and you can save and retrieve games (within the iPhone), and hence is probably the best competitor to Glaurung. If only it had more levels control and emailing feature, I would have rated it a full 5.
Rating: **** (4/5)
| Reactions: |
Monday, July 27, 2009
Moving away from www
Update: All blogs posts from 2003-2011 will continue to work with the previous page urls too (although it will redirect to blog.shreeni.info) - thanks to a quick and dirty hack - I will blog about it later.
| Reactions: |
Sunday, July 26, 2009
Tracking me on Twitter
The right way to do this would have been to use the twitter firehouse, which of course is not openly available to everybody, or to use the search interface. As I was planning to shift the code to use that, I hit upon this neat little widget from Twitter, which allows me to create a widget to track all the tweets containing my name and allows me to publish this wherever. I am putting this up on this blog. I have taken out the widget showing my tweets to the new widget titled "Chatter about me on twitverse" and its a dynamically updating widget. At this moment, I am enjoying the look of the new widget on my blog.
Update: I have removed the widget from this blog since I have made my twitter stream private. You can still get the widget from the link.
Sunday, July 05, 2009
[Hack]: Rahu Kalam Calculator
In India, since it is mostly South Indians who believe in Rahu Kalam, they tend to assume that sunrise and sunset is 0600 and 1800 Hrs respectively. This leads to fixed times of the Rahu Kalam on each day of the week. This, however, could be wrong depending on the seasons. Even more importantly, this would be quite wrong in others parts of the world. In Singapore, sunrise is rarely before 7.00 AM and in Scandinavian counties, sunrise and sunset hugely varies depending on the season. So, I decided to write a hack to automate all this.
So the site is at:
http://rahukalamcalculator.appspot.com/
Essentially, you need to tell where you are from (Bangalore, Hyderabad, New York etc) and based on the lat-long on that location, it will calculate the Sunrise Sunset times and tell you the Rahu Kalam for the next 3 days. You are of course free to choose a specific date and find the Rahu Kalam for that date. The system will remember your location choice and not ask you next time. (You can choose to clear it, of course)
The hack itself involves using a bunch of webservices - the Yahoo Maps Webservice for geocoding a location and getting its latitude and longitude. Second, I used the Earthtools API to get the sunrise and the sunset of a given location. Everything else is calculated internally. I have hosted it on Google App Engine.
Please test the tool and give me your much-sought-after feedback/suggestions etc. You may also tell me what you want to see there.
I will clean up the code in a while and post it in public.
| Reactions: |
Thursday, June 25, 2009
Tinyurl Clone in Java in 40 lines
First, persistence is a breeze in Googe AppEngine and hence I used their JDO approach to store it. The class (with the annotation) is as follows:
package info.shreeni.snip4java;import javax.jdo.annotations.*;
@PersistenceCapable(identityType = IdentityType.DATASTORE)
public class Mapping {
@PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
public Long id;
@Persistent
public String url;
}
As you can see, since the idea was to be as terse as possible, all imports were lumped into the same line and no JavaDocs. Also, I completely did away with getter and setter since that would have consumed more lines of code. :-)
Then comes the MappingManager, the piece that performs the I/O with the Datastore:
package info.shreeni.snip4java;import java.util.*;import javax.jdo.JDOHelper;import javax.jdo.PersistenceManager;
public class MappingManager {
private static PersistenceManager pm = JDOHelper.getPersistenceManagerFactory("transactions-optional").getPersistenceManager();
public static Long storeMapping(Mapping mapping) {
long existingMapping = getMappingByUrl(mapping.url);
return (existingMapping == -1)?pm.makePersistent(mapping).id:existingMapping;
}
public static Long getMappingByUrl(String url) {
Iterator
return (i == null || !i.hasNext())?-1:i.next().id;
}
public static String getLink(String urlId) {
Iterator
return (i == null || !i.hasNext())?null:i.next().url;
}
}
The first method stores the mapping, the second gets a url id based on the url (so that we don't keep bloating our DB with repeated URLs) and the third gets a URL based on the Id. The expression "Long.valueOf(urlId, 36)" converts the url id from Base 36 String to a long. Its the same approach as used by Sau Sheong's Snip. All exceptions and error handling is conveniently ignored so that it would end in a HTTP 500 at the end, which I think is a reasonable approach considering the limited amount of code we can write in 40 lines.
Then comes the servlet code which converts a URL into a short URL and print it to the user:
package info.shreeni.snip4java;import java.io.IOException;import javax.servlet.ServletException;import javax.servlet.http.*;
public class Snip extends HttpServlet {
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
Mapping mapping = new Mapping();
mapping.url = req.getPathInfo().substring(1);
resp.getWriter().print(req.getRequestURL().toString().replaceAll(req.getPathInfo(), "/").replace("/s/", "/r/") + Long.toString(MappingManager.storeMapping(mapping), 36));
}
}
Quite fascinatingly, the first two lines in the doGet method serve very little, but the third pretty much does all the business logic, or storing the url to db, getting the id, converting to Base 36, constructing the URL and printing it.
Now, the last class which does the real work or taking a short URL and redirecting it to the correct URL stored in the DB:
package info.shreeni.snip4java;import java.io.IOException;import javax.servlet.ServletException;import javax.servlet.http.*;
public class Redirect extends HttpServlet {
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
resp.sendRedirect(MappingManager.getLink(req.getPathInfo().substring(1)));
}
}
Right then, we are done. Thats exactly 40 lines of Java Code. The only thing left is the Web.xml and the appengine-web.xml which are XML required for running all this Java code (first required by any Servlet container and the second required by Google AppEngine.) Being XML, each of those can be compressed into 1 line each, but I am not going to bother presenting them here since they are both too trivial. I put in a index.html just for those users who may not know how to use it (again, this can be packaged into one line). Even if we were to include these three, it would come to only 43 lines.
Thats it, go ahead and try SnipOnJava. Examples: Yahoo.com, Sau Sheong's Snip blog entry.
| Reactions: |
Monday, March 30, 2009
Moving Eastward
What prompted this? My recent travels to a few countries opened me to the significant cultural differences that I thought would be great to learn, absorb & appreciate. Also, the travel bug had bitten both me and my wife and we thought this would be a great time to spend some time traveling, especially before other responsibilities catch up with us. So, time was ripe for me to move on. At the same time, Yahoo provided me with an opportunity to continue my engagement with them out of Singapore and it was a win-win arrangement.
Why Singapore? After my visit there last year, I was most impressed with the city. It has fantastic public transportation, has built a great nation in spite of not having much natural resources, has propagated communal harmony in spite of being a pot boiler of multiple religions and cultures. Its also a place that's very inviting with great immigration laws and comfortable life for expats. Its also a great hub to commute around most of south east Asia. And finally, Yahoo has a office with some significant engineering work being done out of there and they offered me an option to work out that location.
While pointing out the good things, there are of course significant shortcomings also - a horrible weather, a very big carbon footprint due to importing everything they require, a insecure system which relies of fickle expats (22% of population) for their economy to grow and a system thats often criticized for being only a pseudo democracy with significant media restrictions. These things bother me, but just enough for me to decide against going there. Probably living there would give me a different perspective on these.
What about Bangalore? Well, I can't say the same great things about Bangalore - but it has been a good home for me and my family over the past 4 years. I have also been a good resident, paying all taxes, investing locally (and hence contributing to the local economy) and celebrating the same festivals that Kannadigas celebrate. Though I have been a vocal critic of some of the issues plaguing the city, I see a lot of hope in where this city can go with action groups and active communities contributing to make this a better place. With the intellectual capital brewing in the city, I also think, it might be the epicentre of creating the change agents that the country requires to move to the next level of development.
I will miss a few things from my life in Bangalore:
- Friends - I have been blessed with acquiantances of some great people during my stay here and instead of taking names - I would just say each one of them has contributed to enriching my life here.
- My ex-colleagues across all my three employers - Trilogy, Ugenie and Yahoo have made me a better person, a better professional and it has been a good learning experience. I hope I have contributed to their causes as well.
- The weather - when you are heading to Singapore with a horrible hot weather through the year, there are probably 360 days you are going to long to come back to the brilliant weather back in Bangalore.
- My favorite eating/drinking joints - ranging from the upscale Ebony to the down-to-earth darshinis and the always good Stones and the creamy-ice-creamy Corner House - have been great memories and I hope they stay with me forever. Kesari Bath, Rava Masala Dosa and Hot Chocolate Fudge will rate the highest here.
- My own home at Mahaveer Nest, Devara Chikana Halli and the locality, that has grown on me with acquiantances with all the shopkeepers and the presence of the serene Aiyyappa Temple being a tempering influence on me, will not be there anymore for me to return to everyday in the evening.
| Reactions: |
Monday, February 23, 2009
First Tweet award goes to - Yours truly
Today happens to be Mahashivratri and my wife had an off. I decided to give up my floating leave of 2009 to be with her. Then I realized it was Oscar day and hence I decided to do live streaming on Twitter. The proud moment for me, then, was to be the first on the tweeting trend of #oscars09 to tweet about Slumdog Millionaire winning the best film. I am a happy man today.
BTW, hearty Congrats to everybody at Slumdog Millionaire team for Oscars09 - (Winners) Christian Colson, Danny Boyle, A R Rahman, Anthony Dod Mantle, Ian Tapp, Richard Pryke and Resul Pookutty, Chris Dickens, Simon Beaufoy - and everybody else on team - Dev, Frieda, Anil, Irffan and the kids.
| Reactions: |
Thursday, January 01, 2009
Starting the New Year in a cool way - Launching shreeni.info
Now, all that is done. I do have the two domains up and working and I have their email accesses also working. So, I feel having achieved something good on New Year's day.
| Reactions: |
Thursday, November 20, 2008
Also, now on Twitter
Having shaken it off yesterday on an impulse, I found it quite charming. The registration should take 15 seconds and adding a few followings another 30 seconds. Now, I am loving the option of doing mini updates on twitter. I have also set up TwitterFox to do all operations out of a small window on FF.
Follow me on Twitter.
Wednesday, October 15, 2008
Sin of Incentives
I have also had related experiences, mostly bad. I have worked in three companies prior to moving to Yahoo. Two of these were pre-IPO startups and the strongest incentives they could give were stock options, which is what they did. The third company was an established non-public-listed company and hence stock options did not make sense.
To incentivize its engineers, they had a bonus scheme. These bonuses would be paid out to the whole team if the team met its own goals and performed well. These were generally some sort of revenue/profit goals. Now, here in the lies the problem. Most technology products take significant time to get to revenue making stage. Websites, for example, take months before you can make profits off them. However, all these months are not spent idling around. You need to build the product, iterate on the features, work on crashes, stabilize the problems and only then are you close to making money.
Now, it is not necessary that the engineers in the team remain constant. Some are moved to different teams because of resource planning, or due to promotions, or due to change in profiles, and some just leave the company. So, the guys who get the bonuses (when revenues/profits start coming in) are not the same guys who helped build the product from start.
Moreover, if the product is already stable, engineers are mostly spending their time keeping things stable. All work comes through strict Change Request processes and are triaged before accepted for work. Often, these maintenance cycles are relaxed points and engineers can easily manage it working 9-5.
On the other hand, early stages need people working much harder to build the product (from scratch mostly), meeting tough early deadlines, meet moving targets, and handle all sorts of crashes happening at night times, because the product isn't stable enough or the monitoring tools haven't matured.
So, this means guys who are working in best conditions are paid out the bonuses, while guys working their asses off get none of it. This could be a big mess.
The normal reaction is - don't pay out team bonuses, but only stock options, so you get paid only when the company succeeds. This works in pre-IPO stages because the strike price is normally trivial and you get paid if the company goes big. However, for an already listed company, your strike price is established based on when you join and hence it is highly randomized.
Essentially, if you join when the market is at its peak, you get stock options which you can never exercise, while others who joined a few months later can just loiter around the office and make thousands off their stock options, which were priced too low.
Off late, many companies try out Restricted Stock Units (RSU) which have nothing to do with the point of time you join, but you payouts depend on when you sell these units, which is a far more controllable piece for most employees. I have been issued RSUs at Yahoo and have a 3 year lock in, which hasn't completed, and hence can't comment on how well it works.
Any comments?
| Reactions: |
Monday, September 22, 2008
The PC Ads
Well, its been a decade and things have changed a long way. Ever since ubuntu has come along, all installation issues have pretty much gone out of the window. And since it is virus proof for most part, I can give it off to my father and he could keep clicking on whatever he wants and I don't need to worry about a crashing OS. In fact, I handed over a Linux desktop to my almost-computer-illiterate father and he has been using it 5-6 hours daily and hasn't brought it down. He uses the Internet to find any application he wants and hence he needs nothing except the browser (and probably a media player for playing music/videos which are not streamed).
Taking the cue, I have moved to a Windows-less life myself. I switched my laptop to Mac sometime back and am most happy. I also have a desktop at work which is a RHEL machine, which I use only through terminal consoles. I am happy with the arrangement and don't miss Windows.
Having said all this, (and I have not even got to where I wanted to), I have always admired Microsoft for producing an easy-to-use OS and hence allowing a lot of computer-illiterate people to get onto the computer revolution. However, a lot of companies were stereotyping Windows and its users and were getting away with it. The "I am a Mac" ads are a classic example.
And I always hoped Microsoft fought back. And they have. Here are the videos of the latest bunch of "I am a PC" ads. I am loving them. Have a look:
ps: Thanks to TechCrunch for exposing me to these ads. I don't think they are running on Indian TV.
| Reactions: |
Friday, July 04, 2008
I am a Macman...
I have to thank Subru or Deepak (or whoever it was who added me to the list of people who should get Macs) for this. While I was happily coding away on my old HP 6320 while I was in the Bay Area, the list of prospective Mac owners was being constructed back home. It was a pleasant surprise, then, to know that I was added to the list and would be issued one. I happily traded my HP one for this brand new sparkling new Mac.
I am yet to get used to quite a bit on this machine, but I have enough control to publish this first blog from my Mac.
And all this elation is forcing me to hum a parody of the old Scatman song, "I am a Macman"
Friday, May 09, 2008
MicroHoo Humor
Personally, I feel it was a fair business decision for M$ to come after us and it was a fair decision making process from Yang and co and so far as I am doing my good engineering work and getting things out of the door, I don't care about all this. My morale is up and the group I work for (YPOST for the Yahoos) is doing some good work that all I can do is look into the future.
Anyhow, the point of the post was not to rant against Kara, but to blog about the excellent post by Kevin Maney who compares the whole episode to a college dating thingy. Copied below (beware MSFTites: humor against your dear CEO):
Let's parse the Reuters story with this perspective in mind.Microsoft gauged Facebook's interest in a possible acquisition after the software giant's failed takeover attempt of Yahoo, the Wall Street Journal reported Wednesday. Steve, frustrated and hurt after being spurned by Yahoo, got out the yearbook, found the most popular girl of the moment, and decided to go for her whether he really wanted to or not.
The newspaper reported on its website that Microsoft's bankers put out subtle signals to Facebook, the social networking website, to see if it would be open to a full acquisition. Steve didn't want to be rejected again, so he got his friends to feel out her interest.
The talks were first reported by website All Things Digital, owned by Wall Street Journal publisher Dow Jones. One of his friends told the school gossip, who of course blabbed to everybody.
Facebook spokeswoman Brandee Barker declined to comment on the report. Microsoft officials were not immediately available for comment. The girl's sidekick girlfriend wouldn't let on whether she knew this happened or not. When asked, Steve's friends also refused to say whether Steve was actually interested.
In October, Microsoft took a $240 million stake in Facebook, which valued the start-up at $15 billion. Citing an unnamed source, the report said there are no active discussions between the two companies. Steve, a senior and a BMOC, flirted with Facebook last fall, immediately raising her profile, but nothing much happened between the two of them after that.
The news came a few days after Microsoft dropped its unsolicited offer to buy Yahoo for $47.5 billion. The aim of that proposal was to build an online advertising powerhouse to rival Google. Steve's interest in Facebook is seen as a rebound thing.
Facebook, founded in 2004 by Harvard student Mark Zuckerberg, has become one of the hottest properties on the internet because of its rapid growth and the loyalty of its users. Facebook has more than 70 million active users. But Facebook has in the past year turned into a hottie, and Steve probably can't get her now.
The museum for geeks
Apart from the machines or reproduction of machines from over 100 years, they also have free guided tours. They also have been working on restoring old machines like the PDP-1 and have also obtained one of the world's two Babbage Machines. We were lucky enough to witness a live working demo of the PDP-1 when we want and the Babbage Engine is going to be inaugurated this Saturday. If you are interested in these things, head out there this weekend.
I will share a bunch of photos along with some descriptions:

Peter telling us about the PDP1. He also told us the story of how he lost the punch cards for the original music he wrote and how he got it back 40 years later at the musuem and how they reconstructed the program to synthesize the music and how he manage to restore everything together. The demo was a once in a lifetime experience.

Peter Samson and Stephen Rusell are live demoing the PDP-1 to us. Peter wrote the first music software, which synthesized 4 tunes and it was written on a PDP 1 and he actually demoed the original 40 year old music program to us. Stephen wrote the first Video Game, again on a PDP 1 and he also demoed it us. It had 4 controls - one each for Left and Right, one for shooting and one to go into Hyper Space. You probably guessed right that it was a Space Wars game. The amazing constraints of the machines then and the significance of the game on that was quite marvellous to experience.

A gimmick of a computer, priced at $10,600 and meant to be installed in a kitchen and used for storing recipes. At that time, you could buy a home in that money and apparently not a single piece was ever sold.

Thats an IBM 360. It was a dream to see the legendary system. It was the first series of machine that IBM designed to be compatible across multiple versions and the backward compatibility to that instruction set has been maintained till today.

Computer connected to a radar used for detecting Russian bombers over the North Pole. These were deployed near the Canadian Border, had a 100% success rate (US was never bombed over the NP). It had a light gun to capture input and also had a small ashtray and a lighter. How cool of a workstation was that!!

This machine was used for counting people and their details in a Census. This was a machine built by Hollerith whose organization eventually became IBM. (I don't know why I was posing like that!!)

The Babbage engine - only 1 of 2 ever built. It was conceived by Charles Babbage but never executed, but was completed in 2008. It will be inaugrated on May 10 at the Musuem.
For more photos check out the Flickr photo stream.
| Reactions: |
Monday, March 31, 2008
SEO Rapping
Lyrics:
Copyright http://www.youtube.com/watch?v=a0qMe7Z3EYg
our site design is the first thing people see
it should be reflective of you and the industry
easy to look at with a nice navigation
when you can't find what you want it causes frustration
a clear Call to action to increase the temptation
use appealing graphics they create motivation
if you have animation
use with moderation
cause search engines can't index the information
display the logos of all your associations
highlight your contact info that's an obligation
create a clean design you can use some decoration
but to try to prevent any client hesitation
every page that they click should provide and explanation
should be easy to understand like having a conversation
when you design the style go ahead and use your imagination
but make sure you use correct color combinations
do some investigation, look at other organizations
but don't duplicate or you might face a litigation
design done, congratulations but it's time to start construction
follow these instructions when you move into production
your photoshop functions then slice that design
do your layout with divs make sure that it's aligned
please don't use tables even though they work fine
when it come to indexing they give searches a hard time
make it easy for the spiders to crawl what you provide
remove font type, font color and font size
no background colors, keep your coding real neat,
tag your look and feel on a separate style sheet
better results with xml and css
now you making progress, a lil closer to success
describe your doctype so the browser can relate
make sure you do it great or it won't validate
check in all browsers, I do it directly
gotta make sure that it renders correctly
some use IE, some others use Flock
some use AOL, I use Firefox
title everything including links and images
don't use italics, use emphasis
don't use bold, please use strong
if you use bold that's old and wrong
when you use CSS, you page will load quicker
client satisfied like they eating on a snicker
they stuck on your page like you made it with a sticker
and then they convert now that's the real kicker
make you a lil richer, your site a lil slicker
design and code right man I hope you get the picture
what I'm telling you is true man it should be a scripture
if it's built right you'll be the pick of the litter
everyone will want to follow you like twitter
competition will get bitter and you'll shine like glitter
if you trying to grow your company will get bigger
design and code right man can you get with it
| Reactions: |

