PHP: v8.js - <AUTHOR> http://www.php.net/manual/en/book.v8js.php <comment><USER3> Pretty mingtastic API for a first attempt, it's not safe, and is sure to suck performance wise, since all interaction must involve parsing an expression, and coercing any return value back to a PHP type, and with no way to maintain references to native JS objects.

I wouldn't object so much if only the PHP community weren't already known for their tendency to take a bad situation and make it worse: can't we learn from the history of mysql_query() and friends? Decades of SQL injections! There's no reason they couldn't provide a nice "JsObject" type supporting __call() and __get() to allow integration without resorting to interpolating bits of JavaScript code with (probably originating from a user) data, this way at least web developers would be safer from themselves.

</comment><comment> marcel-oelke We have the use case to render the same mustache [1] templates on the server side (PHP) and on the client side (JS). Problem here is that the template helper view functions have to be written in two languages, PHP and javascript.

Therefore we started two weeks ago to evaluate javascript rendering of mustache templates from inside PHP. First we tried the spidermonkey extension, but had some issues with it. Currently we are using v8js on mac and ubuntu. Works like a charm so far, and we have to write template functions only once.

Now we can use the same mustache templates AND helper functions from within PHP and client side javascript. Even compiled hogan [2] templates work. The templates and javascript files are stored in the PHP APC cache to avoid disk seeks.

So far we are very happy with the results. Here is some php pseudo code how it works with mustache:

pseudo-php-example: \V8Js::registerExtension("mustache", apc_fetch("hogan.js- content")); $v8 = new \V8Js('ContextName', array(), $extensions); $v8->view = array("stuff" => "available in the js template"); $v8->view = array("partialName" => apc_fetch("partialTemplateContent")) $v8->template = "{{stuff}}"

$script .= 'Mustache.render(PHP.template, PHP.view, PHP.partials);'; $renderedTemplate = $v8>executeString($script); echo $renderedTemplate; // prints available in the js template

I recommend checking the v8js samples [3].

[1] <http://mustache.github.com/> [2] <http://twitter.github.com/hogan.js/> [3] <http://svn.php.net/viewvc/pecl/v8js/trunk/samples/>

</comment><comment><USER4> Can anybody give some use cases for this? Would this allow me to use JS libraries (made for node for instance) in my PHP code, or is there something else I could do with this?

<comment><USER5> Using the same validation code client- and server-side would be pretty nice.

</comment></comment><comment><USER6> For a nicer looking wrapper around V8 in a dynamic language, see <http://code.google.com/p/pyv8/> \-- here your class instances become the namespaces accessible to your JS code and objects are nicely converted back and forth.

I experimented with (py) V8 as an engine for executing certain scripts from Python, but found there was a relatively cost to entering the interpreter. I was also missing a way to pass around buffers and not converting everything to unicode strings (maybe if I could wrap the ByteArray type).

</comment><comment><USER7> I tried implementing the CommonJS spec (eg require) using this extension in order to integrate javascript libraries such as coffeescript and uglify directly into my PHP web stack.

For simple examples it worked fine, but trying it on real projects such as coffeescript it kept seg faulting.

It's definitely got potential though..

</comment><comment><USER8> It looks like a PHP extension to embed JavaScript using the V8 engine. The docs are pretty limited. The return value of executing a blob of JS is described thusly: "Returns the last variable instantiated in the Javascript code converted to matching PHP variable type." I supposed the mapping is obvious, to someone :). I'd personally want to know if JS objects come back as stdClass objects or assoc arrays.

It could definitely be handy for a lot of reasons. Seems like it might be handy for embedding a bit of JavaScript testing in your PHP test suite.

<comment><USER9> I imagine the objects would come back as stdClass as this is the behaviour when decoding JSON objects with json_decode(). I assume other type-mappings will match the behaviour of json_decode() too.

I can't think what the result would be if the last variable instantiated in the JavaScript code was a function though; perhaps null, or an exception would be thrown.

</comment></comment><comment><USER10> This is interesting, and I saw the one Example (Hello World) they have on the site.

So I guess my question is, why? What's a real use case example of why'd I want this? PHP isn't syntactically more tragic than JS. JS doesn't have so many more libraries than PHP already has? I can't see why someone would use this? Maybe to hook into GWT librarieS?

<comment><USER11> The only "why" that I've been able to surmise is for people using PHP to scrape/interpret content from existing webpages. But I only make that assumption looking at the itches that Jani (the lead behind the PHP v8js) has been scratching recently: <http://pecl.php.net/~jani/patches/>

</comment></comment><comment><USER12> Unfortunately, there are some bugs with the variable passing. You should be able to pass an array of variables to the V8js object and have access to them under PHP js object. However, the values are currently set to null.

In my experimentation I wanted to see [in php after js execution] all the variables created in the global scope. There are two ways to do it, pass the flag to the V8js constructor to make executeString return associative arrays and add "this;" to the tail of the scripts you execute. Or, append "JSON.stringify(this);" to the tail of the scripts.

The first method will return everything including references to print, var_dump, sleep and exit methods that are bridged from PHP.

The stringify method will give you just the variables without the method references but tends to leave you with empty arrays if all your array indices point to null values. Which is misleading if the result is "someVal: {}", verses "someVal: {'foo': null, 'bar': null}".

What it misses most, is the ability to bridge your own method calls. Would be nice to be able to register a method call in JS that executes a user defined PHP function.

</comment><comment><USER13> That is a great idea, a scripting language riddled with design flaws integrated into a scripting language riddled with major design flaws, gaping security holes, a over-zealous and wrong tokenizer, extra transparent features that will fuck you over where they can, an incompetent maintainer, a terrible API..

</comment><comment><USER14> Great, just as I'm moving away from PHP and diving into Ruby (I've fallen for it's OO charm), they have to release such a wonderful engine. This is amazing though, well done.

</comment><comment><USER15> I have to say: this is incredibly intresting! I woulbe be curious how one can pass-in variables.

I'm afraid you can not get much out of the great features of JS. Event drivenness..

Anyway, this blows my mind!

</comment><comment><USER16> Very interesting. Although, the last release is more than a year old. That does not bode well... <http://pecl.php.net/package/v8js>

</comment><comment><USER17> So what is the usecase of this project?

</comment><comment><USER18> do. not. want. If you think this is anything but the worst idea ever - <USER2> me; you're doing it wrong.

<comment><USER19> Can you elaborate?

<comment><USER18> Let's see. Practically - a web templating language with weakly-typed bolt-on OO 'featurettes' now has an embeddable, weakly-typed, object-oriented scripting language. Hello run-time heisenbugs that can NEVER be unit tested nor debugged.

Anecdotally - let's face it; there is no shortage of crappy php and javascript out there. This is an open invitation to merge the two into one extraordinary megaclusterfark.

<comment><USER19> Yes, but it could still be legitimately useful. Show me a powerful technology and I'll tell you how it can be misused, but that won't invalidate its potential usefulness.

</comment></comment></comment></comment><comment><USER20> one possible use can be executing some JS code even if JS is disabled in browser

<comment><USER21> yes but that would require server to know that which again requires some sort of ajax which cannot happen because js is disabled!

<comment><USER22>

<comment><USER22> apparently I have to spell it out to the downvoter...

...which fulfills the requirement of "executing some JS code even if JS is disabled in browser".

<comment><USER21> yes, that seems correct, also just to make it clear, i can't even down vote yet :P so it wasn't me :)

</comment></comment></comment></comment></comment><comment><USER23> Well that just makes me go WTF.

I genuinely can't think of a way this will be used which will be positive for PHP.

