January 2006


Sounds simple enough but can be a total pain in the ass since JS passes the nodes by reference:

var _UISwapDOMNodes = function(parentNode, node1, node2) {
     tempNode1 = node1.cloneNode(true);
     tempNode2 = node2.cloneNode(true);
     parentNode.replaceChild(tempNode2, node1);
     parentNode.replaceChild(tempNode1, node2);
}

iFold

For my software engineering class, we essentially spend the entire semester working on a project requested by a client. We constantly keep in contact with the client and also adhere to various software engineering principles and methodologies. Our project is called ‘iFold’. The problem is that our chemistry department has software to analyze protein data and generate images and movies of proteins, but this could take anywhere from 15 minutes to 15 months. The issue is multiplied when people all over the world are trying to access the software and get denied because the queue is full.

So our goal is to provide a nice interface for these outside scientists to see the queue as well as submit jobs, etc. In addition, we have to develop our own little web server to handle the transactions coming in and going out of the visualization software. You can access our admin site here.

The next version of Javascript seriously needs a good threads implementation. Ajax communication isn’t the only example. I’ve been swearing at a single, stupid script for the last half hour. Using opacity attributes, let’s say I want to fade an image for 200 milliseconds when a user mouses over it. I also want to fade out that image for 200 milliseconds when a user mouses out of it. So what happens when a user moves their mouse across the image for 100 milliseconds?

Javascript naturally doesn’t call the mouseOut handler. So the entire thing is broken. I was using moo.fx for the fading effects, and considering the way it was designed, I got around the problem by assigning two objects the two different functions (instead of letting one object try and handle both mousing over and mousing out).

var fade = function() {
     for (var i=0;i<fade.arguments.length;i++) {
          $(fade.arguments[i]).oOver = new fx.Opacity(fade.arguments[i], {duration:300});
          $(fade.arguments[i]).oOut = new fx.Opacity(fade.arguments[i], {duration:300});
          $(fade.arguments[i]).oOut.custom(1, 0.3);
     }
}

Either way though, you’ll have a collision when you leave the image within that 200 millisecond timeframe, and the fading will flicker. Also, what if you have 100 images that you want to have this fading effect on? 2 times the objects. Sucks.

Moo.fx could try and handle this by allowing a developer to prioritize one method over another and allowing a developer to ‘halt’ another method in its process, regardless of the duration. Nevertheless, this would require a hackneyed Listener implementation where the method(s) with the lesser priority would be constantly checking a variable. So basically, javascript sucks at the moment.

I gave my mom a CD for mother’s day a while back. It was ‘50 Cent – Get Rich or Die Tryin”.

All I can say is that it was a gift from the heart.

I’m no expert, and hip hop definitely isn’t my favorite genre, but it just seems like the state of hip hop is sort of degenerating into this primordial ooze of cliche beats and stupid lyrics. With the exception of people like Kanye, it seems like people don’t even put thought into the newest songs; they just pump out something that has the “latest” effects. Twista’s “Hit the Floor” is a Frankenstein-ish song that starts out with the intro of Ying Yang’s “Badd”, kicks in with the ridiculously overplayed reggaeton beat, and continues through the entire song with a hyperactive version of David Banner’s “Play”s synth sound. It’s probably the next horrible thing to “Hollaback Girl” just because it sounds like something a kid could put together in a basement home studio. Twista has some crazy skills though, so I guess that makes up for it.

Through all this mainstream sludge there’re a few dedicated artists who could still pump out a damn good song. The latest soundtrack to NBA2k6 has some of the best in alternative/underground hip hop from some of the coolest artists — Aesop Rock, Common, Aceyalone, The Roots, Blackalicious. Good stuff..

Run PHP4 as an Apache module, run PHP5 as a CGI binary on a port-based virtual host.

Listen 1338
 <Virtualhost _default_:1338>
     ServerName localhost
     ServerAdmin me@localhost
     DirectoryIndex index.html index.php
     ErrorLog logs/error.log
     <Location />
       <Limit CONNECT>
         Order allow,deny
         Allow from all
       </Limit>
     </Location>
     DocumentRoot “D:/www/”
     ScriptAlias /cgi-bin/ “C:/php5/”
     Action     php5-script /cgi-bin/php-cgi.exe
     AddHandler php5-script .php .html
 </Virtualhost>

Pretty easy, especially if you’ve already set up PHP4 with your extensions and stuff. There are other ways, especially on Linux, of setting up two httpd.conf’s and using startup CGI scripts to alternate between them, but this is definitely the easiest way. It also allows you to switch between the two at “runtime”. So now http://localhost:1337 uses PHP4 and http://localhost:1338 uses PHP5.

