sanity-free.com
Sanity Free Coding - C#, .NET, PHP
http://www.sanity-free.com/section11.html
Methods to the Madness. January 26, 2007. Phalanger, PHP for .NET. I ran across an article on the code project. About a PHP compiler / language extension for .NET. PHP has an extension for .NET that allows you to use .NET resources in PHP code, but this allows you to use PHP from .NET, with support for native PHP API's as well as managed compilation. This project may end up making my article on nusoap and C#. Obsolete, though it should make writing web services in PHP as easy as it is in C#. July 29, 2006.
sanity-free.com
Creating Fake Enums - Sanity Free Coding - C#, .NET, PHP
http://www.sanity-free.com/140/creating_fake_enums.html
Methods to the Madness. April 4, 2007. Or give it additional functionality or meta data. Yesterday at work we ran across a case where being able to extend an enum was mandatory. All of our enums have numeric and string values, and are typically written like:. One = 1, [ FriendlyName. Two = 2, [ FriendlyName. Three = 3 }. Here's the code I came up with:. System.ComponentModel; using. System.Reflection; [ TypeConverter. Typical "Enum" declarations, sort of like One = 1, Two = 2, Three. ToString(); } public...
sanity-free.org
A CRC32 implementation in C# - Sanity Free Coding - C#, .NET, PHP
http://www.sanity-free.org/12/crc32_implementation_in_csharp.html
Methods to the Madness. May 3, 2005. A CRC32 implementation in C#. The other day I was looking for a simple CRC32 library. I couldn't find one (that suited my needs) so I wrote a quick and dirty implementation. NullFX.Security { using. Crc = 0xffffffff; for. Index = ( byte. Crc) and 0xff) bytes[i]); crc = ( uint. Crc 8) table[index]); } return. Crc; } public. GetBytes(ComputeChecksum(bytes) ; } public. Poly = 0xedb88320; table = new. Temp = 0; for. Temp and 1) = 1) { temp = ( uint. Temp 1) poly); } else.
sanity-free.org
C# 3.0 Lambda expressions - Sanity Free Coding - C#, .NET, PHP
http://sanity-free.org/138/csharp_3_0_lambda_expressions.html
Methods to the Madness. February 13, 2007. C# 30 Lambda expressions. I've finally seen the light for these little buggers. As I wrote in my original post. That I really didn't glean much from the description of lambda expressions that are mentioned in the specification, but I ran across a great article on it on the code project that did a really good job at explaining it. So my meta blog for the day is a link to that article:. Raquo; http:/ www.codeproject.com/csharp/lambdaexpressions.asp.
sanity-free.com
Sanity Free Coding - C#, .NET, PHP
http://www.sanity-free.com/section10.html
Methods to the Madness. September 28, 2006. Triple DES between PHP and C#. The past while at work I've been working through some annoyingly overcomplicated encryption issues. The problem is not that Triple DES is all that complicated or annoying, it's just that when you have 2 different technologies (one doing the encrypting and one doing the decrypting) at work; it can be frustrating to get anything accomplished. Here's my php script: Read the rest of this article. C # Articles. July 3, 2006. C# webserv...
sanity-free.com
Standard CRC 16 in C# - Sanity Free Coding - C#, .NET, PHP
http://www.sanity-free.com/134/standard_crc_16_in_csharp.html
Methods to the Madness. December 15, 2006. Standard CRC 16 in C#. System; public class. Polynomial = 0xA001; ushort. Table = new ushort. 256]; public ushort. Crc = 0; for. I = 0; i bytes.Length; i) { byte. Index = ( byte. Crc bytes[i]); crc = ( ushort. Crc 8) table[index]); } return. Crc; } public byte. Crc = ComputeChecksum(bytes); return. GetBytes(crc); } public. I = 0; i table.Length; i) { value = 0; temp = i; for. Value temp) and 0x0001)! 0) { value = ( ushort. Value 1) polynomial); } else. All about...
sanity-free.com
C# .NET Single Instance Application - Sanity Free Coding - C#, .NET, PHP
http://www.sanity-free.com/143/csharp_dotnet_single_instance_application.html
Methods to the Madness. June 6, 2007. C# NET Single Instance Application. Today I wanted to refactor some code that prohibited my application from running multiple instances of itself. Previously I had use System.Diagnostics.Process to search for an instance of my myapp.exe in the process list. While this works, it brings on a lot of overhead, and I wanted something cleaner. Knowing that I could use a mutex for this (but never having done it before) I set out to cut down my code and simplify my life.
sanity-free.com
CRC 16 CCITT in C# - Sanity Free Coding - C#, .NET, PHP
http://www.sanity-free.com/133/crc_16_ccitt_in_csharp.html
Methods to the Madness. November 8, 2006. CRC 16 CCITT in C#. Once again I found myself needing another type of CRC algorithm in C#. I found one on code project, but their implementation of CRC 16 CCITT didnt produce that checksum I needed. Come to find out there are different methods to calculate CRC 16 CCITT which use different initial values for the crc. I ended up writing this one for my own purposes:. System; public enum. Zeros, NonZero1 = 0xffff, NonZero2 = 0x1D0F } public class. Poly = 4129; ushort.
sanity-free.com
A CRC32 implementation in C# - Sanity Free Coding - C#, .NET, PHP
http://www.sanity-free.com/12/crc32_implementation_in_csharp.html
Methods to the Madness. May 3, 2005. A CRC32 implementation in C#. The other day I was looking for a simple CRC32 library. I couldn't find one (that suited my needs) so I wrote a quick and dirty implementation. NullFX.Security { using. Crc = 0xffffffff; for. Index = ( byte. Crc) and 0xff) bytes[i]); crc = ( uint. Crc 8) table[index]); } return. Crc; } public. GetBytes(ComputeChecksum(bytes) ; } public. Poly = 0xedb88320; table = new. Temp = 0; for. Temp and 1) = 1) { temp = ( uint. Temp 1) poly); } else.
sanity-free.org
A Standard CRC-16 and CRC-16 Kermit implementation in C# - Sanity Free Coding - C#, .NET, PHP
http://www.sanity-free.org/147/standard_crc16_and_crc16_kermit_implementation_in_csharp.html
Methods to the Madness. July 28, 2012. A Standard CRC-16 and CRC-16 Kermit implementation in C#. Been a while since I posted anything, but here's an update to my original CRC-16. Class that does CRC-16 with CRC-CCITT Kermit code that I posted over on Stack Overflow. System; public enum. Standard = 0xA001, CcittKermit = 0x8408 } public class. Table = new ushort. 256]; public ushort. Bytes ) { ushort. Crc = 0; for. I = 0; i bytes.Length; i) { byte. Index = ( byte. Crc bytes[i]); crc = ( ushort. Comments ha...