30 Dec 2011

How to remove a broken or stripped screw – the ultimate collection of tips

1 Comment crafts

I was inspired to put this post together when searching for ways to remove a broken screw recently – there are so many different tricks that I thought it would be fun to collect them all in the same place. I have tried to put them in order of try-ability, with those that use tools you probably already have at the top.

First of all, are you dealing with a stripped screw or a broken one? A stripped screw is where the slots in the head have become worn and rounded so that the screwdriver can’t grip it and looks like this:

A broken screw is one where the head has sheared off, and looks like this:

If you have a broken screw then the techniques for dealing with a stripped screw won’t help you, so click here to jump down to the methods for broken screws. On the other hand, if you have a stripped screw, then you can use any of the techniques on this page so just start reading.

Methods for stripped screws

These mostly involve ways to improve the amount of grip that you can get on the screw head with a screwdriver. They often work well in combination – try heating the screw to loosen it, followed by using the rubber band trick.

Tap or heat the screw to loosen it

The idea here is to loosen the screw so that you can use what little grip remains in the head to unscrew it. Tapping can help to free a seized screw, while heating a metal screw can loosen it by making the metal expand then contract. To loosen the screw by tapping, place the tip of a screwdriver in the screw head (as if you were going to turn it) then tap the butt of the screwdriver with a hammer. To loosen it by heating, place the tip of a hot soldering iron in the screw head and press down for a few seconds.

Drill a small hole in the centre of the screw

By drilling a hole just a couple of millimetres deep in the middle of the screw head, you can allow the tip of your screwdriver to go deeper in the head and get a little bit more grip. Use a very small drill bit that will work on metal. A Dremel is perfect for this job, using a drill bit like this one.

Use a rubber band to get more grip

This one is simple; just place a rubber band over the screw head and unscrew it normally. The rubber can help to give just enough extra grip to get the screw to turn.

 

Use aluminum carbide or valve grinding paste

The idea here is the same as above – give the screwdriver a little more grip on the screw head. Just spread a little of the paste into the slots in the screw head and unscrew as normal.

Use a hammer to reshape the slots in the screw head

An unsophisticated trick :-) Seat the tip of a screwdriver in the screw head and whack the base of the screwdriver with a hammer. This is only likely to work on screws made out of soft metal (but hey, maybe that’s the reason they get stripped in the first place!)

Use a flat-head screwdriver on a cross-head screw

Sometimes a flat-head screwdriver can get a better grip on a stripped cross-head screw than the correct screwdriver can get, due to the way that cross-head screws are designed to “cam-out”. Use plenty of pressure to keep the screwdriver seated.

Use a screwdriver bit that’s too big

Very similar to the trick above. Instead of using a flat-head screwdriver, use a cross-head screwdriver, but pick a size that’s too big for the screw. If the slots have been worn, this can often give a better grip than using the correct size.

Use a steel punch to hit the screw off-center

This is only likely to work on screws that have a large head. Take a small hardened steel punch and use it to hit the screw off-centre so that it rotates anti-clockwise. This sometimes works to start a screw moving; as soon as it’s loosened, move on to one of the other methods.

 

Methods for broken screws

Grip the screw with a pair of pliers and turn it

If the screw isn’t secured too tightly, and there’s enough of it protruding, you may be able to get enough purchase with a normal pair of pliers to remove it. Be sure to clamp the screw in the sample place with the pliers each time you grip it so you don’t round off the screw.

Of course, the more leverage you can get to grip the screw with the better, so if you’ve got a pair of pliers with long handles and an adjustable jaw like these ones, then use them.

And if you are lucky enough to have a pair of locking pliers (AKA vise grips, vice grips, or mole grips, depending on where you live) then you can use them to apply much more pressure and to clamp down on the screw while you turn it.

Clamp the screw shaft in a drill chuck and turn slowly

