Raspberry Pi

What software do I need to update and how?

There are two different sections of the Raspberry Pi that require updating. These two different items are the firmware and the operating system:

  • rpi-update is a tool to upgrade the firmware for your Raspberry Pi. Firmware is a small package of code that usually lives on a special chip of a computer that helps the software know how to talk to the hardware. However, in the case of the Raspberry Pi, the firmware will live on the first partition of the SD card.
  • Raspbian is an operating system or the core software for your Raspberry Pi. Software (including the OS) lives on second partition of the SD card and is all the stuff that gets executed when you use your device.

Both of these need updating independently. For convenience, the rpi-update tool is included in the Raspbian distribution of Linux because it is a useful software tool that manages the firmware of your Pi’s. You should run it periodically to make sure your devices have the latest firmware. Separately, you need to keep your software up to date using the standard Debian software management tools. The following line will do both:

> sudo apt-get update && sudo apt-get upgrade

Each of these functions is separate, and updating one will not update the other. Upgrading your distribution to the latest software packages might get you a new version of rpi-update, but unless you RUN rpi-update your firmware will not get updated.

Since the place the firmware is stored is actually flashed to the first partition of the SD card (sort of like a BIOS), you will not need to run this on every device. Once you load a new version of software or firmware onto an SD card, any device you plug that card into will be running that version.


C# .Net

Configuration Manager in Visual Studio 2010 Express

When building new projects under VS C# 2010 Express, I have found that the Configuration Manager menu item is missing. In order to access additional features within, that allow me to build against 32 Bit libraries, this menu item is required.

From the Build menu, you will see that the Configuration Manager menu item is missing at the bottom of the list

It appears that Visual Studio Express has the Configuration Manager menu item hidden. It is fairly simple to make if visible.

  1. Selete Tools | Options in order to bring up the Options dialog.
  2. Ensure that the Show all Settings checkbox in the bottom left corner is checked.
  3. Select the Projects and Solutions page and set the check box for Show Advanced build configurations.
  4. Select the Ok button to close the window. You should be prompted that the project needs to be closed and then reopened for the changes to appear.
  5. Once you reopen the project, you should now see the Configuration Manager option on the toolbar.







C# .Net

How to Elegantly Add Row Numbering for DataGridView Tables

There are a few ways to go about adding row numbering for your DataGridView’s, but you have to ensure you have added the code in, where ever you are adding a new row. If your inserting a row, then you have to go back and update all your numbering. With the option shown here, you need not worry about updating any row numbers when working with the DataGridView.


Once you add the event for the ‘RowPostPaint’, the code (function header outlined in red) just needs to be updated to reference the routine (function header outlined in green). I keep the numbering routine in its own block of code so that is can be reused by other DataGridView tables on the same form.

private void dgv_CompanySites_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
bg_DGV_RowPostPaint(sender, e);

private void bg_DGV_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
     var bgDGV = sender as DataGridView;
    var bgRowIdx = (e.RowIndex + 1).ToString();

    var centerFormat = new StringFormat()
        // right alignment might actually make more sense for numbers
        Alignment = StringAlignment.Center,
        LineAlignment = StringAlignment.Center

    var headerBounds = new Rectangle(e.RowBounds.Left, e.RowBounds.Top, bgDGV.RowHeadersWidth, e.RowBounds.Height);
    e.Graphics.DrawString(bgRowIdx, this.Font, SystemBrushes.ControlText, headerBounds, centerFormat);

When you load your DataGridView, the RowPostPaint event will be raised to perform row level painting, after all cell painting has occurred. This renders your row numbering nicely, and you do not have to add any additional code for numbering when adding data rows.

The following example shows the numbering where the numbers are low in range:


As your numbering gets higher up in range, the spacing remains nicely proportioned: