My Map Art Project

I’d discovered a python package called osmnx which will take GIS data and allow you to draw maps using python. Pretty cool, but I wasn’t sure what I was going to do with it.

After a bit of playing around with it I finally decided that I could make some pretty cool Fractures.

I’ve got lots of Fracture images in my house and I even turned my diplomas into Fractures to hang up on the wall at my office, but I hadn’t tried to make anything like this before.

I needed to figure out what locations I was going to do. I decided that I wanted to do 9 of them so that I could create a 3 x 3 grid of these maps.

I selected 9 cities that were important to me and my family for various reasons.

Next writing the code. The script is 54 lines of code and doesn’t really adhere to PEP8 but that just gives me a chance to do some reformatting / refactoring later on.

In order to get the desired output I needed several libraries:

osmnx (as I’d mentioned before)
matplotlib.pyplot
numpy
PIL

If you’ve never used PIL before it’s the ‘Python Image Library’ and according to it’s home page it

adds image processing capabilities to your Python interpreter. This library supports many file formats, and provides powerful image processing and graphics capabilities.

OK, let’s import some libraries!

import osmnx as ox, geopandas as gpd, os
import matplotlib.pyplot as plt
import numpy as np
from PIL import Image
from PIL import ImageFont
from PIL import ImageDraw

Next, we establish the configurations:

ox.config(log_file=True, log_console=False, use_cache=True)

