Tuesday, August 12, 2014

Cleaning Up Old Links

I recently started to clean up the http://www.lazyhacker.com website some parts of which I haven't touched in 10 to 15 years.  One of the pages that I was cleaning up with the utilities page that I had put together.

It was very interesting to see how much has changed (and in some cases how much haven't).  Some observations:

A number of the tools and programs that I linked to no longer exists, but a surprising number still do.  Mostly it was the commercial software that disappeared while community and open source stuff are still going strong.

The programming environment has sure changed a lot.  Back then, we tend to look for "utilities" that helped us with our work.  These days things are more on-line web applications and rather then small utilities it's more large applications.

Back then the major online programming resource was DejaNews (Usenet).  Software was obtained from FTP servers and now how many kids even know what FTP is?

We used to share code by zipping it up for download and now you have Github, Pastebin, etc.

EMACS and VIM.  Many will come and many will go, but these two always remain in the conversation.

One noticeable exception around commercial software was Microsoft.  Most of the Microsoft tools that I linked to were not only still alive, but Microsoft continue to make sure all the URLs to them still worked!  They actually do a better job then open source projects such as Fedora (moved from redhat.com to its own domain but no redirect from the old url to the new) and Jikes (IBM didn't redirect the old jikes page to its new domain).

I removed the Java related stuff since I don't do much Java anymore (not terribly sad about that), but I do wonder about the future of Java.  Perl has kind of faded from public view while C is always and will be C.  I haven't touched Scheme if forever!  I added a link to Go.

If I were to create a new page, I think the whole classification of things would be totally different with categories that wouldn't have been there 15 years ago and many of the old categories be unknown to the new programmer.

Monday, August 11, 2014

Books For Every Programmer's Shelf

Here are some books that I believe should be on every programmer’s bookshelf.
The C Programming Language, 2nd Edition” - By the creators of the C language, this concise book clearly teaches the foundations for the C language. For a more tutorial book on C, I would suggest “C Primer Plus”
Wiley’s Teach Yourself C++” by Al Stevens - My favorite book for learning C++.
Programming Pearls “ - A great collection of essays on programming including ways to approach programming problems.
Programming Perl” - The definitive book for the Perl language by the creator of the language.
The Art of Computer Programming, Volumes 1-4A Boxed Set” - This thick 4 volume set is a thick academic tomb of knowledge for computer science.
Software Tools” or “Software Tools in Pascal” - Writing software tools and utilities is a special discipline.
The Practice of Programming” - Easy to read text on programming practices.
Win32 Programming” by Brent E. Rector, Joseph M. Newcomer - While Petzold’s Programming Windows®, Fifth Edition is generally considered THE book on windows programming, I actually like this book better because of its more in-depth coverage of the topics.
Here are some books for the professional programmer that isn’t around coding.

Friday, August 1, 2014

Use Google Drive For Free Web Hosting on Custom Domains

Update:  Google Drive no longer offer the ability to serve web pages so this post is no longer relevant.

Google Drive allows a very convenient and free way host web pages.  You simply share the folder to the public and anyone can go to http://googledrive.com/host/<folder id> with their browser and see your web site.  Publishing a page or any file is just a matter of dropping it into the drive folder.  However, Drive currently doesn't support custom domains so if you have your own domain (e.g. example.com) you can't have http://www.example.com be served from Drive.

There is a site, http://gweb.io, that allows you to do this for about $10/year, but I've never used them or know much about them.  Instead, this article will describe one way to roll your own using Google App Engine (GAE) and if your site only have moderate traffic you should be able to stay within its free quota.  Note:  this was a quick hack I did and not meant to be a high performance web site.  Don't be running your own Google with this!  :-)

The basic idea is very simple.  GAE allows you to have custom domains so you create an app on it and it can map to your domain (e.g. http://www.example.com).  What the app will do is take the URL, translate it to the googledrive.com URL and fetch the page for you and return it through app engine.

With the mapping, use GAE's FetchURL service to grab the file and pass it back to the caller.  That's it.

Follow the GAE tutorial on setting up a basic helloworld app (such as this one for Go).  Instead of hello.go, I have file called "fetch.go" and instead of "package hello" it is "package fetch".  For the content of fetch.go:

Remember to put in your folder ID in fetch.go at line 20 (I should've made it a constant and easier to spot).

Now give it a try on your local server to make sure it works and then upload your project.  If everything is working well, you can them map this app to your domain.  That's it!

Now, this is not very optimized and only really recommended for small sites.  For example, this will fetch from googledrive on every request and the browser might not be able to cache it.  For the former, it would be easy to insert memcache to keep a cached version on the server side.  For the latter, we'd want to stick in some headers to help browsers cache the file unless the file is updated very frequently.

Anyway, with GAE's generous free quota, this might work well for many small sites out there to serve some examples web sites or landing pages.

One question we might ask ourselves is that why use Drive at all if you're using GAE already?  For me it was mainly convenience of being able to just drop the file into a drive folder and 'cause I just wanted to write some Go code on GAE.