Posts Tagged ‘nerdery’

Removing GPS data from an image

Wednesday, August 11th, 2010

I constantly forget how to remove the geotags from my pictures before I put them on the internet. Here’s an imperfect way to do so:
jhead -purejpg /path/to/image.jpg
Source

This will get rid of timestamps and other ancillary information that you may want to keep attached to the image. It seems like it would be pretty simple to write a script that uses jhead with no arguments to grab the Date/Time field, then run it again with -purejpg to remove all extraneous data, then run it a third time with the appropriate arguments to re-set the Date/Time field.

Technology as explained by my mother: The Internet

Wednesday, July 7th, 2010

I was lamenting to my mother the difficulty in explaining technical answers to people who have limited experience with technology. She sighed sympathetically and said something along the lines of, “It’s very difficult for people who are used to dealing with a physical object to understand this thing fluttering all around us, breaking all the laws of physics.”
“Wait, where did you think the Internet is?”
She made a fluttering motion with her hands, “All around us. Like God.”

Technology as explained by my mother

Friday, July 2nd, 2010

Someday I’d like to rent out a hall or theater and charge $5 a head for my mom to answer the audience’s technical questions. The audience would require a certain amount of savvy to realize that her answers are hilarious, not informative.

I’ll probably never get around to renting that space, so in the mean time, I’ll be posting them here, in a series I call “Technology As Explained By My Mother “. The first installment has already been posted. I’ve got a few such episodes drafted, I can be reasonably certain this will be at least a three-part series. I hope you enjoy them as much as I do.

Technology as explained by my mother: Links

Tuesday, June 29th, 2010

I was fielding technology questions from a family friend who had a hilarious misunderstanding about what a link was (he expressed a concern that too many people would link to his web page and cause a short circuit). I went to tell my mom so we could both laugh about it, but first I quizzed her to make sure she knew what a link was.

I asked something along the lines of “If I told you Google links to CNN, would you know what that meant?”

A google is a thing that appears there and you click it and it does something, whether you want it to or not.

She stopped to tell me to stop making that face. I didn’t catch what she said when she continued because I was trying to keep a straight face.

Random Blogroll Category v1.5.1

Monday, June 28th, 2010

I just committed a minor revision to my WordPress plugin Random Blogroll Category. The line that was supposed to remove an extraneous HTML tag was completely wrong. The latest version will put out valid HTML.

It’s worth noting that I have no further plans for developing this plugin unless it is broken by a future WordPress update.

A primer to blocking advertisements in Firefox

Tuesday, January 19th, 2010

Before I instruct you on how to block ads, I feel compelled to point out that many web site derive their revenue largely or exclusively from advertisements; if you don’t download the ads, the web site doesn’t get paid. Some see ad blocking as theft. I don’t. But I would be remiss in providing these instructions without providing enough background for you, the reader, to make your own educated choice in the matter.

I will cover two lines of defense against advertisements in Firefox: Adblock Plus and custom stylesheet creation. Each has it’s own strengths and weaknesses. I believe Adblock prevents advertisements from being downloaded, which saves you bandwidth (the tubes don’t get clogged with stuff you didn’t want in the first place) and, as indicated above, the web site potentially loses revenue. With a custom stylesheet, you still download the ads, but Firefox doesn’t show them to you, so the site still makes money off you. I haven’t benchmarked it, but I’ve read that a sufficiently large custom stylesheet will slow down your browser. Slower than an equally large set of Adblock filters? I don’t know.

Once you’ve installed Adblock, you can click on the Adblock Icon. Mine appears in the bottom corner of your browser, but I’ve also seen it next to the search bar. You may have to look around. Click on the icon, wherever find it. It will give you a list of the blockable items on the page. I don’t have any idea what any of them represent, and I don’t know of a speedy way to find out, so I like to block conservatively by scrolling through the list of URLs till I find one that looks like an ad server. For example, on Facebook, the only three of the blockable items with URLs suggesting advertisements all started with http://creative.ak.fbcdn.net/ads3/.

Click on the URL will make it appear in the “New filter” prompt across the bottom. Because it seemed pretty safe to assume that anything in the directory ads3 is an advertisement, I added the following new filter:
http://creative.ak.fbcdn.net/ads3/*

The asterisk (*) at the end tells Adblock that it should block anything starting with the given URL.

That blocked all the advertisements’ images, but the text of the ads remained visible. I searched for how to set up a custom stylesheet and manipulate a div on an entire domain, only to find that someone else had already created a much more robust file and installation instructions. Its worth noting that this will download the ads, so the sites you visit will still get paid, and you don’t have to see the ads.

There are couple other ways to block ads, but they require more detailed configuration than I expect the average user to be comfortable with:

  • My favorite is NoScript. It prevents the browser from executing Javascript unless you explicitly tell it to on a site-by-site basis. This breaks most web sites, so it’s not for the faint of heart.
  • Both Windows and Linux (and presumably Mac) have a file listing where to look for certain servers (or hosts). If there’s a domain name you never want to reach again, you can block it in the hosts file. It requires you to add each domain name automatically, so it can be tedious. There are several pre-made hosts files available for download, but I haven’t looked into them to know if they’re any good. I believe the syntax is the same for Linux, Windows and Mac, so if you develop a hosts file you really love, you can take it with you if you change operating systems.

Woe to computing woe – an ode to Roberta

Sunday, January 10th, 2010

After my last post, I was not sanguine about the fate of my favorite tower. Having swapped out four live disks, three optical drives, two hard drives and two memory sticks, that meant the problem could only be the motherboard or the processor (there’s also the power supply, but this really doesn’t look like a power problem). Either way, it’s more work than I’m willing to put into this tower when I have two other theoretically-intact towers.

The first runner up is an Dell I got interning in a scrap shop. It’s 2.6 GHz with like 256 MB in memory. I consoled myself by saying that with a memory upgrade, it’s almost as good as my favorite tower – a 2.6 GHz Pentium with 1 GB (before memory woe) and a bus speed of 800 MHz. I don’t know the bus speed on the Dell, but I surmised it was at most half that. After waiting a good 10 seconds just to get past the bios screen, I decided the bus speed was probably about 2MHz.

I had no idea what was on the hard drive, or even if I’d left a hard drive in there, but I wanted to see if it it ran. I don’t remember what it did, but it didn’t work, so I took the optical drive out of my favorite tower and put it back into this one (from which I’d originally stolen it). I put in one of the disks and waited. I don’t remember what the error was, but it was different than it had been on the other tower, which was encouraging. After a couple more live disks failed, I gave up on this tower and moved on to my last resort: Roberta.

Roberta: 566MHz with 64 MB RAM.
Roberta was my first computer. She was a gift from my mom in 2000. I thought I was just keeping her for sentimental purposes, but I dug her out of the closet and out of retirement. I laughed when I saw her “Designed for Windows 98” sticker on the front. I laughed again at her hardware as I plugged things in: the dialup modem wasn’t integrated; I remembered somebody from ResNet installing the network card during first semester at Humboldt. The funniest – and slightly worrisome – observation was that she only had one USB port. I had a vague recollection that it had never worked quite right, but I didn’t know if that was because she ran Windows 98 at the time or if there was something defective about the hardware.

I didn’t remember what – if any – operating system I’d left her with. The sounds she made as she booted were like nostalgic music. I looked in my hardware drawer and noticed the piece of metal that cradles her hard drive, conclusively answering my question: no, she did not have a hard drive. I grabbed it and the first hard drive off the stack. As I fit the drive in the metal, I noticed the label I’d affixed to the hard drive years ago, “Roberta’s O.” I took this as a sign that all was coming together well, and I’d soon be cruising the information superhighway at 566 MHz.

I booted again to see if I’d left an operating system on her hard drive. I had not. It occurred to me, as I selected the install disk to try first, that none of the operating systems I had on hand would run on 64 MB of memory. Even Puppy and Damn Small Linux require twice that. But I went forward in the name of adventure.

She showed me something interesting: she had all the same error messages as the first tower. The only thing in common was the four disks – all of which were burned from my spindle of CD-RWs that I’ve been burning and reburning for years, then burned on my laptop.

I got out a brand new disk from my CD-R spindle, slapped Debian on it and rebooted my favorite tower. Two hours later I was moving my data from the external hard drive on to my brand new Debian install.

Getting DVDs to play is always my least favorite part of a new Linux install. While contemplating keeping the old Fedora 9 installation, I spent hours fruitlessly trying to get it playing DVDs. Fortunately, there is a Debian multimedia repository. Fifteen minutes later I was watching my latest Netflix disk while my files copied in the background.

I am SO happy to be running Debian again it makes me squeal out loud. I haven’t been this giddy since the library finally filled my hold on Breaking Dawn. It feels like being reunited with an old friend – all thanks to my even older friend, Roberta.

Computing woe

Saturday, January 9th, 2010

I hate golf. I hate golf. Nice shot. I love golf.

Goes for computing too


My laptop has been on death’s door for some months. The screen turns off randomly. I attached an external monitor, and that solved the problem for a little while, but eventually it stopped sending signal to that monitor also. It’s probably a really simple fix, like a loose wire, but I can’t figure out how to get at the relevant innards. The laptop has been a good little friend, but its probably not worth the investment of having it fixed. My plan was to just keep using it as long as its usable, then use my old desktop after it died.

Just for funsies I decided to upgrade it to the latest version of Ubuntu. I don’t have any idea what possessed me to do something so stupid. Every time I upgrade Ubuntu, it brings me nothing but heartache, and I swear never to do it again. Their slogan is, “Linux for people.” Years ago, when we spent an evening together upgrading our laptops to Edgy and it rendered both our laptops unusable, Michael dubbed it “Linux for people who hate themselves.”

I backed up all my data on two (2) hard drives and ran apt-upgrade. It ran for several hours, first downloading packages, then installing them. Occasionally it would ask me if I wanted to clobber a config file.

Meanwhile, I turned my attention to the tower I’m grooming to take over for my ailing laptop. The plan was simple: format over Fedora 9, install Debian, copy personal data, celebrate.

It’s been about a week and I’m wondering if I’ll ever get to the celebrate step. I burned four install disks for various Debian-based operating systems. I’ve tried each one on three different optical drives. Each time I got some non-descript error about a disk error. I’ve tried enough drives to cast suspicion on the disks, but I’ve tried enough disks to make me distrust the drives. In short, I don’t have any idea why I can’t install a new operating system.

Meanwhile, on my laptop, the screen has died and its external monitor is also blank. Usually leaving the lid shut for a few hours will prompt it to come back. Sometimes you can also push the little pin that tells it if its lid is closed. Those failing, wiggling the external monitor cable can sometimes do the trick. This time, none of those worked. For lack of a better idea, I went to bed.

The next morning I still couldn’t get any kind of visual from the laptop. It’s never before stayed off after being shut that long. Lacking any better option, I shut it down. A couple minutes later I booted up and it wouldn’t boot past init 3. I ran dpkg --reconfigure -a and it picked up installing where it had apparently left off (I’m guessing it was waiting on some kind of input from me). Eventually it completed and I was able to start gnome.

Except that it had no internet. It was claiming not to have any network cards. I have no idea what caused this. There was nothing in the logs. Even if there had been, it’s not like I could have googled it, given that it had no network, its successor wasn’t booting, and the server is headless. The server was actually my best bet at that point, had I plugged in a monitor I could have googled from Links.

In replacing the optical drive on the tower, I noticed there were two hard drives plugged in. I unplugged the extraneous one and learned something new upon reboot: Fedora 9 won’t boot if it can’t mount one of the entries in fstab. Even though the operating system and all the files it actually used were on the intact hard drive, it mounts / read only, which prevents the obvious fix: edit /etc/fstab.

