Friday, November 18, 2011

America's Cup World Series in San Diego - Streaming Live

Don't miss the America's Cup World Series in San Diego this weekend, also streaming live on the YouTube America's Cup channel!

My son was lucky to see them last week as they were already there, and he was in San Diego for the weekend for the Perry Junior Sailing regatta.

Here's a summary of today's semi-finals:

Tomorrow at 1PM PST the finals, Oracle Racing vs the Energy Team from France (Yay!) will be streamed live again.

Wednesday, November 16, 2011

Apache HTTP Server 2.3.15 released!

Back to blogging after a break from it as I was too busy the last few days... with some great news!

The Apache Software Foundation and the Apache HTTP Server Project have announced the release of Version 2.3.15-beta of the Apache HTTP Server (also known as "Apache" or "HTTPD"). This version is the 4th, and likely final, beta release before the general availability of the 2.4 release, with lots of interesting new features, described there.

The following will be particularly useful if you're using HTTPD server to run apps in the cloud:
  • Rate limiting and request timeout control, to protect your server against misbehaving clients;
  • Improvements to the HTTP proxy, in particular with clustering, load balancing, and failover;
  • A better multi-threaded processing module (called Event MPM) capable of handling more HTTP connections, typically kept alive and open between requests by Web browsers, with less threads;
  • Performance improvements, focusing on latency and request / response turnover.

So, with HTTPD 2.3.15 you get a more robust and faster HTTP server with load balancing for horizontal scaling in the cloud! I've been playing with the 2.3.* code for some time, and it has been working really well for me. It'll be great to finally get a 2.4 GA release with all these new cool features! Hopefully soon...

For more info, config examples and performance data, see this presentation from Jim Jagielski.

Saturday, October 29, 2011

Integrating Google Page Speed in your Web site build

Google Page Speed is a great tool to help analyze and optimize the performance of your Web pages. It's actually a family of tools:

- Page Speed Chrome and Firefox browser extensions complement Firebug and analyze the performance of your Web pages right from your Web browser.

- Page Speed Online analyzes the performance of your Web pages too without requiring a browser extension.

- Mod_pagespeed is an Apache HTTPD extension module that optimizes, rewrites and minifies your Web pages on the fly.

- The Page Speed Service is a proxy hosted by Google which optimizes and delivers your Web pages from Google's servers.

- The Page Speed SDK allows you to embed the Page Speed analyzers and optimizers in your own project.

If you're paranoid (don't want your Web site to depend on Google's Page Speed servers) and CPU + memory conscious (don't want to spend resources / $$$ running mod_pagespeed on your HTTP server) you can also run Page Speed on your pages ahead of time when you build your Web site.

It's pretty simple. Here's how I'm doing it on Linux using GNU Automake and Apache HTTPD (I'm sure that can be adapted to other environments):

1. Download and build the Page Speed SDK, like this:
curl -OL
cd page-speed-1.9
make builddir=$build/page-speed-1.9-bin

That'll build two useful command line tools: minify_html_bin, an HTML rewriter / minifier which also minifies inline CSS and Javascript, and jsmin_bin, a Javascript minifier which also works well for CSS.

2. Write the following in your Automake file:
minified = htdocs/index-min.html htdocs/foo-min.js htdocs/bar-min.css

sampledir = ${prefix}
nobase_dist_sample_DATA = ${minified}

SUFFIXES = -min.html -min.js -min.css
    ../page-speed-1.9-bin/minify_html_bin $< $@

    ../page-speed-1.9-bin/jsmin_min < $< > $@

    ../page-speed-1.9-bin/jsmin_min < $< > $@

CLEANFILES = ${minified}

I won't go into the Automake specifics now but these rules will run the Page Speed minifiers on your Javascript, CSS and HTML pages as part of your Make build. I'm using a simple naming convention for the minified files, index-min.html is the minified version of index.html.

3. Add a DirectoryIndex directive to your Apache HTTPD httpd.conf config file:
DirectoryIndex index-min.html index.html

