Android

Screenshot 2017-04-24_20-47-12

I decided I’ve been putting off learning Android development for far too long. I’ve completely avoided the idea like it’s some fad that’s gonna pass when, you know, everyone ditches smartphones. My lack of motivation to try the platform was my absolute lack of ideas as to what to develop. I’m just not one of those people who come up with cool ideas for apps.

Recently though, my personal outrage at a hideous app boiled over and a google search for a public API for the service actually yielded some result. The API doesn’t do exactly what an API should, which kind of explains why the app is so gosh darn awful, but it does work.

The first thing that I discovered when I downloaded and installed Android Developer studio on my mac, was how amazingly similar the interface is to PhpStorm by JetBrains, which I use for developing an app in Symfony2 at work. Obviously they’re based on the same IDE framework, but it really was a shock – they’re almost identical.

Screenshot 2017-04-24_20-46-32

The next delightful surprise – remember I’d stuck my head completely in the sand – was that apps are written in Java. Java! I haven’t touched Java since my university days. I’d have to say that it doesn’t seem like a whole lot has changed with Java, but so much with PHP has changed that the two have come a lot closer together. Honestly, it doesn’t feel that different to programming in PHP except, well, it’s not PHP.

On my workplace’s website I’m listed as a “full stack developer” which means I can’t decide what part of the stack to specialise in so I just try to be reasonable at everything. I’ve taken to programming frontends in angular, which has given me a much more up to date understanding of Javascript for frontend development – but this is Java, and it really bears no resemblance to me. Java feels more like PHP, but I’m writing *frontend* code in in, which just feels all wrong. Nevertheless the IDE, the tutorials and good old Stack Overflow practically guided me through the experience in a couple of days.

Screenshot 2017-04-24_20-46-57

The next surprise – again, I had no idea what was in store – was that I didn’t have to code in that gosh darn Hyper Text Markup Language that I’ve grown to hate. Instead, there’s a cool visual editor that helps you lock everything in place – and it’s not wishy washy about how it works. You can easily view the XML that it outputs, and adjust it yourself if you like that kind of thing. One thing I can’t do, is make anything look any good – so if there’s a drag and drop editor that let’s me assign actions to buttons, then awesome.

As I said, I found the public facing API documentation on the website for the original app. The system honestly scares me. Authentication for the API is either via an API key which you can only acquire by contacting customer support – and only if you’re the owner of the organisation, not an end user. The alternative is to send your username and password in the query string of every single request – which means that the app has to store your password. When you call the Authenticate endpoint – the system does give you a token, but there’s absolutely nothing in the API documentation about how to use that token to authenticate. What shocked me, is what happens when you stick in invalid credentials. The request returns successfully with a 2xx status code, and a user object with null fields. You have to check if one of the fields is null (and it could be null for other reasons) to detect that authentication has actually failed. Crazy.

So that’s what happens if you send the right fields with the wrong values. Guess what happens when you send the wrong fields? The API documentation says that the default format for responses is JSON, and that you can request XML if you so desire (because you’re insane) and for the most part this is true – but if you happen to not send a mandatory field, or some invalid value that causes an internal server error – you get a HTML Page with the error on it. Just let that sit for a minute. If I want to tell the user why the request failed (admittedly because I malformed the request) then I have to somehow interpret their HTML 500 error page and jam it onto the little phone screen. All I’ve done so far is just dump the raw html onto the screen, because I’m just not touching that.

I recently had to design and implement an API for a SAAS and making sure the app returns the correct status codes and errors in the correct format was possibly more important than getting the API to actually do anything. I honestly can’t see how they missed this.

In any case I had a little bit of fun, and that’s what I set out to do. I might have a go at getting the app good enough to put on the app store – and there are quite a few more features that I’d like to add to it, but I’m pleased that in a couple of days I made an app that functions better than the one my company pays a monthly fee to have access to – even though a couple of days ago I didn’t have a clue how to make an app.

You can check it out here.
https://github.com/darkbluesun/nimbleschedule-android-timeclock

Hearing is believing

I’m an amateur sound guy. On the weekends I do the sound for a church with a small band – Drums, Bass, Acoustic guitar, a couple of vocals, and electric guitar on a good day. I know as much as I need to know to keep the band and the congregation happy. I’ve never studied audio. I listen to MP3s and I don’t like records.

