Posts about nerdness (old posts, page 2)

2010-08-29 16:58

PET: English Translation Issue 1 has a date

Because it worked once, let's do it again. I have just set a completely arbitrary, and probably too early date for the release of the first english Issue of "PET: Python Entre Todos" magazine.

The english version is called PET, which means "Python Entre Todos: English Translation".

It will have the same contents as the first spanish Issue and... it will be the last Issue done like this.

From now on, both versions will be published at the same time, if we can.

So, there will be a very short gap between the english first Issue and the second one (less than a month, we hope).

So, stay tuned

2010-08-23 18:50

I'm a nerd, but I Have a Cheap Phone

I just got a new phone because my old one disappeared. I got a Samsung Star, which is not a smartphone, but what they call a featurephone, which seems to mean "it does a lot of things but is cheap, can only be coded in Java and doesn't run android".

Here's some of the features of this baby:

  • Touchscreen, 400x240
  • Fake GPS (gives you a 400 meters radius of your location. Good enough for me in the city)
  • Webkit-based browser that works surprisingly well (it comes with the LGPL as a document and you can't delete it :-)
  • Accelerometer
  • FM radio
  • A 2GB micro-SD card
  • 3.2MP camera (takes video at 320x240).

The camera can take decent photos in good conditions:


And it even has some "advanced" features (by which I mean: things my cheap dedicated camera doesn't do), like smile shutter and panoramic shots:


Other that that... well, it's a phone, what can I say. It was "cheap", which means "it costs more than I want to pay for it, but less than the alternatives".

So, how am I taking advantage of it...

First: I have not had a decent pocket-sized ebook reader since my last Clie died. So, I looked for software to do that.

It turns out that the world of Midlets, as feature phone apps are often called, is aweird place, where things are quite hard to find for the uninitiated.

There is a sort of "app shop" at but it's by no means comprehensive, and often things are quite hard to find.

After lots of looking, I found a good (I may even say very good) program called Foliant. Here's their home page, russian only ... it's weird, my favourite Palm ebook reader, Palm Fiction also has a russian-only site!

Of course, the fonts sucked (way too large) but it turns out you can convert TTF fonts using this tool so I am now back to the lovely Droid Sans I am used to.

Another nice thing about the new phone is that it can actually play media (yes, my previous phone was so crappy it didn't even play mp3). But... not every kind of media. For audio, just use mp3. For video... it's a bit more complicated.

Here's the short version:

  1. Convert using HandBrake, ffmpeg MP4 video, AAC audio.
  2. Always use the .mp4 extension, the phone is not smart enough to know what a .m4v is.
  3. Don't make the video larger than 320x240.

Number 3 is a problem. For example, you may have a video in a wide screen format, like 640x272, which is a 2.35:1 ratio.

The obvious thing is to cap the width to 320, and that would give you a 320x136 video.

Well, that's wrong. What you should do is find the right height, keeping aspect ratio, for a 400px width. In this case, that would be a 400x170.

But you can't use a 400x170 video! which is why you will use 320x170, and on playback tell the phone to stretch it and ignore aspect ratio. And voila, 400x170 and the correct aspect ratio.

The difference? 320x130 has only 41600 pixels, while 320*170 has 54400, which means you get a 30% better picture.

Yes, it's tiny (3 inches) but it looks pretty sharp, and depending on the kind of material you are watching, it works.

UPDATE: Foliant is better than I thought, once you get the Samsung-specific version. It's fullscreen (no silly soft buttons) and the screen rotates automatically using the accelerometer. It's a pleasure to use, and the UI is very nice.

2010-08-19 23:02

Spain is much bigger than you think!

On the news today (the newspaper is Tiempo Argentino, sorry about the unreadable photo):


It says "In Spain it amounts to less than 340 thousand customers a month, or 0.006% of the total".

This is talking about cellphone users. Now, how many cell phone users are there in Spain?

According to this newspaper, 340000 are 0.006% of the total, so... 5 666 666 667 (aprox.), therefore, Spain has roughly one cell phone for each man, woman and child in the world.

2010-08-13 18:46

Things I learned publishing a magazine

Today at 00:00:00 GMT-3 PET: Python entre todos was indeed launched, in time (arbitrary but forced) and in budget ($0).

So, what did I learn? I learned a lot!

  • The only thing you need to publish an e-mag is time and content.
  • Time can be converted into content, but if you write everything yourself it's a blog, not a magazine. Luckily, PET found great contributors.
  • If you want utilitarian design, rst2pdf can do the job
  • In fact, it can do it better than other tools in some ways
    • I can push a fixed version of the PDFs in 5 minutes for all layouts. How much would it take me using Scribus or other DTP? In a magazine where correctness matters, that's a big deal.
    • TOCs are better than in most amateur PDF magazines I've seen. The in-content-TOC is clickable, and the PDF TOC is perfect.
    • Page numbers in the PDF TOC make sense (no, the cover is not page 1)
    • I am producing 6 PDF versions: A4(bw, colour), A5(bw,colour), Booklet(bw, colour) and I could add any other I want in a few minutes.
  • I learned about PDF imposition!

Let's explain the last one:

Suppose you want to print a small booklet, and you have 32 pages of content. How do you do that?

The easiest way is to print it 2-up double-sided in A4 paper so that you can stack the pages, fold them down the middle, staple them, and get a nice A5 booklet.

The problem is that the page ordering is hard to get right. For example, for a 4-page booklet, you need to print one A4 page with pages 4-1 on one side and 2-3 on the other. For an 8 page booklet it's 8-1,2-7,3-6,4-5.

Lucklily there's a way to get this done automatically:

1. Install podofo 3. Get booklet-A4.plan (see below) 2. Run this:

podofoimpose my-A5-pages.pdf my-booklet.pdf booklet-A4.plan lua

booklet-A4.plan is this:

---Generic Booklet (A4)
---It is said generic as it will try to determine
---automatically how to fit the booklet onto A4
---paper sheets, scaling pages if necessary.
---it is well suited for office documents for
---which you do not care too much about resulting
---imposition artefacts since it manages to save
-- print("Booklet")
-- We output an A4 booklet
PageWidth = 595.27559
PageHeight = 841.88976


-- We assume that H > W
-- Argh, we now can do better since we have "if" ;-)
-- Scale = PageHeight / (2*SourceWidth)
if(SourceWidth <= SourceHeight)
--  If you A5 pages are not really A5, uncomment the next line
--  Scale = PageHeight / (2*SourceWidth)
    Scale = 1
    rot = 90
        xof = SourceHeight
        yofRA = 0
        yofRB = SourceWidth
        yofVA = 0
        yofVB = SourceWidth
--  If you A5 pages are not really A5, uncomment the next line
--  Scale = PageHeight / (2*SourceHeight)
    Scale = 1
    rot = 0
        xof = 0;
        yofRA = 0
        yofRB = SourceHeight
        yofVA = SourceHeight
        yofVB = 0

    rest = PageCount % 4
    totp = PageCount
    if rest ~= 0
        totp = totp + ( 4 - rest)
    inc = 0
    count = 0
    imax = totp/4
    while count < imax
--          We assume that podofoimpose will discard invalid records
--          such as those with source page greater than PageCount
--          print(totp, inc, rot, xof,yofRA, yofRA, yofVA, yofVB)
-- Recto
        PushRecord(totp - inc , inc + 1 , rot, xof , yofRA)
        PushRecord(inc + 1 , inc + 1 , rot, xof , yofRB)
-- Verso
        PushRecord(inc + 2 , inc + 2 , rot, xof , yofVA)
        PushRecord(totp-(inc + 1) , inc + 2 , rot, xof, yofVB)

        count = count + 1
        inc = inc + 2

That code is taken from here:

And voilá, you get a scrambled PDF with the pages in exactly the right order (and empty pages added as needed).

2010-08-10 16:57

Come see me in Bahía Blanca next weekend!

I will be speaking at the Jornadas del Sur in Bahía Blanca this weekend (August 14/15 and 16).

For a change, I will not be giving my old tired talks, but a brand new one, called "The Amateur", and probably a lightning talk or something else.

The usual offer of free beer will not be possible this year, so: If you mention this blog in the QA session, you get... free candy!

After that, I will be speaking at FM La Tribu on saturday August 21st in the Charlas Abiertas 2010 where I will be speaking about a lot of things between virtualenv and nose and tox and other testing-related topics.

2010-08-09 15:57

It's coming: PET - Python Entre Todos


I removed the countdown because it was wrong (timezone problem). Check for one that works :-)

I have been dragged into YAP (Yet Another Project) and in this case it's the first-issue-ever of PET - Python Entre Todos a python online magazine in spanish.

This is an emergent output of PyAr the online Python community of Argentina, and it may never have a second issue unless we get a lot of help, so pay attention to the first one :-)

