It’s Just Gravity

I was not aware that you have to log into Google+ to read “public” posts. This is bullshit, Google. Good bye. http://pic.twitter.com/F3dncOvE

— Oliver Reichenstein

I once spoke with someone who maintained Google isn’t “just an advertising company” because its assorted services were just too good and too smart to exist if there were no other reason for them besides ad sales. I thought that was naive rubbish at the time I heard it, but it was naive rubbish that made me a little sad because it would be nice to believe that Google was a real Wonka factory of good things driven by nothing more than love and a certain dwarvish passion for artisanal software excellence that put the end user first*.

In my heart of hearts, I would like it if Google had invented some sort of commercial anti-gravity device that would let it float there, just above the dirt. That’s sort of what it felt like in Google’s first few years: Good search results with ads that weren’t intrusive, good webmail with ads that didn’t distract you from the task of managing your mail. A good RSS reader that didn’t distract you from the content. Nobody else had seemed to figure that stuff out. It was immensely satisfying to watch incumbents flail around and fall down in the face of quality and care.

And now there’s Google+, which I admire a lot compared to every other social networking service, and I’ve cringed a little each time Google’s done something sort of tone-deaf or hamfisted with it, but also bristled a little when each ham-fisted or tone-deaf thing becomes the nugget of more ridiculous “Google’s being evil after all!” commentary from people who don’t exist to do anything besides have opinions about whatever.

Making you log into Google+ to read public posts? That’s not evil (and I’m not saying Oliver Reichenstein thinks it’s evil, either). It’s just crappy and sort of lame, and it’s happening because Google can’t bring itself to lie about the numbers Google+ is generating. But it also needs them to be higher, so it pulls stuff like that, knowing a largely negligent tech press will relate the numbers without making an effort at context. That contextless numbers game will inflate Google+ into a genuine force in social networking instead of what might well just be a ghost town propped up less by real people who are using it to share than institutional and quasi-institutional presences who are pumping content into it because they show up at every new thing determined to be a first mover.

So, there wasn’t an anti-gravity device. Or if there was, it wasn’t ever built to sustain the weight of Google in 2012. So Google’s hem has touched the dirt and the company looks a little smaller every day.

It’s just gravity.

* I know … I know … “I’m the product.”

Back to BBEdit with a Unix Accent

I have not been enjoying technology much lately, maybe because I’ve been enjoying it too much. It’s been one of those restless periods, but I think I’m coming out the other side.

In the past several months I’ve rediscovered Rails and Sinatra and added HAML & Bootstrap to my repertoire. Bootstrap gives me a lot of what I was getting with Blueprint, and some its markup is close to identical, so it’s been very simple to convert some smaller projects and quickly whip up pleasant front-ends for new ones. Combined with HAML, writing templates for Rails and Sinatra is a dream.

Two things I found that make writing HAML a little nicer:

Serve, a little rack app that “provides the equivalent of the Views part of the Rails MVC,” and can spit out a static version of your work if you just need a static site.

One small project I’m doing with Serve is a simple tech group status board. I can keep a set of maintenance and support events in a simple YAML file and read them in via Serve’s view helpers. I can keep the YAML file in my dock, update it as needed, and let a little Rake job handle pushing a static version of the status board out every so often.

LiveReload, which will watch a local filesystem and tell your browser to refresh when it detects changes.

This is going to sound incredibly lazy, but standing up a quick little Serve site, opening it in your browser, moving the browser over to a second monitor then watching changes to templates and content appear in the browser as they’re made (instead of needing to flip over to reload constantly) just feels liberating, especially if you’re still learning your way through the way some code works. It’s just “change, save, glance / change, save, glance / change, save, glance.”

But there’s also been discontent.

For starters, TextMate and I no longer see eye to eye. When I first started using it I was a Ruby novice and it did some things that made my life much easier. Its auto-indent helped me understand my own code better, I could run a Ruby script with a quick cmd-R, its bundles and snippets were much easier than Emacs and a bit easier than BBEdit. But it has never been a perfect match.

