Monday, September 14, 2009

Just the domain

I've done this a couple of times before but found myself having to dig through docs to remember how so thought I'd put up a post for future reference.

I wanted to group some users by their email domain for a query I was running in my PostgreSQL database. I have a users table with an email column. Here's a query I ran:


select count(*) as users,
substring(email from (position('@' in email))+1) as "domain"
from users
group by domain
order by users desc
limit 10;


users | domain
-------+---------------
XXXXX | yahoo.com
XXXXX | gmail.com
XXXXX | hotmail.com
XXXXX | aol.com
XXXXX | comcast.net
XXXXX | msn.com
XXXXX | sbcglobal.net
XXXXX | live.com
XXXXX | verizon.net
XXXXX | ymail.com


This allows me to select the email domain from the email column. Pretty handy.

Wednesday, June 24, 2009

TweetDeck - How to follow multiple accounts

With the latest version of TweetDeck, you can now easily follow many accounts at one time. Here's a quick step-by-step to show you how.
  • Click the Add more acccounts link (or Accounts tab in the Settings screen)
  • Enter the account credentials (Username and Password) then add the account and save.


  • Click the "All Friends" column to add a new column.
  • Using the drop-down arrow, select the account you want to add the column for.

One thing to watch out for, when posting a tweet pay special attention to which account(s) the tweet will be "From". You might not want to post as multiple personalities. Just click each account to toggle it on / off.

Tuesday, April 7, 2009

SVN to git and cruisecontrol.rb

We're finally moving from svn to git.  Yesterday, I worked on upgrading our cruisecontrol.rb to monitor our git repository.  Previously, we were on svn and using cruisecontrolrb-1.2.1 so it was time to upgrade CruiseControl and migrate to git in one fell swoop.

Our team uses Unfuddle so the first step was to work with them on completing the svn git clone.

Our cruisecontrol set-up includes an apache web server in front of the cruisecontrol.rb rails application with integration to our Campfire room via a plugin.

Here are the steps I followed:

  1. Set-up a user that has read-only access to our git repository - The steps I followed here were specific to Unfuddle and included putting the public key into the Unfuddle user's personal settings.
  2. Build Cruisecontrol.rb - git clone \ git://github.com/thoughtworks/cruisecontrol.rb.git
  3. Copy the campfire plugin from OLD_CRUISE_ROOT/builder_plugins/installed/campfire_notifiter.rb to NEW_CRUISE_ROOT/lib/builder_plugins
  4. Copy .yml files from OLD_CRUISE_ROOT/config to NEW_CRUISE_ROOT/config
  5. Update my front-end apache server to point to the new cruise installation
  6. remove the .htaccess file from NEW_CRUISE_ROOT/public/.htaccess
With all the configuration complete, I'm now ready to add projects.  In the svn days, we'd always monitor trunk and the branch currently running in production.  Here's how to add the same using git:

./cruise add PROJECT_NAME --source-control git \
--repository git@our.host:repo/name.git

./cruise add PROJECT_NAME --source-control git \
--repository git@our.host:repo/name.git --branch BRANCH_NAME


Friday, March 13, 2009

St. Baldrick's

I'm shaving my head on Sunday for charity!

Friday, October 31, 2008

Slideshare

Have you heard of Slideshare? "SlideShare is the world's largest community for sharing presentations."

Interesting idea. Upload and share your powerpoint presentations. Get your very own Slidespace. Mine's at http://www.slideshare.net/nathenharvey.

Here's a one-slide presentation I put together to test out the service. Are you using the service? What's your Slidespace?

Get Real Get A Visualcv
View SlideShare presentation or Upload your own. (tags: myspace facebook)


Thursday, October 9, 2008

Fun with Gmail addresses

You may already know this (I just found out myself) but Gmail supports plus-addressing.

In other words, you can send an email to yourusername+anystring@gmail.com and it'll be delivered to yourusername@gmail.com.

As it turns out, gmail also ignores any periods in the username so your.username@gmail.com will go to yourusername@gmail.com as will y.ou.ruserna.me@gmail.com.

This is a pretty handy!


Thursday, July 31, 2008

Restore the history of a file in subversion

I have a file (some_controller.rb) currently at revision 7744 that was deleted and added in revision 7614.

Deleting and adding a file in the same revision doesn't make a whole lot of sense. I'm pretty sure this was done inadvertently by the developer. In any case, doing so effectively erased the history of the file. Now svn log only shows the changes that have been made since 7614 and svn blame shows the committer of 7614 as the primary editor of the file.

Of course, we always want to accurately place blame...so we'd like to restore the history of the file.

This can be achieved by restoring a previous version of the file and then re-applying any updates to it. One side-effect is that any changes made between the delete/add revision (7614 in this case) and the new revision will be put in as one revision. Though, if you wanted to, I suppose you could work around that by re-applying the changes one by one.

Here are the svn steps I took to restore the history of the file:

svn mv some_controller.rb some_controller.rb.tmp

svn ci -m "temporary move, restoring the history of the file"

svn cp https://mysvnrepo.url/trunk/app/controllers/some_controller.rb --revision 7613 https://mysvnrepo.url/trunk/app/controllers/ -m "revive old version of some_controller"

svn up

svn cat some_controller.rb.tmp >some_controller.rb


svn ci -m "put new revisions back into some_controller.rb" some_controller.rb

svn del some_controller.rb.tmp

svn ci -m "remove temporary file"