Skip to main content

Ralsina.Me — Roberto Alsina's website

Quick Hack to Catalog your Books

If you have ac­tu­al, pa­per books and want to cat­a­log their in­fo quick­ly, this book­da­ta.py script may be handy:

import sys
import time
import gdata.books.service
import json

def get_book_info(isbn):
    print "Looking for ISBN:", isbn
    google_books = gdata.books.service.BookService()
    result = google_books.search('ISBN %s '%isbn)
    data = [x.to_dict() for x in result.entry]
    if not data:
        print "No results"
        return
    title = data[0]['title']
    with open(title+'.json','w') as f:
        f.write(json.dumps(data))
    print "Guardada info de '%s' en '%s.json'" %(isbn, title)

if __name__ == "__main__":
    while True:
        isbn = sys.stdin.readline().strip()
        if isbn:
            get_book_info(isbn)
        time.sleep(1)

What does it do? It reads IS­BN num­bers from stan­dard in­put and saves the book's in­fo in a ti­tle.j­son file for lat­er pro­cess­ing and for­mat­ting.

If you want to ed­it that in­for­ma­tion, you can just do it or you can try do­ing a lit­tle script us­ing json­wid­get like this:

python -c 'import jsonwidget; jsonwidget.run_editor("abook.json", schemafile="gbooks.schema")'

Where abook.j­son is a file gen­er­at­ed by the pre­vi­ous script and gbook­s.schema is this file.

Oh, and if your books have bar­codes, you can just do:

zbarcam --raw | python bookdata.py

Show your com­put­er your books and let it do the rest :-)

PS: I would love if some­one gath­ered all this and made a nice per­son­al book cat­a­logu­ing thing.

The Arrows of Outrageous Fortune

You know how I know we live in a uni­code world now? Of the 300+ uni­code ar­rows, all dis­play cor­rect­ly by de­fault on Win­dows, Mac and Ubun­tu, ex­cept maybe ~25.

← → ↑ ↓ ↔ ↕ ↖ ↗ ↘ ↙ ↮ ⇦ ⇨ ⇧ ⇩ ⬄ ⇳ ⬀ ⬁ ⬂ ⬃ ⬅ ➡ ⬆ ⬇ ⬈ ⬉ ⬊ ⬋ ⬌ ⬍ ⇐ ⇒ ⇑ ⇓ ⇔ ⇕ ⇖ ⇗ ⇘ ⇙ ⇍ ⇏ ⇎ ⟸ ⟹ ⟺ ↤ ↦ ↥ ↧ ⇤ ⇥ ⤒ ⤓ ↨ ⇆ ⇄ ⇅ ⇵ ⇈ ⇊ ⇇ ⇉ ⇠ ⇢ ⇡ ⇣ ⇚ ⇛ ⤊ ⤋ ⭅ ⭆ ⟰ ⟱ ↩ ↪ ↫ ↬ ↞ ↟ ↠ ↡ ↚ ↛ ↜ ↝ ↢ ↣ ↰ ↱ ↲ ↳ ⬐ ⬎ ⬑ ⬏ ↴ ↵ ↺ ↻ ⥀ ⥁ ⟲ ⟳ ↶ ↷ ⤾ ⤿ ⤸ ⤹ ⤺ ⤻ ↼ ⇀ ↿ ↾ ↽ ⇁ ⇂ ⇃ ⇋ ⇌ ⇜ ⇝ ⇽ ⇾ ⇿ ⟻ ⟼ ⟵ ⟶ ⟷ ⬳ ⟿ ⬱ ⇶ ⥊ ⥋ ⥌ ⥍ ⥎ ⥏ ⥐ ⥑ ⥒ ⥓ ⥔ ⥕ ⥖ ⥗ ⥘ ⥙ ⥚ ⥛ ⥜ ⥝ ⥞ ⥟ ⥠ ⥡ ⥢ ⥣ ⥤ ⥥ ⥦ ⥨ ⥧ ⥩ ⥮ ⥯ ⥪ ⥫ ⥬ ⥭ ⇷ ⇸ ⤉ ⤈ ⇹ ⇺ ⇻ ⇞ ⇟ ⇼ ⬴ ⤀ ⬵ ⤁ ⬹ ⤔ ⬺ ⤕ ⤂ ⤃ ⤄ ⬶ ⤅ ⬻ ⤖ ⬼ ⤗ ⬽ ⤘ ⤆ ⤇ ⤌ ⤍ ⤎ ⤏ ⤙ ⤚ ⤛ ⤜ ⤝ ⤞ ⤟ ⤠ ⤡ ⤢ ⤣ ⤤ ⤥ ⤦ ⤪ ⤨ ⤧ ⤩ ⤭ ⤮ ⤯ ⤰ ⤱ ⤲ ⤫ ⤬ ⥼ ⥽ ⥾ ⥿ ⤶ ⤷ ⤴ ⤵ ⤼ ⤽ ⥂ ⥃ ⥄ ⭀ ⥱ ⥶ ⥸ ⭂ ⭈ ⭊ ⥵ ⭁ ⭇ ⭉ ⥲ ⭋ ⭌ ⥳ ⥴ ⥆ ⥅ ⬷ ⤐ ⬸ ⤑ ⬿ ⤳ ⥹ ⥻ ⬰ ⇴ ⥈ ⬾ ⥇ ⬲ ⟴ ⥷ ⭃ ⥺ ⭄ ⇱ ⇲ ↸ ↹ ↯ ↭ ⥉ ⥰ ☚ ☛ ☜ ☝ ☞ ☟ ◄ ► ⇪ ⇫ ⇬ ⇭ ⇮ ⇯ ⇰ ➔ ➘ ➙ ➚ ➛ ➜ ➝ ➞ ➟ ➠ ➡ ➢ ➣ ➤ ➥ ➦ ➧ ➨ ➩ ➪ ➫ ➬ ➭ ➮ ➯ ➱ ➲ ➳ ➴ ➵ ➶ ➷ ➸ ➹ ➺ ➻ ➼ ➽ ➾

