Programming

Mar. 4th, 2009 12:53 pm
xela: Photo of me (Default)
I am not a great computer programmer. Many of my friends are great programmers, and including some who are world class. This has occasionally made me feel like I'm a crappy programmer, and if I go long enough without talking to anyone outside the MIT community about technical stuff, I can get to where I feel downright stupid.

A few months ago a friend, who's a working programmer but not one of my superhacker friends, asked me to look over some code they were failing to find a bug in.
I'm really not a programmer, you know....
Just look. Fresh pair of eyes and all that.
What's this language? I've never seen it
Special purpose language for this thing....
Hm. This variable — you're not testing for greater than foo.
Can't happen.
[After I spend a few minutes looking over the rest of the program, tracing the logic.]
I'm not convinced. Try just printing an error message if it's greater than foo...

It turned out that the "can't happen" case was happening. And I remembered that I don't actually suck at this stuff. I may not be a genius at it, but I'm not hopeless either.

This in turn encouraged me to think about maybe trying to improve my skills. About a month ago, I came across Project Euler
Project Euler is a series of challenging mathematical/computer programming problems that will require more than just mathematical insights to solve. Although mathematics will help you arrive at elegant and efficient methods, the use of a computer and programming skills will be required to solve most problems.

The motivation for starting Project Euler, and its continuation, is to provide a platform for the inquiring mind to delve into unfamiliar areas and learn new concepts in a fun and recreational context.

What's not clear from that is that there's an extent to which it's structured like a game. Today, I finished level zero.
Bravo, xela! Now that you have solved 25 problems you have achieved what 79.71% of members have failed to do and have advanced to level 1. Good luck as you continue.
xela: Photo of me (Default)
For the last seven and a half years, the government's been screaming at us to Be Afraid!! all the damned time. That got old quickly, and seriously old about the time they started making me take my shoes off at the airport.

And now Google joins in?!?

This morning, I went to do an innocuous search — and all of my results came back marked
"This site may harm your computer"
I did four increasingly innocuous searches, ending with a search on "table" (Full-size screenshot behind the cut.) )
Out of all four of my searches, the only hits of the first ten not to have that warning were the one sponsored link I got, and links to Google's own "shopping results for <search_term>' page.

Way to go live with a new feature, Google!

(To be fair, Google would have to screw up on this scale an order of magnitude more often to be seriously competitive with Microsoft. I should also note that by the time I was done writing this, the bug was gone.)
xela: Photo of me (Default)
I think there is no English word in common use that annoys me more, as regards its written form, than resumé. I try to be consistent about writing it with the accent in my own use, but I'm not happy about it. It's pedantic and it looks weird on the page in any context other than a book. But i've reluctantly decided that is less bad than using resume, which I as a reader (even of my own writing) always trip over, hearing it in my head as the verb pertaining to continuation. It's a no-win situation.

A question for my British readers: I get the sense that in your division of our common language, the brief written summary of your employment history that you submit with your application for a job is more commonly referred to as your vitae. Am I correct in that? It would certainly solve my problem. (In American usage, curriculum vitae or cv is a longer and more complete summary, and for the most part only university professors have one.)
xela: Photo of me (Default)
I don't remember whether I've posted about it or not, but my okd phone (a treo 680) had been on its last legs for a few months, crashing roughly once a day, having sync problems, and just generally being annoying. The earliest I could renew my contract with AT&T and be eligible for a subsidized phone was Dec. 9. So first thing last Tuesday morning, I went to the AT&T store. It took less than 20 minutes to leave with my new iPhone, with a reasonably full charge and ready to take calls. (The guy would even have transferred my phonebook from the old phone if I hadn't seen what he was doing and stopped him: One of the problems I'd been having was that syncing would introduce garbage duplicate records. I hadn't synced for a couple of weeks, and had cleaned up my Mac's address book in anticipation of a clean start.)

I haven't been playing with it obsessively, as some of my friends might, but I dare say i've gotten fairly well acquainted. Overall, I don't think I've felt like a new toy was this cool since I got my Palm Pilot 5000¹ in 1996. At that time, I remember talking about how I was holding as much computer in the palm of my hand as the Mac Plus of roughly ten years earlier. Now I'm once again holding as much computer in my hand as a roughly ten year old Mac — but that's one hell of a lot more computer, and you can get a lot more done with it. Plus, another ten years of really smart people thinking about palmtop UIs have gone into the iPhone, and boy does it show.