The chuck of a drill is designed to hold the shaft of a drill bit securely, so it often also does a pretty good job of holding the shaft of a broken screw. Tighten up the chuck of the drill as hard as you can around the screw – you will need both hands for this so get someone to help by holding the drill in place as you do it. Don’t plug the drill in until you’ve finished clamping the screw, and make sure it’s in reverse  before you turn it on. Any cheap drill should work for this, or you can also use an electric screwdriver if it has a chuck. Don’t try this trick with a rotary tool like a Dremel – they are designed for high-speed, low-torque so will be useless (but if you have a Dremel, see the next method!)

Use a Dremel to cut a slot in the screw

If there is enough of the screw protruding above the surface it’s screwed into, you can use a Dremel or other rotary tool with a cut-off bit to cut a slot directly into the shaft, which you can then unscrew with a flat-head screwdriver. Use this type of cutting wheel and make the cut as straight as you can.

If there is plenty of shaft visible, then you can do the same with a hacksaw, but it’s much trickier – you’ll need a very narrow blade and a steady hand.

Use epoxy to glue a nut onto the end

Two-part epoxy glue forms an incredibly strong bond, so you can use it to glue something onto the end of the screw that will give you enough grip to turn it. Use a type of epoxy designed for metal – J-B Weld is the strongest:

The best thing to glue, if you have one, is a nut that just fits over the head of the screw. Position the nut over the head of the screw, then mix up the glue and use it to fill the gap between the nut and the screw. Be sure not to accidentally glue the screw to the surface that it’s stuck in! Wait for the glue to cure then use a spanner or socket to unscrew the screw using the nut.
Other type of glue are not strong enough for this trick, so don’t bother trying – you will just create a mess!

Weld a nut onto the end of the screw

A similar approach to number 4, but (if you have access to a welder) a much quicker one. Weld the end of the screw to something solid which you can use to grip it – a nut is perfect.

Use a screw extractor

This is bottom of the list because it involves buying a special bit of equipment – a screw extractor set. However, it really belongs at the top because it is the quickest, most reliable solution.  Screw extractors have a left-handed thread, which means that you put your drill into reverse and then start drilling into the broken screw. When the extractor has embedded itself in the screw, the left-hand rotation will neatly unscrew it. If you’re going to the trouble of buying a screw extractor, then you might as well buy a set, because (1) you won’t have to try to guess which size you need and (2) you’ll have the correct tool on hand the next time you encounter a broken screw!

 

If you have a trick that’s not mentioned here, let me know in the comments and I’ll update this post!

 

13 Dec 2011

How to build raiser legs for a chair or sofa

No Comments crafts

Recently I got a new set of sofas and armchairs to go in my living room. They were perfect apart from one small problem – the legs were too short. By that I mean that the underside of the sofas were too close to the ground to allow my Roomba vacuum cleaner to fit underneath. As you can see from this picture, a Roomba will happily clean underneath furniture, but only if there’s enough room – in the case of my model, about three and a half inches (90mm).

I definitely wanted to make sure that my Roomba could fit underneath the new sofas – I have three dogs and hardwood floors, so hair will inevitably gather if it’s not being picked up. I started looking at chair raisers – there are some very nice hardwood ones available – but quickly realised that there were two problems. Firstly, I would need three sets, which would set me back the best part of $100. Secondly, there’s no way to adjust the height – I wanted to raise my sofas and chairs up by only the minimum amount necessary. So I decided to make my own.

Design

The basic plan is to use a hole saw to cut a bunch of circular wooden disks out of cheap timber planks, and then stack the disks together until they’re the right height. Then, to securely hold the legs of the sofa, you’ll cut a final disk with a cut-out section in the middle where the sofa leg will go. A photo of the rough finished product should make things clearer:

This one was made from 3/4 inch (18mm) planed timber, and I used three layers to give a total height of  2¼ inches (54mm). The top layer was made from the same piece of wood, but doesn’t contribute to the height of the sofa – the sofa leg just sits in the round depression so that it’s held securely. This is the rough version – if you’re going to be able to see the leg raisers, you could sand the outside and stain or paint for a nicer finish.

Construction

