Archive for the 'Development' Category

Phasing in PostgreSQL

Since I like to avoid the Sun, I’ve started migrating my stuff away from MySQL and into Postgres this weekend. So far, I have a functional PostgreSQL ActiveTable driver and most of my ActiveTable demo app working with it.

Postgres isn’t bad. It’s a little confusing initially, when you can’t figure out how connecting works (it can auth based on whoami if you just want to connect via a UNIX domain socket, and it supports hashed passwords for connecting over TCP/IP, etc), but once you’re in, it’s easy. I really like phpPgAdmin - I wish phpMyAdmin was this nice.

The major differences I’ve seen between Pg and MySQL are

  • No auto_increment. Instead, there’s a SERIAL type you can use that creates a sequence for you automagically.
  • Timestamp doesn’t accept 0000-00-00 00:00:00 as a valid value.
  • Postgres doesn’t let you specify an empty string in an integer column.
  • Instead of enum, we have a CHECK() that takes in any expression. Enums are CHECK(column IN (’A',’B')).

It has some pretty ridiculous features, like arrays and polygon datatypes, too.

The only problem I’ve had thusfar is that my sequences got all fucked up when I imported my data. I specified the value for my PK columns, but the sequences stayed at 1. Easy enough to fix, though. I wrote a little script to clean things up in no time.

Finally, Web2.0 produces something useful!

I’m not a fan of all of the stupid web 2.0 trends. Ugly designs with rounded-corners and gradients everywhere, useful links to site news being hidden away in the footer, YouTube videos and obnoxious screencasts coming at you from every which-way, and stupid business models…I hate them all. It’s like the original .com bubble, just a thousand times more annoying and in-you-face.

I mean, FogBugz is great and all, but there’s no way in hell I’d ever pay $25 a month for a single user on a bugtracker. Sorry, Joel, your blog is great, your application is even greater, but it’s not worth that kind of recurring cost. $25/m for five users, sure, OK. But for one? Are you kidding me?

But.

I’ve finally seen something useful come out of this web2.0 craze. Something with a simple, quiet (for web2.0 standards) UI, a good pricing model, and an absolutely to-die-for service. Enter: GitHub.

Github is Git repository hosting plus a web frontend. It’s just gone into its public testing phase, so it’s nowhere near perfect yet - for example gitweb is still a much better way to view revision history, since it supports all kinds of crazy diffing, but I expect to see that in GitHub sooner or later.

Fast, free Git repository hosting you can manage through a web UI. No backups to worry about, no making accounts and copying keys around - if you want to give someone write access to your repository, you just add them as a contributor.

If you want to work on some code for someone else’s project, there’s a ‘Fork’ button you can press. It clones the repository to your account. When you finish, you can send the original owner (or anyone else, for that matter) a ping and let them know you have some code they might want to pull in. It’s nice.

There are RSS feeds everywhere (this is web2.0, after all). If you look to the right, you’ll notice I’m pulling in some messages from my GitHub RSS feed right onto the owlmanatt.com sidebar. The messages kind of suck. I wanted the commit notes, but that isn’t really practical (they can be long), so I just threw the feed into Yahoo Pipes (ugh, I’m hitting the web2.0 bong pretty hard today) and munged the titles/filters around a bit until I was happy.

In other news, I’ve changed the OwlManAtt.com theme. It’s been a few years, so…why not?

Lunarwars Source

I will be adding a file I wrote to this list every day, starting with the least significant and ending with the most significant files. I’ll start with two today.

Note that these files are copyright Nicholas Evans, 2007. License is given to download, copy, and modify these files for personal, non-commercial use.

  • warnings.inc.php - The abstraction layer between the DB and the warning GUI.
  • improvements.inc.php - The abstraction layer between the DB and the improvement/upgrade GUI. This contains a very nice recursive function.
  • Soldier Casualty Formulae - In hounour of the war system opening back up tomorrow, a write-up about how soldier losses are calculated.

Lunarwars Cease and Desist Notice

In the interest of full disclosure to the community I worked so hard for, I am publishing this cease and desist notice. I sent this notice to Sandro only minutes ago. Anonymous simply cannot forgive; it is not in our nature.

Received: by 10.100.137.19 with HTTP; Thu, 24 May 2007 13:15:04 -0700 (PDT)
Message-ID:
Date: Thu, 24 May 2007 16:15:04 -0400
From: “Nicholas Evans”
To: lunarwars@gmail.com, “Sandro Bassi”
Subject: Cease & Desist
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Delivered-To: owlmanatt@gmail.com

Sandro Bassi,

I am writing to you today to request that you immediately cease and
desist use of any and all copyrighted code I have written for
lunarwars.net over the past several months. Because I no longer have a
vested interest in the project and because you have stated your
intention to continue generating revenue from lunarwars.net, I do not
feel it prudent that my intellectual property be used to your personal
benefit any longer.

