Going Stimulant Free

For whatever reason I have suddenly decided to go caffeine free (or at least be less caffeinated than I have been).

Monday was the last time I had a caffeinated beverage and Tuesday I just switched on the “no caffeine” mode. I don’t feel the need to try to ween myself from it so I’m quitting, cold turkey. And that’s not to say “I can quit anytime I want to” and walk around like I’m some kind of big shot. I just don’t want to have any more.

I rarely sleep through the night or dream deeply anymore. Attributable to caffeine? Maybe. We’ll see how it goes in a few weeks. I really just want to get a good night’s sleep.

My Name is Jorge…

“… and today is my birfday! My name is Jorge and I am your friend!”

So sings my son’s stuffed giraffe toy when we get greet him every morning or put him to bed in the evenings.

Today IS my birf- *ahem* birTHday. What’s more odd to me is not that I’ve lived for more than a third of a century, but that I’ve now lived more than half of my life in one place. Not one address or even one town – one geographical region.

The first half of my life I was a DoD dependent – an Air Force Brat. Half of THOSE years were spent at Seymour Johnson AFB in Goldsboro, NC. If I’m correct, the sequence of locations was: Goldsboro, NC (2 years), Clark AFB, Philippines (4 years), Goldsboro, NC (8 years), Misawa AFB, Japan (2 years), and Goldsboro, NC (2 years) all prior to coming to the St. Louis area in the summer of 1994.

18 years is a long time to stay in one place. I can’t say I remember much what the place looked like back then – you don’t make a habit of memorizing your commute when you’ve got more than 4,000 round-trips under your belt; it’s all the same 60mph blur.

When the next presidential term is done, I’ll be nearly “over-the-hill”… I hope that’s only a third of my lifetime. I don’t want to be part of the statistical average. I want to go out in my 100s. Maybe I’ll get there.

Please don’t throw me a black balloon party. That would seriously blow the giant llama.

WebResource.axd Interferes with Cascading Style Sheets

I encountered a new and frustrating situation within ASP.Net the other day. I was adding AJAX Control Toolkit v3.5 to an ancient intranet portal site and noticed, by way of Internet Explorer, that some style overrides were not being applied. It took a minute to trace the problem and the cause was interesting and annoying.

After adding a TabContainer and ToolkitScriptManager to the page, I noticed aelement for the embedded stylesheet resource of the ACT. So what should have been the final word on the page regarding styles from sheets added earlier were overridden by a last ditch addition in the form of an embedded resource via WebResource.axd.

Necessity being the ugly mother of invention that it is, I needed this situation rectified. The solution was to iterate through the controls in theelement and reorder them so the site stylesheets were last in the control collection.

This gave the site sheets the priority they should have had. I did try using “!important”, but it did not work, possibly because I didn’t use as fully qualified a name as was specified in the embedded resource. And, retrospectively observing, having to use !important to get the style to stick means using !important again and again later.

Convert.ToInt32 vs CInt

This is a search subject I’ve done quite a few times in the past and never really found a good answer. I’ve found results either asking the same question and debate/bicker threads about the obsolete-ness of CInt, but none that describe the difference between the two. Plenty of “if you try to convert X using Y, Z will happen if you don’t W X first” that don’t give an explanation.

