Git: remove a submodule

For years, i’ve been searching the internet every time i want to do this. Various guides have come and gone. I rarely deal with git submodules anymore since the dawn of Bundler, but every now and then i find i want to remove a submodule in order to convert to bundler.

So once and for all, here’s the process, for example i am deleting a cucumber rails plugin:

Remove the three lines from .gitmodules

[submodule "vendor/plugins/cucumber"]
	path = vendor/plugins/cucumber
	url = git://github.com/cucumber/cucumber.git

Remove the two lines from .git/config

[submodule "vendor/plugins/cucumber"]
	url = git://github.com/cucumber/cucumber.git

Delete the git reference file that holds the submodule’s SHA commit id. Note the important lack of a trailing slash.

git rm --cached vendor/plugins/cucumber

Git will now see the entire directory as new files, because it’s no longer a submodule. Now you are free to delete the whole lot.

rm -rf vendor/plugins/cucumber/

And now you can add it to your Gemfile to use with bundler :)

Packard Bell Mustek Bearpaw scanner on Ubuntu/Mint

I am quite sure that nobody cares about this except for me, unless they happen to have a similar scanner to mine. I’ve had to do this process about 5 times now on different installs. I can guarantee that it works for Fedora, Debian, Ubuntu and Mint. I thought i’d share it because i’ll probably need it again and someone else might find it helpful.

First you need xsane to be able to scan things at all.

sudo apt-get install xsane

Plug in your scanner by USB. Attempt to scan by typing scanimage. It won’t work, but you need to see the error message.

scanimage
[gt68xx] Couldn't open firmware file (`/usr/share/sane/gt68xx/PS1Dfw.usb'): No such file or directory
scanimage: open of device gt68xx:libusb:004:002 failed: Invalid argument

See that PS1Dfw.usb? You need to get that file from http://meier-geinitz.de/sane/gt68xx-backend/ but be aware that your computer might ask for a different file such as ps1fw.usb or ps1fw.usb. Whichever it is, find it on the page and click it to download.

Assuming it’s gone into your Downloads folder, move it to the right place.

sudo mv ~/Downloads/PS1Dfw.usb /usr/share/sane/gt68xx

Now try the scanimage command again. With any luck your scanner will burst into life and a whole load of crazy gobbledegook will splurge into your terminal window. This is the picture your scanner is seeing, trying to be displayed as text! Don’t be afraid to Ctrl-C to stop it once you see it working. Or you can just wait for it to finish.

You can also do this to ensure that your scanner is configured correctly:

scanimage -L
device `gt68xx:libusb:004:002' is a Mustek Bearpaw 1200 CU Plus flatbed scanner

Now to actually scan something! Open up The Gimp and click File -> Create -> XSane -> gt68xx:libusb:004:002

It comes up with this super ugly XSane interface, where you can make a preview, choose the scan area, fiddle with the colour settings and DPI settings, and scan an image.

XSane scanning an image on Linux Mint

When it’s done, it’ll come back to The Gimp ready for you to edit the scanned image.

Protip: If you lose one or more of the XSane windows, you can get them back again by going to the Window menu of XSane and ticking on the ones you need.

Gowalla pins

As of Monday, 5th July, these are the 38 pins currently available on Gowalla, grouped by category. I just made this because it’s sometimes hard to see what all the pins are at a glance.

If you’re curious about Gowalla, see my other introductory post: Gowalla tips.

Installing Gowalla

I Installed Gowalla I Installed Gowalla

Checking in

Wanderer Wanderer Check in at 5 different Spots to receive the Wanderer Pin.
Sightseer Sightseer Check in at 10 different Spots to receive the Sightseer Pin.
Ranger Ranger Check in at 25 different Spots to receive the Ranger Pin.
Discoverer Discoverer Check in at 50 different Spots to earn the Discoverer Pin.
Explorer Explorer Check in at 100 different Spots to receive the Explorer Pin.
Wayfarer Wayfarer Check in at 250 different Spots to receive the Wayfarer Pin.
Voyager Voyager Check in at 500 different Spots to receive the Voyager Pin.
Epic Voyager Epic Voyager Check in at 1,000 different spots to receive the Epic Voyager Pin!

Continue reading

don't you just love an awesomesauce #tupperwarebox

This weekend the world went mad for Tupperware Boxes.

Key output:

Some rather bizarre songs:

My dog’s favourite thing is my #tupperwarebox, it’s full of treats and nom, she behaves so well when it’s around, I think I’ll tie it on.

I’ve got a massive #tupperwarebox it’s got a special lid that clicks and locks

Come on and let’s rock! Everybody let’s rock! Everybody in the whole cell block was dancing to the #tupperwarebox!

How I love my little #tupperwarebox! You can a-store my cheese, you can a-sit on my knees, feels like a picnic right here at home…

A quiz: “Which #tupperwarebox would you be?”

A twitter retweeter bot: @tupperwarebot – the cool thing about this was i learnt how to use Yahoo Pipes and made a pipe that finds relevant tweets and manipulates the stream to become retweets with the hashtag #tupperwarebox

A Justin Bieber in a #tupperwarebox which gained the @tupperwarebot a lot of Justin Bieber fans!

Justin Bieber in a #tupperwarebox on Twitpic

This is actually quite disturbing when i found there is a rumour that Justin Bieber got stuck in a toy box at age 7 and suffers from claustrophobia. But anyway, the fans seem to like it. They appreciate the randomness of it and came up with the hashtag #justininatupperwarebox!

Finally, there is a Facebook group: Tupperware Box! If you are a fan of Tupperware and/or pure random nonsense, please don’t hesitate to join! :D

FB.init(“f76c8ae933a8204f4a989f77369fa340″);

Tupperware Box on Facebook

My mystery UFO

Alright, can anyone explain this to me …

I’ve seen these for sale at the Hawkins Bazaar in Winchester. They refuse to open the box, and the staff all claim they don’t know how it works. In any case, i found out that even if you do open the box there are no instructions; just a password that you can enter on a site to get the information. There must be something they are hiding.

There was a Yahoo! Answers question asked: “How does My Mystery Ufo toy work?” … it has been deleted.

My curiosity wants to know what this is all about, but i’m almost certain i’ll be disappointed.

Update: Oh wait, i think i’ve got it. They wave their hands around it, but they don’t wave a hand straight over the top. I think i have an idea what’s going on. Yup, glad i didn’t buy one!

Rails controller generator

Because scaffolding isn’t the answer to everything, i made a personal generator that churns out some CRUD actions with the RSpec tests that are just the way i like them.

Posted here mainly for reference by future-me but anyone else is welcome to use them too.

Generate Rails controller code

I find it’s particularly amusing if you enter ‘cake’ as the model name. it should look up all cakes in the database. It should not break if no cakes are found. It should attempt to create a new cake.

PS. I decided to do this tonight in anticipation of creating four models with controllers at work tomorrow! Yay for reducing an hour or more of tedious work into a few minutes! :)

Just a little bit geeky

58

Created by OnePlusYou

Okay, i cheated because i did it earlier on today and only got about 30! There are about 90 in total. It’s quite surprising the ones you forget, when under pressure, where in every day usage you’d just use it when you needed it. And then there are some that you’ve never learnt and probably never want to use.

I am very pleased to learn that David Heinemeier Hansson will definitely be speaking at RailsConf Europe. Really looking forward to it!

I did some great programming today with nice visual effects. Drag and drop, expand collapse, highlight and fade, AJAX asynchronous updating. Javascript, Prototype and Script.aculo.us are really and truly rocking my world right now.

In other news, how does this make any sense?

In which parallel universe does this make sense?

A picture with 86 views, no favourites and 3 comments is more popular than a picture with 401 views, 1 favourite and 8 comments …? The only explanation i can think of is because the number 1 picture has a note that somebody added, in which case, Flickr notes are massively influential in your popularity ratings. Can anyone think of any other explanation?

I don’t have access to the stats because i’m not quite interested enough in Flickr to want to pay for it.

Yes, this has been a boring, geeky and unimportant post. You may now resume your wildly fascinating life! ;)

Happy 29th February!

Writing a post simply to celebrate the 29th February! I have a friend who is about a week overdue to have a baby. I think it would be great if the baby comes today … but my friend does not agree!

A colleague just said it’s unfair that we have to work on the 29th February. Another said we have slacked off a quarter day for the last 3 years so now we have to make up for it. I said i like Februarys because we get paid more per day – even when it is a leap year.

In other news, we have been having some banana peeling experiments. I am a new convert to the monkey method – hold it by the stalk, pinch at the blunt end and peel down to the stalk. It seems to work quite well. We have banana o’clock every day sometime between 3pm – 4pm. Yesterday there were 6 people all eating bananas together … all but one of them using the monkey method of peeling! :)

Brrrr … too cold.

Today is a very cold day and i am not feeling very well. I am sitting here clutching a cup of hot Rooibos, trying to warm up. I guess i could do some chores – that would warm me up – haha! I’m not really in the mood, but i ought to do some. Last weekend i got completely swallowed up into Second Life and hardly did any chores at all!

This morning i went to meet a friend that i used to know from doing German lessons in Winchester. It was a nice meetup. Tomorrow i may hopefully be going to Eastleigh to meet with a friend, but it is not confirmed yet. Also, depending on how i am feeling tomorrow it may be wiser not to go.

Gah, my Rooibos has all gone. That went down quickly! It soothed my throat a bit.

Spam me all you like!

I sometimes enjoy checking the spam for comments that Akismet has cast aside for me. There is a kind of comment that takes such a predictable form it is almost like a Haiku. It goes:

{compliment}.
{assurance of trust}..
{greeting}

The two dots on the second line are very important. There are always two dots on the second line. Here are some examples:

Hi this article is funny.
I will definitely read your blog..
ciao

Cool article.
I think you will comment our diary..
Bye

Great comment.
I know you’ll surf on my page..
Thank You

Amazing article.
I think you will comment my blog..
Regards

They all include links to something terribly mundane such as folding chairs, cat litter trays, or sunbeds. Despite their high level of confidence i have not yet surfed on their pages nor commented their blogs! As i say, they usually get trapped in the spam filter.

Does anyone else get these type of messages? Maybe i’ll start writing my blog in this format …

Great day.
I am sure i will sleep well tonight..
See Ya