Since no prior agreement to transfer the copyright of the code
declared below, I hold the copyright to my works. Any implied
agreement to use, redistribute, copy, or modify my work is henceforth
revoked effective as of May 24th, 2007.

From my final backup of the site (from May 19, 2007), I have
identified the following code as being infringing. Note that in many
cases I cite entire files; these were either my original works or
completely rewritten from scratch (to accommodate the new war system,
mainly) by me. Where the entire file was not written by me, I have
identified significant portions by line number and only request that
those sections be removed.

== BEGIN FILE LIST ==
public_html/wars.php
public_html/warn.php
public_html/wars/action/attack/air.php
public_html/wars/action/attack/ground.php
public_html/wars/action/attack/missile.php
public_html/wars/action/other/invite.php
public_html/wars/initiate.php lines: 89-189
public_html/wars/manage_wars.php
public_html/wars/npc_ai.php
public_html/wars/npc_details.php
public_html/wars/npc.inc.php
public_html/wars/peace_check.php
public_html/wars/peace.php
public_html/wars/war_action_engine.inc.php
public_html/wars/war.inc.php
public_html/wars/!get_data.php
public_html/profile.php lines 412-493, 163-180
public_html/config.inc lines 11-44
public_html/administration/npc_manager.php
public_html/improvements/improvements.inc.php
public_html/improvements/purchase_improvements.php
public_html/scripts/formula.inc.php
public_html/scripts/manage_colony.php lines 426-456
== END FILE LIST ==

In order to respect your intellectual property rights, I have deleted
any files from my backup that are not in the above list. I know many
of the files are Fusion files, but they have been heavily modified by
both you and I. I have no use for these files, so they have been
deleted in order to avoid an awkward situation.

Furthermore, I request that any database tables I have designed
completely by my self be removed; these likewise are my intellectual
property. I no longer have a copy of the database, but as I recall,
the following tables were wholly designed by me:

== BEGIN TABLE LIST ==
fusion_improvements
fusion_improvement_type
fusion_war_participant
fusin_war_event
fusion_war_event_type
fusion_npc_colony
fusion_npc_colony_template
== END TABLE LIST ==

I would ask that you confirm your compliance within 48 hours. If not,
I will escalate the issue to abuse@hostmysite.com and follow up with a
letter to their designated agent in charge of DMCA compliance, as per
their Acceptable Use Policy (), section
‘Copyright Infringement.’.

I hereby state that, under penalty of purgery, the statements
contained in this notice are, to the best of my knowledge, true and
accurate.

I would like to thank you for your anticipated cooperation and am
sorry that it had to come to this.

Sincerely,
Nicholas ‘OwlManAtt’ Evans
Former LW Developer

The state of Linux package managemen sucks.

So here I am, wanting to set up a demo of something I’m working on for the public internets. I figure that since I have this big Cisco IPTV machine which will eventually replace Eron sitting here, I should go ahead and set my demo up on that.

And that is where my woes begin. Desu is running Debian and the project I’m working on is with Rails. Debian uses Apt for package management; Ruby uses Gems. Desu has *only* had Subversion, Apache2, and some webDAV module for Apache installed on it. No MySQL, no Ruby, no Gems, and certainly no ImageMagick.

I spend a few minutes installing Ruby. That’s a big ol’ apt-get install ruby irb rdoc ri because, you know, making a ruby-developers metapackage with the whole kit and kaboodle would be too much to ask from the Ubuntu folks. Instead, they just confuse the living shit out of mister Wow-web-2.0-is-cool-let-me-try-this-Ruby-stuff-out! because he’ll only type apt-get install ruby and then have no idea why IRB is not starting.

Then I go ahead and grab the latest version of Gems from RubyForge. I have no idea if there’s a package for this in the Ubuntu repositories, but I won’t bother with it, especially since Desu has Dapper on it. Since Gems can update itself, that’s not too big of a deal — or is it? Why should I need to install anything from a tarball?

But then, I go on to install my gems.

nevans@desu:~$ sudo gem install -y mysql rmagick rails mongrel

This fails spectacularly. I was missing a Ruby -dev package that I needed. I reran the command; it bombed out again. I tried installing a few MySQL packages until it worked. Then I installed the ImageMagick libraries (and the -dev!) to head off the next failure.

And then it struck me; why the hell do I need to worry about dependencies? I thought package managers were supposed to worry about those for me since it’s like, a computer and I’m a human being whose time is valuable.

Because Apt and Gems are two different package managers, of course! So, guys, where’s my meta-get install gems:rmagick gems:mysql gems:rails gems:mongrel?

Next Page »