Wednesday, April 26, 2006

I Can Work in Synergy

Just wanted to quickly link to the Synergy project, which I'm now using. Wow, it is so cool. Anyone who has multiple systems at their desk or sits a laptop beside their desktop's monitor should really take a look at this. Dual screen is one level of cool, but being able to move my mouse across multiple screens running multiple operating systems is a blast, and productive too. Copy and paste and keyboard and mouse can all be shared. Now, I'm very interested in if windows could be dragged between the screens with this one day...

Python AST Manipulation for Transparent Defering of Calls?

A lot of work has been going on with the Python AST and being able to manipulate it for more runtime uses. This is a generalized suggestion for something we could do in the Twisted community to utilize this.

Given a simple function like this:



def processPage(url):
d = getPage(url)
d.addCallback(cb_processPage)
d.addErrback(eb_processPage)
def cb_processPage(page):
print page
def eb_processPage(error):
print "Could not load page. Error: ", error

We write like that, but what we really mean, and just need to express in a more difficult manner, is:


def processPage(url):
try:
print getPage(url)
except LoadError, e:
print "Could not load page. Error: ", e

What I want to know, is can we take the second example and process the AST branch to produce the first example? Lets step through and see how it would work. First of all, we need to know what is deferred. A simple way would be to check every function return and determine if it is a deferred, but there may be more efficent methods we can discover later. For any possibly deferred call, the expression it is a part of can be refactored out into its own function, as can the exception handler code. When a deferred is detected, the callbacks can be attached and if the operation is not deferred, the callbacks can be used directly. This might even bring about something slightly new: optionally deferred operations. Instead of using defer.succeed and such, returning a deferred could cause code to handle the deferred properly, which would otherwise act in a normal syncronous manner. Depending on just how the AST stuff progresses, maybe the returning of the deferred could trigger the inspection of the calling function to inject the deferred handling code, so only functions that ever get a deferred will need processing.

Sunday, April 23, 2006

Greasemonkey Paving the Way for Frankenstein Software?

I'm not real big into Greasemonkey, and I've never written a userscript, but I love what they can do for me. Blogger drafts are posted for the time I post them, not when I originally wrote them, just like I wanted when I first started using Blogger. Gmail labels can be color coded. There is a huge array of improvements to existing webapps, and what can be done beyond that is amazing. The biggest impact is to webapps, rather than websites. The impact is both in the current set of modified apps, and in what it means for the software landscape. There have been plenty of people to suggest this, but if you haven't heard it you should consider what the greasemonkey mentality could lead to in making software fit every individual user's needs better. Firefox extensions have a lot in common, not surprisingly, sometimes altering core fundamentals of the program to tailor better for users who are frustrated with something that other user's might enjoy perfectly. This kind of pick-your-parts software customizing is going to increase, and sooner or later the developers will emprace it and we might even see webapps that function as a base and implement some more of their functionality as userscripts. What if greasemonkey started to recognize a way for websites to publish large sets of userscripts that apply to them, and you could easily enable or disable the ones you want. The application would become a channel for its own customization through external scripts, lower the bar to using the scripts drastically. Just how much development could we push into userscripts, and how much of a framework could we build out of them, to make them more stable between versions, work together more safely, and one day be able to build entire apps with them? Can the userscript concept go beyond the web? How could something be implemented for a Python or Java application?

Friday, April 21, 2006

How my websites can get along

Earlier I asked "Why can't my websites get along?" and now I'm going to answer myself.

What I want them to do

The love triangle in question, to review, is GMail's contact list, Amazon.com wish lists, and the Google Reader and the books listed in some posts there.

Any books mentioned in posts through Google Reader (or on any page, for that matter) should be flagged as being books, or the browser should be able to just figure out that they are books. It shouldn't link them directly to Amazon.com from the website, because maybe I like to by through B&N, right? My browser should see these elements marked (somehow) as being book titles, and make them into links to the books entries at Amazon (or Barnes & Noble). To take this a step further, the book sites might publish some kind of services feed, that lists services available to some particular resouce. So, when you ask it "What can you do with A Tale of Two Cities?" it will say "I can add it to your wish list. I can add it to your shopping cart. I can sell it to you immediately." and etc. Where should these commands show up? Well, that's up to the browser, really. It could be in a right click context menu, or an expanding dialog when clicking the element associated with the book, or maybe in a smart sidebar populated with all the books (and other intelligently utilized resources) found on the current page.

In this example, I tell my browser "I want to add this to my wish list." and it does what the service feed tells it to do, and requests some resource that is known to handle the action it wants for the target in question. Amazon.com will handle this request by adding the book to my wishlist, and it doesn't even have to show me a page about it. It should tell the browser about the success of the command, but that doesn't have to be anything Human Readable, does it? My browser might display a little checkmark or something next to the books name, even in other pages three months later.

