Our Experience in Applying for a Resident Return Visa(Subclass 155)

My wife Jacqui is a New Zealand citizen who arrived in Australia on a Special Category Visa. Because she was not living in Australia prior to 26th of February 2001, she did not fall into the “Protected” category, which allows for Social Security Act payment eligibility. Also being a temporary resident she had no path to citizenship.

She had however visited Australia for a period of 3 months in 1984 as a baby along with her family. Under the legislation that applied at the time, this made her a permanent resident of Australia for the time that she was here.

On advice from the OzKiwi group campaign group on Facebook, we found out that this might give her eligibility to apply for a Resident Return Visa(Subclass 155). This is a permanent resident Visa. After becoming a permanent resident, she would become eligible for some payments under the Social Security Act and have the ability to apply for citizenship after a year.

We used a guide provided through OzKiwi on how to apply.

Firstly we needed to have proof of her residence back in 1984. She and her family didn’t have any travel records back that far so had no idea of the exact dates. Just that it was the early half of 1984.

Because the travel was more than 30 years ago, the Department of Immigration no longer had the records. They had been transferred to the National Archive of Australia. We made an application for the records via the NAA, based on what little information we had. The application form was online and easy to fill out. It did indicate that we were applying for a quote for a copy, but in the end we didn’t have to pay. We asked for a certified copy and it was provided to us within a couple of weeks.

Once we had those dates we started the application process for the Resident Return Visa(RRV). As Jacqui was a Special Category Visa holder, she didn’t have a Visa Issue number so couldn’t do an online application via the Department of Immigration website. Instead we had to download the Form 1085, print it and fill it out on paper.

When filling out the application you need to advise why you left your permanent residence here. For Jacqui this was because as a baby she had to leave with her family.

You’re also asked to provide evidence of your ongoing ties to Australia. For Jacqui this was that she was married to an Australian Citizen, had a child who was an Australian Citizen, had been employed in Australia and was a partner in a small business in Australia. We provided certified copies of our marriage certificate, child’s birth certificate, proof of employment and business registration. Basically, what you’re being asked to do is to prove that you really want to live in Australia for the long term.

We posted the application to our local Department of Immigration office on a Monday morning. The application payment of $363.89 was taken from our account on Tuesday. On Friday Jacqui received an email advising her that the Resident Return Visa(Subclass 155) had been issued to her. I was surprised how quick the processing was. The website had indicated possibly a processing time of 1 business day, and I’d say that’s accurate. As long as you provide the information required and meet the requirements you’ll get it quick.

Now that she has this Visa, she is eligible for basically any payment under the Social Security Act. Normally there is a Newly Arrived Resident Waiting Period that starts from the date you’re issued a permanent residence visa and lasts 104 weeks. However as she has an immediate family member who is a citizen, this is waived. We’re not intending for her to claim Australian welfare payments, but it is good to have a safety net.

In a year’s time from the date she was issued the visa, we’ll apply for her to get Australian citizenship. She’ll become a dual national, keeping both New Zealand citizenship and Australian citizenship. That will give her the additional benefits of being an Australian, such as access to student loans through the HECS-HELP or FEE-HELP system.

If you are a New Zealand Special Category Visa holder living in Australia who had visited Australia at some point prior to 1 September 1994,  you may want to your eligibility for a Resident Return Visa(Subclass 155). See this resource on the OzKiwi website for more information.


Updating/Replacing a MySQL Database from an SQL Dump

Today I needed to replace an existing MySQL database with an updated version of the same database from .sql MySQL dump file. Because my updated sql dump contained duplicate rows that were already in the target MySQL database, just using the standard command-line import produced a fatal insert error due a duplicate primary key.

I couldn’t use PHPMyAdmin for the same reason. Apparently some versions have an option that ignores duplicates but the one on my hosting provider didn’t give me that option.

So to import the SQL dump ignoring the duplicates we need to change the INSERT statements in the file to INSERT IGNORE statements. This can be done using sed:

sed -i -- 's/INSERT/INSERT IGNORE/g' backup.sql

Then import your SQL dump using:

mysql -h host -u username -p -r database < backup.sql

