Knockout JS: sorting a list based on an element property

Knockout is a JS framework to make building complex apps in the browser a breeze. But somtimes it leaves you with problems that you struggle to figure out.


How exactly do I sort on a property on an object in an observableArray?

say we have an array of these objects
name: "baz",
sales: 10

How would I get sales sorted?

Unfollow everyone in bulk on twitter using only the browser

So someone hacked my twitter. Considering my password is random and huge, I am confused.
Anyway this left me a mess to clean up as the spammers followed thousands of people.
I had to unfollow them all.

I wrote a 1 line javascript to unfollow all twitter users.

Go to /following in twitter. Scroll to the bottom and make sure they are all loaded

The JS

$('.following[data-user-id]').each(function(user) { $(this).children("button.follow-button").click() });

Option A
1) paste the above in the URL bar and hit enter

Options B
1) press F12
2) click "Console" tab

Appreciating the Passion of the Geek

Yesterday as I was waiting for my chips in a typical northern chip shop, I overheard another customer telling her friend about her younger brother's new hobby. "He's started getting into flying model planes, such a geek," she said with distaste, "and he's not even any good."
What's wrong with having a hobby? Now I do hate to stereotype, I really do but she struck me as the type of person who would look at anyone suspiciously who showed an interest in anything more than watching Coronation Street or the X-factor.

rsyncing files from a server to a client

Memory jogger for me mainly, but useful

How to make rsync copy files from one computer to another BUT not overwriting existing local files.

The magic keyword is --ignore-existing

Merge/continue copying files from one machine to another with checksum

NOTE: Checksumming is slow!

Woman to Woman

Well well well. Hasn't Ms Brick caused a stir?

I'm sure I'm one of millions writing a little blog about her but as the old insomnia strikes again I thought I'd have my say.

The Tragically Hip versuses The Comfortably Square

In the past week I have had the oppotunity to see two bands live, neither of which are really aimed at my demographic. It was certainly interesting to see the differences between them.

Firstly I am 29. In the last year or so I have started to find nightclubs tedious, too loud and full of 'annoying young people'. Try and fight it as I might, the idea of going for a nice meal where a large amount of sitting down will be required is far more appealing. I am not yet at the stage where I think a trip to B & Q is fun but I am not far off.

The first band I saw was an up and coming indie band, who I shall refer to as the Tragically Hip. The average age of gig goers appeared to be about 19. The gig was loud, dark and crowded. Not long after I arrived I was stuck to the floor with stale beer. I say dark, though when the band came on stage, their lighting technician appeared to be doing his best to blind the audience, maybe this was to blind us to their performance. Whilst I can't say they were bad, the way they threw themselves about the stage, no doubt 'feeling the music', seemed a little contrived. It was all testosterone and attitude, which of course was a unresistable mix to the throngs to teenage girls jumping, giggling and fawning in the audience. Personally I found their charms very resistable and spent most of their set looking for somewhere clean to sit whilst trying not to breath in the soup of airbourne hormones lest it kicked off another puberty. It seemed to me that the aim of their performance was to make as much noise as possible, whilst pulling the most ridiculous faces possible. It was quanity of noise rather than quality of it.

Ten Observations for Star Fleet Captains (based on a back to back perusal of Star Trek: Voyager)

1. When in a battle situation/stuck in a spatial anomaly, the first thing to go offline will always be the warp engines, closely followed by the impulse ones and about half the time the thrusters too.

2. A tachyon pulse/burst/stream is the answer to pretty much everything from scanning for aliens to breaking free from spatial anomalies.

3. If someone is about die/seriously injured or in mortal danger on the planet’s surface, there will always be interference and the transporters won’t work.

4. The holodeck will cause lots and lots of death.

5. The shields will only ever hold for roughly 4 shots from the enemy. BOOM! “Shields at 84%” BOOM! “Shields at 60%” BOOM! “Shields at 23%” BOOM! “We’re fucked”.

Building a hexapod robot

Here is my micromagic/openservo hexpod (as yet unnamed) build log

The Musings of a Sleep Talking Baz