Fortunately, Ubuntu’s install disk is also a live disk. However, I got the same non-descript error that had prevented me from installing when I tried to boot of the disk.

To summarize:

  • I can’t boot off the hard drive.
  • I can’t boot off the live disk.
  • I can’t reinstall the operating system.
  • None of my other computers are in a condition to permit me to download additional ISOs, not that I have any reason to believe they’d do any better.

So I sucked it up and reinstalled the hard drive that fstab wanted, removed it entries from fstab, and re-removed the hard drive. It wasn’t difficult, it just seemed stupid to fix problems with this operating system when the idea was to obliterate it. However, after two days of fighting with four computers, I tired of not having a working computer.

Since Fedora’s not so bad, I decided I’d just upgrade the tower to the latest version and go on with my life. It dies toward the end of the pre-upgrade steps. I’m told Fedora upgrades are always buggy and I should just start anew from CD, Would that I could!

For lack of a better idea, I tested the memory. I was relieved when It failed, because it meant I may have isolated the source of my woe. I took out one of the two sticks and retested. It passed. Just for fun I swapped sticks again – the untested stick should fail, since together they failed, and the one I’d already isolated had passed – it passed too. Curious, I put them both into the two previously unoccupied slots. They again failed together, but passed when tested separately. I don’t have any idea what conclusion to draw from this, but it does me no practical good because I still can’t reinstall the operating system.

It would seem I’m stuck in computer limbo right now. I’m grateful to have working-ish machine, but I don’t want to move all my data until I’m happy with the machine, and I’m hot happy with this. I have two more towers, but they’re even slower than the Fedora box running at half-memory capacity.

Ambiguous date storage

Sunday, December 13th, 2009

I’ve often pondered how to record and work with ambiguous dates in software. I typically have one of two reasons:

  • Scheduling: an item that needs to be done next week or some time in February or a summer Saturday afternoon. The user can schedule it for Monday, or Feb. 1, then, at the end of every day it goes undone, reschedule it for the following qualifying day. This works, but the role software is to automate that sort of responsibility. If the user has to do something the computer could do just as well, the software is lacking.
  • Dating pictures: You kids today and your fancy digital cameras with your fancy exif data and your geotagging. In my day, you had to write the date on the back of the photo. By hand! Like they did in the dark ages. Some pictures from this era have complete or partial dates. Some dates were obviously written decades later. Others you could probably guess and be accurate within about 5 years. In addition to storing a date, each part of the date (day, month, year) may have differing levels of accuracy, and it would be nice to be able to store its certainty with it.

I usually work with MySQL for my application’s data storage, so I’m going to assume that’s the tool we’re storing ambiguous dates in. It’s native Timestamp/Datetime format is YYYY-MM-DD hh:mm:ss. I usually store dates this way. In some contexts I might simplify my life by storing the Unix timestamp instead, but I like the dates to easily human-readable straight out of the database. Any ambiguous date storage system must consider all six pieces of information (year, month, day, hour, minute, second). An obvious table to store this sort of information might be:
create table ambiguous_dates(
    id int unsigned not null auto-increment
        primary key,
    year int(4) unsigned,
    month int(2) unsigned,
    day int(2) unsigned,
    hour int(2) unsigned,
    minute int(2) unsigned,
    second int(2) unsigned
);

Regarding the inclusion of all six pieces of information: while a system for cataloging decades-old pictures won’t have any use for the time of day portion, the idea here is to develop the most complex version I’m likely to need, then scale it back for individual projects if necessary.

I have three issues with this implementation:

  1. Day of the week. The only way to deal with hat is to add another column, but that introduces the possibility that parts of the date will conflict with one another (ie, the YYYY-MM-DD portion is given as 1962-03-23, which was a Friday, but the day_of_week column claims Wednesday.)
  2. Certainty of each field. This is especially important if the parts of the date can conflict with on another as in the example above. We could add another six fields for year_certainty, etc, but that feels heavy-handed to me; I suspect there’s a better way.
  3. According to this article, it just reinvents functionality already built in to MySQL.


