Riddle me this, batman.

sql,

Why do database designers deliberately create one-to-one relationships?

e.g. You can have a table with 50 columns, or you can have two tables with a one to one relationship, having 25 columns in one and 25 columns in the next (the foreign key acting as a primary key). Maybe the first column is called "Contact_Details" and the next table "Contact_Details_Extended"

What's the big advantage? Something tells me Frans Bouma might have an opinion on this. Anyone? Bueller? Bueller?

Any ideas? Leave a comment, or mail me.

 

Stupid Code To The Rescue!

A big dose of .NetFrustration this morning.

When you upgrade an assembly from version 1.0 to version 1.1 you are likely to get a lot of squiggley blue lines and warnings such as:

OR:

OR worse yet:

Google turned up blank, MSDN turned up blank, but I finally got rid of the warnings, by writing stupid code.

(Read on for some dodgy solutions and some stern lectures. :+))

For example:

Rather than:

I would write:

And voila! it works just fine.

The next failed piece of upgraded code was this

In this case you need to add two more parameters, an 'XMLResolver' and an 'evidence' param. This worked:

Evil Moral of the story is:

If a parameter is required, but you don't know why, just set it to 'nothing.'

That's not the sort of lesson I'd like to teach people. But it's what Microsoft taught me today.

Third situation was a bit trickier and called for an even nastier hack.

This worked in version 1.0, but threw a warning in 1.1:

The warning was a familiar one:

My first thought was: 'add a new parameter, value of nothing'. But this failed because the compiler couldn't resolve which overloaded interface I was after. The result of such an approach was:

i.e., 'Sure you want nothing -- but what type of nothing??' Fair cop, so I tried this instead:

Now there were no warnings and it did compile. But did it work? Who cares? Because right then i thought of a cleverer and nastier solution, that would be bound to confuse other developers. Naturally, I gravitated toward it immediately:

I didn't test that it worked, because 'hey, it should, right?'

At that moment, another, nastier solution occurred to me. I call this one: "What type of 'nothing'? **This** type of nothing!"

No time to test it, but the compiler doesn't freak, so my money says she works.

And now I can get on with writing other, better, faster bugs.

As an old friend said to me just yesterday: "One man's bug is another man's paycheck."

 

How to match a string value to its equivalent Enum value.

Updated! How to retrieve an Enum member given its name

To retrieve an Enum member given its name, use the Parse method of the Enum class, and cast the result to your Enum type:


MyEnumVal = CType(System.Enum.Parse(GetType(MyEnum), "gamma"), MyEnum)
Debug.WriteLine(MyEnumVal.ToString()) ' The output is "gamma"

Previous code:

To retrieve an Enum member given its name, use the ConvertFrom() method of the TypeConverter class and cast the result to your Enum type:

MyEnumVal = CType(TypeDescriptor.GetConverter(MyEnumVal).ConvertFrom("gamma"), MyEnum)
Debug.WriteLine(MyEnumVal.ToString()) ' The output is "gamma"

 

the unbearable lightness of being Delpino

A little bit of philosophy from Brisbane band Delpino.

(end of comment)

(nothing to see here)

 

Things I miss about London

  • leaves falling from trees
  • big coats and bitter cold
  • europe on your doorstep
  • crooked narrow streets
  • depressed shop assistants
  • people like roger, dinesh, anthony wong, liffey and scott
  • a swift-half after work that accidentally runs into the closing-time bell
  • belgian beer, belgian chocolate
  • italy just a stone's throw away
  • every alley wafts of piss
  • the tube. i even miss the frigging tube.

end of comment

(nothing to see here)

 

AspCompat='True'

Just a reminder. If you're writing an ASP.net page that invokes a RCW (runtime callable wrapper) to a COM component... you may need to include the attribute 'ASPCompat=True' in your page directive.

In particular, if you have this situation:

then it may be because ASP uses a STA (single-threaded-apartment) threading model, which the COM component may rely upon when returning calls.

The way to get the component to behave in ASP.net is to include that attribute, 'ASPCompat=True' in the calling page's page directive.

You already knew that right?

Well, should you accidentally forget... the chances of working it out on your own are very slim indeed, even with Google's help.

(end of comment)

nothing to see here... just move along

 

Royo on TV?

is it just me, or does Roy Oshergrove look like that guy off "Alias" whom Jennifer Garner is secretly in love with?

the guy off alias roy oshergrove

Come to think of it, there's someone else they *both* look like...

the guy off alias roy oshergrove royo?

(It's traditional to now say something like 'oh thats roy on the right, by the way.' But you know by now that I never indulge in such cliched humour. [100% sarcasm])

(end of comment)

nothing to see hear... comment if you want...
 

Double-posting comments: blame the software!

blog,

Everyone double-posts a comment at times. I've done it. You've done it.

When you accidentally post a comment twice, you feel like an idiot.

You curse yourself. You belt your head against the monitor, you bite your tongue and you jab needles into your eyes.

But is it really your own fault? The software could handle for it. But it doesn't. Blame the software. The major commenting engines *should* handle for it. It's an easy feature to include. But they're so damn rich, fat, lazy and yes, butt-ugly, that they left it out on purpose just to make you feel like a newbie idiot once in a while.

So send a letter to the authors of mt, .text, radio... and send it twice. they'll get the message.

 

A few changes on the way

After getting some excellent reader feedback, I'm going to make it browsers to secretGeek (as opposed to RSS subscribers) to find material quicker -- and to know at a glance whether they're clicking on something Funny or Serious, Very-Technical or Non-Technical.

One idea is that I can use the 'name' attribute of the anchor tag to help with this, along with little warning buttons, such as: [100% Sarcasm] or [all geeky] or [not serious]

Anyway -- nothing will change quickly. That's how we are around this place. We sit back on our rockin chairs and just taaaake our time....

Oh yes... other feedback said that I should avoid linking to a separate page if I've already said everything I'm going to say. Hmmm, I'll fix that too.