<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><atom:link rel="hub" href="http://tumblr.superfeedr.com/" xmlns:atom="http://www.w3.org/2005/Atom"/><description>

  var _gaq = _gaq || [];
  _gaq.push([‘_setAccount’, ‘UA-18131209-2’]);
  _gaq.push([‘_trackPageview’]);

  (function() {
    var ga = document.createElement(‘script’); ga.type = ‘text/javascript’; ga.async = true;
    ga.src = (‘https:’ == document.location.protocol ? ‘https://ssl’ : ‘http://www’) + ‘.google-analytics.com/ga.js’;
    var s = document.getElementsByTagName(‘script’)[0]; s.parentNode.insertBefore(ga, s);
  })();</description><title>Squanderlings</title><generator>Tumblr (3.0; @mlucassmith)</generator><link>http://mlucassmith.tumblr.com/</link><item><title>This weekend I helped kick off a new podcast called...</title><description>&lt;embed type="application/x-shockwave-flash" src="http://assets.tumblr.com/swf/audio_player_black.swf?audio_file=http://www.tumblr.com/audio_file/12474884341/tumblr_lub09mlF5F1qjv3h3&amp;color=FFFFFF" height="27" width="207" quality="best" wmode="opaque"&gt;&lt;/embed&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;This weekend I helped kick off a new podcast called Thu’umcast, a gameplay diary about our adventures in Skyrim, which is released on 11/11/11. Since the game isn’t out yet, I quizzed the other cohosts on The Elder Scrolls.. for points.&lt;/p&gt;
&lt;p&gt;The main website is at &lt;a href="http://www.jarober.com/thuumcast/" target="_blank"&gt;&lt;a href="http://www.jarober.com/thuumcast/" target="_blank"&gt;http://www.jarober.com/thuumcast/&lt;/a&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;There you can find links to the iTunes subscription, facebook, twitter and send us feedback via email.&lt;/p&gt;</description><link>http://mlucassmith.tumblr.com/post/12474884341</link><guid>http://mlucassmith.tumblr.com/post/12474884341</guid><pubDate>Mon, 07 Nov 2011 10:48:58 -0800</pubDate></item><item><title>Why I hate glOrtho and all its offspring</title><description>&lt;p&gt;In case you&amp;#8217;re not familiar with the glOrtho function from OpenGL, it constructs and stores in to the active matrix a &amp;#8220;parallel&amp;#8221; projection matrix that is orthogonal to the screen. The function looks harmless enough:&lt;/p&gt;
&lt;p&gt;&lt;span&gt; &lt;/span&gt;glOrtho(left, right, bottom, top, near, far);&lt;/p&gt;
&lt;p&gt;But the devil is in the details. The details are right &lt;a href="http://www.khronos.org/opengles/documentation/opengles1_0/html/glOrtho.html" target="_blank"&gt;here&lt;/a&gt; by the way, oh and also over at Microsoft&amp;#8217;s &lt;a href="http://msdn.microsoft.com/en-us/library/dd373965(v=vs.85).aspx" target="_blank"&gt;version&lt;/a&gt;.. we&amp;#8217;ll come back to Microsoft&amp;#8217;s version shortly.&lt;/p&gt;
&lt;p&gt;A typical call to this function might look like this:&lt;/p&gt;
&lt;p&gt;&lt;span&gt; &lt;/span&gt;glOrtho(0, 640, 0, 480, -1, 1);&lt;/p&gt;
&lt;p&gt;Usually, the values 640 and 480 are replaced with the actual size of your window or widget. Let&amp;#8217;s take a side step for a moment and upgrade to OpenGL 3.2 and ditch glOrtho and instead of glm:ortho&amp;lt;float&amp;gt;. This is an identical function and the matrix is still the same. In case you didn&amp;#8217;t follow the link to the documentation to see the matrix, here it is:&lt;/p&gt;
&lt;p&gt;&lt;img src="http://i.msdn.microsoft.com/dynimg/IC534299.png" width="160" height="90" align="middle"/&gt;&lt;/p&gt;
&lt;p&gt;(*image belongs to Microsoft)&lt;/p&gt;
&lt;p&gt;So my gripe with this function is the way in which near and far are treated. Imagine we have just set up our ortho matrix and we have a near of -1 and a far of 1. Theoretically, if you wanted to put something &lt;em&gt;close&lt;/em&gt; to the viewer on the screen, you&amp;#8217;d want to put it nearer the &lt;em&gt;near&lt;/em&gt; value, right? so you&amp;#8217;d put it at -1. Oh my, have I expected near to mean near and failed miserably? Why yes, yes I have.&lt;/p&gt;
&lt;p&gt;You see, the matrix described here actually flips the signedness of the near and far values. You can see it in the matrix above with the -2 instead of a 2. Why? Heaven knows, you&amp;#8217;d have to dredge up the history of 3d rendering and go back to the teapot designers to find out why it was done this way. The downshot is that if you want to put something &lt;em&gt;near&lt;/em&gt; the viewer, you have to give it a value near the &lt;em&gt;far&lt;/em&gt; value.&lt;/p&gt;
&lt;p&gt;Confused? You should be. It gets worse. If, for some reason, you went to the Microsoft webpage on glOrtho you would be still scratching your head. You see, the two pages differ ever so slightly in one crucial sentence:&lt;/p&gt;
&lt;p&gt;Microsoft: &amp;#8220;&lt;span&gt;The &lt;/span&gt;&lt;em&gt;far&lt;/em&gt;&lt;span&gt; parameter specifies the location of the far clipping plane.&amp;#8221;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Khronos.org: &amp;#8220;&lt;/span&gt;&lt;span&gt;-&lt;/span&gt;&lt;code&gt;far&lt;/code&gt;&lt;span&gt; specifies the location of the far clipping plane.&amp;#8221;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Microsoft makes the rookie mistake I made years back when I first encountered this function, that far means far and near means near. Only the authors of the opengl spec get this right. Someone at Microsoft didn&amp;#8217;t copy and paste, or perhaps thought that pesky little &amp;#8216;-&amp;#8217; was a typo. Either way, it&amp;#8217;s not unreasonable for someone new to opengl to rage a little on this particular matrix.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;So why rant about it now? Because I fell for it -again-. AGAIN.. after all these years and knowing full well how stupid this little function is, I fell for it again when I dumbly assumed it would behave more sanely in glm::ortho. I found a curious bit of code in my renderer that had near and far back to front and I couldn&amp;#8217;t figure out why. After toying with it a while I finally figured it out and that is what sent me straight to the blog to write some abusive words about this matrix.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Hey ortho matrix, go back to negative space where you belong!&lt;/span&gt;&lt;/p&gt;</description><link>http://mlucassmith.tumblr.com/post/10869898438</link><guid>http://mlucassmith.tumblr.com/post/10869898438</guid><pubDate>Fri, 30 Sep 2011 18:30:00 -0700</pubDate><category>opengl</category><category>glOrtho</category><category>matrix</category><category>glm</category><category>glm::ortho</category></item><item><title>Code coverage for Xtreams using StasisField to detect what has...</title><description>&lt;img src="http://25.media.tumblr.com/tumblr_lrj5noDg711qjv3h3o1_250.png"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;Code coverage for Xtreams using StasisField to detect what has and hasn’t been called in the image. StasisField is an experimental code-coverage technique that unloads code from the image and dynamically reloads it back in to the image when a method is called. It requires no changes to the VM and once a method has been resumed, there is no further cost to the code-coverage mechanism, making it one of the most efficient techniques for reducing runtime memory and for measure code-coverage.&lt;/p&gt;</description><link>http://mlucassmith.tumblr.com/post/10212083817</link><guid>http://mlucassmith.tumblr.com/post/10212083817</guid><pubDate>Wed, 14 Sep 2011 13:45:24 -0700</pubDate><category>smalltalk</category><category>xtreams</category><category>code coverage</category><category>stasisfield</category><category>sunit</category><category>testing</category></item><item><title>C++ references are not good members</title><description>&lt;p&gt;As a Smalltalk programmer, I tend to like things to be uniform. The idea of sometimes using . and sometimes using -&amp;gt; irritates me, so I tend to prefer using . as much as possible. As such, I just learnt a valuable lesson in the C++ world about when not to inflict my own biases on the code.&lt;/p&gt;
&lt;p&gt;References; they&amp;#8217;re great. They let me stay consistently dotted, rather than arrowed. Instead of writing a function like:&lt;br/&gt;    myFunction(const someclass* somevariable) { somevariable-&amp;gt;doStuff(); }&lt;/p&gt;
&lt;p&gt;I can write the function like this:&lt;br/&gt;    myFunction(const someclass&amp;amp; somevariable) { somevariable.doStuff(); }&lt;/p&gt;
&lt;p&gt;Now, technically this is not what references are about. The two methods are in fact equivalent. However, the details are in the nuts and bolts here. That reference to somevariable is a hard-link back to the original variable. Changing its state or calling functions on it are the same in both versions, but -assigning- to the variable is different in each version.&lt;/p&gt;
&lt;p&gt;Assigning to the argument of a function is rare, so when does this matter? Well, it matters when you start trying to use references as members of a class. Consider the following class:&lt;br/&gt;    class newclass {&lt;br/&gt;        someclass&amp;amp; somemember;&lt;br/&gt;        newclass(const someclass&amp;amp; somemember_)&amp;#160;: somemember(somemember_) {}&lt;br/&gt;    };&lt;/p&gt;
&lt;p&gt;The somemember variable must be initialized, because it is a reference. But now that we have it initialized, any attempt to assign to this member will not set what somemember is, but instead copy-replace its contents with the contents of the new object. Wherever somemember came from, we&amp;#8217;re not changing its state - breaking encapsulation in one of the most wildest and dangerous ways.&lt;/p&gt;
&lt;p&gt;So in this case, you have no choice but to either declare it inline (in which case newclass contains it entirely which might not be possible) or to declare it as a pointer. If you declare it as a pointer, which is the right thing to do, now you can no longer use . and instead have to use -&amp;gt;&lt;/p&gt;
&lt;p&gt;Any and all methods you have previously written using . will have to be re-written using -&amp;gt; &amp;#8230;this is incredibly annoying. An object you talk to with . in one place is talked to with -&amp;gt; in another place, which is inconsistent and infuriating. But, that&amp;#8217;s the C++ language for you.&lt;/p&gt;
&lt;p&gt;So, why is it that the dot operator doesn&amp;#8217;t do what -&amp;gt; does? After all, there are -no- messages you can send to a pointer. Oh wait, yes there are.. operators. [] and + and - and a few others can all act on pointers; which means that if . worked like -&amp;gt; then . would be inconsistent with the other operators. However, I think, IMHO, that that is irrelevant; because no named member or function can exist on a pointer, only on the instance itself.&lt;/p&gt;
&lt;p&gt;Oh well, may be in another 10 years C++ will have this sorted out. Somehow I doubt it. Until then, we must continue playing the . -&amp;gt; dancing game.&lt;/p&gt;</description><link>http://mlucassmith.tumblr.com/post/9126022499</link><guid>http://mlucassmith.tumblr.com/post/9126022499</guid><pubDate>Fri, 19 Aug 2011 09:30:33 -0700</pubDate><category>c++</category><category>references</category><category>pointers</category><category>dot</category><category>arrow</category></item><item><title>Hijack window events</title><description>&lt;p&gt;Today I was fiddling around with events on Windows and I wanted to see if it would be possible to steal any and all events from a window, without having to define a new class. This is something that is relatively easy to do in a windowing system with DOM-Event like objects, where you can listen for an event and tell it to stop propagating right at the top of the tree. However, VisualWorks events don&amp;#8217;t work like that; they&amp;#8217;ve always been very object-message-centric, not &amp;#8220;announcement&amp;#8221;-centric.&lt;/p&gt;
&lt;p&gt;So, typically, you would define a new controller and implement the methods on it that you wanted to handle the different events and set that controller on a window. But, what if you didn&amp;#8217;t want to make a new class just for that? What if you wanted to just -script- it?&lt;/p&gt;
&lt;p&gt;I came up with this little ploy today. In it, I take the focused window, grab mouse events and then capture the events in that window so that I can handle them in a block. I like blocks.&lt;/p&gt;
&lt;p&gt;| window eventDispatcher eventHandler |&lt;br/&gt;window := Screen default focusedWindow.&lt;br/&gt;eventDispatcher := window eventDispatcher.&lt;br/&gt;eventHandler := PushButton new.&lt;br/&gt;eventHandler eventReactions initialize.&lt;br/&gt;(eventHandler eventReactions reactionFor: #Button1Up)&lt;br/&gt;    addDefaultAction: [:event |&lt;br/&gt;        Transcript cr; nextPutAll: &amp;#8216;ungrabbing mouse&amp;#8217;.&lt;br/&gt;        eventDispatcher ungrabMouseEventFor: eventHandler].&lt;br/&gt;(eventHandler eventReactions reactionFor: #MouseMoved)&lt;br/&gt;    addDefaultAction: [:event |&lt;br/&gt;        Transcript cr; nextPutAll: &amp;#8216;mouse moved: &amp;#8216;; print: event point].&lt;br/&gt;Transcript cr; nextPutAll: &amp;#8216;grabbing mouse&amp;#8217;.&lt;br/&gt;eventDispatcher grabMouseEventFor: eventHandler.&lt;/p&gt;
&lt;p&gt;This is made possible because of the ongoing work to implement Skinny in VisualWorks 7.9. The eventReactions is part of an effort to modernize the widgets; in this case by implementing nice state machines. Here, we create a push button and hijack its state machine with #initialize to reset it, then set up our button and movement callbacks.&lt;/p&gt;
&lt;p&gt;Unfortunately we can only do this for mouse events so far. The EventDispatcher has special code to &amp;#8220;reroute&amp;#8221; mouse events if the window is &amp;#8220;grabbed&amp;#8221;. Keyboard events head to the KeyboardProcessor, not to a currentKeyboardConsumer. The same goes for events like window resizing, etc.&lt;/p&gt;
&lt;p&gt;May be in the future&amp;#8230; &lt;/p&gt;</description><link>http://mlucassmith.tumblr.com/post/8650037693</link><guid>http://mlucassmith.tumblr.com/post/8650037693</guid><pubDate>Mon, 08 Aug 2011 10:25:46 -0700</pubDate><category>smalltalk</category><category>visualworks</category><category>wrapper</category><category>widgets</category><category>events</category></item><item><title>C++11 on OSX is a Mess!</title><description>&lt;p&gt;GCC 4.6 cannot compile Objective C programs on OSX if you&amp;#8217;re linking to Cocoa, because you end up trying to compile NSTask which uses Apple&amp;#8217;s &amp;#8220;Blocks&amp;#8221; syntax, (return type)(^block name)(arguments&amp;#8230;).&lt;/p&gt;
&lt;p&gt;Apple GCC 4.2.1 cannot compile C++11 programs on OSX because it doesn&amp;#8217;t support C++11.&lt;/p&gt;
&lt;p&gt;Clang++ can compile -some- C++11 programs on OSX, and can compile Apple&amp;#8217;s &amp;#8220;Blocks&amp;#8221; syntax, but does not currently have support for C++ Lambdas. Luckily they have implemented auto, which is probably the biggest win in C++11 out of all the new syntax features.&lt;/p&gt;
&lt;p&gt;You can of course statically link GCC 4.6 libstdc++ and libgcc in to your program and make a self contained distributable program, but you&amp;#8217;re then unable to dynamically link to anything at all, because the ABI is different.&lt;/p&gt;
&lt;p&gt;I&amp;#8217;m not sure what the deal is with distributing clang compiled programs yet; is libc++ standard on Lion? If it&amp;#8217;s not, then you&amp;#8217;re stuck with the same distribution program as GCC 4.6.&lt;/p&gt;
&lt;p&gt;In case you didn&amp;#8217;t know, you should give up on hoping for a newer version of GCC on OSX; everything after 4.2.2 is GPLv3 and Apple won&amp;#8217;t touch it with a ten foot pole. That&amp;#8217;s why they&amp;#8217;ve been investing in LLVM and Clang.&lt;/p&gt;</description><link>http://mlucassmith.tumblr.com/post/8052052794</link><guid>http://mlucassmith.tumblr.com/post/8052052794</guid><pubDate>Mon, 25 Jul 2011 12:21:25 -0700</pubDate><category>clang++</category><category>clang</category><category>c++</category><category>c++11</category><category>c++0x</category><category>gcc</category><category>gcc4.6</category><category>gcc4.2.1</category><category>blocks</category><category>lambdas</category><category>libstdc++</category><category>libc++</category><category>libgcc</category></item><item><title>Welcome to episode 20 of “That Podcast: An FNV...</title><description>&lt;embed type="application/x-shockwave-flash" src="http://assets.tumblr.com/swf/audio_player_black.swf?audio_file=http://www.tumblr.com/audio_file/7834461627/tumblr_loma40lxrX1qjv3h3&amp;color=FFFFFF" height="27" width="207" quality="best" wmode="opaque"&gt;&lt;/embed&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;&lt;span class="Apple-style-span"&gt;Welcome to episode 20 of “That Podcast: An FNV Diary” - a podcast where Michael Lucas-Smith and James Robertson document our trials and tribulations in &lt;a href="http://www.amazon.com/gp/product/B0028IBTL6?ie=UTF8&amp;tag=smallwithjame-20&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=B0028IBTL6" target="_blank"&gt;Fallout: New Vegas&lt;/a&gt;&lt;img src="http://www.assoc-amazon.com/e/ir?t=smallwithjame-20&amp;l=as2&amp;o=1&amp;a=B0028IBTL6" width="1" height="1" border="0" alt=""/&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="Apple-style-span"&gt;On today’s podcast, Michael and James give their first impressions of “Old World Blues” - the latest DLC for Fallout: New Vegas. So far - it’s a big thumbs up!.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="Apple-style-span"&gt;&lt;a href="http://www.jarober.com/blog/blogView?entry=3488570873" target="_blank"&gt;(read more)&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;</description><link>http://mlucassmith.tumblr.com/post/7834461627</link><guid>http://mlucassmith.tumblr.com/post/7834461627</guid><pubDate>Tue, 19 Jul 2011 22:33:00 -0700</pubDate><category>fallout</category><category>new</category><category>vegas</category><category>fnv</category><category>dlc</category><category>old world blues</category><category>old</category><category>world</category><category>blues</category></item><item><title>Time to play with C++11</title><description>&lt;p&gt;This is possibly the worst time to experiment with gcc 4.6 on OSX. Lion is about to be released any day now, so I&amp;#8217;ll have to completely redo the gcc install via macports once I&amp;#8217;ve upgraded. Oh well.&lt;/p&gt;
&lt;p&gt;But, curiosity was getting the better of me. After all, we&amp;#8217;re talking about Closures here, in C++.. hell froze over or something because this just shouldn&amp;#8217;t happen. Will Apple fix change their closure syntax to match? make grand central compatible with std::bind and std::function? Only time will tell.&lt;/p&gt;
&lt;p&gt;So here is my prelim. report on using C++11 on Snow Leopard. I used macports to install gcc46 and that went very smoothly, although it took quite a while to compile. One of the neat things about this version of gcc is the automatic vectorizing of arrays where it can figure out how to do that. Neat. I wonder if I&amp;#8217;ll ever notice.&lt;/p&gt;
&lt;p&gt;My test program utilized two of the three features I&amp;#8217;m most interested in with C++11. Lambda and Auto. The third is the for(:) range syntax, I&amp;#8217;m sure I&amp;#8217;ll get to it eventually.&lt;/p&gt;
&lt;p&gt;#include &amp;lt;functional&amp;gt;&lt;br/&gt;&lt;br/&gt;int main(void) {&lt;br/&gt;    auto f = [] (unsigned char b) { return b - 1; };&lt;br/&gt;    return f(1);&lt;br/&gt;}&lt;/p&gt;
&lt;p&gt;Some things to note here. Auto really does do its job, the actual type of the lambda is this: std::function&amp;lt;unsigned char (unsigned char)&amp;gt; which is yet another templated mouthful which would otherwise make C++11 a miserable failure. But, auto to the rescue &amp;#8212; this may actually make programming in C++ &amp;#8230;nice?&lt;/p&gt;
&lt;p&gt;The next thing of note here is how I didn&amp;#8217;t specify a return type for the lambda, but it worked anyway. It appears that the return type of the lambda is automatically inferred; I assume if it cannot infer it it&amp;#8217;ll throw some obscure unintelligible error.&lt;/p&gt;
&lt;p&gt;The compilation line I used was this:&lt;br/&gt;g++-mp-4.6 -std=c++0x test.cpp -o test&lt;/p&gt;
&lt;p&gt;There are a few things to note here. Make sure you remember to use g++ instead of gcc, or it&amp;#8217;ll try and compile it without the C++ libraries present and all heck will break loose.&lt;/p&gt;
&lt;p&gt;Another important point here is that gcc 4.6 does not compile with C++11 activated by default; so you must specify which standard you&amp;#8217;re using via the -std=c++0x parameter. If you fail to do either of these two steps, you will get the usual gibberish template error messages from gcc that only google can understand.&lt;/p&gt;
&lt;p&gt;By the way, thanks google and stack overflow for eventually pointing me in the right directions to compile this ridiculously simple program correctly.&lt;/p&gt;
&lt;p&gt;They claim that C++11 feels like a whole new language. I have to agree; apart from having closures, this auto type is miraculous for C++, especially with templates. It&amp;#8217;s practically civilized.. may be that&amp;#8217;s going a little too far. But, at least C++ gets a taste of functional and dynamic programming for a change. It&amp;#8217;s been far too long without it.&lt;/p&gt;
&lt;p&gt;Finally, I find it interesting that gcc hasn&amp;#8217;t shipped with std::thread yet; which is probably one of the biggest wins of the C++11 standard library and therefore equally as notable that it&amp;#8217;s missing.&lt;/p&gt;</description><link>http://mlucassmith.tumblr.com/post/7785480841</link><guid>http://mlucassmith.tumblr.com/post/7785480841</guid><pubDate>Mon, 18 Jul 2011 19:04:08 -0700</pubDate><category>c++</category><category>c++11</category><category>c++0x</category><category>closure</category><category>lambda</category><category>osx</category><category>lion</category><category>macports</category></item><item><title>Polycephaly finds new home in Xtreams-Grid</title><description>&lt;p&gt;When I first proposed Polycephaly to Arden Thomas, the product manager, and wrangled Martin Kobetic in to help me; I was unsure if we were really going to help our customers solve real world problems with it or not. Polycephaly, meaning &amp;#8220;Many Heads&amp;#8221; is a framework like Squeak&amp;#8217;s Hydra. It lets you run multiple Smalltalk Images simultaneously, with one image controlling the &amp;#8220;drones&amp;#8221;. Ironically, the drones run headless, so despite it being called Many Heads it really should have been called Many Headlesses.&lt;/p&gt;
&lt;p&gt;To our delight, customers started emailing in with reports of its usefulness in their development and production environments. We also got a lot of feedback too. Polycephaly used stdin/stdout to communicate over pipes between the master and drone. Any customer code that just so happened to write out to Stdout or read from Stdin would break Polycephaly.&lt;/p&gt;
&lt;p&gt;Customers found it very useful to spawn 3-5 extra images and give them work to better utilize their multi-core machines. But they also wanted to do the same over the network. And so, Polycephaly-NetworkVirtualMachine was published by Holger Kleinsorgen.&lt;/p&gt;
&lt;p&gt;Another criticism was how VirtualMachines worked; specifically it was not useful as a load balancer. So Runar Jordahl blogged about &lt;a href="http://blog.epigent.com/2011/03/use-of-visualworks-polycephaly-at.html" target="_blank"&gt;his solution&lt;/a&gt;, which round-robin&amp;#8217;d &amp;#8220;jobs&amp;#8221; to different VirtualMachine instances.&lt;/p&gt;
&lt;p&gt;Meanwhile, I was somewhat unimpressed with the inability for a drone to respond in a streaming fashion back to the master; or for the master to supply job objects in a stream either. This meant that as soon as a drone had completed its job, it would typically lock up in communication with the master through BOSS.&lt;/p&gt;
&lt;p&gt;So, the technical debt on Polycephaly finally reached a turning point when a &lt;a href="http://forum.world.st/Polycephaly-review-td3560523.html" target="_blank"&gt;review&lt;/a&gt; was written on the VWNC mailing list and I was resolved to fix the problems. And what luck, I had an engineering trip planned to travel to Ottawa where two of my colleagues live, and then to Victoria (Vancouver Isle.) where another one of my colleagues live. It just so happens that these colleagues could help me and face to face time is invaluable.&lt;/p&gt;
&lt;p&gt;I present to you Xtreams-Grid, a VisualWorks and ObjectStudio solution for working with multiple images on your local machine and across a network. Here is the features list when compared with Polycephaly:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;Remove drones and remote masters. Drones can be activated via inetd style, or be pre-configured. Drones can connect to a pre-determined master, or be listening for a master(s) to connect.&lt;/li&gt;
&lt;li&gt;Sockets instead of Pipes, no more Stdin/Stdout breaking the system.&lt;/li&gt;
&lt;li&gt;Streaming results and arguments to-and-fro. The stream is now multiplexed too, with high through-put using the Xtreams-Multiplexer protocol.&lt;/li&gt;
&lt;li&gt;VirtualMachines now acts as a load balancer with a &amp;#8220;job&amp;#8221; style API and can easily be used with #promise.&lt;/li&gt;
&lt;li&gt;When starting a VirtualMachine locally, you can specify a different image to use and/or a different virtual machine executable.&lt;/li&gt;
&lt;li&gt;Xtreams-Grid has actual documentation, where Polycephaly was still a work-in-progress and had none.&lt;/li&gt;
&lt;li&gt;If you have the Xtreams parcels available (they will be updated in VisualWorks 7.9 at some point in the nearish future); an image no longer has to be saved, the Xtreams drone script will auto-load Xtreams-Grid and its prerequisites on start up.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;It also has a much more sensible name. Every one knows what grid computing is and typically looks up &amp;#8216;grid&amp;#8217; when trying to find it. Polycephaly, while having a very unique name that is highly recognizable, was always a bit of a tongue in cheek job. You can consider it as a past-tense code name at this point.&lt;/p&gt;
&lt;p&gt;The API of Xtreams-Grid is very similar to Polycephaly, though not 100% the same. There&amp;#8217;s no #timeout:do: method any more, since you can use [] onTimeout: aDuration do: aBlock. VirtualMachines is a complete rewrite and the #do:environment: API is gone completely.&lt;/p&gt;
&lt;p&gt;There are new tricks up its sleeve though. Consider, for a moment, this peculiar little example:&lt;/p&gt;
&lt;p&gt;&lt;span&gt; &lt;/span&gt;&lt;em&gt;evens := machine do: [ :odds | odds collecting: [ :e | e + 1 ] ] with: (1 to: 9) reading.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;In this case, we are streaming in odd numbers to the drone and the drone will increment each element in the stream by one, then stream the results back out to the master. The master can leisurely read results, only taxing the drone as required.&lt;/p&gt;
&lt;p&gt;As well as this, the drone can consume multiple streams as arguments from the master. It does not need to consume each argument stream in full; since underneath the hood is the Xtreams-Multiplexer protocol, which works similarly to the SSH2 multiplexing protocol.&lt;/p&gt;
&lt;p&gt;There is lots to explore here. There are tests which demonstrate some of these capabilities, as well as updated documentation at &lt;a href="http://code.google.com/p/xtreams" target="_blank"&gt;&lt;a href="http://code.google.com/p/xtreams" target="_blank"&gt;http://code.google.com/p/xtreams&lt;/a&gt;&lt;/a&gt;. Or, more specifically: &lt;a href="http://code.google.com/p/xtreams/wiki/Grid" target="_blank"&gt;&lt;a href="http://code.google.com/p/xtreams/wiki/Grid" target="_blank"&gt;http://code.google.com/p/xtreams/wiki/Grid&lt;/a&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The latest version of XtreamsDevelopment as of this writing is 526.&lt;/p&gt;</description><link>http://mlucassmith.tumblr.com/post/7511322455</link><guid>http://mlucassmith.tumblr.com/post/7511322455</guid><pubDate>Mon, 11 Jul 2011 16:40:00 -0700</pubDate><category>xtreams</category><category>grid</category><category>computing</category><category>grid computing</category><category>polycephaly</category><category>hydra</category><category>squeak</category><category>multiplexing</category><category>multiplexer</category><category>streaming</category><category>master</category><category>drone</category></item><item><title>Generators for Xtreams</title><description>&lt;p&gt;While at Smalltalk Solutions 2011 in Las Vegas, a question was raised about Generators. Martin and I had no idea what Generators were, so we filed that one away for &amp;#8220;later pontification&amp;#8221;. Well, that later came this week when Nicolas Cellier posted about &lt;a href="http://smallissimo.blogspot.com/2011/07/using-generators-on-primefactorsfactori.html" target="_blank"&gt;using generators and Xtreams to compute primes&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;One criticism Nicolas raised was the lack of Generators in Xtreams. We wanted to understand what Generators were and why they needed to manipulate the stack to work. In the end, we decided it&amp;#8217;s actually faster and easier to implement them using a second process and a couple of semaphores. Also, more portable.&lt;/p&gt;
&lt;p&gt;So what do generators do? Well, possibly the simplest example is this:&lt;/p&gt;
&lt;p&gt;1 to: 10 do: [:i | &amp;#8230;do something&amp;#8230;]&lt;/p&gt;
&lt;p&gt;In this case, you cannot easily transform it in to a stream using [] reading, because you get stuck inside the iteration block, controlled by the #to:do: method. A generator allows you to push out elements piece-meal regardless of the nature of the code you&amp;#8217;re running, eg:&lt;/p&gt;
&lt;p&gt;readStream := [:out | 1 to: 10 do: [:i | out put: i ] ] reading&lt;/p&gt;
&lt;p&gt;The block will begin running immediately, but as soon as it tries to write out a value on to the @out variable, it will halt execution until you attempt to read from @readStream. This makes it possible for Nicolas to re-write his example as:&lt;/p&gt;
&lt;p&gt;primes := [:out | Integer &lt;span&gt;primesUpTo: 100 do: [:prime | out put: prime ] ] reading.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Note that @out is actually a write stream, so you can use all the regular streaming API on it too, such as #write: instead of a single element #put:.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;The last part of this story isn&amp;#8217;t to do with generators at all, but about using buffers to make non-positionable information positionable. In the case of Nicolas&amp;#8217;s primes, he wanted the last element on the stream. You can&amp;#8217;t &amp;#8220;skip to end, rewind one, read last element&amp;#8221; on a non-positionable stream. But you can on a positionable stream.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;The default buffer of a positionable stream is endless though, so it will record everything, allowing you to rewind right back to the start. In this case, that&amp;#8217;s a complete waste. We also only produce one element at a time, because it&amp;#8217;s coming from a generator. So, we can use a RingBuffer of size 1 as the buffer for positioning.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;(primes positioning buffer: (RingBuffer new: 1 class: Array))&lt;br/&gt;&lt;span&gt;&lt;/span&gt;    -= 1;&lt;br/&gt;&lt;span&gt;&lt;/span&gt;    get&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;This is where the positioning API of Xtreams really becomes handy. We use #-= which means &amp;#8220;From the end of the stream, rewind &amp;#8216;n&amp;#8217; elements&amp;#8221;. Now that we have a positioning buffer that always remembers the last element, we can skip to the end and rewind by one element and then call #get to fetch it.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;The &lt;em&gt;[:out | ] reading&lt;/em&gt; generator terminal is available in XtreamsDevelopment 508.&lt;/span&gt;&lt;/p&gt;</description><link>http://mlucassmith.tumblr.com/post/7273146471</link><guid>http://mlucassmith.tumblr.com/post/7273146471</guid><pubDate>Tue, 05 Jul 2011 12:49:00 -0700</pubDate><category>xtreams</category><category>smalltalk</category><category>generators</category><category>primes</category><category>buffers</category><category>positioning</category></item><item><title>Maki and I take you on an update tour of our fortress in...</title><description>&lt;iframe width="400" height="300" src="http://www.youtube.com/embed/uSnIULz-Nog?wmode=transparent&amp;autohide=1&amp;egm=0&amp;hd=1&amp;iv_load_policy=3&amp;modestbranding=1&amp;rel=0&amp;showinfo=0&amp;showsearch=0" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;Maki and I take you on an update tour of our fortress in Minecraft, now updated to 1.7.2 with pistons. We’re in the process of automating much our farming now that it is possible.&lt;/p&gt;</description><link>http://mlucassmith.tumblr.com/post/7217689107</link><guid>http://mlucassmith.tumblr.com/post/7217689107</guid><pubDate>Sun, 03 Jul 2011 21:43:39 -0700</pubDate><category>minecraft</category><category>pistons</category></item><item><title>Xtreams 492 Update: Marshaling and Multiplexing</title><description>&lt;p&gt;It&amp;#8217;s not often I get to write a change log for an &amp;#8220;add-on&amp;#8221; library. Usually things move incrementally toward the original goals. But with Xtreams, sometimes we add new things, or improve old things.&lt;/p&gt;
&lt;p&gt;Xtreams changes from v472 to v492:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;#write:from:at: and #insert:from:at: now consistently return an Integer. This mirrors #read:into:at: which already returned an Integer consistently.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Added #buffering: to WriteStream, which buffers up all writes in to it, until it hits the buffer size, at which point it flushes the contents down to its destination. You can send #flush to force the contents out immediately, if you&amp;#8217;re working with a particular protocol. This is useful when dealing with protocols that don&amp;#8217;t internally buffer (which is most of Xtreams).&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Included Xtreams-IRC in XtreamsDevelopment. The XtreamsDevelopment bundle is not something you should ever prerequisite. But it is a convenient way to pull everything in. We&amp;#8217;ve decided to include applications of Xtreams in to the XtreamsDevelopment bundle. Yes, I have my eye on you StoMP.&lt;/li&gt;
&lt;li&gt;Hub is removed from Xtreams-Xperiments.&lt;/li&gt;
&lt;li&gt;#multiplexing is removed from Xtreams-Xperiments&lt;/li&gt;
&lt;li&gt;Stitch(Read/Write)Stream can be instantiated from the class side with a semi-private API of #on:contentsSpecies: which avoids the default behavior of stitch streams, which always pre-fetch the very first substream to stitch.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Added #monitoring:every: to (Read/Write)Stream, which allows you to measure the through-put on a stream. This is particularly useful when transferring files and other large data across a network.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;ObjectMarshaler will now marshal/unmarshal/analyse very large integers. Previously this was a #notYetImplemented method. The format is inefficient, but integers that large are by their very nature inefficient.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;ObjectMarshaler will now create light-weight shadow classes for classes that do not exist when unmarshaling objects. The classes are full subclasses of Object with getters/setters created on them for their instance variable names.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Xtreams-Multiplexer package added, which contains the previously implemented #multiplexing and Hub behavior. It now has a sliding ChannelWindow to avoid stream saturation for unread data. As well as being promoted from Xperiments, it now has tests. &lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;strong&gt;* Items in bold represent new behavior / API.&lt;/strong&gt;&lt;/p&gt;</description><link>http://mlucassmith.tumblr.com/post/6696715769</link><guid>http://mlucassmith.tumblr.com/post/6696715769</guid><pubDate>Sun, 19 Jun 2011 12:20:00 -0700</pubDate><category>smalltalk</category><category>xtreams</category><category>marshaler</category><category>multiplexing</category><category>multiplexer</category><category>marshaling</category><category>stitching</category><category>monitoring</category><category>buffering</category><category>changelog</category></item><item><title>It's a travel day...</title><description>&lt;p&gt;Ha ha Canada. I get it, Michael is on his way so well stage a strike in the one random airport he has a connection in. Calgary, of all places. If I get my luggage I will be amazed, but now I&amp;#8217;ll be getting in to Ottawa at 1am. Oh and let&amp;#8217;s not forget the aircraft I was on required an airstart - that happens when the engine can&amp;#8217;t start itself anymore! That flight was delayed I&amp;#8217;m arriving and so is my next flight. I&amp;#8217;ll get there eventually.&lt;/p&gt;</description><link>http://mlucassmith.tumblr.com/post/6539668675</link><guid>http://mlucassmith.tumblr.com/post/6539668675</guid><pubDate>Tue, 14 Jun 2011 18:15:00 -0700</pubDate><category>Travel</category><category>Ottawa</category><category>Canada</category><category>Calgary</category></item><item><title>Quantities in VisualWorks</title><description>&lt;p&gt;In VisualWorks we&amp;#8217;ve had a few arbitrary limits in Timestamp and Duration. Timestamp stops at milliseconds and there&amp;#8217;s a need to go down to nanoseconds there for interfaces to Oracle and other databases. Duration is fixed to nanoseconds as of VW7.8 which covers the majority of short time period computations. But ultimately, we&amp;#8217;d rather not have to go through a 10^-9 -&amp;gt; 10^-12 migration sometime next release.&lt;/p&gt;
&lt;p&gt;So instead, we&amp;#8217;re making Duration and Timestamp hold on to seconds at an arbitrary scale. Now, that&amp;#8217;s not actually what this post is about; but it&amp;#8217;s tangential. As part of the effort to &amp;#8220;get this right&amp;#8221; I wanted to understand the right way to internally represent Duration; as whatever we do there we&amp;#8217;ll be replicating in Timestamp. I&amp;#8217;d rather not get two classes wrong in VisualWorks 7.9.&lt;/p&gt;
&lt;p&gt;To understand it better, I took a step back to look at the entire problem of representing quantities or measurements in Smalltalk and other programming languages. So let&amp;#8217;s start with the best of breed for static languages: Boost.Units &amp;#8212; now, I know some of you will jump out of your seats in fury and rage at this point because I&amp;#8217;m not talking about your favourite functional language. Trust me when I say I understand and I&amp;#8217;m sorry you just broke your favourite chair.&lt;/p&gt;
&lt;p&gt;Boost.Units is a C++ library that provides a zero-runtime overhead for representing units in your C++ program. This is, honestly, a fantastic addition to the C++ language and should be in the base. If only they could get their compilation errors to make sense I&amp;#8217;m sure we&amp;#8217;d all be using it. After all, if a developer starts programming with inches in mind and accidentally collaborates with anyone outside of the USA, they&amp;#8217;ll be combining centimetres with inches and bam, you crash your Mars satellite.&lt;/p&gt;
&lt;p&gt;It&amp;#8217;ll slow down your compilation time, but at least your program will be correct! This is one of the few times where types do not get in your way and save you a lot of time and (especially in the case of NASA) money.&lt;/p&gt;
&lt;p&gt;On to the next best of breed &amp;#8212; Measurements in the Cincom Public Repository. This library comes from two people, the first is Travis Griggs who is my colleague here at Cincom. The second is Ken Greene. Now I&amp;#8217;m mentioning their names, particularly Ken, here because they came up with a way of representing units at runtime that has very low overhead on arithmetic operations. We&amp;#8217;ll come back to what this is later in the post.&lt;/p&gt;
&lt;p&gt;So with these two great examples of units and quantities to go off of, I set about trying different variations for describing quantities in VisualWorks generically. I wanted to allow it to blend with the existing (and future) implementation of Duration. I *really* wanted to know if there is any design impact on Duration that I need to know about now before I go and change its implementation in VisualWorks 7.9.&lt;/p&gt;
&lt;p&gt;After going through many iterations, I ended up with a design using the same trick as Measurements, but with more capabilities, such as instantiating Duration when dealing with the Time dimension. Or instantiating an Angle when you&amp;#8217;re dealing with radians, degrees and gradians. There is of course the Temperature class too - but I won&amp;#8217;t bore you with the details of that one.&lt;/p&gt;
&lt;p&gt;Because we&amp;#8217;re creating and destroying objects constantly if we&amp;#8217;re doing tight loop arithmetics on quantities, we need to make sure the implementation is only being dragged down by a lack of stack-allocation in an otherwise very smart virtual machine.&lt;/p&gt;
&lt;p&gt;This is where Ken Greene comes in to the picture. When you multiply two quantities together, you also need to multiply the units together, eg: 5 seconds * 5 metres = 25 metres.seconds &amp;#8212; to do this, each base unit is given a prime number. Derived units, such as metres.seconds are an integer that is composed of primes. This means you can decompose the integer and find out which base units make it up. You compute the name of a newly derived unit but you can also quickly look up previously computed units using the same integer quickly.&lt;/p&gt;
&lt;p&gt;We have a class called Fraction in Smalltalk, which has two numbers (numerator and denominator) which can be used to describe the unit too, for example 5 seconds / 5 metres will create a fraction unit of seconds/metres.&lt;/p&gt;
&lt;p&gt;The whole implementation ended up being two classes: Unit, ArithmeticQuantity (to mirror ArithmeticValue) and one exception: Incompatible. The package contains two specializations of ArithmeticQuantity: Angle and Temperature; but strictly speaking those domains could be removed from the library and it&amp;#8217;d be just fine. The rest of the dimensions from SI units end up being generic. The library re-uses Duration to represent the Time dimension though.&lt;/p&gt;
&lt;p&gt;You can find the library in the Cincom Public Store under the name Quantities and Quantities-Tests. I&amp;#8217;ll be updating the library once the new Duration is integrated in to VisualWorks 7.9; so if you&amp;#8217;re in the vw-dev program you&amp;#8217;ll want to use the 7.9 version instead of the 7.8 version. The package contains a bunch of documentation, but only time will tell if the documentation is sufficient. It almost goes without saying that you can also use this package in ObjectStudio too (and WebVelocity!).&lt;/p&gt;</description><link>http://mlucassmith.tumblr.com/post/6284777082</link><guid>http://mlucassmith.tumblr.com/post/6284777082</guid><pubDate>Tue, 07 Jun 2011 07:32:45 -0700</pubDate><category>smalltalk</category><category>units</category><category>boost</category><category>measurements</category><category>quantities</category><category>arithmetic</category><category>metric</category><category>SI Units</category><category>visualworks</category><category>objectstudio</category><category>webvelocity</category></item><item><title>The first Minecraft world I built, starting in Infdev and...</title><description>&lt;iframe width="400" height="300" src="http://www.youtube.com/embed/DdBcMxjZSTw?wmode=transparent&amp;autohide=1&amp;egm=0&amp;hd=1&amp;iv_load_policy=3&amp;modestbranding=1&amp;rel=0&amp;showinfo=0&amp;showsearch=0" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;The first Minecraft world I built, starting in Infdev and through a few alpha builds, before Maki joined me and we started to customize it further until we finally moved on to the next world. This is a short tour of this world and the things we made. We were novices at this point.&lt;/p&gt;</description><link>http://mlucassmith.tumblr.com/post/6276803493</link><guid>http://mlucassmith.tumblr.com/post/6276803493</guid><pubDate>Mon, 06 Jun 2011 22:40:03 -0700</pubDate><category>minecraft</category></item><item><title>Battle Flag (feat. Pigeonhead) by Lo Fidelity Allstars. The...</title><description>&lt;embed type="application/x-shockwave-flash" src="http://assets.tumblr.com/swf/audio_player_black.swf?audio_file=http://www.tumblr.com/audio_file/6264308598/tumblr_lme5v9DqzR1qjv3h3&amp;color=FFFFFF&amp;logo=soundcloud" height="27" width="207" quality="best" wmode="opaque"&gt;&lt;/embed&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;Battle Flag (feat. Pigeonhead) by Lo Fidelity Allstars. The album is called How to operate with a blown mind.&lt;/p&gt;
&lt;p&gt;This song has been used in the Duke Nukem Forever trailer. This game is going to be short and crude and I’m going to love every minute of it.&lt;/p&gt;</description><link>http://mlucassmith.tumblr.com/post/6264308598</link><guid>http://mlucassmith.tumblr.com/post/6264308598</guid><pubDate>Mon, 06 Jun 2011 16:13:00 -0700</pubDate><category>duke</category><category>nukem</category><category>forever</category><category>dnf</category><category>gaming</category><category>music</category></item><item><title>This is a tour of a castle that I and Makahlua have been...</title><description>&lt;iframe width="400" height="300" src="http://www.youtube.com/embed/LnoArsc7Dy0?wmode=transparent&amp;autohide=1&amp;egm=0&amp;hd=1&amp;iv_load_policy=3&amp;modestbranding=1&amp;rel=0&amp;showinfo=0&amp;showsearch=0" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;This is a tour of a castle that I and Makahlua have been building in Minecraft 1.5 and now 1.6.6 — it’s not that amazing and the world is still very new, so we’re low on resources like wool and diamond, but it’s coming along nicely.&lt;/p&gt;</description><link>http://mlucassmith.tumblr.com/post/6148360669</link><guid>http://mlucassmith.tumblr.com/post/6148360669</guid><pubDate>Fri, 03 Jun 2011 11:47:00 -0700</pubDate><category>minecraft</category></item><item><title>Portal 3 hints? (warning: portal 2 spoilers)</title><description>&lt;p&gt;I think enough time has passed since Portal 2 came out that most people, rabid fans, will have completed the game. So here are some things that hint at a Portal 3, or at least some serious DLC.&lt;/p&gt;
&lt;p&gt;First off, there is a whole period of Aperture Science&amp;#8217;s history that is completely missing from the game. The 90s. We know that Chell appears to have been the daughter of one of the scientists who worked at Aperture because Chell&amp;#8217;s potato experiment is down in the offices.&lt;/p&gt;
&lt;p&gt;We also know that there is another person in cold storage with the same last name as Chell. Now, if you read the Rat man&amp;#8217;s comic you&amp;#8217;d know that her last name is [redacted]. Why would there be another test subject with a redacted last name? It may have been a reference to the original co-op idea of having Chell and another person run around the mazes; but they changed that to two androids instead - which is cuter.&lt;/p&gt;
&lt;p&gt;Next up, Cave talks about an experiment involving Time Travel once or twice, to great comedic effect. You may have noticed in the 70s control rooms a warning for employees to report any federal inspectors, etc. In the 80s control rooms there was a similar warning, except it was a picture of someone in an orange jump suit. This suggests to me that if there is a Portal 3, it&amp;#8217;ll involve time travel back to Aperture Science&amp;#8217;s hayday, when people actually worked there. This could just as easily be DLC using some of the people who were cryo&amp;#8217;d in &amp;#8220;Saving Science&amp;#8221;.&lt;/p&gt;
&lt;p&gt;Finally, a game mechanic was completely left out of the game, the Pneumatic Diversity Tubes. These babies have a supersuck and once you&amp;#8217;ve hit the end of the game you can easily see why they left them out of the game. Having super suck as a normal game power would have dampened the space vacuum ending. So any DLC or Portal 3 is likely to include this game mechanic now that Aperture Science has easy access to a super vacuum.&lt;/p&gt;
&lt;p&gt;So, possible settings for the game - Aperture&amp;#8217;s past, the moon. Valve has hinted that Chell may interact with characters from the Half-Life universe, so may be she brings them back to Aperture to get access to the technology in there to help fight the good fight. I guess time will tell - DLC is coming up. I&amp;#8217;d like to see them do a Left 4 Dead 2 and make the DLC be full on story involving these sorts of plot lines; instead of just generic/difficult test chambers and dozens of obscure achievements.&lt;/p&gt;</description><link>http://mlucassmith.tumblr.com/post/5016634299</link><guid>http://mlucassmith.tumblr.com/post/5016634299</guid><pubDate>Thu, 28 Apr 2011 11:16:24 -0700</pubDate><category>portal2</category></item><item><title>Me, with a beard. I should probably shave.</title><description>&lt;img src="http://25.media.tumblr.com/tumblr_lk742y0iZa1qjv3h3o1_500.jpg"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;Me, with a beard. I should probably shave.&lt;/p&gt;</description><link>http://mlucassmith.tumblr.com/post/4921161512</link><guid>http://mlucassmith.tumblr.com/post/4921161512</guid><pubDate>Sun, 24 Apr 2011 23:44:59 -0700</pubDate></item><item><title>C++ template aliasing</title><description>&lt;p&gt;&lt;span&gt;
&lt;p class="p1"&gt;Recently I have been working on some C++ classes which make heavy use of templates. In particular there are two classes Vector, T, N and Matrix&amp;lt;T, M, N=M&amp;gt; where you specify the type of the elements and the number of elements for both. Examples of how you would use these are:&lt;/p&gt;
&lt;/span&gt;&lt;/p&gt;
&lt;p class="p1"&gt;Vector&amp;lt;double, 3&amp;gt; myVector(1, 2, 3);&lt;/p&gt;
&lt;p class="p1"&gt;Matrix&amp;lt;float, 3&amp;gt; myIdentityMatrix;&lt;/p&gt;
&lt;p class="p1"&gt;As you can imagine, typing out that full declaration everywhere gets a little tiresome after a while. What I really wanted was a way to alias Vector3 to mean Vector&amp;lt;double, 3&amp;gt; yet at the same time be able to easily do Vector3&amp;lt;float&amp;gt;.&lt;/p&gt;
&lt;p class="p1"&gt;The most logical thing you might try and do is to template the typedef, eg:&lt;/p&gt;
&lt;p class="p1"&gt;template &amp;lt;typename T=double&amp;gt; typedef Vector&amp;lt;T, 3&amp;gt; Vector3;&lt;/p&gt;
&lt;p class="p1"&gt;However, you&amp;#8217;ll quickly discover that this is an unimplemented feature of C++0x. So what can you do instead? The simplest thing that came to mind at first was to make a subclass:&lt;/p&gt;
&lt;p class="p1"&gt;template &amp;lt;typename T=double&amp;gt; class Vector2&amp;#160;: public Vector&amp;lt;T, 2&amp;gt; {&lt;/p&gt;
&lt;p class="p1"&gt;&lt;span&gt;
&lt;p class="p1"&gt;&lt;span&gt; &lt;/span&gt;Vector2 (void)&amp;#160;: Vector () {}&lt;/p&gt;
&lt;/span&gt;&lt;/p&gt;
&lt;p class="p1"&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt; &lt;/span&gt;Vector2 (T x, T y)&amp;#160;: Vector (x, y) {}&lt;/p&gt;
&lt;p class="p1"&gt;};&lt;/p&gt;
&lt;p class="p1"&gt;The obvious problem here is that you have to re-implement the constructors and destructors each time you do this and if new constructors are added, they have to be added to the subclasses as well.&lt;/p&gt;
&lt;p class="p1"&gt;A thread on stack overflow had a different solution to the problem. While C++ doesn&amp;#8217;t let you template typedefs, it does let you template structs, which can contain typedefs:&lt;/p&gt;
&lt;p class="p1"&gt;template &amp;lt;typename T=double&amp;gt; struct Vector2 {&lt;/p&gt;
&lt;p class="p1"&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;typedef Vector&amp;lt;T, 2&amp;gt; type;&lt;/p&gt;
&lt;p class="p1"&gt;};&lt;/p&gt;
&lt;p class="p1"&gt;This approach is a true alias, however it requires you to declare your variables like this:&lt;/p&gt;
&lt;p class="p1"&gt;Vector2&amp;lt;&amp;gt;::type myVector;&lt;/p&gt;
&lt;p class="p1"&gt;That&amp;#8217;s almost as much typing as you would be doing before - albeit without having to redeclare the types and dimensions every time. As I discussed this problem with a friend, he suggested that I template a namespace and then import the types with using, but it turns out that the following is invalid:&lt;/p&gt;
&lt;p class="p1"&gt;using LinearMath::Vectors&amp;lt;&amp;gt;;&lt;/p&gt;
&lt;p class="p1"&gt;You cannot have a template-id in a using-declaration. It introduces ambiguities in to the namespace. But this got me thinking about importing stuff in to your namespace and I realized I could actually do it using subclassing. Since all my code was generally in classes already, it was a simple matter of creating a class that I could inherit from.&lt;/p&gt;
&lt;p class="p1"&gt;template &amp;lt;typename T=double&amp;gt; class Vectors {&lt;/p&gt;
&lt;p class="p1"&gt;&lt;span&gt; &lt;/span&gt;public:&lt;/p&gt;
&lt;p class="p1"&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;typedef Vector&amp;lt;T, 2&amp;gt; Vector2;&lt;/p&gt;
&lt;p class="p1"&gt;};&lt;/p&gt;
&lt;p class="p1"&gt;class MyClass&amp;#160;: Vectors&amp;lt;&amp;gt; {&lt;/p&gt;
&lt;p class="p1"&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;Vector2 myVector;&lt;/p&gt;
&lt;p class="p1"&gt;};&lt;/p&gt;
&lt;p class="p1"&gt;What&amp;#8217;s particularly neat about this is that all the code in my class gets to uniformly use the same vector types and matrix types where appropriate - and they are true aliases, so two compatible types blend together without issue.&lt;/p&gt;
&lt;p class="p1"&gt;This goes to demonstrate the already well known fact that C++ is a very unpolished language with lots of rough edges. Templates exist, but they are not uniform across the language and there are many holes you can easily fall in to. Without namespace templates, typedef templates, using templates.. I was luckily able to find a solution using multiple inheritance.&lt;/p&gt;</description><link>http://mlucassmith.tumblr.com/post/4921423322</link><guid>http://mlucassmith.tumblr.com/post/4921423322</guid><pubDate>Tue, 14 Sep 2010 00:00:00 -0700</pubDate></item></channel></rss>

