Creality Ender 3 Pro: Getting Successful Prints and Ending Frustration

Lots of frustration with the Creality Ender 3 Pro

It’s been about a 10 day journey to getting consistent prints with the Creality Ender 3 Pro. (Amazon affiliate link, but I got it from Creality for cheaper during their Black Friday sale.) Manual bed leveling is an art that there are too many opinions on that… well.. they didn’t 100% work. I tried various gaps from paper thickness to card stock thickness, and while they mostly worked, I would have prints fail at random places halfway through.

Creality Ender 3 Pro fail

Initial Success

I had some success with the Creality Filament (affiliate link) with perfect leveling and some glue stick application, but most prints bailed an hour or two in:

The dog and cat prints did eventually work with specifically the separately purchased “official” filament, but not with the sample white filament that came with it.

Tempered Glass Bed: Amazing for Adhesion

The Dawnblade Creality Ender 3 Glass Bed Upgraded (affiliate link) greatly improved my success with the black “official” filament with the included print files and I was able to print a couple of things from Thingiverse like the Doggie Phone Holder if I started with a raft, but I still ended up a bit warped:

Warped raft

With the glass bed, however, I was able to get the Basics 3D filament (affiliate link) to work with the stock prints:

Maneki Neko print in blue

Creality CR Touch Upgrade: Possibly Better than the Glass Bed?

I bought and received the Creality CR Touch (affiliate link) prior to the glass bed, but installed the glass bed first because it’s much easier. (I later also bought the Ender 3 Pro bed clip clamps (affiliate link) which are mostly unnecessary, but provide cleaner clearance on the ends.)

I suspect that I might not have bought the glass bed if I had the CR Touch first, as the adhesion with the bed is almost *too good*:

Tips for Installing the CR Touch

  • The motherboard is the box in the front left of the Creality Ender 3 Pro. There’s one small screw near the front of the motherboard case (and near the bed rail) and three below. You’ll need to remove all three.
  • Remember to note WHICH VERSION your motherboard is *while you have the case open*… I don’t know if it matters, but if it does, you’ll kick yourself if you close it up before noting it:
  • The firmware is in a zip file for your printer model under accessories on the Creality website
  • You’ll have to turn the printer over to get to the motherboard port you need:
The motherboard access
  • The screws go into the mounting bracket up through the CR Touch and then into the bracket (you’ll be really mad if you fight to get them started the other way, but fortunately, the correct way is easier!):
Mount the CR Touch screws upwards, not downwards!

Here’s a link to the YouTube video that helped me with figuring out the CR Touch install:

Now, Off to the Races!

Getting C64Studio to work with C128 BASIC and Assembly

C64Studio for building more complex projects for Commodore build targets

C64Studio is a .NET based IDE which has some nice macros and dependency linking to connect your BASIC and Assembly files together automatically. Using it with Commodore 128 BASIC and linking the Assembly in add a few extra challenges.

Starting with a template

Sample Project 14 – BASIC and Assembly has most of the settings you need to get going. The keys to this setup

The compile target for the BASIC program needs to have the Assembly file checked as “Dependant” and “Symbols” and that D64 should be the output:

C64Studio setting the Compile Target properties on a BASIC file.
Check “Dependant” and “Symbols”

Set up a “Post Build” step on the BASIC file to add the Assembly target to the D64 image $(MediaManager) -d64 "$(BuildTargetFilename)" -import asmloop.prg -renameto "ASMLOOP.PRG". The .asm extension of the file should be changed to .prg for the post build command.

Post Build step on the BASIC file to add the Assembly file.
$(MediaManager) -d64 "$(BuildTargetFilename)" -import asmloop.prg -renameto "ASMLOOP.PRG"

Right-click your main BASIC source file and make it the Active Element

Active element should be bold after right-clicking and selecting “Set as Active Element”

Linking source itself

C64Studio will expose label references in dependencies in BASIC, so for the following Assembly, ASMSTART, HIBYTE, MIDBYTE, LOBYTE are all available (I haven’t tried .loop or .nocarry, but they are intended to be “local labels”)

;startup address
  * = $0c00
