LJ Archive


New Subscriber Love

I just got my first issue of Linux Journal, and I must say I'm floored. In fact, I suddenly caught myself getting nostalgic, because there I was, reading code in a computer magazine—I haven't done that since the eighties! It gave me a great idea though. What if there was a regular column that looked just at programming techniques? For inspiration, look no further than columns written by the legendary Commodore guru, Jim Butterfield. Or, how cool would it be to feature complete program listings the readers could type in or download, just like the days of COMPUTE! magazine? Only now, of course, instead of being written in Apple or Commodore Basic, it could focus on Python and Pygame, or C++ and Gtkmm. Perhaps some well-known open-source developers would even enjoy stepping through parts of their code they are particularly proud of, and explaining how it works.

I certainly enjoy the features in the magazine focusing on the enterprise side of the Linux world, but I'd also love to see a celebration of the sheer joy of coding.

Anyway, thanks for a great magazine! My only dilemma now is whether to read LJ or Tape Op first.

Sean Corbett

Thanks for the feedback Sean, and stay tuned—you'll see the things you mention in upcoming issues.—Ed.


In his August 2008 column, Dave Taylor uses the following line:

pickline="$(expr $(( $RANDOM % 250 )) + 1 )"

Although that code is not wrong, I prefer this simpler line:

pickline=$(($RANDOM % 250 + 1))


Dave Taylor replies: Nice! Duly noted.

Can't Please Everyone

I was noticing that LJ has been doing more software articles than in the past and that was the reason I renewed this last month. When I received the programming language issue [October 2008] I thought, “Yes! Finally an issue about languages.” I even thought, “I'm going to write them to say thanks.” And, then I noticed someone had written in requesting more hardware articles. I guess it's hard to please us all, eh? Keep it up (but please don't forget about the languages!).

Louis Juska

Compression Algorithms

The Tech Tip on page 72 in the November 2008 LJ uses tar and netcat to copy a directory tree between systems, but the specific command options are often painfully slow on a LAN. The bottleneck is that the gzip compression chosen (tar -z) executes slowly.

It is preferable to choose the compression algorithm according to the network and processor speed. Selecting faster but less efficient algorithms, like lzop, can speed up the transfer for fast connections, while slow but effective compression, like lzma, is preferred for very slow networks.

As a test, I used this Tech Tip with various compression options to transfer 4.6GB from an old server (2.6GHz P4-HT) able to read the ext3 files at about 30Mb/s with a gigabit network able to tcp at about 85Mb/s.

The commands used are:

[server] tar $TAR_OPT -cpsf - $dir | pv -b | nc -l 3333
[client] nc server 3333 | pv -b | tar $TAR_OPT -xpsf -

Results using these options:


are, respectively:

gzip    time 679sec, rate 6.38  MBPS
lzop    time 357sec, rate 12.15 MBPS
(none)  time 160sec, rate 27.15 MBPS

Here, the network is faster than filesystem I/O, so any compression slows the transfer. For these systems, I calculate that lzop would be helpful below a 62Mb/s network speed and gzip below 4Mb/s. These breakpoints would increase if the computers could compress and decompress faster.

I couldn't bring myself to test lzma, as it is many times slower than gzip, but it may be useful for dial-up transfer.

For a fine comparison of compression algorithms, see the September 2005 LJ article by Kingsley G. Morse Jr. at www.linuxjournal.com/article/8051.

Steve Alexander

It's Not a Vendor Thing

Mr. Bonny's letter [“It's a Vendor Thing”, LJ, November 2008] raises the hackles of us Linux enthusiasts. Still, he raises important issues.

Despite claims to the contrary, Linux driver support is on par with Windows and is radically superior to OS X. However, most new users are used to buying a computer with an OS pre-installed and configured and trivially installing vendor-supplied drivers for any widgets they add.

Installing Linux is vastly improved today, and in most instances, it is far easier than installing Windows. But, very rarely do people install Windows themselves anymore. Installing third-party hardware is substantially more challenging.

Googling “3 mobile broadband linux” seems to suggest that there is Linux support, and I would be shocked if there was not Linux support for Mr Bonny's 56K modem. This does not mean getting hardware working that does not have out-of-the-box support from your Linux distribution is inside the skill set of ordinary users.

No OS is perfect. I run Linux on my PowerBook because the internal NIC failed, and I could not find a supported add-on card. I regularly inherit often fairly new “broken” Windows laptops. Virus infections, spyware, conflicting software installs and flaky hardware drivers have resulted in slow and unstable operation. In all instances, a clean re-install restores them to like-new operations. In extremely rare instances, Linux systems suffer the same problems. And in most cases, the problems can be cleaned up, but few Windows machines go 18 months without requiring a clean re-install.

Unfortunately, Mr Bonny and many other users need the skills of a Linux guru and extraordinary vendor support to configure Linux for their needs. But, the payoff is a system that will be more robust. Further, a few months of using Linux regularly inevitably will result in developing a dependence on features that do not exist elsewhere.

Viruses, spyware, corrupted registries, flaky drivers and dll conflicts are of no interest to most Windows users who typically solve those problems by buying new systems.

Dave Lynch


On page 51 of the November 2008 issue, Daniel Bartholomew writes that he mapped the IP address of his Popcorn device using his /etc/resolv.conf file. I'm guessing that he meant using his local /etc/hosts file to map the name to the IP?

Jonathan Miner

