Building a stock market game in 2008

This is a post I meant to write almost 13 years back, on how I built a stock market game using Ruby on Rails for our B-school flagship event Quadriga (I did release the game source code on Rubyforge, but the site is no longer operational). Like they say, better late than never :). Below is a short screen capture of the game in action from the beta run I had organized, showcasing the different features to give you an idea of what it entailed:

The game itself was a very simplified version of a stock market designed to be played as individuals or as a team with the following features:

  • Simple buy and sell transactions without any short selling, futures or options .
  • The trading would be spread across a period of 12 sessions with the prices changing before the start of each. Each user would get a fixed set of shares for each of the stocks at the beginning of the game so that selling activity can be initiated from period 1.
  • There was an element of randomization in the stock price movement from period to period partially influenced by a set of pre-defined events.
  • A user login feature with public leaderboard to give everyone a view of how they are performing against the competitors.
  • A transaction & stock price history section to view the changes over time.

I have fond memories of this game as it game me an opportunity to try out Ruby on Rails in a real world scenario (this video from 2005 was the inspiration). I had a lot of fun coding the game and consulting classmates & seniors on how the stock market should be simulated. Even more fun was the beta testing round we did over the hostel LAN (the video above is from the test run as you can in the message on the login screen), with most of my classmates participating. We have come a long way on the technological front, and one of the things I do find missing in the game is an element of visualization in the form of graphs. Mobile support was of course not relevant back in 2008, but today it would be a no brainer.

As for the actual event, we brought in an element of security/standardization where we had the competing teams using laptops borrowed from my classmates. To ensure that their personal files were not affected, we setup Linux virtual machines on top of the Windows environment, and the teams were using browsers to access the game running my laptop through a Wi-Fi network we had setup on a router borrowed from another of my classmates (it was 2008 after all).

This nostalgic post would not have been possible had I not backed up the files to an external hard disk and to OneDrive eventually. So, here’s a bit more of throwback with the event posters & other collaterals:

iOS to Android [P1]: Perks outside the walled garden

I had never used Android as my exclusive daily driver, and my last proper Android phone usage on the Mi 4 was in parallel with my iPhone 5s around 6-7 years ago. A lot has changed in this time, and a lot has also remained the same especially when it comes to the customizations possible.

Here’s a quick rundown of the key new features I’ve recently (re)discovered on this side of the fence.

Ad blocking with Blokada

Ad blocking apps are of course nothing new on the iOS side, but are largely limited to browsers & webviews at best. This is where Blokada for Android comes in. It sets up a local VPN on the device and does local DNS filtering a la Pi-hole to block ads across apps. There is going to be a slight performance & battery life penalty, but you get ad blocking on the go. You can sideload the full featured version, or just get the Slim version from the Play store. It’s also available for Android TV, in case you do not want to use Pi-hole.

You can get similar functionality on the iPhone side of things, but need to use cloud services to get similar features which add on subscription costs & connection latency.

SMS Organizer

Custom launchers, dialers & SMS apps have been around from the very beginning on the Android side and have also been one of the biggest attractions of the platform. That said, the way we use SMS has changed a lot and it has become more of a platform to get transaction notifications, esp. for OTPs. This of course means that you have to be really careful in which custom apps you choose as a rogue app could easily siphon off your identity or bank balance.

That said, the SMS Organizer app from Microsoft Garage is a really smart app that makes life much easier and feels like a breath of fresh air after having used the iPhone Messages app for the last several years.

Transaction messages don’t just get a separate tab, but the notifications are also designed to highlight the key portion. Promotional & personal messages get their own tab as well. Then there’s the tab for reminders, finance & offers – each of which intelligently parse the messages and put the key information in a usable or actionable form. So, you can glance your bank, credit card, EPF, PPF & other such accounts including a transaction list (not completely accurate at times due to duplicate messages), get a reminder of your upcoming bills & travel plans and also surface the coupon codes that get sent in umpteen promo messages.

