31 March 2008

I posted this with Ctrl+P

OK, try this. I think all browsers have a file menu; if your browser doesn't have a file menu, find one that does. Open the file menu. Done? Good job. Now, did you in any way touch the mouse? If you used the mouse to open the menu, you're doing something very wrong.

I was recently forced in class to read a thing about how wonderful the Mac menu system is. Seriously, I had to explain why Mac OS is clearly the superior operating system. For credit. I don't have the lecture material, but suffice to say Mac menus are awesome because the current window's menu is always at the top of the screen, so you can just fling your mouse to the top of the screen and easily click the menu. Now, obviously this ignores the whole still-need-to-position-horizontally problem, which I would think pretty much kills the time gain, but apparently studies say it really is faster. However, this also ignores the you're-using-completely-the-wrong-interface problem. The approximate order of increasing input device speed is:

  1. Prayer

  2. Mouse

  3. Keyboard

  4. Mind reading


The mouse has lots of useful applications, but my definition of "lots" is degrees of magnitude smaller than most people's. People used to watch me use computers in middle school and giggle that I never used the mouse, and while "never" is an overstatement it's fairly accurate compared to the rest of them. The mouse is stunningly overused, because people are too lazy to learn the keyboard ways to do stuff. You don't even have to bind your own shortcuts, just the default ways to do things will massively speed up your productivity.

If you need to run a program, Super+R opens the run dialog in Windows, Meta+F2 in GNOME. I can't remember the last time I manually opened a run dialog, and I almost never use a shortcut or a start menu item to launch a program, it takes forever. Super+D/Ctrl+Meta+D shows the desktop, although hopefully if you're doing this you're not going to need desktop shortcuts anymore so this won't come in handy very often. Here's one nobody seems to know: Super+Pause opens the System properties dialog. Never right click My Computer again. Want to open the start menu? There's a dedicated key on the keyboard for it. Stop clicking the start menu and hit the key with the pretty windows symbol on it. Then hit the first letter of the menu you want to jump to, P for programs, S for search (although Super+F will get you there faster anyway), etc. Just learning basic navigation keys for documents makes life so much easier. You don't need to be a vim ninja, just knowing that Ctrl+End will get you to the end of the document in most programs is helpful. Highlighting by holding Shift and an arrow? Hold down Control too and each arrow press will jump one word instead of one character.

Now, if you're feeling super crazy, you can set up your own hotkeys to do stuff. I don't know the canonical way to do this in Windows, but most programs come with their own way to deal with hotkeys. Under Linux I use XBindKeys, which lets you map keys to commands really easily. Here's one of my entries:

mpc toggle
Alt+Mod4 + space

When I hit Meta+Super+Space, it runs "mpc toggle", which pauses or unpauses my music. I have a bunch for MPD, a bunch of others for MPlayer (for videos), and a handful for miscellaneous other programs. For maximum fun, you can get peripherals. I have a Saitek Command Pad and a Griffin Powermate, and I use Gizmod to control both of them, which lets you write Python scripts to deal with input devices. In short: bonus hotkeys. Global hotkeying is much easier in Linux because everything is doable from the command-line, but I imagine a lot of this can be accomplished in Windows as well.

Side note: Coincidentally (I started writing this like a week ago when I had the evil lecture of mac-loving), there's an article on Coding Horror about how using the keyboard tends to take longer than using the mouse when learning a program. This is probably true, although with hints like letters underlined in menus I would think the keyboard would be able to keep up just about from the beginning. Nonetheless, once you know how to use the keyboard, it's always going to be faster, so if it's a program you use regularly it's definitely worth the effort. Google understands this, and all of their web applications have hotkeys built in, which is something incredibly lacking in web UIs for some reason. I hit Ctrl+S to save my draft of this entry, and Ctrl+P to publish it. In Google Reader (which i highly recommend), J and P jump to the next/previous entry in the list, and V opens the current selection in a new tab. There are other hotkeys, I don't remember them because I don't use them often, but just remembering two or three saves time.

26 March 2008

All the cool kids hate Apple

There's an article on ITworld about how even Apple will be hated one day. When that day comes, I want to have this blog post on hand so I can point at it and say "See! I TOLD you they sucked. I hated Apple before it was cool to hate Apple"

22 March 2008

Start?

