Fiddlingshttps://blog.gcawood.com
Gareth's Random Blog of FiddlingsTue, 27 Feb 2018 15:50:24 +0000en-UShourly1https://wordpress.org/?v=4.9.417903858SA Driver’s Licence FAQhttps://blog.gcawood.com/2018/02/27/sa-drivers-licence-faq/
https://blog.gcawood.com/2018/02/27/sa-drivers-licence-faq/#respondTue, 27 Feb 2018 05:31:17 +0000http://blog.gcawood.com/?p=2380Continue reading →]]>With several different posts detailing some of the intracacies of the South African Driver’s Licence system, a number of questions get repeated. This post aims to address some of the most common questions.

Frequently Asked Questions:

South Africa no longer has Code 8, 10 or 14 licences. In 1998 they were changed to the A, B, C, E format. You can see a comparison of before and after equivalents here. You can see what all the modern licence codes allow you to drive here.

I was arrested, charged, plead guilty to, arrested 2, 3, 5 years ago, can I get a PrDP?

You are unlikely to be approved for a PrDP if you were convicted, or plead guilty to any criminal offence in the last 5 years. That includes signing an admission of guilt. Usually this does not include ‘minor’ traffic offences such as parking or speeding tickets, assuming you were not convicted for reckless or negligent driving. If you were just arrested, or charged, but never actually convicted, you should be able to get a PrDP.

I am driving a bakkie, quantum, van, ford f150, truck do I need a PrDP?

It depends. If it’s a commercial vehicle, yes. If it has seats for more than 11 people, yes. If you are transporting people as part of your work, yes. Still not sure, read this article.

I have a code B, EB, C1, EC etc licence, and I want to get a code A, EC1 licence, etc do I have to redo my learners?

Yes. Regardless of what licence you hold, if you want to get a new licence of any code, you need to do a new learner’s licence for that code.

I am 18, 20, 25 years old, can I get a PrDP?

The minimum age for a PrDP licence is 18 for a G licence, 21 for a P licence, and 25 for a D licence.

]]>https://blog.gcawood.com/2018/02/27/sa-drivers-licence-faq/feed/02380Lego! For adults?https://blog.gcawood.com/2018/02/12/lego-for-adults/
https://blog.gcawood.com/2018/02/12/lego-for-adults/#respondMon, 12 Feb 2018 05:46:21 +0000http://blog.gcawood.com/?p=2371Continue reading →]]>When I was younger, I was fortunate enough to get to play with a fair amount of Lego. An older brother meant I started out with a decent sized selection and was able to grow that as I too grew up. I would occasionally get new sets, but mostly made do building all kinds of things with the variety of Lego I had. I was usually encouraged to put money I received for birthday’s and things into my savings account, but remember winning some money in an art competition (go figure), and my Mom allowing me to buy a new Lego set. A special treat. I’m quite sure I used the whole amount R300ish to purchase the Res-Q Hovercraft 6473 set.That’s probably the last set I can recall receiving. It would have been 1998 some time. And while I enjoyed building the set; once it was completed and played with, it got torn apart for scraps, to be used in other developments. I can’t recall any set I received since then. My parents stocked me up on miscellaneous blocks for the various fortifications I built, and I continued to build occasional Lego items through high school. But little thereafter.

20 years later, I have money I can spend. The money was a gift, so with minimal effort I can convince my wife that it’s okay for me use it to buy Lego. But what to buy? The selection is truly huge, with wonderful NASA creations, various vehicles, the whole Technic selection. How does one decide? Eventually I settled on set 42043, a Lego Technic set of a Mercedes-Benz Arocs 3245. Partly as an homage to my previous employer, partly because it was close to 3000 pieces and reasonably priced, and partly because I have a fascination with trucks and large vehicles in general.

Little could I contain my excitement when Amazon delivered my first new Lego set, me in my late 20s. I knew this was a fairly large build, but was still amazed by the weight of the box, coming in at over 4kg. The build took a fair amount of time, but I was able to complete it in a few days in my free time. It was a hard battle between wanting it to be finished and wanting the build to take as long as possible.

Instructions are mostly clear, and I only made a few minor mistakes along the way. The instruction book has over 460 pages. But it was fun. It’s not especially difficult, you just follow instructions, but it was a nice way to shut off after a long day at work. Building is a methodical balance between reading the instructions, searching for the part on my limited work surface, and then fighting some of the parts to fit.

Looking at the Lego 42043 set itself, I was quite impressed with some of the technical implementations. I had previously built a much smaller technic set, whose most advanced feature was a piston block and a rack and pinion gear train for steering. This truck has independent suspension, two differentials and two-axis steering. Additionally there’s a battery powered DC motor that supplies power to a number of devices. Under the drawbed is an array of gears and gear selectors, similar to those in function on a manual gearbox.

These allow you to separately actuate:

the lifting and dropping of the drawbed

the extensions and retraction of the stability arms

rotate the boom arm

power the pump for the pneumatics.

The pneumatic pump then (although obnoxiously loud) supplies pressure to four pneumatic actuators on the boom arm that allow you to:

lower and raise the boom arm (two separate sections)

extend and retract a section of the boom

open and close the scoop.

Along with this are a number of other smaller features. What impressed me the most was the attention to detail and how all these features come together.

My least favourite part of the whole build, was putting the tires on the wheels. There are 12 wheels, and 12 tires, and you have to push the tires over and get the seals to line up. Not hard, just not as fun as the rest of the build.

My only disappointment of the set, is the pneumatic system. It’s really cool, and was fun to play with. It’s impressive what they’ve achieved, but the boom arm is heavy, and the pneumatic pump is small, so trying to lift the system is slow. In reverse, when gravity is helping, the system will drop instantaneously (yeah compressible fluids). I know why this is, and once you get the hang of it, you can kind of control how fast the boom lowers by limiting how much you adjust the lever.

Having built this set, I’m sure I’ll get another set at some stage, I think I value part count the most, as I want a longer build time, so I’m interested to see what my next set will be. It’s fun, and relaxing to build. I haven’t yet found a place to display my truck, but online there are instructions provided for alternative builds for the same parts. So I see myself tearing this apart and building something new. Also, they provide extra pieces in the set, like spares. Which is concerning when you’re used to building something and left over pieces implying you did something wrong.

Through all this, I’ve not yet answered my title question. And yet I think the answer is obvious. Yes. Lego, for adults. Much like a jigsaw puzzle, I think people of all ages can derive joy from the process of building, and with the huge selection that is on offer, the result can be a model of something you have an interest in. In some ways it reminds me of the ‘adult’ colouring in books that were notably popular a few years ago, albeit more expensive. I think the building can be as therapeutic as colouring in, not requiring much thought, but with a visible result at the end of the day.

]]>https://blog.gcawood.com/2018/02/12/lego-for-adults/feed/02371Fake News makes me sadhttps://blog.gcawood.com/2017/11/06/fake-news-makes-me-sad/
https://blog.gcawood.com/2017/11/06/fake-news-makes-me-sad/#respondMon, 06 Nov 2017 07:29:51 +0000http://blog.gcawood.com/?p=2344Continue reading →]]>While some of the blame for the surge in fake news belongs with organisations such as Facebook; it seems unfair to put it all on them. It’s up to us to do something as well. Mainly educating those around you who may inadvertently share such material.

Over the last few months I’ve come across a few articles to trigger this post. I don’t post much to Facebook, but tend to scroll through my feed several times a week. And with the amount of messed up stuff happening around the world, it’s making it harder and harder to discern what’s fake and what’s real. For whatever reason, it seems to be on Facebook where I notice most of these articles. Whether it’s just because of the number of ‘friends’ I have, or another reason, I see less such posts on other sites I frequent.

The first article I came across had the headline: “Your baby in you can also get pregnant if you have sex while you are pregnant – Minister of Health warns SA women on women’s day”. Now are ministers take a lot of flack for a lot of reasons. Often warranted. But some statements are too unbelievable to be true, which is generally my first indication.

The article is published by a website called “News at Last”. If you really want to check them out, their current domain is newsatlastsa(dot)online. Not believing this could be true, I checked out the website, and did some googling and searching of other news websites. No one else was reporting this. Based on this information, and the lack of any credibility or supporting evidence on the News At Last’s website, I deemed this fake news. Their only contact details are an email address on a domain that WebAfrica have listed as suspended.

More recently was an article published last week by HIN News – hinnews(dot)com. Apparently it stands for Happenings In Nigeria, but their logo looks like someone tried to poorly Photoshop the BBC News logo. Their Facebook page has a concerning million+ followers and likes.

I googled BBC news, and saved the first image. The HIN logo is a pixel for pixel copy of the BBC logo, besides the off-centred and off-colour text edit.

The article in question was titled “Breaking!!FARM MURDERS: US President Threatens To Intervene If South Africa Does Not Come Up With A Solution To Farm Murders.” Ignoring the two exclamation marks, the article was brief and ended with the author’s personal opinion on the matter. Odd for what one would suppose is an unbiased objective report on something that happened.

But it didn’t happen. Well not as far as I can tell. Nor can I find any reputable news site reporting anything related. While I’m about this, I’m going to throw Gossip Mill Msanzi, gossipmillsa(dot)com into this boat as well. They seem to be offering up the same garbage as the others, and whether intentionally or not, no credible news site should be posting articles without verifying the source.

The biggest problem, is these sites intersperse these fake articles with hoards of actual articles which they lift from larger news organisations, attempting to give them a credible appearance on first glance.

I don’t know what the answer is, but I implore everyone to take an extra look at those news articles. Especially the ones with the lovely clickbait titles. It’s hard to know for sure, but if you can’t verify it’s legit, rather don’t share it until you have reason to believe it’s true. On the same note, if you have friends and family posting articles which you know to be false, call them out on it. It doesn’t have to blatant and rude. Send them an email or PM, telling them you think an article they shared isn’t real and the reasons you think this.

