Full-Text Search in persistence.js

A while ago I released [persistence.js](https://zef.me/2774/persistence-js-an-asynchronous-javascript-orm-for-html5gears), a light-weight ORM for Javascript. It was built to use the [HTML5 SQLite database](http://dev.w3.org/html5/webdatabase/) that modern browser implement. I use it as part of [mobl](https://zef.me/3117/mobl-screencast-1-todo-application), but others have also started to use it for their own projects, e.g. on Palm Pre and [Nokia’s QML](http://doc.trolltech.org/4.7-snapshot/declarativeui.html). I spent some time addingContinue reading “Full-Text Search in persistence.js”

Javascript: the Scope Pitfall II

Hello, and welcome to the second part of [“Javascript: The Scope Pitfall”](https://zef.me/2843/javascript-the-scope-pitfall). Let’s get started, shall we? What does the following code print? ~~~~~~~~~var n = 0;function add() { var m = n + 1; print(m);}add();~~~~~~~~~ That was easy, right? The answer, of course is `1`, because `0 + 1 == 1`. Alright, a slight variation onContinue reading “Javascript: the Scope Pitfall II”

Code Generation and Vendor Lock-In

When you build a code generator you have two basic options: 1. Generate code to be read, complemented and possibly modified by humans2. Generate code purely as a convenient intermediate step toward bytecode/machine code compilation The first approach seems to be the most common. It is the most pragmatic option. “Hey, I keep writing theContinue reading “Code Generation and Vendor Lock-In”

Javascript: the new VBA

Somewhere at the end of the eighties, my dad started work at his [local university](http://www.rug.nl) where he became the [WordPerfect](http://en.wikipedia.org/wiki/WordPerfect) expert, which was the dominant word processor at the time. Beside acting as a helpdesk and laying out documents, he also spent a lot of time writing [WordPerfect macros](http://www.shkatz.com/macrotut/tofc.htm). WP’s macro language allowed you toContinue reading “Javascript: the new VBA”

10 Things You Hadn’t Expected HTML/Javascript Would Do

About 14–15 years ago my uncle took me to the university at which he was studying at the time. He had something to show me. He sat me behind a computer in the computer room and started a program called “Netscape”. He typed in an internet address ending with `.au`. I saw my first websiteContinue reading “10 Things You Hadn’t Expected HTML/Javascript Would Do”

Javascript: OOP Style Performance

I have been watching parts of [Douglas Crockford’s talks on the history and future of Javascript](http://yuiblog.com/crockford/). In his third talk Douglas talks about functions. If you are somewhat familiar with Javascript you know that functions are, somewhat oddly, used to create new objects. The original “intended” way (which Douglas calls the _pseudo-classical_ way) of doingContinue reading “Javascript: OOP Style Performance”

Javascript: A Language in Search of a Standard Library and Module System

Array Boolean Date Error EvalError Function Math Number Object RangeError ReferenceError RegExp String SyntaxError TypeError URIError Recognize that? Yes indeed, it’s the complete list of standard Javascript objects of Javascript 1.5. 16 objects, of which 7 are error objects. Of course, this is just the Javascript language by itself. In practice Javascript executes inside aContinue reading “Javascript: A Language in Search of a Standard Library and Module System”

On Language Design: Making Expensive Actions Hard

While abstraction is a great thing, some abstractions are completely unpredictable. For instance, object-relational mappers are very convenient to get started, but if performance is important these frameworks can get very unpredictable performance characteristics. Let’s take Hibernate as an example. Java does not support properties, instead there’s a convention of using getter and setter methodsContinue reading “On Language Design: Making Expensive Actions Hard”

persistence.js: An Asynchronous Javascript ORM for HTML5/Gears

The past week or two I have been developing an asynchronous object-relational mapper in Javascript, called persistence.js. Its main use-case, right now, is to simplify the database component of offline-capable web applications, like the mobile web applications that I’m working on. But with some tweaking it should also be usable in server-side applications, like node.jsContinue reading “persistence.js: An Asynchronous Javascript ORM for HTML5/Gears”