We’re on the lookout for some office space in Te Aro. Somewhere between 75 and 125 square meters.
Our wish list includes:
- Character
- Earthquake safe
- Showers
- Cycle parking
Would appreciate a call if you’re aware of anything like this.
We’re on the lookout for some office space in Te Aro. Somewhere between 75 and 125 square meters.
Our wish list includes:
Would appreciate a call if you’re aware of anything like this.
The default init.d mongrel script lacked a setting which means that if your server lost power/crashed or you had a mongrel crash, the stale PID files remain and the mongrel_cluster_ctl start command will fail.
This simple fix works great.
Thanks Paul!
Test case: sorting a table containing 750 rows of data. Using the table-kit library.
| Browser | Time |
|---|---|
| Internet Explorer 6.0 (using an XP virtual machine) | 19 seconds |
| Internet Explorer 8.0b2 (using an XP virtual machine) | 5 seconds |
| Firefox 3.0 | 8 seconds |
| Firefox 3.1b1 pre | 8 seconds |
| Safari 3.1.2 | 4 seconds |
| Webkit trunk (31 Aug 2008) | 4 seconds |
| Google Chrome | 9 seconds |
It’s great to see modern browsers executing Javascript so fast. It will be interesting to see how Safari 4.0 compares, which is due to be released shortly.
Want to ensure that your test fixtures are valid? Use the test_fixtures plugin to validate each of your fixtures against the validations defined in your model.
It simply adds a TestFixtures unit test class to your ./test/units directory in your project.
More details are available on github
To install, run:
This plugin adds a breadcrumb trail to your Rails application.
In your action:
In your layout or view:
Generates something like:
You should use CSS to style the breadcrumb trail. See the example in public/stylesheets.
There was a great article in the Herald about Sharesight today. Shame it didn’t mention me or Marcus, but it did explain what we’ve been up to.
Check out Kiwi-made online share trading system hits the market.
We’ve just put together a calculator to work out your savings from Michael Cullen’s Budget 2008. It’s on the Sharesight website here:
We recently needed to create a new database migration, and needed to insert it into at certain position. Normally what I have done in the past is to alter the migration index of an existing file or two.
But this time, it needed to go in at 003. I was going to have to manually increment about 30 or 40 migration scripts. So, it was time to apply my Ruby skills to do it automatically.
Here is the result:
case ARGV.size
when 1, 2
from_index = ARGV[0].to_i
dir = Dir.new(‘.’)
file_list = dir.to_a.sort
file_list.each do |fn|
if fn =~ /(\d{3})(.*\.rb)/
index = $1.to_i
if index >= from_index
index += 1
new_name = case index.to_s.length
when 1
“00#{index}#{$2}”
when 2
“0#{index}#{$2}”
else
“#{index}#{$2}”
end
puts “Converting ‘#{fn}’ to ‘#{new_name}’”
File.rename fn, new_name if ARGV[1] == “RUN”
else
puts “Skipping ‘#{fn}’”
end
else
puts “Ignoring ‘#{fn}’”
end
end
else
puts “Usage: #{$0}
puts ” where”
puts ” number – migration number to start from (mandatory)”
puts ” RUN – add to run to make the changes (default does not rename)”
end
So when you run it, you will get output such as:
chmod 755 /path/to/increment_migrations.rb/path/to/increment_migrations.rb 3/path/to/increment_migrations.rb 3 RUNFinally, thanks to the client for permission to publish. Thanks for giving back to the community!
I’ve just configured Rails to run in a subfolder on a client’s website. Ran into a few issues, that are worth documenting:
In this configuration, you can visit the Rails site by visiting something like http://www.hostname.com/coolsite/
1. There is a Rails bug (ticket 10913) that effects links to assets. I have a link to our combined stylesheets defined as:
The bug is that Rails looks for all of your stylesheets in /public/coolsite/stylesheets/*.css, where ‘coolsite’ is the name of your subdirectory. Obviously, it should not be including the ‘coolsite’ folder in the path.
The workaround I use, is to create a soft link after capistrano deploys the code to our production server. I added this to my /config/deploy.rb file.
after “deploy:update”, “create_apache_prefix_link”
Now, whenever you do a cap:deploy, a soft link will be created in your public software, and this will allow Rails to resolve the stylesheet (and other asses files) in the faulty path. When the ticket is fixed, just remove the capistrano task.
Over the last four months, I’ve been doing both Java and Ruby work.
Inland Revenue are building an external authentication system in Java Portlets on Websphere Portal. And, Sharesight are building an online share portfolio manager in Ruby on Rails.
I’ve noticed how different the two environments are when using 3rd party libraries. Take these two examples:
Display-tag is a Java library that has been around for a long time. I remember using it back at Westpac in 2005. It provides a JSP tag that you can use to render large collections – either on a single page, or over multiple pages. And provides the ability to switch between each of those pages with the expected next/previous and page 1/2/3/etc links. It also can sort the collection by clicking on the column headings.
Anyway, we ran into a problem. The functional specification document wanted the paging link positioned in a specific manner. This differed from what display-tag generated by default. The developer writing the tag spent a lot of time poring over the (good) documentation trying to find out how to make the links appear in the desired position.
Eventually, he came to the conclusion that the Display-tag library wouldn’t do it. The only way the achieve the desired outcome would be to use some CSS magic.
Mail Queue is a Ruby on Rails plugin that converts the normally synchronous mail sending capability of Rails to an asynchronous queue. The emails get stored in a database table, and you use a background process such as cron or Backgroundrb to send the stored email.
It was all going very well, but we wanted to enhance the plugin to add the ability to archive the sent emails, rather than delete them. This would allow us to diagnose problems a lot easier.
In a Rails plugin, you have direct access to the source code. The plugin is stored in the vendor/plugins/mail_queue directory of your Rails project. We opened the mail_queue.rb file, found the code we needed to change, made the enhancement, and saved the file.
With Java 3rd party libraries, they are packaged into a standard JAR file. Inside the JAR file are all the pre-compiled class files. It’s difficult to see how the library is coded. If I wanted to change how a Java library worked, I’d have to:
Contrast that with the Rails approach:
It’s the dynamic nature of the Ruby language that contributes to the ease-of-modification. Being able to replace the change/build/package steps with just a change step makes a huge difference to productivity.