jb… a weblog by Jonathan Buys

Setting up BBEdit 14's Python Language Server Protocol

July 20, 2021

Bare Bones released the new version of BBEdit recently and it’s packed with features that teach the old dog some modern IDE tricks. When programming I mainly work in Python these days, so I obviously wanted to take advantage of BBEdit’s new Langage Server Protocol support. This lets BBEdit start a daemon for you in the background that you install separately, and the daemon takes care of things like code completion, error highlighting, and documentation. However, how to set this up specifically for Python development was a bit unclear to me. Here’s how I got it working.

First, and you’ve probably already got this setup, install python3 with Homebrew and use it to install a virtual environment.

brew install python3
python3 -m venv ~/Unix/env/lsp

Next, activate the new virtual environment and install the Jedi Language Server. Once installed, copy the full path to the executable:

source ~/Unix/env/lsp/bin/activate 
pip install -U jedi-language-server
which jedi-language-server | pbcopy

Finally, open the preferences for BBEdit, find the Languages section, and towards the botton add a Language-specific setting for Python. Under the Server tab, make sure you’ve checked the box to “Enable language server”, and paste the path copied from the previous command.

bbedit-python-lsp-prefs

If BBEdit finds the executable at the path, there will be a green dot at the bottom labeled “Ready to start server”. Otherwise, you’ll see a red dot that says “absolute command path not found”. If you see that make sure the commands above completed successfully.

Now, whenever you open a Python file BBEdit will automatically start the LSP daemon in the background and start working it’s magic.


MacSparky and DEVONthink

July 14, 2021

Yesterday I had the pleasure of chatting with David Sparks about an upcoming Field Guide he’s doing on DEVONthink. He had asked for power users of the app, and given that I’ve been going back and forth with it for years I sent him a screenshot and let him know I’d be happy to help. He responded and here we are. If you’ve ever listened to David on one of his podcasts, he’s just as personable and friendly speaking with him one on one.

I’m looking forward to the new Field Guide. My part in it will be as a kind of power user addendum where a few existing users give a glimpse into what their setup looks like. I hope David can get something useful out of my rambling, overall I felt like I barely scratched the surface of what I wanted to say about DEVONthink. I didn’t get into the custom CSS for Markdown display, or the Sorter menu extra, or how you can import a webpage from Safari as Markdown and strip all the adds and other junk out of it. I didn’t get into backup and restores of the databases, or my Take Note hotkey (^space), or how I integrate RSS into my research database to stay on top of new developments in AWS. Ah well, there’s only so much you can do in 15-20 minutes. I’m sure David already covered all of this in his Field Guide anyway.

Also, since DEVONthink is so good at search and discovering additional data, I closed all but my research database during the recording so I didn’t accidentally surface any proprietary or personal information. One of the biggest reasons I use DEVONthink is because it can keep all my personal data private and secure between machines, but that wouldn’t do much good if I just showed the world my bank account numbers or details about our AWS environment in a search result.

Hopefully David can work some magic in editing. If I’m honest I’m a little nervous about how my section is going to turn out, or if it’ll be included at all. Overall though, I think I’ll be in good company, and that the Field Guide is going to be a great success. I’ve got a lot more to say, maybe I should revisit that podcast idea I’ve had for a while. No matter how my part tuns out, it was great to talk to someone who’s work I’ve been following online for years. David’s work with OmniFocus and Paperless have been foundational, and I hope he has the same success with DEVONthink in the upcoming months.


Inner-Document Markdown Reference Links

July 9, 2021

I’m writing a fairly large document for internal use at work, and instead of using something like Word I’ve generated a bunch of markdown files that I’m stringing together with the excellent Pandoc to generate a very nice PDF file with LaTeX. The resulting PDF is beautifully formatted, thanks to the Eisvogel template. A key part of the PDF is a functional table of contents outline in the sidebar of Preview, and the ability to link to different parts of the PDF from arbitrary text.

Pandoc generates header identifiers for each section of the document automatically, which you can use as normal markdown-formatted links. The documentation states:

