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.

JSFiddle: http://jsfiddle.net/tfk1n1qs/2/

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!

How to clone individual partitions from one drive to another

This is more a reminder for me, but this is something I always have to search for.

How to clone several partitions from one drive to another without cloding the whole drive using dd.

In this example source = sdb and dest = sdd

TLDR:
# Clone partition 1 from sdb to sdd and copy the boot sector
sudo dd if=/dev/sdb1 of=/dev/sdd1 bs=4096 conv=notrunc,noerror
sudo dd if=/dev/sdb of=/dev/sdd bs=446 count=1

Main Content:

Ultimaker and Prusa MK2 heated bed mod

Ultimaker Prusa MK2 Heated bed solution

image of heated bed
After battling through the Ultimaker wiki and the reprap wiki to figure out how to get a heated bed working ont he Ultimaker, I decided to write up my solution.
The Documentation and information available the moment is pretty sketchy. After trying a couple of things and blowing up half my Ultimaker, I decided the wiki was a terrible resource, lacking in opertinent information at best, and leaving massive assumptions.
The biggest assumption on the ultimaker wiki is that you can connect the headed bed to the onboard FET driver directly. While this worked for me temporarily, the heat from the FET caused it to stop working. My advice is to NOT connect directly via the onboard FET and use a relay.

The instructions below are for how to connect a Prusa MK2 heated bed to the Ultimaker with board revision 1.5.6.

Main Content:

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.

3 Hour Hacks: Part 1

Intro



I am planning a small series of 3 hour hacks. Each hack will be allocated a 3 hour window only. There are penalties for failing to adhere to the rules. Points will start at 100 and count down. Rules are as follows:

  1. Research is time free. It does not count towards the total time. (learning should be free, right :) )
  2. Must not go outside of 3 hours. -10 points for every 30 mins outside of this.
  3. Must use all items available. Must not purchase any items for hack. -20 points for each item purchased. (Sub-note: You are allowed to purchase the first item, the one to be hacked only)
  4. Hack must be funny, witty, clever, convoluted, impractical, or otherwise absurd.
  5. The device must serve a purpose. It must have a use. -20 for no valid use!
  6. The hack doesn't have to be nice or finished. -1 point for each stupid build mistake.
  7. Upper limit of £20 for all parts in hack, even if from junkbox. Does not include initial purchase. Estimate prices, but be conservative :). -5 points per £/$ over this.

Hack 1) Hard Drive CPU/RAM meter.

Main Content:

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 http://sleeptalkinman.blogspot.com/ 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!

Searching

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."

(http://news.cnet.com/8301-13505_3-10027925-16.html)

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.

XBoxCake

Mr Daniel's XBox Cake

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

Ingredients:
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 computer...it 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.

Pages

Subscribe to HeadFUZZ RSS