Wednesday, January 9, 2019

Tips from my experience as an Aussie moving to San Francisco

It's been a while since I posted anything on this blog - I figured it was about time to rectify that!

Since my last post I've spent nearly 4 years working at Invoice2go, an Australian startup that received funding from some VC firms in Silicon Valley. I spent the first couple of years working out of their office in North Sydney before the opportunity came up to relocate to the Bay Area to work out of the Redwood City office. This was something I'd wanted to do at some point in my life so I jumped on the chance to make the move. 15 months on I am settled into the area and thought I would share some tips that I found during the relocation process. Hopefully this post comes in handy for anyone else looking to make the move.

Background

First of all, some context. There were a number of things that made this move easier on me than perhaps it would have been for other people. First of all, I'm fortunate enough to have been born and raised in Australia, which has a long history of being a very close ally of the United States. As a result we have access to a special class of visa called the E-3. This (strangely enough) was created as part of free trade deal negotiations that happened during the wars in Iraq & Afghanistan - it supposedly was added a a sweetener to try and get Australia to continue it's commitment of troops. This visa is much simpler than other visas like the H1-B in that it's purely reserve for Australians, with a yearly limit that we never come close to hitting. It's a 2 year visa that you can renew indefinitely by leaving the country and doing another interview. It's also very cheap and the process is relatively simple. I often reflect on how fortunate I am to have access to this visa and have sympathy for others who have a tougher visa situation.

Secondly, as I was relocated by my existing employer I'd already had the chance to visit the Bay Area a number of times and knew the team quite well over there. I was also continuing in a pretty similar role to what I was doing in the Sydney office, so there wasn't any stress of starting a new job added into the move - I simply continued my job the next week but in a different office. 


Prior to the move

If you are planning to make a similar move there are some things you can do to make things easier on you when you come over. 

Get an American Express credit card

Building credit in the USA takes a long time, and most credit providers won't recognize your great Australian credit rating. This means that when you arrive in the USA you'll be stuck either with your Australian credit cards, your debit card from your bank (which may take a few paychecks to build up in funds) or a secured credit card with a very low limit. However American Express is an exception to this rule - they can transfer you from Australia to the USA, and they will take into account your internal credit history with them. So as soon as you are thinking of making a move to the USA I'd recommend applying for an Amex. You can often find good bonus points deals for Amex cards on Ozbargain which might help you pay for some flights in the future. Sign up, use it as much as you can and always pay it off promptly. Then when you move to the USA give them a call and ask to do a global transfer

Thanks to my history with Amex in Australia I was able to get approved for a Platinum Amex card, which was very helpful in the first month until a couple of my paychecks at come through. This allowed me to avoid transferring too much money from my Australian bank account (with the associated fees). Even after a year the only credit cards I had were this fancy Amex and a bunch of secured credit cards meant for people with bad credit scores - kind of weird, but it works.

Move your mobile number to a prepaid sim card

This may not apply to everyone, but I wanted to keep my Australian number active while living in the USA. There are a few reasons that I wanted to do this:
  • I planned to keep bank accounts, credit cards etc active in Australia - so a local phone number is useful for authentication purposes where a 2fa app isn't an option
  • While many USA sim cards offer free global data roaming at slow speeds, I'd prefer to use my old number when I visit Australia and pay for high speed data
  • You never know what is tied to your old phone number that you'll suddenly need access to, or who will attempt to contact you
Obviously you don't want to pay a high monthly fee for the phone when you aren't using it, so move your phone to a prepaid sim that has the option of a small yearly top-up. I went with Aldi Mobile. They had a pay as you go option with 365 day expiry for $15. Whenever I visit Australia I just top up with a 'value pack' (last time was $25 for 9gb and unlimited calls/sms). It's great. 

It's worth moving to this plan before you go as transferring your number gets more complicated if the address is different on your two phone accounts and it is more complicated to do it from overseas.

Plan your Australian mailing address

If you're planning on keeping some accounts open in Australia (bank, credit card, super, etc) it's useful to have an Australian mailing address. Hopefully your parents, siblings or close friends are ok with you sending your mail to their place, or you could do a P.O. box or something like that. I'd recommend starting to update all of your addresses before you move. Once you move out of your place in Australia you can also setup a mail redirection through Australia post to this new address to catch any accounts you've forgotten to update. 