That tells HTTPD to serve /index-min.html (the minified page) instead of the original /index.html page when a user points his browser to

4. Reference foo-min.js and bar-min.css in your HTML pages instead of foo.js or bar.css for example.

5. After making changes to your Web pages, build your site like this:

If you had /index.html, foo.js, and bar.css, you should now have /index-min.html, foo-min.js, bar-min.css, all nicely optimized, rewritten and minified by Page Speed.

To clean up the minified files, run:
make clean

That's it. That little trick should normally save you from 30% to 50% bandwidth, CPU, memory and disk space on the client devices that access your site (particularly useful with resource-constrained mobile devices) and on your HTTP server too (which now serves smaller files).

Hope this helps

Tuesday, October 25, 2011

Recursive Functions of Symbolic Expressions and their Computation by Machine

'Recursive Functions of Symbolic Expressions and their Computation by Machine' is the original paper on Lisp from John Mc Carthy. That paper appeared in Communications of the ACM in April 1960. It is a great short read.

John Mc Carthy passed away yesterday. After Steve Jobs and Dennis Ritchie earlier this month, October has been a sad month for the computing community...

Another good article from Paul Graham, 'The Roots of Lisp' helps explain John Mc Carthy's discoveries with Lisp.

If you don't know Lisp, you should learn it.

I had a brief look at it 15 years ago, but was too impatient and unexperimented to get the point then. I took more time to actually learn it on a summer vacation 2 years ago, then went on to learn Scheme (a Lisp dialect) as I was going through the Structure and Interpretation of Computer Programs classic Computer Science book from MIT.

Believe me. Lisp (or Scheme) will transform you into a different programmer. After that, even if you still have to program in C, C++, Python, or even Java, you're in a different world. You'll see programming through different eyes, and there will be no going back.

Think about a few fun facts... Pretty much everything you manipulate in Lisp is a list of values (Lisp stands for 'list processing'). Values can be numbers, strings, symbols or lists. Data and code are interchangeable and represented in the same way, as lists of values. You can write a Lisp interpreter in half a page of Lisp!

So, if you're working with 'modern' OO programming languages, scripting languages, or functional programming languages, if you're using XML dialects, JSON, DSLs, and you're still struggling to map between documents, data, objects, services, code and configuration... spend the time to learn Lisp. It'll open your eyes.

Thursday, October 20, 2011

Caching Images in a Mobile Web app

Another post on a technique to help make mobile Web apps work offline.

Last time I showed how to use XMLHttpRequest and local storage to download and cache Javascript scripts. Here I'm going to show how to download and cache an image, and then inject it dynamically into your HTML page.

That technique can be particularly useful to optimize an image intensive app (a game or a photo gallery app for example) and allow it to work offline.

First place base64-encoded (as defined in Internet RFC 3548) versions of your images on your Web server. On Mac OS X for example, convert foo.png to a base64-encoded foo.b64 file like this:
$ base64 -w 0 foo.png >foo.b64

Configure your Web server to serve .b64 files as text/plain. If you're using the Apache httpd 2.x Web server -- and if you're not using it, you should :) -- add the following to your httpd.conf server configuration file:
text/plain b64

The reason why we want to convert our images to base64-encoded is that it'll make it much easier to use them in the HTML5 app pages. We're getting to that part now.

Place the following Javascript script in your HTML page, under the <head> element for example:
<script type="text/javascript">
window.appcache = {};

// Get a resource
window.appcache.get = function(url) {
  var doc = localStorage.getItem(url);
  if (doc != null)
    return doc;
  var http = new XMLHttpRequest();"GET", url, false);
  if (http.status != 200)
    return null;
  localStorage.setItem(url, http.responseText);
  return http.responseText;