A recent epiphany finally lifted the veil on the question’s answer: Convert.ToInt32 (and the rest of the .ToX methods in the Convert class) is a method – CInt (and its relatives) are type-casting directives (similar to the C# syntax (int)x; or (string)y;).

The prime difference is the Convert class’ .ToX methods perform additional logic (as methods are wont to do) before employing a type-casting directive and returning the result. Disassembling Convert.ToByte in the .NET Framework library “mscorlib.dll” with Red Gate .NET Reflector supplies the evidence:

Public Shared Function ToByte(ByVal value As Integer) As Byte

  If ((value < 0) OrElse (value > &HFF)) Then
    Throw New OverflowException(Environment.GetResourceString("Overflow_Byte"))
  End If

  Return CByte(value)

End Function

This is the VB.NET representation of mscorlib’s IL for the method; if you disassemble this method into C#, the last line of the method reads: (byte)value;

The Convert class’ conversion methods employ a type-casting mechanism as they return their result. They also throw exceptions when the conversion could presumably be invalid. The difference here is that if you use direct type-casting (CInt, etc.) you may or may not get an exception when an employing them on an invalid argument.

I say “may or may not”, because the default setting for throwing Overflow/Underflow exceptions is different for VB.NET projects versus C# projects. In VB.NET libraries the default is to throw an exception when an overflow would occur and C# libraries default to the converse – in C# if you try to cast the integer value “10000” to a byte the result will be 0 and code execution will continue.

The following truth counters the argument/rumor that “VB.NET’s CInt and its siblings are obsolete”: CInt is shorthand for “CType(, Integer)”. CType is a necessary core construct of VB.NET and without it there would be no type-casting to be had for value types (DirectCast has a different intent so using it to cast value-types should be considered an abomination). There is no reason to believe the VB.NET language group would remove the shorthand because it is a carry-over from VB6 or outmoded or whatever other argument that might be made.

Why write “CType(someVariable, Integer)” when you can write “CInt(someVariable)” and save 10 keystrokes (35%). What a deal!.

I’m Still Impatient

I still have a “microwave mentality” regarding growing a blog audience. I still expect one to appear overnight. Perhaps I over estimate friends’ interests in what I have to say. Facebook and Twitter seem to hide a few interested individuals, but I think I have more acquaintances that full on friends; people I know from that one time way back when. Hell, I’ve even become one myself – I hardly talk to my best friend anymore.

I think my desire for people to have an interest in what I have to say is still a part of my life I’ve been trying to leave behind: the part where I become rich and famous in a world where a man, on average, has only 70 years and the really lucky ones have 115. Contemplating that I’ve already expended half my lifespan is sobering. Having children of my own only reinforces the sobering truth that I am not going to live forever.

I “recently” played Neverwinter Nights 2 and a line from an early NPC has stuck with me: “Oh, I’m sure there’s a hundred Cormicks in a city like Neverwinter…” Meaning: Cormick (another NPC) is not unique in the world. Whenever I think I’m the first to have a brilliant idea I remember this line.

However, there is a second part to this line in the story: “… but for this town, he was as big as folks get.” I’d forgotten that part. Just because you’re not the first to ever have an idea doesn’t mean you can’t do it better than the other 99 out there.

Oh look! I’m caught up on retroposting again. Next update should be Friday. Here’s to fame and fortune!

Less Worry

I was thinking the other day about how much I worry about protecting my personal information (Social Security number and such) and how many times I’ve perhaps been a Paranoid Parrot.

For example, in the past I would have turned off location services in things like Google Maps or iPhone photo tagging thinking: “What if the government is tracking me?” or “What if my phone gets lost? Someone’ll find out where I live!” I even used to leave most of the contact information blank in my phone contacts.

I worry about little. Why worry? What good will come of it? You’re only making a hard time for yourself. I am reminded of Jesus’ teaching to His disciples in Luke Chapter 12 – He was speaking in the folly of worry and storing up things for yourself in this world (specifically verse 25): “Who of you by worrying can add a single hour to his life?”

Do not worry so much about the future that you become a Paranoid Parrot and do not enjoy the good things life has to offer. Do not dwell on material things, but enjoy your time with others. The relationships you establish here are worth far more than gold in Heaven.

Idle Words

I was considering the other day the large quantity of simply ridiculous things that come out of my mouth. I wisecrack too often – the kinds of things that, in retrospect, make you think “Man… I really sounded/acted like a fool” and “I wish I’d kept my stupid cake-hole shut”.

From an indeterminate point in the recent past through to the future I’m going to try to do more thinking before I open my mouth and say another foolish thing.

Since this is, again, another retropost I can say I’m doing better at not filling the air with foolish things.

I was reminded of a verse from the Bible regarding such things: ~”Matthew 12:36 – But I say unto you, That every idle word that men shall speak, they shall give account thereof in the day of judgment.” The context regards speaking wicked things, though if taken as a simple rule, we would be better off to keep control of our tongues and not speak without forethought.

Better to remain silent and be thought a fool, than to speak and remove all doubt.