So… last time I was on here I said something about giving the blog another go.

That went great obviously.

That was nearly nine years ago now apparently. My third child is at school. I think that says everything you need to know about my commitment to regular blogging.

Anyway. I keep telling myself this blog is mostly for me anyway. A brain dump. And right now my brain is full again.

So what have I actually been up to all this time?

The usual stuff.

  • still doing the atebyteapps thing
  • more insurance domain work.
  • watched the kids get big. Weird thing to observe happening in real time.
  • renovated things. Paid for things. Watched tradies. Standard.
  • still playing amateur football. Still not particularly good at it.

And somewhere in all of that I ended up building a whole pile of developer tools.

The back story is pretty boring and I’m sure you can relate. I kept needing to do the same stupid little things over and over. Decode a JWT. Make a wall of JSON actually readable. Generate a UUID. Convert a timestamp because some API refuses to give me anything but epoch time.

Every time I’d go looking for a tool to do it I’d land on some site with more popups than functionality. Or it wanted me to create an account before I could paste in a single string.

Drives me nuts.

So I made my own.

ateByteApps DevTools - a pile of free online developer tools that do the job and get out of the way.

Everything runs in your browser. No accounts, minimal ads (gotta pay for school fees), nothing gets sent off to some server somewhere. Which is handy when the thing you’re pasting in is a JWT or a bit of production config you probably shouldn’t have copied anyway.

A few of my favourites:

  • JSON Formatter - pretty printing a wall of JSON should not be a premium feature
  • JWT Reader - I lose too many hours of my life to these things
  • Regex Tester - still can’t always tell you what my own regex does, but at least I can test it now
  • Timestamp Converter - for when you just need to know what 1722758400 actually is
  • Certificate Viewer - makes it easy to check that cert info without having to remember the openssl command line syntax that changes on every platform
  • QR Code Generator - no real reason, I just like it

There’s plenty more on there too. Base64 encoding, URI and HTML encoding, JSON compare, text diff, SQL formatting, lorem ipsum, colour picker, UUID generator, hash generator, number base converter, word count and all sorts. Full list is right here.

More tools keep getting added. And if there’s something you keep needing a decent version of, yell out. It’s probably already on the list or it soon will be.

Anyway. That’s the update. Took me nine years but I got round to it eventually.

Now if you’ll excuse me, the brain’s full again and there’s a mortgage to pay off so back to the coal mine… hopefully be back in less than 9 years this time.

So about three years ago I made a blog. Not really for you. More so for me.

To write down important stuff really that I came across day to day that I got stuck on or had to work around or fix or whatever.

Somewhere along the line that all got too hard and I decided to stop using it and try to continue to use my brain.

Probably happened somewhere around the time my second child arrived.

So… Now my second child is almost two and I have another on the way before the years end I thought I may as well give this another go.

I can’t remember much of anything as it is right now, so possibly writing things down as they happen is a good idea for when that third child does arrive.

Hopefully I remember to keep the passwords in the password safe though and not on the blog.

Not that this blog is about my children…

So what have I been up to besides procrastination and procreation… Lots of things!

  • setup my company site atebyteapps
  • created a site Stanthorpe Villa for my brother’s rental property
  • worked on Madcow 2.0 test automation system more
  • worked on various insurance domain Guidewire software projects
  • played some amateur football and won and lost an elimination final
  • saw that whole nodeJS revolution happen and built a calendar application for the foxpulse (now sportstg) sporting website using it as a result
  • demolished a house, designed, built and furnished a new house and fixed up an old rental
  • and saw Jose Mourinho come back to Chelsea to win the premiership only to sacked the year after

Sublime Text Editor

By far the best text editor I have ever used is sublime text.