// Convert an image to a data: URL
window.appcache.img = function(url) {
  var b64 = window.appcache.get(url);
  return 'data:image/png;base64,' + b64;

I'm not showing the error handling code to keep it short, but you get the picture. The get(url) function downloads a resource and caches it in local storage. The img(url) function gets an image resource and converts it to a data: URL. A data: URL (as defined in Internet RFC 2397) allows you to include resource data (here our base64-encoded image data) immediately in the URL itself.

Now, later in your HTML page, say you have an <img/> element like this:
<img id="foo"/>

You can set the cached image into it dynamically, like this:
<script type="text/javascript">
var foo = document.getElementById('foo');
foo.src = window.appcache.img('/foo.b64');

The image src property will recognize the data: URL, the image/png;base64 media type at the beginning of the URL, and read the base64-encoded content as a PNG image.

That's it. With the little trick I've described here you should now be able to:
  • control the download of your images;
  • cache them in local storage for speed and working offline;
  • inject them dynamically into your HTML page as needed.

Hope this helps. In the next few days I'll show how to handle CSS style sheets in a similar way.

Sunday, October 16, 2011

Game Industry Forecast - Rapid Growth and a Changing Market

Interesting study and forecast on the game industry there, as Zynga is preparing for IPO and announced 10 new products this week.

The global game industry will generate $60 billions in revenue for 2011. It's not a surprise, but gaming is the only media business growing right now with a rapid growth driven by mobile games, as games are the leading apps on smartphones and tablets.

The game market seems to be changing rapidly from hardcore gamers (mostly teenage boys) to casual gamers with older households (35+yr old), and women (42% of the gamers now), as browsers and mobile are bringing new populations to casual and social games.

The game technical platforms are also shifting quickly to the Web browser. With technologies like HTML5, Canvas, SVG, and WebGL for example, Web browsers have become the most convenient platform for games, and it's now clear that games in browsers are the future. See this interview of the founder of Electronic Arts for more insight and his thoughts on what's happening.

Clearly, that means challenges ahead for the established game companies which have to adapt quickly. That also means great opportunities for new players to come and disrupt the mobile game market!!

Friday, October 14, 2011

PhoneGap / Apache Callback project accepted in the Apache Incubator

The vote to accept the Apache Callback project in the Apache Software Foundation Incubator was open for the last 72 hours, and that vote just passed earlier today.

Apache Callback is the free open source software evolution of the popular PhoneGap project.

Apache Callback is a platform for building native mobile applications using HTML, CSS and JavaScript. Apache Callback allows Web developers to natively target Apple iOS, Google Android, RIM BlackBerry, Microsoft Windows Phone 7, HP webOS, Nokia Symbian and Samsung Bada with a single codebase. The Callback APIs are based on open Web standards and enable access to native device capabilities, including the device camera, compass, accelerometer, microphone or address book for example, from HTML5 apps.

That's really great news for the mobile app developer community! ... and I'll be watching this project very closely in the next few months!

Dennis Ritchie: The Shoulders Steve Jobs Stood On

Dennis Ritchie: The Shoulders Steve Jobs Stood On.

Another great loss. Dennis Ritchie was the father of the C Programming Language and the UNIX operating system, which pretty much the entire Internet and computer industry run on.

I'm writing this on a Macbook Air running Mac OS X, a UNIX-based system, and programs mostly written in C.

His book "The C Programming Language" was my first Computer Science book. My first serious encounter with software was a 2-week job to teach the C language to a team of programmers. I was just trying to make enough money to go on vacation, but then I got hooked and decided that I wanted to be a C coder... Feeling sad today.

#include <stdio.h>

main() {
  printf("goodbye, world\n");

Thank You Sir. RIP.

Caching Javascript in a Mobile Web app

Earlier this week I promised I'd post a useful technique to reference, pre-fetch, and cache Javascripts, as a follow up to my review of an article on HTMLRocks describing HTML5 techniques for optimizing mobile Web performance.

So, here it goes.

The HTML5Rocks article showed how to follow all the links in a page and pre-fetch and cache their target pages in local storage. That was a good starting point, but for a mobile Web app to really work well offline you also need to fetch and cache the referenced JavaScripts, CSS, and images.

Here's how I do that in my apps.

I place the following utility Javascript at the top of my page under the <head> element:
<script type="text/javascript";gt;
window.appcache = {};

// Get a resource
window.appcache.get = function(url) {
  var doc = localStorage.getItem(url);
  if (doc != null)
    return doc;
  var http = new XMLHttpRequest();"GET", url, false);
  if (http.status != 200)
    return null;
  localStorage.setItem(url, http.responseText);
  return http.responseText;

// Load a script
window.appcache.script = function(url, parent) {
  var e = document.createElement('script');
  e.type = 'text/javascript';
  e.text = window.appcache.get(url);

I'm not showing the error handling code here to keep it short, but you get the picture. The get(url) function downloads a resource and caches it, and the script(url, parent) function gets a resource and creates a script element with it.

Then to reference a Javascript script later in my page, instead of writing the usual:
<script type="text/javascript" src="foo.js"></script>

I write this:
<script type="text/javascript">
window.appcache.script('foo.js', document.head);

If you're loading pages in an <iframe> nested inside a main page as suggested in the HTML5Rocks article, you don't need to repeat the utility script in all your pages. Just have it once in the main page, then in the nested pages just write:
<script type="text/javascript">
window.parent.appcache.script('foo.js', document.head);

Or just set the appcache property on your <iframe> like this:
var nested = document.createElement('iframe');
nested.contentWindow.appcache = window.appcache;

Then you can write the same code everywhere:
<script type="text/javascript">
window.appcache.script('foo.js', document.head);

Hope this helps.

To the folks who've pinged me several times this week asking for this tip: Sorry for the delay but I've been kinda busy... I'll show how to fetch and cache CSS (similar to Javascripts) and images (using a data: url and base64-encoded image content) in the next few posts, probably this weekend.

Sunday, October 9, 2011

Offline Mobile Web Apps - Really...

A few days ago I posted a review of an article on HTMLRocks describing HTML5 techniques for optimizing mobile Web performance, in particular a technique to pre-fetch and cache HTML pages and resources, useful to improve navigation performance and allow the mobile Web app to work offline.

In that review I said:
"What HTML5Rocks doesn't describe is how to fetch and cache all the resources referenced by these pages, like CSS style sheets, JavaScript scripts, or images, and that's a lot more work..."

and concluded:
"My 2c... The techniques described in that HTML5Rocks post are fine to get you started, but implementing them is not so simple. As usual, the devil is in the details."

Since then a number of folks have pinged me to challenge and ask:
"So, how do you fetch the referenced resources? and what are these details?"

Fair question :) I'm going to address it in a series of posts in the next few days. I'll also describe a few additional issues and tricks to make a mobile Web app really work offline, and some solutions with code snippets.

Here's a draft outline of the next few posts:
  • Referencing, fetching and caching Javascript scripts
  • Caching CSS stylesheets
  • Caching images
  • HTML5 W3C application cache vs a DIY cache
  • Monitoring your network connection

Stay tuned...

Friday, October 7, 2011

Google Summer of Code 2011 T-shirt - Thanks Google

Received my Google Summer of Code 2011 T-shirt gift from Google today, as I was a mentor for GSoC @ Apache this year again.

Hoping my students have received theirs too (that may take a little longer as they're in Sri-Lanka).

I hope you guys had a lot fun with your coding projects this summer. I enjoyed working with you! Keep up the good work, and look for opportunities to work on and learn from Open Source again!

Silicon Valley Code Camp 2011 - By Developers, for Developers

Silicon Valley Code Camp 2011 is this weekend in  Los Altos Hills.

The camp is free to attend, run by volunteers, with lots of great speakers and interesting sessions. It's also a great opportunity to network with fellow developers.

Here's my session selection:

HTML5 Game Programming - WebGL Edition
Build a mobile web app with Sencha Touch
Faster Mobile Anyone?
Kids Programming Workshop with Scratch
Hands on jQuery Mobile

AutoMobile: the Next Hot Platform for Mobile Linux
Create a Kinect Powered Personal Robot with Microsoft Robotics Developer Studio
The Ecosystem of Context (exploiting user context to go beyond search)
GPU Accelerated Databases using OpenCL

Thursday, October 6, 2011

HTML5 rocks the mobile Web

Great post about HTML5 techniques for mobile on 'HTML5Rocks'. Not sure I agree with everything it says though.

It describes three HTML5 techniques for optimizing mobile Web performance:
  1. For smooth native-feeling sliding and flipping page transitions, use a translate3d(0,0,0) CSS transform to force the phone's Graphics Processing Unint to kick in and perform hardware-accelerated page compositing.

    3D comes at a price though... Hardware acceleration can quickly drain your phone's battery, and some fonts won't look as nice when composited in 3D on the iPhone for example, so you better choose them carefully.

  2. Manually fetch HTML pages and cache them in HTML5 local storage to speed up page navigations and enable the app to work offline (as you have all your pages stored locally).

    What HTML5Rocks doesn't describe is how to fetch and cache all the resources referenced by these pages, like CSS style sheets, JavaScript scripts, or images, and that's a lot more work...

  3. Listen to the network online/offline events and detect the connection type (Ethernet, Wifi, 3G, Edge) using the navigator.connection.type property.

    Well, the online/offline events are useful but navigator.connection.type is not supported on the iPhone (only on Android), and you can't rely on it anyway as sometimes an overloaded public Wifi will get slower than 3G... What you really needed is a measure of the quality of the end to end network connection in terms of bandwidth and latency, and you can get that by instrumenting your usage of XMLHttpRequest in your client code as well as your server code.

My 2c... The techniques described in that HTML5Rocks post are fine to get you started, but implementing them is not so simple. As usual, the devil is in the details.

Wednesday, October 5, 2011

Stay Hungry. Stay Foolish.

'Stay Hungry. Stay Foolish.' And I have always wished that for myself. - Steve Jobs


Remembering Steve Jobs

Apple's Board of Directors - We are deeply saddened to announce that Steve Jobs passed away today.

Steve's brilliance, passion and energy were the source of countless innovations that enrich and improve all of our lives. The world is immeasurably better because of Steve.

His greatest love was for his wife, Laurene, and his family. Our hearts go out to them and to all who were touched by his extraordinary gifts.

Snow Report - 8 inches at el. 8200

8 inches of fresh snow at elevation 8200 feet today.

Counting down 49 days to opening day, Nov 23.

1st Snow Storm of the Season!

Wednesday - Winter Warning - 100% chance of snow in Squaw Valley & Alpine Meadows - accumulation 3 to 7 inches possible.

The ski season is just a few weeks away. I'm expecting some of my new ski gear to be delivered on Thursday. Hoping to try it soon!

Winter Warning forecast details below, from my NOAA favorite site.

Tuesday, October 4, 2011

DELETE FROM keynote WHERE name = 'marc'

Lots of entertainment @ OpenWorld 2011 with last minute keynote changes.

$ sqlplus
SQL> CONNECT larry/password@openworld:1521 as sysdba
SQL> DELETE FROM keynote WHERE speaker = 'marc'

Speeding up Web browsing on Mac OS X

A few days ago I showed how to configure a local DNS server on Mac OS X to help test locally hosted mobile apps.

You can also use that local DNS server to drastically improve Web browsing performance.

On complex Web pages DNS domain name lookups can introduce significant latency and slow down your Web browsing experience. A local DNS server cache (with minimum latency as it's local) connected to fast public DNS servers can eliminate that bottleneck and speed up Web browsing.

The good news is that it's really easy to set up.

After following the steps from my previous post, just edit your /etc/named.conf file, and insert the following inside the options { ... } section:
forwarders {;;
}; and are the Google public DNS servers.

That's it. Like magic, you now have a super fast local DNS caching server connected to the Google public DNS servers, which are also much faster than your average Internet Service Provider DNS servers or the Root Internet DNS servers used in the default Mac OS X DNS config.

Happy speedy browsing!

Monday, October 3, 2011

Parallel Programming in Haskell

Trying to relax after an unlucky day which started with a fender-bender... So, to take my mind away from today's unfortunate events I'm hacking some Haskell code tonight and playing around with the Haskell Par Monad.

I've been exploring various aspects of parallel programming for a while now, ranging from low level GPGPU (General-Purpose computation on Graphics Programming Units) using NVIDIA's CUDA and OpenCL to parallel functional programming using Haskell (also tried F#) and Monads like the Par Monad.

To understand the Par Monad, read the Parallel Haskell Tutorial presentation from last week's Commercial Users of Functional Programming conference, and try the tutorial code available on github there.

What fascinates me about the Par Monad is how it makes it so natural to bring typical Monad composition (watch this interview for a great intro to Monad composition) to a parallel program.

One day we'll be able to construct a parallel program as easily as assembling (think composing) Lego blocks (think logic components/blocks and Monads as connectors between them).

That day is not far away...

Saturday, October 1, 2011

Building Web APIs @ JavaOne 2011

I'm not presenting at JavaOne this year. I've been too busy at work (working on cloud integration and mobile) to focus on any conference presentations.

Last year Luciano Resende and I presented how to create composite apps out of components deployed on several cloud platforms using Apache open source software. See there for the slides and details.

This year Luciano and Raymond Feng will be giving a presentation on how to implement Web APIs, which should be really interesting!

Title: Building Flexible APIs for Web 2.x/Cloud Applications (25208)
Time: Monday, 12:30 PM
Location: Hilton San Francisco, Imperial Ballroom B

Using an open and simple API is a great way to build a developer ecosystem and grow a user base dramatically for Web 2.x (social/cloud/mobile) applications. But building flexible APIs can be a challenge. This session covers how to build a nice Web API from scratch, using open source stacks.

... and they've told me that they're going to show a great demo too!

Monday, September 26, 2011

A DNS server to test your mobile apps

Why would you want to set up an Internet Domain Name System server (DNS) on your laptop? Well, it can be handy to serve test domain names to your iPhone and test the mobile apps you're working on, or to use HTTPS on an insecure network with an TLS/SSL certificate you've created for your test domains.

DNS has a reputation to be tricky to set up, so I thought I'd share the steps to do it on Mac OS X. It's easy, when you know what to do.

Say you want to map the domain (an example test domain) and all the * sub-domains to IP address for example.

1) In a terminal window run the following commands:
sudo rndc-confgen -a -c /etc/rndc.key
to generate the rndc.key file as it's included by /etc/named.conf.
Named is the domain name server, rndc is the Mac OS name server control utility.

sudo launchctl load -w /System/Library/LaunchDaemons/org.isc.named.plist
to enable and start named.

2) Add the following to the /etc/named.conf file:
zone "" {
  type master;
  file "";

3) Create a /var/named/ file, containing this: 7200 IN SOA (
3 ; Serial
15 ; Refresh
3600 ; Retry
3000000 ; Expire 86400 ) ; TTL
IN MX 10
* IN A

4) Open your Mac OS System preferences, go to Network / Advanced / Dns and add to the top of the DNS servers list.

5) To test your new DNS settings try this:

6) On your iPhone go to Settings / your wifi network / DHCP and change the DNS field to your Mac OS system's IP address.

