Geeks With Blogs
Greg Young Greg.ToString() May 2006 Entries
Unit Test???
I was poking through Jason Haley's blog today when I came across one of his interesting links (which are usually pretty interesting btw). It pointed to a post by Phillip Haack titled A Testing Mail Server for Unit Testing Email Functionality. I generally enjoy reading about other’s unit testing experiences as I often gain quite a bit of perspective (and get to see a lot of problems I may not otherwise get to see). Basically what he has done is taken an open source SMTP server and used it for ......

Posted On Wednesday, May 31, 2006 9:23 PM

Floating Point Fun
I am sure by now that most know how floating point approximations work on a computer.. They can be quite interesting. This has to to be the weirdest experience I have ever had with them though Open a new console application in .NET 2.0 (set to build in release mode /debug:pdbonly should be the default) it is important for me to note that all of this code runs fine in 1.x. Paste the following code into your main function float f = 97.09f; int tmp = (int) (f * 100.0f); Console.WriteLine(tmp); Output: ......

Posted On Tuesday, May 30, 2006 12:35 PM

String to Int []
I apologize for the code not being indented , I am using word 2007 and no matter what I do it does not seem to want to indent properly (I have tried copy/pasting to notepad, you name it), if you know how to get this working please contact me. See picture of word version http://gwb.blob.core.window... update I manually indented all of it but I am still wanting to know how to avoid this Everyone seems to enjoy performance posts so …. I saw this question in the advanced ......

Posted On Monday, May 29, 2006 9:56 PM

AOP with Generics Thoughts
As some of you may have realized, I am in the process of re-implementing my AOP framework to fully support generics right now (figured I might as well as I am white boarding it for open source deployment anyways). I have come across numerous issues in dealing with generics. Today I sent an email to the castle project group (who are going through a similar task in supporting generics in Dynamic Proxy). I figured I would post that email here as well in case others have thoughts on some of the issues ......

Posted On Monday, May 29, 2006 1:02 PM

Blogging from Word2007

Hoping that this works…

Posted On Sunday, May 28, 2006 10:17 PM

GetGenericArguments
I have been searching for an answer to this one and I am perplexed. http://msdn2.microsoft.com/... returns an array of the generic arguments .. what I can't figure out is if they will ever be out of order. The arguments themselves have a position on them, is it possible that I get them back out of order where I would need to re-order them ... basically what I am doing is something similar to the following on a generic type definition string [] Params ......

Posted On Sunday, May 28, 2006 5:24 AM

Sorting Performance .NET 2.0
Be very careful when using Array.Sort in 2.0. I had posted a bug report about this a while ago http://lab.msdn.microsoft.c... The behavior observed was originally in arraylist (which uses Array.Sort internally) so keep in mind that this applies to it as well. Array.Sort(Items, 0, Items.Length, Comparer.Default); //takes 1 minuteArray.Sort(Items2, 0, Items.Length, null); //takes 250 ms Items and Items2 are both clones ......

Posted On Sunday, May 28, 2006 12:17 AM

Funny Memory
I was just writing up a bit on a question for some interview questions. I personally always ask conceptual, application, or comparative questions; never definitions so I can try to weed out the “talkers”. So a few years ago I was interviewing this guy ... He seemed like a talker, he had gotten a whole lot of questions wrong. So I asked him .. What is the difference between configuring a webservice by using device=name.asmx and devicehigh=name.asmx in your config.sys I proceeded to get ......

Posted On Thursday, May 25, 2006 9:23 PM

Invoke vs BeginInvoke
Now that 2.0 (with its detection of accessing control properties from an incorrect thread) has become main stream there are numerous people realizing that they had many bugs in their 1.1 code. I could write up a bunch of information about why you need to do this but I think http://weblogs.asp.net/just... and others already do a great job of this. I am instead going to talk about how things work (that you probably don't care about). Once upon a time in a land far away there ......

Posted On Thursday, May 25, 2006 5:52 PM

DotNetRocks - Ted Neward
Just listenned to the latest dotnetrocks with Ted Neward as the guest. Really interesting discussion on TDD .. don't necesarily agree with alot of it but very interesting points brought up. At one point they were discussing http://www.ambysoft.com/boo... They discuss “unit testing” databases, in particular writing unit tests for the data model. I believe this is the wrong term; one should be writing integration tests for the data model. Alot of people have been ......

