Monday, 12 January 2009

Extracting CDs as WAV files with Rhythmbox

For future reference. Doc for Ubuntu 8.10 (Intrepid Ibex)

Edit | Preferences. Click Edit Button on 'Preferred Format'.

Click New. Enter 'CD Quality, Raw' and click Create.

Edit 'CD Quality, Raw' and put

audio/x-raw-int,rate=44100,channels=2 ! wavenc name=enc


in the Gstreamer pipeline and click 'active'.

Close down the Preference Windows and Rhythmbox then restart it.

You can now select 'CD Quality, Raw' as the menu type.



Why do this? You get the WAV files in your Music directory with the correct titles and they transfer across to Windows a bit easier than FLAC.

Wednesday, 24 September 2008

Freelancers - you will be assimilated. Resistance is futile.


The plot to ensure that everybody becomes an employee of some large organisation (preferably the state) for their 'protection' gathered pace this month. If the announcement that Economic Work Units (aka mothers) are to be required to hand their 2 year olds over to some state sponsored indoctrination centre wasn't enough, there was the disappointing, but largely inevitable, result on the IR35 'Dragonfly' case.

Once again Freelancers are going to have to look closely at the way they operate and review their relationships with clients if they don't want a 'a-posteriori' bill from HMRC.

Conspiracy theorists will have enough to go on at this point. Thanks for reading. Those of you who want the details - read on.

The New Rules

I won't go into the gory details. There is plenty of analysis elsewhere: the best being:

Dragonfly appeal by Roger Sinclair at Egos
Dragonfly shot down in cold blood by Steve Gratton on AccountingWeb

What the new 'clarification' boils down to is this:
  • if you do work for somebody and get paid for it that is enough to to satisfy one condition of being an IR35 employee. You are essentially assessed against a Day Casual Worker and not a Full Time Employee.
  • That you determine what and how (and probably where in these days of homeworking) the work is done is no longer sufficient. You have to have the right to do more than a similarly qualified professional employee would ever be allowed to do.
  • if you allow yourself to become part of the furniture you will become an IR35 employee regardless of what is written in any documents.
  • intention is nothing: perception is everything; what the client employees see you as is probably definitive.
IR35 has become a 'Duck Tax', to slightly mangle that wonderful Ruby term. Arguably that is as it should be. So your tax bill may very well be determined by client employees terrified of an HMRC investigation into them. Bear that in mind in how you allow them to treat you.

Sunday, 4 May 2008

Upgraded to Hardy


Well I've taken the plunge and upgraded my laptop to the 8.04 Ubuntu release (Hardy Heron). Overall the process was very smooth. There are some minor irritations with the way the wireless network works. (To do with the move from the binary ipw3945 driver to the open ipl3945 driver) and a trivial problem with my ML-1610 printer that simply required reselection of the driver to update the appropriate PPD. Other than that I'm here on Firefox 3, printing happily and transmitting over a secure wireless connection and generally enjoying life.

The main reason for upgrading was so I can show presentations on an external screen, and so I can use submodules in git (both in Hardy, but not Gutsy). We'll see if any more irritations pop up over the next few days. However so far, so good.

Sunday, 20 April 2008

Dilbert - probably the worst site redesign of all time.

If you've been to the Dilbert site (http://dilbert.com) recently you'll notice that they have redesigned it so that it has new features. Unfortunately while getting excited about all the new website toys they have completely forgotten about usability.


Faux pas include
  • having to scroll the Sunday strip (can you spot the arrow?)
  • Forcing the Sunday 8 box strip into 3 box format.
  • No way of easily getting to the previous or next strip without going through search.
  • Completely pointless flash tool
  • Even more pointless flash menu
  • Chewing the CPU
  • Crashes frequently on Ubuntu and IE 6 if you flip screens
  • Busy, busy screen.

It works so much better if you turn Javascript off.

Fortunately there is a workaround. Just look at the strips on Yahoo instead http://news.yahoo.com/comics/dilbert

Oh and make a note never to hire the guys at vpi.net if you want a site that people can use on anything less than the latest Redmond specified supercomputer.


Friday, 11 April 2008

Rake quick tip - Getting your dates out into the right format

Rails date formatting leaves a bit to be desired with only a few formats available. You can of course use strftime in all it's glory:
my_record.created_at.strftime("%d-%b-%y")

but it is hardly descriptive.

So there are a couple of ways of getting dates to format as you want them in Rails. The first is to set your own key in the date format table, and select it explicitly.
Time::DATE_FORMATS[:uk] = "%d-%b-%y"
my_record.created_at.to_s(:uk)

