Category Archives: Programming

Bug in Google Maps

Click on a “more info”/”reviews” link. It will launch a large dialog with detailed information on the location you’re considering.

Now, while this dialog is up, position the cursor outside of it and scroll the mouse wheel. The map zooms. The dialog goes off-screen. Chaos ensues if you zoom out to get it back (though panning generally works). You can even get part of the map to extend outside of the mapping window if you keep zooming.

Tested in Firefox and IE. It seems worse in Firefox.

It’s just cosmetic, so it isn’t that serious.

I am the hub node!

I have essentially become the hub that everyone goes through in the Metasquares community. My insights and advice are valued by all parties. This is a good thing; all sorts of opportunities open up when you literally have all of the information there is to know.

Programming or Research… both

I can’t help it. When I start programming, I get really excited. It doesn’t matter how hard the problem might be in theory; sit me down in front of a computer for a few hours and I’ll solve it. I wrote a master’s project that was supposed to take me 3 months in less than a week. I wrote a classifier that took my group a year of fine-tuning in a single day, and it worked better the first time than theirs did after all of that time. I just whizzed through a programming assignment that my professor admits should take about 9 to 10 hours in a matter of one. I can’t really do this sort of thing if I’m not coding, and I can’t do it at all if I’m under heavy pressure, but if the environment is right, it’s amazing to even me, and perhaps explains why my expectations of myself in other areas are sometimes unreasonable. In some ways, it’s a pity that I don’t get to code more often, because I love doing it and I’m really good at it (having done it since 8).

I need to find fields where I can both code and do research. Representing a problem in code, thus rendering most calculations trivial, just removes ambiguities and minute details that could obstruct the general thought process and just seems to augment my thinking ability. For an ‘N’ type, more general thought processing and fewer details is the optimal situation 🙂

Yet more problems with CSS!

One tends to repeat oneself a lot in a stylesheet. This is sort of tied to the overspecification issue I mentioned earlier. The situation that made me realize this was one in which I was using float and clear on two separate elements (due to the fun property of floats existing outside of the flow, I had to use a spacer element with the clear property to ensure that both floating and static content fit within the container – the first time I’ve used a spacer element since I began using CSS some 9 or so years ago).

Change the float to left, change the clear to left. Change the float to right, change the clear to right. Any other combination didn’t work (as I had another float on the left, I couldn’t use clear: both – by the way, while we’re suggesting improvements to CSS, it’d be nice to be able to clear individual floats while preserving others in the same direction). For content outside of the flow, change the height in one place, change the margin in another. There’s duplication of content all over the place.

Behavioral programming

This might already exist (and might even exist within OOP in the form of interfaces), so bear with me:

(If by some exceedingly rare chance this idea is implemented, feel free to use terminology less dependent on American spelling than “behavio(u)r”. In reality, if it is adopted, it will probably be at the suggestion of someone more prominent who happened to have the same idea at a different time, so I don’t even know why I bother to post my ideas).

It seems that we should be more concerned with what an object does than what it is, as we are with OOP. Therefore, it seems to make more sense that we should specify behaviors rather than objects and grant variables specific sets of behaviors, or capabilities. An example of this sort of design (and the one that inspired this idea) is the STL. For example, using OOP, if we have three variables, representing a bicycle, a car, and a person, we can declare them to inherit from class MovableObject, which would have variables such as position and velocity. However, this generalizes a little too much, and now we suddenly need to inherit from some other class (or define person as a base class) to include things like name and eye color. What if we instead designed behaviors such as “go” that could be modularly added to bicycles, cars, and people (or whatever else; we could add it to bananas if they had the appropriate variables)? What if we could attach and detach these behaviors from individual variables to include within-class variation? For example, suppose Mary is a person but is paralyzed and can’t move on her own. We could simply remove the “go” behavior from Mary to represent this fact without having to make a statement about all people in general.

This alone isn’t enough, however. We need to provide goals, else the program won’t have much of a purpose. Say we want to design a program that will make a chicken cross the road:

//How do we cross the road? Execute go, passing all of the to “requirements” as arguments to the behavior and optionally specifying additional ones.
to crossRoad() execute behavior go(OtherSide, additionalArgs1, …);
to crossRoad() execute behavior walk(OtherSide, additionalArgs1, …); //Or walk, which is the same thing, really.
to crossRoadTwice() { crossRoad(); crossRoad(); } //etc.

