Sunday, July 17, 2011

Wedding Dance

My latest Dancer project is up at SweetieBeast.us, a website for my pending wedding. T-minus-13 days and counting!

The source is up at github. Look in the wedding-dancer directory for the dancer project.

The dancer code is very short, because I'm not really using any dancer bits. I'm using dancer to provide an interface around templating code and page layout wrapping. As such, the pages are all pure templates.

Version .1 was very close to the following code snippet. Auto_page turns my template files into corresponding routes. I then created a template for each of my pages, spent a day futzing with CSS and poof: wedding website!

package sweetiebeast;
use Dancer ':syntax';
our $VERSION = '0.1';
set auto_page => 1;
get '/' => sub { template 'index'; };
1

When I launched, I put the site behind an apache proxypass directive. So I added Dancer::Plugin::Proxy to create links relative to the external proxy. I query Dancer::Plugin::Proxy to explicitly create link targets in the model to simplify my views.

package sweetiebeast;
use Dancer ':syntax';
use Dancer::Plugin::ProxyPath;
our $VERSION = '0.2';

set auto_page => 1;
get '/' => sub { template 'index'; };

before_template sub {
    my $tokens = shift;
    $tokens->{uri_base}           = proxy->uri_for("/");
    $tokens->{uri_for_index}      = proxy->uri_for("/");
    $tokens->{uri_for_faq}        = proxy->uri_for("/faq");
    $tokens->{uri_for_location}   = proxy->uri_for("/location");
    $tokens->{uri_for_travel}     = proxy->uri_for("/travel");
    $tokens->{uri_for_guests}     = proxy->uri_for("/guests");
    $tokens->{uri_for_images}     = proxy->uri_for("/images");
};
true;

Monday, June 27, 2011

Macintosh Fork Failure

Random failures on my macbook air today. Oh I see, fork failures. The default maxproc setting is ridiculously low (512).

Let's double that:

% sudo sysctl -w kern.maxproc=1024
kern.maxproc: 532 -> 1024
% sudo sysctl -w kern.maxprocperuid=1024
kern.maxprocperuid: 512 -> 1024
Now let's check the ulimits, now that only my shells are affected.
% ulimit -a
-t: cpu time (seconds)         unlimited
-f: file size (blocks)         unlimited
-d: data seg size (kbytes)     unlimited
-s: stack size (kbytes)        8192
-c: core file size (blocks)    0
-v: address space (kb)         unlimited
-l: locked-in-memory size (kb) unlimited
-u: processes                  266
-n: file descriptors           2560
% ulimit -a 512
Now, why am I still getting fork errors when opening a new terminal? What process has this 266 locked in?

Friday, June 17, 2011

my first yapc

I'm looking forward to my trip to Asheville, NC for YAPC::na. June 26-30. Yet Another Perl Conference, North America.

I was supposed to go last year while I was at Rubicon Project, but my trip got canceled (some mix of busy, crunch time, and politics).

I haven't been to a focused perl conference since the short lived "O'Reilly University" circa 2000 in nyc. MJD was the bomb! It'll be interesting to compare with our <shameless_plugs> excellently run LA pm</shameless_plug> and all the other LA tech meet-ups.

what do I need to do to prep? Rest my brain and liver, I suppose.

Grub prompt after upgrade to ubuntu 11-04

I got bit by this when I upgraded "mini", my 11" acer to ubuntu 11.04. Rebooting left me at a grub prompt. The exercise has left me with an improved feel for the grub2 interface and boot prompt -- it's actually pretty slick with the TAB completion. Improved in-grub help would have been nifty, instead I found myself doing research on my phone.

Using information from aaron kelleys blog[1] and information available from tab completion I performed the following steps which led to a successful boot. After the root command, filename tab completion looks at that drive.

Boot from grub prompt:

root (hd0.5)
linux /vmlinuz root=/dev/sda ro
initrd /initrd.img
boot

Alternative, equivalent boot from grub prompt:

