Google Maps SDK and APIs using Swift 3 / Xcode 8

While trying out the Google Maps SDK on iOS and Google Maps Directions API I noticed that Google’s Getting Started code hasn’t been updated for Swift 3. Here are the changes required to get the code to work.

Google Maps SDK

  1. Follow first 3 steps (install latest xcode, install sdk, get api key) at https://developers.google.com/maps/documentation/ios-sdk/start.
  2. Create a single view application in Xcode. For viewDidLoad() function in ViewController.swift, add the following code. Note: I decided to include the API key under viewDidLoad() for simplicity.
    GMSServices.provideAPIKey("YOUR_API_KEY")
    
    let camera = GMSCameraPosition.camera(withLatitude: -33.868,
          longitude:151.2086, zoom:6)
    let mapView = GMSMapView.map(withFrame: CGRect.zero, camera:camera)
    let marker = GMSMarker()
    
    marker.position = camera.target
    marker.snippet = "Hello World"
    marker.appearAnimation = kGMSMarkerAnimationPop
    marker.map = mapView
    
    self.view = mapView
  3. Run the app. You should see a map with a single marker centered over Sydney, Australia. If you click on the marker, you should see the text “Hello World” above it. If you see the marker, but the map is not visible, confirm that you have provided your API key.

screen-shot-2016-10-14-at-12-28-09-pm

Google Maps Directions API

I decided to use Alamofire iOS library to make HTTP requests to the Google Maps Directions API as it makes it much easier than the built-in Swift methods.

  1. Use Alamofire installation instructions here: https://github.com/Alamofire/Alamofire. I went with the CocoaPods method as it was what Google Maps SDK used and it worked well for me.
  2. Get an API key for Google Maps Directions API here: https://developers.google.com/maps/documentation/directions/ (about halfway down the page).
  3. Create a single view application in Xcode. For viewDidLoad() function in ViewController.swift, add the following code.
    Alamofire.request("https://maps.googleapis.com/maps/api/directions/json?" +
                "origin=Disneyland&destination=Universal+Studios+Hollywood4&" +
                "key=YOUR_API_KEY").responseJSON
                { response in
                    print(response.request)  // original URL request
                    print(response.response) // HTTP URL response
                    print(response.data)     // server data
                    print(response.result)   // result of response serialization
                    
                    if let JSON = response.result.value {
                        print("JSON: (JSON)")
                    }
            }
  4. Run the app. You should see the waypoints and directions in the Xcode Console.

screen-shot-2016-10-14-at-12-28-26-pm

Climbing Mount Elbert

A couple of weeks ago I went to Colorado with the goal of climbing Mount Elbert. At 14,440 feet high it is the tallest mountain in Colorado.

Unfortunately I only made it to about 13,650 feet =). A combination of lack of time and mild altitude sickness (on my part) prevented my brother and I from reaching the summit. However I did get some great photos and fully intend on reaching the summit on my next attempt, whenever that is.

Video correction: 2nd tallest mountain outside of Hawaii/Alaska =).

Set up L2TP/IPSec PSK on Surface RT

Surface RT stock imageAt this time, Microsoft’s Surface RT has a very limited GUI for editing VPN parameters. For example, there’s no input field for a pre-shared key commonly used with L2TP/IPSec VPN type. Since there’s limited information for setting up more advanced VPN connections on Surface RT, I figured I would post these simple steps.

  1. Use Windows 8 powershell vpn cmdlet: http://technet.microsoft.com/en-us/library/jj613766.aspx
  2. Open up Powershell
  3. Example:Add-VpnConnection –Name “My VPN” –ServerAddress vpn.mydomain.com –TunnelType L2tp –L2tpPsk 5E2BBC9D423B50A2 –RememberCredential 1 –SplitTunneling 1

S Symbol in Your Emails

I recently ran into an issue where the š character appeared in a client’s emails that weren’t there when she sent them. This was apparently caused by Outlook 2011’s autoformatting options that replaced … with a special ellipses character, which wasn’t supported in all mail clients.

Here’s how you can disable that feature and thus avoid unintentional symbols in your emails.

1. Open Outlook and go to Outlook preferences.

Screen Shot 2013-11-06 at 10.41.31 AM

2. Select AutoCorrect under the Personal Settings category.

3. Select AutoFormat tab and uncheck “…” with ellipses.

Screen Shot 2013-11-06 at 10.43.42 AM

Pesky RunDLL Virus Errors at Logon

One of our user’s computers was infected with a virus that, after being removed and cleaned up, left these annoying RunDLL errors for DLL files with randomly generated filenames which occurred every time the user would login:

logon errors

I didn’t get far trying to google some keywords related to the errors. However, some results did point me in the right direction for resolving the issue.

Basically, you want to check every possible repository of startup items or commands. In the registry, most google results told me to check the following locations.

  • HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows/CurrentVersion/Run
  • HKEY_CURRENT_USER/SOFTWARE/Microsoft/Windows/CurrentVersion/Run

However, where these virus-caused items actually ended up being was under a specific user profile in HKEY_USERS:

HKEY_USERS/userprofile/SOFTWARE/Microsoft/Windows/CurrentVersion/Run

I should mention that CCleaner did not list them under the startup category and neither did msconfig, so registry might be the only way to find them that I know of.

A 23-year-old Learns About Retirement Accounts (and their tax benefits)

So I didn’t really know about this, but apparently opening a retirement account and putting money into it instead of savings is a really nice way to get higher tax return (or owe less taxes) and a much better interest rate as well.

Contributions to traditional IRA still count for the previous tax year if you make them before April 15.

You can quickly see how much of a difference it would make by using this tax estimator (under the retirement button): http://turbotax.intuit.com/tax-tools/calculators/taxcaster/

So basically you can open an IRA (I did through betterment.com cause it’s cheap and quick), move some money from savings, and put the retirement contribution on your tax return.

The only drawback is you cant withdraw it without a 10% penalty until you’re 59 years old, unless it’s for education, buying/building first home, or medical expenses – which are some of the primary uses of my savings anyway.

Office 365 SMTP Settings

Update, in new office 365 UI:

Server name: smtp.office365.com
Port: 587
Encryption method: TLS

  1. Login in to the Microsoft Online Services Portal.
  2. Click on Outlook.
  3. Click on the question mark icon in the upper right corner of the page.
  4. Click on About.
  5. There will be a section titled External SMTP setting that will contain the server name, encryption type and port. You will be able to use those along with your username and password to send email from devices/programs.

 

Change Office 365 Password Expiration Period

Update: This is now available via the Office 365 administration portal:

Screen Shot 2013-10-11 at 10.03.26 AM

If 90 days seems too short of a period before your Office 365 users’ passwords expire, you can change it via a powershell cmdlet.

Set-MsolPasswordPolicy -ValidityPeriod <days> -NotificationDays <days> -DomainName contoso.com

Validity Period: time before expiration

Notification Days: how many days prior to expiration that the user begins to receive notification pop-up

Make sure you use Powershell to connect to MS online service first: http://onlinehelp.microsoft.com/office365-enterprises/hh124998.aspx