//It only makes sense for things with positions of type Point to “go”.
//Note that we don’t need to know whether the object in question is a person, car, banana, whatever…

//”Requires Point position” can also be valid, and would cause the behavior to return false (and thus the goal to fail) if executed on an object that doesn’t have a point. “Provides Point position” will actually add a position attribute to the object if one doesn’t already exist. (If one exists by a different type, it’s an error).
bool behavior go(Point where) provides (Point position) {
position = where;
return true;
}

class Chicken {
hasBehavior go; //Chickens can “go”.
//Point position is implied.

}

int main() {
Chicken c;
c.tryTo(crossRoad()); //true.
}

If we wanted something more traditional, we could statically define class properties and “require” instead of “provide” them on the behavior. This essentially allows a more object-oriented approach, such as the taxonomic one practiced today. Conversely, we can also modify behaviors (and thus provided but not required structure) at runtime on individual instances. For example, let’s see how Mary would work:

class Person {
hasBehavior(walk);


}

int main() {
Person Mary;
Mary.removeBehavior(walk); //Mary can’t walk.
Mary.tryTo(crossRoad()); //false – Mary has no way of crossing the road, since she can’t walk.
}

This can be extended, too. We can add Prolog-style rules, for example, or couple “requires” with interfaces or type checking, and that’s just scratching the surface of the possibilities.

Now that I’ve written this long thing up, feel free to ignore it.

IE7 Bug

Place a container with position: fixed on top, as in a navbar. Now create another container in the normal flow of text below and populate it with some content (of any length). Set it to overflow: hidden or overflow: auto and give it a large top margin. The top container might even be unnecessary.

IE7 ignores the margin entirely, while Firefox and other (non-IE) browsers interpret it correctly. I haven’t tested this on IE6. Since position: fixed elements are not considered in the flow, this is probably something that would come up fairly commonly (placing margins on other elements to offset the dimensions of the fixed layers; klutzy, but the alternative is a fixed-size iframe, which won’t do on fluid layouts, or a full frameset, which I could use quite well here but am deliberately avoiding on this site because it has to scream professionalism).

That brings the count up to 2; the other bug I reported was entering something like “(1+1=)” into the Vista calculator (only the Vista calculator) causes it to crash. I still don’t think this is fixed, but at least it’s not major. The IE bug is worse.

If only iframe sizes were variable, this site would be a lot easier to design, but part of what I’m trying to show is that I can do the “Web 2.0” thing, and using frames of any sort of this site, even when they’re the right tool for the job would impede that. Thus I do what other “Web 2.0” developers do: write ugly CSS workarounds! (Unlike most of them, I never use outright hacks, since those are transient by nature).

ML + Algorithms

There’s an idea that simply won’t leave me alone – coupling largely deterministic algorithms with machine learning capabilities in order to guide behavior (but not completely determine it, as with genetic algorithms). For example, if we want to search for objects with a color attribute of red and we know that red clusters with blue through ML techniques, we can do a general binary search on a blue (or red) object and focus there. In this way, we can give an ordering to data that may not necessarily have as natural an ordering as an ordinal number. If the ML doesn’t dominate the algorithm, this could potentially speed up the creation of indices and search operations, among other things.

Just a thought.

More CSS

CSS is very prone to overspecification, and though I do write CSS, I find the notion of a “class” that has a background color of black, 5 pixel margins, and blue links being distinct from a class that has a background color of black, 6 pixel margins, and blue links completely at odds with the object oriented paradigm. Yes, we can make it one class and override on each individual ID, but that’s klutzy. Surely there must be a better way.

One thing I’d love to be able to do is define my own elements, inheriting from a base element and automatically applying CSS (and adding HTML) to create customized functionality. For example, I have a list of checkboxes on HireGeeks. I should simply be able to define the tag “checklist” or something and have the browser interpret that as “a list with checkboxes and this default styling”. How would one go about introducing such a standard anyway? It’s an idea that should be adopted, but short of making my own browser, I don’t see any way of introducing it to the community. It’s not as if W3C would listen (I wonder how Tim Berners-Lee would have done in such a regulated environment; probably not too well). Maybe XSLT? Or parse it on the server side?