Then there’s the simple but great QoL improvement due to the ability to mark all messages as read and delete old OTP messages after a certain period. It also backs up the messages to Google Drive in case you want to restore later.

I’ve also been using the Microsoft Launcher which neatly integrates with Outlook and makes it easier to glance upcoming work meetings.

Windows integration

Yet another point around a Microsoft feature for Google’s OS. When I had switched to iPhones in 2014, it was from a Lumia 720 and Microsoft was still making Windows Phones at that time. Now, Microsoft seems to have embraced mobile devices & the cloud and their apps have features to further this vision. The Microsoft Phone Companion app on Windows makes it easy to connect to any Android phone, and in my case, the Samsung Galaxy S20FE has the required apps pre-installed.

Microsoft’s Phone Companion app in action along with the Swiggy app running from the mobile on the laptop

While it is not quite the kind of integration between macOS & iOS devices, there are many ways this is more fully featured as you can not just control basic settings like volume but also access your phone’s notifications, messages, photos & apps right from a Windows machine. This makes it quite easy to stay tuned to a single device, unless you are a Mac user, or are using a work laptop where this feature is restricted.

Working on large screens

This is a perk of Samsung devices with DeX support where you can connect to a larger screen like a monitor or TV (USB to HDMI dongle required) or to a PC (wirelessly or through a USB cable), and then get a desktop like experience.

I got a USB-C to HDMI adapter which also has a USB A port & USB C pass through charging, which allows me to connect a key + mouse combo along with the monitor to access the DeX mode. This mainly comes in handy when you need a larger screen to edit audio/video/images taken on the phone, or just want a larger screen to view content.

Also a quick mention of the split screen & hover apps feature on Samsung devices that has been supported since the earliest Galaxy Note devices, and has been available on iPads for a while but not on iPhones.

Automation

iOS devices have made great strides on this front with the Shortcuts app which started off as Workflow before being acquired by Apple. This largely pales when one compares to Android veterans like Tasker & Llama that have been around since the early days. Services like IFTTT & Zapier can also do more on Android than iOS. Then, there are the Shortcuts contemporaries like Google Assistant & Bixby routines which provide an easier interface.

Most of my automations deal with silencing & unsilencing the phone based on different conditions like location & time of the day. This is where the iPhone’s hardware mute switch gets in the way as automations can’t alter its state.

Coming out of blog hibernation & moving to Android

It’s been over 16 years since I started this blog, but I have not posted anything in the last couple of years. So, taking another shot at reactivating it by restarting my linkblog posts through Pocket & IFTTT, and a bit of a tweak to the theme as well.

As for my gadget journey, quite a lot has happened in the last couple of years, starting with iPhone 11 Pro that I got to replace my iPhone 7 Plus. I also added the Homepod & Homepod mini towards the end of 2020 along with the Apple Watch 5, Airpods Pro & iPad mini the same year.

I was getting more & more entrenched into the Apple ecosystem till about a couple of months ago when the iPhone 11 Pro died (no damage – just refused to wake up). I ended up getting a Samsung Galaxy S20 FE 5G along with the Galaxy Watch 4 for the same cost as a replacement for the 11 Pro. The rock solid reliability of Apple hardware seems to be faltering for me, with the Airpods Pro also developing an issue on the left ear piece. I’ve also had different issues with iOS over the years ranging from failed updates requiring device resets to crashing home screens, so the OS side of things is not overtly different from Android in terms of stability.

That said, it has been quite refreshing to get into the modern Android ecosystem, with my last proper usage being Android 6 on the Mi 4. Quite a few things seem smarter on the Android side thanks to the openness of the platform, despite the flexibility Apple has introduced in the last few years with Shortcuts & the likes. Microsoft has also done quite a bit to enable integration with Windows. The link to Windows feature is quite handy to get notifications on my laptop in addition to being able run Android apps from the phone on the laptop as well. Then there’s the DeX mode on Samsung phones that comes in handy when editing videos or creating content using a monitor + keyboard + mouse combo, and of course the split screen & floating apps on the phone that have been around since the early Galaxy Note days.