There are two ways to use this with your hosting provider:

  1. If you have shell access on your host and access to the mysql and sed commands you can run it on the host.
  2. If you don’t, you need access to any machine(Linux box or Mac or Cygwin for instance) with both the sed command and mysql client command-line tool. Just replace host above with your hosting provider’s MySQL server address.

For the record, you can also probably do this with any other text editor that has a Find/Replace function. On Windows I’d suggest Notepad++. I used sed though because it made it easy to do the whole task on my hosting provider’s shell.

My Study Notes for Java SE 7 Programmer I(OCA) Exam

After completing the Java SE 7 Programmer I(OCA) Exam Prep Seminar, I took a self-test online to test my knowledge. Based on my results, particularly the mistakes I made, here are my notes on things you definitely need to know to pass the Java SE 7 Programmer I exam. See my preparation for Java SE 7 Programer I(OCA) exam article for more details on how I prepared.

Firstly, check you understand the assumptions published in the Exam Topics page provided by Oracle.

This page is not intended to teach you Java or enable you to cram for the exam. It makes the assumption you’re already a Java programmer and just need to brush up on a few things you’d normally use documentation for. It’s about having a list of important things to know in the exam.

Note: I accept no liability for any inaccuracy or mistakes in this document. If you find any errors, please let me know so I can correct it!

Java Basics

  • Variable scope
    • Class scope
      • Non-static variables defined in a class are accessible within the class methods without using the class or instance name or “this”.
      • Static variables
    • Method scope
      • Variables declared in the method and arguments of the method are only available within the method.
      • If an argument of the method has the same name as a class variable, the method’s version will be used rather than the class version.
      • If a variable with the same name as a class variable is declared in the method, the method’s version will be used rather than the class version.
    • Block scope
      • A variable declared in a block of code will only be available in that block of code.
      • Variables may be declared anywhere in a block or method but will only be valid after the declaration.
      • Variables declared in a block will be accessible inside a new nested scope under the scope they were declared in.
      • You cannot declare a variable in an inner block scope with the same name as a variable in the outer block scope.
    • Variables are created only when their scope is entered.
    • Variables are destroyed when their scope is left.
  • Class structure
  • Executable applications
    • A Java class is made executable from the command line by creating a main method using the declaration: public static void main(String args[])
      • A main method that returns a value will compile but will produce an error when executed
    • First command line argument is args[0].
  • Import Java packages
    • Import package member using import package.member
    • Import complete package using the wildcard character
    • Java compiler automatically imports the java.lang package and the current package
    • If more than one package you have imported contains the same member name, you must refer to it using the member’s fully qualified name.