linux (hd0,5)/vmlinuz root=/dev/sda ro
initrd (hd0,5)/initrd.img
boot
After booting, these steps updated grub on the MBR for my root drive:
sudo grub-install /dev/sda
sudo update-grub

For a taste of the flip side, I restarted into windows for windows update. Looks like it's been 6 months since I booted windows7, so 300Meg to download. Question: Will it be finished or pwned when I get home tonight?

links:

  1. http://aaron-kelley.net/blog/2011/04/grub-prompt-after-upgrade-to-ubuntu-11-04/

Saturday, June 4, 2011

migrate Subversion repository/dump to Git & Github, with tags and branches

A simple and complete method for migrating from subersion to git, bringing over past tags and branches.

I migrated a work repository from Subversion to Git last week. It went surprisingly smoothly. There were a more steps than I expected after reading various, selected, sources.

My repository was in "standard layout" containing only a single tree/project. I was sent a dump of the repository created with svndump. If you have direct access to your svn repository, skip step one. Similarly you can skip the github steps or replace them with your own "primary git server."

Note, if you don't want to maintain the svn tags and branches, then there is a simple single step solution using git-svn. This works if you don't have tags and branches to keep, or you just want a personal git checkout of a remote svn repository.
git svn clone --no-metadata --stdlayout --A users.txt http://svn/repo/here/ new_checkout_name/

Overview:

  1. import svn dump into svn repository
  2. create mapping file of svn committer to email address
  3. create empty git repository
  4. cd to git repository
  5. import from svn repo to git repo
  6. pull branch and tag information from svn to git
  7. create github repository
  8. add remote repository
  9. push all tags and branches to github repository.
Steps:
  1. import svn dump into svn repository from dump file svn_repo.dump
    % svnadmin create svnrepo
    % svnadmin load svnrepo < svn_repo.dump
  2. create mapping file of svn committer to email address
    Create a file called authors.txt and fill it with line separated “svn-name = git-name ” pairs.
    #example:
    % cat authors.txt
    user_a = Alpha <alpha@example.com%gt;
    user_b = B Dawg <bdawg@github.example.com%gt;
  3. create empty git repository
    % mkdir gitrepo
    % git init gitrepo
  4. import from svn repo to git repo
    #   git svn clone file:///pathto/svnrepo /pathto/gitrepo –no-metadata -A authors.txt --stdlayout
    svn repo path must be an absolute path when using file://
    % git svn clone file://$(pwd)/svnrepo gitrepo/ --no-metadata -A authors.txt --stdlayout
  5. cd to the git repository
    % cd gitrepo
  6. pull branch and tag information from svn to git
    tags and branches are both viewed as remote branches, tags are prefixed with "tag/".
    For each branch you want to migrate, make a local branch.
    For each tag, make a local tag.
    % git svn fetch                          # fetch remote branches and tags from svn
    % git branch -r                          # view remote branches
    % git branch local_branch remote_branch  # for each branch to migrate
    % git tag local_tag tags/remote_tag      # for each tag to migrate
    % git branch                             # check work by viewing local branches and ...
    % git tag -l                             # ... local tags 
  7. create github repository
    ( github repo ui, create yourrepo )
  8. add remote repository
    % git remote add origin git@github.com:yourname/yourrepo
  9. push all tags and branches to github repository.
    % git push origin --tags   # push all tags
    % git push origin --all    # push all branches 

Crashed Kindle

Wow, I crashed my kindle3-3G today. I tried to use the "back page" button after jumping forward a chapter and it wedged. The screen froze, and didn't change when I power cycled. A soft-reset (hold on-switch for "15" seconds) caused the screen to clear (all black then all clear). I could only tell if it was on by checking the light in my case.

The reboot key-combo is "shift-alt-r". After a couple of soft-resets I tried a reboot and it worked! woo!

Of course, I had to verify. I navigated to the same page and hit back again. Now it's back to being wedged.

No, it isn't the case causing crashes in my case, it's my own converted-from-chm-emailed-to-my-kindle ebook.