A header without an explicitly specified identifier will be automatically assigned a unique identifier based on the header text. To derive the identifier from the header text,

  • Remove all formatting, links, etc.
  • Remove all footnotes.
  • Remove all punctuation, except underscores, hyphens, and periods.
  • Replace all spaces and newlines with hyphens.
  • Convert all alphabetic characters to lowercase.
  • Remove everything up to the first letter (identifiers may not begin with a number or punctuation mark). If nothing is left after this, use the identifier section.

So, the header Header identifiers in HTML becomes #header-identifiers-in-html. I did this manually exactly once before I was certain that it was going to be far too tedius and something that could be easily solved by awk, or so I thought.

It turns out that the BSD version of awk included with macOS doesn’t support the flag needed to convert to lowercase, so instead I grabbed a quick perl command and sandwiched it between two awk commands:

sed s/\ /-/g | perl -p -e 'tr/A-Z/a-z/' | sed s/^/\#/g

Then all I needed to do was drop that in a file with a shebang header and mark it executable, move the file into BBEdit’s “Text Filters” folder and it was made available to BBEdit from the Text menu. Now I just highlight some text I want to format as a link, and select the menu option.

I suppose I could get even fancier and muck with the clipboard, and work all the other Pandoc rules into the script, but I imagine this will take care of %95 of my use cases for what I’m doing. That’s more than enough.


Resurrected Site

January 25, 2021

Late last month the domain for this site expired. I had plenty of warning, ample time to log into the Hover dashboard and renew it myself. I could have even left the auto-renew on, like I have for the past twelve years, but this year was different. This year was the end of 2020, and at the time I felt I had enough of the internet. It was time to log off, possibly forever.

The internet had become a toxic place for me, full of political arguments and outrage, it felt like every time I logged on I was watching everything burn around me, and I didn’t want to be a part of it anymore. I left Facebook years ago, I left Twitter in 2020, and I was using my blog to rant about political issues, which was never the intention of this site. This site is here for me to practice writing, to share what I’ve learned, and to force me to think things through1. It’s a repository of my thoughts on the tech industry over time, and a reflection of where I’ve been in my career and mindset.

I didn’t want this site to be something that I knew would start arguments with people I love. My wife and I both got COVID-19 about this same time. There was a lot going on. I let it go.

But then… January 20th rolled around, and 2021 officially started, and with the new year I suddenly felt lighter, more optimistic about the future. I started thinking about sharing tidbits I’ve learned, and I started thinking about the work I’ve put into this site over the years. I remembered how much I enjoyed “blogging” as a hobby, when it was a hobby.

I’m seeing the world with fresh eyes this new year, and I hope you are too. There’s certainly a lot to look forward to, especially as a Mac user. New rumors about M1 MacBook Pros, iMacs, and possibly even the elusive xMac finally making an appearance all have me thinking this might have to be an upgrade year.

I’m also picking up a couple of new hobbies this year. I bought myself an entry-level mountain bike that’s a big step up from the old Walmart special I’ve had for almost a decade. I’m looking forward to exploring the trails around central Iowa. I’m also waiting for a telescope to be delivered. I’ve got an iPhone mount for it, and I’m hoping to be able to do some very, very basic astrophotography. I’ll post what I learn as I go.

They say that getting old means that your sense of time gets warped, one day merges into the next into the next. The days all start to look the same as months turn into years. The fight against that is to never stop learning, to never stop exploring. Novelty is what fights old age, it’s having things worth remembering.

What do you say we make 2021 worth remembering?

  1. As one must when writing, otherwise it doesn’t make sense. 


Student Advice

December 18, 2020

A student asked me for advice for what to focus on getting into the compsci field. Here’s what I said.

I have two pieces of advice:

  1. Stay curious. If you come across something you don’t understand, keep digging till you do.
  2. Start building. The best way to learn is to do. Build a web page, build an app, build a server… whatever direction you want to go, pick a project and start digging in. As you go you’ll hit obstacles, you’ll find things that you don’t understand, when you find yourself there, remember number one and keep at it till you’ve figured it out. Honestly that’s how I’ve built my entire career.

