CrudVision - Lisa Seelye

August 28, 2008

Playing with Git

Filed under: git, github, open source, reve, ruby, subversion — Lisa Seelye @ 5:05 pm

I’ve begun playing with git over at github by importing Reve’s source.

Eventually I will do away with subversion and trac and move to github for Reve completely. Trac is not very good and often locks up.

As I’m still new with git and github I’ll have to keep contributions to a minimum since I don’t know exactly what I’m doing.

August 14, 2008

Reve is going to MIT (license)

Filed under: api, eve online, open source, reve, ruby — Lisa Seelye @ 8:52 pm

There’s a new revision of Reve that has just been uploaded to Rubyforge: Revision 99.

This includes a major change - Reve is now licensed under a proper license: the MIT License. The terms of the license are now distributed with the package and are.

There is also a fix for the character_id that came back from a market order request.

Why a new license now? Simply because I think it’s important to realise that it’s unlikely that anyone will use Reve to create some billion dollar enterprise that I could have got in on. Yeah, not everyone can be Delicious, Flickr or Facebook. ha ha.

So go forth, ye multitudes and fix, hax, and use. Ruby and Rails both use the MIT license so now Reve should be at home.

July 12, 2008

Reve Supports Eve’s Factional Warfare API

Filed under: eve online, open source, reve, ruby — Lisa Seelye @ 8:04 pm

Here’s a quick announcement to let people know that Reve (0.0.96) now supports Factional Warfare.

The cool new things are:

I know the documentation may not be the best, but I’ll do my best to improve it for the next release.

Grab the new gem (0.0.96) and give it a whirl!

June 10, 2008

New Reve Gem, release 91

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

Just a quick note. There’s a new Reve gem out as of June 7th. This one’s release notes are:

  • Typo fix in Reve::Classes::MapKill - shipJills -> shipKills
  • Resolve trac ticket 3 (lowercase field names in postfields method)
  • Update documentation to make ‘charid’ more consistantly ‘characterid’
  • Resolve trac ticket 2 (Reve does not use @charid, but takes it as an argument in initialize)
  • Be strict about currentTime’s casing.

The code changes can be seen At the Reve Trac.

May 11, 2008

Graphing Hard Disk Temperatures with rrdtool (part 2)

Filed under: gentoo, graphs, monitoring, rrdtool, ruby — Lisa Seelye @ 5:03 pm

Last month I made a post about using rrdtool and ruby to graph hard disk temperatures. I recently had some hardware trouble and something with permissions went crazy. Today I took the time to look into the problem and fix it.

The /dev/hd[egik] device nodes were owned by root:disk and 660. However, the hddtemp binary was trying to do some restricted ioctl operations. Even though the binary was setuid and my non-root user was in the disk group I couldn’t access the disk to get the temperatures.

I found out that there is a hddtemp daemon which can query the disks for my unpriveleged user.

The daemon listens on a TCP port and provides output like this:

|/dev/hde|ST3160811AS|39|C||/dev/hdg|ST3160811AS|40|C||/dev/hdi|ST3160811AS|38|C||/dev/hdk|ST3160815AS|39|C|

Should be easy to modify my disk_temperature.rb to connect to that port and parse the data.

Now my temperature graphs will have new data (as soon as the change is made).

April 12, 2008

Graphing hard disk temperatures with rrdtool and Ruby

Filed under: graphs, linux, monitoring, rrdtool, ruby — Lisa Seelye @ 2:27 pm

Since I got to North America I have wanted to put my system under better monitoring. It’s got four active hard disks (and a fifth powered, not active) hard disk in an IcyDock MB-455SPF 5-Bay Internal SATA Drive Enclosure (Manufacturer site, icydock.com, seems offline so link to where I bought it!) with the four active disks plugged into a HighPoint RocketRaid 1640 SATA controller.

I can easily use S.M.A.R.T. to monitor the temperature and the hddtemp Linux utility to get the temperatures of the disks.

It’s easy to use a crontask to poll the disks and to stuff the temperatures into an rrdtool database. I drew much inspiration from Martin Pot’s Perl script to do the same thing but implemented my own in a Ruby Rake task using the woefully undocumented RubyRRDtool gem and a custom hddtemp wrapper class to get the temperatures.

