Friday, September 14, 2012

Git Extensions 240 on Ubuntu 12.04

While I do most of my git work from the command line, I occasionally use GitExtensions for viewing the history of commits and for it's visualization of which commits are in which branch. When converting to Ubuntu I was glad to find out that GitExtensions worked on Linux, but it was not as clear on how to set it up. Apparently, the Linux support for GitExtensions is not as good as the Windows support. GitExtensions is written in C# and utilizes mono to be able to run cross-platform.

I spent some time trying to figure out how to get this to run on Ubuntu. There is a youtube video about getting this to work in Ubuntu 11.04 but after following the steps shown, I still could not get it to work.

Here is what I ended up doing. I downloaded the .zip file for Windows and Linux and extracted it into /home/apps. From the terminal, I ran:
$ mono /home/apps/GitExtensions/GitExtensions.exe
which produced the following error:
Unhandled Exception: System.TypeLoadException: Could not load type 'GitUI.FormChooseTranslation' from assembly 'GitUI, Version=2.40.0.0, Culture=neutral, PublicKeyToken=null'.[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeLoadException: Could not load type 'GitUI.FormChooseTranslation' from assembly 'GitUI, Version=2.40.0.0, Culture=neutral, PublicKeyToken=null'.

While searching for a solution for this, I came across a thread in the Google Group for GitExtensions that led me to downloading MonoDevelop. Apparently even though I had the Mono Runtime and the Mono Runtime (Terminal), MonoDevelop is also needed for GitExtensions to work.

Installed mono software
After installing MonoDevelop, GitExtensions opened with no problem at all. I was able to select my language and configure it for first time use.

One more thing that I wanted was an icon on the launcher so I didn't need to keep running this from the terminal. This post helped me out there. From the terminal run:
$ sudo apt-get install --no-install-recommends gnome-panel
and then to create a launcher:
$ gnome-desktop-item-edit ~/Desktop/ --create-new
The icon can be changed to the GitExtensions icon but you have to first change it to an image format such as .jpeg or .gif. Open the .ico file that came with GitExtensions in an image editing program and save it as a .jpeg or .gif. Then in the Create Launcher window, click on the icon in the top left and select the file that you just created. Give the launcher a name and for its command set it to 'mono' and then the path of GitExtensions.exe. Here is mine:

Git Extensions Launcher
This will place the launcher on the desktop. To move this launcher to the Launcher, just drag and drop it onto the Launcher. You will notice that it appears both in the Launcher and on the desktop. To avoid this, move the launcher from the desktop to another folder such as /home, and then from there, drag it to the Launcher.

Thursday, September 13, 2012

Switch to Ubuntu: Remmina Remote Desktop Client

The switch to Ubuntu 12.04 from Windows 7 has been pretty seamless so far and I find that I enjoy using it. I've found several things so far that I like using better than the Windows counterpart; for instance, Remmina Remote Desktop Client over Windows' RDP interface. Remmina came with my version of Ubuntu, but it is also not difficult to install.

With Remmina, you setup a connection once with all of the parameters for that server, and every time you need to connect after that, Remmina will connect and log in with just one click.

Remmina Connection Profile

Remmina one-click connection
A feature of Remmina that makes it better than the similar product in Windows is tabbing the connections when multiple connections are in use at the same time.

Remmina multiple connections
I'm looking forward to learning more about Ubuntu and will post more of what I learn when I get time.

Tuesday, September 11, 2012

Setting up Ubuntu for the first time

Recently we've seen a shift here at work to start using Linux OS's for as much work as we can. I've not been as quick to jump on that bandwagon but decided last Friday to use the Windows installer for Ubuntu and setup my system to dual-boot Windows 7 and Ubuntu 12.04.

With a little help from Google and my co-workers, I've been able to figure out many of the things that I've wanted to use Ubuntu for but still feel like there's so much more. The biggest trouble that I've had so far has been with docking my laptop. Initially there wasn't any problem until I activated additional drivers for my NVIDIA graphics card.

Additional Drivers window - showing the NVIDIA drivers

Not knowing what I was doing, I activated the drivers and expected them to work just fine, but when the laptop was docked nothing would show on the monitors. I have a Dell laptop, docking station, and two 24" monitors and after activating these drivers, the monitors kept saying they were going into standby mode. For whatever reason, the laptop screen didn't have any issues - just when the laptop was docked.

The resolution (no pun intended) to this was to de-activate the drivers and reboot.

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);
}