Arrested Dev

20Nov/094423

Git in there!

Since starting as Software Engineer at Vamosa I have had the chance to work properly with source control.

I primarily started out using Subversion (svn) which I thought was great and easy to use, except those pesky conflicts.

Anyway...after working with Subversion and absolutely loving it along comes Git and github.com. I moved from working on Vamosa's main software to their other piece of software, this is when I discovered the joys of Git.

Their are a number of features that make Git stand out from the rest of the version control systems, I will touch on a few :)

Distributed

Git was initially designed by Linus Torvalds for the Linux Kernel.  From the beginning Git was designed to be a distributed version control system meaning branching and multiple redundant repositories are a huge part of Git.

In Git, as with any distributed version control system, the user has a copy of the whole repo on their local work station, not only does this gives the user superb performance but also means they can have the full functionality when disconnected from their network.  Each user having a local copy of the whole repo also acts as a backup system, you may have 10 users all with a local copy and if all these users are pushing and pulling changes frequently you will suffer minimal loss if a machine dies some how (touch wood).

Branches

Branches are a central concept used in Git, every developer that is working with the Git respository has a working directory which is a branch.

Git also tracks all merge events, what branch was merge, who performed the merge and why (blame culture :P ) and what changes were made to successfully complete the merge.  Git also automatically tracks the revision the branch was started from which is vital to successfully merge the branch back to the main trunk.

Line Ending Conversion

This was one of the big things that influenced our decision to switch to Git.  The team I work in consists of 4 developers, 2 of us develop on Linux and 2 on Windows.  One of the great features of Git is the ability to configure Git to check out code with CRLF and check in code with LF, Windows users simply configure "core.autocrlf = true".  This can be achieved just as easy with Subversion but you have to specify which files should be converted but with Git it all happens automagically.

Space

When we moved to Git one of the things we noticed was the size of the Git working directory compared to the Subversion working directory, the Git one is a whole lot smaller than Subversion.

In a Subversion working directory their is two copies of each file, one which the user actually works on and another hidden in .svn/.  The purpose of the copy in the .svn/ folder is to assist in tasks such as commit, status and diff.  Where as with Git the working directory only need a index file for each file which is tiny.  We decided to do a little comparison and it worked out that the history for our Subversion was almost 25 times bigger than that for our Git history.  I would imagine that if you have a huge code base this would make a big difference on disk usage.

Speed

One of the other advantages of having a local repository is no network slow down.

I was extremely impressed by the performance of tasks such as diff, committing changes, merging branches, viewing the history for a file and switching branches, it is insanely fast!

The only tasks that suffer from network slow down is pushing and pulling

Install

Linux

I use Git on Debian and installing it on a machine with APT is easy:

sudo apt-get install git-core

Installing it on a machine that uses Yum (Red Hat, Fedora) is just as easy:

yum install git-core

Windows

A couple of solutions are available for Windows msysGit is what the developers here use

Mac

On the Mac you can install Git with MacPort

After you install MacPort run:

sudo port install git-core

The things I have discussed are just some of the benefits of Git.

Install it and Git pulling and pushing :D

yum install git-coreyum instal
Filed under: Git 4423 Comments
10Nov/09Off

PIC – Up and Run!

After a weekend of intense reading on the PIC32 architecture I finally got some code working.

The PIC32 Starter Kit only comes with 3 LEDs and 3 Switches but I have never felt so much reward in seeing LEDs flashing. I wrote the following code, which gives the user a menu to choose which LED to turn on or off...

/*
Author: Eef
Desc: User Toggle LED's :D
*/
#include "db_utils.h"
#include <plib.h>

char GetMenuChoice(void);
void DoEcho(void);
void ToggleRed(void);
void ToggleOrange(void);
void ToggleGreen(void);
void InitLEDs(void);

int main(void) {

  char choice;
  char repeat;

  DBINIT();

  // Make the lights flash!
  InitLEDs();

  while (repeat != 'x') {

    // Print the options to the user
    DBPRINTF("R to toggle the red one. \n");
    DBPRINTF("O to toggle the orange one. \n");
    DBPRINTF("G to toggle the green one. \n");
    DBPRINTF("X to exit. \n");

    // prompt the user for his/her choice
    choice = GetMenuChoice();

    // now switch on the chosen light
    switch(choice){
      case 'o':
      case 'O':
        ToggleOrange();
        break;
      case 'g':
      case 'G':
        ToggleGreen();
        break;
      case 'x':
      case 'X':
        repeat = 'x';
        break;
      default:
        // if the user presses anything else but the choices thrown an error
        DBPRINTF("Whit, type either E,R,G,O,X! ya nugget\n");
        ToggleRed();
        ToggleOrange();
        ToggleGreen();
        ToggleRed();
        ToggleOrange();
        ToggleGreen();
        break;
    }
  }

  DBPRINTF("Exited. \n");
  return 0;
}

