Posts

String Interpolation in Powershell Strings

I've been re-learning PowerShell lately. String Delimiters There are two string delimiters available for building strings in PowerShell: apostrophe (') and double quote ("): Write-Host 'Hello World' Write-Host "Hello World" Both of these PowerShell commands send the string Hello World to the console. I fell into the habit of using the apostrophe in my PowerShell scripts, and found that I missed string interpolation that I use so often in C# and PHP. Consider the following example: $name='Rick' $distanceInMiles=10 $greeting = 'Hello, my name is '+$name+' and I work '+$distanceInMiles+' miles from home.' Write-Host $greeting When this script is executed, the following is written to the console: Hello, my name is Rick and I work 10 miles from home. String Interpolation String interpolation lets you embed expressions into a string when defining the string. The expressions are evaluated when

ASP.NET MVC3

I want to get back into the habit of blogging. I’m currently learning the ASP.NET MVC3 framework. I’m going to be blogging about things I have learned while using the framework. Hope you enjoy it.

Using Linq To XML to Parse XML with Multiple Namespaces

I am working on a SQL Server Reporting Services 2008 project. I decided to write a tool in C# that will document the reports that I have created. What should make this easy is that the structure of the RDL (report) file is XML, which makes it a perfect candidate for using LINQ to XML to dig through its information. Here’s the top of the RDL file I’m trying to process (C:\MyReport.RDL): <? xml version="1.0" encoding="utf-8" ?> < Report xmlns : rd = "http://schemas.microsoft.com/SQLServer/reporting/reportdesigner" xmlns = "http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition" > < DataSources > < DataSource Name = "SalesDM" > < DataSourceReference > SalesDM </ DataSourceReference > < rd : DataSourceID > 60c7781c-ab9c-4c5f-b779-24afa5d5bac3 </ rd : DataSourceID > < rd : SecurityType > None </ rd : SecurityType > </ Data

When Testing Collides With Observation

Recently I noticed that a component I have been working on was running slowly in its Release version. The only changes I had made recently were mostly calls to Debug.WriteLine() to get unit-testing information. When I figured out the problem, it reminded me of a term from my Psychology background (my degree in Psychology, not my therapy ;-) ) called the “Observer Effect.” The Observer Effect is a term in experimental research which basically says that while you are trying to observe something, the very act of observation might affect what you are trying to observe. Consider the following simple, albeit silly example : Hypothesis: Water freezes at zero degrees Celsius. Method of study: Stand in freezer holding small puddle of water in hand. Results: Water doesn’t freeze at zero degrees Celsius. Why? Because the method of observation (holding water in hand) prevents the water from freezing because the warmth of your hand (around 98.6F) warms the water sufficiently so that it doesn’t fre
Image
I love creating tools that simplify a developers life and can save time. My intent with the next few blog entries will be to publicly step through the process of designing, creating, and using tools that I have named the "Fast and Filthy Add Ins for Visual Studio." "Fast and Filthy" is a play on the term "Quick and Dirty." These add ins will be Visual Studio add ins that will give a developer a fast and simple way to create prototypes for customers/management. I think this also has the potential for use by managers and even clients (more on this later). Taking Advantage of the Hierarchical Classes, controls, and data tend to be hierarchical in nature. Classes have properties and methods (which have parameters and a return value ). Controls contain collections of controls. Data tends to be hierarchical to some degree - Databases contains tables which can be related to other tables, tables contain fields, etc.. And then of course there's XML: hierarch

Wha' Happen'd?

Sorry for the delay in blog entries - the lines for the bathroom at my house are way long. ;-) Seriously, I've been away a while, but I'm going to throw myself into blogging. I encourage you to stay tuned!
Image
Copying Doth Not A Debuggable Web Application Maketh This week I was banging my head against the wall with a web project that I was working on. The project manager had sent me a web project that he wanted me to work on. I copied the project and files into a directory (for sake of example xyzproject) under inetpub\wwwroot. Then, from within Visual Studio I opened the project from web: localhost/xyzproject. I made a bunch of changes and then tried to run the web app. I got an error that said that the application was not configured for debugging. Following the instructions given by the error message, I went to my web.config and made sure that in the configuration section that debug was set to true (which it already was). I try to run the application, and again I'm presented with the error that the application is not configured for debugging. I can't even run the app in release mode. After knocking my head against the wall for a while, I came to the realization that just copying a