This is going to be short, but this particular thing drives me crazy. At some point some anti-Microsoft person noticed that to shut down your machine, you click the Start button. They apparently thought this was quite comical, and suddenly everyone on the internet is making fun of Microsoft for being so silly as to put the shutdown option in the Start menu. Now, it's possible the whole Internet is just stupid, or maybe people really do get it and then just keep making fun of Microsoft anyway because it makes them feel good, but just in case it's the former I'm going to clear it up right here. The "Start" on the Start button means start doing something. So, for example, if you want to start to shut down your computer, you would click Start -> Shut Down. You don't click the Start button to start up your computer either, but nobody seems to care about that one. No, it's not a perfect analogy, but when they added the start bar in Windows 95 it was a really big deal UI-wise (No more alt-tab switching!, wink), and it took a decade for somebody to finally complain that apparently they're too slow to figure out how to shutdown their machines.

Microsoft is a dirty thief, let's iCry about it

I found yet another video of Apple bitching that Microsoft steals all its stuff:



Normally when I talk about operating systems on here I focus on my love of Linux, so it may not be clear that my love for Linux is equal to my hate for Mac OS. I hate the look and feel, I hate the interface, I hate the software, I iHate their iNaming scheme, and I hate its users pretty much on sight. Mac users focus on three truths they latch onto like a religion (speaking of things I hate):


  1. Mac is the best

  2. Windows steals everything from Mac

  3. Windows sucks


At some point they're going to realize that there's an issue in there somewhere. Windows steals everything so flawlessly from their precious Mac OS that they call it "photocopying", but Windows still sucks huge. Stop bitching that Windows steals all your shit as though they're going to stop or something; you can't maintain that you're amazing and yet still complain that people are imitating you and you want them to stop

21 March 2008

It's just like a real table!

