Skip to content → Posts

Charles Proxy Xcode 12.5 Simulator

Prior to Xcode 12.5 you could install the Charles Root Certificate by the menu item in Charles:

Help > SSL Proxying > Install Charles Root Certificate in iOS Simulators

This no longer works as of 12.5. But you can still do it manually. Follow these steps.

  1. From the Charles Application Menu, choose: Help > SSL Proxying > Save Charles Root Certificate…
  2. Save the file: “charles-ssl-proxying-certificate.pem” to your Desktop.
  3. Launch the iOS Simulator. Drag “charles-ssl-proxying-certificate.pem” from your Desktop on to the simulator.
  4. Then enable the certificate in the iOS Simulator by going to: Settings > General > About > Certificate Trust Settings and flipping the switch On for Charles Proxy CA

Comments closed

Bucket Strainer System

Here is the method we have used to harvest honey from our Warre Hive. With the right equipment, it is really easy. You can pay $80 for a pre-made bucket system. Or you can make your own for under $30. Here’s how we made our bucket strainer system:

Shopping list

2 – Food Grade Buckets with Lid. $5 each from Home Depot

1 – Bucket Strainer 400 or 600 Microns – $15 on Amazon. Or ~$5 at Biofuel Oasis

1 – Honey Gate – $12 on Amazon Also available at Biofuel Oasis


1/8 hole drill – to drill holes in bottom of bucket

1-5/8″ to 1-3/4” hole saw – to cut a hole for the gate (This depends on which size gate you buy. Measure it)

Jig Saw – to cut a hole in the lid

Start by drilling holes in the bottom of your bucket. You’ll place the comb in this bucket and the honey will filter through. The hardest part here is when you drill from the bottom of the bucket the plastic goes into the bucket and you need to scrape it out or sand it down. If you can drill from inside the bucket, that makes it much easier.

The next step is to make a hole in the bucket lid. The honey needs to fall through this hole, but you need the lid to stack another bucket on top. You want the make the hole as big as you can, but ensure you can still stack another bucket on top. Drill a hole in the bucket lid, big enough to insert your jig saw blade. Then use the jig saw to cut a hole in the bucket lid. You want to cut as much out as possible, but leave enough room to set your bucket with holes on top of it. My hole ended up being about 9-1/2″ diameter.

Finally cut a hole for the gate in the other bucket (without holes in the bottom) as close to the bottom as you can. Then insert you gate.

You stack the system up like:

I also recently learned about bucket heaters. I haven’t tried one of these, but they sure would speed up the process.

Comments closed

Dark Mode Switching

Here is a DarkModeDemo I created to play around with Dark Mode on iOS 13. I wanted to allow a user to override the system setting with dark or light. Maybe the users wants the system to be light but this particular app to be dark.



Comments closed

Kill process running on port

Frequently I’ll run into the case where my IDE (Intellij, Xcode/Vapor) will fail and leave a web server running on a port. I can’t start it again because it is already running. The only way to proceed is to restart your computer or find and kill the process.

To find the a process running on a port you can use the lsof command. You can filter with “-i”, which lists IP sockets.

$ lsof -i tcp:8080

The command will produce output like:

Run     8299 ddiego   15u  IPv6 0xb2782dc730d0c751      0t0  TCP localhost:http-alt (LISTEN)

The PID is the process identification number. You can pass this to the kill command to kill the process:

$ kill -9 8299
Comments closed

U.S. Zip Code Validation in Swift

Here is a small function that will validate a US Zip Code using a Regexp with a: NSPredicate in Swift.

func validate(input: String?) -> Bool {
    guard let input = input else { return false }

    return NSPredicate(format: "SELF MATCHES %@", "^\\d{5}(?:[-\\s]?\\d{4})?$")
        .evaluate(with: input.uppercased())

Playground: zip-code-validation-playground

Comments closed

Charles Proxy on iOS Simulator

Charles “is an HTTP proxy / HTTP monitor / Reverse Proxy that enables a developer to view all of the HTTP and SSL / HTTPS traffic between their machine and the Internet. This includes requests, responses and the HTTP headers (which contain the cookies and caching information).”

It is one of my favorite tools for debugging network applications. It supports Mac, Windows, Linux and even iOS.

The instructions on their website for SSL connections from within iPhone applications are not quite complete. Especially the last step which is tricky and I often forget. Here are complete instructions for SSL proxy connections on the iOS Simulator.

1. Add SSL Location. After launching Charles, open the menu:
Proxy > SSL Proxying Settings

The click the “Add Button”

Charles - Add Domain

Type in the location you want to add. You can use wildcards if you like. When you’re done, you should see you location in the list:

Charles - SSL Proxying Settings

2. Install Charles Root Certificate in iOS Simulators. Open the menu:

Help > Install Charles Root Certificate in iOS Simulators

Charles - Install Root Cert iOS

This will install the Charles Root Certificate on the Simulator.

3. Enable the Root Certificate. This is the step, they forget to document. And the last part of it is tricky.

On the Simulator, go to:

Settings > General > About > Certificate Trust Settings

Charles - iOS Trust Settings

Swipe the switch to enable the certificate. It will give a warning which you must choose “Continue”

Charles - iOS Trust Settings Enable

You’ll be placed back on the Certificate Trust Settings page with the switch on:

Charles - iOS Trust Settings Enabled

Now is the critical part. Quit the Simulator. Now run your application again and Charles will be able to decrypt your network communications.

Comments closed

Covert GPX to Strava Route

Strava has a labs feature to convert a GPX file to a route: Strava GPX to Route.

But it doesn’t work for me:
Strava GPX to Route Error

And I’m not the only one:
Error computing Route when loading a GPX file

Here is a workaround for converting a GPX file to Strava Route:

1. Export the GPX file.

2. Go to GPSies and import your GPX file:

GPSies Import

Verify it:

GPSies Verify

It adds a timing of 10 mph. You can change this, but it doesn’t matter.

3. Export the GPX Track file.

GPSies Export

4. Go Strava and Upload Activity.

Strava Upload

Click Choose File and select the GPX file exported from GPSies. This will create a new ride.

5. Save the activity as a route.

Strava Create Route

Strava Route Verify

Strava Name Route

6. Delete the activity.

Strava Delete

Comments closed

iOS Swipe Keyboard to dismiss

In iOS 7, Apple added an option to UIScrollView which could allow you to dismiss the keyboard when dragged.


public enum UIScrollViewKeyboardDismissMode : Int {

case none

case onDrag // dismisses the keyboard when a drag begins

case interactive // the keyboard follows the dragging touch off screen, and may be pulled upward again to cancel the dismiss

This is very easy to do. Just set the keyboardDismissMode property to .onDrag or interactive:

let tableView = UITableView(frame: .zero, style: .plain)
tableView.keyboardDismissMode = .interactive

You should set this on all tableviews that contain text fields.

For example code, see:

Comments closed

Vapor Error – root manifest not found

I got this error when trying to build a Vapor project.

$ vapor build
No .build folder, fetch may take a while...
Fetching Dependencies [ • ]
Error: backgroundExecute(code: 1, error: "warning: \'fetch\' command is deprecated; use \'resolve\' instead\nerror: root manifest not found\n", output: "")

I recently experienced a lot of error with getting Vapor 3.0 to run during the beta and Swift 4.1. I assumed the error had to do with that. Had I read closer I might have figured it out. I was not in the build directory. Duh! After changing to the build directory everything worked fine.

If you end up on this page, make sure you are in the build directory when trying to build a Vapor project.

Comments closed

Programmatically selecting a row in a UITableView

I had a need to programmatically select a row in a UITableView. In order to do this, you have to do two things:

let indexPath = IndexPath(row: 0, section: 0)
self.tableView.selectRow(at: indexPath, animated: true, scrollPosition: .none)
self.tableView.delegate?.tableView!(self.tableView, didSelectRowAt: indexPath)

selectRow highlights the selected row and didSelectRowAt will call didSelectRowAt if you need to perform whatever action you defined.

For example code, see:

Comments closed