Archive for October, 2008

A rant on the W3C/Tidy HTML

I really need to vent this:

Back in the day, when I learned HTML, I was taught that “Hello World!” was nothing more than:

<HTML>

<HEAD>

<TITLE>Hello World!</TITLE>

</HEAD>

<BODY>

Hello World!

</BODY>

</HTML>

So when I made my extremely simple Python page, I just did that. I obviously had to throw in some <a href=”http://whatever”></a>’s and some <em>’s (I actually thought I was being a good boy, using <em> instead of <i>) but it’s really a simple webpage.

So just for fun, I decided to run it through the W3C validator.

And it coughed up some errors. I have now looked through most of them, and all of them (with the exception of the DOCTYPE one) seem extremely arbitrary. And I would NOT like to use a stylesheet, I’ll get by just fine with my <FONT size=”4″>, thank you very much.

Now I’m sure that the W3C has legitimate reasons for these standards, but I just get the impression that they create new standards out of boredom, not necessity. Less is more and if it ain’t broke–don’t fix it for crying out loud!

I can hear your brilliant counterargument unfolding. “Timmy,” you say, “why don’t you just shut up and use Tidy HTML Generator? W3C had the good grace to include it, lest people greater than you are confused by their cryptic error generation.” to which I reply, “Take a  look at what Tidy suggested”

WHAT IS UP WITH THAT!?!

OK.

</rant>

I can breathe now.

Seriously though–why?

Share/Save/Bookmark

Comments (1)

Playing Python, Programming Pianos

New programmers are never sure what it “takes” to learn a programming language. This is not helped by the quantity of “Learn x language in 24 hours/3 days/etc.!” books that are out there, and by the overabundance of technical information available.

So what I propose is an analogy.

You might think that the analogy I would make would compare learning a programming language to learning a foreign language (e. g. Spanish.) But after much deliberation, I don’t think that’s a valid for several reasons:

  • Foreign languages are almost always more complex than programming languages. Something like French has evolved for the past two millenia, while even ‘old’ programming languages have only been around for 50 years. Furthermore, French has the task of concisely communicating any conceivable expression to another human, while C/Java/Delphi only has to boss around some chunks of metal and silicon.
  • You must memorize every aspect of a foreign language, while with programming languages you have the all-powerful documentation to help you with some of the less common things.
  • Even if you know that “Hello” is the most common greeting in English, you’ll sound dumb if you don’t use “Hi”, “Hey”, and “What’s up?” in the right circumstances. Meanwhile, BASIC will always think “10 PRINT “HELLO, WORLD!” is the best way of doing things.
  • Similar to the first one, foreign languages have a MUCH bigger vocabulary to learn than programming languages.

So I really don’t think it’s a valid comparison.

What I consider more vaild is comparing programming languages to musical instruments. First, let’s think about a story about little Billy.

Little Billy decided one morning that, since he really like music, he wanted to learn to play a musical instrument, so he could make his own music. He went to the music store, and was initially awed by the sheer quantity of different types of instruments for sale. After much inner turmoil, he decided to use the piano, since it was common, rationalizing his choice by thinking, “Since so many people use it, it must be one of the best choices. There’ll also be more people who can help me. Finally, it sounds good.” While he was in the music store, he also picked up a tutorial on learning how to play the piano.

He went home, and did a chapter of the book per day, being sure to actually play the piano as much as possible. By the time he finished working through the book, he was a decent piano player, but still had a lot to learn. He kept playing, hired a teacher, and within a few years he was downright adept.

Now consider little Billy’s brother–Tom.

Tom decided one morning that, since he really like computers, he wanted to learn to program, so he could make his own programs. He went online, and was initially awed by the sheer quantity of different types of programming languages available. After much inner turmoil, he decided to use Python, since it was common, rationalizing his choice by thinking, “Since so many people use it, it must be one of the best choices. There’ll also be more people who can help me. Finally, the syntax looks good.” While he was online, he also picked up a tutorial on programming in Python.

He went home, and did a chapter of the tutorial per day, being sure to actually do the programs as much as possible. By the time he finished working through the tutorial, he was a decent programmer, but still had a lot to learn. He kept programming, started working on projects so he could learn from the project chief, and within a few years he was downright adept.

Now that you know where I’m going with this, I can fill in some details:

They both give you ‘instant success.’ Anybody, and I mean anybody, can either make his computer say “Hello World!”, or play a few notes on an instrument within ten minutes.

They both have specific technique. Java programmers know that using a variable without declaring it first is a big no-no. Trumpet players will fail if they just move their fingers–and don’t blow.  Another way of saying this is that they both teach through failure–be it a bad sound or a segfault.

They both provide gratification. People get really excited when they play a tune well, or solve a particularly sticky programming problem.

If you do something again, you’ll do it better When an elementary school band plays “The Star-Spangled Banner”, it is very apparent that it’s not the New York Philharmonic playing “The Star-Spanled Banner.” A first-year programmer will use a very different method for solving a problem when compared to an old-hand.

So if you’ve ever learned how to play an instrument, you’re primed for programming. And if you’ve ever programmed, you know what it takes to play an instrument.

——-

I’m kind of interested in the reception this is going to get–please let me know what you think!

Share/Save/Bookmark

Comments (1)

FTP managers

I updated my post on FTP managers to include gFTP.

In case you were wondering, it seemed a lot better to maintain one post about FTP managers and update it as necessary, rather than tacking on supplemental information as I produced it :)

Share/Save/Bookmark

Leave a Comment

Handy tip #1: [Aptitude]

First of all, I’m sorry I haven’t posted for a while–school went ‘banoonoos’ (as Joss Whedon would say), and any remaining time went to FSM.

Second of all, I’m contemplating starting a new ‘syle’ of post–handy tips. They’re meant to be concise bits of usefulness. Yes, yes, yes, this one isn’t very concise, but I consider it an extenuating circumstance :) They should have two parts–the [Background:], for…um…background information, and then another part which is the real tip.

That was way too long-winded. Sorry.

At any rate, here’s the real post:

[Background:]

A lot of people use the command line to install packages. Add/Remove is incomplete, Synaptic is slow, and the command-line is awesome.

I find myself using Apitude a lot more than apt-get, for the plain and simple reason that it’s a lot easier to make up commands. sudo aptitude install thunderbird works, sudo apt-get thunderbird doesn’t.

I always kind of got frustrated by the fact that after thinking for a while, I would need to type in ‘Y’ to confirm that I wanted to use disk space. (I suppose I can see the rationale for that feature, but it is annoying)

[Meat:]

To make Aptitude not ask you if you’re OK with the disk space it’s going to use, and the dependencies that have to be installed, use the following command:

sudo aptitude -y install yourprogramname

Where yourprogramname is the name of the program you want to install.


Share/Save/Bookmark

Comments (1)

Really concise explanation of random integers in Python

I wanted to use Python to generate some random integers, and a few minutes of Googling was not very helpful. I figured it out in the end, but I feel like something this basic should be easy.

First you need to import the random module, so:

import random

Then, to get a random integer from 1 to x, use

random.randrange(x)

It’s as easy as that.

(OK, OK, sorry. I know this probably isn’t of general interest, and it’s probably of minimal help, but I was just irritated that it wasn’t really easy to find online.)

Share/Save/Bookmark

Leave a Comment