Archive for the 'development' Category
Vitamin - Cross Browser Vector Graphics
Here is a really good article on creating cross browser graphics with dojo.gfx.
I really like how they do charting; something like this might be quite helpful sometime.
No commentsGeneric types and Type.IsSubclassOf
Type.IsSubclassOf does not work with generic types because the generics are not inheritence.
Here is what worked for me:
genericMonkey.GetType().GetGenericTypeDefinition()
Here is more info on this topic:
No commentsMike Gunderloy and Microsoft
Well, it looks like the journey is over.
Mike Gunderloy of Larkware fame is trying to remove Microsoft and everything Microsoft related from his life.
Choosing to use Microsoft software as the basis for my work, whatever else it may do, contributes to the growth and health of Microsoft. It supplies funds for Microsoft’s continued initiatives in the area of intellectual property and DRM. And it seems to me that the ultimate consequence of these initiatives will be to limit my own freedom of action, both as a software user and a software developer.
This is taken from A Fresh Cup - Mike’s new blog that details his exploration of non-Microsoft technologies as a way to earn a living. So far it looks very intriguing and I am already subscribed to the feed. Currently Mike is evaluating Ubuntu and Ruby on Rails.
This reminds me somewhat of Softies On Rails. The guys from Softies On Rails were originally ASP.NET developers that later completely switched to Ruby On Rails and never looked back. Here is the post - Rails is (officially) life-changing. And here is some more - Why Rails? Part 1: Microsoft pisses me off, Why Rails? Part 2: All the Cool Kids Are Doing It, Why Rails? Part 3: Ruby, Why Rails? Part 4: Because It’s Free and Why Rails? Part 5: Because I Can Test It.
A Fresh Cup looks like it is going to be a great blog and I can’t wait for more posts. Good luck Mike on your journey and make sure you blog the details.
No comments
What is wrong with Typo?
No wonder people are switching from Typo. For at least a month I have been getting the following message:
Bad Gateway
The proxy server received an invalid response from an upstream server.
Apache/2.0.52 (CentOS) Server at www.typosphere.org Port 80
What the hell is going on? Is this the end of Typo? I hope they get their stuff together.
1 commentEnterprise Library will have a new block – Validation Application Block
It looks like the new version of the Enterprise Library will have a new block – Validation Application Block. It will provide common validation rules that apply to primitive data types.
What a great idea, hopefully this would be as easy and nice as BO validation in RoR. One of my problems with ASP.NET validators is that they force you to put business logic into UI. And this leads to the duplication of the validation logic. Now you have to write your validation logic in your business object and in your UI. That is if you ever do… I have seen so many examples where people just put all their validation into UI and never replicate it on the BLL. Not cool… I like the Rails way better. You always start out by coding validation logic in your BO, and UI knows how to pick up all the validation errors and display them to the user.
From the post:
The Validation Application Block will include a comprehensive library of common validation rules that apply to primitive data types. For example, we’ll include rules like string length, numeric range, date range, regular expressions and so on. However your applications will typically deal with more complex objects such as Customers or Orders (yes, here at Microsoft we assume every application is based on Northwind ;-), so while the built-in Validators should be great building blocks, you’ll need to do some additional work to specify how these primitive rules apply to more complex objects. We plan on letting you do this in two primary ways: in configuration (which is ideal if you want the rules to be easily changed after deployment), or in code (which allows better encapsulation of rules and ensures the behavior won’t change unless the code does).
The complete post is here.
No commentsFun with C#’s yield and Fibonnaci numbers
1: using System;
2: using System.Collections;
3:
4: namespace TestConsoleApplication
5: {
6: internal class Program
7: {
8: private static void Main(string[] args)
9: {
10: foreach (int x in GetFibonacciNumbers(20))
11: {
12: Console.WriteLine(x);
13: }
14:
15: Console.ReadKey();
16: }
17:
18:
19: public static IEnumerable GetFibonacciNumbers(int n)
20: {
21: int p1 = 1;
22: int p2 = 0;
23:
24: yield return 0;
25: yield return 1;
26:
27: for (int i = 0; i < n; i++)
28: {
29: int sum = p1 + p2;
30: yield return sum;
31: p2 = p1;
32: p1 = sum;
33: }
34: }
35: }
36: }
IXmlSerializable and sgen.exe
If you really have to control your XmlSerialization - use IXmlSerializable.
I always knew that you can use xsd.exe to generate CS classes from XML schema, but I have never heard of sgen.exe.
From MSDN: The XML Serializer Generator(sgen.exe) creates an XML serialization assembly for types in a specified assembly in order to improve the startup performance of a XmlSerializer when it serializes or deserializes objects of the specified types.
Pretty awesome if you ask me.
No commentsFree e-book on .NET threading
Here is a free e-book about .NET threading. I am using it to prepare for threading section of 70-536.
No commentsCAS Permissions for a Console Application
If you have a console application that creates a console for IO, make sure that the application has unrestricted UI permission.
If you execute your console application in Internet_Zone code group and receive a security exception, you have 2 options:
1. provide unrestricted UI permission to the application
2. get your application to execute in LocalIntranet_Zone code group.
Could not find file ‘Microsoft.Windows.CommonLanguageRuntime, Version=2.0.50727.0′
Today I was working with a solution that had 2 console applications. Console application A was creating a child application domain and executing the console application B in the child domain. Console application A had a project reference to console application B.
Everything worked until I decided to turn down code access security in the assembly that is being executed. Properties -> Security -> Enable ClickOnce Security Settings. Select “This is a partial trust application”. For ClickOnce Security Permissions pick “Internet” zone.
Now, when I try to rebuild the solutions I get this - Could not find file ‘Microsoft.Windows.CommonLanguageRuntime, Version=2.0.50727.0′.
To resolve this problem you have to uncheck “Enable ClickOnce Security Settings”. Once you do it, you will be able to rebuild your solution.
But what if you want to keep your ClickOnce security settings? Make sure you reference your assembly B as a file and not as the project.
3 comments