Letters

Bash Notational Shortcuts II

Regarding the “Bash Notational Shortcut” letter in the December 2012 issue: whitespace is allowed in Fortran variable names, as is in Fortran keywords. It is simply ignored. Here's a small example:

hoel@pchoel:~> cat lj224.f
      p r o g r a m l j 2 2 4
      w r i t e (*,*) "Hello LinuxJournal"
      e n d
hoel@pchoel:~> ifort lj224.f
hoel@pchoel:~> ./a.out
 Hello LinuxJournal
hoel@pchoel:~> gfortran lj224.f
hoel@pchoel:~> ./a.out
 Hello LinuxJournal



Berthold Höllmann

Dave Taylor replies: I find it awesome that we're still talking about Fortran. Now, what about Algol-68?

Readers' Choice Awards 2012

I would really like to see LibreOffice as a contender for next year. It should have had its own slot for the 2012 awards. It has been around and doing great on its own for some time now. Thanks for your consideration. As you noted in the article, many even wrote in LibreOffice.


Fran Parker

I agree. It's funny, the difficult part every year is coming up with the correct options!—Ed.

Digital LJ and Dropbox Sync

I love the digital version of the magazine! But, I would like to suggest you make the digital versions available via Dropbox sync, much like O'Reilly and Pragmatic Bookshelf do with their digital books. I find myself logging in to the LJ site and downloading the PDF versions for safe-keeping into a Dropbox folder (I already get LJ on my iPad mini via Newsstand). It would be awesome if this was automatic with Dropbox sync!

Keep up the great work!


Terry Dunlap

That's an interesting idea, Terry. I do the same thing, actually. I'm not sure if it is easy with our current distribution model, but I like the idea. We'll look into it!—Ed.

January 2013 Work the Shell

I've been a Linux user and reader of Linux Journal since the beginning, and I always find something valuable in every issue of your magazine. One of my favourite columns is Work the Shell, because I'm always looking for neat ways to process files and data in different ways. Often—no offense, Dave—it is the letters from readers that provide that aha moment!

This time (regarding Dave Taylor's column the January 2013 issue), I have a comment of my own. When attempting to shuffle a deck of cards, why not just use one of the well-known shuffle algorithms? Then, there is no need to worry about picking a card for the second (or third) time on reaching the end of the deck. Here is a piece of code for the Fisher-Yates algorithm, courtesy of Wikipedia:


#!/bin/bash

for ((i=0;i<52;i++))
do
deck[$i]=$i
done
for ((i=51; i>0; i-- ))
do
rand=$(( $RANDOM % (i+1) ))
tmp=${deck[i]} deck[i]=${deck[rand]} deck[rand]=$tmp
done
echo ${deck[@]}

I'm sure this can be improved, but you get the idea.


dik harris

Dave Taylor replies: Thanks for your note and sample code. It's ironic that when I was in college studying for my degree in computer science I complained about having to re-invent the wheel when Knuth's The Art of Computer Programming was on my shelf and had tons of great algorithms. Zoom forward, and now I'm re-inventing the wheel in every column rather than looking for optimal results.

But here's the thing: while the code you sent me might be a good “shuffle”, it's completely obfuscated, and since my primary goal with the Work the Shell column is to explain and explore the concepts underlying good script writing, using a 12-line block of complex code seems counter-productive.

I'll simply suggest we publish your letter and my response and see how the rest of the reader community feels about the subject.

RPi

I've been thinking of getting a Raspberry Pi to make a digital video-capture device for our wood-turning chapter (BAW). We currently use an old tape video camera. Then we have to transfer from tape to a PC, edit the video and produce it. We have two small cameras attached to tripods and can switch back and forth between them to show the demo on a 46" flatscreen so everyone watching the demo, up to 40 people, can see it better. But, when making a video, we have only the one camera! We sure would like to improve the process. What do you think?


Rex

Shawn Powers replies: I like the idea of using a little Pi device, but I worry it might not have the processing horsepower to process and store video. You might consider a couple decent USB Webcams with long cables connected to a single beefy computer. Either solution sounds more fun than video tape, however, so I think you're headed in the right direction!

WiFi Analyzer

I have a picture of Tux alongside the Android robot on the outside of my cubicle. The going joke in the office is that I can analyze the Wi-Fi with my phone, but my co-engineers cannot because they all have iOS. Another good app is WiFi Map Maker by Dave McKellar. It really helped me figure out which neighbor is flooding my house with his Wi-Fi signal. Thanks for the article and good work.


Roman

Shawn Powers replies: I love that app too! I've never had a good enough GPS signal indoors to use it very well. Your scenario sounds perfect. I'm glad it worked for you.

Memorable Password Generator

After reading this XKCD comic about developing easy-to-remember, hard-to-crack passwords: xkcd.com/936, I stumbled upon this page for manually generating a strong password with six-sided die: world.std.com/~reinhold/diceware.html.

Now, rolling a bunch of die to select a password is rather cumbersome (I'm not a table-top RPG geek), so I developed a script that will select any number of words (by default, five) and select a pseudo-random list of words from the Diceware word list (see the article linked above for the list):

ppgen.sh:
#!/bin/bash

# Copyright © 2012, Trey Blancher
# Licensed under a Creative Commons Attribution-ShareAlike
# 3.0 Unported license.
#
# Inspired by XKCD
# http://xkcd.com/936/
#
# adapted from Diceware's Passphrase table-top generator
# http://world.std.com/~reinhold/diceware.html

while getopts "f:n:" opt; do
    case $opt in
            f) # Process file argument
                    #echo "File argument passed:  $OPTARG" >&2
                    WORDLIST=$OPTARG
            ;;

            n) # Process number argument
                    #echo "Number argument passed:  $OPTARG" >&2
                    NUM=$OPTARG
            ;;

            \?) echo "Invalid option: -$OPTARG" >&2
                      echo "usage:  $0 [-f <word list>] [-n <number 
                      ↪of words in passphrase>]" >&2
                            exit 1
            ;;
    esac