The camera on the new phone is about on par with the 11 Pro with the telephoto having a longer focal length which I prefer, but the ultrawide is not as wide. The camera app performance is not as smooth, especially on the shot to shot performance when using the on screen shutter. I did try a few Google Camera ports, and their shot to shot performance is better but image quality is on the iffy side.

Either way, I’m in the Android ecosystem as my daily driver and the performance has been perfectly fine. Plus, the flexibility in using smarter apps for SMS & the likes is a more than worthwhile tradeoff for the camera performance.

Down the memory lane with Digit

My tryst with the modern PCs started in the mid 90s when the internet was almost non existent in India. At the time, software and games were not easy to come by and magazines like Chip which have away trial versions and freeware in CDs along with their copies were quite sought after. Chip later became Digit in India but the freebies continued.

Digit magazine July 2019

It was with this thought that I attended the Digit Squad Tech Day in Mumbai today and it was fun to see all the colourful assembled desktops, consoles and mobile phones placed around the venue and fellow Digit Squad members participating enthusiastically in the different contests. Felt quite nostalgic to soak in the geeky environment.

Didn’t sit around idle of course and instead captured a few videos of the front camera fall detection in action for the smartphones on display. You can catch the video here.

OnePlus and Oppo seem to be catching on quite soon and they flash a dialog on screen while Samsung seems to be partially retracting their module. The Redmi K20 pro is similar in terms of responsiveness to Oppo and OnePlus but it closes the camera app instead of showing any alert. The Asus Zenfone 6z provides an interesting experience where you can see the arc on screen as the module rotates to its resting position.

And here are a few more shots from the event

First impressions of Spotify in India

The service launched yesterday in India in the midst of the Warner music conflict, but it seems to have a pretty decent catalogue in India. The recommendations engine is also top notch as I experienced it first hand by feeding in my preferred artists across different genres and it right away created a bunch of playlists with some of my favorite songs. Definitely the best experience of all the music streaming services so far for me.

I’m currently on the free tier which doesn’t lose out much other than the highest audio quality and offline storage. The ads are bearable for now. It also seems that Amazon is holding back with their Spotify support on the Echo line in India as seen in this mail from customer support.

The premium pricing is also in line with Apple Music though quite a bit more expensive than the Indian services like Wynk or Saavn. It also doesn’t seem to support in app purchases on iOS as evidenced below.

I’ll probably go for the premium subscription once the Echo support kicks in or I require the offline access. For now, happy with the free tier of Spotify and making do with Amazon Music on the Echo.

Amazon Echo Plus in India – first impressions


Got my first smart speaker, the Amazon Echo Plus yesterday and it seems to be nicely Indianised. It seems to be using the Raveena voice based on Indian English or a variant thereof from Amazon Polly (AWS’s text to speech service). The Alexa app itself is also pleasantly adapted for India with the appropriate command suggestions and services available.

Some of the India specific commands to try

I had pre-ordered the device and it was delivered within a day of the dispatch. The setup process was quite smooth and once done, I promptly went about installing a bunch of skills ranging from the utilitarian to the time pass ones.
As a music player, the sound quality is decent but nothing spectacular as many reviewers have noted. As for the music catalog, it seems to be using Saavn exclusively though it does Amazon music as one of the options in the app. Saavn itself has a decent catalog and Alexa has again been Indianised sufficiently to understand some Hindi song names. I  tried “Play the song ek main aur ek turn” and it actually started playing the song from Saavn though it did pronounce “main” the English way.

Alexa understands Hindi!

The flash briefing skill is quite handy to get a quick bulletin of your areas of interest once you have set it up with your desired sources. It can also give you cricket score updates without any skill installation as I tried out during today’s India – New Zealand match.


I installed the Uber and Ola skills to check the overall utility factor. While Alexa seems to be able to book an Uber including picking up your location, the payment mode defaults to cash which is a dealbreaker for me. Then there’s the Zomato skill I installed and tested. It seems to know your last 3-4 orders and you can reorder as well but didn’t go beyond browsing for the moment.