7) That's it! Now open in Safari on your iPhone. You should hit your mobile app running on

Hope this helps!

Saturday, August 27, 2011

Google Summer of Code 2011 - My students passed!

I've been mentoring two students in the Google Summer of Code program this year.

Nirmal's GSoC project was to develop a tool to generate SCA composite diagrams using SVG.

Eranda's project was to develop SCA datastore components using Apache Cassandra, CouchDB and Hadoop.

Both students just passed the final GSoC evaluations! They should be proud of what they've achieved this summer!

I hope we helped them learn a few things, and that they'll continue to be involved with open source in the future.

Tuesday, July 26, 2011

The Gang of Four would be Proud

Just came across this on reddit, which gave me a good laugh.

What is an AbstractSingletonProxyFactoryBean? I guess it gets crystal clear after reading this javadoc :)

I already knew that for some time, and I'm not blaming Spring in particular as they're better than most, but SomethingIsDefinitelyWrongInTheJavaDevelopmentCommunity...

Monday, June 27, 2011

I want a NYC app that...

Great initiative from New York City with NYCBigApps!

New York City is challenging the public to share what apps they want for residents, businesses, and visitors. After 8 days running the challenge there's already more than 300 app ideas! It's amazing to see all the app ideas that people come up with.

Imagine if creating these apps was as easy as blogging about them :)

