December 2009

Bruce Schneier on Aviation Security

Computer security expert Bruce Schneier has a really nice opinion piece on CNN:

One could wonder whether a computer-security expert is qualified to write about aviation security or national security, but what he says makes a lot of sense.

Despite fearful rhetoric to the contrary, terrorism is not a transcendent threat. A terrorist attack cannot possibly destroy a country's way of life; it's only our reaction to that attack that can do that kind of damage. The more we undermine our own laws, the more we convert our buildings into fortresses, the more we reduce the freedoms and liberties at the foundation of our societies, the more we're doing the terrorists' job for them.

Ten New Year's Resolutions for Everyone

Being the arrogant lummox that I am, I've taken it upon myself to make a list of ten New Year's resolutions for everyone to follow.

  1. Be a better parent. Make time to spend with children (even if you have no children of your own).
  2. Be a better spouse. Are you the partner you promised you would be?
  3. Be a better friend. Your life isn't all about you. Reach out to others.
  4. Be a better citizen. Educate yourself about what's going on in your city, in your nation, and in the world. Ask questions. Respect those who disagree with you.
  5. Take care of your health. Prepare healthy meals, get some exercise, take your prescribed medications, get a physical exam and vaccinations.
  6. Put more into your work, but don't let your work take anything out of you.
  7. Correspond with people. This doesn't mean forwarding e-mail jokes, posting your status on a web page, or ranting about what some politician has done. You need to write about meaningful things, and carefully read what others have written.
  8. Examine your beliefs. How did you get them? What are they based on? Do they still make sense to you? Can you imagine what it would be like to hold different beliefs? Talk to someone who does have different beliefs.
  9. Get rid of what you don't need, literally and metaphorically.
  10. Relax more. You really do have the time.

Now you'll have an answer when annoying people ask you what your resolutions are.

Detecting Bullshit on the Internet

It's amazing what people will believe. At least once a week, I'm forwarded a piece of information from a seemingly intelligent person that seems fishy. Obama is not a US citizen! Obama is a Muslim who hates Christians! The Department of Homeland Security is setting up death camps! Eat whatever you want and still lose weight! Cancer cured by prayer! Etc., etc., etc.

It is usually very easy to debunk these claims:

  • Is this story being reported by any reputable news sources? If not, you should be skeptical.
  • Try Googling the first sentence or two of the story. This often brings up pages that demonstrate the story to be a hoax.
  • Try searching websites like http://snopes.com/, http://www.factcheck.org/, or http://skeptoid.com/, that have smart people who investigate suspicious claims.

For some stories, a tiny bit of research and critical thinking quickly leads to the conclusion that they are bogus. But it amazes me that people accept these stories without even considering that they may be untrue. Their "bullshit detectors" just don't work. They accept any negative story about people they don't like, and any positive story about people they do like. They reject mainstream media and other reputable sources in favor of quacks, cranks, and conspiracy theorists.

It is very easy to accept stories without question if they fit your existing beliefs, but we must always be on guard against such acceptance.

The first principle is that you must not fool yourself — and you are the easiest person to fool.
Richard Feynman

Carl Sagan, in his book The Demon-Haunted World, presented what he called his "Baloney Detection Kit". It's a simple set of guidelines for testing the believability of assertions and arguments. If you haven't read it, please do, and apply it both to new stories and to your existing beliefs.

And, please, stop sending me this crap.

The Programs

The following subsections each present a simple JavaScript example program. They proceed roughly in order from simple to complicated.

For each program, there will be some commentary describing small sections of the code. There will also be suggestions for making changes to the programs.

Setting Up Your Text Editor

[This page will describe how to set up a text editor.]

Setting Up Your Work Folder

[This page will describe how to set up a work folder.]

Setting Up Your Web Browser

[This page will describe how to set up the web browser.]

Setting Up

The following subsections provide steps you should take to ensure that you can download and run the programs, and make modifications to them.

jQuery

[This page will describe jQuery.]

Domain Object Model (DOM)

This page will describe the DOM.

JavaScript

[This page will describe JavaScript.]

Cascading Style Sheets (CSS)

[This page will describe CSS.]

HyperText Markup Language (HTML)

[This page will describe HTML.]

Web Browsers and Web Servers

[This page will describe how web browsers and web servers work.]

Background

The following subsections of the book describe the underlying technologies for JavaScript-based web pages. They briefly describes how web browsers and web servers work, what HTML is, what CSS is, what JavaScript is, and so on. The intent is to provide a little bit of background information for readers who are unfamiliar with web technologies.

This is not a tutorial. The purpose is just to explain what each piece does and how they fit together. Links are given to other sources of information where readers can learn more.

If you already know what HTML, CSS, JavaScript, and jQuery are, then you can safely skip this section and move on to the Setting Up section.

Introduction

When I was a kid, in the early 1980's, I got started with computer programming by typing in the programs from David H. Ahl's BASIC Computer Games. I spent many hours typing in those little programs, playing them, and then modifying the code to customize the games to my liking. I later moved on to more sophisticated programming languages, but that early exposure to simple examples of BASIC programming is what got me started.

Today, we're all surrounded by programmable computers, but in some ways it is more difficult than it has ever been to get into programming. Everything seems so complicated. There are so many programming languages to choose from, so many development tools to choose from, and such a wide variety of books, tutorials, and other information available on the Web that it can be overwhelming to someone who wants to get started.

