Redline Software Inc. - Winnipeg's Leader in Ruby on Rails Development

Player Data and OT Pts

Two new features have been added to Redzone.

  1. You can now download your player data from the admin users page. The file can be imported into a spreadsheet and formatted however you see fit.
  2. A new overtime win point setting has been added along with the other point settings which are available from the admin dashboard.

Redzone Update

Just a quick note to mention some small updates recently made to Redzone…

  • Division Stats
    - You can now view the stats for an entire division. The default it still the top 10 for all divisions, but if you’re looking for an extended list of stats, you now have that option.
  • Allow multiple contacts
    - This is a really minor change, but before you couldn’t add a user more than once on the contact page, but now you can.
  • Division email
    - An additional email option has been added to the teams page. You can now send an email to an entire division if required. (This is only accessible to administrators)

Team Roster Enhancements

It’s been a little while since our last feature update post, but we’ve recently added a couple of new enhancements to the team rosters.

Player number support has now been added. An administrator or team contact can enter in player numbers for their team and these will appear on the team page and will also automatically appear on game score cards.

The second addition is the ability to “disable” a player on a team. An administrator or team captain may want to do this if a player no longer plays on a team or have been “traded” to another team, etc. Disabled players are removed from the team email messages as well as the list of eligible players for a game when entering stats.

Both of these features are only available to the league administrator and the team contact. Simply press the “Edit Roster” button at the bottom of the page for a specific team and you will have the options to specify the player numbers as well as enabling and disabling players using the checkboxes beside each player.

Redzone News & Forum RSS Feeds

We’ve added RSS feeds for news items as well as each forum that you create for your league. There’s also a feed for all of the forums combined. See your browsers docs and/or use your favourite RSS reader to make use of them.

Enjoy!

File_column Image Regeneration

If you use file_column for some projects and find that you want to change the thumbnail sizes that you’ve been using for models, then hopefully this little bit of code can help.

Add this as a rake task and run it as rake "filecolumn:regenerate[Model, field]" RAILS_ENV=production where Model is the model you want to regenerate images for and field is the filecolumn field on the model. The task uses Rake arguments, so you’ll need Rake 0.8.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
namespace :filecolumn do
  desc "Regenerate filecolumn images"
  task :regenerate, :model, :field, :needs => :environment do |task,args|
    if args.any?{|k,v| v.blank?}
      puts "Usage: #{task.name}[Model,field]"
    else
      klass, field = args.model.constantize, args.field

      klass.all.each do |obj|
        puts "Regenerating #{klass} #{obj.id}"
        next if obj.send(field).nil?
        state = obj.send("#{field}_state")
        state.instance_variable_set(:@just_uploaded, true)
        state.transform_with_magick
      end
    end
  end
end

The code essentially boils down to 2 lines…

  • setting @just_uploaded to true on the state object
  • calling the transform_with_magick method on the state object

Skittles and Bowling Now in Redzone

I thought it was just candy, but it turns out Skittles is also a sport. You can now create Skittles leagues in Redzone, and because Bowling is a descendent of it we added that as well.

Got a sport that you need league software for? Let us know!

Dodgeball Added to Redzone

We’ve added Dodgeball support to Redzone today.

There are tons of variations of Dodgeball, so we tried to keep it simple with the statistics. If you have a variation that you’d like us to support drop us a line and let us know!

Kickball (Soccer Baseball) Support

Redzone Leagues has recently added kickball as a supported sport. The stats currently configured are basically the same as those used for softball, but if you don’t want to use any of them, you can use the “Statistics Management” feature and turn them all off or select just the ones you want to use.

Using God to Automatically Monitor Mongrels

Here is a sample god configuration file for monitoring all the mongrels on your system. This script assumes that your mongrel configs are all in /etc/mongrel_cluster and that your pid_file attribute in your config files point to an absolute path. I lifted the majority of this script from the example in thin. (Thin is awesome FYI)

I have a few mongrel config files in /etc/mongrel_cluster that look similar to:

1
2
3
4
5
6
7
8
9
---
user: deploy
group: www-data
cwd: /var/www/apps/sampleapp/current
port: "8200"
environment: production
address: 127.0.0.1
pid_file: /var/www/apps/sampleapp/shared/pids/mongrel.pid
servers: 2

When I want to deploy another application on the same machine, I add the config file there and then restart god. It will then begin automatically monitoring the new application.

My /etc/god.conf:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
require 'yaml'
config_path = "/etc/mongrel_cluster"

Dir[config_path + "/*.yml"].each do |file|
  config = YAML.load_file(file)
  num_servers = config["servers"] ||= 1

  (0..num_servers-1).each do |i|
    number = config['port'].to_i + i

    God.watch do |w|
      w.group = "mongrel-" + File.basename(file, ".yml")
      w.name = w.group + "-#{number}"
      w.interval = 30.seconds

      w.uid = config["user"]
      w.gid = config["group"]

      w.start = "mongrel_rails cluster::start -C #{file} --only #{number}"
      w.start_grace = 10.seconds
      w.stop = "mongrel_rails cluster::stop -C #{file} --only #{number}"
      w.stop_grace = 10.seconds
      w.restart = "mongrel_rails cluster::restart -C #{file} --only #{number}"

      # assemble the pid file, pid files look like mongrel.8000.pid, mongrel.8001.pid etc
      pid_path = config["pid_file"]
      ext = File.extname(pid_path)
      w.pid_file = pid_path.gsub(/#{ext}$/, ".#{number}#{ext}")
      w.behavior(:clean_pid_file)

      w.start_if do |start|
        start.condition(:process_running) do |c|
          c.interval = 5.seconds
          c.running = false
          c.notify = 'team'
        end
      end

      w.restart_if do |restart|
        restart.condition(:memory_usage) do |c|
          c.above = 150.megabytes
          c.times = [3, 5] # 3 out of 5 intervals
          c.notify = 'team'
        end

        restart.condition(:cpu_usage) do |c|
          c.above = 50.percent
          c.times = 5
          c.notify = 'team'
        end
      end

      # lifecycle
      w.lifecycle do |on|
        on.condition(:flapping) do |c|
          c.to_state = [:start, :restart]
          c.times = 5
          c.within = 5.minute
          c.transition = :unmonitored
          c.retry_in = 10.minutes
          c.retry_times = 5
          c.retry_within = 2.hours
          c.notify = 'team'
        end
      end
    end

  end
end

God::Contacts::Email.message_settings = {
  :from => 'god@example.com'
}

God::Contacts::Email.server_settings = {
  :address => "localhost",
  :port => 25,
  :domain => "example.com"
}

God.contact(:email) do |c|
  c.name = 'team'
  c.email = 'team@example.com'
end

One thing that the god install doesn’t do is create a nice init.d script, but you can find one here which I found from this post about using God.

The God website has an example with explanations of what each of those sections mean. Check it out.