Review of Hackers and Painters

Lately, I've been interviewing people for a technical position, While researching the topic of what makes a good programmer, I came across Paul Graham's 2004 book. This is my review of it. (more...)

Has it really been a year?

Wow! Time does fly. I've not blogged on my personal blog for more than a year!!!. My excuse is of course prosaic. I've been busy with work, some of which I hope to be able to talk about shortly. For today though the topic the revamp of this website. (more...)

The trouble with URL shorteners

Lately I've been spending some time thinking about URL shorteners. The interest arose over a recent weekend as I sent someone shortened URLs to a couple of sites, that I had bookmarked a few years ago. I'd inadvertently bookmarked the shortend links rather than the long URLs, and my reciepient complained that they couldn't read the content I'd sent them. Some investigation later, I realized that their mail system may have been blocking the URL. In addtion, one of my other shortened links had 'expired'. The short URL no longer worked. That sparked off a series of technical explorations that are now the subject of this and the next few blog posts to follow.(more...)

Fools Venture Where Angels Fear to Tread

My journey into entrepreneurship officially kicks off today. After nearly twenty years of employment, I've joined the ranks of the voluntarily unemployed. And April Fools Day seems like an oddly appropriate marker to start a new venture. After all, entrepreneurship requires a certain degree of foolhardiness with respect to resources not controlled. (more...)

Sampling from a Bivariate Normal Distribution

Most math libraries have a random number generator that generates samples from a normal distribution. Many libraries, like Apache Commons Math have random number generators that generate normally distributed scalar variables (i.e. samples from univariate normal distribution.) The task of generating random samples from a bivariate normal distribution, given a univariate normal random number generator is a little more complex. This is the subject of this post. (more...)

Series: Using Java applets and applications portably

Part 3: Creating applet launch buttons with CSS

Oracle's web applet deployment framework (deployJava.js) only allows the Web Start application button to be customized with an image. As described earlier, it doesn't provide a button based launch mechanism for applets at all. Ideally, one would like both applets and applications to be launched with CSS styled buttons (or even HTML5 button elements). The latter solution plays well with browsers and search engines. This is because CSS scales well and the text of the buttons can be easily indexed by a search engine. (more...)

Series: Using Java applets and applications portably

Part 2: Javascript techniques to control Java applet deployment

Oracle provides a convenience script called deployJava.js to handle differences in the way a Java applet is invoked across browsers. However, it automatically redirects the reader to Oracle's Java download site if the Java runtime is not installed on the reader's machine. As described in the previous article, this results in a poor experience for first time readers, as they are not given the opportunity to skim the page to decide if it's worth installing Java to see the applet run. If the running applet is not integral to the value of the page, it may often be unnecessary to actually run the applet on page load. This article describes how to use a modified Javascript launch framework that ovecomes this problem. (more...)

Use Modernizr to make HMTL5 render correctly on older browsers

HTML5 is a joy to work with compared to older versions, given the amount of visual and semantic control it gives authors of websites. However, as I realized while hacking up vepa.in, one of the problems with using it is that older browsers, especially Internet Explorer IE6, IE7, and IE8 don't support it. Enter Modernizr! Modernizr is the perfect solution to the problem of rendering a site developed in HTML5, correctly on older browsers.

Modernizr is a polyfiill. A polyfill is a piece of code, usually Javascript, also often a plugin, that provides technology not natively supported by a web browser. Modernizer allows older browsers to recoginize a wide variety of HTML5 features. And using it turned out to be extremely simple. (more...)

Why is if a special form in Scheme?

The if conditional is a special form in Scheme and Lisp. As an exercise question in SICP asks:

  1. Can if be implemented as a procedure that uses the cond special form?
  2. Is the if special form necessary in scheme, when the cond special form exists?
(more...)

Running MIT-Scheme programs as Unix scripts and via CGI

As a long time Unix user, I expect my scripting languages to be, well, scriptable!

On Unix and Unix-like systems (like Linux), the standard way to invoke a script is with the #! (shebang) notation on the first line of the script. Most modern scripting languages like Perl, Python and PHP treat # as the start of a comment that ends with the new line. This choice of comment delimiter is not accidental. It is chosen so that the first line in a script is treated as comment, as shown below:

#!/path/to/script/interpreter
code

In a twist that probably reflects a heritage that pre-dates the advent of Unix, Scheme uses semi-colons to denote start of a single line comments. So the #! trick doesn't work. Some implementations like Chez Scheme interpret the #! on the first line as the interpreter invocation and ignore it.

MIT-Scheme however is more puritan. It will only accept input when it is streamed from the input as in:

scheme < program.scm
(more...)

Tail Recursion is Looping

Lately, my thoughts and interests have swung towards functional programming languages.

As a way of reacquainting myself with the genre, I was reading through that venerable introductory programming text — The Structure and Interpretation of Computer Programs, when I came across this little snippet of code (It’s exercise 1.5 if you want to find it in the book):

  (define (p) (p))

At first glance the code snippet above seems a little weird. (more...)

I’m back!

After nearly a decade, I’m back on the web with my own site!

Although I’m active on social media, I needed a place on the Internet where I could showcase my experiments with technology, marketing and entrepreneurship. This is that place.

Do keep checking back for updates. I hope to be regular with them.