Well, it shouldn't be too hard actually, with all the nice Web APIs that are available out there now for search, maps, location, photos, shopping etc.

Let's look at the very first app idea submitted to NYCBigApps:
I want a NYC app that shows me all music instrument stores in NYC.

That one is actually pretty easy:
  1. Get your location, say NYC.
  2. Do a Google map search for music stores around that location.
  3. Size the map to 320 pixels to fit nicely on your smartphone screen.

After about 5 mins fiddling with this, here we go! Looks like a simple app, just a map with markers, not very fancy, but does the job.

View Larger Map

Wouldn't it be great if we could make it so easy to create mini apps that the public could finally unleash their creativity, take control and make their own apps in minutes as ideas come up?

With HTML5 becoming easier to use and more mobile friendly, we're getting closer to that dream every day!

Wednesday, June 8, 2011

Meritocracy in Action: The Apache Membership Process

The Apache Software Foundation (ASF) will be holding its annual Members' meeting this July. Among the Foundation's business that takes place during this meeting is the election of new ASF Members.

ASF committers who demonstrate merit in the Foundation’s growth, evolution, and progress are nominated for ASF Membership by existing members and elected bi-annually.

The ASF just published the list of new Members elected at the January 2011 Members' meeting on its blog. That was 6 months ago but it's never too late to blog about it :).

