Fixing sofa springs

For some time I have been aware that my sofa has had at least one broken spring. Generally it was feeling a little too soft, and it sagged in the middle where there was one spring missing.

Months ago I investigated buying new springs, and found they are only about £1.50 each. But they come in different lengths, and I tended to remember this job at work and forget it at home. So weeks passed with me doing nothing. However, the other week I was at work whilst Kat was working from home and I remembered. So I got her to measure the depth of the sofa, and I ordered new springs and fixings.

Yesterday after a very long time thinking I should try it, I finally set about my sofa.

First I took off the removable red cover, underwhich is the fixed pale covering. I thought I’d need to cut the covering material somewhere to get access, but when I flipped the sofa on it’s front I found the plastic sheet covering the bottom was held by staples. So with a screwdriver I began levering them out to remove the plastic sheet.

There were lots to remove, but they weren’t too hard to get out so I quickly got access to the underside of the sofa.

I’m not sure what I was expecting, but I was suprised how simple the structure of the sofa is. No custom metal brackets, just bits of chip board and bits and boards of some hardwood. Cut to shapes and forming the structure. Made me consider how hard t would be to make my own sofa…. But not today.

I could easily see that it wasn’t a broken spring as such, it has simply come out of it’s fixing.

Working in confined space wasn’t too easy, but I removed the existing spring and it’s fixings, and discovered that they were not that same as the fixings I got with the new springs.

The existing ones were quite clever, they clearly just hammered in place and gripped the wood. Where as the new ones I had needed nailing or screwing. Given the limited space and access I decided screwing would be easier so I grabbed a box of screws from the garage (some time ago i got a trade pack of various sizes from screwfix. Times like this it’s very handy)

Fixing the first bracket at the top(back) of the sofa was easy enough. But then I wasn’t sure how easy it would be to get the spring in place, so I decided I’d need to attatch the second fixing with the spring in place. Right about now I was thinking a second pair of hands would have been handy. Then I glanced accross at my side table and noticed a small g-clamp…of course! (It pays to untidily leave tools laying around the living room :-) )
I fetched a small wedge of oak from my offcuts box and presto:

I could clamp everything in position whilst I flipped the sofa back over and screwed the front fixing in place.

Job done.

Having fixed the only broken spring I decided to try to make the sofa a little more firm where I usually sit. So I used the same technique to put an extra spring between two existing ones.

Hard to tell if there is much difference. I think so, but I could just be convincing myself given I know there should be.
All told it took about and hour and a half. So not too bad, for a job which took me so long to get around to. Now I can consider designing my own replacement….but maybe that’s taking diy too far.

N900 charging from ‘dumb’ charger

This weekend I took Kat up to London for a couple of days. Knowing that my n900 is a bit of a battery vampire I took with me a generic USB charger an my nokia usb cable.

At the end of the first day we returned to the hotel and I plugged in my n900 as it was on it’s very last gasps of power. Only to discover that it did not register any charge. I previously noted an issue with this charger when I’d completely run out of charge and found that whilst it did register charge nothing became responsive until I plugged it into a computer.

Very odd.

The next morning I went out early to grab a new usb charger from the maplin that was down the road from our hotel. I bought one with 2 USB sockets on the basis that it would be helpful to charge multiple devices. But when I tried it out I found that I still got no charge. At this point it would have been good to be able to do some research on line. However… no charge!

So during the day, after going to the natural history museum, we took a trip to the Nokia store on Regent Street, and I bought a new official Nokia charger. I did ask if they knew any reason why my generic usb chargers weren’t working, but the sales guy knew nothing.

After some research I found that the issue of charging is down to the spec for charging from micro usb. It turns out that the N900 is adhering to the spec, that says it can determine a ‘dumb’ charger if the the d+ d- data lines are connected via a 200 Ohm resistor.

I found this on the talk.maemo.org forum written by shadowjk
You can find the Battery Charging spec at usb.org, in a zip. batt_charging_1_1_FINAL.pdf

Page 7 shows the connection, “A Dedicated Charging Port is required to short the D+ and D- lines with a resistance of RDCHG_DAT”, page 29 specifies max 200 ohms across D+ and D-. Although the wording on page 7 suggests it should be exactly 200 ohms… Also on Page 29, a minimum of 2 MEGA ohms of resistance between D+ and ground or vbus. That is, not connected together at all.

Several people on the forums found that simply soldering d+ and d- together was sufficient, but I decided I’d go with the slightly safer option. Since I had a 200 ohm resistor laying around anyway.

I had a cheap 4 port usb hub that I wasn’t using, and I figured I could rip a socket and the plug out of that. So I broke out the soldering iron, desoldered one of the sockets, and the plug. Then used a bit of strip board and soldered the pieces back on, but with a 200 ohm resistor joining the two middle strips. And voila! easy as that I could plug this into any generic usb charger, and plug my normal cable and get charge.