So last Thursday, President Bush signed into law a prohibition on posting annoying Web messages or sending annoying e-mail messages, anonymously. Essentially this is an amendment to an earlier ruling that prohibited the same sort of thing on telephone lines. Basically what it amounts to is that you can’t post anything on a blog or send flaming emails to someone anonymously, but it’s totally cool as long as you put your name on it.

On an even sneakier note, Senator Specter and other sponsors slided this section into a bill to fund the Department of Justice so that it would be ultimately impossible for anyone to oppose it.

One of the most successful facets of the internet is that it preserves anonymity. That is essentially why the internet has become home to many different types of people, information, and opinions. Refugees, for example, fleeing from a persecuting country, look to the internet to share their opinions to the world. Recent stories about threatening New York camera stores were published on the internet anonymously. But thanks to this new law that blatantly violates the First Amendment, all of that is now illegal.

Thanks a lot.

There are tons of neat things you can learn about outside of school, especially in computer science. There are really specific products like Tomcat, methodologies like connection pooling, or new things like Ajax, and sometimes, even optimization techniques on algorithms — things you should learn about in school. Bitwise operations are a good example. Although more complex operations aren’t really that readable, there are some cool tricks you can do. For example, you can use XOR in C++ to cleverly reverse a string without temporary storage (although on a lower level, the ‘0′ bits of first and the ‘1′ bits of last together compose the temp variable). Either way, it’s fast:

void reverse (char *str) {
     char *first = str;
     char *last = first + strlen(str) – 1;
     for (;first < last; first++, last–) {
          (*first) ^= (*last);
          (*last) ^= (*first);
          (*first) ^= (*last);
     }
}

You can get even more compact with the body of that for loop by just writing: “(*first) ^= (*last) ^= (*first) ^= (*last)”. Or you can find out whether an integer is a power of 2 by using a bitwise AND to compare the integer and one less than the integer:

int isPowerOfTwo(int num) {
      return !((num-1) & num);
}

When you subtract one from a power of two, you get a string of ones. Use bitwise AND to compare that and the original number and you get a string of zeros, so you can use a logical NOT to return 1 if true, or 0 if nonzero.

We got our baggage back today. One week and two days ago, Delta forwarded them to New York and then Air India forwarded them to Delhi… while we stayed in Charlotte. The amount of tags on the baggage was insane; it was no surprise that it got sent all over the place, since the tags listed several different places and it was hard to identify which was the “last” tag.

A glance on the internet for lost baggage is pretty much horrifying. There’s even a site dedicated to selling people’s unclaimed baggage. I wonder what the turnaround time on this is. Still, it’s pretty depressing, and scary for anyone who’s lost their own baggage.

Where do the problems exist?

(1) The main problem exists in bureaucracy. Delta, Air India, and probably many other airlines have issues with obfuscating simple functions involved with baggage and ticketing. These are, of course, standardized through business software like SAP, but it’s pathetic that human error is still at large, and this is due to the inability to understand fifty different tags on a person’s baggage.

(2) In addition, this obfuscation combined with inabilities to communicate within different airlines places a huge burden on the consumer. Air India and Delta both rely on different record-keeping systems. This creates a big gray area when baggage is transferred between airlines.

Could this be done any better?

In an age where people are moving faster and communications are increasing in scope, maybe these airlines should start looking at adaptive business technologies.

RFID is a good example. Why not tack an inexpensive RFID tag onto every checked in baggage? Not only does it provide the perfect model, since information actually resides WITHIN the baggage itself, but it provides standardization in terms of allowing airlines to communicate (in this model, the baggage actually serves at the conduit of communication between airlines).

In addition, it greatly decreases the chance for human error. RFID Readers can be placed at various points within the airports and they don’t even have to be made by the same company. Soon, EPCGlobal will release the Gen2 RFID international standard. Any differentiation beyond the RFID tag is negligible.

Consumers (like myself) don’t have to bounce between calling Air India or Delta; their frustration can be easily suppressed when the baggage is scanned through a Reader, and an RFID Edge Controller can easily manage the intricacies involved in filtering the tags without human support. When baggage is transferred, data can be appended to the RFID, like a simple log. A tracking number can be associated with the RFID tag, so that a consumer can look up the bag itself.

More advanced possibilities..

More complex software could actually find missing bags *before* they become missing. An intelligent piece of software could analyze ETAs of baggage given their current position at any point in the world. Thus, the software would “expect” that an RFID reader would be triggered at a certain point with the corresponding tag. If it isn’t, the software could associate a warning flag with that tag and keep special watch on it, possibly automatically sending alerts to airline staff at the airport in which the bags were last scanned.

In this manner, airline staff are alerted only when necessary, and the system can “adapt” to any sort of situation. Hence, “adaptive business model”.

Hope everyone has a great 2006. My resolutions, short and simple:

1. Don’t procrastinate.

2. Work hard, but not too much.