Posts

Testing on Windows IE/Edge

I'm using a MacBook Pro, so I don't have easy access to a windows machine for testing web applications on Internet Explorer - or so I thought... Microsoft have made available virtual machine images (for VirtualBox, Parallels, Vagrant, VMWare, HyperV) of Windows 7 through to 10 so you can run IE and Edge easily. Note that the VMs expire after 90 days, but if you take a snapshot when you first install the VM you can roll it back later and start again. Perfect!

Slow, Buffering, Stuttering Udemy Video

Udemy video has been completely unusable from my home broadband connection. Videos would take minutes to start playing and then continuously stutter and buffer. Searching for a solution I came across this Reddit post - and I found the solution was to change my DNS to use CloudFlare (1.1.1.1). After changing my AppleTV from automatic DNS to manual and using 1.1.1.1 video playback from the Udemy app has been as you would expect. I don't know why this helps, but it seems to have so far.

Enabling FileVault on Yosemite

Read the full details here before doing anything:  http://support.apple.com/kb/PH18637?viewlocale=en_US Enabling disk encryption on OSX Yosemite turns out to be a straightforward process. Simply enable it through Setting/Security & Privacy/FileVault - if you chose not to let your iCloud account unlock your disk (for when you've forgotten your password) you'll have to keep a safe record of the recovery key (it sounds like you only get one oppourtunity to record this) - this triggers a reboot, and then when you log back in you'll be able to monitor the progress of file encryption from the same settings panel. I have 2 MacBooks: July 2014 Apple MacBook Pro , 2.6GHz Quad-core Intel Core i7, Turbo Boost up to 3.8GHz, 16GB 1600MHz DDR3L SDRAM, 512GB PCIe-based Flash Storage January 2011 Apple MacBook Air , 13 inch display, Core 2 Duo 1.86GHz, 4 Gig RAM 1067 MHz DDR3, 256 Gig SSD Since disk speed is king, I wanted to measure the effect of enabling FileVault so I f...

Customising what gets included from bower dependencies (Brunch)

Sometimes you'll find you need to customise which files get included from a bower dependency. For example, when using the moment.js library, you'll see (in bower_components/moment/bower.json) that by default 'moment.js' is the only file included: In my case, I'm using brunch to build the project and I'd prefer to include moment.min.js - plus I want to selectively pick which moment local files to include. This turns out to be quite easy - brunch understands bower overrides, so in your projects bower.json all you have to do is include an override which tells it which files to use from your dependencies:

Resetting your android device pin

If you've forgotten the PIN for your android device, you can reset it at  https://www.google.com/android/devicemanager . This page lets you choose from your registered devices (if you have more than one). From here you can see when it was last used, and where. You have the option of 'Ring', 'Erase', and 'Lock'. Choosing 'Lock' lets you provide a new pin - so next time you access it the new pin should be active.

Intellij tip - Joining multiple lines into one

There are times when you have some code with each statement on its own line, and you want to move it all onto one line. CSS is where I've needed this the most. You start off with some code like this: And really want this: Intellij has a very simple way to do this by using Ctrl-Shift-J - for more information, see http://www.jetbrains.com/idea/webhelp/joining-lines-and-literals.html

Finding a use for an iPad 1

I'd noticed that most of the recent applications in the App Store won't install on my iPad 1 anymore. They either need a gyroscope or IOS 6 or 7. My iPad is stuck on IOS 5. The first problem with this is that I haven't found a way to browse the App Store for applications that ARE compatible. This is incredibly frustrating, since its just left to trial and error finding some that will work. I'd heard about the ' download the latest version that is compatible ' feature, so decided that since my iPad is in awesome condition I'd gift it to my parents - who wouldn't be needing the latest and greatest features. This hasn't been so simple, and I suspect others might have the same problem so I've tried to document what I've found: Doing a 'reset' to erase the iPad (before gifting it to someone) will leave you in the unfortunate situation of not being able to install many applications very easily. At this point, it doesn't seem p...

Using Selenium WebDriver to select JSF/PrimeFaces selectOneMenu options

I'm using JBehave with Selenium WebDriver to test my PrimeFaces (JSF2) application. Selecting an option from a SelectOne option list isn't standard though because of the HTML markup generated by the JSF component. The facelets code to place the selectOneMenu uses the ID 'state': This generates HTML div blocks with id's prefixed with this components id: To select an option, I use a method which manipulates the appropriate divs - this can be used as illustrated below: To reuse this type of utility method, I put it in a base Page Object class:

Some user feedback

I was exporting my banking transactions the other day. It's a much more tedious process than it has to be and after using this for years and not seeing any updates to the site I thought I'd send some feedback - written as stories: As an Online Banking Customer, I want the system to remember my export preferences so that I can efficiently export my transactions ­  currently I have to set everything every time (even if you navigate from a selected account, you still have to pick an account) ­  file format (i.e CSV) ­  date format (dd/mm/yycc)  As an Online Banking Customer, I want to export transactions for all my accounts in one go so that I can efficiently export my transactions ­ so I don't have to do them one at a time ideally multiple accounts in one file  As an Online Banking Customer, I want to be able to access more than 12 months worth of transactions so that I don't have to export so often. ­  not much history is available online...

Exposing the version of your Maven built web application

Sometimes its useful to expose the version of your web application - I find it useful so vsConsole can display the version of the deployed application for each environment on the dashboard. If you build your app with Maven, you can use this code to get the version, and simply wire up a controller/rest endpoint to return it as text/plain. To expose the version of your maven built spring web application, you can use a REST controller like that shown below. Note, you won't see a valid version while running in the IDE - it'll only work when running the Maven built WAR. If you want to add the Jersey dependencies to your spring application try using the following dependency declaration.

Avoid embedding database connection information in your code

I've seen projects where the application code base contains database connection information - passwords and all, or, WAR files are rebuilt for each environment with properties substituted appropriately for the target environment. Rather than putting database information in the application code, it makes more sense to use a JDNI data source provided by the container. This way the exact same application code is deployed to all environments, and we don't encounter any exposed passwords - since the owner of the container (in production environments the infrastructure/support team) define the data source themselves. Database access via JNDI data source in Tomcat In your application server you want to define a data source which points to the database server and schema of your choice. Here, I'm using the H2 database , and assuming this is the DEV Tomcat server, I point it to the DEV schema - define this resource in the Tomcat context.xml :  <Resource name=" jdbc/...

Deploying to Tomcat 7 with Maven

It's sometimes nice to be able to update a development Tomcat 7 server from Maven - this makes it simple to hook automatic deployment into a CI server or just update the dev server as a developer. First, the Tomcat manager application needs to be installed (check Tomcat's webapps directory for the manager application) and configured with the appropriate user credentials: Now, I needed to define the server admin credentials in my maven settings (~/.m2/settings.xml): Then, I updated the POM to configure the maven tomcat plugin : Now, using 'mvn tomcat7:redeploy' lets me update the dev server. Note however, on Windows you may have some problems with undeploying the application - after an undeploy command, some jars may be left over in the webapps/appname directory. When you try to redeploy your app you'll see an error containing " cannot invoke tomcat manager fail - unable to delete... ". To work around this, you can change the TOMCAT_HOME/...

Exception: AbstractMethodError requires c3p0 upgrade

Image
photo credit: markchadwickart via photopin cc I just encountered this exception: Exception in thread "main" java.lang.AbstractMethodError: com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.setCharacterStream(ILjava/io/Reader;J)V at org.hibernate.type.descriptor.sql.ClobTypeDescriptor$4$1.doBind(ClobTypeDescriptor.java:114) at org.hibernate.type.descriptor.sql.BasicBinder.bind(BasicBinder.java:92) It turns out that upgrading c3p0 does the trick (from 0.9.1.2 to 0.9.2.1):         <dependency>             <groupId>com.mchange</groupId>             <artifactId>c3p0</artifactId>             <version>0.9.2.1</version>         </dependency>

Week in Review - 2013-16