Here it’s on a strip board which I later cut down to size and fit the assembly back inside the original case

I could probably have made the whole thing smaller, but it’s not too bad. And now I can use any generic usb charger.

This weekend really made me appreciate how much I want battery tech to improve to the point it will last weeks of heavy usage no just hours.

Insulating my garage

I’ve not spent a great deal of time in the garage in the last couple of months. Mostly because the work shop is not so appealing when it’s really cold. Last year I struggled on, taking frequent breaks to hover over the space heater. But it was always a losing battle. This year the thought of the cold kept me inside working on Witter.

At various points I’ve considered insulating the garage, considering everything from putting up a plaster board ceiling and using loft insulation, to just using thin reflective foil bubblewrap stuff stapled to the rafters.

I would have loved to deck out the ceiling with boards and make a proper loft space. However the structure of my garage was built without that in mind. The ceiling joists are just 2×4s that span a little over 4 meters. Fine for just holding a roof structure together, but certainly not load bearing. I considered options to retrofit the strength necessary, but the cost and effort involvd would have been disproprtionate to the benefit gained.
Finally someone mentioned a local polystyrene firm that sells large sheets for insulation. This of course has the benefit of being very light. And a collegue that insulated his tin shed reported notable improvement with 25mm sheet.

So I got some prices and found I could buy a sheet of 50mm fire retardent polystyrene 1.2m x 2.4m for £7.98 ex-VAT.

My plan was to cut up the boards and stuff them between the ‘ribs’ of the roof structure (rafters?) Right up under the felt beneath the tiles. Thus retaining access to the space about the ceiling joists for a few bits and bobs I have up there. I measured up and calculated I’d need 12 sheets to do it this way. Just for comparison I worked out the cost of just covering the space with whole boards and it also required 12 sheets. So this week I placed my order and on Friday they arrived.

This morning I set to work. First measuring up the bap between ribs of the roof for the first one to fill, then cutting a piece to size.

After getting it up into the space, manouvering, finding it was too wide, bringing it down, adjusting, puting it back up and manourvering, finding it was too long…. i layed it down on top of the joists and started to re-evaluate my choices.

Whilst retaining easy access above the joists is theoretically useful, in practice I don’t really need it. And by laying the sheets directly on top it would be a) much faster and b) mean i won’t be heating the whole loft space. And c) mean I could seal the main wokshop from the ceiling space and the gaps where the roof rests on the walls. I’m told thes gaps are important and need to be there. This way I keep them open to the ceiling space but not to the workshop.

You can see here I’ve just cut some bits to stuff between the ceiling joists at the edges to cover the gaps.
It took about 2 hours to get all the boards in place. Of course doing it this way left me with 3 whole extra boards. I clealy should have planned it this way from the start. I just put all the boards up so in some places it’s 100mm thick.
This afternoon I need to put all the little making up pieces to seal off the rest of the edges.
Hopefully I’ll really feel the difference and be able to comfortably work in cold weather. I just need to decide what my next project is…
After I clean up all this stuff off the floor:

Displaying a busy indicator on maemo python app.

This is the post I wish existed when I was looking for how to do this simple thing. I spent hours reading around trying to figure out how to show my app is busy, but to no avail.

Lets first look at the ‘why?’.
So you’ve written yourself a python app for maemo, you’ve figured out how do do some interesting things and your little project is becoming really quiet useful. Having got it to go do some processing, you ralised that it was locking up the whole user interface whilst it ran, and so you have figured out threads. Everything is going great. The UI no longer freezes when the user presses the ‘go’ button. But there is a problem.

The time between the user hitting go, and your application having done it’s thing is filled with the user staring at the UI wondering…’is it working? Did I hit the button enough? This is rubb…oh theres the response I guess that’s ok then’

What you want is to show the user that you’ve registered their click and are busy working on it for them. Enter, the busy indicator…
Everyone is familiar with this concept, little spinning wheels or hour glasses etc. So how do you do this in maemo?

My big mistake was thinking of it as a busy indicator, when I should of thought about it as a progress bar. Personally I think of these as two quiet different things.
Lucky for me mwerle on the talk.maemo.org forums was a few steps ahead of me, and he found the answer in the pymaemo documentation under the section on progress bars. He then posted a comment on my witter thread letting me know. It is hard to explain how happy I am when someone helps me with a problem by giving me specific code examples. It makes my life so much easier, so I’m always really grateful.

It turns out to be as simple as:

hildon.hildon_gtk_window_set_progress_indicator(dialog, 1)

