Wednesday, June 27, 2012

Erlang syntax highlight for Notepad++ (Obsidian style)

Notepad++ does not come out of the box with a syntax highlighter for Erlang, but it does come with the support for creating a User Defined Language. Here is a syntax highlighter that I found to be almost what I needed. I use the Obsidian style and so I needed to make a couple of changes.

Here is my syntax highlighter for Erlang using the Obsidian style. Import it into Notepad++ by going to View > User Defined Dialogue and clicking on Import.

Monday, March 26, 2012

git: Rename the Directory Containing a Repository

When we thought about doing this it seemed like it was going to be a big deal but it turned out to be pretty simple. The following steps accomplished what was necessary:

1. Modify gitosis.conf to add the new directory

[group foo]
writable = foo
members = @developers

[group foo_readonly]
readonly = foo
members = @designers @developers

[group bar]
writable = bar
members = @developers

[group bar_readonly]
readonly = bar
members = @designers @developers

2. mv oldDir newDir

On origin, run the bash 'mv' command
mv foo bar

3. Work with new code

On my development machine, run git clone on the new directory and start working with the files. In our case we were using the old directory name for a new project. Running git pull from my development machine created an empty git repository on origin with the old directory name.

Tuesday, March 20, 2012

Matcher maker Matcher maker .... make me a Matcher

Ran into a problem at work today that we as a pair were close to giving up on before we finally came across the solution. We had an existing test that was ensuring that our mocked method was called with a pointer argument.

Here is that test:
using ::testing::Return;

TEST(MessageDataTests, SendResponseIsCalledWithMap)
{
    CString messageId = "TestMessageId";
    TXMLDataMap* xmlDataMap = new TXMLDataMap();
    (*xmlDataMap)["MsgId"] = messageId;

    MockTranslator *translator = new MockTranslator();
    EXPECT_CALL(*translator, SendResponse(xmlDataMap))
        .WillOnce(Return());
    translator->GetMessageData(xmlDataMap);
}

As you can see, this test is just ensuring that when SendResponse is called, it is called with the pointer xmlDataMap. We needed to add an expectation on part of what xmlDataMap was pointing too. Google Mock can accomplish this with Pointee(m) where m is a Matcher. Our pointer is not a simple type so we had to create our own matcher to check to see if our map contained the item we were adding inside of GetMessageData.

Here is what the final code looked like:
using ::testing::Return;
using ::testing::Pointee;
using ::testing::AllOf;

MATCHER_P(MapContainsValue, valueToCheck, "")
{
    return (arg.find(valueToCheck) != arg.end());
}

TEST(MessageDataTests, MapContainsDataWhenSendResponseIsCalled)
{
    CString messageId = "TestMessageId";
    TXMLDataMap* xmlDataMap = new TXMLDataMap();
    (*xmlDataMap)["MsgId"] = messageId;

    MockTranslator *translator = new MockTranslator();
    EXPECT_CALL(*translator, SendResponse(
        Pointee(AllOf(MapContainsValue("MsgId"),
                      MapContainsValue("Data")))))
        .WillOnce(Return());
    translator->GetMessageData(xmlDataMap);
}

Friday, October 7, 2011

Auto-deploy feature file

Feature file for our auto-deploy:

@Install
Scenario: Install and Configure Virtual Hold on a remote machine
  Given I stop the Virtual Hold services
  And I uninstall if already installed
  And I install the media on a remote machine
  And I configure the media on a remote machine
  And I can log into EyeQueue
  And I start the Virtual Hold services
  Then Virtual Hold is running properly

When the file references Virtual Hold it is talking about the collection of windows and web services that are needed to make our software work. EyeQueue is the web application that is used to make configuration changes for the Virtual Hold software.

Monday, September 26, 2011

Automation: Auto-deploy

One of the biggest time savers that has been implemented recently at our company has been something that we call an auto-deploy. Our software consists of windows services, web services, web applications, and databases; installing and configuring a system to test against can take quite a while when doing the entire process manually. A handful of individuals here have been working to improve this process by creating an auto-deploy process that will automate the following:
  • Uninstall the software if previously installed
  • Copy the latest build of the software to the server
  • Install the software
  • Configure the databases
  • Start the software
  • Check the software status to ensure that it is running
This used to take easily 30 minutes and sometimes several hours. The problems before mostly revolved around finding the right configuration for the server and setting up the configuration in the database through a combination of wizard screens in our windows app and different pages of our web application. (Just to explain a little about the configuration, our software is capable of talking to multiple types of telephone switches and only certain servers in our lab are configured to talk to certain switches in the lab. Because not any server can talk to any switch, the difficulty was figuring out where the configuration for Server A's connection to Switch B is and then deciphering the excel document that the lab tech's use to keep track of the configured numbers on the switch.)

Now, within ten minutes I can have a system installed with the latest version and fully configured for testing. It takes about 20 minutes to setup an auto-deploy for a server for the first time, and usually within the first two or three times it is run, all of the kinks have been worked out for that environment.


The configuration for the server is now contained within a .yml file that is read in by ruby code which is called from a scenario in a cucumber feature file. A Jenkins job is setup for each server configuration, and this job runs the installation feature. Because it is in Jenkins, it is available to put on our reader board that shows each of our projects' build status.

Our team has already seen the benefit of this. There was a bug introduced in the code that caused the services not to start. Because we have this as part of our CI, we were able to know that a problem was introduced within an hour. Without CI and the auto-deploy, this could have taken days until another build was completed.

Friday, August 26, 2011

Making Daily Standups .... Interesting: Days 12-15

I got a little behind in posting these. The contest is now over, but for your viewing pleasure:

Darth Vader

Green Cowgirl (with lights)

Tiara

Pink Cowgirl (with lights)



Friday, August 19, 2011

Making Daily Standups .... Interesting: Day 11

Here's a viking quote to go along with today's hat:
Never walk away from home ahead of your axe and sword. You can't feel a battle in your bones or foresee a fight.
- The Havamal

Viking helmet