The ox.config allows you to specify several options. In this case, I’m:

  1. Specifying that the logs be saved to a file in the log directory
  2. Supress the output of the log file to the console (this is helpful to have set to True when you’re first running the script to see what, if any, errors you have.
  3. The use_chache=True will use a local cache to save/retrieve http responses instead of calling API repetitively for the same request URL

This option will help performance if you have the run the script more than once.

OSMX has many different options to generate maps. I played around with the options and found that the walking network within 750 meters of my address gave me the most interesting lines.

AddressDistance = 750
AddressDistanceType = 'network'
AddressNetworkType = 'walk'

Now comes some of the most important decisions (and code!). Since I’ll be making this into a printed image I want to make sure that the image and resulting file will be of a high enough quality to render good results. I also want to start with a white background (although a black background might have been kind of cool). I also want to have a high DPI. Taking these needs into consideration I set my plot variables:

PlotBackgroundColor = '#ffffff'
PlotNodeSize = 0
PlotFigureHeight = 40
PlotFigureWidth = 40
PlotFileType = 'png'
PlotDPI = 300
PlotEdgeLineWidth = 10.0

I played with the PlotEdgeLineWidth a bit until I got a result that I liked. It controls how thick the route lines are and is influenced by the PlotDPI. For the look I was going for 10.0 worked out well for me. I’m not sure if that means a 30:1 ratio for PlotDPI to PlotEdgeLineWidth would be universal but if you like what you see then it’s a good place to start.

One final piece was deciding on the landmarks that I was going to use. I picked nine places that my family and I had been to together and used addresses that were either of the places that we stayed at (usually hotels) OR major landmarks in the areas that we stayed. Nothing special here, just a text file with one location per line set up as

Address, City, State

For example:

1234 Main Street, Anytown, CA

So we just read that file into memory:

landmarks = open('/Users/Ryan/Dropbox/Ryan/Python/landmarks.txt', 'r')

Next we set up some scaffolding so we can loop through the data effectively

landmarks = landmarks.readlines()
landmarks = [item.rstrip() for item in landmarks]

fill = (0,0,0,0)

city = []

The loop below is doing a couple of things:

  1. Splits the landmarks array into base elements by breaking it apart at the commas (I can do this because of the way that the addresses were entered. Changes may be needed to account for my complex addresses (i.e. those with multiple address lines (suite numbers, etc) or if local addresses aren’t constructed in the same way that US addresses are)
  2. Appends the second and third elements of the parts array and replaces the space between them with an underscore to convert Anytown, CA to Anytown_CA
for element in landmarks:
	parts = element.split(',')
	city.append(parts[1].replace(' ', '', 1)+'_'+parts[2].replace(' ', ''))

This next line isn’t strictly necessary as it could just live in the loop, but it was helpful for me when writing to see what was going on. We want to know how many items are in the landmarks

rows = len(landmarks)

Now to loop through it. A couple of things of note:

The package includes several graph_from_... functions. They take as input some type, like address, i.e. graph_from_address (which is what I’m using) and have several keyword arguments.

In the code below I’m using the ith landmarks item and setting the distance, distance_type, network_type and specifying an option to make the map simple by setting simplify=‘true’

To add some visual interest to the map I’m using this line

ec = ['#cc0000' if data['length'] >=100 else '#3366cc' for u, v, key, data in G.edges(keys=True, data=True)]

If the length of the part of the map is longer than 100m then the color is displayed as #cc0000 (red) otherwise it will be #3366cc (blue)

The plot_graph is what does the heavy lifting to generate the image. It takes as input the output from the graph_from_address and ec to identify what and how the map will look.

Next we use the PIL library to add text to the image. It takes into memory the image file and saves out to a directory called /images/. My favorite part of this library is that I can choose what font I want to use (whether it’s part of the system fonts or a custom user font) and the size of the font. For my project I used San Francisco at 512.

Finally, there is an exception for the code that adds text. The reason for this is that when I was playing with adding text to the image I found that for 8 of 9 maps having the text in the upper left hand corner worker really well. It was just that last one (San Luis Obispo, CA) that didn’t.

So, instead of trying to find a different landmark, I decided to take a bit of artistic license and put the San Luis Obispo text in the upper right hard corner.

Once the script is all set simply typing python MapProject.py in my terminal window from the directory where the file is saved generated the files.

All I had to do what wait and the images were saved to my /images/ directory.

Next, upload to Fracture and order the glass images!

I received the images and was super excited. However, upon opening the box and looking at them I noticed something wasn’t quite right

Napa with the text slightly off the image
Napa with the text slightly off the image

As you can see, the name place is cut off on the left. Bummer.

No reason to fret though! Fracture has a 100% satisfaction guarantee. So I emailed support and explained the situation.

Within a couple of days I had my bright and shiny fractures to hang on my wall

Napa with the text properly displaying
Napa with the text properly displaying

So that my office wall is no longer blank and boring:

but interesting and fun to look at

My Outlook Review Process

In a previous post I spoke about my use of Rules and Custom Actions in Outlook. In this post I’ll talk about my Review process which I adapted from David Allen’s Getting Things Done methodology.

There are several decisions that need to be made when reviewing email:

  1. Is this for me?
  2. Is it something that I need to do right now?

If the email is not for me then I need to decide who it is for. Once I have made that decision I Delegate the responsibility of the email.

I will forward the email (or write up a new email with the salient details) and send it to the person that I’m delegating the responsibility to. But here’s the trick … I have a rule that if I put my email address in the BCC line it will be moved to a folder called @waiting and flagged as a follow up item.

I then review the @waiting folder once a day or every other day and will send a follow up email if needed OR delete the email once the person has responded to me.

The next decision I need to make is “Do I need to do this right now?” If I don’t, then I’ll Defer a response or action to the needed time. Unfortunately Outlook doesn’t have a good defer mechanism like my beloved OmniFocus, so I will convert the email into a meeting and remove the attendees other than me to a data and time when I need to work on the email.

Finally, the email may require me to Do something right now. In that case, I focus fully on the requirements of the email and do it.

This may involve scheduling a meeting, or supplying times when I’m available for a meeting, or it might be answering a question asked of me. I will do any necessary research OR as I start working on the email that requires a decision I’ll discover that I don’t have enough information to actually make that decision.

When that happens I’ll send an email (either forwarding or creating a new one) to the person I think that can supply the information and, you guessed it, I’ll BCC myself so that the email is put into my @waiting folder.

Using the above methodology I’m able to manage the massive amounts of email that I receive. Hopefully this helps someone out there who is drowning in email.

Rules and Actions in Outlook or How I stayed sane after coming back to 1000+ emails

One of the best things about the holidays is getting to take some time off and visit family and friends.

One of the worst things about the holidays is coming back to work and an inbox with more than 1200 emails. Granted, I was out of the office for 4 business days so it’s only about 300 emails per day, but still … it’s a lot1.

I have two strategies for dealing with the many emails I get:

  1. Outlook Rules (Rules)
  2. Outlook Custom Actions (Actions)

Rules

Rules allow you to apply actions automatically as they are received in your inbox. This is useful if you work (or manage) one or more tech support desks and you need to segregate the email received into folders to review later.

This is exactly the kind of thing that I do. I currently have more than 50 rules set up in Outlook and they help process about 50%-60% of the emails that I receive.

The other 40% – 50% can’t be ‘Rule’ drive.

For these types of emails I use Actions.

Actions

Actions are amazing because they can have keyboard shortcuts assigned to them.2

I have 3 Actions that I use consistently to help manage my email that isn’t automatically routed with Rules:

  1. Archive (Ctrl + Shift + 9)
  2. Review (Ctrl + Shift + 5)
  3. Review with Boss (Ctrl + Shift + 1)

I archive all internal emails I receive, and probably about 90% of the external emails I receive so that I can refer back to them when needed. I have to archive them into a .pst file because my IS department only allocates a finite (some might say small finite) amount of space.

Using the Keyboard Shortcut Ctrl + Shift + 9 will automatically move an email to the archive. This is really helpful for emails that were sent to me for informational purposes OR that have a long email chain and a resolution was reached without me.

The Review Action will mark the email with a Flag and move it to a @Review folder. I do this with emails that will take more than 2 minutes to process. This works well for longer emails, or emails that need me to make a decision and I am not ready to make that decision yet.

The Review with Boss action is the one action that is used the least of these three. It is useful when I receive an email and need guidance from my boss. If I just need to send her an email about it then I’ll usually mark it as Review and follow up with it during my review process or if it will take less than 2 minutes to write up an email I’ll take care of it right then and there.

Usually emails to her take loner than 2 minutes to compose because they need to be short3

In my next post I’ll go over my review process. This is where I go through the 25 – 100 emails that have been marked as Review and answer the emails that need attention.

  1. I used to get even more. When my company upgraded to Exchange Server 2016 we got the ability for Out of Office Notifications to appear in a message BEFORE a person sent it. This has cut down on the amount of email I receive when I’m out of the office by about 30% – 50%
  2. If you’re not using keyboard shortcuts, you’re really missing out on some power user productivity hacks that will help you out.
  3. This idea is cribbed from Blaise Pascal’s statement, “Je n’ai fait celle-ci plus longue que parce que je n’ai pas eu le loisir de la faire plus courte” … in English, “I have made this longer than usual because I have not had time to make it shorter.” Hat tip to Quote Investigator

My Mac session with Apple

For Christmas I bought myself a 2017 13-inch MacBook Pro with Touch Bar. Several bonuses were associated with the purchase:

  1. A $150 Apple Gift Card because I bought the MacBook Pro on Black Friday and Apple had a special going (w00t!)
  2. The Credit Card I use to make ALL of my purchases at Apple has a 3% cash back (in the form of iTunes cards)
  3. A free 30 minute online / phone session with an ‘Apple Specialist’

Now I didn’t know about item number 3 when I made the purchase, but was greeted with an email informing me of my great luck.

This is my fifth Mac1 and I don’t remember ever getting this kind of service before. So I figured, what the hell and decided to snooze the email until the day after Christmas to remind myself to sign up for the session.

When I entered the session I was asked to optionally provide some information about myself. I indicated that I had been using a Mac for several years and considered myself an intermediate user.

My Apple ‘Specialist’ was Jaime. She confirmed the optional notes that I entered and we were off to the races.

Now a lot of what she told me about Safari (blocking creepy tracking behavior, ability to mute sound from auto play videos, default site to display in reader view) I knew from the WWDC Keynote that I watched back in June, but I listened just in case I had missed something from that session (or the 10s / 100s of hours of podcasts I listened to about the Keynote).

One thing that I had heard about was the ability to pin tabs in Safari. I never really knew what that meant and figured it wasn’t anything that I needed.

I was wrong. Holy crap is pinning tabs in Safari a useful feature! I can keep all of my most used sites pinned and get to them really quickly and they get auto refreshed! Sweet!

The other super useful thing I found out about was the Split Screen feature that allows you to split apps on your screen (in a very iOS-y way!).

Finally, Jaime reviewed how to customize the touch bar! This one was super useful as I think there are 2 discoverability issues with it:

  1. The option to Customize Touch Bar is hidden in the View menu which isn’t somewhere I’d look for it
  2. To Customize the Touch Bar you drag down from the Main Screen onto the Touch Bar.

After the call I received a nice follow up email from Apple / Jaime

Now that you’re more familiar with your new Mac, here are some additional resources that can help you go further.

Apple Support
Find answers to common questions, watch video tutorials, download user guides, and share solutions with the Apple community. Visit Support

Today at Apple
Discover inspiring programs happening near you. Visit Today at Apple

Accessories
From the Apple accessories page, you can learn about all kinds of new and innovative products that work with iPhone, iPad, Mac and more. Visit Accessories

How to use the Touch Bar on your MacBook Pro – https://support.apple.com/en- us/HT207055

Use Mission Control on your Mac – https://support.apple.com/en- us/HT204100

Use two Mac apps side by side in Split View – https://support.apple.com/en- us/HT204948

Websites preferences – https://support.apple.com/ guide/safari/websites- preferences-ibrwe2159f50

I’m glad that I had the Mac session and I will encourage anyone that buys a Mac in the future to schedule one.

  1. They are in order of purchase: 2012 15-inch MacBook Pro, 2014 27-inch 5K iMac, 2015 MacBook, 2016 13-inch 2 Thunderbolt MacBook Pro; 2017 13-inch MacBook Pro with Touch Bar

Why Ulysses is Awesome

I started writing my last post on my iMac but because Apple Photos is a bit … finicky with the iCloud syncing a screenshot I had taken on my iPad wasn’t there.

No fear, just keep writing in Ulysses, then move from the iMac to the iPad and drop the image in. It worked, no problems no fuss. It just works.

Now, if only iCloud would just work …

Setting the Timezone on my server

When I scheduled my last post on December 14th to be published at 6pm that night I noticed that the schedule time was a bit … off:

I realized that the server times as still set to GMT and that I had missed the step in the Linode Getting Started guide to Set the Timezone.

No problem, just found the Guide, went to this section and ran the following command:

sudo dpkg-reconfigure tzdata

I then selected my country (US) and my time zone (Pacific-Ocean) and now the server has the right timezone.

Setting up the site with SSL

I’ve written about my migration from Squarespace to WordPress earlier this year. One thing I lost with that migration when I went to WordPress in AWS was having SSL available. While I’m sure Van Hoet will “well actually” me on this, I never could figure out how to set it up ( not that I tried particularly hard ).

The thing is now that I’m hosting on Linode I’m finding some really useful tutorials. This one showed me exactly what I needed to do to get it set up.

Like any good planner I read the how to several times and convinced myself that it was actually relatively straight forward to do and so I started.

Step 1 Creating the cert files

Using this tutorialI was able to create the required certificates to set up SSL. Of course, I ran into an issue when trying to run this command

chmod 400 /etc/ssl/private/example.com.key

I did not have persmision to chmod on that file. After a bit of Googling I found that I can switch to interactive root mode by running the command

sudo -i

It feels a bit dangerous to be able to just do that (I didn’t have to enter a password) but it worked.

Step 2

OK, so the tutorial above got me most(ish) of the way there, but I needed to sign my own certificate. For that I used this tutorial. I followed the directions but kept coming up with an error:

Problem biding to port 443: Could not bind to the IPv4 or IPv6

I rebooted my Linode server. I restarted apache. I googled and I couldn’t find the answer I was looking for.

I wanted to give up, but tried Googling one more time. Finally! An answer so simple it couldn’t work. But then it did.

Stop Apache, run the command to start Apache back up and boom. The error went away and I had a certificate.

However, when I tested the site using SSL LabsI was still getting an error / warning for an untrusted site.

🤦🏻‍♂️

OK … take 2

I nuked my linode host to start over again.

First things first … we need to needed to secure my server. Next, we need to set up the server as a LAMP and Linode has this tutorial to walk me through the steps of setting it up.

I ran into an issue when I restarted the Apache service and realized that I had set my host name but hadn’t update the hosts file. No problem though. Just fire up vim and make the additional line:

127.0.0.1 milo

Next, I used this tutorial to create a self signed certificate and this to get the SSL to be set up.

One thing that I expected was that it would just work. After doing some more reading what I realized was that a self signed certificate is useful for internal applications. Once I realized this I decided to not redirect to SSL (i.e. part 443) for my site but instead to just use the ssl certificate it post from Ulysses securely.

Why go to all this trouble just too use a third party application to post to a WordPress site? Because Ulysses is an awesome writing app and I love it. If you’re writing and not using it, I’d give it a try. It really is a nice app.

So really, no good reason. Just that. And, I like to figure stuff out.

OK, so Ulysses is great. But why the need for an SSL certificate? Mostly because when I tried to post to WordPress from Ulysses without any certificates ( self signed or not ) I would get a warning that my traffic was unencrypted and could be snooped. I figured, better safe than sorry.

Now with the ssl cert all I had to do was trust my self signed certificate and I was set1

  1. Mostly. I still needed to specify the domain with www otherwise it didn’t work.

Installing fonts in Ulysses

One of the people I follow online, Federico Viticci, is an iOS power user, although I would argue that phrase doesn’t really do him justice. He can make the iPad do things that many people can’t get Macs to do.

Recently he posted an article on a new font he is using in Ulysses and I wanted to give it a try. The article says:

Installing custsom fonts in Ulysses for iOS is easy: go to the GitHub page, download each one, and open them in Ulysses (with the share sheet) to install them.

Simple enough, but it wasn’t clicking for me. I kept thinking I had done something wrong. So I thought I’d write up the steps I used so I wouldn’t forget the next time I need to add a new font.

Downloading the Font

  1. Download the font to somewhere you can get it. I chose to save it to iCloud and use the Files app
  2. Hit Select in the Files app
  3. Click Share
  4. Select Open in Ulysses
  5. The custom font is now installed and being used.

Checking the Font:

  1. Click the ‘A’ in the writing screen (this is the font selector) located in the upper right hand corner of Ulysses

  1. Notice that the Current font indicates it’s a custom font (in This case iA Writer Duospace:

Not that hard, but there’s no feedback telling you that you have been successful so I wasn’t sure if I had done it or not.

Switching to Linode

Switching to Linode

I’ve been listening to a lot of Talk Python to me lately … I mean a lot. Recently there was a coupon code for Linode that basically got you four months free with a purchase of a single month, so I thought, ‘what the hell’?

Anyway, I have finally been able to move everything from AWS to Linode for my site and I’m able to publish from my beloved Ulysses.

Initially there was an issue with xmlrpc which I still haven’t fully figured out.

I tried every combination of everything and finally I’m able to publish.

I’m not one to look a gift horse in the mouth so I’ll go ahead and take what I can get. I had meant to document a bit more / better what I had done, but since it basically went from not working to working, I wouldn’t know what to write at this point.

The strangest part is that from the terminal the code I was using to test the issue still returns and xmlrpc faultCode error of -32700 but I’m able to connect now.

I really wish i understood this better, but I’m just happy that I’m able to get it all set and ready to go.

Next task … set up SSL!

Migrating from Square Space to Word Press

This weekend I migrated my site from Square Space to WordPress. I had been planning to do this for a while (ever since a Hover ad read on ATP earlier this summer). This weekend was the last weekend before my Square Spacesubscription was set to expire so I finally made the switch.

Why I did it

Square Space offers a beautiful interface and great templates to get you started. They make everything about setting up a blog, portfolio or online store as easy as it can get. But … that’s kind of where it ends for me. While the set up is amazingly easy, the actually content posting (for me this means my writing) was more difficult than I would have liked.

In order to get something posted to my Square Space site I would write something in anyone of a number of Plain Text Editors (BBEdit, Drafts, Editorial, Ulysses). Then I would preview the generated HTML to verify it looked the way I wanted it to. Finally, I would post my MarkDown to the Square Space Blog App on iOS and do it All. Over. Again.

To say that it was frustrating is a bit of an understatement. I looked really hard to see what APIs existed and found that there used to be an API but that Square Space removed them for some reason. So no direct posting to my blog by my favorite text editors.

So, with Hover having a discount on domains, and me getting an AWSaccount where I could host WordPress and a rich set of WordPress APIs to post directly from some of my favorite text editors, it seemed like a no brainer to make the switch.

How I set up my WordPress Install

The AWS ecosystem has some amazing documentation on how to do just about anything that you want. So, instead of laboriously taking screenshots and writing up what I did, I’ll just link to Amazon’s Launch a WordPress Website tutorial

Exporting from Square Space to WordPress

For all the pain it was to get content into SquareSpace, it was a breeze to get it out. Again, no need to get screenshots or write it up if I can just link to it instead!

What I hope to gain from it

As I wrote earlier my main reason for leaving Square Space was the difficulty I had getting content in. So, now that I’m on a WordPress site, what am I hoping to gain from it?

  1. Easier to post my writing
  2. See Item 1

Writing is already really hard for me. I struggle with it and making it difficult to get my stuff out into the world makes it that much harder. My hope is that not only will I write more, but that my writing will get better because I’m writing more.

Ulysses integration

With all of that, what has my experience been with writing my first post to my WordPress site?

This entire post was written and edited in Ulysses. I was able to preview my post in Ulysses. I was able topost my content to the site with Ulysses. Basically, Ulysses is a kick ass app and on day one of the conversion, I’m about as happy with a decision that I can be given the short amount of time since I’ve made it.