An experiment-driven guide to Perl - <AUTHOR> http://matt.might.net/articles/perl-by-example/ <comment><USER2> Full disclosure: I'm the guy who made [http://perl-tutorial.org](http://perl- tutorial.org) a few years ago because the top google result for "perl tutorial" was a perl 4 tutorial. I have looked at many tutorials and have a vested interest in getting quality tutorials in people's hands to avoid them writing shitty perl.

That said, this tutorial is terrible on a number of points, since it teaches outdated things that have long been known to be dangerous and are only kept around for the sake of backwards compatibility. Reading it is wholly a waste of your time, unless you already know perl like the back of your hand and wish to get enraged; or have the masochistic desire to learn perl in a manner that will punish both yourself and others for your mistake of reading this tutorial.

If you truly wish to learn about Perl in a whirlwind tour, read either the very short free book Modern Perl [1] or any other short tutorial linked on the site i mentioned first.

If you're the author of this tutorial, i applaud you for the effort, but wish you'd have spoken to any part of the community before publishing. If you feel like it, #perl-help on irc.perl.org is a great place to start. And if you meant this as a troll, 10/10, would rage anytime.

[1] [http://onyxneon.com/books/modern_perl/](http://onyxneon.com/books/modern_perl/)

<comment><USER3> Article author here.

To be clear, this is not a tutorial on writing good, idiomatic Perl. (And, I've strengthened the article's disclaimers to that emphasize that.)

It's a semantic excavation of Perl.

My goal was to understand how the Perl interpreter thinks, and to answer language design questions like: How are parameters passed--by value, by alias, by name, by reference, by need? How are variables scoped--lexically, dynamically, globally? What is the effect of @ in a prototype? For the .. operator, how is the implicit toggle scoped--at the procedure or the nearest enclosing block? How do prototypes influence context, and how do contexts influence evaluation?

That is, I wanted to understand what was possible. The possible is entirely separate from the good.

As a formal semanticist, I was continually surprised by how Perl behaved.

As someone that has had to occasionally debug other people's Perl, I believe there is value in understanding the syntactic and semantic quirks in the language.

Thanks for your comments.

I'll be updating the article with your feedback.

<comment><USER4> I can dig it. By analogy something like "If you insist on installing deck screws with a hammer instead of a screwdriver, this is what happens with a sledgehammer, this is what happens with a large heavy rock, this is what happens if you use your fist..." It is interesting, rather than terrifying, when seen in that light.

However, Google is going to google, thats its thing, so some victim in the future might think this is the one true answer to using objects in perl, which is not cool.

</comment></comment></comment><comment><USER5> Ahh perl... the first language I used to make something non-trivial. The coolest script I wrote was a load balancer that used ssh to submit jobs and monitor the activity of nodes in a cluster via commands remotely executed by ssh. No root access needed, no servers to install, just needed to have an account accessible via ssh on the remote machine and ssh + perl on the machine you were working on. It was the simplest solution to the complex problem of "I have all of these computers, now how do I use them to their maximum potential?" Stuff like Linda existed than, but I found it way too complex in comparison to my simple scripts. Alas, I since moved onto the heady world of lisp, but I still use perl for the occasional $ perl -pe 's/this/that/' at the command line and as a alternative to bash scripting.

A merry Tim Toady to you all! Also, an obligatory xkcd: [https://xkcd.com/224/](https://xkcd.com/224/)

</comment><comment><USER6> As a long time Perl programmer, I am a little disappointed with the lack of comments on this post.

I generally follow Matt Might's blog, and I am impressed by previous posts. Unfortunately, this tutorial is likely to leave beginners more confused than when they started. I have to encourage people to look at chromatic's free book "Modern Perl" instead.

</comment><comment><USER7> > In Perl, there are three contexts in which an expression may be evaluated.

> 1\. scalar

> 2\. array

> 3\. void

There's actually no such thing as "array context" in Perl; instead there's "list context". An array is a list that's been stored in a variable (this is a fairly common mistake).

See [http://friedo.com/blog/2013/07/arrays-vs-lists-in- perl](http://friedo.com/blog/2013/07/arrays-vs-lists-in-perl) and [http://perlmaven.com/scalar-and-list-context-in- perl](http://perlmaven.com/scalar-and-list-context-in-perl) for good examples/discussion.

EDIT:

Posted this before I finished the article. Understanding the difference between arrays and lists makes the following potential WTFs a lot clearer:

        sub take_two_arrs (\@\@) {
          print $_[0], $_[1] ;
        }

        take_two_arrs @a1, @b1 ;         # prints ARRAY(0xAddr) ARRAY(0xAddr)

        take_two_arrs ((1,2),(3,4)) ;    # error: arrays must be named

The second doesn't work because the prototyped function takes _array_ references, not lists. It would work if you called it like this:

        take_two_arrs ([1,2],[3,4])

I'll admit that this is baffling.

        sub what_are (++) {
          print $_[0], " ", $_[1] ;
        }

        what_are ((1,2),(3,4)) # prints 2, then 4

(This is part of the reason that Perl programmers don't use prototypes very often.) perlsub warns:

> When using the + prototype, your function must check that the argument is of > an acceptable type.

The plus here forces scalar context on the arguments, which are lists (not arrays!), so they return their last elements. This would work how the author probably wants if called like this:

        what_are ([1,2],[3,4]);   # prints ARRAY(0xAddr), ARRAY(0xAddr)

<comment><USER8> _I 'll admit that this is baffling._

The inner parentheses force evaluation of the two inner comma operators in the scalar context provided by the function prototype. `1` and `3` get evaluated in void context and discarded, leaving `2` and `4` as the two arguments to the function. (I had to look up `+` in prototypes, however.)

Without a working understanding of lists and context, this example is undoubtedly baffling, but that's why the documentation exists.

<comment><USER7> I guess I really meant "is baffling without a thorough understanding of context." I feel better about looking up the + now that I know you did too, though! I don't think I've ever seen code like that in the wild, and I've never seen a Perl programmer attempt to call a sub with nested parens, like what_are((1,2),(3,4)) before.

<comment><USER9> You may not realized that's what you saw, but for example all of the Moose documentation uses effectively a nested param:

        has foo => ( is => 'ro' );

is equivalent to:

        has('foo', ('is', 'ro'));

because Moose's `has` sugar is written as a exported function.

<comment><USER7> That's true, but I've never actually seen anyone call 'has' like that. Plus, Perl's behavior on lists makes sense (always flatten) if there's no mucking around with prototypes, so that's much less confusing than the behavior in the article.

<comment><USER9> The first one I presented is the way the Moose documentation calls has, the way the Moose test suite typically calls has, and the way I and most of the rest of the Moose Cabal call has.

The second one isn't common at all, but I have seen people both completely leave out the parentheses:

        has foo => is => 'ro', isa => 'Str', ...;

or treat has as a straight function

        has(foo, is => 'ro', isa => 'Str');

both of which cause Perl::Tidy to do weird things.

<comment><USER7> Sorry, I meant I'd never seen it called the second way (nested parens). I also haven't seen the no-parens version, which looks really bizarre!

</comment></comment></comment></comment></comment></comment></comment><comment><USER8> The core documentation is not always clear about the difference between lists and arrays--and much credit to the author for identifying the comma operator as an operator--but this is really confused:

 _By default, the arguments to a procedure are in the array context, which means that the comma operator expects both of its operands to be arrays. It promotes them to single-element arrays if they are scalars. In Perl, comma (,) can mean cons, append, flatten all at once._

I wrote an explanation of context in Perl which is hopefully clearer:

[http://modernperlbooks.com/books/modern_perl/chapter_01.html...](http://modernperlbooks.com/books/modern_perl/chapter_01.html#context)

</comment><comment><USER10> I loved this article.

I started writing Perl nine months ago because of my new job. I learned it with the Modern Perl book, which is really nice and goes directly to the best practices. However, I've found that real life Perl code is full of the old/deprecated/insane ways of doing things as well. And Perl developers really take the TIMTOWTDI principle to the limit.

This article helped me to understand Perl more. And specially to understand real life Perl code better. I also liked the language designer perspective and the semantic analysis. Thanks for writing it!

</comment><comment><USER11> "alarming brevity" :-)

Looking forward to reading further into this.

<comment><USER12>
      To accept a reference to one of several specifiers, Perl accepts a grouped \[ specifiers ] form:

      sub array_or_hash (\[@%]) {
        print $_[0] ;
      }

Dear god...

</comment></comment><comment><USER13> Hi Matt,

I've been exploring your blog. Great stuff! I was particularly appreciative of the parsing articles.

Larry Wall (the Perl designer) has been designing and helping develop a new language for years. (He claims he began thinking about this new language before Perl 5 shipped 20 years ago.) Arguably it addresses the same sort of audience as Scala and Haskell. Have you taken a look at it?

<comment><USER14> I can't find the link, but I remember a few talks about Perl 6 Grammars which were very interesting both in the eDSL structure and the fact that Perl 6 was built on top of them. I think it was Damian Conway speaking but I'm not sure anymore.

</comment></comment><comment><USER15> I'll concentrate on the mistakes. If I were to criticise all the other many weird formulations and expressions in this guide which make it hard to unambiguously understand what the author meant, I would still sit and be typing here tomorrow.

\----

> A code comment in Perl begins with a hash #

Hashes are already something different in Perl. Avoid ambiguity, use the common name of that character: number sign.

> procedure

This word is used through-out, but the official Perl documentation does not mention it. Use the word subroutine (or just sub for short) instead.

> The $ prefix references a variable as a scalar

> Array variables use the prefix @

This is the wrong explanation. The sigil denotes the mode of access, @ indicating the expression evaluating to a list value, $ indicating a single value. This becomes clear when one examines slices of a compound data structure.

        @arr = ("foo","bar","baz");
        $arr[1];    # "bar"
        @arr[2,3];  # ("bar", "baz")

        %hash = ("foo", 1, "bar", 2);
        $hash{"foo"};        # 1
        @hash{"foo", "bar"}; # (1, 2)

The guide mentions the change from @ to $ or from % to $ only in passing without explanation, and does not mention slices at all.

> Hash variables expect an array for initialization.

No, a list.

> three contexts in which an expression may be evaluated:

> 1\. scalar

> 2\. array

> 3\. void

No, the second is list context.

> Is localtime() returning a scalar, or an array?

No, a scalar or a list.

> By default, the arguments to a procedure are in the array context, which > means that the comma operator expects both of its operands to be arrays. It > promotes them to single-element arrays if they are scalars.

> It seems that the function call still flattened out the arrays (and hashes) > when making the call.

This is completely misleading. A sub takes always a list. What is described here has nothing to do with arguments, but is the consequence of the specifics of how values are evaluated into a list. This also happens, for example, on list assignment.

> all of the following are equivalent procedure calls:

> print3 (1,2,3) ;

> &print3 (1,2,3) ;

This is wrong, there is a difference, it just did not show up in the example.

> In fact, the argument isn't even hash, despite what the specifier says

Refer to the documentation: when not backslashed, % is defined to behave like @.

> sub use_hash (%) {

> print $_[0]{"foo"} ;

> print $_{"foo"} ;

> print @_{"foo"} ;

> }

> use_hash ("foo" => 1701) ; # prints nothing

No wonder. The code is broken.

@_ contains a plain list value. To access it with a hash subscript, turn it into a hashref first.

        print +{ @_ }->{"foo"};
        print ${ {@_} }{"foo"};

> The specifier & expects to receive a function

Not function, coderef is the appropriate word.

> To accept a bareword filehandle as an argument, it becomes necessary to use > the rarely used * prototype specifier

Simply passing *F is also possible, no prototype involved.

> The repetition operator x repeats a string or an array,

No, it repeats single or list values. Scalars are coerced into their string representation, and lists are simply repeated unchanged.

\----

Closing words: This is amateur hour, not worthy of a professor. Advice for next time: consult domain experts and have them proof-read before publishing, and also always give your documents a last-modification date and version history, or at least a version identifier.

</comment><comment><USER16> "Every programmer needs Perl in their arsenal."

I stopped reading at this point.</comment>


Solar power is already saving lives in the US.  how - <AUTHOR> https://www.vox.com/2016/5/19/11711040/sunshot-solar-benefits <comment><AUTHOR> "Annual reduction of 17 million metric tons of CO2, which is, based on the central estimate of the social cost of carbon, "equivalent to an annual global benefit of $700 million." Annual reductions of "10,000, 10,300, and 1,200 metric tons of SO2, NOx, and PM2.5, respectively ... which provide annual domestic air quality benefits of $890 million." Annual water "withdrawal and consumption savings of 294 billion gallons (0.8% of power sector total) and 7.6 billion gallons (0.5% or power sector total), respectively, with much of those savings located in drought-impacted California." It's worth keeping in mind that the somewhat clinical phrase "domestic air quality benefits" is another way of describing fewer kids having asthma attacks, fewer adults missing workdays, and fewer people dying of respiratory and circulatory ailments.

It's also worth keeping in mind that none of these social benefits are priced into the cost of solar; it is not compensated for its "positive externalities." If it were, it would knock almost 5 cents a kilowatt-hour off the price, which would mean the Sunshot cost target was already achieved."

</comment><comment><USER2> I wish more people were pressuring their local representatives to vote for measures like net metering (allows residents with solar to sell excess kW to the local utility company), rebates, and tax breaks. This would go a long way in increasing solar adoption and deployment.</comment>


Show HN: We're building a better music distribution platform - <AUTHOR> http://mvsic.co/

<comment><USER2> The misspelling and the .co URL instead of .com is going to hurt you so bad. When consumers choose a brand to trust, a lot goes in the name. You might be able to prove out an MVP of a product but you won't go big on that domain name.

<comment><AUTHOR> We're actually pretty happy with the name choice. Mvsic should be an easy term to rank for, while also having connotations of "music" to a human reader.

Plus, we think it's simple and elegant, which describes the service. See also: <http://svbtle.com> and <http://svpply.com>

<comment><USER3> Maybe the name is okay, but this is gonna kill you: <http://www.mvsic.com/>

<comment><USER4> It'll be a hurdle, for sure, but not too much different than The Hype Machine being at hypem.com

<comment><USER3> Not quite the same. "Hey, this site is music but with a V instead of a U. Check it out." I go to <http://www.mvsic.com/> and it's a Go Daddy parking page. Oh well. User lost.

You and I don't think like this, but many users do.

</comment></comment></comment></comment></comment><comment><USER5> I don't know if SEO will be a priority for your company--you might be relying on a different source of traffic. If you need SEO, you are hurting yourself by not having "music" in your domain name. Using the "v" might be cool but it isn't going to help your effort.

<comment><AUTHOR> Do you think that "music" is a keyword that people normally use when searching for music? It sounds like a rhetorical question, but I'd argue that it's actually not that important.

We're planning on having really SEO-friendly link structure:

        mvsic.co/artist-name/track-name/

But the majority of search rankings are determined by off-site factors, like how many inbound links a site has. We're definitely hoping to rank well for branded search times (ie, someone looking for a particular artist or song) but we know it'll take awhile before that traffic becomes meaningful to the artist, so we're not advertising it yet.

</comment></comment><comment><AUTHOR> As someone who started a music blog several years ago, I've worked with tons of artists and used many different "file sharing" websites to distribute music. And they all felt a little lacking. Soundcloud is probably the closest, but their focus on "sounds" as opposed to "music" left much to be desired.

We're offering real time stats, geolocation analytics, and a whole bunch more to help artists distribute music and watch it spread. Let me know what you think!

<comment><USER6> Looks great. As a band member, active new-music-finder and song-downloader, I fit within your demographic.

If you'd like some feedback and stuff I'd be happy to take a look!

<comment><USER4> Thank you! We'd love some feedback, especially from the artist's perspective as far as our feature set and pricing.

<comment><USER6> As far as the branding goes, MVSIC reminds me of a minimal Bandcamp and I assume the whole V thing is taken directly from Svpply?

Now, I'm sure this will resonate with the artist, but the problem you have is the same problem faced by many sites I've seen before. It's partly a branding issue (on the front page, all I see is a globe) and a distribution issue. Do I have to post a link to mvsic somewhere in order to get people in the door? If so, what are the benefits of sending them to mvsic rather than somewhere like Bandcamp?

I'm not saying that Bandcamp does what you guys do, better (I'm sure mvsic is awesome, and I'm going to delve into it further after work), but it's not clear what value it actually brings to me as an artist.

So, here's some things you can do now.

* Make the front page friendlier. Pictures of the product in action. Keep it minimal, that's a great thing you have there, but just take a think about what someone wants to see when they visit mvsic.co.

* What IS your USP? Give me it in plain english. (It's definitely a SP but not sure how U it is!).

* Maybe think about offering a free tier. I know you've put a reason as to why there isn't one, but I'd urge you to experiment with offering a free trial for a certain amount of downloads, restrictive features etc. For instance, make your account FOR FREE , after first 50 downloads prompt the user to subscribe to your service.

<comment><AUTHOR> Thanks for the feedback. To answer some of your points:

I think our goal is to one day drive our own traffic to an artist's music. Have people coming to the site and clicking around to find stuff. But in the near term, we can't promise we'll drive any of our own traffic to the artist, so we're relying on the artist to spread it.

The other thing people have seemed to love is the concept of real-time stats similar to Google analytics. When an artist posts a new release, there's that "moment of truth" where they blast it out to their fans and then wait for a reaction. But it's hard to really get insights into what's happening. Who is listening right now? Where did they come from (referrer)? Where are they located geographically?

And then eventually being able to do cool things with all that data to follow up with the right fans with the right message at the right time.

We're also aiming to take a lot of things other sites have done (ie, charging money for a download) and making is simpler for the artist to manage. We'll deposit money directly into an artist's stripe account, for example, rather than holding it until they hit a threshold.

And we've gone back and forth about offering a free tier dozens of times. Our current solution is to allow anyone to sign up and get their hands on the software for free, but then they have to pay before they can publish a track. Among other things, we're hoping this cuts down on the risk of DMCA violations we have to worry about :)

Screenshots coming soon!

<comment><USER6> Sounds awesome! I'll talk to the rest of the band about signing up with you guys.

<comment><USER4> Thank you! We'll definitely be posting updates on our blog (blog.mvsic.co) in the coming month or two as the service continues to be built.

</comment></comment></comment></comment></comment></comment></comment><comment><USER7> I couldn't find an example of an artist page, so it's hard for me to evaluate.

I have a question though. How are you ever going to compete to Bandcamp? From what I read, the services sound very similar, except Bandcamp does it all (well, almost all) for free. Plus a lot of artists and consumers are already familiar with Bandcamp, it's pretty much the go-to website unsigned indie artists put their stuff up (either as a free download or paid download).

<comment><AUTHOR> I'd be lying if I told you that I thought Bandcamp was a bad service. In fact, they've been a big influence on what we've decided to build. Them and Soundcloud.

How will we ever compete? We obviously won't be able to match them feature for feature at this point -- we're just two guys working on this in our spare time.

But I think our positioning is a little different. Plus, both of us have years of experience music blogging so we'll lean on our networks of artists we're in contact with to hopefully drive some initial sing-ups and get some momentum.

We have dreams of being the go-to service for this kind of stuff, but we know it's going to be awhile before we get there.

</comment></comment><comment><USER8> I have a hard time believing that many indie artists are willing to pay $15/mo for access to a distribution platform with no traction with music purchasers or listeners. That's putting all the risk on them. I'd structure it more like "we get the first $15 of your earnings on our service each month".

That said, welcome competitor! I admire you guys taking a stab at this problem; it is one that needs solving.

<comment><USER4> Thanks for the feedback :)

Hartley and I actually have some good connections in the music blogging space, and we're working on building some tools that we think will help artists and bloggers work together.

For example, right now bloggers either:

a) use an artist's embeddable player in order to post a song. They can't track plays/downloads coming from their site or their impact on an artist (I contributed 20% of their downloads, for example).

b) upload their own versions of audio files so that they can track plays/downloads. But now the artist can't see the reach of their music.

I think we can fix this.

<comment><USER8> So does that mean that you would sell access to the analytics data for a song listing to both the artist and the blogger? Would the blogger's data be limited to traffic on their own site? Does the artist control who gets access to their data?

<comment><USER4> Those are good questions, and ones we're also working through at the moment!

</comment></comment></comment></comment><comment><USER9> Some thoughts about your pricing...

The relatively minor jump in pricing from manager -> label really confuses me. I'd think a label should be paying in the _thousands_ per month, not just 6x more than an individual artist.

<comment><USER4> Really good point. Right now we're figuring out what prices make the most sense, and we're talking to different artists/managers/label owners about how we can meet their needs.

</comment></comment><comment><USER10> Here's what your site looks like to me:

<http://i.imgur.com/frnJd.png>

Google Chrome 23.0.1262.0 (Official Build 155673) dev / OS Linux

<comment><USER4> Is that on mobile? Looking into it now, thanks for the heads up!

This is how it should look, by the way: <http://imgur.com/wt9kC>

<comment><USER11> Same issue as evmar,

Chrome, OS X Mountain Lion

<comment><USER12> Same. Firefox 15, XP.

<comment><USER4> Thanks for the heads up - we'll work on fixing this mobile view issue. Is the site looking (more) normal when you're viewing on a wider browser?

<comment><USER3> These people clearly stated they were using desktop browsers...

So am I, and here is what I see: <http://puu.sh/161Xi>

Firefox 16

edit: Maybe it is a font issue. I am not loading the fonts I see in your screenshot.

<comment><USER4> Yeah, that's a fallback issue on our end - thanks for the screenshot.

</comment></comment></comment></comment></comment></comment></comment><comment><USER13> I understand that you're targeting musicians, but to whom will you sell and distribute their music? The site doesn't currently mention or appeal to listeners. You probably don't (yet) have a lot of music to promote, but a quick visit to Beatport shows what type of attention is paid to audience and content.

Some initial feedback on the site's layout:

\- The layout breaks at medium and narrow widths, particularly the home and FAQ pages

\- Looks enough like Rdio that I feel compelled to mention it here

Good luck!

<comment><AUTHOR> Yah, we're definitely hoping to become a portal for fans discover music. At this early stage though, we can't promise that we'll be able to drive traffic to artists since we're not there yet, so we'd be relying on artists to drive their following to us.

Once our content library starts to build up, we'll hopefully transition to a more listener-driven public site. Thanks for the feedback!

</comment></comment><comment><USER14> As a musician and owner of a record label, I closed out immediately once I saw the generic site design. Not saying it has to be super hip or whatever, but, trivial as it is, I'd like to see some semblance of taste or creative spirit for lack of anything else to go on.

</comment><comment><USER15> CASH Music: <http://cashmusic.org/>

CASH Music is a nonprofit organization that builds open source digital tools for musicians and labels.</comment>


Firefox 3.0 opens door to Web apps, Mozilla says - <AUTHOR> http://news.yahoo.com/s/infoworld/20070227/tc_infoworld/86376;_ylt=ArVcNuzsHJF2q2hUReDfwZOor7oF <comment><USER2> What's interesting is that FF3 may allow you to use webapps offline.

</comment><comment><USER3> Closes doors for every other browser?

<comment><USER4> One thing the article didn't make real clear was that the new features are all standards compliant- in theory most other browsers will end up doing the same things (though IMO it would be nice if Mozilla stays ahead). Here is where you can see the web-programming landscape will look like in the next several years: http://www.whatwg.org/</comment></comment>


Counting lines 60% faster than wc, with Clojure and core.async - <AUTHOR> https://hackernoon.com/counting-lines-60-faster-than-wc-with-clojure-core-async-1af4ce058884 <comment><USER2> I did something like the single-threaded naive approach from [http://lemire.me/blog/2017/02/14/how-fast-can-you-count- line...](http://lemire.me/blog/2017/02/14/how-fast-can-you-count-lines/) and outperformed wc -l slightly. But Lemire's vectorized/bit magic'd version is 16x as fast as the naive.</comment>


I Sleep In Late, And I'm Tired Of It - <AUTHOR> https://medium.com/pursuit-of-happiness/720a7d173812 <comment><USER2> Get a dog. You could also consider a cat, but they're more complicated.

<comment><USER3> I'm going to go ahead and confirm that a cat will not help. I have 2, have had up to 4 at one time, and when I've slept in, they're helpless.

A dog on the other hand is substantially...well, bigger.

<comment><USER2> I have 10, and yes I meant the number between 9 and 11. This is equivalent to an alarm with a short snooze function, albeit one that involves scratching and sandpaper-like abrasion from feline tongues, and which can actually result in sleep deprivation instead of excess somnolence.

Dogs fortunately come in a variety of sizes, but IME they're a bit more regular than cats, plus they're more prone to express gratitude than merely issue demands.

<comment><USER3> Haha, that was funny. I can't believe you have 10! Do you breed them? I'll have to defer to your experience then.

I've never had any of mine (I've had 6 total) scratch me to wake me up. They also fail to wake me up by making noise. The worst that ever happened was my kitten biting my nipple.

