Category Archives: utilities

Azure CLI and ACR Docker Credential Helper on macOS 12 Monterey

After upgrading to macOS 12 Monterey I started getting the following error when using docker with the ACR Docker Credential Helper:

[code language=”shell”]
fatal error: runtime: bsdthread_register error
[/code]

This error is caused when using a Golang binary that has been compiled with an older version of the Golang compiler, you can find out more in the MacOS12BSDThreadRegisterIssue Golang wiki.

You can run the command helper by hand to verify that it is generating the error:

[code language=”shell”]
docker-credential-acr-darwin list
[/code]

If you use the instructions provided by Microsoft to install the ACR Docker Credential Helper binary then you have installed a binary that is compiled with a fairly old version of Golang. The fix for the error is to recompile the ACR Docker Credential Helper using a newer version of Golang.

To recompile using a newer version you will first need to clone the helper github repo:

[code language=”shell”]
git clone https://github.com/Azure/acr-docker-credential-helper
[/code]

Then you will need to edit the Dockerfile so that the Golang version used is a supported version on macOS 12, I found that version 1.15 worked and the helper still compiled:

[code language=”shell”]
FROM golang:1.15-alpine
RUN apk update && apk add make bash zip
ADD . /build-root
WORKDIR /build-root
CMD make
[/code]

After modifying the Dockerfile you can build the binary by running the build.sh script. This script will build the helper for multiple platforms and put the results in the artifacts directory. The artifacts/docker-credential-acr-darwin-amd64.tar.gz file is the one with the new macOS binaries. The two binaries will need to be extracted from that file and put in the /usr/local/bin/ directory.

You can verify that the update has fixed the issue by running the helper by hand again:

[code language=”shell”]
docker-credential-acr-darwin list
[/code]

Segmenting WebM Video and the MediaSource API

For a while now I’ve seen people ask when support for Apple’s Pantos HTTP live streaming would make it past Safari and iOS. The answer seems to have been that it wasn’t clear that Pantos streaming was the best option and something else would come about eventually that would be more flexible. There have been other options but they involve either Flash or Silverlight and most people want something that works with html5 video. After a long wait it seems like the time is getting close now with the MediaSource API.

The MediaSource API has experimental support in Chrome and can be enabled by using the chrome://flags option. To see it in action you can go to the MediaSource demo page. You can also read a litte more about it here although the spec linked to above is probably a better place to learn about it.

A while ago I created a tool for segmenting H264 video in a Pantos compliant way. When I saw the MediaSource API I wondered how the same type of tool might fit in. The first thing to note is that the Pantos draft describes a complete technique for video streaming while the MediaSource API gives you the tools to stream video and leaves the technique. What follows is a simple technique for segmenting a WebM video in a way that allows standard streaming with the MediaSource API in the same fasion as the Pantos draft technique. While this example will not support variable rate streams it could be expanded to do so and would be the next logical step.

Continue reading

Google Analytics Dashboard WordPress Plugin Version 2.0 Released

It has taken me a while but I’ve finally been able to release version 2 of the Google Analytics Dashboard WordPress Plugin. The primary enhancement of this version is that it no longer blocks the dashboard, posts or pages interfaces while loading. The next major change is an upgrade to using Google’s OAuth login system (see my Google OAuth example using PHP for more information on how I did that if you are interested). The old login system is still available but the OAuth login is the one to use going forward and I may remove the old one at some point. The move to OAuth along with the refactoring I did to the code will allow support for other Google sites such as Feedburner. As a bonus I also moved the caching system to the newer WordPress transient storage interface. The use of the transient storage interface should fix one of the biggest issues people have seen in the past so no more worrying about finding a temp directory that is writable.

Here are a list of the major changes:

  • The dashboard panel now loads asynchronously so the entire dashboard doesn’t block while it is loading
  • Made the analytics column in posts and pages load asynchronously so that it doesn’t block the loading of the page
  • Added support for Google OAuth logins
  • Use transient API support with wordpress version 2.8+
  • Added ability to support multiple analytics sources

Some other minor changes:

  • Stop unlink warnings when caching won’t work
  • Refactored code so that major parts are split into classes
  • Refactored code to better seperate UI code
  • Fixed mime type not being sent correctly for admin area javascript file
  • Fix bug in wordpress version checking

Java AirPlay Client

Ever since getting one of the new AppleTV devices I have been wanting to fiddle with AirPlay. I finally got around to looking at a dump of the traffic between an iPad and the AppleTV over Christmas and was surprised at how simple it was. Soon after I noticed a blog post about AirFlick for the Mac. AirFlick was close to what I was wanting at the time but I really wanted something that would let me control AirPlay from Linux or Windows.

I decided to make something that could run anywhere so I created my own AirPlay client called AP4J. I used Java and a pure Java Bonjour implementation called JmDNS so AP4J can run anywhere Java runs.

The current version only has the ability to control an AirPlay device. That means you have to supply a location that has a compatible video (h264 encoded) but once playing you will have control over the video just as you would using the iPad or iPhone. The next step will be to add the ability to directly serve videos instead of only being able to control the playback of videos. My goal will be the ability to run AP4J on my Windows Home Media server where I can have it stream videos to my AppleTV.