Or does a standard exist for this already? I thought that was what XForms was supposed to be, but looking at the W3C’s page on it, I’m greeted with:

“The Forms working group is chartered by the W3C to develop the next generation of forms technology for the world wide web. The mission is to address the patterns of intricacy, dynamism, multi-modality, and device independence that have become prevalent in Web Forms Applications around the world. The technical reports of this working group have the root name XForms due to the use of XML to express the vocabulary of the forms technology developed by the working group.”

Well, uh… thanks, I guess. Wow, I can’t wait to “address the patterns of intricacy, dynamism, multi-modality and device independence!” in my web pages! So how do I use it? Is it supported by common browsers? What exactly does it do? Of course, that information is absent. Why does everyone do this? Is this the logical outcome of a society that values form so completely over function? One that mistakes sesquipedalianism (my favorite word in the English language, meaning “the attitude of using long words”) for insight?

Coupled with the mess that W3C has made of XHTML, their position as a gatekeeper of web standards, their abuse of this position by neglecting individual contributors (unless you run a business, you’re invisible to them, however good or even popular your ideas may be), and their general failure to solve common problems plaguing web developers today, I think the time has long passed where the W3C should have been dismantled, to be replaced by a community-based model (or even a grassroots one, as the web began in). Since the majority of web developers are either self-employed or belong to small firms, W3C is causing nothing less than the stagnation of web development with this attitude. Even worse, the companies that have the most influence on the panel (read: Microsoft) have a history of screwing things up (read: IE 6).

NetGear and ATI drivers

There are some hardware companies that can make really good pieces of hardware, but completely ruin any advantage that may give them because they can’t write decent drivers if their lives depended on it. Ok, so there are other companies that can’t figure out how to write Linux drivers for their products. Fine. I don’t like it, but I’ll accept it (and buy other products in the meantime, because I’m in Linux more often than not).

But at least make sure the Windows drivers work!

NetGear and ATI in particular are two “repeat offenders” that I doubt I’ll buy any more hardware from due to the poor quality of their drivers.

Reminiscing on Rudenid

I make it a point to list Metasquarer, one of the masterworks of my childhood, on my resume. I’m proud to have demonstrated such a masterful grasp of programming, AI, and even algorithms at such an early age, for I was only 12 when I wrote it, and I do sometimes refer to it as the “magnum opus” of my childhood. However, for a relatively brief period between the ages of 15 and 18, I accomplished something that is perhaps even more impressive, and yet almost no one even knows that it was my work in the first place. It certainly isn’t on my resume. For even though I strive to be the best in every field I enter, it wasn’t until I was the best that I knew I could accomplish this on a larger scale. In this sense, my success at that critical moment opened the floodgates for all of the spectacular failures I am fighting society’s tide to avoid, for it was here that I utterly mastered my first skill.

Everyone attributes my success in the Ultima Online emulation community to “Rudenid”, which was the handle I uniquely used in the SphereServer and Irth communities. I left nearly no trace of my actual identity, for I didn’t see the need to associate my UO activities with the work I was doing with Metasquarer.

As always, my schoolwork was underchallenging, but at the time, this did not bother me for two reasons: I was receiving the same education as everyone else (a view that has instilled a great disgust for the standard system of secondary education in me, because the standard model caters strictly to the lowest common denominator), so I didn’t need to worry about inherent inequalities in training and could instead breeze through classrooms on intelligence alone (to the extent that I wouldn’t do homework because I already understood the material, thus receiving excellent grades on tests but mediocre overall grades due to zeros on homework), and I had already demonstrated programming competence far beyond my peers, most of whom either couldn’t program at all or were just writing their first programs.