Edit: update, she's working again now that I'm done writing this post. Perhaps it was just really really busy finding that page?

Friday, April 29, 2011

Dude, what function am I in?

The ctags plugin for vim shows the function name containing the current line. This is helpful when you're refactoring down functions that are longer than a screenful.

I've been using this (exuberant) ctags based approach for years. It's quite handy and works across more languages than I use: 41 languages from ant to YACC. I've tested with perl, python, C, java and ruby.

The plugin has options to display the function name in the status bar or in the xterm menu bar. It takes care of generating the ctags files on the fly.

I've blogged before on using vim with tags file, recommending using ctags to create a tags file for your codebase. Using the tags browser to jump to subroutines defined in other files is just ... super fun.

ctags plugin for vim:
http://www.vim.org/scripts/script.php?script_id=610
exuberant ctags:
http://ctags.sf.net/
My blogpost on effective VIM with perl and tags. http://www.lowlevelmanager.com/2010/12/perl-tags-and-vim-effective-code.html

These are the options I use with the plugin:

  let g:ctags_statusline=1
  let g:ctags_title=0
  let g:generate_tags=1 
  let g:ctags_regenerate=1

PS. OSX comes with a different version of ctags, you'll need to install exuberant ctags for the ctag plugin to work, it's available in both fink and MacPorts.

Wednesday, April 27, 2011

More LWP SSL 500 issues! Now with HTTP::DAV crossover