I have been doing webmastering, editing and PDF production, Emiliano Dalla Verde Marcozzi has been helping everywhere and getting articles.

The first issue is some 45 A5 pages (or 23 A4 ones) in small type, so it's not exactly huge, but it has half a dozen articles aimed at different python levels.

It has been a lot of fun so far, I hope it's well received!

2010-06-03 13:21

Random photos from my phone

A few days ago I finally got my 89 cents bluetooth dongle (now $1.85, but still with free shipping from china!) and got a bunch of pictures I had in my phone.

The quality is crap because my phone is crap, but trust me, there must be one thing here you have never seen before.

Here they are: weird stuff that made me take out my phone and grab a picture, with explanations.


This, from Mar del Plata, is the most badass popup book I ever saw.



And open:


I'm Mark Shuttleworth!

Imagen024 Imagen025

In a free software event in Buenos Aires, Canonical's boss and former space cargo was supposed to deliver the keynote. He canceled at the last minute. So Maddog Hall offered to replace him... in character.

Someone found a really, really awesome (and/or crappy!) astronaut costume, and Maddog gave a keynote shouting "I'm Mark Shuttleworth! I'm an astronaut!" and claiming to have come from the future to examine some slides recently found, written by some unknown dude named Maddog. Really funny stuff.

Python vs. Ruby