Posted On Friday, May 12, 2006 1:56 AM

May 2006 Linq CTP
Hot off the presses http://www.microsoft.com/do... Overview LINQ is a codename for a set of extensions to the .NET Framework that encompass language-integrated data query, set, and transform operations. It includes extensions to the C# and Visual Basic languages with native language syntax for queries and provides class libraries to take advantage of these capabilities.This package is a combined update of both the VB ......

Posted On Wednesday, May 10, 2006 8:03 PM

ICollection and ICollection<>
Eralier I posted (and deleted) about the Queue class not implementing ICollection from some research this is by design. From: http://msdn2.microsoft.com/... collections that limit access to their elements, like the Queue class and the Stack class, directly implement the ICollection interface."If you look, the interfaces are also very different from each other in what they include. The generic one includes methods such as ... Add, Remove, and Clear which do not exist on ......

Posted On Tuesday, May 9, 2006 10:19 PM

Random Useful Code
I don't remember where I got this (so whoever you are thanks but I can't link to you update .. http://groups.google.de/gro... some time ago but it is a quite useful (and portable) way to see if a file is a .NET assembly or not ... If you fall back to the Assembly.LoadFrom method .. you have to fail many times if you are searching many files ... In looking at this again (had nearly forgotten about it until today). It works ......

Posted On Tuesday, May 9, 2006 4:01 PM

Active Record
OK, I have put up two posts about why I generally don't use Active Record. http://geekswithblogs.net/g... I feel it only fair now to say why I really like Active Record and when I DO use it. OR Mapping tools such as nhibernate, gentle.net, wilson OR, and object spaces (heh) can make Active Record extremely flexible as they handle large amounts of model mapping (such as column names or relations) Active Record ......

Posted On Thursday, May 4, 2006 11:58 PM

Repository, the Foundation of Domain Driven Design
Recently I had posted some reasons about why I use Repository as opposed to Active Record. This post was originally spawned by some comments by Sam Gentile in regard to peole refactorring from repository to active record. In my previous post I listed a few reasons but one of those reasons requires much closer analysis ... ActiveRecord seems to defeat the entire concept of DDD, ActiveRecord promotes a database centric model Every methodology has its foundation, for Domain Driven Design it is the Repository ......

Posted On Wednesday, May 3, 2006 9:21 PM

2.0 Specify Thread Stack Size
In .NET 1.x if you wanted to modify the stack size of a thread you created you would have to go through some pretty nasty code .. Here is a hint :) [DllImport("kernel32.dll", SetLastError=true)]static extern int CreateThread (ref SECURITY_ATTRIBUTES lpThreadAttributes, int dwStackSize, ref int lpStartAddress, ref object lpParameter, int dwCreationFlags, ref int lpThreadId) In 2.0 a new overload has been added to the Thread class to support alterring your stack size directly through managed code http://msdn2.microsoft.com/... ......

Posted On Tuesday, May 2, 2006 9:17 AM

Hilarious

Nothing like a good troll.

http://shelleytherepublican.com/2006/04/linux-european-threat-to-our-computers.html

Now if the argument had been made for VMS, it might be valid!

if-only-my-laptop-had-a-do-key

Posted On Tuesday, May 2, 2006 5:01 AM

BigInteger/BigDecimal
MSDN Question: Specifically, I need something that will let me represent decimals with a large amount of precision... Similar to this library:http://www.codeproj... but I need decimal support.If worse comes to worse I'm thinking I can use this and just multiply out the numbers as necessary by a fixed large number (10000000000000000000000000... or something similar), but that really feels like an incredibly dirty hack... So, any ......

Posted On Monday, May 1, 2006 10:20 AM

Community Credit
http://community-credit.com is one of the cooler sites I have seen in a while. The site as a whole is oddly reminiscent of experts-exchange (when it was still expertsexchange) except that its not their own forums where questions get answerred but the same things you are most likely doing already! In their own words “We give stupid prizes to smart people”. Well my prize was actually really cool (although I have to admit I had my heart set on the usb microscope! :) There is no cooler keyboard ......

Posted On Monday, May 1, 2006 7:08 AM

Copyright © Greg Young | Powered by: GeeksWithBlogs.net