Tuesday, February 28, 2006

Microchunks: short online media clips

Erik Schonfeld, writing in this month's Business 2.0, has a good take on both the commercialization and free distribution of short media clips using examples of Jon Stewart's CNN "hurting America" clip, etc. I have written before about my desire to see more "grass roots" media development since I am more than tired of what mainstream media offers up ('reality TV' - yuck!). Here are a few links that are worth checking out: Sundance Festival, iFilm, YouTube.com, and Google video.

I have been having lots of fun posting my pictures on Flickr and when I have time I have been thinking of "down editing" some of my video works to very short segments and decide on which public web portal to use.

Friday, February 24, 2006

Wonderful mix of functional and logic programming

I received the book The Reasoned Schemer last week. The authors use the same socratic teaching style (ask questions of the reader) that they used in the Little Schemer to introduce the implementation of logic programming using a functional programming style. I can just feel my brain twisting a little from new ways of thinking about old problems.

I mostly use object oriented programming (Java, Ruby, Smalltalk, and Common Lisp's CLOS) so it is healthy to switch to a functional programming style if only for research and learning projects. Anyway, this is an awesome book.

Sunday, February 19, 2006

Switching markwatson.com to Rails (with some Java)

I have been hosting markwatson.com for almost 10 years on the same server using just plain old HTML and a little PHP. It will take a while (I am super busy working on a Ruby book, and some consulting projects) but I am switching the site over to Apache 2.0x + FastCGI + Rails. I will eventually also be using some Java web services on another server for some live demos.

I have kept the structure of my site the same for years to avoid broken links, etc. I have decided to restructure my site, and to heck with broken links, etc. This is an easier decision to make now that many people navigate the web using search instead of bookmarks. I hate to break old links, and I will be a little careful, but change is good.

I really enjoy writing, and I have been thinking of doing more web content writing instead of distributing my free web books as PDF files. About 8 years ago, I experimented with an online Java/AI tutorial using a few Java applets for live examples. I don't use applets anymore, but with AJAX, etc., I can have some dynamic content as appropriate. Another advantage of having all of my web books live on my site instead of releasing PDF files is being able to sprinkle a few advertisements in them for some extra revenue. Ruby has a few good templating systems and I want to experiment with them to get a good fit for supporting separating content of web books from presentation and occasional random advertisement placements. In any case, I am in no hurry, so I can tinker with getting a flexible authoring and presentation setup.

European effort to compete with Google/Yahoo, and local open source advocacy

France and Germany want to compete locally with Google and Yahoo which makes sense. Setting aside hype about web 2.x, internet bubbles, etc. I think that we can agree that the future prosperity of any country depends strongly on home-grown technology, a great educational system, and a (relatively) honest government to promote commerce and free trade with fair laws that balance public and business interests. (Huge and economically inefficient military superpowers are so 19th and 20th century. I hope that economic superpowers will be our future: economic efficiency making militaristic inefficiency irrelevant. Economic superpowers do not, by my definition, necessarily have to be large countries or corporations: I am talking about the efficiency and wealth generated per person.)

Every time I hear about a country starting a national program adopting Open Source, I also think that they are doing the right thing for long term economic and technical power. Really, what country should depend strongly on proprietary software written and owned by a company in a foreign country? I expect to see hardware and network costs go down (both better power efficiency and purchase price) and software to become a commodity - but software services as a business will grow. The only thing that I see as a possible problem for my rather optimistic outlook on the IT industry is last ditch efforts by a few corporations and corrupt governments to enforce a general lack of social and business freedom through DRM and hardware devices that might keep businesses and organizations from getting maximum economic utility from the computer equipment that they own.

I believe that countries that do not honestly promote business and free enterprise while protecting public interests will simply be "routed around" (in the internet sense :-) and will fall by the economic roadside.

Thursday, February 16, 2006

Mongrel: interesting alternative to WEBrick

You can download Mongrel here. This is a project by Zed Shaw that is interesting: like WEBrick, but with some low level C code and considerably better performance running servlets.

While I think that Rails is great stuff, my interest in Ruby is driven more by the Ruby language itself. I am working on an Enterprise Ruby book right now and only about 20% of the book is about Rails and the rest covers 'Ruby coolness' in general. I continue to be amazed at how quickly non-trivial programs can be written and debugged in Ruby.

Anyway, good job Zed - I really like WEBrick because it is light weight and an simple platform to program to for all sorts of services and Mongrel looks like another tool that I will use a lot.

Sunday, February 12, 2006

Ruby duck typing

Old habits die hard. I am writing a set of Ruby classes for handling a variety of document types and my first inclination was to start to design a class hierarchy to factor out common behavior for processing different document types. Specifically, I am handling Word, OpenOffice.org and AbiWord documents. After a little thought I realized that the only common behavior is uncompressing and reading XML files for OpenOffice.org and AbiWord. Also, I only need one public method for my application: given a file path to a document return the plain text from the document.

Anyway, I will start with writing 3 unrelated classes - one for each document type. They will all implement one method signature for retrieving plain text for a document file. I am likely to eventually factor out some common code for processing OpenOffice.org and AbiWord documents, but I can put off that decision (it is better to refactor after you understand a problem better).

Friday, February 10, 2006

Life, New Google Desktop and Netflix

I have been even more into work and writing lately because of my shoulder separation (it has popped out twice in 8 days - ouch). I usually divide my time equally between friends and family, work, and wilderness hiking. Being sidelined from hiking for a while, I am depending more on social activities and work to keep life interesting.

I have been following the EFF's and other warnings about activating the multi-PC search and file sharing for Google Desktop version 3. If Google supported this functionality also on Linux and OS X (not just Windows) I would absolutely use it for my own stuff (book projects, free web books, design and implementation artifacts for open source and my own fun programming projects and research, etc.) but never for directories containing customer projects. I think that Google will likely support some features of the Google Desktop on Linux and OS X - and when they do sure I will enable saving my stuff on their servers.

Netflix has been getting some negative press for "throttling" (slowing down deliveries to customers who get many movies a month) but I think that they provide a great service for a small fee. Not only do I only pay a dollar or two per DVD, but I save lots of time not visiting the video store. So, they save me money and time. With Netflix and being able to purchase movies and TV shows from the iTunes stores (and from Google Video when they support OS X) I almost feel like canceling cable service (which I think provides poor value).

Sunday, February 05, 2006

Apache vs. lighttpd vs. WEBrick

While Apache has the advantage of coming pre-installed on leased servers and virtual servers, I am way more enthusiastic about using lighttpd as the front end for Rails applications. For one thing, all you need to do is install the Perl Compatible Regular Expression and then lighttpd, and then Rails will automatically and painlessly use lighttpd in development mode. Installing lighttpd and Rails in production mode is also easier than dealing with Apache (here are good directions).

Although what I am going to say next goes against common Rails wisdom, I would also like to add that it sometimes makes sense to deploy in production mode with WEBrick. Here are a few application specific details that might make you decide, at least for a long while, to just use WEBrick:
  • You need your web application to run in a very low memory environment (like a virtual server with a very small amount of allocated memory)
  • You expect a small number of concurrent users
  • Most content is dynamically generated
If I run a small web application in production mode on WEBrick + Rails it takes about 22MB. If I run the same web application using lighttpd + Rails (using two FCGI processes), I use a total of about 60 MB, but obviously with better performance. (This is a moot point for me because I lease two virtual servers with 192MB and 224 MB of allocated physical memory.)

For a lot of reasons I like to not use a shared server (i.e., share Apache, get a unique port for Rails, etc.): ability to customize the OS, what services to run, choose lighttpd instead of Apache, secondary uses like backup and subversion services, etc. It has been my experience that I get better service (automated backups, restarts after hardware replacements, etc.) using Xen based virtual servers rather than cheap leased servers. You can also usually buy just what you need and reconfigure as needed; one scenario is setting up a low volume web portal using WEBrick + Rails and an inexpensive low memory virtual server. If necessary for either reducing server latency or handling many more concurrent users, just order more allocated memory and switch to using lighttpd + Rails with very little trouble.

I have not tried SwitchTower yet, but the documentation looks good and I am looking forward to trying it out.

Friday, February 03, 2006

My hiking accident, virtualization, and DRM

Wow, three subjects in one blog entry, such a deal. As those of you who are my friends know, I took a nasty fall hiking back down a local mountain yesterday. Scary at first because I had no feeling for 20 minutes in my right arm - then the feeling came back, and the pain was manageable, and I started counting my blessings that I got away with a bit of carelessness. Things were OK for about 2 hours, but then my right shoulder popped out (dislocated), and it hurt like a bitch until I got it popped back in. My wife then insisted on taking me to the hospital ER last night - probably a good thing because they put me on pain medication so I slept well. Anyway, I hope that this does not slow down my work finishing up my new Ruby and Ruby on Rails book (and a few consulting jobs I have right now).

Slashdot had a pretty good discussion on virtualization today. I have used virtualization tools for years to cut down development and testing costs, mostly being able to have a collection of prepared OS images with specific software and environments set up; clone/copy an image, do the work then toss the copy. Huge time saver. I also have been indirectly taking advantage of Xen by using the excellent services at rimuhosting.com. Hosting providers can offer services like backup and general maintenance much less expensively when several virtual OS instances are on one maxed-out server. I used to set up my own and customer systems on leased servers at places like server beach and 1and1 but for many applications a Xen hosted virtual OS (backed by great service) makes more sense.

Linus Torvalds has come out against the draft GPL v3's anti-DRM position. I must say that I agree with him. I look at open source and free software as being tools for effectively doing business (and to have fun with :-) and I think that GPL v2, BSD, MIT, etc. licenses are all business friendly in their own ways. Also, not everything needs to be "free" (both in FSF and 'beer' word usages). As far as I care, things that are not business/work related (like buying music, renting/buying video and interesting things to read) can be DRMed if that makes the content owner's happy. Other technologies like 'trusted computing' hardware make me extremely nervous because they might get it the way of doing business: hamper the use of Linux, interfere with the use of virtualization, etc.

Thursday, February 02, 2006

Glad that Google is supporting the Mac with GMail notifier and Google Earth

I am just about back to using a Mac full-time as my desktop (but with a Linux test server in my office closet and 2 leased Linux hosted servers). Google's Mac support is greatly appreciated.

Speaking of Mac support, I must admit a bit of hipocracy: I complained to Microsoft this week about their live.com portal not working with Safari and then remembered that I don't (yet) support Safari on my KBdocs.com web portal. Note to self... Anyway, I have been getting into spending real test/try-it-out time on all the major new web portals - I like to see where the big players are going, maybe get some ideas, etc.