LWP::UserAgent is returning a 500 level error in the case of a self-signed site key. This is similar to my previous post on this topic, ( Fixed 500 can't verify SSL peers ):
For https://... default to verified connections with require IO::Socket::SSL and Mozilla::CA modules to be installed. Old behaviour can be requested by setting the PERL_LWP_SSL_VERIFY_HOSTNAME environment variable to 0. The LWP::UserAgent got new ssl_opts method to control this as well.
I use HTTP::DAV to push changes to the Los Angeles Perl Mongers website. When I tried to push updates for tonight's meeting, HTTP::DAV threw an error " The URL "https://groups.pm.org/groups/losangeles/" is not DAV enabled or not accessible.".

This seemed familiar -- in fact I filed a bug against HTTP::DAV ( Bug 59674 ) to pass through SSL errors from LWP when SSL libraries were not installed. ( Cosimo, I am sorry that I didn't respond in a timely manner when the fixes were proposed. Thanks for fixing it!). The fix for 59674 included having a specific message for various classes of errors out of LWP::UserAgent.

## Error conditions
my %err = (
    'ERR_WRONG_ARGS'    => 'Wrong number of arguments supplied.',
    'ERR_UNAUTHORIZED'  => 'Unauthorized. ',
    'ERR_NULL_RESOURCE' => 'Not connected. Do an open first. ',
    'ERR_RESP_FAIL'     => 'Server response: ',
    'ERR_501'           => 'Server response: ',
    'ERR_405'           => 'Server response: ',
    'ERR_GENERIC'       => '',
);

LWP::UserAgent is returning a 500 level error in the case of a self-signed site key. Not 501 as in the prior case.

Example:

#!/usr/bin/perl
use strict;
use warnings;
use LWP::UserAgent;
use Data::Dumper;
my $url = "https://groups.pm.org/groups/losangeles";
my $ua=LWP::UserAgent->new();
my $resp = $ua->get( $url );
print Dumper $resp;
Output Snippet:
LWP::Protocol::https::Socket: SSL connect attempt failed with unknown errorerror:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed at /Library/Perl/5.10.0/LWP/Protocol/http.pm line 51.

One can get around this by setting an environment variable export PERL_LWP_SSL_VERIFY_HOSTNAME=0, or by using the ssl_opts option to UserAgent. A third, preferred solution would be import the key and mark it as "OK" on the client side.

I pushed my website changes by using the PERL_LWP_SSL_VERIFY_HOSTNAME=0 workaround. Now let's see if I can figure out workarounds 3 and 2.

Friday, April 22, 2011

FIXED: 500 Can't verify SSL peers without knowning which Certificate Authorities to trust

Having problems using LWP::UserAgent with SSL hosts? Try installing Mozilla::CA.

500 Can't verify SSL peers without knowning which Certificate Authorities to trust

Props to Corion for posting this tip to perlmonks.

2011-03-08 Release 6.00

Unbundled all modules not in the LWP:: namespace from the libwww-perl distribution. The new broken out CPAN distribtions are File-Listing, HTML-Form, HTTP-Cookies, HTTP-Daemon, HTTP-Date, HTTP-Message, HTTP-Negotiate, Net-HTTP, and WWW-RobotRules. libwww-perl-6 require these to be installed.

This release also drops the unmaintained lwp-rget script from the distribution.

Perl v5.8.8 or better is now required. For older versions of perl please stay with libwww-perl-5.837.

For https://... default to verified connections with require IO::Socket::SSL and Mozilla::CA modules to be installed. Old behaviour can be requested by setting the PERL_LWP_SSL_VERIFY_HOSTNAME environment variable to 0. The LWP::UserAgent got new ssl_opts method to control this as well.

Support internationalized URLs from command line scripts and in the proxy environment variables.

The lwp-dump script got new --request option.

The lwp-request script got new -E option, contributed by Tony Finch.

Protocol handlers and callbacks can raise HTTP::Response objects as exceptions. This will abort the current request and make LWP return the raised response.

-- LWP 6.00 release notes 2011/03/08(emphasis mine).

Monday, April 18, 2011

CPANTS: down?

I tried to pull up a report on CPANTS (cpants.perl.org) today (The CPAN Testing Service) and was greeted by the sad message quoted below.

Is this because CPANTS.perl.org wasn't getting used in favor of www.cpantesters.org? I was afraid we'd lost the awesome CPAN testing infrastructure. According to the CPAN::Testers documentation, CPANTS was a project to track "Kwalitee" & metadata of modules on the CPAN. So what does that mean?

CPANTS - The CPAN Testing Service
CPANTS is currently down due to terminal bitrot.
If you're interested in having it back, please contact domm AT cpan.org

CPANTS and Site maintained by Thomas Klausner - domm AT cpan.org

Hosting and bandwidth provided by Vienna.pm.
-- cpants.perl.org

Saturday, April 16, 2011

Moving at Scale : Etsy

I know the etsy engineers like to graph, graph, graph, but I hadn't heard too much about the rest of their release cycle. They have taken specific steps to attempt to "Stay a Startup as we grow larger." Watch as they expound on the benefits of "one button deployment", empowering releases, branching-in-code, A-B testing and configurable features.

Warning, the video is a couple of hours long.

Watch live streaming video from etsy at livestream.com
Source

  1. Make deployments easier
  2. No-fault post-mortems
  3. everyone works on head, no branches in source control, lots of if(0){ ... } blocks
  4. configuration file that determines which features are live, to which percentage of the population.
  5. public logging and metrics
  6. ...
  7. Change are quick, easy and encouraged.
  8. maintains the "can do" "default is yes" attitude of the early startup.
  9. mean time to notice problems: <5 minutes, mean time to fix problems: 4.5 minutes.
  10. ...
  11. profit

They have released two projects as openSource, available on github:

logster
https://github.com/etsy/logster
Forked from ganglia-logtailer, they removed the daemon mode to simplify the code.
Logster is a utility for reading log files and generating metrics in Graphite or Ganglia. It is ideal for visualizing trends of events that are occurring in your application/system/error logs. For example, you might use logster to graph the number of occurrences of HTTP response code that appears in your web server logs.
statsd
Github: https://github.com/etsy/statsd
Blogpost: measure anything measure everything/
A network daemon for aggregating statistics (counters and timers), rolling them up, then sending them to graphite.
They make heavy use of Graphite for displaying graphs. http://graphite.wikidot.com/

Saturday, April 2, 2011

Better programming reading list

How to become a better programmer in 90 days -- a lightning talk.
http://www.foraker.com/how-to-become-a-better-programmer-in-90-days/

I stumbled upon this lighting talk by Neal Enssle. In it he recommends three books to improve our craft. I admit to not having read any of them, but I have heard of some of the authors.

The Passionate Programmer: Creating a Remarkable Career in Software Development (Pragmatic Life) Clean Code: A Handbook of Agile Software Craftsmanship Refactoring: Improving the Design of Existing Code

The Passionate Programmer, Chad Fowler
Love what you do, your attitude comes through. Highlight a daily win.
Clean Code, Robert C. Martin
A language for describing our code.
Refactoring, Martin Fowler
60 refactoring patterns.

Thursday, March 31, 2011

MacBook Air 13" -- lockup in iTunes, fixed?

My new MacBook Air 13" froze twice last week. (full lockup, requiring reboot), both times as I was launching a fresh install of iTunes. There is an update out this morning to fix that, w00t. Those lock-ups were my only complaint about my new Air. Let's hope this fixes it.

"This update addresses an issue that makes the system unresponsive when using iTunes. It is recommended for all 13" MacBook Air (Late 2010) users running Mac OS X v10.6.7."
-- Mac OS X 10.6.7 Supplemental Update for 13" MacBook Air

In other news, yes, I bought a MacBook Air 13" last Friday. My previous Mac purchase was an 68000 MacSE running 8.6, purchased 20 years ago. Fully pimped out, this was a big impulse buy on Ebay (after a week of watching ebay and craigslist, it still felt like a impulse to start and finish bidding last friday morning). It did run my 3x as much $$ as the Acer (4x retail). What will I do with two tiny laptops?

It is both bigger and smaller than my lovely Acer 1810T. The 13" Air has a hugely larger footprint to the acer, at 13 vs 11. The whole body is slightly lighter and much thinner. Having gotten used to the size of the 11", this feels really big. How do people carry around 17" monsters? The screen is larger and has more pixels at 1400x900 vs 1366x768, albeit at a lower DPI of 130 vs 135 dots per diagonal inch. It also has more pixels than the 13" macbook pro, why are they still using a lower res screen on those?

The 13" Air has a larger battery spec and seems to have considerably larger real-world battery usage. The battery lasts a full workday, though I get nervous when it says an hour or two left. Wake from sleep is wicked fast, and sleep seems to be a very low power situation. I put my acer to hibernate and it takes about 20 seconds to boot with the SSD -- ~8 of that is just the bios time to get to the bootloader. I haven't been able to compare wake from hibernate on the Air since I can't force hibernation -- it happens automatically if it is in sleep mode "long enough."

I'm still trying to get used to the change in keyboards -- the wrist rest area is ginormous on the Air. The large wrist area makes it sit in my lap differently than the Acer, and typing is more awkward. It does rest more softly in the lap -- similar weight over a larger surface area.

I found myself trawling ebay looking for an 11" as a companion to this one. The 11" air is a very close alternative to the 1810T. If you can live without a second mouse button and page-up/page-down dedicated buttons. The larger trackpad really is nicer than the Acer, though I was quite used to that smaller trackpad. The 11" has roughly the same specs, a slightly faster chip, similar quoted battery life, same footprint, much thinner and a tad lighter. Counting the big SSD I put into the 1810T the prices are comparable.

Note, if you are looking to buy an Air, know that the RAM is hard soldered at the factory, so there is a large difference between the 2G and 4G versions. Do the resellers (bestbuy, frys, buy.com etc) even get 4G models to sell? It is possible to replace the SSD, it is non-standard but they are available. The ram you won't get to change.

Wednesday, March 30, 2011

Startup Toolkit.

I'd like to see a project of a "startup kit," a collection of opensource tools that are known to work well-enough together: revision control + code review + continuous integration + issue tracking + deployment&configuration.

I don't need perfect, but I would like good-enough.

I suppose this is close to what Atlassian provides, but that's a little too much corporate proprietary synergistic kool-aid for me. Maybe I'm judging too harshly after the Rubicon Atlassian experience, which was soured more by the lack of system and sysadmin resources to upgrade/install/approve the tools than by the tools themselves.

Some options I'm considering now:

  • Issue Tracking
    • Trac
    • bugzilla
    • redmine
    • github issue tracker
  • Source control
    • git, shared via github private account
  • Continuous Integration
    • hudson/jenkins
    • buildbot
    • cruise-control / cruise-control-rb
  • Code Review
    • mondrian (hosted by google appengine)
  • Configuration management and bootstrapping onto ec2
    • chef (pretty far down the chef road at this point)
    • puppet
    • cfengine
  • Monigoring (using all of these for different aspects:
    • nagios
    • ylastic
    • aws console
  • statistics and graphs
    • ganglia
  • log aggregation
    • splunk -- hadn't considered this, but was suggested by friends at GumGum, to monitor logs across a cloud of app-servers
This should be enough to get a scalable environment for developing, testing and deploying an application. After that, it's time to pick the additional infrastructure pieces needed by the application (data persistance, caching, logging, ... )

TODO(andrew): add links for the projects.

using git-flow with github

We've decided to use nvie's "Git Branching Model" for a work project using github as a "central" repository (by convention). The gitflow documentation is aimed at people running their own local repositories and using the default git-flow settings for branch names.

I want to make some branch naming changes from the original model. First I was going to swap develop and master with master and production. I've gone a step further and done away with master. I want my branches to be develop, qa, and production.

First, how to initialize this in a new repo:

% mkdir fakerepo
% cd fakerepo
% git init fakerepo
Initialized empty Git repository in /Users/andrew/src/fakerepo/.git/

% git flow init
No branches exist yet. Base branches must be created now.
Branch name for production releases: [master] production
Branch name for "next release" development: [develop] 

How to name your supporting branch prefixes?
Feature branches? [feature/] 
Release branches? [release/] qa
Hotfix branches? [hotfix/] 
Support branches? [support/] 
Version tag prefix? [] 

% git branch
* develop
  production

#git flow saves elements to the local repo configuration, .git/config
% git config -l | grep gitflow
gitflow.branch.master=production
gitflow.branch.develop=develop
gitflow.prefix.feature=feature/
gitflow.prefix.release=qa
gitflow.prefix.hotfix=hotfix/
gitflow.prefix.support=support/
gitflow.prefix.versiontag=
Now, how to push to the matching github repository, spazm/fakerepo? Normally I'd use:
 git remote add origin git@github.com:spazm/fakerepo.git
 git push -u origin master
But now I don't have a local master. Should I be using the publish features? #Add manually, rather than via git flow * publish
%  git remote add origin git@github.com:spazm/fakerepo.git

% git push --set-upstream origin develop
Counting objects: 2, done.
Writing objects: 100% (2/2), 173 bytes, done.
Total 2 (delta 0), reused 0 (delta 0)
To git@github.com:/spazm/fakerepo.git
 * [new branch]      develop -> develop
Branch develop set up to track remote branch develop from origin.

% git push --set-upstream origin production
Total 0 (delta 0), reused 0 (delta 0)
To git@github.com:/spazm/fakerepo.git
 * [new branch]      production -> production
Branch production set up to track remote branch production from origin.

% git branch
* develop
  production

% git branch -r
  origin/develop
  origin/production

Now, what does the next user need to do after he clones the remote repo?

% git clone git@github.com:spazm/fakerepo.git
% cd fakerepo
% git status
# On branch develop
nothing to commit (working directory clean)

% git branch
* develop

% git branch -r 
  origin/HEAD -> origin/develop
  origin/develop
  origin/production

% git config -l | grep gitflow

#blank, the gitflow configuration items aren't present in the checkout.
% git flow init

Which branch should be used for bringing forth production releases?
   - develop
Branch name for production releases: [] production
Local branch 'production' does not exist.

#manually bring over tracking branches
% git branch --track production origin/production
Branch production set up to track remote branch production from origin.

% git flow init
Which branch should be used for bringing forth production releases?
   - develop
   - production
Branch name for production releases: [production] 

Which branch should be used for integration of the "next release"?
   - develop
Branch name for "next release" development: [develop] 

How to name your supporting branch prefixes?
Feature branches? [feature/] 
Release branches? [release/] qa
Hotfix branches? [hotfix/] 
Support branches? [support/] 
Version tag prefix? [] 

% git config -l |grep gitflow
gitflow.branch.master=production
gitflow.branch.develop=develop
gitflow.prefix.feature=feature/
gitflow.prefix.release=qa
gitflow.prefix.hotfix=hotfix/
gitflow.prefix.support=support/
gitflow.prefix.versiontag=
Question: Do I really have to manually set up the tracking branches when I clone, prior to running git-init? That seems messy. I'll keep digging and let you know.

[Undisclosed Startup], my new gig

I started working for [Undisclosed Startup] in December, after leaving leaving The Rubicon Project in September.

These four months have flown by.

I'm having a blast getting back into Startup mode. Rubicon is doing great but has grown to hundreds of engineers. [Undisclosed Startup] has a single digit number of employees and ~4 engineers. At some point we'll de-stealth and show the world ... awesomeness.

I'm definitely getting to "wear a lot of hats," ranging from code reviews to company goal planning. I'm now much more familiar with amazon ec2. I've lead the push to switch to git (so far, so awesome) and an SVN layout cleanup. I'm doing a bunch of sysadmin-ish tasks (oh how I loathe the term dev-ops, yet here we are) -- dear opscode/Chef, your documentation is all over the place, but the product is neat. Leveraging my dearly earned hadoop knowledge from Rubicon. Maintaining and extending the perl web ui. Picking up python. testing testing testing! Maybe I'll even use my low-level-manager hat?!

Apologies in advance for my dearth of future entries: startup-land takes a lot of time and energy. I do hope I at least write about some of the multitude of research topics I'm digging into.

Saturday, March 12, 2011

patching github projects

Wow, adding changes to projects on github is surprisingly easy, once you figure out the steps. I made a patch for vim-space earlier today, after I found an error in a comment that cost me an hour yesterday.

I nearly got the github flow correct on the first pass. Here's what I did:

  1. fork the project (via UI on github)
  2. clone locally
    git clone git@github.com/spazm/vim-space.git
  3. make change to plugin.vim in my working directory, test:
    vim plugin.vim ...
  4. create an issue for the original project (via UI on github)
  5. commit change locally:
    git add plugin.vim
    git commit plugin.vim -m "[issue 7] ..."
  6. push change to my cloned repo on github:
    git push origin master
  7. create the patch file:
    git format-patch HEAD^..HEAD
  8. upload the patch file to the issue. Nope, can't upload files to the issue tracker at github.
  9. create pull request:
    git request-pull HEAD^ origin HEAD
    The following changes since commit 9640d4d1ee980e352abd96e2c0ef13372d1c14cd:
    
      Merge remote branch 'remotes/origin/master' (2010-04-13 16:22:27 +0200)
    
    are available in the git repository at:
      git@github.com:spazm/vim-space.git master
    
    Andrew Grangaard (1):
          [issue 8] correct loaded_space to space_loaded in plugin
    
     plugin/space.vim |    4 ++--
     1 files changed, 2 insertions(+), 2 deletions(-)
  10. Copy and paste this pull request into issue 7.

This was close to the correct flow. While the issue tracker on github doesn't allow uploaded files in the comments, it does track pull requests. So the flow should look like:

Correct Flow

  1. Clone Repo (github UI)
  2. clone locally:
    git clone git@github.com/spazm/space-vim
  3. Make Changes, test
    vim plugin.vim ...
  4. commit locally:
    git add plugin.vim
    git commit -m "loaded_space fix"
  5. push to github:
    git push origin master
  6. issue pull request(github UI)
  7. done. bask in the warm glow of improving an open source project.

The issue pull request stage will create a tracking issue. Slickness. The Clone and Pull Request are handled in the github UI. Check the Pull Requests as Github UI documentation for pretty pictures.

Proper form would be to create a topic branch in the cloned repository, this becomes more useful if you plan to make any further changes or modifications to the project. Make the upstream girl's job as easy as possible to enhance the likelihood of your changes being accepted.

[LA.pm] March Los Angeles Perl Mongers

LA.pm.org will be back at Rent.com this month. Thanks for hosting again!

What:   Los Angeles Perl Mongers Meeting
When:   7-9pm
Date:   Wednesday, March 23, 2011
Where:  Rent.com - 2425 Olympic Blvd Suite 400 E, Santa Monica, CA 90404
Theme:  Perl!
RSVP:   Responses always appreciated.

As always, I'm looking for presenters. What are you doing in the greater perl infrastructure?

Looking forward to seeing my fellow mongers in 11 days.

RSVP at facebook

Vroom - vim overrides and mapping for presentation remote

The second best thing about using Vroom (Formerly Vroom::Vroom ) for presentations is hearing, "I've never seen a presentation in vim before." The best thing is using vim as both the editing and display platform.

I realized yesterday while cramming to finish my "intro to git" presentation for work that my recently added vim plugin "magic space" (space.vim) interferes with the default Vroom vimrc bindings. Space.vim rebinds space in a variety of ways to repeat the previous movement commands (search, movement, etc).

Disabling the plugin took a couple of iterations because the documentation was incorrect -- it references loaded_space while the code was checking space_loaded. Actually, the documentation was correct, but the comments in the plugin code are incorrect. I opened a ticket, cloned the github repo, pushed the changes, and updated the ticket with a pull request via git request-pull. Not bad for 5 minutes.

This encouraged me to expand my Vroom knowledge. First, I found the syntax for adding a vimrc override to my presentation. Today, I created a user specific vroom vimrc override in $HOME/.vroom/vimrc to disable magic space when I'm running Vroom presentations.

Since I was already adding custom configuration, I dug out my nerdnite presentation remote and found that the buttons are mapped to PageUp, PageDown and b. These are what powerpoint use for previous page, next page and blank screen. They aren't particularly useful while presenting in vim, so I remapped them in the vroom override to previous and next file.

You think people are shocked by a presentation in vim? Wait until you pull out your laser pointer remote to advance the slides. priceless.

My Intro to Git vroom presentation
https://github.com/spazm/presentations/tree/master/open42-git-intro
Vroom vimrc override file:
https://github.com/spazm/config/blob/master/vroom/vimrc
vim-space
https://github.com/spiiph/vim-space
my fork with fix for issue 8
Issue 8

"" Custom .vimrc overrides for Vroom
"" These will be automatically added to all 
"" vroom autogenerated .vimrc files

" disable space.vim during Vroom presentations.
" in my version of space.vim the docs refer to
" g:loaded_space, but the code checks g:space_loaded
let g:space_loaded = 1

" My presentation remote has three buttons
" forward: sends PageDown
" back:    sends PageUp
" blank:   sends b
" Bind PageUp to previous doc and PageDown to next doc
map  :N:gg
map  :n:gg
" map b ???

Sunday, February 27, 2011

Thrift!

Sweet, a new module popped onto the CPAN this weekend, Thrift::XS, an XS version of Thrift. This is doubly nice -- one, it's a faster XS version. two, it's available directly on cpan. The current module from the Apache Thrift project requires finding and downloading the package.

Thrift is a streaming serialization format. See also Protocol Buffers and Avro.

DESCRIPTION

Thrift::XS provides faster versions of Thrift::BinaryProtocol and Thrift::MemoryBuffer. On average it is about 4-6 times faster.

Thrift compact protocol support is also available, just replace Thrift::XS::BinaryProtocol with Thrift::XS::CompactProtocol.

To use, simply replace your Thrift initialization code with the appropriate Thrift::XS version.