quote: We are systematically creating races out of things that ought to be a journey 02 May, 2013 Comments

We are systematically creating races out of things that ought to be a journey.


Static Website on Google App Engine 10 Apr, 2013 Comments Static Website on Google App Engine

I've been experimenting with hosting static websites on Google App Engine(GAE) for a while now. One major deterrent to an otherwise straight forward procedure was the fact that GAE did not automatically serve index.html when encountering static folders. Now that I found this workaround on Stack Overflow, the static website is ready for GAE!

But there was another hurdle waiting.

GAE's instructions on using custom domain names for GAE hosted apps did not work. Specifically, Step 5 (Add New URL), failed with the following error: We are unable to process your request at this time. Please try again later. (Error #1000) After a bit of searching and experimenting, only this apparently silly technique actually worked. Along with naked domain redirection, this is now a static site, fully hosted on Google App Engine. Even though this runs off GAE, there are zero machine instances running. This can be verified in the app.yaml not relying on any executable script.

Update: GAE does not currently support custom 404 handlers. So, until then, back to Amazon S3 hosting.


Levenshtein Distance for Handling Redirects from Blogger 06 Apr, 2013 Comments Levenshtein Distance for Handling Redirects from Blogger

Here's a problem I've long faced and a neat use of Levenshtein Distance.

This website started off as a blog on blogger.com. Over time, it was migrated to a self hosted Wordpress site and now runs off a Jekyll generated, Amazon S3 hosted bucket.

However, since the blogger hosted site still got a lot of traffic from search, I did not take it down. I've always wanted to redirect the traffic to my new website, but Blogger apparently only features redirects in the other direction. While Webupd8.org has a solution, I could not get it working in this case. There were at least two problems that were in the way:

  • URL structure of the current website also includes the date of publication, in addition to the year and month.
  • while migrating to Jelyll, some of the URL 'slugs' also changed.
  • I did not want to host a server to do this; I had tried this and have moved on.

To deal with these two and also handle correct redirects automatically, here is my quick solution:

  • On the blogger.com hosted website, place a redirect to a special page to handle redirects from blogger (in this case, /blog/blogger-redirect.html).
  • This special page first detects the 'referer', then extracts the year, month and slug from the blogger URL. If the referer is not found, extract the query parameter from. This is a minor optimization in case referer is set (eg. with Google Chrome); one could simply always use the query parameter method (IE and Firefox seem to remove referer).
  • It then lists the URLs on the month-page (eg. /blog/YYYY/MM/) of this website, and computes the Levenshtein's distance between the blogger-slug from the blogger URL and the slugs from the month-page URLs.
  • If the minimum amongst the computed Levenshtein distances is less than 5, automatically redirect to the URL with that minimal Levenshtein distance (example).
  • If not, admit that we made a booboo and list all pages for that month, and additionally providing the search box (example).

Notes:

  • I am pretty sure this may affect the SEO ratings, but I am unsure how exactly that will be. So, if you use it, be cautious.
  • This solution needs Javascript to work, but has the advantage of not requiring any server backend.
  • I used this JavaScript implementation of Levenshtein's distance.
  • This is the source code for my solution.
  • Yes, the source code could do with some more optimization :/

Handling 404 Errors in Javascript 06 Feb, 2013 Comments Handling 404 Errors in Javascript

Migrating between hosting and blogging solutions can cause headaches. Now that I've moved to an Amazon S3 hosted static website, I needed an intelligent way to handle certain features like tags and categories that I had with the blogger.com and Wordpress hosted site, without the need to host a server.

JavaScript to the rescue!

  • I first identified the specific causes of problem using the crawl statistics from Google's Webmasters tool.
  • I then crafted JavaScript specifically tailored for these situations.
  • Put that into my 404.html.

This solution is specific to my use case, but you can get the idea.


Wonder without Googling 01 Jan, 2013 Comments Wonder without Googling

Great advice on so many levels. Happy New Year!

Wonder without googling.

-- Janell Burley Hofmann on Huffingon Post.




     
Original design for Tumblr crafted by Prashanth Kamalakanthan.
Adapted for Tumblr & Jekyll by Sai Charan. Customized theme available on Github.

Sai Charan's blog by Sai Charan is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
Creative Commons License