done

if [ -z $WORDLIST ]; then
  # Default word list comes from Diceware (see above link)
  WORDLIST="/usr/share/diceware/diceware.wordlist.asc"
fi

if [ -z $NUM ]; then
    NUM=5
fi

#echo "$0 -f $WORDLIST -n $NUM" >&2

# Algorithm uses six-sided die
D=6

# Initialize RANDOM variable
RANDOM=$RANDOM

for ((i=1;i<=$NUM;i++));
do
    for d in {1..5} # five digits per word in master list
    do
            WORD+=$(($(($RANDOM % $D))+1))
    done
    grep $WORD $WORDLIST | awk '{print $2}' | awk '{ printf "%s ", $0
}'
    WORD=
done
echo

This script lets you choose how many words you want in your generated password and uses some tips on shell programming from Dave Taylor. There probably are better ways to do what I've done here, but this works for me. I use it any time I need a password I can remember (without writing it down or storing it in a password manager).


Trey

Shawn Powers replies: I love Randall Monroe. When I saw his comic (days after writing my column, of course), it made me think how silly passwords are in general. Your script sounds like a good idea to me. Thanks for sharing.

Platform-Agnostic Backup

I just read the January 2013 issue of LJ and noticed the letter about a backup system for Linux. Crashplan looks interesting. I haven't tried it yet, but I plan to play around with its free offerings at a minimum. The trial looks like a good way to test the full experience too. I run both Mac and Linux computers, and I like that all major OSes are supported.


Nathan

Shawn Powers replies: I happen to agree with you. In fact, I wrote a piece about it in this issue's Upfront section. I use it everywhere, and I really appreciate the generous free-feature offering.

Another Vote for Crashplan

It works on Solaris, Linux, Mac and Windows. I use it on Solaris and Windows machines, and it has been completely set-and-forget for me for a number of years now. I do the occasional restore to make sure that it is working as expected.

Oh, Crashplan also has an Android application that is restore-only. It's useful for getting files onto phones and tablets.


Gary Schmidt

Shawn Powers replies: As with my response to Nathan, I completely agree. Crashplan is awesome.

Mint+Google?

Has Linux Mint sold its soul to Google? See forum.linuxmint.com/viewtopic.php?f=157&t=108859.


B.r. Mintman

I can't speak to Linux Mint's procedures and goals. I can only give my take on using Mint in the past: I thought it was very user-friendly and configured well out of the box, but I didn't care for it much myself. I don't think I'm the intended target, however, so that's okay.

I know Linux Mint always has had a custom Google search in the Firefox browser as a way to raise some capital. It's possible there is more Google interaction, but I honestly don't know. The great thing about Linux is that if you don't like the philosophy and/or actions of one company, there are many other distros from which to choose!—Ed.

Elliptic Curve and Putty

Regarding the “Elliptic Curve Cryptography” article in the January 2013 issue: Putty unfortunately doesn't support ecc/ecdsa keys, but it's on the wish list.


Wes

Could You Review Slax Linux?

Could you please take the time to review Slax Linux? I have never seen this version of Linux reviewed by your magazine in the past or present and would love to see what you think of it. Here is the URL: www.slax.org.


Christina Cross

I've covered Slax in a video review before. If there are cool new features or significant changes, we might take a look at it. I do recall liking the look of Slax, and I appreciated its underlying Slackware roots.—Ed.

Photo of the Month

My wife bought me a Rasberry Pi for my birthday, and I thought you might get a kick out of this picture of my son holding it on its first boot. It's connected to the flatscreen, with top running in the login shell.


Michael Soulier

First Boot of a Pi