<comment><USER24> In theory, it will have the exact same use as the rubyracer gem (<http://rubygems.org/gems/therubyracer>). Possible uses of that are compiling coffee script using the official compiler or running the same form validation code on both the client- and the server side.

In general I'd be cautious about both the ruby racer and this as you are practically embedding a garbage-collected heap into another garbage collected heap, exchanging references between them (more so for the ruby racer - the PHP extension here is way less integrated).

This is memory errors waiting to happen.

<comment><USER4> "or running the same form validation code on both the client- and the server side."

That sounds great until you realize that you usually do a lot more validation on the server than on the client (is the username taken, is password correct, etc etc). So you would still have to use PHP for validation (in most cases).

<comment><USER25> Sure, but only for the cases not covered by the JS.

<comment><USER4> I was trying to say that you don't really gain anything in this case. You would load some JS file (which would probably have to be written in a way that it could be used this way) just do do some simple validation (if (someField!='') for instance). Doesn't seem like worth the bother to me.

</comment></comment></comment></comment></comment><comment><USER26> Yo dawg, I heard you like javascript.

</comment><comment><USER27> I have been doing a lot of work with PHP recently, and reading through their library docs, it seems to me like they will put _anything_ in a core extension, regardless of whether it's something that really belongs there.

<comment><USER28> > I have been doing a lot of work with PHP recently

If you've been doing a lot of work in PHP recently, then you should be compiling your own PHP. Which gives you the option of disabling every extension. The PHP core is actually very lean. Virtually everything is an extension. They even have a nifty flag to disable everything.

I like having the option of compiling a bazillion extensions in the binary if I want to. Even though I never enable anything beyond the basic stuff I need.

<comment><USER29> Stuff like this with PHP just reminds me how nice the module loading systems other languages use to handle this sort of thing.*

PHP - forgot something? Best re-compile so I can access the module's massive list of global functions.

Python, Ruby, Node, etc. - `import/include/require module`

* because Pear is basically a waste of time.

<comment><USER28> What?

Have you tried to install something using pip for Python? How about npm for Node?

Those package management programs _compile_ stuff on your system all the time. Same as PECL extensions.

The ecosystem for Python, Ruby, Node works _exactly_ the same as it does for PHP. Please leave your random PHP hatred at the door.</comment></comment></comment></comment>


Secrets of the "Clear" airport security line | Brad Ideas - <AUTHOR> http://ideas.4brad.com/secrets-clear-airport-security-line <comment><AUTHOR> I thought this added some interesting (if true) details about the business and politics behind "Clear". Arguably these entanglements strangled it as a business.</comment>


Google's Pichai: "New competitors emerge every day" - <AUTHOR> https://www.searchenginejournal.com/google-ceo-testimony/376060/ <comment><USER2> "... which we dutifully crush, as is tradition."</comment>


Learning to write a compiler - <AUTHOR> http://stackoverflow.com/questions/1669/learning-to-write-a-compiler <comment><USER2> Here is an earlier incarnation of the "writing a compiler" thread:

<http://news.ycombinator.com/item?id=1608129>

<comment><USER3> Oops, I downvoted you when I meant to upvote. There is probably another incarnation or three before the one you linked, too.

I'd recommend Appel's "Modern Compiler Implementation in ML" over the dragon book.

<comment><USER4> I noticed there are a few versions, including for Java and C. Any reason why the ML version is better (not against ML; just don't know it well enough (at all actually)).

<comment><USER3> A very large part of compiler operations involve analyzing and transforming tree/graph data structures (once you've parsed to an AST), so you want a language with good native support for those structures. Pattern matching and garbage collection help immensely, as do ML's inferred static types. Working with complex data structures is really where ML shines.

It's not just ML, though - using a language where you can work directly with native tree structures (ML and Haskell's type constructors, Lisp sexps, Prolog functors, Lua tables, or even JSON) means that you can postpone learning syntax/parsing and _start_ with the language's semantics. You can save the syntax details for when you have the language design worked out. Compiler books based on C (such as the dragon book) spend such a long time on parsing upfront because they don't have much choice.

Also, Andrew Appel works on SML/NJ, and the C and Java books are translated from the ML version. I've looked at the C version (which uses lex and yacc instead of ml-lex and ml-yacc, mallocs but doesn't free until later in the book, etc.), and while it's still a good compiler overview book, I'd strongly suggest getting the ML version instead. The ML version uses Standard ML (SML), but I've only used OCaml and didn't have trouble following it and making the minor adaptations along the way. (I haven't looked at the Java version. Whatever.)

</comment></comment></comment></comment><comment><USER5> I'm upvoting this just to hopefully start a discussion and hear more about this topic from fellow HNers.

I hear the Dragon Book mentioned almost daily around here; I'm intrigued. Do you think this book could be read by someone who's not actually interested in writing a compiler? Does the book stand by itself? I'm interested in reading it, but I don't really think I have the motivation to start writing my own compiler (even a mock one).

<comment><USER6> DO NOT READ THE DRAGON BOOK.

It's not a very good introduction to compilers. Read Engineering a Compiler by Cooper and Torczon. The Appel book is also very good, and contains some stuff about functional and logic languages that are generally missing from most compiler texts. If you're an enthusiast, but not in it to build a compiler, I really enjoy Programming Language Pragmatics. For more advanced material, use the Muchnick book, or the Compiler Design Handbook (both editions have different materials). They also provide excellent pointers to literature, but aren't great for beginners.

I get the impression that most people who recommend the Dragon book haven't read it. When I was doing my PhD I had five or six books on my shelf, and was constantly unimpressed with the Dragon Book, but always impressed with Cooper/Torczon, Muchnick and Appel.

<comment><USER7> >I get the impression that most people who recommend the Dragon book haven't read it.

These days you can usually tell that they haven't read it if they refer to it as "the Dragon book" and don't say anything about the edition. The same thing goes for "Knuth", "the Appel book", etc.

</comment></comment></comment><comment><USER8> The interesting thing about compiler writing is the drastic reduction in complexity that's happened. There are essentially off-the-shelf tools that can be used to handle everything before semantic analysis and everything after conversion to a reasonably high-level IR. This has dramatically reduced the cost of language experimentation; it's now feasible to bang out a new language in a day or two (assuming you're familiar with yacc, LLVM, etc.), and generate efficient code on a number of target architectures.

These tools mean that "learning to write a compiler" can take several different paths; on the one hand, we could learn about how each of these tools work (e.g. "how to write a parser generator", "machine-independent optimizations", "code generation", etc.). This is the approach taken by the dragon book. This gives the background theory and mathematics behind compiler- writing (and will likely be something people need to know if they want to write for instance an LLVM optimization pass). The problem with this is that, because of the trends mentioned above, it has little to do with the day-to-day of actual compiler writing and language experimentation (this is only somewhat true, since most "real" compilers will have a custom-written frontend and at least a little bit of knowledge about the target architecture).

The other approach is to use pre-written tools, to focus on language design decisions and applications. To be honest I'm not familiar with any resources that do this particularly well. This is the approach taken by most of the "we're going to build a compiler!" websites mentioned on the Stack Overflow post. This approach is probably more useful for most of the people who want to "write a compiler", but it leaves people with a very shallow knowledge of what's happening beneath the surface of the APIs they use.

I don't mean to imply that one of these approaches is "better" than the other (and indeed, the second requires a little bit of the first - it's difficult to debug an automatically generated parser without knowing at least a little bit of the theory), but it's important to know which approach you're aiming for, and trying to optimize based on that goal. Going to the Dragon book as a "how- to" is a disaster waiting to happen.

<comment><USER9> I think that combining this short compiler tutorial with LLVM would be a very effective way for someone to get comfortable with basic compiler writing:

<http://scheme2006.cs.uchicago.edu/11-ghuloum.pdf>

Afterward, learning how to do lexing and parsing would be a good addition. The tutorial covers a subset of scheme, which is trivially simple to parse, especially if you're writing the compiler in scheme as well.

</comment></comment><comment><USER10> The top comment has a remarkably good list of references. I like the nanopass and incremental papers a lot, RTT is a classic, and there were several good- looking references I had never seen. Almost makes me feel some jealousy at the pleasant vertigo the original poster must feel :)</comment>


Reflections on the State of AI: 2018 - <AUTHOR> https://evolutionone.ai/blog/2019/2/9/reflections-on-the-state-of-ai-2018 <comment><USER2> Some points : duplex... the verge article linked ([https://www.theverge.com/2018/12/5/18123785/google-duplex- ho...](https://www.theverge.com/2018/12/5/18123785/google-duplex-how-to-use- reservations)) is very interesting about the constraints on the roll out and also the work that is required to get duplex to do what you want it to do; including covering off contingencies (like unavailability) _that may not arise_. This means it's actually _more work_ to get duplex to do an average reservation than it is to do it yourself.

Also it's evil (disinter-mediating people preventing human contact, gathering more data, closing options, preventing plurality of opportunity), but never mind ehh?

Second point; they aren't "self driving cars" they are _not driving_ driving is a human thing that requires agency that no AI has at the moment. Autonomous vehicles are environmentally responsive guided robots or something like that. This confusion is important because many people see something that is "self driving" and impute many characteristics and capabilities to "it" that "it" just doesn't have; and this colours their expectations about what it can and can't do and what autonomy and responsibilities to ceed and delegate to that thing.

Most perniciously both Duplex and Autonomous Vehicles are parts of systems, they are not "your assistant" they are an interface to a collection of machines and people who's function is not to help you, but instead is there to enrich someone else and constrain your ability to choose and act as you would if you didn't interact with them.

Stalin would have loved this - the citizens go where they are taken, they can't even think of an alternative. They choose the food we say they can. The pictures that they take a manipulated and managed by us.

At any time your photos of your friend who's no longer in favour might morph over night to be landscapes only, or to contain just the friends who remained loyal to the party/government, you might wonder what's happened, but how will you know?

<comment><USER3> environmentally responsive guided objects, ERGO

It's always possible to imagine bad and worse scenarios. Fear is always available, and can be applied to any situation. Believing that technology is the tool of an "evil" system, or that it facilitates "evil" is not healthy for the believer or anyone else.

Naturally, we are all aware of the power of tools and especially modern "smart" systems. How can we trust anything? We can imagine how things could be as bad as we can imagine! I've decided, even at the risk of being naive, that I must not fear the machine, fear the network, fear anything. We living beings all basically want the same outcome- happiness. Having convenient tools help us actualize that outcome is a good thing. Just because we can imagine some deep dark conspiracy of "evil", behind the scenes, deceiving and manipulating us, doesn't mean that there is any such thing. Nor, of course, that there isn't. Since we can't know, let's just enjoy all of our cool gadgets while being happy...

Although, I'm also beginning to feel as though the best decision will be exiting the information super-highway :)

If y'all haven't read it, The Joy Makers is a pretty fun sci-fi exploration of technological routes to happiness, and possible downsides to "plugging in".

<comment><USER2> I'm of the view that Google, Facebook (et-al), many governments and assorted other groups are not evil, not deliberately in any organized way at any rate. But, the mechanisms that are being developed have huge potential for very insidious application, and it's important that we get ahead of this as soon as we can.

</comment></comment></comment><comment><USER4> It's really depressing that a lot of machine learning tasks can now be performed without much programming knowledge and even less knowledge about machine learning...

<comment><USER5> Replace "depressing" by "dangerous in the case of certain applications" and we can agree: [https://en.wikipedia.org/wiki/Weapons_of_Math_Destruction](https://en.wikipedia.org/wiki/Weapons_of_Math_Destruction)</comment></comment>


State Borders Were Drawn in the Distant Past. Time to Reimagine the Map? (2014) - <AUTHOR> http://www.slate.com/articles/arts/culturebox/2014/10/if_every_u_s_state_had_the_same_population_what_would_the_map_of_america.html <comment><USER3> [https://en.wikipedia.org/wiki/Territorial_evolution_of_the_U...](https://en.wikipedia.org/wiki/Territorial_evolution_of_the_United_States)

January was "the distant past"? Granted, that modified state line affected 19 properties, but it's not trivial _to them_.

<comment><USER4> Right? I'd have to check but I might be older than one State. Distant past? To whom?

There's quite a bit of neat history and a silly series called How The Stats Got Their Shapes is worth watching. It was on the History Channel, about a decade ago.

<comment><USER5> The transfer of a few acres of land does not a state shape make - sellers of state-shaped fridge magnets don't have to go get their stock remade as a result. The last significant transfer of land in the mainland US was michigan and wisconsin's quarrel almost a century ago.

Saying that state shapes are still in flux because 19 properties were shifted from state X to state Y earlier this year is a bit like saying you've got a new computer because you replaced your mouse.

<comment><USER4> You base your State shapes on magnets and not cartographers?

Ah well, at least the map makers got some work to do. There's also a number of other examples besides what they mentioned. It's a nice documentary series, of you're interested.

<comment><USER5> > _You base your State shapes on magnets and not cartographers?_

You can see the transfer of a few square miles on a continent-scale map like the ones in the article?

The North/South Carolina border change represents about 700 sq miles changed over. The smallest state in the US is Rhode Island, with 1.2M sq miles - <USER2> orders of magnitude more. South and North Carolina are 30M and 50M sq miles respectively - five orders of magnitude more than this parcel of land.

Do you think that miniscule _corrections_ every few decades are really enough to counter the author's claim that the state shapes were 'drawn in the distant past'? Seems excessively pedantic to me - especially since the shapes involved didn't change all that much.

<comment><USER4> Yes, yes I do. Not to mention I'm older than the most recent State. So, yeah, I think distant past is quite an exaggeration. You're not required to agree, of course.

<comment><USER5> Hawaii has no state borders, drawn now or in the past, so I'm not sure why that's relevant here, given we're talking about the article's byline. Alaska also has no state borders, though it does have national borders.

In any case, if you were born several generations ago and still don't consider your childhood to be in the distant past, remind me not to get on your bad side :)

<comment><USER4> Oh, it's all good. My lawn has plenty of room. You're more than welcome on it.

But, less than sixty years hadly seems like the distant past. However, that's mostly an addendum. You may not have clicked the Wikipedia link but, if you do, you'll see quite a few changes.

It turns out that I'm older than the State of Alaska and Hawaii. I'm am pretty old, but, damn it! That's not the distant past. Dinosaurs roamed in the distant past. I am not a dinosaur. Well, I'm not a fossil.

Edit: By the way, not all of the Hawaii territory is part of the State of Hawaii. And some islands are changing their borders all the time.

</comment></comment></comment></comment></comment></comment></comment></comment><comment><USER6> Or just direct representation? Why am I represented by someone the majority of my neighbors elect instead of who I choose?

<comment><USER7> A congress consisting of half the population might be a little too large to work well.

<comment><USER8> I think how it works is that you take the top N.

<comment><USER9> I still believe that Legislative Duty should be compulsory, like Jury Duty. 538 citizens, selected randomly per state in the same ratios as today's house and Senate. Tele-commute, and make/update laws for the good of all with minimal direct outside influence.

I'm not sure how long a session would last, but it sure would be interesting.

<comment><USER10> 3rd house of Congress?

My persona; hope is that they just double or triple the number of senators and representatives to allow greater specialization.

<comment><USER9> No, _instead_ of both current houses.

</comment></comment></comment></comment></comment></comment><comment><USER11> Powell's watershed map lays out administration zones based on the major flows of water.

[http://www.npr.org/programs/atc/features/2003/aug/water/part...](http://www.npr.org/programs/atc/features/2003/aug/water/part1.html)

It gets my vote, watersheds are the strongest constant we have next to continents. Technology, language, rivers, and coastlines all shift.

</comment><comment><USER12> I'm much more on board with equal area boundaries than equal population.

<comment><USER13> Why? Acres don't vote. People do. Dividing by area will just keep "one person, one vote" from being true, as long as we assign two senators (and thus two extra electors) per state. What's the benefit, other than giving each rural voter more power than each urban one?

<comment><USER12> To me your view of "one person, one vote" sounds more like a new kind of colonialism - a way of making it so that the concerns of less population-dense areas are ignored and population-dense areas basically exert hegemony over them. Even if not a single person lived in Alaska it would deserve representation. Likewise, if just native tribes lived in Alaska it would not be appropriate for everything in the whole area be dictated by non-natives somewhere else just because more people lived there.

While I view our current situation and system as imperfect, I do think one of its redeeming characteristics is the attempt (not really successful) to create a system that can both protect from the tyranny of the majority and the tyranny of locality.

Equal population redefinition seems likely to merely exacerbate urban/rural tensions and vast geographic differences and create more conflicts.

On the other hand, equal area represents a cleaning up of our current system - Senators would now clearly represent something: land/area, apportioned equally, as a more appropriate check on a hypothetical population-only apportionment of a house of Reps, which should have its size uncapped so as to have the proper granularity for purely population based representation.

<comment><USER13> > concerns of less population-dense areas are ignored

As I said, areas don't vote. People do. Why should ten people living on a hundred acres get more representation than ten people living on one? Painting "one person one vote" as colonialist is flat-out dishonest. It's the alternative that's discriminatory, treating some people as more deserving than others because they own more land.

</comment></comment></comment></comment><comment><USER14> [https://medium.com/organizer-sandbox/liquid-democracy- true-d...](https://medium.com/organizer-sandbox/liquid-democracy-true- democracy-for-the-21st-century-7c66f5e53b6f)

</comment><comment><USER15> Never understood cities split by two states. Born and bred in one. Being on one side of the state or the other tends to complicate simple things. At least they're not independently operating countries, I guess.

</comment><comment><USER16> Relevant xkcd: [https://xkcd.com/1902/](https://xkcd.com/1902/)

</comment><comment><USER17> Please can someone add (2014) to the title?

<comment><USER18> Ah yes. Thanks!</comment></comment>


Make with Ada: Redux - <AUTHOR> https://nocko.se/blog/make-with-ada-redux/ <comment><USER2> Heh, I didn't understand the title at first and thought it had something to do with an implementation of the JS redux library in Ada.

Anyway, it's a cool write up. I wish Ada came up more on HN. It's one of those languages that, like the author, I only know of as one that's "built for reliability, mainly used in defense applications".

If it's fast and safe, why doesn't it get the attention that, say, rust does?

<comment><USER3> It's before my time, so YMMV, but it seems that the 90s-era "HN crowd" took something of a "shoot-the-messenger" approach to Ada, assuming it must be a terrible language because it was created by the Department of Defense. Not unlike how anything associated with Microsoft used to be treated until pretty recently.

Complaining-about-languages-you-don't-use was an even bigger phenomenon in the era when the internet/open-source was not widespread, and trying out a new language was often far from a trivial thing to do.

It's always a bit amusing to read an old article from the 90s or early 00s, filled with unironic praise for langs now considered poor-to-mediocre, like C, Perl and PHP. (Because these were the languages that didn't take a great deal of effort/money to start writing in the first place).

<comment> david-given I did a bunch of stuff with Ada, and like it a great deal; the core language is rock solid, fast, expressive, and extremely easy to work with. But I still have a laundry list of issues, and probably would pick something else for future projects. (My current one is in C. C89. Because reasons. Sigh.)

The three biggest turnoffs for me with Ada are:

\- case insensitive identifiers. I understand why they chose that, but history has shown that that's not what programmers want, as evidenced by ever other mainstream programming language ever. Also, there's nothing more likely to repel a new developer than forcing them to switch to a new coding style. (It's also weirdly unAdalike; surely a language which puts such an emphasis on correctness and precision wants things that look different to _be_ different?)

\- no garbage collector. As soon as you spend any time with the language it becomes obvious that one's been planned right from the very beginning --- it would drop right in. It just hasn't been _implemented_.

\- deeply inscrutable object oriented syntax. I've used it several times and I _still_ have to look it up, every single time, and even so I keep getting it wrong. There are several hidden gotchas --- it only works properly if your class is defined in a named package and all your method declarations need to be next to each other. I think. It's all totally unmemorable and desperately needs a 'class' keyword.

There's some other stuff which would be nice to have, like better strings, or the ability to have pre- and post-conditions on procedure definitions and not just declarations, but for me those are the three big ones.

I might try Nim next, as that looks nice, and appears to have a number of features borrowed from Ada.

<comment><USER4> \- case insensitivity

I'm not sure it was clear in 1983 that programmers preferred one way or the other. Most languages were case sensitive because it was easier to write the compiler that way and I think programmers "prefer" it now because it's what they are used to. Personally I find the different syntax and conventions as one of the fun things about learning different languages

\- no GC

This is a consequence of the level of abstraction Ada is operating at. Actually I think it's one of Ada's greatest strengths because Ada does a really amazingly good job of implementing the pattern C++ programmers call "RIAA". Ada calls it Controlled Types and it puts the power to manage memory in the hands of the programmer without making it unsafe or prone to bugs. RIAA is implemented so messily in C++ and explained so poorly in the community that I've spoken with C++ programmers who agree that the best way to learn to write good C++ is to learn Ada.

\- OO Syntax

Yeah I agree with your assessment. I think the problem was that Ichbach wanted to make an OO language originally but felt that some OO features (inheritance, dispatching) weren't appropriate in a high-integrity language in 1983. So he ended up making a language that was 80% OO. Then in 1995 it was clear that the language was worse for not having those features so they were shoehorned in.

<comment><USER5> *RAII. And C++ does just fine.

</comment></comment></comment></comment></comment><comment><USER6> I really regret not getting my act together and working on my entry for the Make With Ada contest - the language really appeals to me. One day...

</comment><comment><USER7> I hope someone creates React/Redux with Ada and posts it under the same title.</comment>


An Atlas of Upward Mobility Shows Paths Out of Poverty - <AUTHOR> http://www.nytimes.com/2015/05/04/upshot/an-atlas-of-upward-mobility-shows-paths-out-of-poverty.html?partner=rss&emc=rss&abt=0002&abg=0 <comment><USER2> The article often mentions school disctricts and their effect on house pricing. I've heard the same thing time and again from relatives in Palo Alto.

It's awkward for me to see how the US restricts free choice between public schools. In this part of western Europe, except for queueing on enrollment and capped numbers, you just go to the school your parents decide to put enroll you at.

If understand correctly, the public school monopolies in the US are because mostly local taxation and much less higher level (state or federal) taxation funds local schools.

It might be interesting to see an experiment where kids from let's say East Palo Alto can go to schook in Palo Alto if their parents want so....

<comment><USER3> You can't understand America, especially any topic having to do with housing or schooling, without understanding our deep-seated racial conflicts. Pull up a public school profile in any U.S. city that has a large black or hispanic population. Odds are that on the first page, it'll tell you exactly what the racial mix of the school is (so parents can quickly figure out where not to send their kids).

Washington, D.C. [http://profiles.dcps.dc.gov/Ballou+High+School](http://profiles.dcps.dc.gov/Ballou+High+School) (bottom right)

Chicago: [http://www.cps.edu/Schools/Pages/school.aspx?SchoolID=610268](http://www.cps.edu/Schools/Pages/school.aspx?SchoolID=610268)

Baltimore: [http://www.baltimorecityschools.org/cms/lib/MD01001351/Centr...](http://www.baltimorecityschools.org/cms/lib/MD01001351/Centricity/domain/8783/schoolprofiles/085-FortWorthington- Profile.pdf) (race statistics on page 1, test scores on page 3).

Philadelphia: [https://webapps.philasd.org/school_profile/view/1200](https://webapps.philasd.org/school_profile/view/1200) (second item after "enrollment").

School choice means the prospect of black and hispanic families sending their kids to primarily white schools, and that is a non-starter in even the most liberal communities. San Francisco used to have a very progressive policy of assigning schools at random so that wealthy people couldn't congregate in one neighborhood and send their kids to the local school. Even that city had to dismantle that policy a couple of years ago.

<comment><USER4> There's a difference between demographic info being available for a school and it being on the front page of the school's site. Before clicking through your Chicago link, I tried to find a CPS school site that made demos easy to find, and came up empty. You've hotlinked to the fact sheet for a specific school to make your point, which isn't entirely fair.

I live in Oak Park, and my kids go to OPRF, which is 53/37 white/(latino|african-american). Minorities are (thankfully) overrepresented in the school. Oak Park (a/k/a/ "The People's Republic Of Oak Park") isn't conservative, and the (tiny) village is a haven for well-off white families who want to live close to the city without sending their kids to CPS schools. Lower-income families rent apartments along Austin Ave, or Section 8 houses on blocks like mine, and manage to get their kids into Oak Park schools without too much trouble.

</comment></comment></comment><comment><USER5> I'm curious how things change when moving becomes a routine; i.e.: moving 5+ times whilst growing up—to the point where it becomes an expectation of the child. This was the case for me, and I notice I grew up with a much different perspective on life than those who were raised in one city or those who were transplanted just once.

<comment><USER6> Talk to any military brat. I was in 11 schools by 10th grade so I learned a whole different set of lessons from the vast majority of my "civilian" peers.

</comment></comment><comment><USER7> One thing I could not quite understand, is why people stay in poor area with little to no opportunities?

Some people may want to stay close to family and friends, especially when they need their support. That is understandable, but then it's their own choice, and they are probably content about it.

For those who are unhappy about their situations, why don't they just move?

<comment><USER8> Feel free to go into the site and search for "Northampton County, Virginia". The site points out that it's one of the worst counties in the country to be either poor or middle income. I spent a big chunk of my childhood there, and attended the horrific public schools there.

I was one of the very lucky ones, and I'm now living in an affluent suburban community, watching my son attend the kinds of schools that I'm assuming you got to attend. (I'm assuming this by your comment, which shows someone who almost certainly doesn't have a deep understanding of poverty or areas with high poverty.)

Notice that the site has a median rent listed for this county of a little over $300. Think about that: You are somebody who lives in a place with a $300 rent, which means that a given landlord, when presented with the income of the area's renters, can only fill a unit if they charge $300 a month. Yes, everyone is that poor. Work is few and far between, incomes are very low, and savings are non-existent. How can you save when you can barely get by?

So without savings, how do you finance a move to a place? How do you pay a security deposit that is, by itself, triple your current rent, plus the first month's rent, assuming you landed a job in this richer area?

The education offered sucks, period. I went to college on a scholarship, and I was completely unprepared for my classes compared to the other students. I had to work over 30 hours a week while in engineering school to pay my rent/food/books/etc, which put me at a disadvantage compared to my peers. On top of that, I didn't have the knowledge base my peers had. When I graduated high school in 1999, my school only had 4 computers with internet connections for a student body of roughly 900. This is typical of poor, rural schools. How could I have learned to program like my peers from the DC suburbs?

Your characterization that these people have made a choice to not move suggests that they ever had a choice to begin with. Most of them don't, and your comment, to people like me who had to claw ourselves out of the trap, smacks of self-righteousness and contempt.

<comment><USER7> I grow up in a poor family in China, I know what's it's like to only eat cheap food, or choose to walk instead of bus to save money. I'm not going to make comparison though, as being poor in China is probably very different from being poor in America.

I've also met a fare share of poor people here in Canada. And most of them choose to be so, by choosing work in arts and music, spending money on parties and drinks, or not follow the worker bee lifestyle and work as little as possible. I don't look down upon them, as they seem to enjoy their chosen lifestyles. Although I have a feeling that the poor you are talking about might be different from what I see.

I've also met many poor immigrants who are not as fortunate as I am, working as taxi drivers, manual labours and/or minimum wage jobs. But most of them don't seem to be seriously stuck, as in that they could afford to move to a different city if there is no job locally.

So I'm sorry that my question smacks contempt, which is half-true (for people who don't work hard and blame others for their misfortunes). But I am also ignorant about what it's like to be poor in America. Is it really that much worse than Canada?

<comment><USER8> For the poor, the United States is a far, far worse place to live than Canada.

Canada has a comparatively large welfare state, and far better public schools. In the United States, public schools receive the majority of their funding from the local town/county taxes. This means that a poor person who lives in a poor area will attend a bad school.

I could go on, but take a look at the data. On basically any metric, the US is a much worse place to be poor than Canada.

<comment><USER9> > In the United States, public schools receive the majority of their funding > from the local town/county taxes. This means that a poor person who lives in > a poor area will attend a bad school.

The conclusion is true, but the reason given is not true in many parts of the United States: e.g., California (and I don't think California is the only state with similar rules) requires equal per-pupil public spending statewide, so difference in local tax bases within the state do not affect spending (but schools in poor areas have unique challenges that increase costs, and often get less additional support from outside sources to supplement their equalized funding, so they still end up disadvantaged.)

</comment></comment></comment></comment></comment><comment><USER10> Looking at some semi-rural areas where I have family and there isn't much opportunity this looks like it is strongly correlated with whiteness, which makes me wonder how much of this is a matter of minorities having less economic mobility.

</comment><comment><USER11>
        They have elementary schools with higher test scores, a higher share of two-
        parent families, greater levels of involvement in civic and religious groups
        and more residential integration of affluent, middle-class and poor families.

While income inequality may appear influenced by race, it's empirically shown to be cultural, predicated on whether individuals believe they have control over their lives and are responsible for their actions. Culture often masquerades as race, but is easy to distinguish: Are members of the same race who grew up with a different set of values as successful as members of other races with those same values?

The acts of those in Baltimore may feel justified, but they are only feeding the culture that contributes to their lack of upward mobility.

</comment><comment><USER12> Austin is considered one of the worst neighborhoods to raise kids? That doesn't seem right. It is one of the most affluent cities in Texas.

<comment><USER13> The article's interactive map has a misleading caption: "The Best and Worst Places to Grow Up ..." The map is based on the upward mobility of children from poor families, not all children.

The article's map doesn't have enough resolution to separate Austin from the surrounding areas well. Although downtown Austin is in Travis county, the county is over 1000 square miles in size. The top rated Austin school district is very very good and is only 31 square miles out of the 1000. Furthermore, the Austin area includes Williamson county too and there are several additional good school districts with schools in Williamson county as well. Westlake High School, located in the Austin area, is ranked by Newsweek at 117 among all public high schools nationally and an admission based magnet school in the Austin Independent School District is number 8 in the same ranking.</comment></comment>


Why Elon Musk's brain is different to yours - <AUTHOR> https://www.smh.com.au/business/companies/why-elon-musk-s-brain-is-different-to-yours-20180911-p502y2.html <comment><USER2> id argue that musk and likely tesla were autistic</comment>


Show HN: Community of Engineers, Scientists, Innovators Thinkers and Visionaries - <AUTHOR> https://www.guaana.com/#07h04n <comment><AUTHOR> Hi Everyone,

We are building Guaana to accelerate scientific collaboration. A hub to scale up creative conversation, to connect and build meaningful partnerships. A place that speeds up the problem-solving process, and expands the range of problems that can be solved by the human mind.

Our opening collection have several projects related to AI and Big Data, so it would be great to know if you find something interesting for yourself.</comment>


Economics Forum - <AUTHOR> http://economics.slinkset.com/ <comment><USER2> If you're looking for an economics forum, check out Freakonomics. The discussion there is pretty intelligent. <http://freakonomics.blogs.nytimes.com/>

</comment><comment><USER3> Maybe _new, yet unused_ forum would be more appropriate.</comment>


Schools everywhere are breaking Google's TOS - <AUTHOR>

Every school that allows under 13s to make Google searches breaks Google's terms of service
Here are Google's TOS which I assume apply to search:
https://www.google.com/accounts/TOS
TLDR; You may not use the Services and may not accept the Terms if (a) you are not of legal age to form a binding contract with Google <comment><USER2> As far as I see, this only applies to registered users, as it talks about accounts and whatnot. You don't need that for ye' olde search.

<comment><AUTHOR> First line,

> Your use of Google's products, software, services and web sites (referred to > collectively as the "Services" in this document...

Search is a service. I can't find any TOS that are more specific to search.

</comment></comment><comment><USER3> Clickable: <https://www.google.com/accounts/TOS></comment>


Here's the map of the world, if size were determined by market cap (2015) - <AUTHOR> https://www.marketwatch.com/story/heres-the-map-of-the-world-if-size-was-determined-by-market-cap-2015-08-12 <comment><USER2> World maps without NZ are such a common occurrence that I cannot be sure if NZ was left off of this map deliberately or was just forgotten.</comment>


It's been two months since I canceled by data plan - <AUTHOR> http://www.gregtracy.com/its-been-two-months-since-i-canceled-by-data

<comment><USER2> Doesn't utilizing Google Calender API over SMS conflict with the spirit of canceling the data plan? It feels like hacking around a self imposed problem.

<comment><USER3> It lets me check my calendar in the morning. An important use case, but not something that would generate habit throughout the day.

</comment></comment><comment><USER4> The biggest reason I would probably not be able to go through with this is that I'm pretty sure Verizon (maybe most carriers?) will not let you use a smart phone without the data plan. I just don't think I can go back to one of those horrid "feature phones" for basic cell phone things like calls and texting.

<comment><USER5> Sounds like a great excuse to find a less abusive carrier.

<comment><USER4> Heh, I can't argue with that.

</comment></comment></comment><comment><USER6> Sometimes I feel like some sort of leper amongst the tech crowd because not only do I not have a smartphone, but I haven't even had a functioning cell phone for over a year now.

There have been times when a bare-bones cell would have been useful, but most of the time I just work without it. Business communication is over Skype or email. Thing is, I spend so much time on my laptop doing computery stuff that the last thing I want is to have yet another fully-fledged computer in my pocket to nag me all the time. I find the lack of cell phone to be freeing in a way.

The downside is that I have to turn down lots of mobile-based work :)

</comment><comment><USER7> I turn notifications off excepts for texts and calls from my friends. Otherwise, my cell phone is a push-only device. Who cares if someone mentioned me on Twitter? Who cares if I have an appointment? Who cares if some bank wants to sell me some bullshit product? Not me, so I opt out. I just want to use Google Maps and read my RSS feeds on the train.

</comment><comment><USER8> I'm waiting for the time when carriers realize that everything should be a data plan. Voice is just bits and bytes anyway, so why not roll up the voice minutes into the data plan?

<comment><USER9> Carriers realize this. They also realize they get more money from the current setup as we transition from generations that are used to paying for voice to a more digitally minded consumer base.

The ipad plan is a pretty good data only no contract plan. My wife lost her phone so I gave her my iphone and bought a 3g ipad2 and used a cheap prepaid phone while I waited for 4S/5. That ran about $40 a month instead of the $80+/month you get with a smartphone contract.</comment></comment>


What Facebook Did to American Democracy - <AUTHOR> https://www.theatlantic.com/technology/archive/2017/10/what-facebook-did/542502/?single_page=true <comment><USER2> For how long will Americans blame FB for the rise of Trump? One he is democratically elected and two Americans have voted for him. Now dont argue about vote share, it does not matter as far as the way American electoral system works, its like talking about possession share in soccer when the winner is decided based on goals scored. The whole thing about Russia, the fact is the ground conditions & discontent amongst large population of Americans existed, it may have been fanned by Russia but it could have been simply done by any political party using ads, there is nothing ground breaking about it except the use of Russian money perhaps, most of it is marketing. Instead of acknowledging & working towards a more united society, (the U in USA), most media is just fanning further divisions by trying to sensationalize & scandalize every single thing. If so many of your fellow countrymen feel disenchanted enough to vote for a reality tv star, then the society needs deeper introspection. Coming to interference in election, America has done this & destroyed many countries, there is nothing scandalous if it is happening to USA. This is just another tactic employed by countries to get some benefits for themselves. IT might be morally incorrect, but just because it has probably happened to US does not make it something to scream about especially when US has done this probably the most.

[https://en.wikipedia.org/wiki/Foreign_electoral_intervention](https://en.wikipedia.org/wiki/Foreign_electoral_intervention)

<comment><USER3> For a democracy to give good results, voters need to work from good information.

Even in the absence of intentional manipulation, Facebook is hyper-efficient at spreading bad information.

Now America's adversaries have weaponized this, and are actively pushing sophisticated and targeted disinformation through Facebook.

Zuckerberg's malign naïveté allowed this to get bigger, faster than he could manage. It's a monster that he doesn't know how to control.

Until Americans understand how thoroughly they've been fucked, and until Facebook reckons with their outsized role in this, it's really important to keep beating this drum.

Zuckerberg himself is only gradually coming to terms with it.

Here's his "preposterous defence" eviscerated -> [https://www.nytimes.com/2017/09/29/opinion/mark- zuckerberg-f...](https://www.nytimes.com/2017/09/29/opinion/mark-zuckerberg- facebook.html)

<comment><USER4> People don't vote based on facts. They vote based on identity and feelings. Democracy for Realists has an explanation at length.

</comment></comment></comment><comment><USER5> At the end of the day, individual citizens decided to show up at the polls and vote for candidates. The premise of this article seems to imply that sometimes when that happens, it's not fair. In particular, citizens are too ignorant or easily manipulated to be trusted to choose their own leaders.

A core tenet of democracy is that the voters are capable of governing themselves. Or at least the popular vote is better than other alternatives.

> The informational underpinnings of democracy have eroded, and no one has > explained precisely how.

I'd argue that the desire to make sure that the education and motivation of the populace is properly supervised is more dangerous to democracy than a giant pile of pizzagate spam.

<comment><USER6> You state this as an absolute, but taken to it's conclusion it seems to be arguing that no one should attempt to influence the vote of anyone else.

I see nothing undemocratic about examining the ways in which voters receive information and attempting to address deficiencies.

Controversial statement: It's better for voters to believe true things than to believe false things.

<comment><USER5> I'm arguing against the government doing things to make sure voters vote the "right" way. Reductio ad absurdum, my argument would turn into this: voters are always right. But that's simple enough to refute. Pick some examples of democratically elected leaders who ended up being terrible. Pick some Jim Crow laws enacted through the democratic process.

I think it's more likely in the U.S., at least right now, that the government starts interfering in speech or elections in undemocratic ways than that the electorate would elect a tyrant.

That being said, there are some provably false stories floating around out there. There should be a good case for revisiting American libel and slander laws, or at least revisiting how they are prosecuted and enforced. If the slanderer is a foreign power, Washington has a responsibility to judiciously ensure that doesn't happen again.

But babysitting the American voter is a bad idea. If they can't be trusted, we've picked the wrong form of government. And while liberal republican democracy has its issues, it has proven better than the alternatives, at least the ones attempted so far

</comment></comment></comment><comment><USER7> I am not American nor do I live/work in the US but every time I read articles from Western media that mentions Trump I am 100% sure that the "Russian" word will be mentioned somewhere in the article. For an outsider like myself the blaming on Russia is getting out of hand. Maybe Russia did something or NOT but I still haven't seen any evidence up to now.

It's a shame that we are in the last quarter of the year and yet people there still haven't moved on.

<comment><USER8> For decades now, there has been a significant chuck of the nation's fringe (10-20%) who simply CANNOT accept a member of the opposite political party as a legitimate President.

All through the 90's, the talk radio fringe used the same argument that Bill Clinton's victory wasn't _truly_ legitimate because he didn't win a majority of the popular vote. And they had a special prosecutor follow him around for his entire Presidency, pretty much on a fishing expedition (younger people might not remember this, but Ken Starr stumbled across the Monica Lewinsky thing _years_ into the process).

All through the 2000's, the fringe left rejected George W. Bush's legitimacy, because they felt that it was decided by a Supreme Court with a thin majority of Republican appointees.

President Obama spent 8 years assuring people that he isn't a Muslim, and wasn't really born in Kenya. It sounds like parody, but roughly 1/3 of partisan Republicans seriously believe in this conspiracy theory ([https://www.nbcnews.com/politics/2016-election/poll- persiste...](https://www.nbcnews.com/politics/2016-election/poll-persistent- partisan-divide-over-birther-question-n627446)).

Today, partisan Democrats just can't let go of the "Russia hacked the election!" conspiracy theory... even though, from an independant's perspective, they sound flatly insane. At BEST, someone with ties to Russia leaked some embarrassing emails from a criminally insecure mail server. If HRC hadn't been the worst Democratic nominee in decades, then it wouldn't have mattered regardless.

I don't know what's going to happen with the next inevitable handover in 4-12 years. But it's a pretty safe bet that the next Democrat will be seen as "illegitimate" by roughly one-fifth to one-quarter of the nation as well. This is just the not-so-new normal.

<comment><USER9> I feel that, while you're not wrong about the ongoing de-legitimization of the presidency, there's a danger of drawing a false equivalence here.

The 2000 election really was decided by a Supreme Court with a thin majority of Republican appointees (in a state governed by the winning candidate's brother, under circumstances of serious, fraudulent voter disenfranchisement). And there really was foreign interference in our last election, in favour of the winning candidate - it's not really a "conspiracy theory" when President Obama literally called Putin on the red phone to ask him to stop. Whether you think it was effective or not (and there's no possible way you can know), there's no doubt at all they tried.

Conversely, Obama was definitely not in any shape or form born in Kenya, and Clinton's lack of popular vote was as immaterial as Trump's.

Only one of these sides looks "fringe" to me.

</comment></comment></comment><comment><USER10> The only(?) good thing to come from the Trump election is that more people are slowly realizing that democracy isn't all its cracked up to be, from a systems view.

All systems will eventually be gamed, evolution knows this very well. The only surprise here is that in this iteration of democracy the obviousness took so long. Plenty of other nations have known it for their whole democratic history. The Greeks knew it forever ago. Aristotle:

> _It is accepted as democratic when public offices are allocated by lot; and > as oligarchic when they are filled by election._

Facebook didn't do so much as it allowed more of the same and slightly revealed just how much manipulation gets attempted. If you like modern US democracy, you like the idea of _everyone_ , no matter how stupid or easily manipulated, having a vote. You can't complain about it _only_ when it doesn't go your way.

You cannot just blame Facebook. It's not like this was the first time the two teams tried to buy an election. Look at the 2012 figures for campaign spending (per OpenSecrets):

2012 OVERALL SPENDING

BLUE TEAM $1,144,965,831

RED TEAM $1,254,323,304

A couple billion spent sound like they were trying their hardest to "do something" to American Democracy.

<comment><USER11> There's far more manipulation and deception coming from the establishment media.

For example, how many people heard that Trump removed two countries from the travel ban list (Iraq and Sudan)? The media practically ignored that. Ignoring events like that, which would show Trump in a more reasonable light, is a form of deception: a lie by omission.

<comment><USER10> Yeah, most established media has been shameful lately. From one angle it's hard to blame them, since they are largely just trying to post stories that they know their current subscriber base wants to hear. This is even true of the NYT. There was a great comment chain on HN about it a while back (comparing the coverage from stories vs looking at what their linked sources said), but I can't find it. It was similar to coverage like this: [https://randomcriticalanalysis.wordpress.com/2016/05/09/my-r...](https://randomcriticalanalysis.wordpress.com/2016/05/09/my- response-to-the-nytimes-article-on-school-districts-test-scores-and-income/)

</comment></comment></comment><comment><USER12> It is much more comforting to blame Russia or Facebook for who won election in USA or general state of politics then to accept that most blame should go much closer. The reasons why majority of voters are disengaged have nothing to do with Russia. The reasons why people are skeptical of both parties in two party system have nothing to do with Russia too.

It is not like USA would be a poor country with both Democrats and Republicans being peny-less helpless parties unable to get their version of story to news. We are still talking about the most powerful country with most powerful countries that take money from billionaires.

Lately it seems that Russia is responsible for everything in America and there is Russian behind every tree. As much as comforting it might be, the real causes of problems are not Russia.

<comment><USER13> I agree with a lot of this. I've said before that whatever Russia did pales in comparison to what Limbaugh and Fox does every day. The Democrats didn't have a good candidate, obviously, and Americans were ready to shake things up. Trump just happened to be standing there with a shaker when it happened.

Even if Trump doesn't get re-elected, the likelihood of electing another candidate that is an "outsider," is significantly high.

</comment></comment><comment><USER14> It seems the country is not comfortable with diversity. There has been an insular and closely managed narrative by main stream press that is now confronted with true diversity of opinion.

This confrontation with a whole array of opinions that are not in the mainstream is throwing people off their comfort zone and has created an unreal hysteria and panic about bogeymen.

</comment><comment><USER15> Modern democracies are always an interplay between mass media and electorate. The schema is roughly circular:

people in power => media => voters => people in power

The Facebook problem (and more generally the Internet problem) is that it vastly reduces the control that people in power have over the information consumed by the voters. Which could be a good thing in some cases, a very bad thing in others, as the powerful are usually _also_ a highly educated elite that is capable of steering public opinion towards better choices.

However, I also agree with others when they say that blaming Facebook for Trump's election is an exceedingly self-absolving way of dealing with the problem of a very unsatisfied, poorly educated electorate. And the risk now is that a global, pervasive censorship will be applied by Internet giants to please the powerful elites of their home country.

<comment><USER13> >that blaming Facebook for Trump's election is an exceedingly self-absolving way of dealing with the problem of a very unsatisfied, poorly educated electorate.

I'm not sure poorly educated is the right term, but they are definitely poor financially across the vast majority of the US. I hesitate to say poorly educated because wading through the bullshit of politics isn't taught in high school and it takes years of getting burned before you realize just how much bullshit there is.

I mean when you want to learn about something, you go to a source or two and learn about it. With politics, your source is the news, and there are really no consistent good sources that are consistent over decades. Also, the nature of politics is highly subjective.

<comment><USER15> > I hesitate to say poorly educated because wading through the bullshit of > politics isn't taught in high school and it takes years of getting burned > before you realize just how much bullshit there is.

I didn't mean "poorly educated" in a derogatory way. Poor education can be the result of many factors, among which individual choice is probably the least relevant. The quality of education is influenced by family wealth, and on a bigger scale by political choices and a certain cultural attitude (I have long had the intuitive idea, _which might be completely wrong_ , that USA's cult of freedom entails a rejection of the value of a common basic educational standard).

</comment></comment></comment><comment><USER16> I live in france, and a friend who did not use her real name on facebook was flagged and asked to provide her id card to prove her identity.

I mean there are not that many structures in the world, not to mention international ones, that can do such things (or should).

We even did a little research, and apparently if she did provide a photoshopped version of her id card, it could end up in a tribunal (the mere act of falsifying false documents). Meanwhile we live in france and an american private company can ask for such documents, it feels a little odd.

I mean facebook can now justify asking users for their real identity paperwork to fight against bogus accounts.

</comment><comment><USER17> People not viewing the information we want them to view? Why not make your good information mandatory, and prohibit the bad information!

Facebook didn't do anything to democracy; the electorate has always been mostly simple salt-of-the-earth, common-clay people [1]. The kind of people who've been swayed by yellow journalism before, and would eagerly spread completely fabricated rumors about candidates amongst themselves.

The article also rings hollow when talking about how "no one could have seen this coming" since evidently Russia, the Trump campaign, and Beitbart (and, honorable mention, Scott Adams? [2]) had all managed to see it coming. Instead, I suspect the author is simply bitter about the fact that Clinton was unable to buy as the same kind of impressions as Trump, despite spending twice as much.

[1] [https://www.youtube.com/watch?v=KHJbSvidohg](https://www.youtube.com/watch?v=KHJbSvidohg) [2] [http://blog.dilbert.com/post/161777338226/russia-hacked- our-...](http://blog.dilbert.com/post/161777338226/russia-hacked-our-election- so-what)

</comment><comment><USER18> What's up with all the angry comments here? The article is about the influence of social media. People here take it as an assault on Trump supporters. Relax.

</comment><comment><USER19> Wasn't also the Obama campaign helped (in 2008 and 2012) by massive social media/web presence? I remember articles of newspapers writing fondly of how "innovative" it was and "transformative".

It's amusing how quickly and easily tables and narratives turn.

</comment><comment><USER20> The worst is yet to come, just wait till Zuck runs for president.</comment>


The mistake WikiLeaks made - <AUTHOR>

I'm the CEO of a US corporation. This is a throwaway account.
I admire Julian Assange greatly. As the CEO of a company that provides services to Bloggers, I have seen first hand the good that free speech does. I believe that freedom of the press and freedom of speech is perhaps the greatest contributor to the success of the experiment that is the United States and many other countries that allow transparency.
I grew up in South Africa during Apartheid and witnessed first hand the evil that an opaque government perpetrates. It seems power without accountability inevitably leads to great evil.
I wholeheartedly supported Wikileaks disclosure of the Iraq footage of the death of Reuters photographer Namir Noor-Eldeen. I support the disclosure of the entire trove of diplomatic cables, even though most of the cables are not items of public interest - the test that traditional news organizations apply in deciding whether to disclose sensitive material.
Recently Julian and his organization said that they would release internal material that would sink a major US bank. The implication is clear: Wikileaks target's are not limited to governments. Corporations are fair game too.
In making this decision, Wikileaks lost many of their remaining friends with power. I'm not advocating whether or not this was the morally correct decision to make, but I would like to point out that it was a strategic blunder.
Since then Amazon have booted Wikileaks off their servers days after allowing them on. Today Paypal suspended their account.
While these events are quite probably unrelated to Wikileaks targeting corporations, it's unlikely that the executives in these companies would go out of their way to help Wikileaks after the organization has made it clear that corporations are fair game.
I recently had the pleasure of debating the wikileaks situation with a friend who has spent his entire career in Aerospace protecting government secrets. We agreed to disagree on the level of transparency that is acceptable. But he asked me how I would react if my intellectual property was published by Wikileaks. At the time I said that I would target the individuals who stole the IP and would leave Wikileaks alone. When Julian Assange made the announcement that he's targeting US companies I suddenly found myself emotionally engaged in the argument and discovered that I felt differently. I felt that organizations like Wikileaks could threaten my family's livelihood and that of my employees.
I tend to err on the side of maximum transparency. But I think that by targeting corporations, wikileaks has lost a critical source of support in the important work they're doing.
I'd like to hear how startup CEO's and executives on HN feel about wikileaks from a business perspective.
~torq <comment><USER2> Whatever Wikileaks publishes on the bank in question, you can be certain that it will contain evidence of a pattern of probably illegal and certainly unethical behavior. If corporate governance and regulatory oversight are failing to prevent such behavior, then Wikileaks is providing a valuable service to everyone by exposing that behavior. Everyone, that is, except the bank in question, complicit organizations, and employees of those organizations.

<comment><USER2> One more thing to add. Paypal and the other companies that pulled the plug on Wikileaks did not pull it in protest to Wikileaks targeting of a bank. These plug-pullers seem to be a rather benign bunch. They probably have no dirty big secrets and therefore they–like the rest of society–actually stand to gain by Wikileaks exposing bad behavior among business. The only businesses that stand to lose, and therefore the ones that should be worried about it, are the businesses that are engaged in foul play or benefiting from it. So, ahem, why exactly are you so bothered, sir

</comment></comment><comment><USER3> I agree it's probably a strategic error, but I don't think it's actually very easy to distinguish governmental secrets from corporate ones, especially if you have to be somewhat opportunist in what secrets come across your desk. For example, what if you were interested in exposing the web of corruption that is the African oil and gas industry? Leaking documents on the subject from major multinational oil companies is probably the best route. You could try to only go after it from the governmental side, leaking documents from corrupt regimes that take bribes and rig auctions, but if you're a mainly western-based organization like Wikileaks, you might have easier access to internal documents from Exxon versus internal documents from the Nigerian government. The Nigerian government may have also been more careful about whether any of that ever got written down, so Exxon's side might actually have the best documentation.

</comment><comment><USER4> The comparison is wrong. Informations that could lead to the downfall of a corporation would not be plain industrial secrets (irrelevant politically). Companies would have nothing to fear if they did nothing objectionable from an ethical or criminal standpoint.

<comment><USER5> Exactly, WikiLeaks is not going to publish a corporation's IP. What it would publish is information revealing dirty practices.

The Enron scandal is something that the wikileaks would be interested in publishing. They would not publish Intel's chip designs.

I also work in the financial field (for a company that has more public responsibility than your average), and we have a whistle-blower hotline internally. If you see any "dirty practice" you are encouraged to report it ASAP. As the CEO, I can only encourage you to create this procedure in your company.

</comment></comment><comment><USER6> It wouldn't be the first time Wikileaks went after corporations. Half a year ago they published a document about how shareholders plundered the islandic bank Kaupthing before it collapsed.

Publishing intellectual property would be illegal, and I fail to see why anyone would fear Wikileaks for doing such.

</comment><comment><USER7> it is only a strategic error because if they target governments they can be politically supported by corporations and vice-versa. one place doing both things looses a lot of friends. but i am sure if you took a strawpoll of every technically literate person in the world what they thought of wikileaks, a resounding majority would be in support.

</comment><comment><USER8> I think it is very revealing...</comment>


Proposal for a text-based, typed, columnar data format - <AUTHOR> http://jimkeener.com/posts/TDFrev2

<comment><USER2> Looks like a good idea overall. Getting a format like this widely accepted would be tricky. Good tools that use it would certainly help.

A few comments/quibbles concerning the format itself:

(1) It think the realities of the modern world are such that you'll need to embrace Unicode a bit more warmly and deal robustly with files containing non- ASCII characters. (Some of those ordinary text editors you want to use will do UTF-8 transparently.)

I would suggest:

\- Officially specifying UTF-8 as the default character encoding, to be used if no character encoding is specified with some other mechanism.

\- Allowing specification of a different encoding within the file format. (You already have an HTTP-style header; you _could_ use a Content-Type line to specify encoding in the same way HTTP does.)

(2) You want to be editable using a standard text editor, but you allow null- terminated data as a type. You can't do both of those.

(3) You're using "," as a separator with lower precedence than ";". That goes against common usage in both programming languages and English text. Also your header, following the HTTP convention, is "key: value".

Putting those together, doesn't it make more sense to do something like this:

      Field_name:Type,Type; 2nd_field_name:Type

Etc.

(The above looks more natural to _me_ , anyway.)

(4) Your escaping looks odd. The explanation about awk doesn't quite do it for me. Why the strings of "$" and "%"?

To put it differently, why not use escapes in a more traditional style, something like the following?

      ; %;
      , %,
      : %:
      % %%

<comment><AUTHOR> I think I do like using the headers to define fields better: [http://jimkeener.com/posts/TDFrev3](http://jimkeener.com/posts/TDFrev3) That allows it to fall back to being a simple CSV if all the headers are removed.

It looks a lot better and just becomes more readable I think. I also simplified the types a bit (most noticeably removed the null-terminated and Pascal strings).

</comment></comment><comment><AUTHOR> The orderly, typed part of me is always offended by CSV files even though they are fairly useful. Having a texted based data exchange format that is typed and doesn't have the field overhead for each record is a good thing, I feel.

I would greatly welcome any comments and experience with anything similar. After I'm pretty confident with the format I would like to write a reference library for it.

Note to mods: please don't change the title I submitted under, the post title doesn't make much sense outside my blog, which I should change but cannot at the moment. The blog title, in my defence just references this spec because I'm not completely finished with the spec. I'm close and hope the hn community can give me feedback before I write an implementation.</comment>


Ask HN: Do you find blog comments useful? - <AUTHOR>

Do you find comments by users on your blog useful? <comment><USER2> I don't have a blog, but I'll answer this question: As a reader, do I find comments by other users on your blog useful?

Yes. The "me-too" and "great stuff!" comments I could do without, but a lot of times you get the situation of "I did what you said, and X happened, how do I fix?" and the answer by the owner is just as helpful as the original post.

Or if the post is a few years old but still relevant you can post the tweaks you made in order to get the solution X to work.

So if you're using this as a benchmark of whether or not to have comments, as a reader I'd prefer if you did, even if they're empty 99% of the time.

<comment><AUTHOR> When post is not-good then nobody comments on it. When post is good then people drag it here on HN but avoid commenting on the blog. So it is true that it will be empty 99% of the time.</comment></comment>


Node.js v0.8.0 [stable] is out - <AUTHOR> http://blog.nodejs.org/2012/06/25/node-v0-8-0/

<comment><AUTHOR> :-D I actually set an alarm this afternoon to submit v0.8.0 as soon as it comes out, if you can possibly believe it ( _I still can't believe I've done such a low, degenerate thing and am a little ashamed of myself_ )!

But I'm incredibly happy about this release, specially about the 'new' cluster API[1] that has made my life a whole lot easier! So apologies for being a karma whore, but I was _so_ glad I couldn't resist, if you know what I mean...

[1]: <http://nodejs.org/docs/v0.8.0/api/cluster.html>

<comment><USER2> I can't believe you managed to get this submitted to HN before I did. That's what I get for posting it to twitter before coming here ;D Since I knew the URL, I could have totally cheated and done it before even uploading the blog post.

<comment><USER3> Was there a prize for the first person that posted this?

<comment><USER4> what izs has called "Internet Points"

<comment><USER5> Welcome to HN, the show where everything is made up and the points don't matter.

</comment></comment></comment></comment></comment><comment><USER6> Make sure you at least got this points correct when trying to upgrade:

1\. require('sys') throws, use require('util') now. The "sys" module was deprecated in node v0.4.

2.cluster.fork() no longer return a child_process.fork() object use cluster.fork().process to get the object.

3.the 'death' event on the cluster object is renamed to 'exit'

</comment><comment><USER7> While the benchmarks look like there's an overall improvement, it's not instantly clear how much of an improvement they demonstrate. To more easily parse what the benchmarks are telling us, I calculated the percentage difference and the results appear really impressive.

Some of the most notable improvements listed below (results rounded, possibly misleading, but nonetheless awesome).

According to these benchmarks, 0.8 is approximately:

* 43% faster at reading files.

* 119% faster at reading 4096 byte buffers.

* 117% faster at writing 16384 byte buffers.

* 243% faster at http benchmark TYPE=bytes LENGTH=123456

* 506% faster at http benchmark TYPE=unicode LENGTH=55555

Be sure to note the actual figures though, as they are what really matter.

[https://github.com/timoxley/node/blob/ddee8bcda50c8377d135d6...](https://github.com/timoxley/node/blob/ddee8bcda50c8377d135d68923ecac0a29f72173/doc/blog/release/node-v0.8.0.md)

</comment><comment><USER8> This means contracts.coffee (<http://disnetdev.com/contracts.coffee/>) can finally be used on the stable version of node.js!

</comment><comment><USER9> This looks incredible. Congrats to node core on this milestone! I really appreciate how laser-focused you guys are on code consistency across the board.

Looking forward to trying out the cluster and domain modules in strata!

<comment><USER10> The domain module looks fantastic: <http://nodejs.org/api/domain.html>

"Domains provide a way to handle multiple different IO operations as a single group. If any of the event emitters or callbacks registered to a domain emit an error event, or throw an error, then the domain object will be notified, rather than losing the context of the error in the process.on('uncaughtException') handler, or causing the program to exit with an error code."

This will be great for things like request handlers, initialization code and other "loose" blocks of code where you don't really care about success but you do care about errors not propogating.

<comment><USER11> I've been reading back and forth between this post and the docs and I'm still not really getting it.

Is this just a way of registering a single callback to respond to error events that could be emitted by different operations? What are some examples when this would be better than handling error events individually?

Is it sort of like a try/catch for error events?

<comment><USER2> > Is it sort of like a try/catch for error events?

Yes, but it's also sort of like a try/catch for thrown errors.

        d = domain.create()
        d.on('error', function(e) {
          console.error('an error: ', e)
        });
        d.run(function() {
          throw new Error("whoops")
        })

would console.log, rather than crashing the program.

When an EventEmitter is bound to a domain, their error events and any errors thrown while emitting an event on them will be handled by the domain object that they're bound to.

</comment></comment></comment></comment><comment><USER12> Coincidentally, today is the day that I started looking into learning node. Anyone know some good guides which don't use deprecated code?

<comment><AUTHOR> It's been a long since I watched "Introduction to Node.js with Ryan Dahl"[1], but although I think it was circa v0.4.0, it's not _really_ outdated. It's a short talk, but it talks a little about Node's philosophy and I highly recommend watching it.

I haven't watched Pedro Teixeira's tutorials[2], but many recommend it.

But I personally think Manuel Kiessling's online book[3] is the best. It really teaches you to think asynchronously. I took a quick look and I don't think any of the modules he's used have had a significant change. Be sure to check it out.

[1]: <http://www.youtube.com/watch?v=jo_B4LTHi3I>

[2]: <http://nodetuts.com>

[3]: <http://www.nodebeginner.org>

<comment><USER13> I just started teaching myself node a couple days ago and just finished with Manuel Kiessling's online book yesterday. It really is a great tutorial and helped me a lot. Thanks for the other links, I'm going to check out nodetuts.com later today.

</comment></comment></comment><comment><USER14> Congrats on the release!

I'd love to take this opportunity to dive into Node, but I have yet to stumble accross an effective way of organizing medium to large Node projects. What tools do you guys/gals use?

<comment><USER15> Late response, apologies..

Node is still young, and for its primary use case (multiuser/messaging- oriented apps) it seems like the actual LoC stays pretty low. However, here are some things I've picked up in my studies that seemed to make sense to me as an Express user. Keep in mind I'm still a relative nodenoob, so take this with a grain of salt..

\- Keep the actual 'route code' (i.e., code that handles your end points) in a folder, named by the function: i.e., routes/login.js

\- The overall route map (i.e., app.get()) lives in the main app.js file or routes/index.js

\- Use underscore.js where possible; this raises the cognitive level of your code and its become a 'standard part' of Javascript to some degree. Unfortunately the Node repl treats _ as a special value, so you can't really test with it there. Kinda sucks..

\- Use config.js to contain database settings, default port, middleware settings, etc.

\- Develop the more complicated parts of your code in libs/. Think of them as open source components; keep them generic and disconnected from your app itself. This increases reusability (obviously) and testability. I think it creates better code overall. Some people even npm the core "hard parts" of their code! This is a really interesting and freeing strategy.

</comment></comment><comment><USER16> Yay! This looks great. I'm particularly excited about v0.9x as the current SSL performance is still a massive issue when it comes to actually running apps in production (it's SUPER SLOW). It seems that optimising this will be a core focus moving forward:

 _SSL performance leaves much to be desired at the moment. Node's interface with OpenSSL is somewhat naive and leaves a lot of potential optimization on the table._

</comment><comment><USER17> If you want to play with this new version but also have code running on older versions that hasn't been completely ported yet, I recommend using nave to manage your node versions. After you `npm install -g nave` you can just `nave install 0.8.0` to get node 0.8 then type `nave use 0.8.0` to start using it!

<https://github.com/isaacs/nave>

<comment><AUTHOR> Or 'nvm'[1], or 'n'[2]... All of them are bash-specific so if you're using 'fish' for example (what I really like to), you're out of luck and you must hack your own.

[1]: <https://github.com/creationix/nvm>

[2]: <https://github.com/visionmedia/n>

</comment></comment><comment><USER18> Does anybody know which optimization was added to V8 to improve the throughput by so much?

<comment><USER19> It is hard to say: that's 2642 worth of revisions in V8.

String (unicode) benchmark throughput was definitely greatly affected by improvements in string handling (both internal operations and writing then out of V8 heap through the API; V8 also reintroduced string slices to avoid copying of characters for long substrings).

Other notable things on the compiler front: V8 has switched to a new counting profiler from statistical one, and now makes slightly different optimization decisions. There were improvements in functions inlining (including inlining of constructors). There was some cleanup in invocation sequences for functions and we enabled type feedback for function calls through local variables on x64 (which opened the door to all optimizations that were dormant at such callsites: e.g. inlining or direct calls).

Other notable things in the runtime: new GC has landed and was tweaked for quite some time. Unboxing of double arrays and tracking of smi-arrays (should not affect node.js though).

I think the only way to see which changes in V8 resulted in throughput boosts is to get per-V8-revision measurements.

</comment></comment><comment><USER20> Does anybody know the details on cluster.autoFork()? <http://nodejs.org/api/cluster.html> has it in a couple of examples, but not documented - is that supposed to be there?

</comment><comment><USER21> Any ideas how long it usually takes Heroku to add a new release of Node?

<comment><USER22> You can use any version at any time: <https://devcenter.heroku.com/articles/nodejs-versions>

<comment><USER23> Not quite, I think? That page suggests that you can only use versions in this manifest: [http://heroku-buildpack- nodejs.s3.amazonaws.com/manifest.nod...](http://heroku-buildpack- nodejs.s3.amazonaws.com/manifest.nodejs)

...which doesn't list 0.8.

<comment><USER24> The node.js buildpack has good instructions for how to upgrade it yourself if needed: <https://github.com/heroku/heroku-buildpack-nodejs> (and the buildpack docs are now public since Heroku's Cedar stack became the official default)

<comment><USER21> I meant when will they update it so that you can use the new version of Node without hacking the buildpack. >To change the vendored binaries for Node.js, NPM, and SCons, use the helper scripts in the support/ subdirectory. You'll need an S3-enabled AWS account and a bucket to store your binaries in. I don't want to mess with that, I'd rather wait for Heroku to update so I can change one line in my package.json.

<comment><USER25> I'm beginning to wonder if Heroku is going to bother with this any time soon. The default version is _still_ 0.4.7 [1] and personally I'm starting to feel the pressure to update, especially considering recent performance improvements.

[1] <https://devcenter.heroku.com/articles/nodejs-versions>

</comment></comment></comment></comment></comment></comment><comment><USER26> In the announcement: s/in favor of/in place of/, otherwise one can't parse which array implementation will be picked.

</comment><comment><USER27> Congrats on the release, it looks great!

</comment><comment><USER28> Gotta love that the homebrew recipe is already up.

brew update

brew upgrade node

<comment><USER29> Why does brew NOT include NPM? I used the mac installation package instead.

<comment><USER30> Homebrew doesn't handle software that updates itself. It's an opinionated piece of software.

UPDATE: More on this here <http://blog.izs.me/post/3295261330/on-npm-and- homebrew>

</comment></comment></comment><comment><USER31> The big difference is the switch from node-waf to node-gyp for native modules.

</comment><comment><USER32> Anyone noticed increased CPU usage?</comment>