I like to think that most of the people I know wouldn’t intentionally post false information, and approach them with that attitude. I want them to think twice next time a similar article comes up.

Since the Logitech K750 was first released, I was a fan. But the $100 price tag put me off. It’s most noticeable feature is the fact that it has a bar of solar panels along the top of the board which are used to charge the built in battery. This should mean you never have to replace the battery. A dream come true to me, who in general is disposable battery averse. Besides that it’s a standard wireless keyboard that uses Logitech’s unifying receiver, I additionally like the style and design of the keyboard.

So joyous was I to find it on a half-price special at some stage, promptly ordering it and enjoying it’s use. Two years later, on returning from a short trip, the keyboard no longer worked. Not registering keypresses, nor activating any of it’s notification lights. The battery is not supposed to be replaced, but is relatively easily accessible, so I popped it out and measured the voltage.

The battery used is a rechargeable coin-cell battery, similar to what is used on motherboards, an ML2032 3.0V battery. My battery measured 2.9V, so I assumed it was still fine, and something else had gone wrong. The keyboard had a 3-year warranty I was still within, so after the retailer rejected me, I contacted Logitech who were kind enough to send me a replacement that continues to work perfectly.

This was over a year ago; in-between a lot has happened, but Logitech didn’t ask me to return the old keyboard, and I couldn’t bring myself to throw it out. I figured I’d salvage the solar panels or something. I found it the other day and decided to take another look. Although the battery comes out relatively easily, the keyboard’s faceplate is glued into place. So to disassemble it you have to pry that off, making reassembly difficult.

After that there are a number of screws to remove, and then the base separates, giving you access to the circuit-board. On the front are a few test-points. With my old battery plugged in, V_BAT showed 2.86 V and V_MAIN showed a steady 2.0 V. I tested some other components but couldn’t find anything notably wrong with the board. Solar panels provided a charge.

So I popped my battery out of my new keyboard, and lo and behold it worked. I measured the voltage and it reflects marginally over 3.03 V. Apparently a 0.15 V drop on this battery is enough to stop the keyboard working. I measured the V_MAIN on the test points, and it showed an match 2.0V, like with the ‘bad’ battery. This also meant my disassembly was completely unnecessary. So with it in pieces, I ordered a replacement battery.

Now I have two working K750 keyboards, although one is slightly disfigured.

]]>https://blog.gcawood.com/2017/11/04/logitech-k750-repair/feed/02331TkInter crashing without errorhttps://blog.gcawood.com/2017/09/28/tkinter-crashing-without-error/
https://blog.gcawood.com/2017/09/28/tkinter-crashing-without-error/#respondThu, 28 Sep 2017 02:52:13 +0000http://blog.gcawood.com/?p=2313Continue reading →]]>I’ve been working on a minor python project recently, and went back to my old friend TkInter. TkInter is the standard GUI library for Python. I had used it previously in another small project, so when I wanted to quickly get a GUI going for a project, it made sense to use TkInter. There are many other GUI libraries, but TkInter is supposedly one of the quicker and easier to get going.

TkInter has a number of shortcomings. It’s clunky and not completely intuitive. But the biggest issues that I experience with it is trying to get the interface to update from an outside perspective. My specific implementation required me to update about 20 values on the GUI by reading data from a serial port.

The easiest way to implement this is to make use of the TkInter Label widget. The Label is used for displaying any kind of text. A label can be linked to a TkInter variable, so that if you update the variable, the label automatically gets updated. The difficulty is that you need an event to trigger an update of the variables.

The way to get around this is threads. Python has built in support for threads, via the Threading class. And so you create a thread, and pass it the Tk variables and update them from the thread. This allows you to continue doing other things in the GUI, and still have your thread run. Or does it.

The immediate issue is with how TkInter queues up tasks. Because the label uses Tk variables, you can only update them by calling a set method. Not just by declaring the variable equal to a value. As such this set gets added to a queue. I found that when I clicked a drop down menu (Tk.OptionMenu), my updates would pause. My thread would effectively pause as it waited to be allowed to call the variable set method.

This was not the end of the world, and I probably would have left it like this if I didn’t continue to have the program crash unexpectedly. It would happen often, but at different times, and only when I was interacting with another aspect of the GUI. For example, when I clicked a button or selected a menu item. The program would freeze, causing the python itself to crash, and not reporting any error.

I battled to find much info on this topic. All I’ve been able to come across is the repeating statement that “TkInter is not thread safe” and that you shouldn’t try to access TkInter widgets, except from within the main thread.

There are a couple ways around this. What I ended up using is the TkInter after method. It’s janky. But it works, and has proven reliable. Since I made the change, I have not had my app crashing any more. Now I have a global variable to store the data from serial in. I have a function within my GUI object that updates the Tk variables from the global array. It then calls itself using the after method.

The after method adds a note to TK to do something after a specific amount of time has lapsed, and appears to operate much like an interrupt, ignoring whatever else I am doing and updating on schedule. I first came across the after method as described by Furas on StackOverflow.

Below is a summary of what I was doing before, and what I am doing now.