90 seconds of otherworldly beauty
All posts by moore - 41. page
Lob Postcard Review
A few months ago, I wrote a Zapier app to integrate with the Lob postcard API. I actually spent the 94 cents to get a postcard delivered to me (I paid 24 cents too much, as Lob has now dropped their price). The text of the postcard doesn’t really matter, but it was an idea I had to offer a SaaS that would verify someone lived where they said they lived, using postal mail. Here are the front and back of the postcard (address is blacked out).


Here is the PDF that Lob generated from both a PDF file I generated for the front (the QR code was created using this site) and a text message for the back.
A few observations about the postcard.
- The card is matte and feels solid.
- The QR code is smudged, but still works.
- The text message on the back appears a bit closer to the edge on the actual postcard than it does on the PDF image.
- The front of the postcard appears exactly as it was on the PDF.
- It took about 5 business days (sorry, working from memory) for delivery.
So, if I were going to use Lob for production, I would send a few more test mailings and make sure that the smudge was a one off and not a systemic issue. I would definitely generate PDFs for both the front and back sides–the control you have is worth the hassle. Luckily, there are many ways to generate a PDF nowadays (including, per Atwood’s Law, javascript). I also would not use it for time sensitive notifications. To be fair, any postal mail has this limitation. For such notifications, services like Twilio or email are better fits.
In the months since I discovered Lob, I’ve been looking for a standalone business case. However, business needs that are:
- high value enough to spend significant per notification money and
- slow enough to make sending mail a viable alternative to texting or emailing and
- split apart from a larger service (like dentist appointment scheduling)
seem pretty few and far between. You can see a short discussion I kicked off on hackernews. However, they’ve raised plenty of money, so they don’t appear to be going anywhere soon.
But the non-standalone business cases for direct postcard mail are numerous (just look in your mailbox).
Throttling Back My Writing Schedule
For a while, I have been writing a post a day. Then I took a vacation, and cut back to 2-3 times a week in order to spend more time with the family. I actually like the 2-3 times a week schedule because it lets me take time that I was previously using to write and spend that investigating new technology and tools. Or to write meatier posts.
So, I think that will be the new normal.
Just wanted to let you know.
PS If you don’t want to check back periodically, you can subscribe to my blog.
Video of the Week: The Puzzle of Motivation
What we seek in employment: autonomy, mastery, and purpose.
My Favorite Eclipse Shortcuts

Learning your tools can make you far more efficient, whether those tools are Photoshop, Sublime Text, or Microsoft Word. I do a fair bit of java development, so I use an IDE called Eclipse. Here are some of my favorite shortcuts. (Note that you can personalize eclipse shortcuts via the menu outlined here.)
- control-shift-t: look up a particular type/class by name
- control-shift-r: look up a particular file by name
- alt-shift-c (custom): check in the file I’m working on
- control-f5 (custom): re-run the last thing I ran (typically a unit test)
- control-h: search through any files for a given string (can set up patterns for the file names if desired)
- control-f8: shift perspective (from java to debug, for example) without my hands leaving the keyboard
Also, I always install vrapper, which lets me move around my editor screen via the vi movement keys.
What shortcuts do you use to get around eclipse?
Should you be mapping or using a GPS?


I recently spent a long time in the car, driving cross country. I had a GPS that led me from across the USA, including through New York City, at 60-80 miles an hour. It was easy and convenient to focus on the road and the radio while listening to the dulcet tones of the GPS, but I missed the map reading and location awareness I’d had in previous cross country trips, when using a Rand McNally atlas. Because all I’d been doing was following directions, I didn’t have the understanding of the larger context–how roads fit together, what cool places were just off the interstate, or even which city I stopped in for lunch.
In the vein of Mark Suster’s “Is it Time to Learn or Earn” (which is definitely worth a read), I wanted to talk about whether your current task is a “mapping” task or a “GPS” task, and what each type of task looks like.
Mapping tasks can be high level or low level, but share the following characteristics. They:
- require you to look at the big picture
- are focused on a long term goal, not tactics
- often result in serendipitous results
- take longer
- sometimes require backtracking from dead ends
- make you stop every so often and look around
- have learning as a direct goal
- require iterative search queries
Examples of some of my past mapping tasks include selecting a public records data vendor, hiring an employee, creating my first REST API, and making my first departmental budget. Don’t be afraid to ask for help with mapping tasks, or to stop every so often and make sure you on right track.
GPS tasks, on the other hand, tend to be tactical. GPS tasks:
- often have clear directions (sometimes from others, sometimes from your experience)
- don’t require you to understand context
- require little, if any, exploration
- are action oriented
- often are smaller in scope
- have learning as a by-product, if at all
- can be phrased as a single google query
- may not be core to your business or job
Some of my past GPS tasks include: setting up a virtual server for development, finding a way to display release changes in maven, connecting to the QuickBooks Online API and writing an employee review (after the first one).
The main difference between these tasks is the amount of context needed. With mapping tasks, you have to have your head up and be “looking around” at the problem landscape. With GPS tasks, you can put your head down and just “drive” toward task completion.
If you do a GPS task often enough, you’ll start to acquire context, just as if you drive with a GPS around a new city for a few days, you start to see how the streets and areas fit together. The first time you do something relatively complex, like setting up a new server, hiring or making a department budget, it will be a mapping task–but after a few times it may turn into a GPS task (especially if you document your process).
Next time you take on a task at work, think about whether it is a complex, big picture task that would be best handled by mapping, or a quick, “gotta get this done” task that you don’t need to fully understand.
Video of the Week: Misrepresentation Trailer
This is an 8 minute trailer for a movie about how (Western) society and media (mis)represent women.
Preparing Your AngularJS App for Deployment