My personal bias is to recommend the devops path, and the first step on that path is to learn Unix. You can download Linux (a Unix clone) for free, or if you have a Mac can pop open the Terminal app and go to town. Figure out what the shell is, what common commands are available to you, and start writing out a personal library of scripts.

Unix is everywhere, it took over the world and no one even noticed. Unix is the core of macOS, iOS, Android, ChromeBooks, and every server running in the cloud. It’s in Internet of Things devices, it’s in your smartTV, it’s probably in your routers and cable modems, and if you do a search for “Unix or Linux Sysadmin” or “devops engineer” you’ll come up with thousands of available jobs.

Here’s an easy trick to get on the path to knowing your computer, once you are in a Unix or Linux environment, run “ls /bin”, that will show you some of the basic programs available to you, pick one, say, “dd”, and run “man dd” and read the manual page on the command. Keep going till you know what every program in the list does.

Secondly, and very closely related to learning Unix is learn networking. Learn the TCP/IP stack, the three-way handshake, basic subnetting, Literally everything is networked, so a solid understanding of how it all works can only help. It’s all just signals down a wire.

On a more practical level, I recommend opening up a Github account, buying a domain name, and using Github to host a webpage with Jekyll. Use that webpage to write about what you learn. Share your projects. Even the experience of getting the Jekyll site up and running is a good exercise. It’s complicated to get started, but once you figure it out, you’ll have a good base for how a lot of things work in industry.

The combination of doing, then writing, helps with your learning, and it gives back to the community for the next person who wants to learn. Come to think of it, I haven’t done enough of that myself lately.

As far as sites to read… well, you could follow Hacker News although I don’t. I know quite a few folks who do. I prefer to follow individual blogs like cks. The tech industry was built, originally, by academics and interested folks building and sharing what they’ve learned, and… well, at it’s core it still works that way now.

I hope it’s good advice, and I wish the student luck on the path to their new career.


Healthy Tech

November 9, 2020

I deleted my twitter account this morning. I’ve been on Twitter long enough to remember when it was spelled twttr, and there was a SMS bridge to a specific number, 40404 if I remember correctly. For me, it’s always been a fun place to chat about Apple and technology. Twitter was a place to learn about new tech and be part of the community of developers, designers, and enthusiasts. Through Twitter I’ve found apps I use every day, books that I love, Authors to follow. We’ve chatted live through Apple keynotes, commiserated through hard times, and found common interests across the world. But… that’s just not what Twitter is anymore. At least not to me.

I quit Facebook a few years ago because I was using to to get into Political arguments. Today I quit Twitter for the same reason. The old Twitter I loved is still there, but it’s buried under the weight of supporting modern society. Politics makes my blood boil, the hypocrisy, the mindless parroting… it’s not good for me to be involved in, and I find that it takes only the slightest provocation to lash out and start an argument. Of course, in my mind at the time, I’m trying to prove a point, I’m debating, but that’s not the truth. The truth is that it doesn’t take much for me anymore to want to argue, and that’s just not healthy.

A friend suggested I watch The Social Dillema on Netflix. I initially resisted because I figured that I’ve been in the tech industry for so long I know what the AI is doing. I think more people should watch the show, but I didn’t think I’d learn anything I didn’t already know. But, having the day off today and nothing better to do, I watched it anyway, and I’m glad I did. There was nothing too revelatory in the show, but while watching it I did begin to second guess my participation in any platform that contributed to the decline in mental health and societal structure, and also contributing to a rise in depression, self-harm, and suicide. This is horrifying.

The crux of The Social Dillema is that technology has moved faster than our brains have had time to adapt, not to mention our societal norms and laws. We’ve gone from having to be physically together to socialize to socializing through a screen in a single generation, and now we are starting to see the effects. For me, I’m taking the War Games approach… sometimes the only way to win is not to play.

