Craig in feed form

Archive for 2010 An orange feed icon

Wireless won’t work out of the box on the Shuttle XS35GT with Fedora 13 because it does not include a kernel driver for the Realtek 8171 network controller. The instructions by Bill Giannikos for 8172 and 8192se controllers work for the 8171 as well… using the same driver as in the guide.

Also, remember to watch out for kernel upgrades because you will need to recompile the module each time there is an upgrade.

Google Books android script

July 29th, 2010

The script below lets you scan multiple book barcodes and add the books directly to your Google Library.

Since getting a Nexus One I’ve been wanting to dabble with programming something for it, Java seemed far too hard. However, I quickly came across Scripting Layer for Android (SL4A) which lets you write quick scripts in a variety of languages; including my favourite, Python. The next challenge was to actually come up with a simple project to get my hands dirty.

Matt Cutts wrote a simple script that scans a barcode and pulls up its Google Books page, from which you can then click the ‘add to my library’ button, but this seemed far too clumsy and slow to me, so I settled on improving it. The script now lets you scan multiple books in series and then add them to your Google library by making use of the Google Books Search API.

See the code (public domain) below:

import android
from gdata.books.service import BookService
import gdata.books

email = 'youremail@gmail.com'
password = 'yourpassword'

droid = android.Android()

def dialog(items):
  title = 'Another?'
  droid.dialogCreateAlert(title)
  droid.dialogSetItems(items)
  droid.dialogSetPositiveButtonText('Add')
  droid.dialogSetNegativeButtonText('Exit')
  droid.dialogSetNeutralButtonText('Upload')
  droid.dialogShow()
  response = droid.dialogGetResponse().result
  return response['which']

def add_from_queue(self):
   for k,b in self.queue.items():
      self.add_item_to_library(b)
   return(True)

def get_by_barcode(self):
   (id, result, error) = droid.scanBarcode()
   if result is not True:
      return(False)
   isbn = int(result['extras']['SCAN_RESULT'])
   q = 'ISBN'+str(isbn)
   b = self.search(q, feed=self.ITEM_FEED).entry[0]
   self.queue[b.dc_title[0].text] = b
   return(True)

gdata.books.service.BookService.get_by_barcode = get_by_barcode
gdata.books.service.BookService.add_from_queue = add_from_queue
gdata.books.service.BookService.queue = {}
gdata.books.service.BookService.ITEM_FEED = gdata.books.service.ITEM_FEED

service = gdata.books.service.BookService()
service.ClientLogin(email, password)

service.get_by_barcode()

i = True
while i:
  response = dialog(service.queue.keys())

  if response == 'positive':
     service.get_by_barcode()

  elif response == 'neutral':
     service.add_from_queue()
     service.queue = {}

  else:
     i = False

droid.exit()

Updated: Thanks to sjb for pointing out a bug in the code; now fixed.

Digital Economy Bill Letter

March 17th, 2010

The following is a copy of the letter I sent to my MP regarding the Digital Economy Bill.

Dear Don Foster,

I have read of your position on the Digital Economy Bill and I am mostly pleased by it; we all like carrots over sticks.

I am writing to first add another voice to the mêlée pressuring MPs to ensure any self serving items introduced at the behest of lobbies are removed and that Labour’s draconian approach is resisted. Aside from any discussion on the societal cost of copyright, an act that press-gangs one group of companies into acting as policemen for another group is a many faced abomination.

Second; to give you the perspective of a PhD student at the University of Bath; one of the stereotyped targets for this bill. I can tell you we would dodge any stick you might try to hit us with. Without meaning to sound arrogant; I and my peers are more familiar with IT than you and yours. We know of and can use technology, to make ourselves anonymous and to encrypt the data we send.

Third, I fully believe the whole system of copyright in this country has lost sight of its original intentions and now solely benefits copyright holders while preventing creative endeavour. Not unsurprisingly, the current argument playing out is framed entirely as a dichotomy, ‘stricter controls’ or ‘what we have now’? But I’m sure an intelligent and interested man such as yourself will already be fully aware of arguments for the drawing-back of copyright. I would be thrilled to see you make your peers just as aware.

On this topic I recommend Jamie Boyle’s book The Public Domain: Enclosing the Commons of the Mind (ISBN:978-0300137408).

Finally, I am extremely disappointed in the behaviour of the Lib. Dem. lords in introducing an amendment such as they did.

Yours sincerely,
Craig Loftus

P.S. I never download music or films; I buy CDs and rent DVDs. I do however enjoy the occasional YouTube clip.

Archives

Categories