Java Data Types

  • Declare and initialise variables
    • Declared using syntax: type identifier
    • Multiple variable of the same type may be declared in the same statement, separating the identifiers with commas.
    • Variables may be declared and initialised on the same line.
    • Multiple variables of the same type may be declared and initialised on the same line, by putting a comma after the value of each variable and then supplying the next identifier.
    • Variables may be dynamically initialised with any valid expression at time of declaration.
  • Object reference variables
    • When instantiating an instance of a class, we declare a reference variable and then allocate a new instance of the class to the reference
    • Class name and arguments specify the constructor to be used
  • Primitive variables
    • 8 Primitive types:
      • byte – 8 bits signed
      • short – 16 bits signed
      • int – 32 bits signed
      • long – 64 bits signed
      • float – 32 bits single precision
      • double – 64 bits double precision
      • char – 16 bits unicode
      • boolean – true or false – not 0 or 1
  • Integer literals:
    • Whole number value is an integer literal, assumed to be decimal
    • Octal values denoted by a leading 0
    • Hexadecimal values denoted by a leading 0x
    • Binary values denoted by leading 0b – beginning with JDK 7
    • No error produced when assigning an integer literal that is within the range of the type
    • To specify a long literal append an L(upper-case or lower-case) to the end of the literal
    • Underscores may be embedded in integer literals
  • Floating-point literals:
    • Default is double precision
    • To specify float, append F to the literal
    • To specify double, append D to the literal
    • Scientific notation uses a floating point number plus suffix indicated by E followed by a decimal number with is the power of 10 to which the number is multiplied.
    • Hexadecimal floating point literals may be used with prefix 0x, but scientific notation then uses P rather than E.
    • Underscores may be embedded in floating-point literals
  • Character literals:
    • Enclosed in single quotes(‘)
  • Read and write object fields
    • Inside the class just use the field name.
    • Outside the class use the instance name, dot operator and field name.
  • Object lifecycle
    • Variables are created when their scope is entered and destroyed when their scope is exited.
    • Objects will be eligible for garbage collection when there is no reference pointing to them.
  • Call object methods
    • Within the class just use the method name.
    • Outside the class use the instance name, dot operator, method name and required arguments.
  • StringBuilder class see tutorial
    • Identical to StringBuffer, is faster, but is not synchronized so is not thread-safe
    • Represents growable and modifiable character sequences
    • Provides utility functions for characters or substrings to be inserted into or appended onto a string.
    • Use append() to add more characters to the string
    • Use charAt() to get the character at a particular index – throws IndexOutOfBounds exception if index is invalid.
    • Use length() to get length of string
    • Use substring(int index) to return all characters from index to end of string or substring(int start, int end) to return characters between start and end inclusive.
  • Strings
    • Strings are immutable – cannot be changed once created
    • A string object is automatically created for every string literal
    • The + operator may be used to concatenate strings
    • To compare two strings use the equals() or equalsIgnoreCase() methods of the String class
    • Use the compareTo() or compareToIgnoreCase() method to compare whether a string comes before or after another string in dictionary order.
    • Use length() to get length of string
    • String methods that return a new String object may be used with the assignment operator to replace the an existing String object.
    • String methods that “modify the string” don’t actually modify the string, but return a modified copy of the String.

Operators and Decision Structures

  • Operators
  • Parentheses
    • Raises the precedence of operations inside them
    • May be used to alter the precedence or clarify the meaning of the expression
  • Object and string equality
    • == determines if the variable references refer to the same object
    • .equals compares the contents of the two objects
  • If/else statements
    • May contain just one statement or a block
    • May be nested, but the if-else-if ladder structure is preferred
  • Switch statements
    • Statements in a switch case must be labeled with one or more case or default labels.
    • break statement branches execution to first statement after switch block
    • break may be omitted from a case in order to have execution fall through to the next case’s statements
    • Prior to JDK 7 only byte, short, int or char expressions may be used in a switch.
    • In JDK 7 and above String may be used.
    • switch is more efficient than if’s, but may only test equality of contents of expression


  • One-dimensional arrays
    • Braces may follow the type or the variable name.
    • Array memory must be allocated using the new keyword and size must be specified in braces after the type
  • Multi-dimensional arrays
    • Braces may follow the type or the variable name.
    • When specifying the size of a multi-dimensional array only the first dimension size needs to be specified. The second dimension size may be allocated manually for each index of the first dimension.
    • It is possible to create uneven or irregular multi-dimensional arrays – a triangular multi-dimensional array even!
  • java.util.Arrays has utility static methods for manipulating arrays
  • Arrays are objects and all methods of class Object may be invoked on an array.
  • ArrayList
    • Supports dynamic arrays which can grow when needed.
    • Automatically enlarged when needed.
    • May be shrunk when objects are removed.
    • Declared in form: ArrayList<type> var = new ArrayList<type>()
    • Contents may be returned using default toString() method.
    • Can be converted to an array using toArray() method. Needed for use with an enhanced-for loop.
    • Use get(index) method to access a value.
    • Use add(element) to append to list
    • Use add(index, element) to insert in a list – index must be less than the size() of the ArrayList.
    • Use remove(index) to remove from ArrayList.
    • Use remove(object) to remove the first occurrence of object from the ArrayList.
    • Use clear() to remove all elements from the arraylist.


  • While loops
    • Only run if controlling expression is true
    • May not run at all if expression is false when execution reaches the loop
    • Does not require a body if the controlling expression can handle all required functionality
  • For loops
    • General form: for(initialisation; condition; iteration)
    • Commas allow multiple initialisation and iteration statements
    • Initialisation and/or iteration statements may be absent
    • All three parts may be empty for an infinite loop
  • Enhanced for loops
    • General form: for(type variable : collection)
    • Iterates through a collection and places the current value in the variable
    • May be used for multi-dimensional arrays using nesting
  • Do/while loops
    • Always runs once, subsequent runs will occur if the controlling expression is true at the end of the first iteration.
    • Decrement/Increment may be included in the controlling expression as a pre-fix decrement/increment preceding the comparison
  • Break and continue
    • break terminates the loop and execution continues with the first statement after the loop
    • continue terminates the current loop iteration and execution continues with the next loop iteration
    • break label breaks out of the named block of code
    • continue label ends the current iteration of the block label and triggers the next iteration to begin
    • break may only be used within a switch block’s case or default labels or in a loop.
    • continue may only be used in a loop.

