Archive for September, 2008

Making a PDF grayscale with ghostscript

A request from a friend made me face the problem of converting a color [[Portable Document Format|PDF]] into a [[grayscale]] one. Searching the web provided some ways of doing so with [[Adobe Acrobat]], via some obscure menu item somewhere.

However, the very same operation could be undertaken with free tools, such as [[ghostscript]]. I found a way to do it in the YANUB blog, and I will copy-paste it here, with a small modification.

Assuming we have a file called color.pdf, and we want to convert it into grayscale.pdf, we could run the following command (all in a single line, and omitting the “\” line continuation marks):

% gs -sOutputFile=grayscale.pdf -sDEVICE=pdfwrite \
-sColorConversionStrategy=Gray -dProcessColorModel=/DeviceGray \
-dCompatibilityLevel=1.4 -dNOPAUSE -dBATCH color.pdf

I prefer the above to YANUB’s version below (in red what he lacks, in blue what I lack), because a shell operation is substituted by some option(s) of the command we are running:

% gs -sOutputFile=grayscale.pdf -sDEVICE=pdfwrite \
-sColorConversionStrategy=Gray -dProcessColorModel=/DeviceGray \
-dCompatibilityLevel=1.4 -dNOPAUSE -dBATCH color.pdf < /dev/null

A sample [[Perl]] script to alleviate the tedious writing above:

#!/usr/bin/perl -w
use strict;
my $infile = $ARGV[0];
my $outfile = $infile;
$outfile =~ s/\.pdf$//;
$outfile = $outfile.”_gray.pdf”;
system “gs -sOutputFile=$outfile -sDEVICE=pdfwrite -sColorConversionStrategy=Gray -dProcessColorModel=/DeviceGray -dCompatibilityLevel=1.4 -dNOPAUSE -dBATCH $infile”

Assuming we call the Perl script “togray.pl”, and that we have a color file “input.pdf”, we could just issue the command:

% togray.pl input.pdf

and we would get a grayscale version of it, named “input_gray.pdf”.

Comments (27)

Wikipedia is down

Wikipedia seems to be temporarily down… see below (click to enlarge):

How will the western civilization survive this!

Comments

Installation of simyo Huawei E220 under MacOSX

I recently subscribed to [[simyo]]’s mobile internet service. I was considering also [[Orange (brand)|Orange]], as explained in a previous post (es), but simyo’s offer is better.

I am writing how to make the modem simyo provides (the commonplace [[Huawei E220]]) on MacOSX first, because apparently the [[Personal identification number|PIN]] has to be deactivated for the modem to work in Linux. I have to admit that in MacOSX installation was a breeze.

Software installation

Start MacOS, then plug the USB modem. A window will open automatically, with two objects inside: “MobileConnect” and “User Manual”. The former is the installer binary, and the latter is a folder with the manuals in PDF format (for me, they were in English and Spanish).

Clicking on the “MobileConnect” icon the installer will start, and after being asked to accept an [[Software license agreement|EULA]], then introduce the admin password, then choosing a location for placing the files (actually just a hard disk, not a concrete dir), the installer does its thing.

Profile setting

After that, we only need to configure a connection in the “Mobile Connect” window that opens automatically after installation. For that, click on “Setting…” and create a new profile. If you read the manual (see above), it is easy to fill in the blanks. In short:

  • Profile name: whatever you want
  • Access Point Name: this is the APN value that simyo tells you in some paper (gprs-service.com)
  • Telephone number: *99#
  • Account name: irrelevant
  • Password: irrelevant

Save the above, then choose the profile you just created in the drop-down list in “Profile name”, then hit the “Connect” button. If after saying “Dialing up, please wait”, it tells you “Connection succesfull!”, then everything is fine!

PIN deactivation

Apparently using the modem under Linux requires that the PIN is deactivated. Doing that under MacOSX is easy: when the “Mobile Connect” window is active, go to the “Manage PIN” drop-down menu in the top bar. There you can find “Activate”, “Deactivate” and “Modify”. Self-explanatory, ain’t it?