This is an attempt to provide a modern analogue to BASIC Computer Games. Here, I present a set of simple JavaScript programs that run in a web browser. It is my hope that people interested in programming can study them, modify them, and then move on to more complicated applications.

All you'll need is a modern web browser, a text editor, and some time.

Simple JavaScript Examples

This book is a collection of simple JavaScript programs that run in a web browser. It is intended for people who want to learn about web programming.

This book is still under development.

Are Web Apps the new BASIC?

I often wonder how kids today get into programming. When I was a kid, and got my first computer, I spent a lot of time typing in the programs from David Ahl's BASIC Computer Games. After typing in the code for the games and playing them a bit, I'd start changing them. Eventually, I got into 6502 assembly language and higher-level programming languages, but that early exposure to a bunch of simple BASIC programs is what got me started as a coder.

Today, kids are surrounded by programmable computers, but few of them learn how to write code. Most kids are no more interested in programming a computer than they would be in rebuilding a car's engine. I don't see a lot of simple projects like those in Ahl's book that they can play with and start hacking on. How does a kid get started?

There are programming environments that are intended to teach kids programming (Scratch, Alice, etc.). But use of those is not widespread, and I question their usefulness. All the good programmers I know started with something primitive, like BASIC, Fortran, Perl, or command.com. I wonder if somebody can really learn how computers work by working with fancy 3D "authoring environments" like Alice and Squeak.

It's occurred to me that web applications might be one way to get into programming. Web browsers are as ubiquitous as BASIC was in the 80's. It's relatively easy for a kid to set up a web site with Drupal or some other off-the-shelf CMS, and then start customizing it. All they need is Notepad and an Internet connection. They learn a little CSS here, a little JavaScript there, and pretty soon they'd rather be coding than playing games.

Is there a web-app equivalent to BASIC Computer Games? If not, there should be.

Playing Catch-Up

Early in my career, I prided myself on my ability to absorb a lot of information and stay up-to-date on programming tools and techniques. I learned C++ before any of my colleagues did, and knew more about its intricacies than they did. I implemented ActiveX control containers before most people knew what "ActiveX" or "COM" was. I dug into CORBA. I played around with Java 1.0.

In short, I liked being an expert on new stuff. I enjoyed being on the bleeding edge. I liked being able to answer everyone's questions.

However, now I find myself on the other side of things. I'm bringing myself up to speed on some relatively "old" stuff: Java, JavaScript, and Cascading Style Sheets (CSS). It sometimes feels like I'm the only person who doesn't already know this stuff, and I'm not comfortable being the newbie.

There are benefits to jumping on the bandwagon late. For example, JavaScript actually works now, and most people have browsers with decent implementations of DOM and CSS. A lot of that J2EE silliness has quietly faded away. I can take advantage of lots of libraries written by experienced people, and there are plenty of people who can answer my questions.

Still, I'm nagged by the feeling that I'm behind, and won't ever be able to be one of the foremost experts or significant contributors to the communities. Maybe someday I'll be mature enough to accept that, but I'm not there yet.

Are Web Developers Real Programmers?

The native-vs.-webapp hubbub from a couple of weeks ago got me thinking about why "web developers" are looked down upon by "real programmers."

Quick-and-Dirty Guide to QUnit

I'm playing around with JavaScript in my spare time, and have started creating a web app. As I usually do, particularly when learning something new, I am using a test-driven development approach. I looked at a few JavaScript unit-testing frameworks, and decided to go with QUnit, the testing framework used by the jQuery project.

QUnit isn't too hard to set up or use, but my unfamiliarity with JavaScript, jQuery, and related things meant it took a little more work than it should have. A few out-of-date QUnit tutorials on the web made things worse. So, here is a quick-and-dirty QUnit tutorial that might be helpful for others who are the same boat that I was in.

Stack Overflow Careers

Finding a good job, or finding good employees, has always sucked. The guys at Stack Overflow are trying to make it suck a little less with their new service: Stack Overflow Careers.

What differentiates Stack Overflow Careers from all the other job-board web sites is that candidates' CV's are linked to their Stack Overflow accounts, so an employer can get a feel for how smart a person is by checking their SO reputation and reading their questions and answers. They are also trying to avoid a lot of the annoyances that plague other job-search sites. It is also hoped that the association with Stack Overflow will attract the best candidates and employers.

I've set up my CV: http://careers.stackoverflow.com/kristopherjohnson. The process was pretty easy.

It costs $29 to enter your CV into the employee-search database, and employers have to pay a pretty steep price to search it. I think that's a good thing; it keeps things serious. (Note: You can create a public CV for free, but it won't show up in employer's searches.)

I'm not actively looking for a job, but if anyone wants to pay me huge gobs of money to play with cool stuf, I'm definitely available.

Not Quite NaNoWriMo Review

Last month, I committed to do a lot of writing. Let's see how I did.

I was going to write one blog entry per day. I actually did 22 entries during the 30-day month of November. Not 100%, but not too bad.

My other commitment was to get a new iPhone app into the App Store. That didn't work out. I did work on an app, but as it progressed, I came to the conclusion that it wasn't worth finishing. So instead of spending that time working on an app nobody would use, I spent time learning about JavaScript.

So, I didn't really meet either commitment, but I'm OK with that. I don't mind letting myself down.