Friday, 23 December 2016

Changing IP of Brother Scanner Under Linux

We had a power outage this week. Some devices on my home network got new IP addresses when the power came back on. One of the devices that got a new IP address was my Brother MFC-9340CDW printer/scanner/fax. The printer was still working fine, but I couldn’t scan.

The tl;dr is to remove the old configuration and set the new one:

sudo brsaneconfig4 -r MFC-9340CDW
sudo brsaneconfig4 -a name=MFC-9340CDW model=MFC-9340CDW ip=

I got the new IP address from poking buttons on the front panel of the printer.
The name of the device may be different, but the above is what I had from the default setup.
brsaneconfig4 -q gives all the devices supported, and also the last line is the current configuration.
That’s useful to see what the currently configured IP address is, according to the software on the computer.

To figure out what was wrong with simple-scan, I did this in a terminal to see debugging output:

simple-scan -d

Another useful command is:

brsaneconfig4 -p

which runs ping on the scanner. However, in my case another device had the scanner’s old IP address,
so the ping appeared to be working fine.

Friday, 18 November 2016

Disabling Warnings and Autocorrect in Rubocop

I finally found how to disable Rubocop messages and auto-correction on a file or individual line basis.

I have Atom set up to run Rubocop and auto-correct my files on save. Most of the time this is very handy. I especially like how most of the time it indents my code to the standard. But I was struggling to debug some test cases, and I wanted to use Capybara’s save_and_open_page to see what Capybara was actually looking at. When I saved the file, Rubocop and Atom helpfully deleted the line before I could even run the test case.

But then I discovered this:

save_and_open_page # rubocop:disable Lint/Debugger

Problem solved.

Since the Lint/Debugger cop is arguably not applicable to your test files, I sometimes put this at the top of a test file:

# rubocop:disable Lint/Debugger

In the above case, I could turn Rubocop back on if I needed it with:

# rubocop:enable Lint/Debugger

This is described in the manual at, but I had trouble finding that section with Google.

Sunday, 28 August 2016

Enterprise Challenges to Continuous Delivery

On one of my recent projects I noticed a challenge to a continuous delivery (CD) approach in the enterprise that I haven’t seen mentioned: Software that requires a paid license.

Most CD approaches are based on easily creating instances of a virtual machine. Software with a paid license often has mechanisms, like the MAC address of the first network interface has to be registered with the software vendor’s license server, to prevent automatically creating multiple instances of a virtual machine. Or it may have a license compliance tool that will get very confused by instances of virtual machines appearing and disappearing rapidly.

It’s probably not impossible to do CD with your paid software. Obviously, the easiest way to deal with the problem is to use software that’s completely free to use. If you can’t do that, you’ll need to understand how the license restrictions work, and then tailor the continuous deployment approach around those restrictions. Not easy, but probably doable.

Configuring Applications

I once had experience with a browser-based application that would show pages that were links to another application. Since the URL of the other application would change depending on the environment (development, test, staging, production, etc.), the developers decided to put the URL in a field in a row in a configuration table in the database.

So far, so good. Per-environment configuration needs to be changeable. But it turned out that putting configuration in the database had some challenges. Configuration in the database is less convenient to put under revision control and to deploy with automated tools. So we didn’t have the configuration as part of an automated build tool, and it was a bureaucratic nightmare each time we had to change the URL. (Simple files are easier to integrate with revision control and automated deployment tools.)

But what really caused problems was that the database contained more than just the protocol, host, domain, and port – the stuff that would change for each environment. It included a template for query parameters as well. So the line in the configuration table looked something like this:,parm2=%2

The application would take the query string (?parm1=%1,parm2=%2), and fill in the placeholders (%1, %2) with values. The problem was, every time the requirements expanded and we needed more parameters, the configuration string had to change for every environment.

The parameters weren’t part of the environment set-up, so they never should have been put in the configuration table. When you’re parametrizing an application configuration, make sure you put only things that change per environment into the environment configuration parameters.

