<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Disqus - Latest Comments for troygoode</title><link>http://disqus.com/by/troygoode/</link><description></description><atom:link href="http://disqus.com/troygoode/comments.rss" rel="self"></atom:link><language>en</language><lastBuildDate>Tue, 29 Jan 2019 20:31:49 -0000</lastBuildDate><item><title>Re: Roll20 Resolutions: Time to Get a New Look!</title><link>http://blog.roll20.net/post/182402826410#comment-4313519196</link><description>&lt;p&gt;"LAYER"... "MORE". More layers - YES, PLEASE!&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">TroyGoode</dc:creator><pubDate>Tue, 29 Jan 2019 20:31:49 -0000</pubDate></item><item><title>Re: A gentle Introduction to Higher Order Components</title><link>https://www.robinwieruch.de/gentle-introduction-higher-order-components/#comment-3242039414</link><description>&lt;p&gt;If you're using recompose anyway, why not use their "branch" HoC?&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">TroyGoode</dc:creator><pubDate>Wed, 05 Apr 2017 19:43:59 -0000</pubDate></item><item><title>Re: The Fringe of .NET - You've Been Haacked</title><link>http://haacked.com/archive/2015/03/10/dotnetfringe/#comment-1900400159</link><description>&lt;p&gt;Hey Phil - I've been out of the .NET world for a few years now, but this sounds an awful lot like what was going on several years ago with "AltDotNet" (which I loved, and eventually helped lead me away from .NET). Is that "movement" (not sure what else to call it) dead? Is this kind of a recreation of that original premise under a new context given Microsoft's new status quo?&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">TroyGoode</dc:creator><pubDate>Tue, 10 Mar 2015 22:44:17 -0000</pubDate></item><item><title>Re: Minty: Razing the Pyramid of Pain</title><link>http://www.wekeroad.com/2013/11/05/minty-razing-the-pyramid-of-pain/#comment-1156291158</link><description>&lt;p&gt;This is the part I take exception to:&lt;/p&gt;&lt;p&gt;"The same thing is happening with my continueWith - in the zipper analogy I threw down, article2 is incapable of "jumping the queue" past article1 - because it's a queue and it's synchronous.&lt;/p&gt;&lt;p&gt;It can't get popped onto the queue any earlier either since Node is single threaded and will handle synchronous code inline."&lt;/p&gt;&lt;p&gt;The assignAuthor handler pushes the "author-assigned" event onto the queue, but only after the assignAuthor handler has finished received a response from the database. This is an asynchronous out-of-process action and you now have no guarantee of which article (article1 or article2) will have its callback fired first. In theory you'd expect the database to respond to the node.js process (and thus fire the callbacks) in the order that node.js originally made the requests, but as we all know this isn't always the case (though it probably is in your case given that you're using NeDB). If these requests were going out to a sharded database environment query2 could quite easily respond before query1.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">TroyGoode</dc:creator><pubDate>Mon, 09 Dec 2013 14:21:42 -0000</pubDate></item><item><title>Re: Minty: Razing the Pyramid of Pain</title><link>http://www.wekeroad.com/2013/11/05/minty-razing-the-pyramid-of-pain/#comment-1155400272</link><description>&lt;p&gt;Consensus at last! :-)&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">TroyGoode</dc:creator><pubDate>Sun, 08 Dec 2013 19:09:10 -0000</pubDate></item><item><title>Re: Minty: Razing the Pyramid of Pain</title><link>http://www.wekeroad.com/2013/11/05/minty-razing-the-pyramid-of-pain/#comment-1155394713</link><description>&lt;p&gt;While you may not intend for multiple calls to #saveDraft to be made from the same Writer, the module as you've currently written it does not prevent this.&lt;/p&gt;&lt;p&gt;The race condition is that consecutive calls to #saveDraft on the same instance of Writer can contend over access to continueWith variable. If #saveDraft{X++} is popped off the even loop queue and processed while #safeDraft{X} is waiting for a call to the database to return, continueWith will be overwritten and #saveDraft{X} will not complete the way you intend it to. If you don't consider that a race condition, we'll have to agree to disagree. :-)&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">TroyGoode</dc:creator><pubDate>Sun, 08 Dec 2013 19:00:48 -0000</pubDate></item><item><title>Re: Minty: Razing the Pyramid of Pain</title><link>http://www.wekeroad.com/2013/11/05/minty-razing-the-pyramid-of-pain/#comment-1155379680</link><description>&lt;p&gt;Yes, we're on the same page. That "zipper" effect creates a race condition if you're accessing state shared between multiple runs of the event loop, such as with the continueWith variable.&lt;/p&gt;&lt;p&gt;I think your best option, if you want to continue down this path, is to encapsulate the entire Writer object in another object with its own #saveDraft method. This wrapper object would be stateless and would ensure that each your actual Writer objects (which could contain state, such as continueWith) are not reused. You would dispatch WriterWrapper#saveDraft-&amp;gt;WriterInstance#saveDraft and also listen to &amp;amp; re-emit each WriterInstance's events from WriterWrapper (so that you still can have your extensibility points).&lt;/p&gt;&lt;p&gt;I'm interested to see how you ultimately choose to handle this.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">TroyGoode</dc:creator><pubDate>Sun, 08 Dec 2013 18:42:57 -0000</pubDate></item><item><title>Re: Minty: Razing the Pyramid of Pain</title><link>http://www.wekeroad.com/2013/11/05/minty-razing-the-pyramid-of-pain/#comment-1155350703</link><description>&lt;p&gt;The event loop is absolutely a queue, yes. Sorry, I think I'm not doing a good job explaining myself here. :-)&lt;/p&gt;&lt;p&gt;Take a look at this gist:&lt;/p&gt;&lt;p&gt;&lt;a href="https://gist.github.com/troygoode/7864904" rel="nofollow noopener" target="_blank" title="https://gist.github.com/troygoode/7864904"&gt;https://gist.github.com/tro...&lt;/a&gt;&lt;/p&gt;&lt;p&gt;* run that in one tab of your terminal&lt;/p&gt;&lt;p&gt;* then, in another tab, run "curl http://localhost:3000" twice in a row&lt;/p&gt;&lt;p&gt;* switch back to the original tab and wait a few seconds to see that the console.logs are now intermingled&lt;/p&gt;&lt;p&gt;What I'm trying to show is that whenever node.js is waiting on an asynchronous external process (file system, database, in this case a #setTimout) it is free to process additional events from the event loop so you cannot be guaranteed that your code will execute in order.&lt;/p&gt;&lt;p&gt;When #assignAuthor is waiting on the response from the database, node.js *will* start processing the next event in the event loop (which may be another HTTP request).&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">TroyGoode</dc:creator><pubDate>Sun, 08 Dec 2013 18:04:12 -0000</pubDate></item><item><title>Re: Minty: Razing the Pyramid of Pain</title><link>http://www.wekeroad.com/2013/11/05/minty-razing-the-pyramid-of-pain/#comment-1155312975</link><description>&lt;p&gt;You're correct that there is only one loop per process - but remember that there can be entry points in that process that are adding things onto the event loop. The main thing to consider here is that node.js' HTTP server adds each request onto the event loop queue as it comes in. This means what while your code path that calls #saveDraft is executing (but *before* it has called #emit) a new request could come in queue'ing up the same codepath which would then execute before your #assignAuthor function runs (because #sendDraftToDB gives up control).&lt;/p&gt;&lt;p&gt;Obviously if you're the only user this might not be a big deal (though keep the "accidentally double-clicked the submit button" scenario in mind), but if anyone else tries to adopt your approach they might end up getting themselves into trouble...&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">TroyGoode</dc:creator><pubDate>Sun, 08 Dec 2013 17:17:07 -0000</pubDate></item><item><title>Re: Minty: Razing the Pyramid of Pain</title><link>http://www.wekeroad.com/2013/11/05/minty-razing-the-pyramid-of-pain/#comment-1155259688</link><description>&lt;p&gt;You’re right that node.js is single-threaded, but unfortunately that doesn’t free you up from the possibility of race conditions as node.js implements cooperative multitasking to take advantage of its asynchronous usage. Node.js operates using something called an Event Loop. What this means is that node.js queues up code that it should run, runs a segment of code from the queue sequentially, and then moves on to the next section of code once the first section has given up control, ad infinitum. This is part of what makes node.js so fast - other work can be done while waiting for the return of an asychronous call.&lt;/p&gt;&lt;p&gt;Note that I mentioned your code has to “give up control.” The most frequent way this occurs is by calling a asynchronous IO function (file system, network, database, etc), but this also occurs when you manually give up control and wait for the next available run of the event loop via process.nextTick: &lt;a href="http://howtonode.org/understanding-process-next-tick" rel="nofollow noopener" target="_blank" title="http://howtonode.org/understanding-process-next-tick"&gt;http://howtonode.org/unders...&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;EventEmitter’s implementation does happen to be synchronous so your #emit’s and #on’s would be executing within the same event loop IF all of your event handlers were also synchronous, but they aren’t - your handler for “slug-checked,” “article-saved,” and “article-tagged" are asynchronous. Your “chain” will be broken up into several runs of the event loop which may be interspersed with code from elsewhere in the program. This means calling Writer#saveDraft a second time on the same instance of Writer is NOT safe unless you’ve waited for previous run of #saveDraft’s chain to end.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">TroyGoode</dc:creator><pubDate>Sun, 08 Dec 2013 16:12:50 -0000</pubDate></item><item><title>Re: Storing LINQ Objects in SQL-Based Session State</title><link>http://www.squaredroot.com/2008/01/30/storing-linq-objects-in-sql-based-session-state/#comment-1017394100</link><description>&lt;p&gt;Sorry Arun - I'm not spending much of my time programming in .NET these days, and haven't thought about this particular problem in five years. Best of luck finding a solution!&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">TroyGoode</dc:creator><pubDate>Sun, 25 Aug 2013 22:14:50 -0000</pubDate></item><item><title>Re: Rob Conery&amp;#8217;s PagedList Class (Updated)</title><link>http://www.squaredroot.com/2008/04/08/updated-pagedlist-class/#comment-719361369</link><description>&lt;p&gt;Hi Moh,&lt;/p&gt;&lt;p&gt;In that case you'll want to call OrderBy before calling ToList:&lt;/p&gt;&lt;p&gt;var productsPaged = _products.All().OrderBy(p=&amp;gt; p.Price).ToPagedList(0, 10);&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">TroyGoode</dc:creator><pubDate>Mon, 26 Nov 2012 09:30:55 -0000</pubDate></item><item><title>Re: http://4sffl.com/post/30937296510</title><link>http://4sffl.com/post/30937296510#comment-640801840</link><description>&lt;p&gt;Also, Nick says he would put his faith in Mike Wallace and then proceeds to tell me to start Brandon LaFell.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">TroyGoode</dc:creator><pubDate>Wed, 05 Sep 2012 16:21:09 -0000</pubDate></item><item><title>Re: http://4sffl.com/post/30368039354</title><link>http://4sffl.com/post/30368039354#comment-632512610</link><description>&lt;p&gt;How was Chris Johnson not on last year's LVP list?&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">TroyGoode</dc:creator><pubDate>Tue, 28 Aug 2012 19:48:55 -0000</pubDate></item><item><title>Re: CoffeeScript or Straight Up Javascript? It&amp;#8217;s Decision Time</title><link>http://wekeroad.com/2012/03/21/coffeescript-or-straight-up-js-i-suck-either-way/#comment-474172573</link><description>&lt;p&gt;Fair enough, different strokes for different folks. :-)&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">TroyGoode</dc:creator><pubDate>Thu, 22 Mar 2012 23:07:10 -0000</pubDate></item><item><title>Re: CoffeeScript or Straight Up Javascript? It&amp;#8217;s Decision Time</title><link>http://wekeroad.com/2012/03/21/coffeescript-or-straight-up-js-i-suck-either-way/#comment-473743005</link><description>&lt;p&gt;Computers prefer 1s and 0s - if we want to speak their language we should stay as close to that as possible (Assembly for most mortals). Higher level languages are all about giving *humans*, not computers, a language that is easier for *us*.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">TroyGoode</dc:creator><pubDate>Thu, 22 Mar 2012 12:49:55 -0000</pubDate></item><item><title>Re: CoffeeScript or Straight Up Javascript? It&amp;#8217;s Decision Time</title><link>http://wekeroad.com/2012/03/21/coffeescript-or-straight-up-js-i-suck-either-way/#comment-472722949</link><description>&lt;p&gt;Presumably you wouldn't have to port your code to Harmony, but CoffeeScript's compiler could be ported to it so your code takes advantage of it without direct changes to your source.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">TroyGoode</dc:creator><pubDate>Wed, 21 Mar 2012 15:59:05 -0000</pubDate></item><item><title>Re: CoffeeScript or Straight Up Javascript? It&amp;#8217;s Decision Time</title><link>http://wekeroad.com/2012/03/21/coffeescript-or-straight-up-js-i-suck-either-way/#comment-472718300</link><description>&lt;p&gt;Comprehensions are my "dagger" for CoffeeScript:&lt;/p&gt;&lt;p&gt;console.log color for color in ['red', 'green', 'blue']&lt;/p&gt;&lt;p&gt;The above is the equivalent of:&lt;/p&gt;&lt;p&gt;['red', 'green', 'blue'].forEach(function(color){&lt;br&gt;  console.log(color);&lt;br&gt;}); //note that I originally forgot the closing paren here&lt;/p&gt;&lt;p&gt;Here is another comprehension:&lt;/p&gt;&lt;p&gt;colors =&lt;br&gt;  red: '#ff0000'&lt;br&gt;  green: '#00ff00'&lt;br&gt;  blue: '#0000ff'&lt;br&gt;console.log "#{color} is #{hex} in hex" for color, hex of colors&lt;/p&gt;&lt;p&gt;The above is the equivalent of:&lt;/p&gt;&lt;p&gt;var colors = {&lt;br&gt;  red: '#ff0000',&lt;br&gt;  green: '#00ff00',&lt;br&gt;  blue: '#0000ff'&lt;br&gt;};&lt;br&gt;for(var color in colors){&lt;br&gt;  var hex = colors[color];&lt;br&gt;  console.log(color + " is " + hex + " in hex.");&lt;br&gt;}&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">TroyGoode</dc:creator><pubDate>Wed, 21 Mar 2012 15:54:15 -0000</pubDate></item><item><title>Re: CoffeeScript or Straight Up Javascript? It&amp;#8217;s Decision Time</title><link>http://wekeroad.com/2012/03/21/coffeescript-or-straight-up-js-i-suck-either-way/#comment-472678135</link><description>&lt;p&gt;+1 for "CS", but wanted to note that you can reduce your example further (the {} are optional):&lt;/p&gt;&lt;p&gt;find name: 'leto', (doc)-&amp;gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">TroyGoode</dc:creator><pubDate>Wed, 21 Mar 2012 15:19:00 -0000</pubDate></item><item><title>Re: PagedList can haz HtmlHelperz? | troy goode | squaredroot.com</title><link>http://www.squaredroot.com/2011/06/28/pagedlist-can-haz-htmlhelperz/#comment-444409389</link><description>&lt;p&gt;Thanks, glad you liked it!&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">TroyGoode</dc:creator><pubDate>Mon, 20 Feb 2012 19:39:42 -0000</pubDate></item><item><title>Re: NHibernate Built-in Code Based Mapping instead of using Fluent NHibernate - Kazi Manzur Rashid</title><link>http://kazimanzurrashid.com/posts/nhibernate-built-in-code-based-mapping-instead-of-using-fluent-nhibernate#comment-326525292</link><description>&lt;p&gt;Interesting. Do you know if it does FluentNhibernate-style automapping?&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">TroyGoode</dc:creator><pubDate>Tue, 04 Oct 2011 14:51:15 -0000</pubDate></item><item><title>Re: PagedList can haz HtmlHelperz? | troy goode | squaredroot.com</title><link>http://www.squaredroot.com/2011/06/28/pagedlist-can-haz-htmlhelperz/#comment-313380238</link><description>&lt;p&gt;Hey Dan,&lt;/p&gt;&lt;p&gt;So you're actually putting Model.HouseFeatures into an anonymous type which is being passed into Url.Action(...), and that is an object+method built into Asp.Net MVC by Microsoft - so no, I can't change how it works. ;-)&lt;/p&gt;&lt;p&gt;That said, what you want to do isn't too hard. Ultimately we want {"HouseFeatures", Model.HouseFeatures} to become {"HouseFeatures", "1,2,3"} (where 1, 2, and 3 are the integers stored in the Model.HouseFeatures array. The String object provides the handy Join method that will do some of this work for us:&lt;/p&gt;&lt;p&gt;String.Join(",", Model.HouseFeatures)&lt;/p&gt;&lt;p&gt;The above won't *quite* work though, because Model.HouseFeatures is an array of ints and String.Join expects an array of strings, so modify it to:&lt;/p&gt;&lt;p&gt;String.Join(",", Model.HouseFeatures.Select(hf=&amp;gt; hf.ToString()).ToArray())&lt;/p&gt;&lt;p&gt;And now you're rocking. The full call should look something like:&lt;/p&gt;&lt;p&gt;@Html.PagedListPager(Model.SearchResults,&lt;br&gt;    page =&amp;gt; Url.Action(&lt;br&gt;        "Index",&lt;br&gt;        new RouteValueDictionary{&lt;br&gt;            { "Page", page },&lt;br&gt;            { "HouseFeatures", String.Join(",", Model.HouseFeatures.Select(hf=&amp;gt; hf.ToString()).ToArray()) }&lt;br&gt;        }&lt;br&gt;    )&lt;br&gt;)&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">TroyGoode</dc:creator><pubDate>Fri, 16 Sep 2011 15:45:46 -0000</pubDate></item><item><title>Re: MVC Membership Starter Kit Released</title><link>http://www.squaredroot.com/2009/08/07/mvcmembership-release-1-0/#comment-309993787</link><description>&lt;p&gt;@flascuba, the project just uses Microsoft's Membership Provider abstraction, which has a Windows Auth provider:&lt;br&gt;&lt;a href="http://forums.asp.net/t/958504.aspx" rel="nofollow noopener" target="_blank" title="http://forums.asp.net/t/958504.aspx"&gt;http://forums.asp.net/t/958...&lt;/a&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">TroyGoode</dc:creator><pubDate>Wed, 14 Sep 2011 12:45:10 -0000</pubDate></item><item><title>Re: MVC Membership Starter Kit Released</title><link>http://www.squaredroot.com/2009/08/07/mvcmembership-release-1-0/#comment-292539334</link><description>&lt;p&gt;Yup, the latest release is based on MVC3 and Razor (CSHTML).&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">TroyGoode</dc:creator><pubDate>Sun, 21 Aug 2011 15:24:56 -0000</pubDate></item><item><title>Re: PagedList can haz HtmlHelperz? | troy goode | squaredroot.com</title><link>http://www.squaredroot.com/2011/06/28/pagedlist-can-haz-htmlhelperz/#comment-291545054</link><description>&lt;p&gt;hey Foton - there have been a few fixes to PagedList &amp;amp; PagedList.Mvc and one of them handles certain IQueryable situations better. you may want to try it out again; the fixes may have solved your scenario&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">TroyGoode</dc:creator><pubDate>Fri, 19 Aug 2011 23:32:50 -0000</pubDate></item></channel></rss>