Between BBEdit, Emacs and TextMate, TextMate is by far the least robust. Large files bring it to a crawl and eventually crash it, which has always meant that I’ve had BBEdit laying around to step in when I’ve needed to work through a large file.

From a front-end Web developer’s point of view, I find BBEdit friendlier. The Markup menu is a nicer toolkit than what come with TextMate or Emacs out of the box, and the text filter palette makes more sense even if TextMate’s bundles are a little more keyboard-centric (which I prefer).

From a Rails developer’s point of view, TextMate is still more comfortable, but I’ve developed habits over the past several years that serve me in place of the Ruby-friendlier automation TextMate provides. The thing is, I’m not really a “Rails developer.” I periodically dive into Rails or Sinatra when I need to take a process I’ve automated for myself and hand it off to people who can put text into a web form but can’t run a shell script or learn to configure a text editor to run one for them.  Given nothing to do but Rails work, I’d be thrilled because Ruby’s my favorite language and Rails is very comfortable for me. But nine months into my new job, I’ve hit a few limits in terms of what I can automate for others and I need more efficiency (and HTML-centricity) for the things I can’t reliably hand off to people who aren’t as fluent in HTML as I am. BBEdit’s great when you need to automate text processing for yourself, not build tools to do it for other people.

All of which ignores Emacs. Whenever things start screwing up for me — TextMate crashes more times in a week than a developer’s tool should, for instance — I start eyeing Emacs again.

Emacs has been pretty good to me over the years. One could argue that I got a book contract because I knew how to make light of Emacs in a way that proved accessible both to people who knew what Emacs was to begin with and those who didn’t. It’s a sort of technological comfort food for me: Things go wrong and I go play with Emacs for a little while, tending to my .emacs file and making lists in org mode until I feel better.

So in the past few weeks, TextMate seeming to be twitchier than normal, I went back to Emacs for a bit, first with Aquamacs, then with plain old Emacs via Homebrew, which spits out a very nice Cocoa Emacs. But I’ve never really found Emacs comfortable for HTML editing, and that’s what I’ve needed more of. And I didn’t want elisp in between me and routine automation, much of which I’d be porting over from TextMate. I can get Emacs polished up for use pretty quickly, but it just didn’t feel very smooth and it wasn’t what I needed. I briefly cast about for a copy of an elisp manual at one point, until I remembered I had given it away during a moment where I realized it was just an aspirational bit of clutter I needed to be rid of. I don’t really want to be an elisp wizard, and I haven’t for a few years.

So I got to thinking about my rationalizations for returning to Emacs every so often, and they’re all good enough: It’s portable, so even if the Great Mac Meteor comes and renders OS X inoperable, even on ratty Hackintoshes, I’d have a familiar coding environment. It’s free, so there’re no upgrade fees for new releases. It’s robust. org-mode.

At the same time, things and people change. I’ve been using Macs pretty consistently for about ten years now. Even with Emacs keybindings wired into Cocoa I’m still more likely to use the standard set of Mac keyboard shortcuts these days. I prefer opening up a preferences pane to scanning a file full of configuration variables (and Emacs’ config buffer doesn’t count as a “preferences pane” even if it has been wired up to cmd-,). When I stick a Linux desktop on a VM and try it out in fullscreen mode for an hour, it no longer feels anything like home. It just feels like the product of people who are coming to grips with the fact that “be better than Windows” was a ridiculous goal, and who’re now trying to be better than a Mac (which is also ridiculous — just make something awesome unto itself).

So I fired up BBEdit for a day and it was a joy. Everything about it feels solid. It’s very configurable, so it’s easy to cut down on the proliferation of menu items and features. It respects the Unix heritage of OS X without being a slave to it. Most of the text filtering convenience scripts I’ve written in TextMate, for instance, could just be dropped into the support folder and bound to a key and used right away, because I wrote them as someone whose homeland is a Unix shell environment. Start with STDIN and go from there. So I ponied up to upgrade from version 9 to version 10.

