Thursday, May 31, 2007

WPF and XAML Tutorials By Josh Smith Available

CodeProject has an excellent series on WPF by Josh Smith

Part 1 (XAML): Learn about XAML and how it is used in WPF applications.
Part 2 (Layout): Learn about layout panels and how they are used to construct user interfaces.
Part 3 (Data binding): Learn how WPF data binding works and how it can be used.
Part 4 (Data templates and triggers): Learn how data templates and triggers work and how they can be used.
Part 5 (Styles): Learn about how UIs can be styled in WPF.

Sam Gentile Reviews RubyMicrosoft Essay By Martin Fowler

Martin Fowler asked Sam Gentile to review and contribute thoughts to his very important new essay RubyMicrosoft. This piece presents the view that Microsoft is at a crossroads, an important time in its life where Microsoft can make good of opportunities or choose an altogether different road.

Read the article here:

Here is the most interesting comment

On the alpha geek side, I fear all is lost already. All of my peers and the "Agile .NET" community have already moved ontoCastle/Windsor, NUNit, NAnt, MonoRail, Spring.NET, NHibernate, etcinstead of Microsoft solutions. It’s virtually over already. For twoyears now, I have talked about our Agile team and how we can't useVisual Studio Team System and instead have to use CruiseControl.NET,NUnit, NAnt, etc to work in an Agile fashion. Not only does Microsoftnot understand this, but the majority of Microsoft programmers don't.They have been weaned on being "Morts" and having wizards, storedprocedures, drag & drop forced on them and not required to learn thesolid skills that make up what we think of as a developer

What is your opinion? We are using Subversion and currently testing with CruiseControl, NAnt and NUnit

EBay Acquires Online Search Site StumbleUpon

EBay Inc. announced Wednesday that it acquired StumbleUpon Inc., a software startup that suggests Web sites based on reader reviews and personal preferences of its members.
The $75 million cash acquisition gives eBay access to about 2.3 million people who have filled out profiles at StumbleUpon, founded in 2001 by three Canadian software engineers in Calgary. The venture capital-funded company, which recently relocated to San Francisco, is considered a pioneer of the so-called "Web 3.0" niche.

The term refers to technology that pairs general Internet search capability with a user's personal data and aggregated community data, theoretically delivering more relevant results than a standard search engine such as Google Inc.

For example, a StumbleUpon search for "cars" could generate a list of Web pages that factor in a user's income, age, gender, home address, current vehicles owned and other demographic data submitted. The search results would also include sites ranked favorably by other StumbleUpon members with similar interests and background.

By contrast, a straight Google search delivers 357 million Web pages ranging from the popular Hollywood movie "Cars" to advertisements for used car dealers and newspaper classified sections.

StumbleUpon is free for users and generates revenue through advertising, though the company doesn't disclose financial information. Members who pay an annual fee bypass advertisements completely.

Michael Buhr, senior director at San Jose-based eBay, will serve as general manager of StumbleUpon. StumbleUpons founders and managers will become eBay employees.

"StumbleUpon is a great fit within our goal of pioneering new communities based on commerce and sustained by trust," Buhr said.

The acquisition is not expected to change eBay's latest financial guidance. The company expects to report second-quarter profit of 31 cents to 33 cents per share on sales in the range of $1.75 billion to $1.8 billion. For the full year, eBay expects profit of $1.30 to $1.34 per share on sales of $7.2 billion to $7.45 billion.

The 12-year-old e-commerce powerhouse had $3.5 billion in cash last month and has been aggressively acquiring smaller companies to compete against rivals ranging from Google to EBay, which already owns Internet phone service Skype and portals such as and, completed the buyout of online ticket reseller StubHub for $310 million earlier this year.

Login failed for user 'sa'. Reason: Not associated with a trusted SQL Server connection.

SQL Server 2005 version

I am seeing a lot of searches on this blog or reaching this blog from MSN/Google with this search “SQL 2005 Login failed for user 'sa'. Reason: Not associated with a trusted SQL Server connection.” So this is what causes the problem: your SQL Server has been setup with windows authentication only. In order to make it mixed mode authentication right click on the server name in enterprise manager select properties and click on the security tab. Select SQL server and Windows Authentication mode(see picture…) and that will fix it The cool thing about SQL server 2005 is that you can script this out so that you can run the code on multiple servers instead of going to all the servers and clicking etc. Just click on script and code like the one below will be generated

USE [master]
EXEC xp_instance_regwrite N'HKEY_LOCAL_MACHINE', N'Software\Microsoft\MSSQLServer\MSSQLServer', N'LoginMode', REG_DWORD, 2

SQL Server 2000 version

I am seeing a ton of searches on this blog or reaching this blog from MSN/Google with this search “Login failed for user 'sa'. Reason: Not associated with a trusted SQL Server connection.” So this is what causes the problem: your SQL Server has been setup with windows authentication only. In order to make it mixed mode authentication right click on the server name in enterprise manager select properties and click on the security tab. Select SQL server and Windows (see picture…) and that will fix it

Tuesday, May 29, 2007

Free SQL Injection Scanners

SQLIer - SQLIer takes a vulnerable URL and attempts to determine all the necessary information to exploit the SQL Injection vulnerability by itself, requiring no user interaction at all. Download SQLIer.

SQLbftools - SQLbftools is a collection of tools to retrieve MySQL information available using a blind SQL Injection attack. Download SQLbftools.

SQL Injection Brute-forcer - SQLibf is a tool for automatizing the work of detecting and exploiting SQL Injection vulnerabilities. SQLibf can work in Visible and Blind SQL Injection. It works by doing simple logic SQL operations to determine the exposure level of the vulnerable application. Download SQLLibf.

SQLBrute - SQLBrute is a tool for brute forcing data out of databases using blind SQL injection vulnerabilities. It supports time based and error based exploit types on Microsoft SQL Server, and error based exploit on Oracle. It is written in Python, uses multi-threading, and doesn’t require non-standard libraries. Download SQLBrute.

BobCat - BobCat is a tool to aid an auditor in taking full advantage of SQL injection vulnerabilities. It is based on AppSecInc research. It can list the linked severs, database schema, and allow the retrieval of data from any table that the current application user has access to. Download BobCat.

SQLMap - SQLMap is an automatic blind SQL injection tool, developed in python, capable to perform an active database management system fingerprint, enumerate entire remote databases and much more. The aim of SQLMap is to implement a fully functional database management system tool which takes advantages of web application programming security flaws which lead to SQL injection vulnerabilities. Download SQLMap.

