Skip to content

{ Category Archives } Programming

I see dead code

So I am trying to improve my approach to parsing. So I was adding this to a property called ledHelp: And I see the incredible similarity (it was copied and pasted) and that irritated me. As it should all good programmers. But I was having a hard time coming up with how to manage this. [...]

To $.each his own

In JavaScript, there is no iterator over arrays or objects. One has to do a for construct such as the one below. Notice how one has to declare all the variables with var to prevent global namespace pollution. And there is a lot of verbiage just to iterate over these objects. A better way can [...]

Tagged ,

Parsing

See a primitive working parser at http://mythiclogos.com/parsing/version01 Does arithmetic, does not handle ill-formed errors (missing “)” ) gracefully (does nothing actually–if you check in firebug, just gives warning). So I have spent the past week or so creating the foundations for a parser. And reacquainting myself with Javascript and jQuery. I love both the language [...]

HTML5

A new world is upon us. Already the web seems nearly magical in its many different uses, but within a year, this might look like the dark ages. As HTML5 takes hold, everything seems like it will be simpler. And Flash free! I have been reading HTML5 web programming on SafariOnline on my iPad. It [...]

Tagged

Star Wars and the Command Line

I am sitting here trying to avoid doing my work (?!!?!) and the thought occurred to me of the scene in the original Star Wars in which Vader is talking with some officers and one of them says something about being an adherent to an old religion. I feel that the command line and programming [...]

Cocoa Objects

Objective-C is a fairly straightforward language (main thing is to be aware of memory leaks for inline creation;usage;discard idioms that should be avoided or mitigated with autorelease pools). But there is a little of learning to do with the built in object types. For example NSArray (and mutable version) has to everything be an object. [...]

iPhone Dev

Working on getting into iPhone dev. Started it a couple of months ago and got distracted. Now I am back. Working through, chapter by chapter, Dudney and Adamson. I like it so far. It is a fairly neat development system (I have just been working with text editors up to now, so…) Essentially, you create [...]

Tagged

Object.create

In order to create objects nicely in JavaScript, Crockford suggests: if (typeof Object.create !== ‘function’) {Object.create = function () { // create a method of the universal objectfunction F() {} //create an empty functionF.prototype = o; //load the function’s prototype with the old object to inherit fromreturn new F(); //use that function to create a [...]

Tagged

Crockford videos

More Crockford videos. I haven’t laughed that good in a long time. One bit that was amusing is the following: return { ok : false}; This works well to return an object literal return{ ok: false};is a total failure. So go with the first form. Why does it fail? Well, the language inserts semicolons and [...]