So when I was invited to a Digital Console Showcase in a nearby church where they would be comparing the sound quality of the mixers in a blind test – I figured I would barely notice any difference, unless the quality of a mixer was really bad. Well, it turns out that I can hear the difference between the mixers – and that my observations were pretty much on par with the group. I’m on the lookout for a 16 channel digital mixer.

Here’s what we did. We had a set wave file with lots of different types of music and speech in a short clip. We had each listened to it beforehand. Then, the file was played at nominal gain with no tuning through five different desks: the Roland M200i, the Behringer x32, Midas m32, Yamaha QL5, Soundcraft Performer SI2, and Allen & Heath’s GLD 80 – though only the operator knew which mixer was number 1, 2, 3, 4 or 5. Predictably nobody really noticed a difference between the desks (or at least consistently across the group) and neither did I.

Soundcraft SI performer 1

X32-COMPACT_P0AAP_Top_XL

Behringer x32 compact

m200i_top_main_gal

Roland m200i

QU16_Front_Main

Allen & Heath QU16

The next step was to play with the EQ. The sound file was then played through the mixers with different eq settings. +10dB @5k Q1, +10dB @1k Q2 and finally +10dB @150 Q1. We listened to see which mixers gave the most musical or transparent results for the increase in gain. At this point i started to notice differences in the sound between the mixers. I could swear that the EQ change on the first mixer had a much harsher effect. In the 1K test the fourth desk sounded awful – and I knew by the reactions of those around me that I wasn’t wrong. Sadly, we were told later that there was an error with that mixer in that test.

Lastly we listened to the track with heavy compression. 5:1 Attack 15mS Rel 100mS reducing 10db. In this test I could definitely hear that some mixers just didn’t do a great job of compressing the sound without altering it.

The results were surprising to me. For example the Behringer x32 performed quite well – about on average with the other mixers – proving that the inclusion of Midas pre-amps with the mixer have made a big difference given the company’s less-than-satisfactory reputation for audio quality. That said, most people (except me) noted it sounded poor in the compression test. Maybe that’s something I need to listen out for more.

No desk stood out particularly above any other, and (if you exclude the botched 1k test results) no desk stands out as particularly poor either. Here they are:

Screenshot 2014-11-28 10.34.30

As a point of interest we listened to the sound file played through all 5 mixers with the gain pushed to solid red. Needless to say, they all sounded bad, and it wasn’t really a very measurable test anyway.

Opencart 2 and GST (or other taxes) included

Have you seen the new Opencart version 2? It’s a really nice re-build of the ageing 1.x version of the simple open source shopping cart. If you’ve decided you don’t want the hassle of trying to tame Magento to your needs, you’ll notice that it’s a whole lot simpler. Unfortunately the developers have left out a critical feature in my mind. You must enter a product price (and any discounts, options, specials, etc) excluding any taxes. Tax – as configured by the store set-up, and applied according to the location of the buyer – is then applied to the product for display on the website and in the cart/checkout. If you our your client are selling products locally or nationally, but not internationally this might seem like a bit pain in the behind. Frankly I can’t understand how they would leave such a crucial piece of functionality out of the code base.

admin no taxfrontend with tax

Opencart 1.x is notoriously difficult to extend, beyond a few simple functions like payment gateways and shipping methods. Fortunately the community developed vQmod. This add-on makes a few changes to the core files, and then uses find-and-replace XML files to create modified versions of the core code and uses them instead of the originals. You can get vQmod files to change just about any functionality in OpenCart 1.x.

In Opencart 2, the developers have included their own system for rewriting the code base called OCMOD. I’m sure you can guess what it stands for. It works on exactly the same principal, although there was some disagreement on the way the XML files should be structured so the two are not strictly compatible.

I’ve written a simple OCMOD XML file to add some new fields to the admin section of Opencart. It’s based on a vQmod XML file for Opencart 1.x. The extra fields simply allow you to enter a price including your configured tax rate, and the ex tax price is calculated instantly using Javascript. Only the ex tax price is saved in the database. This mod will work with the base price, options that add or subtract from the price, qty discounts and specials.