Unrelated to the above point, but important to note, is that we also found it very inconvenient that the placeholder marker in the URL was a percent sign. Percent signs are URL-encodeable. When we had to e-mail each other with updates to the URL, we were constantly tripped up by our e-mail and spreadsheet programs “helpfully” URL-encoding the query parameters for us, turning %1 into %251, for example.

Tuesday, 19 July 2016

Citrix in a Window on Linux

[Edit: This was not the solution. It worked the first time, but now it isn't working again.]

I was using Citrix Receiver quite successfully on Ubuntu 16.04 and Linux Mint 13 to remotely access my customer's network, but I couldn't make it start in a window. It was coming up in full screen mode. I could minimize the whole Citrix session by doing Ctrl-F2 (to tell Receiver to pass the next key to Linux), then Ctrl-Super-downarrow (Super is the "Windows" key). However, I wanted to be able to watch the Citrix session on one monitor, while I worked on other stuff on the other monitor.

I finally found this blog that told me how to set up the Receiver config files to get Receiver to start in a window: What it says is:

Edit "~/.ICAClient/All_Regions.ini", replacing the line "TWIMode=*" to "TWIMode=Off".

Edit "~/.ICAClient/wfclient.ini", adding a line "TWIMode=off" to the "[WFClient]" section, and adding a line "UseFullScreen=True" to the "[Thinwire3.0]" section.

Monday, 30 May 2016

WebEx on Ubuntu 16.04


You need Java installed. I used the Open JRE. Some places on the web say you need the Oracle version, but it works for me with the Open JRE and IcedTea:

sudo apt-get install openjdk-8-jre icedtea-8-plugin

That’s all you need to get the meeting to work, but…

Missing i386 Libraries

But you won’t be able to share screens without a bunch of missing i386 libraries. The WebEx plugin is 32-bit, so you need to install some libraries that aren’t installed by default.

Check to see if you’re missing libraries by going into ~/.webex/ and then into a sub-directory whose name is all digits and underscores. Once there, run:

ldd *.so | grep "not found" | cut -f1 -d' ' | tr -d '\t' | uniq

I got about a dozen missing libraries on a relatively new install of Ubuntu 16.04. You may get different results, depending on what’s been installed on your system since you initially installed Ubuntu 16.04.

I installed the following packages [updated with suggestions from readers] (fewer than a dozen, because some packages pull in multiple libraries as dependencies):

sudo apt-get install libxmu6:i386
sudo apt-get install libgtk2.0-0:i386
sudo apt-get install libpangox-1.0-0:i386
sudo apt-get install libpangoxft-1.0:i386
sudo apt-get install libxtst6:i386
sudo apt-get install libasound2:i386
sudo apt-get install libxv1:i386

If you check again with the above ldd command, the only library you should still be missing is This library doesn’t seem to be needed.

Sunday, 17 April 2016

Android Phone Not Connecting via DHCP

I had a weird problem where suddenly my phone stopped connecting to my home WiFi. I was getting the WiFi icon with the exclamation mark, meaning that the router was connecting but I wasn't getting all the info needed to participate in the network.

(The solution further down doesn't require you to understand the next couple of paragraphs, so don't despair if there's too much tech talk in what follows.)

Many posts on-line suggested using a static connection. I was able to do that at home, because I knew the range of DHCP addresses that my router would not give out. But I wasn't satisfied with that solution. I hate it when problems mysteriously arise, and I couldn't identify any reason why my network connection at home should have suddenly started failing.

About the third time I looked for a solution, I came across this document from Princeton. It mentions that there's a bug in some Broadcomm chips that messes up DHCP when the network stays on when the device is asleep.

Well, I remember noting that I had my network configured to stay up when the device was asleep. I noticed it because I didn't think I had configured it that way. (I sometimes find my phone on the settings screen when I pull it out of my pocket, and settings are accidentally changed.)

So (here's the solution), I went back to Settings-> WiFi, then touched the three dots near the top right of the screen, then Advanced, then I turned off "Keep Wi-Fi on during sleep", which set my network to go off when the device sleeps. After that, my phone connected to my home network just fine.

My phone is a Nexus 4, running Android 5.1.1, but obviously this might affect other models since it looks like it's because of the hardware.