Vim in OS X with System Clipboard Support

I’m currently in the process of trying to migrate from MacVim to a terminal based version of Vim on OS X. There are several motivations for switch (which I won’t go into here), but one of the frustrations I was encountering was lack of a functional asterix or ‘*’ register in Vim, which according to ‘:help registers’, is ‘… for storing and retrieving the selected text for the GUI.’

Solution 1: MacVim’s bundled Vim

One solution to this problem is to use the version of Vim that comes bundled with MacVim. For my version of OS X (Mountain Lion) and MacVim (Snapshot 65) this was possible by setting the following alias:

alias vim=/Applications/MacVim.app/Contents/MacOS/Vim

Solution 2: Homebrew installed Vim

While the MacVim solution fixed my clipboard problems, I felt a little dirty using MacVim’s version of Vim. Looking around I found an alternative solution; installing the homebrew version of Vim. This assumes you already have homebrew installed (if not, see homebrew’s homepage.)

brew install vim

Hopefully one of those solutions works for you if you were struggling with the same problem.

Using FocusLost in MVIM to Autosave Buffers

This idea was actually exposed to me while reading a Pivotal Labs post on pair programming over tmux.  The idea of autosaving in MacVim hadn’t occurred to me previously, though in retrospect it makes perfect sense.  I had a veritable nervous twitch before I would switch focus to another application (iTerm, chrome, etc.) from MVIM.  “:wq!” ,possibly a few ctrl-]’s and a few more “:wq!”‘s.  It seems like a small thing, but given that this is a keystroke I hit probably hundreds of times in a day small things add up.

I searched chrome for “MVIM auto saving”, and came across this Stackoverflow post which gave me just the snippet I was looking for:

autocmd BufLeave,FocusLost * silent! wall

I dropped this into my gvimrc, restarted my MacVim, and quickly added a few lines to a file.  I then (without saving!) went over to my terminal and cat’ed the file, and sure enough there were my changes!   I’m greatly looking forward to the extra keystrokes this is going to save me, hopefully in turn reducing another little piece of the friction slowing down my ability to create great code.  An important caveat is that this is dependent on the FocusLost command, which to quote the help “Only for the GUI version and a few console versions where this can be detected.”  This makes me a little worried about the need to teach my fingers to auto-save again under certain contexts (like when working in tmux), but hopefully that doesn’t prove to be too challenging.

Accessing US-only blocked content in Canada (video)

This is a video of a dry-run of my screencast for DemoCamp 17 on accessing US-only content that is blocked from Canada.

Tagged , , , , , , , ,

Accessing US Content From Canada with a Boxee Box

If you want the answer without having to read the rest: Unblock-Us.  If you want to hear more of the story of my experience, read on!

Following the strong recommendation of my friend Ryan Jones, I finally broke down and bought a Boxee Box to replace my 7 year old Dell laptop as my primary HTPC (Home Theatre PC).  I’ve been fairly happy with the device and it’s functionality, and perhaps I will do a more comprehensive review at a later time, but for now I want to talk about the setup I ended up using to be able to access US only content (e.g. Pandora, Netflix US Selection, etc.) using my Boxee Box.

If you’re curious about the actual mechanism that is used to block access to US content for those of us located elsewhere, I discussed it in more detail in an earlier post about Pandora.  Here, I’ll simply summarize by saying that all computers have an address (just like houses), and that the US content providers check that address when you request content from them, and deny you if your address is not located in the US.  There are several ways you can try and get around this limitation, and unfortunately for most of them if you want to get decent performance you’ll need to open up your wallet.

For my Boxee Box I initially tried to use one of my standby solutions for this problem; a paid VPN service.  In this case I tried using a service called Overplay, chosen because of it’s fairly low cost ($10/month), and the fact that they had an article specifically about using their VPN with the Boxee Box.  I won’t fully replicate their instructions here, but will instead redirect anyone interested in configuring a VPN on the Boxee Box directly to their article here.  Their steps take you through configuring the Boxee Box to use their VPN service and turning it on.  This part of the process went fairly smoothly, but then I started to encounter some issues.