char GetMenuChoice(void) {

  char choice;

  // let the user know what they can choose
  DBPRINTF("Choose a light to light (e,r,o,g): \n");
  choice = 'r';

  // get the user input
  DBGETC(&choice);
  return choice;
}

void InitLEDs(void) {
  mPORTDSetPinsDigitalOut(BIT_0);
  mPORTDClearBits(BIT_0);
  mPORTDSetPinsDigitalOut(BIT_1);
  mPORTDClearBits(BIT_1);
  mPORTDSetPinsDigitalOut(BIT_2);
  mPORTDClearBits(BIT_2);
}

// methods to turn on the lights
void ToggleRed(void) {
  DBPRINTF("Red LED \n");
  mPORTDToggleBits(BIT_0);
}

void ToggleOrange(void) {
  DBPRINTF("Orange LED \n");
  mPORTDToggleBits(BIT_1);
}

void ToggleGreen(void) {
  DBPRINTF("Green LED \n");
  mPORTDToggleBits(BIT_2);
}

This is very simple stuff with the PIC32 MCU and I have not explorered it fully.

From what I have developed so far it is a great environment to develop on especially as the guys at MicroChip have provided a excellent C library to handle most of the nitty gritty stuff.

If you have ever programmed C before you will notice that the usual stdio.h library is not included and the normal printf is replaced with DBPRINTF. The PIC32 library replaces a lot of the usual C functions but stays very close, so anyone with some C experience can pic (excuse pun) one up and get going.

My next project is getting output directed to a LCD screen that I have bought, I was going to attempt it with a OLED but I do not have the correct expansions yet, specs:

PIC32 Starter Kit

PIC32 I/O Expansion Board

Powertip PG12864 LCD Module

Will post some pics once I get things to display on the LCD module. :)

Filed under: C, PIC32 Comments Off
9Nov/09Off

PIC of the day

Today my PIC32 Microcontroller arrived.

First off I need to say UPS are a top class delivery company. Ordered the MCU yesterday at 4.30pm and it arrived today at 1.30pm...less than 24 hours, get that roond yi Royal Snail Mail :)

I have recently started learning C for a little project that me and a friend are working on, nothing serious, just messing about.

I rattled threw 2 C book's last week, mainly learning about pointers and memory mumbojumbo, but got my head around them eventually.

I decided to take C a little further after a friend sent me this post about Steve Wozniak [Link] and purchased a MCU. It's nothing special, PIC32 running at 80 MHz with 512K Flash, 32K RAM, 4 ch [Link] , also got a excellent looking book "Programming 32-Bit Microcontrollers in C" [Link]

I will be recording my progress on the rest of my adventures with C and Microcontrollers, so watch this space for my frustration :D

Filed under: PIC32 Comments Off
8Nov/09Off

Pain in the Flash

Today I had the pleasure of working with Flash on Ubuntu 64bit - First of it was a pain in the to get installed. Eventually used 32bit flash player plugin and it work o.O

I then implemented JQuery Thickbox into my application. All was well, Thickbox is a very nice JQuery plugin. I did however notice that my Flash objects were appearing on top of the Thickbox.

After a little investigation I solved it with a little attribute called wmode.

Here is some information on wmode.

wmode was brought in by Macromedia, it purpose is to give developers/designers the ability to hide Flash from older screen readers.

I have not tested but I presume that all elements with similar attributes to the Thickbox popup will appear behind flash.

If this is the case for you then follow these steps:

Make sure you have a params element nested inside your object element. Now simply add the attribute "wmode" and try both values "opaque" or "transparent", one of them should do the trick.

This should hopefully solve the issue of your Thickbox window appearing below Flash objects.

If you do not have a object element and only a embed element, just add the same attribute to this element.

Happy Flashing!

Filed under: Flash, HTML Comments Off
   

Recent Posts

Archives

Categories