That’s not to say that I’m abandoning technology altogether. I still believe that humans can and will solve the biggest problems we face through technology. Climate change, overpopulation, pandemics, food and water shortages can all be overcome through technology. I believe in a future where clean energy powers our vehicles, green cities provide healthy and sustainable living communities, where we’ve reversed the effects of climate change, and where, through the building of this future, everyone has meaningful employment.

Furthermore, I believe in personal technology that works for you, where your privacy is paramount, and the systems we choose to use respect our time and mental health. So far I think Apple is doing a good job of helping to build this future, showing the path forward to a sustainable business model that prioritizes privacy over advertising. They could be doing more, but I think they are doing better than the other big players in the industry.

When I pick up my phone I want to know that I’m not going to get lost in an endless feed, that I’m not going to wind up arguing with a stranger, or worse, a friend. I don’t want to feel left out, insufficient, or incomplete. I want my technology to help me feel more on top of things, to help me make better choices, to eat better, sleep better, get more exersize, be more productive at work, and remember things for me that I might otherwise forget. I want technology to help me learn new skills, and help me hone old ones. To be the bicycle for the mind.

The answer to the dillema is not to abandone technology… the genie is out of the bottle there. The answer is to be mindful about how we use technology, and to demand better from the developers building these services and devices.

I’m an optimist. I believe we can have healthy relationships with our technology, and I believe that we can overcome the hardest problems our society faces. To do so we must understand the problems, generate in ourselves the desire to overcome them, and then start working together.


Getting Small Again

March 23, 2020

It’s been quiet here at home lately. Grey and overcast, rain morning, noon, and night. A good time to rest and recover from a lot of busy weeks. I’m essentially an introvert, and while I enjoy visiting it tends to take a lot out of me. I’ve always preferred long conversations over coffee to loud concerts or clubs. I’m on the couch this morning, my wife’s dog is next to me. The dog kept us up a lot last night. It’s nearly silent, but for the breath of the dog and the clack of the keys.

I watched “Amazing Stories” on TV the other day, the one about a guy who went back in time to 1919. While he spent most of the show trying to get back to 2019, he found that he actually preferred life 100 years ago and wound up staying. It’s an interesting thought experiment to consider the things that we’ve gained over the past century, like civil rights, women’s rights, advances in medicine, heating and cooling, the ability to stay in touch over long distances, but also to think about the things that we’ve lost along the way too. Independence, civility, an overall slower pace of life. I live in a small town and I think a lot about what could revitalize it. Folks that lived here for a long time say that it used to be different, the buildings that are crumbling and empty around the square used to be stores that were stocked and full, kept in top shape. A person could walk down to the square and see their neighbors going about their business.

The butcher, the baker, and the candlestick maker.

What I miss is the opportunity for someone to open a shop selling what they’ve made with their own hands, and be able to make a living off of it. People in town say that things changed when the state put in a highway that bypassed the town, but I think that was only a symptom… a sign that pointed to a real cause. Things fell apart because people stopped shopping in the town. They stopped shopping in town because they could get things cheaper if they drove 20 miles to shop at Walmart instead. The desire for cheap goods has decimated small towns and small businesses, making us dependent on massive corporations that exploit the world’s poorest and most vulnerable to make a $5 t-shirt.

What I wouldn’t give for a generation of makers and independents to turn this around. Sometimes I like to write or envision future scenarios where that’s taken place. Not that there’s not a place for big companies. Something like the MacBook or iPhone simply can’t be created by a mom & pop shop, but they could definitely be made here, by us.

We still have a fantastic barber and a, well, mediocre doctors office in town. Although, of course, the doctors office just recently stopped being independent and is now part of a regional system. Now when I call to make an appointment I get re-routed to someone 25 miles away instead of a mile down the road. I was in the office one day when an elderly gentleman was waiting in line right in front of me, and I asked him about how things had changed over the years. He didn’t have much time to talk but the description he gave was striking. I asked him what happened and as he was walking out the door he turned and said “everything got big, big, big!”