I first attempted to use Netflix with the VPN turned on.  This didn’t work at all, simply leaving me at an unchanging black screen until I exited back to the Boxee Box interface.  Worse, after exiting the app it had disappeared and was nowhere to be found, and I could only recover it by restarting the Boxee Box.   (I should note that I have a support ticket in with Overplay for this issue, and have not yet heard back)  After several attempts with similar results, I attempted changing the VPN server.  Overplay has three servers located in the US; one in each of the west, central, and east.  I was initially using the East server, so I changed to the Central server.  Fortunately the Central server yielded improved results, allowing me to log into Netflix and get my test US-only content (the Tron movie) streaming, as well as to get Pandora configured.  Unfortunately I was still experiencing frustrating issues.  Occasionally my Boxee Box would decide that it no longer had an internet connection, and I would have to go back into the settings and re-run the network wizard so it would realize it was still connected.  I also experienced bandwidth issues with several sources of HD content, exhibited by halts to the streaming every 20-30 seconds as content buffered.  Finally I was frustrated by the fact that the VPN was not turned back on when I restarted the devise.  Every time I restarted the Boxee Box I needed to go back into the settings and reconnect to the VPN.

My vision for using a Boxee Box was that I could achieve a seamless experience for accessing my local content, as well as the US-only content that I sorely miss.  The VPN alternative was falling short of this expectation, so I looked for other alternatives and came across Unblock-US.  This is a somewhat mysterious service which appears to have gone through several name changes, and seems somewhat questionable even from the less than professional appearance of their website.

I also am currently at a loss to explain exactly how their service works.  There is a Quora article trying to answer this question, but no answer has yet been forthcoming.  From what I could find from various discussions it appears to manipulate the DNS requests for the services it enables by returning alternative IP’s, but what exactly it does with your requests after that point I am not sure.  It does not seem likely that they are in fact routing all your streaming content through their servers as they offer a lower price point than any other competitors that are providing products based on that form of solution.  In any case, the failure of the VPN based solution to live up to my expectations led me to give Unblock-US’s 7-day trial a go.

So far I have only had success with their system.  It requires you to go into your network settings and manually change your DNS server to point to their provided servers.  This may seem scary if you don’t know what a DNS is, but they have explicit instructions to walk you through this change in the Boxee Box settings.  I turned off my VPN, followed their instructions, and went to go test how it worked.

Much to my surprise, I have had no issues with Unblock-US’s solution.  Both Netflix and Pandora were still available and working, and the bandwidth issues I was experiencing through VPN were no longer present.  One of the inherent disadvantages of Unblock-US is that they have to support every service you wish to use, but their list of supported services is quite extensive.  I will continue to make use of their service, and if my experience changes I will updated this post, but so far I am surprised to say I am very happy with how well their solution has worked out, and I intend to cancel my VPN subscription and move my subscription dollars over to them.

Tagged , , , , , , , , , , ,

Meta – Migrating mice and pen from posterous to wordpress

If you visited my blog before, you might notice that there’s now a completely new look and feel. In this particular case this went well beyond a simple reskin, and actually involved moving my blog completely over from being hosted on posterous.com, to being hosted on my own hosting using WordPress.

I made this move for one larger reason, and several smaller ones. The main reason is simply that my other blog, springlaunched.com is hosted using WordPress, and I’ve fallen in love with the quality of the tools that come with WordPress, and the functionality available through the large number of community plugins.  The smaller reasons may be outdated as Posterous has been busy making improvements, but these are what initially drove me to use WordPress:

  • Difficulty doing code highlighting
  • Frustrating web-based editing interface
  • Frustrating interface for working with assets (images, etc.)

My intention is not to start a flame war between WordPress and posterous, but I’ve been very happy with WordPress and would rather only be using one platform across my various blogs, so I wanted to move this blog over to WordPress.  This is a quick record (written in WordPress) of the process of migration.

