Thursday, December 13, 2007

Ethical Roads

Ethics don't exist without opposition. Luckily, the world is full of opposition. People can either hold to their ethics or give in.

If they hold to their ethics, they should be prepared to fight, be unpopular, and feel like a loser. Bosses don't like to be told, "No." Friends don't enjoy being corrected. Of course, this won't always happen to the ethical, but they should be prepared for it, as it's likely.

If people give in and take the easy road when an ethical roadblock appears, their ethics will change. Ethics that aren't held are not ethics at all. Stated differently, when people give in to something against their personal code of ethics, that code of ethics is decreased.

Choose the hard or easy road, and be prepared for the consequences.

Tuesday, December 11, 2007

Go Forth

Forth is an interesting little programming language. First of all, it's stack based, so to do 4 + 5, you would actually need to type 4 5 +. Next, it's a compile-as-you-go language. Defining new "words" for your program is literally extending the compiler. And finally, its grammar is nothing more than a string of defined words.

Forth is used for embedded systems (in fact, according to forth.com, it's used today), and has been used in the past for arcade games.

Tuesday, November 13, 2007

PHP CGI Weirdity

I don't know why anyone would ever want to programmatically call the CGI version of PHP, but there's a slight weirdness you'll have to deal with. If you call it with just the normal CGI environment variables, PHP will complain that it was compiled with "--enable-force-cgi-redirect," and that it needs some extra stuff.

Here's that stuff:
1. REDIRECT_STATUS. I just set this to 200, and it seemed to work. Pretty sure that refers to the HTTP status, but I really haven't researched it at all.
2. PATH_TRANSLATED. This is just the location on disk of the php script to run.

Setting these two seemed to work, but (just for kicks) I also set REDIRECT_URL = SCRIPT_URL = REDIRECT_SCRIPT_URL = the URL (minus the server name, ie "/dir/script.php".)

Monday, November 12, 2007

Fun With PERL

I'm pretty proud of myself right now, because I just used PERL to do something cool. In my 360 class (CS 360 - Internet Programming) we're building a web server, and I keep finding new mistakes of mine to fix. It's going well, but there seems to be some kind of limit in Linux to the number of semaphores I'm allowed to create. So when my program dies a few times (without removing the semaphores it created), it won't create semaphores on restart. Up till now, I've been restarting the computer when this happened.

Did some investigating, and I found out that there's a nice little utility, ipcs, that prints out all the IPC (interprocess communication) stuff - message queues, shared memory, and (of course) semaphores. There's another nice little utility, ipcrm, that removes IPC stuff.

I could go through and remove all my semaphores every time, OR I could use my newfound PERL knowledge to make the computer do it for me. Being a geek, I found the second option way cooler.

Anyway, here's my code. Enjoy! (Note that I don't guarantee it on anything. Also, note that it deletes ALL semaphores under your user. So don't run this if anything else you're running is using semaphores. Finally, use this at your own risk!)


#!/usr/bin/perl

open(IPCS, "ipcs|") || die("Couldn't run ipcs.\n");

$startedSems = 0;
while (<IPCS>){
if ($startedSems){
if ($_ =~ /------ Message Queues --------/){
$startedSems = 0;
}
else{
($currkey, $currid, $usr) = split /\s+/;
if ($currid != "" && $usr eq "yourUserNameHere"){
$cmd = "ipcrm -s " . $currid . "|";
open (IPCRM, $cmd);
while (<IPCRM>){
print;
}
close(IPCRM);
print "Removed sem id=$currid\n";
}
}
}
else{
if ($_ =~ /------ Semaphore Arrays --------/){
$startedSems = 1;
}
}
}
close(IPCS);


Oh yeah, two more things. Change yourUserNameHere to your user name. And last of all, either chmod a+x the file to make it executable, or perl it.

Monday, November 5, 2007

Quit Stealing

Is stealing from thieves different from stealing from honest people? In the words of Futurama's Lrrr, "Yes; but not by enough."