I have found that younger cats like to play at the most inconvenient times for _falling asleep_...but once I'm there I've never found a mewing or even fighting cat to wake me.

I've only had one dog, and they definitely do seem to appreciate people more, but cats are much more interesting, I think.

<comment><USER2> No, I had a crazy cat lady neighbor that abandoned 9 of them (in stages), and #10 was an impossibly cute kitten that showed up because there were other cats here. I've recovered several lost cats for neighbors, they tend to gravitate to my yard since it has a bunch of contented cats.

It's a long story. My wife and I are trying to turn it into a children's book.

<comment><USER3> Impossibly cute kittens are the best. I just recently got a purebred ragdoll...beautiful coat and bred to be extra affectionate. If you're ever in the market to buy/adopt another kitten on purpose, you might check out [http://wikipedia.org/wiki/Ragdoll](http://wikipedia.org/wiki/Ragdoll) \- they're more hyper, but they have these piercing blue eyes and a white/gray coat. They also don't mind how people pick them up...they'll pass out stomach completely exposed in your arms, for example.

But on the flip side, you could make a cool Kafka-esque horror story in which you awake one day to find that you had inexplicably become, to your terror, a _cat-lady_...with mewing cats around you and all.</comment></comment></comment></comment></comment></comment>


Rethinking WordPress as a CMS - <AUTHOR> http://www.webinsation.com/rethinking-wordpress-as-a-cms/ <comment><USER2> We have several years of experience with building websites with WordPress for clients. And indeed most of the clients seem to struggle with managing the content. Most of the problems occure with the wysiwyg editor and the media library. Mostly small stuff like disappearing new lines or the other way around. Even for me it's sometimes hard to figure out why the editor behaves unexpectedly. Try to make a decent bulleted list and then edit it. My personal rescue is the html view, but we can't expect that from the customer can we?