I have recently been working on an AngularJS CRUD front end to a REST API (built with DropWizard). I have been working off the angular-phonecat example app (from the tutorial).
After making a few changes, I wanted to deploy the app to a standalone web server (Apache2). I naively checked out the codebase on the web server, and visited index.html.
I saw a blank screen. Looking in the console, I saw this error message: ReferenceError: angular is not defined
Whoops.
“Looks like there’s more to deploying this application than I thought.” Some searching around doesn’t reveal a lot, maybe because deployment is just taken for granted in the AngularJS community? Or I don’t know what questions to ask?
Regardless, the fundamental fact of building AngularJS apps for deployment is that, at least with the angular-phonecat base, your dependencies are managed by bower and/or npm, and you need to make sure you bundle them up when you are running on a web server that isn’t the npm started web server.
In practice, this means writing a Gruntfile (or, actually, modify this Gruntfile), which is similar to an ant build.xml file–you write targets and then gather them together.
For my initial Gruntfile, I wanted to make things as simple as possible, so I stripped out some of the fanciness of the g00glen00b file. In the end, I had two tasks:
- bowercopy to copy my bower dependencies to a temp directory. I tried to use the bower grunt task, but wasn’t able to make it work.
- compress to gather the files and build the zip file
These were bundled together in a ‘package’ task that looked like this: grunt.registerTask('package', [ 'bowercopy', 'compress:dist' ]);
The compress task is complicated and took some figuring out (this post was helpful, as was a close reading of the task’s readme page and the page detailing how file objects can be dynamically generated). Here’s an example of the dist task:
compress: {
dist: {
options: {
archive: 'dist/<%= pkg.name %>-<%= pkg.version %>.zip'
},
files: [{
src: [ 'app/index.html' ],
dest: '/',
expand: true,
flatten: true
}, {
cwd: 'dist/libs',
src: [ '**' ],
dest: 'bower_components',
expand: true,
},
// ... more files definitions
]
}
}
I want to unpack this a bit. First, the options object specifies an archive file and the name of the file. You can see that it is dynamically created based on values from the package.json (which is read in earlier in the grunt config file).
Then, the set of files to be added to this archive is specified. The src attribute outlines the list of files to include in the zip file. src handles wildcards (* for all in the directory, ** for all in the directory and subdirectories). The dest attribute, in contrast, indicates the directory where the file is to land in the zip archive. The expand attribute lets grunt do dynamic file matching (more here). The flatten attribute removes all the leading paths from the source files–if you didn’t have flatten:true in the index.html entry, it would be placed at /app/index.html in the zip file. The dist/libs entry handles all the dependencies that were copied to that tmp directory by the bowercopy task. What the cwd attribute tells grunt is to act like it is in that directory for the src attribute. So, a file at dist/lib/foo/bar will be treated like it was foo/bar and, in the task above, copied to bower_components/foo/bar in the zipfile. This allows one to maintain the same directory structure in my index.html file in both dev and production.
Finally, you need to install grunt and run grunt package to get your zipfile with all dependencies, for deployment.
There are a lot of other beneficial changes grunt can make to your app before deployment, like concatenating css and minifying the javascript, and I encourage you to read this post for more information, but this was enough to get the app running in an environment without npm or any of the other angularJS toolchain.
Java REST API Framework Options


I’ve been working with a couple of REST API solutions that exist in the Java tech stack. I haven’t seen any great analysis of REST API solutions (though Matt Raible does mention some in this exhaustive slide deck about Java frameworks [pdf]), so wanted to share my on the ground experience.
First up is restSQL. This framework makes it easy to get data from a database to a JSON or XML REST API and back. If you have a servlet container available, you write two configuration files, one with a SQL query and one with db connection information, and you have a RESTful API. For prototyping and database access, it is hard to beat.
Pros:
- Quick to set up
- Only SQL knowledge is required
- No programming required
- Allows simple mapping of db table to resource, but can include one to one and one to many mappings
- Supports all four REST operations out of the box
- Supports XML as well as JSON
- Is an embeddable java library as well as a standalone framework
- Project maintainer is engaged and the project is moving forward
Cons:
- Requires a servlet engine, and you have to restart it for changes to your configuration to be picked up
- Output format has limited customization
- Only works with mysql and postgresql databases (though there is some experimental support for Oracle and MS SQL)
- Doesn’t work with views
- The security model, while fine grained, isn’t modern/OAuth (can be solved with an API gateway (like 3scale, Tyk or ApiAxle) or proxy
The next framework I have experience with is Dropwizard. This is a powerful framework that creates uberjars that you can run on any port as a standalone service. It’s not limited to providing a JSON representation of database tables–if you can create a Java object, Dropwizard can serve it up as a JSON resource.
Pros:
- Community support
- Extreme output formatting flexibility, but be prepared to write a custom deserializer if you want to handle anything other than reads of custom formatted objects
- Supports any database that hibernate supports
- Built in testing support
- Brings together ‘best of breed’ tools like Jersey, Jackson and Hibernate, so you don’t have to do the integration yourself
- Great documentation
Cons:
- Have to roll your own deployment solution (tarball, chef, puppet)
- No services startup script provided
- Shading can slow down development
- Not yet at 1.0 release
The last one I don’t have familiarity with, but a colleague used it in the past. It is Sparkjava. This is a lightweight framework that fits when you have an existing Java library with functionality you want to expose. I’m not competent to write pros/cons for this framework, but wanted to mention it.
The gorilla in the room that I haven’t had experience with (in terms of writing RESTful webs services) is Spring. I would definitely include this in any greenfield solutions review.
Video of the Week: Marc Andreesen at Stanford
Via Fred Wilson, here’s a 50 minute discussion with Marc Andreesen (of much fame) about entrepreneurship, tech trends and more.