Same event, take a look:

Imagen023 Imagen022

Yes, I swear they are taken with less than 10 seconds of one another.


Imagen018 Imagen026

I was buying groceries in San Isidro's Disco supermarket. Yes, usually buying a large package of butter is cheaper per kilo than a small one. But here, a 200g package costed almost the same as a 100g! That's just stealing money from those who don't use much butter. Me? I'm not at risk.

Visa discount!


This was a shop in Avenida Alem in Buenos Aires. It was unusual to see a "VISA is suspended, 20% discount" sign. Much more unusual was to see the small letters: "present your visa card". I mean, wasn't it suspended?

And then I saw the rest:


It says "present your visa card and pay using anything else".

That guy must really have been pissed off at Visa!

I got a bunch more for some other time.

2010-03-24 17:27

The day we saw the dinosaur (an Ada Lovelace Day story)

Today, March 24th is Ada Lovelace day, a day of blogging to celebrate the achievements of women in technology and science.. I am taking the liberty to tag this as python so it appears in the right planets, but that's just to promote Ada Lovelace day. Sorry 'bout that.

I will write about the only person who ever taught me programming, Claudia. I was young, so the earth was still lukewarm, the day we saw the dinosaur.

I was just a green sophomore in the School of Chemical Engineering where, paradoxically I would never take a chemistry class, being an applied math student and all that, and at the time "personal computers" were a novelty, a toy of the upper middle class.

We had spent the first two months of the semester learning how to program the obvious way: writing assembler for a fictional machine on paper by hand, when Claudia broke the news, we were going to see a real computer.

No, not a PC, not even an XT, but a real computer, the one real computer in all the university, and you could hear the type switching to bold as she spoke about it. Sadly it was not as real as the one at the research facility (A MiniVAX!) but it was a real enough PDP.

We would not be allowed to actually use it until the following year, but ... well, it was still something special.

I had been programming for years, even for a year before I saw my first (seriosuly not real) computer, I had followed BASIC programs in my head for days, imagining the space invaders float on the screen of my mind, and stepped into writing machine code inside REM statements in my Timex Sinclair 1000 onto the luxury of a C64, but never noone had taught me anything.

Our small class (maybe 10 students) spent endless hours doing things like traverse a matrix, first by rows, thn by columns, then in a spiral from the top-left, writing programs that followed our endless source of algorithms, the numerical solutions guide.

First assembler, then Fortran, we learned.

She was my Mr. Miyagi, I was a heterosexual Ralph Macchio, and I figured out the most important thing about programming: I was awful at it.

Over the next 20 years that situation has been slowly improving, but I never again had someone teach me programming. Claudia had already taught me everything I needed to know, that code can always improve, that there's more than one way to skin a cat.

That the dinosaur was real and that some day soon my computer would be faster and nicer than the dinosaur was then, and that programming was cool, and that if I could find a way to draw a polynomial graph horizontally on a printer without ever having the whole graph in memory (it didn't fit), those future computers would do awesome things, and that I was one of the many who would help bring that to reality.

That talking about code was fun in itself, that you could make a modest living and be happy about it, that you could in any case make jigsaw puzzles in your spare time and keep on teaching or whatever.

And later the dinosaur's bones were scavenged into a line of racks holding routers, and its glass terminals are destroyed, and the gold in its teeth was stolen and the rare bus cables sold, and its circuits scrapped, but I saw the dinosaur alive, and Claudia taught me how to make it jump, and for that, I will always be grateful.

Contents © 2000-2019 Roberto Alsina