Absinthe - Absinthe is a GUI-based tool that automates the process of downloading the schema and contents of a database that is vulnerable to Blind SQL Injection. Download Absinthe.

SQL Injection Pen-testing Tool - The SQL Injection Tool is a GUI-based utility designed to examine database through vulnerabilities in web-applications. Download SQL Injection Pen-testing tool.

SQID - SQL Injection digger (SQLID) is a command line program that looks for SQL injections and common errors in websites. It can perform the follwing operations: look for SQL injection in a web pages and test submit forms for possible SQL injection vulnerabilities. Download SQID.

Blind SQL Injection Perl Tool - bsqlbf is a Perl script that lets auditors retrieve information from web sites that are vulnerable to SQL Injection. Download Blind SQL Injection Perl Tool.

SQL Power Injection Injector - SQL Power Injection helps the penetration tester to inject SQL commands on a web page. It’s main strength is its capacity to automate tedious blind SQL injection with several threads. Download SQL Power Injection.

FJ-Injector Framwork - FG-Injector is a free open source framework designed to help find SQL injection vulnerabilities in web applications. It includes a proxy feature for intercepting and modifying HTTP requests, and an interface for automating SQL injection exploitation. Download FJ-Injector Framework.

SQLNinja - SQLNinja is a tool to exploit SQL Injection vulnerabilities on a web application that uses Microsoft SQL Server as its back-end database. Download SQLNinja.

If you are using a lot of dynamic SQL then don't forget to read The Curse and Blessings of Dynamic SQL written by Erland Sommarskog, SQL Server MVP.

How To Check If A Temporary Table Exists

How do you check if a temp table exists?
You can use IF OBJECT_ID('tempdb..#temp') IS NOT NULL
Let's see how it works

USE Norhtwind

--Create table

--Check if it exists
IF OBJECT_ID('tempdb..#temp') IS NOT NULL
PRINT '#temp exists!'
'#temp does not exist!'

--Another way to check with an undocumented optional second parameter
IF OBJECT_ID('tempdb..#temp','u') IS NOT NULL
PRINT '#temp exists!'
'#temp does not exist!'

--Don't do this because this checks the local DB and will return does not exist
IF OBJECT_ID('tempdb..#temp','local') IS NOT NULL
PRINT '#temp exists!'
'#temp does not exist!'

--unless you do something like this
USE tempdb

--Now it exists again
IF OBJECT_ID('tempdb..#temp','local') IS NOT NULL
PRINT '#temp exists!'
'#temp does not exist!'

--let's go back to Norhtwind again
USE Norhtwind

--Check if it exists
IF OBJECT_ID('tempdb..#temp') IS NOT NULL
PRINT '#temp exists!'
'#temp does not exist!'

now open a new window from Query Analyzer (CTRL + N) and run this code again
--Check if it exists
IF OBJECT_ID('tempdb..#temp') IS NOT NULL
PRINT '#temp exists!'
'#temp does not exist!'

It doesn't exist and that is correct since it's a local temp table not a global temp table

Well let's test that statement
--create a global temp table
CREATE TABLE ##temp(id INT) --Notice the 2 pound signs, that's how you create a global variable

--Check if it exists
IF OBJECT_ID('tempdb..##temp') IS NOT NULL
PRINT '##temp exists!'
'##temp does not exist!'

It exists, right?
Now run the same code in a new Query Analyzer window (CTRL + N)

--Check if it exists
IF OBJECT_ID('tempdb..##temp') IS NOT NULL
PRINT '##temp exists!'
'##temp does not exist!'

And yes this time it does exist since it's a global table

Cross-posted from

Saturday, May 26, 2007

MbUnit 2.4 Released

Download it here:


  • .NET 1.0 support dropped.

  • .NET 1.1 support in 2.4 merged into the main line (No need for MbUnit.Framework.1.1.dll)

  • Added greater support for .NET 2.0 including (MbUnit.Framework.2.0.dll)

    • Database rollback (now no longer need COM+ if your using .NET 2.0).

    • Private method testing (see Vadims articles here and here).

    • Generics in certain Asserts.

  • Support for NUnit style explicit attributes.

As well as a great deal of bug fixes and functional improvements.

The road ahead.

2.4 signals the end of major releases for 2.*, interim releases with tweaked functionality and bug fixes will still occur to 2.4 (starting with 2.4.1) but the next major release of MbUnit will be v3 codenamed MbUnit Gallio. In the coming weeks the core development team will be stepping up through the gears on MbUnit Gallio.

Cumulative update package (build 3161) for SQL Server 2005 Service Pack 2 is available

How to obtain the cumulative update package (build 3161) for SQL Server 2005 SP2
A supported hotfix is now available from Microsoft. However, this hotfix is intended to correct only the problem that is described in this article. Apply this hotfix only to systems that are experiencing this specific problem. This hotfix might receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next SQL Server 2005 service pack that contains this hotfix.

To resolve this problem, submit a request to Microsoft Online Customer Services to obtain the hotfix. To submit an online request to obtain the hotfix, visit the following Microsoft Web site:

SQL Hotfix bug number Knowledge Base article number Description
50000939 933508 Microsoft SQL Server 2005 Service Pack 2 issue: Cleanup tasks run at different intervals than intended

50000787 929240 FIX: I/O requests that are generated by the checkpoint process may cause I/O bottlenecks if the I/O subsystem is not fast enough to sustain the IO requests in SQL Server 2005

50000784 930505 FIX: Error message when you run DML statements against a table that is published for merge replication in SQL Server 2005: "Could not find stored procedure"

50000783 930691 FIX: SQL Server Profiler stops monitoring the instance after a time when you use SQL Server Profiler to monitor an instance of SQL Server 2005 Analysis Services

50000785 930775 FIX: Error message when you try to retrieve rows from a cursor that uses the OPTION (RECOMPILE) query hint in SQL Server 2005: "Could not complete cursor operation because the table schema changed after the cursor was declared"

50000873 931329 FIX: Error message when you run a query in Microsoft SQL Server 2005: "Msg 8624, Level 16, State 116 Internal Query Processor Error: The query processor could not produce a query plan"

50000875 932115 FIX: The ghost row clean-up thread does not remove ghost rows on some data files of a database in SQL Server 2005

50000900 933549 FIX: You may receive an access violation when you perform a bulk copy operation in SQL Server 2005

50000949 934109 FIX: The Distribution Agent generates an access violation when you configure a transactional replication publication to run an additional script after the snapshot is applied at the subscriber in SQL Server 2005

