Monthly Archives: June 2012

Which Internet Weather Site is Most Accurate?

I have been a long-time user of the Weather Underground, while my wife uses some Weather Channel app or something on her phone. We frequently have disagreements about what the high temperature for the day is/was supposed to be because we use these different services.

I really like the Weather Underground, but I must confess her numbers/rain probabilities seemed to jive better with what was happening, so I did a search to see if someone had analyzed the various weather sites for consistency and accuracy. Someone did, and how.

I’ll be honest. I mostly just skimmed through the site, because I was just interested in the conclusions (at first). An important caveat is that the analysis was done for only one location, by one guy, but I have to admire the effort and the statistical analysis.

In conclusion: I’m going to see if I can find an IntelliCast app for my phone.

Firefox 13.0.1 for Linux Not Working With Flash Plugin?

I’ve been a little annoyed with how Ubuntu has been going lately (even though I think it’s a great distribution for new Linux users), and so I’ve been moving my systems back to Debian. My workstation, whose filesystem originated I think on Ubuntu 8.04 and was running 10.04, was the last one to go.

I had some issues because I run RAID1 for my system disks, and then some issues with crypto and booting, but finally I got it up and running, only to find that the brand-new Firefox 13.0.1. did not work with Flash. At all. I couldn’t even see the flash plugin in about:plugins. My searches were all confounded by apparent problems between the latest Flash and Firefox 13 on Windows. However, I’m partly writing this post to help change that.

This morning, my laptop (already running the same version of Debian) came due for its firefox upgrade, so I decided to see whether the same thing happened on upgrade. Sure enough, it did. I’m not sure why I didn’t think of this on Thursday with the workstation, but I checked the filetype of the firefox 13.0.1 binary, and found that it was 32-bit. This is a little funny if you’re an old hand at running 64-bit firefox on Linux, because it used to be the case that none of the plugins were 64-bit and required using nspluginwrapper to run them at all. In this case I had the opposite problem — most of my plugins were 64-bit, but I had a 32-bit browser that couldn’t link to them.

I’m not sure why the Firefox site always gave me the 64-bit download automatically before, and this time gave me the 32-bit download, but I’ll spare you the trouble of trying to find it yourself. Go here (the Mozilla ftp server in the Firefox releases directory), select your release (in this case 13.0.1), and then linux-x86_64. Then select your language (for me, en-US), and finally, the 64-bit Firefox download.

Once I loaded the 64-bit Firefox, sure enough, my plugins came back. Here’s some stuff to help others find this via search engines:

Debian firefox 13 libflashplayer.so linux 32-bit 64-bit flash plugin about:plugins

Extracting certain lines from a file using Perl

As often happens to me when processing data, I needed to extract a specific set of lines from many files. If the files are small or few, or the list of lines is short, this can be done manually. If the list of lines or number of files are large, well, that’s what computers are for.

As Google will reveal, there are a number of ways to hack this up with bash, grep, sed, and other command-line tools, but none (that I know of) are really designed for this.

Here’s my script. It’s designed around some heart model stuff, and we use base-0 (first line is line 0, second line is line 1, etc), while many other tasks require base-1 (first line is line 1, second line is line 2, etc), and I’m sure there are other numbering schemes out there. Therefore, I included an optional base parameter. Without that it assumes base 1.

Note: I have no idea if this works on non-UNIX-like systems (i.e. Windows).

Use it like:

extract_lines.pl <file with list of lines> <file from which to extract lines> [optional base number]

And now, the code:

#!/usr/bin/env perl

use strict;

unless(@ARGV == 2 || @ARGV == 3){
    die "Usage: extract_lines.pl <line number file> <source file> [base]\n";
}

open(NUMBERS, "<$ARGV[0]") || die "Failed to open line number file $ARGV[0] for read: $!\n";
chomp(my @numbers = <NUMBERS>);
close(NUMBERS);

open(SOURCE, "<$ARGV[1]") || die "Failed to open source file $ARGV[1] for read: $!\n";
chomp(my @source = <SOURCE>);
close(SOURCE);

my $base = 1;

if(@ARGV == 3){
    $base = $ARGV[2];
}

# sort inputs just in case
my @sorted = sort { $a <=> $b } @numbers;

# save mem
undef @numbers;

my $nextline;

$nextline = shift(@sorted);
my $currline = $base;

foreach my $line (@source){
    if($nextline == $currline){
        print $line . "\n";
        if(@sorted > 0){
            $nextline = shift(@sorted);
        }
    }
    $currline++;
}

Bug reports welcome, just leave a comment.

Why Credit Cards are Good (alternate title: Why Debit Cards are Bad)

I am a reader of the comic “Templar, AZ” (sometimes NSFW), and a one-time reader of “The Tightwad Gazette”, so when I found out that Templar, AZ artist and author Iron Spike (whose actual name I do not know) wrote a comic with another artist on how to live well but thriftily, I was all about that.

It was funded through a Kickstarter campaign well before I ever heard of it, but just yesterday the PDF went up for sale for $5, so I snagged myself a copy.

I find myself agreeing with much of the book, but a little diatribe against credit cards at the beginning really put me off. I know this has been hashed and rehashed, but credit cards are not inherently evil. If you can’t control yourself with a credit card in hand, fine, don’t use a regular credit card. The spendthrift character in the book objects by saying something like, “But, how can I buy stuff online without a credit card?”, and the penny-wise protagonist assures her that she can use her debit card instead.

This is a very, very bad idea.

Imagine this scenario: your credit or debit card (or account info) is stolen. Someone goes on a spending spree, buying $1000 worth of prepaid phone cards before the fraudulent activity gets shut down one way or another. How would this go with credit vs. debit cards?

Credit: Notify company of fraud (if they didn’t call you first, as they usually do these days). Sign a sheet of paper saying you didn’t make the charges. Get a new card. Done.

Debit: Notify bank of fraud. Probably sign a sheet of paper as above (never had my debit card / number stolen, because I DON’T USE IT), wait for the bank to put the money back into your account.

Now, it’s one thing if your debit card and checking account only had a small portion of your money on/in them. However, if you had a lot in there, you could be without a big, important chunk of your money for a long time, assuming you ever get it back. This happened to a friend of mine in grad school, and it took her I think 1-2 months to get her money back. Thousands of dollars. Just don’t do it.

If you really, really can’t trust yourself to use a regular credit card with restraint and pay it in full every month, get a secured credit card (where you load money onto the card and then spend it), or if you must use a debit card, make sure it’s well segregated from the bulk of your money. Keep it in a different bank from your savings. In fact, you should probably have another checking account as well, just open a checking account specifically for the use of that debit card.

Please stop using debit cards. The banks love them because they get merchant fees. They love them so much that most banks now charge you extra for a plain old ATM card instead of a debit card. But don’t fall for it. Use cash, use credit cards, us prepaid or secured cards, or segregate your debit card in its own bank. But don’t just go using your debit card attached to your main bank account.

The book also decries the use of credit cards as an emergency buffer. An ’emergency’ credit card with a $20+k limit and a negotiated low interest rate in addition to your emergency savings fund could be a huge lifesaver in a major, expensive emergency, and help you build credit to get lower interest rates on, say, a mortgage. Really that’s another topic entirely, though.

End rant.

EDIT: Key point – most people think of credit cards as reasonably secure. In practice, not really. Thousands of credit (and debit!) card numbers are stolen every day, if not every hour. The whole system (at least the way the USA does it and the way most merchants seem to run their security) is full of holes like swiss cheese. Would you rather go putting your debit card number (linked to your checking account) out there, or your credit card number?