I don’t want to go back in time to 1919, I rather enjoy the privileges and comforts that we have now (especially considering that the idealized past so many think about was generally only great if you were white and male), although I also believe that a lot more of us could benefit from living more of Teddy Roosevelt’s “Strenuous Life”. I want to go forward. I want to live in the future where we’ve figured out these things. Where we’ve created self-sustaining communities of independent makers, linked by high-speed rail systems and electric cars powered by the wind and the sun. Where we all grow gardens full of good food, and we know where the goods we buy come from, and maybe even know who made them. Where we know our neighbors. Where we know the mailman’s name and recognize his uniform and know approximately when to expect him. Where teachers are revered for the responsibility they have. Where the ability to fix a broken thing is given the respect it deserves.

I wish I knew how to make that vision a reality, and now in this isolated time of the Coronavirus, it seems more relevant than ever. We spent too many years getting big, what we need now is to get small again.


Cloud Backup with Arq and B2

March 21, 2020

I’m a fan of the three-pronged approach to backups. I’ve got two different drives attached to my iMac, one for Time Machine for hourly backups, and the other for SuperDuper! for nightly clones of the internal drive. For many years I’ve also had BackBlaze running for a third off-site backup in case the house goes up in flames. At $6 per month it wasn’t bad, but at the beginning of the year when I did a review of subscriptions and decided what should stay, it didn’t make the cut. Not having an off-site backup bothered me though, and I considered starting it back up again till I heard the guys on ATP talking about Arq and thought I’d give it a shot.

What I like most about Arq is that it’s a standard Mac-assed Mac app. It fits in with the rest Mac environment, is light on resources, and just works as expected. The developer, Stefan Reitshamer, has been working on it since 2009 and has built a good business around it, releasing a Windows version and their own cloud backup option.

At $50 Arq itself is a bit pricy, but by pairing it with Backblaze’s own B2 online storage I’m only paying around $1 per month for the storage. Compared with the normal Backblaze service price of $6 per month, I’ll have recouped my money after five months of using Arq. My personal dataset that I’m backing up isn’t that big, but it is important.

I like having more control over my backups, and knowing that if I add something to the Arq backup set that it’ll stay there, no matter if I disconnect a drive or if the data is deleted from my Mac. More control means that there’s more setup than Backblaze or Crashplan, but that’s a tradeoff I’m willing to live with.


Over the Air

March 19, 2020

I recently dropped our cable service and switched our home entertainment system to be centered around the Apple TV (the box, not the service), with an app installed to watch live news, sports, and other local channels. Here’s how I did it.

I used the otadtv.com tower locator to find that there were several over-the-air broadcast antennas within 30 miles of us. Since we live in Iowa and the terrain is almost entirely flat farmland, there’s very little to get in the way of a signal.

Equipment

  • RCA Outdoor Yagi Satellite HD Antenna - link
  • Tablo Dual Lite OTA DVR - link
  • Seagate Portable 1TB External Hard Drive - link
  • Apple TV HD - link

The RCA antenna is inexpensive, and mounted cleanly on the post on my roof recently vacated by the old Dish antenna we haven’t used in years. The one downside to the antenna is that the converter that screws into the antennas dipole was incredibly fragile, I accidentally snapped off both ends screwing them on by trying to screw them on too tight. Luckily the part is only $2-$4 at any local hardware store, so I bought two and kept one in a cabinet just in case.

The Tablo box is a DVR that hooks straight into the coax coming from the antenna. It then hooks into the local network either by ethernet, which I do, or over the wireless network. Since the box was going to be sitting right next to my modem and Eero router, it made sense to plug it straight in. The 1TB hard drive hooks into the Tablo box for DVR and commercial skipping capabilities. Finally, since I wanted the same experience upstairs that we have downstairs I bought a second Apple TV, but since the TV is so much smaller I opted for the slightly less expensive “HD” version instead of the “4k”. When and if we upgrade the upstairs TV to 4k, I’ll probably just buy another Apple TV box to go along with it.

