Sparklines.js
20 August 2008
in links
tagged with
[javascript]
[processing]
[sparklines]
Javascript sparklines library. Looks pretty.
280slides.com
06 June 2008
in links
tagged with
[javascript]
[presentation]
[software]
[web]
An astonishingly good implementation of web-based presentation software. Very hard to believe it’s written in JavaScript.
Trivial iPhone / iPod Touch delicious front end
23 January 2008
in blog
tagged with
[ajax]
[delicious]
[iphone]
[ipod]
[javascript]
[software]
[touch]
I’ve been looking for an excuse to play with IUI for a while now, and finally I found one. I wanted a way of getting at things that I and my friends have saved in del.icio.us, and the native web interface isn’t very usable on the iPod touch. So let’s implement a delicious client using IUI! Also, let’s implement it in pure client-side JavaScript, so I don’t have to run a server anywhere!
So, here’s a trivial implementation. It’s hard-coded to look at my links and friends, but that’s not hard to fix, I just don’t care. The thing I’m happiest with is the way it’s entirely client-side, and pulls in things from the delicious JSON api as it needs them. And it’s pretty small, too..
jRails - jQuery on Rails
21 November 2007
in links
tagged with
[javascript]
[jquery]
[rails]
Makes all the Rails JS helpers work with jQuery, rather than prototype
IEBlog : Scripting Debugging in Internet Explorer
22 October 2007
in links
tagged with
[debug]
[internetexplorer]
[javascript]
Tools for debugging JS in internet explorer. They make it less unbearable.
RussellBeattie.com - Server Side JavaScript and the Universal Scripting Language
08 October 2007
in links
tagged with
[javascript]
[server]
REALLY GETTING ANNOYING NOW
http://www.russellbeattie.com/blog/server-side-javascript...
as days pass by » Blog Archive » DOMContentLoaded for IE, Safari, everything, without document.write
26 September 2007
in links
tagged with
[ajax]
[embed]
[html]
[javascript]
Useful snipped to fire an event once the DOM is loaded. Cross-browser and doesn’t need a large library.
New in Rhino 1.6R6 - MDC
01 August 2007
in links
tagged with
[javascript]
[release]
[rhino]
[strict]
oooh, strict mode for JavaScript. And Rhino is catching up with all the nifty SpiderMonkey stuff I like. Still no deconstructed assignment, though.
Optional catch in JavaScript
26 July 2007
in blog
tagged with
[exceptions]
[javascript]
[programming]
[rhino]
[spidermonkey]
One of the things that’s been annoying me about JavaScript recently is the inability to only catch certain classes of exception, as in Java or Python, for instance. The try {..} catch(e) {..} block has always seemed too inclusive. But recently Ash found a crazy syntax in SpiderMonkey that lets us only catch certain exceptions.
try {
// something that can throw
} catch(e if e.bar == 'foo') {
// an error is only caught here if it has a 'bar' property of 'foo'
} catch(e if e.bar == 'baz') {
// there can be different catches for different conditions
} catch (e) {
// otherwise it's caught here. Without this block, the error would fall
// through the 'try' and be re-thrown.
}
I haven’t bothered testing this in Internet Explorer (or any other web browser for that matter), because I’m only interested in server-side JavaScript execution at the moment. It works in at least recent SpiderMonkey CVS and Rhino 1.6r6, not sure about earlier versions.
helma.org » wiki » JavaScript Template Engine
26 July 2007
in links
tagged with
[helma]
[javascript]
[template]
Replacement templating engine for Helma - supports loops, assignment, various other logic constructs that the built-in system doesn’t. Not that trimpath doesn’t work too, of course.
[Helma-user] Rail-like URL Routing Script
26 July 2007
in links
tagged with
[helma]
[javascript]
[rails]
Rails-style routing for Helma. I find the default Helma URL dispatching very annoying - this is far better.
http://grazia.helma.at/pipermail/helma-user/2005-November...
del.icio.us/url/4f0ca933571745672c08c129c7d6e83e
26 July 2007
in links
tagged with
[javascript]
[server]
I guess I should delicious this, since I’m playing with it.
mod_js - Lightwieght server-side JavaScript for Apache
09 July 2007
in links
tagged with
[javascript]
[mod_js]
the ‘official’ mod_js page. Yay.
mod_js - a JavaScript Apache module
09 July 2007
in code
tagged with
[apache]
[javascript]
[programming]
[spidermonkey]
mod_js is an Apache module written by Ash Berlin and I that embeds the SpiderMonkey JavaScript engine and lets you run JavaScript code on the server as CGI scripts. As you’d expect, it’s very early, but is good enough to compile scripts, run the JavaScript, and print the output to the client. mod_js is licensed under the GPL3.
Server-side JavaScript under Apache
09 July 2007
in blog
tagged with
[apache]
[javascript]
[programming]
[spidermonkey]
Ash Berlin and I recently hacked together an Apache module that embeds the SpiderMonkey JavaScript engine and lets you run JavaScript code on the server as CGI scripts. We called it mod_js.
JavaScript UUID Class
30 March 2007
in links
tagged with
[javascript]
[uuid]
Generating UUIDs in pure javascript.
solutoire.com | Plotr
29 March 2007
in links
tagged with
[chart]
[graph]
[javascript]
javascript charting framework. Shiny.
Showdown - Markdown in Javascript
01 March 2007
in links
tagged with
[javascript]
[markdown]
ooooh, markdown in JavaScript. It works in Zimki, too, on the server side. Nifty.
Yet more E4X irritations
30 January 2007
in blog
tagged with
[javascript]
[programming]
I’m finding E4X to be one of those weird technologies that is alternately utterly wonderful and incredibly irritating. The ability to treat XML data as any other JavaScript data structure allows very fast app development and messing around, but every so often I find myself amazed at how awful the syntax is.
Today’s irritation is about E4X attributes.
// a perfectly normal E4X object.
var myXML = <xml foo="bar">content</xml>;
// the attribute with value 'bar'
var myAttribute = myXML.@foo;
Easy. I love this stuff. Unfortunately, Zimki, my company’s product, uses uneval to store complex objects, and the myAttribute variable there would count. uneval won’t produce JSON but it does produce a string that, when run through eval, will probably produce the original data structure, and we store that string in a database to store object.
Not so for E4X nodes. Playing in the SpiderMonkey JS console,
js> uneval( myXML );
<xml foo="bar">content</xml>
js> uneval( myAttribute );
bar
The first one is fine. That string will eval nicely back to the original E4X object. But the ‘bar’ there isn’t valid JavaScript - eval won’t restore the original object. In fact, had the original XML been something like:
<xml foo="delete_all_zimki_data()">bar</xml>
and we’d tried to use eval/uneval to store this XML, we’d have executed the attribute as JavaScript. Ick.
Unusually, Rhino handles this much better (normally I find Rhino lags in features..):
js> uneval( myAttribute );
<>bar</>
Not really an attribute node any more, but at least it’s valid JavaScript and won’t destroy my server.
I don’t even have a good solution for this. Right now I’m fudging E4X nodes in the storage engine, but I really feel that attribute nodes should uneval to something a little more sensible. Perhaps I’ll be able to produce a patch to SpiderMonkey, if I have time..
Vitamin Features » Create cross browser vector graphics
20 December 2006
in links
tagged with
[chart]
[graphics]
[javascript]
danwebb.net - A Low-down, Dirty Goblin Of A Hack
21 November 2006
in links
tagged with
[clever]
[evil]
[javascript]
ooooh, I like this. Steal methods from the array namespace and use them on the arguments object..
http://www.danwebb.net/2006/11/7/a-low-down-dirty-goblin-...
BookIntroduction - JotSpot Wiki (dojomanual)
06 October 2006
in links
tagged with
[ajax]
[dojo]
[javascript]
the Dojo book. I should look at it.
http://manual.dojotoolkit.org/WikiHome/DojoDotBook/BookIn...
DTrace meets JavaScript
21 September 2006
in links
tagged with
[debugging]
[dtrace]
[javascript]
Utterly nifty - DTrace embedded in JavaScript. Via dwilson
JavaScript Lint
20 September 2006
in links
tagged with
[javascript]
[lint]
[programming]
Check JS code for silly errors - missing trailing semicolons, etc, etc. A nice idea.
Burning Chrome: Design-By-Contract, Object Constructors, and Error Stacks in JavaScript
19 September 2006
in links
tagged with
[javascript]
[stack]
JavaScript Error object stack manipluation
Google Groups: mozilla.dev.tech.js-engine
07 August 2006
in links
tagged with
[javascript]
[rhino]
[spidermonkey]
This is, apparently, where the real mozilla spidermonkey/rhino mailing list lives, as opposed to merely the one linked from the ‘help’ page as being the official one. Nice.
http://groups.google.com/group/mozilla.dev.tech.js-engine...
RFC4627
30 July 2006
in links
tagged with
[javascript]
[json]
[rfc]
Horay! JSON is an RFC. I consider it a pity that they don’t require the escaping of non-ascii, given how useless people (and browsers) are at getting character sets right. But at least it talks about character sets at all.
Bluish Coder: Javascript continuation based webserver
20 July 2006
in links
tagged with
[development]
[java]
[javascript]
Utterly lovely. Java/Rhino based JavaScript-using server
http://www.bluishcoder.co.nz/2006/07/javascript-continuat...
Wiky: A Bidirectional Markup Converter
27 June 2006
in links
tagged with
[javascript]
[markup]
[wiki]
Recently I’m very interested in pure-javascript libraries for doing things. (especially those that don’t use the DOM). This one does wiki-like markup.
E4X - A native XML datatype for JavaScript
30 May 2006
in blog
tagged with
[javascript]
I gave a talk on E4X. In a Just and Decent world, I wouldn’t have to write a blog entry on this, because there would be a nice front page to jerakeen.org that listed all the recent things I’ve done, with the option to subscribe to RSS (or whatever) feeds of various subsets. But I’ve been too lazy to write this so far, so I’ll just link to it here until I get django to do what I want.
E4X is a lovely extension to JS (well, compared to messing with the DOM, and it’s in core, so embedded users get it too), despite its crazy inconsistent syntax and annoying brokeness in Firefox. Fortunately, I don’t have to care about web browser-based JS implementations, so I get to use it, and you don’t..
E4X
30 May 2006
in talks
tagged with
[javascript]
A talk I gave at the london javascript night in May 2006, on E4X, the native XML datatype for the JavaScript language.
phobos: Project Phobos
26 May 2006
in links
tagged with
[java]
[javascript]
[platform]
server-side javascript, running on a Java server
Ajaxian » Javascript Associative Arrays considered harmful
19 May 2006
in links
tagged with
[javascript]
On prototype, Arrays, and extending the prototypes of built-in objects.
http://ajaxian.com/archives/javascript-associative-arrays...
JavaScript strings - a followup
12 May 2006
in blog
tagged with
[javascript]
[programming]
Having played around with the JavaScript string type some more, I think I understand why it acts as it does. I’m a Perl monkey normally, so I’m not used to the concept of immutable strings, but JavaScript strings are immutable. Playing with the === operator (approximately, ‘is this the same object’) gives:
js> "a" === "a";
true
js> "a" + "b" === "ab";
true
js> "ab".replace(/./, "c") === "cb";
true
but
js> new String("a") === new String("a");
false
If strings were to magically upgrade themselves to objects, they’d change behaviour - previously equivalent strings would suddenly not be equivalent. Likewise, suppose this worked:
var a = "string";
var b = "string";
a === b; # true
a.foo = 1;
Shoud a still be equivalent to b? If not, a clearly isn’t immutable, as we’ve changed it. But if it is, then we’ve chanaged b at a distance - it’s grown a foo attribute.
Still all very annoying, of course, but I understand why now.
PlotKit - Javascript Chart Plotting | liquidx
02 May 2006
in links
tagged with
[charting]
[javascript]
Graphs. Pretty graphs, in fact. And client-side. Perfect.
JavaScript string weirdness
29 April 2006
in blog
tagged with
[javascript]
[programming]
Recently, I mentioned a peculiar difference between uneval and toSource. Specifically (using the SpiderMonkey JS console):
js> uneval("");
""
js> "".toSource();
(new String(""))
"" and new String("") are different types of objects. The first is the basic string type, and only really has a value. The second is a full Object, that happens to have a value. However, it turns out that if you treat a basic string type as an Object, say by putting ‘.’ after it in an expression, the SpiderMonkey runtime will implicitly promote the string to a String. Hence, "".toSource() promotes the string object, then calls toSource on the new String object.
Annoyingly, the String Object doesn’t hang around, it’ll get thrown away as soon as you’re done with it. This leads to the weird case that you can set attributes on a basic string type (because it’ll get promoted to an Object, and Objects have attributes) but they don’t stay set (because the Object you’ve set them on gets thrown away as soon as the set call finishes).
By the way, all of this applies very specifically to the current CVS trunk SpiderMonkey. I don’t know what most web browser engines do with strings, so don’t assume this applies in, say, Internet Explorer. But I’d be interested if someone wants to find out and tell me…
uneval() does not produce JSON
22 April 2006
in blog
tagged with
[javascript]
[programming]
More playing with JSON and Spidermonkey has revealed yet another incredibly annoying fact (I hate those guys). Spidermonkey provides a lovely uneval() function, that does the exact opposite of eval() - turns JS objects into strings. It works on almost everything, and make life very very nice. There’s also Object.toSource() which does something similar (but not the same - try uneval("") vs "".toSource()).
But the strings that uneval produce are not valid JSON, as I have been assuming. I’ve been getting steadily more worked up at all the JSON parsers in the world, refusing to parse things that are clearly valid JavaScript, and eventually I go look at the spec, which fails to list ' as a valid string delimiter. And guess what delimiter uneval produces? Yay. So all the parsers are fine, and it’s just SpiderMonkey that’s broken.
Fortunately, Mochikit provides a nice serializeJSON() function.
Simon Willison: Escaping regular expression characters in JavaScript
12 March 2006
in links
tagged with
[escape]
[expression]
[fishtodo]
[javascript]
[regular]
Regular Expressions: Methods - Doc JavaScript
06 March 2006
in links
tagged with
[expression]
[javascript]
[regular]
how to use javascript regular expressions. The bit I always have to look up
Prototype in scriptaculous wiki
21 February 2006
in links
tagged with
[documentation]
[javascript]
[prototype]
Google Desktop Sidebar Plug-In Creation Using Scripts
15 January 2006
in links
tagged with
[desktop]
[google]
[javascript]
[plugin]
from __future__ import * » Remote JSON - JSONP
06 December 2005
in links
tagged with
[javascript]
[security]
Particletree · Quick Guide to Prototype
30 November 2005
in links
tagged with
[development]
[javascript]
[programming]
[reference]
[web]
/IE7/overview/
30 November 2005
in links
tagged with
[browser]
[hack]
[internetexplorer]
[javascript]
TrimPath Forum / TrimPath Templates, a faster implementation.
23 November 2005
in links
tagged with
[javascript]
[template]
[trimpath]
Faster implementation of the trimpath templating engine.
TrimPath JavaScript Templates Demo
23 November 2005
in links
tagged with
[javascript]
[programming]
[template]
[web]
Javascript templating language. Completely insane.
Using prototype.js v1.3.1
06 November 2005
in links
tagged with
[developer]
[javascript]
[prototype]
A P R E S S . C O M : Foundations of Ajax
29 October 2005
in links
tagged with
[book]
[javascript]
[personal]
Rui liked this a lot
script.aculo.us documentation script.aculo.us Wiki
28 October 2005
in links
tagged with
[javascript]
[prototype]
a ⊘GUI efffects toolkit built on prototype.js
Really Simple History
23 October 2005
in links
tagged with
[back]
[browser]
[javascript]
magic AJAX browser history / working back button
http://codinginparadise.org/projects/dhtml_history/README...
«« Endoflow »»
19 October 2005
in links
tagged with
[browser]
[file]
[javascript]
Holy cow, this is gorgeous. I especially like the trick for permalinking
SpiderMonkey
18 October 2005
in links
tagged with
[embed]
[javascript]
[mozilla]
The Mozilla Spidermonkey javascript engine
further notes on JSON
16 October 2005
in blog
tagged with
[javascript]
[programming]
Off I go, making random unsubstantiated claims about the danger of using JSON with non-ASCII characters. This called for a Test. So I wrote one. Visit my JavaScript unicode test page and see how your browser interprets external JavaScript files - I serve an ‘é’ using JavaScript to the page via 3 methods and 2 character set encodings, and try to render them all.
My conclusions from some limited testing? Owch. You can’t include a JavaScript file and expect the client to interpret it properly, unless you control both the server serving the JavaScript and the HTML page requesting it, and can make sure that they’re both in the same character set. Alternatively, you can escape all non-ascii characters in your JavaScript files using the \xXX or \uXXXX notations, which seems to work everywhere I’ve tried, but also seems like a pathetic work-around. Anyway, needing a work-around for only the non-obvious case means that no-one will actually do it, because no-one ever seems to bother testing with non-ASCII (see any on the JSON examples page, for instance?).
However, requesting JSON using XMLHTTPRequest seems to do the Right Thing in every browser I’ve tested, including those that include JavaScript wrongly. So if you’re using JSON as an RPC transport, instead of XML, for instance, it looks safe. From a character-set point of view.
JSON Examples
16 October 2005
in links
tagged with
[javascript]
[unicode]
..and not a single non-ascii character on the page.
JSON
12 October 2005
in blog
tagged with
[javascript]
[programming]
In the bad old days of web 1.7ish, the cool thing to do for dynamic web applications was to generate HTML snippets on the server-side, pull them into your app using XMLHTTPRequest, and shove them bodily into a DIV on the page somewhere. “generating DOMs is hard” was the excuse, “the server already has a nice templating language”, etc, etc. And this was Good.
Nowadays, of course, this is Evil. Pulling HTML across the wire? It’s inefficient! Even worse,