by Mwwhited
1. November 2009 17:24
I put together a quick framework for reading ISO disk images from .Net. This was written in C#. Again it is a quick demo framework so it does not have any exception handling and should probably not be used in production code. It has been written to use any stream but really it needs to support seeking. I would suggest only MemoryStreams and FileStreams, but you can have fun with anything you like. ISO9660.zip
by Mwwhited
31. October 2009 14:20
I prefer to write mostly in .Net and C# these days. But sometimes you need to work with external systems. On particular system I have been working with supports COM interop but the deployment model leaves much to be desired. In my typical net surfing I found a IL hack to export method calls from .Net assemblies and expose them as Unmanaged references. The handy part about this it you can use the exports anywhere you may call unmanaged interfaces. The need for me w...
[More]
by Mwwhited
29. August 2009 12:08
In response to a question on StackOverFlow I posted a response about possibly using the ControlBuilder class in ASP.Net to get around the lack of generic control support in the ASP.Net designer. While it may be possible to use the ControlBuilder to dynamically generate controls based on inputs. Having it work as simply as a generic wrapper seem like it will require a pretty in-depth dive in reflection and the ASP.Net control model. Because the person asking the question was pri...
[More]
by Mwwhited
11. August 2009 10:08
Using reflection to create classes and invoke methods can be tricky. Worse still can when you try to invoke methods with generic arguments. This is a short and quick example
static void Main(string[] args)
{
var flags = BindingFlags.Static | BindingFlags.NonPublic;
var t = typeof(Program);
var mi = t.GetMethod("Loopback", flags);
var gargs = mi.GetGenericArguments();
var pargs = new object[] {"input value"};
var gargIn = pargs.Select(a =&g...
[More]
by Mwwhited
19. June 2009 11:06
While not as bad as calculating PI in BF this LINQ statement is pretty impressive. Being able to define a full ray tracer in a single, complex, fuctional, recursive statement is very interesting. Ray Tracing in LINQ
by Mwwhited
18. June 2009 01:06
In the sprit of playing with a string chop question on stackoverflow… I somehow got myself into the middle of some fun code profiling. So this is a report of the code and results. (this is related to a previous most I made as well http://hackersbasement.com/?p=134) Charted Short String Results Person Version Run 1 Run 2 Run 3 Str SB J Str SB J ...
[More]
by Mwwhited
17. June 2009 23:06
In coming across this question on StackOverflow I inspired to write my own version for the question. I started to think about using a List<string> but decided to create sized array up front. My version was taking longer than I hoped (mainly because I kept refreshing the site) but I did create a version that used string.Join and Array.Copy. Wanting to compare the speed differences between a few of the answers I put together this little test of code. (as a side note...
[More]
by Mwwhited
16. June 2009 15:06
Two chucks of code... both do the same thing. Why is the version with the goto so much worse? I would even debate that it is clearner.
Dim password1 As String
While True
Console.WriteLine("Enter Password: ")
password1 = ReadHiddenString()
If String.IsNullOrEmpty(password1) Then Continue While
Console.WriteLine("Reenter Password: ")
Dim password2 As String = ReadHiddenString()
If String.IsNullOrEmpty(password2) Then Continue While
...
[More]
by Mwwhited
15. June 2009 00:06
After playing a little with Inversion of Control Containers... and being annoyed by the backing of a Hash Table or Dictionary, I decided to use some generic magic. And just for giggles I tossed in some .Net 3.5 Extension method love. Oh, as a warning... I build this on VS2010 Beta 1 so the Range object's constructor has optional parameters. Please feel free to leave questions and comments. -Thanks, Matt
using System;
using System.Collections.Generic;
using System.Linq;
using System.Collect...
[More]
by Mwwhited
13. June 2009 16:06
I decided to play around with VS2010 Beta 1 this weekend. While talking with one of my dev friends, I was asked what I thought about the Parallel extensions. Having not used them yet I figured I'd give them a go...
[More]