Home Network

We upgraded our home cable service last year to a bundle of TV channels, home phone service, and internet. The only thing I was interested in the was the internet, but my wife enjoyed a few shows and liked having the cable, so we kept it. We needed two cable boxes, but only one of the boxes they delivered was a proper DVR, the other one would stream shows from it across the network. There was a ridiculous coax network setup when Mediacom installed the cable, but I changed it so each cable box hooked up over ethernet to an Eero router to communicate over the home network, and the boxes could download the tv guide from the web.

The new setup has each Apple TV plugged into ethernet into an Eero router, networked to the base Eero where the Tablo box is hooked up. I’ve got the Tablo app downloaded on the Apple TVs which gives me a single interface for movies, tv shows, and local news, weather and sports. As a bonus, I can now watch the morning news on my iMac or MacBook in Safari by visiting my.tablotv.com. We are still in the testing things out phase, but assuming everyone’s happy with the setup I’ll cancel my cable and drop back down to just internet service. With the reduction in price this setup should pay for itself in about four months.


How Long Will macOS Be Unix?

March 16, 2020

I’ve started to worry about the Unix core of macOS. Possibly unnecessarily, but there have been a few troubling signs over the years, the biggest of which is obviously the lack of access to a decent development environment on iOS. On iOS, web development is possible, but only in the barest, most basic sense of the term. As soon as you need to do anything even remotely complex, like build a Django project, run the server locally, and browse the site for testing, you are out of luck. That’s fine, because it’s iOS and I don’t need to do development on my phone, but for years Apple has been saying that they thought iOS and specifically the iPad was the future of computing. In the past few months we’ve seen other signs that point towards Apple looking to simplify their products to the point where they’d no longer be usable for me.

Another obvious sign is that Apple has deprecated what they call “scripting languages”.

Scripting language runtimes such as Python, Ruby, and Perl are included in macOS for compatibility with legacy software. Future versions of macOS won’t include scripting language runtimes by default, and might require you to install additional packages. If your software depends on scripting languages, it’s recommended that you bundle the runtime within the app. (49764202)

Well, fine, for years we’ve needed to download the Xcode Command Line Tools to install git and a compiler. I imagine (hope) that future versions of the download will include the scripting languages needed to bootstrap Homebrew.

What bothers me the most though is that Apple has removed the man pages from their online documentation. Even the old archived links no longer work. In fact, if you start at developer.apple.com/opensource, and follow the link at the bottom to “View Unix Documentation”, you are brought to an extremely out of date archive page with five (5!!) links, none of which are relevant. I’ve been listening to Swift and Objective-C developers complain on podcasts about how the language documentation is incomplete or out of date, but that’s nothing compared to what’s been done to the Unix documentation. So far, the best we can get is doing a search on the open source repository… until that goes away.

I use a Mac because I love the simplicity and reliability of the user interface coupled with a solid Unix core, and because the indie developer community produces some of the best software in the world. The text editor I’m using now for example, BBEdit. Personally I think it’s clear that the Mac’s model for a software ecosystem is the best we’ve been able to come up with. Provide a person with the ability to craft an application themselves, and be able to make a living off of doing so by selling to a global audience. This results in high quality, sustainable software built by people who care deeply about their work and are motivated to continue developing it. Not to mention that the community built between writers, developers, artists, and hobbyists is welcoming, friendly, and inclusive.

One of the reasons for the Mac’s success in the 2000’s and 2010’s is because it made such a great developer or sysadmin machine because of the Unix architecture. Being a Mac, if you never needed to know about it, you would never see it, but if you did need it, the Terminal app was always right there in the Utilities folder, pop it open and you’re off to the races. Unfortunately, given recent moves by Apple, I’m not sure how much longer I’ll be able to stay with the mac as my primary work machine. If I literally can’t get my job done, I’ll be forced to go somewhere else. That really doesn’t sound appealing to me.