The Archives

SEARCH

I’m Attending

CodeMash

Archive for September, 2010

Setting Up Mercurial

Posted in: Programming by Steve on September 30, 2010

With Atlassian acquiring BitBucket yesterday, it’s time to seriously look at moving to a distributed source control system.  We have been struggling with Subversion for a while now and it’s time to start getting our source control under control.

Here’s what you need to get going with Mercurial on Windows (other OS’s are listed too):

After getting everything installed, it’s time to work on getting our environment set for diffs, merges and comments.  I have grown to love Beyond Compare and Notepad++ and want to integrate it into Mercurial.  To do this, we need to set it in the mercurial.ini file.  This is located in c:\Users\<UserName>\mercurial.ini.  If it doesn’t exist, you must create it.

Here is my mercurial.ini:

[extensions]
extdiff =

[extdiff]
cmd.bcomp = c:\Program Files (x86)\Beyond Compare 3\BComp.exe
opts.bcomp = /ro

[tortoisehg]
vdiff = bcomp

[merge-tools]
bcomp.executable = c:\Program Files (x86)\Beyond Compare 3\BComp.exe
bcomp.args = $local $other $base $output
bcomp.priority = 1
bcomp.premerge = True
bcomp.gui = True

[ui]
editor = c:\Program Files (x86)\Notepad++\notepad++.exe
merge = bcomp
username = Stephen Wright (email addresss)

This will set your commit editor to Notepad++ and any merge/diff commands to Beyond Compare.

After saving this file, you can open up a command window and start typing commands.  You can create an account for free at BitBucket, then create a new repository.  You can then setup a local directory for your repo.

Clone Repo

Even though it is empty, this gives you an empty canvas to play with.

The next step is to create a readme file and add it to the repo.

Add File

To push your changes to the repo:

image

Autotest in Ruby

Posted in: Programming by Steve on September 29, 2010

Getting constant feedback on the health of your system is always a great thing.  In rails, you can install a gem called autotest that can run your tests as you change your application and let you know if you have broken anything.

All you have to do is start a terminal window, and type “autotest”.  That’s it!  You get instant feedback on your tests!

http://ph7spot.com/musings/getting-started-with-autotest

ASP.NET Vunerability Fix Today

Posted in: Programming by Steve on September 28, 2010

Scott Guthrie announced on his blog that a fix from Microsoft will be available for download sometime today, and that the fix will be available through Windows Update in the coming week(s)

http://weblogs.asp.net/scottgu/archive/2010/09/27/asp-net-security-update-shipping-tuesday-sept-28th.aspx

Please make sure to update your servers.

Update (3:00 PM)

Scott Guthrie has a post on all the fixes: http://weblogs.asp.net/scottgu/archive/2010/09/28/asp-net-security-update-now-available.aspx

New Project Tools

Posted in: Programming by Steve on September 26, 2010

Beginning a new project can be very exciting.  It can also be hard to gather all the requirements, especially when your team is distributed. With any team, you want to make sure everyone is on the same page and working toward the same goal.  The tools that I use help me keep track of everything, such as requirements, stories, deadlines and milestones.  Here are some of them:

Unfuddle – unfuddle.com

This is where we keep all the details of all the projects.  They also have source control for both Subversion and Git.  Very straightforward and easy to use interface make this my primary place for information. 

Agile Zen – agilezen.com

Kanban boards galore!  Keeping track of what is going on is essential to getting a new project off the ground.  Being able to visualize this on AgileZen is simple. 

Steve Smith also has a great checklist of tools to check out as well.

The Quest to Get Rid of Cable

Posted in: Home by Steve on

956420_15571988.jpg
Comcast d-bag
(in case you didn’t know)

I pay an outrageous amount of money a month for cable.  This d-bag over here represents Comcast.  They take so much of my money each month, it’s sick.  We were going over our monthly budget and decided to look at other options for getting our weekly fix of House and Man vs. Food.

So the first thing we needed to figure out was what are the shows that we absolutely have to watch?  I love to watch sports.  Right off the bat, I’m screwed because trying to get any of the local sports teams online is impossible.  Thanks to agreements between the major sports, they will not broadcast the NHL Gamecenter, MLB or NFL online because of local blackout restrictions.  So if I can live without watching sports, then getting rid of cable would be a lot easier.  This is really the crux of the decision.  Everything else is just a nice to have.  Sports is what we have cable for, especially NHL Network, Comcast Sportsnet, NFL Network and MLB Network.  The majority of my TV watching comes from these channels.

Since our local sports teams do not broadcast many games OTA, the decision is a lot harder than I realized.  I was watching the first couple of games for the NHL preseason and the HD is quite amazing.  It’s hard to say goodbye to that.

After having to make the decision on whether or not to do it, I have to determine how my media is going to get to my TVs.  Our current inventory of hardware and content consists of:

  • XBox 360 with Wireless G Adapter
  • Nintendo Wii
  • Western Digital HD Live
  • Netflix Subscription
  • PlayOn.TV
  • Windows Media Center
  • Windows Home Server

Our house has 3 physical TVs. We have 2 standard definition (SD) and 1 HD TV.  One of the problems that I am facing is how to get network to these locations.  The bedroom TV is easy because I can run an ethernet cable to whatever ends up being the media hub for that TV.  That leaves me with an SD TV in the far corner of the house, and the HD TV. For the SD TV, I’m looking at getting a Roku XD because of the extended range capabilities of the player.  I don’t know if even having a TV hooked up to media makes any sense because it’s in our son’s playroom. This could be the last step when building our our solution. 

Which brings us to the main TV in the house, the 61” HD TV.  Now trying to get HD quality signal to this television is going to be interesting to solve.  The XBox is connected to this TV and has a wireless G adapter.  This is fine for gaming, but when I try to connect to the Media Center, it never plays any of the videos.  A possible upgrade for the 360 is to get a Wireless N adapter to increase the bandwidth.  I could then get all of the media running through the XBox. 

I’m still weighing my options, but it looks like I might be able to save almost $1,300 / year getting rid of cable completely if I can live without local sports.

Subtracting a record count from current records

Posted in: Programming by Steve on September 25, 2010

In our application, we have a need to archive some specific records in a table.  After the records are archived, more records could potentially be added after those that are not archived.  Here is an example table:

ID    |   InstanceNumber     |   IsArchived

5000  |         1            |     True
8347  |         2            |     True
9343  |         3            |     False
11048 |         4            |     False
15311 |         6            |     False

So the record set I am trying to return is this:

ID    |   InstanceNumber     |   IsArchived

9343  |         1            |     False
11048 |         2            |     False
15311 |         4            |     False

This results in records that are not archived, but with Instance Numbers that have been adjusted by subtracting the count of archived records. The SQL that I came up with is this:

DECLARE @tbl TABLE
(ID INT NOT NULL, InstanceNumber INT NOT NULL, IsArchived BIT NOT NULL)

INSERT INTO @tbl VALUES (5000, 1, 1)
INSERT INTO @tbl VALUES (8347, 2, 1)
INSERT INTO @tbl VALUES (9343, 3, 0)
INSERT INTO @tbl VALUES (11048, 4, 0)
INSERT INTO @tbl VALUES (15311, 6, 0)

SELECT ID, InstanceNumber - (SELECT MAX(InstanceNumber) FROM @tbl WHERE IsArchived = 1), IsArchived
FROM @tbl
WHERE IsArchived = 0

I am looking to optimize this query so it does not have any adverse affect on the report that it is needed for.

Any ideas? I even added a StackOverflow question about it.

Internet Dependency – Uptime Fallacy

Posted in: Programming by Steve on September 24, 2010

Today, Facebook was down for an extended period of time.  This caused many websites to stop loading because of the Like Button JavaScript that so many sites (including CNN, TechCrunch, etc…) all have on their articles.  So if your site has the iFrame or JavaScript that allows you to post from your site to a user’s Facebook page, it would not load all the way.

This is why I do not advocate having a dependency on another site.  If your site needs another service to function, then you are at the mercy of that site and cannot operate autonomously.  What if Facebook completely shuts down completely?  What if your site needs it to function? What do you do?

I am facing the same issue now with one idea that I’m trying to hash out.  Do we use Facebook login to manage users or do we create our own authentication system that ties back to a user?

Today’s issue makes me think that having our own system that pushes our data out to Facebook is the best answer because we can then change based on the market.  We could change our pushing of data into Twitter, or Skype or LinkedIn, or whatever the flavor of the month will be in the future.  Having the ability to change will is the best way to protect your “investment”.

Why Ruby on Rails?

Posted in: General by Steve on September 23, 2010

Because today, Visual Studio crashed 4 times on me, Visual Basic compiler crashed and I had to force the application closed via Task Manager.

I don’t have a lot of crashes with Textmate.

Home Security

Posted in: Home by Steve on September 22, 2010

A house near us was broken into last week.  It was during the middle of the day and they took a lot of the valuables from the house.  My wife and I are now on the lookout to make sure that we always have our house locked up and that we’re watching for shady people in our neighborhood.

I saw this comic from Ctrl-Alt-Del and LOL’d

http://www.cad-comic.com/cad/20100920/

How to Rollback to a Earlier Revision in Subversion

Posted in: Programming by Steve on September 21, 2010

498474_88753320 So I’ve been working on a feature where I needed to strip out a lot of legacy code.  Unfortunately, as I was doing so, I was touching more of the code than I really wanted to.  The code in question was not under test and would have to be manually retested.

I had created a branch from the main development branch and had made several commits since the changes had started.  I needed to revert back to when I started tearing some of the original code out.

In Subversion, you have to merge the revision you want to go back to into your current revision and commit.

This is the command:

svn merge -r2467:2453

In my case, the revision I was on was 2467 (current revision) and I wanted to revert back to revision 2453 (revert to revision).

I haven’t had to do this before, and had to look it up.