Comments (5)

Comment on a Fox forum comment on Obama

Silly title for the post, I know. Bear with me.

Through the “random hot post” feature in WordPress, I read Fox forum post criticizing Barak Obama (I would’t expect that in a Fox forum!). In short, it says that the claim that women are worse paid than men for the same job is a myth. For a longer explanation, read the whole article

The thing is that I tried to comment there, but I couldn’t (when hitting “Submit comment” a [[HTTP 404|404 error]] appears). Bad page coding or anti-leftist filter? I don’t know, but I’m writing down my opinion here. Because I can :^)

I didn’t expect such right-wing ideas in a Fox forum [/irony]

I partly agree with the reasoning of the post, fair is fair. But the writer absolutely fails to stick to the logic he proclaims. There are two issues, that he correctly differentiates:

A) Whether men and women have different salaries “on average”

B) Whether men and women have different salaries “for the same job”

The writer seems to accept that while it is true that men earn more in A, in the more “fair” comparison B, the salaries are equal. I am not going to comment on B, because I have no data. For the sake of argumentation, I will assume that it is true that in the B comparison salaries are equal.

Now the writer tries to convince us that the comparison in A is unfavorable to women because:

a) women tend to not choose jobs with higher salaries.
b) women can not sacrifice themselves to their job, because they have to be good mothers

Let me disagree. The fact that, on average, men have better jobs does not imply that women do not choose them. Actually, it is more probable that what it means is that those on charge (men) do not choose women for those jobs. This is discrimination.

And about the point b, it is hard to make it enter some people’s skulls, but women should be “good mothers” as men should be “good fathers”. A home/family is a hard work for BOTH parents, and there is no sacrifice a man could do for his job that a woman should not be allowed to do. Maybe men are more willing to make sacrifices to their job (condemning their partners to stay home in the process), and maybe men are more allowed to do those sacrifices. This is discrimination.

Comments

DreamHost MediaWiki update problem

I recently updated the [[MediaWiki]] installation in one of my [[DreamHost]] domains from 1.12 to 1.13, and I started to see the following error messages when trying to edit/save pages (the capital letter triplets used for privacy):

Database error

A database query syntax error has occurred. This may indicate a bug in the software. The last attempted database query was:

(SQL query hidden)

from within function “Article:getHiddenCategories”. MySQL returned error “1146: Table XXX.YYY_page_props’ doesn’t exist (mysql.ZZZ.AAA)”.

After a Google search that yielded only two results, I checked a mediawiki.org page talking about the subject. The (maybe obvious) reason for my error was that I hadn’t run the MediaWiki update script, as one should after any upgrade.

The procedures is outlined in this other mediawiki.org page. However there is a little catch: the [[PHP]] version (at least in my case) accessible in the shell of the server where my wiki is is 4.4.8, but the MediaWiki update script needs PHP5. No problem, I checked the DreamHost wiki, and found out that for PHP5 I could use the following executable: /usr/local/dh/cgi-system/php5.cgi.

Running that executable on the corresponding update.php script (after setting up AdminSettings.php as told to), everything was OK again.

Comments (2)

My music collection surpasses 9000 songs

Following the “report” series started with my first summary of info about the music collection I listen to, I will update that info in this post.

The data (in parentheses the difference with respect to last report, 5 months ago).

Files

Total files        9512 (+1439)
  - Commercial     6161 (+1174)
  - Jamendo        3226 (+225)
  - Other CC       71 (+40)
  - Other          54 (+0)
Total playtime     25d (+4d)
Disk usage         45GB (+7GB)
Artist count       1270 (+236)
Album count        847 (+109)
MP3 count          0 (+0)
OGG count          9512 (+1439)

Last.fm

Playcount           41534 (+5255)