The companies in the recording industry are unabashed crooks. That they steal artists' rights in legal ways is completely irrelevant.

But their status as weasels doesn't excuse those who steal music. Unless it's an act of civil disobedience, stealing music is wrong.

Record company executives: change, or go to Hell. You are thieves.

Musicians: license with Creative Commons. Record companies are obsolete.

Saturday, November 3, 2007

My Search Terms

Thanks to Google Analytics, I know that about half the people who visit my little blog are actually just seeking guitar tabs to the Jonathan Coulton song Code Monkey. Then they promptly leave for the good reason that I don't have any Code Monkey guitar tabs (or any guitar tabs, for that matter).

So to appease the masses, here are some links. Here's Jonathan Coulton's Code Monkey page - just click on the Guitar Tabs tab. Also, there's a link on that page to a pdf with an actual tab. It seems fairly accurate to me. When I get a break from school, (and when I finish my guitar tab xml DTD and XSL) I'll make an attempt at doing one myself. Enjoy.

Tuesday, October 30, 2007

Operation American Freedom

This week, the Associated Press empirically proved that Comcast is actively attacking BitTorrent clients. They are sending data to the BitTorrent client that appears to come from the same computer, which effectively shuts off the connection.

This article points out that this is the same tactic used by the Great Firewall of China to block access to the Western World. This is no coincidence. Comcast (among others) wants the ability to block certain kinds of traffic.

What will an evil corporation do with this power? In a few years, maybe Comcast will decide to launch a new video sharing site. Will they have the ability to block YouTube to promote their own site? I can foresee a new MMORPG debuting from Microsoft. Microsoft will pay Comcast, who will then slow all other online games to a crawl.

Our government needs to protect us from the whims of a greedy corporation.

Sunday, October 21, 2007

Sex Equality in Tech

Tech jobs are filled with mostly men. From the point of view of a sociologist, that's a broken system. From a techie, well, ....I don't really think any of us understand why there aren't more women joining us. What we do is fun! We play with machines all day! This should be as fun for a girl as it is for a boy.

From the outside in, the tech world seems like a boy's club...no girls allowed. So let me extend an invitation to any girls out there who like math, and enjoy solving problems: join us! You'll get paid to use your brain, solve problems, and play with machines! And, of course, you have a strong likelihood of being the best looking person in a group of fellow techies, making you look better by comparison.

Graphics Card Working (Finally)

Linux won't ever be the desktop OS of choice unless it's easy for average users. I'm running Ubuntu Feisty, and it's been a wrestling match to configure it the way I want.

Take my struggle to get my Nvidia GeForce FX 5200 working with it. I did my initial install using the onboard graphics card (no HDMI to VGA converter :P.) When I switched the graphics option in the BIOS to "AUTO" to enable the card, Ubuntu wouldn't boot!

After about 10 hours or so of searching online (and a couple patches less of hair), I finally found this thread on ubuntuforums. I had to do lots of weird configurations to make it work just right.

So now Ubuntu uses my graphics card. So I went to turn on the ultra cool desktop effects...CRAP!!! With the desktop effects enabled, all title bars disappeared! Oh, Ubuntu's telling me that they're experimental. That's disappointing. Oh well...here's hoping it's fixed in the next update. (Gloomy Goldfish?)

Anyway, I'll finally get to my point. With Linux, there's a catch-22: The difficulty of configuring it makes me love using it. I'm extremely pleased with myself that I got it working. And by association, I love Linux even more now. Linux is fun to us geeks because it's not friendly.

But its user-non-friendliness is precisely what will always drive standard users away from it. It can either appeal to tinkering geeks like me, or it can appeal to standard users. It can't be both.

Now come along and prove me wrong, Google OS!

Tuesday, October 16, 2007

Am I Paranoid Enough?

Hackers exist. I know that's painfully obvious, but it just occurred to me. Of course I knew that they were out there, but it hadn't hit home until recently. Now I'm realizing that I'm not nearly paranoid enough.

