Hide PostgreSQL user in OSX Yosemite

If you install Postgres from enterprisedb.com then you’ll have a PostgreSQL user created that shows up in your login screen. It’s not the end of the world but is mildly irritating so here’s how to hide the account from the GUI:

sudo dscl . create /Users/postgres IsHidden 1

Note that /Users/postgres is not the home folder of the user but simply the path /Users/ followed by the user’s shortname. I tried pointing the tool to the users home folder with no luck.

Thanks to Apple Support for this answer. http://support.apple.com/en-us/HT203998

Groovy / Spring / Spring Security / Gmock : Last method called on mock already has a non-fixed count set

I banged my head against the wall for quite a while trying to figure this error out in my Groovy Junit tests:

Request processing failed; nested exception is java.lang.IllegalStateException: Last method called on mock already has a non-fixed count set.

I’m using Spring 4.0 with Spring Security 3.2.5 and thought maybe it was something to do with my test setup.  It turns out to be pretty straightforward.  I hadn’t wrapped my test in a play closure.  So going from this:

def r = mockMvc.perform(get("/...")).andExpect(status().isOk()).andReturn()

to this:

play {
  def r = mockMvc.perform(get("/...")).andExpect(status().isOk()).andReturn()
}

solved my problem.

Down to one remote with HDMI-ARC and HDMI-CEC functionality

One of my biggest complaints about getting a home theatre system was the need for multiple remotes.  I know you can buy an all-in-one remote that will manage everything for you but for whatever reason I didn’t do that. I just bought a Samsung Smart TV and decided to look into the state of TV remotes again.

228550581

Last night I learned that I was just ignorant of some progress that had been made in this area by two standards: HDMI Audio Return Channel (HDMI-ARC) and HDMI Consumer Electronics Control (HDMI-CEC).  Using these two technologies, I have tied all of my devices together under one remote control.  I push one power button and everything turns on. I push the volume up button on the TV remote and my receiver volume increases.  I want to go to bed and I hit the power button on the TV and both the TV and receiver turn off.  This is the way things always should have been.

Let’s start with HDMI-ARC.  This is quite simple in concept but solves the persistent issue of how do you get audio from the TV back to your receiver.  Most setups I have done and seen involve Blu-ray players, cable STBs and PS3s sending their video and audio to your home cinema receiver then the receiver sends the video to the TV.  Basically, your TV is a dumb monitor.  This all changed when I got my Samsung Smart TV and tried to watch Netflix on it for the first time.  My picture quality was fine but all the audio was coming from my TV!  Enabling the HDMI-ARC on the TV and my Onkyo receiver solved that problem and now it makes no difference where the audio comes from, my receiver can find it.

Next is HDMI-CEC.  You will find this under various brand names like VIERA Link or Anynet+ but they are mostly compliant with the HDMI-CEC standard.  What it allows you to do is send commands over the HDMI cable so when your TV powers up and it’s on the cable input, it tells your cable box to power up too.  When you switch to Blu-ray, it turns that on for you.  My TV also automatically tied into my receiver’s volume control so when you change the volume on the TV it is actually changing the volume on my home cinema receiver.

Sounds like paradise, right?  Well, I have managed to get things gummed up a couple of times and had to reboot everything a couple of times already but I’m hoping that it’s because I don’t have it all hooked up correctly yet.  Also, you’ll probably still need your Tivo remote to do some Tivo things and your Blu-ray remote to do some BD things.  But I’m okay with that.  If I can use one remote 90% of the time then I’m happy.

Using CSS instead of XPath in Xopus config to set placeholder text in Xopus

We have URLs that are generated from the main topic’s title element and we wanted the authors to be aware of this when they created a page in Xopus. I thought it would be a simple update to the Xopus config.xml file but it turned out not to be. In the end, we added content using CSS instead of using the Xopus config like this:

/* This adds text to Xopus specifically on the first page title*/
#xopus-xsl-root div h1.topic-title:first-of-type .xopus-placeholder:after {
  content: ' (used for generating page URL)';
}

I believe this could do with a little more refinement but it’s worked in all the cases we’ve tested so we are happy.

If you are interested in what didn’t work, keep reading.

One of the limitations of the Xopus placeholder configuration option is that it is not really XPath so it only matches on the element name, attribute name or a class name.  This is documented on the Xopus Use of XPath in configuration FAQ page.

So we first tried:

<x:node match="class('topic/title')" preferElementsOnlyParent="true">
  <x:name xml:lang="en">Title (used to generate URL)</x:name>
  <x:placeholder xml:lang="en">{name}</x:placeholder>
</x:node>

But this added the message ‘ (used to generate URL)’ to the titles on figures, sections and other elements. My next thought was to do add the longer placeholder only to actual descendants of the topic element (and go back and add concept, etc. later) like this:

<x:node match="topic/title" preferElementsOnlyParent="true">
  <x:name xml:lang="en">Title (used to generate URL)</x:name>
  <x:placeholder xml:lang="en">{name}</x:placeholder>
</x:node>
<x:node match="class('topic/title')" preferElementsOnlyParent="true">
  <x:name xml:lang="en">Title</x:name>
  <x:placeholder xml:lang="en">{name}</x:placeholder>
