Tag Archives: Ubuntu

Add a search engine to Ubuntu Touch browser

You can’t add search engines with the browser GUI, perhaps because Ubuntu Touch is a Work-In-Progress and it’s still early days. Adding search engines to browsers still has patchy support from major browsers, even though the OpenSearch standard is donkey’s years old. I installed Ubuntu Touch on my Nexus 4 after experiencing the “Sleep Of Death” too many times and wanted to use my Firtl search proxy in Touch’s browser.

I located the configuration files (they’re OpenSearch XML description documents, which is handy!) by using grep -r to search for one of the existing search engine names. The search engine description documents are located (on my phone) in

/usr/share/webbrowser-app/webbrowser/searchengines

The / filesystem appears to be mounted read-only and must be remounted read-write to make changes. I did this with the command

mount -o remount,rw /

Copy your search engine’s OpenSearch description document into this directory and next time you attempt to set Ubuntu Touch’s web browser’s search engine, you should see the new search engine in the list. Don’t forget to remount / read-only.

Happy Searching!

Parametric 3D printer designs with OpenSCAD

xyzprintingdavinci1.0I bought an entry-level 3D Printer from PrintME3D recently – an XYZprinting DaVinci 1.0 and I’m impressed. I’ve printed nothing fancy – mostly brackets, clips, motor couplings and a few replacement parts for toys and tools.

I’ve been using OpenSCAD and wanted to  put my simple designs online. Some of my OpenSCAD designs might be useful for other people but with different dimensions, so I made a simple parameter form for each design with a preview image to show the effect of changes.

The preview image is linked to a simple 3D viewer powered by JSC3D, which uses STL produced on the server using the modified parameters from the form. The images are of an adjustable, flexible clip-on bracket to hold a rear mudguard in place with an M5 bolt on a Giant MTX bicycle belonging to my daughter.

Bicycle+rear+mudguard+stay+bracket+-+two+piece

OpenSCAD rendering of one half of symmetrical adjustable rear mudguard bracket

Bicycle+rear+mudguard+stay+bracket+-+two+piece-3D

JSC3D interactive rendering of STL file

The XYZPrinting DaVinci 1.0 is great for an entry model 3D printer, once Repetier (so it can be used with a Linux PC) has been installed and trial-and-error has established good temperatures for the bed and extruder and levelled the bed. After producing many satisfactory-to-good prints, I find it occasionally goes through bad patches of the first layer not adhering to the bed. If poor adhesion happens in only one small patch, it’s not always fatal for the print. I suspect occasional poor adhesion is due to the bed going out of level, possibly due to the vigour with which I remove the previous print’s baked-on glue.

HMRC Companies House Return Service PDF Filing on Ubuntu (64 bit)

Ubuntu includes a pretty good, basic PDF reader called “Document Viewer / evince”. The Return Service from Companies House uses a PDF document which needs the support offered by Adobe’s Reader. Installing Adobe Reader on the latest (14.04 LTS at the time of writing) 64-bit Ubuntu is not quite as simple as pointing and clicking.

Here are the steps I needed:

Get and install adobe reader by following the instructions from http://askubuntu.com/questions/89127/how-do-i-install-adobe-acrobat-reader which follow the heading “For Ubuntu 14.04 (and 13.10), 32 or 64-bit”

I’m guessing that installs a 32-bit version of Adobe Reader which will start up when run from the command line but will complain about some missing modules which can be installed by

sudo apt-get install libcanberra-gtk-module:i386 libidn11:i386

and a missing theme fixed also by installing

sudo apt-get install gtk2-engines-murrine

One more complaint fixed by installing

sudo apt-get install unity-gtk2-module:i386

… left a complaint about “overlay-scrollbars” as the only outstanding error message at the command line. It’s not obvious what installing these extra modules improved in the PDF document.

The Companies House Return Service PDF opens up in evince (the default PDF viewer) with a message that says the PDF document won’t work in all viewers and to ‘Please Wait’. The wait never ends and it must be assumed that evince doesn’t support all the features the Companies House PDF requires. Opening the same file in Adobe Reader shows (for me) a blank screen for 20 seconds or so, before the introduction page appears. Navigation through the Return is by ‘Back’ and ‘Next’ buttons at the foot of each page.

One further problem is that HMRC appear to be using a self-signed certificate which you have to explicitly ‘trust’ in Adobe Reader. The instructions for this are contained in a PDF. Direct links to the PDF are all over the Web, but the person who would follow instructions to accept a self-signed certificate from a directly-linked PDF document does not deserve security.

Here’s my best attempt at a link to the document that explains how to trust the self-signed Companies House security certificate. Satisfy yourself that you’re looking at the Companies House website before downloading and following those instructions! The instructions are in the document linked as “a guide on changing settings in Adobe Reader”.

After trusting Edward Tucker’s certificate, you should be ready to start filing. Good luck!

Wouldn’t this be so much easier if they’d just made a web-based Return Filing Service?

LWJGL: No Keyboard events in Ubuntu / Linux

Running the jbullet demo just now, I noticed mouse events were handled but none of the keyboard events were handled. Stepping through the code it seemed no events were captured by LWJGL’s Keyboard class. Spotted this “Keyboard does not respond on Linux” discussion on LWJGL’s forum which has the answer (ibus isn’t handled correctly) but doesn’t provide a copy-paste solution for “do you haz teh codez” visitors (as I was just now) who just want to overcome the immediate hurdle of the non-functioning LWJGL Keyboard.

This works for me:

XMODIFIERS="@im=none"; java -Djava.library.path=../lib/lwjgl/linux/ -jar jbullet.jar

Brother PT-1230PC on Ubuntu Linux

I found one of these in LIDL recently at the kind of price that usually makes me buy gadgets out of curiosity. My wife had been talking about writing out price labels for a stall in our local market for products she has in her web shop. I wondered if this little label printer might make the job easier.

Brother PT-1230PC label printer

Brother supplies no non-Windows drivers for this product. A quick search reveals a neat Glade/Perl application called blabel by Ari Sovijärvi that formats two-line labels for the PT-1230PC. I needed to print about 140 price labels, so the several cm feed that seems to be a part of every ‘job’ on this little printer would have wasted some pretty pricey label tape.

Without knowing anything about how the printer is controlled, it seems the best way to avoid the inter-label feeds is to combine several labels into one image and print that aggregate image as a single job. I created a CSV file using phpMyAdmin on the web shop which held the product name and price in two columns. A shell script using ImageMagick converted each line into a single label 120×64 pixels and appended it to an 11-label image, which is then printed as a single job using a ‘–fromfile’ command line argument I added to blabel.

Single 120x64 pixel price label

Single price label

I didn’t do too much trial-and-error on the expensive label tape but the largest image I printed was 1320×64 pixels for 11 labels. I chose 11 because the CSV file had a number of rows divisible by 11. Each label is 120 pixels wide. 20 labels caused the printer’s LED to flash (an error?), so the maximum image is somewhere between 1320 and 2400 pixels wide.

11 labels combined with ImageMagick's convert +append

11 labels with ImageMagick’s convert +append

The original deb from Ari’s site is below, along with a patch that adds the –fromfile command line argument. The image you print must be black and white PNG 64 pixels high. I use it like this:

blabel --fromfile=biglabel.png

blabel with –fromfile patch in zip archive

I’ve never edited Perl before (or code with so many ‘ghetto’ comments =p) so, you know, caveat emptor.