That said, there's plenty of gushing about the iPhone out there, and it's not without its frustrations. So I'm going to focus on some of those. Starting with the on-screen keyboard: this has to be the most annoying and error-prone UI device ever. I thought it would be slightly worse than the Treo's thumb keyboard; instead, I find it takes me two or three times as long to enter any text I need to. And because of Steve's control-freak instincts, not only is there on option of using a bluetooth keyboard when I really care about entering text, but I'm told the architecture would make it nearly impossible even if Apple changed their minds and wanted to allow it. (There is a report of a beta Graffiti, but it would require jailbreaking my iPhone, and I'm not that frustrated about text entry. Yet.)

One place where Apple's control-freak attitude is just flabbergastingly stupid is alert tones. It's not just that the only way to add a ringtone without hacking is to buy it from ITMS, although that's certainly annoying. No: Consider my choices for sounds settings. Silent mode is a physical switch on the phone, which is totally the right way to do that; the sound settings also give me independent control over whether the phone vibrates in silent and ring mode — as you would expect from even the most basic phone these days. Those aside, here follow all of my sound choices:

ItemChoices
RingtoneMenu w/ 25 items
New Text MessageMenu w/ 7 items, including 'None'
New VoicemailOn/Off
New MailOn/Off
Sent MailOn/Off
Calendar AlertsOn/Off
Lock SoundsOn/Off
Keyboard ClicksOn/Off

And what do I do if I don't like the alert tone Apple chose for, say, Calender Alerts? (Which, as it happens, I don't: the phone has to be sitting on the table in front of me for me to even notice it. Which makes it pretty pointless.) Or if I would like a vibrating alert in addition to the sound for something other than a call? Apple's answer appears to be "Sucks to be you."

Which brings me to another matter, Apple's arbitrariness in its role as App Store gatekeeper. Perhaps their contract with AT&T really does require them to limit the functionality of iPhone apps. But given that Steve used that excuse for his original decision not to allow third party applications at all, only to backpedal on it and open the App Store a year later (and given the applications that exist on other smartphones), I'm dubious. I like Apple a lot, and I'm an Apple shareholder, but I hope if they don't get their head out of their ass about this, someone finds a way to drag it out in court.

And while we're on the subject of the App Store: Damn, what a terrible UI. If I have to use iTunes as a special-purpose web browser, can't I at least please have spacebar give me page-down? And how about letting command-click open, if not a new tab, at least a new window? And command-left-arrow take me back a page? No, scratch all that: Just make the damned App Store a fucking website, only calling iTunes for downloading. (Then, among other things, people could link to App Store descriptions of iPhone apps in a discussion like this, instead of having to Google for a page about each app, and mostly not finding a satisfactory one.) The App Store also turns out to get an F in arithmetic: A couple days ago I was looking at two iPhone spreadsheets. Both, according to the App Store, have an average customer rating of three stars. But when I looked at the reviews for one of them, which has only been out about three weeks and only had eight reviews, I found myself thinking these don't average three.. In fact those ratings are 1, 5, 3, 5, 5, 4, 5, and 4 — that's a total of 32. Dividing 32 by 8 and getting 3 is the kind of arithmetic I expect from politicians, not computer companies.³ Oh, and Apple: once you've mastered the arithmetic thing, maybe you could get your buddies at Google to help you with the search thing? Searching the App Store for "spreadsheet" gets me 34 apps, of which at most a half-dozen are spreadsheets and another dozen or so special-purpose apps you might, if you squint, think of as spreadsheet-like. The rest include the likes of gFlashPro (a flashcard program) and RPN Calculator, neither of which appear (there is no searching or copy-pasting the descriptions; see previous remarks about iTunes sucking as a web browser) to even have the word in its description. And none of those 34 is i123, whose description starts "i123 is a spreadsheet program for iPhone...."


