Aha Moments

by Codewiz51 23. April 2013 19:00

I was working on a side project to remove http post operations to a web service and replace it with a proxy component.  Easy right?  I thought it would be.  But the service I was looking at didn't utilize a WSDL or SOAP.  And Visual Studio 2008 doesn't like that when you set up a service reference. So, I had to look at writing my own proxy.  Not so easy, but doable.  The real issue is that the group that writes the web services uses VS 2012 and .Net 4.0.  The group I work in uses VS 2008 and .Net 2.0 (when we actually use .Net.)  These two don't play well together when you need to create references.

It took me a little while to realize the dll's the dev had sent me were targeted at .Net 4.0, and the best I could do was target .Net 3.5.  Goodbye project references.  (Except, a little magic with managed C++ might do the trick. Surprised I'll discuss that in another post.)

"Best laid plans of mice and men" and all that other rot that doesn't really help solve the problem.

Tags: , ,

Programming

Piddling around with JavaScript/Browser Performance

by Codewiz51 20. April 2013 08:07

Here's some results I got while piddling around with webkit's SunSpider benchmark program this morning.

It's not scientific, or even well controlled.  I'm using the latest updates for IE 10, Chrome and Firefox as of April 20.  Links will take you back to the test results.  My laptop is an old dual core machine running Windows 8 64bit, 8GB RAM and a slow 500 GB hard drive.

IE10 - 203.5 ms

Chrome - 280.9 ms

FireFox - 310.9 ms

 Just some food for controversy. Yell

Tags: , , , ,

Life | Programming

Document Your Code

by Codewiz51 18. April 2013 06:17

I've heard just about every excuse in the world why code is not documented.  The excuses are bogus. All of them.  Documentation must be a part of the corporate culture.  Most organizations do not understand the need for effective code documentation.  There's no training, no policy and no will to make it happen.

Ignoring documentation at the code level, the application level and the infrastructure level leads to another form of technical debt. An organization that ignores documentation, doesn't train personnel to develop it and doesn't incorporate it into their culture is living for today.

This is one of the better articles I've found on the internet regarding the mechanics of .Net program documentation using Sandcastle.  It's long, detailed, and effective.  You should read it.

Tags: , ,

Programming

C++ is a tolerant language

by Codewiz51 14. April 2013 21:18

Every C++ dev knows a java coder.  We're friendly to show we're tolerant. Surprised

Tags: ,

Programming

Passing parameters to and from dynamic queries

by Codewiz51 26. February 2013 19:54

I had a most interesting experience today.  I've been assigned to correct and improve an SQL procedure that was performing poorly during a critical holiday period.

The queries contained in the procedure had been transformed to dynamic queries in order to handle linked servers based on vendor type and geography.  From the start, it was apparent that the original author did not understand how to pass parameters to and from parameterized queries.  Instead, the transformed queries inserted records into a table var for later recovery.

Well, there is an excellent mechanism for passing parameters to dynamic SQL using sp_executesql. A quick check of MDSN presents several excellent examples.  Here's my rendition of the problem.

DECLARE @sqlCommand nvarchar(1000)

DECLARE @campgn1 varchar(20)

declare @startdate datetime

declare @campgnname varchar(50)

SET @campgn1 = 'ABC1234'

SET @sqlCommand =  'SELECT @stdt=startdate, @cname=campaignname FROM ' + @linkserver + '.' + @targetdb + '.dbo.mktcampaign WHERE campaigncode = @campgncode' 

EXECUTE sp_executesql @sqlCommand, N'@campgncode nvarchar(20), @stdt datetime output, @cname varchar(50) OUTPUT' , @campgncode=@campgn11, @stdt=@startdate OUTPUT, @cname=@campgnname OUTPUT

select @startdate as [Start Date], @campgnname as [Campaign Name]

As you can see, it's pretty simple to pass parameters into and out of dynamic sql using sp_executesql.

Tags: , ,

Programming

Disclaimer

This blog represents my personal hobby, observations and views. It does not represent the views of my employer, clients, especially my wife, children, in-laws, clergy, the dog, the cat or my daughter's horse. In fact, I am not even sure it represents my views when I take the time to reread postings.  So, take most of what I say with a grain of salt.

© Copyright 2008-2014