Skip to main content

Ralsina.Me — Roberto Alsina's website

Posts about open source (old posts, page 10)

PET: English Translation Issue 1 has a date

Be­cause it worked on­ce, let's do it again. I have just set a com­plete­ly ar­bi­trary, and prob­a­bly too ear­ly date for the re­lease of the first eng­lish Is­sue of "PET: Python En­tre To­dos" mag­a­zine.

The eng­lish ver­sion is called PET, which means "Python En­tre To­dos: Eng­lish Trans­la­tion".

It will have the same con­tents as the first span­ish Is­sue and... it will be the last Is­sue done like this.

From now on, both ver­sions will be pub­lished at the same time, if we can.

So, there will be a very short gap be­tween the eng­lish first Is­sue and the sec­ond one (less than a mon­th, we hope).

So, stay tuned

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

I just got a new phone be­cause my old one dis­ap­peared. I got a Sam­sung Star, which is not a smart­phone, but what they call a fea­ture­phone, which seems to mean "it does a lot of things but is cheap, can on­ly be cod­ed in Ja­va and does­n't run an­droid".

Here's some of the fea­tures of this baby:

  • Touch­screen, 400x240

  • Fake GPS (gives you a 400 me­ters ra­dius of your lo­­ca­­tion. Good enough for me in the city)

  • We­bkit-based brows­er that works sur­pris­ing­­ly well (it comes with the LGPL as a doc­u­­ment and you can't delete it :-)

  • Ac­celerom­e­ter

  • FM ra­­dio

  • A 2GB mi­cro-SD card

  • 3.2MP cam­era (takes video at 320x240).

The cam­era can take de­cent pho­tos in good con­di­tion­s:

Foto0005.jpg

And it even has some "ad­vanced" fea­tures (by which I mean: things my cheap ded­i­cat­ed cam­era does­n't do), like smile shut­ter and panoram­ic shot­s:

Foto0018.jpg

Oth­er 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 al­ter­na­tives".

So, how am I tak­ing ad­van­tage of it...

First: I have not had a de­cent pock­et-­sized ebook read­er since my last Clie died. So, I looked for soft­ware to do that.

It turns out that the world of Mi­dlet­s, as fea­ture phone apps are of­ten called, is aweird place, where things are quite hard to find for the unini­ti­at­ed.

There is a sort of "app shop" at http://get­jar.­com but it's by no means com­pre­hen­sive, and of­ten things are quite hard to find.

Af­ter lots of look­ing, I found a good (I may even say very good) pro­gram called Fo­liant. Here's their home page, rus­sian on­ly ... it's weird, my favourite Palm ebook read­er, Palm Fic­tion al­so has a rus­sian-on­ly site!

Of course, the fonts sucked (way too large) but it turns out you can con­vert TTF fonts us­ing this tool so I am now back to the love­ly Droid Sans I am used to.

An­oth­er nice thing about the new phone is that it can ac­tu­al­ly play me­dia (yes, my pre­vi­ous phone was so crap­py it did­n't even play mp3). But... not ev­ery kind of me­di­a. For au­dio, just use mp3. For video... it's a bit more com­pli­cat­ed.

Here's the short ver­sion:

  1. Con­vert us­ing Hand­Brake, ffm­peg MP4 video, AAC au­­dio.

  2. Al­ways use the .m­p4 ex­ten­­sion, the phone is not smart enough to know what a .m4v is.

  3. Don't make the video larg­er than 320x240.

Num­ber 3 is a prob­lem. For ex­am­ple, you may have a video in a wide screen for­mat, like 640x272, which is a 2.35:1 ra­tio.

The ob­vi­ous 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, keep­ing as­pect ra­tio, 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 play­back tell the phone to stretch it and ig­nore as­pect ra­tio. And voila, 400x170 and the cor­rect as­pect ra­tio.

The dif­fer­ence? 320x130 has on­ly 41600 pix­el­s, while 320*170 has 54400, which means you get a 30% bet­ter pic­ture.

Yes, it's tiny (3 inch­es) but it looks pret­ty sharp, and de­pend­ing on the kind of ma­te­ri­al you are watch­ing, it work­s.

UP­DATE: Fo­liant is bet­ter than I thought, once you get the Sam­sung-spe­cif­ic ver­sion. It's fullscreen (no sil­ly soft but­ton­s) and the screen ro­tates au­to­mat­i­cal­ly us­ing the ac­celerom­e­ter. It's a plea­sure to use, and the UI is very nice.

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
---paper!
---
-- print("Booklet")
-- We output an A4 booklet
PageWidth = 595.27559
PageHeight = 841.88976

print("PageCount",PageCount)

-- We assume that H > W
-- Argh, we now can do better since we have "if" ;-)
-- Scale = PageHeight / (2*SourceWidth)
if(SourceWidth <= SourceHeight)
then
--  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
else
--  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
end

do
    rest = PageCount % 4
    totp = PageCount
    if rest ~= 0
        then
        totp = totp + ( 4 - rest)
        end
    inc = 0
    count = 0
    imax = totp/4
    while count < imax
        do
--          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
        end
end

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!


Contents © 2000-2024 Roberto Alsina