Author Archives: Justin Paulin

HackTheNorth 2017: An Overview Of Our CockroachDB Cluster Monitoring Tool

A few weekends ago, I had the opportunity to work with CockroachDB at Hack the North in Waterloo. For those of you who aren’t familiar with CockroachDB, it’s a scalable and resilient SQL database that’s very easy to setup and manage. Together with my team, I worked on a tool called CockroachNest to automatically monitor distributed CockroachDB nodes in a single cluster.

Our CockroachDB Monitoring Tool

Our CockroachDB Monitoring Tool

CockroachNest was designed to connect to any single node in a CockroachDB cluster, and using Cockroach’s built-in API, automatically monitor all of the nodes within the cluster without requiring any changes in the monitoring tool, even as nodes were added or removed from the cluster.

To collect data, we used CockroachDB’s built-in status APIs (which are available by default on port 8080 on any Cockroach node), particularly /_status/nodes to get a list of all nodes in the cluster, and /_status/problemranges to find errors on each individual node. At first, we ran into issues with timeouts when checking the problemranges endpoint, but those were solved after some help at 1am on Sunday from an engineer at CockroachLabs who told us that querying problemranges on each individual node with node_id as a GET parameter would prevent large response times on the problemranges endpoint when one or more nodes were down. Thanks Bram!

To present collected data, we performed geo-lookups of each node’s IP address and added a coloured icon (red for dead, green for alive) for each node to a map, showing it’s location, uptime, and any other relevant information. These icons were updated in real-time as monitoring data was refreshed from the individual Cockroach nodes. For an extra layer of monitoring, we also integrated PagerDuty, adding an incident whenever a node’s status went red using the node’s name as an incident key (for de-duplication) for when users weren’t actively watching the map.

Overall, we learned a lot setting up, using, and integrating CockroachDB, and I’m looking forward to using it in the real world now that it’s been added to my proverbial developer’s toolbox.

The Hello Machine, 1974

This is an incredibly well-made short, wordless film-poem that touches upon the manufacture of a Western Electric 1ESS phone switch. It’s amazing how much work went into one of these – truly a feat of engineering, and definitely worth a watch. If you’re interested, there’s also quite a library of other interesting historical telephone lore on AT&T’s archive channel.

NES 1001 in 1 Pirate Multicart Teardown and Game List

When purchased new from Pacific Mall in the 1990s, this bootleg Nintendo NES multicart included a handy paper game list. As I’ve seen other people with this same cartridge online, but with no complete game list, I’ve scanned and uploaded a copy here.

Front

Front

Back

Back

As for the games on the cartridge, it’s pretty much the same 20 games repeated over and over again; with each different copy of each game using different icons for the characters and worlds. Some game copies also have a cheat menu.

Looking at the cartridge board itself, it seems to be a Japanese Famicom game board with a pin converter connected to make it compatible with the North American NES. On the Famicom board, there’s an 8Mbit EPROM and another unidentified ROM chip.

Front Board View

Front Board View

Front Board View

Front Board View

Rear Board View

Rear Board View

Quite an interesting piece from the early days of video game piracy.

How to Enable Thumbnail Image Previews in Crunchbang Linux

Now that I’m running single-boot Crunchbang Linux on my desktop, I figured I might as well write a couple of tutorials on making some simple tweaks to customize the OS making it both more convenient and easy to use.

In this tutorial, I’ll go over how to enable thumbnail image previews in the default file manager without installing any additional apps or going through the command line. Although making this change is quite easy, it took quite a while to find a simple answer, as there’s a lot of info on the Crunchbang forums that can be somewhat unclear or misleading; so I figured I’d publish this. As a bonus, I’ll also include how to make files open with a double click rather than a single click.

Step 1: Open Thunar (the file manager) and go to Edit -> Preferences:
imgpreview1

Step 2: Check the show thumbnails box:
imgpreview2

Bonus Step 3: Go to the Behaviour tab in the same window and check the Double click radio button:
imgpreview3

…and that’s it!

Storing Game Boy EPROM Prototype Cartridges

Through trial and error, I’ve found that Sega Game Gear cases are perfectly sized to store Game Boy prototype cartridges. With them, you can stack and box Game Boy prototypes without worrying about damaging the cartridge or EPROM. Just something I thought I’d share.

