look at http://www.codeplex.com/xunit
Quite interesting. I might give that a shot soon.
You can read about it at http://jamesnewkirk.typepad.com/posts/2007/09/announcing-xuni.html
The upside for that is the simplification of things by removing some attributes, and having a more consistent model regarding assertions on exceptions.
I've just tried the type speed test that I had read about on Aaron's blog.
My results (not excelled I'm afraid):
YOUR RESULTS ARE:
Number of words typed: 145
Test duration: 3 min
Speed: 48.6 words/min. (243 keystrokes/min.)
Error penalty: 10
Accuracy: 93.1%
For my defense I'd add that although I'm typing English since I was about 6 years of old, 90% of that typing was inside of some kind of an IDE, and it was in languages such as BASIC, C and Pascal, rather than English. Only on the last year when I started blogging, the last half of a year when joined the Castle community, and the last couple of month of working at Music Glue, have I really done some proper typing in English...
So, maybe I typed slowly, but it was maintainable and testable.
Some of you might know that it's Rosh Hashana (the Jewish New Year) tonight.
I wish you all a great year, filled with happiness, joy, and high quality code. May you need not debug code horrors this year ...
A year of improvement and becoming better at being who you are, and what you do.
And thank's to Idan Gross (WWW.IDANGROSS.COM) for the lovely picture.
Main reason - I want to reduce traffic to my blog (I do have a gazzilion a million few hundreds subscribers, just like you, my dear reader.).
Plus, since feed-burner has gone Google-d, they give the PRO services for free, so I'd be able to enjoy the stats - which means I'd be able to know exactly how many people are reading me, and then can arrange the kenegozi-readers-party (thought about the Madison Square Garden, but I guess my living room will do just fine).
So, please update your favorite reader to point to http://feeds.feedburner.com/kenegozi.
Following that thread from Castle Project's user group, I'm writing that down as to remember that.
Notice that an ASP.NET application mat spawn more than one HttpApplication object. That is, to keep HttpApplication thread safe, thus providing each thread it's own instance. Now the Start event may fire only during the (logical) application start, rather than on each instance start. Therefore, if you want to hook events, you'd want to do that on the application's Init event, that would get called for each HttpApplication instance.
Seriously, it's Google. What took them so long?
Anyway - Google Reader remains my feed reader of choice. I do not use my laptop offline much, so it's ok like that, plus the offline mode in reader kinda works, so for the occasional offline sessions I do have it's more than enough.
It took me almost a week to notice, though ...
Well, it depends who you're asking.
It also depends on how good you look, apparently.
If you'd ask John Bristowe he'd say YES.
If you'd ask a good-looking software consultant such as Justice Gray, he'd just get angry at John.
Now, seriously, my view on that:
Javascript is a GREAT language.
It's VERY easy to work with(*) (and I mean, to do DHTML, not to write a WorkFlow engine or an OR/M).
You can O.O with Javascript, you can get functional, you're a dynamic as you can get, and it's THE most cross-platform thing today. It'd work exactly the same on every PC and MAC operating system from the last two three five years.
Of course, lousy developers can write javascript code that would work only on FireFox, or only on IE6 and a XP machine without SP2 that was installed on a full moon Thursday evening.
But note that these kind of developers won't be able to code a fizz-buzz in C/Java/C#.
And that's what so great about javascript.
It works even for idiots.
(*) It is. Just throw prototype.js (or any other) and you're a king. You say "it's not fair"? well, that's the whole point. Extending javascript from a "regular" one to a "prototype.js" one is possible, and even not that hard. Now try to do that for Java/C#/Whatever.
(**) The answer is No. If you haven't guessed that by now, then forget about Javascript. Hell, forget about programming all together.
So you say "Hey Ken, that's not fair. Ranting about the bad performance tips isn't good enough. We want GOOD tips".
I won't say that those are necessarily GOOD tips, however they are probably BETTER.
without further ado, I'll quickly pull out of my hat my somewhat better tips:
1. Learn to use caching, both for dynamic and static content.
2. TURN OFF ViewState (and ControlState). Find better solutions. Really. You do not need the viewstate to get txtName.Text. Just use the damn Form["txtName"], or write TypeSafe wrapper around the Form (or Request.Items) collection.
3. Learn SQL.
4. Use caching.
5. ADD Client-side validation to the Server side validation. DO NOT remove server side validation, as every javascript beginner can bypass client-side stuff.
6. Avoid SELECT+N.
7. Cache responses where appropriate.
8. Have as least external files as you can. Join all .js to one file. join all .css to one file. It takes a LOT more time for the browser to open a connection to the server, that to actually get those lousy extra 5k. And out-of-the-box, browsers can have a maximum of 2 connections to the server at once.
9. Cache DB queries when appropriate
10. Enable GZip on IIS
11. Use the "COUNT" keyword in SQL, rather than the "Count" or "Length" .NET properties
12. Did I mention caching?
13. Avoid Page where it can be replaced with an IHttpHandler. That code is BAD:
public class SomePage : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Response.Clear();
Response.Write(something);
}
}
Wow.
Take a look at that tip sheet.
Are these guys serious?
Best quotes:
3. Avoid Server-Side Validation
Try to avoid server-side validation, use client-side instead. Server-Side will just consume valuable resources on your servers, and cause more chat back and forth.
huh?
12. Caching is Possibly the number one tip!
Use Quick Page Caching and the ASP.net Cache API! Lots to learn, its not as simple as you might think. There is a lot of strategy involved here. When do you cache? what do you cache?
if it's no. one tip (and it is), why is it numbered 12?
20. Option Strict and Option Explicit
This is an oldy, and not so much a strictly ASP.net tip, but a .net tip in general. Make sure you turn BOTH on. you should never trust .net or any compiler to perform conversions for you. That's just shady programming, and low quality code anyway. If you have never turned both on, go turn them on right now and try and compile. Fix all your errors.
what's that has to do with performance?
I just can't believe that CodeProject has linked to that article.
From the fifth story in Steve Yegge's Tech News Issue #1:
"... the engineer has formulated a proof that invalidates one of the most fundamental results in Computer Science, specifically that "recursion" and "iteration" are formally equivalent ..."
Oh, and if I've HAD to do Java programming, for something larger than the casual-edit-in-Scite, I'd use Eclipse (and buy as much memory sticks as I can fit into my workstation).
I hate switch statements. They just looks bad.
So take a look at a nice example I've read at Luca Bolognese's, for switching from a switch based code to a cleaner one.
The syntax in pre-c#3 would be less nice (delegate() instead of lambda, and parseFuncs.Add instead of the initializer) but it's doable.
Heck, it reminds me of some old university-level Ansi-C code I've once wrote for a matrix-calculator program:
typedef struct {
char * name;
char * (*func)(char *);
char * description;
} cmd_class;
// matrix functions.
// pre: parameter string. post: answer is printed or stored in matrix
char * read_mat(char * parm_string);
char * print_mat(char * parm_string);
char * add_mat(char * parm_string);
char * sub_mat(char * parm_string);
char * mul_mat(char * parm_string);
char * mul_scalar(char * parm_string);
char * trans_mat(char * parm_string);
cmd_class cmd[] = {
{"read_mat", read_mat, "parameters: matrix,val1[,val2,...,val16]"},
{"print_mat", print_mat, "parameters: matrix"},
{"add_mat", add_mat, "parameters: matrix_A,matrix_B[,target_matrix]"},
{"sub_mat", sub_mat, "parameters: matrix_A,matrix_B[,target_matrix]"},
{"mul_mat", mul_mat, "parameters: matrix_A,matrix_B[,target_matrix]"},
{"mul_scalar", mul_scalar, "parameters: matrix,scalar[,target_matrix]"},
{"trans_mat", trans_mat, "parameters: matrix[,target_matrix]"},
{"stop", stop, "exit program"},
{"menu", print_menu, "print this menu"},
{"not_valid", NULL, "NULL"}
};
It allowed me to avoid switch by looping over the cmd[] array in a helper method, thus able to do
command(commandName).func(params);
Not exactly a typical jet-fighter-realtime-c-code, but it gave me a better looking code, and a 100/100 grade.