Most played artists Joaquín Sabina - 2711 (+195)
                    The Beatles - 1346 (+118)
                    David TMX - 853 (+82)
                    Silvio Rodríguez - 782 (+37)
                    Extremoduro - 694 (+251)
                    Fito & Fitipaldis - 675 (+53)
                    Siniestro Total - 650 (+39)
                    Bad Religion - 632 (+59)
                    La Polla Records - 565 (+28)
                    Ismael Serrano - 478
                    Ska-P - 440 (+20)

Most played songs   Cuando aparezca el petróleo (E. Sánchez) - 66 (+10)
                    La del pirata cojo (J. Sabina) - 55 (+3)
                    Tirado en la calle (E. Sánchez) - 53 (+7)
                    Conductores suicidas (J. Sabina) - 51 (+3)
                    Y sin embargo (J. Sabina) - 49 (+4)
                    Pacto entre caballeros (J. Sabina) - 47 (+2)

Amarok

Playcount         30392 (+4796)

Favorite artists  NanowaR - 96.16% (+2.14)
                  ABBA - 95.85%
                  Erick Sánchez - 95.19%
                  Rafael Caballero - 94.73 (+0.43)
                  Peiremans - 94.68% (+1.20)
                  Leihotikan - 94.53% (+0.14%)
                  Su ta Gar - 94.44% (+0.34)
                  Simon and Garfunkel - 94.26% (+0.42)
                  La Caja Negra - 94.22% (+0.65)
                  Antarhes - 94.18%
                  Ska-P - 94.12% (-0.96)
                  Eskorbuto - 94.06%
                  Fito & Fitipaldis - 93.87%
                  Juan Luis Guerra - 93.75% (+0.10)

Favorite songs    Salir - Extremoduro
                  You shook me all night long - AC/DC
                  Km 0 - Ismael Serrano
                  Golfa - Extremoduro
                  Todos los segundos cuentan - La Caja Negra
                  Vértigo - Ismael Serrano
                  1st movement of Winter - Antonio Vivaldi
                  Total eclipse of the heart - Bonnie Tyler
                  New America - Bad Religion
                  Caperucita - Ismael Serrano
                  Fiesta pagana (Mägo de Oz) - Mägo de Oz
                  Cuando aparezca el petróleo - Erick Sánchez
                  La extraña pareja - Ismael Serrano
                  Highway to hell - AC/DC
                  Uno - dos - tres - cuatro - Javier Álvarez
                  El roce de tu cuerpo - Platero y Tú
                  Torn - Natalie Imbruglia
                  Un muerto encierras - Ismael Serrano
                  Chop suey - System of a Down
                  Tirado en la calle - Erick Sánchez

Comments

DreamHost makes me happy again: free backups

Perhaps you are aware of my first (and last so far) gripe with [[DreamHost]]: as I wrote a couple of months ago, they wouldn’t let me use my account space for non-web content.

Well, it seems that they really work to make their users happy, and probably other people requested something like that, and read what the August DH newsletter says about it:

In keeping with my no-theme theme, uh oh, I think I just made a destroy-the-universe-LHC-style self-contradiction, here’s a new feature that pretty much has nothing to do with anything I said in the introduction!

https://panel.dreamhost.com/?tree=users.backup

Now, you know how we give out a LOT of disk space with our hosting? Well technically that space is only supposed to be used for your _actual_ web site (and email / database stuff) .. not as an online backup for your music, pictures, videos, other servers, etc!

Well, just like every other web host does, we’ve been sort of cracking down on that some lately, and it seems to catch some people by surprise! Nobody likes being surprised, especially in the shower, which is where we typically brought it up, and so now we offer a solution:

You CAN use 50GB of your disk space for backups now! The only caveat is, it’s a separate ftp (or sftp) user on a separate server and it can’t serve any web pages. There are also NO BACKUPS kept of THESE backups (they should already BE your backups, not your only copy), and if you go over 50GB, extra space is only 10 cents a GB a month (a.k.a. cheap)!