One of the best things about it is that it is available for free (you can and should buy it if you like it http://www.sublimetext.com) and it works on almost all operating systems.

One of the many many cool features it has is the ability to create and define it’s own set of “Build” systems. These can work based on the type of file that is open in sublimetext itself.

Madcow Test Automation

I helped to create an open source DSL based testing tool called Madcow. It relies on Webtest and java style .properties files to test webpages. There is also currently a second iteration of it which utilises Selenium Webdriver instead which is under continual development. Check it out here http://madcow.4impact.net.au or on github http://github.com/4impact/madcow.

For those of you still stuck using Madcow Classic however the following little build system script for Sublime may come in handy. It attempts to run the currently open madcow test against the “local” environment. It was made and tested on windows but it should work on both Windows and unix based machines.

{
    "cmd": ["runMadcow.sh", "-u", "local", "-t", "$file_base_name"],
    "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
    "selector": "source.java-props",
    "working_dir": "${project_path:${folder}}",

    "windows":
    {
		"cmd": ["runMadcow.bat", "-u", "local", "-t", "$file_base_name"],
    }
}

You can add it to Sublime’s Build System by simply clicking…

Tools -> Build System -> New Build System

pasting the above code and then doing

File -> Save As -> RunMadcowLocal.sublime-build

Then everytime you open a madcow test all you need to do is click F7 or Ctrl B to run it locally.

Encoding URLs in Java is quite trivial. However, too often I see people using the URLEncoder class for this. This is WRONG.

The URLEncoder class is used for encoding form data into xxx-form-urlencoded -format. Even though very poorly named, it does say this in the Javadocs ;)

The proper class for URL encoding is the URI class.

Lets assume we have an URL such as http://www.somedomain.com/shop/Awesome Sauces

If you encode this with the URLEncoder class, you get:

1
http%3A%2F%2Fwww.somedomain.com%2FAwesome+Sauces

Unreadable and incorrectly encoded. Reserved characters such as : and / should not be encoded. Also, the URLEncoder encodes empty spaces as a “+” even though it should be encoded as “%20”.

Which makes it really annoying and doesn’t end up matching up with what you would expect if you used javascript’s

1
encodeURI
and
1
encodeURIComponent()
method for example.

With the URI class, you get:

1
http://www.somedomain.com/Awesome%20Sauces

which is much better and correct.

To construct as simple URL like the example above with the URI class:

1
URI myURI = new URI("http", "www.somedomain.com", "/Awesome Sauces");

And to get the URL in an encoded format:

1
String url = myURI.toASCIIString();

If you want to do something like encode the functionality found in

1
encodeURIComponent()

Here’s a bit of a dodgy work around.

    private String getEncodedFileName(String filename) {
        try {
            def filelink = new URI("file","//", filename)
            return filelink.toASCIIString().replace("file://#",'')
        }catch (Exception e){
            return  filename!=null? filename:"";
        }
    } 

Recently wanted to install an older version of a homebrew formula…

After checking around on “StackOverflow: Homebrew install specific version of formula” thought I’d list out some of the steps for next time I need to do this.

Here goes:

Update the git repository containing homebrew formulas by running:

$ brew update

Choose the specific version:

$ brew versions scala
2.9.1    git checkout 53a1f0b /usr/local/Library/Formula/scala.rb
2.9.0.1  git checkout cb1ab23 /usr/local/Library/Formula/scala.rb
2.9.0    git checkout 4002978 /usr/local/Library/Formula/scala.rb
2.8.1    git checkout 0e16b9d /usr/local/Library/Formula/scala.rb
2.8.0    git checkout fdb41a3 /usr/local/Library/Formula/scala.rb
2.7.7    git checkout 6a18e38 /usr/local/Library/Formula/scala.rb
2.7.6    git checkout a82e823 /usr/local/Library/Formula/scala.rb
2.7.5    git checkout e9dd256 /usr/local/Library/Formula/scala.rb

For these to work you have to be in the working-directory:

$ cd /usr/local/Library/Formula

Execute the git code for your version:

$ git checkout 4002978 /usr/local/Library/Formula/scala.rb

And install:

$ brew install scala

If you’ve already install an older version, you may have to brew remove scala

You may need to do some funky git reset’s after this to get back to the latest versions too