Migrating Magic Unicorns

This past weekend I had the opportunity to present at the Orlando Code Camp. This was a great event and I was happy to be amongst the community once again. I presented my Entity Framework: Code First and Magic Unicorns talk. I gave this talk a month ago at the South Florida Code Camp. That session didn’t turn out as well as I wanted. I originally had some rage comics and that didn’t go over so well. Most didn’t even know what a rage comic was. I also had a few demo failures that I wanted to squash. And of course the introduction of Code First Migrations made some of my content obsolete.

So I reworked the presentation from scratch. I threw out the rage comics and added a Migrations section. I also moved much of my code from the demos into the slide deck. This helped me focus the talk on the feature which I was speaking about. I added a simple console app demo that showed a database creation and simple data retrieval. I kept another demo which showed a more complex mapping scenario complete with multiple kinds of relationship mappings.

During the presentation I went off script in one of the demos tried to show the default configuration in Entity Framework. I showed how I didn’t have to explicitly set a connection string for EF to work because EF would automatically connect to SQL Server Express. My misunderstanding was that Entity Framework would recreate the connection string in app.config. But the app.config is created by the Nuget package and not Entity Framework. So I deleted the app.config and ran the app. The app threw an error, duh. Demo failures seem to be the norm with me. I wrapped up my point and moved on. Like I said, demo failures are normal for me. Now, if I had only uninstalled the Entity Framework Nuget package and then installed it again everything would have worked just fine.

Other than the demo failures I had a blast giving this presentation. Entity Framework has come such a long way since the Alpha days when I first used it. I’m more than happy to talk about the awesomeness that it’s become. Thank you Orlando for allowing me to speak and we’ll see you next year.

Download the demos from my presentation.

Fixing Sound Issues With VirtualBox and Thinkpad T520

image

While putting the Windows 8 Consumer Preview through the ringer, I encountered an issue with VirtualBox running on my Lenovo Thinkpad T520.  I was playing an episode of This American Life, the one about the Apple factory workers, when I started up the Windows 8 VM. The audio stopped.. It wasn’t just the This American Life player, it was all audio on the host system. When I shut down the VM the host audio came back to life.

image

My initial solution was to change the VM audio controller to SoundBlaster 16. The other two options, Intel HD Audio and ICH AC97, did not fix the host audio problem. Another restart of the VM and I was back in Ira Glass bliss.

As it turns out it just wasn’t a problem with the Windows 8 beta but a VirtualBox issue. My other VMs, Windows Server 8 and Windows Server 2008, had the same host audio issue. So I started to look into this further. Switching the audio controller to SoundBlaster 16 did correct the host audio issue but didn’t solve the VM audio problem. The Windows 8 VM still didn’t play any sounds.

I found a few posts online that pointed to installing the Realtek drivers for the ICH AC97 audio controller on the Windows 8 VM but the drivers refused to install and it brought the host audio problem back.

I decided to start from the beginning. I checked the host (Windows 7) audio drivers and they were dating back to December 2010. After a quick driver search on the Lenovo site, I found an Conexant 20672 SmartAudio HD drivers that were updated in November 2011. After a quick download, install and reboot  I changed my Windows 8 VM audio controller back to Intel HD Audio and started the VM up. Lo and behold everything was working, both the host and the VM audio.

So the moral of the story is keep your drivers updated kids. It’s not worth the head-to-desk moments later.

Quick and Dirty Data Dictionary

image

Recently, I’ve been working on databases that I’ve never touched before. Of course, when dealing with a “new to you” database there some are challenges. What’s the schema of the database? What’s the “cleanliness” of the data? Is there any useful metadata? When I look at a database for the first time I want to see an entity relationship diagram. It’s a rarity that a well maintained ERD separated into appropriate subject areas is available. Sad but true, I know. The next thing that I need to see is the data dictionary. The data dictionary contains information about the tables, columns, keys and other objects in the database. In other words, it’s darn useful. There are some tools that do a really great job of this such as Redgate’s SQL Doc or Pragmatic Works’ BI Documenter. But I wasn’t in the position to pony up the cash. So what’s a programmer to do? Write his own tool of course.

I had a few criteria in creating this tool:

  1. It had to output a Word doc.
  2. It had to show partition information as well as table/column/key information.
  3. It had to be done quickly. Like in a couple of hours.

I decided that my old friend, Reporting Services, would be perfect for this job. I’ve had some experience using the DMVs so writing these queries wasn’t so tough. Here’s the query that I use to retrieve all of the tables, columns and metadata information in a database.

SELECT
     DB_NAME() AS [DB NAME]
    ,SysTbls.name AS [Table Name]
    ,SysSch.name AS [Schema Name]
    ,tblexp.ExtPropValue AS [Table Extended Property]
    ,SysCols.name AS [Column Name]
    ,ExtProp.value AS [Extended Property]
    ,SysTyp.name AS [Data Type]
    ,CASE WHEN SysTyp.name IN('nvarchar','nchar')
               THEN (SysCols.max_length / 2)
          WHEN SysTyp.name IN('char', 'varchar')
               THEN SysCols.max_length
          ELSE NULL
          END AS 'Length of Column'
    ,CASE WHEN SysCols.is_nullable = 0
               THEN 'No'
          WHEN SysCols.is_nullable = 1
               THEN 'Yes'
          ELSE NULL
          END AS 'Column is Nullable'
    ,CASE WHEN SysTyp.name IN ('numeric', 'decimal')
               THEN SysCols.precision
          ELSE NULL
          END AS 'Precision'
    ,CASE WHEN SysTyp.name IN ('numeric', 'decimal')
               THEN SysCols.scale
          ELSE NULL
          END AS 'Scale'
    ,SysObj.create_date AS [Table Create Date]
    ,SysObj.modify_date AS [Table Modify Date]
