Showing posts with label Programming. Show all posts
Showing posts with label Programming. Show all posts

Monday, May 18, 2009

nunit and VS2008

I’ve recently started using NUnit on some of my side projects, and the one frustrating thing has been the lack of ability to debug the unit tests. 

I know, I can see the “run” external app on the unit test project to point to the nunit directory, or I can run nunit, manually attach to process, etc.  But those seem kinda hacky.  Or I could shell out money for other solutions.

Well, codeplex has once again saved the day:

 

NUnitit is a project that adds a new tools menu that will allow you to debug VS projects in NUnit without having to set the execute remote, or attach process.  It in will auto detect the NUnit install, so if you have NUnit installed in a different directory, you’ll still be fine.  And you aren’t forced to always use NUnit.  You can set your projects up for MSTest and NUnit and be able to debug both.  I hope it’s

Monday, June 4, 2007

Could not find resource assembly

I'm currently working on PDA app for our inventory program. I'm tweaking the program to point to a different webservice.

After deploying the app to the PDA, it started the connection to the webservice, when the following error popped up:

Could not find resource assembly

Hmmm. . . After some researching I found an msdn blog that mentioned that this error isn't an error that occurs in the apps resource assembly, but because the PDA does't have the resource assembly that contains the error codes that are used for display.

The blog contained a link to msdn to read through the issue, but alas, that pointed to a File Not Found error on the msdn. Oh well.

After searching, you need to copy the System_SR_enu.cab file to your PDA and install it.

Once I did that, the correct error message appeared and I moved on to debugging it. yeah!

Tuesday, May 22, 2007

SSIS: Flat File Connection Manager gotchyas

So my latest issue with SSIS: The Flat File Connection Manager.

Everything works fine, unless you want to add or remove a column from the source that the manager is connected to. Normally, with the other managers, etc. They pick up the change, or let you "fix" the change. Not with the Flat File Connection manager.

From what I've been able to find, you have to delete the manager, recreate it, and re-assign it to your flat file destination in order to "pick up" that extra column that you wanted. I use the flat file only for debugging the output of my package, before actually updating the database itself. Handy, except for that pesky issue. If I click the reset columns, I would expect to have the columns reset to the input. Nope, everything goes blank and you have to either delete the manager or hand enter the columns. Yikes!

Oh yeah, one more gotcha: if you run it without column headings check for the first row, then decide that you really want them, be sure to delete the files first, or you'll get really hosed.

Pretty much you'll be forced to delete the manager and recreate it.

Wednesday, May 16, 2007

SSIS packages and Variables

Today, I spent most of the day trying to figure out why the following:
(this is inside of an SSIS package, not just a query)

select * from foo where foodate >= getdate()- ?
where the variable for the data is set to 2.

And the package really did not like when I tried to do the following:
select * from foo where foodate>= dateadd(d,?,getdate) and used a -2 for the value. That time it threw all kinds of errors.

If I hard coded the number in, it returned the data that I wanted, but if I left it as a package variable nothing would work.

In the end I had to create a stored procedure passing the variable as a parameter in the SSIS package, and then things worked fine.

Oh well.

Note: Hopefully soon, I'll get several posts about how to from start to finish get a SSIS package running in Sql Server 2005.

Tuesday, May 8, 2007

VMWare Ctrl-Alt-Del

For those of you out there using VMWare, and are frustrated with the whole Ctrl-Alt-Del popping up the message that "VMWare has detected you pressed Ctrl-Alt-Del...." when you lock your host machine, I've found the answer. It appears that in VMWare workstation you can set a flag to ignore that.

Add to the file Buried in C:\Documents and Settings\All Users\Application Data\VMware\VMware Server\config.ini the following:

mks.ctlAltDel.ignore = "TRUE"

and it'll ignore when ever you press control alt delete keys. Yeah! no more popups. For me, this has been working on VMWare Server 1.0.1 and since, and it's universal to every one on the computer.

Wednesday, May 2, 2007

Converting a Column to a delimited string

Well, after a good bit of searching, I found a couple ways to convert a column of data to a delimited string. It's actually not too bad.

DECLARE @p_str VARCHAR(2000)
SET @p_str = ''
SELECT @p_str = CAST(O.OrderID AS NVARCHAR(6)) + ',' + @p_str
FROM (select OrderID
from Orders
where CustomerNumber = @CustomerNumber
) O


You have to set the @p_str to '' or it'll return a null. The other thing is that this method ends with a , that you may or may not have to trim.

The other method is this:

DECLARE @p_str VARCHAR(2000)
SELECT @p_str = COALESCE(@p_str + ', ', '') + CAST(OrderID AS varchar(5))
FROM Orders
WHERE CustomerNumber = @CustomerNumber

The second method does not need to have the @p_str set to '', and it doesn't end with a comma. So in the end, the second is probably the better method.