Tuesday, May 24, 2016
Sunday, May 15, 2016
I have been very interested in the ongoing discussion about the iPad-only lifestyle on all my favorite podcasts. It has made me think a lot about how I use my iPad and more importantly how I could be using my iPad for more tasks. A few weeks ago I bought a 9.7" iPad Pro with the intention of taking my iOS game to the next level. It has been an interesting experiment and has required me to rethink my usual workflow at both home and work.
The Dev Diary
The first thing to go was going to be my “Daily Dev Diary”. For the last few years I have been printing out a sheet of paper each day for keeping me on task and for keeping track of little things that happen during the day. Each morning I take my notes from the previous day, update the source document and then create the next day. The document has four sections to cover things I want to do over the long term, things I did yesterday, things I have to do today and random notes.
Migrating this process to include the iPad, was pretty easy once I settled on using Good Notes 4 as the primary note for note taking. I start by editing the master markdown document on my laptop and print the current day out to a PDF using Google Chrome. The PDF resides in OneDrive, which I use for all of my work file needs. I open up Good Notes 4 and import the document using the OneDrive integration. Once in the app I am able to use my Apple Pencil to markup the document as I had before. At the end of the day I export the document back to the OneDrive folder and voila it is ready for the next day. It was weird at first walking around with the iPad, but eventually it became natural and I don’t think I could go back to using the paper.
One of my extracurricular activities involves being the secretary for the local youth baseball league, Merrimac Baseball. Due to my recent success with my dev diary, I thought it would be a piece of cake. I immediately ran into a problem with the first step in the process, duplicating an existing iCloud Drive document. I normally take the previous meeting minutes markdown file and make a copy, but there didn’t seem to be an easy way to do this in iOS. I opened up the iCloud Drive app, but it only provided me with a limited set of options. My markdown editor of choice, Byword recently added support for editing iCloud Drive documents, but I couldn’t figure out how to “Save As” or “Duplicate” the files. In the end I turned to Workflow for iOS and created a custom workflow that would let me select an iCloud Drive file and save it somewhere else. It took a few tries to get it right, but now I have it there to use whenever I need to copy a file. Once I duplicated the file it was all downhill from there, because I just used GoodNotes for my note taking.
After the meeting I had to transcribe my notes back into a markdown file, which I did using the new split screen feature in iOS 9. Byword had some problems displaying the full keyboard in split screen mode so that wasn’t great, but I did eventually figure it out. Finally after exporting the PDF to iCloud Drive I had to upload it to the baseball website. At first I wasn’t sure if it was possible, but once I clicked on the file chooser button on the web page in Safari, I was presented with my iCloud Drive directories and quickly found the PDF and added it to the site.
Learning the Ropes
So far the iPad lifestyle experiment has been successful for me because the device is so portable and I have found my original assumption about it being too much work to do things in iOS was flawed. There are definitely times when I have to put on my thinking cap and figure out the iOS way to do something, but in most cases it involves a simple solution, I will easily be able to apply in the future. I look forward to continuing this trend and expanding the amount of things I can do on this wonderful little device.
Monday, May 9, 2016
Last night I published the first episode of my new podcast, Kilobyte. It is a microcast where I will be talking about my thoughts on a wide range of my interests like technology, life as a software developer, the parenting and hopefully some funny anecdotes about my life. Initially I want to post 5–10 minute long episodes a couple times a week. Although I am looking forward to seeing how it evolves over time as I learn my voice and start to get better at audio editing.
Here are a few ways to subscribe:
Saturday, May 7, 2016
I have been using Heroku for over a year now and have learned quite a bit along the way. I have a very simple Java web application for my work softball team, TAP Softball. It uses a Postgres database and contains basic information like the teams, schedule and standings. The database connection is configured using Spring and Hibernate, with the database URL and credentials hard coded right into the Spring context file. Using Eclipse and the Tomcat plugin I can deploy the web application locally to test changes prior to deploying to the server. I also have a local database I use for testing database changes before pushing to the live database. In the Spring context file I have a commented out localhost datasource defined, which I swap in when testing locally.
Yesterday, I received an email from Heroku that my database was going to be upgraded with the latest Postgres changes. A few minutes later an email confirmed the upgrade finished successfully. I had seen these messages before and thought nothing of it until this morning when I tried to use the site and got a big fat stack trace.
It didn’t take long to see the database URL and credentials had changed, which as you probably figured out was problematic since I had them hard coded. I quickly scrambled to fix the issue because I didn’t have access to my MacBook. The Dropbox deployment method didn’t work so I installed the Heroku Toolbelt and was able to update the database connection information. The site was back online, so I took a breather and then emailed support to find out what was going on.
Support promptly responded to my message and explained that if an upgrade doesn’t go perfectly the database will move to a different address and reset the credentials. He also said I should be loading my database connection information from the environment variables, so it will start up correctly should the database move again. I did a little searching and found Connecting to Relational Databases on Heroku with Java. After scrolling down I quickly found that I had to add a new Spring bean that would instantiate a Java URI using the DATABASE_URL environment variable. I also had to update my existing dataSource bean to get the host, port, path, username and password from the URI bean. I pushed the change up to Heroku and it worked.
My next challenge was to get my development environment working again, because now Tomcat was getting a null pointer exception when trying to generate the URI bean. After some trial and error I figured out that I needed to modify the run configuration for the Tomcat server in Eclipse to have a new entry in the Environment tab for the DATABASE_URL. The value to use came from my app’s database page on the Heroku site, in the last item called URL. Making this change and starting the server loaded the homepage, but when I attempted to load a page that used the database I received an error about SSL.
I remembered having problems connecting to the database originally, and to fix it I added
?ssl=true&sslfactory=org.postgresql.ssl.NonValidatingFactory to the end of the path. Unfortunately just sticking that onto the end of my Run Configuration’s environment variable didn’t work. I also had to add
+ '?' + @dbUrl.getQuery() to the end of the url property in my datasource bean. In the URI the part after the question mark is called the query and by appending it to the end of the path it fixed my issue. I pushed the change up to the server and it still worked fine. The best part is now I can easily create separate run configurations for the remote and local databases rather than randomly updating one of my Spring configuration files.