Monday, February 27, 2006

Transmitting GUIs: When interfaces become data

While it might be old news to some of you, I just recently heard about XUL(pronounced Zuul), which apparently is what Mozilla's suite of applications, such as Firefox and Thunderbird, built their GUIs on. Most recently, an open source music player, Songbird, also uses XUL.

When I first started using Java's Swing, it seemed pretty simple. However, when working with web applications, I found it much easier to get a GUI up and running in HTML, CSS, and AJAX than it was with Java's Swing (However, some things are still hard in web apps that Swing does well). So I wondered if there could be a similar thing for desktop applications?

I guess that's what the people at Mozilla thought of too. What makes XUL interesting is that it employs an XML schema to define the GUI. And since it's still XML, you can embed other forms of XML in there, such as SVG and MathML. XML is usually used to describe data, but in XUL, it's used to describe a user interface.
There's no Data, only XUL
But on the converse, if it's expressible in XML, isn't the description of the GUI the data being represented?

Currently, we tend to think of the GUI as a cohesive part of the application. But that shouldn't be the case with XUL, since it's data. Then, you can certainly also send the GUI back and forth between applications. What use could this possibly have?

Well, for one, many programmers have long said that HTML was never meant to be used for applications. It was only meant to display hypertext. What we've done so far was use a lot of workarounds, to make it seem like it's an application. It could be entirely possible to have XUL servers, and not just HTTP servers. Upon looking it up, they have Remote XUL for that purpose. I imagine that with smaller and more powerful devices, the client-server model will still exist, but to the user what-is-a-server and what-is-a-client will become vanishingly small. Your mobile phone might be a server to a number of other future devices in the house.

Another idea is one about Walk-away GUIs. Say, you were looking at a map application of a place you're going to survey. With walk-away GUIs, you would be able to send a mobile version of the map application GUI to your mobile device to take with you out on the field.

Already, the web applications have small versions of themselves. Blogger has a "blog it!" mini control that lets you post things quickly. Del.icio.us has firefox extensions that lets you tag quickly. This could be sent to mobile devices, so that you can use it while you're out in the field, without high bandwidth (otherwise, you'd just run the application from the XUL server).

I think that this, coupled with Human Area Networks, you can visually transfer the GUI from a desktop to a mobile device, much like in the future thriller, Minority Report, where Tom Cruise could move a picture onto a plate, which could be removed and transferred. While their application was to move a picture from machine to machine (inefficient), the idea makes far more sense for transfering GUIs between applications on different platforms.

I also see XUL as being an easy way to update and patch software out in the field, as well as being extensible beyond current GUIs. If there are future devices with a different dimension to their GUIs, XUL would be flexible enough to be backwards compatible, as well as being able to support current GUI innovations.

Currently, XUL is only used with the Mozilla applications. Will XUL catch on? I don't know. It might be impractical in cases where bandwidth was low.

Update:
There seems to be other problems with XUL.

Saturday, February 25, 2006

A host of poking will get the brain working

I had a deadline today, but decided to put it off a day, since I had an interest in looking several things up tonight.

I use to have no interest what-so-ever in compilers, but I started reading up on it due to a catalyst. Since I was an Electrical Engineer, I never took compilers in undergrad. And in grad school for Computer Science, I somehow avoided taking compilers. I read alot about what parsers and lexers were. I knew who Noam Chomsky was, but I didn't know that he was the first person to separate syntax and semantics.

So I found a free compiler tools site as well as a long article on compiler basics that I finished halfway. I talked to Ian Martins, in brief, and found out that commonly used tools for compiler creation were Lex & Yacc.
The asteroid to kill this dinosaur is still in orbit.
- Lex Manual Page

Haha. But these two tools generate parsers in C. Are there Ruby equivalents? Of course. It's called Racc. Since Ruby was written in Japan, and has large adoption over there, a number of libraries have documentation written in Japanese. Who would have thought that reading some Japanese would come in handy?

I also made a stop at looking at what Rinda was, though documentation is sparse on the web. Rinda is the Ruby implementation of Linda, which is something used for distributed computing.

Perusing around these topics, I stumbled upon an O'Reilly article on Asterisk & Rails. Asterisk is apparently an open source VoIP implementation. That's pretty interesting, especially since you can tie it into Rails with RAGI. I think the possibilities for this are exciting, though I fear that people will blow it out of proportion and turn it into a bandwagon of sorts.



In the article, they had this picture, and I found it interesting that there is an overlap between IM and VoIP. Related, they are. I wonder how the traditional telephony and cable are going to try to block this? I honestly hope they don't succeed. I had heard of Gizmo before, downloaded their software, but didn't really have anyone to dial, so I removed it. But thinking about it now, and open protocols, I wondered if there was a Jabber implementation in Ruby. There were two, but one was more active, being XMPP4R.

I find that Digg or /. might not always have the news I'm looking for, although it comes through once in a while. The best leads I have are by following topics and often times from blogs, in footnotes.

