Sunday, March 15, 2009

unable to find manifest signing certificate in the certificate store

I got this sweet error on my build server today, shortly after enabling signing of my project. I saw many different solutions on the web for this, but most of them involved removing the signature from the project, which I did not want to do. In the end, I ended up installing visual studio express on my build machine and opened up the project. What finally fixed it was going to my project properties -> signing tab, clicked the 'select from file...' button, browsed to my strong name key, and hit OK. Here it asked me for my password on the file (which I may have gotten wrong on the first build on this machine), I entered that, and then it was happy. I assume this action put the certificate into my store as it was building it fine after that.

Thursday, March 12, 2009

LINQ passing query results

Wow, first off, I need a better way to post code to the blog. I noticed this guy has rigged up a way and I will give it a try when I have some time: Please make a note blog
In the meantime I put my code snippet as a crappy image. The problem that I had being a fairly new Linq user was, what if I want to pass the results of a LINQ query to another method, or based on some logic in an if statement, do something different for the query, how can I declare it so I can pass it or use it and assign it based on logic. I found that in the case where I know what I am getting back from my query, then I can declare an Ienumerable of my type and assign it or pass it as I please. In this case I had a query return squares in a sudoku puzzle. You can see below how to declare and then assign the results of one of two linq queries.

Wednesday, March 11, 2009

SSPI Handshake errors

My initial purpose for this blog was to post things that caused me trouble at work that I could not find answers to what I was looking for on google. One of the things that has cropped up lately is some SSPI handshake errors for users connecting to a central SQL Server. The first most obvious cause of this that I have found is when a user has a basic change in their active directory user account. Sometimes their account gets locked out from too many failed password attempts or they change their password, and until this replicates to all sites, they can get handshake errors. Failing that the event log usually shows evidence of issues communicating with servers in regards to these issues. The best resource I have found when troubleshooting this issue is the sql protocols blog. There is one specific page that I can't seem to find again that has several different scenarios where this can occur and how to troubleshoot it. I think one of the keys to this is understanding Kerberos.

The ultimate brownies?

Totally off topic here, but..... I have been looking for a brownie recipe that is nice and chewy and moist just like Betty Crocker. The only difference is that I want to make them myself because they taste better when you make them. Anyone know how to nail these down like Betty? Mine keep ending up like hard plates.

Sunday, March 1, 2009

WCF Host and Client in same assembly

A few weeks ago I decided to write a networked, multi-player version of Sudoku. One of the first things I had to decide to tackle was how the client and server should communicate. I had done something similar in the .net framework 1.1 using sockets and that was my first thought, however I had heard of .NET remoting and thought that was worth looking into. After some research, I found that the most current practice for client/server communication was to use WCF, part of the .NET Framework 3.0 and thereafter. I could not believe how simple this ended up being, and it broke down to a few lines of code in the end. First I had to put this section in my app.config:


















For service name I just put the name of my class with the namespace, I gave the name of the service the same name as my class, and as my contract, I created an interface that has to be present in the server and client, but in my case my assembly could be either. The interface just specified which methods could be called on my server class, and then my server class just implemented that interface. For the server I added a thread to my user interface and when a user chose to host a game it just did this:

mHostThread = New Threading.Thread(AddressOf StartHost)
mHostThread.Start()

And startHost simply did this:

mPuzzleHost = New ServiceHost(GetType(PuzzleServer))
mPuzzleHost.Open()

Having this in a thread allowed the person hosting the game to also join as a client. Then to join the game (server) as client all I had to do was this:

Dim puzzleFactory As ChannelFactory(Of IPuzzleServer) = New ChannelFactory(Of IPuzzleServer)("PuzzleServer")
puzzleFactory.Endpoint.Address = New System.ServiceModel.EndpointAddress("net.tcp://" & frm.IP & ":3315/PuzzleServer")

Try
mPuzzleProxy = puzzleFactory.CreateChannel
mPlayerId = mPuzzleProxy.JoinGame(frm.PlayerName, frm.PlayerColor)
Catch ex As Exception
MessageBox.Show("Could not connect to host '" & frm.IP & "'. Reason: " & ex.Message)
Exit Sub
End Try

I hope that makes sense, if you have any questions feel free to email me.

Friday, February 27, 2009

It's on

Thats right, it's on, here it is...