I've seen dozens of videos now on Microsoft Surface. First, I think Surface could be very cool, I love multitouch interfaces. Second, I think right now Surface looks useless. As far as I can tell, a personal Surface table can do exactly four things:

  1. Show really big maps. This is pretty neat; personally, I would get tired of manually dragging a map around instead of just entering an address and going there, but I can see the use for it

  2. Transfer files (well, really just pictures and music in the clips I've seen) between devices. This is useless for me, but cool for other people, so this one is good

  3. Take the nice, organized photos stored on a device and explode them into a mass of disorganized thumbnails that you can spin and resize for no reason

  4. Make little bubbles shoot out from a glass when you set one on the table


Now, the one that really annoys me is apparently Surface's big feature: allowing you to, and I quote from more than one video, "organize your photos". For some reason, Surface's definition of "organize your photos" is to take all the photos on your device, ignore any organization they may have like folders named "Vacation" and "Work", and spread thumbnails of them all over the table haphazardly. Sure enough, I check the Wikipedia article and there it is:



Apparently this is somehow a good thing. If I wanted my photos to be like this, I would take print photographs and spread them all over my much cheaper analog table. Why would you want this?

Terrible:


Sexy:


I made up those picture folders on the spot because I don't take pictures, but still. I really don't understand why you would want to use the method of organizing photos that computers replaced forever ago, that's exactly the wrong way to be going about this. We should be designing new interfaces that are even easier to use than the ones we have now, not ones that very accurately simulate stuff we've already gotten rid of. Somebody should write a Surface app that lets you play music by dragging an LP over to a record player and then dragging the needle onto the record. Not that people ever actually do anything with the photos but spin them around and resize them over and over again; it's actually very much like people who enable the desktop cube in compiz for the first time:

20 March 2008

Jon Stewart: 1, Crossfire: 0

My roommate is watching this clip for the first time, and it's come to my attention that not everyone in the world has seen Jon Stewart destroy Crossfire. And you should see it before you die, because he is both unbelievably funny and extremely intelligent, unlike the sadly unimpressive Crossfire hosts:



And the transcript:
(show transcript)


Prefix notation considered harmful?

I found an article on making readable S-expressions. The premise is that, as Paul Graham is quoted as saying in the article:

I've used Lisp my whole programming life and I still don't find prefix math expressions natural

I understand that prefix notation isn't what everyone learned in school, so it seems weird at first, but I find prefix and postfix notation both more logical than infix; come to think of it, I'm actually not sure why we even use infix in the classroom instead of prefix. It's an ambiguous grammar, so (ironically, considering all the whining about parenthesis in S-expressions) you need parentheses to clear up what the meaning is, or some sort of accepted precidence rules.

Postfix makes sense if you think of things like a stack, which granted most people probably don't. It's easy to understand in that sense though. If you see an operator like +, you're going to add the last two numbers you had, so 2 3 + means add 2 and 3, and you end up with 5 on the stack. Want to do (2 + 3) * 5? To hell with parentheses: 2 3 + 5 *. This is easiest for computers, but I agree it doesn't make much sense to think about math this way.

Prefix makes total sense to me, however. In prefix notation the first thing you get is what you're going to be doing. You shouldn't have to wait for the middle of an expression like 2 + 3 to find out you're doing addition; when you have + 2 3 you know from the beginning you're adding two numbers, all you need to do is get the actual numbers now. Prefix notation tends to be much more logical to read: + 2 3 is obviously "add 2 and 3". Infix notation requires a passive voice like "2 added to 3", which seems silly. Programmers take it for granted that you would call add(2,3) to use the add function to add two numbers, but balk when they see (+ 2 3) as being obviously wrong -- all Lisp has done is normalize everything instead of having an annoying mix of prefix and infix functionality.

When I first learned Lisp (technically, Scheme) I thought it was the greatest thing ever, and I loved writing things in it. I think a lot of programmers have the same experience, and yet there seems to be a growing movement to destroy the S-expression, which seems to defeat the whole point.

19 March 2008

Holy hell, all is not lost

If you haven't heard Obama's speech from yesterday, go listen to it. Now. It's fine, my blog will still be here when you get back. Or watch it here:



How great was that? Seriously, it gave me chills, I can't remember the last time I heard a speech I could even stand to listen to, let alone liked. Rumor has it Obama wrote that speech single-handedly. If he did, we might not end up destroying the world after all like I figured was pretty much inevitable at this point. Even if he didn't write it alone, still, it was great. Now, I understand that our southern voters might worry about electing someone who "knows stuff". (Yes, I went there. Be happy I left the racism out of it for the moment). But please. Please. Don't keep electing crazy morons, we can't afford another four years of insanity. Presidential candidates seriously worry about "looking too smart", because "people don't want to elect someone smarter than them". WHY NOT? Here is pretty much my formula:

(elect (apply max candidates))

Why would you not want the smartest person possible? Are you jealous? You should be, they're President and you're not. Sorry I went all second-person on you, but I'm imagining getting my hands on all the people that, to put it bluntly, vote wrong. Don't vote for somebody because they make you feel smart by comparison, vote for somebody that can actually fix everything.

This post is a trade secret

How hard is it to write voting machine software? Seriously, ignore all the problems we've had with them, and (if you're a CS, or just bored) picture it. How long would it take you to write something that asks the user who they vote for, and records it?

Who do you vote for?

 

DONE. Slap a database connection on that thing and it's already more successful than the voting machine software in use today. What is wrong with these companies? Furthermore, what could possibly make them think this is ok:

Union County has backed off a plan to let a Princeton University computer scientist examine voting machines where errors occurred in the presidential primary tallies, after the manufacturer of the machines threatened to sue, officials said today.

A Sequoia executive, Edwin Smith, put Union County Clerk Joanne Rajoppi on notice that an independent analysis would violate the licensing agreement between his firm and the county. In a terse two-page letter Smith also argued the voting machine software is a Sequoia trade secret and cannot be handed over to any third party.

Excuse me? How can we possibly still allow security through obscurity designs? Haven't the *epic failures* of these designs in the past proven that we should maybe not do them anymore?


If you missed what actually happened that prompted this investigation, there's coverage elsewhere, I'm not going to go though it all. In short, dozens of voting machines in New Jersey were disagreeing with themselves: the number of votes for each candidate didn't add up to the total number of votes the machine said were cast. The article I just linked to had a fantastic example of how bad this is:

This is a single voting machine, disagreeing with itself about how many Republicans voted on it. Imagine your pocket calculator couldn’t make up its mind whether 1+13+40+3+4 was 60 or 61. You’d be pretty alarmed, and you wouldn’t trust your calculator until you were very sure it was fixed. Or you’d get a new calculator.