The similarities between my Rake task and Martin’s RRDtool-fu is obvious, however I wanted an hour graph too and so I added it in on line 17.

My next task is to combine the temperatures (lines) of all four disks into a single graph to get a feel for the overall temperature of the disks on one image.

The graphs can be seen at my personal website.

March 12, 2008

Reve Release 86

Filed under: api, eve online, ruby, testing — Lisa Seelye @ 12:09 am

Another Reve release, 86. This time I’m fixing a bug with the strict XML parsing not picking up cachedUntil. Tests and test XML have been fixed. Check trac for specific changes.

March 7, 2008

Reve 83. Bug fixes

Filed under: api, eve online, reve, ruby — Lisa Seelye @ 3:05 am

Just a quick note! I’ve been busy and have not had time to push this Reve release. Wish I had done it earlier but it’s here now.

Reve Release 83 with release notes at rubyforge. Short story is that I’ve fixed a bug with personal_wallet_tansactions method and fixed a bug with short XML tags causing problem with writing XML to disk for re-use.

Good luck!

February 17, 2008

First Reve Trac Ticket

Filed under: api, bugs, eve online, open source, rails, reve, ruby, subversion, testing, trac — Lisa Seelye @ 11:58 am

Had my first bug report today about the to_i method I made on the String class breaking Rails migrations because leading zeroes weren’t being treated nicely in my method: "001".to_i # => 1 and fails the test 1.to_s == "001" and so a String was being returned fromto_i. Crap.

I don’t think that I need the method anyways (I’m going to spend part of today to make sure with more tests!) so I’ve removed it and tagged Release 80 and uploaded the gem to RubyForge. It should be available to gem update or gem install shortly.

This release also has a larger test coverage and some other unnecessary methods were pruned. Check it out!

February 9, 2008

An evil snippet for hash traversal

Filed under: json, rails, ruby, snippet, testing, work — Lisa Seelye @ 12:28 pm

First the problem:

I'm writing a load test framework at work and I need to consume JSON webservice and pass on the output to another request. But I don't always know what the data is that I need to pass on but I do know the basic "path" ("hpath" -- "hash path") to get to the data as the JSON data is uniform.

Now the method:

RUBY:
  1. # Picks out data from a (JSON) decoded hash based on the @passon hash,
  2. # which looks like this:
  3. # { "id" => "packet.products[0].attributes.id",
  4. #   "quantity" => "packet.products[0].attributes.quantity"
  5. # }
  6. # The "id" and "quantity" are the new keys for the return data;
  7. # packet.products[0].attributes.id will look at the value of the id key
  8. # in the attributes hash in the 0th element of the products array in the
  9. # packet hash.
  10. def pick_out_passon(hash_data)
  11.   return {} unless @passon
  12.   returnhash = {}
  13.   nh = hash_data.dup
  14.   @passon.each do |newkey,part_str|
  15.     parts = part_str.split(".").reverse
  16.     while (part = parts.pop) do
  17.       m = part.match(/\[(\d+)\]/)
  18.       index = nil
  19.       if m
  20.         index = m[1].to_i
  21.         part.gsub!(/\[#{m[0]}\]/,'')
  22.       end
  23.       nh = nh.values_at(part).first
  24.       nh = nh.at(index) if index
  25.     end
  26.     returnhash.merge!({ newkey=> nh})
  27.     nh = hash_data.dup
  28.   end
  29.   returnhash
  30. end

What's it do? It does magic!

I'll step through it...

Looks for @passon instance variable and doesn't do anything useful unless it exists.

Duplicate the input hash because the process done is destructive to it and we may need to reuse it.

For each new hash key and "hpath" pair from @passon split up the hpath into its parts and reverse it so Array#pop will work in the while loop to get the next first part to try.

Since each part of the hpath can examine an Array by index it has to be checked for and the index removed from the part (and saved).

Next, investigate the copy of the hash_data, nh by the computed key; if the value in the hash was an Array use the index to get the desired value. Then compute the next part!

Once we're out of parts stuff the new key and data into the returnhash and keep going til there's no more @passon pairs.

And thus some fun code was written.

Older Posts »

Powered by WordPress