But what about portability and all that? Good questions, never completely resolved when you’re using a tool that’s only available on one platform. At the same time, that one platform is my home and I plan to stay on it for a while. Sitting around worrying about the day it’s not going to be my home anymore isn’t any more productive than taking a course on current divorce law each year: If the giant Mac-eating star goat comes, I will be very sad for a little while, but I’ll just go back to Emacs and stay there. In the mean time, when I need to edit a remote file, I’ve probably got the server it’s on bookmarked in BBEdit.

 

Put the current Chrome URL in your Safari reading list

… or “Hey, dawg, we heard you like Safari so we put your Chrome in your Safari so you can Safari when you’re done Chroming!”

safari_service_menu

I tend to do desktop surfing with Google Chrome because I do a lot of “open 10 tabs at the same time” stuff on our Drupal multi-site and Safari’s not very good at that. Sometimes, when it’s time to head downstairs for lunch or by the fireplace for some iPad surfing, I find myself wanting to take a few things I had open in Chrome with me on the iPad. I used to use Pinboard, but Safari’s new reading list is more convenient and doesn’t clutter up Pinboard with short-lived links, so it’s cool that there’s an AppleScript command to add things to it:

And here’s one that does the same thing with the selected NetNewsWire headline:

Hook them up to the actual apps to taste.

I made the mistake of writing a quick Automator workflow that created a Service Menu item to do the same thing with any selected URL in any app, but when I went to try out my new service I noticed Apple had already thought of that. Easier to go into System Preferences and create a shortcut for it.

If you don’t mind the extra keystrokes, you could also just ⌘l then ⌘c to get Chrome’s current URL and use the service, no need for AppleScript at all, but I wrote it all before I realized Apple had done it for me.

What about Firefox?

No real scripting support because Firefox is lame like that and always has been. You can get the current Firefox URL by using AppleScript to press ⌘l then ⌘c:

Yuck.

Stand in the Place Where You Work

Some notes on adopting a standing desk for my home office. Maybe an odd entry because I started writing it several weeks ago, just after installing it and now I’m circling back because I didn’t want to do the whole “I got this standing desk and it’s been awesome for, like, 30 minutes now!” thing.

Read the rest of this entry »

Quick sharing from Acorn to imgur

Skitch is neat, but I usually have Acorn open already and it has a very nice layered screenshot tool. This gist just takes the frontmost Acorn image, web-exports it to a PNG file, uploads it to imgur then copies the resulting URL to the system clipboard for sharing.

That MacBook Air (and the iCore of the Future)

I’m officially a fan. I think it’s the  SSD that manages to make an ultralight laptop packing a 1.4GHz processor and 2GB of RAM feel as nimble as a desktop with a 2.4GHz processor and 8GB of RAM. There are some things I don’t do on the Air: It’s not running MySQL, Apache or Rails. But for all the “normal computer” stuff —surfing, writing, mail, RSS, light coding — it’s great. It even seems to run WinXP in VMWare pretty well, though doing that manages to get the (very quiet) fans to spin up.

Some day, if my situation changes such that I don’t want to have a big desktop machine handy, I can see entertaining the notion of owning another “full-sized” laptop, like a MacBook or MacBook Pro. For now, though, I don’t think I’ll ever want to own a notebook larger than an Air. It does everything I need in a notebook at about half the weight and without any sense that I’m making some big tradeoff. In fact, the old white MacBook just feels bloated and unnecessary: A device packing too much because there was a good chance it was going to be The Main Computer for a lot of its anticipated market.

Having had both side by side for a week now, I’ll be the first to say that having both an Air and an iPad is an unimaginable extravagance. There may be times when I’ll be glad to shave an extra pound off my bag and take just the iPad along, but I think I’d also be about as happy having my iPhone in a lot of those cases. During the day, when I’m still working but taking a break from the desk, there’s no way the iPad makes more sense than the Air.

