Wednesday, February 23, 2011

VB.NET -- Checkerboard in PictureBox

    Private Sub CheckerBoard()
 
        Dim rect As New Rectangle
 
        ' create a Graphics object to draw into it
        Dim pbox As Graphics = PictureBox1.CreateGraphics
        mSquWidth = PictureBox1.Width / CDbl(mCols)
        mSquHeight = PictureBox1.Height / CDbl(mRows)
        rect.Width = mSquWidth
        rect.Height = mSquHeight
 
        Dim r, c
        For r = 0 To mRows - 1
            For c = 0 To mCols - 1
                If ((r + c) Mod 2) = 0 Then
                    ' create a Graphics object to draw into it
                    pbox.FillRectangle(Brushes.Azure, rect)
                    pbox.DrawRectangle(Pens.Pink, rect)
                Else
                    pbox.FillRectangle(Brushes.BlueViolet, rect)
                    pbox.DrawRectangle(Pens.Red, rect)
                End If
                rect.X = c * mSquWidth
                rect.Y = r * mSquHeight
                ' create a Graphics object to draw into it
                pbox.FillRectangle(Brushes.BlueViolet, rect)
                pbox.DrawRectangle(Pens.Red, rect)
            Next
        Next
 
    End Sub
 

Tuesday, February 22, 2011

All She Wrote

Maybe I'll get a little time to review the books I've been reading lately.
  • The Edge of Physics by Anil Ananthaswamy
  • Self Comes to Mind by Antonio Damasio
  • A Walk in the Woods by Bill Bryson
  • Switch by Dan Health
  • Getting Organized in the Google Era by Douglas Merrill, James Martin
  • Spark by John J. Ratey
  • Matterhorn by Karl Marlantes
  • 101 Theory Drive by Terry McDermott
  • Sleight of Mind by Stephen L. Macknik, Susan Martinez

Real Estate and Financials

Interesting, stocks making new highs are REIT, Insurance Companies and other financials including RE, CBL, AIZ, MAC and UDR.  Insurance companies have to invest their reserves somewhere safe.

Something Old, Something New

The chunky 4GL math library creates console applications with very little GUI grace. The solution to the quagmire came in the form of .NET wrapper around the console application. All the niceties of a modern GUI with the number crunching under the hood.

Being that the 4GL is strictly single threaded, a few tricks were needed in order to accommodate the inter process communication. Since the wrapper had no way to directly initial a dialog, the 4GL had to instigate the handshake.

Initially I established a channel using a network socket, low level stuff.  I found it more responsive and robust to cheat a little.  I set off a system file watcher thread from the .NET wrapper and created event handlers for the various types of files it discovered.

Phil Windley

Phil Windley does a great service in promoting technology and ideas via the IT Conversations web site. Find out more about him:

Phil Windley
IT Conversations

Go!

IT Conversations had guest Rob Pike describe the reasoning behind the Go programming language.

audio clip

Monday, February 21, 2011

Umbraco or Bust

When Install the Umbraco CMS via WebMatrix I had to change my security setting to "SQL Server and Windows Authentication mode".