Where 1 turns it on, and 0 turns it off. This puts a little spinning indicator into the title bar or your window/dialog whatever you pass in the first argument.

So simple when you know how.

Of course there is a little extra complication if you can have multiple threads, since you need to co-ordinate them setting/unsetting this indicator.

For witter I wrote a simple method every thread calls on entry and exit. On entry they call with a value of +1 on exit they call with a value of -1


def showBusy(self, increment, *args):
#increment might be +1 or -1 to take the counter up or down
self.busyCounter = self.busyCounter + increment
print "running tasks: " + str(self.busyCounter)
if (self.busyCounter > 0):
#at least one thing running
hildon.hildon_gtk_window_set_progress_indicator(self.window, 1)
else:
#no more tasks busy
hildon.hildon_gtk_window_set_progress_indicator(self.window, 0)
#in case we missed it somewhere, no longer getting Tweets
self.gettingTweets = False

return

Simply it counts how many active threads there are. And whilst that’s not 0 it sets the busy indicator on.

Hopefully this post will help the next developer save some time.

Setting up maemo 5 python development environment

Last week I finally got around to downgrading my laptop from karmic to jaunty. I did this for a couple of reasons. For my laptop the control of external displays regressed from working flawlessly, to crashing everytime it tried to detect an external display that it didnt boot with.
Secondly,, eclipse has some major problems on karmic due to some changes. The fault is with eclipse, but it will be some time before any fixes work through to the eclipse based products I need to work with, so I downgraded.

This meant that I wanted to set up my development environment again for witter, and decided to try and make a better job of it.
So first thing I did was install esbox.
The python plugins are pretty good, and just simple stuff like the outline view of the code, makes navigating around much easier. And some basic syntax highlighting goes a long way to improve productivity.

However the main reason I stopped using esbox before was i failed to get it working with the subversion plugins. I ended up following the instructions here which got me going nicely.

So why is subversion support so important? If you are going to get even slightly into developing any app, you really want it in some kind of version control system. Ideally one hosted somewhere, so that should the worst happen to your pc, you dont lose it. But verison control is more than just backup, its freedom to make wide reaching changes without any worry that you can’t get back to a working system. Wither version control it is trivial to go back to any previous version. I personally like to be able to see how my application evolves over time, as it’s useful for writing blog posts about it.

So svn is just one possible version control system, however it is the one used by garage.maemo.org. Which is the easiest place to find hosting for your maemo project, since you can just sign up and get it free and easy.
I personally would like to see more integration between garage and the talblet repository / build system. It would be cool is a correctly formed project in svn in garage could automagically be built correctly at the click of a button. But it isn’t. At least not yet.

So with esbox and svn support i was ready to checkout witter back into my workspace and get on with development. However I personally quite like having the fremantle development environment. With esbox you can just run python right on the device if you configure it as a remote environment. And there are distinct advantages to this approach, not least the fact you don’t have to setup scratchbox etc.
However I find it faster, once setup, to copy files into scratchbox and run locally, rather than ssh things accross to my n900 which i then have to switch to, then back to laptop etc.

The important things for python in the scratchbox development environment are,…don’t bother with the armel target. That is only really needed if you are compiling c for the device. The x86 target is better because you can actually run the emulated n900.
Once youve setup stcratchbox, done the updates, and installed the nokia-binaries pacakge. You will want to add the extras-devel repository to your /etc/apt/sources.list. This allows you to install all the required python libraries.
I’d list them here, but I find it useful to stumble over each library my app needs as I add the imports, since I can keep a list which will ultimatly make it into a depends declaration when you build your python project into an installable app.

The other thing you want to do in scratchbox is modify the /etc/resolv.conf file to match that of your host system. Without it you won’t be able to resolve any internet addresses. Given you are developing for a mobile internet device, it’s likely your app will need to access the internet.

I personally develop in esbox natively in ubuntu. Then copy my files into scratchbox. And I have Xephyr running, with maemo 5 up inside it. And a terminal logged into scratchbox where I can run/rerun my app.

Then when I want to copy onto my n900 I just scp the files to the device.

With this setup, anyone wanting to look at the witter source can just open a new project in esbox as an svn project and enter the svn details for witter (or whatever project from garage you are interested in) and you can start playing with the code much as the developer does.

It’s not as good as eclipse for java, but it makes devloping in python a little easier, and integration with svn makes working with a garage project nicer to do. Maybe in time there will be more great python help for would-be developers.

Next Page »


RSS Navit SVN Feed

  • An error has occurred; the feed is probably down. Try again later.

My Twitter

Error: Please make sure the Twitter account is public.

blog Archieve

 

February 2010
M T W T F S S
« Jan    
1234567
891011121314
15161718192021
22232425262728