First I created a temporary WordPress site to give me a location to migrate my posterous site to.  I use dreamhost for the hosting of this blog, and they have a “1-click” install for WordPress which made this very quick and easy to do.  Following the basic WordPress setup (create admin account, give the blog a name, etc.), I went to Tools > Import hoping to see posterous.  Unfortunately posterous is not one of the default import options in WordPress.

Fortunately a quick search of the available WordPress plugins yielded a posterous importer which I was able to install.

After installing the posterous importer plugin, posterous showed up as an option in WordPress under Tools > Import.

Clicking on the now available “Posterous” option yielded a basic form with a few fields that needed to be filled in with my posterous info.

After clicking “submit” the plug-in ran off and was able to grab all my posts and comments from my posterous blog and pull them over to my new WordPress blog.  Once I had all my posts pulled over I wanted to install Disqus, which is the comment system I use on Spring Launched, and which I like because of it’s social media integrations.  This was a fairly straightforward process to install using the plugin system in WordPress, and to setup by going to “settings” in the list of plugins under “Disqus Comment System”, and then selecting “install” at the top right of the settings page.

To import my existing comments I then had to go to the “import/export” section of the Disqus settings, and tell it to import the existing WordPress comments into Disqus.

The last step I had to take to get my content all moved over was to add syntax highlighting to my WordPress blog as several of my posts from posterous had code embedded in them, and the porting process lost much of the formatting.  After a little bit of research I came across the WordPress plugin “WP-Syntax”, which gave me the functionality I needed.  To actually convert the code that had been imported from posterous to the format supported by WP-Syntax took a bit of montonous copy/pasting, but it achieved the desired result.  It is worth noting that if I had a large amount of code in my posterous blog this would have proved quite a cumbersome task!

In order that my old backlinks would correctly work, I wanted to maintain the URL format that posterous uses for it’s posts.

Posterous:

WordPress default:

This setting can be changed in WordPress under Settings > Permalinks:

At this point I had my temporary wordpress instance on dreamhost working like I wanted to, so now I needed to move it over to zittlau.ca where I wanted it to be hosted.  First I needed to change the domain in the wordpress general settings.

Then I simply setup zittlau.ca as a fully hosted domain in dreamhost, and then connected through ssh and used the linux command “cp” to copy the files over:

macbook: Ben$ ssh argonauts.dreamhost.com -l [my_login]
[argonauts]$ cd zittlau.ca
[argonauts]$ cp -r ../migrate.zittlau.ca/* .

Using the terminal may be intimidating for some who are not familiar with the command line. If you belong to this camp you can accomplish the same thing through ftp by copying the files from the temporary folder to the folder for the permanent location.

At this point the migration was pretty much complete, and I was ready to unleash my new WordPress based blog on the world!  The one step I didn’t talk about here is moving the DNS from pointing to posterous, to get it to point to the new host.  This will be dependent on your setup, but if you have any questions about this step leave them in the comments and I’ll do my best to help!

Happy Blogging!

Tagged , , , , , ,

Manually generating #yeg trash data

Unfortunately Alertzy is running out of the garbage pickup data that was published by the City of Edmonton on their open data catalogue.  I’ve been assured that the data will be up shortly, but our data was set to run out on May 31st and that was starting to get a little too close for my comfort.

 

I wrote a quick rake task (Alertzy runs on Rails) to generate the data for June 2011 while we wait for the data catalogue to get up and running.  I encourage anyone to borrow the code (and point out any mistakes they find!) if they are in a similar position.  The code can be found here:
namespace :alertzy do
  desc "Populate June 2011 data"
  task :populate_june => :environment do
    generate_june_data
  end
end
 
def generate_june_data
  mondays = [6,13,20,27]
  tuesdays = [7,14,21,28]
  wednesdays = [1,8,15,22,29]
  thursdays = [2,9,16,23,30]
  fridays = [3,10,17,24]
 
  mondays.map! {|day| DateTime.parse("June #{day}, 2011 7:00:00")}
  tuesdays.map! {|day| DateTime.parse("June #{day}, 2011 7:00:00")}
  wednesdays.map! {|day| DateTime.parse("June #{day}, 2011 7:00:00")}
  thursdays.map! {|day| DateTime.parse("June #{day}, 2011 7:00:00")}
  fridays.map! {|day| DateTime.parse("June #{day}, 2011 7:00:00")}
 
  mondays.each do |date|
    [{:zone => "D", :day => 5},
     {:zone => "D", :day => 6},
     {:zone => "D", :day => 7}].each do |zone|
       GarbagePickup.create(:zone => zone[:zone], :day => zone[:day], :pickup_date => date)
    end
  end
  tuesdays.each do |date|
    [{:zone => "E", :day => 7},
     {:zone => "E", :day => 8}].each do |zone|
       GarbagePickup.create(:zone => zone[:zone], :day => zone[:day], :pickup_date => date)
    end
  end
  wednesdays.each do |date|
    [{:zone => "A", :day => 1},
     {:zone => "A", :day => 2}].each do |zone|
       GarbagePickup.create(:zone => zone[:zone], :day => zone[:day], :pickup_date => date)
    end
  end
  thursdays.each do |date|
    [{:zone => "B", :day => 2},
     {:zone => "B", :day => 3},
     {:zone => "B", :day => 4}].each do |zone|
       GarbagePickup.create(:zone => zone[:zone], :day => zone[:day], :pickup_date => date)
    end
  end
  fridays.each do |date|
    [{:zone => "C", :day => 4},
     {:zone => "C", :day => 5}].each do |zone|
       GarbagePickup.create(:zone => zone[:zone], :day => zone[:day], :pickup_date => date)
    end
  end
end
Tagged , , , , ,

Blackberry CEO’s not getting treated “fair”

There seems to be a theme the dynamic co-CEO duo of Jim Balsillie and Mike Lazaridis are going for in the media lately.  Techcrunch just ran an article discussing the somewhat unfavorable early reviews for the playbook where they quote Jim Balsillie, and the BBC is airing clips from an interview with Mike Lazaridis where issues of security in India and the middle east are discussed.  In both cases each half of the duo seemed to think they are not being treated fairly with Balsillie responding to statements about the playbook with “I don’t think that’s fair", and Lazaridis responding to questions with "that's just not fair".  This comes across to me as somewhat comical.  Why this pair thinks that the rest of the world has some obligation to treat them in a "fair" manner is beyond me, and further more why they think the appropriate way to respond is by calling the world out is even more confusing.  

RIM is clearly facing an increasingly challenging market where they are facing competition from giants where they long enjoyed little or none.  The only way they are going to remain competitive in such a market is to take an assertive stance.  If reviews for your device aren't what you hoped they should be, then take that as an opportunity to engage in authentic dialogue with your reviewers and customer base.  If there are concerns over the security of devices, then use this as an opportunity to advocate for the security of your device relative to your competitors.  In both cases by responding with such a weak claim to fairness they are fundamentally failing to control the message.  

I have a huge amount of respect for RIM and what they have accomplished.  They have established a global brand, and created the concept of the smartphone.  I want to see them continue to succeed and show that a Canadian company can compete against the US based gorilla's, but this is not the way to accomplish that.

Creating a branch of a repo on GitHub

This is a simple thing, but it took me some digging to find some straightforward instructions.  For my own future use and hopefully to save some others the same searching here they are:

1. Make sure your local repo is up to date 

git pull origin master

 2. Create a local branch

git checkout -b [local branch name]

3. Perform your changes to your new local branch.

4. When ready to commit to github:
- If you want the github branch name to match your local name:

git push origin [local branch name]

- If you want the github branch name to be different than the local name:

git push origin [local branch name]:[remote branch name]

Also, as a bonus, to delete a remote branch use:

git push origin :[remote branch name]

Thanks to Joe Savak and his post here which I based my instructions on.
Tagged , , ,

The Social Exodus

There is a recent trend of people ‘quitting’ facebook.  Usually this action is accompanied by some form of attention fetching dramatic blog post or video where the remaining of ‘us’, the schmucks still using facebook, are referred to as drones or some similarly derisive term.  (Here’s a great example I found through britl) I’ve recently come to the conclusion that this annoys me, and if you feel your attention span is up to the task I’ll spare a few paragraphs to expand on the theme.

Thanks to the marketing campaign for “The Social Network”, we’re all now very familiar with the fact that Facebook has over 500 million users.  In Canada there are over 17 million users, meaning over 60% of Canadians currently use Facebook (checkfacebook.com).  Not to argue that just because everyone else is doing it you should, this means that there is a good chance you can find almost anyone on Facebook.  When you want to get ahold of an old friend you haven’t seen in years, a past coworker, or a friend of a friend you met at that party last weekend Facebook gives you a convenient way to do that.  With more and more people discarding their landlines in favour of cellphones, Facebook offers a timely alternative to the whitepages.

Usually when people make their declarations of independence, one of their main complaints is the detritus in their news feed.  “I don’t care if you need help on your farm.”, or “I don’t care what you had for breakfast.”.  Aside from the fact that Facebook allows you to easily remove all future posts from a given user from your news feed, there is an even easier solution to this problem; just don’t read your news feed!

Personally the main features I make use of on Facebook are the messages and the events.  When I log into Facebook it takes me a total of 10 seconds to check if I have a new message or invites, and then I can get back to the non-social aspects of my life.  If you’re planning on throwing a party, being able to send out a mass invite to everyone’s Facebook account is an incredibly convenient way to get the word out.  In deleting your account your are in-fact creating an inconvenience for your friends and contacts.  It seems the belief that “I’m important enough that you should remember that I’m an exception and go out of your way for me” is one consisent with the psycological make-up of a typical Facebook quitter.

Finally, my greatest annoyance with the Facebook quitter is their patronising attitude to the “attention starved masses”.  Their complete confidence that all of those still using the service do so only because they have the neurotic need to share every aspect of their life with the world.  While such people certainly exist, generalizing the rest of us is comparably fair to calling anyone who ever drinks alcohol or walks into a casino a destructive addict.  The greatest irony of this is the need for the Facebook quitter to constantly share with everyone how superior they are because they don’t need to constantly share with everyone.

I have yet to find a real justification for the deletion of a Facebook account.  There is a happy middle-ground between being a drooling, locked in the basement Facebook stalker, and pressing pulling the dramatic delete account switch.  However, if you do feel the need to take the action please have the decency to try and not act so smug about it.  Yes, there is sometimes merit in moving against the current, but if you insist on staring down your nose at the rest of us at least come to the debate packing some good arguments.
Tagged , , , , ,

Chrome eats IE as Firefox watches

This is not intended to be a well researched in-depth post; if I have a chance I’ll look into these trends further and offer some more in-depth insight, but right now I just wanted to share an observation.  

Looking at developing a new web application I’ve started to do some initial research into the current market shares of various leading browsers.  Looking at the WC3 statistics, I found what looks to be an interesting trend.  
In September 2008, (the first available data point for Chrome) the market shares for the leading 3 browsers were as follows:
  • Chrome – 3.1%
  • Internet Explorer – 49.0%
  • Firefox – 42.6%
In the January 2011, the latest available data, the shares are:
  • Chrome – 23.8%
  • Internet Explorer – 26.6%
  • Firefox – 42.8%
Or in terms of deltas:
  • Chrome – +20.7%
  • Internet Explorer – -22.4%
  • Firefox – +0.2%

Ignoring all the reasons that this wouldn’t be a scientific conclusion, this suggests that Chrome might be taking market directly from Microsoft, picking up the customers that Firefox wasn’t able to convert when it maxed out it’s market share in the mid 40%’s.  Off the top of my head I can think of several reasons that could be contributors to this trend; Chrome’s stronger appeal to the mass market through it’s simpler interface, possible conversion of IE6 users to Chrome instead of IE8, impact of mobile browsing (i.e. Android based Chrome users).  
I’d be happy to hear any insights from others that may have given this trend more thought.
Tagged , , , , ,