A few years ago, many apps and fonts were con­fused by sim­ple let­ters with di­a­crit­ics like á. So, yes, re­al progress hap­pen­s.

The Long Post About PyCamp 2012

As I have men­tioned in half a dozen posts al­ready, I spent the last week­end at Py­Camp 2012. But what I have not writ­ten about is what ex­act­ly it was, and why any­one would want to at­tend one, or maybe or­ga­nize one. So that's what this post is about.

Py­Camp was or­ga­nized by PyAr, the Python Ar­genti­na com­mu­ni­ty. PyAr is a very spe­cial bunch of peo­ple, who are com­plete­ly am­a­teur, and do ev­ery­thing for love and fun. Since PyAr is a very spe­cial group of peo­ple, the things PyAr caus­es, in­spires or cre­ates are spe­cial as well.

So, since a few years ago, what hap­pens is some­one finds a place with bunk bed­s, a large room, per­haps some­what iso­lat­ed, that pro­vides meal­s, and is cheap (it's as hard as it sound­s) and rents it for a long week­end. Then ev­ery­one is in­vit­ed to chip in for the rent mon­ey.

This year, 4-­days, all in­clu­sive, cost­ed rough­ly U$S 100. Sure, it's not ex­act­ly lux­u­ry ac­co­mo­da­tion­s, but it does what it has to do, which is give us shel­ter and pro­tect us from wild an­i­mal­s.

Thus, you end up with a few dozen nerds with com­put­er­s, one of them is great at set­ting up wire­less (Joac!), one is the MC (Ale­cu!), one helps around (Fa­cun­do!) one is the li­ai­son with the lo­ca­tion (Pin­don­ga!) and so on, the work is spread around, and we have time and com­pa­ny to hack.

So, on the first morn­ing, ev­ery­one pro­pos­es what he would like to work on. Those pro­pos­als are vot­ed by the pub­lic, and those with more votes are as­signed slots (5 a day), where they will be the main fo­cus of at­ten­tion.

So, what hap­pens if your pro­pos­al is not vot­ed? Well, you ei­ther find a pro­pos­al you like, and join it, or you just do your thing. Be­cause this is not a democ­ra­cy, this is an­ar­chy, the votes are just a way for ev­ery­one to know what peo­ple will be do­ing, and to find places to fit in if you want (BTW, there is a sit­u­a­tion in LeGuin's The Dis­posessed which is so much like this, it's scary).

Af­ter that, you just do what you wan­t. You can put your head­set on, and code, or min­gle and chat, or join a group, or do a bit of ev­ery­thing. Since meals are catered, you don't have to wor­ry about break­s. When the meal is ready, ev­ery­one breaks at the same time and so­cial­izes in com­mu­ni­tary ta­bles.

Does all this sound as strange to you as it does to me? A bunch of grown pro­fes­sion­als act­ing like hip­pies. Well, it feels strange too, but that does­n't mean it does­n't feel great. It even works great. Once you see what the oth­ers are do­ing, things you would­n't ex­pect start look­ing like fun (Cel­ery!?! Jug­ger­naut! An­droid!) and the sheer ex­cite­ment of peo­ple telling you "look, I did this!" is in­fec­tious, and ex­hil­a­rat­ing.

Al­so, RC cars, kinect hack­ing, an­droid hack­ing, elec­tric gui­tar hack­ing, jug­gling, mono­cy­cle lesson­s, a firepit, al­co­hol, cof­fee, mate, boardgames, cardgames, mu­sic, jokes, adrenaline, huge spi­der­s, asado, cold, vim, nin­ja, ping pong, ro­bot space­ship­s, peo­ple you see on­ly twice a year if that, ques­tion­s, not know­ing the an­swer­s, fig­ur­ing things out on the run, get­ting help in that thing you have been stuck for week­s, hav­ing the piece some­one else has been stuck on for week­s, feel­ing like some sort of beard­ed bud­dha and a to­tal ig­no­ra­mus in 5 min­utes...

And at least I, at least this year, had a very pro­duc­tive week­end. I got help from a bunch of peo­ple in things I was daunt­ed by, I felt like an ac­tive pro­gram­mer in­stead of a suit, which is al­ways nice, since I don't own a suit, and had a great time. Laughed a lot. Made a cou­ple new friend­s. Saw a bunch of old ones. Helped a few peo­ple.

So, I would like oth­er peo­ple to have as great a time as I had. Of course com­ing to Ar­genti­na is prob­a­bly not a great idea. It's an ex­pen­sive trip, if you don't speak span­ish you will miss a lot, and if Py­Camp gets too big it may stop be­ing fun at al­l.

But why not do some­thing sim­i­lar? Does­n't have to be about Python, you can do it about mak­ing stuff, about pro­gram­ming in gen­er­al, what­ev­er. Just get a some­what com­fort­able, some­what iso­lat­ed place with a rea­son­able cater­ing and get your 50 near­est geeks there, and have a ton of fun.

You may get some­thing use­ful done, too.


Contents © 2000-2021 Roberto Alsina