Here’s a little something I give to my online Ruby and Python students every year.
A human generation is 33 years, a dog’s 7, a mayfly’s 24 hours. I figure that a netizen generation is about 3 years. I mean, every three years or so, a new generation of clueless users crashes into the china shop and starts smashing things up.
It goes like this. Some newbies get hooked on the web, they get a blog/website and they start foraging for content to put on their blogs, which usually means copying other bloggers’ images, jokes, and downloads. The easiest way to add content, it turns out, is to borrow other people’s stuff. The Web is a cornucopia of free stuff, to which it’s easy to apply the old Hippie mantra, “Hey, let’s share your stuff.”
I’m not saying that all newbies are malicious. I’m just saying they they’re clueless about web etiquette. Instead of saying, “Hey, go visit so-and-so’s blog and download that cool thing”, they’ll say, “Check out this awesome download”, and put up a link to your resource.
If that link leads to a 12MB zipfile, they’re giving away 12MB of your bandwidth while they borrow your content to build their site. This shabby practice has been around since the beginning of the Web. Fortunately, there’s a solution for it: our old friend, the .htaccess file.
If you want to stop hotlinkers/poachers, put something like this in directories that hold your precious resources.
# Turn on the rewrite engine (to rewrite the URL)
RewriteEngine On
# If the referring site is not YOURDOMAIN
RewriteCond %{HTTP_REFERER} !^http://(.+\.)?yourdomain\.com/ [NC]
# Or the refering domain is missing
RewriteCond %{HTTP_REFERER} !^$
# redirect the request to the hotlinking is not cool
# image ON ANOTHER SERVER. Thisis a must
# to avoid a "too many redirects" error.
RewriteRule .*\.(jpe?g|gif|bmp|png|zip|pdf|mp4a|mov)$ http://yourdomain.com/images/hotli
nkingisnotcool.jpg [L]
If you’re at a loss to create your own custom image, check out these rude examples. Oh, and don’t hotlink to them!
Kids say the darndest things. I’m talking about 25-year old guys who end up in my PHP class. One student—I’ll call him Werner—was having a hard time understanding the concept of True and False.
“So, tell me what programming languages you know,” I said.
“None,” he said. “But it’s not a problem. I can learn anything.”
“How’s that?” I asked.
“I have a special knack for learning. I can just absorb knowledge. I can walk into a room where people are speaking a foreign language and an hour later I can carry on a fluent conversation.”
“That’s a gift,” I said. “What languages have you learned?”
“Farsi, Greek, Mandarin, German, and Italian, all in one summer when I was traveling through Europe.”
“Say something in Mandarin,” I said. I happen to know a little Mandarin.
“Oh, that’s not necessary,” Werner said. “It’s something I can do in the moment, when I’m in the flow of the conversation. But I’m having trouble with this PHP. It’s not coming to me yet and it’s bothering me. Really, I should be on top of it. I have so many great ideas for making money, if this PHP would cooperate. Maybe it’s something you’re not doing.”
“I don’t get it.”
“I learn by osmosis, like I said. If I’m in the room with you, I’ll absorb everything in your head. My roommate works at Yahoo and he’s always hacking on PHP at home. That’s how I learned PHP, by being there when he’s hacking. I think you must be blocking the osmosis.”
“Got it,” I said.
He dropped the course after a month of waiting for the osmosis to kick in. I saw him a couple of years later. He was taking an intro Java course.
“I figured out that it wasn’t you. Osmosis doesn’t work for programming languages,” he said. “So I’m doing it the easy way, just taking courses. Anyone could do it.”
The future has arrived and I can’t ignore it—I’m going to add schema-less databases (MongoDB and Redis) into my PHP, Ruby, and my soon-to-be Python courses. I ran a few tests last week and I’ve got to admit that I was totally impressed. Mongodb was especially interesting. I’ll be showing my intermediate PHP students MongoDB next week.
I admit that when I saw these “No SQL” dbs several years ago, I turned up my know-nothing nose and hoped they would just go away. Oh, how the times do change.
This a great color scheme—light and dark versions, both readable and easy on the eyes, available for Vim, Emacs, gnome-terminal, Terminal.app and lots more.
The gnome-terminal version is tricky to install, since gnome-terminal lacks a decent configuration gui. Check this link for accurate instructions. Terminal.app is a little tricky, too tricky for Mac hipsters, so I suggest that they should pass on this one—if Steve wanted you to have Solarized, he would have included it in OS X.
On second thought, I’d rather keep this color scheme all to myself. It’s so sweet that I’d hate to see everyone else using it. Oh well, it’s too late. I’ve already pushed the “Publish” button.