Archive for November, 2008

mozrepl is the most exciting firefox extension I have ever seen

Saturday, November 22nd, 2008

mozrepl seems astonishingly powerful.

Although I’m not currently developing in js,  I think mozrepl will be a game changer,  having a real repl with access to every nook and cranny of firefox is an amazingly powerful tool ,  It makes firebug irrelevant for me.

I never wanted to do any serious coding in the firebug repl,  not when I used vim as my everyday editor, not now when I use emacs as my everyday editor.   The problem with the firebug repl is multiline functions, it was utterly frustrating to write them the multi-line editor pane, from my memory had no easy way to e   .   Then once you did write a useful bit of code in firebug, you had to copy and paste that back into your text editor, almost completely defeating the purpose of writing it in the first place.  Not so with emacs, which gets repl interaction so right (vim never really tried).  Firefox is a great start for a tool,  it has saved me much time during debugging,  but it alway seemed innacessible to me.
On top of a clunky ui, firebug also only played in the web js playground.  You couldn’t fiddle with firebug itself via firebug.  try this in firebug

>>> console.log.toSource()
"(function anonymous() {return window.console.notifyFirebug(arguments, "log", "firebugAppendConsole");})"
>>> window.console.notifyFirebug.toSource()
"(function (objs, methodName, eventId) {var element = this.getFirebugElement();var event = document.createEvent("Events");event.initEvent(eventId, true, false);this.userObjects = [];for (var i = 0; i < objs.length; i++) {this.userObjects.push(objs[i]);}var length = this.userObjects.length;element.setAttribute("methodName", methodName);element.dispatchEvent(event);var result;if (element.getAttribute("retValueType") == "array") {result = [];}if (!result && this.userObjects.length == length + 1) {return this.userObjects[length];}for (var i = length; i < this.userObjects.length && result; i++) {result.push(this.userObjects[i]);}return result;})"

See those anonymous functions, it feels like you are oh so close to being able to change firebug's behaviour, but you can't really touch that code You can't access the variables because they are in closures.  This is actually much less opaque in 1.2.1 then it was in 1.0 or 1.1 (I can't remember which version I used to run.
MozRepl doesn't seem to suffer from those problems. You seem to be able to change anything in the browser, including the url, including which tab you have currently selected.   This opens up a whole new realm of possibilities for what you can do with your browser.

As a side note, on the moz-repl  wiki, for emacs integration it is recommend that you point your browser to  chrome://mozlab/content/mozrepl/javascript.el to get the javascript elisp file necesary for emacs integration.  The problem is, that with FF 3.0 at least, accessing that url gives a blank page.  to get to javascript.el you need to download the xpi file (firefox's extension format) and unzip it (xpis are compressed and packaged similar to apple dmgs).  Once you do that, you will be able to find javascript.el and other files.


to get to javascript.el and moz.el

first unzip mozrepl.xpi

then unzip chrome/mozrepl.jar

there you will find the two emacs files

Matt says that you can also download the files here

Open Sourcing chartWidget

Wednesday, November 19th, 2008

In 2007 I wrote a javascript charting package named chartWidget. I intended to pursue business oportunities with it, that didn’t work out (another post).

Take a look at the site.  You can view the javascript source, but it is obfuscated, I modified the YUI Compressor to munge global variables somewhat safely.
Anyway, I think I wrote some pretty cool code.  I’m not currently doing anything with it, and many friends have recommended that I open source it.  So I am thinking about it

I have questions

1. Which license to choose?  I’m leaning towards GPL, because it is still a bit hard to let go.   Which license puts me in the best position should someone want to use it (for me to possibly receive consulting fees)?
2.Should I include my whole subversion repository, about 700 revisions, I’m worried to do this, because it quite likely includes passwords ( I know bad practice)?  On the plus side including the whole repository could show thought patterns, to help other people debug the code
3.Will anyone care?  I guess I can find out by doing it.

4. My code is idiomatic to say the least, in some places wrong, and in many more places just hard to understand.  How much will this matter for me,  if someone looks at the code will they consider me an idiot?

5.What questions am I not asking that I should be?

python debug mode in emacs

Monday, November 17th, 2008

I was walking through some SQLAlchemy code last week and I used pdb, the python debugger for the first time.  It was a truly astonishing experience.  I have seen debuggers before, primarily in javascript and java , and they were helpful, and relatively easy to get started with, but there were annoyances there that I couldn’t easily correct.  Not so with pdb.

First with pdb, you seem to have all of the power of python available at your fingertips.

Second, pdb is all text, no need to use a mouse.

Third, pdb integrates with emacs very well.

Even with ropemacs, emacs is somewhat lacking for python integration, I’m getting more used to it, but it feels clunky (emacs freezes if you try to execute long running code and your not already running a shell).  pdb integration rocks though,  buffers for the appropriate files open as you step into functions, showing you  line number with a caret on the left hand side of the screen.

Next up (abbrev-mode) abbreviations for pdb-mode.  when stepping through the debugger, it is annoying to press “s RETURN”,  I think I will make an an abbreviaton tying “s” to “s RETURN” , just for pdb mode.

How I moved to New York City

Saturday, November 8th, 2008

In the Fall of 2006 I had left my first job after college.  I was living in Northern Virginia at the time doing consulting work.  With some free time on my hands I decided to drive up to the December New York to check out the New York Tech Meetup.  I walked into a large auditorium at Cooper Union and was instantly grinning, here were 400+ people listening to presenters talk about their new startups.  Nothing like this existed in DC.  After everyone had given their 5 minute speeches, a series of people were allowed to make 30 second announcements.  One person said that he would be teaching a class about web 2.0 applications next semester at Cooper Union and he requested help from people interested in contributing to the class.

After everyone was finished speaking there was a chance to mill around and talk to people.  I ran into the guy who spoke aobut the web 2.0 class.  His name was Sanford Dickert.  I said, “Hello, I’m Paddy and I’m interested in your web 2.0 class.  I have built large AJAX applications for Verisign and AOL”.  He said, “well I really have to go, but here is my card”.  I continued to enjoy the excitement of the city for the rest of the night.

A couple of weeks later I was in New York again and I met with Sanford.  I had been expecting to give a talk to his class about AJAX techniques.  I told him about my background, how I was interested in startups and building web applications.  He told me that the class would be different from traditional cs offerings,  more about the product design aspects of building a product than the theory or implementation details (students would be expected to provide those on their own).  I asked him, “How do you think I could be involved with this course?”, he replied “Well I could see you being a TA, but you don’t live in New York”.  I said, “I didn’t say I wouldn’t, I would just need to figure out how to get back and forth and where to stay”.  It ended up working out that Sanford offered me his couch one night a week until March, so that I could TA.

After talking it over with some people and wondering what I was getting into (no pay, a couch from a guy I really didn’t know) I accepted.  Sanford came through with his part of the deal and I  was TA for the class for the whole semester.  On March 1st I moved into my place in Brooklyn.  It was one of the best decisions I have ever made.  Because I was spending a lot of time with Sanford I was instantly tapped into the New York tech scene, he seemed to know everyone.

Paddy working in Sanford's class

Thank you Sanford.

Ani Difranco

Sunday, November 2nd, 2008

I had to listen to two cd’s worth of Ani Difranco in a car last week.  It’s like listening to someone try to sing a seizure