What is chicken?
Friday, November 30, 2007
I've never been too much of a fan of Jeopardy!, the TV show. If its on, I watch it--with no cable, we only get one local channel, which forces us to have the TV off most of the time. Even though I am not a fan, I do remember
Peter Ken Jennings
, the guy that won 72 straight games. I didn't watch all 72 shows; I don't even think I watched 3 shows when he was in it. However, the internet was buzzing with his mental prowess, hence I knew who he was. Just like you know what the "dancing baby" was, way back then (5 years ago?).
I think knowing irrelevant things now is actually kind of cool. It's the revenge of the nerds, net style. And the bank accounts of IPO winners are proof to it. I wonder if there will ever be another Jennings? 72 games amounts to a lot of useless fact memorization.
So what's up with the "what is chicken?" title? When my son was around 4 years old, he had a cold together with a minor fever. He gets really mellow when he's sick and just lays around the couch doing nothing. One night, Jeopardy! was on. Nothing unexpected: answers were given, and the contestant gave the question. For one answer, which I don't remember what it was, Gabriel sat up and confidently said: "What is chicken?" Again, I don't remember the question, but it was interesting that the understood the rules of the game. So every time that the show is on now, we first try the question: "What is chicken?"
From time to time, it is actually the right question. Similarly to a broken watch that has the correct time twice a day: that's 0.083333333...accuracy. It'll be correct 1 out of 12 times--that is not bad for something that is supposed to be broken.
2 things that really bother me about FireFox
Wednesday, November 28, 2007
There are 2 things that bother me about FireFox. First, its memory leakage--or whatever it's being called, e.g., memory fragmentation. And second, the lack of multi-threading support when downloading something. Note that it does download things in a separate thread; however, the problem I see is that you have to wait for the connection to be established before you can do anything with the browser again. It really ticks me off.
IE doesn't do this: it handles the request, passes it to a new thread to do its thing, and leaves the browser alone.
I could look at the code and figure out why it does that, but hasn't anyone at Mozilla
ever noticed this problem?
Of course, I have a flash movie of the issue, and one for IE (if you have a fast connection, see for yourself):
Irony is best served cold...
Saturday, November 24, 2007
...or was that revenge?
I think it's great when kids get involved in active citizenry, but some actions are unintentionally sardonic.
It's almost X-mas and the malls are busy. I just came from buying a present for a party I have tonight and saw around 10 kids dressed as zombies (white makeup), walking around the mall with "consumers" signs plastered on their bodies. It's a form of protest directed towards our wasteful generation that blindly buys anything that is advertised on TV. The funny part, I thought, is that these suburbanite, middle-class kids were zoombying it up with designer clothes and shoes. The point got muddle in the midst of All-Star and Nike shoes, Gap sweaters, and Levi's jeans.
I did wonder, when they go back home, if they they'll drink Coke to quench their thirst, and watch the news on the new HDTV 52" unit (plasma or LCD) their parents bought this year? (Chances are good.)
Like I said, it's good kids get involved. In high-school I thought the GAP was evil for using cheap labour in third world countries. It did eventually click that by not buying their products my life didn't change in one bit but it was more of personal choice. Now, ethical cheap labour is just part of a better balance sheet at the end of the year. (Sarcastically, I pump my fist to my capitalistic education.)
I do hope the actual message is not lost on the kid-zombies, and don't think it's a just a cool prank to have the mall security running around them while obediently protesting something adults told them to protest. I mean, it's hard to come by original dissent now a days. It has to come in the form of shrink-wrapped glossy magazines
sold at the local bookstore, with Starbucks coffee brewing in the background. But maybe that's the intention: work the system from within
For me, I have I to go now: I have to fill-up my 42 gallon gasoline guzzler to go eat, drink
, and be merry.
To my defense on consuming things, I have no cable so I'm not sure what's in or out. Against me, though, is the fact I do have a high-speed internet connection. But I think it's better to corrupt my young mind with pull technology rather than push technology: I control the buttons.
911, is a polymorphic number
Thursday, November 22, 2007
Going back to fundamentals is always a good thing. With OO design and development, it means going back to thinking about what inheritance, encapsulation, and polymorphism mean.
One of the things needed to accomplish OO in actual code is method overloading and overriding. The concepts are simple: with overloading, you can have multiple methods with the same name, as long as you change the signature of it (e.g., take on different input data); with overriding, you can change the functionality of a method if you are not satisfied with the inherited implementation. The point is that one method can be used to do different things depending in the context, or its inherited behavior can be modified depending on the need.
It's seems to be such a natural way of doing things. So it's not surprising the two concepts are part of modern programming languages. In the real world, however, overloading comes by easier than overriding. For example, any verb is overloaded. Take the verb run. Not all running is the same, and hence the input for the verb run becomes the context, i.e., Me.run(context). With this example, context can be "save life" or "enjoy scenery." The output is similar (running), yet the intention is completely different.
With overriding, think of things that are passed down to you--perhaps in the form of knowledge. Most of these things can be improved. For example, my parents taught me how to walk in the most basic sense. I, however, improved on the technique and overrode the basic premise of putting one feet in front of each other to generate motion. I became an expert on walking (by not falling so often), and also running--which, by the way, I learned to overload depending on the context. (There is a caveat with this example, as we already come wired with the notion that our two feet are for standing up, and our skeletal structure is made for walking, and that's what we do.)
There are many things we can't override. They are given in the form of inheritance. For example, the colour of my eyes was set the instant I was conceived. However, I can override their function with surgery or by putting eyeglasses in front them to play the with light before it hits my retina.
If you want to take this concept of human function overriding further, it can be done: we will be able to change a lot about us. Nonsense, you say. Well, experts are saying that we are within 50 years of enhancing our basic human functions (and I say basic, because I can't jump 4 meters high, or see through concrete; but there is nothing basic about us). This ability to change our nature is what people are calling the "singularity."
In a few words, it means that at some point we will be part machine, part human. We will be able to enhance ourselves by implanting chips here and there, swallowing nano-robots to realign DNA malformations, and, essentially, cure everything that is incurable now--to the point of really living forever (avoiding natural death will be easy, keeping us safe from things we make that can kill us is another story). This is not so far fetch, as aging is the breakdown of cells and the inability to repair themselves. Therefore, if we are able to repair them at the molecular level, aging will be what the Apple Newton was to our generation: a good concept, but not good enough for the market. Finality has its advantages; however, given the alternative I'm certain most of us would indulge in some AI memory enhancement chips and nano-robot-drinks to fool old nature.
Going back to overloading and overriding. These concepts are found everywhere. Almost everything works this way. Don't take me wrong, I'm not the kind of guy that thinks I am a hammer and therefore everything looks to me like nail. No way, Jose. But for some reason, I started thinking about the 9-1-1 emergency system.
Two things came out of this. First, the emergency system, or 9-1-1 in North America (US and Canada), is one of those systems that have these two concepts as the root of their design. I doubt it was called a polymorphic system when it was originally put in place
. However, every city must handle the call independently. I mean that it must know where it is to answer accordingly. What we don't want is anyone calling from Tampa Bay, Florida to reach Stratford, Ontario with an alligator emergency--there are no alligators in Stratford, and it's really far way from Florida.
So how does the system know to route the call to the proper city? If you think of the cities to be the context of the call, then it makes sense since a dial tone is a dial tone everywhere (again in North America) and everything gets connected without problems. For example, I have a unique phone number in the US and Canada, which is based on the area I live, i.e., the area code. So 9-1-1 is a funny number: it works the same regardless of where I am. Therefore, I think of 9-1-1 as a polymorphic, designed oddity of our phone system.
The second thing that came to mind is that if 2,000 years from now historians will look back at our 9-1-1 system and think that our society designed the system because of September 11, 2001? You may think this is preposterous, but the time span between the invention of the system and the World Trade Center being leveled to the ground is only 40 years. This is not long in written history, and, to date, there are many events that we can't really pint point with 100% degree of accuracy--we kind of say, "give or take 50 years." Of course, presently, we have public records of both events (and the internet to find the information in seconds), but if they get lost somehow, only the myth of both events will live. And someone will wonder if these events are connected somehow. I would, and history is subjective at its best, and subjunctive at its worst (though, I'm not sure if there's a difference).
Java Swing: JTextArea ignore tab and enter key
Tuesday, November 20, 2007
This is probably a very weird title if you are not looking for a particular solution to this problem.
But why would anyone want to suppress the TAB and ENTER key inside a JTextArea component?
Well, some people like to traverse through fields in a Java JFC/Swing application by clicking the TAB or ENTER key. And if you have tried to traverse to the next field using the TAB key while inside a JTextArea component, it can't be done by default.
I looked for a reasonable solution, and I couldn't find anything that worked or didn't looked like a hack (replacing the chars with empty fields didn't look so elegant in the code). Let me save you some time by putting the solution I came up with:
- Consume the KeyEvent with the method Component.consume() in the keyPressed() handler.
- Then, traverse to the next field in the app with JTextArea.getNextFocusableComponent().requestFocusInWindow().
A couple of notes, before the code: first, it tricks the application to use the ENTER key to traverse the fields (looks like you are using the TAB key); second, it uses the deprecated method getNextFocusableComponent().
The code is here
, and the running application is here
. Note that IE takes over the TAB key, so use ENTER so the required effect; if you are using FireFox, you are fine.
The internet knows me (and you)
Monday, November 19, 2007
Over the weekend, I was surfing around for icons (you know, small application icons). To my surprise today, I got an email that asked, "Do you have icon requirements for your software or multimedia projects?"
I was surprised, to say the least. How does the internet know what I'm thinking?
OK, it doesn't. But it just amazing how SPAM still exists and why. An old saying comes to mind: the one that goes, I'm paraphrasing, "spread enough shit around, and it's bound to stick somewhere." I don't know who said that, but in this case all those annoying bits of useless data bouncing form router to router in our network have become the "shit" that by sheer coincidence makes itself useful and it gets stuck somewhere. In other words, someone clicks on one the offers and actually buys something.
Of course, sometimes the promises don't materialize. For example, I'm still waiting my for $15 million promised by an African prince's lawyer. Maybe I should send him the other $5,000 he asked for.
Put your tinfoil-hat back on, the internet can read minds. Most important, the contextual internet is here. Well, sort of--and only if you wait long enough for the answer to your existing problem. I'm sure some spammer is concocting an catchy email to sell something useless. Let's say, for example, how to make millions of dollars while working from home.
Context of this image? No idea...
Tuesday, November 13, 2007
Links are the lifeblood of the web, and I click on a lot of links during the day. I usually just open them in new tabs (I use FireFox) and I continue doing what I'm doing. Since I'm doing a number of things at once, I sometimes forget to check out the new tabs--right now I have 17 tabs opened.
From time to time, I find small surprises. For example, the image below was just there, waiting to be seen. I don't remember where it came from (the original site) or what the context of it was, but it sure is interesting. How many people do you recognize? Einstein, Tyson, Fidel Castro, and "El Che" don't count.
Monday, November 12, 2007
The gphone that is no phone at all, but a Linux-based software platform. Of course, the APIs are written in Java, and the development environment is Java (based on Eclipse). We, developers, love this kind of stuff. However, I was expecting an actual device attached to the release. No word on when they will be available, but lots of big names are saying they will support Andriod (this could end up meaning nothing, actually).
Ballmer is not too impressed with google's Andriod. He said in an interview, "they [google] have a press release. We have many, many millions of customers, great software, many hardware devices. They are welcomed in our world." He's got a point, but google outmaneuvered Microsoft in the internet market, and will likely do so in the web application market.
Nigel Clifford, CEO of Symbian, simply said, "it's another Linux platform...There are...25 Linux platforms out there." He's also got a point, but google search was just another search engine in a crowded market, yet here we are.
Watch the interviews:
Google, of course, will sweet talk us into developing application for the new platform. And applications will pop-up from everywhere (I may even write one), but this will not guarantee success unless the hardware is as sweet as the iPhone's. It's one of those things: the hardware has to be good enough to run applications that consumers will actually want, and, most important, will actually need.