Could it ever? Maybe, but it would involve Apple building the sort of hybrid device that third parties have stepped in and created with iPad keyboard cases, and it would involve Apple opening iOS more than it seems willing to. My day-to-day basics are heavily tied up in things like being able to use clipboard history applets, quick flipping between apps that are guaranteed to remember their states under normal load, and browsers that don’t need to reload tabs if I’ve been away from them. With those things, I could make some of the compromises needed to work around other deficiencies.

I’d like “some sort of hybrid device” a lot, but here’s my notion:

In under ten years, Apple’s going to be selling us iPhone-like devices we’ll jokingly call “iCores,” because they’ll (either literally or virtually) snap into the back of three form factors: larger tablets, notebooks and consumer desktops. The iCore will pack enough RAM, processing power and storage to do everything you need in a desktop computer today (with some help from the cloud). It’ll just be less wasteful about it, because you won’t need three different CPUs, GPUs, storage devices or sets of RAM. Instead, each form-factor will have a slot for some kind of physical interconnect or enough wireless hardware to communicate with nearby iCores and drive audio/video/input: They’ll be thin hosts to a fat client where fat has been defined down to “thin metal wedge you can slide into your pocket and use as a phone, too.”

TMTOWTDI – mysql2 and Windows edition

So, you’re trying to get Rails going on Windows, and you’ve used the handy package at RubyInstaller.org, installed the equally handy Ruby DevKit, and now all you need to do is install the mysql2 gem to get going.

At this point, if you do what any normal person might think to do, which is gem install mysql2, you’ll fail because the gem wants a bunch of MySQL dev headers. That’s not a bad thing … we live in a world of dependencies that must be met.

One answer you can pursue is to download the big MySQL archive and pass a few flags along when you install the gem:

gem install mysql2 -- --with-mysql-lib="c:\Program Files\mysql\lib" --with-mysql-include="c:\Program Files\mysql\include"

Then be ready to tell Bundle the same thing for your Rails app proper, which I couldn’t get working.

What also works, and is much more simple, is just getting the version that works with Mingw32 build environments (which is what you get when you install the DevKit):

gem install mysql2 --version 0.2.6

Bundle file?

gem 'mysql2', '0.2.6'

then bundle install

This is all, by the way, another lovely use case for VMWare: Freeze dry a VM at the point before you start desperately following whatever random advice you can find from people trying to make some portion of Ruby or Rails work on Windows so once you think you have it figured out you can roll back to a pristine state and make sure it all works before you document.

Not a bad time at all (tech edition)

Sometimes it’s nice to stop and look around and think about all the things you’ve been taking for granted. I’ve been in the process of handing two projects over to coworkers, one small and one large, and it’s caused me to go out looking for ways to make that easier. I don’t work on an actual dev team: My stuff has been solo efforts, so I’m aware that it probably looks and feels a little different from what everybody else is used to. It was good to find a few tools to make the handover less painful.

So here are a few things I’m newly grateful for:

GitHub

Wow. TextMate has great support for git repositories, so it was super-easy to set up a repository, add all the files, write a few READMEs in Markdown and hand things over. When something needed tweaking, it was a simple matter to make a fix, push it up, and let the recipients know. One of them was on Windows and needed different instructions to get things running? Fine … I made a Windows branch with its own instructions and dependency lists.

Maybe not as important, but GitHub made me feel better about dropping that code on my coworkers because it made everything more approachable. It makes the READMEs look good (and readable) and it makes the source easy to browse with pleasant syntax highlighting.

RVM

I’ve been developing with Rails on OS X, able to install whatever I need to get a gem working, updating my rubygems install whenever it suits me, etc. etc. I didn’t want to make my coworkers go through custom-building their own Ruby or rubygems, and after a few years of getting everything just so I know there’s a chance I’ve got something on my machine they don’t have on theirs. So RVM completely rocked.