The trick to cutting out these perfectly circular disks of wood is to use a hole saw -  a circular blade that fits into a normal drill and cuts round holes.

For this project we need to cut two sizes of hole – a big one for the main layers, and a smaller one for the sofa/chair leg to fit into. Rather than buying two individual saws, it’s cheaper to buy a set that contains a range of sizes. This set will do the job perfectly and contains a range of sizes which will be useful for other projects. You’ll also need an electric drill and some smooth planed timber – try to get a plank that’s 3/4 inches thick and about 5 inches wide.

Now, on to the cutting. Disclaimer: power tools are dangerous – take care!

If you look at your hole saw, you’ll see that the central drill bit protrudes a bit beyond the cutting saw part. The trick to cutting nice neat holes is to drill through your wood until the central bit emerges on the other side, but before the saw part has cut all the way through. Then, turn the wood over and finish off the cut from the other side, using the central hole to make sure that you’re cutting in exactly the same place. If you just cut all the way through from one side, then you’ll get a load of splinters where the saw breaks through the wood. Most hole saws have a small hole in the back that you can use to poke out the circular disk if it is stuck – do this gently, as you don’t want to dent the wood.

While you’re cutting, watch out for any sign of overheating, like smoke. The friction between the saw and the wood can cause it to get very hot. Also, be careful not to touch the blade immediately after you’ve finished a cut as it will probably be hot. A hole saw generates a large amount of sawdust – much more than normal drilling – so make sure you do it somewhere that will be easy to clean up.

The easiest way to figure how how many layers you need is by trial and error. Cut out four disks using the largest hole saw in your set, and put them underneath the four legs of your sofa. If it’s still not high enough, cut another four and repeat. Be careful, because at this stage there is nothing holding the disks together, so they could easily slip.

Once you’ve got enough layers to raise your sofa to the right height, cut one more set of disks for the top layer that will hold the legs. Now comes the clever bit – we will use a hole saw to cut another disk from inside the first one, leaving us with a ring-shaped bit of wood that will hold the leg securely. The trick to this is to cut the inner hole just big enough to hold the existing sofa leg, so measure it and pick the hole saw from your set that is just big enough to fit. If your existing sofa leg is round, then just measure across it; if it is square then measure on the diagonal. If the size is in between two of your hole saws, then pick the smaller one and enlarge the inner hole after glueing. Use the drill bit hole in the centre of your wooden disk to make sure that you drill the inner hole in the exact middle. You’ll probably want to clamp the wooden disk when drilling it, as there might not be much clearance between the edges of the disk and the hole that you’re drilling.

When all the drilling is done, you’ll be left with a stack of wooden disks (3 in my case) and a wooden ring for each leg. Assemble each raiser by glueing the bottom of each disk to the top of the one below it, and glueing the bottom of the ring to the top of the uppermost disk (take a look back at the photo above to see what I mean).  Because you’ve made the disks from planed wood, the tops and bottoms should be perfectly flat and easy to glue. And because you’ve used a hole saw to make the disks they should all be exactly the same diameter, so it should be easy to get them to line up.

Once the glue has dried, it’s time to check that the sofa legs fit into the depressions on the top of each raiser. If you’ve cut the holes slightly too small, then the best way to enlarge them slightly is with a rotary tool like a Dremel with a drum sander.

You could also use a round file or a piece of sandpaper, but it will take quite a lot longer! If necessary, you can tap the bottom of the raisers with a mallet to get them seated securely on the sofa legs – the slight friction between the leg and the wood will help to hold them on securely.

Finally, finish the raisers however you like. I simply sanded the outside to a nice smooth finish, but if the raisers are going to be on display, then you could stain or paint them to match the rest of your furniture.

05 Dec 2011

How to build a high-quality audio system using Ubuntu

No Comments Linux

Note: this post is about high-quality audio under Linux; however, the set-up will work just as well on a Windows or Mac machine.

