Sep 25 2009

(Don’t) Close Firefox with Last Tab

Prior to Firefox 3.5, the default behavior of closing the last tab was to leave a blank tab. That changed in Firefox 3.5, and the default behavior is now to close the whole window with the last tab. If you’re on Windows or tend to close tabs with Ctrl-W, like me, this can be pretty annoying if you forget about it, what with reopening the browser and all.

Fortunately, it’s easy to change.

Venture into about:config. Go to the address bar and enter “about:config” and press enter. You’ll see a long list and at the top, a text box called “Filter:”

closewindowwithlasttabBuyer Beware here. You probably saw a warning when you tried to go to about:config. That’s because you can significantly alter the behavior of Firefox here, and you need to be either very careful about what you change, or very confident in your ability to fix it.

Enter “tabs” into the filter and you’ll see a list like the picture above. There may be more items depending on the addons you have installed. Now look for “browser.tabs.closeWindowWithLastTab” and double click it. It should turn bold, and in the right columns it will say “user set” “boolean” “false”.

That’s it!

Of course, if you’re not comfortable mucking about in about:config, or you also want to restore the close button to that last tab, there’s an addon* for that.

* Of course, I haven’t used, and can’t vouch for, that addon, but it’s there.


Sep 22 2009

Upgrade Flash in Firefox

If you upgraded Firefox lately, you might have seen a message on the start page urging you to upgrade Flash. As of yesterday, something like 12 million people had clicked through to upgrade. That’s a great number.

However, when you got to the Adobe site, and clicked the “Agree and Install” button, instead just saving an installer file, you might have seen this:

update-flash-1Right there? That’s enough to deter me from this whole process, so I can definitely understand if it scared you off. But this is an important update, a security update, so you need to do it.

Fortunately, it’s very easy to get around this annoying development in Flash. (Their hearts are in the right place, automatic updates, but their implementation leaves something to be desired. Of course, the Adobe Updater makes you quit Firefox to update Photoshop, so this clearly isn’t their strong suit.)

For starters, head to Adobe’s Get Flash page. If you see that annoying bar, click on the [x] in the right corner:

update-flash-2Now, more towards the middle of the page, look for a link that says “click here to download.”

update-flash-3That will start downloading the normal installer we’ve come to know and love. Yeah, you’ll still have to restart Firefox, but you were going to need to do that, anyway.

There you have it, avoiding Adobe’s strange new extra software and getting Flash up-to-date with the latest (really, really important) security fixes.


Sep 1 2009

NextUp

I never properly introduced my latest(?) little side project: NextUp.info.

NextUp

Continue reading


Aug 22 2009

Excitement about HTML5: Forms

I shouldn’t imply that I don’t like HTML5. I don’t like certain parts of it—the redundant new elements that add no functionality and are of little use except to A List Apart. But other parts of the spec are very exciting. Forms, in particular, are getting a much-needed facelift.

Forms will be able to require the user-agent to do pre-submission validation. Obviously we can’t rely on this for security reasons, but it will save us from writing JavaScript validation scripts and give users a better experience with our forms.

And the validation is fairly robust. <input/> elements gain an attribute called pattern, which accepts a simple regular expression, like "[A-E][0-9]{7}".

But you probably won’t need the pattern attribute very often, since there is a whole slew of new types that the UA will be expected to provide controls for, and validate. Crucial types, like email and url, and difficult types like datetime-local and color.

jQuery UI is great, but it doesn’t compare to this kind of power.

I only realized the sorry state of our current form controls very recently, after getting an iPhone. Built-in form fields on the iPhone can trigger different input methods. A field, like ZIP code, that accepts only numbers, opens the keyboard to the numbers first. A field that wants a URL can open a keyboard with a .com button to save time. But web pages can’t do this. They can only say that an input accepts arbitrary text.

For mobile or touch-enabled UAs, knowing that you can open a keypad instead of a full keyboard is a great step forward. For everyone, having date and color pickers built into the UA means saving both developers’ and users’ time. Less time to build and less time to download, consistent experience in the UA across web sites.