Renew your passport and drivers license

This is something I didn't do, but wish I did. My passport had a 10 year expiry and I was over 8 years through it when I got my E3 visa. The visa gets affixed to a page inside your passport, and if you get a new passport it doesn't get transferred. There are generally problems with traveling to the USA on a passport with less than 6 months until the expiry, so after a year of living in the USA I had to get a new passport. This involved finding a a place who understood the strict Australian passport photo requirements (A Better Passport Photo in San Francisco was perfect for this) and then going to the Australian Consulate to renew the passport. This wasn't such a big deal, but as the E-3 doesn't transfer you I now had to carry around two passports everywhere I went. It would have been easier if I just renewed it in Australia prior to applying for the visa.

I also have a NSW drivers license that is going to expire soon, and I'm sure renewing it will be a pain - I have no NSW residential address (my parents are in QLD) and even just getting to the office to renew it will be a pain given I mainly transfer over the holiday period. It would be easier if I had a longer expiration date on my license to begin with. 

The visa application process

After receiving the offer to relocate we kicked off the visa process. There's a few good posts online about it so I won't go into too much detail, but in my experience the process from engaging the lawyers to receiving my passport with visa attached was around 3 weeks. This fluctuates depending on appointment timing and other factors, but for me it went quite smoothly.

Some people opt to do this process without the assistance of an immigration lawyer, but I'd recommend getting your employer to engage with one - it reduces the stress and uncertainty of the process. 

I was living in Sydney and did my interview at the consulate there, whilst working with the lawyers in the USA. Here's an idea of the timings:

Day 1 - Lawyers started the process
Day 3 - LCA filed
Day 8  - LCA certified
Day 14  - Documentation signed & case filed
Day 20  - Visa interview at consulate, approved on the spot
Day 22 - Received passport with visa in the mail

Logistics of the move 

Moving country is always going to be a logistical challenge. My partner and I had no pets or children and our apartment lease was month to month which meant that things were simpler for us than they might otherwise have been. It was still a lot of work to pack pup the apartment, sell my car & a bunch of other possessions, make good on the lease, move to temporary accommodation and then get to the airport. 

Every situation is likely to be unique, but some tips that I have in general are:
  • Before you sell every little thing on Gumtree/Ebay consider if it's worth your time. It may not be worth the hassle to sell various $10-50 smaller items in the rush of planning a big move. The weird and wonderful people of Gumtree can take up quite a lot of your time!
  • Take note of the local council rubbish collection policy in your area. My area only collected large items (like mattresses) on a certain day of certain weeks. We thought someone was going to buy our whole bed/mattress setup so we didn't put it out for collection on that day, but they didn't end up coming. As a result we had to pay a bunch of money for a garbage collection agency to come pick up the mattress and some other items in a last minute rush. Granted we could have just dumped it outside our apartment but we wanted to do the right thing.
  • Use the recommended cleaners from your real estate agent. It just makes the process easier - they know each-other and if the cleaners don't do a good enough job they'll chase up with them directly. You don't want that stress just before you fly out of the country!
  • Think about if you really want to move your stuff to the USA. I decided that it wasn't worth it. The cost of shipping is quite high and it takes a long time. Consumer goods are much cheaper in the USA, chances are you can furnish your whole apartment with Ikea and Amazon for around the same price as shipping everything across. We ended up just maxing out our luggage allowance on the flight over (we had status with Virgin Australia so were able to get 6 checked bags total).

Getting setup in the USA

When we arrived in the USA we were in a motel for a few weeks while we found an apartment to live. It'll probably take 3-4 weeks to find an apartment so you'll definitely need some temporary accommodation, and in the Bay Area even Airbnb is not cheap, so make sure you factor this into your costs/negotiation with employers. 

Finding an apartment

The Bay Area has a real housing shortage at the moment, so housing is competitive and very overpriced. A one bedroom apartment can set you back between 3 and 4.5 thousand dollars a month. If you thought Sydney was expensive wait until you arrive here! 

There's a few websites for finding rental properties - Zillow, Trulia and Craiglist are some popular ones. Craiglist can be known for scams - if it looks too good to be true it probably is. 