We (as in, the country) should refuse to so much as consider a voting machine that isn't completely open. And I know this is the OSS inside of me talking, but in this case I would think everyone would agree that a voting machine that can be examined by everyone is better than "It works and doesn't cheat at all, pinky swear. Love, Sequoia". Anyone that wants to can view the source code for this page and look at how my voting buttons above work, so they can clearly see that clicking Hillary's button seems to very suspiciously cast a vote for Obama anyway.

Finally, this is somewhat unconnected to the general "closed-box voting machines are bullshit" argument above, but I noticed this in the article too:

Sequoia maintains the errors, which were documented in at least five counties, occurred due to mistakes by poll workers. The firm, which is based in Colorado, examined machines in Middlesex Count, and concluded that poll workers had pushed the wrong buttons on the control panels, resulting in errors in the numbers of ballots cast.

Why in the world do poll workers have buttons that change the number of votes that have been cast? Why do poll workers have buttons that do anything at all? Let's take a poll on what poll workers should be able to change:

Add votes
Subtract votes
Nothing at all
It doesn't matter, I'm just going to change your votes anyway

Good news, you all voted for "nothing at all", because I changed your votes. Perhaps I shouldn't have this power, and neither should the fairly technology-illiterate poll workers who just have to see what the blue button does.

13 March 2008

Weapons of Mass Piracy

The MPAA today weighed in on net neutrality. Think about everything the MPAA has done in the last five years, and then guess how they came out on it. If you guessed "the way nobody likes", good call. From Glickman himself:

Government regulation of the Internet would impede our ability to respond to consumers in innovative ways, and it would impair the ability of broadband providers to address the serious and rampant piracy problems occurring over their networks today.


Ah, there's the magic word. It would not be below the MPAA to blame global warming on the "rampant piracy problems" facing the world. They're almost as bad as Bush with terrorists, which is a depressing analogy really. Terrorists are to Bush as piracy is to the MPAA: Bullshit they use to get away with whatever they want.

This is my second negative blog post today; I need to find more positive sources of news.

Microsoft: Standards are for lesser companies

The W3C has been working on a draft for supporting safe XSS requests. It's currently a working draft, so they're encouraging comments and criticism on the design; that's the whole idea behind publishing the working draft. Firefox 3 implements the draft as it currently exists. While I think implementing drafts is a somewhat bad idea, Firefox 3 is in beta, and Firefox's automatic update mechanism means they can make any changes that come up in the draft.

Did Microsoft implement the draft? Or, even better, did they just wait? Or, God forbid, did they take their ideas and contribute them to the W3C draft? Hell no they didn't, waiting and contributing to the community is for "the other guys". They implemented their own mechanism. How very precedented, Microsoft. They just couldn't fucking help themselves, they had to do it. So once the W3C draft is finalized, everyone else will implement it, IE will have its own way, and web developers will have to write functions that use both methods. Soon fun libraries will come out that handle all the browser differences for us so we don't need to bother. Libraries that needn't have ever existed at all. Pledge to conform to web standards indeed.

This question occurred to me once, and I still don't have the answer, so if somebody does comment or something. Why does Microsoft still make Internet Explorer? They don't make money from it, they were forced to start distributing it for free ages ago. They get in trouble for antitrust stuff because of it all the time. Every web developer alive hates them because of IE. They'll probably never get it right. What's the point? Why not just distribute Firefox or some other browser instead, and stop making a custom browser?

11 March 2008

random.choice(['Clever','Not so much'])

Apparently there are rules to having a clever blog title. Fortunately, I have avoided public reprimand by

  1. Not attempting to be clever with my blog title

  2. Having no readers


Take that interweb

If Gore were President

This is a couple years old, but this is the first time I've seen it. Gore did an intro to SNL in 2006 where he talks about his presidency for the last 6 years, it's both hysterical and very depressing:



Here's the transcript:


AL GORE: "Good evening my fellow Americans. In 2000 when you overwhelmingly made the decision to elect me as your 43rd President, I knew the road ahead would be difficult. We have accomplished so much, yet challenges lie ahead.

In the last six years, we have been able to stop global warming. No one could have predicted the negative results of this. Glaciers that once were melting are now on the attack. As you know, these renegade glaciers have already captured parts of upper Michigan and northern Maine. But I assure you, we will not let the glaciers win.

