<?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>Overanalyzed &#187; Technology</title>
	<atom:link href="http://coollabssoft.com/blog/index.php/category/all/technology/feed/" rel="self" type="application/rss+xml" />
	<link>http://coollabssoft.com/blog</link>
	<description>A Systems Analyst's thoughts on science, technology, programming, business, and occasionally politics.</description>
	<lastBuildDate>Sun, 08 Nov 2009 22:23:17 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>New CPU Instruction</title>
		<link>http://coollabssoft.com/blog/2009/04/28/new-cpu-instruction/</link>
		<comments>http://coollabssoft.com/blog/2009/04/28/new-cpu-instruction/#comments</comments>
		<pubDate>Tue, 28 Apr 2009 15:12:22 +0000</pubDate>
		<dc:creator>Chris Davenport</dc:creator>
				<category><![CDATA[Science]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://coollabssoft.com/blog/?p=16</guid>
		<description><![CDATA[I&#8217;m going to propose a new CPU instruction. Purely theoretical for now, but interesting to talk about. At least I hope so.
My new CPU instruction is going to load into EAX the value of EAX from 10 seconds in the future.
Crazy talk, I know. But I&#8217;m going to ignore the &#8220;you can&#8217;t do that!&#8221; aspect, [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m going to propose a new CPU instruction. Purely theoretical for now, but interesting to talk about. At least I hope so.</p>
<p>My new CPU instruction is going to load into EAX the value of EAX from 10 seconds in the future.</p>
<p>Crazy talk, I know. But I&#8217;m going to ignore the &#8220;you can&#8217;t do that!&#8221; aspect, because that&#8217;s just silly rejectionism. Instead, I&#8217;m going to think about how to actually implement the instruction. </p>
<p><span id="more-16"></span><br />
Supposing we had a second computer, nay, a supercomputer available. That supercomputer has a virtual machine in it, that exactly matches our machine. It&#8217;s going to pack 10 seconds of runtime of our computer into the time to execute one instruction, and provide the value back to our machine.</p>
<p>And we&#8217;ve implemented it. Well, with a few exceptions.. Our virtual machine simulator doesn&#8217;t have the connection to a supercomputer to provide the same 10 seconds in the future instruction. We&#8217;d need an even more super computer. Also, I&#8217;ve assumed that 10 seconds of runtime is 10 seconds of realtime, which may or may not hold.</p>
<p>That isn&#8217;t anything new really, that&#8217;s an old turing machine problem. The question of whether a turing machine can determine if a program for that machine will ever halt is considered unsolvable by that same machine.</p>
<p>But that&#8217;s because we need that external connection to the supercomputer to give us that 10 seconds&#8217; future result.</p>
<p>Supposing we didn&#8217;t. We already know about virtual machines. We already know we can run, on one machine, a virtual machine that just emulates everything. If we don&#8217;t worry about time and memory, we could concieveably do all this on one machine, by just firing up a virtual machine that&#8217;s a copy of our currently running machine, running it for 10 seconds, then returning to our original machine with the result.</p>
<p>That one can even provide the same 10-seconds&#8217; future EAX, by just creating a second virtual machine within the virtual machine.</p>
<p>So my instruction is going to be a FORK. It means &#8220;clone yourself and continue, then in 10 seconds, die and return EAX&#8221; </p>
<p>It&#8217;s an interesting instruction. We already use branch prediction and pipelining very similarly. And it highlights something we should have noticed earlier. Of COURSE a turing machine can solve the problem of it ever halting. It just takes the machine waiting for itself to run to completion. </p>
<p>One of the interesting problems with FORK in software is telling the two apart. If we really execute a FORK instruction, and really accomplish it, then the new machine is expecting the results of a fork instruction in EAX. Supposing the next instruction is the equivalent of &#8220;oh, well, don&#8217;t do that then&#8221;.</p>
<p>What should the fork instruction assume? should it assume a value at all? should it nest again? we&#8217;ll just run out of resources cloning machines. Maybe throw a temporal processor exception?</p>
<p>I see a paradox. There is one here, there&#8217;s no way to just nest machines forever. Paradoxes by their nature is interesting, because they either can&#8217;t happen, or can&#8217;t not happen. So if it&#8217;s not happening, it never will. And if it is happening, it&#8217;s a tautology and always will.</p>
<p>So press onward. We don&#8217;t need to nest forever. EAX is only 32 bits. We only need to create 2^32 virtual machines, each with a different value for EAX, let them all run, and figure out which one resolves the paradox. Which machines, when given a value for EAX, actually produce that same value in 10 seconds time.</p>
<p>And the instruction, the same for all of them, is now &#8220;Guess and Explode if Wrong&#8221; (GEW?), and of course we throw away the one that guesses it explodes, though I suppose that can&#8217;t happen because &#8220;exploded&#8221; isn&#8217;t a valid value of EAX, but now we have the problem of them all exploding.</p>
<p>We&#8217;ve gotten around the requirement of requiring intramachine communication, though we still have the cellular automata problem of a machine copying itself, but it stands to reason that if we can copy it, we can also copy it with a new value of Guessed EAX.</p>
<p>If we keep the VM on the same machine, running inside the same machine, then we can answer the larger class of turing problems, provided that we have a specific limitation on the instruction set. There can&#8217;t be a halt instruction, because that can&#8217;t be emulated without halting the machine, we&#8217;re working with non-self-modifying code here, and there must be a return-to-host-or-halt instruction. With those two limits, one program can analyze another and determine if it ever halts within an arbitrary limit, by running it for that long. And the only reason we can&#8217;t say if a program will EVER halt is because we can&#8217;t run it one step past forever and see.</p>
<p>But that&#8217;s for really complicated predictions. Most predictions in a computer system can be made more simply. If all we want to know is the result of a function call, we can do that in the same machine, by setting up a little function-calling sandbox closure and calling it.</p>
<p>I wrote a patent similar to this, many years ago, in which an application could trade runtime for user input, by cloning itself and predicting that input, and then destroying those that guessed wrong. It&#8217;s even trainable using standard net techniques.</p>
<p>Pretty easy to see how this technique could be used in a distributed processing system, the function-closure model is very similar to google&#8217;s map/reduce, and I doubt it will be long before the OS vendors figure out that they can export memory and runtime to other systems.</p>
]]></content:encoded>
			<wfw:commentRss>http://coollabssoft.com/blog/2009/04/28/new-cpu-instruction/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>On Applications, OSes, and VMs</title>
		<link>http://coollabssoft.com/blog/2009/03/18/on-applications-oses-and-vms/</link>
		<comments>http://coollabssoft.com/blog/2009/03/18/on-applications-oses-and-vms/#comments</comments>
		<pubDate>Thu, 19 Mar 2009 00:31:40 +0000</pubDate>
		<dc:creator>Chris Davenport</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Operating Systems]]></category>
		<category><![CDATA[OS]]></category>
		<category><![CDATA[Virtual Machines]]></category>
		<category><![CDATA[VM]]></category>

		<guid isPermaLink="false">http://coollabssoft.com/blog/?p=14</guid>
		<description><![CDATA[I&#8217;ve lately begun to realize that when a common problem shows up, it&#8217;s often the symptom of something else. Such as when customers complain about the amount of rBGH in their food, manufacturers can decide to avoid it, not avoid it, or, and more intelligently, create two products and sell to everyone.
Writing about how my [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve lately begun to realize that when a common problem shows up, it&#8217;s often the symptom of something else. Such as when customers complain about the amount of rBGH in their food, manufacturers can decide to avoid it, not avoid it, or, and more intelligently, create two products and sell to everyone.</p>
<p>Writing about how my less savvy family members are terrified of anyone touching their computer, for fear of damaging the stuff they use, I got thinking about the problem that their issues are showing exists. Because applications do have that problem.</p>
<p><span id="more-14"></span></p>
<p>One solution I often see are VMs, but the solution is less interesting than the reason. Why are VMs better than applications? Separate OSes can&#8217;t interfere with each other the way separate applications can. But really they have the same requirements. Independent hardware interfaces, protected memory, protected processor time, so why aren&#8217;t applications exactly as rock-solid as a VM is? So far the only answer I can come up with is the OS sucks. Sucks because it allows applications to indirectly destabilize each other through it&#8217;s interactions with the app.</p>
<p>From a windows perspective, some of that is solvable, some is not. Windows has grown to the point where separate users are handled reasonably well, though not yet perfectly, such that it&#8217;s almost impossible for one non-admin user to break something in a different non-admin user&#8217;s session.</p>
<p>It does that by keeping a separate registry for each user. (mostly). It doesn&#8217;t do that for applications though, so if I change network settings in Yahoo, and it decides to be [un]helpful and propagate those to the IE/Windows (integrated) registry key, it could potentially break IE or any other app that uses those settings. Though not without UAC confirmation now.</p>
<p>Fair time to the Linux side (fair isn&#8217;t fair, interesting. But offtopic).. Linux handles multiple users very well, even allows CPU runtime quotas, and it&#8217;s virtually impossible for one app to take out another, even indirectly through syscalls. Might be able to do something with IOCTLs, or otherwise cause IO bottlenecking that slows the whole system, but I&#8217;m not sure exactly how. Linux is also pretty good about service accounts, where the vanilla kernel does almost nothing on its own, used to be that you needed a service running just to ping it, though that&#8217;s a kernel module now.</p>
<p>The various fans generally tell me that windows is just as capable in that regard, and I have no doubt the windows kernel is.</p>
<p>I&#8217;m pretty sure granddad is admin of his box. He doesn&#8217;t log in. I think if I changed the autologin username to a non-administrative user, he&#8217;d just call me up and complain that he couldn&#8217;t install some software he bought, and the local pc repair place would simply reformat his machine with blank admin windows, business-pirated. They all seem to do that now.</p>
<p>What&#8217;s at question here is the application framework, even if granddad weren&#8217;t admin, and could install an app that is totally contained within his specific windows environment, one evyl (www.stopbadware.org) install later and he&#8217;s still got 15 IE plugins he can&#8217;t get rid of. </p>
<p>Android, that little Linux/Java OS Google wrote on the G1 phone, runs each application as a separate user. as it&#8217;s own user. Apps are incapable of interacting with each other, unless they specifically decide to keep things in common locations.. Like the SDCard where all your &#8220;good data&#8221; is stored is visible to all apps, and there have been a few already that brokenly delete all SDCard contents&#8230;.. music/photos/all non-phonebook user data. Oops.</p>
<p>It makes IPC tough, but not impossible. Google&#8217;s got a few special mechanisms in place, particularly for starting/stopping other apps or invoking them dialog-box style.</p>
<p>But I digress. My point was the OS doesn&#8217;t seem to be doing its job, applications should be as isolated from each other as users are, even so far as having their own copy of system-wide configurations, like the registry, with administrative-oversight propagation to other apps or the whole system.</p>
<p>Some of that dependency is inevitable. If you update a video driver, it&#8217;s necessarily going to affect everything that uses video. That&#8217;s even true for a VM, to some extent. Video in a VM is still pretty crappy though, I don&#8217;t think you can use OpenGL/D3D in a VM, though I see no reason why it couldn&#8217;t.</p>
]]></content:encoded>
			<wfw:commentRss>http://coollabssoft.com/blog/2009/03/18/on-applications-oses-and-vms/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>On Security of Operating systems</title>
		<link>http://coollabssoft.com/blog/2008/12/29/on-security-of-operating-systems/</link>
		<comments>http://coollabssoft.com/blog/2008/12/29/on-security-of-operating-systems/#comments</comments>
		<pubDate>Mon, 29 Dec 2008 17:12:07 +0000</pubDate>
		<dc:creator>Chris Davenport</dc:creator>
				<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://coollabssoft.com/blog/?p=11</guid>
		<description><![CDATA[I was reading about yet another zero day exploit for IE and Windows, on the heels of a security update for same because of an existing unpatched vulnerability that&#8217;s been causing pain to many over the past few weeks.
Honestly, you could write the above two lines any time over the past 12 years, and it [...]]]></description>
			<content:encoded><![CDATA[<p>I was reading about yet another zero day exploit for IE and Windows, on the heels of a security update for same because of an existing unpatched vulnerability that&#8217;s been causing pain to many over the past few weeks.</p>
<p>Honestly, you could write the above two lines any time over the past 12 years, and it wouldn&#8217;t look out of place.</p>
<p><span id="more-11"></span></p>
<p>Security is an ongoing concern, which is weird, because it doesn&#8217;t seem to be solved. A lot of times it&#8217;s an afterthought, and security is challenging enough to begin with. I&#8217;m regularly amazed by the utter lack of security that exists for convenience&#8217;s sake. The two do tend to contradict, but so often are pitted opposite through accident, afterthought, or intent.</p>
<p>So why must there be patches? I understand generally that if there&#8217;s a bug, it needs to be fixed, so patch it. But to take another tack, if word wrecks my formatting, then all I do is reformat it. If an app crashes or doesn&#8217;t work the way I want, deletes my files, I don&#8217;t run it, don&#8217;t use it. If I install it and it turns out badly, I uninstall it.</p>
<p>I wonder if similar approaches can be used with OS or DLL or standard library calls?</p>
<p>Basically, the OS should allow you to hook those calls, check the parameters, and do something else. Windows and others already have syscall hooks for auditing purposes, that&#8217;s where we get strace output and the like, so security can be maintained, and the mechanisms are there. It hasn&#8217;t been extended to the dynamic loader, however, and there isn&#8217;t any way for you, as an administrator, to change something so that word, specifically, doesn&#8217;t have the ability to open a socket to ha.cx, write to the boot.ini file, call GetObjectEx with a bad CLSID, or some other evil act.</p>
<p>Seems like it would be pretty easy to isolate the bad behavior in that way, at the OS level, and give you back a little control over what these applications do with your system.</p>
]]></content:encoded>
			<wfw:commentRss>http://coollabssoft.com/blog/2008/12/29/on-security-of-operating-systems/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>&#8220;It just works&#8221;</title>
		<link>http://coollabssoft.com/blog/2008/11/07/it-just-works/</link>
		<comments>http://coollabssoft.com/blog/2008/11/07/it-just-works/#comments</comments>
		<pubDate>Sat, 08 Nov 2008 01:48:24 +0000</pubDate>
		<dc:creator>Chris Davenport</dc:creator>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[justworks]]></category>

		<guid isPermaLink="false">http://coollabssoft.com/blog/?p=9</guid>
		<description><![CDATA[There&#8217;s been a lot of talk about &#8220;It Just Works&#8221; lately, probably due to the renewed popularity of the Mac platforms. I recall quite a few &#8220;just works&#8221; promises in the past. Plug and Play was supposed to be that. Heck, the very meaning of the phrase is almost identical.
The problem with &#8220;It Just Works&#8221; [...]]]></description>
			<content:encoded><![CDATA[<p>There&#8217;s been a lot of talk about &#8220;It Just Works&#8221; lately, probably due to the renewed popularity of the Mac platforms. I recall quite a few &#8220;just works&#8221; promises in the past. Plug and Play was supposed to be that. Heck, the very meaning of the phrase is almost identical.</p>
<p>The problem with &#8220;It Just Works&#8221; is &#8220;It Just Doesn&#8217;t&#8221;. </p>
<p><span id="more-9"></span><br />
I can&#8217;t count the number of times some unnamed thing has gone wrong and prevented something from &#8220;just working&#8221;. I had a windows box that lost its drivers. The built-in drivers that ship with windows. Lost. Plug in a USB key, and it asks you to install the USB Storage driver. Or the Floppy Disk driver. Could make it work, browse to the windows driver directory, find the file that&#8217;s already in the OS driver collection, and tell it to use that one, and it goes. Still, a normal user confronted with such things is immediately lost, all because windows can&#8217;t find it&#8217;s own driver database, which should &#8220;just work&#8221;, for a USB generic device, which should also &#8220;just work&#8221;.</p>
<p>This morning I had a RedHat 5 system that couldn&#8217;t see it&#8217;s PS/2 mouse. i8202 driver loaded, gets interrupts from the keyboard, no problem, no mouse. You&#8217;re not supposed to have to reboot Linux, but what can one do when the bus just won&#8217;t talk to the device? Yeah, yeah, go hardcore CTRL-ALT-F1 and drop that sissy graphical desktop. I did. But that&#8217;s not fixing my mouse. I&#8217;m just glad it wasn&#8217;t the keyboard. PS/2 mice are old technology that in my limited experience &#8220;just work&#8221; the large majority of the time, except this time it &#8220;just doesn&#8217;t&#8221;.</p>
<p>Virtually all of those situations are met with puzzlement and the suggestion to reinstall and/or reboot by the tech support of the world. I&#8217;ve been tech support, and I hate that approach because it doesn&#8217;t tell you how you got there or ensure you won&#8217;t get there again, though occasionally I have little option. Incidentally, that&#8217;s one of the things I dislike about the Mac. Fewer knobs and settings to fiddle with to fix things when they&#8217;re broken. I agree all the tweaks shouldn&#8217;t be presented to the user generally, but they should be accessible somewhere. Windows does a little better, though also much worse, if you have any experience with the registry (of doom!). Linux does better still, though again, much worse, virtually every knob and dial is available to a linux admin, you just have to know what where to find the knob, where to find the changes it makes, what to look for, and how to read what you find.. A lot is documented, and if you&#8217;re so inclined, you can probably go read the code, which you&#8217;ll have to do if google doesn&#8217;t pan out. Of course, now you&#8217;re a theoretical administrator who has all that time to fix the problem, and it&#8217;s probably pointless since they don&#8217;t pay or listen to noncorporeal sysadmins.</p>
<p>Of course, there are systems for which a reboot or reinstall meaningless&#8230;.</p>
<p>I set up powerline networking recently, HomePlug AV protocol, specific device is probably irrelevant, they all advertise &#8220;plug and go&#8221;. It didn&#8217;t work. My device was able to get an IP off my home network, but every time it tried to update itself, it failed. Could be poor circuit layout, too much distance, the unavoidable power strip I had in the mix. I relocated it to an adjacent outlet and did some testing, I was losing 14% of all pings. No explanation, no diagnostics or other setting manipulation possible. I upgraded the firmware. Blindly, I might add, since none of them mention what&#8217;s changed or why I&#8217;d want to upgrade. But it works now. More of a &#8220;it just works after you fiddle with it&#8221; situation, which is true of virtually everything.</p>
<p>SlingBox did the same thing. It&#8217;s been a great product for the &#8220;just works&#8221; situation, except now it&#8217;s forgetting remote codes. Error 93260000, nicely unexplained and ignored by their tech support. Forums are full of witch doctor fixes &#8220;reboot it twice and resave the configuration&#8221;, hold the power button for 5 seconds, etc. It&#8217;s only been a problem since the slingplayer 2.0 upgrade.. Which has had it&#8217;s hardware performance requirements jacked up to the point where my 2GHz laptop can&#8217;t play video anymore, even though it was doing fine with 1.5 at ~4300Kbps HD quality video, that&#8217;s now a .Net app, in case you&#8217;re one of the converted. Downgraded that, reset the slingbox, and the remote codes are working again, for about an hour. Reset the slingbox, and it works again.. Connect the next day with nothing touching it in between, and they&#8217;re lost again. It just doesn&#8217;t work anymore. Must be something in the slingbox configuration and/or box firmware upgrade, though I&#8217;ve read on their forums that folks who haven&#8217;t upgraded the slingbox firmware are having the same problem.</p>
<p>I&#8217;ve worked in software/hardware development of commercial products, and the issue is usually time and testing. Can&#8217;t test every configuration, can&#8217;t get every bug fixed, can&#8217;t get every feature in. If it&#8217;s a new or emerging standard, like powerline ethernet, there&#8217;s often a lack of test tools. In the end, it&#8217;s a business decision. Eventually it costs you less money to ship it as is than to continue to work on it.</p>
<p>So I understand the issues with making perfect products, and I take &#8220;just works&#8221; with a grain of salt, trying hard not to insert the doesn&#8217;t. If you work on such products, I encourage you to check the error codes that should never happen, expose the dials under a hood for those that need them, and try to give some minimially unique and preferably useful (to a user) output when everything goes tits up.</p>
]]></content:encoded>
			<wfw:commentRss>http://coollabssoft.com/blog/2008/11/07/it-just-works/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Active and Reactive programming</title>
		<link>http://coollabssoft.com/blog/2008/10/24/active-and-reactive-programming/</link>
		<comments>http://coollabssoft.com/blog/2008/10/24/active-and-reactive-programming/#comments</comments>
		<pubDate>Sat, 25 Oct 2008 00:46:54 +0000</pubDate>
		<dc:creator>Chris Davenport</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[MVC]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://coollabssoft.com/blog/?p=8</guid>
		<description><![CDATA[Imperative languages like C and java and just about everything else I use are very demanding. You use the languages to say things like &#8220;do that&#8221;, and it does. Deeply fulfilling for a type A personality, I&#8217;m sure.
But it lacks something. Other languages, like lisp, prolog, etc.. have different concepts. I don&#8217;t know the computer [...]]]></description>
			<content:encoded><![CDATA[<p>Imperative languages like C and java and just about everything else I use are very demanding. You use the languages to say things like &#8220;do that&#8221;, and it does. Deeply fulfilling for a type A personality, I&#8217;m sure.</p>
<p>But it lacks something. Other languages, like lisp, prolog, etc.. have different concepts. I don&#8217;t know the computer science term for it, I think it&#8217;s &#8220;functional&#8221;, versus &#8220;imperative&#8221;, where you define what you want to happen, but not when. I think I can get a handle on it if I think in terms of actions.</p>
<p><span id="more-8"></span><br />
Active versus reactive. C programs are active, Lisp are reactive. One might wonder how a Lisp program gets anything done, since it&#8217;s not acting, just reacting. &#8220;This R2 unit&#8217;s got a bad motivator&#8221;.  But really, Lisp reacts to you, to the program being loaded, all sorts of things are around to react to.</p>
<p>Computers, however, do both. At the low levels of hardware, you have a CPU that responds to a clock signal and loads and runs instructions. Reality, you see, is reactive, so we put a clock trigger on it so that it&#8217;s always reacting, thus appearing active.</p>
<p>But that&#8217;s not changing. Well, not much. CPUs now actually chill for a while if they find an instruction to do so. In the meantime, we have an active CPU that is running instructions, and we also have hundreds of signals for asynchronous events. Interrupts for user input, system status, device communication, timers, all sorts of asynchronous stuff happening. And it&#8217;s all treated like the exception to the rule. Generally, that&#8217;s handled with fakery. Instead of actually responding to the interrupt event, you just make note the event happened, then when your regular imperative train comes around, it&#8217;ll pick up and deal with it then. And you hope that the time you spend making note is so small that there&#8217;s no perceptible loss of responsiveness.</p>
<p>I find it odd that when you get down to writing a GUI application or game or basically anything beyond a number-cruncher, you end up creating a special thread to actively wait for events, ironically enough. What you end up losing there is the ability to respond to multiple events. </p>
<p>If you get a pretty good platform going, with a good understanding of Interrupt handling and events, then it&#8217;ll probably provide a way to make your event thread, or it&#8217;s own event thread, as is increasingly common, chill out until the event actually happens, so it doesn&#8217;t go Noober on you asking if the event happened yet. Unfortunately, you&#8217;re often stuck with just the one thread, so here we are again handling asynchronous events synchronously, to the detriment of all. God help you if that thread dies or gets locked up, confused, spammed, or otherwise too distracted by acting reactive to actually react.</p>
<p>Now we have system designers eager to throw extra CPU cores at us, and our imperative design methods and languages, and lesser extent platforms, make it hard to do anything with or even think about except as multiple chugging-along trains, still with just one track.</p>
<p>Now I&#8217;m not a fan, and I never learned it, but a language like Lisp or SmallTalk seems to get things mostly right on that front. All the events are written almost as closures, and there&#8217;s nothing stopping them from happening simultaneously. Very elegant, very distributable, very scalable, for event driven things. Computer Scientists and Mathematicians get to be very happy, because it&#8217;s a minor tweak to make the language provable. But for actions, well, it gets weird again. You end up having to react to actions like the act or begin command being issued.</p>
<p>Just so you don&#8217;t think I&#8217;ve gone 100 miles off the reservation, think about the last webserver app you wrote. Maybe it started just generating some pages, with a database backend, but was basically doing everything on-demand. Somewhere along the line, you probably had to create some kind of service or hack or application or something to do something that needs to happen when there ISN&#8217;T a web request driving it. Update your database, delete cookies from users who just wandered away half an hour ago, invoke the Enterprise Java Bean your user requested, whatever.</p>
<p>It&#8217;s likely that at that point you wrote a service. Joel Spolsky writes about a &#8220;service&#8221; in his web application that waits for a user to load a special &#8220;go do maintenance stuff&#8221; URL, and the maintainer has to sit there and refresh while the thing gets &#8220;maintained&#8221; until the page returns something different. Jeff Atwood writes about a clever hack used to schedule events to run later in the webserver, using special tricks to get it to run without a user request.</p>
<p>It&#8217;s also likely at this point you discovered you needed the context of your application outside the webserver, which is often the reason to attempt to develop it within the web server itself, conforming to the reactive framework.</p>
<p>Or maybe you web-enabled your application that used to just chug. So you have it stop chugging every 30 minutes and write a special file with it&#8217;s latest status or apply another clever trick so that when the webserver is asked, it can pretend to actively generate the answer, conforming to the chug-along framework.</p>
<p>Honestly, it seems to me that right answer is in between these two. Write up some stuff that chugs along doing whatever it is you want done, and some stuff that responds to things that happen, and get a nice interaction layer between the two.</p>
<p>Last time I did it, I wrote a webservice and  an application that both used the same database. Web service would show users what&#8217;s up, make changes, whatever. System service would use that information to generate tasks. It wasn&#8217;t ideal, the two really couldn&#8217;t communicate well. It was almost, but not quite, Model-View-Controller, except I had one model with two viewcontrollers. Only leveraged part of the pattern. If I&#8217;d known better, I would have done more.</p>
<p>I don&#8217;t know of any languages that mix the concepts. Most pick one and hack the other in. Imperatives are more popular because they&#8217;re easier to understand, functionals because they&#8217;re easier to prove and generally hard to derail.</p>
]]></content:encoded>
			<wfw:commentRss>http://coollabssoft.com/blog/2008/10/24/active-and-reactive-programming/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Colors</title>
		<link>http://coollabssoft.com/blog/2008/09/30/colors/</link>
		<comments>http://coollabssoft.com/blog/2008/09/30/colors/#comments</comments>
		<pubDate>Tue, 30 Sep 2008 23:13:10 +0000</pubDate>
		<dc:creator>Chris Davenport</dc:creator>
				<category><![CDATA[Science]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[color]]></category>
		<category><![CDATA[prism]]></category>
		<category><![CDATA[rainbow]]></category>
		<category><![CDATA[violet]]></category>

		<guid isPermaLink="false">http://coollabssoft.com/blog/?p=7</guid>
		<description><![CDATA[Purple is an odd concept.
We see it as a combination of red and blue&#8230; because we have roughly RGB retinas&#8230; but then we see 50%R 50%G as yellow, when there&#8217;s a real yellow that just triggers 50%R 50%G.. We can&#8217;t see the difference though.
But there&#8217;s no frequency of light that corresponds to purple. Makes the [...]]]></description>
			<content:encoded><![CDATA[<p>Purple is an odd concept.</p>
<p>We see it as a combination of red and blue&#8230; because we have roughly RGB retinas&#8230; but then we see 50%R 50%G as yellow, when there&#8217;s a real yellow that just triggers 50%R 50%G.. We can&#8217;t see the difference though.</p>
<p>But there&#8217;s no frequency of light that corresponds to purple. Makes the color wheels seem a little goofy, honestly. And suddenly bothers me to find purple on manmade rainbows, when real rainbows have indigo and violet, neither of which have any red in them.</p>
<p><em><strong>EDIT:</strong> I recently discovered that the red cones in your eye actually do have a second peak in their response to color. Instead of a nice bell curve centered around red, it tails off more slowly in the high-frequency (green/blue) direction, and has a second, much lower hump above blue. This is why some people may see some purplish colors there, it&#8217;s signal confusion.</em></p>
<p><span id="more-7"></span><br />
Violet is past blue.. past indigo.. ultra indigo&#8230; Eyes don&#8217;t work at the ultraviolet frequencies. As you move your view across a rainbow, the light goes from yellow to green to blue, then it goes more blue to indigo, then to violet, and then disappears as it gets beyond our range of vision. </p>
<div style="float:left; clear:left; padding: 10px;">Compare this artist&#8217;s rendition:<br />
<a href="http://media-2.web.britannica.com/eb-media/10/7710-004-5E698CE9.gif" target="_new"><img width="315" height="185" src="http://media-2.web.britannica.com/eb-media/10/7710-004-5E698CE9.gif" alt="Artist's prism" /><br />
<font size="-1">(click for large version)</font></a></div>
<div style="float:left; padding: 10px;">
To this photograph:<br />
<a href="http://people.rit.edu/andpph/photofile-c/prism-DSCN4991.jpg" target="_new"><img width="180px" height="254" src="http://people.rit.edu/andpph/photofile-c/prism-DSCN4991.jpg" alt="Photograph of prism" /><br />
<font size="-1">(click for large version)</font></a>
</div>
<p style="clear:left">There&#8217;s no purple at the high edge of a rainbow. There&#8217;s no red color there. Purple is the mix of red and blue light, and it just doesn&#8217;t exist as a physical color, the way white and black don&#8217;t. All the other colors on the wheel, sure, but there are no purples, no colors that mix red and blue. Just like there are no numbers &gt;5 and &lt;-5.</p>
<p>Even the <a href="http://en.wikipedia.org/w/index.php?title=Violet_(color)&#038;oldid=241956046">wikipedia article</a> indicates that they&#8217;re showing some electric violet color in which they&#8217;ve just added some red because violet can&#8217;t actually be represented in RGB channels.</p>
<p>In the photo, you&#8217;ll see some &#8220;purple&#8221; near the prism in the blue/indigo areas, which is a result of white light bleeding into those areas, the other colors have been lightened as well, to the point where the yellow is white as you get close. But it&#8217;s down near the bottom where you&#8217;ll see the blue just taper off. Red has a sharper line because cameras have lenses that aren&#8217;t transparent to red-infrared.</p>
<p>Obviously our artist has an issue with the whole blue-to-violet range, he&#8217;s clearly indicated a cyan color as blue.</p>
<p>RGB is a total scam. We lost our indigoes and violets, and have to put up with this sham of purple instead. There was a time that 0,0,255 would have been called violet, because blue was/is 0,128,128.</p>
<p><center><img width="269" height="276" src="http://www.graphic-design.com/Photoshop/color_cast/color_wheel.jpg" alt="Color Wheel" /></center></p>
<p>The whole lower right quadrant is colors that don&#8217;t exist. Notice how they&#8217;ve compressed the blue range so that the 3 first tier colors (Blue/indigo/violet) fit in 30 degrees, compressed the orange section so it&#8217;s 2nd tier, elongating the greens to invent cyan. ROYGBIV man.  Not RYGCBM.</p>
<p>It&#8217;s not unreasonable. People are most sensitive to greens, less so to blues, least to reds. Any division that looks balanced to us would have to be biased. And we have a way to identify red+blue and red+blue+green individually, so we might as well put them on the wheel even if there&#8217;s no such thing.</p>
]]></content:encoded>
			<wfw:commentRss>http://coollabssoft.com/blog/2008/09/30/colors/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Closures</title>
		<link>http://coollabssoft.com/blog/2008/09/25/closures/</link>
		<comments>http://coollabssoft.com/blog/2008/09/25/closures/#comments</comments>
		<pubDate>Thu, 25 Sep 2008 20:57:26 +0000</pubDate>
		<dc:creator>Chris Davenport</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[closures]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://coollabssoft.com/blog/?p=6</guid>
		<description><![CDATA[This weekend, I learned about closures. Part of this has to do with the fact that I seem to be obsessed with StackOverflow.com; it was there that I found a question on closures with a link to an answer, and prompted my fire of discovery to go learn about them.
Closures are Functions-with-context. Usually used in [...]]]></description>
			<content:encoded><![CDATA[<p>This weekend, I learned about closures. Part of this has to do with the fact that I seem to be obsessed with <a href="http://stackoverflow.com">StackOverflow.com</a>; it was there that I found a question on closures with a link to an answer, and prompted my fire of discovery to go learn about them.</p>
<p>Closures are Functions-with-context. Usually used in formal proofs and the like, but also used in functional programming languages like Haskell. Languages like C are called imperative because they focus more on step-by-step action.</p>
<p>Anyway, the neat thing about a closure is persistence, or maybe independence, depending on how you think about it.<br />
<span id="more-6"></span><br />
In standard C, I might call a function:</p>
<pre class="prettyprint lang-c">
do_stuff(with_stuff)
{
    coefficient = 3;
    some_var = rand();
    new_stuff = with_stuff * with_stuff + with_stuff / some_var;
    return new_stuff * coefficient;
} </pre>
<p>And the compiler will create a stack frame to call the function.. pushing some saved state onto the stack if needed, a return address, then with_stuff. Then the local variables to the function will be allocated on the stack, here they&#8217;re some_var, coefficient, and new_stuff.</p>
<p>When the function returns, it places new_stuff in the stack, or puts it in a register, and then returns, and the stack frame is lost. All the local variables are gone, popped off the stack. Really they&#8217;re still present, but the stack pointer is now indicating that space is available, so the next push, or sometimes the push of the return value, will overwrite them. They&#8217;re not persistent.</p>
<p>But they are the context of the do_stuff function. If you wanted to call it remotely on another machine, that&#8217;s all the data that you&#8217;d need to pass around and/or allocate on the remote side. If the language supports closures, then this is the neat little package that is all about &#8220;do_stuff(with_this_stuff)&#8221;.</p>
<p>JavaScript, as it turns out, contains closures. They&#8217;re a bit tricky to get to, but they exist. Basically, any time you create a function, you get a closure. </p>
<p>I don&#8217;t mean the regular function do_stuff(with_stuff) like we did before. I mean really create one. So you can modify the previous do_stuff function so that it doesn&#8217;t actually do stuff, it just returns a function that will do the stuff when you ask it to later. Kind of a cool way to defer execution and evaluation.</p>
<pre class="prettyprint lang-javascript">do_stuff(with_stuff)
{
    coefficient = 3;
    some_var = rand();
    do_func = function() {
        new_stuff = with_stuff * with_stuff + with_stuff / some_var;
        return new_stuff * coefficient;
    }

    return do_func;
}
</pre>
<p>When you&#8217;re thinking about it, you may notice that coefficient and some_var were declared, allocated, and assigned within do_stuff.. But do_func is returned, and therefore would exist after coefficient and some_var are lost. The interpreter keeps the stack frame from do_stuff around as a closure for do_func, so that when you call do_func later, it has valid references to coefficient and some_var.</p>
<p>And it&#8217;s unique. If you call do_stuff again, you&#8217;ll get a new do_func returned, with it&#8217;s own reference to a new stack frame from do_stuff, and it&#8217;s own closure.</p>
<p>Now comes the really fun stuff. Since we have a function closure in a variable, we know we can call it later. We can even build up a bunch of them and execute them more in parallel. What&#8217;s interesting is calling it multiple times. The same closure is used for all invocations. so if we call our returned do_func() once, and then call it again, some_var will actually have the same value. It was assigned just once, randomly, when we called do_stuff, then made part of the closure, and is now persistent.</p>
<p>And then there were two. You could, conceivably, create more than one function this way, even inside the same do_stuff function, and they&#8217;d share one closure, both able to access the same out-of-scope variables from the creating context.</p>
<p>Perl can do the same thing; they&#8217;re very similar languages.</p>
]]></content:encoded>
			<wfw:commentRss>http://coollabssoft.com/blog/2008/09/25/closures/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hacking Javascript</title>
		<link>http://coollabssoft.com/blog/2008/09/16/hacking-javascript/</link>
		<comments>http://coollabssoft.com/blog/2008/09/16/hacking-javascript/#comments</comments>
		<pubDate>Tue, 16 Sep 2008 16:17:15 +0000</pubDate>
		<dc:creator>Chris Davenport</dc:creator>
				<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://coollabssoft.com/blog/?p=5</guid>
		<description><![CDATA[And here I mean &#8220;hacking&#8221; in the original sense of &#8220;making it work&#8221;, not &#8220;attacking websites&#8221;, as it is so commonly misused.
A lot of people don&#8217;t know that you can write javascript on the browser&#8217;s Address line. That javascript executes in the context of the page, so if you need to do some quick debugging, [...]]]></description>
			<content:encoded><![CDATA[<p>And here I mean &#8220;hacking&#8221; in the original sense of &#8220;making it work&#8221;, not &#8220;attacking websites&#8221;, as it is so commonly misused.</p>
<p>A lot of people don&#8217;t know that you can write javascript on the browser&#8217;s Address line. That javascript executes in the context of the page, so if you need to do some quick debugging, you can often just throw some script onto the Address line and off you go.<br />
<span id="more-5"></span><br />
JavaScript is a very nice language, with excellent features such as First-class functions and runtime code evaluation, which means you can actually create a function using the Address line and call it. Or even change a definition, move values into and out of fields, whatever suits your need.</p>
<p>I found this debug script using google <a href="http://www.drewnoakes.com/debug.js">http://www.drewnoakes.com/debug.js</a>, though you could do it with just about anything.<br />
<code class="prettyprint lang-javascript"><br />
javascript:eval('/* Script written by Drew Noakes -- http://drewnoakes.com*/ /* 4 Dec 2006*/ /* the div element used for debug output.  created in enableDebug. */ var debugDiv; /* call this function from a script within the document for which to enable debug output */ function enableDebug() { debugDiv = document.createElement("div"); debugDiv.setAttribute("id","debugContent"); debugDiv.setAttribute("style", "display:block; position:absolute; top:7px; right:7px; padding:10px; width:300px; background:#ccc; color:white; border:solid 1px black;"); document.body.appendChild(debugDiv); writeClearLink(); } /* writes the string passed to it to the page */ function writeDebug(message) { if (debugDiv) debugDiv.innerHTML += message + "&lt;br\/>"; } /* writes the value of some code expression. */ /* eg: writeEval("document.location"); // writes "document.location = http://drewnoakes.com" */ function writeEval(code) { writeDebug(code + " = " + eval(code)); } /* writes all of the properties of the object passed to it */ function writeDebugObject(object) { for (property in object) writeDebug(property); } /* clears the debug output.  called either manually or by the user clicking the "clear" link in the debug div. */ function clearDebug() { if (debugDiv) { debugDiv.innerHTML = ""; writeClearLink(); } } /* writes a link in the debug div that clears debug output */ function writeClearLink() { writeDebug("&lt;a href=\\"#\\" onclick=\\"clearDebug(); return false;\\">clear&lt;/a>"); }');<br />
</code></p>
<p>I know it&#8217;s a bit messy, but it&#8217;s all written in one line. Which means once you have it copied as one line, you can paste it into the Address of the browser, hit enter, and retroactively add debug facilities to the javascript running inside a page. If your script has a dummy definition for the various writeDebug/writeDebugObject/writeEval functions, and calls them regularly, then when you paste in these new definitions, you&#8217;ll get debug output.</p>
<p>Of course, if your script isn&#8217;t currently calling debug output functions, you can use <code>javascript:eval("writeDebug(myFunction);")</code> on the Address line, grab the code, change it, and then use another eval to store the new definition.</p>
<p>That&#8217;s all temporary. Reload the page and everything&#8217;s gone.</p>
<p>This is one reason you should never depend on the javascript in your page to perform validation for you. Anyone who feels like it can change the validation function.</p>
]]></content:encoded>
			<wfw:commentRss>http://coollabssoft.com/blog/2008/09/16/hacking-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Designing software</title>
		<link>http://coollabssoft.com/blog/2008/09/10/designing-software/</link>
		<comments>http://coollabssoft.com/blog/2008/09/10/designing-software/#comments</comments>
		<pubDate>Wed, 10 Sep 2008 21:04:39 +0000</pubDate>
		<dc:creator>Chris Davenport</dc:creator>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://coollabssoft.com/blog/?p=4</guid>
		<description><![CDATA[My own experience has been that one should shoot for simplicity, treat the business rules differently than design rules, and don&#8217;t put your data in your program. I prefer a toolbox approach, when you take it to the multiple subsystem level.

More interestingly&#8230; Let&#8217;s design &#8220;Hello World&#8221;. Standard thing to toss out to a starting programmer.

#include [...]]]></description>
			<content:encoded><![CDATA[<p>My own experience has been that one should shoot for simplicity, treat the business rules differently than design rules, and don&#8217;t put your data in your program. I prefer a toolbox approach, when you take it to the multiple subsystem level.<br />
<span id="more-4"></span><br />
More interestingly&#8230; Let&#8217;s design &#8220;Hello World&#8221;. Standard thing to toss out to a starting programmer.</p>
<pre class="prettyprint">
#include &lt;stdio.h&gt;

int main(int argc, char* const argv[])
{
    printf("Hello World!\n");
    return 0;
}
</pre>
<p>Pretty simple. But in the software world, things change. All the time. Our helloWorld isn&#8217;t multilingual. It can&#8217;t say &#8220;Hello World+dog&#8221;. There&#8217;s at least one bug in there too. Don&#8217;t try to have it say &#8220;Hello 95%[World]&#8220;.</p>
<p>You could go crazy with it.. add a flag on a command line argument so that it can say &#8220;hello world&#8221; and &#8220;hello world+dog&#8221;. Implement unicode routines, hit up a translation site, and hope you don&#8217;t get a <a href="http://boingboing.net/2008/07/15/chinese-restaurant-c.html">bad translation</a>. You can get clever with it and make it read the string from an external file, so you don&#8217;t have to recompile when the requirement changes for the 100th time.</p>
<p>If you make it sufficiently flexible and abstract, you&#8217;ll probably end up reimplementing the TYPE, ECHO, CAT old DOS/Gnu commands.</p>
<p>Which brings up an interesting point. We&#8217;re training programmers to use code to solve problems. Even really trivially simple ones.</p>
<p>What makes CAT or TYPE better than HelloWorld? Why are we not teaching programmers that anything you hardcode like that could end up changing?</p>
<p>That doesn&#8217;t mean we should design HelloWorld to be much more complicated, but recognizing that there are nearly equivalent complexity implementations that are more flexible in the ways that may change seems like a good idea.</p>
<p>I bet there&#8217;s some statistical analysis that can be made.. relating to the odds and difficulty of changing things.. We don&#8217;t really expect it to stop printing to the screen, so there&#8217;s no reason to design it so that it can edit wikipedia or recognize kittens in a photograph.</p>
<p>Theoretically we&#8217;re trying to minimize the lifetime of work that the program requires.</p>
]]></content:encoded>
			<wfw:commentRss>http://coollabssoft.com/blog/2008/09/10/designing-software/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Work Smarter not Harder</title>
		<link>http://coollabssoft.com/blog/2008/09/09/work-smarter-not-harder/</link>
		<comments>http://coollabssoft.com/blog/2008/09/09/work-smarter-not-harder/#comments</comments>
		<pubDate>Tue, 09 Sep 2008 19:37:30 +0000</pubDate>
		<dc:creator>Chris Davenport</dc:creator>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[business]]></category>

		<guid isPermaLink="false">http://coollabssoft.com/blog/?p=3</guid>
		<description><![CDATA[I hear that a lot. Or I used to. Now it seems like I mostly hear &#8220;work more&#8221;.
That&#8217;s not the point. Today it struck me how weird the phrases &#8220;work harder&#8221; and &#8220;work smarter&#8221; really are.
What&#8217;s your work? Mine is largely coding and software design, minus the social tax of meetings.
So there&#8217;s a pretty simple [...]]]></description>
			<content:encoded><![CDATA[<p>I hear that a lot. Or I used to. Now it seems like I mostly hear &#8220;work more&#8221;.</p>
<p>That&#8217;s not the point. Today it struck me how weird the phrases &#8220;work harder&#8221; and &#8220;work smarter&#8221; really are.</p>
<p>What&#8217;s your work? Mine is largely coding and software design, minus the social tax of meetings.</p>
<p>So there&#8217;s a pretty simple variable substitution. &#8220;Code harder&#8221;. Which sounds insane. It&#8217;s almost meaningless. &#8220;Design harder&#8221;.<br />
What about smarter? &#8220;code smarter&#8221; or &#8220;design smarter&#8221;. Seems like a Good Thing. Totally opposed to KISS, so maybe not.</p>
<p>How &#8220;smart&#8221; should code or design be? Do you really want bobs_memcpy()? Class MemoryCopier? Seems to me that it should be as simple as it can be and get the job done, and no simpler. Sound familiar?</p>
<p>Asking for smarter code is asking for clever tricks. Asking for smarter design is asking for <a href="http://www.joelonsoftware.com/articles/fog0000000018.html">higher-altitude</a> standards. Doesn&#8217;t seem like a very good idea to me.</p>
]]></content:encoded>
			<wfw:commentRss>http://coollabssoft.com/blog/2008/09/09/work-smarter-not-harder/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