;create BASIC startup
  ldx #$00
  ldy #$00
  lda #$00
  sta $a0
  sta $a1
  sta $a2
  sta LOBYTE
  sta LOBYTE
  lda #$60
  bne .nocarry
  bne .nocarry
  inc HIBYTE
  cmp $a2
  bcs .loop
  stx LOBYTE
  !byte $00
  !byte $00
  !byte $00

In the BASIC file these symbols can be used within curly braces:

BASIC code referencing Assembly labels/symbols

Make sure to use curly braces and select the proper BASIC for your target Commodore. Since I’m targeting Commodore 128, I’ve selected BASIC V7.0. Basic keywords are compiled to two-byte codes, dependent on the version, so if you select the wrong one, some keywords may be treated as variables or use the wrong keyword code and you’ll get bizarre errors. (I initially got “Compile Errors” on my BASIC with no error message and then “Type Mismatch” on my “compiled” BASIC file.)

Compile and Run

You should be able to click “Compile and Run” now if you’ve set up your emulator in the IDE to point at an installed emulator (VICE GTK has been working for me).

URI::InvalidURIError : The scheme mysql2 does not accept the registry part

How you can end up with the URI::InvalidURIError

This error is pretty easy to end up with if you have database URL with embedded username and password, although it’s also possible if you’re using basic auth over https.

Example problem URL

Suppose you have a URL such as mysql2://my-user-name:passwordwith.and#and$init@mymacbook.local:3306/db. The passwordwith.and#and$init will cause an error message:

URI::InvalidURIError (the scheme mysql2 does not accept registry part: my-user-name:passwordwith.and (or bad hostname?))


