Assignment Statements, Comparisons & Observations
Font: Size: + -

China Trip

Tuesday, May 28, 2019

I recently went on a trip to China (Shanghai and Beijing) and Hong Kong for about 9 days in May 2019.

The trip was splendid. We were a group of 75 people led by our spiritual leader Swamiji Udit Chaitanya. Most of the devotees are senior citizens from Kerala. The weather was very pleasant. It drizzled for a few minutes one day only.

Language is a major barrier as most people there don't understand English properly - even at airports and train stations. I installed an app on my Android phone called Dear Translate that does translation (text and speech) from English to Chinese but couldn't do the other way around (for the Chinese people to use) as I could not locate an option to type in Chinese language on my phone which ironically is a Chinese make (Xiaomi, but bought in India).

Because most of us were vegetarians, we ended up at large (capacity for 75 people to be seated) Indian restaurants which had excellent North Indian food and one non-veg curry. Only for one particular day we went to a Chinese restaurant for vegetarian lunch that served Chinese cuisine which a lot liked but there were a few persons who still preferred Indian food.

As of now (2019), China's Internet has blocked Google's websites, Facebook, Instagram, Twitter, YouTube and WhatsApp. We need to use a VPN like Express VPN and install it on our phones before entering China. Google Play is also blocked so can't install it after entering into China. These restrictions are not there in Hong Kong though.

Even though China is more populous than India, it's not crowded in China like the way it is in India. The roads are all wide and all neat and clean 4-6 lanes like in the Western countries. Since the country is itself so vast, the cities are spacious.

Shanghai :

Mostly a financial city, we first went on an hour long cruise overlooking the city night life in the financial district which has skyscrapers.

Went on a ride on the Maglev train to and fro. It takes 7 minutes to cover 33 kilometers. It's top speed is 431 km/hour. This was really fantastic.

Traveled to Beijing via bullet train which covered the distance from Mumbai to Delhi in about 5 hours.

Beijing :

Unlike Shanghai, Beijing is a much much larger city which would take 6 hours to travel from one end to the other of the city.

We went for a Kung fu show by Chinese monks which was just amazing, though I can't tell if the performers were Shaolin monks or not.

We walked along the Great Wall of China. The steps are high so many elders couldn't climb. Apparently it would take 200 days to walk / climb the entire length of the Wall. Swamiji, myself and a few others (say about 10 of us) climbed up a few kilometers and returned the same way after sometime.

Hong Kong :

One half of the day (evening) we went sightseeing the night life.

Most spent the next and final whole day at Ocean's park which is like Singapore's Sentosa. But some 12 of us including myself cut short the Ocean Park after lunch and went shopping for the rest of the day.

Things you should buy in Beijing :

Buy as many headphones from Beijing as possible - you'll get wired headphones for 10 Yuan (Rs 50) and wireless bluetooth airpods (not Apple's) for about 100 - 150 Yuan (Rs 1500 or less). The smaller stores may not accept credit cards but I didn't check thoroughly.

Things you should buy in Hong Kong :

Shops in malls close at 6PM.

There is a street called Li Yuen street where there are numerous small shops where you can buy a variety of items. Mongkok has ladies market we were told where you can bargain like anything but we didn't have the time to go there since we were in Hong Kong for about one and a half days only.

Hong Kong has a famous electronic store in central called Fortress. Things are cheaper than in India, but I find that Indian credit cards have some cash back offer when using certain cards. This is not possible in Hong Kong. I saw an iPad Air 1TB version for $15,000 HKD which is about Rs 1.33 lakhs.

Web Hosting Solutions for Web Developers

Saturday, June 29, 2013

There are tons of hosting companies for web developers.
There are many that provide VPS-like solutions.
But there are a few good ones for developers wanting more than the standard LAMP setup and a Fantastico script.
Here we'll look at a handful of the ones that have proven to be good enough.


This is a semi-VPS where you can install your own tools / software as long as it resides in your home directory. Supports Python, Ruby, PHP out-of-the-box.
Plan starts at $9.50 a month for 100GB disk space.


A fully-fledged unmanaged VPS that has been in the hosting space for quite some time now. Developers normally compared Linode with Slicehost, another great unmanaged VPS before it got acquired by & merged with Rackspace.
Plan starts at $20 a month for 24GB disk space.


This is one of the best places to start out for newbies who want to full root-access at a low cost. Its an unmanaged VPS where you can setup your own Linux distro with whatever software you want. Oh - and it may offer the choice of a datacenter in India.
Plan starts at $5 a month for a 20GB SSD disk space.

Amazon AWS

