Thursday, 11 March 2010

ToneMatrix: A fun, simple music synthesizer

ToneMatrix (Flash-based): The pattern determines the sound.  Example pattern:

Right-click copy and paste let's you save compositions as text.

Examples abound in the reddit discussion.

I must try my kids on this ...

Wednesday, 10 March 2010

Harmony: A neat drawing tool in JavaScript

Flash-free graphics in the browser is getting easier to do, and snazzier:

Try it here. View the source to see the JavaScript.

Monday, 8 March 2010

mmmm ... CoffeeScript

The most commonly used programming language in the world today, certainly within the browse, JavaScript superficially resembles the Java programming language in its syntax, but at deeper levels it owes far more to lesser-known languages, such as Scheme and Self.

The Java part of the name and syntax apparently came about as a result of a decree from Marketing that Java was the next hot thing, and inventor Brendan Eich worked feverishly to swiftly put a Java-esque sheen over the top.  This, plus the cutesy name, helped mislead a lot of people for a lot years into thinking that it was a toy scripting language, and only with the more recent success of AJAX has its underlying power come to the fore.

And yet we are still burdened with the clunky syntax.

However, CoffeeScript promises to change that, with a new, lightweight syntax for JavaScript that owes a fair bit to Python and Ruby syntaxes, and a lot to experience with JavaScript.  An example:

# Uses a binary search algorithm to locate a value in the specified array.
binary_search: (items, value) ->
  start: 0
  stop: items.length - 1
  pivot: Math.floor((start + stop) / 2)
  while items[pivot] isnt value and start < stop
    # Adjust the search area.
    stop: pivot - 1 if value < items[pivot]
    start: pivot + 1 if value > items[pivot]
    # Recalculate the pivot.
    pivot: Math.floor((stop + start) / 2)
  # Make sure we've found the correct value.
  if items[pivot] is value then pivot else -1
# Test the function.
puts(2 is binary_search([10, 20, 30, 40, 50], 30))
puts(4 is binary_search([-97, 35, 67, 88, 1200], 1200))
puts(0 is binary_search([0, 45, 70], 0))
puts(-1 is binary_search([0, 45, 70], 10))

At time of writing CoffeeScript is only up to version 0.5.5, and syntax is not guaranteed to stabilize until 1.0, but IMO it's well worth a look.

P.S. A neat little blog post about CoffeeScript (with short examples) from Thomas Reynolds.

P.P.S. There are similar tools/nicer syntaxes for HTML (HAML), and CSS (Sass).

Tuesday, 2 March 2010

What makes a good entrepeneurial blog

In his good-bye to blogging article Joel Spolsky of Joel on Software fame paraphrases Kathy Sierra:
To really work, Sierra observed, an entrepreneur's blog has to be about something bigger than his or her company and his or her product. This sounds simple, but it isn't. It takes real discipline to not talk about yourself and your company. Blogging as a medium seems so personal, and often it is. But when you're using a blog to promote a business, that blog can't be about you, Sierra said. It has to be about your readers, who will, it's hoped, become your customers. It has to be about making them awesome.
Now, that's not the aim of this blog, which started off as a combo. semi-regular frustrated rant / the traditional idea of a web log (keeping a log of cool things the author found on the web) / cute things about my kids, but nonetheless I reckon it's spot-on.