Right now in the second week of May 2006, we are facing perhaps the worst gas crisis in history. We have way too much gasoline! Gas is down to nineteen cents a gallon and the oil companies are hurting. I know that I am partly to blame, by insisting that cars run on trash.

I am therefore proposing a Federal bail-out to our oil companies because hey, if it were the other way around, you know the oil companies would help us.

On a positive note, we worked hard to save welfare, fix Social Security, and of course, provide the free universal health care we all enjoy today. But all this came at a high cost. As I speak, the gigantic National Budget Surplus is down to a perilously low 11 trillion dollars. And don't get any ideas. That money is staying in the very successful lock box. We're not touching it. Of course, we could give economic aid to China or lend money to the Saudis again, but right now we are already so loved by everyone in the world that American tourists can't even go over to Europe anymore without getting hugged.

There are some of you would like to spend our money on some made-up war. To you I say, "what part of lockbox don't you understand?" What if there's a hurricane or a tornado? Unlikely I know, because of the anti-hurricane and tornado machine I was instrumental in helping to develop…but what if? What if the scientists are right and one of those giant glaciers hits Boston? That's why we have the lockbox.

As for immigration, solving that came at a heavy cost, and I personally regret the loss of California. However, the new Mexifornian economy is strong and El Presidente Schwarzenegger is doing a great job.

There have been some setbacks. Unfortunately, the confirmation process for Supreme Court Justice Michael Moore was bitter and divisive. However, I could not be more proud of how the House and Senate pulled together to confirm the nomination of Chief Justice George Clooney.

Baseball, our national pastime, still lies under the shadow of steroid accusations. But I have faith in Baseball Commissioner George W. Bush when he says, "we will find the steroid users if we have to tap every phone in America."

In 2001, when I came into office, our national security was the most important issue. The threat of terrorism was real. Who knew that six years later, Afghanistan would be the most popular spring break destination, or that Six Flags Tehran is the fastest growing amusement park in the Middle East, and the scariest thing we Americas have to fear is … Live From New York, It's Saturday Night!"

08 March 2008

I counterfeited Vista. Apparently

It occurred to me today that I pretty much never update Vista, so I ran Windows Update. It found 40-some updates, so I told it to go crazy and install them all. I live on the edge like that. So then I restart, and get this:



A victim? Me? Damn the people I got Vista from! (I got Vista directly from Microsoft). I have no idea why it decided I stole Vista, but I click the resolve link, and it takes me directly to:



Er. OK then. I restarted, and everything was back to normal. So I have no idea why Microsoft decided I stole Vista, but at least they changed their minds pretty fast. I'm more confused why they decided to punish me by disabling, of all the features Vista has that I would need for day-to-day functionality, Aero. You stole Vista? No fancy graphics for you! Carry on with everything else though.

EDIT: I randomly discovered that this is apparently called "Reduced Functionality Mode", otherwise known as the "kill switch", and it will log you out after an hour, so apparently there were additional punishments in store had the resolution process not worked. Which is good, since more than one person told me the speed gain I got from having Aero off was probably the opposite of a punishment. It appears Microsoft has gotten rid of this in SP1, probably because it's unnecessary when users can't boot anymore

07 March 2008

Just Fucking Google It

This is awesome, there's a site you link people to when they ask you stupid questions called Just Fucking Google It. People ask me questions all the time about things I know nothing about, and usually I google it, click the first search result, and send them the URL without even looking at the page, and usually it helps. I actually considered writing a script to automate the process for me, but I think I'm just going to send them this link instead.

06 March 2008

Escaping quotes in SQL

You may have made this mistake in the past:

SELECT * FROM table WHERE row=$search


Silly you. See, what you should have done is escape the search parameter. To do that, you. . . I'm just kidding. This isn't really a blog post about how to escape quotes in SQL, or about how prepared statements are good. However, it does seem to be some sort of rite of passage that every technology-related blog must at some point post about the dangers of SQL injection, and when they do so they must pretend like they're breaking the news for the first time. We've known about SQL injection since about ten seconds after somebody exploited it the first time. When I said you "may have made this mistake in the past", by "past" I meant at least 5 years ago, and yet I constantly stumble across more and more blog posts warning about the dangers of taking raw user input and feeding it directly to your database. Can we all just agree as programmers that we all now know about this, and there's no need to continue informing each other?

