HNHacker News
TopNewBestAskShowJobs

richardofyork

437 karma · joined July 3, 2011

Developing.
submissionscomments
richardofyork··on Meteor hits 1.0
For an unbiased overview of Meteor, including what it offers and how it differs from typical JavaScript frameworks (like Angular.js and Backbone.js) and ecosystems (like Mean.js and Yeoman), read this article: http://javascriptissexy.com/learn-meteor-js-properly/
richardofyork··on Show HN: Improve Your Writing – Grammar and Writing for Creators
I am the author, and I will try to address some of the comments:

1. First, if you buy and read the book, your writing will definitely improve. You will write better than you ever have. I am confident you will. Those tiny grammar books on amazon.com wouldn't help much because many don't cover the crucial topics for writing well. I read nearly all of them.

2. Language is instinctual, so arguing about grammatical rules is pointless. Take this passage from my book: "I agree with Steven Pinker, as he describes in his book "The Language Instinct," that humans have an instinct to learn and use language, and some nonstandard grammars and dialects perceived to be unsophisticated and ungrammatical (Appalachian English Vernacular and Black English Vernacular, for example) do, in fact, follow sophisticated grammatical rules.

I will not hurl even a pebble of criticism to anyone who uses English grammar to his or her own inclination. Instead, this book helps people who want to improve their Standard American English and Standard British English grammar. By “standard,” I mean the form used in academia, mainstream businesses and books, and formal and informal writing aimed at the general public or educated readers.

3. For the first bullet, I combined two similar bullets into one, hence the possible oddity. I constructed it for brevity, not for eloquence. No need to niggle over a bullet; it's a peccadillo. Incidentally, I wrote an entire chapter on how to write eloquent prose.

4. Ztratar, I presume you would agree that books are not useless. While anyone can probably learn anything online, books are still usually more organized and better researched than disparate articles and blog posts spread across hundreds of websites. In fact, to my knowledge, about half of the content in my book cannot be found online. I have devised some new grammatical constructions and techniques for writing skillfully.

5. Icambron, you should definitely read my book. You will learn a lot. For example, you will learn that all those things you pointed out are actually grammar myths (aka superstitions). I have an entire section on myths that many people believe are legitimate rules of grammar. Many such myths abound even in schools, including college. You should read the following article, a section from my book; you may find some of the cool sentence constructions quite different from the prosaic and formulaic constructions taught in schools: https://grammarandwritingforcreators.com/Creative_Powerful_W...

5. Seanmcdirmid, I wrote an entire section on the rhythm and euphony of sentences, another topic rarely found in grammar books. You can read this new figure of speech that I have devised (unrelated to rhythm, but all the examples employ rhythm): https://grammarandwritingforcreators.com/Conceal_Reveal_Arti...

richardofyork··on Can Ruin Your Career/Business in 5 Seconds, and it is Not Taught in Schools
Ohh, so that is why sites disappear from the front page suddenly. Interesting. I agree with you.
richardofyork··on A surprising JavaScript memory leak found at Meteor
Good question: I take it you are referring to the code below. The reason str is garbage collected is because of the modern implementation of the JS compiler in Chrome. Such modern JS compilers look specifically for such unused variables in closures, even when the variable is in the execution context of the closure.

To clarify, it is Chrome's decision to garbage collect the str variable in that context that resulted in str being garbage collected. It is not a result of a JavaScript bug.

Moreover, different browsers have different implementations for how they garbage collect variables in closures' scope chain. Heck, browsers do their own thing when it comes to many aspects of JavaScript.

On second thought (from our previous back and forth), you are correct that I did not explicitly discuss this specific issue in my earlier post. So you win :) and I have up-voted your two comments accordingly.

Here is the code I think you are referring to: var run = function () { var str = new Array(1000000).join('*'); var logIt = function () { console.log('interval'); }; setInterval(logIt, 100); }; setInterval(run, 1000);

richardofyork··on A surprising JavaScript memory leak found at Meteor
Are you saying my explanation does not explain the following? "logIt alone -> str is garbage collected"

I don't see why you don't understand why I am saying. My first post explains in detail how closures work and why the issue is not a JS bug, though it is indeed a memory leak. All I can say is that I have explained the overall inner workings of closures in JS, and my explanation covers all the scenarios outlined in the blog post.