Given that you've just arrived in the area, you won't have any credit or rental history, so some of the cheaper more competitive places might be harder for you to get. Given that we had limited time in our temporary accommodation and were brand new to the area our strategy was to just pay a little extra for an apartment in a large building. There's a number of newer developments that have a rental office attached to them, you can book an appointment and go for a tour of the amenities and see some example apartments. We figured we'd rather pay more for at least the first year and avoid any stress with bad landlords or not-so-great areas. 

When we applied for a place our lack of credit history meant we needed to pay a months worth of rent up front as a deposit, not a big deal but it was lucky we had a couple of pays in our bank account by this point. 

Something else to keep in mind here is the location of your work and what your commute will be like. As we were working in Redwood City we ended up in Mission Bay as it's close to the Caltrain. There's only 2 Caltrain stops in the city, so it really constraints your options unless you are willing to  do a commute that involves multiple forms of transport. 

Social Security Number

One of your top priorities after landing should be to get your Social Security Number. The advice I received is that you need to wait 4-5 days after entering the USA in order for your information to be in the system, so we waited a week and then tried to go into the social security office. Katherine has a good post on this process. It took me 3 visits to get it done, first day I went there was a public holiday that government offices observed so it was closed. Second day I went as soon as they opened and the line was massive already - part of this is because of the build up from the day before I'm sure, but from what I've read this isn't uncommon. Third day I decided to get there 40 mins before they opened, and was 6th person in line. This is what I'd recommend you do - get there before they open and line up. 

Once you've got your SSN, you should provide it to your employer. Strangely enough I didn't need it in order to get my first pay - a temporary SSN was used and the tax agency was updated afterwards. I'm not really sure how that works, but it was helpful.

Bank accounts

Getting a bank account was surprisingly easy. I walked into a Wells Fargo office and was able to get a bank account by bringing in my Australian passport. I didn't have an SSN (I added it later - it's important for your credit score) and put in my companies address.  It's important to fix all this information up later, and apparently you should remember that your companies address was once used as a bank account location as it may come up when dealing with credit score related things later on. 

For a credit card, as mentioned above I did a global transfer with Amex. A couple of months later I also setup a couple of secured credit cards in order to build my credit score. Don't rely on your Amex alone to build the score as it's a charge card rather than a traditional credit card so it will hold you back a bit. 

Drivers license

Your Australian drivers license will only work for a short period of time in California. There's a bit of confusing information flying around (apparently the DMV has been giving out conflicting information). The guide I followed was that 10 days after arriving in the state on your E-3 visa you won't be able to legally drive with your Australian license anymore. It will probably be different in other states as each state has a different set of rules. Some people choose to continue driving after this point, but the main thing I was worried about is not being covered under insurance if you are technically driving unlicensed. 

So after 10 days you'll need to look at getting a Californian drivers license. Katherine has a great blog post with some information on this. It involves taking a knowledge test, much like the learners license in Australia, and then a practical test. In my experience the knowledge test took a bit of study, as there's a different enough set of rules to remember and all the speeds and distances aren't in the metric system like I was used to. The DMV website has a downloadable handbook to refer to, and I found a great website with extra practice tests. With some study I was able to pass the written test. 

Even though I had signed up for Zipcar (possible even with an Australian license) to get easy access to a car to drive around, you cannot use it for the practical test. Because you aren't legally allowed to drive, you need someone to bring you to the test and you apparently can't just bring a rental car. I found a great service called YoGov who will pick you up, let you practice for a couple of hours and then come with you to the test. The couple of hours of practice were more than enough for me - the practical test was much less strict than in Australia - instead of parallel parking all I had to do was reverse in a straight line! 

Make sure to refer to the DMV website to find out what forms of I.D. you need to bring to your appointment, and be sure to make an appointment - the lines can be very long without it. 

Useful resources 

There's a good community of fellow Aussie expats that have also made the move to the USA. I found some great Facebook groups that are useful to search through for information, particularly around the visa process. Here's a list of useful resources I found:

Good luck!

Hopefully there's some useful information in this post for anyone who is looking to make a similar move. The USA is a great country to live in and explore, and is full of great people. Feel free to reach out to me if there's anything I can do to help you on your journey, or post on one of the Facebook groups - there's lost of helpful Aussies there. 



Sunday, February 16, 2014

[Revit API] Binding a project parameter to all categories

