Skip to main content

Ralsina.Me — Roberto Alsina's website

Posts about nerdness (old posts, page 3)

Things I learned publishing a magazine

To­day at 00:00:00 GMT-3 PET: Python en­tre to­dos was in­deed launched, in time (ar­bi­trary but forced) and in bud­get ($0).

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

  • The on­­ly thing you need to pub­­lish an e-­­mag is time and con­­ten­t.

  • Time can be con­vert­ed in­­­to con­­ten­t, but if you write ev­ery­thing your­­self it's a blog, not a mag­a­zine. Luck­­i­­ly, PET found great con­trib­u­­tors.

  • If you want util­i­­tar­i­an de­sign, rst2pdf can do the job

  • In fac­t, it can do it bet­ter than oth­­er tools in some ways

    • I can push a fixed ver­­­sion of the PDFs in 5 min­utes for all lay­out­s. How much would it take me us­ing Scribus or oth­­­er DT­P? In a mag­a­zine where cor­rec­t­­­ness mat­ter­s, that's a big deal.

    • TOCs are bet­ter than in most am­a­­­teur PDF mag­a­zines I've seen. The in­­­-­­­con­­ten­t-­­­TOC is click­­­able, and the PDF TOC is per­fec­t.

    • Page num­bers in the PDF TOC make sense (no, the cov­­­er is not page 1)

    • I am pro­­­duc­ing 6 PDF ver­­­sion­s: A4(b­w, colour), A5(b­w,­­­colour), Book­let(b­w, colour) and I could add any oth­­­er I want in a few min­utes.

  • I learned about PDF im­po­si­­tion!

Let's ex­plain the last one:

Sup­pose you want to print a small book­let, and you have 32 pages of con­tent. How do you do that?

The eas­i­est way is to print it 2-up dou­ble-sid­ed in A4 pa­per so that you can stack the pages, fold them down the mid­dle, sta­ple them, and get a nice A5 book­let.

The prob­lem is that the page or­der­ing is hard to get right. For ex­am­ple, for a 4-­page book­let, you need to print one A4 page with pages 4-1 on one side and 2-3 on the oth­er. For an 8 page book­let it's 8-1,2-7,3-6,4-5.

Lucklily there's a way to get this done au­to­mat­i­cal­ly:

1. In­stall pod­ofo 3. Get book­let-A4.­plan (see be­low) 2. Run this:

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

book­let-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 tak­en from here: http://www.oep-h.­com/im­pose/

And voilá, you get a scram­bled PDF with the pages in ex­act­ly the right or­der (and emp­ty pages added as need­ed).

Come see me in Bahía Blanca next weekend!

I will be speak­ing at the Jor­nadas del Sur in Bahía Blan­ca this week­end (Au­gust 14/15 and 16).

For a change, I will not be giv­ing my old tired talk­s, but a brand new one, called "The Am­a­teur", and prob­a­bly a light­ning talk or some­thing else.

The usu­al of­fer of free beer will not be pos­si­ble this year, so: If you men­tion this blog in the QA ses­sion, you get... free can­dy!

Af­ter that, I will be speak­ing at FM La Tribu on sat­ur­day Au­gust 21st in the Char­las Abier­tas 2010 where I will be speak­ing about a lot of things be­tween vir­tualenv and nose and tox and oth­er test­ing-re­lat­ed top­ic­s.

It's coming: PET - Python Entre Todos

I have been dragged in­to YAP (Yet An­oth­er Pro­jec­t) and in this case it's the first-is­sue-ev­er of PET - Python En­tre To­dos a python on­line mag­a­zine in span­ish.

This is an emer­gent out­put of PyAr the on­line Python com­mu­ni­ty of Ar­genti­na, and it may nev­er have a sec­ond is­sue un­less we get a lot of help, so pay at­ten­tion to the first one :-)

I have been do­ing web­mas­ter­ing, edit­ing and PDF pro­duc­tion, Emil­iano Dal­la Verde Mar­cozzi has been help­ing ev­ery­where and get­ting ar­ti­cles.

The first is­sue is some 45 A5 pages (or 23 A4 ones) in small type, so it's not ex­act­ly huge, but it has half a dozen ar­ti­cles aimed at dif­fer­ent python lev­el­s.

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

Random photos from my phone

A few days ago I fi­nal­ly got my 89 cents blue­tooth don­gle (now $1.85, but still with free ship­ping from chi­na!) and got a bunch of pic­tures I had in my phone.

The qual­i­ty is crap be­cause my phone is crap, but trust me, there must be one thing here you have nev­er seen be­fore.

Here they are: weird stuff that made me take out my phone and grab a pic­ture, with ex­pla­na­tion­s.


This, from Mar del Plata, is the most badass pop­up book I ev­er saw.



And open:


I'm Mark Shuttleworth!

Imagen024 Imagen025

In a free soft­ware event in Buenos Aires, Canon­i­cal's boss and for­mer space car­go was sup­posed to de­liv­er the key­note. He can­celed at the last minute. So Mad­dog Hall of­fered to re­place him... in char­ac­ter.

