A little bit of telemetry goes a long way

def update(self):
        for name, mgr in self.manager_entries:
            start_time = time.ticks_ms()
            mgr.update()
            now = time.ticks_ms()
            mgr.update_time_ms=time.ticks_diff(now,start_time)
            self.status[name] = mgr.get_status()

This is the update loop for the Python version of the Connected Little Boxes software. It works through all the managers and updates them all. It also records how long each manager took to update and stores this value in the manager. I’ve found this to be incredibly valuable when trying to measure performance. When I display the status of the managers I also show the update_time value, which tells me who is slowing things down. When you make something that might be a bit performance sensitive its always worth adding a tiny bit of telemetry to find out what is going on.

Reverse Vibe Coding

“Vibe coding” is apparently the word of the year. It describes a programming practice where you tell an AI system what you want a program to do and then it writes the code for you. Then you test the code, it works perfectly, you embed it in a mission critical system and everyone lives happily ever after. Or not.

I’ve tried this a few times and what I end up doing is what I call “Reverse Vibe Coding”. I describe what I want, the AI makes something which mostly works. I describe what changes I think should be made to make it work properly, the AI then makes something new which may, or may not, be better. And then we repeat. There seem to be inflection points in the process where the AI can jump in massively the wrong direction and you have to kick it back on track. Rather than AI helping me solve my problem I end up helping AI solve its problems. This is kind of fun, but not usually very efficient. Although the AI probably learns a lot.

Hyper Japan Manchester

We like Hyper Japan in London. So we thought we’d try Hyper Japan Manchester. The journey was different, in a car rather than on a “more exciting than we needed train”. But no less exciting as it turned out, thanks to the antics of Apple Maps navigation which insisted on taking us off the motorway so that we could enjoy some A-road action and a trip through Oldham that we didn’t expect. Then, when we needed it most in the middle of Manchester, the navigation had a complete meltdown spouting random instructions to head off down unknown streets and make sudden U-turns. I’ve no idea what caused it, but fortunately I kept my nerve and found the car park next to the venue.

You could say that the event was “more intimate” than the one in London. You could also say it was smaller. But it was no less interesting and enjoyable. Although we didn’t find anyone selling bubble tea. We got great stands, amazing musicianship and good food. Plus fantastic costumes. I’ve dropped some pictures down below. You can find all my Hyper Japan pictures here.

Python Shorts 16: Getting an exception description in Micro Python

This is useful if you want to find out how your otherwise perfect code has just fallen to pieces. One of the nice things about Python is that when a program fails you get a description of what happened and where:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "main.py", line 21, in <module>
NameError: name 'zanzibar' isn't defined

However, if you catch the exception you need a way of displaying this useful information in the handler. This is how you do it:

try:
    mgr.setup(mgr.settings)
except Exception as e:
    print(f"[CLB] Manager {name} crashed during setup:")
    sys.print_exception(e)

The call of sys.print_exception takes in the exception object that was thrown and prints the terribly useful message. If you want to put the message into a string (perhaps so you can log it or send it somewhere) you can do this:

import io
import sys
try:
    x=zanzibar
except Exception as e:
    buf = io.StringIO()
    sys.print_exception(e, buf)
    trace = buf.getvalue()
    print("bang")
    print(trace)

The code above will throw an exception (unless your program contains a variable called zanzibar). The exception is copied into the variable called trace which you can then do what you like with.

Out of date spam

Does anyone know how I can delete all the emails from a particular sender on Gmail using the web client? You would think that this would be easy. There would be some way of specifying the sender and then a convenient button that you could press to delete everything.

If there is such a button, I’ve not been able to find it. All I can do is work my way through pages of mails, deleting everything in each page. It’s almost as if Google want to make it hard for you to get rid of dross so that your email fills up and you have to pay them for extra storage….

Happy snaps at the Hardware Meetup

There is a lot of detail in the gloom, Thanks to Ben for arranging the elements in this shot

We had great fun taking pictures and developing film at the Hardware Meetup tonight. Ian’s film, taken on a 100 year old camera, looks really good. My shots suffered from serious underexposure/developing, but I’ll have some scans tomorrow.

Update: By using a magical power called “Posting From the Future” I’ve added a picture. It seems that I seriously overestimated the power of the flash I was using. I think it looks good and properly atmospheric.

Im quite pleased with how this picture looks as well.

Analogue Photography at the Wednesday Hardware Meetup this week

I’m getting bits and bobs together for the Film Processing Hardware Meetup on Wednesday this week (12th of November). We’ll have 120 and 35mm film plus some cameras to play with, along with some cameras to play with. We’ll take some pictures and then develop them. If you fancy having a go at analogue photography (or just want to see how it works) then come along to the MakerSpace at the top floor of Hull Central Library on Wednesday evening from 5:00pm. We’ll develop a few films and you’ll be able to take your negatives home with you (although they might be a bit wet).

Creating Multi-Colour prints from FreeCAD

I need to work on the letter sequencing…

I’ve been working on the self-solving wordsearch for a while now. Today I’ve been creating two different models for the case, one is the white outer case and the other is the black letter grid. I managed to print out a small test piece and I’m quite happy with how things turned out. The idea is that I put lights behind the letters and you can watch the answers appear.

This is the back of the text. There are some bad bits, but they don’t really show

The design is built using Python in FreeCAD which made it very easy to create and align the two models. Next step is to make the full size (16x16) wordsearch and then print it out, which might take a while. Great fun.

Rob at The Tech Sessions in Hull on December 2nd

If you are in Hull you should go to Tech Sessions. If you aren’t in Hull you should come to Hull. And then go to Tech Sessions. I’m doing half of a session at the University of Hull starting at 6:30 pm on December 2nd in the Brynmor Jones library. I’m talking about making stuff. The other half of the session is from Rory Reid who is talking about writing meaningful, valuable, and maintainable tests.

And there will be free food and drinks too. And it’s free to attend. You can sign up here. Why would you not?

AI is nice. Only humans can be kind.

A nice person can be expected to give you what you want. A kind person can be expected to give you what you need (which might not be what you want). AI is in the business of being nice. Once it has figured out what you want it considers that the job is done. It is really hard for a human to work out how best to be kind, and it is a human thing to want to try.

I’m far from convinced that we can ever encode kindness into an AI. I think it adds a layer of introspection which would be an order of magnitude bigger than what we are doing at the moment. This doesn’t mean that we can’t use AI. It just means that when we do we need to remember that is only ever nice.

Snap Fit Fun

I’m trying something different with 3D printed components. Snap fitting. Rather than using screws and whatnot I’m cutting grooves in one element and putting a lip on the other so that they snap together. It’s all done by the software that makes the panels, and I’ll be able to tweak the size and configuration of the snapping bits. All I have to do now is print the parts and see if they snap together….

Light Leaks?

This one looks OK

I think I have a light leak. Either that, or something weird is happening with the film developing process.

At first I thought this was cloud, but it isn’t

This one has weirdness down the right hand side.

It’s here too

I don’t think it is problems developing because that would lead to dark marks, and these are light. I think some light is sneaking down the side of the dark slide and getting onto the film. It might be time to invest in some new felt here and there…

Photo Processing Hardware Meetup 12th November

Another fun meetup. With working, wandering robots. But at the next meetup the focus will be on photography (see what I did there?). I’ve been playing with “one-shot” developer, which makes developing black and white photographs as easy as it can be. At the next meetup I’m hoping we can take some pictures on film and then develop them during the evening. Should be fun. That will be on the 12th of November.