I'm excited about a couple ideas brewing in my head, but I'll just need to write them down and push them in the back of my head, and come back to them later.

"Facets of Ruby" Brown Bag

I gave a Brown Bag presentation yesterday to the software developers of the Johns Hopkins University Applied Physics Lab. It was good to pour over the lesser known features of Ruby, and though I know more now, I couldn't answer a lot of the basic questions that were asked. A lot of the discussion was on dynamic typing.

Here are some of the answers to questions I couldn't answer right there and then.

Which module is "times" iterator in?

I had the example:

3.times do
print "ho! "
end
# it prints out "ho! ho! ho!"


Since everything in Ruby is an object, the number "3" is also an object, and therefore has methods. "times" is a method in the module Integer. After looking at the source code for "times" (written in C), I stand corrected, it does NOT use "each". Only classes that mixin the module Enumerable will use 'each'. It takes 3 as an argument (hidden to rubyists), and then yields to the block(printing 'ho!' in this case) in a for loop from 1 to 3.

Why would you ever want to add methods at runtime?

I completely forgot that Rails does this as part of it's "magic." Let's say, for example, you have a table called "songs" that has attributes, "id", "title", "artist", and "duration". Normally, you can use a find() method to find all songs by Eric Clapton in the "songs" table:

Song.find(:all, :conditions => ["artist = ?", "Eric Clapton"])

However, rails will also dynamically add methods, based on the attributes of the table:

Song.find_by_title("Bell Bottom Blues")
Song.find_by_artist("Eric Clapton")
Song.find_by_duration(253).


When you query the database for a record, Rails will create a data object with those attributes available as methods on the fly. This way, there is no configuration or mapping between the databse and your data model objects.

How does Ruby go about deciding which method to execute for ambiguous method names?

From the pickaxe book:
"Ruby looks first in the immediate class of an object, then in the mixins included into that class, and then in superclasses and their mixins. If a class has multiple modules mixed in, the last one included is searched first."

In trying it out with test code, you can only use the scope resolution operator to distinguish between two methods with the same name in two different modules if the method in the Modules were declared static.

What is the type of an object when you mix modules into it?

Let's say I have two modules, "Bar" and "Yak", and a class "Foo" that mixes "Bar", but not "Yak". Using the kind_of? method:

f = Foo.new
f.kind_of? Foo # => true
f.kind_of? Bar # => true
f.kind_of? Yak # => false


So yes, an object instanciated will also be a type of modules that you mixed in.

If I really wanted type checking, what could I do?

You can use the reflection methods, such as kind_of?() or instance_of?(). But since what you're really interested in is if the object will fail on a call that you make, it might be better to to call responds_to?(), to see if the object responds to a particular method.

The pickaxe book warns that you should do type checking if you really have a good reason for it. Otherwise, it's more code to maintain, and has less flexibility in future enhancements.

Saturday, February 18, 2006

Rails Collections and Partials

I like convention, mostly because it simplifies what needs to be said, because it can be implied. But likewise, it makes it difficult for newcomers to know what these conventions are, because they're usually not written anywhere.

When rendering a partial, a parital has access to all instance variables generated by the controller method. So if you were rendering a method from show_comments, @my_crazy_comment would be available to the partial. But not only that, if the partial is called with

<%= render :partial => "comment_display", :object => @my_crazy_comment %>

The partial would have available to it, a variable called 'comment_display' that points to @my_crazy_comment.

So inside your partial file, "_comment_display.rhtml"

<blockquote>
<%= comment_display.comment %>
</blockquote>
<%= comment_display.author.name %>


The variable "comment_display" will have the comment in @my_crazy_comment. For a collection of partials, it's just as easy.

<%= render :partial => "comment_display", :collection => @all_crazy_comments %>

Where @all_crazy_comments is an array of comments.

If designs were reusable, would I be for it?

So I've been watching Project Runway II...not religiously, but I watch it with the same reason I watched that modeling reality show with Tyra: to see what others are seeing that I'm not. Certainly, one can say that models don't do much. They dress up, look pretty, and walk. But I always had a suspicion that's like saying basketball is just putting the ball in the hoop. While both true, they're gross over-simplifications.

I often joke, while watching Project Runway, that there should be a reality TV show about engineers and coders. "For this challenge, you have to code on an Amiga!" "For this challenge, write your own Sudoku generation algorithm!"

But thinking about it hard, there is always a trend in technology, where first, it has to be functionally working and innovative, before the designers move in and improve it incrementally and aesthetics. In the case of web applications, with the recent surge of the so-called web 2.0 sites, they all have a similar look and feel. Some of this is constrained by the practicality of a common GUI widget set. Some of this is due to the common fonts and the set of pleasing color schemes. However, on the other end of the specturm, you have flash sites with an unusable UI set and overly animated.

What's the balance between something new, aesthetic, simple, yet functional? I suppose this is the holy grail that most designers strive for. I wonder if it's possible to be both technologically innovative and aesthetically innovative in one step?