In a recent project I had the need to create a new project parameter, and then set the value of it on certain elements. This post has great information on creating project parameters, however that post along with much of the Autodesk documentation add certain parameters to the CategorySet for the InstanceBinding method, what I wanted to do was add all of them. Unfortunately adding all categories in document.Settings.Categories throws an error as not all categories can have parameters bound.

There is a simple solution to this, only add categories to the CategorySet if they have their AllowsBoundParameters property set to true. It’s an obvious solution once you know this flag is available.

CategorySet categories = app.Application.Create.NewCategorySet();

foreach (Category category in doc.Settings.Categories)
{
    if (category.AllowsBoundParameters)
    {
        categories.Insert(category);
    }
}

Saturday, January 4, 2014

Setting up node-postgres with a new PostgreSQL installation on OSX

I was getting a PostgreSQL installation setup with NodeJS today on my computer and ran into some difficulty that I thought I'd write a post about in case someone else comes across the issue.

I started off by downloading the PostgreSQL installer from the PostgreSQL website (I had also tried Postgres.app) and running through the installer with mostly default settings.

Once that was done I went to install the node-postgres module in my node project via 'npm install pg', this threw the following error:

gyp: Call to 'pg_config --libdir' returned exit status 127. while trying to load binding.gyp

After some searching I found this Github issue which pointed me to the solution. The problem is that the installer did not add the PostgreSQL binary folder to my PATH. To get around this, I updated my ~/.bash_profile (vim ~/.bash_profile is the easiest way to do this) to add the following line:

export PATH=/Library/PostgreSQL/9.3/bin:$PATH

(be sure to use the version of PostgreSQL you installed. Also, if you already have that line, you should just add '/Library/PostgreSQL/9.3/bin:' after PATH=)

Save that file, restart terminal and you should be able to type pg_config and get some output on your screen. Once you've done that, reinstall the node-postgres module and you should not see the error anymore.

Hope this helps!

Wednesday, November 13, 2013

SQLite.Net ORM with Task Parallel Library in Xamarin

I've recently had the opportunity to work on a Xamarin.iOS project with Envoy. Having previously built iOS applications with Objective C I've been enjoying the chance to investigate techniques to share code across platforms.

With Xamarin, you can share some common code between Android and iOS projects if you structure it in a certain way. One technique that is commonly used to share code is to use the SQLite.NET ORM with SQLite rather than using Core Data or other device specific data access API's. Xamarin themselves have used this for an application which they've open sourced as example code: MWC 2012 

In that application, they create a subclass of SQLiteConnection with a static constructor that initialises a static variable to hold a reference to itself, as a kind of singleton. I followed this pattern in my code, however I've since discovered that this is perhaps not the best approach in all circumstances.

My application makes use of the Task Parallel Library to do some web service calls and subsequent database updates on a background thread. Much like the MWC sample I wrapped my calls to the database with a lock so that multiple threads won't update the database at once, and the application appeared to work correctly. However at various stages during my testing I came across seemingly random crashes, where the application which had been working fine would crash out of the blue with an error similar to the following:

mono-rt: Stacktrace:
mono-rt: at <0xffffffff>
mono-rt: at (wrapper managed-to-native) SQLite.SQLite3.Prepare2 (intptr,string,int,intptr&,intptr)
mono-rt: at SQLite.SQLite3.Prepare2 (intptr,string)
mono-rt: at SQLite.SQLiteCommand.Prepare ()
mono-rt: at SQLite.SQLiteCommand.ExecuteNonQuery ()
mono-rt: at SQLite.SQLiteConnection.Execute (string,object[])

This isn't particularly helpful and originally made me worried that perhaps the SQLite.NET ORM wasn't stable. However after some more research I've discovered that others were having the same problem and that they believed it was caused by the SQLite connection being accessed on different threads, even if it's not at the same time. When you think about it, of course this is an issue - the subclass of SQLiteConnection shouldn't be a singleton, it's a connection similar to those seen in ADO.NET and should be thread specific and closed when not needed. I believe the MWC application musn't have ran into this issue as they were only doing updates to the database on certain threads, not leaving it up to the Task Parallel Library.