My passwords are an example. I don't do anything stupid like use dictionary words or proper names, but I do use Firefox's handy password tool, which records my user name and password to each of my favorite sites.

But does Firefox have a backdoor or a bug that a hacker could exploit? I don't know, but it wouldn't be the first time*. (Programmers aren't perfect, even though we're much closer than the rest of the human population) The point is that it's theoretically possible that a FF bug exists which would allow a malicious website access to my user names and corresponding passwords. If I was truly paranoid, I would memorize all passwords, and possibly kill anyone who knows them.

I'm not paranoid enough with websites I've worked on. To be paranoid about a website, there are a lot of things to consider:
  • Security patches to all applications must be installed! This is an ongoing process, since malicious hackers usually hear about security flaws the second they're released.
  • All default passwords need to be changed.
  • Web applications need to be protected against all kinds of attacks.
  • User passwords can not be trusted, since users are stupid.
I'm pretty sure I'm up on all security patches. I'm pretty sure that I've changed the default passwords...at least the ones I know about. I'm pretty sure I've protected web apps against SQL injection, etc. I'm pretty sure I've also protected them against people posing as users.

The problem is that to be a developer, you only need to know how to do things, not how to protect what you do. In fact, most bosses will be happy if you can just program things the way they want. It's up to the developer to learn about security and implement security measures. No one else will do it effectively.

So I'm taking possible threats a little more seriously now, and I've turned the personal paranoia level up from yellow to orange. I'm trying to memorize my passwords and keep security in mind whenever I program anything. I can only hope that this will be enough to keep intruders out of my systems.



* Here are a couple of security flaws found in FF: 1 2. I know, IE is far, far worse, but that's a different post.

Tuesday, October 9, 2007

Doing Something Useful

As a code monkey, it's hard to remember that computer stuff is only valuable when it does something useful. Here's an example: In my internet programming class (CS 360), I've been enjoying playing around with threads, fork(), mutexes, semaphores, and signals. Learning about the underlying topics has been fascinating, and programming them has been a blast. It's hard to remember that the technology I'm using and building in this project (IP, TCP, Sockets, and HTTP) exists outside of the project. When I'm coding, dealing with networks, configuring a computer, or learning the theory behind all of this, it's easy to forget that it can be used to do something useful.

Thursday, October 4, 2007

Soul Monkey

For those of you who don't know, I took my blog name from a Jonathan Coulton song*. I like his music because it's clever, geeky, catchy, and, most of all, because he doesn't associate with a record company. I respect anyone who can be successful without selling out.

Yes, I just implied that associating with a record company equals selling out. Why? Here's my logic:

A music artist is someone who has respect for their own music as a piece of art. Artists do not let others deface, devalue, or overexpose their art. When an artist's work is exploited, the artist himself is exploited.

To sign with a record company, one must give up certain rights. Any music the artist makes after signing is subject to the record company's whims. The music can suddenly show up on car commercials, as political theme songs, or (worst of all) on MTV.

Why would anyone in their right mind sign with a record company? It's a business decision, which, by definition, is greedy and self-serving. Musicians who sell the rights to their music have sold their souls.

So be an internet star. Keep your soul and make a little less money. Keep the rights to your art!


*A warning: Code Monkey contains some crude language. It's not bad enough to prevent me from referencing it on my blog, but listener beware.

Friday, September 28, 2007

Who's to Blame?

We're a blame-crazy country. When accidents happen, people try to find who's to blame. Lawsuits happen.

The medical industry is a great example. When something goes wrong, people file malpractice lawsuits. This has two effects. First, when you go into a doctor, they are usually to scared of a lawsuit to mess up badly. Second, health care costs are rising, partially because of malpractice insurance.

Clearly, accidents cause a complicated issue. I think individuals can solve most of these problems by being ethical.

