CrudVision - Lisa Seelye

December 19, 2007

Reve release 39

Filed under: eve online, open source, reve, ruby — Lisa Seelye @ 10:08 pm

Here is Reve release 39. As always it can be found at its homepage, http://www.crudvision.com/reve-ruby-eve-online-api-library/
Download the release with these links. Reve requires the hpricot gem to run.

This release supports the API Version 2 from Eve Online. The RDoc can be found online at http://docs.crudvision.com/reve/ or by running rake doc.

I know the documentation is spartan. I’ll be working on the documentation over the coming week to make it much more informative.

Reve revision 39 (Eve API Version 2 support)

Filed under: api, eve online, reve, ruby, subversion, testing — Lisa Seelye @ 9:00 am

It’s coming. All I have to do is zip the release up and update the RDoc documentation.

This fully supports the API Version 2. Next tasks on Reve include setting up a Trac as well as refactoring a lot of the methods (corporate and personal methods are almost always identical but wrapped in different classes). I also want to add the ability to save and feed the library your own XML.

Look for Reve revision 39 before the 23rd of December.

December 9, 2007

Eve Online Trinity Database dump

Filed under: eve online, postgres, sql — Lisa Seelye @ 3:58 pm

As I’ve done for previous Eve Online database dumps here’s a Postgres (8.1) dump for Trinity. Hosted at http://www.eve-files.com and can be downloaded by clicking on right here

Included in the zip archive is a Schema file as well as each individual table as a .sql file. They’re numbered 001 to 065. 001 is the schema (001_schema.sql) and is intended to be imported first. The others have no real order as there are no foreign key constraints but were numbered for my testing and sanity.

View the dump online

December 8, 2007

Rails has_many gotcha

Filed under: activerecord, crud, rails, ruby, sql, work — Lisa Seelye @ 2:39 pm

With Rails there's a useful set of callback methods that can be used within model classes. They include after_create, before_validation and the one I want to talk about after_initialize.

A lot of cool things can be done with after_initialize, especially if one uses the database as a means to store meta-data about a model. Use the after_initialize method to transform your models with Ruby after they're fethced from the database. Consider the following User model definition:

RUBY:
  1. class User <ActiveRecord::Base
  2.   has_many :memberships, :order => "memberships.group_id, memberships.expires_at desc", :group => "group_id"
  3. end

It's pretty clear that with the :group => "group_id" that I want a unique set of Membership objects. That works well when I've already got a User and do user.memberships but not at all when I do User.find(:first, :include => :memberships); likely because of the way the join is set up and grouping on that may not be possible.

I still wanted to use eager loading so I thought that it would be an OK sacrifice to fetch all the Membership objects even if I wanted to pare it down after I initialize the User object (with eager loading). I defined:

RUBY:
  1. class User <ActiveRecord::Base
  2.  
  3.   def after_initialize
  4.     do stuff with @memberships instance varible
  5.   end
  6. end

Except it doesn't work. Quickly I found the following from active_record/base.rb (click link for source): right where it does the after_initialize callback! But it wasn't working for me. I needed to dig further.

Further research indicated that before the creation of the @memberships instance variable that would hold the collection of Membership objects the after_initialize callback was being fired off in the User model. Using after_initialize would not work due to the design of ActiveRecord. I'm still searching for an elegant way to work the way I want. I'll post again when I find it!

December 7, 2007

She does a little PHP, too

Filed under: eve online, php, postgres, sql — Lisa Seelye @ 10:44 pm

I don't like it but I'll do it. :)

I rewrote my Eve Online Database Viewer. With the recent Trinity Dump (Postgres version coming soon) I wanted to rewrite the PHP script in order to better make use of mod_rewrite and to better handle errors.

December 1, 2007

My First Patch

Filed under: open source, oracle, rails, sql, work — Lisa Seelye @ 10:05 pm

I've submitted my first patch to the Rails trac today to speed up the OracleAdapter#indexes method (used in migrations). A client at work uses Oracle and in the production environment this method was taking upwards of 45 seconds to run per table!One of their DBAs gave me the SQL there, so I can't take the credit, I just submitted it.

I hope it's accepted. Incidentally, it works and has saved me a lot of time with migrations.

Edit: Yeah, turns out that since turning these adapters into gems patches for them shouldn't be done through Rails trac. How irritating, but whatever. I've sent the patch do the current maintainer for review.

Powered by WordPress