Wednesday, August 25, 2010

GitHub Forked Projects Warning

Template projects, particularly in Rails, have become very popular. If you are in a hurry to get a project off the ground, it is nice to start with a base project that includes your favorite goodies like acts_as_authenticated, active_merchant, paperclip, etc. There is a hidden danger that I just encountered recently, though. If the person you fork your project from has a paid account, and they stop paying, you lose access to your source code.

The simple solution: After cloning the project, check it in as a new project to your account.

What my experience was:

Thursday night, I was working on an urgent issue that had to be fixed for Friday morning. I fixed the issue at 2:00am and went to check the code into the repository. The message I got back was:

ERROR: Account `<redacted>' is disabled. Please contact support@github.com or ask the owner to check their account.
fatal: The remote end hung up unexpectedly

Eeep! I don't think I had ever seen the name of the account owner mentioned before (I came into this project after it was started). To make matters worse, the person who owned the account containing the project was on a fishing trip. What was I to do? I opened a ticket with github, but I couldn't wait for them to resolve the issue. I used git's wonderful diff tool to create a patch which I could then install on the server.

It turns out, "patch" was not installed on the server! Very carefully, I copied the changes one by one from the patch to the code (I know - installing patch may have been faster, but I was over stepping my authority already). Fortunately, the manual patch worked.

The next morning, GitHub support explained the issue and offered to "un-fork" the repository for me. After that, I was able to use the repository again. I returned to the server, used "git stash" to remove the manual changes and updated. All was good.

Saturday, November 14, 2009

Island Tech 2009

I had a great time today at Island Tech 2009.Island Tech 2009

The day started out with the keynote speech by Will Harbin who informed us that there is still success happening in Technology, even in today's marketplace.  He specifically highlighted the growth areas of lead generation and virtual goods (think Mafia Wars on Facebook).

Over in the exhibit hall, there were approximately 50 businesses and organizations represented, highlighting the best of the tech sector in Victoria.  I spent a fair chunk of time hanging out with a number of ex Mercurial folk and catching up with old friends after making the rounds a couple of times to see what was new and exciting.  Highlights of the exhibits included: the Flock and Clover Point Cartographics booths (manned by old colleagues), Starfish Medical, who displayed a number of medical devices designed and built locally, and Knowledge Computers who are taking used networking equipment from Cisco, Sun, and others and re-selling it locally and overseas.

The morning got a bit noisy when the usually quiet tech crowd was overwhelmed by a large number of school children who came to visit the show and take in the "Things that go boom in the lab" talk.  They were a boisterous bunch but were polite and well behaved (until someone thought it would be a good idea to hand out giant foam hands in the middle of the lab show - causing a bit of a stampede).

I didn't take in all of the talks, but I certainly enjoyed the ones I went to:

Kurt Cagel had a fascinating take on trends with us now which will be effecting us for the next 10 years or so.  From generational issues, to changes to the energy economy, to changes in the way we communicate, Kurt covered a lot of ground.  I'm looking forward to seeing the full set of slides (he ran out of time and had to truncate his talk a bit).  In the mean time, check out his blog posts on the Metaphorical Web.

Kris Krug gave a sprited talk about open everything.  He stressed the possibility and the reality of companies (and himself) making money off of open source (he publishes all of his own work under the Creative Commons license).  The one phrase that really stuck with me, though, was about a software company we love to hate and their "drug dealing business model."

Joshua McKenty gave a really interesting talk about high performance teams - what they are and how to nurture them.  Given that Josh is one of the highest energy, high performance people that I know, he has a good perspective on this subject.  What I took away from this is that a high performance team should not have people parachuted in - the team knows what they need and knows who will (and most importantly who will not) add to the mission.  This is a lesson well learned from the Netscape 8.0 days.  The most shocking part of the talk was what Josh used to get our attention in the first place: "A single bad hire will easily cost a company $100,000.  A single good hire is worth $400,000."

Clayton Stark (of Flock) surprised me with an empassioned talk drawing parallels between our evolving social networking modes of communication and how people with autism spectrum disorders communicate.  The gist of the talk is that we have accepted asynchronous communication as the norm when interacting with people on the web.  We need to take our evolving communication strategies and be able to accept autistic communication as being inherently asynchronous, rather than bad or wrong.  This one hit close to home as my nephew has Asperger syndrome.

The final presention of the day was truly "Out of the Box".  Dave Olson challenged us to embrace the "translucency" of the web and express ourselves to the best of our ability.  It's not the sort of talk I would have attended based on the synopsis, but Clayton was raving about this guy.  I'm glad I went.  Dave was, by far, the most entertaining and engaging speaker of the day.  I learned a little history and took on a new appreciation for some of the artists of the past and the present.  Most importantly, I feel challenged to not let my creative side slip away under the pressures of work and family.  Thanks, Dave.

Thursday, August 20, 2009

IE6 DHTML fun

I had a wierd one this week.

We had a form which we were loading dynamically on a key press and the form had buttons of the form:


<a href="#" onclick="if ($('myform').onsubmit()){$('myform').submit();};"><span>go</span></a>

None of the buttons were functioning correctly, and were not producing error messages.

To make things even more interesting, the form was being created from a partial in a helper (Rails).

The code basically looked like this:


toggle = link_to_function "---HTML---", do |page|
page << "--some javascript--"
page.insert_html :top, 'main', :partial => 'friendships/new', :locals => {:friend => friend}
page << "--some javascript--"
end


The form was contained in the 'friendships/new' partial.

Needless to say, the raw html produced was very ugly and full of various amounts of escapes and quotes. I was pretty sure that this was the source of the problem. I was wrong.

It was pointed out by karma that the problem was really a permissions issue. The page.insert bit in the helper uses prototype.js to create the html and insert it into the page at the top of the div with id='main'. The problem is that the order it does this in is:

1. Instantiate the html.
2. Insert into postion.

As karma points out, that leaves all javascript operating at the security level of about:blank.

The solution was to add a funny little bit of javascript to the page:


page << "var x = $('myformcontainer').innerHTML;$('myformcontainer').innerHTML = x;"


This had the effect of re-inserting the code in place on the page, rather than instantiating it first.

Thursday, July 23, 2009

Javascript Cookies

Thanks to Jason McCreary, I was able to get Javascript cookies working very easily.

The one thing missing on that page, though, is a more general bit of help with how to safely use cookies. My first attempt (below) almost worked perfectly, however there was a little bit of weirdness.


Cookie.init({name: "macBlogMenu"});
open_nodes = Cookie.getData("open_nodes");
<do stuff>
Cookie.setData("open_nodes",open_nodes);


I am working on a rails site which is defined such that /blog shows the current blog and /blog/N shows the blog with id=N. Since both of these show a blog entry and the cookie was to keep track of menu state on the blog display page, I used a javascript cookie with just default options. This was a bad idea. State was not being updated when I looked at other blog entries, only when I used the default (current) blog entry.

Anyone familiar with cookies would probably already know the answer is to define the path option for the Cookie object. So the better code is:


Cookie.init({name: "macBlogMenu"});
Cookie.options.path = "/blog/";
open_nodes = Cookie.getData("open_nodes");
<do stuff>
Cookie.setData("open_nodes",open_nodes);


The path needs to be "/blog/" because of the scope rules for cookies. Documents at root (one level - i.e. /blog), can read and change cookies for documents on lower nodes. Lower nodes (/blog/3) can read cookies defined for higher level paths, but not set them. By defining the path this way, it is accessible to /blog and /blog/N documents.

Wednesday, July 15, 2009

Git Diff and Empty Files

I use git for local source control whenever possible.

If I am working with a system which does not have access to my repository, sometimes I use "git diff" to create patch files to update the remote site.

Today, I found a huge flaw in that strategy. If I have an empty file that was created on my local site, the "git diff" output does not include the file at all!

There are two ways around this. The first is to remember that the file needs to be created on the remote system and to "touch" the file. The second, and better way, is to never create completely empty files. Instead, create a file with a comment that it is intentionally left empty.

Friday, July 10, 2009

Jackalope Apache Virtual Hosts

I had an annoying problem with my Apache virtual hosts when I updated to Juanty Jackalope recently. Any hostname I used to access my server was resulting in the same virtual host serving the page. I lived with it for a week or so by using a2dissite/a2ensite to only enable the virtual host I needed at the time (obviously a poor solution).

I figured it out today. The trick was to go through all of my virtual hosts and change the line:


<VirtualHost *>

to

<VirtualHost *:80>

I hope this helps someone.

Wednesday, March 25, 2009

Working Environment

I've been thinking a lot lately about how I work. You know the saying: work smarter, not harder. I'm wondering if I am working smart enough.

First off, I was a Unix/Linux systems administrator for 10 years, so my preferred development OS is linux (Ubuntu, primarily). I do ruby on rails development. That means I normally have two windows open: A terminator window, and a browser window (usually flock).

I am a bit of a command line/terminal bigot. I work most efficiently that way. I know lots of people do great work with various graphical IDE's. I've just never been satisfied that I (me personally) can work faster than on the command line. I use vim extensively. With multiple windows open in terminator, each of which is running a named screen session, I am able to have a couple of edit sessions and a console or database session running. With a little hackery, I can copy text to and from the various windows using keyboard shortcuts only.

Why flock browser? Well, for starters, I was part of the development team for a while, and still in contact with those working on it. If something breaks, I know who to talk to about it. Also, I find the aggrigation of my various social networking bits useful (but the addition of linkedin would be nice).

In addition to these, I have, for one of my projects, the need to use campfire. To help with that, since the mozilla update of the number of unread messages is not always reliable, I use butane to keep up with the discussion. Finally, I use Pidgin for general IM functions.

If anyone reading this has any suggestions for working smarter, I'd be happy to entertain them.