You can download it free here:

http://www.opencart.com/index.php?route=extension/extension/info&extension_id=19744

You can contribute to the code here:

https://github.com/darkbluesun/oc2-prices-inc-tax

Screenshots below:

input-price-including-taxesspecialdiscount

option

Laravel generates a system fast

Today I showed off a task management and time tracking system I’ve been working on this week. The system isn’t unique or marketable, but simply meets the organisations needs without incurring a monthly fee – as so many systems do nowadays.
Not only did my co-workers and managers think it was a great system, they also were astounded at how quickly I’d produced a fully functioning system. The answer is with Laravel, generators and Twitter Bootstrap.

Laravel

There are so many good frameworks out there today that nobody should ever code anything in straight PHP. When you use a framework, you have access to code libraries that take care of the basic functions of a web application – routing, security, authentication, database abstraction and more – for you, better than you would handle them yourself. I’ve found Laravel to be an exceptionally easy framework to use.

My application didn’t need to focus on authenticating users, writing SQL statements, dealing with URLs and fighting cross-site scripting and SQL injection. I just got on with the business logic of my application.

http://laravel.com/

Generators

Whilst Laravel itself does not come with particularly powerful code generation – perhaps that’s not in the scope of a framework – Jeffrey Way has developed an outstanding set of generators for the Artisan command line interface. These generators help you develop anything from a simple database migration to a model to a whole set of code to support an object. Say I have an application to manage pets. Generate a pet scaffold with the generators and you’ve got a database migration, a model, a controller and a set of views. Everything you need to get started developing and avoid time-wasting boilerplate writing.

Knowing the objects I needed to work with, I simply generated all the scaffolds and then got to work coding the specifics.

https://github.com/JeffreyWay/Laravel-4-Generators

Twitter Bootstrap

I am not a designer. I don’t want to spend my time designing. I used to create really ugly admin panels. Not any more. Twitter Bootstrap allows you to create a beautiful user interface without trying. Just include the CSS and JS files in your source, and use the CSS classes to style your application. It even comes with an awesome icon font to give you lovely buttons instead of ugly links for your actions.

http://getbootstrap.com/

With these three tools, I could develop an application extremely fast, yet develop code that won’t have the next developer hunting me down for revenge.

 

 

Adding a Boolean Toggle to a grid in Joomla admin

Joomla has a fantastic tutorial on MVC components on it’s website, but it seems to stop way short of explaining how to make a fully featured admin panel.

One of the features it doesn’t seem to explain well is how to add those little green ticks and red circles that you can click and it changes (toggles) from one to the other.

Joomla Demo - Administration - Google Chrome_2013-04-30_16-55-57

I like to use it for chosing if an item will appear on the front page or not – but I’m sure you could think of other uses for it. Joomla also has a built in ‘Published’ button which is a bit simpler, so I’ll start from that and move on up. Continue Reading…

Hadrian’s wall

DSC03472

This is the second weekend in a row we’ve managed to get out and explore the beauty of the world around us, and I’m loving where God has placed us in the world. We walked along a picturesque section of Hadrian’s wall – like the Great wall of China, but not quite as great. It was built with much the same purpose: to keep out the northern barbarians – in this case the Scots. Continue Reading…

Invisible roadworks

2013-02-09 16.35.08

In Australia roadworks were traditionally done by the local council, and though for many years it has been subcontracted out to private companies there is still a general image of ‘council workers’ who dress in reflective gear and sit by the roadside smoking cigarettes. I’ve discovered recently that it’s the same in England – except for the name.

All around the world I have seen this same phenomenon. I can’t imagine why the government needs to install traffic cones along a 3 mile stretch of the motorway where there is no appearance of any work being done or any damage to the road. Do they just do it for fun?

I decided that I needed to look this up on the web. The Highways Agency twitter account mentioned the closed lane:

#M6 northbound between J39 and J40 | Lane(s) blocked http://bit.ly/sutXS1

