Paul Brown

Failure to Learn

Programmatically Reading and Converting Database Sizes With Exchange 2013 Powershell

For quite a while I’ve had automated PowerShell scripts that monitor our Exchange database sizes. I set this up so we could see weekly/monthly/annual growth patterns for different departments in the company. We weren’t really concerned about running out of space on the backend servers, but it would be good to have a rouch idea of the trajectory. And more data is always better, right?

To start, here is how you get the database size in Exchange PowerShell:

> Get-MailboxDatabase -Status <databaseName> | select DatabaseSize

8.063 MB (8,454,144 bytes)

That size format is a bit odd, but in Exchange 2010, PowerShell would let me convert that to gigabytes, using the ToGB() function on the DatabaseSize property. So, I set up a script to iterate through all of our databases, convert each DatabaseSize to GB, and then enter that data into a database.

ForEach ($db in $arr) {
  Get-MailboxDatabase -Status $db | select DatabaseSize | ForEach {
      $size = $_.DatabaseSize.ToGB()
      $query = "INSERT INTO ``sizes`` (``timestamp``, ``database_id``, ``size``) VALUES (DATE(NOW()),(SELECT id FROM ``databases`` WHERE db_name LIKE `'$db`'),$size)"
      Write-Host $query
      $Rows = WriteMySQLQuery $conn $query

The WriteMySQLQuery at the end is just a function defined elsewhere that executes the MySQL query.

After we upgraded to Exchange 2013, these scripts stopped working. I tried running the script manually so that I could see errors, and I saw a bunch of these:

ForEach : Method invocation failed because [System.String] doesn't contain a method named 'ToGB'.
At C:\exchangescripts\db_sizes.ps1:99 char:58
+     Get-MailboxDatabase -Status $db | select DatabaseSize | ForEach {
+                                                             ~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [ForEach-Object], RuntimeException
    + FullyQualifiedErrorId : MethodNotFound,Microsoft.PowerShell.Commands.ForEachObjectCommand

I don’t know the exact reason, or I at least can’t find any documentation indicating that Microsoft changed anything. However, in my search for a solution, I found this forum post, which gave me the fix. I inserted these two lines at the top to load the Exchange Data dll:

$dll = "C:\Program Files\Microsoft\Exchange Server\V15\Bin\Microsoft.Exchange.Data.dll"

Then I used a ByteQuantifiedSize object to hold the DatabaseSize property, like so:

[Microsoft.Exchange.Data.ByteQuantifiedSize]$obj = $db.DatabaseSize

Working this concept into the original script above, it now looks like this:

ForEach ($db in $arr) {
  Get-MailboxDatabase -Status $db | select DatabaseSize | ForEach {
      [Microsoft.Exchange.Data.ByteQuantifiedSize]$rawSize = $db.DatabaseSize
      $size += $rawSize.ToGB()
      $query = "INSERT INTO ``sizes`` (``timestamp``, ``database_id``, ``size``) VALUES (DATE(NOW()),(SELECT id FROM ``databases`` WHERE db_name LIKE `'$db`'),$size)"
      Write-Host $query
      $Rows = WriteMySQLQuery $conn $query

This is how I got my data out of Exchange. I also set up a task in Task Schedular to run this every night. Over time this generates a nice bit of data that can be charted. Once I have a bunch of data, maybe I will come back and edit this post with some of those visulations.

How I Track Which WWDC Videos I’ve Watched

It’s that time of year again, when Apple developers around the world get back home from WWDC (or are still at home and well-rested, like me) and start trying to soak up all they can from the session videos. I always have intentions of watching ALL THE VIDEOS, but inevitably I just catch the ones that are pertinent to what I’m doing. If you write iOS and Mac apps for a living, though, you probably watch more than me.

One problem I have with the session videos is that sometimes I forget which ones I’ve actually watched, especially if I watch them sporadically. My solution to this is to create an Evernote checklist with all of the sessions listed and I check them off as I go. As stupidly simple as this sounds, it’s very effective, so I thought I’d share my WWDC 2014 checklist. You can download the file below. Enjoy! And please send any suggestions for improvement.

Update (2014-07-25): I’ve now created a similar Evernote file to track NSConf 6 and UIKonf 2014. I may also add one for Çingleton.

WWDC 2014 Evernote note file – just import it into Evernote
NSConf 6 Evernote note file
UIKonf 2014 Evernote file

Tools of the Trade - 2014 Edition

Toolchest Dock

I’ve been running a side business for a little over a year now. The term “running” might be a stretch, because I released an app in June of 2012 and have just been issuing updates since then. Don’t get me wrong – I haven’t been just resting on my laurels. I try to stay up to date, and this means I have been building up an arsenal of tools. After being inspired by people like Justin Williams and Scott Hanselman, I thought I’d share my short but growing list here. It’s more a record of the state of things, so I can revisit this and see how far I’ve come years from now.

As I compiled this list, it’s amazing just how many individual pieces there are. And I’m just a side-gig, small-time iOS developer. It’s reassuring, though, to know that people are providing great software and services to meet our needs.

Web Development and Hosting

  • Coda – Made by the fine folks over at Panic. It’s kind of a swiss army knife, but I use it to upload files to my web server and whip up quick pages. It’s the best general purpose web IDE in my opinion.
  • Digital Ocean – They provide me with a cheap SSD linux server in the cloud. It’s only $5/mo, and it’s way more than I need to host this blog and a few other sites.
  • – I can run a simulated version of my app on my website. It’s kinda magical, go try it out. I’m not sure if their business model scales, but it’s fun for now.
  • Namecheap – I switched away from that other domain registrar last year, and haven’t looked back. Namecheap does exactly what you need it to do.

Web Services

  • Countly – I’ve been using Countly since I launched my app. I’m not even sure where I heard of them, but I know that I didn’t want to use Google Analytics. Countly has worked out great, and I highly recommend them. Also, check out my post about integrating Countly with my Raspberry Pi.
  • Appfigures – Appfigures has a really nice UI for viewing your app sales and revenue. I must be grandfathered into a cheaper plan from last year, but it’s still worth it. I also appreciate that they explicitly say “We never sell you private data”.
  • App Annie – I have an App Annie account to monitor my App Store rankings, but I don’t have it linked to my iTunes Connect account because their free pricing model scares me (see previous item about Appfigures never selling private data?).
  • Bitbucket – I keep my git repositories on Bitbucket. I’m small enough to fit into the free tier.
  • Backblaze – I’m still in my trial period, but I plan on subscribing. There’s a certain amount of security in knowing my hard drive gets backed up to the cloud.
  • Freshbooks – Occasionally I need to invoice someone. Freshbooks does the job. There may be better options, but I don’t invoice frequently enough for it to matter.
  • Tethras – I recently used Tethras to translate my app into Spanish, German, Chinese, and Japanese. You give them your strings files, they send you translated strings files. Works great.
  • NSScreencast – Weekly videos that teach different aspects of development.
  • AdMob – I’m not a huge fan of using Google’s services for revenue, but they are the king of serving ads. I started using AdMob when I released the Android version of Easy Grade, and lately I updated the iOS version so that when iAds fail to load, AdMob fills the gaps.


  • Xcode, duh – Required for any iOS developer. It has come a long way since Xcode 3, but there’s still room for progress. We’ll see what WWDC 2014 brings us!
  • Kaleidoscope – A diff tool with a gorgeous interface. Black Pixel seems to care a lot about making this app amazing. I recommend buying direct from Black Pixel, since this app seems like it might suffer from serious sandboxing problems in the long run (just my opinion, I may be wrong about that). Kaleidoscope is also really handy at my day job with things like comparing configuration files.
  • Slender – This app helped me clean out a ton of cruft from Easy Grade before my last update. It points out which graphics don’t have @2x assets, and it tells you which image assets aren’t being used in the project so you’ll know to delete them.


  • xScope – xScope is invaluable if you measure things on your screen. I also use it for aligning things on my screen, and for finding color values (in whatever format you need it).
  • Sketch – I designed my iOS 7 icon in Sketch. I’m no designer, but I think it turned out alright, and Sketch made it easy.
  • Acorn – Acorn is a great Photoshop alternative. A lot of Photoshop’s concepts carry over straight into Acorn. I’ve hit a few roadblocks with not knowing how to accomplish a task, but I think that’s more because my brain is wired into Photoshop. Luckily, Gus Mueller has a wealth of tutorials and guides on the website. It’s only $30, so go get it. Trust me.


  • Soulver – I heard Marco rave about Soulver for years before I finally bought it. If you deal with numbers in any capacity, it’s worth the cost.
  • OmniFocus – I just jumped on the OmniFocus bandwagon. I’m sure it’s overkill for me, but I must say, I am much more organized now. I found myself forgetting some important tasks at my day job, and I realized the sticky notes weren’t cutting it any more. Now I’ve got my life’s tasks compartmentalized into OmniFocus. So while I still may not get to everything, I at least won’t neglect a task due to forgetfulness. :–)
  • Transporter – Putting files on the public cloud brings with it many concerns. I wanted to keep my business and highly personal stuff on something other than Dropbox. I realize I back up my hard drive to Backblaze, but I feel like it’s more secure than the Dropbox varieties of cloud storage. We’ll see.
  • Alfred – I haven’t fully embraced the full power of Alfred, but I find it’s much better than Spotlight. I hear Launchbar is also pretty good, too.
  • 1Password – I couldn’t manage my digital life without 1Password. It’s a game changer. Now I don’t have to remember all my passwords, and I have different passwords for almost every service I use.
  • Bartender – Bartender keeps the menubar icons under control on my 13-inch retina MacBook Pro. It’s an essential tool on a laptop.
  • Numbers – I keep several business spreadsheets in Numbers, particularly my bookkeeping documents for the business. A lot of the trivial spreadsheet-y tasks have been migrated to Soulver, but I still need Numbers. Plus, it makes really pretty charts and graphs.

Honorable Mentions

  • Sublime Text – This is more a tool for my day job. A text editor with multiple cursors and regex find and replace is awesome.
  • Reflector – Reflector is a cool tool, particularly if you need to remotely show someone what you are doing on your iPad/iPhone.
  • NetNewsWire/Reeder/ReedKit/Unread/Feedwrangler – There has been somewhat of a renaissance of RSS apps and services since Google shut down Google Reader last year. I use Feed Wrangler as my sync service to keep all of my computers/devices in sync. My ideal would be to use NetNewsWire on the Mac, but Black Pixel hasn’t implemented sync yet. For now, I’ve been using a mixture of Reeder and ReadKit on the Mac, and Unread and Reeder on iOS.

Updates for Easy Grade

Last week I shipped an update to Easy Grade Free, my EZ Grader app in the iOS App Store. The actual changes in the app are minor (a new “iOS 7” icon and a slight color change, and a removal of the periodic nagging to rate the app. The bigger news might be that I have removed the paid version of the app from the App Store.

Easy Grade’s original icon was great, but it was far too detailed to fit in with iOS 7. I knew it needed to be updated, but I didn’t particularly want to pay for a new design at the moment. I kept hearing people on Twitter talk about this app called Sketch, so I thought I would try my hand at redesigning my icon. You could certainly make the argument that it looks like a non-designer made the new icon. As they say, Don’t Ship Programmer Art. Knowing this, I designed what I had in mind and asked for several people’s opinions as I iterated on it. I kept it on my Home Screen for a few days, and I think it fits right in. Oh, and yes, Sketch is an amazing program.

When I included the prompt to rate the app in Easy Grade Free, I didn’t particularly like the idea, but I told myself that this was the free version of the app, so let’s experiment. Then Gruber’s campaign happened, and while that alone didn’t convince me to remove it, it did help me make my decision. In the future, I hope to find a way to put an info screen with a button to rate the app, so that it’s a more user-driven action and so it never interrupts the user in the middle of a task.1

The other part of my decision to remove the rating prompt is because I removed the paid version from the store, effectively making Easy Grade Free the premium product. It always bothered me that searching for EZ Grader in the iOS App Store would return two almost identical apps. I felt like this was confusing. The free version is, for obvious reasons, getting significantly more market reach. From my business’s perspective, it is also receiving significantly more revenue. So I decided to consolidate into a single, free, ad-supported app and remove “Free” from the app name.

You’ll often see apps in the App Store that are free, but up-sell you with terrible In-App Purchases. This is mostly the case with games.2 I feel like Easy Grade offers a nice base level of functionality and is accessible to anyone with an iPhone (or Android) because it’s free. This will always be the case. And then, if for whatever reason a teacher needs to add the half points feature, they can spend $0.99 to upgrade. I feel like this is a fair compromise and benefits everyone.

PS – Unrelated to this blog post, props to Ken Lasko for calling me out on his blog for not posting regularly enough. I try not to post just to post, but this gave me a little kick in the pants to write about recent happenings.

  1. I’ve already got two reviews, with five ratings, which is hopeful.

  2. I’m looking at you, Candy Crush Saga

Countly, Raspberry Pi, and Servos, Oh My!


TL;DR – I got a Raspberry Pi to do cool things when people use my iOS app. Watch the video below.

I can’t even remember where I heard about Countly, but I signed up for my beta account with them on Oct 10, 2012, and probably shipped my app using their service shortly after that. One particularly cool feature (this isn’t unique to Countly) is that I can track “events” that occur in my app. As I was developing the free version of Easy Grade, I wanted to know how many times users were prompted to buy, but did not buy, the In-App Purchase. So I made an event for this (as well as for how many ads are shown and how many times people actually do buy the In-App Purchase), and began obsessively watching that dashboard once the app was available in the App Store.

EasyGradeFree Dahsboard

As I stared at the dashboard for longer than I care to admit, I looked at my Arduino and thought it’d be cool to make fun things happen, such as raising a flag or flashing an LED, in response to these events that I had defined. I did a quick search and came across a post about ZipWhip, which raises a flag with an Arduino every time they get a new customer ( I wrote some code for the Arduino that pulls from Countly’s servers and parses the resulting JSON file, but it proved to be quite a challenge. Maybe I’m just too much of a novice at writing code in Processing (Arduino’s language), but it just seemed like more work than it was worth.

Then a coworker got a Raspberry Pi, and I SSH’ed into it (with his permission, of course) and wrote a quick and dirty python script in about 15 minutes that did basically what I wanted, and I was sold. It’s amazing how powerful a little tiny Ubuntu server can be! Oh, and Python makes it SUPER easy to parse JSON data. It was even pretty simple to get my servo spinning with the script, and after a bit of tweaking, I finally have something that is presentable. I’ve posted the code to GitHub here. It’s still rough, so be kind! (and please offer suggestions for improvement)

Right now, my code is pretty specific in its use case. I don’t have any immediate plans to make it more generic, but who knows what will happen. For now, though, it pulls the count for specific Events that I have defined in Countly, and takes certain actions based on what events are incremented:

Event Name: bannerViewDidLoadAd
iAds are successfully loaded – currently no action, since this number pretty much is always increasing

Event Name: clickedTheIAPCancelButton
Someone is presented with my In-App Purchase dialog and declines it – the servo spins for a time that is relative to the number of times this Event happens

Event Name: transactionComplete
Someone actually purchases the In-App Purchase – the servo spins, like before, but the Raspberry Pi also plays a “chaching” sound file through the audio output.

Here’s a video of it actually working. Here it turns the flag and plays a sound, indicating that someone bought my In-App-Purchase:

Raspberry Pi with Flag and Servo from Paul Brown on Vimeo.

In closing, I will say that Countly is a great product for mobile app analytics. Their support team is extremely responsive, the data feeds are easy to deal with, and those dashboards are just gorgeous. Every now and then the site seems a little bogged down, but hopefully those are just initial issues and will be resolved as time goes on. I highly recommend the service. Their url is

Also, it’s worth noting that I only track this kind of user behavior data for users of Easy Grade Free who haven’t upgraded yet. For paid users, I only track the very basic analytics data, like sessions and device/OS versions (so I know when it’s acceptable to drop an old OS).

And finally, I leave you with some photos of my contraption. I cut some cheap acrylic with a Dremel and hot-glued it together to serve as a prototype. Some day I hope to redesign it and print out a custom enclosure on a 3d printer.





UPDATE (2013-05-03):
The servo that I’m using is the ROB-09347 from Sparkfun. And yes, I am currently using a coffee stirrer and a Post-It note as a flag.


Andrew Millette grave

I received a phone call 2 years ago in the middle of the night from our youth pastor. You know you’re about to hear some bad news when your phone rings that late (or early, if you’re like me and wake up at 5:15). I sleepily answered the call, and Matt proceeded to tell me that our friend was at the gym that night with his fiance, and he passed out, and had now passed on. He was 28 years old.

I first met Andrew when he had asked about how to download our church’s podcast from the website. I explained to him the ridiculous way he had to right-click the mp3 link and download the file. At that time, I remember thinking that he was a little awkward for some reason.

Fast forward a little bit, and Atlanta had a major flood in 2009 (look it up, there are some YouTube videos of it), and Andrew’s first floor apartment was flooded while he was away at work. Andrew called me that night and asked if he could stay with me for the next night or two, since I lived a couple miles away. I was hesitant at first, because I still didn’t really know Andrew, but I felt like I should help him out.

Over time, I realized that my impression that Andrew was awkward was really just my own awkwardness and insecurities. We ended up sharing rides to Bible study with each other, where we shared conversations about engagement rings, theology, soccer, eco-friendly cars, Mennonites, technology, the outdoors, video games, and many other things. What I came to learn about Andrew was that he was passionate about other people and passionate about his relationship with his Savior. He focused on others so much that it made him different from everyone. His full time job was at Good Will, where he counseled people who were getting back on their feet. He poured himself into our church’s youth group as a small group leader and mentor. He had worked at a Christian camp most if not all of his summers in college. He loved his fiancé with every cell in his body. And that’s just the tip of the iceberg.

It turns out he died of an enlarged heart. As his obituary so aptly stated, this was a huge irony, because everyone who knew Andrew would say that he really did have a huge heart, figuratively. John Mark McMillan wrote a song called “How He Loves”, and if you watch the back story about why he wrote it, you find out that John Mark’s friend ended up leading several people to Christ at the cost of his life. Over time, I’m confident that the song has brought thousands more people to Christ. Watch that video here:

I can’t watch that video, or even sing the song in church without at least tearing up thinking about Andrew, because it loosely describes him. During his life, it’s hard to quantify the impact he had, but he certainly made an impact on people. More notable, though, is that through his death, at least 4 or 5 more youth came to Christ. This is what I think about when I hear “How He Loves”, and why I struggle to control my emotions.

Another funny thing about that “How He Loves” song is that Nikole and I went to see the David Crowder Band, Gungor, John Mark McMillan, and Chris August last year. They all sang the song at the end of the show (David Crowder has most recently done a popular version of the song), and Michael Gungor looks a lot like Matt Miller, who lived with Andrew for the year before his death. It was a strange juxtaposition of beauty for me. Also, Matt wrote a heart-wrenching post about the night Andrew died. Matt also posted some great pictures here. One of those pictures is in their apartment just before heading out to our wedding, which always makes my soul smile. I will always remember Andrew as one of the greatest role models and friends anyone could have.

We had the honor of visiting Andrew’s grave in Harrisonburg, VA over the Christmas holidays on our way from Pennsylvania to South Carolina, thanks to Nikole getting the directions and surprising me with the idea as we left PA. We took the picture you see at the top of this post. That relatively small gravestone is so fitting, as Andrew always minimized himself and magnified others. I love you, man, and I look forward to reuniting with you.

In closing, a few things that will always remind me of Andrew:
– “button” pronounced with a hard “t”
– AC Milan jersey (or Fly Emirates)
– Honda Fit
– car wax
– scrapple
– Mennonites
– Turkey Hill

Books I Read in 2012

Last year, 2011, my goal was to read on average a book a month. In 2012, I didn’t really set a goal, other than to just continue reading. It’s been fun and educational. Here’s the list.

Steve Jobs by Walter Isaacson

The Hunger Games by Suzanne Collins

Catching Fire by Suzanne Collins

Mockingjay by Suzanne Collins

Why We Make Mistakes: How We Look Without Seeing, Forget Things in Seconds, and Are All Pretty Sure We Are Way Above Average by Joseph T. Hallinan

xkcd: volume 0 by Randall Munroe

A Million Miles in a Thousand Years: How I Learned to Live a Better Story by Donald Miller

Out of the Silent Planet: (Space Trilogy, Book One) by C.S. Lewis

Erasing Hell: What God Said about Eternity, and the Things We’ve Made Up by Francis Chan

A Wrinkle in Time by Madeleine L’Engle

Fresh Wind, Fresh Fire by Jim Cymbala

A Wind in the Door by Madeleine L’Engle

A Praying Life: Connecting with God in a Distracting World by Paul E. Miller

I noticed a theme as I was typing these out. A lot of the “modern” books (written in the last decade) have titles in the Title:Subtitle format. Not a bad thing, just an observation.

Which books did you read in the last year?

Full disclosure: The links above are Amazon Affiliate links, which means I get a small percentage of money from sales made by clicking them. If you don’t want to support that, go directly to Amazon/Google and search for the books.

Easy Grade - an EZ Grader for Your iPhone


There I was, one evening, helping my wife grade papers. I only do the multiple choice questions and the strict short-answer ones. I needed to calculate grades to put on the top of the papers, and I needed a way to quickly calculate this number. Being the geek that I am, I made a quick Numbers spreadsheet (which is a simple, useful skill for anyone to learn, whether it be Numbers of Excel). I quickly ran into many papers on which my wife had given half credit for some questions, and since I had generated the spreadsheet for integral numbers, I had to keep adjusting it, which was the point where the app developer in me said “There’s gotta be an app for this”.

Well, there is an app for this. In fact, there are many. But I noticed one particular feature missing from all of them: the ability to calculate grades where half-credit was given. Thus the idea for my app, Easy Grade, was born. Those cardboard EZ Graders also don’t do half-points, are $7-$8, and you don’t always have those with you, but you do always have your phone with you.

While on the bus one day, I sketched out what I thought I wanted, and I came up with this: Sketches_blog

I had recently done an app for the App Store, and this new app seemed like a simple enough idea, so I set about making it. My goal was to make it super simple to configure, with only one screen, and to make it sleek and attractive, setting it apart from pretty much all of the existing competition. I think I accomplished this. With a good bit of help from my wife about placement, size, and colors, and with the help of the nicely-designed glyphs from Glyphish, we came up with what you now see in the App Store. Here are some screenshots:

Screen Shot 2012-04-10 at 1.27.29 PM Screen Shot 2012-04-10 at 1.27.16 PM

In addition to the delight of designing and developing my own app, I had the opportunity to commission the app’s icon design to the fine folks at Artifact. It took a 15-minute conversation with the art director to describe my idea. A couple of emails and a couple of weeks later I had the icon you see at the top of this post.

I’m very happy with the outcome, and my hope is that the app is helping teachers around the country (and world) calculate their grades. I’ve got a few ideas for improvement, and I plan on developing an iPad-specific version. If you do grab it on the App Store, please leave a review to let me know what you think.

We Built a Shed

Over the July 4th week, and then some, Nikole and I both had our parents down to help us build a 16x12 shed in our backyard. The goal was to add some much-needed storage to this house, provide us with some workshop-like space, and to have good family time. Overall, I think it was a success.

I shot a timelapse video from inside the house through the window. I don’t think my old MacBook Pro, or any computer, would’ve handled the high 90’s temperatures we had all week. It might be a little blurry, and isn’t the greatest angle, but I still think it’s pretty awesome. Here’s the final video:

The final product: finished shed

In the last 4 weeks, our yard has been transformed. Our aunt/uncle came down from Illinois to deliver their wedding gift (the swing), and some friends came and put in the raised beds (also a wedding gift): backyard

For the more curious: The video was shot using an app called Gawker, which is super-simple to use, and my old iSight camera (you know, from back when computers didn’t have built-in iSight cameras). The shed plan that we used was found here on Amazon. They were good plans and we got what we wanted out of them, but there were riddled with typos.