The alarms and timers work pretty well too and I conveniently set a sleep timer to stop playing the music while going to bed.

Then of course there’s the whole reason why I got the plus instead of the regular model which is the smart home hub built into the device. A solo Philips hue bulb is what I ordered next and setup today. It was again a pretty simple process with the Echo detecting the bulb in a few seconds. Controlling the bulb by voice is also quite easy right from switching it on and off to changing the colour and brightness. The app however has just the on/off switch and brightness control at the moment and as many reviewers have noted, the functionality of the smart devices using just the Echo Plus is considerably limited when compared to using the devices with their respective hubs. This is definitely one area of improvement and given the kind of coverage you see for smart homes on the Amazon Alexa pages, it should improve sooner rather than later.


Apart from all this you can also use the Echo as a Bluetooth speaker and pairing it with my iPhone was quite simple. That said, all the sounds from the phone start getting carried over to the speaker and this interrupts any song or speech playing on it directly. Due to this, I ended up keeping the phone disconnected unless I wanted to play something from my phone.

One thing I couldn’t find is the voice profiles option that lets Alexa identify the person speaking and customising the responses accordingly. Possibly a feature not yet rolled out to the Indian market as it seems to depend on the Amazon app that didn’t seem to have this option in my case.

A smart speaker is a family device but my wife is not very enthused by the idea while my 4 year old daughter would like to play with Alexa but hasn’t yet gotten out of her initial shyness phase to begin talking freely to her. It didn’t help that Alexa couldn’t answer many of her queries and also the fact that she was trying to get Alexa to identify the colours of the crayons she was holding in front of the device – a perfect case for Google Lens and Assistant.

This is of course just what I’ve been able to check out in the first 24 hours with the Echo Plus and I’m sure there’s lots more already available and also coming in the near future.

My iPhone Home Screen for 2016

20170101_083446000_ios

Last year turned out to have quite a lot of changes for my iPhone, thanks in parts to the entry of the 2 major video streaming services into India. That along with some amount of app rationalisation on my part due to the constraints of a 16 GB iPhone led to a bit of diversity on the home screen unlike the last two years.

I was also quite tempted by the iPhone 7 plus and its dual lens camera (not to mention the 128 GB storage tier) as a replacement for my iPhone 5s, but a change of battery a few months back gave it a new lease of life. Plus I got an Apple Watch a few months ago (review coming up hopefully) to replace my Pebble Time (turned out to be just a month before the Pebble sale to Fitbit).