I just discovered that blog today as people started to send me emails when they saw my name there...

It is a great honor for me to be in that list as a new -- well... 6 month old :) -- elected ASF Member!

For more info, see the complete list of ASF members, committers and how the ASF works.

Friday, June 3, 2011

Comparing the performance of C++, Java, Scala and Go

An interesting paper from Google comparing the performance of C++, Java, Scala and Go was presented at the 2011 Scala days.

Conclusion from the paper: "We find that in regards to performance, C++ wins out by a large margin. However, it also required the most extensive tuning efforts, many of which were done at a level of sophistication that would not be available to the average programmer."

And my 2c: If you care about performance, for example if you run in the cloud and memory footprint and CPU directly translate to dollars on your cloud monthly bill, if you like programming and are not afraid of spending energy to design and program efficient algorithms, then C++ is still your best bet.

Sure that requires a bit more thinking and perhaps more sophisticated programmers, but you get what you pay for.

And to all the folks who criticize C++ for being complicated, well... in my opinion it's as complicated as you want it to be. It's really up to you as a programmer to think and keep your code simple and, by the way, there's a lot of complicated Java and Scala code out there too :)

Thursday, May 26, 2011

Mod-security now available under Apache License v2.0

Great news! ModSecurity v2.6.0 is now available and that's the first release of this great Web firewall module for the Apache HTTP server available under the Apache License v2.0.

