The Stars, Like Dust

  • Post author:
  • Post category:Book

This is a short book, and quite different from the other Asimovs I've read recently. Specifically it doesn't have any robots, and isn't a murder mystery. Its also set about 1,000 years into the future from the previous Robot Mysteries. Its a good book, with a style similar to the original Robot Mysteries (distinct from the newer ones written 40 years later). Its short and an easy read. I liked it. Update: I originally thought the space between the Robot Mysteries and this book was much bigger than apparently it is meant to be. According to Wikipedia's page on the empire series: "Some sources further this argument by asserting that The Stars, Like Dust takes place about one thousand years following the events of Robots and Empire." [isbn: 0449023737;0345339290]

Continue ReadingThe Stars, Like Dust

Dealing with remote HTTP servers with buggy chunking implementations

  • Post author:
  • Post category:Python

HTTP 1.1 implements chunking as a way of servers telling clients how much content is left for a given request, which enables you to send more than one piece of content in a given HTTP connection. Unfortunately for me, the site I was trying to access has a buggy chunking implementation, and that causes the somewhat fragile python urllib2 code to throw an exception: Traceback (most recent call last): File "./mythingie.py", line 55, in ? xml = remote.readlines() File "/usr/lib/python2.4/socket.py", line 382, in readlines line = self.readline() File "/usr/lib/python2.4/socket.py", line 332, in readline data = self._sock.recv(self._rbufsize) File "/usr/lib/python2.4/httplib.py", line 460, in read return self._read_chunked(amt) File "/usr/lib/python2.4/httplib.py", line 499, in _read_chunked chunk_left = int(line, 16) ValueError: invalid literal for int(): I muttered about this earlier today, including finding the bug tracking the problem in pythonistan. However, finding the will not fix bug wasn't satisfying enough... It turns out you can just have urllib2 lie to the server about what HTTP version it talks, and therefore turn off chunking. Here's my sample code for how to do that: import httplib import urllib2 class HTTP10Connection(httplib.HTTPConnection): """HTTP10Connection -- a HTTP connection which is forced to ask for HTTP 1.0 """ _http_vsn_str = 'HTTP/1.0' class…

Continue ReadingDealing with remote HTTP servers with buggy chunking implementations

The Stainless Steel Rat Sings The Blues

  • Post author:
  • Post category:Book

The underlying premise of this book is weak (a criminal forced into a band in order to find a stolen item), but like I've said in the past the Stainless Steel Rat books are fun, and not really intended to make you a better person. This one is along those lines too -- its an enjoyable light read, with a much better plot twist than the other Stainless Steel Rat books I've read. I liked it, even with the weak premise. [isbn: 0533405012]

Continue ReadingThe Stainless Steel Rat Sings The Blues

Sydney 1, Mikal 1

  • Post author:
  • Post category:Book

I tried two more second hand bookstores yesterday. Books Buy and Sell no longer exists, it has been replaced with a sex toy store. I guess that says something about Sydney again. Gould's books was all I had remembered (big mounds of books everywhere), and was worth the visit. Its more organised than I remember, and I did eventually find the science fiction section. Thanks to those who recommended it in comments here. It is surprising that a second hand book store managed to have no paperback Isaac Asimov, with the four Harry Harrisons I bought make up for that I suppose. I took some photos of Gould's as well, but it turns out that the room full of PhDs can't figure out how to empty a micro SD card, so I will give up on putting them online for now.

Continue ReadingSydney 1, Mikal 1

Universal Feedparser and XML namespaces

  • Post author:
  • Post category:Python

I've always found python's Universal Feedparser to be a bit hard to work with when using feeds with XML namespaces. Specifically, if you don't care about the stuff in the namespaces then you're fine, but if you want that data it gets a lot harder. In the past I've had to do some gross hacks. For example this gem is from the MythNetTV code: # Modify the XML to work around namespace handling bugs in FeedParser lines = [] re_mediacontent = re.compile('(.*)<media:content([^>]*)/ *>(.*)') for line in xmllines: m = re_mediacontent.match(line) count = 1 while m: line = '%s<media:wannabe%d>%s</media:wannabe%d>%s' %(m.group(1), count, m.group(2), count, m.group(3)) m = re_mediacontent.match(line) count = count + 1 lines.append(line) # Parse the modified XML xml = ''.join(lines) parser = feedparser.parse(xml) Which is horrible, but works. This time around the problem is that I am having trouble getting to the gr:annotation tags in my Google reader shared items feed. How annoying. In the case of the Google reader feed, the problem seems to be that the annotation is presented like this: <gr:annotation><content type="html">Awesome. Canberra has needed something better than buses between the towncenters for a while, and light rail seems like a great way to do it. I…

Continue ReadingUniversal Feedparser and XML namespaces

Sydney redeems itself, if only a little

  • Post author:
  • Post category:Book

On the way home from our awesome soup dumpling dinner in Sydney we dropped into Elizabeth's Bookshop entirely by accident. We'd deliberately walked a block offset from where we do normally to avoid boredom, and just got lucky. The second hand science fiction selection was good (not huge, but big enough to have some stuff I hadn't already got in the collection), but then again the store was quite small. Overall much better than Galaxy. Oh, and they had a huge range of erotic fiction for some reason. That might just say something about Sydney I suppose.

Continue ReadingSydney redeems itself, if only a little

On the potentially sorry state of second hand science fiction book stores in Sydney

  • Post author:
  • Post category:Book

Following a recommendation from Danny, I went and checked out Galaxy Books on York Street during one of my lunch times. The review says they have a good second hand section, and I am still hunting for some old Asimovs. Unfortunately, it was a waste of time. The second hand section must of only had about 100 books in it, and none of them were interesting. They did have an awesome new section though, but I figure buying books from the 1950s new is cheating. One book I might be forced to buy new is Asimov's The Complete Robot. I can't find it in any second hand bookstores that I've tried, and its not even available new in the US. Inexplicably though, it is easily available new in Australia. I am not sure why. It seems like a shame to spend nearly $25 on a book though, so I am not sure what I will do about that one yet. I will continue my hunt for a good second hand book store in the Sydney CBD. Any recommendations? Update: post title fixed after entirely deserved sarcasm from Steven.

Continue ReadingOn the potentially sorry state of second hand science fiction book stores in Sydney

The Stainless Steel Rat Gets Drafted

  • Post author:
  • Post category:Book

This book is another Stainless Steel Rat prequel, although it was written well after the original book. This book takes up from where A Stainless Steel Rat is Born ends -- with Jim arrested (of course), on a surprisingly low tech planet. Jim must then escape, and make his way in the universe once more. He has some unfinished business with some previous acquaintances if he finds a way as well... Harrison's writing is very easy to read, especially because his science fiction books always seem to require a good dose of suspension of disbelief, although some need more disbelief than others, so I read this book as a break from my quite a lot of Asimov. The book is 300 pages, but I managed to knock it over in a day, which I guess means I found it engaging. I liked this book. Its silly, and I'm not a better person for having read it, but it was entertaining. [isbn: 9994607332;0553273078;0553173510]

Continue ReadingThe Stainless Steel Rat Gets Drafted

End of content

No more pages to load