Archives
-
Separating Object Querying Languages from O/R mapping tools
Sebastien Ros just published a free library that enables you to query an arbitrary object graph using an XPath-like syntax.It's definitely a great idea to finally separate OQL from O/R mappers. The syntax here seems very intuitive.
It brings us closer to Cw. By the way, wouldn't it be even greater if the Navigator object could be extensible?This way, you could give it an XML document, for example, or a DataTable, or an object that has a property that is an XML document and be able to seemlessly query across the heterogeneous parts?But maybe I'm asking too much...Update: another, similar approach, but more standards-based: http://www.byte-force.com/sdfxpath/doc/ (source TSS.NET) -
Stupid tests!
-
How to multiply a Unit by a number?
Unit Multiply(Unit indent, int depth) {
if (indent.IsEmpty) {
return Unit.Empty;
}
if (indent.Value == 0) {
return indent;
}
double indentValue = indent.Value * depth;
// I'd love not to hardcode this but Unit.MaxValue is currently private.
if (indentValue < 32767) {
return new Unit(indentValue, indent.Type);
}
else {
return new Unit(32767, indent.Type);
}
} -
A Gates paradox
I was reading this very informative interview of Bill Gates about rights management and the way it ends made me smile:Gizmodo: But I think we just disagree.Gates: No, I actually don't think we disagree.So can we agree to disagree? Or agree not to disagree about our disagreements, at least? Oh well, I'm confused. -
Are StringBuilders always faster than concatenation?
Console.WriteLine(DateTime.Now.ToString("HH:mm:ss.fffffff"));
for (int c = 0; c < 5000000; c++) {
int i = 0;
string a = "a" + i++ + "a" + i++ + "a" + i++ + "a" + i++ + "a" + i++ + "a" + i++ + "a" + i++ + "a";
}
Console.WriteLine(DateTime.Now.ToString("HH:mm:ss.fffffff"));
for (int c = 0; c < 5000000; c++) {
int i = 0;
StringBuilder sb = new StringBuilder(15);
sb.Append("a");
sb.Append(i++);
sb.Append("a");
sb.Append(i++);
sb.Append("a");
sb.Append(i++);
sb.Append("a");
sb.Append(i++);
sb.Append("a");
sb.Append(i++);
sb.Append("a");
sb.Append(i++);
sb.Append("a");
sb.Append(i++);
sb.Append("a");
string a = sb.ToString();
}
Console.WriteLine(DateTime.Now.ToString("HH:mm:ss.fffffff")); -
Callbacks are getting momentum, not only in ASP.NET
The recent launch of the Google Suggest beta attracted a lot of attention to XmlHttp callbacks. Such features where client-side script asks the server for very focused updates to the page without reposting it entirely have been possible ever since frames and javascript exist (I've done a web-based chat application and treeview based on hidden frame posting more than 4 years ago), but the XmlHttp APIs first found in IE 5 and then in Mozilla, Safari and Opera (without the need to use an ActiveX, which is a great improvement) have made it a lot easier and a lot less hacky. There's even an ongoing W3C attempt at standardizing such APIs (which unfortunately adds a third syntax to the IE and Mozilla syntaxes).So everyone is now realizing what potential it holds to make better web applications. Here's an interesting blog entry about the Google implementation.But even this very nice Google feature has been available for ASP.NET developers under an easy to reuse form for years: check out this excellent WebControl.This being said, to my knowledge, ASP.NET 2.0 remains the only server-side technology to natively support callbacks with ready-to-use server and client-side event-driven APIs.