There's a little bit of room on the sides of the case, but other then that, prototypes fit nicely.

There’s a little bit of room on the sides of the case, but other then that, prototypes fit nicely.

Closed Case

Closed Case

A Webmaster’s Worst Nightmare

Woke up to all this in my inbox today. It was much scarier in person.

A failed update corrupted some important configuration files.

A failed update corrupted some important configuration files.

Dirt Cheap Dirty Boards (DirtyPCBs.com) Review

After seeing the post about DirtyPCBs last month on Hacker News, I decided to give them a try and ended up ordering some prototypes of a basic Arduino matrix shield that I had been working on in KiCAD. When I placed my order on April 10th, 10 5cmx5cm boards cost me $12. Looking at the site now, it seems that prices have risen by $2, however, there are now large quantities and stencils also available.

Order Confirmation

Order Confirmation

Ordering was simple, and I used the same Gerber export settings that I had used with SeeedStudio in the past, along with this Perl script to merge the non-plated drill hole file that I needed for panelization slots with the main drill file (as DirtyPCBs would only accept a single drill file, and KiCAD outputted two separate files). I also renamed the board files to match EAGLE’s export names (which is what they required, as listed on their about page). Since two of my boards could fit onto one 5cmx5cm board, I simply used a single, long, non-plated slot so that I could place two boards onto one, and break them apart easily once manufactured. The ability to choose a different colour solder mask instead of the standard green for no extra charge was a nice feature, as I could match the colour of the shields to the colour of the Arduino itself.

I received the boards a little under a month later, on May 6th. As for the quality of the boards, I was very impressed. For the price and from what I expected based on what was described on the site, I wasn’t expecting much. However, almost everything turned out perfect. There were a few minor imperfections on the silkscreen, however, nothing that was really noticeable unless you were looking closely. I actually received 12 boards instead of 10, and the e-tested boards were marked on the side in black marker. One of the boards had a damaged solder mask, but there were extras, so no complaints there. A small order number was placed on the corner of the silkscreen by DirtyPCBs.

Here’s what I received:

I sure hope the mailman knows what PCBs are...

I sure hope the mailman knows what PCBs are…

Order label

Order label

What I received

What I received

Front view

Front view

Back view

Back view

Side view

Side view

Assembled board. I'm not very good at SMD soldering...

Assembled board. I’m not very good at SMD soldering…

Assembled board

Assembled board

Testing the assembled board

Testing the assembled board

Overall, I’m very pleased with what I received, and if you don’t mind the 30 day wait, would recommend DirtyPCBs to anyone looking for cheap prototype boards.

Testing a Texas Instruments TI-99/4A Without Power or Video Cables

I bought this TI-99/4A computer along with around 70 games, 2 monitors, and a Milton Bradley MBX system at a garage sale a few years ago. If I recall correctly, the seller used to be a Regional Manager for Texas Instruments in the 1980s, and used it as his personal computer during that time. The whole set cost me around $90, however, it didn’t include the power or video cables, so I couldn’t test anything before I bought it.

The set

The set

While cleaning out my basement last week, I rediscovered the whole set and decided to take it for a spin. Since the TI-99’s AC adapter outputted AC power and I don’t currently own a variable AC supply, I decided to just disassemble the computer and bypass the internal power supply completely by connecting DC power directly to the motherboard.

Prior to disassembly

Prior to disassembly

After unscrewing the bottom of the case and removing the power supply, I was able to locate the power connector to the motherboard. According to the silkscreen on the power supply board that it was plugged into, the voltages required were +5v, -5v, and +12v DC. With that in mind, I configured 3 variable DC power supplies so that they shared a common ground and outputted the correct voltages. I then used jumper wires to connect the supplies to the computer.

Power supply board - Not exactly the clearest picture, but you can see that the output pinout shows the voltages.

Power supply board – Not exactly the clearest picture, but you can see that the output pinout shows the voltages.

Power supply configuration

Power supply configuration

How to create two positive voltages with a common ground (these supplies have reverse-voltage protection diodes built in)

How to create two positive voltages with a common ground (these supplies have reverse-voltage protection diodes built in)

How to create a negative voltage with a common ground (these supplies have reverse-voltage protection diodes built in)

How to create a negative voltage with a common ground (these supplies have reverse-voltage protection diodes built in)

The connected computer

The connected computer