Methods and Encapsulation

  • Method arguments and return values
    • A method may accept values into variables which are known as parameters
    • A method that accepts parameters is passed arguments(variables or literals) when it is called
    • Void methods do not return values or include a return statement.
    • Non-void methods must return a value via the return statement.
    • The last parameter of a method may be a varargs parameter which may accept an arbitary number of values. The syntax is: type… array_name
  • Static keyword
    • Static variables are essentially global variables
    • Static methods can only directly call other static methods
    • Static methods can only directly access static data
    • Static methods cannot use this or super – it will cause a compilation error
    • Static members can be accessed before an instance of its class is created and without reference to an object.
    • Inside their class static members can be used without specifying the name of the class.
    • Outside their class static members can be used by specifying the class name followed by the dot operator and member name.
  • Overloaded methods
    • Overloaded method use the number and types of arguments to determine which version of the overloaded method to call.
    • Return type are not used to determine which overloaded method to call.
  • Default and user-defined constructors
    • If no user-defined constructors are provided for a class, the compiler will supply a default no argument constructor
  • Create and overload constructors
    • If a class will be inherited, a no argument constructor should be supplied.
  • Access modifiers
    • public
      • Can be accessed by any other code
    • private
      • Can only be accessed by other methods in its class
    • protected
      • Applies only with inheritance
    • default
      • Also known as package-private
      • Accessible from all classes within its package
  • Encapsulation
    • Declare variables of a class private
    • Provide public setter and getter methods
  • Call by reference vs call by value
    • Primitives types are passed by value – the method has a copy of the primitive and can’t change the original variable
    • Object types are passed by reference – the method can change the original object


  • Implementing inheritance
    • Java implements single inheritance
    • On instantiation of a subclass, the no-arg constructor of the superclass will be executed prior to the subclass constructor running
    • Subclass cannot access those members of a superclass that have been declared private
    • Declaring a method as final means it cannot be overriden by a subclass – a compile-time error will occur
    • Declaring a class as final means it cannot be inherited.
      • A class cannot be abstract and final
  • Polymorphism
    • Subclasses of a class can implement their own unique behaviour but share common functionality with the superclass
    • Achieved by overriding superclass methods to provide unique behaviour in the subclass, while also adding additional unique methods specific to the subclass
  • Reference type vs object type
    • A reference variable may be declared to be of a type that is a superclass of the actual object type
    • Reference type determines which members of the object are accessible
    • Only those members declared in the reference type will be accessible, so some members of actual object type may not be accessible
  • Casting
    • Where a superclass has been used as reference type, the object may be cast to the actual type to access members that are not part of the reference type
  • Super
    • May be used to call the constructor of a superclass – the signature will determine which constructor
    • May be used to refer to a method or instance variable in the superclass
  • This
    • this is a reference to the current object
    • this() can be used to invoke an overloaded constructor
    • this may be used to refer to a redefined instance member variable from a method.
  • Interfaces
    • An interface is a a reference type, like a class, that can only contain constants, method signatures, default methods, static methods and nested types.
    • Cannot be initialised
    • Are designed to be implemented by classes or extended by other interfaces
    • A class based on the interface uses the implements keyword to declare this.
  • Abstract classes and interfaces
    • Abstract classes cannot be initialised
    • Abstract classes are able to be subclassed, with subclasses inheriting the methods provide by the abstract class
    • An abstract class may implement an interface