This is the crux of the matter of the entire blog post:

"...str is only referenced in the main body of run, and in doSomethingWithStr. doSomethingWithStr itself gets cleaned up once run ends… the only thing from run that escapes is the second closure, logIt. And logIt doesn’t refer to str at all! So even though there’s no way for any code to ever refer to str again, it never gets garbage collected!"

And I explained why that problem is observed and why closures work the way they do.

PS. I will humbly agree to disagree: I think that I have explained all the scenarios outlined in the blog post and you disagree with me. This is not a problem; there is nothing wrong with disagreeing.

richardofyork··on A surprising JavaScript memory leak found at Meteor
nknighthb, I am just wondering. Did you downvote me because you think one part of my explanation was not specific enough?

First, you are correct that I specifically mentioned the logIf function when I discuss the specific example.But that does not take away from my thorough explanation of the main reason for the problem. In fact, everything I said about the logIt function applies to the doSomethingWithStr function, since they are both closures, so my explanation stands as is.

If you read my explanation again, you will see that I clearly explained that closures still have access to the outer function's scope, so both the logIt and the doSomethingWithStr functions have access to the outer function's scope chain even after the outer function or any of the other closures returns.

It is not until both all closures are destroyed or returns that the outer function's scope activation object is destroyed.

richardofyork··on A surprising JavaScript memory leak found at Meteor
>> TL;DR -- all closures created within a function are retained even if only one closure is ever referenced. This is really interesting, and potentially devastating for certain coding styles. <<

This is not devastating, it is how closures and scope chain work in JavaScript. See my detailed explanation below. The crux of the matter is that the closure still references the outer function's scope chain, even after the outer function has returned. And the outer functions's scope chain is referenced by the closure until the closure is destroyed or returns.

richardofyork··on A surprising JavaScript memory leak found at Meteor
First, it is not a bug in JavaScript at all.

Here is a technical explanation of why there is a memory leak and how to fix the problem.

The scope chain of Closures (in JavaScript) contains the outer function(s) activation object. The activation object of a function contains all the variables that the function has access to, and it is part of a function’s scope chain.

This means the inner function (the closure) has access (a reference) to the outer function’s scope chain, including the global object. And even after the outer function has returned, the closure still has access to the outer function’s variables.

Therefore, the activation object of the outer function cannot be destroyed (for garbage collection) after it has returned, because the closure still references its variables.

When the outer function returns, its own scope chain for execution (its execution object) is destroyed, but its activation object is still referenced by the closure, so its variables will not be destroyed until the closure is destroyed.

The execution context of a function is associated with the functions’ activation object, but while the execution object is used for its own execution and is destroyed when it returns, its activation object is referenced by closures—its inner functions. 


Now, as to the specific example in question: The reason the str variable is never destroyed is because it is referenced buy the logIt function because the logIt function's execution object references the entire scope chain of the run function, and the logIt function is never destroyed, so the str variable remains in memory.

As the original author (OP) suggested, be sure to dereference any local variable in the outer function that the closure is using, once the closure is done with it or once the outer function is done with it.

Also, simply setting the logIt function to null (when it completes execution—returns) will allow the str variable and the entire scope of chain of both the logIt and the containing run function to be destroyed and ready for garbage collection.


For a detailed explanation of closures in JavaScript, see "Understand JavaScript Closures With Ease": http://javascriptissexy.com/understand-javascript-closures-w...

richardofyork··on Discover Meteor
Meteor uses Fibers. And you can do any of the async stuff in Meteor, like you would in Node.js with async.js, with the exception that you will most likely use Futures, and the code style will look synchronous (not the lengthy callback chains we are used to in Node.js). For more on Async execution in Meteor.js, see this link: https://gist.github.com/possibilities/3443021
richardofyork··on Discover Meteor
Man, you guys are making me feel warm and fuzzy. I had no idea some followers of my blog are HN regulars.

Thanks for the wonderful compliment and encouragement, laughfactory. I am very happy that my blog is making a difference. Good luck with your learning.

