a c# strong naming conundrum
by Geoff on Apr.17, 2012, under c#, Coding
As we all know by now, Strong Naming is good. It lets your clients know that your code is yours and they can trust it. From a developer stance however, Strong Naming can be a hurdle at times.
There are a few ways to accomplish Strong Naming in a windows development environment. The one we use at my company is through Visual Studio under the Signing tab. Pretty simple, really. Check the box, assign the pfx and give it a password. Honestly it is cake.
What about debugging against Strongly Named services? Well, in short, you can't debug Strongly Named services unless you exclude them from verification checking. Windows gets upset if you don't exclude them. Unsigned code cannot talk to signed code. They must match unless, as a I said, you exclude them from verification.
I wrote a little powershell combined with a DOS call in order to allow me to debug my companies Strongly Named assemblies.
In order to find all of the assemblies that are in my project, I run a little powershell script which uses a few directory variables. This example only deals with the executable files. I have other versions of this that handle the .dll files. Just change the *.exe to *.dll and you are set.
$projectpath = root_location_of_project_files
Get-ChildItem -Path $projectpath -Recurse -include *.exe |
ForEach-Object {
#Write-Host $_.FullName
sn -T $_.FullName
#sn -Vr $_.FullName
}
The powershell above will spit out the publickeytokens for each file. Most likely they will all be the same when you are dealing with your own code but it could be that you have more than one publickeytoken to handle with the script below. The next script will need to be run in a Windows SDK Command Window with Elevated Permissions. You need the elevation because the strong naming application will make a modification to the registry.
sn -Vr *,publickeytoken
The key benefit to this in development is being able to debug strongly named applications and services.
Chevy Volt April 2012 Onstar Report
by Geoff on Apr.17, 2012, under Volt
April's OnStar Volt Report includes a trip to St.Louis!
Our Chevy Volt continues to impress and enforce that it was a good decision.
Kill All Users in a given Database
by Geoff on Apr.17, 2012, under Coding, SQL
Have you ever been trying to run a SQL Restore and found that a user was blocking you? Want an easy and impolite way to bounce them immediately?
-- Get rid of all DB users use master alter database DATABASE1 set offline with rollback immediate
-- Bring DB back online in single user mode, and connect to DB alter database DATABASE1 set online, single_user with rollback immediate use DATABASE1
-- restore database here
-- Return DB to multi user mode use master alter database DATABASE1 set multi_user with rollback immediate
Chevy Volt March 2012 Onstar Report
by Geoff on Mar.28, 2012, under Volt
Comments Off :chevy volt, efficiency, ev, onstar, volt more...the Chevy Volt - a prelude to spring
by Geoff on Mar.28, 2012, under Coding, Volt
We bought our Volt to be a commuter car with the added benefit of being able to drive long distances when we wanted. I know, that sounds like the commercial. But, in reality, that is the way to use the Volt. I drive less than 10 miles to work each morning and conquer trips to the grocery, hardware store and nerd store during the day. The Volt fits perfectly into that. I would suspect if we didn't live so close to work, I would have a different opinion.
For the pure gasoline drivers out there, the Volt is sitting at a lifetime of 119 mpg presently. On the current fill up, it has gone 2200+ miles and used 4.8 gallons of gasoline. I am certain you are asking about cost of electricity. We spend roughing $25 a month for the car's charging. That is not an exaggeration. $25 a month.
I would strongly suggest the Volt for anyone who travels less than 40 miles round trip to work or for someone who works from home.


