...making Linux just a little more fun!


This month's answers created by:

[ Anderson Silva, Ben Okopnik, S. Parthasarathy, Joey Prestia, Kapil Hari Paranjape, René Pfeiffer, Mulyadi Santosa, Kiniti Patrick ]
...and you, our readers!

Our Mailbag

Image size vs. file size

Ben Okopnik [ben at linuxgazette.net]

Tue, 28 Sep 2010 20:04:15 -0400

I've always been curious about the huge disparity in file sizes between certain images, especially when they have - oh, more or less similar content (to my perhaps uneducated eye.) E.g., I've got a large list of files on a client's site where I have to find some path between a good average image size (the pic that pops up when you click the thumbnail) and a reasonable file size (something that won't crash PHP/GD - a 2MB file brings things right to a halt.)

Here's the annoying thing, though:

ben at Jotunheim:/tmp$ ls -l allegro90_1_1.jpg bahama20__1.jpg; identify allegro90_1_1.jpg bahama20__1.jpg 
-rwxr-xr-x 1 ben ben   43004 2010-09-28 19:43 allegro90_1_1.jpg
-rwxr-xr-x 1 ben ben 1725638 2010-09-28 14:37 bahama20__1.jpg
allegro90_1_1.jpg JPEG 784x1702 784x1702+0+0 8-bit DirectClass 42kb 
bahama20__1.jpg[1] JPEG 2240x1680 2240x1680+0+0 8-bit DirectClass 1.646mb 

The first image, which is nearly big enough to cover my entire screen, is 42k; the second one, while admittedly about 3X bigger in one dimension, is 1.6MB+, over 40 times the file size. Say *what*?

And it's not like the complexity of the content is all that different; in fact, visually, the first one is more complex than the second (although I'm sure I'm judging it by the wrong parameters. Obviously.) Take a look at them, if you want:

http://okopnik.com/images/allegro90_1_1.jpg http://okopnik.com/images/bahama20__1.jpg

So... what makes an image - seemingly of the same type, according to what "identify" is reporting - that much bigger? Does anybody here know? And is there any way to make the file sizes closer without losing a significant amount of visual content?

* Ben Okopnik * Editor-in-Chief, Linux Gazette * http://LinuxGazette.NET *

[ Thread continues here (22 messages/37.41kB) ]

Tesseract 3.00 Released

Jimmy O'Regan [joregan at gmail.com]

Fri, 1 Oct 2010 03:33:55 +0100

Tesseract, the Open Source OCR engine originally created at Hewlett-Packard and now developed at Google, has released a new version.

Tesseract release notes Sep 30 2010 - V3.00 ?* Preparations for thread safety: ? ? * Changed TessBaseAPI methods to be non-static ? ? * Created a class hierarchy for the directories to hold instance data, ? ? ? and began moving code into the classes. ? ? * Moved thresholding code to a separate class. ?* Added major new page layout analysis module. ?* Added HOCR output. ?* Added Leptonica as main image I/O and handling. Currently optional, ? ?but in future releases linking with Leptonica will be mandatory. ?* Ambiguity table rewritten to allow definite replacements in place ? ?of fix_quotes. ?* Added TessdataManager to combine data files into a single file. ?* Some dead code deleted. ?* VC++6 no longer supported. It can't cope with the use of templates. ?* Many more languages added. ?* Doxygenation of most of the function header comments.

As well as a number of new languages, bugfixes, and man pages.

Languages supported are: Bulgarian, Catalan, Czech, Chinese Simplified, Chinese Traditional, Danish, Danish (Fraktur), German, Greek, English, Finnish, French, Hungarian, Indonesian, Italian, Japanese, Korean, Latvian, Lithuanian, Dutch, Norwegian, Polish, Portuguese, Romanian, Russian, Slovakian, Slovenian, Spanish, Serbian, Swedish, Tagalog, Thai, Turkish, Ukrainian, Vietnamese

<Leftmost> jimregan, that's because deep inside you, you are evil.
<Leftmost> Also not-so-deep inside you.

LG hosting

Ben Okopnik [ben at linuxgazette.net]

Mon, 20 Sep 2010 17:26:36 -0400

Hello, Gang -

After a number of years of providing hosting services for LG (and a number of others), our old friend T. R. is, sadly, shutting down his servers. Whatever his plans for the future may be, he has my best wishes and the utmost in gratitude for all those great years; if there was such a thing as a "Best Friends and Supporters of LG" list, he'd be right at the top.