But if you want this date format all the time, just overwrite the :default key. Then to_s will use your format by default.
Time::DATE_FORMATS[:default] = "%d-%b-%y"
my_record.created_at.to_s

I stick the command in the ApplicationHelper. It's always a global change.

Thursday, 10 April 2008

Rails and git - clean branch and merge



I've moved over to git recently to take advantage of the new distributed functionality and the various git repository engines that are springing up in the Rails world.

One of the beauties of the new git regime is that creating and deleting test branches of your application is an absolute doddle. For every iteration you simply






neil@neil-laptop:~/test_git$ git checkout -b new_branch
Switched to a new branch "new_branch"
neil@neil-laptop:~/test_git$ *change something*
neil@neil-laptop:~/test_git$ git commit -a -m "let's try this"
Created commit cb3200f: let's try this
1 files changed, 0 insertions(+), 59 deletions(-)
neil@neil-laptop:~/test_git$ *add something else*
neil@neil-laptop:~/test_git$ git add .; git commit -a -m "That didn't work,
let's try something else"
Created commit 0c5f35e: That didn't work, let's try something else
1 files changed, 144 insertions(+), 0 deletions(-)
create mode 100644 FOOBAR
neil@neil-laptop:~/test_git$ *change something again*
neil@neil-laptop:~/test_git$ git commit -a -m "Now we've cracked it"
Created commit 3876936: Now we've cracked it
1 files changed, 0 insertions(+), 144 deletions(-)
delete mode 100644 FOOBAR
neil@neil-laptop:~/test_git$


Which gives you a nice branch with your shiny new functionality in it, but all the hacks and changes are in the log file.


neil@neil-laptop:~/test_git$ git-log --pretty=oneline master..HEAD
3876936d77f6963a5db461fbc013059c84a5e480 Now we've cracked it
0c5f35e7a0386698e57eab0791f5897cb44a0266 That didn't work, let's try something e
cb3200fd16de9bf4a14cbdba1a8abcfa0fcfeb71 let's try this


And that means when you merge down all those log entries get merged as well


neil@neil-laptop:~/test_git$ git checkout try_merge
Switched to branch "try_merge"
neil@neil-laptop:~/test_git$ git merge new_branch
Updating 1b63b7d..3876936

Fast forward
FRED | 144 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
README | 59 --------------------------
2 files changed, 144 insertions(+), 59 deletions(-)
create mode 100644 FRED
neil@neil-laptop:~/test_git$ git branch -d new_branch
Deleted branch new_branch.
neil@neil-laptop:~/test_git$ git-log --pretty=oneline master..HEAD
3876936d77f6963a5db461fbc013059c84a5e480 Now we've cracked it
0c5f35e7a0386698e57eab0791f5897cb44a0266 That didn't work, let's try something
6182c9866e6f4972eb74e873f5d9eff1dd0a272d That didn't work try something else
cb3200fd16de9bf4a14cbdba1a8abcfa0fcfeb71 let's try this


Now recording your twists and turns for posterity probably isn't what you'd want to do. Fortunately there is an alternative. Let's do that again.


neil@neil-laptop:~/test_git$ git checkout try_merge
Switched to branch "try_merge"
neil@neil-laptop:~/test_git$ git-merge --squash new_branch
Updating 1b63b7d..766208c

Fast forward
Squash commit -- not updating HEAD
README | 31 -------------------------------
1 files changed, 0 insertions(+), 31 deletions(-)
neil@neil-laptop:~/test_git$ git commit -a -m 'Shiny new functionality as if by magic'
Created commit 2940a71: Shiny new functionality as if by magic
1 files changed, 0 insertions(+), 31 deletions(-)
neil@neil-laptop:~/test_git$ git-log --pretty=oneline master..
2940a71686d0c618bf39c17d3dd12c8ee02248d7 Shiny new functionality as if by magic
neil@neil-laptop:~/test_git$


Now all the twists and turns of your test branch are banished from history and you can pretend you created the perfect solution first time :-)

The one wrinkle is that you have to force delete the test branch. If you do a normal delete it complains

neil@neil-laptop:~/test_git$ git branch -d new_branch
error: The branch 'new_branch' is not a strict subset of your current HEAD.
If you are sure you want to delete it, run 'git branch -D new_branch'.

However if you take the advice all is well

neil@neil-laptop:~/test_git$ git branch -D new_branch
Deleted branch new_branch.

Git makes it really simple to launch a branch for every iteration you undertake and allows you to keep your mainline commit sequence clean.

Monday, 31 March 2008

Rails Patch accepted!

I came across a Rails problem last week while writing the VAT validation plugin. So based on the open source principle of 'he who finds fixes' I submitted a patch, and it has been accepted!

It's nice to be part of the process.