A proven product, if you want scalability & reliability. Some of the major websites / services like Reddit, DropBox, FourSquare, Netflix, Zynga use Amazon AWS. Amazon AWS EC2 is the virtual dedicated hosting service.
Amazon AWS provides a plethora of other services like S3, etc.
You still need to maintain the server on your own - Amazon won't do it for you. Moreover you've got to have sys-admin skills to handle an EC2 instance.

Google App Engine

Google's servers ! That's the best part. Scalability. No worrying of backups, server maintanence, server going down etc etc.
What's the worst part ? It's not the standard setup you get with other providers which provide (S)FTP, SSH etc.
Configuration is done using a file named app.yaml. Everything else is almost custom based.
This is PaaS - Platform as a Service hosting solution and hence you can't go about installing your own software. Instead it provides a wide range of options and custom solutions. Currently Python, Java, Go and PHP are the languages supported.

Others :

Uploading gzipped content to Google Storage via gsutil

Thursday, January 17, 2013

Blogging this, since it doesn't fit on twitter.

It took me sometime to figure out the proper usage of gsutil when uploading files to google storage with the -z option to stream gzipped content. Just make sure to send in the content-type header too.

gsutil -h "Vary:Accept-Encoding" -h "Cache-Control:public,max-age=31536000" -h "Content-Type: text/javascript" cp -z js -a public-read script.min.js gs://[bucket]/script.js

How to upload a web-font to Google Cloud Storage and use it in your CSS

Wednesday, December 26, 2012

