Read on and leave a comment
or return to our portfolio.

2 Feb 2007

by Noel

Functional Graphics = Fun!

Ezra blogs on something I’ve often thought. Wouldn’t it be cool ifProcessing had a better programming model. For better you should read: functional reactive. Imagine how easy it would be to code great animations. As he notes, it would make a good Master’s project, but it probably wouldn’t work as a PhD as I don’t think there is enough originality.

He closes with:

If I were just starting now on my PhD, I’d find a way to include this in my work, or I’d put off the PhD until I could get this done! Tinkering with graphics demos and slapping them up on the web is the kind of hacking I’d really like to be doing. As it is, I’ll have to leave it to some young whippersnapper, alas.

You mean a PhD isn’t about pursuing your own side projects? Why didn’t some one tell me! ‘sides Ezra, your PhD is really cool already. I don’t think it would be fair if you got all the toys.

Posted in Fun | Comments Off on Functional Graphics = Fun!

2 Feb 2007

by Noel

Simplicity at Work

Founders At Work is a collection of interviews with the founders of successful high-tech companies. They have two interviews online, one with Woz and one with Joel Spolsky.

Some good quotes:

All the best things that I did at Apple came from (a) not having money and (b) not having done it before, ever. Every single thing that we came out with that was really great, I’d never once done that thing in my life.

I think what makes a good hack is the observation that you can do without something that everybody else thinks you need. To me, the most elegant hack is when somebody says, “These 2,000 lines of code end up doing the same thing as those 2 lines of code would do. I know it seems complicated, but arithmetically it’s really the same.” When someone cuts through a lot of crap and says, “You know, it doesn’t really matter.”

There is a remarkable similarity to the two interviews. Both emphasize simplicity and working under constraints.

Posted in Business | Comments Off on Simplicity at Work

22 Jan 2007

by Noel

Large Scale Web Site Development

Two interesting case studies on large web sites: MySpace and EBay. They are remarkably similar. Or perhaps it should be unremarkable. You don’t get many chances to get that sort of system wrong, so it is natural that different groups should converge to tried and tested solutions. Ezra Kilty offers some thoughts on EBay and the great Goog, who of course have a system way different and way cooler than anyone else’s.

Posted in Web development | Comments Off on Large Scale Web Site Development

19 Jan 2007

by Noel

Flapjax in Action

In a few days we’ll be releasing our first code using Flapjax to drive the user interface. The core of the system is a grid view that runs in the browser. The user can edit data in place, and when they move to a new row changes are sent to the server. Invalid data is flagged in the grid, and mousing over shows the reason for the error. Given we’re probably the first people in the world to release commercial code using Flapjax a few notes on our experience are worthwhile.

The summary is: Flapjax worked very well for us. Flapjax code is much smaller and faster to write than the equivalent plain Javasscript, and Flapjax insulates you from most of the cross-browser issues. If your application revolves around events, and most Javscript applications do, Flapjax will probably be a good fit. However current Javascript implementations are so slow that they can limit how much you can take advantage of Flapjax.

Now, the details. We went through two design. Our first prototype rendered the TABLE that contained the grid data as one enormous Behaviour. Every field was an “edit in place” field, using more Flapjax code. (See here if you don’t know what an edit in place field is, though note that this isn’t the code we used.) This plays very nicely with the Flapjax model, as changes to any part grid automatically get updated in the browser. It worked fine for small tables, but scaled really badly; for large tables it was so slow to load and redraw that the browser would kill the script.

The main problem with our first prototype is that browsers are really slow at rendering elements inserted using the DOM. Our second design made two major changes to overcome these problems. First we dropped edit in place fields in favour of plain old INPUT elements, and then got the server to render the HTML instead of building the grid dynamically on the client side. So essentially we used Flapjax to handle events from the grid, but not to render the grid. This design is much faster; for example a grid with a thousand cells renders in about a second.

As with any new technology, the community still has to develop best practices and design patterns to make it easier to adopt Flapjax. The best design for error handling is still an open issue. Architectures for mixing OO and FRP (Flapjax) code are not well defined, though there is prior work. However we feel the benefit we got from Flapjax, in terms of shorter code and a faster development cycle, outweighed the cost.

Posted in Web development | Comments Off on Flapjax in Action

13 Dec 2006

by Noel

S3, SSL, and s3sync

S3 is Amazon’s rather awesome data storage service. I’ll just note that it makes a great way of backing up your data; if you want to know more read Matt’s excellent overview.

We ran into problems setting up s3sync on a client’s system. Specifically SSL didn’t work, with the handy error message SSL Error:. That’s right, we were told there was an error put s3syncwouldn’t tell us what the error was. We tried using wget which wasnice enough to tell us we had a certificate problem. An hour of Googling later and the solution was this:

  • Grab the CA Cert file (cacert.pem) from any one of the bazillion places on the Internet that mirror it.
  • Copy it to /usr/lib/ssl/certs/cert.pem
  • Set SSL_CERT_DIR and SSL_CERT_FILE to /usr/lib/ssl/certs/ and/usr/lib/ssl/certs/cert.pem respectively.
  • Nothing more to do!