Historically, sound has always been a weak point for Linux, with many devices refusing to work due to a lack of drivers. The appearance of Ubuntu improved matters, but I have always found support for high-quality audio to be lacking. However, the development of USB sound cards has made a big difference and I have finally found a way to get high-quality audio on Ubuntu on a budget. The set up I’m about to describe will give you fantastic, detailed sound for music listening for around $200.  Briefly, the recipe is

1. use an external USB soundcard

2. get a line-out signal from the soundcard and

3. use active monitor speakers, NOT multimedia speakers

The sound card

There are two main reasons to use a USB sound card. Firstly it means that the digital-to-analog conversion is taking place outside the computer, where it can’t be affected by all the electrical noise inside. Secondly, the quality of the conversion (which will ultimately determine the quality of the sound) is far better than can be achieved by your computer’s built-in sound card.

The best low-cost USB audio device I have found is the FIIO E7, which you should be able to pick up for around $80.

It’s actually designed and marketed as a headphone amplifier, but it’s perfect for our purposes because it’s actually a high-quality USB soundcard as well. It is recognized by Ubuntu as a USB audio device so it doesn’t need any drivers and will work out of the box.

The line-out signal

Because the E7 is designed to drive headphones, you can’t take the output and use it to drive a pair of speakers. Instead you need to get a line-out signal which you can feed to an amplifier. There are two products that let you get a line out signal from the E7 – a rather cool looking separate headphone amp, and a line out dock.

The headphone amp looks extremely cool, but will set you back another hundred bucks and take up a chunk of space on your desk.  The line out kit (called the L7), on the other hand, costs ten bucks and does the job perfectly.

It clips to the bottom of the E7, then you plug a USB cable in one side, and get a line out signal from the other side. This will allow us to use the DAC part of the E7 while bypassing the amplifier part.

Active monitors

Now you have your line-out signal you need a amplifier and a pair of speakers. The best value solution is a pair of active speakers (also called powered speakers); these have an integrated amplifier so you can connect them directly to a line out source. Active speakers come in two main flavours. Multimedia speakers are designed for computer games and movies, so they tend to be loud and dynamic, but are lacking in detail for music. A much better choice is a set of monitor speakers; these are specifically designed to accurately reproduce music and are often used for recording and mixing.

M-audio make a few models of budget speakers that are ideal for our purposes. I am currently using a pair of AV40 speakers . They are nicely sized, comfortably loud enough to fill a large room and have wonderful sound reproduction.

If you need something smaller there’s a very similar model with slightly less power which will take up less room. Alternatively, if you want to go larger, the next step up would be the Bx5A, which has a slightly bigger speaker – handy if you listen to a lot of bass-heavy music – but comes at a hefty price.

Setting up

Hooking up a system like the one I’ve described above is very simple. The L7 plus into the bottom of the E7, then the USB cable runs from the L7 to your computer. The line out cable runs from the other side of the L7 to the active speakers. Be sure to arrange your speakers for best sound from your normal listening position – follow a guide like this one and you can’t go wrong.

A set up like this should keep you happy for a long time; the only thing I have found I needed to upgrade is the line out cable which goes between the L7 and the speakers. The supplied one is a little loose, but even a high-quality gold-plated, shielded cable is only about $10, will sound great, and will last practically forever.

30 Nov 2011

Higher order programming and functional abstraction in Groovy

No Comments Programming

I’ve been checking out the legendary MIT Structure and Interpretation of Computer Programs course from 1986 on YouTube, and it’s fascinating for many reasons, not least the hypnotic synthesized Bach that bookends each lecture. I don’t think I will ever be able to hear Jesu, joy of man’s desiring again without seeing that purple wizard. What’s really striking to me is how quickly the course gets into territory that I (coming from a self-taught Perl/Java background) think of as pretty advanced. In the first three lectures we are introduced to:

  • Recursive subroutines
  • big-O notation
  • passing functions around as variables
  • building functions using higher-order programming

Anyway, I thought that the example used to illustrate higher-order programming was pretty cool, so I decided to see if I could implement it in Groovy. The example involves writing a function to calculate the square root of a number using the Babylonian method - start with a guess and repeatedly average the guess with the number divided by the guess, until the answer is close enough.