Preparing for Oracle Java SE7 Programmer I (OCA) Certification Exam

Over the past couple of weeks, thanks to my work, I’ve been preparing to sit the Oracle Java SE7(OCA) Certification Exam. I already knew how to program in Java, having completed several units at University that covered Java programming therefore I was pretty confident that I would be able to pass the Associate level exam without any hitches. Just to be sure though, I asked to take the Oracle University 1 Day Exam Prep Seminar to brush up on anything I had missed. I was also given a practice exam license for the Kaplan Self-Testing for the Java SE7 Programmer I exam.

As it turns out it is pretty lucky I did get the Exam Prep Seminar and Practice Testing. On first attempt of the practice test I found it harder than I had expected.

Oracle University 1 Day Exam Prep Seminar

The Oracle University 1 Day Exam Prep Seminar is a fantastic way to prepare for anyone who has studied and/or programmed in Java in the past. While I had passed my Java programming units at Uni, those exams hadn’t required me to memorise anywhere near as much detail about Java syntax, development techniques and APIs.

The Exam Prep Seminar consists of 3 hours and 25 minutes of videos, divided into 8 sections covering the major syllabus areas required to pass. It’s presented as a slideshow presentation led by Oracle expert instructor Lee Klement. Each video is around 6-12 minutes long. The material is covered quickly but in a fair bit of depth. The detail is suitable for people who have a familiarity with Java. It certainly wouldn’t be suitable for a beginner.

The prep seminar does go through a few sample questions from the exam which is quite useful to indicate what the questions are likely to be like. The sample questions make it clear that a high attention to detail is required. The programs you’re asked to analyse in the exam are not necessarily written in the way real world programs would be. They are specifically designed to make sure you know exactly how each aspect of the Java programming language works. In some ways, many of them could be considered as “trick questions”.

I strongly recommend this seminar for anyone who wants to complete the certification

Kaplan Self-Test

The Kaplan self-test was useful to practice but hard to make work. It uses either a Windows 9x testing program you need to download or a Flash-based browser test interface. I couldn’t load the self testing program on my work computer due to administrator restrictions and I couldn’t load it on my personal Macbook. Most browsers now prevent Adobe Flash from being used for security reasons. I eventually managed to find an old version of Firefox I could use on my Macbook though. Making their self-test system work really felt like going back to the late 1990s.

Once accessed, the Kaplan self-tests offer a number of options. It offers a configurable learning mode, certification mode and flash card mode. It’ll let you either simulate doing a full certification exam or just practice the syllabus areas you need to. The questions are excellent at making you think. Once completed you can view answers including information that tells you why the correct answer was correct and why the wrong answers are not correct. This makes it quite useful to improve on the things you don’t know.

The report that comes out of it breaks down the areas you need to work on, and I’ve used those to focus my study. See my study notes for the key things I thought I needed to work on.

The Exam and My Results

I undertook my exam at the Dialog Pearson Vue testing centre in South Brisbane. The setup is pretty much the same as every other certification testing setup. You’ve got a computer running just the test software.

The exam was 120 minutes and had 70 questions. They were all multiple choice and for some you will need to select more than one answer. As expected from the practice test, a lot of the questions felt like trick questions. They often use keywords and statements in ways you would not ever expect to find in production code and you may therefore be unfamiliar. They are used to test your knowledge of syntax rules and API items.

I used all 120 minutes. I finished the last question with 8 minutes to go and used the remaining 8 minutes to review the questions I had issues with. You are able to mark ones you want to review. The review was useful and I think I changed a few important errors there.

I got a score of 73%. The pass mark was 63%, but this may vary as question sets vary. So I passed first time! I definitely think my extensive study, including writing up study notes after I had issues on the practice test, definitely helped me succeed.

One last note, you won’t get your result immediately. The test instructions say it will be emailed to you, but it wasn’t for me. I had to log into the CertView site to view it. I did it an hour after completing the test and my results were available. The certification apparently follows up to 48 hours later.