I found the Lynx documentation the most useful. The OpenSSL documentation was much less helpful.

Posted in General | Comments Off on S3, SSL, and s3sync

15 Nov 2006

by Noel

Fix your Mac

If there is one downside to owning Apple hardware it’s the cost of repairs. I’ve just come across iFixit, which has excellent do-it-yourself guides to replacing all the major components in your Mac. Yay!

Posted in General | Comments Off on Fix your Mac

13 Nov 2006

by Noel

New Software, For You!

We released two bits of code a little while ago, both at
PLaneT:

  • A new minor version of <a
    href=”http://planet.plt-scheme.org/300/#schemeunit.plt”>SchemeUnit
    that adds a check-= form for comparing numbers
    within a specified tolerance, and fixes a few bugs.
  • A new add-on to SchemeUnit, called <a
    href=”http://planet.plt-scheme.org/300/#benchmark.plt”>Benchmark
    that, as the name suggests, adds forms for benchmarking
    code.

A simple example of using the Benchmark library:

Suppose you were benchmarking some functions that worked
on vectors of numbers, and you wanted to see if the SRFI-43
vector-map was faster than writing a loop by
hand. You can test this assumption using the
check-faster form:

(module test mzscheme

(require
(lib "vector-lib.ss" "srfi" "43")
(planet "test.ss" ("schematics" "schemeunit.plt" 2))
(planet "text-ui.ss" ("schematics" "schemeunit.plt" 2))
(planet "benchmark.ss" ("schematics" "benchmark.plt" 1)))

(define big-vector
(vector-unfold
(lambda (i x) (values i x))
1000
0))

(define check-map
(test-case
"Check vector-map is faster than hand-written loop"
(check-faster
(lambda ()
(vector-map - big-vector))
(lambda ()
(let loop ([vec (make-vector 1000)]
[idx 1000])
(if (zero? idx)
vec
(begin
(let ([idx (sub1 idx)])
(vector-set! vec idx (- (vector-ref big-vector idx)))
(loop vec idx)))))))))

(test/text-ui check-map)
)

On my computer the hand-written loop is a fraction faster
than vector-map, so if performance is essential
than the loop is to be preferred.

By formalising assumptions as tests you automatically get
notified when implementation changes render them invalid.
So if changes in the JIT compiler made
vector-map faster this test would fail and I
would know to rewrite my performance critical code.

Often it isn’t convenient to keep two versions of a
function around, perhaps because the implementation depends
on many modules. In this case it is useful to benchmark the
implementation against its past performance. You can do
this by creating a benchmark-case where you
would otherwise create a test-case. An example
is in order: Say you have a complicated function
foo and you want to ensure your optimisations
are making it faster. Then you simply write:

(benchmark-case
"foo benchmark 1"
(foo some-big-input))

The Benchmark library automatically saves performance
data and fails this test if foo becomes slower.
The name of the test case is important, as this is what
the Benchmark library uses to find historical data.

That’s it. As you can see the Benchmark library is quite simple, but I have found it very useful when optimising code. I hope you do as well!

Posted in Code | Comments Off on New Software, For You!

6 Nov 2006

by Noel

Does engineering/math/science education in suck?

Kathy Sierra asks why does engineering/math/science education in the US suck? Nice of her to limit that to the US. I guess we’re ok here in the UK. “Education sucks” is a meme that has a lot of mileage. We’ve posted along these lines before. I’m willing to accept that the average educational experience is only average, but so is the average student. I think the passionate will always be disappointed with those who don’t share their passion. I know I have been in my time at University, but on the flip side I’ve been a pretty poor student in some classes that I found boring. However, as an engineering/science graduate I must ask “where’s the evidence” in response to this claim. There is definitely something to be said about the issues of teaching and teaching standards, but I find this post too simplistic.

Posted in General | Comments Off on Does engineering/math/science education in suck?

6 Nov 2006

by Noel

Voting Systems: Theory Meets Practice

Suresh posts on tamper-proof voting systems. Why do you care? Apart from the application to democratic government, it’s a problem that all Internet companies that aggregate user behaviour (for example, social networking sites) face. Be sure to read the comments.

I love applying theory to real-world problems, if only because it justifies my over-education :)

Posted in General | Comments Off on Voting Systems: Theory Meets Practice

6 Nov 2006

by Noel

A Farewell to Alms

Tyler Cowen writes

The book is not yet out, but it is the best of its kind since Guns, Germs, and Steel.

The book in question is A Farewell to Alms, and 4 pages into the draft I’m hooked.

cp>Till a few days ago a full PDF draft was available online. This has been replaced with a few PDFs of individual chapters. The author tells me this was done at the request of the publisher, and he intends to put the first eight chapters online.

Posted in General | Comments Off on A Farewell to Alms