This move from the viral GPL License v2 to the Apache License should help further adoption and community development of ModSecurity.

The OWASP ModSecurity core rule set v2.2.0, a set of protection rules against most known Web attacks was also released today under the Apache License v2.0 as well.

More details on the ModSecurity blog.

Tuesday, January 25, 2011

Coding in the Cloud... Linux Shell in a Web Browser

The last few weeks I've been exploring how to use an iPad, tablet or netbook to write programs in the cloud with just a Web browser connected to my Linux servers.

I've played with the recent Web based source code editors from Google (Code Mirror), Mozilla (SkyWriter), and Eclipse (Orion). They're OK, but a source code editor is just not enough for me...

I also need a browser-based Linux shell window. There's some good ones out there. I've tried Ajaxterm (a little slow and not all keys worked), Anyterm (keyboard issues as well), and finally settled for Shellinabox.

Shellinabox gets pretty close to a real xterm. I've been using it for two days for various tasks including coding (with vi). I like it a lot! and am starting to think that vi in a shell in shellinabox compares favorably to these new fancy Web based editors...

I've patched it to allow a shell to set the browser title using a VT escape sequence in an environment variable (PS1='\\033]0; [\W]\007\\w \$ ' for example), like people usually do with xterms. 

The patch is there on my Github account. I find it useful to help distinguish Shellinabox browser windows and tabs and see what directory they're in.