But give any unexperienced person a copy of Word and the struggle with the same problems. The difference is there are not that many client without experience with Word. They do that every day. They edit the website a few times a week tops. And when they try WP for the first time they expect it to be a hassle free ride. What I am trying to say is every piece of software you want to use in a good way you need to sit down for and put some effort in it. Sweat and curse just like we all did on Word and then you wil get used to it.

That being said there is always room for improvement in WP. Thanx for the post.

</comment><comment><USER3> I was introduced to Concrete5 (<http://concrete5.org>) more than a year ago. I stopped looking elsewhere after that.

It is by far the best open source CMS. It is being actively developed, MVC backend, and the in-line editing - clients love it.

It has some good caching as well.

<comment><AUTHOR> That's great to hear that Concrete5 is working so well for you! I'd be interested to hear more about the "inline" editing feature.

</comment></comment><comment><USER4> If you think you're going to make a custom web solution using Wordpress without training the customers, your project is doomed. That would apply to any site project. Replace WP in your post with whatever software you want and you'll end up with similar conclusions.

</comment><comment><USER5> From an sysadmin POV, Wordpress is awful.

Please don't give the Wordpress project new ideas for ooh-shiny. Please. Just don't do that. Because they already do that _incessantly_ instead of fixing bugs and cleaning up the festering rats nest of code it all staggers forward on.

<comment><AUTHOR> Thanks for your thoughts. I agree that WordPress is very powerful from a sysadmin point of view. I also mention in my article that I'm not necessarily suggesting that things need to be fixed on the back end. However, from a Client front end editing perspective some things need to be made a lot simpler and easier.

Also, there need's to be a way for us as developers to create more complex layouts like 3-Column responsive designs, parallax scrolling sites etc.

I'll be sharing more of my ideas for WordPress and what we as designers/developers can do to help WordPress be a better solution for our Clients over the next several weeks.

I'm interested to hear what some of the code bugs are that need to be worked out.

</comment></comment><comment><AUTHOR> According to Forbes, WordPress powers one of every 6 websites on the Internet, nearly 60 million in all, with 100,000 more popping up each day. But have you ever taken time to think about how WordPress manages content. Not only from an editing perspective but also from a design perspective.

This article has come about from years of experience with WordPress, talking and working with multiple Clients, and even being inspired from other innovative products – like Square. One of the things that really strikes me about Square is that they are so focused on their users. They are focused on completely rethinking how payments are done in order to make them beautiful and easy to use.

Let's think about the WordPress Admin – is it focused on its users; is it easy to use; is it breathtaking? I think we'll all agree that it could use some work in these areas.</comment>


Fabulous: Python library for printing images and fancy text to the terminal - <AUTHOR> http://lobstertech.com/fabulous.html <comment><USER2> This is cool, but I get the feeling it is just a workaround for the broken state of current terminals. Why are they still character based? We have had bitmap displays as long as I have had a computer, but we still emulate text terminals.

There are graphical terminals in programs like Maple and Matlab, and some years ago there was talk of an XML-based terminal, but nothing happens.

Sorry for the rant. I just couldn't help my self.

<comment><USER3> There are some shells like that:

<http://poshconsole.codeplex.com/>

Windows only - WPF based Powershell console.

I think the simple reason is there are better tools for working with graphics. Text terminals were great, and are still immensely productive if you are proficient with the command-set. Even in a full-blown word processor, people have trouble laying out text along with graphics. It would simply turn out to be chaotic I fear.

<comment><USER4> Hmm, I've just tried it. It has potential, but it's very slow and sluggish on my machine (quad).

</comment></comment></comment><comment><USER5> It reminds me the famous libcaca:

<http://caca.zoy.org/wiki/libcaca>

One of my favorite application of the libcaca is neercs:

<http://www.youtube.com/watch?v=sQr42LjaNCY>

</comment><comment><USER6> Lobstertech: I couldn't help but be reminded of the fancy things we did with ANSI graphics in the BBS days. Merging the gif/jpg to ansi converter was very clever. This could make for some interesting terminal programs.

<comment><USER7> yeah this gives me flashbacks to the 80's

</comment></comment><comment><USER8> looks very cool, but running easy_install fabulous on Mac 10.5 installed a broken version. the demo threw some errors and the whole thing blinked and didn't show all the colors. blinking terminal....

might work if i build it myself and sort out the ld dependencies. anyway, still a cool project. not sure i'll ever have use for it...maybe for debug apps.

<comment><USER9> Also Mac's Terminal app is only 16 color.

<comment><USER10> Not if you turn on ANSI color

</comment></comment></comment><comment><USER11> You can also install it via pip:

sudo pip install fabulous</comment>


It's OK - <AUTHOR> https://its-ok.clearleft.com/ <comment><AUTHOR> I think there's even one more point that could be added:

It's OK if you're not being productive outside of work.</comment>


Is Onlive pirating Windows, and what will it cost them? - <AUTHOR> http://www.extremetech.com/gaming/121769-is-onlive-pirating-windows-and-what-will-it-cost-them

<comment><USER2> <http://en.wikipedia.org/wiki/Betteridge%27s_Law_of_Headlines>

</comment><comment><USER3> By contrast, the Register is reporting Microsoft is talking to OnLive and is 'striking a conciliatory note.' [http://www.theregister.co.uk/2012/03/08/microsoft_office_ipa...](http://www.theregister.co.uk/2012/03/08/microsoft_office_ipad_port/)

</comment><comment><USER4> This article is truly speculative linkbait nonsense.

It's better titled: "Do you think a reputable company like OnLive is dumb enough to expose itself to a huge lawsuit?"

Ridiculous.</comment>


YC's Xerox Alto restoration Part 7: disk exerciser trial [video] - <AUTHOR> https://www.youtube.com/watch?v=c0sL_FwPVwM <comment><USER2> I think the really interesting part about all of this is that it is _possible_. You can hook up an oscilloscope and a logic analyzer and really figure out what's going on all the way down to reading the microcode and decoding the signals. You won't be doing that on a modern system.

<comment><USER3> I don't see why it should not be doing that on a modern system. It will just be a lot harder to do (less access, wider busses, much higher frequencies), but possible non the less

<comment><USER2> Ok, practical. An oscilloscope that can probe a high speed bus like PCIe is priced in the same range as a house. Not to mention motherboards are 8-10 layer PCBs, which makes it pretty tough. The high level of integration is also going to make it rather difficult to get inside a lot of the parts and listen in, much less the sheer amount of stuff one person would have to know to understand what is going on from the bottom up is a lot more unreasonable than it is on a relatively primitive machine (architecture wise) like the Alto.

</comment></comment></comment><comment><USER4> Looking through the schematic of the disk controller, it wouldn't surprise me if the bad inverter also ended up causing the parity errors. That one pin ends up affecting error detection, clocking, and addressing of the disk controller, which could very well end up manifesting as the parity errors you're seeing, especially given that your entries suggest that the errors went away once you dead bugged the inverter. Regardless, this is definitely an interesting series and I wish you lots of luck in getting things running.</comment>


Ethereal Email – mail server written in Node.js (IMAP+SMTP) - <AUTHOR> http://demo.ethereal.email/ <comment><USER2> The decision to delete the email on disconnect is interesting.

What happens when there is a temporary network issue?

Might it be more useful to allow a reconnect period before the inbox disappears?

</comment><comment><USER3> GitHub link: [https://github.com/andris9/ethereal- email](https://github.com/andris9/ethereal-email)</comment>


The Day Yahoo Decided I Liked Reading About Child Murder - <AUTHOR> http://www.theatlantic.com/technology/archive/2012/04/the-day-yahoo-decided-i-liked-reading-about-child-murder/255970/ <comment><USER2> The thing about this is that the "Filter Bubble" isn't actually new. It has existed as long as mass-media has. Technology may well be making the phenomenon worse, perhaps to the point of creating something qualitatively different from what has been seen in the past, but anyone who thinks that the media has ever provided an accurate reflection of actual reality is horribly mistaken.

In fact its difficult to see how the media ever could provide such a reflection. Actual reality is very boring, reading about it doesn't interest people, because the brain has its own filters which lead us to only be interested in that which we find new or surprising.

Unfortunately providing people with information which appeals to them (which is what the media has always done, with or without algorithms) will invariably distort their own sense of reality, just as would training a probabilistic model only on outliers.

<comment><USER3> Yes, it happens in traditional media too, albeit more crudely. After all, all of the incentives are already there.

Run stories about rare but terrible crimes -> more people watch your news -> ad revenue goes up -> run more stories about even rarer but more terrible crimes -> even more viewers -> wash, rinse, repeat -> everyone thinks the govt should be "tough on crimes" even though our society is the safest ever.

</comment></comment><comment><USER4> After reading this story, I was curious how much Google News had personalized my homepage after several years of using it as my primary outlet. Somewhat surprisingly, there wasn't any I could find other than things I had told it to do: more "Science" stories, no "Entertainment", a couple custom news alerts, no Huffington Post or Fox News.

The actual stories under each category were identical, other than a few were linked to different sources.

</comment><comment><USER5> The worst thing related to this happened to me just today. Google maps gave me different result for address search. Like the little mark on map was placed on different place than it was when I tried it in private tab (and just to make sure in other browser, also not logged in). It is a really weird thing to do (and dangerous too -- I almost sent a friend on a wrong bus).

The reason why I think this happened is different numbering system. You see, I entered street name, number and city. I meant street number, "normal" google maps showed result using the street number, but when I'm logged in I get result not by street number but rather distrcit number (not sure if I'm translating this right). Really bad behavior in my opinion. Also, there was no note on other results, or did you mean, or anything like that.

</comment><comment><USER6> Something's wrong with the narrative. The author writes, "Going through my search history, I could trace the emergence of stories to the day I read about the Bustamante murder." .

But she didn't use 'search' to get to that article; she just clicked on it on the homepage. So it wouldn't be there in the search history.

<comment><USER7> Probably just a coincidence but Chrome's history page has a "Search history" button.

</comment></comment><comment><USER8> Let's also keep in mind that if true, this is personalization done poorly (for the consumer). Presumably, was no correction in Yahoo's model to consider whether the user liked the content after reading it. The first question here is whether or not the author clicked on more articles leading to more ad views as a result. If so, then it "worked" and made business sense. The second question is whether or not it improved the user's experience, which in this case it obviously did not.</comment>


Why Are Smart People Usually Ugly? - <AUTHOR> http://www.slate.com/articles/health_and_science/explainer/2012/01/are_smart_people_ugly_the_explainer_s_2011_question_of_the_year_.html

<comment><USER2> Terribly headline, great answer.

One explanation of the illusion is that if 10% of people are _really_ smart and 10% of people are _really_ good looking then only 1% of people will be both. Which makes it look like the two don't go together very often, when in fact they go together as often as you'd expect.

</comment><comment><USER3> In society's definition of beauty, for those class of beautiful people (celebrities for instance), they work especially hard at looking beautiful. I would guess a female celebrity spends a lot of effort on her hair and makeup and has a personal trainer, dietician, etc so that she looks beautiful. A "smart" person on the other end of the spectrum I would imagine spends little or no time on "looks" once they get past a certain threshold of neatness and cleanliness because they simply don't care that much about how they look. That's doesn't affect their sense of self worth as much.

</comment><comment><USER4> Actually, beauty and intelligence are positively correlated.

</comment><comment><USER5> They aren't. I am very smart and, of course, stunningly beautiful.

But seriously, surely looks are a very subjective thing?

<comment><USER6> Genetically, looks and brains shouldn't be linked at all and I do believe there is no serious (anti-)correlation here. There are, however some factors dependent on attractiveness that probably influence the personal development of a person to a great deal. For example, I think there is a huge ratio of assholes among beautiful people due to similar processes that inspired the German proverb "money corrupts the character". Along those same lines, good- looking people often don't have to work very hard - so they usually don't enter academic careers, leading to a disproportionate amount of ugly people in academia.

<comment><USER7> """Genetically, looks and brains shouldn't be linked at all and I do believe there is no serious (anti-)correlation here."""

How did that "should not" come about?

How about creatures with worse looks (less attractive to their species), cope up by being smarter to turn sexual selection in their favor?

The notion of "looks" has not just come about in the last century or so, it exists even in totally foreign species, like flowers (attractiveness to bees by features/colors/smell/etc).

And looks have been shown to correlate strongly to sexual selection (from big tits to body fat).

<comment><USER6> Because neither "looks" nor "smarts" are simple real numbers that can be adjusted up and down. It's not like eye color or ear lobe size. Both are complex phenomena with many different parameters, and there is no evidence to suggest that those myriad parameters are linked in a way to suggest worse looks lead to inherently smarter brains. The null hypothesis is that they don't and that's what we should stick with.

On a more anecdotal note, I don't think inheritance is a strong factor for bad looks over many generations (which would be necessary for the kind of adjustment you're describing). Ugly parents can have beautiful children. And stupid people can have smart children, too. There is a genetic predisposition, yes, but the simple mixing of genomes over a few generations seems to be enough to sufficiently randomize a child's outlook.</comment></comment></comment></comment>


Should I give up part of my online identity? - <AUTHOR>

Should one role over part of your online identity because of a companies unfortunate marketing choice?
I took on the moniker e14n (some time before 2009) as it was the shortest representation of my name that wasn't already widely used.  Its a play on the contraction of internationalization to i18n, which has come up a bit in the 10 years I have worked in Japan.
Like a few passive narcissists I have on occasion searched for my various identities online.
Today I received a polite letter asking me if I would consider role over my twitter account.  I am a business owner and I know how much we really struggled with branding so I would really like to help, but a number of issues don't sit well with me.
1. It is likely to confused people because we are both involved in open source, and most of the people following me are connected through this association.
2. I don't think it serves the other company well.  There doesn't seem to be a strong connection with the company (it is being used as a contraction of ephemeralization).
3. Having had to deal with the stupid real name only bs in social networks it really offends me someone trying to take away my nic. <comment><USER2> I don't see why they want it when it would presumably only confuse and provide no benefit to any party, at any point, in any way.

I actually think you'd be doing them a business favor by explaining why (from this fairly brief overview at least) it's a horrible idea.

</comment><comment><USER3> I wouldn't give it up.</comment>


Ask HN: Anyone else getting frequent DNS resolve errors on the web lately? - <AUTHOR> Not a tech support question, just curious if others are seeing this. It seems that lately every 1 out of 5 or 10 requests fails due to a "DNS server address error" according to Chrome. I thought it may have something to do with my setup or connection but I'm hearing from other people at different locations experiencing the same.<p>I'm starting to think that Cloudflare could be the root cause, and since so many sites depend on it a lot of the web suffers from it. Thoughts? <comment><USER2> Well. Check if the auth DNS of said failed domains are served by Cloudflare DNS. And then we go from there.

</comment><comment><USER3> Or it could be your DNS resolver. Try changing it to googles 188.8.131.52 and 126.96.36.199</comment>


Why Use an FPGA Instead of a CPU or GPU? - <AUTHOR> https://blog.esciencecenter.nl/why-use-an-fpga-instead-of-a-cpu-or-gpu-b234cd4f309c <comment><USER2> One clarification on the comment about latency. FPGAs are typically clocked much slower than a modern CPU. Typically, they run somewhere in the low 100's of MHz, whereas an Intel CPU clocks in at around 3GHz last time I went to the Apple Store. With a typical x86 multiply instruction having a latency of about, say, 3 cycles, putting that workload on an FPGA would result in a ~10x slow-down!

The real benefit of an FPGA is that you get to decide what happens in any given cycle. So rather than being able to multiply two numbers in a single cycle like on x86, you could make your FPGA design do, say, 20 multiplications in a single cycle (space allowing). Which means that you can now multiply 20 numbers in 1/10th of the time it would take on x86. (In reality I think you have something like four execution units capable of perfoming parallel ALU operations per cycle, depending on the family.)

So the latency benefit of an FPGA comes from flexible, almost (almost) unbounded potential for parallelism in a given cycle, not clock frequency. Hardware has to be designed to exploit this potential, otherwise it's not going to see any improvement in latency.

Anyways, just something that is maybe obvious once you're told it, but isn't always mentioned in discussions like this. It certainly something that I didn't fully appreciate before getting involved in hardware design.

<comment><USER3> Another thing is that you can pipeline, for example, multiplies. So in a CPU multiply you give the CPU inputs, wait a couple cycles, and then get the result. In an FPGA you can build a pipelined multiply. It's built such that you can feed it input every cycle and get an output every cycle. The only caveat is that the outputs are delayed relative to the inputs. i.e. you may give it (2, 3) to multiply on one cycle, but you won't see the result (6) of that particular input on the output until a couple cycles later.

[Yup, "pipeline" here is the same term used to describe how modern CPUs get their performance. They, too, are pipelining their instruction execution so that many instructions can be in the process of executing at the same time. Though what I describe is a more extreme and specific kind of pipelining.]

This is kind of like having a bunch of multiplies in parallel. But it's useful for, for example, real-time calculations. You get to perform all the calculations you need every single cycle, no matter how complex; your results are just delayed by X cycles. Pipelines are usually also more efficient than straight parallelism (i.e. an 8 deep pipelined multiplier uses less silicon than 8 individual "serial" multiplier units).

Another interesting thing: In a previous life I built an FPGA based video processing device. It sat in an HDMI chain, so it had to be real-time. If that had been built with a GPU, most engineers would build the system to buffer up a frame, perform the processing, and then feed the processed frame out. That results in at least 1 frame of delay. In contrast, because we used an FPGA, it was simple to just pipeline the entire design and thus only needed to buffer up the few lines that we needed. This meant A) we needed no external memory (cheaper) and our latency was on the order of microseconds. In my travels with that job I ran into tons of other companies building video processing devices. They _all_ used frame buffers, which made their devices unacceptable for, e.g., gaming.

