March 30th, 2007 Luke
Well, the month of March has been interesting.
I finished Path. There are a few tweaks I’m considering making to it, but I’m mostly happy with it.
I’ve started another project, named “Militarism” for the moment. Probably forever. It’s a slightly modified take on the traditional linkgame. I’ll write about it soon.
I managed to find dnScoop, which will let me evaluate how much my domain is worth. Right now girasquid.com is worth $121. I’m going to try to make it a goal to increase that amount each month.
I also brought in a substantially larger number of unique hits this month than January or February. In January I got 56 hits, and in February I got 50. These are…small numbers. So far, for the month of March, I’ve received 201 hits. That’s not quite hitting my target of 212(february + january doubled), but it’s very very close. I want to try and get my number of hits snowballing too; I have little doubt that if I can just work on updating more often and finishing more projects that I can put up and have people using, I will. Once Militarism is finished that number of hits should spike, at least for a little while.
March 31st Update: I have managed to achieve a grand total of 227 hits over the month of March, with an average of 16 hits/day. Let’s see if I can beat that during April.
I signed up for Google Adsense. So far I’ve made all of $0.23. But it’s something. Maybe one day girasquid.com will pay for itself. That would be sweet.
I also discovered a really neat community for startups called StartUpping.com. I’ve just been lurking around their forums, and I’ve picked up on a lot of neat tips and ideas from them.
StartUpping also led me to another service, called MyMindShare. It’s a really neat take on paid advertising and how we as consumers/customers interact with it. Right now I’ve got an ad up on there, as I’m frantically trying to hit those 212 hits in my last day and a half or so before the month is over.
I’m considering setting up Project Wonderful ads on one of my projects too. I’m just not quite sure where yet, or which project it would be viable on.
I’ve gotten a lot of sketching done on Parakeet 2.0. I know almost exactly what I want to do with it and how I want to change it, and hopefully once Militarism is finished and I figure out if I’m going to finish Bear or not, I’ll start on it. It will be a lot easier than building 1.0 was, because I’ll A) know what I’m doing, and B) actually be following standards. Also, there will be a few sweet new features that will hopefully help me get my foot in the door on it. Bear’s on hold indefinitely now.
That’s been my month of March. How was yours?
Posted in monthinreview, postmortem, site | No Comments »
March 26th, 2007 Luke
Has anyone other than me noticed the exceedingly bad grammar in some online games? Instead of saying “You have 2 swords” when you have 2 swords, you get a message like “You have 2 sword”. It’s a disturbing thing to have happen to you.
Recently, while working on Militarism(new project - I’ll talk about it later), I realized that that’s what would happen when a user viewed their units. I had the unit names in the units table, but at the moment it was just their singular name, and…they weren’t grammatically unique in terms of how you would transform them to make them plural. I couldn’t just add an ’s’ to the end. That might work for the Legionnaire unit, but what about the Phalanx?
So, I settled on this solution. Here’s the table setup:CREATE TABLE units (
id int not null auto_increment,
name text,
plural_name text,
PRIMARY KEY(id)
);
And here’s the Perl code that I used:
# we already executed and bound $sth with $unitID and $unitCount
my $singleName = $dbh->prepare("SELECT name FROM units WHERE id = ?");
my $pluralName = $dbh->prepare("SELECT plural_name FROM units WHERE id = ?");
while($sth->fetch) {
if($unitCount > 1) {
$pluralName->execute($unitID);
$pluralName->bind_columns(\$unitName);
$pluralName->fetch;
} else {
$singleName->execute($unitID);
$singleName->bind_columns(\$unitName);
$singleName->fetch;
}
}
Basically, all we have to do is prepare two statements instead of one, and then check how many units of a specific type a user has. If they have more than 1, we’re going to retrieve the units.plural_name attribute. Otherwise, we’ll just retrieve units.name and use that. This makes it so that if a word needs to be transformed in some special way for plurals, it’s possible. Things like pikeman -> pikemen work just great.
Posted in SQL, perl | No Comments »
March 25th, 2007 Luke
One of those “Big Things”™ that most web applications do(or want to do) lately is have clean URLs. That means instead of going to site.com/cat.cgi?org=2;jot=6 or something, you’d go to site.com/cat/org/2/jot/6 or something. This is all accomplished with some .htaccess magic, that looks something like this(for this example):
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^cat/(.+)/(.+)/(.+)/(.+)$ cat.cgi?$1=$2;$3=$4 [NC,L]
It took me a while, but I managed to get clean URL’s working for Path, too. Now if you want to play Path, whether you have an account or not, you can go to http://girasquid.com/path/play and, well, play.
However, there is a caveat here. Having a form with an action that’s actually a clean URL does…interesting things. In my case at least, it breaks and the POST data never gets sent to where it’s supposed to. After some googling, I seem to be the only one having this problem. Which probably means it’s just something I mistweaked somewhere. Here’s how I fixed my .htaccess to get it working, though:
ForceType cgi-script
After writing that piece of code, I just stripped the extension of .cgi off of the Perl scripts that would have data getting POST’d to them, and got rid of any RewriteRules that applied to things like girasquid.com/path/login or something. That solved the whole problem.
Posted in Project, perl | No Comments »
March 23rd, 2007 Luke
Well, after a few weeks of work, Path is finished. You can check it out at http://girasquid.com/path.
Path turned out okay, and I did what I wanted to do with it. I also learned some stuff, which was what I was going for. Here are some of the things I learned:
Google Adsense’s Setup is Neat
I just turned 18, and one of the first things I did after turning 18 was to sign up for Google Adsense. It has a really cool
box set-up process, that let me customize my styles all I wanted. That’s how I got boxes that matched the color scheme of this blog
, and that matched the color scheme of Path. Very neat process.
MySQL is a lot more powerful than you think
MySQL can do a lot more than I thought it could before I started working on Path. Here’s an example of some queries I learned about:
-
SELECT (SELECT COUNT(*) FROM user_answered WHERE user = ?) = (SELECT COUNT(*) FROM questions)
-
That snippet returns either a 1 or a 0. This lets me figure out if a user has answered all of the questions or not.
-
SELECT id FROM questions WHERE id NOT IN (SELECT question FROM user_answered) ORDER BY RAND() LIMIT 1;
This snippet lets me select a random question that a user hasn’t answered, without having to perform multiple queries or loop through all of my data to do it.
-
DELETE FROM unique_hits WHERE ipaddress LIKE '66.249.72%'
Did you know MySQL could do basic pattern-matching? I didn’t. The DELETE statement above lets me remove all of the Google Crawler’s IP addresses from our table of unique hits.(66.249.72.*)
I don’t have regex-fu
While working on Path’s profile storage, I was looking for a way to allow users to embed stylesheets and HTML code, without jeopardizing my security by allowing them to embed <script> tags. I ended up settling on using a CPAN module called HTML::EscapeEvil, but not before I tried to build a custom regex to strip out <script> tags and failed miserably. I really need to work on learning and understanding regular expressions better.
I’m not comfortable with complex data structures
The way I designed Path, it’s 100% possible to have a question with 8 million answers, and 5 correct ones. The system can expand to that point. In order to make it easier for me to build the question-adding and answering systems, most of the data I retrieve from the database is stored in a complex data structure(namely, an Array of Hashes). This worked, and I managed to hack out code that would let me use it, but…I don’t feel quite comfortable using structures like that yet.
In the end though, I’m happy with Path. I’m pretty sure there aren’t any features I’ve missed, and I’ve learned a lot. Bring on the projects!
Posted in Path, Project, postmortem | No Comments »
March 19th, 2007 Luke
Recently, I bought the game Virtual Villagers(Chapter 1). It’s a great little casual game, and sometimes I need to distract myself from other things I’m working on. Virtual Villagers is great for doing that.
There are two computers here. Primarily, I use my eMac, but we recently acquired a Vista computer also. There are two separate versions of Virtual Villagers, one for PCs and one for Macs. I noticed this, but I still bought the PC version for $19.95. It’s a neat game.
I installed it on Vista, activated it, and set to playing. And it was sweet. So I said to myself “hey, this game is sweet. I should put it on both computers”. This, in theory, was a good idea. However, upon installing it on the eMac, I tried to run it only to find that my “registration key was invalid”. With a sinking feeling, I realized that they probably had two separate licensing systems; I would have to buy two copies of the game so that I could play it on both operating systems.
Initially, I was angry. I was strongly tempted to pirate it for the Mac; I’d already bought one copy, why should I need another just to play it on a second computer?! However, cooler heads prevailed and I ended up sending an e-mail to their support line. The e-mail read:
I am on a Mac computer, and when attempting to input my registration code the program told me that “The registration code is not valid.”
I expected a reply something along the lines of “we have your money, you have a copy, go buy another one”. But, to my surprise, today I received an e-mail that went like this:
Hello,
I will make an exception for you and give you a code for your other computer.
I need to make sure you are referring to Virtual Villagers: A New Home
(Chapter 1).
I also need to know which one you bought.
Encouraged by this response, I quickly sent back my information, and profusely thanked the sender. Maybe fifteen minutes later, I was e-mailed a link to a .zip file that would allow me to download the Mac version of the game, fully activated and ready to go, free of charge.
This heart-warming story does have a moral. And that moral is: customer service matters. Before I e-mailed support, I thought that I would need to buy another copy to play the game on my Mac. I was a bit angry, and everyone I talked to lately has heard me ranting about this. However, they responded to my issue and did their best to make good on the problem; they’re eating at least $19.95 on the sale of another registration key, just to get in my good graces. Which they did. Now, you could say I’m an evangelist. I’ve been raving about their game even more than I did after I played their demo, and I don’t plan on stopping anytime soon. Great customer service is hard to find these days, and these guys definetly stepped up to the plate.
So if you’re ever looking for a great casual game to play, check out Virtual Villagers. I can vouch for both the game and the company that made it being awesome. And Carla Humphrey, if you ever read this…thank you.
Posted in life | No Comments »