Coming to the apps:

  • No change in the first row, but the second row see some major changes with the Reminders app being relegated to a separate screen. Todoist continues to feature on the second row thanks to its IFTTT & cross platform support, and is now augmented by the Apple Watch app that makes it easy to refer to reminders on the go.
  • Alarmed finally moves off the screen making way for Due that’s a very similar app and has an Apple Watch app. This turned out to be the major reason for the switch. While Alarmed did expose the notification actions on the Apple Watch, there was no way to add reminders or act on dismissed notifications. Due fully support adding reminders through the Apple Watch and also gives access to the timers on the wrist.
  • I got rid of Inbox and consolidated my Gmail account into the Outlook app, mainly due to the space constraints. But, it doesn’t hurt to have the emails and calendars consolidated into one app, and it supports the Apple Watch as well with a full fledged app and complication.
  • Whatsapp also swaps places with Outlook based on my more frequent usage of Whatsapp due to the introduction of voice calls last year.
  • Messages continues to stick around along with Day One though the usage of both has reduced over the year. There was also a new version of Day One launched with web and IFTTT support, but I am sticking to the original version for the time being.
  • While I continue to use One Note as my primary note taking app, I have found the performance of the app to be quite poor on both the iPhone and Mi 4, and finally moved it out of my home screen. The Apple Watch app is also quite handy though it is of limited utility for note taking on the wrist. An honorable mention for the Zoho Notebook app that is cross platform just like One Note and also supports the Apple Watch, but not IFTTT. It also allows you to make audio notes from the wrist.
  • My trio of travel apps – Google Maps, Uber and Ola – remain in the same places and my reliance on each of them remains unchanged as well. That said, the apps themselves have changed quite a bit over the last year with Uber undergoing a major rebranding exercise and a complete overhaul of their iOS app. Ola has also expanded its range of services over the last year.
  • Oura is one of the new entrants to the home screen and it is the companion app to the Oura ring that I got in May 2016. I use it through the day to track my activities, starting off with my sleep first thing in the morning.
  • Streaks continues to remain on the home screen and I have tweaked the activities that I’m tracking to make them more automated where possible like the ones that read data from the Health app for steps, sleep and weight. It again has an Apple Watch to make it easier to track habits.
  • Netflix and Amazon Video don’t need much of an introduction of course and 2016 saw the entry of both the services in India albeit at either end of the year. I even upgraded my data plan so that I could watch shows on the go. Here again, the 16 GB storage of my iPhone 5s prevents me from downloading any shows though both apps support offline videos. Good thing I have my Mi 4, but Netflix for some reason doesn’t allow downloads on itNetflix for some reason doesn’t allow downloads on it.
  • The Money Pro app also finally displaces the MoneyBook app for my finance tracking. The main advantage was the search feature, making it easier to track expenses. The Apple Watch app also helps in making quick entries. It has a macOS app as well along with iCloud sync support.

A few other apps that don’t feature on the home screen but get used regularly are PayTM (was using it long before the demonetisation), Workflow, Pedometer++, Data Counter and Copied (a clipboard manager with a keyboard and widget) some of which I use through widgets or the Watch apps.

Dangal – Parenting for the millennials

The movie is definitely fun and inspiring with wonderful performances from the entire cast. Aamir Khan is very unlike himself as a senior citizen in the movie for sure. It was quite interesting to watch the Disney logo at the start as well and the movie fits in nicely with their image.

There’s quite a bit of a lesson for parenting as well over here, especially for the millennials of my generation. There were some cinematic liberties taken with the overall story, with Geeta’s final match in real life being a practical walkover (1-0, 7-0), and the role of the NSA coach as well as there would’ve been a lack of tension in the movie otherwise. It also turns out that she apparently won a gold for India in the 2009 Commonwealth Wrestling Championships, so her record leading up to the CWG 2010 was not as disheartening as shown.

Babita’s performance was also downplayed in the movie overall as she has a pretty decent record herself. Of course, the person people actually remember from CWG 2010 was not even mentioned, but he made sure that he was making news right after the release of the movie. Either way, it was a stark reminder of the fact that pretty the majority of Indian sports (that are not cricket) victories are in spite of the system and not because of it. This possibly makes the movie more important than Lagaan.

Where Apple is aiming the puck

There weren’t too many surprises on the hardware front with the iPhone 7 release with the usual stream of supply chain leaks and rumours over the last few weeks leading up to the launch. The event pretty much reemphasized that the smartphone market, particularly the high end, has pretty much matured and Apple checked off the niggles over the entry level storage. Apple also broke a trend of sorts with the external design not changing considerably over the previous “s” year, another sign of a maturing market.

There was also a lot of clarity in their positioning of the Apple Watch with the focus shifting to health and fitness, while reducing the emphasis on communication (at least for the time being). It is going to be a while before the Apple Watch is able to turn into a standalone device. The new models in tandem with WatchOS 3 do address some of the performance concerns with the first model, but we’re still some time away from an always on display.

Apple also doubled down on their strengths with the focus on platform exclusives, 3D Touch and pushing the envelope on the camera capabilities. They have also increased the feature gap between the regular and Plus model this year with the camera having a tangible difference in addition to the screen and battery size, along with the increased RAM.

