Trixbox configuration for Sipgate

CuMu.Li Comments Off
Trixbox configuration for Sipgate I’ve had a lot of troubles getting Sipgate SIP connections working with Trixbox. I’ve searched loads of forums and they all give opposing opinions of what works and what doesn’t. In my case I’ve found them mostly not to work. However, now I’ve got my SIP connection working (at least for incoming, I’ve not tested outgoing).
Read more »

Attachment_fu Thumbnail class bug

CuMu.Li Comments Off

Update – This has now been fixed and included in Release 3007 Hurrah!!!!

I’ve found a bug in Rick Olsons attachment_fu plugin. If you create image attachments and using a different model for the thumbnails, eg.

class Image < ActiveRecord::Base has_many :thumbnails, :dependent => :destroy has_attachment :content_type => :image, :thumbnail_class => ‘Thumbnail’, :thumbnails => { :sidebar => “x200” }, :storage => :file_system validates_as_attachment end

class Thumbnail < ActiveRecord::Base belongs_to :image has_attachment :content_type => :image, :storage => :file_system end

If you have an image with an id of 1 and a thumbnail with an id of 1 then when you try to destroy image (id=1) the code will go into an infinite loop as the destroy_thumbnails function will think the thumbnail itself is has thumbnais and try to recursively delete itself until the stack level gets too deep.

Read more »

Testing file uploads to attachment_fu using RSpec

CuMu.Li Comments Off
I’ve been doing quite a lot of Behaviour Driven Development using RSpec recently. However, I hit a problem topday, I was trying to test file uploads to Rick Olson’s attachment_fu plugin. First I thought all I had to do was to pass it a file handle or contents of a file, not so. The tests failed moaning of missing methods. I had a rummage around in the tests for the plugin itself.
Read more »

HAML and TextMate

CuMu.Li Comments Off
HAML and TextMate

I love HAML and SASS, they’re such beautiful ways of ways of writing HTML and CSS respectively. I saw Hampton do his (I believe first) presentation at RailsConf Europe 2006 in London last year with a can of Stella and no small amount of profanity! It was a fantastic presentation and I remember commending him on a good job whilst having a cigarette outside. I started using HAML pretty much immediately after that.

However, I’ve always been a bit annoyed that TextMate doesn’t have support for it. I’ve probably just not been keeping up, but I’ve now found that in the Macromates SVN repository there is a bundle that enables HAML support in TextMate, hurrah. The URL for this bundle is http://macromates.com/svn/Bundles/trunk/Bundles/Ruby%20Haml.tmbundle

All you have to do is go to your ~/Library/Application Support/TextMate/Bundles directory and do a svn co http://macromates.com/svn/Bundles/trunk/Bundles/Ruby%20Haml.tmbundle and the support will be in TextMate. Well done Macromates and the guys at Unspace.

Autotest, RSpec and Growl on OS X

CuMu.Li Comments Off

I’ve just been getting autotest (part of the ZenTest suite) to work. It’s a really good framework for just getting your tests to run automatically in the background.

Following the instructions in one of the fantastic PeepCode screencasts I got the notifications from autotest to get piped though to Growl

In the PeepCode Episode there’s a link to to Wincent Colaiuta’s knowledge base on how to do this. However, it would seem that the formatting of the RSpec output has changed since this ~/.autotest file was written. “Not implemented” strings have changed to “Pending”

Read more »

Errors When Rendering a Partial with a Layout

CuMu.Li Comments Off

I submitted my first patch to Rails yesterday. I found that if you render a partial with a layout before you call yield in your site layout, the value that is returned by yield is whatever was rendered by your partial (without it’s layout) and not the rendered action as expected.

This is because the requested action is rendered before it’s layout, then stored in @content_for_layout (in the ActionView object). When render :partial => ‘blah’, :layout => ‘my_layout’ is called it stores it’s value in, you guessed it, @content_for_layout, thus overwriting the rendered action with the rendered partial. Thus, when you call yield from your site layout, the last partial rendered with layout (just the partial bit though) will always be returned.

The patch creates a copy of the current @content_for_layout before doing a render, then sets it back to its original value once the render has completed. It doesn’t seem to appear on the main ticket listing page though, I’m not sure why.

OpenAdvantage

CuMu.Li Comments Off

I’ve been working for OpenAdvantage since December 2003 and I’ve thoroughly enjoyed my time here. Unfortunately the funding has come to an end. So from the end of September I will be out of a job :(.

We had another bid into Advantage West Midlands to continue our work with the National Open Centre, but unfortunately due to the recent change in Prime Minister most public spending has been stopped for re-evaluation. So as far as AWM are concerned there is no money available to fund our project.

Read more »

How to get Asterisk working on OS X

CuMu.Li Comments Off
How to get Asterisk working on OS X After spending ages playing around with both Parallels and VMWare on OS X I’ve decided it’s probably easier if I get a local copy of Asterisk working rather than running it on a virtual machine. With the project I’m working on I need access to the files that Asterisk has created and was having problems getting the files between the the virtual machine and my Mac.
Read more »

Testing and refactoring too far?

CuMu.Li Comments Off

I’m just writing a load of unit tests for a project I’m working on and I’m thinking about two things. Firstly, how much do I need to test? I’m thinking I probably need to test everything that I put in a model, in case it gets changed at any point.

However, I’m finding myself repeating myself over and over again, which I don’t like and it’s not very dry, is it? I’ve already refactored a method which I’ve called assert_not_valid_with_missing which checks a list of symbols to check that if they aren’t included in the model then it’s not valid, for example assert_not_valid_with_missing :name, :address, :telephone_number etc.

Read more »

First Seminar

CuMu.Li Comments Off

I’ve just finished giving my first seminar, it was called Powerhouse Office Servers With Samba and LDAP. I was particularly worried about doing this as I’m not particularly good a speaking in front of people, however it is something I’d like to be good at. So, after spending about a week getting the 97 slides ready, complete with screencast style video of the steps needed to setup a couple of different systems, the time came to give it today.

How did it go? Well, I was certainly nervous before and throughout the hour and a half presentation, but all in all it went really well. People seemed pretty receptive to what I was saying and there were a good number of questions both throughout and at the end. Plus, I don’t think I saw even one of the 15 people even starting to nod off!

Would I do it again? Yes, infact I’ve got to do another one in September, same subject, so the presentation will just need a bit of tweaking, with a little luck. Am I looking forward to doing it again? Not sure, don’t think so, but I’ve been told it just gets easier and easier as you do more, so that’s what I’m planning on doing!

I think I’m just sure of one thing… I’d very much like a beer!!!

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in