As some of you may know, Baz is a natural born sleep talker (and occasional sleep walker). You've probably heard how when we first got together he'd sit in bed staring at me, telling me "It wasn't going to work" or the time I found him searching under the bed "looking for the Foo Fighters".

So inspired by I decided it's about time I kept a record too.

15th Jan 2010

"We're not really dedicated. We're like the filthy offspring. We're Mongoloid"

"Poo on his hands"

Making Kopete slightly more usable

I have been using Kopete for years, and it is a great IM program. After the recent releases for kde 4.x I have noticed a few irritations. These irritations are small, merely papercuts, but should still be fixed. So I fixed them.

I would say in advance, these fixes are probably (certainly) implemented in the wrong way, and should never go near an official branch. If I ever find time to figure out how to make this work in the right way, I will. For now the patches are here and they are pretty raw, but functional.
Also I didn't bother to try and fix compiling the experimental branch as it seemed more broken than I can find time to fix. These fixes are compiled against the latest stable kopete 0.80.2 from svn. They took me about 2 hours of real work to do these.

A couple of problems in the current kopete, and resolutions

Here are the problems as I see it. You may disagree.

  • Searching. Working but limited.
  • Search visual elements. Shows empty folders in the results view
  • Grouping offline contacts together. Doesn't exist!


Weddings....What's Love Got To Do With It (Sod All From What I Can See)

There's a programme on BBC3 on Tuesdays that has stoked my ire. The progrmme in question is called 'Don't tell the Bride'. The premise of the programme is that a well meaning if sometimes misguided Groom plans the whole wedding in 3 weeks for a (usually) demanding wedding obsessed Bride.

I'm not a fan of the big wedding, as many know. And people usually interpret this as me being anti-marriage which on the whole I am not. It annoys me immensely that these bridezillas truly believe that the colour of the bridemaids dresses or the invitations are the most important thing in the world. Really? Is it some indicator of future happiness I am unaware of? Call me naive but surely the way a man treats you or respects you is a better measure of future happiness that the ribbon on the invitation being the same colour as the cake.

Royal Mail Suck

5:28pm just got in from work a bit early. Got the card through the door... "Sorry, you were out"... So Royal mail came with a parcel. Cool. I wonder what it is.

Collection times:
Mon-Fri 0900 - 1700

Um, really? I just called them to make sure it wasn't a really really dumb typo. Nope, it isn't. I can only collect the parcel between the times that 99% of the poopulation are working. Smooth.

I have 7 days to collect it before they send it back. Nice of them.

Okay, now remember I have no idea who this is from? Well, they can't tell me. Data protection. That has to be the worst excuse I ever heard. I have a card they they posted through my door. Of course it is me. You think a burglar is going to go to the trouble of ringing up the post office on the off chance that the parcel wasn't something mundane? No.

Overhearing irritating things

"No one uses Linux for servers because it's not very good"

What? in fact "Linux has now climbed to 13.4 percent of the overall server market, with Unix at 7.7 percent and Windows at 36.5 percent."


So Linux is just under half of the Windows share. hardly insignificant.

"Linux is free, but there is no such thing as a free lunch"

When I overheard this I was torn. I believe there is no such thing as a free lunch, but in the context of the overheard conversation, it is free.
Free to use, free to add to, free to edit. Free as in freedom. You might want some support though. I'm pretty sure you would need to get some support for your windows network too.


Mr Daniel's XBox Cake

xbox's have more in common with mr kiplins than they do an x86. baked to perfection

1x XBox (preferably one of those e74 ones)
1x Screwdriver
1x Box of plasters (for the inevitible blood)
1x Oven (preheat at gas mark 4 30 mins)

It's a common misconception that an xbox is a is infact a type of cake...and although you can play with the dough first and savour it, you will infact need to bake your xbox to get the most out of it....gas mark 4 for 30minutes until the xbox is piping hot all the way though and the 2 fully cooked decoration lights come on, leave to cool for 40minutes until devouring the gaming goodness.

I Hate Going To The Cinema