richardofyork··on Discover Meteor
No, you need to learn JavaScript first. See the link below (there is even a Reddit study group to help you along the way): http://javascriptissexy.com/how-to-learn-javascript-properly...
richardofyork··on Discover Meteor
I am happy to hear from readers who are following my blog, and most importantly, to hear of their progress. So thanks for your comment, loupeabody.

It appears that you have the passion and determination to follow through with learning JS and then Meteor. You can skip Node.js/Express.js/Backbone.js and go straight to Meteor, if your goal is to develop modern web applications with JS soon (without the lengthy time needed to learn all the libraries and frameworks needed to put a full Node.js app together).

richardofyork··on Discover Meteor
I am glad to hear you are a fan of the blog, Cory. I am somewhat surprised you are all over Meteor already :), and you probably think the same thing of me :)

There will be Meteor hysteria for sure, but I don't know if it will happen so soon, although this book will help quite a bit.

richardofyork··on Discover Meteor
I have read the beta release of the book in its entirety. I do not know the book's authors personally, so I can give an unbiased assessment of the book and answer specific questions about the book.

The Crux of the Matter:

Coming from Node.js/Backbone.js/Express.js, I was pleasantly shocked and surprisingly inspired by how pleasurable and productive it is to develop with Meteor. I am not sure I feel this way about any other web-dev technology besides jQuery. Meteor is so awesome that it makes the book easy to get through and fun to learn from (the book is a web app, a book, and a tutorial in one; it is more than just a book, hence my use of the word “use” instead of “read”).

The book covers most of the big Meteor concepts with example code and it guides you along as you build the Microscope web app—a "real world" application you can deploy and actually use. You will learn so much and get through the book so quickly that you will want to develop your own web app with Meteor in an instant. Be warned: You will be giddy with excitement at how easy it is to get stuff done with Meteor. Using Meteor is analogous to using an iPhone for the first time after using one of those "smartphones" [1] that were available prior to the launch of the iPhone.

The alternative to using this book is to learn Meteor by painstakingly browsing and reading the thorough (but not necessarily logically organized for structured learning) Meteor docs. Forget finding a proper "Getting Started with Meteor" tutorial; they are outdated and lack depth. The book summarizes some of the important Meteor concepts in a logical, succinct, and exemplary manner, with hands-on implementation.

There are some specific Meteor core concepts that the book either doesn't cover or only discusses briefly, like eJSON, Deps, Custom Reactivity, and cursor.observe (similar to Backbone's model.on events). But fortunately, Chris Maher does an excellent job covering these topics in depth on EventedMind.com [2]. Therefore, I highly recommend the book along with frequent visits to EventedMind.com to get a thorough understanding of Meteor.js, so you can confidently start building Meteor apps straightaway.

It is worth noting that the book's format (a web app with comments, videos, frequent updates, and the main Microscope tutorial, in addition to PDF and eBook copies of the book) is groundbreaking and must be celebrated. Every book on any web development topic should be published in this manner. Authors take note.

Background: I am the dude blogging at http://javascriptissexy.com/ and I am a Frontend Developer (JavaScript Guru). Incidentally, I will likely write a detailed blog post about Meteor ("How to Learn Meteor Properly," perhaps) in a few weeks, after I develop my first Meteor app.

[1] http://reviews.cnet.com/cell-phones/sanyo-katana-6600-black/...

[2] http://www.eventedmind.com/

richardofyork··on HN Admin: I have apparently been mistakenly flagged or banned
Ah ha, so that must be the issue. I am relieved, now that I know the reason for the problem. Thanks, sp332.
richardofyork··on HN Admin: I have apparently been mistakenly flagged or banned
That is strange indeed. I think what might have flagged the previous comment was: I initially posted the comment in reply to the wrong person. So I deleted it and reposted it in response to the correct person.
richardofyork··on Learning JavaScript - my experience and advice
Yep, skip those pesky IE compatibility issues, except, if you expect to target IE <= 8, you should definitely get the shim library at the link below. It provides compatible IE functions for all the common native JS methods and functions that missing in IE <= 8. Then you never have to worry about IE again. https://github.com/kriskowal/es5-shim
richardofyork··on Six months with Meteor: Why the future of the web is real-time
> ..."it’s not ideal for sites that need to load very fast (like e-commerce sites)"

Sasha, could you elaborate on the quote above a bit more so that we can better understand which use cases are not ideal for Meteor right now? Thanks.

