Repairing a Broken Multimeter Part 2

In Repairing a Broken Multimeter, I identified a faulty capacitor C18 and desoldered it from the board. I wasn’t sure what its purpose was and what to replace it with. Recently one reader, Marcin, who’s interested in how multimeters work emailed me telling me that C18 is used in capacitance measurement, that the correct value is 1nF and that it helps with linearity for values lower than 4nF. I opened my multimeter and looked at the datasheet again.
Read more...

Nix Notes: Overriding Haskell Packages

Setup In one of the projects, I use a pinned version of nixpkgs based on miso. There are two advantages to that, one is that I know that miso builds with that version, and the second one is that I can take advantage of miso’s cachix cache and not compile everything from scratch. In the most basic form, it looks like this. File nixpkgs.nix: let bootstrap = import <nixpkgs> {}; misoTarball = bootstrap.
Read more...

Quick Haskell Trick

The Haskell REPL (Read Print Eval Loop) - GHC interpreter, ghci invoked with: $ ghci or: $ stack repl or: $ cabal new-repl or: $ cabal repl is an environment enabling fast iteration. You can test a particular function and that’s cool and all, but you can also run an entire program in the interpreter. You do that with: ghci> :main or ghci> main The flow is as follows:
Read more...

Fixing Yakuake Shift+Tab

I upgraded my Ubuntu recently from 19.04 (Disco) to 19.10 (Eoan Ermine). At some point, I noticed that Shift+Tab stopped working in vim. I use nvim and have Tab configured to move to the next tab and Shift+Tab configured to move to the previous tab. Tab worked, Shift+Tab didn’t. It’s two lines in my .vimrc: nmap <Tab> :tabnext<enter> nmap <S-Tab> :tabprev<enter> Maybe it’s nvim? At first, I suspected it’s a problem with nvim since I upgraded it as well and there is some old article mentioning how to get Shift+Tab to work.
Read more...

Repairing a Broken Multimeter

In December 2017 my multimeter broke. It no longer measured resistance correctly. For low resistances, the numbers looked alright, but with bigger resistances, the value didn’t go higher than about 40kΩ. I only had one multimeter, so I didn’t have anything to compare against, so how did I determine that it’s broken for sure?

It seemed to measure 1kΩ accurately, so I used Ohm’s Law and connected 10 of the 1kΩ resistors in series. It read about 7kΩ. Uh, oh.

I ordered a new one, same model. I complained to my friends on Facebook and got some pity likes. I didn’t know much about electronics, so I accepted that the old one is broken and only trusted the new one. Until it broke as well. In a similar way.

How did I break it? To be honest, I don’t know. I assume it was a user error. If I had to guess I either tried to measure the resistance on a powered circuit or tried to measure current with the red lead still in the Voltage/Resistance socket.

Last year I asked Santa for a different multimeter as I was tired of buying them myself. After learning some more electronics theory I decided to take a look and try to fix it.

Read more...

Why did no one tell me about gdb-add-index?

I’ve been exploring TensorFlow internals in the past couple of weeks. Doing that required me to run some python scripts with a debug version of TensorFlow, set some breakpoints, examine some values, modify the script, repeat. You know, general sleuthing. TensorFlow core functionality is written in C++. The python package is a wrapper around C++ code + libraries at the python layer. The way that python interacts with TensorFlow core is by loading a shared object.
Read more...

Debugging a Safe Module

TL;DR: change -XSafe to -XTrustworthy. I’ve found myself needing to add some trace statements to System/Environment.hs. The module is marked Safe, so when you try to: import Debug.Trace (trace) you get the following error: Debug.Trace: Can't be safely imported! The module itself isn't safe. I don’t know anything about Safe Haskell and I didn’t want to learn at the time. Removing {-# LANGUAGE Safe #-} made the Safe modules depending on System.
Read more...

A Hacky Way to Send Notifications From a Development Machine on iTerm2

When hacking on something in a language that’s compiled, some compiles take a long time. So long that it doesn’t make sense to wait and watch it. You can do some lightweight tasks in the meantime - respond to emails, review diffs… The problem is, unless you leave your terminal visible, you won’t know it’s done the moment it is done. The solution is to send a notification once it’s compiled.
Read more...