Print to Google Drive I just noticed 'Save to Google Drive' in my 'Print' options in Chrome! This is awesome - when you want to save something for reference, and you don't want to go through thousands of bookmarks, this is exactly what I wanted! Media Problems Here is a great blog post about trying to find a decent movie streaming service. Now I have FetchTV (this lets me buy movies to stream, much like the Google Play option) I'm considering turning my MythTV media center off, but I still need an option for playing music/displaying photos/etc. There are lots of options, from AppleTV to Western Digital et al media players. Props to Google for actually selling us here in Australia movies and music - unlike Amazon (we still can't buy movies and music from Amazon in 2013). Andrew Chen quits RSS - WTF! Andrew Chen just announced that he's quitting RSS in favour of email notifications. Look at the comments though, and there isn't a single p...

AspectJWeaver with JDK 7 - error - only supported at Java 5 compliance level or above

I came across this problem with an older project - when I switched from jdk6 to jdk7, when the application started I encountered: nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0': Initialization of bean failed; nested exception is java.lang.IllegalArgumentException:   error annotation type patterns are only supported at Java 5 compliance level or above I didn't want a purely maven solution because during development I run the app in Tomcat via the IDE (Intellij IDEA). In the end I just upgraded my aspectjweaver dependency to 1.7.2 (it was 1.5.4) <dependency>    <groupId>org.aspectj</groupId>    <artifactId>aspectjweaver</artifactId>    <version>1.7.2</version> </dependency> Everything seems okay now.

Week in Review - 2013-13

Image
photo credit: @Doug88888 via photopin cc Installing Windows Vista For the first time since I bought it, my old Dell Inspiron 1525 has Windows Vista back on it. It's been running Ubuntu Linux since I got it, so why does it now have Windows again? My children are using computers at school now and they are using Windows - mainly Office. So rather than confuse them with different operating systems it seems more constructive to just give them some consistency and let them have their own computer set up like it is at school. I'm going to have to buy Microsoft Office for them - which after seeing how Libre Office handles clip art, I'm quite happy to do! (MS Office has a nice search and browse for clipart which the kids love and can use well. Libre Office didn't seem to have any search and you were left to click into each folder one at a time to see the clipart - not particularly useful). Downloading statements I've just noticed PayPal have an interesting fea...

Week in Review - 2013-12

Google Reader and Listen I've been using Google Listen for listening to podcasts since I got my Android phone. It worked well, I would just subscribe to podcasts via Google Reader and drop it in the 'Listen Subscriptions' folder. But now with Google announcing the end of Reader , and Listen has long been abandoned , I'm looking for a suitable alternative. I really liked how I simply had to subscribe to a feed online - if I have to subscribe to things via an app, I'm stuck if I ever want to switch apps. Maybe I'll try Pocket Casts . LinkedIn Groups I've noticed that when contributing to LinkedIn groups, its not immediately obvious to others from your profile. Recent comments might show up in your activity stream but they'll soon disappear. If you view your profile, you'll see a Groups section that shows the groups you have joined. Click on one of those and you'll be taken to the Group page and at the top there will an area where you can st...

Living without Google Reader and Listen

Since I got my Android phone, I've been using Google Listen to listen to podcasts. I really liked this solution since adding another podcast to my collection was as simple as adding it to my 'Listen subscriptions' folder in Google Reader. All from within my browser, all at the click of a button. Awesome. Listen may not have been the best podcast player - it didn't let you speed the playback up and didn't have a sleep timer. But it was simple and worked. Pity it was discontinued last year. Now Reader is on its way out I've had to find a new solution to consume my podcasts. And I've found it in Pocket Casts . This does allow you to speed up playback and set a sleep timer - something particularly useful since I've found podcasts distract me so much I can fall asleep very quickly. I've imported my Reader OMPL file by doing the following: Read how to export Google Reader feeds here http://lifehacker.com/5990456/google-reader-is-getting-...

Fixing my server 500 errors

I'm slowly working through my broken pages - which were broken during the conversion from WordPress to Blogger. I can see in Google Web Master tools I've still got 22 server 500 errors left. There must have been more like 50 to start with. Its a slow painful process of copying the content from the broken post to a new post. I suspect it may be caused by the original WordPress post having comments - something the Wordpress2Blogger script must not be able to handle and therefore creates an corrupted post. Interestingly, the contents of the post are still viewable via the monthly archive page, but viewing the individual post errors - presumably as it tries to render the comments. If I had time, I'd go look at my WordPress database to confirm this theory but all of my time is being taken with fixing the errors. I cannot recommend using the Wordpress2Blogger script, I'm feeling a lot of pain and I had no help from Blogger support or groups.

Week in Review - 2013-11

Job interview testing While job hunting, I've come across one company that seems to have a very good filtering process. First off, you get a series of technical questions which are obviously aimed at finding out how you think or how much you know about technologies applicable to the organisation. I'm sure these questions have been custom written for their environment - which does to some extent convey some information about the potential role. If you pass that, you get an online 2 question Codility test which you have exactly an hour to complete. This is where you actually write code and can verify it compiles and produces the right answers. If you haven't seen Codility before, have a look - as a programmer you can even complete tests to get a 'certificate' you can put on your resume. Job hunting sites Some interesting sites when job hunting: http://www.glassdoor.com/ Information about company salaries http://www.snipey.com.au/ Find jobs advertised by co...