create table ambiguous_dates(
    id int unsigned not null auto-increment
        primary key,
    year int(4) unsigned,
    month int(2) unsigned,
    day int(2) unsigned,
    day_of_week int(1) unsigned,
    hour int(2) unsigned,
    minute int(2) unsigned,
    second int(2) unsigned
);
 
create table ambiguous_dates_certainty(
    date_id int not null,
    field varchar(11) not null default '',
    certainty int(1) not null default 0,
);

This is closer to what I want, but it doesn’t join gracefully with the above table (you sure can join, but you’ll get up to seven rows of results for one date, which is awkward), so you risk having to run a second query, which is expensive in terms of processing time, and still gives you two sort of awkward sets of data. Additionally, I’m not sure I like just having an int for certainty. If it’s am multi-user application, one person’s seven may be another person’s three. Also, unless very explicitly programmed otherwise, some users may see 1 as very certain and others may think of 9 as the most certain. And even then, since when do users take the time to read the whole prompt when they think they have the gist of it?

We could add a text column indicating the source of each portion of the date so that we’d know whether it was from a reliable source or somebody’s best guess half a century after the picture was taken, but that also feels excessive to me. What would the corresponding interface for that look like? Is it fair to expect to enter each portion of the date separately, then add meta information about each portion? Especially when they’re likely to be (as in the example of the picture catalog) cataloging dozens or hundreds of ambiguous dates? Eventually, whether programmer or user, you have to accept that some data will always get lost to the sands of time, even if it means never knowing how old grandma was in that picture of her with her dogs.

A compromise might be to just have one column for notes in the ambiguous_dates table. If programming for my own use/enjoyment, I don’t think I’d take that compromise. My usual MO is to try to retain as much information as possible because once forgotten, it can’t be brought back, whereas if it’s retained needlessly, it’s easy to ignore.

I don’t think I’ve made any particularly good suggestions, but it is a starting point. I googled the topic and found very little written on it (but I did find this thread about another kind of ambiguous date), although I may not be using the best terminology. I’d be interested in hearing what the good people of the Internet have to say.

Better than silent mode on the G1

Tuesday, December 1st, 2009

I killed my two biggest annoyances with my G1 with one stone: I recorded a couple seconds of silence and set that as my default ringtone.

  • Even if the volume control on the side of the phone gets pushed in my pocket, my phone will vibrate silently (but for the noise of the vibrator) when I receive a phone call.
  • The phone cannot by design mix silent and noisy alarms (all can be silent or all can be loud), I can now set the default to noisy, set mid-day alarms to vibrate while using the silent ringtone, and those alarms facing the formidable task of rousing me from a dead slumber can still blast at full volume.

I assume these points are also true for any other Android-based phone on the market.

Detailed instructions

Set silence your default ringtone.

  1. Download snd.ogg. You can also record your own silence if you want to be all proprietary about it, but the result should be about the same.
  2. Transfer the file from your computer the same way you would any other file. If you downloaded from your phone rather than your computer, I believe it will be automatically added to your music library.
  3. Go to the Music application on your phone. In the library, press the “artists” button. There is no artist/album data associated with the file, so Android files it under “Unknown artist” and album “Music”. Scroll down to the song snd. Hold your finger down over it until a context menu pops up. Select “Use as phone ringtone”. Your default ringtone is now silence
  4. If you’ve given people in your address book their own ringtones, those will still be audible. Either adjust those settings individually or learn to live with the shame of Hanna Montana announcing your mother’s every phone call.

Silence some alarms.

  1. Having followed the directions above, go to the Alarm Clock application. Tap the alarm you’d like to silence.
  2. Tap ringtone. In the ensuing menu, select snd. Tap OK.
  3. Make sure vibrate is checked to avoid making the alarm too subtle.