richardofyork··on Show HN: TextRazor, a scriptable text mining API
I just tried it again and it worked this time. That is interesting: I don't know if they tweaked it a bit or not :), but I am feeling a bit better now, because my application really needs a reliable, accurate service like this.
richardofyork··on Show HN: TextRazor, a scriptable text mining API
I am also building an application that could use this service. So I tested TextRazor and the results were not good on two random articles I processed with the service.

I really want this to work out, because my application needs this kind of technology to be reliable and accurate. I just processed the article at the link below, and the word "Tesla" was not captured as one of the topics. http://www.teslamotors.com/blog/most-peculiar-test-drive-fol...

richardofyork··on How to Learn JavaScript Properly
Immediately after the sentence you quoted above, the article went on to say: "Crockford’s book does not explain the JavaScript concepts in a thorough, clear, easily digestible form."
richardofyork··on When and Why to Learn to Program
I recommend any new programmer interested in developing web applications or an internet startup should learn JavaScript first. Here is a blog post on How to Learn JavaScript Properly: http://javascriptissexy.com/how-to-learn-javascript-properly...
richardofyork··on Etsy acquires Mixel
I always thought Mixel was an interesting, useful app and, in some ways, more useful than Instagram. The big question is how much they were acquired for.
richardofyork··on Aaron Swartz commits suicide
I am very saddened by this young man's taking of his life and the apparent reckless pursuit by the Government to prosecute him for a seemingly minor "crime."
richardofyork··on Trello celebrates One Million Users
I wonder how much, it at all, has Trello's success impacted sales of 37 Signals' Basecamp. We cancelled our Basecamp account and switched to Trello after we realized Trello was ideal for our project management needs.
richardofyork··on Effective JavaScript Reviewed
Thanks for the info, telemachos. I have always bought my eBooks from Amazon and, on some rare occasions, from iBooks iPad app. So I am happy to know there are better deals outside of Amazon.

In most cases, however, the eBooks (Kindle) are cheaper on Amazon, but I am willing to pay a few dollars more to get the eBooks in all 3 formats (.pdf. .epub, and .pdf). I personally prefer to use iBooks (.epub works fine), when I am on my iPad, and the .pdf—when I am on my laptop.

richardofyork··on Effective JavaScript Reviewed
Buy the eBook at the link below with a 45% off coupon code (and you get it in 3 formats: .mobi, .pdf, and .epub — UNBELIEVABLE. (I have never gotten more than one format of the eBook anywhere). http://www.informit.com/store/effective-javascript-68-specif...

Here is the 45% off discount code: IUGD45 (45%)

richardofyork··on No bullshit guide to math and physics
If you make this promising book available in eBook format you are guaranteed at least a few sales from HN readers, and indeed very likely from many other readers who prefer digital books over paper books.

I would advise that you make the digital copy of the book available as soon as possible—I am an interested buyer as well.

richardofyork··on Plenty Of Zip Codes For Form Auto-Completion
Thanks, Mate.
richardofyork··on How I got a YC interview as a single founder and blew it at the final hurdle
First, thank you very much for detailing your Y Combinator experience with the rest of us; you will no doubt help out many other startups planning to apply to Y Combinator.

During the entire interview, I imagine PG and his partners were likely analyzing and processing your idea, your capacity to execute your idea, and your potential to succeed compared with the potential for other top-tiered candidates to succeed. Also, they were likely looking for signs, any sign (based on prior failures), that were predictor of failure.

In my opinion, you were likely turned down because either they weren't convinced that you (along with your idea) have the potential to succeed more than the candidates they were considering, or your case showed signs of potential failure. Note that the signs of potential failure is not necessarily reflective of you or your idea, it is simply based on actual factors that Y Combinators have seen in startups that had eventually failed. I have read about this from PG himself right here on HN.

If Y Combinator turned down a potentially primed-to-succeed applicant because the applicant did not convincingly answer one question (while being very convincing on all the other questions), then I am definitely mistaken about all I have read about PG and Y Combinator. These chaps are well-reasoned and thoroughly experienced investors, I don't think they will turn down a potential DropBox for missing one question—well, I hope not.

Page 1 of 2Next →