I notice that Ian
Stevens mentioned an application that the company he works at
recently released.
Damn, what a sell-out! I can't wait to
see what his next announcement will be.
Disclaimer: I work with Ian, and he knows that I don't actually think he's a sell-out.
urls = ["http://www.neilgaiman.com/journal/journal.asp"]
def simpleprovider(context, text):
context.push("channel", title="Neil Gaiman", link=urls[0])
header = '<font Class="bold"> Journal:<font>'
signature = '<blockquote>'
i = j = k = 0
j = text.find(header, j)
while 1:
i = text.find(signature, j)
if i < 0:
break
j = text.find(signature, i+len(signature))
if j < 0:
break
description = text[i:j]
context.push("item", link=urls[0], description=description)
if __name__ == "__main__":
# test wrapper
import urllib
class context:
def push(self, tag, **kw):
print tag, kw
simpleprovider(context(), urllib.urlopen(urls[0]).read())
Well, mail works now, as does web and even the cute little weblog script, but logging on an X session at the console fails pretty heinously. (Specifically, rxvt fails complaining that it couldn't open the pseudo-tty, or could not obtain control of tty, depending on what random bit I flipped before I tried to launch it.) Plain old xterm seems to work just fine, though. More debugging later, I guess. For now, I'm just going to go to sleep.
Apparently we've been hacked. Craptastic. I've changed all the files I think they affected, but I also removed a bunch of files that I didn't know I needed. Oh well, everything should get back to normal any time now.
Oh, yeah, and mail doesn't work. I'll see if I can fix that tonight.
So the company I work for has just released our first product. It took a lot of time and effort to get there, but I think we did something good. The main part I've been working on these past few weeks was the "synchronized (offline) mode!" part. There are a lot of challenges to writing a Conduit for the Palm Desktop, some of which come from our framework. It was really designed to be used in an application, with Models, and Views, and asynchronous network calls. I'm trying to use it in a dll with no UI, no application, and synchronous messages. It's a bit of a mis-fit, but it mostly works.
So when I was writing the first iteration of the tiny web browser I looked around on the Internet for stories from other people who had done the same sort of thing, so that I could hopefully avoid some of the dumber mistakes people had made, and if I was very lucky, perhaps I might even pick up some tricks to make my implementation smaller or faster. Sadly, though, I found nothing. So I forged ahead with my design, and said that when I was done, I would put my experiences up so that other people didn't have to repeat my mistakes, and could possibly learn from what I did correctly.
The first thing I think I did correctly was to break the stream up into elements, all of which had content to paint, and all of which had a bitfield of formatting flags. In my gadget, I would figure out the bounds for any given element, splitting a long bit of content up into several lines each with their own bounds. When the time came to paint the html, I would just loop through the elements, set the colour and font based on the format flags, and draw the string at the bounds. This made the drawing extremely fast, which was a good thing.
(Next issue, Limitations...)A while ago, I wrote an HtmlViewer component for the Palm. It was hard, and I made a lot of assumptions on the basis that we would be getting our data from a server that we would also write, so it made more sense to have the server do anything that was necessary to the input stream to make it easier for the small device to display. (Things such as figuring out the widths of table cells, and making sure that any start tag also contained an end tag. You know, simple stuff.) The problem came when we started using my HtmlViewer to display content that we got from a client. The content was a complete mix of tags, and had no hope in hell of validating. As well, the server guys were swamped with other requests, and didn't want to write the code it would take to fix the html up. So my component broke. Colin (a co-worker) suggested that we just modify what I had to do what we wanted. After some discussion, I convinced him that it would be faster to re-write what was there so that it didn't make the same assumptions.
(To be continued...)