Here it is in Groovy:


def abs(x){
    if (x < 0)
        -x
    else
         x
} 

def sqrt2(guess){
    println "guess is $guess"
    def difference = abs((guess * guess) - 2)
    if (difference < 0.001){
        return guess
    }
    else{
        def new_guess = ((2 / guess) + guess) / 2
        return sqrt2(new_guess)
    }
}

sqrt2(1)

and the output:

guess is 1
guess is 1.5
guess is 1.41666666665
guess is 1.414215686275

I’ve defined an abs() closure because the built-in .abs() method complains about different types of numbers. The sqrt2 method itself is easy to read – given a guess, calculate how far off it is by squaring it, and either return the guess (it it’s close enough) or use the averaging procedure to make a new guess and call sqrt2() again. We could make it a bit more concise by leaving off the explicit return statements – a Groovy method returns the value of the last expression that was evaluated, so we don’t really need them (this is what I’ve done with my abs() method). Note that when we call the method in the last line, we have to supply it with an initial guess.

The first step in abstraction is pretty obvious – let’s do away with the hard-coded 2 and let the method take the number for which we want to take the square root as an argument.


def sqrt_iter(x, guess){
    println "guess is $guess"
    def difference = abs((guess * guess) - x)
    if (difference < 0.001){
         guess
    } else {
         def new_guess = ((x / guess) + guess) / 2
         sqrt_iter(x, new_guess)
    }
}

def sqrt = { x ->
    sqrt_iter(x, 1)
}
sqrt(5)

To make things a a little more convenient I’ve moved the iterative code to a closure called sqrt_iter; the job of sqrt now is just to supply the initial guess. Now we can ask for the square root of exotic numbers like five:


guess is 1
guess is 3
guess is 2.33333333335
guess is 2.238095238095
guess is 2.2360688956435

Up to this point there’s no higher-order programming going on. But now it starts to get interesting; we can extract the bits of code that are responsible for checking if the answer is good enough and for generating the next guess:


def improve(x, guess){
    ((x / guess) + guess) / 2
}

def goodEnough(x, guess){
    def difference = abs((guess * guess) - x)
    difference < 0.001
}

def sqrt_iter(x, guess){
    println "guess is $guess"
   if (goodEnough(x, guess)){
        guess
    }
    else{
        def new_guess = improve(x, guess)
        sqrt_iter(x, new_guess)
    }
}

def sqrt(x){
    sqrt_iter(x, 1)
}
sqrt(5)

Now, what we are left with in sqrt_iter is a generic procedure for solving a problem by generating successively better guesses until we get close enough. We can make this abstraction explicit by turning our improve / good enough methods into closures and having them as arguments to the main iteration method:

sqrt_improve = { x, guess ->
    ((x / guess) + guess) / 2
}

sqrt_goodEnough = { x, guess ->
    def difference = abs((guess * guess) - x)
    difference < 0.001
}

def generic_iter(goodEnough, improve, x, guess){
    println "guess is $guess"
    if (goodEnough(x, guess)){
        guess
    }
    else{
        def new_guess = improve(x, guess)
        generic_iter(goodEnough, improve, x, new_guess)
    }
}

def sqrt(x){
    generic_iter(sqrt_goodEnough, sqrt_improve, x, 1)
}
sqrt(5)

I’ve changed the names of the closures to make things clearer. sqrt_improve and sqrt_goodEnough are the particular type of improve and goodEnough routines that are for solving square roots. Our iteration routine is now a generic one that take four arguments – a closure that can tell if a guess is good enough; a closure that can improve an existing guess, a number for which we’re trying to find the answer, and a guess. Note that the generic_iter method now contains absolutely no logic to do with calculating square roots – it is completely generic. We can use it to solve any problem which we can express in terms of a way of checking if a guess is good enough, and a way of improving a guess.

Here’s a completely brain-dead example; using the generic_iter method to solve the problem of finding the smallest integer that is bigger than a given number:

biggerThan_improve = {x, guess ->
    guess + 1
}

biggerThan_goodEnough = {x, guess ->
    guess > x
}

def biggerThan(x){
    generic_iter(biggerThan_goodEnough, biggerThan_improve, x, 0)
}

biggerThan(5)

The improve closure just increments the guess by one; the good enough closure just checks whether the guess is bigger than the target number. The output is not particularly surprising:

guess is 0
guess is 1
guess is 2
guess is 3
guess is 4
guess is 5
guess is 6

One final point: because we can return closures as values from methods in Groovy, we can redefine generic_iter so that rather than executing the iteration procedure, it returns it. So we can assign the result to another variable and use it later on:

def generic_iter(goodEnough, improve){
    def returnClosure
    returnClosure =  { x, guess ->
        println "guess is $guess"
        if (goodEnough(x, guess)){
            guess
        }
        else{
            def new_guess = improve(x, guess)
            returnClosure(x, new_guess)
        }
    }
}

def sqrt = generic_iter(sqrt_goodEnough, sqrt_improve)

sqrt(5, 1)

Note that here we have to define returnClosure before we assign a value to it, because we want to refer to it inside the closure body. generic_iter now takes only two arguments – the two closures that will do the work – because its job is not to actually carry out the calculation, but to build the routine that will.

29 Nov 2011

How to fix an infinite 301 redirect loop in WordPress

No Comments WordPress

I just ran into this problem today; thought I should post the solution in case anybody else finds themselves in the same boat.

I moved a WordPress blog from one server to another which was running lighttpd with a blanket 301 redirect to from www to non-www URLs. When I fired up a browser to test it, I got the dreaded “this website is responding in a way that will never resolve” message. A quick look at the lighttpd logs confirmed that I was bouncing from www.example.com to example.com then back to www.example.com.

I expected the first redirect but not the second, and checking in my lighttpd conf showed no rule that could possibly be triggering it. Thinking maybe I had left a redirection plugin running, I logged on the blog (by temporarily disabling the redirect rules) and checked, but couldn’t find anything.

Turns out that WordPress itself is capable of generating 301 redirects according to the “Blog URL” field in the General settings page. If the URL is set to http://www.example.com and a request comes in for http://example.com/some/page, then WordPress will automatically respond with a 301 redirect to http://www.example.com/some/page (which in my case, would get caught by my lighttpd rule and bounced back to the original request URL, and so on).

Moral of the story: make sure that your WordPress URL settings and any manual redirection you are carrying out are in agreement as to what the ‘correct’ URL should be!

11 Sep 2011

How to lie with evolutionary trees

No Comments Science

Because evolution is largely treelike in large, multicellular animals (interesting cases of lateral gene transfer notwithstanding) the easiest way to display the history of life is in the form of a tree. Trees are great at packing a lot of information into a small space; they can represent the entire set of relationships between a group of organisms very compactly.

image credit: wikipedia

However, they can also be difficult to read and so a reader’s interpretation of them can be easily affected by the way in which they’re drawn. Take a look at this evolutionary tree, showing the evolutionary relationships between several different animals.
Read more

03 Sep 2011

Which is harder, walking or flying?

No Comments Science

One of the nice things about having a reliable knowledge of the relationships between groups of organisms is that it lets us figure out when different traits have evolved. This can be of great practical importance – for instance, if we see that a particular mutation has evolved independently in several species that are all parasites, then it suggests that the mutation might be important for parasitism. It also lets us make more general statements about the history of life on earth – for example, we can say with great certainty that complex eyes have evolved independently multiple times.

Another trait that has evolved multiple times is powered flight. We know that there are four groups of organisms that can fly – birds, bats, insects, and (extinct) pterosaurs. And we know that each of these groups evolved flight independently because, in each case, the most closely-related group cannot fly. For example, bats are most closely related to carnivores like dogs and cats than they are to any other flying animal. (The situation with birds is slightly more complex because their closest relatives are all extinct, but the principal is the same). We can be pretty confident that powered flight evolved independently four times.
Read more