The victims in any accident need to ask who they're hurting by suing or otherwise hurting the blamant*. Sometimes it's appropriate. Sometimes it's greed. Sometimes it's revenge. Victims, think about your motivations before taking action.

Most of all, avoid being a blamant! Instead, be a human being. See, humans make mistakes. If you make a mistake, admit it. And most of all, try to avoid making mistakes.

*Blamant is a word I just made up to describe the person or organization being blamed for something.

Tuesday, September 25, 2007

Geriatric Gaming?

My wife stumbled across this article about the Nintendo Wii. To sum it up, they've installed a Wii console in a retirement home, and it's become a popular thing to do.

Contrast this with an experience I had a few weeks ago. I mentioned to someone that I had been playing video games. She responded, "what are you, twelve?" This surprised me, and I told her she was weird, but it reminded me of just how much the Wii has changed the world. I had forgotten that video games were juvenile before the Wii debuted.

How did the Wii change this? Some will say that it's because their marketing is more focused on non-gamers than ever before. Others say its motion-sensing controller is a gimmick that appeals to non-gamers. These things, of course, are part of it, but they are indicative of a spirit of innovation at Nintendo. Their goal is to bring the user into the games by giving her a more natural interface. This naturally appeals to gamers and non-gamers.

Thursday, September 20, 2007

The Magical Internet

Before I learned HTML, JavaScript, PHP, and HTTP, the Internet seemed like a wonderful, magical place. I could find out about a new video game, download the demo, and (two hours later) play it. I could talk to friends. I could look up magic tricks. It was all great and useful.

Then my knowledge grew, and the Internet stopped being a place; it started being a creative outlet. I made a web page and shared it with my friends. With increased knowledge, the Internet was not magical or wonderful - it was just a medium.

Today, the Internet is a place again. It's where I go to connect with friends far away. It's where I go to unwind. It's where I go for spirituality. But it's not just a magical place any more; I now think it's miraculous. Instead of being a mystical, arcane place, it's an infinitely useful source for many things in my life.

As a side note, check out the song Electric Highway on the Innovators album by Kurt Bestor and Sam Cardon. This site has a preview, but it doesn't do it justice. Download the song, listen it and think about how the Internet is a miracle. Enjoy.

Thursday, September 13, 2007

Should I Cut the Cable?

Following my reading for my CS 404 class today, I've been thinking about the information that I absorb. I think there's too much of the junk variety. For example, I spent about 1 hour today watching the Simpsons, another hour playing Super Smash Brothers Melee, and about half an hour looking up Jonathan Coulton videos. I spent a lot more time than this on school and work, but it's still an uncomfortable amount of luxury.

I think I'll try turning off the information flood for an hour every day to see what happens. I have no ideas for what to do in that time, but I know that people in the past have gone their entire lives without TV, video games, or the Internet. I hope that giving my mind a break from these things will give it time to make better use of what's already in there.

But for right now, I have to finish this post so I can go watch Family Guy.

Thursday, September 6, 2007

Hello, World!

Hi everyone! Welcome to my blog. I've been meaning to start a blog for a long time, and now with CS 404 making it a requirement, I finally have an excuse! I hope this will be a fun outlet for any creativity that I might have.

Let me introduce myself. I grew up in New Jersey, thanks to some delicious pizza (and possibly some good parents and leaders.) I love programming, playing guitar and drums, and I enjoy playing video games (though they're not my life). My favorite color's green, my favorite food's pizza (as you may have guessed), and my favorite band is Soundgarden.

I also enjoy making video games. In the past I've made a maze game and a tank game in QBASIC, and a tank adventure game in Visual BASIC. Currently I'm working on a 2-D game engine for Java that I'll use to make some game applets. I'm also thinking about making some XML to represent guitar tabs. If I do this, I'll probably create some small AJAX applets or Java Applets to manipulate and/or play the music from the tabs. This is all the distant future right now; school will be my first priority for a while.

Anyway, hope everyone enjoys my blog!