Daniel Bartholomew replies: You are correct. This looks like a case of my mind thinking one thing and my fingers typing something completely different. Thanks for catching it!

Thanks for the HPC Articles

As a number-crunching scientist who has used Linux daily since 1994, let me thank you for two excellent articles in the November 2008 issue: Michael Wolfe's article on GPGPUs and Joey Bernard's article on Python for scientific computing. There is more to Linux than Web 2.0.

That said, I have a minor quibble with Joey Bernard's matrix multiplication example using numpy. By default, numpy objects are arrays, not matrices. So a1*a2 in his example is an element-by-element array multiplication, not a matrix multiplication. To get the result he intended, Joey either should have created explicit matrix objects or used a3 = numpy.dot(a1,a2) or a3 = mat(a1)*mat(a2).

That minor criticism aside, can we have more articles like Joey's and Michael's please!

Dave Strickland

Array Multiplication

Joey Bernard's article “Use Python for Scientific Computing”, LJ, November 2008, is a valuable introduction, and it prompted me to compare Python versus my own language, experix. The most important feature of experix that (as far as I know) is not found elsewhere is the detailed exposure of the kernel device driver interface to user command input. In my lab at Washington University, we are using experix to perform device control and data acquisition on instruments with piezoelectric and stepper motors; to analyze and archive the data; to perform analytic and Monte-Carlo simulations of fluorescence intensity distributions; and to fit photon count records from a Zeiss ConfoCor system to particle distribution models.

I find Bernard's exe times for array multiplication highly questionable. The time for unoptimized C is close to what I get on my Pentium laptop, but the other times (for -O3 and Python) are preposterous unless it was done with massive parallel processing.

Here is a very contrived experix example, demonstrating most of what Bernard did with Python plus some other things, and written in a way that fits in a 40-character column for printing. For info and downloads, see experix.sourceforge.net and sourceforge.net/projects/experix:

;; load some graphics stuff
;; make a [479,503] ramp array and
;; convert to Poisson deviate
.001 479 503 2 ] ]+ ]P
;; make a [503,512] array filled
;; with sin((.00005*j+10)^2)
5e-5 503 512 2 ] ]+ 10 + .sq .sin
;; multiply these and make a scaled
;; graph of the [479,512] product
]m \2k \2k Fgsa \s Igsa \s graph/skW
;; Fourier transform; graph column 1
fft> 1 -1 [s \s\-4r graph/sTzRl \3D 
;; create a file called "demo"
''of def/be ''xw of "demo" file/o
;; define a format string
"w  DC: %g  1Hz: %g  hiF: %g %g %g"
''fm1 def/r
;; make a command to write 5 numbers
;; from an array to file, formatted
{ of "w %d" file/w 512 * 5 [r }
{ of fm1 file/wn \d } | ''L1 def/rc
;; do each array column; close file
$0: ,0r L1 ,0i 479 ,0c!=$0 of file/c

Bill McConnaughey

Democratic Utopia?

In the November 2008 issue, Doc Searls writes about how technology can finally bring us to some democratic utopia. I think that nothing could be further from the truth. I believe de Tocqueville coined the phrase “tyranny of the majority” to describe the almost certain results.

For evidence, just look at current events. Huge numbers of folks (very likely a majority) have no problem with a presidential candidate who announces his plan on the first day in office to shut down opponents on talk radio. No problem at all. “The People”, as it were, are too easily swayed and too easily deceived.

As a member of a number of minorities, such as “bicycle commuters”, “private pilots”, “skiers”, “EEs”, “tax-payers”, “non-smokers who think smokers should be able to smoke” and numerous others, I'm painfully aware that I'm always at the mercy of the majority as it is. The idea that at any moment, some democratic good-will impulse will cut out another little freedom is all too real. When democracy starts to turn into populism and nationalism, history has shown that things always turn ugly.

I bet that a large number of readers, if not a majority, already view the phrase “tax the rich” with joyous enthusiasm. It gives me a cold chill. To me, the rich are entitled to their riches. I'd like to join them some day. The idea that they are some minority that we should milk for our benefit is an assault on liberty. It means that we no longer have the thirst for equality and justice that once wrote our Constitution.

One can ask what the solution is. I would say a little less democracy and a lot more education—the kind that is no longer taught in our public schools. A little more Adam Smith, and a lot less Karl Marx. Uneducated people historically vote themselves into a kind of servitude.

I do agree that more openness in government is a good thing. Politicians all too often hide behind layers of legalese and obfuscation. But Whitman's ode to democracy is downright scary. Politics 24/7? Every interaction governed by the masses? Please, no. Just keep every bill to a page or two of actual English.

I really don't want to be involved in every nit that needs to be picked, and I really don't want the government to be picking nits anyway. What I want government to worry about are the big things that folks can't do individually. Things that people wiser than myself can handle. Take care of it and don't bother me is my utopia. I'll take a little more wisdom and liberty, and a lot less democracy, anytime.


Brilliant New Slogan

Microsoft has recently launched a new ad campaign that uses the slogan, “Life without walls”. I find that interesting. You know what happens if you don't have any walls? Windows crash.

Alexander Pennington

Photo of the Month

Have a photo you'd like to share with LJ readers? Send your submission to info@linuxjournal.com. If we run yours in the magazine, we'll send you a free T-shirt.

Penguins at Kite Fair on Southsea Common, Portsmouth, UK. Photo taken by Simon Wright.

LJ Archive