With the power supplies connected, I began work on the video. I found an old Commodore 64 monitor, and was able to use that for testing since it supported composite video input and mono sound. I also found a 5-pin DIN cable (like those used with old audio equipment), and matched the pinout of the video jack to that of the DIN cable. I’ve included a picture of the pinouts below. Before plugging anything into the monitor, I also measured each end of the cable with a multimeter to make sure I wasn’t about to plug +12v into the monitor’s video or sound jack (the TI-99 has +12v on one of the video pins to power the RF modulator box that was sold with the system). With everything verified, I connected the correct ends of the video cable to the monitor, and powered up the supplies.

DIN Cable Pinout

DIN Cable Pinout

TI-99/4A Video Jack Pinout

TI-99/4A Video Jack Pinout

Coloured ends used on the DIN cable

Coloured ends used on the DIN cable

The connected computer

The connected computer

It works!

It works!

As I had hoped, everything ended up working fine. I had some fun with a few cartridges before putting everything away. I also got the speech synthesizer working with the TI Extended Basic cartridge (Command: CALL SAY (“HELLO”) in TI Extended Basic).

Main menu

Main menu

Hello, World!

Hello, World!

This cartridge had great intro music

This cartridge had great intro music

I had absolutely no idea how to play this game...

I had absolutely no idea how to play this game…

TI Invaders

TI Invaders

A-MAZE-ING! I spent the most time playing this game by far.

A-MAZE-ING! I spent the most time playing this game by far.

Before putting everything away

Before putting everything away

Quite an interesting “blast from the past”.

Converting a Merit Radion Force Countertop From CRT to LCD (Without The Official Kit)

During a recent auction, I purchased a Merit Radion Force game system with a dying monitor. As the monitor was unusably dim at maximum brightness settings even under dim light, the cathode gun was likely on it’s way out; and a repair would cost many times more than what I paid for the machine itself. So rather than sink any money into it, I converted the whole machine to LCD using an old Samsung 15″ monitor with an external power brick supply that I hadn’t used in years.

Auction pictures showing the dim monitor.

Auction pictures showing the dim monitor.

Auction pictures showing the dim monitor.

Auction pictures showing the dim monitor.

Auction pictures showing the dim monitor.

Auction pictures showing the dim monitor.

Auction pictures showing the dim monitor.

Auction pictures showing the dim monitor.

You’ve probably seen a counter top like this, although likely a newer model, in a bar or restaurant. Essentially, they’re designed to sit on a bar-top and play a collection of touch screen games. Each game costs anywhere from $0.25-$2.00 to play, which gives you around 2 minutes of play time. This breed of arcade machine is dying, with the largest manufacturer Merit having announced their shut down 2 months ago; likely thanks to smartphones which run similar games for free.

Anyhow, onto the repair. After giving the whole system a wipe-down and compressor dusting to clean it up, I disassembled the entire plastic shell assembly, leaving just the steel frame and electronics on the base. With the plastic out of the way, I disconnected the power cable to the monitor board, the touch screen’s serial cable, as well as the VGA cable (the whole machine is basically a computer running a custom version of Linux, and is built with all standard parts), peeled away the black duct tape holding the touch screen in place, and removed it from the monitor. The touch screen is made of glass, and is very fragile, so should you attempt this repair, be careful where you place it. After that, I unscrewed the monitor, and pulled it out of the cabinet by unlatching the board from the base. All of the parts were nicely designed to be “snap-in”, so removing it didn’t take long at all. Should you attempt this fix yourself, when removing or working near a CRT monitor, always be sure not to touch any electronics on the board, or attached to the tube (for example, the anode on top). As I’ve said before, the high voltage capacitors on the board are charged and are extremely dangerous if touched. Look up how to discharge monitor capacitors, and follow those instructions before continuing; and DO NOT attempt this fix if you aren’t comfortable working with them.

With the old monitor out of the way (I boxed it up and dropped it off at the local electronics recycling depot), I began preparing the LCD monitor for the switch. I disassembled the case, leaving only the monitor and control panel board, and mounted it where the old monitor was; using picture hanging wire fed through the old screw holes to keep it in place. With the monitor securely in place, I added about an inch of double-sided mounting tape (Dollarama sells it) to all four edges of the monitor, and covered the mounting tape in black duct tape to camouflage the tape with the plastic case. This mounting tape “shield” served to prevent the glass touch screen from scratching against the monitor’s metal edges, and raised it so that it was securely in place along the plastic front casing (which was slightly raised, since the old CRT extended further out of the cabinet.

How the monitor was secured (with duct tape!) and connected

How the monitor was secured (with duct tape!) and connected

With that done, I mounted the touch screen, securing it to the monitor with more black duct tape, and reconnected the monitor. Lucky for me, the LCD monitor’s external power brick fit nicely within the cabinet, and used the same plug socket, so that didn’t need to be changed at all. I taped it down to the base, so it wouldn’t slide around while moving. With everything reconnected, I reassembled the plastic shell, and powered it on.

Motherboard and connections

Motherboard and connections

Side view of the mounted monitor

Side view of the mounted monitor

Finished and mounted monitor

Finished and mounted monitor

Moment of truth

Moment of truth

It's ALIVE!

It’s ALIVE!

This game extended my post-repair testing by at least 30 minutes

This game extended my post-repair testing by at least 30 minutes

Another game

Another game

Everything worked fine, and after a quick recalibration, the machine looked and played almost as good as new. The total cost for the repair? About $5 in tape and picture wire, as well as a monitor worth around $15 on Kijiji. Not a bad fix, if you don’t mind the look.

Android FTP Server Project – How to Give Apps Write Permissions to External Storage Devices

I recently purchased an inexpensive ($35~ on FastTech.com) Android Mini PC to replace the old Windows XP computer I had running an FTP server for offsite web server backups. It’s smaller, more secure, and uses a lot less power than the old computer did. However, with the stock Android ROM on the device, writing to external storage devices (for example, a USB drive) with apps was disabled. To solve this, I temporarily rooted the device and modified the permissions file, which worked perfectly. In this post, I’ll go over exactly what I did to get the permissions working.

What I received from FastTech - Dime is for size reference.

What I received from FastTech – Dime is for size reference.

Specifications

Specifications

Close-up of the Mini PC itself. It's actually designed to be used as an HDMI TV Media Stick (Similar to the Chromecast).

Close-up of the Mini PC itself. It’s actually designed to be used as an HDMI TV Media Stick (Similar to the Chromecast).

After connecting the device to my computer (make sure you use a USB data cable, the cable that comes with the Mini PC is power only), I was able to use the Android Debug Bridge (ADB) within Android’s developer tools to temporarily root the device. To use ADB, download and install the Android SDK from Google’s website.

Once I had shell access on the device, (Commands: ./adb remount, ./adb root, ./adb shell in that order), I navigated to the folder containing the platform.xml permissions file (Command: cd /system/etc/permissions), and displayed its contents so that I could edit them later (Command: cat platform.xml). With the contents of platform.xml copied, I was able to logout (Command: exit), and in a text editor, added write permissions by changing these lines:

1
2
3
    <permission name="android.permission.WRITE_EXTERNAL_STORAGE" >
        <group gid="sdcard_rw" />
    </permission>

to this:

1
2
3
4
    <permission name="android.permission.WRITE_EXTERNAL_STORAGE" >
        <group gid="sdcard_rw" />
        <group gid="media_rw" />
    </permission>

After saving the new platform.xml file, I uploaded it to the device with ADB (Command: ./adb push “PATH_TO_EDITED_PLATFORM_XML_ON_YOUR_COMPUTER/platform.xml” “/system/etc/permissions/platform.xml”), logged back into the shell, and viewed the files contents again to make sure the changes were saved successfully. With that confirmed, I rebooted the Mini PC, and was able to write to the USB drive from apps that I previously couldn’t.

Great success!

In order, the commands I used were (from the directory that adb was located in):

  1. ./adb remount
  2. ./adb root
  3. ./adb shell
  4. cd /system/etc/permissions
  5. cat platform.xml
  6. exit
  7. ./adb push “PATH_TO_EDITED_PLATFORM_XML_ON_YOUR_COMPUTER/platform.xml” “/system/etc/permissions/platform.xml”
  8. ./adb shell
  9. cd /system/etc/permissions
  10. cat platform.xml
  11. reboot (ONLY AFTER PLATFORM.XML WAS CONFIRMED TO HAVE BEEN SUCCESSFULLY UPLOADED)

Please note that this was done on a Mac, and may not work if you’re on Windows. Linux commands should be the same.