If I find time, I'll post the steps I'm using to configure Shellinabox, build it and connect to it through a secure HTTPD reverse proxy... later this week.

Thursday, January 20, 2011

CLang completes support for C++0x variadic templates

The CLang project has just completed support for C++0x variadic templates (see [1], [2], [3]).

Pretty good news! CLang now compares well with GCC.

The CLang and underlying LLVM projects use liberal BSD, NCSA and MIT licenses compatible with the Apache 2.0 license (see [4]). That's better than GCC, GPL licensed and usable to build an Apache project but not embeddable in the project itself.

I've been thinking about using CLang in the Apache Tuscany C++ project for a while.

I'd like to use its API to convert SCA composites (XML docs describing SCA component assemblies) into C++0x templates and compile them into machine code on the fly, instead of having to interpret all the XML gorp at run-time.

Think of it like an 'SCA assembly JIT compiler'...

Benefits: ultimate speed, CPU and space, cloud resources (and resulting monthly bill) optimizations, and less XML parsing and interpretation code to worry about.

Requirement: support for C++0x variadic templates...

Patience may pay off after all, as it is finally there.

I gotta try that stuff this weekend!


Tuesday, January 18, 2011

Coding in the Cloud... Feels good like back to the 80's

I started programming on a VT100 terminal in 1980, with:
  • a white/black screen / 24 x 80 characters
  • no disk, data on a server
  • vi
  • assembly language + C on Unix
  • a few programming books
  • some deep thinking

I loved it!

Then, after a few detours through:
  • a dozen or so programming languages
  • fancy OSes on hi-res overheating laptops
  • 'integrated' development environments
  • 'code assist' (enough said)
  • no thinking (replaced by 'IDE' and 'code assist')

Recently I've gone back to a more productive environment:
  • 24 x 80 characters
  • vi
  • a few programming books
  • Web search
  • some deep thinking

I can think again!

But still missing that part:
  • no disk, data on a server, always on, accessible from anywhere

Then something cool happened today:

The Google Project Hosting team just announced the ability to edit programs directly in the Web browser using an online editor powered by CodeMirror. With Mozilla's SkyWriter, and Eclipse's Orion, that's one more way to edit code 'in the cloud' from a connected device.

That works well for me, as most of the programs I write these days run on servers 'in the cloud' anyway (say, big servers on a network instead of my laptop).

I've also been looking at the iPad as a programmer terminal and wondering about the upcoming iPad-2.

So, here's my future programming environment:
  • White/black screen / 24 x 80 characters
    How about an iPad-2, Google CR-48 or similar netbook and a single Web browser window with big fonts?

    I haven't been lucky enough to receive a CR-48, so I'm thinking about buying an iPad-2 out and hacking a programmer-friendly keyboard app for it.

  • No disk, data on a server
    Anybody say Cloud?

  • VI-like
    CodeMirror, SkyWriter, a hosted Orion server, or I'll just hack up a vi-like editor on top of one of these projects.

  • Assembly language + C Well, I have to use Java at work, but on my spare time I like to code some C, C++, Scheme, Lisp, Python or F#. Feels better. I haven't written assembly language for a while, but now that I think about it...

  • A few good programming books
    Receiving the new TAOCP-4a book tomorrow, and will probably spend a few nights reading it.

  • Web search
    Allow for a second browser window.

  • Some deep thinking
    Still thinking...

I already love it!

Hmmm, the new iPad-2's rumored fancy screen should be enough for some 24 x 80 coding, right?

Is IPad-2 the new VT100 terminal? :)

The postings on this site are my own and don’t necessarily represent positions, strategies or opinions of my employer IBM.