JSTimers is not a registered callable module

This can happen if you have two versions of react-native installed. I use yarn to install dependencies, and normally fix this by adding a resolutions section to my package.json:

  "dependencies": {
    "react": "16.9.0",
    "react-native": "0.61.5",
  "resolutions": {
    "@types/react": "16.9.0",
    "react": "16.9.0",
    "react-native": "0.61.5"
  "devDependencies": {
    "@types/react": "^16.9.0",

Make certain that the versions are consistent — otherwise multiple versions may end up installed by react and some of those versions will not be able to connect to the native dependencies, resulting in an error like JSTimers is not a registered callable module or Module RCTDeviceEventEmitter is not a registered callable module.

Working Goldfish

Our goldfish have returned indoors after another successful summer of eating mosquito larvae in the water lily pond (a 25 gallon plastic tub). I overwinter the water lily bulb in a 5-gallon bucket that’s loosely covered in the basement.  Then in March I fill the outdoor pond and put the lily in the bottom.  I wait until I see a few larvae swimming in the pond before I put the goldfish out. That first day they gorge themselves on all the larvae.  We’ve had these two 5-cent comet goldfish for 10 years now. They absolutely thrive in the bucket all summer, and nary a mosquito larvae survives while they’re on duty. I don’t feed them at all — enough bugs and leaves and algae and who knows what comes along that they are fat as can be all summer. Every November I chip them out from beneath the frozen water and bring them inside.  Let them temperature acclimate in their own pond water in a bucket inside for 24 hours.  Then carefully net them into the aquarium that’s been running empty all summer. They live inside all winter — we do feed them now of course — no random bugs dropping in while inside (I HOPE).

Their names are Harold and Henry.

React-Native Viewpager

Android has a view called a “viewpager”. It’s sort of like iOS PageViewController. There are several efforts to bring this to react-native as a cross-platform solution. rn-viewpager is now abandoned, even though it worked great. react-native-app-intro-slider is interesting, but seems special purpose for doing welcome screens — it doesn’t allow other interesting use cases because it seems to assume it’s always the full width of the device window. react-native-viewpager is another one but it’s Android only.

One that seems often overlooked is good old tabview. This can be customized so that the tabs themselves look like paging dots and it already has a nice “viewpager” style animation.

So next time you’re googling for react-native viewpager, maybe consider tabview as an easy solution. It’s well supported by the community and doesn’t have as big a risk of being orphaned like rn-viewpager was.

“Cannot connect to iTunes Store”

If you’re trying to test a new in-app purchase on iOS, and you get this mysterious error:

Error Domain=SKErrorDomain Code=0 "Cannot connect to iTunes Store" UserInfo={NSLocalizedDescription=Cannot connect to iTunes Store}

… make sure you’re using a real device. This error will be given if you try to complete a purchase in the Simulator. That’s right, although you can list purchases in the simulator, actually buying something with a Test user in the sandbox environment will simply fail with this vague error.

Arduino without the Arduino

AVR ATMega328P controlling multiple stepper motors

I built a custom PCB to host a ATMega328P in DIP form factor. I want to control two stepper motors for a project. I considered doing it “the hard way” : E.g. using my own driver transistors and protection diodes… and I’ve also ready about a variety of silicon that makes driving them easy. But I’m still not ready to learn to do surface mount soldering, and I wasn’t finding any stepper motor drivers in DIP configuration. So I opted for something I’ve used on other projects, the “Easy Driver” from SparkFun.

A few of the features of this PCB is the 6-pin header that allows for it to be programmed using the linux command-line tool avrdude. I found that avrdude runs on raspberry pi, and I have one unused in a drawer. My plan was to make it so I could slide the pcb right onto the GPIO of the pi. But I neglected to consider the height of the various components on the pi, so I had to opt for use wires to hook it up instead… Not elegant but functional.

The wifi went out on my pi (which is why it is in a drawer). So I used a internet sharing on my mac to connect to it using a thunderbolt ethernet adaptor. I ssh into the pi, and use avrdude to upload to the PCB with the ATMega328p. I have a simple makefile that compiles my “C” program using avr-gcc.

The PCB was printed by OSH Park. First time using the Eagle software and first time getting a PCB made. It took about 2-3 weeks for the PCB to arrive…

It’s a beautiful board. I don’t think I’ll ever build something out of a generic perf board again.

I made some mistakes:

  1. The vias for my Easy Driver were too small to use regular wire. But I had some resistors with thin enough leads I could use those.
  2. For some reason my status LED’s weren’t actually grounded. I soldered a jumper wire
  3. The problem with the programming connection for the pi I mentioned before
  4. I’m sure I think of some others.

But the fact that the thing actually drives a motor is kind of amazing….

gitflow tools on github

We’ve adopted gitflow for one of our projects. The git command line tool integrations found on github are very handy. Note: be sure to adopt the -avh version of the tools found in this repo: gitflow for git on github. To install on Mac OS use `brew install git-flow-avh`. The non `-avh` version of this tool is 7 years out of date — we mistakenly used that version initially and ran into bugs that have been around for many years (and which are fixed in the `-avh` version).

Watching program flow in a time-sensitive situation

I’m working on some unit test in Java (well, Kotlin) for an Android project. When I set a breakpoint, the failure mode changes because there are timeouts and races going on. This is not an ideal situation, but I’m debugging someone else’s code here. So I found a clever way to log what code is getting called, and from where, by using breakpoint actions. Just put `new RuntimeException().printStackTrace()` in as a breakpoint action! Now your log shows when code got hit, and why it got there, but doesn’t actually stop execution, so it does less intrusive shift to the timeouts and race-conditions.