Forms also get a new event, input, which is a little like the current change event, except you don’t need to wait for the element to lose focus for the event to fire. That’s just useful.

Controls get new methods, stepUp() and stepDown(), to enable, for example, very fast forward/backward selection on a date input.

The last fun addition I’ll mention (go read the links, they’re all to the same page) is the autocomplete attribute. It doesn’t do what you hope it does. What it does is specify to the UA that it should not remember and suggest values for this input. It lets the UX designer decide whether to use Firefox or IE’s built-in autocomplete on a per-field basis. Useful. (Not as useful as, say, an autocompleteUrl attribute that could load some JSON or XML, but still useful.)

Building forms is going to be so, so much better once these are widely support.


Aug 10 2009

What Time Is It There?

We just pushed an update to What Time Is It There?, so I thought I’d take the time to mention it here, since I’ve already done so on Twitter. You can now link to a time. Continue reading


Aug 8 2009

Reservations about HTML5

A day or so ago, Adrian Bateman, from Microsoft’s IE team, posted his team’s thoughts on the current draft of the HTML5 spec.

Reading it is brutal. Bateman takes issue with basically everything added since HTML4. He goes through and individually criticizes many of the new tags, sometimes with extremely detailed, multi-paragraph critiques. I guess this is what happens when you’re not sufficiently involved at the beginning.

Of course, there is still plenty of time to complain, since the HTML5 spec won’t reach its final stage until 2022.

Bateman and the IE team, even while sounding like they don’t even want HTML5, do bring up a few things that have been bothering me about the spec.

Let me be very clear: I think new tags like <audio> and <video> are wonderful. Breaking the Adobe monopoly is great. There are still some issues (refusing to specify a codec meaning you can’t build support into the browser, for instance) but those types of tags are going to help push the web to a better place.

The parts that bother me are the new, highly touted “structural” tags, like <header>, <footer>, <section>, and worst, <article> and <aside>. Continue reading


Jul 19 2009

EzGz: WordPress GZip Plugin

By default, WordPress (at least in the current generation, 2.8) does not enable any kind of compression on its output. Some plugins, like WP Super Cache, add gzip compression, but that’s an awfully big plugin if all you want is compressed output.

So I wrote EzGz this afternoon. It is, by far, the simplest plugin I’ve ever written. The actual source is probably two orders of magnitude smaller than the comments (plugin details and the license).

All EzGz does is enable the built-in PHP gzip/deflate handler. This does require output buffering, so it’s not right for everyone. Some themes or other plugins may already do this.

I’ve tried using the zlib.output_compression ini setting, but on my server, with zlib working otherwise correctly, the setting had no effect. So I stuck with the output buffering.

You can download it, or check it out of svn, then turn it on and see if it works.


Jul 16 2009

Programming in Middle School?

Eating breakfast in the hotel the other morning, my father mentioned a Twitter conversation he had to join about programming courses in schools and math curricula.

Programming and math education? I just had to get involved, too.

Ben Grey and Colleen K had started talking about the value of programming courses in school. Ben and my father (initially) were against it, concerned that the skills would be obsolete before they could be used, and were not particularly transferable to most fields. Colleen and I took the pro side.

Ben and my father both pointed out that languages go extinct, which is true. But judiciously chosen languages have staying power. Basic can be run in a browser, but is obviously a fine starting point. C has been around since 1972, and it isn’t going anywhere soon. JavaScript has been around since the mid-90s and seems to hold a secure point.

What of transferability? How many professional programmers still work in the first language they learn. Anyone? Anyone? Beuller? My first language was Perl, which helped me learn JavaScript and PHP, which helped me learn Java and C. People older than me probably started with Basic. People much older than me may have used ALGOL—which was on its fourth generation by the time C was born.

But what about the majority of students who don’t want to be programmers?

Programming is a powerful, concrete interface to the two mathematical concepts that cause the most problems for students in K-12: variables and functions.