I have frequented the cinema quite a few times recently and it's reminded me of how much I fucking hate it. Don't get me wrong, I love the experience of watching films on the big screen, but the rest of the experience is bloody awful.

Let's start with the price. It's robbery in any light, day or otherwise. I also despise people kicking the back of my chair, accidental or otherwise. They is no redemption for these people they are going straight to hell.

Then there's people arriving late. It niggles me we people arrive when the previews are showing but arriving after the film has started really pisses me off. There should be a row of really uncomfortable stools by the door where these people have to sit. As the film started last night 2 girls came in, stood in the isle next to me, blocking my view of the left side of the screen, pondering where to sit like it was a difficult algebra equation. These annoying latecomers shouldn't be allowed the disrupt the film for those of us who have the decency to arrive on time.

10 Signs A Geek Is In Love With You

1. You have your own login on his computer.

2. Instead of lovenotes you get sent xkcd links.

3. Any arguments you have are solved by Google.

4. He's milled, soldered or embossed your name into something.

5. You are more likely to discuss what you've seen on the internet than on TV.

6. If you say you want anything, he'll say he'll build you one.

7. He lets you blog on his website (ahem).

8. He's drawn a comic strip starring you.

9. You've been converted to Linux.

10. All your base are belong to him.

It's How I Was Raised...(What as an idiot?)

It's how I was raised...a little phrase encompassing a notion used almost as much as religion as a thinly veiled explanation of prejudicial views.

My mum wore ridiculously high heels all through my childhood. She's suffering for it now. I told her she would. I wear sensible M&S shoes and my feet are just fine. I don't try and stuff my essentially rombus ended feet into triangular ended shoes because quite frankly it's ridiculous. My Dad smoked 80 a day for most of his life and now wheezes and coughs to pass the time.

Great parent eh? Well Yes. Aside from the shoes and a sometimes dodgy dress sense my mother taught me to regard people of all colours, sexes and sexualities equally. Aside from the smoking by father taught me the importance of learning, of questioning and understanding.

God damn crappy software

As a developer I know that software crashes occasionally. I accept these things and move on. Some things, though, are just too god damn annoying to let it pass without rage.

Here is a list of software that has ruined my life this week

Firefox 3.0.4 on Linux:

  • Crashing randomly, even when backgrounded.
  • Can't open many pages that I could before without javascrit errors.
  • Gmail, google search and google images are all now defaulted to plain old HTML
  • flash has stopped working, both free and non-free.
  • Java makes firefox hang, and needs -9 killing

The Manchester Congestion Charge - My 5 Quid’s Worth

Well everyone else has had a whinge. Now its my turn.

So, if we vote yes, we'll get £3 billion pound investment, more trams, more buses, better service and we'll live in a utopian public transport paradise - will we balls! GM Transport managed to spend £250,000 installing a bus stop in Eccles, yes a, one, singular. At that rate we'll get fuck all. If we do vote yes, I predict at least half of the money will go on red tape and senior management bounses.

I get to work by bus and I am voting no. There's just some annoying things about bus travel that the plan doesn't cover like, how to stop people being fucking idiots and gathering around the door at the front of the bus when there are loads of seats and making it difficult for everyone to get off. Or how to stop people which colds and germs coughing and spluttering all over you. Another thing - smelly people - I'd be more inclined to vote yes if the unwashed weren't allowed on.

The X Factor - That's entertainment?

Being away from the usual abode on Saturday night, I was forced to watch the X Factor. Actually thats wrong - I was forced to endure the X Factor. What a big pile of poo.

As I never watch it I thought maybe I had judged too quickly, maybe they were great singers, maybe here was the new Tina Turner or Freddie no. Slightly above average pub singers. So here's what I thought of them.

The Jamelia-a-like - Probably the best one cos I can't remember anything about her. Bland.

The Spanish one - Her body was the different shade of orange to her face.

The Baby Headed one - Surely he's not a man but some giant mutant baby? If you see him run away lest the mother appears.


Subscribe to RSS - blogs

Latest cool gadgets

Here is a small list of reviews I have done on some toys