LosTechies - Latest Commentshttp://derickbailey-lostechies.disqus.com/enThu, 03 Jul 2014 18:38:11 -0000Re: How I Work Around The require(&#8220;../../../../../../../&#8221;) Problem In NodeJShttp://lostechies.com/derickbailey/2014/02/20/how-i-work-around-the-require-problem-in-nodejs/#comment-1467501196<p>I have build a simple module called `lequire` for fixing this problem.</p>alireza94Thu, 03 Jul 2014 18:38:11 -0000Re: Composite Views: Tree Structures, Tables, And Morehttp://lostechies.com/derickbailey/?p=866#comment-1465843932<p>Good article. Unfortunately, the JSfiddles are all broken due to incompatible changes in Marionnete v2.0. You should probably use versioned library includes to avoid this in the future.</p>ChrisWed, 02 Jul 2014 19:31:07 -0000Re: Composite Views: Tree Structures, Tables, And Morehttp://lostechies.com/derickbailey/?p=866#comment-1465715810<p>Hey great blog post! <br>I added a childView attribute to the CollectionView so that the tree would render appropriately.</p><p><a href="http://jsfiddle.net/AdWjU/593/" rel="nofollow">http://jsfiddle.net/AdWjU/593/</a></p>b.tyler.burtonWed, 02 Jul 2014 17:44:18 -0000Re: How I Work Around The require(&#8220;../../../../../../../&#8221;) Problem In NodeJShttp://lostechies.com/derickbailey/2014/02/20/how-i-work-around-the-require-problem-in-nodejs/#comment-1461403046<p>Interesting relevant read:<br><a href="https://gist.github.com/branneman/8048520" rel="nofollow">https://gist.github.com/branne...</a></p>Bran van der MeerMon, 30 Jun 2014 08:15:52 -0000Re: How I Work Around The require(&#8220;../../../../../../../&#8221;) Problem In NodeJShttp://lostechies.com/derickbailey/2014/02/20/how-i-work-around-the-require-problem-in-nodejs/#comment-1454260870<p>If you pass a reference to the root module into your required module, you can use module.require inside of that module as if it were the root module.</p><p>So in your main app, require the sub-module, but invoke it by passing in the root module: require('sub-module')(module);</p><p>Inside, that module is actually a function that accepts the root argument, and uses it to require more modules from the root context: root.require('next-module');</p><p>This allows you to require to all of your module includes as if you're still inside of app.js.</p>Rob GibbonsWed, 25 Jun 2014 16:04:00 -0000Re: How I Work Around The require(&#8220;../../../../../../../&#8221;) Problem In NodeJShttp://lostechies.com/derickbailey/2014/02/20/how-i-work-around-the-require-problem-in-nodejs/#comment-1452833862<p>So you'd have a repository set up something like this?:</p><p>root<br>|- node_modules (npm modules from package.json)<br>|- src<br>| |- node_modules (my local common modules visible to App.js and children)<br>| `- App.js<br>|- package.json<br>`- run.js (entry point - requires ./src/App.js and 'executes')</p>AndrewEddieTue, 24 Jun 2014 21:11:06 -0000Re: Asynchronous Unit Tests With Mocha, Promises, And WinJShttp://lostechies.com/derickbailey/?p=976#comment-1452223537<p>How do we know that one test spec file has finished processing <br>in mocha. ?</p>anubhavaeronTue, 24 Jun 2014 14:59:23 -0000Re: JavaScript Mixins: Beyond Simple Object Extensionhttp://lostechies.com/derickbailey/?p=1009#comment-1449987918<p>&gt; Why do I feel ... all the frameworks are craaaazy to understand ...</p><p>Because some of them are ingenious but others are implemented in a way that shows a lack of understanding this languages design and core features.</p><p>If it comes to JavaScript and Role based composition approaches like Mixins and Traits, I'm meanwhile very opinionated. I always will point to a library agnostic mix of 2 purely function based patterns - firstly the module pattern and secondly the "Flight Mixin" pattern as it has been rediscovered, named and described by Angus Croll in May 2011. But I also would recommend reading a paper of mine from April 2014.</p><p>- [A fresh look at JavaScript Mixins](<a href="http://javascriptweblog.wordpress.com/2011/05/31/a-fresh-look-at-javascript-mixins)" rel="nofollow">http://javascriptweblog.wordpr...</a> <br>- [The many talents of JavaScript for generalizing Role Oriented Programming approaches like Traits and Mixins](<a href="http://peterseliger.blogspot.de/2014/04/the-many-talents-of-javascript.html#the-many-talents-of-javascript)" rel="nofollow">http://peterseliger.blogspot.d...</a> <br></p>Peter SeligerMon, 23 Jun 2014 11:48:33 -0000Re: Getting Audio File Information With HTML&#8217;s File API And Audio Elementhttp://lostechies.com/derickbailey/2013/09/23/getting-audio-file-information-with-htmls-file-api-and-audio-element/#comment-1448843711<p>no, that would be a security problem. if you could do that, there would be nothing to stop malicious people from loading sensitive files from hard drives, without the user knowing. file selection must be performed by the browser user, directly.</p>Derick BaileySun, 22 Jun 2014 12:56:34 -0000Re: Getting Audio File Information With HTML&#8217;s File API And Audio Elementhttp://lostechies.com/derickbailey/2013/09/23/getting-audio-file-information-with-htmls-file-api-and-audio-element/#comment-1448507228<p>Is there any way to say.. store the file's path locally, so that when you reload the page, you don't have to re-upload the file and then call URL.createObjectUrl?</p>jaiwveeSun, 22 Jun 2014 04:54:02 -0000Re: 7 Things I Learned From 175,000 Eyes And A Failed Adhttp://lostechies.com/derickbailey/2014/03/05/7-things-i-learned-from-175000-eyes-on-a-failed-ad/#comment-1432084274<p>Sounds like a nice book, though I wouldn't have clicked the banner either. In fact I looked at the ad and just scanned the two punchlines at the side. After having read the whole article I revisitid the ad and noticed it was a book about backbone. I should have noticed, because I'm into backbone - but didn't.</p><p>So here are more Principles of Banner design: don't emphasize many things by coloring and boldening. Emphasize just one or two things. With a product this specific, backbone should be one of those one or two things!</p><p>Also, don't use columns. In your Ad, the User reads: <br>1. Left top <br>"Stop wasting..."</p><p>2. Left bottom <br>"Write maintainable..."</p><p>3. Right <br>The image of the book</p><p>4. Bottom<br>"Buy the ebook..."</p><p>In this or another order. Instead you should make the user read from top to bottom. No left and right.</p><p>- It's too much large text.<br>- Line spacing should be increased for better legibility</p><p>- People also don't like to read coloumns with lines of text with only two or three words in a row. Coloumns should have at least 5 or words in a row. Six words in one line of medium sized text is way better than a block of text seperated into three lines. Larger isn't easier to read.</p><p>So, enough said. I believe your book is probably much better than your ad. Another thing to consider is hiring a professional like yourself for certain kinds of things.</p>MaxThu, 12 Jun 2014 10:53:02 -0000Re: How I Work Around The require(&#8220;../../../../../../../&#8221;) Problem In NodeJShttp://lostechies.com/derickbailey/2014/02/20/how-i-work-around-the-require-problem-in-nodejs/#comment-1422710810<p>thanks was looking for this</p>Victor EspírituFri, 06 Jun 2014 11:07:02 -0000Re: Git: Oops. I Forgot To Add Those New Files Before Committinghttp://lostechies.com/derickbailey/2010/06/09/git-oops-i-forgot-to-add-those-new-files-before-committing/#comment-1419236526<p>Awesome post. Gave me exactly what I was looking for. <br>Thanks a lot.</p>anonymousWed, 04 Jun 2014 11:13:03 -0000Re: Why Should I Use Backbone.Marionette Instead Of … ?http://lostechies.com/derickbailey/2012/06/13/why-should-i-use-backbone-marionette-instead-of-%e2%80%a6/#comment-1418672532<p>Is it ok to use Marionette for mobile apps?</p><p>On <a href="http://stackoverflow.com/questions/10937738/jquery-mobile-with-marionette-or-chaplin" rel="nofollow">http://stackoverflow.com/quest...</a> , I see that you said it requires performance improvements long time ago. Is it jQM + Marionette that is slow on mobile devices or just Marionette on mobile devices.</p><p>Please confirm.</p>kareemTue, 03 Jun 2014 23:52:12 -0000Re: Zombies! RUN! (Managing Page Transitions In Backbone Apps)http://lostechies.com/derickbailey/2011/09/15/zombies-run-managing-page-transitions-in-backbone-apps/#comment-1417021993<p>Awesome article.</p><p>Looks like you have a syntax error in rule #2</p><p>function AppView() { ..</p><p>`this.showView(view) {` ---should be----&gt;&gt; `this.showView = function (view) {`</p>lee101Mon, 02 Jun 2014 22:26:44 -0000Re: Event Aggregator And/Or/vs Mediator: A Tale Of Two Patternshttp://lostechies.com/derickbailey/2013/03/18/event-aggregator-andorvs-mediator-a-tale-of-two-patterns/#comment-1416635841<p>I agree that there is coupling involved in having to know the name of the event aggregator. However, it is less coupling than most other cases. You can further mitigate the issue by using a global namespace, then setting a pointer within that namespace to the event aggregator of choice. For example, MyAppNamespace = {}. MyAppNamespace.vent = Backbone.Marionette.App.vent. Then, you should be able to just use MyAppNamespace.vent as your event aggregator in your code. Should you later choose to change event aggregators (for example, to Postal) you can just change to MyAppNamespace.vent = Postal.[whatever].</p>Ken DickinsonMon, 02 Jun 2014 16:58:42 -0000Re: Intro To Backbone.js: How A Winforms Developer is At Home In Javascripthttp://lostechies.com/derickbailey/2011/06/14/intro-to-backbone-js-how-a-winforms-developer-is-at-home-in-javascript/#comment-1415690995<p>I've never seen a heavy client app that degraded gracefully. Could <br>just be that I haven't looked under the covers of enough heavy client <br>sites.<br>Guess you could always go the non RIA path. Building a web <br>application twice would seem prohibitively expensive for all but giants <br>like Google or Facebook.</p><p>If anyone has got some solid info on following WAI-ARIA, I'd love to hear it.</p><p>I've never seen a heavy client app that degraded gracefully. Could <br>just be that I haven't looked under the covers of enough heavy client <br>sites.<br>Guess you could always go the non RIA path. Building a web <br>application twice would seem prohibitively expensive for all but giants <br>like Google or Facebook.</p><p>If anyone has got some solid info on following WAI-ARIA, I'd love to hear it.</p><p>wasn't there a major airline sued for accessibility of it's kiosk checkin systems, as well?</p><p>...<br> also - Brian Hogan makes some really good points in his "Web Design For<br> Developers" book about how accessibility isn't just for people with <br>various degrees of disabilities anymore. it also cover things like <br>mobile browsers, text browsers, etc.</p><p>there's a lot to consider <br>when building an app that uses a framework like this, and audience / <br>device / accessibility is an important factor</p><p>like every tool in our toolbox, you only use it when it's <br>appropriate. if you're not experiencing the problems that JQuery or <br>Backbone solve, then don't use them.</p><p>maybe you don't need the <br>highly interactive, rich client side experiences in your systems? or if <br>you do, you're probably able to build good javascript code without these<br> tools... more power to you! i would love to sit down with your for a <br>day or two and learn about writing good javascript! (seriously... you're<br> only a few hours away from me... ever make it to austin or near waco <br>where i am?) but as of now, i'm not smart enough to do the rich browser <br>experiences that i need without tools like jquery and backbone.</p><p>"I guess what I'm trying to say is it feels like you are really fighting the framework by mixing JQuery and Backbone"</p><p>there's<br> some insight in this that i need to pay attention to, for sure. i <br>should see what i can / can't do with backbone, leaving jquery out of <br>the picture. it would give me a much better picture of which problems <br>each framework solves well.</p><p>...</p><p>you should at least take the<br> time to learn JQuery and/or backbone if you're going to offer some <br>heated opinions about them. claiming you don't like something because <br>you can't stand people that built it / love it, makes you look <br>over-emotional / reactionary, instead of thoughtful and insightful (i <br>know this from experience in doing the same thing too many times. :-/ )</p>guestMon, 02 Jun 2014 03:11:52 -0000Re: Heroku And SSL: Fixing &#8220;This site&#8217;s security certificate is not trusted!&#8221; on Android and other deviceshttp://lostechies.com/derickbailey/2014/02/12/heroku-and-ssl-fixing-this-sites-security-certificate-is-not-trusted-on-android-and-other-devices/#comment-1415629415<p>hi all</p>guestMon, 02 Jun 2014 01:20:33 -0000Re: Get Rid Of &#8220;locahost:#port#&#8221; With NGINX Reverse Proxieshttp://lostechies.com/derickbailey/2013/12/19/get-rid-of-locahostport-with-nginx-reverse-proxies/#comment-1413972958<p>Thanks for posting this, found it very useful and worked perfectly for using bind9 + nginx to have a local domain redirect for jenkins.[internaldomain].com</p><p>I previously had just been 301 redirecting back [internaldomain].com:8080</p>Albert WuSat, 31 May 2014 17:28:43 -0000Re: Killing Switch Statements With A Registry: An Example And Screencasthttp://lostechies.com/derickbailey/2014/01/28/killing-switch-statements-with-a-registry-an-example-and-screencast/#comment-1412026038<p>I use this pattern quite a bit in both Javascript, Python and Java. I find it tidies the code up nicely and is easier to maintain.</p>Mike StoddartFri, 30 May 2014 09:05:01 -0000Re: Don&#8217;t Do Role-Based Authorization Checks; Do Activity-Based Checkshttp://lostechies.com/derickbailey/2011/05/24/dont-do-role-based-authorization-checks-do-activity-based-checks/#comment-1408296776<p>I agree with this guy and I don't want to think a lot.</p>EricWed, 28 May 2014 10:19:01 -0000Re: Composite Views: Tree Structures, Tables, And Morehttp://lostechies.com/derickbailey/?p=866#comment-1406696922<p>Thank you for your explanations! Helped a lot.</p><p>I`ve remade tree example - <a href="http://jsfiddle.net/d6zUK/1/" rel="nofollow">http://jsfiddle.net/d6zUK/1/</a></p><p>UL and LI elements are now in place.</p>Dennis DyatlovTue, 27 May 2014 12:10:27 -0000Re: Stop Using Backbone As If It Were A Stateless Web Serverhttp://lostechies.com/derickbailey/2011/08/03/stop-using-backbone-as-if-it-were-a-stateless-web-server/#comment-1406059847<p>Good read, I share a lot of your views. One suggestion however: Instead of calling delete on a view, let the model listen to the "remove" event. If it is properly coupled to the view, the view should then be deleted automatically.</p>ramseydsilvaTue, 27 May 2014 00:49:21 -0000Re: Stop Using Backbone As If It Were A Stateless Web Serverhttp://lostechies.com/derickbailey/2011/08/03/stop-using-backbone-as-if-it-were-a-stateless-web-server/#comment-1404895075<p>"A web application is a stateless system" not true for Java.</p>mandrakeMon, 26 May 2014 12:09:27 -0000Re: How I Work Around The require(&#8220;../../../../../../../&#8221;) Problem In NodeJShttp://lostechies.com/derickbailey/2014/02/20/how-i-work-around-the-require-problem-in-nodejs/#comment-1399988579<p>My preferred solution to this problem takes the form of a module named ‘rekuire’:</p><p>var use = require('rekuire');<br>var foo = use('foo');</p><p>where ‘foo’ is a file anywhere in your project. You can disambiguate the file name by including as much of its path as you need: var bar = use('util/bar').</p><p>Unfortunately, this doesn’t work if you’re using Browserify to require modules in front-end code—only ‘require’ itself gets picked up. Anyway, on the back-end or for unit tests it’s great, and it doesn’t suffer from the ugliness of using an environment variable or putting project files in node_modules.</p>Leo Baker-HytchThu, 22 May 2014 16:52:22 -0000