So I did what every bored kid does after school: I played games. I still maintained Metasquarer, of course, but it was stable and the community was thriving by that time, so maintaining it did not require much work. Though I was conscious of society’s problems at that age (for that matter, I was conscious of society’s problems for as long as I could remember – in particular, I wanted to take action to stop global warming since I was six, shame on the rest of you for not even agreeing that there was a problem until recently), I did not have the compelling altruism that I later developed, and as someone who was constantly tortured by other students and faculty alike when all I wished was to be left alone, I was perfectly content to let society solve its own problems. So, as I said, I played games, including one called “Ultima Online”. Referred to the game by Jesse Alter, one of the three friends I would have before college (we later lost touch), I was directed to two free shards. The name of the first escapes me, but as soon as I created a character on it, I was immediately ambushed and killed by someone riding a llama who apparently decided to welcome “n00bs” to the server in his own special way. I left that shard almost immediately.

The second shard I joined was a roleplaying shard known as First Sundering. I knew nothing of Ultima lore (which is surprisingly rich) at the time, so I generally took “roleplaying” as “speaking in Elizabethan English”, which I was an expert at thanks to my many readings of Arthurian legends. I originally wanted to choose the name “Zandar”, after a character in an RPG I had just developed, but a character named “Zander” already existed on the server, so I chose “Rudenid” (another character) instead. First Sundering required an application for accounts, but their standards were not very high: after a week of eager waiting, I was welcomed to the shard, despite knowing little about what roleplaying was truly about.

What a difference! The community was helpful in the extreme, and it wasn’t long before I had much of what I was doing down thanks to their guidance. While on FS, I developed my character into a powerful mage (who crafted bows, of all things, in his spare time!) It was the perfect escape from the misery that defined my life from 6 to 2.

Unfortunately, while the shard’s playerbase was everything that could be asked for, the shard’s leadership was rather inept. After a series of successive bad decisions, culminating in a shard reversion that cost everyone nearly a month of progress, I left. Only a few months later, the shard folded, scattering the community. First Sundering was indeed an appropriate name for the shard.

Some members simply left UO altogether. Others found other shards. I did neither. From First Sundering, I had learned of “SphereServer”, the scriptable server that FA was powered by. At first, I simply toyed with being a Game Master on a test shard I called “MetaShard”. However, I very quickly decided to seriously start a roleplaying shard in the vein of FS. This shard was originally called “Endless Void” (Jesse’s idea as a member of the staff), but initially failed to attract players due to the relative sparsity of the world and the fact that building such a community is endosocial (an existing player population is required to attract players to the shard in the first place, resulting in a nasty feedback loop and a very difficult launch; see my previous posting on “exosocial” and “endosocial” communities).

But I was never one to let poor adoption of my ideas hinder me. After a policy disagreement with Jesse, he left and I changed the name of the shard to “Final Aegis”, where it would remain. At that point, I became serious about running the shard, and began reading “Taran’s Guide to Sphere Scripting”, a fairly well-written (better than any other documentation, anyway) guide to the Sphere scripting language, which was somewhat C-like (maybe Delphi is closer) and rather powerful despite Sphere’s quirks. This language is recursively enumerable, and thus probably qualifies for Turing completeness, surprisingly enough.

Within one month, I had mastered Taran’s guide. I would occasionally use it as a reference, but I would never rely upon it, or any other documentation, as learning material for the language again. My future training would come from running my shard, which began to grow, as well as visiting the Sphere Scripting Boards, where I fully intended to ask many questions, yet found myself answering instead.

And answering and answering, and scripting and scripting…

Within six months, I reached a ceiling of sorts: anything the server made it possible to do, I could do, no matter how impossible it may have seemed before I solved it. I knew the entire language (not trivial) by memory, and though I’d occasionally forget minor details, they’d always come back to me when I needed them. More importantly, I could construct scripts that many simply considered impossible with those tools, shaping the universe of my shard in highly novel ways. Despite this, I did not think of myself as a master of the craft until later: the true breakthrough moment came when I found myself fixing and extending scripts written by Swindler (considered one of the top three sphere scripters, along with Taran and Belgar). Fairly soon after that, my scripts began to outstrip theirs in both quantity and quality, even though I later learned that they had the advantage of seeing portions of the server’s source code.

Having finally contented myself with my mastery, I went back to answering people’s questions and improving my own shard, becoming one of the most prolific scripters as I wrote scripts for myself and others. Final Aegis became a moderately successful roleplaying shard, never able to accumulate a playerbase to compare with a player-versus-player (PvP) shard, but gathering a closely knit community nonetheless. The shard went down on September 29, 2004.

I just brought it back up today.