Silverlight Tip – How to make bold text in a textblock from the CodeBehind

The Problem: You need to conditionally bold text in a text block, but you cannot find any way of doing so

The Cause: For inexplicable reasons, Microsoft chose not to include a FontWeight.Bold in their xaml specification

The Solution: Microsoft did include a FontWeights (note the S) class  To bold text in the codebehind, all you have to do is write this

tbbDownloader.FontWeight = FontWeights.Bold;

And presto!  Bold Text.

Popularity: 1% [?]

How to fix a missing reference to mscorlib in Visual Studio 2010

Runtime compiling is greatI was trying to update my main app code to utilize the .Net Framework 4.0 and this happened:

The Problem: I could find no obvious way to update the mscorlib reference in my solution, so I decide to simply delete it and add it again, and hope that it magically updates to the most recent version.  This is actually what usually happens with Visual Studio.  However, I delete the mscorlib reference, and I am unable to add it back again, I get the error message telling me that mscorlib is already included in the project.

The Cause: This is a known problem in Visual Studio.

The Solution: I just went into my project (.csproj) file and added the following line

<Reference Include=”mscorlib” />

And that fixed it.  I still have no idea how to make it use the most recent .Net Framework though.

Creative Commons License photo credit: dasapfe

Popularity: 1% [?]

An odd thing I noticed after years and years of coding

365.8 (Distracted by Penmanship) Growing up all of my teachers told me that my handwriting was horrible and needed improvement.  I took two years of Russian in college and somehow learning Cyrillic made my handwriting even worse.  My first few jobs after college had varying degrees of handwriting needed, but over time, and especially after I moved to development full time, I wrote things out longhand less and less.

As I’ve gotten older I am now writing things out far more than I used to (thank you Pormodoro Technique) I’ve noticed that my printing has markedly improved, while I’ve forgotten how to write cursive, and I can no longer write anything in Cyrillic, though I can still read it to some degree.

Creative Commons License photo credit: kpwerker

Popularity: 1% [?]

A successful round of networking – with presentation lessons learned

Neural Network : basic schemeI just returned from a successful lunch at the Duluth Flash Networking event, sponsored brought to you by Solutions Marketing, and sponsored by Purdue Vision (a graphic design and marketing firm).  I had a good time and learned more about how to market both myself and Stronico.

I’m something of a novice presenter, so I’m sure that this will not be news to many of my readers, but here are the lessons I drew from the four 90 second presentations I made Read the rest of this entry »

Popularity: 1% [?]

CSS trick – how to use two classes on a single DOM object

I have no idea how this trick has eluded me for so long, but it is possible to use two classes on the same DOM object.  For example to combine a class called “TopNav” and a class called “SelectedNav” all you have to do is call them both with code like this

<div id=”HomeNavItem” class=”TopNav SelectedNav”>Home</div>

In other words, you’re just putting them in the same class declaration.  I’ve been doing this for years and I’ve never done that before.

Popularity: 1% [?]

Productivity Tool – a printed call sheet

For unknown reasons I have embraced printed forms this past year.  I started using the Pomodoro Technique  (and their To Do Today sheet) for several months now and recently I came up with a form to keep phone calls on track, and I thought I would share it here.  This will probably make it into the Stronico at some point, but until then, this is what I intend to use.

Download:

Feel free to download and use!

Popularity: 1% [?]

A simple way to create a Microsoft Word document from a template in Asp.net/C#

Will code for food I recently had the need to create a Microsoft Word document from a template. I initially tried using Office Web Components and Interop but all that really wasn’t worth the trouble.  I wound up doing global replacements in the html of html   Here is how I did it:

  1. Open up your template document in word, and put any target areas in special Brackets, the text would read something like “I, [FULLNAME] do hereby affirm that”.  I found that the target area had to be in uppercase, I’m not sure why
  2. Go to “Save As Html, Filtered”, and save it in a writeable directory.
  3. In your C# code, first load the entire document into a string
  4. Convert that string into an instance of StringBuilder
  5. Use the StringBuilder Replace function, it would look something like this –  sb.Replace(“[FULLNAME]“, strFullName);
  6. Create a TextWriter, and write the StringBuilder to it – make sure you’re saving it with a “.doc” extension.
  7. Close the TextWriter

All told, the code looks like this

//Create a new filename
string strFileName = System.Guid.NewGuid().ToString();
string strPathRoot = “d:\\domains\\MyDomain\\Word\\”;
string strPath = strPathRoot + “TemplateHtml.doc”;
string str = System.IO.File.ReadAllText(strPath);
StringBuilder sb = new StringBuilder();
sb.AppendLine(s);
//replace the text
sb.Replace(“[FULLNAME]“, strFullName);
//save it out
TextWriter tw = new StreamWriter(strPathRoot + strFileName + “.doc”);
// write a line of text to the file
tw.WriteLine(sb.ToString());
// close it
tw.Close();
tw.Dispose();

That’s it!

Creative Commons License
photo credit: pvera

Popularity: 2% [?]

Rest In Peace Drex


Today at 3:00 PM I put my dog of six years to sleep.  I got Drex in 2004 when his previous owner was out of the house for too long during the day and Drex needed constant companionship.   Luckily I never left the house and we fit together well.  He was a great dog, preventing at least one break-in at my condo, and always being loving, protective and affectionate.

He had his neurotic moments, like the time he chewed through drywall and insulation during a thunderstorm, or the time he opened a locked door (he was quite bright) and climbed the back fence during the Tornado of 2008, but he was a great dog through and through.  Over the past year (his 14th) he entered a marked physical and mental decline and it got to the point of being cruel to let him continue.

Godspeed Mr Buddy.

Popularity: 1% [?]

My “So What” positioning statement

As I’m currently reading Mark Magnacca’s excellent book “So What” (regarding marketing) I offer my humble Positioning Statement

Me: Do you know how you always forget people you meet and then don’t see for a while?

Potential Customer: Oh yes, that happens to me all the time

Me: Well, Stronico helps you remember people by showing you where they fit into your life.  You can see their interests, their friends and how you know them in the first place.

Coming up with that is an illuminating exercise.     “Visual Contact Management” is an accurate description of what Stronico actually does, but most people don’t see the utility in that description.

Popularity: 1% [?]

I don’t post for a week and the hits go up!

By that logic, I wonder how many hits I got before I even started the blog!

Popularity: 1% [?]