FROM      sys.tables AS SysTbls WITH (NOLOCK)
LEFT JOIN sys.columns AS SysCols  WITH (NOLOCK)
         ON SysTbls.[object_id] = SysCols.[object_id]
LEFT JOIN sys.extended_properties AS ExtProp WITH (NOLOCK)
         ON ExtProp.major_id = SysCols.[object_id]
         AND ExtProp.minor_id = SysCols.column_id
         AND class = 1 --Object or column
LEFT JOIN sys.objects as SysObj WITH (NOLOCK)
         ON SysTbls.[object_id] = SysObj.[object_id]
LEFT JOIN sys.types AS SysTyp WITH (NOLOCK)
         ON SysCols.user_type_id = SysTyp.user_type_id
LEFT JOIN sys.schemas SysSch WITH (NOLOCK)
         ON SysTbls.schema_id = SysSch.schema_id
LEFT JOIN (
    SELECT
         SysTbls.object_id
        ,SysTbls.name AS [TableName]
        ,ExtProp.value AS [ExtPropValue]
    FROM      sys.tables AS SysTbls  WITH (NOLOCK)
    LEFT JOIN sys.extended_properties AS ExtProp WITH (NOLOCK)
             ON ExtProp.major_id = SysTbls.[object_id]
    LEFT JOIN sys.objects as SysObj WITH (NOLOCK)
             ON SysTbls.[object_id] = SysObj.[object_id]
    WHERE class = 1 --Object or column
          and minor_id = 0
      AND SysTbls.name IS NOT NULL
      )
        tblexp  ON SysTbls.object_id = tblexp.object_id

Then, I cracked open Reporting Services and  threw together some sub-reports for the indexes, foreign keys and the partitions. I didn’t spend much time on the look of the report. I just needed it legible.

When I finished,  I thought that there may be others that may benefit from this report. I couldn’t be the only one that needed a quick data dictionary. So, I put the source on BitBucket for others to use. To download the report go to the SQL Server Data Dictionary project on BitBucket. Then hover over the “get source” menu on the top right and select “zip”. This will start the download of the most current version of the Reporting Services project.

image

You’ve unzipped the project open the DB Schema Report.sln file. Once Visual Studio opens double-click on the DBServer.rds data source.

image

Fill in the connection information to the server. Include the server name, database name, user id and password (if necessary).

image

Then open the DB Schema.rdl file and run it. The report will read the database schema and load the report. Feel free to leave any comments or better yet check-in an update or two! Enjoy.

On letting go and being let go

As I continue though my journey through my career I have experienced many things. I’ve created software that is used by thousands of people. I’ve architected databases that store information for a three billion dollar supply chain. I’ve lead a multi-million dollar project to successful implementation. I’ve created many, many project plans, some with thousands of tasks. I’ve had to hire people and fire people. I’ve had to mediate discussions between conflicting co-workers. I’ve had to tell others that their work wasn’t satisfactory. I’ve created web sites, windows applications, windows services, web services, reports and interactive spreadsheets. I’ve worked into the early morning hours countless times. I’ve celebrated when a large software deployments succeed and shook my head when a minor release fails. I’ve taught colleagues both technical and business information. I’ve had to make tough technical and business decisions and a bunch of compromises along the way. I’ve seen and done so much over my career but the one thing I never experienced was being let go…until now.

For the almost twelve years I’ve worked for a company that manages the supply chain for a global restaurant chain. I was hired as a developer in early 2000 and promoted Senior Developer three years later. In 2007 I was promoted to Manager, Application Architecture and took charge of most of the company’s development projects and systems that were developed in-house. During this time I transformed myself from a developer to a leader. I wound up leading the project that rewrote the entire supply chain software that ran the three billion dollar supply chain. On September 24, I was notified that my services were no longer required and that my last day will be on October 31st.

This was not a surprise to me. In fact, I saw this coming at the beginning of the year. The lack projects being thrown my way. The lack of communication from upper leadership. There just didn’t seem to be enough for me to do. The silence was deafening. I decided early this summer that I would seek alternative employment but I wanted to finish out the fiscal year out first. This time was difficult emotionally for me. I had sold out to the organization for so long I was no longer Richie Rump I was Richie Rump-Manager, Application Architecture. I had to separate my identity from my role in the company. That was hard because I didn’t realize that my identity had changed. I was questioning everything; who I am, what I’ve done and what I wanted to do. Luckily, this time didn’t last long but it did serve as a gut check and a checkpoint.

I don’t see my departure as a pure negative event. The company and I were moving in separate directions. The company was getting leaner and I was looking for the next challenge and not finding it there. I don’t hold any ill will towards the company, quite the opposite, I wish them all the best. I will miss many, many people there many whom I worked with for over a decade. I’m honestly looking forward to tackling the next opportunity and moving forward.

IT Camp 2011 – An Introduction to Project Management

This past weekend I had the pleasure to speak at the first South Florida IT Camp. It was a great event and I had a blast presenting on Project Management. I t was my first professional talk. The premise of the session was to introduce the concepts of the traditional project management methodology and to share some if my successes and failures in leading projects. To create my presentation I used Prezi.com. Using Prezi you can create very cool zooming and camera panning effects in your presentation. I recommend you checking it out. As for my presentation it can be found here: An Introduction to Project Management.

ITCamp2011-JorrissSpeaking

Photo Credit: @jseoh