So now, instead of having a singleton in my SQLite Connection, I'm using it in the IDisposable fashion it is designed to be used so that a connection is opened and closed with each query.
using (var db = MyDatabse.NewConnection())
{
    db.Insert(itemToInsert);
}
I've since stopped having the random application crashes. Hopefully this helps someone out who is having the same issue.

Tuesday, May 28, 2013

Styling Two or More Fusion Tables Layers in Google Maps

The Google Maps API has a feature called 'Fusion Tables Layer' which lets you overlay data from a Google Fusion Tables. Using this feature, you can upload some KML data into a Fusion Table and see it represented on the map (for example, you can highlight an area on a map to represent some sort of data). The Maps API has in built support for using KML directly, however KML files can get quite large for complex data, so using Fusion Tables is a high performance alternative (Google handles large data sets with ease) This is what my exmaple Fusion Table with KML data uploaded looks like:


You can display markers, polygons, and polylines on a layer and can style each of these as you wish using the options supplied to the API call. An example of the code to do this is available here.

If you have multiple bits of data to show, you can add multiple layers from a range of different Fusion Tables. However, there is one limitation, which is pointed out in the documentation:
Styles can only be applied to a single Fusion Tables layer per map. You may apply up to five styles to that layer.
I recently ran into this limitation when trying to overlay two separate (complex) data sets. For my use case, I wanted to show data from two different Fusion Tables with two different styles, which means I was out of luck. I tried a number of workarounds to avoid this (seemingly odd) limitation. I attempted to combine them into the one table, but the queries don't allow OR statements,  I then tried using my own KML file, however that came out larger than 1MB, which loaded very slowly, whereas the Fusion Tables layer handled that data with ease.

I then attempted to add styling information to the KML file before uploading it into the Fusion Table interface (as KML supports this), however the upload process strips that information out. It was while searching for a way to get around this that I found the solution. I discovered that in the Fusion Tables interface you can add your own map, style it there, and it will give you code to easily embed it. This is designed to allow those without coding skills to style and embed a map on a blog or web page. Great! I thought, a bit annoying that I have to store that information in an external dependency instead of in my own code in source control, but at least I can solve this problem (I could perhaps use the Fusion Tables API to set this style from within my application, at the cost of a few HTTP requests).

However when I went to find this map tab that the documentation mentions, it was greyed out...


There's no mention that I could easily find on the page explaining why it was greyed out, but I had a hunch. Given how terribly Google has dealt with Google Apps accounts, I figured that seeing as I was signed in with a Google Apps email, it might have something to do with that. Signing into my personal Gmail revealed that my hunch was indeed correct, I can add a map (you may need to give that account write permissions or copy the table to your personal account).

Sigh. Some searching uncovered some documentation on this. You have to submit a request to Google asking them to turn it on. Would be nice if they just mentioned this in the interface...

Once you've added a map, tools > change map styles will let you style it.
 
You're note quite done yet though, simple embedding this table into the API won't do it, you need to tell the API which style and which template to use in your map. There's some documentation on getting the style number and setting it in the Maps API here. I couldn't find an easy way to get this Id from the API, but it's probably a small number if you just want to try numbers up from 1,2,3,4 etc. Next you need the template ID, which you can find by clicking on the map tab's dropdown and clicking publish. At the end of the URL the querystring will have the template ID as 'tmplt'. 

You then pass these through in your maps API call like so:
 gridLayer = new googleMap.FusionTablesLayer({
                            query: {
                                select: 'geometry',
                                from: fusionTableId,
                            },
                            map: map,
                            templateId: 2,
                            styleId: 2,
                            clickable: false
                        });


You should them see your styled map embedded in your page. Simple... right?

Friday, June 29, 2012

Using C# Named Parameters for Code Readability

In C# 4.0, Microsoft introduced a feature called 'Named Parameters', which lets you refer to parameters in a method that you are calling in a syntax like this:
 
public void MyMethod(firstParameter: firstValue, secondParameter: secondValue)

This lets you call the method with parameters in a different order, and also helps to facilitate optional parameters. Aside from these benefits, I've come to like using them to improve code clarity, particularly in unit tests.
 
Lets say you have a method like this one:
 
public decimal CalculateFuelCostPerKm(double kilometresTravelled, double litresInFuelTank, decimal costToFillTank)
 
If you were to call that method, you might do something like this:
 
CalculateCostPerKm(500D, 60D, 72.58M);

However if you are reading that and don't know the parameters, you're going to have to dive deeper to understand it. A way to improve it might be:
 
var kilometresTravelled = 500D;
var litresInFuelTank = 60D;
var costToFillTank = 72.58M;
CalculateCostPerKm(kilometresTravelled, litresInFuelTank, costToFillTank);

Which is much clearer, but is a fair bit of effort. But with C# named parameters you can do this:
 
CalculateCostPerKm(kilometresTravelled: 500D, litresInFuelTank: 60D, costToFillTank: 72.58M);

Simple to do, and clear to read. In fact, this is probably one of the rare situations where C# being written
more like Objective-C is a good thing. Take this example for creating an alert dialog in the iOS SDK:
 
- (id)initWithTitle:(NSString *)title message:(NSString *)message delegate:(id)delegate cancelButtonTitle:(NSString*)cancelButtonTitle otherButtonTitles:(NSString *)otherButtonTitles, ...
 
Which you would call like:
 
[[UIAlertView alloc] initWithTitle:@"Error" message:@"You stuffed up" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];

Or in C# you might do something like this (ignoring the delegate business):
 
UIAlertView.InitWithTitle("Error", "You stuffed up", myDelegate, "OK", null);

As you can see, the verbose nature of Objective-C makes for clearer code in this instance, however, we could write the C# method like:
 
UIAlertView.InitWithTitle(title: "Error", message: "You stuffed up", delegate: myDelegate, cancelButtonTitle: "OK", otherButtonTitles: null);

Which makes it just as clear.
 
I've found this technique particularly useful in unit tests, which often tend towards using constant values. For instance I might often have a method to setup a certain state in my stubs where I take in the important parameters required, this technique makes this much easier to read.
 
I’d love to hear your thoughts on this technique, either in the comments on this post or via Twitter (@rodh257)

Sunday, June 17, 2012

What's been happening?

It's been a fair while since I last posted to this blog, so as I start lining up a few more blog posts I thought I'd make a quick post to let you know what I've been up to over the last 6 months.

The last post I made was about an experimental technique I'd created for running Revit API add-ins as scheduled tasks. This was a part of my Autodesk University 2011 virtual presentation, which is online now. If you don't have access to the AU Online website I've uploaded the slides and handout and the sample code for the Revit Remote Boot and Html Server Admin are on Github. This was a pretty niche topic, but it was fun to dive into, and I hope people got some good use out of it. It's worth noting that Revit Server 2013 is now out, and makes a few changes which could affect this code (I'd be interested to hear if you were using this code).


After this post was made I have started work with a new company, Envoy Advanced Technologies. Envoy are an agile software development firm that primarily work on web-based business applications. This has given me the opportunity to work on some big software systems with some really brilliant developers using some great development techniques (as a shameless plug, if you're looking to have a software system developed, whether it involves Revit or not, you could do much worse than to get into contact with Envoy).
Aside from the larger projects, I recently worked on the iOS and mobile web apps for this years Revit Technology Conference. Envoy were a sponsor of RTC AUS and the USA version of the conference is starting in a couple of weeks time, if you haven't had a look yet I recommend you head to their website and look over the schedule. It looks to have some really good classes, including one on Revit Server.

This change in employer has meant that I've not been working as much on Revit add-ins as I used to, hence the lack of posts on the topic. I am however still tinkering away with it in my spare time, and have a few ideas floating around my head for nifty ways to use the new 2013 API features which I hope to post about in the future.
In my spare time, I've released an update to Convoy, my iOS app to make it easier to communicate when travelling in a group of vehicles. Primarily it includes a graphics overhaul which is thanks to Vanessa Grixti.

This and other projects I've been working on are great as they give me the chance to dive into some product development/management, which is an interest of mine, I've been blogging about these sorts of topics over at Cejest, but I'm planning on moving those posts over to this blog.

In addition to these posts, I'll be writing more about general software development topics, both technical (C#, ASP.NET MVC, iOS etc) and non-technical, including posts on workflows, development practices etc. A reminder that if you aren't interested in reading this, and just want Revit content, there's a link to a Revit topics only RSS feed on the right of the blogs main page.

If you've got any feedback or questions feel free to email me (mail@rodhowarth.com) or ping me on twitter (@rodh257).