Still, I found it very difficult to find out WHY the lanes were blocked – as the highways agency doesn’t allow you to search in the past (though it’s helpful for the future – http://www.trafficengland.com/disruptions.aspx)

Eventually I found this on a cached version of the advanced driving website:

http://www.advanced-driving.co.uk/traffic-reports/north-west-england/

M6 northbound between J39 and J40 | Northbound | Resurfacing

On the M6 northbound between junctions J39 and J40, minor delays can be expected at peak times due to carriageway resurfacing , between 8 pm and 6 am, from 5 February 2013 to 8 February 2013.

I passed through on the 9th of February, so I guess they finished the job and decided to leave the cones in place one more day (or more!). Oh well.

Yesterday I saw some guys doing works on the road while there was snow coming down and wind blowing it everywhere, so I guess that kind of makes up for it.

Transformed

Untitled 2On Monday I launched the newest revision of the Transform website http://www.transform.om.org/. This is the first website I’ve created by using wordpress – and it’s not half bad looking. I was really surprised at how swish a website can look with the right themes and customisation – and a few plugins.

Here is a look at the website itself. The fairly wide image in the middle is a slideshow with 5 images that take you to some of the site’s pages for more information – and the last slide is a link to a youtube video that opens up in a pretty lightbox and plays right away. That’s pretty cool. This is all part of the theme I used called ‘Duotive’.

Untitled

The website can be viewed in several different languages such as French, Italian and even Korean – thanks to a fantastic plugin called qtranslate. All the links have a 2-letter language code somewhere in the URL to keep the language. Personally I would have prefered a cookie or a session variable, but this seems to work fine.

Untitled 6

It also pulls all of the short term missions opportunities for Transform participants into the website. The best part of this is that the options change depending on which country you are from – so with geoip country detection, the options are correct for your country and your currency. I used a simple rss feed reader and customised the code pretty heavily for this.

Untitled 3

The gallery is also pretty swish. The videos are hosted by OMNItube – something I’ve helped work on at OMNIvision for a while now – the advantage being no ads. The picture gallery is a part of the theme again, with nice lightboxes. The second video has subtitles based on the language you are viewing the site in, but this is just done with seperate videos at the moment.

Untitled 4

 

Lastly the prayer map is pretty cool. You click on one of the Mediterranean countries and it gives you a short bio with links to full information and how to pray for the country.

I’ve had some ups and downs with the website. The contact form that comes with the theme has no anti-spam protection so the owners got spammed as soon as it went online. Of course there’s always a better plugin available so I just dropped one in and the problem is solved. All in all, wordpress is a great CMS for simple and complex websites – there’s no reason to waste time with Joomla.

Setting up

So we’ve been here in Carlisle for just over two weeks now and we’re almost all settled in. We are so very thankful for the gifts that people have given us towards setting up a new home together. Every time I cut up vegetables I am thankful for sharp knives and nice (colour coded!) chopping boards. We love the concept of being able to store things in places other than our bedroom for once! One important part of setting up a home happened just last night – we finally got our new book-cases. Ruth had lots of fun putting out all her books on display, and I must say they look great. And don’t worry, I’ve set up the TV and Wii so we’re all set there!

But we’ve had little time to sit at home and play with our toys because we are already hard at work at OM. With the TeenStreet conference in Germany happening this month, Ruth has been planning a whole kid’s program and I have been training in the use of some pretty crazy sophisticated equipment. It is going to be a hectic two weeks so please pray for us as we go on this adventure together.

We’re married!

Yes, Ruth and I finally tied the knot on the 9th of June 2012 at Northchurch Baptist Church, Berkhamsted, England. We had a magnificent day that (save for a slight delay) turned out just the way we planned. The sun even made an appearance in the afternoon and there was an especially beautiful sunset to end the day. You can see lots of photos of the big day on our facebook pages.

We had a lovely relaxing honeymoon in tropical north Queensland, Australia before heading to Australia for a whole second wedding and reception! It was lovely to celebrate again with the people who are special to me, and who had already met Ruth and encouraged us on our journey together. It was also a time for last goodbyes as we flew back to the UK two days later!

We’ve been very busy setting up our new home in Carlisle, UK and we will have some photos for you to see soon. We’ve also started work already as volunteers for Operation Mobilisation – Ruth is working with families in the mission field and I am working with a multimedia ministry called OMNIvision. Between our day jobs, setting up a home, getting over jetlag and getting used to each other – we’re quite drained – so please pray for energy and grace for one another.