In the US, our K-12 math curriculum covers three broad areas—numbers, variables and functions. These roughly correspond to primary math (counting, operations, fractions, equalities) algebra and geometry, and (pre-)calculus.

Most students can wrap their heads around numbers, even fractions. They are relatively concrete. Some students struggle with operations like multiplying and exponents, but this is the lowest hump, the bunny hill. The majority make it down unscathed.

When does your school start losing people in the math program? It’s probably around 8th grade. That’s when most schools begin the dreaded algebra. Variables are intuitive to some, but abstract and meaningless to others. If you believe Myers and Briggs, some of us are predisposed to abstractions and generalizations (*NTJ) but is there a biological reason others are lost here? Or do math teachers and curricula need to change?

Of the people who survive algebra without hating math, how many make it past “pre-calculus” or “FST”? I’ve heard the story a dozen times myself: “I was good at math until my calculus class.” If numbers are the bunny hill of K-12 math, then variables are the green circle, and functions are the double black diamond.

Again, functions may be completely intuitive to a few of us, but they can strike terror in the heart of even the most dedicated students.

Too often, when they reach a jump in complexity and struggle, students are told “it’s OK.” They are “not ‘math people.’” This can come from parents (“I was never good at math, either.”) or even well-intentioned teachers (“Maybe you’re just right-brained!”). There is a deeply held belief in this country that “math” is some innate ability, a genetic gift, and either you’re the next Will Hunting, or you may as well not try.

How does this relate to programming? How did you learn programming? Here’s a common roadmap:

  1. Imperative programming; no functions or abstractions; lots of constants; instructions in linear order.
  2. Using variables for input or consistency/ease-of-maintenance.
  3. Using functions and subroutines to encapsulate repeated operations.
  4. Using someone else’s functions—you probably don’t see the implementation.
  5. Branch off to more advanced ideas like object-oriented or functional programming; lots and lots and lots of abstractions.

A remarkably parallel route. And instead of saying “x is a number,” you can say “var name holds the name the user enters!” The results are far more immediate and interactive. Play is cheap. (“What if I change this line? Oh it doesn’t work, better undo that.”) Instead of limiting functions to scary numbers and equations, more pedestrian words can be used as arguments and return values.

Programming is applied mathematics. Teachers spend much of their lives looking for new examples, better applications, to drive home the theory, when there is already a wealth of application available.

There is also a two-pronged economic argument. To paraphrase Mr. Friedman: anything that can be outsourced, will, and the new jobs created here will require deeper interaction with computers. A cursory understanding of the programming techniques underneath will benefit all students as they enter the job market, and the exposure may mean more prepared students entering computer science programs. Basically: we need more talented, creative programmers—how many art students harbor latent programming skills—and even non-programmers will benefit from the exposure and understanding.

And of course, the math skills. No subject (that is taught) is taught as badly as math in our schools. On the personal level, this translates to people who misunderstand interest and get themselves in trouble with debt; on a national level, it certainly doesn’t help when a subprime mortgage market bubbles and pops.

Even if you don’t use “math” on a day-to-day basis, it is another way of thinking, of solving problems. Algorithmic thinking, epitomized in computer programming, provides a layer of cognitive flexibility, and every layer we can add, we should.

I don’t expect every student to become a master programmer, or even explicitly use those skills—or other skills in their math courses—every day. But I do expect schools to use every tool they have to make these methods of thinking and courses of study available to everyone. We wouldn’t allow a future programmer to skip his English class, why would we allow a future writer to skip his math and programming class?


Jul 13 2009

My New Job

I’m very excited to announce my new job: starting next month, I will be on the Web Development team at Mozilla.

Mozilla Firefox

I am out in Mountain View right now, looking for an apartment, meeting my future boss—in person, we’ve spoken on the phone several times—and more of the web team, and checking out the area and the new offices.

I’m incredibly honored to be working with a group of people dedicated to making the internet a better place, and to have the opportunity to help improve products I use every day.

Of course, I’m also excited to be moving into the heart of Silicon Valley, in a beautiful area with fantastic weather, near a great city like San Francisco. It’s a bit of change from Michigan!