<comment><USER4> Thanks.

Just to clarify whilst I have your attention: isn't it a common practice to pipeline frame buffers too? For instance, Android has three frame buffers. IIRC, one is with the user space handing off display lists, one used for composition, and one is used by driver for rasterization?

In that case, how good, you reckon, would the perf be compared to FGPA?

<comment><USER5> by straight having a frame buffer vs having a couple lines buffered, I'd imagine it's still the fpga, except now the GPU needs even more memory to do the same task

</comment></comment></comment></comment><comment><USER6> The author isn't aware apparently of over a decade of work done in FPGA/CPU integration. Both in more sequential languages like System C[1] or in extended instruction set computing like the Stretch[2]. Not to mention the Zynq[3] series where the CPU is right there next to the FPGA fabric.

For "classic" CPUs (aka x86 cpus with a proprietary frontside bus and southbridge bus) it can be challenging to work an FPGA into the flow. But the problem was pretty clear in 2007 in this Altera whitepaper[4] where they postulate that not keeping up with Moore's law means you probably end up specializing the hardware for different workloads.

The tricky bit on these systems is how much effort/time it takes to move data and context between the "main" CPU and the FPGA and then back again (Amdahl's law basically). When the cost of moving the data around is less than the scaling benefit of designing a circuit to do the specific computation, then adding an FPGA is a winning move.

[1] [https://www.xilinx.com/products/design-tools/vivado/prod- adv...](https://www.xilinx.com/products/design-tools/vivado/prod- advantage/rtl-synthesize.html)

[2] [http://www.stretchinc.com/index.php](http://www.stretchinc.com/index.php)

[3] [https://www.xilinx.com/products/silicon-devices/soc/zynq- ult...](https://www.xilinx.com/products/silicon-devices/soc/zynq-ultrascale- mpsoc.html)

[4] [https://www.intel.com/content/dam/altera- www/global/en_US/pd...](https://www.intel.com/content/dam/altera- www/global/en_US/pdfs/literature/wp/wp-01029.pdf)

<comment><USER7>
      >> The tricky bit on these systems is how much effort/time it takes
      >> to move data and context between the "main" CPU and the FPGA and then back again

The sweet spot for FPGAs is when the data is streaming. You can build hardware where the data is passed from one stage to another, and doesn't go to RAM at all. Particularly where the data is coming in fast, but with low resolution (huge FPGA advantage for fixed point instead of floating point).

FGPAs are much more efficient for signal processing from data collected from an A/D converter (e.g. software defined radio) or initial video processing from an image sensor.

<comment><USER8> > The sweet spot for FPGAs is when the data is streaming

Netezza does this with their hardware, I've been dreaming of the day I could DIY and put a OSS RDBMS on top.

</comment></comment></comment><comment><USER9> "Intel does offer an emulator, so testing for correctness does not require this long step, but determining and optimizing performance does require these overnight compile phases."

After some experience with FPGAs, the emulation step is not enough to test for correctness. Most of the problems happen while synchronizing signals with inputs/outputs and with other weird timing problems, glitches and unintuitive behavior that FPGAs provide (and the emulator behaves differently). I was using VHDL however. Anybody has experience with OpenCL on FPGAs to explain what difficulties persist (are the timing problems easier to solve)?

<comment><USER10> There are a number of real issues with the emulation approach even now. Firstly, emulation isn't accurate - if you do floating point math in your application it will give you different results (within the tolerances of the OpenCL spec) on FPGA vs. CPU. So you can't test for correctness in the emulator.

A second more serious issue is that getting performance that justifies using an FPGA requires tuning very carefully to the architecture. This may mean adopting pipeline architectures that destroy emulator performance (there's still issues with the emulator identifying that the design patterns for shift registers in FPGA look like pointer fun on CPU rather than mammoth memcpys). So for a huge part of the design stage the emulator is basically useless- because it tells you nothing about what you care about, since the performance of the emulator is often negatively correlated with performance on FPGA. This is made worse if you're doing hardcore FPGA tricks like mixed precision arithmetic.

As you say though - the fact that timing is lost in the emulator also means you don't get a true idea of whether you have buffer overflows etc or lock-up. Adding debug into the actual design impacts the implementation on FPGA in a way that it doesn't for software - and is sometimes unintuitive.

<comment><USER11> > if you do floating point math in your application it will give you different > results

That seems like a gross weakness in the emulator; floating point isn't actually nondeterministic!

<comment><USER10> Actually it's not as clear cut as you'd expect. Obviously you can't represent every number in floating point, so you have to choose a way to round numbers - and for simple operations like add you can correctly round the results. For transcendental operations like x^y it's actually unknown how many resources you'd need to correctly calculate x^y for every valid value of x and y[1]. So since you can't calculate these numbers to correct rounding, you have to choose a level of rounding for your approximation - like 3 units of least precision rounding at the output. Of course we all need to know how accurate these are - so the OpenCL standard specifies it[2] - exp requires being correct to 3ULPs for single/double and 2ULPs for half.

Now if you have 3 ULP to play with, the maker of an Intel CPU is going to design an exp instruction to best make use of the existing Intel functional units. But an Intel FPGA dev is going to design an exp instruction to best make use of Lookup Tables and 18x18 multiplies - because that's what they have on the FPGA.

So whilst you'll get the same answer for x^y on Intel CPU and Intel FPGA within 3 ULPs those rounding errors are going to be different between the two architectures. So now, if you want to compute a normal distribution on Intel FPGA vs CPU you'll get 3 ULPs in your exponent, but that'll carry forward into the rest of the equation.

So now you have a choice - do you use the built-in function for exp on the Intel CPU - which is OpenCL compliant just like the FPGA, and get unknown rounding errors in what is probably a mathematically sensitive task, or do you emulate the actual sub-operations the FPGA does? In which case your hardy RTL designer who wrote that exponent function RTL is going to have to write an implementation in C that emulates the hardware. Oh and they don't only have to do that for exp - they have to do that for 100s of mathematical functions, and it'll run dog slow on the CPU compared to using the native functions.

[1][https://en.wikipedia.org/wiki/Rounding#Table- maker's_dilemma](https://en.wikipedia.org/wiki/Rounding#Table-maker's_dilemma)

[2][https://www.khronos.org/registry/OpenCL/specs/opencl-2.1-env...](https://www.khronos.org/registry/OpenCL/specs/opencl-2.1-environment.pdf)

<comment><USER12> > do you emulate the actual sub-operations the FPGA does?

Yes. It's an emulator.

> ... is going to have to write an implementation in C that emulates the > hardware.

Makes sense. It's an emulator.

> ... and it'll run dog slow on the CPU compared to using the native > functions.

Isn't that to be expected? It's an emulator. This isn't like games where it just has to look close. If it's a dev tool for testing correctness, exactness matters.

<comment><USER10> Well last time I looked, the answer to question 1 for the Intel OpenCL SDK is actually no.

And while yes, it's expected to be slow compared to the native functions, that's not the problem. It's slow compared to simulation.

</comment></comment></comment></comment></comment></comment><comment><USER13> > The HPC community is already used to GPUs — getting people to switch from > GPUs to FPGAs requires larger benefits.

It's worth pointing out that some scientists haven't even made the leap to CPGPU computing yet and are still relying upon OpenMP / multithreading on general purpose CPUs, even when a GPU would be clearly superior. Anecdotally, I remember hearing that climate science simulations are particularly bad about taking advantage of new architectures for speedups, an assertion which possibly is supported by the fact that climateprediction.net simulations took several days using all 8 cores on my laptop to finish.

Neuroimaging is also pretty bad, since other than Broccoli [0], most toolkits for preparing analyses don't leverage GPUs, even though I'd wager 80% of the steps involved image manipulations / linear algebra.

[0] [https://github.com/wanderine/BROCCOLI](https://github.com/wanderine/BROCCOLI)

<comment><USER14> In my experience, it's true. And it's unlikely to change - the simulation code was largely written in FORTRAN and C over a period of 50 years.

This is in fact what makes Intel Phi so appealing to some.

<comment><USER15> For C/Fortran using LAPACK it _should_ be as simple as relinking. [https://www.olcf.ornl.gov/tutorials/gpu-accelerated- librarie...](https://www.olcf.ornl.gov/tutorials/gpu-accelerated-libraries/)

</comment></comment></comment><comment><USER16> One interesting use case for FPGAs is where hardware qualification is very expensive, for instance for use in space. If a given FPGA is already space qualified, you just need to load new code onto it and you can skip the expensive qualification step for your new application. You can also consolidate functionality of multiple chips into that one qualified FPGA.

<comment> irq-1 The expense for space is producing RAD Hard parts. (The designs are done on the same FPGA then a few RAD Hard chips are made.)

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

</comment></comment><comment><USER17> I've always thought FPGAs would be perfect to have hardware backed video decoding/encoding that could adapt to new codecs (like vp9) while also being updatable for new performance improving discoveries.

It also seemed like it would go well with a generic radio subsystem, so you could compile hardware support for new wireless standards that come out after your hardware did (essentially an fpga sdr).

It seems like there could be lots of uses for being able to on demand enable hardware acceleration for certain tasks a program might need lots of.

<comment><USER18> FPGAs are indeed commonly used for SDR as well. Ettus has a range of USRPs with FPGAs on-board, and you can find readily available IP cores for anything from Bluetooth to DVB-S.

<comment><USER17> That's partially where I got my inspiration.

Seems like it integrated properly it could be a great component in a general purpose PC to future proof it against changing needs and requirements

</comment></comment></comment><comment><USER19> Does anyone have experience of Reconfigure.io [1] and their toolchain that transpiles Go for execution on FPGAs [2]? I am curious how it feels from the developer perspective, how it works in practice, and what types of applications it is a good fit for.

[1] [https://reconfigure.io](https://reconfigure.io)

[2] [http://docs.reconfigure.io/overview.html](http://docs.reconfigure.io/overview.html)

<comment><USER20> Unless you have optimized your code as much as possible to run on x86 or GPU and still find that you need a prohibitively expensive amount of processing power to accomplish the task, then and only then is an FPGA worth it.

It is literally a DIY CPU architecture. So, unless you know exactly what it is about your current CPU's architecture that is holding you back, you won't be able to benefit from an FPGA-based design.

</comment></comment><comment><USER21> I doubt that programming efficiency is what's holding back FPGA's for general compute.

Why ? because we've seen decades of research in this area - so at least we have some tools(c for fpga isn't ideal, but still...), and a lot of the general mapping between what algorithms should be in FPGA.

And Amazon FPGA's instance exist for over a year.

So in that time, if there worth while services to offer with FPGA's, people would have offered them, or at least started. And sure programming complexity is a barrier. but entrepreneurs and VC's love competitive barriers. So where's all this VC funding going towards this area ? Where are all those startups ?

<comment><USER2> I disagree. FPGA design remains a highly-specialized area. Tools such as VivadoHLS, and other high-level synthesis tools, do provide some improvement in productivity though with inherent tradeoffs in design quality. There's been a lot of new hardware construction language popping up recently (e.g., HardCaml--which I happen to use, Chisel, Migen, PyMTL, etc.). They may bring something to the table in the coming years, but that's yet to be determined.

HardCaml's pretty great though, IMHO. But then again I'm already biased towards OCaml, and I get to work with its creator!

</comment></comment><comment><USER22> Aren't FPGA's used mostly to test/design a circuit that you would then go on to actually fabricate/build? I could be wrong but I thought FPGA's were stateless (meaning if they powered off/reboot you loose everything and have to set it up from scratch again).

<comment><USER23> That is incorrect, or at least inaccurate, on both counts.

FPGAs are often used to test/design not a "circuit" but an ASIC (application- specific-integrated-circuit) that you will then go on to actually build. Or, if your application doesn't have volume to suppprt the ASIC engineering costs but can support the FPGA unit cost, you just leave it as an FPGA. There are millions of devices (industrial machines, research, testing, etc) where this makes sense.

And not all FPGAs loose state when powered down. For those that do, there's typically an easy way to hook up a little Flash chip and bootloader to reload the state automatically on reset. For those that don't have that option (EG, currently working with an ABB robot, Mecco laser, and Rockwell PLC which all contain FPGAs, only the Mecco can boot itself), you store state in battery- backed SRAM and just leave the RAM on at all times.

<comment><USER24> > FPGAs are often used to test/design not a "circuit" but an ASIC > (application-specific-integrated-circuit)

To be pedantic, an ASIC (and any IC really) is a circuit, as denoted by the "C" standing for "circuit".

</comment></comment></comment><comment><USER25> "...programming FPGAs is still an order of magnitude more difficult than programming instruction based systems." True statement. If you're offloading computation from a CPU, profile your application first, and determine if the FPGA board's architecture will allow you to improve performance. Don't underestimate the cost of communicating data to/from the FPGA/CPU.

</comment><comment><USER26> Is there high performance FPGA that does not depend on proprietary bloated windows-only toolchain?

<comment><USER27> Proprietary and bloated yes, but I believe both Xilinx and Altera both have software available for Linux, or am I wrong? At least I used Altera's suite on Linux once for a pilot project.

<comment><USER28> I have used Xilinx's toolchain on Linux, though it was hard to get working. This was a few years ago.

<comment><USER29> They support Ubuntu now. Setup was just as easy as windows for me.

</comment></comment></comment></comment><comment><USER30> For those wanting to play around with an FPGA, this looks quite interesting: [https://www.sparkfun.com/products/14829](https://www.sparkfun.com/products/14829)

It's about half the price of the other FPGAs I've seen commonly used for hobbyist projects [1], doesn't need any separate programmer board to interface to your computer for programming, and has an open source tool chain available.

I've not played with it, as it just showed up in a mailing from Sparkfun about new products.

[1] such as [https://www.sparkfun.com/products/11953](https://www.sparkfun.com/products/11953)

</comment><comment><USER31> I'm surprised he doesn't talk much about direct cost (rather than engineering cost). A decent FPGA developer kit will cost several thousands of US$, more expensive even than high end GPUs.

<comment><USER32> You can buy this dev board to play around with and learn FPGA for $75, and it has extensive documentation and resources to help you

[https://www.sparkfun.com/products/11953](https://www.sparkfun.com/products/11953)

<comment><USER31> But that's not a high performance FPGA. Believe me, I have a ton of FPGAs at home (starting even cheaper than that), and I write about them all the time: [https://rwmj.wordpress.com/?s=fpga](https://rwmj.wordpress.com/?s=fpga)

However if you're doing the sort of work which isn't just hobbyist stuff, you're going to spend 1000s on a board. This is the sort of thing commercial developers will be using: [https://www.xilinx.com/products/boards-and- kits/ek-v7-vc707-...](https://www.xilinx.com/products/boards-and- kits/ek-v7-vc707-g.html)

<comment><USER32> If you're building a commercial product, a 3k dev board sounds incredibly cheap. My company spends orders of magnitudes more on licenses for an IDE extension (resharper).

<comment><USER31> Absolutely. However I guess you'll also want to deploy your FPGA application at some point, which means buying FPGAs for all your servers too. So the cost is more analogous to the cost of a CPU/GPU than to the cost of an IDE/developer license.

</comment></comment></comment></comment></comment><comment><USER33> Another FPGA sweet spot is analyzing TB/PB-scale databases. Netezza programmed FPGAs to uncompress, project, restrict (including NULLs), enforce isolation & visibility and check CRCs at disk scan rates (>200MB/sec). When touching a handful of columns from a 20-200 column table, CPUs spend most of their time stalled on cache line misses. FPGA-projecting just those few columns into memory enormously increases cache hit rates.

<comment><USER34> Plain C code can readily scan at a couple GB/sec on an ordinary Intel core, and NVME drives can transfer 8 or 16GB/sec

</comment></comment><comment><USER35> Is it just me, or does this article seem like it's trying really hard to push Intel? For an article about FPGAs, failing to acknowledge the other (major) player in the market-there's no mention of Xilinx anywhere in the article, while plenty of Intel/Altera-seems disingenuous. Really, the tone just seemed to stick out to me as an subtle advertisement piece; maybe it's just me?

</comment><comment><USER36> Is there a pipeline to compile tensorflow computation graphs to fpga? seems like this is one possible benefit of Tensorflow's fixed graphs, that they may be much easier to compile to fpga then other options

Edit: Seems like some experimental work is being done with XLA (and llvm) [https://www.google.ca/amp/s/www.nextplatform.com/2018/07/24/...](https://www.google.ca/amp/s/www.nextplatform.com/2018/07/24/clearing- the-tensorflow-to-fpga-path/amp/)

</comment><comment><USER37> How long does it take to "program" a FPGA? i.e. compared with typing a command, and having it load into memory.

What about a JIT that compiles hot code sections to FPGA? (Though compilation sounds too slow)

EDIT "one or two seconds or at least 100's of milliseconds." [https://electronics.stackexchange.com/questions/212069/how-l...](https://electronics.stackexchange.com/questions/212069/how- long-to-program-a-fpga-seconds-microseconds-less)

</comment><comment><USER38> > An exception to the rule that GPUs require a host is the NVidia Jetson, but > this is not a high-end GPU

Well, the host is just on the same die, but it's still there

</comment><comment><USER39> One reason could be to meet real-time constraints or to get predictable timing. This is becoming more and more difficult to do with modern CPUs for all sorts of reasons.

</comment><comment><USER40> "A couple of FPGAs in mid-air (probably)"

</comment><comment><USER41> I would love to see projects like MAME and MESS targeting FPGA hardware for near-perfect hardware emulation of classic hardware.

<comment><USER42> The Anologue Super Nt project uses an FPGA to run SNES cartridges unemulated.

[https://www.analogue.co/pages/super-nt/](https://www.analogue.co/pages/super- nt/)

<comment><USER41> But it is not Open Source. There are more commercial products using FPGA's for emulating gaming console hardware.

</comment></comment></comment><comment><USER43> What are some cool jobs for FPGA experts besides Intel and Military? It seems like there's not much availability.

<comment><USER44> I recently spoke to someone at Broadcom who was moving networking processes from software to hardware using them, try looking into similar companies.

</comment></comment><comment><USER45> Why does the compilation take hours, is this an NP Hard problem?

<comment><USER46> If my memory of a Processor Design course is correct, arranging the desired functionality onto the finite resources of an actual FPGA chip, let alone in such a way as to get good performance (i.e. have critical paths be as short as possible), reduces to bin-packing.

<comment><USER47> The answer might be obvious, but I'm not a hardware guy: couldn't they use a FPGA to do the compilation itself, or at least the bin-packing part? Is there a way to code a general SAT-solver in FPGA?

</comment></comment></comment><comment><USER48> Whats that for?</comment>


Floors on Losses - <AUTHOR> http://www.nytimes.com/2008/03/21/opinion/21fri1.html?ex=1206763200&en=10308e72469a983d&ei=5070&emc=eta1

<comment><AUTHOR> Politics aside, there's an idea I like in here:

"Bankers operate under a system that provides stellar rewards when the investment strategies do well yet puts a floor on their losses when they go bad."

The market that is available to mere mortals two sorts of bets: buying long and buying short. Most people do the former, because you can only lose as much as you put in: there's a floor on your losses.

But some folks buy short, in which case you can lose a whole lot more than you put in.

Do folks have ideas of how to constructed (financial) executive compensation to reflect a similar "buying short" reward matrix?</comment>


An awesome list of developers to follow and learn from - <AUTHOR> https://github.com/douglascorrea/awesome-developers <comment><USER2> This should really be called "Directory of Awesome Developers' _Github Repositories_ ".

(I was immediately struck by the absence of Brian Kernighan, Dennis Ritchie, etc. from the C list.)

<comment><AUTHOR> We can insert any other source of knowledge from the developers (Site, twitter, blog, etc). I will add Brian Kernighan and Dennis Ritchie on C list, but please feel free to make a PR.

<comment><AUTHOR> Done

</comment></comment></comment><comment><AUTHOR> I changed the layout now it is not only for the ones that have github profile (=</comment>


Show HN: run-after - <AUTHOR> https://github.com/azer/run-after

<comment><USER2> So it's a limited (buggy?) version of "at"? What's the use case for this? A demonstration of "english-time"?</comment>


Java Inner Classes - Under The Hood   - nerds-central http://nerds-central.blogspot.com/2011/04/java-inner-classes-under-hood.html Ever wondered how inner classes actually work in Java rather than all that theory in the books. Here the inner workings are explained in simple terms. <comment><AUTHOR> So that is how they work. What else can se find out by looking at the byte output of javac?

<comment> nerds-central Just ask a question and I am happy to take a look. I found this an interesting area because the approach 'under the hood' seems a bit 'hacky' but it does work. Java generics are even more strange... [http://nerds- central.blogspot.com/2011/04/java-type-erasure-...](http://nerds- central.blogspot.com/2011/04/java-type-erasure-what-pile-of-bollocks.html)</comment></comment>


Announcing Git Kata - <AUTHOR> https://dev.to/slashgear_/announcing-git-kata-np0 <comment><USER2> Antoine, this is superficial (I didn't look into the kata right now) but you should go over the text once more :

> The basis was known but in practice.

> Very often users know how to manage but do rather obscure things.

> Often users know how to manage but do rather obscure things.

Also, AFAIK « trublion » is 100% french (but it's a nice word).</comment>


Olli, a 3D printed, self-driving minibus, to hit the road in US - <AUTHOR> http://phys.org/news/2016-06-olli-3d-self-driving-minibus-road.html <comment><USER2> What would be the raw printing costs for this in materials? What wouldn't be printed, or what % would be printed? - Educated guesses welcome in the absence of any released figures</comment>


New York Police Department is beta-testing Google Glass - <AUTHOR> http://venturebeat.com/2014/02/05/nypd-google-glass/

<comment><USER2> This technology will need to be shut down by the courts or laws very quickly else there will be no privacy. Already police departs have cars with many cameras on their trunks all aimed in different directions to scan license plates. They look for out of date tags, owners who may have warrants, and more.

Just imagine this technology changed to also do the same with faces. The claims of course will be just like the NSA, its just random sampling and therefor not a violation.

1984 just had to wait for technology to catch up</comment>


Ubuntu Touch: First look at the Linux smartphone OS - <AUTHOR> http://www.networkworld.com/slideshow/105180/ubuntu-touch-first-look-at-the-linux-smartphone-os.html

<comment><USER2> I don't want to sound too cynical, but I don't yet see anything that makes a case for this new mobile platform to me.

The iPhone got me excited for a reinvention of mobile ui.

Reading about andrioid's ideas tickled the architecture nerd in me so hard I was on board even when it still looked like a jacked-up blackberry.

Ubuntu phone looks like an also-ran, Canonical's attempt to get some of that sweet sweet app store revenue. That's fine; it's just not a case for adoption of the platform.

It took android a long time to finally hit its stride, and that wasn't for doing all the things that excited me about the platform, it was the commoditization of a luxury. Windows Phone is struggling, is there room in the market for another platform to enter this marketplace?

There are interesting aspects to the Ubuntu phone, but without any big selling point I wonder if they're not better suited just getting rolled into Android proper. Canonical has had widely varying degrees of success when they make hard breaks from the current opensource answer for something (and plenty of dragons lurk down the tailored-android approach too). I hope it works out for them because Ubuntu is an important force in opensource and I'd hate to see Canonical die out.

</comment><comment><USER3> Ubuntu needs to ditch the Orange Brown colour. Its the most disgusting thing about Ubuntu. Can't believe they're using it on their Mobile OS.

<comment><USER4> That's a tired point to make, especially since it's not relevant anymore. Ubuntu ditched the brown a while back, and the orange definitely makes it stand out compared to its competitors.

<comment><USER3> Based on the screen shots in the link, the orange/brown looks terrible. A lot of the screens look really nice and clean and I like them, hit that orange, BAM its hideous.

</comment></comment></comment><comment><USER5> The drive to create more Linux-based mobile handset is a very good thing. It's going to benefit Linux distributions by driving a focus on design, and a consensus on UI toolkits.

However, nobody seems to be looking at what gave Android a big technology advantage even back when Android was a design ugly duckling: A common managed language runtime for apps and OS middleware.</comment>


Why your wife should be 27% smarter than you  - <AUTHOR> http://news.cnet.com/8301-17852_3-10463132-71.html <comment><USER2> Link to actual paper: <http://papers.ssrn.com/sol3/papers.cfm?abstract_id=1102378>

EDIT: This must be an early version of the paper, or the linked article is substantially overstating its conclusions. (Is there a student on HN who can get free access to the published version?) I don't even see a metric for intelligence, other than a binary high/low.

<comment><USER3> The one "good" thing about this paper is that they don't even try to defend the arbitrariness of their model. Absolutely not "robust".

EDIT: The copy I looked through was the published one. <http://dx.doi.org/10.1016/j.ejor.2009.06.009>

</comment></comment><comment><USER4> > "your wife should have a college degree, and you should not"

I don't think college degree == more intelligence, but I'm for the 5 years younger and same cultural background concepts.

<comment><USER5> Hell, as I age I'm for the "10 years younger" concept.

Call me in five years and I'll discuss the virtue of "15 years younger".

<comment><USER4> In a nutshell, your perfect wife is always 20-25 no matter what's your age :P

</comment></comment></comment><comment><USER6> Ahh, the glories of scientific research, reinforcing useless bias since 1989. This is why I got into this racket.

</comment><comment><USER7> Ugh.... when <http://news.ycombinator.com/item?id=1236686> was posted it was as a joke. This guy seems to be taking papers like that at face value.

</comment><comment><USER8> One more reason I wish PG would implement a vote-down function.</comment>