Polaroid Miniportrait - four pictures in one

Got given this today. Well, it was free with another camera I bought. But what a beauty! It’s a Polaroid MinPortrait which was made for taking passport pictures and the like. You can set it to take four shots at the same time, giving four identical pictures, or you can take individual or dual images. It has ultrasonic focusing, a beefy flash (that works) and it is all round awesome. Only snag is that you can’t get the film for it anymore. But I’ve got plans involving Instax Wide instant film. Great fun.

Python Shorts 18: Unpacking tuples and passing them as arguments

Tuples are a great way to group data together. Say I want to pass into a function the minimum and maximum values for a particular random item. Say I was writing a function to draw stars, and I want to make random ones with points in the range 5 to 20. I can make tuple like this to express the requirement.

points_min_max=(5,20)

This makes me a tuple with the two values. However, when I call random.randint from the random library it wants two individual arguments. I could do this by getting each value out of the tuple and passing it into the call:

random.randint(points_min_max[0],points_min_max[1])

This is not very elegant, and it would be a real pain if I wanted to pass lots of tuple values. So, instead Python lets you do this:

random.randint(*points_min_max)

We just have to specify the name of the tuple variable, preceded by a * which in this context means "unpack". When the function or method is called Python will convert the values in the tuples into individual arguments and then pass those. The order of the arguments matches the order of the values in the tuple.

You can find all the Python Shorts here.

Fun with Fonts in FreeCAD

I hate it when reality breaks. I hate it when I have two facts, both incontrovertible and mutually exclusive. It happened today in FreeCAD. I’ve got a program that makes 3D wordsearches. At one point the program goes off and finds a font file it then uses for character designs. I wanted to make a version that runs on the Raspberry Pi, so I did some due diligence (had a look in the fonts folder on the Pi) and found a path to the font file I wanted to use. I then put that path into my program and expected it to just work. It just didn't. The font file was not found. Which was annoying. After I’d convinced myself that the filename was correct (which took a while) I  asked FreeCAD to show me the files it could see in each environment:

Shurely Shome Mishtake..

The screenshot above shows what I got. In the console at the top you can see the files that the Raspberry Pi has in its font folder. Underneath you can find the files that a Python program running in FreeCAD can see. I’ve got two different views of what should be the same part of the file system. Wah!

After a few minutes I figured it out. The easiest way to get FreeCAD to run on a Raspberry PI is to install it as a Flatpak application. I even explain how to do it here. It works a treat. Unfortunately, Flatpak exposes a different reality to programs that run within it it. This is all to do with making them portable across different platforms. So my fonts weren’t where I was expecting them to be. All I had to do was use a font path which made sense in the Flatpak universe and all was well.

There’s useful lesson here. If things don’t seem real, it might be because your program might be running in a different reality.

Lego's new Smart Brick looks fun

Lego have just launched a new Smart Play system. It’s based around a Smart Brick that contains an embedded processor which enables the brick to make sounds, flash lights and react to movement. They’ve created a custom ASIC (Application Specific Integrated Circuit) to control everything and added wireless charging for the tiny internal battery. The charging coil used to get power into the brick is also used for brick-to-brick communication and to talk to the other two components in the system, plates and minifigures which contain NFC (Near Field Communication) chips. Plus, and this is the really interesting part for me, the charging coils can also be used to allow one smart brick to tell the location of another.

The less interesting part for me is that none of this is programmable, at least at the moment. The bricks run custom firmware which executes built-in routines triggered by external events. This means that you are limited to what behaviours have been hard wired into the devices and so that the kit has much more in common with the Lego Mario smart devices than with Lego Mindstorms. However, there is also a Bluetooth interface in each brick which can talk to an app, so maybe in the future your might be able to string together behaviours to bring your ideas to life.

The first Lego Smart Play sets come out in March and you’ll be able to reserve them in a couple of days. But you’ll need deep pockets. The sets are all Star Wars branded, which means that as well as a smart premium you’re also paying extra for licencing. I’m still tempted though…

Developing Nicely

Always fancied one of these cars, but I don’t think I’d fit into it

We spent some time yesterday developing colour film. This went surprisingly well and I really like the results. We used these chemicals which make colour development as easy as black and white. We did the first batch of prints at the end of November. It’s nice to know that the chemicals keep for a reasonable time.

Given the pip

When is a dishwasher not a dishwasher? In our house it’s around half past three in the afternoon when you open the thing and find lots of plates still with food still attached. Very much a first world problem, but still a bit irritating.

Today I thought I’d have a go at fixing it, just in time for Christmas next year. Or something. I took off the “spinny things that spray water” - I’m sure that’s their proper name - and had a look a them. Turned out that one had filled itself up with lemon pips. These had escaped from gin and tonic glasses and found their way into the pipework, ending up in a position to block the water flow into the jets which clean the plates.

There’s a pro-tip here. If your dishwasher isn’t a dishwasher, make sure that nothing is blocking the flow. In theory there are filters to stop this kind of thing happening but as we all know, theory and reality are not always the same thing.

Slow Flash Sync on Christmas Eve

I’ve spotted at least two chocolate decorations..

Apparently “slow flash sync” is all the rage this year. You take a long exposure giving time for the lights in your picture to show up in the image and maybe wave the camera around a bit. Then, at the end of that you take a flash photograph, which lights up everything else in the picture and freezes it. Qute fun.