Thursday, February 09, 2006

Visual CSS Inspector

After coding in Ruby for a while, and omitting semicolons, it's hard to get back in the habit of doing do when writing CSS. I couldn't figure out how to get a CSS to take effect, and it ends up that I didn't put a semicolon down after "width: 250px".

Problems are always entirely stupid after you figure out what the source is. However, this has led me to wonder about the design of HTML and CSS. HTML is now criticized for being to loose and easy-going with users that use it with errors. However, we forget that without that ease-of-use, and ease-of-forgiveness, HTML wouldn't have had the widespread adoption that it does today. We might still be using GOPHER (maybe).

But when it comes to formatting, the effects of which aren't as readily seen as structure, it might do well to have some warnings or error messages. This should be the case for developers, and not normal users. Well, poking around Firefox, I see that under "Tools", there's a DOM and javascript console. Nice.

But I don't think there are the equivalents of CSS checkers. How do you verify visual aesthetics? Maybe it can check for things like overlap between boxes, in different sizes. If general visual aethetics could be measured, then it might be possible to have a Visual CSS evaluator. One can argue that human creativity has a range of aethetics, and that it would be impossible to capture it algorithmically or mathematically. However, I think basics of aesthetics could be captured, because despite the variability of aethetics, they all share commonalities such as symmetry.

And yet, I hope that if something like this ever comes about, it won't be seen as a standard of aesthetics, but more of a tool to run automagically, so that humans won't have to look at it one by one.

Tuesday, February 07, 2006

Nav with google earth

This article has been all over the news. I've been thinking that this was in the works about six months ago when Google Earth came out. I'm not sure whether the pics are real or not, however. Speculation, of course, but I tend to think that Google as a part of it mobile strategy intends to focus on organizing information between contexts. No longer do you have to look up an address on maps first, print out the directions, and go. No longer will you have to transfer that information between contexts onto paper and then electronically again.

Beyond that, you can find and advertise things in the real world with the google nav system. If augmented reality takes off, I think that Google will be positioned to be the medium in which to make money off of advertising when users are searching for places to eat, gas stations, etc while they're cruising in their cars.

Sunday, February 05, 2006

Long Lasting Design

PC world covered their list of top 50 gadgets in the past. I'm don't buy too much into the listings, other than that it is true that the Walkman changed a lot of things in America, and hence it deserves it #1 spot.

What I noticed is that some of the designs on these gadgets are surprisingly modern. I'd see gadgets like these on the shelfs of some stores in order to set itself apart from the crowd without being too gaudy. So I'm looking at gadget designs pre-1990...so that enough time has passed for those designs to look retro if they weren't timeless.

1. Sony Walkman TPS-L2 (1979)


5. Sony CDP-101 (1982)


10. Regency TR-1 (1954)


26. Nintendo Game Boy (1989)


Surprisingly, the sony walkman also looked pretty modern, as well as the Regency radio. Some say that the Regency radio's design was copied by the modern iPod. Like the iPods, they also came in multi colors.

35. Motorola DynaTAC 8000X (1983)


This is an example of not long lasting design. This brick was a foot long and weighed two pounds. It was considered the first mobile phone, and cost $4000. Can you imagine pulling this thing out of your pocket and asking a girl for her number with it? I'm not sure whether it's not a long lasting design simply because of its sheer size in comparison to the gadgets now, making it unwieldy, or if it's just not pleasing to look at.

Saturday, February 04, 2006

Momo, the Comcast guy that cared

My internet's been intermitten the last couple of months. It would go up and down, up and down. It's really quite frustrating, as I rely on it like I do a car or an appliance. So when it's not working, it disrupts my workflow.

We had called Comcast, and most people they hire are not troubleshooters and problem solvers. They just go by the book, instead of thinking about things. The first time we called, the rep told us to put it on a battery backup. That sounded skeptical, but we did it anyway. Then it was changing the outside splitter, and then proclaiming that the splitter in the wall was bad. After going through three of these guys, I finally got Momo, the Comcast guy that cared.

Since it was an intermitten problem, it wasn't readily reproducible. It would of course work while the technician was here. They'd just shrug and say, "It looks good to me." And then they were on their way. Moments later, my internet would be down again. It might be because I scheduled an early morning appt instead of an evening one, where the technicians just want to go home.

However, Momo was a problem solver. He went all the way back to the tap with the signal meter, and found that the connectors were corroded back there. None of the other technicians from Comcast did that. So we were losing about 10dBs just from that connector. So, a tip for all of you out there, there's a greenish pill tube protruding from the ground somewhere in the neighborhood. It's under that cover that has all the neighbor's cable services. You can check out your own connection if you're experiencing the same problem, and none of the technicians don't seem to be systematic in their diagnosis.

I'm calling Comcast to tell them to give Momo a freakin' promotion, because he's doing the world some good. And that Comcast should hire more people that are problem solvers.