(T.R. - if we happen to be in the same proximity, the beer's on me. Yes, even the realy good stuff.)

I've arranged for space on another host, moved the site over to it, and have just finished all the configuration and alpha testing. Please check out LG in its new digs (at the same URL, obviously), and let me know if you find any problems or anything missing.

* Ben Okopnik * Editor-in-Chief, Linux Gazette * http://LinuxGazette.NET *

[ Thread continues here (9 messages/13.03kB) ]

GPG secret key

Prof. Parthasarathy S [drpartha at gmail.com]

Wed, 22 Sep 2010 10:38:22 +0530

Is there a neat way to export and save my GPG/PGP secret key (private key) on a USB stick ?

I have to do this, since I am often changing my machines (most of which are given on loan by my employers). The secret key goes away with the machine, and I am obliged to generate a new key pair each time. I did a Google search and did not succeed.

I know I can save/export my public key, but GPG/PGP refuse to let me use a copy of my secret key.

Any hint, or pointers would be gratefully appreciated.

Many thanks,


Dr. S. Parthasarathy                  | mailto: drpartha at gmail.com
Algologic Research & Solutions        |
78 Sancharpuri Colony, Bowenpally P.O.| Phone: + 91 - 40 - 2775 1650
Secunderabad 500 011 - INDIA          |
WWW-URL: http://algolog.tripod.com/nupartha.htm
My personal news bulletins (blogs) ::

[ Thread continues here (3 messages/2.96kB) ]

wanna learn about hard disk internals the virtual way?

Mulyadi Santosa [mulyadi.santosa at gmail.com]

Sat, 4 Sep 2010 22:54:21 +0700

Sometimes, people are scared to get a screw driver and check what's inside the hard drive. Or maybe simply because we're too lazy to read manuals.

So, what's the alternative? How about a simple flash based tutorial? http://www.drivesaversdatarecovery.com/e[...]-first-online-hard-disk-drive-simulator/

It's geared toward disaster recovery, but in my opinion it's still valuable for anyone who would like to see how the hardware works.

PS: Thanks to PC Magazine which tells a short intro about the company: http://www.pcmag.com/article2/0,2817,2361120,00.asp

-- regards,

Mulyadi Santosa Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com training: mulyaditraining.blogspot.com

[ Thread continues here (5 messages/9.55kB) ]

Brother, can you spare a function?

Ben Okopnik [ben at linuxgazette.net]

Fri, 17 Sep 2010 09:14:23 -0400

I don't know why this kind of thing keeps coming up. I never wanted to be a mathematician, I'm just a simple programmer! :)

(One of these days, I'm going to sail over to an uninhabited island and stay there for six months or so, studying math. This is just embarassing; any time a problem like this comes up, I feel so stupid.)

I've been losing a lot of weight lately, and wanted to plot it on a chart. However, I've only been keeping very sparse records of the change, so what I need to do is interpolate it. In other words, given a list like this:

6/26/2010 334
8/12/2010 311.8
8/19/2010 308.4
9/5/2010 300.0
9/9/2010 298.6
9/14/2010 297.2
9/16/2010 293.6

I need to come up with a "slope" function that will return my weight at any point between 6/26 and 9/16. The time end of it is no problem - I just convert the dates into Unix "epoch" values (seconds since 1970-01-01 00:00:00 UTC) - but the mechanism that I've got for figuring out the weight at a given time is hopelessly crude: I split the total time span into X intervals, then find the data points preceding and following it, and calculate the "slope" between them, then laboriously figure out the value for that point. What I'd really, really like to have is a function that takes the above list and returns the weight value for any given point in time between Tmin and Tmax; I'm sure that it's a standard mathematical function, but I don't know how to implement it.

Can any of you smart folks help? I'd appreciate it.

* Ben Okopnik * Editor-in-Chief, Linux Gazette * http://LinuxGazette.NET *

[ Thread continues here (24 messages/45.54kB) ]

Current Issue calculation

Joey Prestia [joey at linuxamd.com]

Mon, 06 Sep 2010 20:34:43 -0700

Hi Tag,

I am trying to rework a script that currently uses an external file to keep track of what issue the Linux Gazette is on. I would like to do this with out relying on an external file (feels cleaner that way) and just calculate this from within the script using maybe the month and year from localtime(time) from within Perl. Using the month and year I thought this would be an easy task but it turns out its more difficult than I thought. I will probably need some formula to do It to since I will be running it from cron. Can you make any suggestions on how I might attempt this? I have tried to figure a constant that I could use to get it to come out correct with no luck. What works for one year fails when the year changes when you add the month to the year.

# Get Issue my (@date,$month,$year,$issue);

@date = localtime(time); $month=($date[4])+1; $year=($date[5])+1900;

$issue= $year - 1841 + $month ; print "Month = $month Year = $year Issue = $issue\n";


[ Thread continues here (5 messages/6.26kB) ]

Installing Linux Modules

Kiniti Patrick [pkiniti at techmaxkenya.com]

Sun, 26 Sep 2010 07:29:53 -0400

Hi Gang,

I have a question on how to go about installing kernel modules without going through the entire process of recompiling a new kernel. In question is the agpgart module which i want to have as a loadable module. As of now my the agpgart only exists as header files, and dont have the modules ".ko" file yet. Below is the output command from locate agpgart.

$ locate agpgart

/usr/include/linux/agpgart.h /usr/src/kernels/

Thanks in advance.




[ Thread continues here (3 messages/6.96kB) ]


Talkback: Discuss this article with The Answer Gang

Copyright © 2010, . Released under the Open Publication License unless otherwise noted in the body of the article. Linux Gazette is not produced, sponsored, or endorsed by its prior host, SSC, Inc.

Published in Issue 179 of Linux Gazette, October 2010