From time to time I see posts about removing the use of lock() from producer/consumer queues where the number of threads operating are limited. This is an exploration into writing such a queue, the techniques used, and how to create the thread interactions without the use of locks. Step 1 – Building the first thing [...]
Ran across this SO post: http://stackoverflow.com/questions/652788 and in the top answer was a complete gem. Apparently this guy would sporadically… … exit from his chair to do a quick ten pushups. He explained this last one as “Compiler found error in code. This is punishment” Damn, I should have thought about that years ago. If [...]
Just published the latest release v1.10.1124.358 of the C# Library hosted on google code. Major new functionality in the form of the new assembly CSharpTest.Net.RpcLibrary. This library wraps PInvoke calls to the Win32 RPC APIs. This allows pure managed C# applications the ability to move byte arrays over the supported rpc protocols. The following is [...]
Changes in this release: Added CSharpTest.Net.Generators.exe to integrate with the CmdTool’s VS integration: Provides ResX loose-typed string formatting via simply using “{0}” in a resource string. Provides ResX strong-typed string formatting via resource names like “Name(string x)” Adds exception generation to resources via names like “NameException” Exceptions can be derived from explicit type via comments: [...]
So first off this is not new, it’s been around for a long, long while. One issue I have with IDisposable is that for whatever reason .Net did not include a base class for handling the details… I admit you may not always be able to leverage it since you may have a base class, [...]
This one is actually something of a triviality, yet it can be very useful at times. Now a word of caution is due here, this object is built on System.Threading.Timer and should not be used to enqueue 12 million work items. Yet if you need to perform a simple task at some time in the [...]
Changes in this version: Added CmdTool.exe – the last Visual Studio code generator you’ll ever need :) Code generation made easy, just write a command line tool. No shutting down Visual Studio when you change your code generation tool. Integrates with Visual Studio 2005, 2008, or 2010. Displays console output in Visual Studio’s output window. [...]
Most people I’ve seen online compute a simple hash of password + salt for persistence and authentication. This is the accepted standard in a straight-forward solution: byte[] Hash(string password) { byte[] pass = System.Text.Encoding.UTF8.GetBytes(password); //Create the salt to use byte[] salt = new byte[32]; new RNGCryptoServiceProvider().GetBytes(salt); //Create the hash of password and salt HashAlgorithm hashAlgo [...]
So recently I’ve been working heavily with some of the cryptography stuff in .Net and adding a large amount of it to my open source library. One of the many things I needed to perform was simply encrypting and decrypting a piece of data with a password. It seems everyone out there is using Rfc2898DeriveBytes [...]
Changes in this version: Library.Crypto namespace was added with a fairly complete cryptography API (at least what I needed) including: Added Library.Crypto.WhirlpoolManaged a managed implementation of the whirlpool hash function. Added Library.Crypto.Password to wrap up the complexities of using a password for authentication and/or encryption. Library.IO namespace was added to include several new stream derivations [...]