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.
Thursday, December 13, 2007
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.
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".)
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!)
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.
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.
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.
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.
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.
Subscribe to:
Posts (Atom)