<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>ursecta.com &#187; Dotnet</title>
	<atom:link href="http://ursecta.com/wp/category/dotnet/feed/" rel="self" type="application/rss+xml" />
	<link>http://ursecta.com/wp</link>
	<description>J. Martin Wehlou on Security, Software Development, and Medicine</description>
	<lastBuildDate>Tue, 08 May 2012 10:19:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>.NET considered harmful</title>
		<link>http://ursecta.com/wp/2009/09/net-considered-harmful/</link>
		<comments>http://ursecta.com/wp/2009/09/net-considered-harmful/#comments</comments>
		<pubDate>Mon, 07 Sep 2009 11:24:50 +0000</pubDate>
		<dc:creator>martin</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Dotnet]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://ursecta.com/wp/?p=285</guid>
		<description><![CDATA[A friend of mine just told me about what an MS evangelist said at a symposium on multicore (paraphrased), after getting the question: &#8220;Did MS consider that cache awareness for programmers in multicore development?&#8221; &#8230;and he answered: &#8220;The average developer is not capable of handling that kind of level of detail. &#8230; Most developers are [...]]]></description>
			<content:encoded><![CDATA[<p>A friend of mine just told me about what an MS evangelist said at a symposium on multicore (paraphrased), after getting the question:</p>
<blockquote><p>&#8220;Did MS consider that cache awareness for programmers in multicore development?&#8221;</p></blockquote>
<p>&#8230;and he answered:</p>
<blockquote><p>&#8220;The average developer is not capable of handling that kind of level of detail. &#8230; Most developers are that ignorant. Welcome to the real world.&#8221;</p></blockquote>
<p>To me, this explains a lot. It explains why .NET looks like it does, and to clarify what I mean by that, let me simply copy in extracts from what I had to say about it in a private forum just weeks ago. In what follows, the italics are brief extracts of comments from others. The rest is my own text. It&#8217;s not always in a totally logical order and it starts out in midflight, but it&#8217;s a synthesis of a longish thread on a security related forum.</p>
<p><span id="more-285"></span></p>
<p><strong><em>Note: I didn&#8217;t ask any of my correspondents for permission to quote, but the quotes are so limited that I consider them &#8220;fair use&#8221;. If you think I crossed a line here, beat me into submission and I&#8217;ll never do it again.</em></strong></p>
<p>- &#8211; - here we go &#8211; - -</p>
<p><em>Even Java, Ada, and COBOL  do not inherently encourage &#8220;good programming style&#8221;.</em></p>
<p>Well, I wasn&#8217;t thinking of which language &#8220;encourages&#8221; good programming practices. IMNSHO, none really does. That&#8217;s an idea that isn&#8217;t even viable once you get into programming for real. The idea of &#8220;encouragement&#8221; from a language standpoint is, let me be blunt, something only wannabe programmers could think is relevant.</p>
<p>Once you really use a language and its platform, one is not bothered in the least about what the language or platform &#8220;encourages&#8221;, but what the language or platform *allows*, and that&#8217;s an entirely different kettle of fish. And this is where .NET falls down severely.</p>
<p>In .NET you can do reflection. Up to a point, and then not. You can do generics/templates. Up to a point, then it comes to a screeching halt. You can do aspects, but only to a very small point. You can do dynamic scripts, but only to a severely complicated and fairly worthless point. And on and on it goes. For every good abstraction technology they implement, you soon discover it&#8217;s just a faked out front that can&#8217;t scale up to something really useful.</p>
<p>So, like MS Basic before it, .NET languages and the platform have cheap selling points, leading you down a path of instant gratification and then you hit a wall. But it&#8217;s actually much worse than good ol&#8217; MS Basic was, since MS Basic was actually pretty close to what could be done back then, which wasn&#8217;t much. And you hit the wall soon enough to realize you should take another path. .NET, on the other hand, limits you from exploiting what currently very well can be done with computers, and it let&#8217;s you invest considerable energy and time in the platform before you get down to the bare metal behind it, only to discover it&#8217;s a rusty shell of improvised junk.</p>
<p>Let me put this in yet another way. Limiting languages to what is considered &#8220;safe&#8221; by non-programmers may limit the damage relative amateurs can do with these languages. But if this limitation also means you limit the *depth* of the language, like .NET does, then you actually put a ceiling on the level of abstraction than can be reached in larger systems built by people who actually know what they&#8217;re doing. Meaning that you exchange junk on a small and local scale for architectural and design junk on an epic scale.</p>
<p><em>With the reality of rapid time to market/deployment and a realistic assessment of the skills many programmers bring to the table, limited is what is needed quite often.</em></p>
<p>Yes, but what&#8230; um. Let me restart. It&#8217;s not a &#8220;yes, but&#8221; thing.</p>
<p>No, that&#8217;s wrong. Because it let&#8217;s you build small systems quicker and safer, that&#8217;s true, but small systems almost always become large systems. And these large systems almost always become monsters, due to the limitation that was built into them from the start. IOW, the limitation you talk about will practically always result in severe problems a bit down the road. It rewards shortsighted development.</p>
<p>Maybe, just maybe, limited and &#8220;safe&#8221; languages will reduce stupid errors in small systems by unskilled programmers more than they will cause deep errors in architecture of large systems (written by skilled or unskilled programmers, since skill doesn&#8217;t bring much to the table if the system won&#8217;t allow advanced techniques), but do we know that to be true? Has anyone tried to find out? As long as we don&#8217;t know that, you buy into &#8220;safe&#8221; languages on no better basis than what you do when you choose one shampoo over another.</p>
<p>- &#8211; -</p>
<p>Let me take a real life example to show what I mean, and why I currently detest .NET so much. (Maybe, just maybe, someone on the forum then tells me the one feature I missed in .NET and everyone gets to laugh at me, but I&#8217;m willing to risk that. I&#8217;m actually willing to *welcome* that, since it would be such a relief.)</p>
<p>When doing an app with grids and details, like 90% of everything out there, you want to let the user change details, add lines, delete lines, whatever, and then hit &#8220;Save&#8221; to save it all to the database, or &#8220;Revert&#8221; to go back to the original state. You also want the system to ask &#8220;Do you want to save first?&#8221; when you try to leave without saving changes. Right?</p>
<p>Ok, there are several ways of doing this. The &#8220;right&#8221; way would be to have the objects in memory versioned. You should be able to ask any object &#8220;did you change?&#8221; and &#8220;what did you change?&#8221;, and tell the object to roll back to a previous state or commit to the current state and start recording changes from there from now on.</p>
<p>You can&#8217;t do that in .NET, there&#8217;s no such feature. So, you say, what else is new, let&#8217;s fix that. With, um, AOP, which sounds just about right. Looking for solutions on the net shows nothing but spurious outbursts of unprintable language and gnashing of teeth. So forget it.</p>
<p>A mix-in, then? Um, no, .NET doesn&#8217;t support mix-ins, that&#8217;s only if you&#8217;ve got multiple inheritance.</p>
<p>Ah, let the objects deep-copy themselves to save state. Um, no, .NET has no reliable or complete deep-copy. And even if it had, it would copy too much of dependent object trees.</p>
<p>Then, let&#8217;s try good ol&#8217; raw bitblitting into memalloced save spaces and calculate our own offsets (and make the company CISSP, if there is one, turn blue in the face)? Um, no, such &#8220;unsafe techniques&#8221; aren&#8217;t allowed in .NET.</p>
<p>Let&#8217;s inject the dispatch table with a pre- and post-function to record changes (key/value observing or AOP, depending on taste)? Nope, can&#8217;t do. Unsafe.</p>
<p>Finally, if you still haven&#8217;t dumped the whole idea and started a bicycle shop instead, you may have worked your ass off to get a kind of reflection function lib going that can copy, compare, rollback your objects, if your objects conform to a fairly limited feature set and implement some clumsy attributes. That&#8217;s what I did, and I keep debugging this thing long past the time when it should have been clean. I&#8217;m also pretty sure it&#8217;s slow, but I don&#8217;t care anymore.</p>
<p>Or, you do what everyone else does, and that is riddling your code with checks if anything changed, and saving old values here and there when you think they may need to roll back. So if there are 15 ways of leaving that screen, you&#8217;ve got 15 different places you need to check if you need to reload or save any of maybe 20 different objects in your app. Leaving the support desk a never ending source of joy and happiness for years to come as customers find new and inventive ways of leaving half edited objects in memory.</p>
<p>You know what? If this had been C++, I would have done a real down to the metal hack of the dispatch vtable mechanism maybe, and gotten a fast solution working that could be used anywhere and forever to solve this problem. It would be &#8220;dangerous&#8221; but once debugged it would last forever.</p>
<p>What you see now in .NET is much less dangerous solutions, but they have to be done over and over again and everytime they risk new bugs, each of which is much harder to find than any bug I would have in my &#8220;unsafe&#8221; solution.</p>
<p>BTW, even my halfassed solution won&#8217;t work if you compile .NET apps in &#8220;secure&#8221; mode (or whatever it&#8217;s called) since reflection can&#8217;t be used then. (Meaning an even buggier solution with hundreds of times more code for the same thing&#8230;) And you know what, it&#8217;s actually *much more* difficult to get the 15 * 20 simple-code solution debugged than the one advanced vtable injection technique debugged.</p>
<p>So, that&#8217;s what &#8220;safe&#8221; languages deliver even for pedestrian apps. Hurrah.</p>
<p>- &#8211; -</p>
<p><em>Not sure I&#8217;d let most developers any where near C or C++.</em></p>
<p>Yes, but you also lose the opportunity to get really good scalable apps. I would suggest finding a few &#8220;real developers&#8221; instead of a load of &#8220;most developers&#8221;. Quantity can&#8217;t compensate lack of quality.</p>
<p><em>As for .Net, you could always mix managed and unmanaged code and do what you need to do in C++ if you&#8217;ve got the guys with the skills to do it right.</em></p>
<p>If that would let me attack the basic dispatch mechanism in .NET and have it install itself into all the objects in memory that I pointed out to it, with for instance attributes, I&#8217;d do it. But, AFAIK, you can&#8217;t do that. Then you need to switch over to C++ unmanaged for the entire project. Which, if we look back, was my exact argument. You *can&#8217;t* do scalable and safe programming in managed .NET even if you&#8217;re able to.</p>
<p>My argument is this: if you cripple a language, you&#8217;ve exchanged a few &#8220;dangerous&#8221; and qualified pieces of code against a sh..load of slightly dubious and simple pieces of code. And of the two ills, I am convinced the latter is the worst.</p>
<p>PS: I&#8217;m still waiting for someone to tell me I should&#8217;ve used disconnected datasets. Here I am, fully loaded for war and nobody shows up?</p>
<p>- &#8211; -</p>
<p><em>I&#8217;ve found it surprisingly practical on the scales I normally work with. I certainly concur that it&#8217;s not what you might call &#8220;large enterprise ready&#8221;, but then what really is?</em></p>
<p><em>BTW, couldn&#8217;t we define a &#8220;large system&#8221; as one in which none of the builders (are really able to) know what everything is doing?</em></p>
<p>I&#8217;ll take those two as the same question.</p>
<p>It *is* surprisingly practical for small scale stuff, or as the technical term goes: quick and dirty. But what is a &#8220;large system&#8221;? I&#8217;d say most useful systems are &#8220;large systems&#8221;, since the builder, even if he&#8217;s alone, can&#8217;t keep all parts of the system in his head all the time. I don&#8217;t think there are any, or more than very few, really &#8220;small&#8221; and useful systems out there, according to this definition.</p>
<p>A good programming system allows you to write &#8220;straight code&#8221;, or quick-and-dirty, as you start out and as soon as you see a pattern in your code, you are able to replace that pattern with a single implementation of an abstraction somewhere. All on the basis of DRY (Don&#8217;t Repeat Yourself). You *have* to be able to do this, else you get inheritance-by-editor, that is repeated and almost identical code in multiple places. Which is the most sure-fire way of making it a unmaintainable slag heap in no time.</p>
<p>For simple code sequences, we have functions. Even C# can do that. For structures we have objects. C# can, yay. For behaviours, we have templates aka generics. C# does that better than C++ in the &#8220;cute and nice to have&#8221; ways, but doesn&#8217;t do it at all in the &#8220;OMG-what&#8217;s-this- weird-code-but-it-saves-the-project&#8221; ways. It&#8217;s just cute and tantalizingly close to being real-world useful. Aspect oriented programming (AOP) or Key-value observing (KVO): C# is totally braindead. Same for run-time object extensions. Same for object delegation or runtime discovery of implementation (cfr respondsToSelector in Objective-C). None of these things are even there in any form. Even swapping out one DLL for another in runtime is painful in the extreme.</p>
<p>A highly abstract way to view this is to visualize a development effort curve that starts out linearly, then goes exponentially up. You stop there, grab the language by the neck and raise your code an abstraction level. You drop back to linear for a while, then you go exponential again, then you raise the code an abstraction level, etc.</p>
<p>With .NET, you can do this for a couple of times, then you either run out of abstraction levels or they don&#8217;t return you to a linear curve, but to another exponential curve (IOW, whatever you do, C# bites back). With C++ I&#8217;ve never run out of abstraction levels, they go on and on, right into user domain territory to an amazing degree. I suspect Objective-C won&#8217;t run out of them either. Languages like PHP don&#8217;t have them at all, they&#8217;re more or less at the level of MS Basic way back when. Almost. Which in itself is a kind of honesty, since PHP doesn&#8217;t even pretend to be a &#8220;real&#8221; language in that sense. It&#8217;s quick- and-dirty elevated to a religion.</p>
<p>Even though I can&#8217;t prove it, I strongly suspect that there are no simple projects really suitable for .NET. Almost all projects start out being the right scale, but almost all of them ultimately (or even &#8220;quickly&#8221;) escalate beyond the level where .NET is a good fit, but then they&#8217;re stuck on that platform. And it is in this phase of its lifecycle that we see the problems with unmaintainability and bugs, not while they&#8217;re still small.</p>
<p>So, in conclusion, I strongly doubt that &#8220;safe&#8221; programming systems bring us that safety. I think it&#8217;s the other way around. The problems we see due to poor use of sharp knives (horrible C++ code, for instance) can&#8217;t be solved by switching languages, but should be solved by switching or training programmers and fixing project management issues.</p>
<p>If you don&#8217;t have the project management and the developers you need to write solid, maintainable, and safe code with a real language, switching to &#8220;safe&#8221; languages won&#8217;t help you. I think that is what I&#8217;m trying to say.</p>
<p>- &#8211; -</p>
<p><em>A well-designed module will be maintainable. &#8220;Take the time to do the design before coding&#8221; beats the snot out of &#8220;pick the write language&#8221; when it comes to making the source readable and maintainable.</em></p>
<p>Uh, no. And yes. And no again.</p>
<p>The problem is that if you design your stuff first, the language has to be able to express that design. Unless you keep the design trivial enough to be expressed by any old (new) language.</p>
<p>For instance, if your design has the element &#8220;Restore this object tree to last savepoint&#8221; and your language has a feature that can be used to achieve that, you may get away with a handful of lines of code that clearly and succinctly express what you&#8217;re doing even without comments or docs, and that can be tacked onto your objects as mix-ins, categories, templates, reflection, or whatever.</p>
<p>If your language does not support the necessary operations and declarations, you&#8217;ll end up with stereotypical code that needs to be manually replicated into each and every darn class you&#8217;re building and that is specific for the very project you do them in, hindering reuse across projects. You end up with hundreds or thousands of lines of code spread all over, hard to understand, even harder to find when you need to find it and a real f&#8230;up to debug.</p>
<p>You can&#8217;t get around that if the language is too limited. Or &#8220;safe&#8221; as they call them nowadays.<br />
<em><br />
I have seen readable structured code in assembler and incomprehensible spaghetti in Modula-2</em></p>
<p>Assembler is much less limited than C# in this respect, so that isn&#8217;t so strange. It starts out at a very low abstraction level, but can reach very, very high. I&#8217;d say assembler is more or less linear in development complexity, but the problem is that the line, however straight, is very long.</p>
<p>Also, if you&#8217;ve already concluded that assembler can be well structured, then you have to admit C can as well. Same thing, almost. Extend at will to C++.</p>
<p><em>Of course it can!  Any language can!  That&#8217;s my point&#8230;.</em></p>
<p>Hah! OMG&#8230; so tell me, what&#8217;s wrong with MS Basic, then? Or MSDOS batch language?</p>
<p>Do an undo/redo manager for MS Basic, or even (let&#8217;s be generous here) C#, in an average accounting app. Then in Objective-C. Then compare for &#8220;well structured&#8221;. I&#8217;d guarantee you that the C# undo/redo manager will be unreadable, plastered all over the project up to the rafters, a neverending source of joyous bugs and a strongly contributing cause to the death of the product just a few years hence. Not so with Objective-C. (The undo/redo manager is already part of the libraries, but even if it wasn&#8217;t, it could be built by the developer in a very reasonable time. Not so for C#.)</p>
<p>And no amount of design will change that. C# simply doesn&#8217;t have the features you need and is brimming with the &#8220;safety&#8221; to stop you from getting it done. Thanks to the drive for &#8220;safer languages&#8221;, I have to add.</p>
<p><em>Isn&#8217;t the CISSP-relevant point here that your redo manager, or any comparable object, necessarily constitutes a locus of increased risk? Seems to me that might be why it&#8217;s hard to implement in such a language.</em></p>
<p>Yes, maybe, which points out why the CISSP-relevant point is nuts. Somebody decides that the undo/redo manager (or something equivalent) is dangerous, so let&#8217;s not do that. Um, so what do we do when we don&#8217;t have an undo/redo? We fake it in each of the 50 or 100 classes that need it and the problem is now orders of magnitude larger. Or, more likely, we prohibit undo/redo entirely, making the use of the app a bloody nightmare, causing the actual business to suffer. And if the bloody user makes an error, he can&#8217;t correct it, but then it&#8217;s his fault, right?</p>
<p>In any case, this method of suppressing any patterns that carry risk only moves the problem elsewhere, usually making it much worse at the same time.</p>
<p><em>Pretty much all languages these days do the real work with library calls. The accretion of platforms slowly renders specific languages less relevant, as implementations increasingly consist of calls to external libraries and objects held outside the language&#8217;s environment. So-called &#8220;safe&#8221; languages attempt to fulfill their promise by limiting external calls or, in the .Net case, opening holes to &#8220;unmanaged code&#8221;.</em></p>
<p>I intentionally took an example of something that can&#8217;t be done by libraries. You can&#8217;t equip classes or objects with runtime state monitoring by library calls if there is no dynamic injection or intercept functionality in the language. There is no equivalence between language functionality and library functionality; those cover disparate areas of functionality. Libraries have in absolutely no way taken over from languages, but libraries have grown much faster than languages, so it may seem so if you just compare sizes.</p>
<p><em>This is the dichotomy of Java: it lives in a sandbox that makes it very safe, leaving you with the problem of getting things in and out of the sandbox.</em></p>
<p>As taken right out of the marketing book. It&#8217;s BS. If it was as easy as prohibiting dangerous behaviour and then danger went away, Java would have solved world hunger by now.</p>
]]></content:encoded>
			<wfw:commentRss>http://ursecta.com/wp/2009/09/net-considered-harmful/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>The real iPhone conspiracy</title>
		<link>http://ursecta.com/wp/2009/08/the-real-iphone-conspiracy/</link>
		<comments>http://ursecta.com/wp/2009/08/the-real-iphone-conspiracy/#comments</comments>
		<pubDate>Tue, 04 Aug 2009 10:05:19 +0000</pubDate>
		<dc:creator>martin</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Dotnet]]></category>
		<category><![CDATA[Mac]]></category>

		<guid isPermaLink="false">http://ursecta.com/wp/?p=254</guid>
		<description><![CDATA[So I&#8217;ve used a Mac for a while and I&#8217;m just starting on iPhone development and a blinding flash of the almost-obvious strikes me. This is not the Blackberry killer or the Palm killer, it&#8217;s the long-fuse Microsoft killer. Remember the monkey dance? Ballmer yelling &#8220;Developers, developers, developers!&#8221;, while jumping around like a neurally defective [...]]]></description>
			<content:encoded><![CDATA[<p>So I&#8217;ve used a Mac for a while and I&#8217;m just starting on iPhone development and a blinding flash of the almost-obvious strikes me. This is not the Blackberry killer or the Palm killer, it&#8217;s the long-fuse Microsoft killer.</p>
<p>Remember the monkey dance? Ballmer yelling &#8220;Developers, developers, developers!&#8221;, while jumping around like a neurally defective and sweating profusely (one could be excused for suspecting some cholinergic poison, but he lived through it, so that is not the answer). Right. I mean, he&#8217;s right. Developers is what makes or breaks a platform, but now he&#8217;s losing them, so he really has no reason to celebrate.</p>
<p>When Apple designed the iPhone, they could have created a special development system and language for it, but even though it may have been easier, they didn&#8217;t. They chose to tweak the development environment for OSX to include the iPhone, and by necessity, also putting OSX on the iPhone. The result of this is that if you want to develop for the iPhone, you have to get a Mac (strike 1), learn OSX (strike 2), learn Objective-C (strike 3), learn Cocoa (strike 4), and by then you&#8217;re so deeply immersed in the Mac environment that you won&#8217;t find your way out again. Since you can run your Windows stuff, including Visual Studio, just fine under Parallels or Fusion, you don&#8217;t need that Dell or HP machine for anything anymore, and you&#8217;re not sorry to see them go. In other words, you&#8217;ve got a developer that clearly isn&#8217;t going to like going back to .NET development again. I mean, once you&#8217;ve used these two environments (Xcode/Cocoa/Objective-C vs .NET/Visual Studio) it&#8217;s practically impossible to enjoy .NET anymore. It&#8217;s so far behind and so very clunky in comparison it&#8217;s almost a joke.</p>
<p>So, every developer you task with iPhone development is almost certainly lost from the .NET camp forever. This I can&#8217;t prove, but I&#8217;m convinced of it. But now is the question: who are these developers? Do they already develop for the Mac or are they from the &#8220;other&#8221; side? Again, by the seat of my pants, I&#8217;m convinced that a very large and increasing proportion come from large enterprise .NET development organisations that need to add a client for their large systems on the iPhone. See where this is going?</p>
<p>It&#8217;s only just begun.</p>
<p><em>Update: I suddenly realized that I fused two unrelated events together in my mind. Steve Ballmer did <a title="Ballmer monkey dance (86 hits)" href="http://ursecta.com/wp/go.php?http://www.youtube.com/watch?v=wvsboPUjrGc" target="_blank">the monkey dance</a> and <a title="Youtube video of &quot;Developers! Developers!&quot; (139 hits)" href="http://ursecta.com/wp/go.php?http://www.youtube.com/watch?v=KMU0tzLwhbE&amp;NR=1&amp;feature=fvwp" target="_blank">yelled &#8220;Developers, developers&#8230;!&#8221;</a> at two different, equally traumatizing, occasions. I&#8217;m not sure that&#8217;s any better, though. It&#8217;s all very disturbing.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://ursecta.com/wp/2009/08/the-real-iphone-conspiracy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MS patch of&#8230; Firefox?</title>
		<link>http://ursecta.com/wp/2009/06/ms-patch-of-firefox/</link>
		<comments>http://ursecta.com/wp/2009/06/ms-patch-of-firefox/#comments</comments>
		<pubDate>Fri, 05 Jun 2009 09:36:36 +0000</pubDate>
		<dc:creator>martin</dc:creator>
				<category><![CDATA[Dotnet]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://ursecta.com/wp/?p=238</guid>
		<description><![CDATA[To quote an article on annoyances.org about the new ClickOnce install support that MS has added to .NET: The Microsoft .NET Framework 3.5 Service Pack 1 update, pushed through the Windows Update service to all recent editions of Windows in February 2009, installs the Microsoft .NET Framework Assistant firefox extension without asking your permission. This [...]]]></description>
			<content:encoded><![CDATA[<p>To quote an <a href="http://ursecta.com/wp/go.php?http://annoyances.org/exec/show/article08-600" target="_blank" title="(140 hits)">article on annoyances.org</a> about the new ClickOnce install support that MS has added to .NET:</p>
<blockquote><p>The <a href="http://ursecta.com/wp/go.php?http://support.microsoft.com/kb/951847" target="_blank" title="(132 hits)">Microsoft .NET Framework 3.5 Service Pack 1</a> update, pushed through the Windows Update service to all recent editions of Windows in February 2009, installs the Microsoft .NET Framework Assistant firefox extension without asking your permission.<br />
This update adds to Firefox one of the most dangerous vulnerabilities present in all versions of Internet Explorer: the ability for websites to easily and quietly install software on your PC. Since this design flaw is one of the reasons you may&#8217;ve originally choosen to abandon IE in favor of a safer browser like Firefox, you may wish to remove this extension with all due haste.</p>
<p>Unfortunately, Microsoft in their infinite wisdom has taken steps to make the removal of this extension particularly difficult &#8211; open the Add-ons window in Firefox, and you&#8217;ll notice the Uninstall button next to their extension is grayed out! Their reasoning, according to <a href="http://ursecta.com/wp/go.php?http://blogs.msdn.com/brada/archive/2009/02/27/uninstalling-the-clickonce-support-for-firefox.aspx" target="_blank" title="(162 hits)">Microsoft blogger Brad Abrams</a>, is that the extension needed &#8220;support at the machine level in order to enable the feature for all users on the machine,&#8221; which, of course, is precisely the reason this add-on is bad news for all Firefox users.</p></blockquote>
<p>And then follows a convoluted procedure to hack the crap out of the registry. <a href="http://ursecta.com/wp/go.php?http://annoyances.org/exec/show/article08-600" target="_blank" title="(140 hits)">Go there, read it</a>, do it, if you run Windows, this service pack, and Firefox.</p>
<p>Tech Republic put it like this:</p>
<blockquote><p>In a surprise move this year, Microsoft has decided to quietly install what amounts to a massive security vulnerability in Firefox without informing the user. Find out what Microsoft has to say about it, and how you can undo the damage.</p></blockquote>
<p>Read the entire <a href="http://ursecta.com/wp/go.php?http://blogs.techrepublic.com.com/security/?p=1716&amp;tag=nl.e019" target="_blank" title="(149 hits)">Tech Republic article</a>.</p>
<p><em>PS: this isn&#8217;t exactly news (the annoyances.org article is dated February 27, 2009), but I only just noticed through a posting by Rob S on a private list.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://ursecta.com/wp/2009/06/ms-patch-of-firefox/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A feature?</title>
		<link>http://ursecta.com/wp/2009/01/a-feature/</link>
		<comments>http://ursecta.com/wp/2009/01/a-feature/#comments</comments>
		<pubDate>Fri, 16 Jan 2009 13:29:18 +0000</pubDate>
		<dc:creator>martin</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Dotnet]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://ursecta.com/wp/?p=170</guid>
		<description><![CDATA[Had to use the Directory.GetFiles() method in .NET, so I read the description. Now, take a moment and read the following about how an asterisk wildcard character works in the search pattern parameter. Then tell me if this description is of a feature or of a bug. Windows, largely due to legacy, is full of [...]]]></description>
			<content:encoded><![CDATA[<p>Had to use the Directory.GetFiles() method in .NET, so I read the description. Now, take a moment and read the following about how an asterisk wildcard character works in the search pattern parameter. Then tell me if this description is of a feature or of a bug. Windows, largely due to legacy, is full of this crap.</p>
<p style="padding-left: 30px;"><em>When using the asterisk wildcard character in a searchPattern, such as &#8220;*.txt&#8221;, the matching behavior when the extension is exactly three characters long is different than when the extension is more or less than three characters long. A searchPattern with a file extension of exactly three characters returns files having an extension of three or more characters, where the first three characters match the file extension specified in the searchPattern. A searchPattern with a file extension of one, two, or more than three characters returns only files having extensions of exactly that length that match the file extension specified in the searchPattern. When using the question mark wildcard character, this method returns only files that match the specified file extension. For example, given two files, &#8220;file1.txt&#8221; and &#8220;file1.txtother&#8221;, in a directory, a search pattern of &#8220;file?.txt&#8221; returns just the first file, while a search pattern of &#8220;file*.txt&#8221; returns both files.</em></p>
<p>and:</p>
<p style="padding-left: 30px;"><em>Because this method checks against file names with both the 8.3 file name format and the long file name format, a search pattern similar to &#8220;*1*.txt&#8221; may return unexpected file names. For example, using a search pattern of &#8220;*1*.txt&#8221; returns &#8220;longfilename.txt&#8221; because the equivalent 8.3 file format is &#8220;LONGFI~1.TXT&#8221;.</em></p>
<p>The conclusion must be that this function is worse than useless and bound to cause excruciating bugs in your apps. Better use the GetFiles() method without any search pattern and then filter using a regex.</p>
]]></content:encoded>
			<wfw:commentRss>http://ursecta.com/wp/2009/01/a-feature/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The end of .NET? I can&#8217;t wait.</title>
		<link>http://ursecta.com/wp/2008/12/the-end-of-net-i-cant-wait/</link>
		<comments>http://ursecta.com/wp/2008/12/the-end-of-net-i-cant-wait/#comments</comments>
		<pubDate>Mon, 29 Dec 2008 13:43:54 +0000</pubDate>
		<dc:creator>martin</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Dotnet]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[OSX Dev]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[MSDN]]></category>
		<category><![CDATA[OSX]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[XCode]]></category>

		<guid isPermaLink="false">http://ursecta.com/wp/?p=167</guid>
		<description><![CDATA[Ok, I admit, that title is a bit over the edge, but still that is how I feel. Developing for .NET is increasingly becoming not fun and far too expensive. The only reason to do it is because customers expect products for .NET, but under slowly increasing pressure from developers, that is going to change. [...]]]></description>
			<content:encoded><![CDATA[<p>Ok, I admit, that title is a bit over the edge, but still that is how I feel. Developing for .NET is increasingly becoming not fun and far too expensive. The only reason to do it is because customers expect products for .NET, but under slowly increasing pressure from developers, that is going to change. It may take a while, but it will happen. There are a number of reasons for this.</p>
<p>.NET development is single platform. Admittedly the largest platform, but a platform that is increasingly having to share the market with other platforms. And already, according to some, there&#8217;s more sales potential for small developers in the OSX market than in the Windows market, due to a number of factors like customers that are more willing to buy and to pay for software, less competition in each market segment, etc.</p>
<p>.NET development is also entirely dependent on Microsoft&#8217;s development tools and those are increasingly expensive. For reasonable development, you need an IDE, a good compiler, version control, bug handler, coverage analysis, profiling, and a few more. We used to have most of that in the regular Visual Studio, but recently MS has removed all the goodies and plugged them into the Team system only, which carries an obscene pricetag (in Sweden around USD 13,000 + VAT for the first year&#8230;). This means that a regular one-man development shop can barely afford the crippled Visual Studio Professional at USD 1,500 for the first year. Sadly, there aren&#8217;t even any decent and affordable third party products to complement the VS Pro so it becomes a &#8220;real&#8221; development suite. And with every version of Visual Studio this only gets worse. More and more features are added to the Team suite and removed from the Pro. This is not the way to breed a happy following.</p>
<p>Meanwhile, OSX comes with XCode, which is almost as good as Visual Studio Pro, and is free. Objective-C is also a much more modern language with more depth than any .NET language, even though it is actually older. But, sadly, it&#8217;s not cross platform either and I don&#8217;t see how you can get the Windows fanboys of the Scandiavian healthcare scene to even consider another platform. Same probably goes for most other industries.</p>
<p>I&#8217;m no fan of Java, but on the other hand I&#8217;ve never worked much with it so that opinion doesn&#8217;t count. Eclipse, the IDE often used for Java development, is cross platform, very capable, and open for other languages such as Python, Flex, and many more. Yes, I know, in theory so is Visual Studio, but how many real languages do you have there? You&#8217;ve got one: Basic, masquerading as C#, J#, and, um, Basic.</p>
<p>Using Eclipse on any platform, you&#8217;ve got a real good chance of covering the line of tools you need, profilers, coverage, version control, without much pain and without breaking the bank. And you can write crossplatform integrated larger systems.</p>
<p>So, I guess it&#8217;s time to bite the bullet. I really like XCode and OSX, I really know C# and .NET, but I really only believe in Java, Flex, Python, Perl, C++ under Eclipse for enterprise development in vertical markets. And in XCode under OSX for regular shrinkwrapped desktop apps.</p>
<p>Not even Silverlight is very attractive and that is largely due to the marketing and pricing of the tools for it. A small developer organisation can&#8217;t afford it. Flex and AIR looks like serious contenders, though.</p>
]]></content:encoded>
			<wfw:commentRss>http://ursecta.com/wp/2008/12/the-end-of-net-i-cant-wait/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>x2c source</title>
		<link>http://ursecta.com/wp/2008/12/x2c-source/</link>
		<comments>http://ursecta.com/wp/2008/12/x2c-source/#comments</comments>
		<pubDate>Fri, 05 Dec 2008 15:46:12 +0000</pubDate>
		<dc:creator>martin</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Dotnet]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[code generator]]></category>
		<category><![CDATA[GPL]]></category>
		<category><![CDATA[source code]]></category>
		<category><![CDATA[tools]]></category>
		<category><![CDATA[x2c]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://ursecta.com/wp/?p=136</guid>
		<description><![CDATA[I finally got around to putting up the source code for x2c under GPL. No, you haven&#8217;t heard of this thing and it may not seem immediately useful, but when it is useful, it&#8217;s incredibly useful. The hardest thing is coming up with full samples of what it can do, so I&#8217;ll just outline it [...]]]></description>
			<content:encoded><![CDATA[<p>I finally got around to putting up the <a title="Page on wehlou.com with download link (121 hits)" href="http://ursecta.com/wp/go.php?http://www.wehlou.com/x2c/index.htm" target="_blank">source code for x2c</a> under GPL. No, you haven&#8217;t heard of this thing and it may not seem immediately useful, but when it is useful, it&#8217;s incredibly useful. The hardest thing is coming up with full samples of what it can do, so I&#8217;ll just outline it right here.</p>
<p>x2c stands for &#8220;XML to Code&#8221;, and it&#8217;s an interpreter for a little language I made with built-in commands to handle XML documents and write to plain text output files.</p>
<p>It started life as a tool to create VB and C# source code for data access layer classes, based on XML descriptions of an Oracle database. Another possibility is generating language tables from Excel spreadsheets, and I&#8217;ll tell you how:</p>
<p>Imagine an Excel spreadsheet with one sentence per row. In each column, the same sentence is written in another language, like Swedish, English, French, etc. Save the spreadsheet as an XML document. Now you can write a pretty short x2c script that reads these languages, column by column, and then produces a C++ header file with the right strings declared as constants. Great for products you want to recompile for a number of human languages.</p>
<p><img class="alignnone" title="x2c source for language example" src="/images/20081205/387.jpg" alt="" width="500" height="606" /></p>
<p>Especially for this last use, I recently adapted the text output file command in x2c to allow output to ASCII, unicode (default), or any codepage you have installed on the Windows system you&#8217;re running this thing on. In the above script example, you see codepage 1251 used for Russian. In this case this was necessary since the C++ compiler used (Borland) couldn&#8217;t use unicode header files. This script runs under US or Swedish XP and Vista, as long as codepage 1251 is also installed on the system, and then produces the right MBCS file for Borland C++, resulting in binaries that will look real to russians running russian versions of Windows. Note that above is the <em>complete</em> script that is needed to convert the excel spreadsheet to four different C++ header files and it can easily be run from a build script.</p>
<p>The source is C++ in a VS 2008 solution. Have a go at it.</p>
]]></content:encoded>
			<wfw:commentRss>http://ursecta.com/wp/2008/12/x2c-source/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Strongly typed constant parameters in C#</title>
		<link>http://ursecta.com/wp/2008/10/strongly-typed-parameters-in-c/</link>
		<comments>http://ursecta.com/wp/2008/10/strongly-typed-parameters-in-c/#comments</comments>
		<pubDate>Wed, 29 Oct 2008 12:53:04 +0000</pubDate>
		<dc:creator>martin</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Dotnet]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[constants]]></category>
		<category><![CDATA[csharp]]></category>
		<category><![CDATA[enum]]></category>
		<category><![CDATA[functions]]></category>
		<category><![CDATA[static]]></category>
		<category><![CDATA[strongly typed parameter]]></category>

		<guid isPermaLink="false">http://ursecta.com/wp/?p=110</guid>
		<description><![CDATA[After a bit of searching, I found a way to have strongly typed constant parameters for C# functions. You know the situation, where you need to pass one of a limited set of strings or chars or other values to a function and you want to make sure somebody doesn&#8217;t just go and pass any [...]]]></description>
			<content:encoded><![CDATA[<p>After a bit of searching, I found a way to have strongly typed constant parameters for C# functions. You know the situation, where you need to pass one of a limited set of strings or chars or other values to a function and you want to make sure somebody doesn&#8217;t just go and pass any old thing they find laying around the place. Enums are pretty good for this kind of thing, but it gets hairy if you need to translate it to anything else, like a string or a char.</p>
<p>Any solution also needs to pander to intellisense, making it easy to use and kinda idiot safe (I&#8217;m talking about myself a couple of hours after defining any constant, which usually leads to me behaving like the idiot user I had a hard time envisioning just hours earlier).</p>
<p>I think I found a good system for doing this, and as an example, I&#8217;ll invent a function that takes a string parameter, but it has to be just the right kind of string. To do that, I first declare the constant strings in a separate module this way:</p>
<p><img src="/images/20081029/336.jpg" alt="" /></p>
<p>Then I write my function, the fictional &#8220;Rechandler&#8221; that takes a parameter of the ConstRecTypeValue kind. And then I write a function that calls it. Now, while writing the caller, I want intellisense to do its thing, and it does:</p>
<p><img src="/images/20081029/334.jpg" alt="" /></p>
<p>As you can see, it obediently pops up a tooltip to tell me only a ConstRecTypeValue is accepted here. As soon as I start to type that, it recognizes the ConstRecType static class name and it intellisensively lets me choose which constant member I want:</p>
<p><img src="/images/20081029/333.jpg" alt="" /></p>
<p>&#8230;which I complete the usual way:</p>
<p><img src="/images/20081029/335.jpg" alt="" /></p>
<p>The callee (Rechandler) then easily recovers the string that is hiding inside the passed value (in this case &#8220;DELETED&#8221;) and continues its merry ways.</p>
<p>Naturally, you can use chars, doubles or entire collections of values instead of the string value in this example and still achieve the same effect.</p>
<p>You can also take it one step further along the path to universality, by using a generic base class for the value type:</p>
<p><img src="/images/20081029/337.jpg" alt="" /></p>
<p>If you have this guy in reach in your project somewhere, you can now simplify the definition of the value class like so:</p>
<p><img src="/images/20081029/338.jpg" alt="" /></p>
<p>&#8230;while everything else stays just the same.</p>
<p>I love it.</p>
]]></content:encoded>
			<wfw:commentRss>http://ursecta.com/wp/2008/10/strongly-typed-parameters-in-c/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Reflect on those constants</title>
		<link>http://ursecta.com/wp/2008/10/reflect-on-those-constants/</link>
		<comments>http://ursecta.com/wp/2008/10/reflect-on-those-constants/#comments</comments>
		<pubDate>Thu, 09 Oct 2008 15:19:07 +0000</pubDate>
		<dc:creator>martin</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Dotnet]]></category>
		<category><![CDATA[configuration]]></category>
		<category><![CDATA[const]]></category>
		<category><![CDATA[csharp]]></category>
		<category><![CDATA[dictionary]]></category>
		<category><![CDATA[fieldinfo]]></category>
		<category><![CDATA[reflection]]></category>
		<category><![CDATA[settings]]></category>
		<category><![CDATA[string]]></category>

		<guid isPermaLink="false">http://ursecta.com/wp/?p=108</guid>
		<description><![CDATA[This falls in the category &#8220;neat tricks&#8221; and definitely under &#8220;DRY&#8221; (Don&#8217;t Repeat Yourself). When you have a list of constants that you need to save or retrieve, typically settings, you easily get into a situation where you have say 20 constant strings defining the names of your constants, and then a block of code [...]]]></description>
			<content:encoded><![CDATA[<p>This falls in the category &#8220;neat tricks&#8221; and definitely under &#8220;DRY&#8221; (Don&#8217;t Repeat Yourself). When you have a list of constants that you need to save or retrieve, typically settings, you easily get into a situation where you have say 20 constant strings defining the names of your constants, and then a block of code going through the same 20 variables to retrieve or save them. When you add a constant, you&#8217;ve got at least three places to add code and then I&#8217;m not even counting the places where you actually use the settings value.</p>
<p>But using reflection in C#, you can easily make it so the system retrieves all your constants and their values into a dictionary at runtime and saves them back, using nothing but the declaration of the string constants.</p>
<p>This is an example of a declaration of the names of the values we want to save and restore:</p>
<p><img src="/images/20081009/316.jpg" alt="" width="589" height="238" /></p>
<p>And this is code that then gets the values of those constants and sticks them into a dictionary in runtime. The rest of the code is trivial and not worth reproducing here</p>
<p><img src="/images/20081009/317.jpg" alt="" width="460" height="198" /></p>
]]></content:encoded>
			<wfw:commentRss>http://ursecta.com/wp/2008/10/reflect-on-those-constants/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