Some point in the future, after I have lots of nifty books on my wish list, I'll want to send it out to friends in family. It is my birthday, after all. At Amazon.com, I click on the "My Wish List" link and I view my books and I click on "Send this list to someone" because I want everyone to buy me things. The page I navigate to will have a form, where it wants a list of email addresses and a message to send along with the list. The emails is what interests us. Somehow, they need to communicate that this particular input on the form is a list of email addresses. This might be some new attribute for input or form elements, but it doesn't really matter. What matters is that the client will see this and know I am going to entire e-mail addresses. It could do a lot of different things with this information, of course. It might give me a drop-down list of known emails, and those might come from a number of places. It might have different address book protocols implemented, or might pull e-mails straight from GMail webpages. In any case, it will acquire them the best way it knows, and I'll have this list anywhere I need it, including to send out my Wish List.

And then, everyone buys me stuff.

What pieces are missing

I've gone over a few things we need to accomplish to be able to combine services and information freely like we should have been doing years ago. Service feeds are an important concept that is only very lightly being touched on yet. In this case, I am talking about some Web Service that you can ask about other web services available. You would give it something it knows about, like a book ISBN or title, and it would tell you what it can do with that resource. It would return a list of commands, by name and the URLs to execute those commands. Maybe your browser would look to http://www.amazon.com/services/servicesfor?title=Prefactoring to get an XML document that has the information it needs. Does anyone reading know if there is a current format or specification to deal with that kind of data specifically? These services should all be considered something the client would perform on our behalf, maybe without us seeing. That means the results of the requests should be status-oriented, and don't need to be webpages at all. If they want to say "There is a webpage here about this request I just completed, too" then that is fine. The final component involves the data we need to put into all of these webservices, and how much about what it wants we and our webclients know, so as to better equip us to provide that information. Again, is there something in the works towards this goal?

Thursday, April 20, 2006

Internet TV Makes Me Do Stuff

I love that I can watch TV on the internet. Adult Swim's Fix is especially a well visited destination for me. However, I do have a problem with them. One and all, in my expirience, they forget what radio stations and television channels have trained us for all our lives: never reach for the remote until you know what's on next. When one show is over, the familiar feeling of "hey, look what's next" is a nice way to relax in front of the TV, because its already on its way and you don't have to do a damn thing for it. All the video distributions I've used across the internet, however, make me request each and every show or clip or whatever, and simply stop when the current one ends. Why can't I sit back and enjoy the show, without knowing what it is?

Top-Reply in Emails and More-Than-Text Body Formats

I commented to Fighting the top reply over at Signal vs. Noise and felt like writing a small bit about it here. The basic issue was where to place your reply in an email, as any modern mail client will quote the original text and most of them place your cursor right above it. I have a couple of angles to take on this, but the conclusions all arrive at the same place.

When I still worked at an office and spent a decent portion of my time tracking efforts and monitoring going-ons throughout the company, I used Microsoft Outlook, which was enforced by the corporate IT people. Although it did bug me that I was unofficially forced to top-reply, I admit that in certain situations I do it myself, anyway. Typically, my view is that if the conversation shouldn't go on for a long time with the need to review a chronological log of what was said, and is only between two parties who will know what was said before, top-reply is really OK. When you are on a mailing list or newsgroup or in a reply-all cycle with thirty other people, it can get a little confusing trying to track the conversation.

I have probably slipped even more once I started using GMail, because it makes it easier to track the converstation by showing me all the actual emails, with quoted text collaposed. This might seem lazy, but I am a firm believer that the software is here to make our lives easier, so why do we ignore so many ways it can do that? Why not take the next step and stop quoting text by prepending a bracket or indenting it and come up with some extensions to the email protocols, maybe some new headers or a modified Multi-Part header, which would let us specify "Quoted Text" and "Reply Text", with the reply associated directly with the quoted text.

How we want this to be arranged on screen when we write it and how someone wants to read it, should not be based on the order of the bytes representing the glyphs that display the text we read. It shouldn't be a convention, it should be a preference and that preference should be free for all. This all reminds me a lot of a vast HTML-vs-PlainText-Email flame I was on the painful end of a while back, all because some people still want to use some console based email apps (which is fine) that don't support Multi-Part messages properly (which is not fine).

Wednesday, April 19, 2006

Bad eMusic Expiriences?

Has anyone has had a bad expirience with eMusic? Lured by promises of DRM-free MP3 files, like so many others, I signed up for a trial of their service. I was unimpressed with the selection, although I understand the problem they face trying to convince the labels that their methods are financially safe for the music industry. Still, my wife and I were unable to find even a handful of songs we were interested in, and I found it impossible to actually download anything. Their download manager gave me an error about some non-existant cache directory within my Firefox installation, and their support offered no help that actually solved the problem, just a standard "Reinstall the program and try it again." Realizing the service would not be worth the $9.99 per month, I cancelled my account and didn't look back.