50000952 934188 FIX: The Distribution Agent does not deliver commands to the Subscriber even if the Distribution Agent is running in SQL Server 2005

50000958 934226 FIX: Error message when you try to use Database Mail to send an e-mail message in SQL Server 2005: "profile name is not valid (Microsoft SQL Server, Error 14607)"

50001012 934459 FIX: The Check Database Integrity task and the Execute T-SQL Statement task in a maintenance plan may lose database context in certain circumstances in SQL Server 2005 builds 3150 through 3158

50000948 934106 FIX: SQL Server 2005 database engine generates failed assertion errors when you use the Replication Monitor to monitor the distribution database

50000786 An application that uses Analysis Services 9.0 OLE DB Provider (Msolap90.dll) to connect to SQL Server 2005 Analysis Services may experience a memory leak.

50000810 When you update a view by using a cursor, error 16934 occurs. The error message for error 16934 is as follows: "Optimistic concurrency check failed. The row was modified outside of this cursor."

50000809 The lazywriter process may cause high CPU usage in SQL Server 2005 on a computer that has "non-uniform memory access" (NUMA) architecture.

50000874 The disk space that is allocated for temporary tables may not be released. This problem occurs when a temporary table is created on a connection that has the SET XACT_ABORT option set to ON.

50000889 In the Data Mining Client for Excel add-in, you perform the Analyze Key Influencers action against a SQL Server 2005 Analysis Services Standard Edition server. When you do this, you receive the following error message: "The 'MINIMUM_DEPENDENCY_PROBABILITY' data mining parameter is not valid for the 'ATableName' model."

50000921 A transactional replication publication that involves replicated procedure executions may cause error 701. The error message for error 701 is as follows: "There is insufficient system memory to run this query."

50000945 The USERSTORE_TOKENPERM SQL Server 2005 memory cache may grow too large. Therefore, high CPU utilization occurs, or "out of memory" errors occur.

50000964 SQL Server 2005 may select a poorly performing query plan for a query that references a scalar user-defined function that performs data access.

50000969 In SQL Server 2005, assertion error 3624 may occur. The error message for assertion error 3624 is as follows: "Attempt to access expired blob handle (3)."

50000918 When you run a query that uses the FOR XML clause together with the TYPE directive, the query may fail. Additionally, error 6611 may occur. The error message for error 6611 is as follows: "The XML data type is damaged."

50000960 A content query from the Data Mining Client for Excel add-in may take a long time to display the result set. This problem occurs especially when the result set is large. Microsoft Office Excel may appear to stop responding (hang) when the query is running.

50000919 When you run an encrypted stored procedure, error 565 may occur. The error message for error 565 is as follows: "A stack overflow occurred in the server while compiling the query. Please simplify the query."

50001026 After you perform a piecemeal restoration of a database that uses the vardecimal storage format, filegroups may be marked as defunct.

50001083 When you join an int data type column together with a bigint data type column, you may obtain incorrect results. This problem occurs if the join uses bitmap filtering.

50001076 Tables in SQL Server 2005 Reporting Services reports may not be displayed correctly when you view the reports in Microsoft Office Outlook 2007.

50001105 After you apply SQL Server 2005 SP2, the Print Preview feature in Reporting Services may show a solid black page.

Read more here:

Friday, May 25, 2007

The Evolution Of LINQ And Its Impact On The Design Of C#

C# PM Anson Horton explains the relationship between LINQ and the new features in CSharp 3.0 such as extension methods and lambda expresssions.

This article discusses:
C# and LINQ
The evolution of LINQ
SQL querying from code

Lambda Expressions
Extension Methods
Anonymous Types
Implicitly Typed Local Variables
Object Initializers
Query Expressions

Podcast: Community Corner: an interview with Dan Stolts on Windows Server “Longhorn” (Windows Server 2008)

On this week’s Community Corner, Dan Stolts talks with John Weston about Windows Server “Longhorn” (now Windows Server 2008). They dive into some of the new features in Windows Server 2008, including Powershell and Virtualization.

Eric Ostrowski – Your Show Host and TechNet Radio ProducerJohn Weston – IT Pro Evangelist
Dan Stolts – Dan Stolts has had a long involvement in the user group community and is President of BayState Integrated Technology, Inc. which specializes in IT system integration and IT infrastructure outsourced support for the small and medium sized business markets.

Listen to the podcast(MP3)
Listen to the podcast(WMA)

Video: Windows PowerShell: Origin and Future

Bruce Payette, one of the original PowerShell team members and author of the Windows PowerShell scripting language, discusses the design goals and origins of the PowerShell language. He demonstrates the ease with which PowerShell language can be used to write a PowerShell make program that controls the generation of executables and other non-source files of a program from the program's source files.
Additionally, Bruce and Jeffrey discuss futures for V2, whether it is a shell or a language, is it OO, is it dynamic language, and how they have learned to love the upgraded name because it says what it is!

Download the Video
Watch the Video

Dot Net PDF Cheat Sheets

.NET Format String Quick Reference
Current Version: 1.1» Download Now (PDF, 123 KB)

ASP.NET 2.0 Page Life Cycle & Common Events
Current Version: 1.0» Download Now (PDF, 64KB)