RVM stands for “Ruby Version Manager,” and it’s a way to get a self-contained Ruby sandbox running on an unprivileged account. At its simplest, RVM lets you bypass your distro’s elderly Ruby packages and update your Rubygems package without getting a scolding about how your distro will be pleased to update that on its own timetable.

RVM can do a lot more: You can install multiple versions of Ruby and switch back and forth between them with something like:

rvm use 1.8.7

If you’d like to use whatever Ruby came with your distro:

rvm system

If you’ve got three or four Rubies floating around, you can set a default:

rvm --default use 1.9.2

You can also create swappable gem sets.

VMWare

I first reviewed VMWare 11 years ago, when this is what passed for a middling machine:

VMware’s base system requirements are a Pentium II/266 MHz processor and at least 96 MB of RAM. We tested the software on several configurations, ranging from a machine at the very lowest end of the recommended specifications to a Pentium III/500 with 128 MB RAM. Performance is clearly helped by devoting plenty of RAM to the virtual machine. A computer with 160 MB or more is closer to ideal, unless you run X with a conservative window manager and few applications.

I could have spent some time guessing about what might be needed to get my projects working for somebody else, but it was a lot easier to ask “which distro are you running?” download the necessary disc image, set up a VM to match their environment, then run through installation and testing. I did that twice this week: Once to match a developer’s workstation, once to make sure I was testing against the company server platform.

Ubuntu each time, by the way. I don’t know what the current state of the distro wars is, but Ubuntu went up about the way I remember Debian going up: easily and thoughtfully, leaving me with something that Just Worked for my limited purposes. So good for it.

progress_bar

So, _I_ know the script is doing what it’s supposed to be doing because I’ve been fiddling with it for a year. Not everybody else does, so there are a few ways to denote that something is happening. One is just adding an extra bit of noise to each iteration of the main loop to simulate a comforting beeping noise. Another is to use the handy progress_bar gem, which adds a progress bar that can show a counter, percentage completed, rate and ETA with just a few extra lines. Looks nice, less noisy, took all of a minute to add.

iPhone Tracker

iPhone Tracker is pretty neat.

Iphone tracker

Interesting how wrong some of the data is, too.

Padrino

Neato! Sam tipped me to Padrino, which sits on top of Sinatra and provides a sort of bridge between Sinatra’s minimalism and Rails’ … uh … Railsiness.

I’ve been fiddling around with the idea of building an app that would help me keep track of client sites: What plugins they have installed, what version their core software is at, what needs to be added to them, etc. It’s the kind of thing you could keep in a spreadsheet, but as I’ve sketched out what I want to keep track of, it’s gotten more and more unwieldy. I’d like, for instance, to keep track of which version WordPress is at in one place by updating just my WordPress entry, then list all the sites and get some quick visual feedback on which ones need an update. Same with plugin versions, template versions, etc.

It’d also be nice to have on place to keep track of which hosts each site lives on, what the path to the site files on the server is, client contact info, client support/development rates, and a worklog for each site (the better to have invoicing at some point).

Padrino’s cool because it provides a way to generate an admin interface that’s a step beyond Rails’ basic scaffolding. It’s nothing you couldn’t do in Rails pretty quickly, but Padrino makes it pretty and simple. For instance, here’s how to generate a Site model for my app:

g model site name:string url:string client_id:integer cms_package_id:integer server:string path:string

And here’s how to quickly create an admin panel to manage sites:

padrino g admin_page site

Then you just load up /admin/sites, enter your user name and password, and you have a password-protected Web admin interface from which you can create and edit sites:

Padrino panel

It doesn’t figure out associations, so you have to hand-edit here and there to do stuff like create a select item to pick which of your clients a site belongs to. You can do that by defining a collection in the controller (e.g. “clients”) and then use that collection with a form helper:

And that gets you this:

Padrino helpers

Combined with Pow and an hour of poking around the docs to figure out how to make the helpers work, Padrino gave me a working site manager app in under an hour. Nice.

© Michael Hall, licensed under a Creative Commons Attribution-ShareAlike 3.0 United States license.