RefCardz - great first stop
Here is a
nice link that
holds a lot of interesting
RefCards. On
quite different subject also (C#, Ruby, SOA etc.).
Found use of it several times already. Thanks Patrik for the tip.
Read More
NMock2 RemotingException ByRef value type parameter cannot be null
OK this might be the most misleading error message I’ve seen. I
cannot decide on how to describe it… What this means… or what this
try to …
Actually this happens when one of your mocked objects is mocking a
method that returns something and your mocking doesn’t return anything.
Eeeeh - that was quite tricky. Got it?
Here is an example:
When I mock this method:
Public Class FacadeObject
Function CreateSomeThing(ByVal aName As String) As Long
End Function
End Class
by using the following code to do the
mock
Expect.Once.On(m_mockadFacadeObject).Method("CreateSomeThing")
an exception of RemotingException (ByRef value type parameter cannot be
null) will be thrown.
Here is another description that you might find easier to
understand
Read More
Update AppSettings with XmlUpdate in build scripts
I know I will chase this one for ever if I don’t put it up here…
We ran into a situation where we needed to tweak the AppSettings-section
of an configuration before tests in the build script.
Luckily there is help to be found. With the XmlUpdate-task (in the
MSBuild
Community Tasks) this can be accomplished. IF you know how to write
the XPath-query.
Here is how (found it here):
<XmlUpdate
Namespace=”http://schemas.microsoft.com/.NetConfiguration/v2.0”
XmlFileName=”$(SourceDir)\Core\ABSuite\ABClient\App.config”
Xpath=”//configuration/appSettings/add[@key=’Main.ConnectionString’]/@value”
Value=”$(DatabaseConnectionString)”
/>
Also here is a great site to pick up some
XPath-skills.
Read More
How to read other exe's config
When we’re doing integration tests we need to find some settings from
the exe (yes, we’re batching some stuff - I am sorry ;)) that we are
testing.
Instead of copying it into the test app.config I discovered a way to
read another exe’s configuration - OpenMappedExeConfiguration.
Very useful if a tad … ugly maybe.
Read More
ASP.NET MVC Storefront
I have been watching the first three in this
series
and not only are they a great introduction to ASP.NET
MVC, they also introduce
TDD in a very methodical and nice
way.
Follow along here -
http://www.asp.net/learn/mvc-videos/#MVCStorefrontStarterKit
Read More
Custom tool warning cannot import wsdl:portType
I chased this bug for a while - more and more frustrated… This was what happened: I updated a WCF Service Reference and got this error (or actually warning) in the Error List of Visual Studio. Also I saw that the Reference.vb was totally empty. OK - after some trying of my own (why do I do that over and over? Don’t think - steal from others…) I though of searching the Net and of course found the answer in five seconds. Here is a guy that solved it - but the header and description of the post is quite different so I’ll try to give my own explanation here. In the Configure Service Reference… dialog box there is an option “Reuse types in referenced assemblies”. Exactly what that means is hard to grasp (<a href=”http://www.google.com/search?hl=en&q=” data-reuse+types+in+referenced+assemblies”&meta=” target=” data-_blank”=”“>just try for yourselves</a>) - but I understand it as the tool...
Read More
WCF with handcrafted WSDL generated no FaultExceptions
This is problem that has haunted us for the good part of the autumn and winter; early on in our design process we chose to create the WSDL for our services by hand. This decision mainly had to do with that you can express stuff in XSD that WCF-attributes doesn’t support, such as string length etc. Also we were using the ErrorHandlerAttribute found in the excellent book “Programming WCF Services” by Juwal Löwy. What we saw was that even though we had created the wsdl for handling the fault and their details correct, we didn’t get the details over to the client (that is the T of FaultException<T>). We checked the wsdl and the generated client proxy (and it’s wsdl) file over and over, and line by line but just couldn’t find it. And finally it dawned on us… It was Mr Löwy’s fault ;). Seriously - it was the...
Read More
2008 - another great year
To sum up 2008 is not very hard for me - it starts and ends with Abbe (Albert). He was almost a part of our lives at the start of 2008 since he took up considerable space in Elin’s belly. :) He went from: to: In work I don’t think I ever learned so much in one year (TFS, SOA, MSBuild, WCF, Oracle just to mention a few things I have touched during the year). But it come to a cost - where I also lost my ability to leave work at work when I go home. I’ll try to improve that next year - which won’t be hard since I will be home with Abbe for about six months. With the Vasa Band it was also a great year with the recording and release of our CD Priority and a tour of the western parts of Sweden. On top...
Read More
About this blog
Lately I have been asked the question why I have this blog, several times actually. I honestly thought that I wrote that in the first posting I did, but it was very short. Not even when I change into www.marcusoft.net I wrote something about it. But the reason for the blog is, and has always been this simple: I write about things that interest me and when they catches my attention. For several years I did notes in diffrent kind of notebooks at different customers. Always forgot them when I left. So now I have them in one place. I often link to the blog for solutions to problems I have and solve. I then and then write about private stuff also, in the same manner - when it feels good. I write in english to keep my english up to date. So there you have - the reason for...
Read More
Compress a string with zip
[UPDATE START] We found a nasty performance bug in the code below. The DeCompress-method copies a string for each turn in the loop. That is a classic problem that creates a new copy of the string for each row. That became a major problem for a 3.8 Mb string… I have now updated the code to use the System.Text.StringBuilder object instead. That took down the speed to about a tenth. Sorry that I didn’t catch that… [UPDATED STOP] We had a quite special need the other day; we wanted to compress a part of our request, namely a XML-string that was sent to us. Most of the examples I found on the net showed how to compress the content of a file. But here is the code that compress a string. The code uses ICSharpCode.SharpZipLib. Here you go: /// <summary> /// Compress strings with ICSharpCode.SharpZipLib /// </summary> public class StringZipper...
Read More