Visual Studio 2005 Built-in Code Snippets (C#)
Current Version: 1.0» Download Now (PDF, 56 KB)

Thursday, May 24, 2007

BBQ SEASON ORIENTATION - For those that have forgotten!

BBQ rules

After months of cold and rainy weather, we are finally coming up
to summer and BBQ season. Therefore it is important to refresh
your memory on the etiquette of this sublime outdoor cooking
activity, as it's the only type of cooking a 'real' man will do,
probably because there is an element of danger involved.

When a man volunteers to do the BBQ the following chain of events
are put into motion:

(1) The woman buys the food.
(2) The woman makes the salad, prepares the vegetables, and makes
(3) The woman prepares the meat for cooking, places it on a tray
along with the necessary cooking utensils and sauces, and takes
it to the man who is lounging beside the grill - beer in hand.

Here comes the important part:


More routine....

(5) The woman goes inside to organize the plates and cutlery.
(6) The woman comes out to tell the man that the meat is burning.
He thanks her and asks if she will bring another beer while he
deals with the situation.

Important again:


More routine....

(8) The woman prepares the plates, salad, bread, utensils,
napkins, sauces, and brings them to the table.
(9) After eating, the woman clears the table and does the dishes.

And most important of all:

(10) Everyone PRAISES the MAN and THANKS HIM for his cooking efforts.
(11) The man asks the woman how she enjoyed "her night off." And,
upon seeing her annoyed reaction, concludes that there's just no
pleasing some women....

Wednesday, May 23, 2007

Video: Microsoft Robotics Studio Videos

Channel 9 has four how to videos on using Microsoft Robotics Studio on their site

Singapore Sumo-Robot How-To #1: Getting the Robotics Bits
Singapore! Are you ready for our local Sumo-Robot competition with Microsoft Robotics Studio? If you are, check out the video on how YOU can get started on the competition using the VIRTUAL SUMO ROBOT.

Getting the virtual sumo ready on your machine should take about 20 mins! We have number of additional videos to show you the basics of the robot and guidance on how to code your logic.

In this video, Shen Yizhe (MIC Tech Lead from NUS) and Chewy Chong (MS Developer Evangelist) shows you where to get the bits, how to install and how to test your installation. The step by step details can be found at Chewy’s blog (

Singapore’s first Sumo-Robot competition will take place at MEDC Singapore 2007 on 8 June in Suntec. Make sure you sign up to check out the event in person. We will have more competitions across the island over Summer 2007 so stay tuned.

Download the Video
Watch the Video

Singapore Sumo-Robot How-To Video #2: Understanding Your Robot's Inputs and Outputs
In this video, Shen Yizhe (MIC Tech Lead from NUS) will be showing developers where are the sensors physically located on the Sumo Robots and what are those sensors used for during a Sumo Robot Competition.There appears to be a problem with the streaming media file redirecting to one of the other videos... we suggest you download the full video (7.84 MB).
Download the Video
Watch the Video

Singapore Sumo-Robot How-To Video #3: Building Your First Robot
In this video, Shen Yizhe (MIC Tech Lead from NUS) and Yap Baofa (MSP from Singapore) will be discussing about the various steps which a developer has to take in order to write and deploy their first robots into the simulated environment which comes with the Sumo Robots Package released by the Robotics Studio Team. After completing this video, developers will be able to understand the basic concepts in deploying their self-created robots into the simulator.This video contains "code views" and we recommend you download the Full Video to clearly see the code details (48MB).
Download the Video
Watch the Video

Singapore Sumo-Robot How-To Video #4: Understanding Your Robot's Code Methods
In this video, Shen Yizhe (MIC Tech Lead from NUS) and Tan Chun Siong (MSP from Singapore) will be going through the various methods that form the decision logics of the Sumo Robots. At the end of this video, developers will be able to code their own decision logics and strategies for their Sumo Robots.
As this video contains "code views", we recommend you download the Full Video for the best view (38MB).
Download the Video
Watch the Video

Webcast Series on and Orcas

The Visual Basic Team has put together a webcast series about the next version of Visual Basic and Orcas.
Here is what is offered:

Live From Redmond: VB9 - Deep Dive into LINQ May 23rd, Presented by Amanda Silver

Live From Redmond: VB9 - Building Service-Oriented Applications May 30th, Presented by John Stallo

Live From Redmond: Using the Interop Toolkit to Migrate your VB6 Applications to .NET June 6th, Presented by Jonathan Aneja

Live From Redmond: VB9 – LINQ Best Practices June 13th, Presented by Lisa Feigenbaum

Cannot add, update, or delete a job that originated from an MSX Server

This is one of those very friendly error messages that don't mean anything when you look at it. This happened to a client who was migrating their servers and backed up all the SQL server Databases and restored them on the new machine they bought. What happened is this, they named the new machine differently than the old machine. When you look at the jobs you can see them (and that’s about it). You can not delete, update or run these jobs. Unfortunately renaming the server was not an option for the client. I looked in the sysjobs table in the msdb database and found out that the name stored was the old server name

SELECT originating_server FROM msdb..sysjobs

I then updated the originating_server fields in the table with the new server name value and everything was fine after that. As far as I know this doesn't effect SQL server 7 since it stores (local) in the originating_server column

Tuesday, May 22, 2007

Video: SOA From Theory To Practice; Enterprise Service Bus (ESB)

Channel 9 has their latest video on their site, this one deals with SOA and more specifically Enterprise Service Bus (ESB)

From the site: "Ok... I'm going to say something we are not supposed to say... Ready? Here it is... Enterprise Service Bus (ESB). We are not supposed to say this because Microsoft didn't invent the term (ok I'm only partially kidding here). In spite of the fact that we didn't invent the idea, there is some goodness in the idea and for that reason I decided to chat with Izak Cohen and Eliaz Tobias from Microsoft Israel about their thoughts on ESB and SOA."

Download the Video
Watch the Video

NULL and SQL Problematic?

There seems to be a lot of confusion on newsgroups about NULLs and how they behave.
Before I start I would like to point out that all the code will behave this way if ANSI_NULLS is set to on not to off

First create these 2 tables

INSERT INTO testnulls VALUES (1)
INSERT INTO testnulls VALUES (2)
INSERT INTO testnulls VALUES (null)


Now run these queries and you will understand why NOT IN should never be used

--We get back value 1 here

--Nothing is returned because testnulls contains NULL values

--Value 3 is returned

--value 3 is returned
SELECT * FROM testjoin j
FROM testnulls n
WHERE n.ID = j.ID)

--value 3 is returned
SELECT j.* FROM testjoin j
LEFT OUTER JOIN testnulls n ON n.ID = j.ID

Counts are also tricky with NULLS

--a count of 3 is returned
SELECT COUNT(*) FROM testnulls

-- a count of 2 is returned, the count ignores NULL values
SELECT COUNT(id) FROM testnulls

--By using coalesce the count is also 3

--all 3 rows are returned
SELECT * FROM testnulls

The WHERE clause is also something that people have problems with

-- 1 row is returned
SELECT * FROM testnulls

-- only 1 row is returned the row with the NULL value is ignored
SELECT * FROM testnulls

-- Now both rows that are not 1 are returned
SELECT * FROM testnulls

-- Now both rows that are not 1 are returned also
SELECT * FROM testnulls

Some more NULL Fun
You can''t compare NULL with anything
Since both values are unknown even a comparison with another NULL is unknown


IF @v = @v2
SELECT 'yes'

Be carefull with forgetting to initialize parameters while building string


SELECT @SQL = 'SELECT * FROM testnulls

--Oops nothing is returned because NULL + anything else is always NULL

Monday, May 21, 2007

Silverlight Plugin For Lutz Roeder's Reflector

One of the nice advantages to Silverlight is that you can view the source of a site to see how things work, but with Silverlight 1.1 Alpha that process became more complex. While you can still fish through the JavaScript and Xaml to find the .NET assembly(dll) that is doing all the logic it takes a lot more time.

Ernie Booth decided to write a plugin for Lutz Roeder's Reflector that takes a URL to a Silverlight page and finds the assembly for that page. It also loads up the JavaScript and root Xaml for the page.

Download all the source and assembly for the 0.1 Alpha of the Reflector Silverlight Browser here:

Friday, May 18, 2007

NStub: A Unit Test Generator For .NET Assemblies

NStub is a unit test generator for .NET assemblies. You simply point NStub at the assembly containing the types you wish to test, pick the types and methods that your interested in from interface, choose where you want the resulting source files to be created at, and click GO!. That's all there is to it!

What do I get? Your resulting group of source files will contain one stubbed test method for each method that you selected. The code is clean, clearly documented and is already decorated to work with your chosen test framework. All you have to do is fill in the logic. Each group of source files even comes with an associated project allowing you to quickly open the files in Visual Studio and start editing. Not using Visual Studio? No problem! Just open the files individually in your chosen development environment and go to work.

That sounds great...except for... NStub is fully extensible, allowing you to create plug-ins not only to support multiple testing frameworks but also to generate the testing code in any .NET compliant language. The sky is the limit to what you can accomplish.

Download it here:

Microsoft Releases Mashup Tool Popfly


Microsoft has just released Popfly
This tool, and community, lets you build a mashup in a few minutes.
You can mashup various services like Twitter, Flickr, Virtual Earth, etc etc.

Popfly is the fun, easy way to build and share mashups, gadgets, Web pages, and applications. Popfly consists of two parts:

1 Popfly Creator is a set of online visual tools for building Web pages and mashups.

2 Popfly Space is an online community of creators where you can host, share, rate, comment and even remix creations from other Popfly users.

Mashup Creator
Web Page Creator
Popfly Space

Check it all out here:
The overview page is here:

ASP.NET Podcast: Silverlight and Managed JavaScript

View in Flash.

Show Notes:
Silverlight .NET 1.1 Alpha.
Running in VS.NET Orcas Beta1
Managed JavaScript

Original URL:

Video: Luke Hoban: Orcas - Compiling LINQ, C# Futures, Intellisense

Chanel 9 has made avalable their latest video: Luke Hoban: Orcas - Compiling LINQ, C# Futures, Intellisense

From the site:"Meet Luke Hoban, Program Manager on the C# Compiler team. Here, we talk about how LINQ works, from a compiler point of view. As you know by now, LINQ is a construct that is built of new language level innovations which of course must have compiler support... As you might imagine, given the nature of LINQ's requisite language level components, we talk about functional programming and it's new role in our good old imperative world. In Orcas, you shouldn't talk about LINQ without showing it in action inside of Visual Studio. "

Media Length: 00:41:39
Download the video here:

Thursday, May 17, 2007

Extending Visual Studio Just Got Much Easier With VSIPFactory

If you're extending Visual Studio using the VSSDK, you probably know that it's a pain in the neck.
But don't worry any longer because VSIPFactory is here.

The purpose of this project is to provide an better authoring experience of VSIP packages and VSIP components.

Target audience

  • VSIP developers
  • Visual Studio enthusiasts

Features overview
  • Create:

    • VS Package solution
    • VS Package project
    • VS Services
    • VS Tool Windows
    • VS Commands
    • VS Tool Options Pages
    • Editors / Language services
    • Custom projects
    • Custom projects property pages
    • Subscribe to VS Events

      • VS Solution Events
      • VS Build Events
      • VS RDT Events
      • VS Project Item Events
      • VS File Change Events

  • Configure:

    • VS Package
    • VS about/splash screens

  • Deploy:

    • Configure VS Package Load Key
    • Create VS Package Deployment Information

  • Test:

    • Create VS Package Load Key Report
    • Test VS Package Load Key
    • Test VS Splash Screen

  • Utility:

    • Register VS Packages
    • Unregister VS Packages
    • Refresh VS Package Registration Information
    • Launch VS on Experimental Hive

  • DSL authoring:

    • Templates transformation

  • Provides in-context guidance

VSIPFactory - A Software Factory for Visual Studio Extensibility

Microsoft ASP.NET Futures (May 2007) Available For Download

The Microsoft ASP.NET Futures May 2007 (“Futures”) release contains an early developer preview of features providing a wide range of new functionality for both ASP.NET and Silverlight™. The functionality in the Futures release includes early experimental versions of features currently being considered for future versions of ASP.NET and the .NET Framework. The Futures releases assume prior knowledge of the core features of ASP.NET including the previous ASP.NET AJAX Futures January CTP.

Features in this release include ASP.NET Silverlight server controls, new functionality for ASP.NET AJAX Extensions, dynamic data controls, enhancements to dynamic languages, and more.

Download it here:

Wednesday, May 16, 2007

Interview With SQL Server MVP Adam Machanic Author Of Expert SQL Server 2005 Development

Expert SQL Server 2005 DevelopmentI am a big fan of Adam Machanic and the way he thinks about SQL server development. How may SQL developers unit test their procedures or use assertions in their code? Well I can guarantee that there are very few of those. I was very excited when Adam Machanic contacted me to give me a copy of Expert SQL Server 2005 Development for review. I did not finish reading the whole book yet but what I have read so far is very good. If you are an advanced developer and want to kick it up a notch then this is the book for you.

The question-and-answer session with Adam that follows was conducted via email.

What is the audience for this book? Is the book geared towards a beginner/intermediate level user or do you have to be an advanced user to really utilize the information in this book?
The book is certainly not for beginners; I make a lot of assumptions about the level of knowledge possessed by the reader. The reader should understand the basics of writing T-SQL, creating indexes, reading query plans, etc. It's difficult to differentiate between intermediate and advanced users, as everyone has their own opinion of what those levels actually mean! I've covered several not-so-common topics, and my hope is that that almost any SQL Server practitioner who has advanced beyond the basics can learn something from the book.

What are the most important things a person can do to master Transact-SQL?
Practice, practice, and more practice! The more complex queries you write, and the greater the variety of problems you solve in T-SQL, the easier it gets. Just like other programming languages, T-SQL programmers use and reuse various patterns as they work on different projects and problems. Gaining skill in T-SQL is really nothing more than a process of learning when and how to properly apply the patterns to any given situation.

Adam, the first time I came across your name was in the Microsoft public SQL Server programming group. Can you explain to us why you participate in newsgroups and forums?
When I first started working with SQL Server and other Microsoft technologies I discovered Microsoft's news server and was shocked to discover the overall quality and high signal-to-noise ratio compared to many other (Usenet) newsgroups I'd previously frequented. Questions I asked were actually answered--by people who knew what they were talking about, no less! After spending quite some time asking my own questions I realized I could answer a few here and there too, and give something back to the community that had helped me so much. Over time I became hooked. What a great way to kill free time (especially while waiting for software to compile or long queries to run)--not only does it feel good to help others solve their problems, but it also helps to strengthen my skills as a developer. As I mentioned in the previous question, the most important key to software development greatness is practice. By answering newsgroup and forum posts, you can get exposure to all sorts of business problems and scenarios that you would otherwise never see. There is no better learning experience that I have found.

Why is it important to think in sets instead of procedurally?
It's often said that thinking in sets takes advantage of the declarative nature of SQL; and while this is certainly true I think it's important to drill down to why that's such a big deal. SQL query performance, generally speaking, comes down to I/O performance. Too many I/Os, or an I/O-bound system, and your query won't return fast enough--simple as that. When we write set-based queries, we allow the query engine to optimize in order to minimize the number of index requests--and, therefore, I/O operations--necessary to satisfy the query. Working procedurally, with loops, means that the opposite happens--the maximum number of index operations will happen on every invocation, and therefore the query will perform in constant time—at the worst possible level.

Why do you feel it is important to properly unit test procedures?
I cover unit testing in some detail in Chapter 2 of the book, including when and why you want to do it. But what it boils down to is that creating a solid unit test infrastructure helps to guarantee that as you change your code over time, you won't break anything--and if you do, you'll find out about it very quickly. Studies have shown that by far the most expensive part of the software development process is maintenance. This is due to the fact that as we change our software, we break other pieces (dependencies)--and oftentimes, those dependency breaks silently cause subtle issues, that aren't noticed until long after the change was actually made. This can make it extremely difficult to track down and fix the root causes of problems. Comprehensive unit testing makes it possible to eliminate a lot of that delay, by alerting the developer right away if something doesn't look good. This, in turn, results in better quality software, happier customers, more business, and as a result, bigger bonus checks. A win-win situation, if you ask me.

Which chapter was the hardest to write and can you explain why?
Chapter 10, "Working with Temporal Data," took me four months to write. It's my favorite chapter in the book, and one of my favorite topics to think about, but it covers a huge variety of scenarios. As I mention in the chapter, temporal data finds its way into every single database, so it's a large and far-reaching topic. Attempting to cover it in a fairly complete manner turned out to be quite a big task!

Why do you write technical books?
Mainly for the groupies. But aside from that obvious perk, I do it simply because I love sharing technology and techniques with others. Writing a book is similar to participating in a newsgroup or technical forum, but on a much deeper level. Whereas I might answer a question on a forum in 400 words, or write a 3,000-word article, in a book I can cover the same topic in 15,000 or more words--really guide the reader through all of the pitfalls and ins and outs of a given area, and do things that would be impossible in another media (except, perhaps, in a long series of blog posts or articles). Plus, let's be honest--it's just a real thrill seeing my name on the cover of a book!

Who are your favorite authors?
For technical titles, my favorites are Steve McConnell ("Code Complete," "Rapid Development"), Joe Celko ("SQL For Smarties" and others), and Andrew Troelsen ("Pro C# and the .NET Platform"). These authors manage to convey heavy technical topics in very readable formats--which is something I aspire to doing in my own writing.

Unfortunately, I haven't been reading much fiction recently. The last really great novel I read was "Cloud Atlas" by David Mitchell. I'm also a longtime fan of science fiction writers such as William Gibson ("Neuromancer") and Neil Stephenson ("Snow Crash," "Cryptonomicon").

I noticed you have a chapter that deals with application concurrency, do you feel that developers don't have a multi-user/multi-app mindset when first developing the data model/procedures?
With the recent trend towards multiprocessor and multicore machines, threading and synchronization have been hot topics. I've read lots of interviews and articles about how many developers don't understand multithreading well enough. Yet as database developers, I feel like we've been there for years--the database is almost always a shared resource, and managing synchronization is no less important there than in the application tier. A lot of the time we tend to think about concurrency merely in the context of isolation levels and the like, but there is a lot more to it than that--an application will often push much of its synchronization logic all the way into the data tier (whether on purpose or not), and how to properly handle things is really more of a business question than a technical one. When writing that chapter, I tried to frame the issues in terms of business requirements, and then show how to use SQL Server to satisfy them. I think that developers are sometimes prone to getting too excited about technology and trying to find a business problem to which they can apply some new technique--the whole "hammer looking for a nail" mentality--rather than the correct route of determining the business problem and then using technology to solve it.

What SQL Server books are on your bookshelf?
I've now gotten rid of most of my SQL Server 2000 books, except for Ken Henderson's Guru's Guide" series and Kalen Delaney's "Inside SQL Server 2000". My bookshelves (note the plural!) are filled with SQL Server 2005 books--for the first year or so after its release I managed to get almost every new book that was released. I eventually slowed down a bit, but it's hard--there is a lot of great material out there! I'm a really big fan of the "Rational Guides" -- short, concise, yet in-depth guides to just one topic, generally very well-written and easy to digest.

Why did you decide to include a chapter on spatial data?
Through nothing more than luck of the draw I ended up on a couple of projects involving heavy spatial queries, and found that it was an area I really enjoyed. I love to solve difficult problems, and since comparatively very few people are doing spatial in SQL Server, I found that there was a lot of room to innovate--so I ended up having a great time with these projects and totally got hooked. I feel that spatial data is an area we're going to see a lot more of in the future. Spatially-enabled devices are becoming more and more prevalent, and of course all of those devices are going to need data. Unfortunately, due to time constraints I was not able to write that chapter, so my friend Hugo Kornelis tackled it. Hugo did an absolutely fantastic job of covering the topic--I think it's a great chapter, and will help readers get right up to speed.

Are you still making your own beer?
I live in a fairly small apartment at the moment and am somewhat cramped for space as well as time, so I haven't brewed a batch beer for the last couple of years. However, I have been experimenting with ciders quite a bit, and have made a variety of batches using all sorts of adjuncts including honey, brown sugar, and malt extract. Cider is very forgiving and needs to sit around for a long time before it's drinkable, so it's easy to make in a small space with limited time. I've also made a few batches of ginger beer, using a recipe that we actually designed in an online SQL Server forum!
( )

Table Of Contents
CHAPTER 1 Software Development Methodologies for the Database World
CHAPTER 2 Testing Database Routines
CHAPTER 3 Errors and Exceptions
CHAPTER 4 Privilege and Authorization
CHAPTER 5 Encryption
CHAPTER 6 SQLCLR: Architecture and Design Considerations
CHAPTER 8 Designing Systems for Application Concurrency
CHAPTER 9 Working with Spatial Data
CHAPTER 10 Working with Temporal Data
CHAPTER 11 Trees, Hierarchies, and Graphs

Sample: Chapter: Ch. 01 - Software Development Methodologies for the Database World
Amazon Link: Expert SQL Server 2005 Development

Cross-posted from SQL Server Code,Tips and Tricks, Performance Tuning

Anonymous Types In Orcas Article

Anonymous types are a convenient language feature that enable developers to concisely define inline CLR types within code, without having to explicitly provide a formal class declaration of the type. Although they can be used in lots of scenarios, there are particularly useful when querying and transforming/shaping data with LINQ.

Scott Guthrie has a nice article on his blog that covers anonymous types

Here are the sections:
What are Anonymous Types
Anonymous Type Example
Understanding the Var Keyword
Declaring Anonymous Types
Using Anonymous Types for Hierarchical Shaping
Data Binding Anonymous Types

Read the article here:

Enable Ad Hoc Distributed Queries (OPENROWSET) On SQL Server 2005

By default Ad Hoc Distributed Queries are disabled on SQL server 2005

If you try to run OPENROWSET you will get this error message

Server: Msg 15281, Level 16, State 1, Line 1
SQL Server blocked access to STATEMENT 'OpenRowset/OpenDatasource' of component 'Ad Hoc Distributed Queries' because this component is turned off as part of the security configuration for this server. A system administrator can enable the use of 'Ad Hoc Distributed Queries' by using sp_configure. For more information about enabling 'Ad Hoc Distributed Queries', see "Surface Area Configuration" in SQL Server Books Online.

To enable it do this

EXECUTE sp_configure 'show advanced options', 1

EXECUTE sp_configure 'Ad Hoc Distributed Queries', '1'

EXECUTE sp_configure 'show advanced options', 0

Windows Longhorn Server becomes Windows Server 2008

At WinHEC 2007 in Los Angeles, Bill Gates announced the final name for what was previously known only as Windows Server codename "Longhorn." Windows Server 2008, which recently reached the Beta 3 milestone, is expected to ship before the end of the year.

You can download the Windows Server 2008 fact sheet from Microsoft PressPass and visit the newly branded Windows Server 2008 website for details. Also, check out the amusing "What’s in a name?" video too.

Sunday, May 13, 2007

List Of XAML Controls

Control Library
The Windows Presentation Foundation (WPF) control library contains information on the controls provided by Windows Presentation Foundation (WPF), listed alphabetically.
In This Section



Related Sections
Control Library Samples
Control Customization
Controls by Category
Content Models

Community Server 2007 SP1 - Available

Community Server 2007 SP1 - Available
You can grab it from the new store/download center.

Here is a quick run down of what has been fixed:

User Experience Improvements

  • Corrected width of modals in the Control Panel.
  • Updated Control Panel to hide Manage Licenses for non-admins
  • Updated "Default" theme comment styles to correct overflow styles.

Help text clean-up and Improvements

  • Fixed email template typo
  • Changed messaging for license restrictions on Points, IPBanning, Reporting
  • Missing Resource issue resolved on Blogs.aspx page.
  • Added XML Comments to Controls
Feature Enhancments and Bug Fixes/Updates
  • Updated folder line and icon URLs in the content selectors.
  • Updated avatar handler to support passing username on querystring to retrieve avatar
  • Updated ConfigurationForm to correct an issue that occurs when multiple appended/prepended tabs are defined.
  • Fixed issue with CA:Callback control
  • Fixed premature searching issue in the RelatedIndexPostList control.
  • Fixed searching issue where you couldn't search within a section
  • Fixed issue with how MailGateway stores and uses the encoding name on messages
  • Fixed issue with threading caused by not passing the post object when checking Reply permission for replies to a post
  • Fixed MailingLists object not setting the SettingsID
  • Fixed cs_system_SampleForum setting owner information, which throws off permission checks in MG for the admin user on the Sample Forum
  • Fixed: Admin & Anonymous user’s LoweredEmail was never set in CreateCommunity so some MembershipAPI lookups (FindByEmail) would never work
  • Fixed: Bad redirect from forum moderation “Approve & View”
  • Fixed: Duplicate key exception thrown for non-existent threads
  • Corrected rounding error when selecting colors using the ColorSelector.
  • Corrected russian language issues with the DateTimeSelector.
  • You can now approve a post that starts a thread and it will still be visible in the forum.
  • The mark as read button now only shows to those with permissions to view it (moderators) or thread authors whenever enable status tracking is enabled.
  • Changed TinyUrl HttpHandler away from using a 302 statuscode to redirect to a 301 to help SEO

Thursday, May 10, 2007

Podcast: Eric Evans on Domain Driven Design

DotNetRock has published their latest podcast; Eric Evans offers his insights on good software development using Domain Driven Design techniques.

Eric Evans is the author of Domain-Driven Design: Tackling Complexity in the Heart of Software. Since the early 1990s, he has worked on many projects developing large business systems with objects with many different approaches and many different outcomes. The book is a synthesis of that experience. It presents a system of modeling and design techniques that successful teams have used to align complex software systems with business needs and to keep projects agile as systems grow large. Eric now leads "Domain Language", a consulting group which coaches and trains teams applying domain-driven design, helping them to make their development work more productive and more valuable to their business.

Download the podcast here:

MIX07 Podcast: Peter Kellner and Elisa Johnson with Anand Iyer on Code Camps, Silverlight and Data Programmability

Peter Kellner, MVP, ASP.NET and Elisa Johnson, Microsoft Program Manager on the Data Programmability team, talk about MIX 07, Project Astoria and Project Jasper.

Listen to the podcast(MP3)

MIX07 Podcast – Jeff Atwood and Anand Iyer on MIX, Silverlight, Blogging and Trends

Anand Iyer catches up with Jeff Atwood of CodingHorror fame to talk about their experiences of MIX 07, Silverlight, Jeff’s work, blogging and current trends in academia with regards to computer science and technology.

Listen to the podcast(MP3)

Screencast: Extend your VBA with .NET

Visual Studio "Orcas" makes it very easy for your existing VBA solutions to call Visual Studio Tools for Office (VSTO) methods!

By setting the "EnableVbaCallers" and "ReferenceAssemblyFromVbaProject" project properties to TRUE, VSTO automatically adds the necessary code spit and references to your VBA project.

Then you're free to mix managed .NET code with VBA script! Preserve your investment in VBA and amaze your friends as you effortlessly call VSTO using VBA's IntelliSense.

Join Eric Schnepp, Principal Program Manager in the VSTO team in this screencast to see how it all works.

Length: 8:08
Watch the screencast(WMV)

Wednesday, May 9, 2007

Video: Meet the Project Jasper Team

Project Jasper is geared toward iterative and agile development. You can start interacting with the data in your database without having to create mapping files or define classes. You can build user interfaces by naming controls according to your model without worrying about binding code. In this interview Shyam Pather, Carl Perry, Andrew Conrad and Jeff Derstadt, go deep whiteboarding and demoing Jasper.

Media Length: 00:39:31
Download the Video
Watch the Video

Podcast: Review of Windows Server Longhorn Beta 3 Product/Workload Scenarios

Listen in as David Lowe, Senior Product Manager for Windows Server, and Matt Hester discuss how Windows Server “Longhorn” has been designed around server roles and workloads that meet customers’ needs. Get an understanding of how roles map to workloads, how workloads combine to deliver clear value in specific customer scenarios and why we have chosen certain high-priority scenarios as the focus for our launch. Plus we have the monthly segment with Kai Axford and Mark Griesi from the Security Response Team, discussing the May Security Updates.

Eric Ostrowski – Your Show Host and TechNet Radio Producer
Aurora Queen – TechNet Content Manager
Matt Hester – IT Pro Evangelist
David Lowe – David Lowe is Senior Product Manager for Windows Server with Microsoft Corporation. In this role, he coordinates worldwide launch activities for the next major version of Windows Server, code-named “Longhorn”, and works with customers on pre-release deployment planning and readiness. David has been with Microsoft since 2001, and in this time he has also been Senior Product Manager for Security and IT Professional portfolios with Microsoft Learning. Prior to joining Microsoft, David was Senior Lecturer in Internet Technologies at the Centre for Advanced Technology Training in Dublin, Ireland, where he specialized in Web development and XML. David holds a Bachelor of Science degree from University College, Dublin, and he is the author of BizTalk Server: The Complete Reference, published by Osborne-McGraw Hill.

Media Length: 42:29
Listen to the podcast(MP3)
Listen to the podcast(WMA)

Tuesday, May 8, 2007

Podcast: David Barkol, Alessandro Gallo, and Rama Krishna Vavilala On Ajax.Net

DotNetRocks has published their latest podcast: Barkol, Gallo, and Vavilalla on ASP.NET AJAX

David Barkol, Alessandro Gallo, and Rama Krishna Vavilala talk about ASP.NET AJAX, and their upcoming book ASP.NET AJAX in Action from Manning Publications.

David Barkol is a Principal Consultant for Neudesic, one of Microsoft’s leading .NET professional service firms and a Gold Certified Partner. At Neudesic, David specializes in providing custom .NET solutions that leverage technologies such as ASP.NET, Web Services, Windows Forms, SQL Server and C#. A frequent speaker at code camps and .NET user groups in Southern California, David is also one of the authors for the upcoming book ASP.NET AJAX In Action. An MCSD in .NET and avid urban hang glider, David resides in tropical La Palma, CA with his wife Emily and two daughters Miranda and Madeline. His blog can be found at

Alessandro "Garbin" Gallo is a Microsoft MVP in the Visual ASP/ASP.NET category and has been an active contributor for the Ajax Control Toolkit project. As a .NET developer/consultant with a primary focus on ASP.NET application design and development, Alessandro has been developing with ASP.NET AJAX since the very first CTP. Notably, he won the Grand Prize at the Mash-it-up with ASP.NET AJAX contest held by Microsoft in 2006.

Rama Krishna Vavilala is a senior software developer/architect at 3C Software, a leading supplier of Cost Management Solutions. He has designed and developed three different versions of Impact:ECS™ (3C Software's product suite). Currently, he is designing an Ajax-based web application using ASP.NET AJAX. This application will be a part of the Impact:ECS™ suite. He is a regular contributor at The Code Project and has contributed around 20 articles on wide ranging subjects

Download the podcast available in a variety of formats here:

Screencast: Windows CardSpace in One Minute

Channel 9 has published their lastest screencast: Windows CardSpace in One Minute

"This demo shows the Windows CardSpace user experience in IE7 and FireFox. It only takes a minute* so anyone can see what's involved without having to become a world expert in Identity (although you may be tempted). This is a technology that everyone can, and will, benefit from."

Download it here:

Monday, May 7, 2007

Video: Astoria Data Services

Channel 9 has their latest video up on their site

"Meet Pablo Castro one of the folks behind Astoria. Astoria exposes "data services" that enable applications to access and manipulate data over regular HTTP connections, using URIs to identify pieces of information within the data service, and simple payload formats such as XML and JSON to represent the data exchanged between the client and the server. In this interview Pablo goes deep whiteboarding out Astoria. If you want to go even further on Astoria check out Pablo's session from Mix."

Download the video here:

Grant EXECUTE/SELECT Permissions For All User Defined Functions To A User

You want to create a new user with read and write access who also has ability to execute all user defined functions but you don't want to make the user a db_owner. The code below will do a GRANT EXECUTE/SELECT for all the user defined functions in the DB If the user defined function is a table-valued function then you need to grant select permissions otherwise you need to grant execute permissions

Right now this code will print the GRANT EXECUTE/SELECT statements, change the PRINT to EXEC if you want it to be done automatically

--Grab all the functions for the current DB
INTO #FunctionList

@Loopid INT,
@MaxId INT,
@UserName VARCHAR(50)

--This is the user that will get the execute/select permissions
SELECT @UserName = 'SomeUser'

--Grab start and end values for the loop
SELECT @Loopid = 1,
@MaxId = MAX(ID)
FROM #FunctionList

@ProcName VARCHAR(400) ,
@Permission VARCHAR(20),
@DataType VARCHAR(20)

--This is where the loop starts
WHILE @Loopid <= @MaxId BEGIN

--grab the function name and type
FROM #FunctionList
WHERE ID = @Loopid

--Find out if it's a table-valued function
IF @DataType ='TABLE'
SELECT @Permission ='SELECT'
SELECT @Permission ='EXECUTE'

--construct the statement
SELECT @SQL = 'GRANT ' + @Permission +' ON [' + @ProcName + '] TO ' + @UserName
PRINT (@SQL) --change PRINT to EXECUTE if you want it to run automatically

--increment counter
SET @Loopid = @Loopid + 1

--clean up
DROP TABLE #FunctionList