Thanks, DreamHost, for showing me that I made a good choice when I chose you!
Update: apparently only [[SSH file transfer protocol|SFTP]] works (or [[File Transfer Protocol|FTP]] if you are idiot enough to enable it), but not scp or any [[Secure Shell|SSH]]-related thing (rsync, …). I hope I find some workaround, because if not that would be a showstopper for me.

Comments (2)

Orange contra simyo

Estoy en proceso de selección de una compañía que me dé acceso a internet móvil. Es decir, poder conectarme a internet a través de la red de telefonía móvil, usando para ello una tarjeta SIM como la de los móviles, y un módem habilitado para usarla.

He seguido (de lejos) la evolución de los precios y servicios ofertados por las compañías de telecomunicaciones españolas, y la verdad es que no podían calificarse más que de estafa, o quizá “robo” es una palabra mejor. Sin embargo creo que ahora mismo es el momento en que los precios empiezan a ser competitivos (aunque no los de todas las compañias). Movistar y Vodafone parecen ofrecer basuras de calibre considerable, pero hay dos productos que me han llamado la atención: Internet Everywhere de Orange, y Tu propio internet móvil de simyo.

Ambas compañías ofrecen un servicio similar, que se puede resumir en:

  • Tarifa plana
  • Velocidad 3.6 Mbps hasta 5 GB mensuales
  • Tras consumir 5 GB se puede seguir navegando a 128 kbps sin coste adicional
  • Módem USB Huawei E220, que he leído que está soportado bien por Linux

La diferencia entre ambas es básicamente el precio (siendo simyo bastante más barata). A continuación resumo puntos a favor y en contra para ambas, y animo al amable lector a que me dé su opinión sobre el tema, si a bien tuviera.

Orange

Pros

  • Tiene tiendas físicas donde acudir
  • Regala el módem

Contras

  • El precio es más caro (39 eur/mes + IVA).
  • Exige compromiso de permanencia de 18 meses
  • Siendo una de las tres compañías que forman el oligopolio de las operadoras móviles en España (con Vomistar y Robafone), contratarla supone apuntalar su dominio (y poder para abusar del cliente), y ahogar a la competencia minoritaria

simyo

Pros

  • Mucho más barato: 24.99 eur/mes + IVA).
  • El módem es libre (el de Orange creo que no).
  • Me gusta más su política de funcionamiento, la idea de “no frills”, y lo que conlleva.
  • Aunque respaldada por KPN, simyo es una compañía minoritaria en España. Por ello, contratar sus servicios activa una sana competencia en el mercado.

Contras

  • Sólo puede accederse a la compañía por internet.
  • El módem hay que comprarlo, por 99 eur + IVA.

Todo lo anterior podría resumirse simplistamente en que Orange te regala los 99 euros del módem, mientras que simyo te cobra 14 euros menos al mes. Si esto fuera cierto, en 7 meses uno habría amortizado el módem en simyo (y tengamos en cuenta que Orange pide 18 meses de permanencia, y simyo 0). En los 18 meses de permanencia de Orange uno habrá gastado 18×39 = 702 eur (más IVA), mientras que en simyo habrían sido 99+18×25 = 549 eur (más IVA). Esto supone un ahorro de 150 euros en año y medio.

Comments (2)

LWD – September

Ups! August passed, my holidays finished, second work week… and I haven’t written much lately. I will partially fix that by updating my Linux World Domination project (you can read this May 2008 post for an intro).

As usual D2D means “days to domination” (the expected time for Windows/Linux shares to cross, counting from Feb 3, 2008), and DD2D means difference (increase/decrease) in D2D, with respect to last report. CLP means “current Linux Percent”, as given by last logged data.

Project D2D DD2D CLP Confidence %
Einstein 310.2 +62.3 34.94 43.0
MalariaControl 621.2 -374.9 12.20 35.0
POEM never 9.76
QMC 2873.2 +356.5 7.88 7.2
Rosetta 24647.0 +20189.5 7.80 0.5
SETI 4668.7 +1666.2 7.83 4.3
Spinhenge 12226.0 3.01 0.8

Comments