Until they charged my bank account two weeks later and caused me a series of cascading overdraft fees that I've had to lodge a complaint with my bank to clear up. I contacted eMusic about this issue, and they will not respond, so my bank is looking into this matter for me. Thank god for fraudulent charge protection on my Visa, because the month of eMusic I didn't even want almost cost me $73.99 plus a massive headache.

Tuesday, April 18, 2006

Google Loosing the Charm?

For years we've been so in love with Google. Don't deny it, a part of you smirks or even cringes when you see a colleuge searching with Yahoo or MSN. You feel better than "those hotmail kids" because you are @gmail.com. Google is at the forefront of all that is technologically good and righteous, and we just can't get enough.

I think I've had enough.

Why am I using Microsoft's Live Earth instead of Google Maps/Local (they can't seem to draw a good line between the conjoined services)? Live's Image search is enough to make Google Image look like a cheap gallery on a geocities page. YouTube consistantly provides better content than Google Video, whose saving grace is the large video size by default and that you can rent Night of the Living Dead. I'm desperately looking for something to replace Google Reader for my feed consumption, and eagerly awaiting Divmod to reopen Quotent so I can pay them to not have to use GMail anymore. Google recently launched their long-rumored calender service, and I've been using it but am continually frustrated by the interface's inconsistancies.

The various things that lead me to realize more and more that Google isn't so fantastic have also opened my eyes to an interesting revelation: their web-app interfaces are pretty poor. Simple is good, so they seem to drop features just to make it look clean, but end up with a stump of what could have been. And, I'm continually tired of the lack of interconnectiveness with all the Google app's that I use. Blogger, GMail, Reader, Calender, and its like I'm using them all from seperate venders.

Google, what are you paying all those PhD's to spend the 80% of their time on? At the rate Live is improving and companies like 37signals are tossing out great web-apps, you're going to fade away and be lucky if you salvage a place in the world as a mediocre advertisement channel.

Utilizing Python's Assert Statements for Compile-Time Checks

Some recent discussions around the 'net have been tossing around the ideas about static typing in python, briding static and dynamic typing in C++-like languages, and similar concepts of making static-typing more dynamic or dynamic languages more optimized in static-typing ways. Particularly, I was sparked by Michael Feather's "Set of Tests" article. There are different ways we might look into bringing those concepts to Python, and I rolled a few of them around in my head. My final mental landing was "Can we utilize the assert statement to inform the compiler about these tests that are absolute?". Of course, you probably can see how this is a lot like what assert does now, with the only difference being between run-time and compile-time being the target of the rules. This leads us to looking for where an assert could be compile-time verified and then used to optimize code. The most basic compile-time assert I can think of us "assert builtin is builtin", which would be a contract that the name 'builtin' will continue to be bound to the default builtin object, and won't be changed. This means we can do "assert isinstance is isinstance" and the compiler can make assumptions it could not before: that when it sees the name isinstance, it knows exactly what it is before runtime. This opens up other expressions that use these known names and promise other things to the compiler. We could do things like "assert isinstance(l, sequence)" or "assert len(l)==3", which would create a pair of contracts that l was some kind of 3 element sequence, and the compiler could make it a tuple for optimization.

Saturday, April 15, 2006

Who types correctlly?

Even the most computer-literate geeks usually do not use the "proper" methods of typing. I've not used it since keyboarding class in Jr High, myself. I am wondering, do you use the proper methods or not? Do you rest on the home row and hit the space with a thumb and never an index? I'm also wondering, has anyone taken the plunge and tried to relearn their typing skills after years of doing it the "wrong" way?

Saturday, April 08, 2006

So I finally tried Google Desktop

Windows has given me the opportunity to try some things I was curious about, but unable to look into while still using Linux exclusively. Namely, the emerging market of Desktop Applet Channels, such as Google Desktop, Microsoft's Live.com, and Yahoo Gadgets. I have since tried all three of these, but I dislike all of them. I am keeping Google Desktop run for the search, photo, and news features, but I have my issues.

I had applet/gadget/whatever installation problems with all three of these, mostly related to having to install things as the Administrator but actually running the thing as a normal user. I especially found this a bad thing for Google, who I expected to be a little more security savvy.

Trying the three of these out does make me wonder about the possibility of some open initiative for something like this. It would probably be based on Python, PyXPCOM, and XUL Runner. It should not install applets, but cache them from web URLs. I would love to see something like this take off. Google might even back it, as it would be easy to integrate into Google Desktop panels. Anyone could publish applets for it easily, and people could preview them in webpages before even installing the client app to use them. Effectively, this could allow us to write web-apps that are psuedo-installable as desktop-apps. Just imagine using Writely, going out of network range, and continuing its use?
I write here about programming, how to program better, things I think are neat and are related to programming. I might write other things at my personal website.

I am happily employed by the excellent Caktus Group, located in beautiful and friendly Carrboro, NC, where I work with Python, Django, and Javascript.

Blog Archive