</x:node>

This resulted in not showing the additional text message anywhere because the Xopus config doesn’t use full XPath, as I mentioned earlier so a match of topic/title matches all titles and since class(‘topic/title’) also matches the element and it comes later in the file, that is the version that was used.

Installing a SuperNexus ROM on Galaxy S3

I finally did it. I finally rooted my Galaxy S3 and installed a custom ROM. This usually happens when my phone becomes slow and I think “this phone was fast last year so what is wrong?”

I also despise hearing about new Android features but not being able to use them. My Google Now was horrendously slow on my Samsung TouchWiz ROM.  I just got a galaxy tab 10 too and I found that things were just different enough between the two to annoy me when switching back and forth.

So was it hard? Not at all. I’d explain but the instructions on the SuperNexus ROM announcement page are adequate. If you have problems, let me know and I’ll help. I’ve flashed a lot of ROMs on other devices but this is the first one on my S3.

http://forum.xda-developers.com/showthread.php?t=2219885

Now for what didn’t work very well.

Barclays mobile app wouldn’t run on my rooted Galaxy S3. It would start and take me through all the steps then bomb out saying that you cannot run the app on rooted devices. This is annoying because I’ve come to rely on this application’s mobile pinsentry functionality.  After a little research, I found that I could get the Barclays Mobile application to run on my rooted phone using the steps below. I basically followed the instructions I found here: http://forum.xda-developers.com/showthread.php?t=1710613

  1. Buy TriangleAway
  2. Tell it to reset your custom ROM counter
  3. Open the SuperSU application
  4. Click the button that says prepare for reinstallation via google play (or something similar…my app is gone now so I can’t go back and look!)
  5. Reboot
  6. Your phone now is not flagged as having a custom ROM and superSU is not installed
  7. Run the Barclays app and set it up
  8. Unverified yet: reinstall SuperSU from the play store. I’ve read that this will work but I’ll download it and use it when I need it next. For now things are in good shape on my phone.

I’ve heard that this will help you use SkyGo on a rooted Galaxy S3 too but I haven’t tried that either. Bonus: my Netflix application works now too!

I’ve been running the ROM for a day and am incredibly pleased with my phone again. I’d recommend flashing to anybody who is a little frustrated with lags and the overall performance of their Galaxy S3 at the moment. It’s not a hardware problem, it’s a software one!

Ultimaker first (few) print notes

There is a fairly steep learning curve on 3D printing. I spent the first day or two in a fog where I just pushed buttons and didn’t really know what was going to happen but that’s what hacking is all about, right?

Since I would have found this helpful, I’ll just give some tips that I’ve learned so far. Keep in mind that these are tips from a guy who’s been printing for just 24 hours.

  1. The Ultimaker build instructions end abruptly. I had a finished machine but nobody said, now print this and post your results to the forum so we can help you. But that’s a good idea. Also, I later found this page which is just what I was looking for after I finished assembly: http://wiki.ultimaker.com/Calibrate
  2. The blue tape and the build platform. When I got to the step where I was supposed to cover my lovely perspex platform in blue masking tape I shuddered. Why? Oh why? There are a couple of reasons. One is that perspex isn’t very grippy so it’s not good for your first print layer. The second is if something is really screwed up, you can just pull the tape up and put down a new layer. I’ve grown to like my lovely blue tape.
  3. What temperature do I use? How do I print? What is slicing? Do I need a support structure? Keep reading articles and take your time. The answers are out there and often it involves experimentation so just go for it.
  4. Are my belts tight enough? Probably not. Grab a paperclip or two: https://groups.google.com/forum/?fromgroups=#!topic/ultimaker/L5oH548RO8I Otherwise people suggest printing things to help with belt tension but you haven’t got that far yet, have you?!
  5. How tight should I tighten the thumb screw on the extruder? I made mine pretty tight. People recommend “just tight enough” but I’m finding that position hard to find. Since I’m getting better at printing every minute I’m probably going to be confident enough to print the http://www.thingiverse.com/thing:26094

Just think, in no time, you’ll have sloppy prints just like me:

Image

First Ultimaker 3D Print

I spent the last couple of months building an Ultimaker 3D printer. Ok, I didn’t actually spend three months building it but it took me three months.  The build process was daunting because I wasn’t sure what I was building. If you draw up some plans for a bunk bed and then proceed to build it then you kind of know what’s happening at every step. When you get a big kit and are following directions you aren’t always sure why you are doing something.

2013-01-20 21.53.01 2013-01-20 21.53.36 2013-01-20 22.31.30 2013-01-20 22.32.33 2013-01-20 22.33.59 2013-01-21 00.05.08

 

As you can see my bed levelling went a bit wonky. Those are supposed to be squares. The y-axis was working well but the x-axis wasn’t and seemed to cause movement in the y-axis instead. After untangling my wires because I thought I had crosstalk I realised that I hadn’t properly tightened the pulleys on the actual stepper motors. A twist of the screwdriver and things became much better.

I find this all rather exciting and daunting at the same time. I’ve been stuck in the land of digital for so long that worrying about crosstalk, friction and belt tensions is slightly bewildering. I’d recommend it to any developer!