Replace [bucket] with your bucket name.

  1. Use fontsquirrel's @font-face Generator to download all the font formats required for various browsers.
  2. Upload the fonts to Google Storage :
    gsutil -h "Vary:Accept-Encoding" -h "Cache-Control:public,max-age=31536000" cp -a public-read font-webfont.eot gs://[bucket]/fonts/font-webfont.eot
    gsutil -h "Vary:Accept-Encoding" -h "Cache-Control:public,max-age=31536000" cp -a public-read font-webfont.woff gs://[bucket]/fonts/font-webfont.woff
    gsutil -h "Vary:Accept-Encoding" -h "Cache-Control:public,max-age=31536000" cp -a public-read font-webfont.ttf gs://[bucket]/fonts/font-webfont.ttf
    gsutil -h "Vary:Accept-Encoding" -h "Cache-Control:public,max-age=31536000" cp -a public-read font-webfont.svg gs://[bucket]/fonts/font-webfont.svg

    Now your font is accessible at http://[bucket] or http://[bucket] etc.

  3. Apply the code to your CSS.

    @font-face {
        font-family: 'fontFamilyName';
        src: url('http://[bucket]');
        src: url('http://[bucket]') format('embedded-opentype'),
             url('http://[bucket]') format('woff'),
             url('http://[bucket]') format('truetype'),
             url('http://[bucket]') format('svg');    
        font-weight: normal;
        font-style: normal;
  4. Unfortunately the last step is not enough to display the web-font on your website since the fonts need to be on the same domain as the website.

    In order to allow web-fonts to be hosted elsewhere, the location of the web-fonts must have a Access-Control-Allow-Origin header sent.

    For Google Storage, we do this :

    <?xml version="1.0" encoding="UTF-8"?>

    Save this as font.xml.
    Hmmm ... Google says :

    gsutil setcors <cors-xml-file> uri

    But using gsutil, we can set CORS to an entire bucket only and not to an object.

    gsutil setcors font.xml gs://[bucket]

    not uri as mentioned

    Similarily, for getcors :

    gsutil getcors gs://[bucket]
    and not
    gsutil getcors gs://cats/mycats.png

Solving all my permission issues on Ubuntu

Sunday, November 25, 2012

So many permission issues when copying files / folders from an outside source like a remove drive or Dropbox to my hard-disk that I have this mini-snippet to solve them all.

chmod -R 755 directory/
cd directory/
find -type f -exec chmod 644 {} \;
cd ..

Why I bought a Dropbox Pro account ?

Sunday, August 12, 2012

Last weekend was bad. My MacBook Pro's hard-drive crashed and my Ubuntu machine's hard-drive was semi-crashing, booting once in a while and once it booted with the entire file-system as read-only !

While my Ubuntu machine was up and running, I managed to backup all my data to Dropbox. But this time I backed it up in such a way that I don't have to 're-arrange' the folders all over again when my computer crashes.

Here's an example of what I did for my localhost (http://localhost/anjanesh) which, on the physical file system points to /home/anjanesh/www (~/www).

  • I copied all my data from ~/www to ~/Dropbox/www
  • Dropbox synced all the data in ~/Dropbox/www to the server
  • I deleted ~/www and symlinked www to ~/Dropbox/www (ln -s ~/Dropbox/www www)

So now ~/www points to ~/Dropbox/www
Whatever changes I make to ~/www gets stored, indexed and synced to Dropbox's server.

And now on my MacBook, I installed Dropbox and did the same thing with www - except point ~/www to /Users/anjanesh/Dropbox/www
This way, http://localhost/~anjanesh/ physically points to my Dropbox folder.

You can do this with all data folders, like Documents, Pictures and even Desktop. Even /var/lib/mysql to point all the mysql-data to a Dropbox sub-folder itself.

Open-Source Slideshare alternative

Sunday, February 05, 2012

There were 2 reasons for me to create an alternative to slidehsare's slide-show plugin :

  1. My uncle had a 170MB PPT file which is over-the-limit of Slideshare's 100MB size limit.
  2. My previous company's CEO wanted to display 6 slideshows on the company's homepage and 6 slideshare plugins was being extremely heavy esp on the flash part.

So I created a simple slide-show using jQuery as a jQuery plugin. There are some advantages as well as disadvantages.


  • This is completely customizable using CSS.
  • Flexible slide size
  • Unlimited slides


  • The slides are all images though, not HTML on the inside. Images would consume more space than HTML sildes.
  • You need to export the slides to images, which you can do using Open Office.
  • Require basic programming knowledge in HTML, CSS & JavaScript to embed this.

An example of this :

Usage :


The other options for effect are fade, flip and slide

This project is on github :

Linkedin's April Fool Hoaxes

Friday, April 01, 2011

Every year we want to know Google's april fools' hoaxes. This year was no different. But has anyone noticed linkedin ? This is what I found on linkedin from my People You May Know section.
Linkedin People You May Know
(Click on the image to view the full "resume")

Linkedin People You May Know Linkedin People You May Know Linkedin People You May Know

Google Agarbatti (Incense)

Monday, October 25, 2010

My friend Sudhir bought this from the local store.

google agarbatti

Read : Google Agarbatti. (Agarbatti = Incense)

Update : Thanks to Sumit Ashok Kesarkar for the clarification. its Gugal which means Guggul == made from the sap of the plant "Commiphora mukul"

Email Newsletter Subscription via GFC & GAE

Wednesday, July 28, 2010

There is one major limitation when sending out legit mass emails via SMTP ("compose") - a daily cap on the number of emails allowed to be sent from a mailbox. This applies to most e-mail service providers.
Google Apps Standard, the free edition, allows a maximum of 500 outgoing mails per day for each user id.
Even the Primier edition which costs $50 per user a year limits outgoing mails at 2000 per day for every email id.

There are two cost-effective ways to send out newsletter emails via Google's services - Google Friend Connect (GFC) and Google App Engine (GAE).

Google Friend Connect

subscribeA lot of people are not unaware of the fact that you can actually send out newsletters for free to your subscribers via Google Friend Connect (GFC).
The catch is that the users have to be susbcribed exclusively via Google's Subscribe button without which there is no way for the newsletter to reach the user.
This is really a tough catch as you got to have it's subscribe button right from launch date.
Its a major turnoff, especially when a website collects registration infomation via a form and sends the data to a database, after which emails are sent separately.
Most email marketing systems like aweber, mailchimp, emailbrain, constantcontact, madmimi etc have the option to add subscribers manually externally.
And with GFC, you would not be able to retrieve the subscribed users' email ids via the control panel - export gives only names, ids, open id urls and thumbnail images.
So, at a later point in time, if you decide to switch to another email marketing system, you would need to send one last email asking them to re-subscribe to a new system.
Another bad news is that the subscriber's email address must be an open id ! (google a/c, yahoo a/c, twitter, AIM, netlog or any other openid)
Looks like all bad news, but if you think from the users' perspective, this is a good deal.
Its secure since there is no way for emails to be leaked accidentally.
Its safe because there is no room for errors in accidentally sending out mails to users who have unsubscribed.
Regarding the sender / from email address - It would be the same as the google account username. So if you don't want it sent from, then create a google account under your app id. (This dual account chaos would be resolved soon : Google Apps Accounts Will Also Be Personal Google Accounts)
GFC is straigtforward, only bit of major work required is getting the audience to hit the google subscribe button.

Google App Engine

If you are not convinced with GFC then check out GAE - Google App Engine.
It has a daily free quota of sending emails to 2000 recipients. Link
After that, its billed at $0.0001 per recipient - thats just $1 for sending to an additional 10,000 recipients which can execute in about 2 minutes ! Link
But you've got to code to take advantage of GAE and your website should most probably be powered by GAE as well.

Google Groups

Then there is always google's mailing list at google groups.
But this cannot really be act a newsletter system.

If you want to submit ideas / suggestions to the Google team for its products, you can submit or vote at Google Product Ideas which is open to the public.