Month: November 2009

MVC Development: Remember to Unblock the Moq!

If any of you are doing ASP.NET MVC development right now and are really into doing TDD then more than likely you are using Moq as one of your flavors of mocking libraries. If not then I would advise you to at least give it some consideration as it was built from the ground up with .NET in mind. You can get the library for download from : http://code.google.com/p/moq/ Now when you unzip Moq a common scenario is that the first time you try to run anything test-wise with Moq you will get an error telling you that blah-blah directory is not trusted…blah-blah…came from another machine..blah-blah..I want to protect myself from you evil programmers.. So you have to remember to go into the directory where the Moq dll that you are referencing resides ..Right Click and click the Unblock button as shown below.. Unhappy Moq.dll 🙁 Happy Moq.dll 🙂 Happy Moq’ing everyone! Cheers, AJ Technorati Tags: moq,mvc.asp.net,programming,mocking...

Read More

SSIS Hints: Getting a Row Count within the Data Flow

One of the main hindrances of the RowCount component in SSIS is that the variable that stores the row count is not updated till the data flow component has finished processing. What if you need to have the row count within the data flow component? I ran into this exact problem when I had to utilize an API for a third party CRM implementation that required me to get IDs for new contacts through a process that wanted me to tell it how many IDs I would need up front. I could have accomplished this by merely requesting 1 ID at a time but this proved to be much too slow..not SSIS’s fault but the API 🙂 . So are you just hosed then? Of course not! You just need to understand why the RowCount component does what it does. The RowCount component does not update the variable until the end because it has no idea when it is coming to the end of the data stream….and what if another component asked for the row count before it had completed counting all the rows? Total disaster! However, we know that we could instead just use a custom script component to run through the rows and count them for us. That takes care of problem #1..Now we have a variable that is filled as it is being counted…. Now for...

Read More

T-SQL: Padding Values

Sometimes its the simple things that really irritate you as a DBA. Case in point is the lack of a LPAD, RPAD functionality in T-SQL. What makes it slightly more inconvenient is that there is similarly no LEFT and RIGHT functions to compliment the SUBSTRING function. These string functions often come in handy when integrating values between different systems. You might come across situations in which different systems may be referring to possibly the same account number but in a slightly different way such as one being padded with zeros. System #1:  0012345 System #2: 12345 Additionally, in integration project it becomes necessary to handle null values. A lot of the time it is not necessarily that there is no data but maybe a key data field is left unpopulated …such as an SSN. For these generally, you would want to replace the NULL value with something more significant like UNKXXXXXX. Without a good LPAD function it becomes annoying to left pad the number in the above case with zeros. So how do you do it? Well, one method that I like to use involves using the REPLICATE function. The REPLICATE function takes a character value and simply copies it N number of times. The syntax is below.. REPLICATE(‘<character value>’, <number of times to copy>) So if we were to want to pad out account number example above to...

Read More

2009 PASS Board of Directors Elections

** Disclaimer: I wrote this at 12:58 Saturday Morning. So all bets are off to an overly intelligent argument. Just my thoughts on it all. At least, it shows how passionate I am about the community.   Well, lucky ..lucky me.. in the aspect that I had looked over the board of directors election application a few months ago and was actually asked by a couple of people to throw my hat in the ring because they thought I fit the bill. So my employer backed me in submitting my application and I went ahead to fill it out….got lucky enough to be interviewed…and didn’t make the cut. No biggie. Now a couple of weeks later I get to the SQL Saturday in Louisville only to find out, (excuse: I have been in a big time rollout of code for the past couple weeks), that there is some controversy that has been brewing. So after having some people vent to me over the last week, I copped to being involved in the process , read some of the blogs, and thought it would be a decent opportunity to throw my 2 cents into the ring. Especially, since there has been an abundance of thought on several topics that are relevant… Directors Litmus Test Poor Andy Leonard has taken a beating on his post for a couple of days now....

Read More