Some­one found a re­al­ly, re­al­ly awe­some (and/or crap­py!) as­tro­naut cos­tume, and Mad­dog gave a key­note shout­ing "I'm Mark Shut­tle­worth! I'm an as­tro­naut!" and claim­ing to have come from the fu­ture to ex­am­ine some slides re­cent­ly found, writ­ten by some un­known dude named Mad­dog. Re­al­ly fun­ny stuff.

Python vs. Ruby

Same even­t, take a look:

Imagen023 Imagen022

Yes, I swear they are tak­en with less than 10 sec­onds of one an­oth­er.


Imagen018 Imagen026

I was buy­ing gro­ceries in San Isidro's Dis­co su­per­mar­ket. Yes, usu­al­ly buy­ing a large pack­age of but­ter is cheap­er per ki­lo than a small one. But here, a 200g pack­age cost­ed al­most the same as a 100g! That's just steal­ing mon­ey from those who don't use much but­ter. Me? I'm not at risk.

Visa discount!


This was a shop in Aveni­da Alem in Buenos Aires. It was un­usu­al to see a "VISA is sus­pend­ed, 20% dis­coun­t" sign. Much more un­usu­al was to see the small let­ter­s: "p­re­sent your visa card". I mean, was­n't it sus­pend­ed?

And then I saw the rest:


It says "p­re­sent your visa card and pay us­ing any­thing else".

That guy must re­al­ly have been pissed off at Visa!

I got a bunch more for some oth­er time.

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

To­day, March 24th is Ada Lovelace day, a day of blog­ging to cel­e­brate the achieve­ments of wom­en in tech­nol­o­gy and sci­ence.. I am tak­ing the lib­er­ty to tag this as python so it ap­pears in the right plan­et­s, but that's just to pro­mote Ada Lovelace day. Sor­ry 'bout that.

I will write about the on­ly per­son who ev­er taught me pro­gram­ming, Clau­di­a. I was young, so the earth was still luke­war­m, the day we saw the di­nosaur.

I was just a green sopho­more in the School of Chem­i­cal En­gi­neer­ing where, para­dox­i­cal­ly I would nev­er take a chem­istry class, be­ing an ap­plied math stu­dent and all that, and at the time "per­son­al com­put­er­s" were a nov­el­ty, a toy of the up­per mid­dle class.

We had spent the first two months of the se­mes­ter learn­ing how to pro­gram the ob­vi­ous way: writ­ing as­sem­bler for a fic­tion­al ma­chine on pa­per by hand, when Clau­dia broke the news, we were go­ing to see a re­al com­put­er.

No, not a PC, not even an XT, but a re­al com­put­er, the one re­al com­put­er in all the uni­ver­si­ty, and you could hear the type switch­ing to bold as she spoke about it. Sad­ly it was not as re­al as the one at the re­search fa­cil­i­ty (A Mini­VAX!) but it was a re­al enough PDP.

We would not be al­lowed to ac­tu­al­ly use it un­til the fol­low­ing year, but ... well, it was still some­thing spe­cial.

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 stu­dents) spent end­less hours do­ing things like tra­verse a ma­trix, first by rows, thn by column­s, then in a spi­ral from the top-left, writ­ing pro­grams that fol­lowed our end­less source of al­go­rithm­s, the nu­mer­i­cal so­lu­tions guide.

First as­sem­bler, then For­tran, we learned.

She was my Mr. Miyag­i, I was a het­ero­sex­u­al Ralph Mac­chio, and I fig­ured out the most im­por­tant thing about pro­gram­ming: I was aw­ful at it.

Over the next 20 years that sit­u­a­tion has been slow­ly im­prov­ing, but I nev­er again had some­one teach me pro­gram­ming. Clau­dia had al­ready taught me ev­ery­thing I need­ed to know, that code can al­ways im­prove, that there's more than one way to skin a cat.

That the di­nosaur was re­al and that some day soon my com­put­er would be faster and nicer than the di­nosaur was then, and that pro­gram­ming was cool, and that if I could find a way to draw a poly­no­mi­al graph hor­i­zon­tal­ly on a print­er with­out ev­er hav­ing the whole graph in mem­o­ry (it did­n't fit), those fu­ture com­put­ers would do awe­some things, and that I was one of the many who would help bring that to re­al­i­ty.

That talk­ing about code was fun in it­self, that you could make a mod­est liv­ing and be hap­py about it, that you could in any case make jig­saw puz­zles in your spare time and keep on teach­ing or what­ev­er.

And lat­er the di­nosaur's bones were scav­enged in­to a line of racks hold­ing router­s, and its glass ter­mi­nals are de­stroyed, and the gold in its teeth was stolen and the rare bus ca­bles sol­d, and its cir­cuits scrapped, but I saw the di­nosaur alive, and Clau­dia taught me how to make it jump, and for that, I will al­ways be grate­ful.

Contents © 2000-2023 Roberto Alsina