One last point: I really love having high-speed internet in my pocket, and the combination of that plus GPS had me thinking of the iPhone as a basic navigation tool after only a few days. I was consequently extremely frustrated last night when I couldn't get any network connectivity, even though I had four or five bars of voice connectivity. I'd have gotten home a good 20 minutes sooner last night if that had been working. (Or if I hadn't assumed it would work and had instead done what I would have last weekend or any other time in the past decade: spent a few minutes downloading and printing maps and directions before I left.) I'm told losing 'net is a known issue, and that switching into and back out of airplane mode. Call me naive, but I expected a product that's been out for five months and sold tat least eight million units to be out of beta.

Now, to close on a positive note, some things I'm enjoying about my iPhone:
Favorite way to kill time on the T:
Tiltsnake: the classic snake game, controlled by swipes of your finger — or, if you change a setting (which, oddly, has to be done in the Settings app, not in Tiltsnake itself) by using the iPhones accelerometer.
Best amusement:
urbanspoon: Launch it, give it permission to use your location, and shake your iPhone to see a slot-machine display (with appropriate sound effects) of nearby restaurants. Keep shaking til you find one you want to try. (I have not yet used it to find a place to eat, but it's fun to play with.)
Best gee-whiz UI:
Google Mobile app: Pick up the phone, launch the app, hold it up to your ear, speak your search, hold it in front of you, and read the results. Totally amazing. Now I know why they've been giving away 1-800-GOOG-411.
Most useful:
The strangely named Air Sharing: a combination of a WebDAV server that runs on your iPhone — enabling you to easily upload any files you might want to have in your pocket — and a file browser that lets you look at them, in most of the formats you might care about. This is so much cooler than it sounds. The other day I spent roughly an hour on the T, reading a book all the while without having brought my bag. I can review a spreadsheet, show someone my resume, or proofread a friend's thesis, all in this one app.


¹ Boy do I wish I'd hung on to that little piece of computing history.

² Called, imaginatively enough, "Spreadsheet" and "Spreadsheet LX" — I want a ringside seat if one of those developers sues the other for trademark infraction.

³ Yes, I checked the other as well: Its 59 reviews average 3.17, for which rounding to 3 is entirely sensible.
xela: ligature of the letters w, t, and f (wtf)
I tend to command-click on links when reading pages, and sometimes don't get to the resulting tab for days or even weeks. Which occasionally results in my uncovering a tab and going What the fuck? I would really like to be able to click on something in my browser at moments that would take me back to the page that referred me to the tab, in the hope of obtaining some context. I don't suppose anyone knows of a Firefox extension that does that? Or if it is perhaps a feature of Google Chrome?
xela: Photo of me (Default)
The museum and associated projects at Bletchley Park are in dire need of funding. Historic buildings are crumbling and need restoration. Despite its historical importance it receives no ongoing public funding and is urgently seeking donations. The iconic Victorian Mansion alone requires somewhere in the region of £1,000,000 for repairs and some of the symbolic Codebreaking Huts are in a desperate state of decay.
More at savebletchleypark.com

They're soliciting donations. If you live in the UK, they're also soliciting signatures for an e-petition to Downing Street to get government funding.

It would be a shame to see this important part of geek history fall into ruin.



¹ Yes, that URL caused me to consider the possibility that it's a scam targeted at geeks. The donation link takes you to bletchleypark.org.uk, which has been in DNS for ten years and is registered to Bletchley Park Trust Limited. So if it's a geek-targed scam, they're thorough and have a long planning horizon.
xela: Photo of me (Default)
I just sent a "please don't feed the troll" zephyr to a friend, and it occurred to me that that rule reminded me of a thread in [livejournal.com profile] siderea's LJ a few weeks ago, that linked to an article about dealing with stalkers. A stalker (paraphrasing from memory¹) gets positive re-enforcement from any contact with the victim — and depriving them of all such contact is necessary if not always sufficient to getting rid of them. A troll gets positive re-enforcement from any response — and not responding to them is necessary if not sufficient to getting rid of them.

Do people think this is more than a superficial analogy? Is the troll a species of stalker?



¹ I wrote the post before looking up the URLs: I had entirely forgotten that the title of the article.
xela: Photo of me (Default)
I'm told I should be able to use iChat on my Mac to have audio or audio-video conference with a Windows user using the latest official AIM client. If you're a Windows + AIM user, and would like to let me try this with you, please leave your AIM username and some times today or tomorrow when you'll be available (don't forget to mention your timezone) in a comment. (Or if you're uncomfortable doing that, in email to xela AT mit.edu.)

The goal here is for me to be able to send mail to Windows users I want to talk over the net with saying "Do these things and we can talk online."

Thanks in advance!
xela: Photo of me (Default)
I had a chance to actually handle a MacBook Air the other day, and all my doubts were swept away. I carry my laptop most of the time these days, and the weight savings would be a godsend. Unfortunately, the price tag plus the fact that my MacBook is less than two years old conspire to make it feel like too much of an indulgence.

But the idea of carrying around several fewer pounds of computer all the time is very appealing. So I want to at least play with an Eee, get a sene of its heft and try typing on one. Does anyone know of a store in the area that carries them in stock?
xela: Photo of me (Default)
I just for the second time in as many months bought coffee at Shaws in Porter. And for the second time in as many months, realized only when I got home that I had forgotten to grind it. I never do this at Whole Foods.

I am tempted to attribute this (geek is a rationalizing animal, after all) to a subconscious aversion to the grinders at Shaws, which are always so grungy that I suspect they've never been cleaned, and which my nose can't help but notice have been used for that sin against nature, flavoured coffee.
xela: Photo of me (Default)
Yesterday marked six months since I was able to start working out regularly. Since May 15th I've lost 51 lbs and gone from being worn out by ten minutes on the nordictrack or concept2 to being able to take a 40 minute bike ride, park the bike, do my grocery shopping, have lunch at the store, ride a half-hour back home via a slightly less indirect route, and still not feel tired. My typical resting pulse has gone from the low 90s to the high 70s.*

I've spent a total of 96 hours and 3 mins doing aerobic exercise of some sort or other over the past six months — probably more, since when I have to estimate, I try to lowball it. I've recorded 329 aerobic exercise sessions on 122 days over those six months. (Yes, 122/183 or exactly 2/3. No I didn't plan that.) My exercise sessions had a mean duration of 17 min 31 sec, the median session being 13 min.**

I would have given up in despair long since without the support of my friends. Sitting here looking back on six months of solid progress, it all looks fantastic. But at any given moment during that six months, or the next six months, or the year after that, it can be awfully hard to believe there's light at the end of the tunnel. Friends matter more than I can say at those times. Thank you.
My doctor says the thing I need to focus on now is endurance, and with my median session being 13 minutes, he certainly has a point. Aside from my target weight, I didn't have any goals more concrete than "get into better shape" when I started this. Now that I know what kind of progress I can make, I want to set some concrete goals for the next six months:
  • Every day that I exercise, I will have one session of at least twenty minutes duration
  • Once each week, I will have at least one 60-minute session
  • I will have at least four sessions of two hours or greater
Look for another retrospective in six months, telling you how it went with those goals.
* The downside, such as it is, to my progress is that I can no longer get aerobic exercise in anywhere nearly as readily as I could six months ago. The other day I spent two hours cleaning out the garage and raking (wet) leaves, which would have easily gotten me into my aerobic range six months ago. When I finished and checked my heart monitor, my average pulse was 109: not high enough to count as aerobic. Six months ago, I could go for a stroll and my pulse would average 120; now a ten minute walk won't get me into my aerobic range unless I'm paying attention to walking fast.

** If you're interested, you can see a large and detailed graph of my exercise activity over the last six months. Or, if you're really, really interested, you can see that same graph in context, with an html-ified version of my exercise log. (That page is mostly for my doctor, who's very enthusiastic about it.)
xela: Photo of me (Default)
I'm looking for a tool to help me filter my email. Whenever I've mentioned this before, someone always mentions procmail. At which point I take a cursory look at procmail, find myself thinking about cats having hairballs, and go do something else.

But at this point, even though I have really excellent spam filtering, my mail is getting unmanageable. Before I actually dig in to the procmail hairball, I'd like to know what, if any, alternatives I should look at.

I think my pony here would be a special purpose language (or better, a python module) with which I could write scripts that I would run either directly on maildirs on my imap server (i.e. I would run them as a local user on the sserver), or that would function essentially as a scriptable imap client.

My starting point for thinking about the features I want is mh: I've been using shell scripts and mh to filter my MIT mail for years; at minimum I want the features that gives me. Which is, in a nutshell, the ability to filter on the content of any header. I could live with less annoying syntax, though:
# punt any discussion involving tom lord on fsb
rmm `pick -lbrace -to fsb -or -cc fsb -rbrace -and \  
          -lbrace -from lord@emf.net -or -to lord@emf.net -or \
          -cc lord@emf.net -rbrace `
Leaving aside how inefficient that code is, I could totally do with being able to express that instead as:
for item in inbox:
    if item.to(fsb@crynwr.com) or item.cc(fsb@crynwr.com):
        for user in ["lord@emf.net", ... ]:
            if item.to(user) or item.cc(user) or item.from(user):
                trash(item)

        refile(item, fsb_folder)
I'd also like to be able to alter messages.
    if item.from(my_fax_service):
        # save a copy of the original just in case
        copy(message, fax_archive_folder)
        for element in item.body.parts:
            if element.type != 'application/pdf':
                delete(element)
        refile(item, faxes)
So, if anyone knows of a mail filtering system that would be closer to my pony than procmail, I'd love to hear about it.
Edit: Added 2007-11-01 at 19:29

I forgot to mention one of the main reasons this is a pony: I should have made clear that part of the reason I'm thinking in terms of something I can run on the files in a maildir is that I don't necessarily just want to filter mail upon receipt. For instance, I'd like to be able to run aging filters, to archive or trash messages past a certain age that match certain criteria. Or to send mail to myself saying, e.g., "You have mail in your personal inbox from Charlie that's two weeks old. You should answer that and refile it." That said, I'm not really expecting to find my pony, and am looking at sieve docs right now....

New wheels

Oct. 17th, 2007 07:00 pm
xela: Photo of me (Default)
Two weeks ago I sold my car. Today I took delivery of my new wheels. A much sportier model. More... )
xela: Photo of me (Default)
I was thinking of riding my bike somewhere today and realized I have no idea what's become of the key to my bike lock. It's an old Kryptonite "New York" lock: A heavy square-stock hardened chain with a small U-lock, not much bigger than a typical padlock to hold the ends of the chain together. I could get a new key for the lock, but I suspect it's suceptable to a variant of the bic pen attack, and fortunately I stored it unlocked, so it hardly seems worthwhile. Instead, I'd like to see if I can find a different lock to use with the chain. I'd like to find a lock that wouldn't be conspicuously the weakest link in comparison to the chain. Can anyone recommend a padlock (or some other type of lock) that would be roughly as daunting to thieves with bolt cutters as heavy hardened steel chain?
xela: Photo of me (Default)
Today, for the first time in quite a while, I spent the day pretty much uninterruptedly sitting in front of the computer geeking. The net result of which (this is going to be greek to some of you) is that I have a half-dozen freshly minted dotfiles, a new favorite terminal emulator that does what I want the way I want (mrxvt), and have finally, after over fifteen years using tcsh as my login shell, switched over to bash. (It made sense to go with tcsh BITD. It stopped making sense probably five years or so ago, and I haven't switched earlier largely due to inertia. I like my customizations. But today I decided to just sit down and do it. And now it's done.

It was kind of nice to spend a day grinding away on this sort of stuff. Though it no doubt helps that I don't have a steady diet of it.
xela: Photo of me (Default)

I often use Google when I'm not sure how a word is spelled, especially when I have two alternative spellings in mind, on the theory that if the number of hits differs by an order of magnitude or more, the one with more hits is probably correct. Today I tried this in a way I quickly realized was subtly sloppy, with misleading results:

  • 4,660,000 for hermann miller
  • 806,000 for herman miller

Two "n"s beats one by better than five to one, that's straightforward enough. But I can't help but notice that the top four hits for both searches (i.e. the ones I can see without scrolling) all conspicuously say "Herman Miller", with one "n". What's up with that?

What it is, of course, is that I'd constructed my search sloppily. I was interested in how Herman[n] is spelled when conjoined to "Miller", but what I had searched for was how it is spelled when the two words happen to appear on the same web page. A situation in which, for whatever reason, Hermann vastly outnumbers Herman. Putting a dot between the two words* yields:

  • 28,900 for hermann.miller
  • 2,080,000 for herman.miller

One hundred to one. Now that's more like it....

* Googling miserable.failure and "miserable failure" are equivalent; I prefer the former because it's less typing and I'm lazy.

xela: Photo of me (Default)

I came across this while Googling for info pertaining to the post I'll be making in a few minutes. It didn't really fit there, not even in a footnote, but I wanted to share it.

Banning of books was unknown in India before the Britishers imported the concept to serve and protect their imperial hegemony. Even though mostly Christians by faith, they signally failed to learn from the life of Jesus Christ that crucifixion of the Messenger could not annihilate the message but made it more efficaciously vibrant and effulgently operative. You can kill the thinker, burn his writings, but not his thought or expressions.  —A.M. Bhattacharjee, in The Hindu.

...crucifixion of the Messenger could not annihilate the message but made it more efficaciously vibrant and effulgently operative. What American or Briton since the nineteenth century would have the balls to write that sentence? For a newspaper column? And expect the editor to let it pass? And be right?

I love clean, simple prose. But in my fairly random (though admittedly limited) encounters with English prose written by Indians, they demonstrate a relish for the entire range of the English vocabulary that I find wonderfully invigorating — in rather the same way a nice curry would be after a week or two of sandwiches.

xela: Photo of me (Default)

Every geek has had the experience of saying a word aloud that they learned from reading &mdash and discovering that they pronounce it wrong. It's rather a rite of passage for young adult geeks1. It's been a few years since I experienced this phenomenon from the speaker's side. But yesterday I found myself using the word "fecund" in a sentence — and just as the F sound started passing my lips, realized I did not know how to pronounce it. Which isn't to say I didn't have a pronunciation all loaded up and ready to emerge from my lips. But I had no idea whether it was, in fact, the normal pronunciation2. This tangential thought caused me to screw up the bit of mental arithmetic necessary for the rest of the sentence, such that I said "August" when I meant "May".

(Perhaps the threat lies not in a large vocabulary, but in the meta-state of observing yourself stumbling over your own vocabulary and thereby menacing your arithmetic skills.)


1  I do wonder, with the advent of computer dictionaries that will pronounce a word for you at the click of a mouse, whether we may be the last generation of nerds to share this common experience. It is both vastly quicker to look up a word online than in a paper dictionary, and much less work to click your mouse than to figure out your dictionary's pronunciation key. I'm sure if I were a kid today I would use an online dictionary far more than I in fact used paper ones when I was little. (I was always very fond of dictionaries, but it was nevertheless rare that I wouldn't try to puzzle out a new word from context first, and only turn to a dictionary if I couldn't. Or — rarely — when eiher zero or two obvious pronunciations occurred to me.) This is, of course, not an unmixed blessing: We may also be the last generation discover the pleasure of browsing the dictionary.
2  According to thefreedictionary.com I in fact mangled it rather badly.

xela: Photo of me (Default)
So, if mechanical locks are so easily defeated, perhaps you were thinking of a fancy biometric lock. I suggest you watch how The Mythbusters deal with this one and then think again. (Note: History has shown that TV network executives are too stupid to recognize free publicity when it's staring them in the face, so I expect this video will be pulled off youtube in fairly short order.)
xela: Photo of me (Default)

Transcript of an AIM conversation between me and [livejournal.com profile] crs this afternoon. He'd just mentioned looking at a mutual friend's new iPod nano:

me:
I've only seen pictures. It's very nano.
crs:
8G that you might accidentally swallow. Welcome to the future.
me:
Nah. The future is 8G implanted behind my ear, with iSync over bluetooth and a lifetime battery recharged by head-bobbing....
crs:
"battery low. please play more death metal."

Profile

xela: Photo of me (Default)
xela

November 2022

S M T W T F S
  12345
6789101112
13141516171819
202122 23242526
27282930   

Syndicate

RSS Atom

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jul. 9th, 2025 11:30 pm
Powered by Dreamwidth Studios