I have tested AP4J on Linux, Windows and Mac but only extensively on Linux. I have also tested a number of sites that have compatible videos available, a few of those are listed here:

Now for a couple screen shots. This is what you see after starting the server and going to the web interface:

This is what it looks like when a video is playing:

VNC on OS X + Devil’s Pie = seamless desktop

I’ve been doing iPhone development lately using a mac mini. When we first started looking at developing for the iPhone it seemed like overkill to go out and buy multiple macbooks or one macbook to share between developers so instead we got a mac mini to share using Vine VNC.

For reference we are able to share the mac mini by taking advantage of fast user switching for more information see this guide on using Multiple Desktop Sessions on Mac OS X.

The VNC part is pretty easy once you have the multiple desktop sessions working. I’ve been doing development on a linux box that has two monitors connected so I will open the desktop in one window and all the non-mac stuff in the other. After using the VNC desktop like that for a while I started to get annoyed by the window decorations so I looked to see what I could do to remove them and that is when I ran into Devil’s Pie.

Devil’s Pie runs as an application in the background and watches for window events that you set up in a configuration file. When it sees the events it can do all kinds of fancy things to the window like remove decorations and set position. It turns out there isn’t a lot of documentation on the configuration language but I did find a configuration language reference, a gnome configuration file editor that kind of works depending on what you need it to do, a decent reference, some configuration examples, and best of all an example of how to remove window effects. With all that I was able to cobble together the following configuration file:

[code lang=”text”]
(if (contains (window_name) “VNC:”) (begin (undecorate) (maximize) (geometry “+1280+0”)))
[/code]

This says to undecorate, maximize, and set the geometry of any window that contains the value “VNC:”. The undecorate will strip the title bar and any border from the window, the maximize does what it says to the window, and the geometry in my case puts the window on the right hand screen. I tweaked the background for my account in OS X and the resulting combination of it all looks like this:


(Click the image to see a larger version)

So now I have what feels like an OS X box integrated right into my normal desktop.

Using scrub to destroy a hard drive

Recently I had a hard drive failure that pushed me into getting a little NAS device that I could back up to S3 easily. After consolidating a lot of data to the NAS I was left with a few old hard drives that I needed to do something with as well as some existing hard drives that I’ve collected over the years. Some of the drives I have are from family members that I have recycled computers for but kept the hard drives out of fear that personal data might still be on them. At the same time this was happening I read an article claiming that a single drive wipe protects data.

Continue reading

PowerDNS Makes Custom DNS Backends Easy

I ran into PowerDNS recently when I needed to find a DNS server that would allow me to produce custom responses to domain queries. I needed to have a request for a DNS entry return a different IP depending on some factors in a database and I needed that data to always be accurate (not cached locally). I found that PowerDNS allows for a lot of customization and I ended up using its piped backend for dynamic queries feature.

With this level of customization you can do things like write your own DNS black list, track who is making DNS requests, give out IP addresses based on a servers availability or use geographic information to return a different IP.

Continue reading

10 Tips For Creating Good Looking Diagrams Using Inkscape

After multiple attempts to find a good free diagraming application I think I have found a decent solution. I’m not creating enough diagrams to justify buying something expensive and I don’t feel like finding a graphics designer to make Dia diagrams prettier. If you have a Mac you are probably not in as bad a situation since you can buy OmniGraffle for $79. But for those of us without a Mac or who are just very cheap I think the best solution starts with Inkscape. I’ve put together a list of 10 tips that will help make better looking diagrams with Inkscape.

Continue reading

Acrobat Reader 7 and FC6

I broke down and wanted to install Adobe Acrobat Reader 7 on my FC6 box to replace xpdf. After installing it from the tar.gz version the acroread startup script bombed out with the error: expr substr 2400000000000 1

After a little searching I didn’t find much help so I started looking at the script myself to see if I could track down the problem. It turns out that it wasn’t that hard to fix. First off the script file was located at: /usr/bin/acroread

Open the script file and find the function named “check_gtk_ver_and_set_lib_path”. This is the location of the first error you will hit. To fix the error you will need to change:

[code lang=”text”]
base_version=`expr substr “${base_version}0000000000″ 1 $len_version`
[/code]

to

[code lang=”text”]
blah1=”${base_version}0000000000″
base_version=${blah1:1:$len_version}
[/code]

You will find this two places and it needs to be changed in both. If you don’t notice the 2nd place it is right after the first in a loop:

[code lang=”text”]
while [ $len_version -gt $len_base_version ]; do
[/code]

The second problem you will have is located in the function “get_gtk_file_ver”. Find this function and change the following line:

[code lang=”text”]
echo $mfile| sed ‘s/libgtk-x11-\([0-9]*\).0.so.0.\([0-9]\)00.\([0-9]*\)\|\(.*\)/\1\2\3/g’
[/code]

to

[code lang=”text”]
echo $mfile| sed ‘s/libgtk-x11-\([0-9]*\).0.so.0.\([0-9]\)000.\([0-9]*\)\|\(.*\)/\1\2\3/g’
[/code]

Now you should be able to run acroread without errors.

[tags]acroread, fedora, script[/tags]