Microsoft giveth and Microsoft taketh away

Suddenly so many problems I've had with my home network are explained: XP accounts with blank passwords can't be used over the network. I hereby award Microsoft 1 point for enabling this feature that will increase your security assuming you have no firewall or router and are still stupid enough to have no password, and deduct 1000 points for all of the networking problems I've had everytime I try to access one of my family's computers that doesn't use a password. Apparently my assumption that setting the account to allow remote access meant the account allows remote access was foolish.

05 March 2008

WTF Tkinter?

I'm learning Python for my programming paradigms class. I've used Python before for scripting stuff, but I've never done anything with the graphics part of it, and the first assignment was to make an animation using it. I have a help dialog in my program, which I wrote in wxWidgets. It looks like this:



Oooo. The green border is my theme, btw. So, it turns out Windows doesn't have wxWidgets by default, so if the program can't find wx, it will use Tkinter instead. That dialog looks like this:



Tkinter -- for shame! WTF? The same problem comes up in Java, the default Java L&F is really ugly, so then people tend to think Java programs as a whole are ugly. That is seriously the worst dialog I have ever seen; you really can't get the full effect in this thumbnail version of it, but the text in the actual dialog is all pixelated like somebody took the thumbnail version from above and magnified it to be a normal dialog size. Here's a crop of the full-size dialog:



I'm tempted to not offer help at all if the system doesn't have wxWidgets.

Every vote counts, even after the election

Thanks to the fine folks at the Board of Elections, I received my absentee ballot today. March 5th. Now I can vote and ensure Hillary doesn't....wait, what? What the hell do you mean she already took my state yesterday? Well shit.

Democrats and our primary

Between blogs and listening to the news I've heard more than one Republican make fun of the Democrats because they've had their "presumptive nominee" figured out for a while now and we're still working on it, as though somehow they accomplished this through superior strategizing or something. I'd just like to apologize on behalf of Democrats everywhere for having two candidates the people mistakenly think are qualified to be President instead of your one. Your guy won by default, his main competitor was the guy who thought Guantanamo was awesome and should be doubled in size, and after him the guy who thought the only laws we need are the 10 commandments. For the picture-oriented readers, your guy's main competitor was the green line on this graph:

02 March 2008

Weather Win

I was on break all last week, but I'm back in Indiana today. I have the weather for here and my hometown on my desktop:



Where I am now is on the left. Where my family is now is on the right. I'm feeling pretty good.

EDIT: Well, I deserve this:

01 March 2008

Dynamic Swap Space

Yet another reason why Linux is amazing. I'm pretty much out of RAM, and running out of swap space, because I'm a process whore and I have way too much stuff open. I don't want to permanently increase my swap space, just at the moment I need more, and I certainly don't want to restart to increase it, that kind of defeats the point.

dd bs=512 count=1M if=/dev/zero of=/tmp/swap
mkswap /tmp/swap
sudo swapon /tmp/swap.


Problem solved. I should've switched to Linux years ago.

Bush depresses electorate - Part 1 of 97

Apparently at a news conference yesterday, someone mentioned to Bush that analysts predict $4/gallon gas, to which he responded: "Oh, yeah? That's interesting. I hadn't heard that." I'm actually not surprised that Bush was unaware of this, considering he seems unaware of most things; I'm more surprised at our surprise that he's surprised. I for one find this to be a fairly standard Bush reaction, so I'm not sure why people are shocked. If he ever turns around and decides we shouldn't be in Iraq after all, he could probably manage to convince the country he's so out of touch he didn't realize we're still there. I have no trouble picturing Bush saying "What do you mean, pull out of Iraq? I thought we did that months ago!"

I find these quotes more interesting. I've elided the actual name from both of them:
"Bush waded into presidential politics, criticizing the Democratic contenders for their positions on free trade and taking particular aim at ______________ . . ."

"He reserved his harshest comments for ______________'s recent statement . . ."

Now, it's the same name that goes in both blanks, and you can probably guess which one it is. Obama should seriously run an ad where he says "Vote for Obama: I'm the one Bush doesn't like"

EDIT: Jon Stewart made fun of the first thing on the Daily Show:

Peep Diorama

This is my girlfriend's submission for the Washington Post Peep Diorama Contest, "Give Peeps A Chance":



That's pretty much the greatest thing ever :D