There was of course the loss of the headphone jack that many had predicted and the switch to a non clickable home button. The former is something that many of the Android phone makers have tried to preempt, while the latter is something a majority of the non-iPhone owners are used to. As for the A10 chip, it was a validation of ARM’s big.LITTLE architecture that has been in use by the Android market for over 3 years. Big jumps in performance usually come through node shrinks, and with Moore’s law slowing Apple has its task cut out.

Here are a few thoughts on where things seem to be headed based on Apple’s moves this year:

  • They have pretty much set their sights on the pro camera market with the support for wider colour gamuts on the sensor and display. Plus (pun intended) there’s the dual camera lens bringing back a viable telephoto lens to the smartphone market (sort of – 56mm is closer to normal focal length). People who were hurt with Windows Phone and Nokia’s (Lumia 1020) demise have a proper alternative at last.
  • It’ll be a while before the longer focal length on the iPhone attains the quality of the wider one, but this is just the beginning and we can expect iterations to happen pretty quick now that the ball has been set rolling by the most focussed company. Also, you don’t have to look any farther than this comparison of the original iPhone camera to the iPhone 7 to see what can be done in 10 years.
  • Again, on the photography front, with the Plus introducing a second lens, we get closer to the “holy trinity” of prime lenses which typically refers to a wide-normal-telephoto combination of lenses to cover a majority of shooting options. Technically we’ve got the wide and normal lengths covered. Of course, the iPhone is not going to be replacing DSLRs for specialised purposes (birding, low light action) anytime soon, but you know where we’re headed.
  • This dual lens camera also enables the journey towards computer vision thanks to the depth of field perception. What is today a sort of gimmicky feature previously tried by Android phone makers can potentially be the stepping stone towards AR.
  • Those Intel fab rumours that have been around for the last couple of years might finally be coming true next year.
  • The currently gimmicky, but increasingly exhibited feature of 3D Touch is most likely a stepping stone to a future where the display lets you actually feel the textures of items shown. This would take interaction to the new level and iOS 10 has finally opened up the current haptic engine to developers. Just take a look at Apple’s patents to get a feel (yes) of where things are headed. Maybe it’ll arrive as soon as next year when people expect the 10th anniversary iPhone to have an all display front. Accessibility has been one of Apple’s strengths and they also support Braille displays with their iOS devices. This expertise might just help them overall bringing out the really 3D in the touch. As to what kind of stuff is possible, check out Disney Research (guess which companies share board members?).

So, where does this leave me personally? Well, I just replaced my iPhone 5s battery and it should last me another year quite easily given that the performance has all but improved with iOS 10 (I doubt anyone with a 3 year old Android phone can say the same thing). The iPhone 7 Plus camera is really tempting me to give up my DSLR entirely (I really love shooting with my Canon 50mm f/1.8 prime lens which on a cropped body like the 550D gives an 80mm equivalent focal length), it’s just the first iteration and I find the 5.5″ size too big. Apple Pay has also not launched in India either, so I’m not missing any major feature with the 5s barring the screen size and camera (I do use a Mi 4 as well, so the screen size is even less of an issue). Then there’s the next year’s iPhone of course.

Retirement savings plan post Budget 2016

Looks like the best retirement planning that salaried employees can do given the intentions of the government to tax the EPF (or interest on EPF), is to shut down the PF before the new rules come into effect and move the balance to a tax free account in a Swiss Bank. Then all you have to do is open up a Swiss or EU company and invest in a made in India food business back home. Given some of the entrepreneurial friendly policies being introduced of late, this can only mean a secure future post retirement.

Jokes apart, it seems that this EPF taxation plan is the first step of a bigger plan that is not going to get discussed till the uproar over the issue dies down. This policy pretty much ensures that voluntary PF contributions are going to stop and that can only mean more disposable income in the hands of the salaried.

So, not only does this increase the funds for the Swachh Bharat and Agriculture schemes, but also for the increased service taxes. In the long term, this means that government has lesser interest to pay out due the lower voluntary PF contributions, plus some of that interest goes back to their kitty thanks to the taxes.