Archive for the ‘Webdork’ Category

Updates in the world of Morgan

Wednesday, September 3rd, 2008

With the major exception of USPS, Deutsche Post and DHL’s combined effort to loose my laptop, things are going great. I have been in Berlin for about three weeks now, landed an exciting new programming contract, looking like I found a rather cheap room to rent.

So what have I been up to….. Since I do not have my regular laptop, the programming lad been kinda limited. I am working on my ASUS EEEpc (which I finally fixed) which has been, well, a bit of a pain in the ass. But surprisingly I have gotten used to it. But I have also gotten a new laptop (free too). So tomorrow I will be back to it, getting some really work done on a full sized screen. But I still have been working on some interesting stuff. For the new job, I have spent the last day familiarizing myself with the code already in place and doing a huge amount of cleanup. A lot of redundant code, good practices used in the wrong way, bad practices making things worse. But not too bad all in all. I have also been playing a lot with V8 which I am super excited about. While I am not the best C++ programmer, I am a terrible Java programmer. So this is a great alternative to Rhino. And that’s not entirely true, I can guess and stumble through Java as well as C++, but Java’s build environment leaves me totally befuddled. I have also been playing around with FUSE again, and decided why not combined the two? So I made JsFS (I’ll post about this again later), but basically it create a jsin and jsout file, put Javascript into jsin and it is executed by V8 and the results are in jsout. Pretty useless yeah, but it was fun to make. I figure in the end I could make a Javascript interface for FUSE.
Bike News! I rode to Copenhagen two weeks ago. Well most of the way. Weather was not very cooperative and my friend I was riding with got injured to we ended up riding about half of it while hoping on and off trains. I am putting together a better mini-touring setup and will be riding to Geneva in about two weeks to race in the Swiss Bike Messengers Championship.
Also posted some pictures. Okay, thats enough out of me.

Move along

Thursday, July 17th, 2008

After about a year and a half, I have decided to leave Snitsig (snappystuff.com). The decision was made mostly due to my excessively long commute, sometime spending as much as 5 hours ‘going’ (lots of missed,delayed,slow trains and standing around) to and from work. But in the last year+ I really learned a lot. I went from ‘Nah, I do not use XML much’ to a near zealot for it (I have not forgotten about you JSON). I am doing things in PHP I did not think possible (Almost there PHP), had the opportunity to do a little more hardware/Interweb interaction and play with RFIDs again. Learned a TON about API writting. Most importantly I learned about working with a team. I am so used to working either along or with just one other person. It is really nice having other people to bounce ideas off of and collaborate with. Cheers to you SnappStuff, it was a pleasure working with you all, and I look forward to collaborating with you all again.

And for me…. Meh, I’m fickle.

Fun with jQuery and bookmarklets

Wednesday, April 16th, 2008

So I pretty much use jQuery for everything. I have used it with Rhino and jetty to parse web pages in data mining. While doing CSS or design for work I regularly use jQuery and the Firebug console to make alterations before making changes to XSL or any other backend. Sometimes while on other sites, something will either just really bug me, like flash or bad element positioning. Firebug takes great care of this, inspect element, delete element. Done. But in a situation like doing a chip comparison on website for piklab. But they do not use jQuery.

The Bookmarklet.
The idea of a bookmarklet is too add the link to your favorites and when it is clicked the Javascript is executed in the pages scope. This script create a new script element, sets the src attribute to the latest version of jQuery and adds it to the current page. Now you can start choppin’ up anyones pages with jQuery.

The Problem.
So like I said. I was trying to look up info on piklabs website. They have headers on a really long data set and I am lazy. The chip I was looking at was near the bottom, and I cannot remember what those headers said by the time I got there, so those checks and x’s mean nothing. Inspect Element… We have some tr.headers (only at the top). tr.odd_row and tr.even_row for the zebra striping.

The Selector.
The chip I want is the 16F88 in the Midrange Family. First I get the row elements
$('tr.odd_row,tr.even_row')
This get all the non header row, now I want to remove all the element not containing 16F88, this is where jQuery really sets itself apart from other framework because of the way selectors can be stacked even within a single string.
$('tr.odd_row,tr_even_row').filter(':visible:not(:contains("16F88"))')
Because :not is a selector function that takes another selector, I can invert the :contains string removing all the other chips in the list. Yay. The one short coming here is that the :contains selector is a non-exact selector, so this match F88, F883, F886. This is not so much a problem of this selector, but that there is not an exact content selector in jQuery yet, unlike the attribute =, !=, ^=, $= (equal, not equal, starts with, ends with) selectors. And even with that, jQuery is still my favorite framework, and this is a nice little out of the normal use for it.