Generic properties

As part of a project I am working on, I need to create an appointment calendar with appointments that can be tagged with and one (or more) of four tag groups.  The appointment viewer can then be filtered to see only appointments tagged with selected properties.

The tags are stored in a generic pot with all of the tags, and then are themselves tagged by Type. 
(Can amyone say MetaInformation.  Yeah, there’s an app for that.)  The tags of each type should have their own checkboxlist. The UI looks like this:


There are a number of ways that I could implement the collection that I bind to the listbox, but I am using Telerik controls and they would really like a generic list.  OK, I can handle that, right?  I can make a generic List of the particular POCO, and just pass it through.  But … how do I filter?  In the old days I would write a sproc, but these days, we have LINQ, and this is a job for LINQ to Objects (really the only LINQ that matters …)

protected List<Tag> Clients
        var clients = from x in Tags
                      where x.Type == "Clients"

                      select x;         return clients.ToList();

protected List<Tag> Resources
        var resource = from x in Tags
                    where x.Type == "Resource"

                    select x;
        return resource.ToList();
protected List<Tag> Staff
        var staff = from x in Tags
                      where x.Type == "Staff"
                      select x;
        return staff.ToList();

protected List<Tag> TextTags {
    {         var tag = from x in Tags
                    where x.Type == "Tag"
                    select x;
        return tag.ToList();

Now I can work from the Tags collection in the entity model, and easily get just the values I need.  I can get rid of the magic values with an enumerator, but I thought it was a good use of Linq.

Brew Plan for Cinco party

I posted a pic of the latest delivery by my favorite UPS guy, along with a little beer haiku:

Even on cold days
The ups driver can
Bring warmth to my heart

A few people asked about the brew plan, but it doesn’t fit in Twitter.  I thought I would post it here for fun.

Good Night In Mexico

(From TCJOH, page 179)

7lbs Dark DME

1lb Rice

1lb Light Crystal Malt

¼ lb Barley

1 ¼ oz Spalt

1oz Saaz

1oz Hallertaur

German Lager Yeast



(from BCS, page 151)

7lbs Pale Ale DME

¾ lb Special Roast

½ lb Victory

½ lb Crystal

¼ lb Pale Chocolate

2oz Williamette



Leaden Lager

(Hellbranch Recipe)

7 lbs ultralight DME

3oz saaz

Saflager S-23

Android development … in Windows

So my plan was to start some Android development with Eclipse in Linux, just to sharpen the saw. But you know what?  With all of the improvements in Linux over the last ten years, it still sucks.  If ANYTHING goes wrong, you are screwed.  You have to change some bit flag in some cryptic file that there are four references to in Google, and then restart seventeen times.

Specifically, what I did was install Eclipse in Jaunty Jackalope using Add/Remove.  That was admittedly my mistake – Jaunty doesn’t support 3.4 or 3.5 of Eclipse, which are needed for a quality experience in Android development.  Second mistake – I tried to install Eclipse 3.5 manually over top of 3.2.  HORRIBLE idea.  When I figured out what I had done, it was a mess to fix it.  In short, total time to compile Hello World, 5 hours.

Windows 7 experience: 10 minutes.  We will be talking about Windows.

To get started, you want to install the JavaSDK.

Next you want to install the Android SDK.

Finnally, you want to install Eclipse.

After all of the installations are done, you will want to configure the Android tools for Eclipse.  Part of this is adding the SDK components.  This is all well document, and most importantly, it is hard to screw up.

The only weirdness is the necessity to manually create the package file.  IT’s easy but weird.  From a command prompt, go to the location that you put the Android SDK (Mine is just in the Documents folder) and run this:

android create avd --target 2 --name my_avd

The you just need to create a new Android project in Eclipse.  I’d write about it, but it was so well documented in the Hello World documents.


And there we go.  Got the whole things running, in just about ten minutes.

The actual programming thing, well that’s next.

Sempf's Laws

Sempf's First Law: In any system, no single effect has a single cause.
Sempf's Second Law: All systems can be decomposed into binary decisions.
Sempf's Third Law: Given the correct catalyst, all systems will accelerate descent into entropy.

How you know you were a geek in the eighties

  1. You remember when AD&D went to Second Edition, and were ticked off about it.
  2. You know the Commodore 64 bootup sequence.
  3. Wargames was your favorite movie.
  4. After watching Wargames, you dialed into Delta's system and ordered tickets to Paris.
  5. You subscribed to Dragon Magazine and Boy's Life.
  6. You listened to Dr. Demento.
  7. There are three bins of Space Legos in your basement.
  8. There are CDs in your collection that are twenty years old.
  9. You ran a BBS from your TRS 80.
  10. You remember Donkey Kong's four screens, and know who Jumpman is now.
  11. Johnny Five - scaring the SHIT outta me since 1986.
  12. There is a a Mac Classic in your basement you have been meaning to turn into a Macquarium.
  13. You know at least one method for bypassing physical copy protection on floppy disks.
  14. After the Challanger disaster, you were the one that explained to everyone exactly what happened.
  15. You still have your big fuzzy marching band hat.
  16. You have a working IBM Luggable in the basement.
  17. If you STILL jump after the phones ring because of Lawnmower Man.

Describing one-to-many relationships in M

In M you can describe values and use MGraph to infer a data model.  for instance, I can tell it a little data, like this:

module TheStates
  States  => { "Ohio", "Indiana", "Kentucky" };

… and get back the SQL code for my inferred table:

set xact_abort on;

begin transaction;

set ansi_nulls on;

if not exists 
    select *
    from [sys].[schemas]
    where [name] = N'TheStates'
    execute [sp_executesql] N'create schema [TheStates]';

create table [TheStates].[States]
    [Item] nvarchar(max) not null

insert into [TheStates].[States] ([Item])
    values (N'Ohio'),

commit transaction;

The problem is with a real world model, say a collection of states that represents a route.  if you try to model that with an extent, like this:

module Proto
  Representative =>
    Id => "4";
    Name => "Bill";
    States  => { "Ohio", "Indiana", "Kentucky" };
  } where identity Id;

Well, at least it is a Not Yet Implemented error.

untitled3  4,3-8,22    Error   M3999   Not yet implemented: Initializing a collection with an expression that yields a collection (Microsoft.M.SemanticGraph.FromExpressionSymbol)

Still, without something that straightforward implemented, it is tough to call this a modeling language for data.  Hopefully it is in the works soon.

CodeMash v2.0.1.0. Burndown

Codemash 2010 is in the books, and once again it has proved that sub-1000 attendee regional conferences can provide at least as good – if not a better – experience than the PDCs and the TechEds of the world.  Every single attendee that I spoke with was blown away by the speakers, the open spaces, the staff, the location, the food and everything else.  With the exception of the local area network and AT&Ts poor showing signal-wise, I don’t think I heard a single complaint.

It was the best one yet, and I believe they will outdo themselves next year as well.  It’s a great con, and I think all of the people who put it together: Jim Holmes, Brian H. Prince and Jason Gilmore, along with the speaker board, the vendors and the countless volunteers.  It was a great team effort.

Honestly, I didn’t go to too many sessions this year.  I did manage to go do the Ruby Koans with EdgeCase, and that was eye opening.  Not only did I get started learning a new language, I also learned a fantastic way to teach a new language.  My other precompiler session was with Mary Poppendieck, on the topic of leadership and building sustainable competency in an IT organization.  She knows her stuff, and I think I found the mentor I needed going forward with the Technical Evangelist project at ICC.

Mary Poppendieck at CodeMash

The breakout sessions were not as mind blowing as I thought they would be.  There was a distinct shift in the presenters this year, with many fewer local speakers, and a lot of names I didn’t know, but with impressive titles.  I don’t think any one company had more than one presenter, except EdgeCase, who presented a remarkable SEVEN TIMES through the con.  Those guys are smart, but SEVEN TIMES?  I just don’t know.

Honesty, the quality of breakouts that I went to was about the same.  Rob Gillen had a very well delivered presentation on using Azure for parsing weather data, and that was really eye opening.  Other than that, though, it seemed to be a lot of the same old stuff.  Nothing was bad, mind you, just a little less inspiring than I thought given the 500 presentations that they had to pick from.

<sigh> No matter how I say that it just sounds bad.  I was really happy with the breakouts.  There, I said it.  I just thought there would be more ANAZING stuff.

Anyway, I was really honored to be asked to speak this year.  I did my Economics of Cloud Computing presentation, and it was really well received.  Many people stopped me afterward and mentioned how they liked the information (and then there was Pete Gordon, who told me my math was wrong.)


Anyway, I had the classic stupid technical problem at the beginning, but a reboot fixed it, and everyone waited patiently.  I could have used the time though – I had to rush through the cloud breakdown a little.  It was a bummer.  Oh:

Here is the link to the Economics of Cloud Computing Presentation.

Here is the link to the orginal Economics of Cloud Computing paper.

Here is my new page.  Go rate me – since I am not sure if evals were actually taken.

There is a lot to be said about holding a developer conference at the largest indoor waterpark in the country, too.  Aside from that there was a game room set up by Jeff Blankenburg, KidsMash, and this huge ball cannon tree root air swoosh thingie:

2010-01-13 19.15.03

A good time was had by all.

econofcloud.pptx (7.08 mb)

Christmas came (a day) early.

Went and got the mail and I was SO VERY happy to see my new picks from LockNewbie.  I got a short hook and a bogata to go with my long feeler, and replaced my existing short hook and half diamond  in my carry set.  I am still going to keep my set of bogata from Rai, because how could I not??


This should about do it for me, on a day to day carry-and-practice set.  I can get into a Master 140 in about 20 seconds using the long feeler and my custom tensioner.  Rai’s bogatas will get me into a lock with no security pins in under ten seconds usually. 

The bogata/short hook combo seems to be a great combination for spool and mushroom pins.  They have the same feel, so I can start with the handled bogata to get a false set, and then move to the VERY delicate short hook to pop the lock.

I got Gabrielle a bogata and a ball feeler too – it should work well with her picking style.  And they are RED.  All in all, very happy.

Get started modeling in ‘M’

Well, if you went to PDC and did the thing I always do, which is go to every talk that lists Don Box as a speaker, then you probably heard about SQ!L Modeling.  I don’t care about the SQL part – SQL is a database as far as I am concerned – it is an implementation detail.  As a software architect, though, I am very interested in Modeling.

So I get the bits and install them.  Great.  I have Quadrant as a Start Menu item, but Quadrant is Access.  Not interested (for this anyway).  I want to tell Visual Studio how I need my software built.  I need M.

The New Project Dialog has a Oslo Library that might be interesting.  I thought they had nixed Oslo though?  What’s up with that?  Anyway, the description says “A project for creating Oslo Flavored CSharp Library” whatever that means.  I just want to design software, people.  I don’t make ice cream.


I’ll go ahead and model SHARP, my event system, because I know that system well and have been modeling it for years.  To start, I name the Oslo Library SharpLibrary.  The resultant code is unusual, but it is a new language after all.

module SharpLibrary
    type Model
        Id : Integer32 => AutoNumber();
        Field : Integer32;
    Modelsamples : {Model*} where identity Id;

Don’t let the ‘module’ statement fool you – this isn’t a RAD application development language that will remain nameless.  M is a language that will model your middle tier.  Let’s model.  The goal is to build the simple SHARP model, which I used in VB for Dummies and the C# All In One.


I will start with the Conference entity, because it is sorta the middle of the system.  ID is as the example, but I want to add a Title and Description.  First thing is that M needs intellisense.  What’s a string again? String?  Varchar?  Oh, no of course it is Text.  Of course.

More later!

Using the Entity Framework POCO Adapter

Not all of us get to use EF 4.0 like the cool kids.  Sometimes, you are on a project with a state government – for example – who won’t use a Microsoft product before its first service pack, much less Beta 2.  You are stuck with a product that everyone including Microsoft has agreed is a substandard effort – EF 3.5.

One of the big complaints about EF 3.5 is that the domain mode it provides is persistence aware.  This means that rather than just asking the framework for a class, say People, and getting a Person object back, you get a framework object with a bunch of extra database code in it that breaks the tenants of encapsulation.  At first blush, this seems like something that only people at MIT care about, but the fact is that when you change something about your database, you have to change all of these objects, which is a bad thing.

Anyway. I was tasked with finding a data layer technology for this big project.  I looked at NHibernate, and SubSonic, and a few others.  I looked at code generators like LLBLGen.  I ended up with EF 3.5 because I know I am going to want to go to EF 4 and there will be less recoding if I start with EF 3.5.  That’s basically it.

I still need persistence ignorant objects, though.  Enter the POCO Adapter.  This project is on, and it written by people knowledgeable about how EF works.  It has a code generator that takes the EDMS file and generates Plain Old CLR Classes, and a customizable transport  layer.  Looks like it will work.

Getting the POCO Adapter and getting started

The EF POCP Adapter is available from   It comes in both C# and VB, and has sample code and texts using Northwind.  The code generator compiles into a console application, and the adapter itself is just a strongly typed class file.

I started things out by generating an EDMX of SHARP, my sample conference management system.


Then I compiled the EFPocoAdapter project and was rolling.

Generating the domain model

I started by running the commandline utility on my EDMX file for SHARP.

EFPocoClassGen /inedmx:"C:\Users\Bill\Documents\Visual Studio 2008\Projects\SharpEdm\SharpEdm\SHARP
.edmx"  /outputfile:c:\sharp.cs

I added the resultant sharp.cs file to my project, referenced the EFPocoAdapter project in the solution,. and set up a project reference to clear up references to EFPopoAdapter and EFPopoAdapter.Classes.  Wow, it really does take a loong time for that dialog to come up.  Anyway, then I compiled.

Ran into a weird naming problem.  All of the generic PocoAdapterBase instances referenced the ConferenceDbModel, which is the namespace for the EDMX classes, and not SharpEdm, which was the actual class.  After discovering this, I discovered for the 10,000th time that it is a good idea to read the documentation first.  Doing that, I learned that there are some options I really should set.

  • /ref sets the compiled DLL that has the classes that I want to map to.  All I did was compile the EDMX file and use that DLL.
  • /map helped with my naming issue.

So the final command looked like this:

/inedmx:"C:\Users\Bill\Documents\Visual Studio 2008\Projects\SharpEdm\SharpEdm\SHARP.edmx" 
  /ref:"C:\Users\Bill\Documents\Visual Studio 2008\Projects\SharpEdm\SharpEdm\bin\Debug\SharpEdm.dll"

The tools it left me are pretty straightforward.  here is a look at them:


In the next post I’ll take a look at using them in this context.

Bill Sempf

Husband. Father. Pentester. Secure software composer. Brewer. Lockpicker. Ninja. Insurrectionist. Lumberjack. All words that have been used to describe me recently. I help people write more secure software.



profile for Bill Sempf on Stack Exchange, a network of free, community-driven Q&A sites