Vincent Gable’s Blog

September 27, 2009

Python Programmers Don’t Get Laid Much

Filed under: Programming | , , ,
― Vincent Gable on September 27, 2009

Or Python Programmers are Wankers

Good recommendation systems are a win for everyone. But inevitably, they show correlations to undesirable products, and in that sense they also all give condemnations, which sometimes can be quite funny.

According to amazon.com, customers who bought a tube of Swiss Navy Cream Masturbation Lubricant also bought Learning Python, 3rd Edition,

CorrelationSmaller.jpg

Find Your Own

The only trick to finding a juicy “condemnation” is to start with something embarrassing to buy. Amazon has a filtering system, so regardless of how strong the correlation is, it shouldn’t ever show embarassing purchaces from the Learning Python book page. And even for systems without a filter, this approach maximizes your chances of finding something, since every recommendation from a disreputable product is a condemnation.

I’m not sure where the sweet-spot in popularity is for finding a condemnation.

If an item has fewer purchases overall, that should mean that it takes only a few purchases of it and X for X to be recommended. On the other hand, that means fewer items will be recommended from it.

Things can be too popular. Because Amazon only shows up to 100 recommendations, if an item has enough purchases, all of the recommendations from it will be so similar to it, that finding a “deviant” condemnation is impossible. Again I don’t know exactly where this popularity threshold is.

Good luck!

September 21, 2009

Best Mosquito Bite Remedy

Filed under: Announcement,Tips | , ,
― Vincent Gable on September 21, 2009

The past few rainy days here in Austin have been a welcome respite from the drought, but it means mosquitoes. The best remedy I know for a mosquito bite is Thayer’s Superhazel,

Most importantly, it numbs mosquito bites quickly, and seems to help reduce swelling. It’s most effective for me when I use a little spray bottle to apply it; then blow on the bite or put it under a fan. Airflow + menthol = instant relief.

What do you think works best for treating mosquito bites?

September 18, 2009

Strange AOL Instant Message Filtering

Filed under: Announcement,Bug Bite,Security | , , , ,
― Vincent Gable on September 18, 2009

You can’t send a message over AIM that has a JavaScript event handler name, followed by = in it. The message seems to be blocked on the server, not in the client, as this behavior was observed in different AIM clients (iChat, Adium, and meebo.)

Examples

The following messages can’t be sent over AIM:

onclick=

onclick =

Yo dawg, I heard you liked onclick= in your JavaScript…

Interestingly, using a newline, instead of space, between the handler name and = allows the message to be sent, even though it is still valid HTML/JavaScript. For example, you can send,

onclick
=x();
/*this is fine*/

I suspect there is an interesting security story behind all of this. If you know how and why this filtering came to pass, I please leave a comment.

Thanks to Dustin Silverman for helping me investigate this. In case you were wondering how I stumbled onto this behavior — I was sending snippets of HTML from twitterglyphs.com/ over AIM.

September 17, 2009

Installing Mac Apps

Filed under: Accessibility,MacOSX,Programming,Usability | , , ,
― Vincent Gable on September 17, 2009

Today’s Daringfireball article on the shortcomings of the Mac application-install procedure is worth a skim. Gruber’s suggestion that Mac OS X automatically move 3rd-party applications into the /Applications/ folder on first-run, (a la the dashboard widget install process) is a good one1. Since Mac OS X already prompts you on first run (“Are you sure you want to run a program Apple didn’t write?”) it’s hard to see any downsides to this idea.

But that’s not the behavior we have today1.

Don’t Use a Damn .dmg!

As it stands today, I don’t see a good reason to ship your apps as a .dmg. I’ve been suspicious of disk images for a few years now; and usability tests show that people get confused by them.

Distribute your application as a single .app in a .zip archive. What possible use are other files besides the application? If a “Readme” file should be read before using the application, then show it when the application is first launched.

Installers are opaque and un-Mac like. There’s always a risk that they’ll install something that breaks the computer. As a developer I am even more suspicious of installers on the Mac, because I know how broken Apple’s installer tools are.

Of course, as a developer, I know that applications do sometimes need to install components. And here the best solution is for the application to check it’s environment and ask to install missing components as needed (in essence be it’s own installer). It’s more robust, since it detects-and-corrects missing or damaged components. It always preserves the user-facing abstraction that the icon is the application.

Applications shouldn’t install hacks dangerous enough to require a bundled user-facing unisntaller. To make IMLocation work, I had to install a background process — but I made it intelligent enough that it would uninstall itself if the main application had been deleted. Yes, this is more work, but it’s worth it.


1Another idea is to make Safari and Firefox smart enough to download applications directly into the right /Applications/ folder, bypassing the usual downloads folder. This elegantly solves the instillation problem, although it creates some new problems.

2Although it would be a cool hack to write.

Big Freaking Systems

Filed under: Programming,Quotes,Research | , , , ,
― Vincent Gable on September 17, 2009

A programming language is a tool for handling design complexity. That’s what all of computer science is, really — languages, libraries, type systems, garbage collectors, everything you learn about programming. They’re ways to build more and more complex designs without losing your grip.

The way you manage complexity is to be able to ignore it. A good programming tool lets you forget about some part of the problem, so that you can focus on some other part. And it ensures that when you return to the parts you forgot, you haven’t accidentally broken them.

Andrew Potkin

Years ago, When I was taking to programmers about what college I wanted to attend, I had in interesting conversation about how Computer Science education is an utter failure at preparing students for real-world programming. Outside of Software Development, no technical field accepts (sometimes prefers) candidates with “N years of experience” in place of a degree. I’m not sure I know why CS education fails so badly and universally. But my current best guess is that it’s because school never exposes you to enough complexity. Projects have to end in a semester. You never have to deal with a multimillion-line program, written by hundreds of co-workers, dozens of which you need to collaborate with, at unexpected times, for surprising reasons.

September 15, 2009

More Dear Than Sleep

Filed under: Uncategorized | , ,
― Vincent Gable on September 15, 2009

… making (my new MacBook Pro) well worth the ~$2700 purchase price because I use my computer for more hours in a year than I sleep

Jason Kottke

My computer stays on 24/7. When I take it somewhere, it’s “asleep” but still on. Yes, I restart it occasionally; but by any human definition restarting isn’t turning off, anymore than someone blinking is taking a nap.

September 11, 2009

Never Start An Integer With 0

When programming, never start an integer with 0. Most programming languages treat a decimal number that starts with 0 as octal (base-8). So x = 013; does not set x to 13. Instead x is 11, because 013 is interpreted as 138 not 1310.

Languages with this quirk include: C, C++, Objective-C, Java, JavaScript, Perl, Python 3.0, and Ruby. If you add up the “market share” of these languages, it comes out to above 50%, which is why I say most languages.

“But I use {Smalltalk, Haskell, Lisp, etc.}”

I’m jealous that you get to use such a nice language. However, it’s bad programming hygiene to pick up habits that are dangerous in common languages.

Now, I assume you wouldn’t write 7 as 007, unless the leading zero(s) carried some extra meaning. There are cases where this clarity outweighs “cleanliness” (unless the code meant to be ported to a C-like language).

But you should at least be aware of this inter-lingual gotcha.

September 5, 2009

Powered by WordPress