Dealing with null data in SSRS

When working with a SSRS report, the report framework will already “Denull” everything.  But in some cases, for example when you are working with numbers, you might want to display a value in lue of the “” that is displayed for nulls.

Now you would THINK, that they would just use the same ISNULL syntax that everyone knows from sql programming.

HAHAHHAHA… of course they didn’t do that.

Instead you have to use a combo of IIF and IsNothing like so:

=IIF(IsNothing(Fields!Quantity.Value),0,Fields!Quantity.Value)

It isn’t THAT big of a pain, but I wish MS would sometimes just realize how much easier it would be for them to just create an IsNull function in their own codebase than make their users write this out.

Oh well.  I guess when it comes to problems with SSRS, this is waaaaaaayyyyy down my list.

Speaking of “my problems with SSRS”… when are you guys going to support TBLR text??  Drives me nuts.  Everyone does “vertical text” in TBLR format, for pretty much every application, but now in SSRS you are forced to use TBRL.  When you give these reports to engineers that is the very first thing they say “You need to turn this text around the other way”…. yes I know, I got my degree in Civil Engineering with a focus on structure design, so when you come from a background of seeing all vertical text (like on any plans) as ALWAYS, by requirement, aligned in a TBLR manner, and then you are forced to cock your head the other way to read it, it is really a pain.

But I guess I would still like to see MS fix their *terrible* PDF rendering first.  I just LOVE watching my reports take 4x as long as in CR, and end up 100x bigger in file size than they are after being saved in acrobat (15 MB for a 1 page PDF, open in Acrobat, save the file again, down to 150KB, with no visible change in appearance or quality).

 

404s on ASP.NET AJAX script files in the System.Web.Extensions folder

Recently I ran into a problem where browsing to a newly installed web app produced a bunch of javascript errors.  Stuff like: “‘Type’ is not defined” and “‘Sys’ is not defined”.

After debugging it for a while, I found the problem to be that URLScan had been installed on the server (Windows 2000 Server), which was preventing any requests with dots in the folder name.

URL Scan is a tool that MS suggested everyone install a while back that acts to filter out many malicious attacks.

So, with the default settings any request for a file inside the scriptsSystem.Web.Extensions folder would be denied as a 404 b/c of URL Scan.

To fix this, you need to edit the UrlScan.ini file, located in %WINDIR%System32InetsrvURLscan.  Near the top of the file, change AllowDotInPath from 0 to 1.

The run iisreset to restart IIS and you should be ok!

More info on URLScan is available here:

http://support.microsoft.com/kb/326444

 

Chicago Neighborhoods

Edit: It turns out that the areas listed below are the 77 official “Community Areas” of Chicago.  Each of these areas can be made up of multiple neighborhoods.

For example, the “Near West Side” is made up of the West Loop, and Greektown, among others.

http://www.answers.com/topic/community-areas-of-chicago

———-

This is not really a definitive map, as I see some places that appear to go by different names than are listed on this map, but this is the best one I could find.

 

Getting Dumpprep.exe to leave me alone

Everytime a program on my computer hangs or crashes, dumpprep.exe spins for a long time getting a dump report ready for microsoft.  Only problem is, I never send the report, because I need to get back to work.  So all that time is wasted.

Thankfully, you can turn off this time wasting “feature”:

1. System Properties (Either via System in Control Panel, or Getting Properties on My Computer)
2. Advanced Tab, and choose “Error Reporting”. Set to “Disable Error Reporting”
3. You could also Select “Startup and Recovery” – Settings button, and change “Write Debugging information” from complete to none.

Credit goes to Peter Collinson www.clieuk.co.uk.

Using My.Settings on a referenced project

I recently ran into some seemingly strange behavior as I was testing a couple windows services I had written.

In my case, I had a test harness program that was referencing the service (an exe) but this could also apply to references to dlls if you are using the projects application settings (My.Settings.Whatever in VB.Net).

After figuring it out, it all makes sense.

When you create an application setting by providing a value in the project’s “Settings” tab, the value is written out into a special <applicationSettings> block in your config file.

But, in order to make those values accessible via a strongly typed/intellisense method, a class is created to wrap those values.  The class is in the Settings.vb file that is generated when you first add an application setting to your project.

But there is one more interesting thing to note:  If the settings class doesn’t find the item it expects in the config file, it will return the last supplied value by default. 

So what this means is that if create an application setting for XYZ for the value “123” and then change the app.config file directly to change the “123” to “abc”, then “abc” will be returned when you run the program.  However, if you were to then alter the config file to remove or rename the XYZ item, then your application would return “123” again when it ran.

Also, if you directly modify the config file, and then try to edit the projects applications settings, it will alert you to the fact that some values have changed, and ask if you want to use the updated values from the config file.  If you say yes, it will overwrite the Settings.vb file to use the new values that you had supplied in the config file.

So, I was referencing a project that used these settings, but when I would update the config file, those updated settings were not seen.  All I had to do was go into the project settings tab, allow it to refresh the Settings.vb file, and rebuild the project.

 

TFS Source Control "No Commands Available"

I just opened VS to do something in TFS Source Control Explorer only to find that all my controls were disabled and right clicking on anything only showed “No Commands Available.”

Turns out that this was because I had to change my default source control plugin to VSS for a project I was working on.  If you go to Tools->Options->Source Control and select TFS as the default SCC plugin, it will fix the problem.

Right aligning text when printing from a .net program

In a program I am writing, I need to print directly to a couple of label printers.

My God these things are a pain in the ass to work with, but I will leave that rant to another post.

One thing I ran into was how to right align text when using the DrawString method of the System.Drawing.Graphics class off of the PrintPageEventArgs.

The solutions I was coming across seemed about as bad as I was expecting.

They involved measuring the width of the line of string using some System.Drawing.Graphics.MeasureString to figure out the length, and then dynamically position the text to make it appear right aligned.  So what that means is that for short text, X would be greater and for long text X would be less.

Fortunately, I came across the most simple solution:

Dim s As New StringFormat()
s.Alignment = StringAlignment.Far

e.Graphics.DrawString("por que?", New Font("Tahoma", 8), Brushes.Black, 50, 50, s)

Very simple.  But you have to wonder, why did MS pick “Far” as the alignment name instead of “Right”, as you would expect.  Maybe “Far” is more of a graphics term for alignment?  Who knows.