Adding Groovy Support to Eclipse Mars 4.5

The short answer:

  1. Open Eclipse
  2. Select the menu: Help->Install new software…
  3. Click the Add… button
  4. Enter http://dist.springsource.org/snapshot/GRECLIPSE/e4.5/ for the name and URL
  5. Select groovy packages and install

The longer answer is that that since Pivotal Software has dropped funding for Groovy there is a bit of a transition period and things aren’t as easy to find as they used to be. I also no longer find using STS as beneficial since a quick install to get running was the goal and if I have to install Groovy support separately moving forward with STS too then why not use the standard Eclipse app?

Advertisements

Finding adb on OSX with Android Studio

I had a software update on my phone and referred to my earlier post on a
Tethering Fix for Xperia Z2 on Lollipop 5.0 when I realised I didn’t have adb in my path anymore. For those who have moved up to Android Studio and not updated your path, you’ll need to add something like this to your .bashrc or .bash_profile

PATH=~/Library/Android/sdk/platform-tools:$PATH

Tethering Fix for Xperia Z2 on Lollipop 5.0

After upgrading my phone to Android Lollipop, mobile tethering stopped working. I rang my operator and they said my account allowed it so it should work fine. They then ran me through a bunch of steps and it still didn’t work.

I found a long discussion on XDA developer that I was going to review eventually and then my colleague sent me through this fix to type into an adb shell:

settings put global tether_dun_required 0

And now it works. Hopefully it will help you too.

Thank you to silvrback and you can see his more in-depth explanation here: https://pmf.silvrback.com/fixing-tethering-on-android-kitkat

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.

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!