Category Archives: Programming

Word of the Day: arity

Here’s a new word for me:

Arity—In a computer programming language, the number of arguments a function or operation accepts. For example, public void FindUser(string FirstName, string LastName) has an arity of two.

I discovered this word recently as I began exploring Prolog. In most programming languages I’ve worked with, the numerical value of an operation’s arity isn’t emphasized. In the Prolog world—in documentation, discussion and in the interpreter’s output— predicate names are always coupled with their arity. For example: reverseList(In, Out) is referred to as reverseList/2 (with the ”/2″ indicating an arity of two).

More Details on Arity

NetMsmqIntegrationBinding — No Data Being Passed

, ,

Recently, I encountered a strange problem with a simple WCF NetMsmqIntegrationBinding service. The data objects passed into my service contained no data! When a message was received, the service would create an instance of the appropriate DataContract class but then would not populate the just-constructed object with the data contained in the WCF message (i.e. the data object’s fields were all left at their default values—null, 0, empty string, etc.). Continue reading

“The profile for the user is a temporary profile” Error Even After Granting Private Key Read Rights

,

Recently, while helping a client deploy a wsHttpBinding Windows Communication Foundation web service configured with message security, we encountered the following error: “The profile for the user is a temporary profile.” As is sometimes the case with WCF certificate security issues, the initial error message’s description did not come close to describing the actual problem. Continue reading

SQL Refactoring – Comparing Result Sets with EXCEPT

,

I often refactor SQL, cleaning up convoluted statements using language features such as views, common table expressions and nested joins. It’s one thing to rework a gnarly query into something legible; it’s another thing to verify that the rewritten query returns the same data as the original.

The starting point for verification is comparing the result sets returned by the old and new queries. I’ve recently found Microsoft T-SQL’s EXCEPT operator quite handy for this purpose. Continue reading

C# Boolean Expressions With and Without Short-Circuiting

For years I’ve used the && and || operators in C# Boolean expressions (e.g. if (age > 60 && gender == male) { /* do something */ }). Today, I was surprised to learn that & and | can also be used to compare bool values (this is in addition to their traditional use as bitwise AND and OR operators).

What’s the difference between the two pairs of operators? && and || use short-circuit evaluation while & and | do not. Continue reading

INotifyPropertyChanged – propertyName – Past, Present and Hopes for the Future

, , ,

Raising an INotifyPropertyChanged event requires a string containing the affected property’s name. Developers want a simple, clean and performance-efficient way to populate this string. New versions of .Net have brought developers closer and closer to achieving this goal.

Let’s review how INotifyPropertyChanged implementation options have improved over the years. Then, let’s consider an idea on how these options might be made even better. Continue reading

async/await Doesn’t Make Synchronous Code Asynchronous

, ,

With the recent release of .Net 4.5/C# 5, I’ve spent time experimenting with the new async/await functionality. To my surprise, these new keywords didn’t have the effect I anticipated. Based on my skimming of pre-release information, I was under the impression that the appropriate use of these keywords would cause a normally-synchronous method to execute asynchronously.

Wrong! Continue reading

SSRS: Referencing Data Contained in Other Textboxes

Did you know that the content of other textboxes can be referenced in Microsoft SQL Server Reporting Services expressions?

In the example below, the expression for Destination (the lower textbox) is set to =ReportItems!Source.Value. When report rendering occurs, Destination is populated with Source‘s content.

Continue reading