The above error message ends before the first problematic character (#). These need to be URL encoded (%23 for '#'). mysql2://my-user-name:passwordwith.Eand%23and$init@mymacbook.local:3306/db should pass.

Using Ruby to Quickly validate the URLs

The URI::RFC2396_Parser in ruby can provide a quicker way to validate vs. trying to boot an application dependent on the URL:

Traceback (most recent call last):
        8: from /Users/tpowell/.rbenv/versions/2.7.2/bin/irb:23:in `<main>'
        7: from /Users/tpowell/.rbenv/versions/2.7.2/bin/irb:23:in `load'
        6: from /Users/tpowell/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/irb-1.2.6/exe/irb:11:in `<top (required)>'
        5: from (irb):12
        4: from (irb):13:in `rescue in irb_binding'
        3: from /Users/tpowell/.rbenv/versions/2.7.2/lib/ruby/2.7.0/uri/rfc2396_parser.rb:219:in `parse'
        2: from /Users/tpowell/.rbenv/versions/2.7.2/lib/ruby/2.7.0/uri/rfc2396_parser.rb:219:in `new'
        1: from /Users/tpowell/.rbenv/versions/2.7.2/lib/ruby/2.7.0/uri/generic.rb:208:in `initialize'
URI::InvalidURIError (the scheme mysql2 does not accept registry part: my-user-name:passwordwith%2Eand (or bad hostname?))
=> #<URI::Generic mysql2://my-user-name:passwordwith%2Eand%23and$init@mymacbook.local:3306/db>

Running a Commodore VICE emulator on a remote Ubuntu Linux machine with Xfvb

The Challenge

I want to have a Commodore 128 VICE emulator start up, run some arbitrary BASIC code, and get a snapshot of the output. There are a few settings configurable from the command line to accomplish this:

  • +sound (without this option you will get and error "pa_simple_new(): Connection refused" because you’re *probably* not going to have a PulseAudio option for your remote linux box)
  • -limitcycles 10000000 (intentionally timeout the machine after 10 million cycles… ~10 seconds)
  • -exitscreenscreenshotvicii – this is just -exitscreenshot for non-128 emulators
  • -keybuf so that you can “type” in your program to the BASIC emulator

Installing and Running VICE

In Ubuntu the VICE package can be installed with sudo apt install vice. You still have a couple of issues: First you have nothing to send your display to. I remedied this with Xfvb (the package is lowercase x, but the executable is uppercase)

sudo apt install vice xfvb 
Xfvb :1 & # if you exit your session, you'll have to kill this off or point to it again
export DISPLAY=:1 # use Xfvb for your "display"

At this point, if you try to run on Ubuntu, you’ll be missing ROMs for the various components (basic and the kernal are two of them). They don’t install with the vice package because they’re not appropriately licensed (understatement) for the Ubuntu distro. If you try to run the emulator without them, you’ll get something like the following:

*** VICE Version 3.4 ***

Welcome to x128, the free portable C128 Emulator.

Current VICE team members:
Marco van den Heuvel, Fabrizio Gennari, Groepaz, Errol Smith, Olaf Seibert,
Marcus Sutton, Kajtar Zsolt, AreaScout, Bas Wassink, Michael C. Martin,
David Hogan.

This is free software with ABSOLUTELY NO WARRANTY.
See the "About VICE" command for more info.

C128MEM: Error - Couldn't load kernal ROM `kernal'.
Error - Machine initialization failed.

Segmentation fault

Getting and installing the ROMs

You can download the ROMs from the release source file on the project page. I used the vice-3.4 source. Download/upload the file to your Ubuntu machine and then untar and copy the rom files from the vice-{version}/data directory to /usb/lib/vice:

tar -zxvf vice-3.4.tar.gz
cd vice-3.4/data
sudo ls **/* | grep  -v '\.' | sudo xargs -I {} cp -Rp --parents {} /usr/lib/vice

Run a test script

The following code should have the emulator draw a circle and then capture to the horribly named haha.png:

x128 -keybuf "10 graphic 1
20 scnclr
30 circle 1,100,100,30
" -sound -limitcycles 10000000 -exitscreenshotvicii haha.png

Next Steps

I don’t know… Hook up a lambda? Write a crude server that listens on a COM port? One thing I’m happy about discovering is the -keybuf argument, because I know now that I can inject BASIC (keystrokes to enter BASIC) into an emulator from a source code file without having to worry about the disk or tape image formats.

DKIM for Cloudflare and Fastmail

After creating the CNAME fm#._domainkey records in Cloudflare DNS Management, I was still getting “DKIM is not configured”. Initially I thought it was a TTL issue on the DNS records…

After playing around with dig fm1._domainkey.DOMAINNAME TYPE CNAME I went back to check the settings on the CNAME records:

Proxied CNAME records!

I went in to edit those to be DNS Only

Now my Fastmail DKIM is correctly configured

Running Linux on a Mid-2009 MacBook Pro

[I’ve had decent luck with the iFixIt replacement batteries (Amazon affiliate link) for extending the lifespan of 3 different Macs, Linux or not]

Me using the same Manjaro Live USB to boot Linux on a 2012 MacBook Air

Apple and their aggressive EOL/EOS policies

I have had an old mid-2009 MacBook Pro (2.26Mhz, Core 2 Duo P7550) that got left behind at macOS 10.11 (El Capitan). I’ve already gone through dealing with end-of-support with a 2011 MBP (no AirPlay server, no longer getting macOS updates, etc…), but the 2009 is old enough that Homebrew itself has dropped support officially. While that doesn’t prevent everything from working, once something won’t install, you either need to fix it yourself or give up.

I was trying to get RDP up and running when I hit that issue, so I figured that it was time to see if I could install an operating system that was still supported on the 2009 MBP.

Ubuntu Linux attempt

I first went down the rabbit hole of Ubuntu, but the first set of instructions I found did not give me a warm fuzzy about being able to install Ubuntu and still have a working machine. I used Rufus to write an Ubuntu ISO to a USB drive and was able to live boot into Ubuntu. Of course, Linux and wifi isn’t always plug and play and the live boot did not recognize the MBP’s wifi card, so it would have been wired or nothing until I installed the OS.

Hello Manjaro

Time for a different strategy. I tried a different strategy and searched for Linux distros for a 2009 MacBook Pro. I decided to go with Manjaro XFCE and was able to write the ISO to my USB drive and have wifi working on live boot, so I swapped MacBook hard drives back to the original 5400 RPM 160GB hard drive that came with it.

Manjaro with XFCE is far snappier than even my 2011 or 2019 MBPs. This is mainly because no bloat and very little running so far, but I’ve also installed Ruby 2.8.0-dev from Manjaro in rbenv on the 2009 (P7550 Core 2 Duo) vs. from the 2019 (i7-9750H 6 core) and the install/build time was 9m31s for the 2009 vs. 11m19s for the 2019 (yes, the 11 year old Mac was faster). This is probably a Clang vs. gcc and readline + openssl installation/build difference between the two environments, but I still found it interesting that the 2009 could win the race even with a head start.

As for system load, the MBP 2009 not actively running anything on macOS 10.11 would register a consistent 2.0+ load and would take several minutes to be usable for typing in iTerm. By contrast, running XFCE, it required several tabs open in Firefox + Terminal + gvim for the load to break 1.0.

Steps to get up and running:

  • Download Manjaro XFCE iso
  • Write image to USB drive using Rufus (dd or whatever if you are adequately skilled at that… Rufus was just painfully easy to kick off from a Windows 10 box)
  • Hold down option while booting to get boot menu.
  • Select your USB drive
  • Boot and verify that Linux is sufficiently usable for your MacBook
  • Install to a hard drive (I recommend using a different hard drive that is booting macOS, but then you’ll need tools for the mounting screws at a minimum.
  • Boot and enjoy

Getting set up

Having used yum, apt, and brew, pamac was a bit of a change. For example, I had to use pamac build ruby-build and pamac build rbenv vs. an install command.

I have starship installed as well, which was relatively straightforward, but I still need to get the fonts right for unicode.

Overall experience

So far I’ve been pleasantly surprised with how useful my 2009 MacBook Pro is again. I’ve managed to type up this blog post without any lag from the processor, and the memory usage is sane as well (despite Firefox). I also miss having the pre-butterfly keyboard keys to type on for writing, so it was nice to experience those again.

Planet Fitness Cancellation Template

Update: I put this in the mail on Tuesday and got cancellation confirmation less than 48 hours later.

Also, your mileage may vary, some locations are a little more of a stickler about certified mail, but you should get a confirmation from the location within a few days if they’ve accepted.

I needed to cancel Planet Fitness in the middle of the COVID-19 pandemic and I really didn’t want to be showing up at a gym in person right now (time and unnecessary risk) just to cancel.

I called up my local Planet Fitness and was told I could either come in in person *or* send a [yes, snail mail] letter to the Planet Fitness I signed up at.

So, I’ve thrown together a cheap template to help you include everything you need to cancel (it’s just name, date of birth, and signature, according to the person on the phone.)

You can download the doc I put together at: Planet Fitness Cancellation Word Doc template

Who Else is Participating in Advent of Code 2019

Who else is doing Advent of Code 2019?

I’m using it to try to solve problems in Ruby without actually looking up syntax (looking at you, inject) and getting some practice using MiniTestinstead of RSpec which I use 99% of the time.

Day 2 was kind of fun to be able to implement a tiny virtual machine in Ruby.

Day 3 had me stumped until I just when for a naive solution in which I just created a list of all the coordinates visited instead of trying to figure out an elegant way to calculate the answer… an approach which actually paid off in the second half.

Day 4 has been the problem that I spent the most time fighting with (specifically the second part) after thinking that I had it solved. It was one of those scenarios in which I pretty much starting chasing my own tail after the solution I thought should work didn’t. I ended up with 4 state variables in addition the input variable itself.  

Multiple Postgres Schemas and Rails db:test:prepare

In our Rails databases, we use multiple Postgres schemas. This is partly for partitioning archive data from fresh data. On a new Rails 5 project, I started having tests fail once the models had the “archivable” concern added, which depended on an archive schema existing.

Ultimately, the problem is that the archive schema wasn’t being created in the test database, because rake db:test:prepare performs a db:test:load which was loading the db/schema.rb, which is completely ignorant of the Postgres-specific schema concept.

In order to fix this without attempting ugly hacks, the simplest solution was just to switch to using structure.sql for the Rails schema dump.

In config/application.rb, insert the following in your Application class definition:

config.active_record.schema_format = :sql

If you haven’t already added the additional schema(s) to your schema_search_path in your config/database.yml.

database: whatever_db
schema_search_path: 'main,main_archive,public'

You’ll need to run rake db:migrate to force structure.sql generation before running tests again. Also, be sure to switch from schema.rb to structure.sql if you’re committing this file.