VoodooJS – Mix 2D and 3D content on the same page - <AUTHOR> http://www.voodoojs.com

<comment><USER2> "U.S. Patent Pending." \-- wasn't expecting to see that on a JS lib.

<comment><USER3> Yes, especially coming from a library built on top of three.js [1], which is a gigantic and awesome piece of work licensed under MIT, using Twitter Bootstrap (Apache License), and a logo free for non commercial use only [2]. But everyone can do what he wants with his work, as long as licenses are respected.

A question for the author: this is a really cool demo, but I can't see where is the innovation which needs protection here? A parallax effect when the user scrolls? 3D on a Web page? The "Next Generation Internet" concept?

[1] [http://threejs.org/](http://threejs.org/)

[2] [http://findicons.com/icon/33154/mask_02?id=33154](http://findicons.com/icon/33154/mask_02?id=33154)

<comment><USER4> The patent thing, the licensing uncertainty, the use of public libraries and the somewhat overly enthusiastic comments here on HN (most from <300 accounts) give me a very weird taste in my mouth.

<comment><USER5> I'm sorry to hear that. Point taken. My focus for Voodoo has always been about creating a great framework to fix a problem and make the web better. Legally, I am edging on the conservative side for now because I want to make sure the correct steps are taken for it to succeed. So I'm listening to everything everyone is saying and I plan to seek advice/mentoring as well. It's still early.

bpierre, good questions. I'll come back to answer them in a bit. Have to catch up on a little work.

<comment><USER3> Thank you!

<comment><USER5> Basically yes, I believe there are some novel ideas here worth patenting. Specifically, the unified coordinate system between 2D and 3D, and the methods of implementing it (here by using a virtual camera to align 3D coordinates with pixels and sandwiching the 2D page with fullscreen canvases). To date, I don't believe this idea has been suggested anywhere else, and while it might seem obvious in hindsight, it took many late nights of experimenting developing it. There was no promise that the research would pay off or the end result would even work. You should see the early prototypes.

Also, you're right. Voodoo needs a different logo.

<comment><USER4> > Basically yes, I believe there are some novel ideas here worth patenting.

Analogous to what Stallman once coined, you are now literally talking about patenting ideas[0].

> To date, I don't believe this idea has been suggested anywhere else, and > while it might seem obvious in hindsight, it took many late nights of > experimenting developing it.

> There was no promise that the research would pay off or the end result would > even work.

Aka every single software that is a little more daring than standard CRUD. Are you seriously suggesting that a patent is the only way to be properly compensated for your work?

Might I suggest a different route? How about you release what you have there the same way all those libraries you base your work on were released. Trust me, they are full of research that nobody knew would pay off, with things that seem obvious in hindsight, but took many, MANY late nights of experimenting.

If what you're saying is true and your "novel ideas" and the solutions you've found really are that valuable, then there is an incredible trove of respect and admiration waiting for you. (And if you're smart, you will find ways to convert that into "making a living".) You'd be robbing yourself of a huge community (again, the same community that you are currently _using_ \- bootstrap, jquery, threejs, modernizer etc.) cheering you on, respecting you in the same way that you might have felt using those other public libraries.

The only thing you see at the moment is that you _have something_ and you imagine that the thing you have should be the thing that pays your bills, directly. So you have decided to close it down as much as you possibly can (and, judging from the use of public, floss libraries, it's debatable how much you actually can). I'm telling you there is another way. You could be "the library" for people mixing 2D and 3D.

The path you're on right now only leads to one of two things: First, you're going to go closed-source. Then somebody else will write a floss "the library". Then you get angry and lawyer up. Then you realize that only the US and a handful of other countries is idiotic enough to allow for patents on software. Then you realize that trying to "go legal" is probably pointless. Here, you are at a crossroads: On one side is the path I'm telling you to go now, you're then just five years behind on where you could be now and somebody else has earned all the admiration and respect. On the other side is an old and bitter man, clutching his wallet.

[0] [http://www.gnu.org/philosophy/software-literary- patents.html](http://www.gnu.org/philosophy/software-literary-patents.html)

<comment><USER5> This is very compelling. I've echoed many of these same thoughts.

Growing a community has always been the goal, and that's true --- it would be the same community as ThreeJs, Modernizr, etc. That's a very good argument to make it OSS.

And the positive acknowledgement the past 48 hours has been wonderful and incredibly motivating. Far more than I expected.

Hmm... let me let this sink in for a day. Thank you.

</comment></comment></comment></comment></comment></comment></comment></comment><comment><USER6> The main page eats all my GPU to the point it's almost impossible to scroll (macbook air 2013). Shouldn't take so much resources for such a simple page.

<comment><USER7> I'm on a Macbook Air 2013 and have no issue. Currently using Chrome.

</comment></comment><comment><USER5> Author here. Thanks everyone. It's all still a work in progress and I'm listening to everyone's feedback.

</comment><comment><USER8> The tree looks cool. If this catches on I might finally buy a 3d monitor just to browse the web ;)

<comment><USER9> It really does look cool. I could really imagine that this would catch on. It's gimmickry, but unlike almost any other 3D effect on a webpage, it's not annoying.

</comment></comment><comment><USER10> Very impressive and inspiring to think about new possibilities: games, interfaces, data visualizations ... And works fine on my netbook. Now there's hope that we won't be dominated by flat design ;)

</comment><comment><USER11> This is great work. An earlier demo page from the same author is at [http://www.threedeeify.com/](http://www.threedeeify.com/) (VoodooJS is a much better name)

Looks like the 3d layers are running in full-page canvas overlays and the Three.js camera is positioned according to the page scroll. Clever work! Must have some kind of positioning logic to match up the models to DOM elements (like the ring around the quote)

Wish it was not closed-source, so we could learn from it a bit, or contribute. But author is free to do with it what he wishes...

<comment><USER5> Essentially yes. There's also some tweaking the CSS pointer-events property on those canvases to allow mouse events to fall through when you're not hovered over 3D content.

I envision most people will want to position their 3D objects relative to some 2D element like a div.

</comment></comment><comment><USER12> This reminds of the emphasis Apple is putting on depth in iOS 7 interface.

Lots of interesting things to be done with this sort of tech.

</comment><comment><USER13> Such a great name. To me as a front-end dev, this truly is black magic.</comment>


Repository of Cocoa objects for iOS & Mac OS X - <AUTHOR> http://cocoaobjects.com/ A great little website providing links & summary descriptions of Open Source code you can use in your iOS and Mac OS X projects. <comment><USER2> upvoted because I can easily see myself using this for all sorts of applications in the future. Thanks!</comment>


Canada Tech Startups Winners as Morneau Backs Off Options Plan - <AUTHOR> http://www.bloomberg.com/news/articles/2016-03-22/canada-tech-startups-winners-as-morneau-backs-off-options-plan <comment><USER2> To provide some background for non-Canadians: Rather than having entirely separate rates, capital gains in Canada are taxed as "half income" based on the normal tax brackets. So if you earn $X of regular salary and I earn no salary but make a capital gain of $2X (or if I earn $X/2 salary and make a capital gain of $X) then we pay the same amount of income tax.

If you buy a stock option, it ends up resulting in a capital gain or loss; either you dispose of the option and directly produce a capital gain or loss, or you exercise the option and it counts towards the book value of the shares you acquire, resulting in a capital gain/loss later.

The tax treatment of _incentive_ stock options is weird, because they don't consider you to "own" the options in question. So instead of getting a capital gain as the stock option gained value, you're considered to be paid the ultimate value of the stock option as "earned" income. People realized this was dumb, so a rule was put in place to "fix" this: Incentive stock options would be 50% tax-exempt, bringing them down to the capital gains tax rate.

The issue at hand here was whether that "fix" should be removed, limited, or left intact. Right now inventive stock options receive the same net tax treatment (via a different route) as purchased stock options; the proposal was to tax employees at a higher rate than investors.

If this proposal had passed, it wouldn't have yielded any significant increase in tax revenues, since there was a simple workaround: Rather than granting stock options to employees, pay them a small bonus and then have them buy the stock options from you. The lawyers would have made plenty of money drawing up the paperwork, but nobody else would have benefited.

[I am neither a tax lawyer nor an accountant. This is not legal or tax advice.]

</comment><comment><USER3> I benefit from Canada's favourable option plan, but it is still bullshit. These tax loopholes are how a VP of Marketing at an obviously going-to-be- successful company like Shopify makes $1m / year while only paying half the top marginal tax rate.

Even more if they are clever. I'm not sure if they've closed the loophole but you used to be able to max out their TFSA by exercising their options, claiming the share certificates, then putting them into their brokerage account before the Series A is closed. It only costs $500 / year at RBC to do this you / your family just can't ever own 10% of the stock in question and it is completely legal. Then when your $40k of shares grows to $4m after the IPO you have a perpetual tax free investment account.

But these tricks are nothing new. Businesses have all the flexibility in the tax code. The only year I was in the 1% in terms of income I paid an effective tax rate of 12%, and this wasn't because I qualified for the capital gains exemption tax when my business was acquired (the business wasn't was too young, your business needs to be at least 2 years old to qualify).

Investment income should be taxed the same as normal income with one caveat: losses should decrease normal income and should be _after_ inflation. Right now the biggest pushback I hear (that I think is legitimate) to raising the capital gains / dividends rate is about inflation; which makes sense for 4% blue chip bonds, but falls apart on 40% yoy options that are more like deferred income plans than they are investment schemes.

Edit: Downvote me all you want. People disagree with things that challenge situations that are good for them.

<comment><USER2> You can't put shares into your TFSA if you don't operate at arm's length from the company. And if you're operating at arm's length from a company yet are able to predict which shares are going to increase in value, you should be running a VC fund.

<comment><USER3> You at the very least can once you're leaving the company, which were the circumstances of someone I know who has done this. Even if you are right (I can't quickly find a good definition for "Arms length" as it relates to non-C level employees) it doesn't materially change my point that people in our position pay substantially less tax than people in the medical or legal profession.

Whether it's bulk asset sales and dividends, or Hong Kong holding companies and tax treaties, or capital gains exemption to "retain top talent" if Canadians actually knew how it worked 90% of the time they would never stand for it.

<comment><USER2> _You at the very least can once you 're leaving the company, which were the circumstances of someone I know who has done this._

Sure. But then you have to put in the shares (or options) at their _fare market value_ , which is going to be pretty high if there's an IPO on the horizon.

<comment><USER3> Fair point. Although I still feel the way we value startups (at the last funding event) warps decision making greatly. The person I knew did this with a company about 6 months before they raised their next round. So the company was valued at around $15m for 2.5 years, person invests, then BAM company valued at $45m on year 3 6 months later. And I think if you're in a company that is really going to make it you know. Especially if you've been in startups for a while.

<comment><USER2> _the way we value startups (at the last funding event)_

That may be how you value startups, but I guarantee you that if the CRA looks closely it's not how _they_ would value the shares on the eve of a deal which values the shares much higher.

<comment><USER3> My experience is that short of being 60 days before a deal the CRA generally accepts the previous funding round as the valuation. I agree that the actual eve of the deal wouldn't fly though.

</comment></comment></comment></comment></comment></comment></comment><comment><USER4> While nerve racking, this ended up being quite civil. A party proposed a tax plan, the community gave great feedback, and they revised. Thanks to Tobi, OMERS and everyone who spoke up.

<comment><USER5> But they were only going to raise them for options worth more than $100k right? Other than people "winning the lottery", and C-level staff, how many startup employees would be affected by this? My understanding is that comp packages above $100k are much rarer in Canada than in the US?

<comment><USER2> _Other than people "winning the lottery", and C-level staff, how many startup employees would be affected by this?_

I'm guessing not many, but that's not really the point. The possibility of "winning the lottery" is very important for startup recruiting.

<comment><USER5> Right, and I can see your point above about the change being pointless because it's so easy to work around ISOs!</comment></comment></comment></comment>


The researcher programmer, a new species? - <AUTHOR> http://elazungu.wordpress.com/2012/03/26/the-researcher-programmer-a-new-species/

<comment><USER2> I prefer quantitative researcher myself.

</comment><comment><USER3> Not a new species, an old species. Remember, laboratories were producing research code before even IBM hired its first "software engineer".</comment>


Zach Braff, Amanda Palmer, and the New 90-9-1 Rule - <AUTHOR> http://dlewis.net/blog/2013/04/27/zach-braff-amanda-palmer-and-the-new-90-9-1-rule-the-indifferent-the-haters-and-the-ones-who-love-you/

<comment><USER2> I seem to recall that the Amanda Palmer backlash less to do with her being popular and more to do with her raising a huge sum of money for an album and tour, then expecting background musicians to work for free because she was popular - and that was just the latest in a line of ethically dubious things she's done.

<comment><USER3> The story I read said that she invited local musicians who happened to be fans on stage with her.

<comment><USER4> Correct, which is insanely cool. It's like a design contest - if an organization crowdsources all of their design work it is tacky and offensive, but having a rare or occasional contest is a great way to get talented fans involved.

<comment><USER5> Except it wasn't an amateur contest, or even a contest; they just chose the best professional musicians they could to back them up.

<comment><USER6> No, she hired and paid a band of professional musicians, who toured with her. She _also_ invited fans in each city to play with them on stage.

</comment></comment></comment></comment></comment><comment><USER7> This happens a lot in the game industry kickstarters. The most money usually goes to a large studio or a famous game designer appealing to his fans.

Examples: Ragnar Torquist's The Longest Journey sequel, Richard Garriott's kickstarter, Double Fine Adeventure by Tim Schafer, Project Eternity, Planescape: Torment spiritual sequel... there's a lot of them.

Ultimately, both sides have a point. It is a tad disingenous for the elite in a specific genre to ask for money upfront from crowdsourcing, because they could have gotten that money elsewhere. On the other hand, we shouldn't deny them the chance of starting the kickstarter -- and once they start it, their large fanbase can usually be counted on to pitch in enough.

As for you and me, dear reader, we should do as always -- vote with our wallets and support interesting and sometimes risky projects which wouldn't get the money any other way.

<comment><USER8> People are worried about bigger projects muscling out smaller ones in the same category, but for now, this isn't what's happening. High-profile campaigns are instead still creating the market for smaller ones.

Kickstarter has some basic analytics so creators can see where backers are coming from, and for small campaigns, most backers are like you, people who go to Kickstarter looking for new and interesting projects. But the blockbusters brought most people to Kickstarter in the first place, not the long tail.

</comment></comment><comment><USER9> Here's my own statistically questionable 90-9-1 theory of creativity to explain why the backlash exists.

\- 90% of wannabe creatives lack the talent, vision or focus to actually see their idea though \- 9% of wannabe creatives have the talent, vision and focus but lack money or the ability to connect with traditional financial backers. They're the people Kickstarter was created for. \- 1% of people have talent, money and connections in abundance but see Kickstarter as a free way to get better publicity and collect more of the profit.

You can't really _blame_ a multimillionaire for keeping their cash and equity in a movie project and offering their fans unspecified extras roles not guaranteed to make the final cut in return for a few thousand dollars, but it doesn't mean we have to admire them for doing so.

</comment><comment><USER10> "The point is that you don't need a whole lot of people to participate in order to create something pretty impressive. That's how Wikipedia became the behemoth it is today."

I'm not sure that's true. <http://www.aaronsw.com/weblog/whowriteswikipedia>

<comment><AUTHOR> Interesting. Wikipedia shows about 50k active editors (5+ edits) for any given month in 2006 -- I didn't keep the URL, but that's pretty much right. I didn't realize how much output the "9%" yielded.

</comment></comment><comment><USER11> That's one aspect of Kickstarter that never made sense to me -- why is there no way to take an "equity" stake? For the sums of money involved relative to the total kickstarter (oftentimes you see targets at roughly 1% of the target amount to be raised), I would think that some of the tiers should get some sort of stake.

<comment><USER12> The legal mechanisms behind such an operation (essentially you're selling shares of the company/organization, after all) are prohibitively complex.

<comment><USER13> And apparently, people are willing to pay even without the creators having to give up equity. So even if that option legally existed today, why would they?

<comment><USER14> It's certainly true that _some_ people are willing to pay. I consider myself a person who's primed for contributing to a kickstarter, and yet I've never pulled the trigger on one because it doesn't meet my minimum criteria for investing, which is a monetary return. I imagine I'm not the only person who feels this way, and to open up that option to people only brings more money to projects

<comment><USER15> Do you consider any time you spend money as an "investment"?

</comment></comment></comment></comment></comment><comment><USER16> I get the feeling that these backlashes are mostly about no longer having "control" over the creative minority via money and media-exploitation.

Especially in the case of Amanda Palmer none of these people bitching about her had ever heard of her before and don't care about her work.

People just don't seem to like the idea that those "artsy types" can now get money to do their thing without having to whore themselves out to the entertainment industry and the media, and to the larger public by way of the latter.

<comment><USER17> No, the palmer backlash stems more from the naive hubris she exhibits in everything, from her ted talk to her refusing to pay professional musicians on her tour and the dodgy accounting for the money she made on kickstarter.

</comment></comment><comment><USER18> What is of interest to me in this crowdfunding of celebrity projects is that it gives the impression that crowdfunding could be a way to "solve" the general issue of content only coming from a select few media outlets without it actually doing so. Without the popularity - gained by being part of those initial big-media enterprises - of some of the stars that are able to draw in that funding, there's no similarly easy way for a good grassroots project to get the level of funding they would need for a competitive project.

I equate popular people/companies using Kickstarter to promote and fund their next project to retailers selling products directly on eBay. Yeah, it's viable, has long since drowned out the small guy with something useful to sell, which seemed like the whole point of eBay to me.

<comment><USER19> One of the major problems with specifically web-based television and movies is that they just aren't delivering the revenue that conventional media can, by a huge margin. One of the reasons why such projects are possible at all today is that the creators call in a lot of favors from their friends (actors, editors, techs, etc.) and get them to work at minimal rates. But that's not a very sustainable model.

Perhaps with crowd funding projects that then release in more conventional ways (e.g. DVD, netflix, etc.) it'll be possible to solve both ends of this problem. It'll be interesting to see how everything works out.

Anyway, I've been surprised at the absence of anyone trying to either coopt the popularity of web video and such-like or to try to make money on it as a business partner. For example, why isn't there a production studio which concentrates on crowd funded movies? It took Zach Braff seeing the popularity of the Veronica Mars kickstarter to have the idea to do the same thing, imagine if there was a group out there catering to artists with projects they want to fund. Apply a little bit of polish, experience with how to formulate a good kickstarter campaign, select reward levels appropriately, help with fulfillment, help with legal issues, help with distribution, take a cut of the profits.

<comment><USER20> _why isn't there a production studio which concentrates on crowd funded movies?_

What you're describing is a movie producer, and as these appear in the Kickstarter space - as they are apparently doing now - I'd expect them to be essentially the same people that have been producing movies for the previous century.

The "conventional media", which is to say "the media", have the cameras and the lights. They have the theater-chain contracts and the distribution contracts. They have the agents' phone numbers and the union contracts and the favorite-son politicians and the sound stages within driving distance of your favorite actor's home. They know how to advertise and they have the lawyers and accountants.

And today's movie producers have connections to all of these things. Acquiring these connections is the hard part. Learning to put up a Kickstarter campaign is easy by comparison.

Kickstarter can change the shape of the "development" phase of movies, by giving producers (and writers or actors who want to self-produce) an alternative source of seed money and a way to cheaply drum up and demonstrate fan enthusiasm in advance of the product. But it will swiftly be incorporated into the existing media infrastructure, just as, say, the San Diego Comicon was.

</comment></comment></comment><comment><USER21> This article was written by someone who has no understanding of basic accounting, let alone movie industry or television industry accounting.

For example: _There's a HUGE amount of upside here. That's why Garden State grossed $35 million at the box office. Or, put another way: if 350,000 people see this movie in theaters, at $10 a ticket, that's $3.5 million — 10% of what Garden State made. If Braff gets $2 per ticket, that's $700,000 right to him. Wow! ↩_

There is no way that Braff got $2 a ticket. At $10/ticket, that represents 20% of the top-line grosses (i.e., before expenses and the theater's take), and would represent almost 50% or more of the _studio's_ receipts on the film at today's prices. (When Garden State came out, ticket prices were $2-$3 less, so the alleged $2/ticket amount would be even more obscene. ) Theaters typically receive 1/2 of the ticket amount in the first week or two, and an increasing amount each week thereafter to incentivize theatrical longevity.

Studios then divy up the remainder, taking their share and expenses first out of such earnings. (Actors and directors are generally paid their salaries at the onset of the project and would normally be treated as an expense for the studio to recoup).

Some actors are able to negotiate a portion of the net proceeds, and receive those in the unlikely and rare event that the movie company with which they contracted shows a profit. More preferable, but infinitely more unlikely, is for a star to negotiate a portion of the _gross_ proceeds (i.e., before the Hollywood accounting kicks in). Zach Braff has never been a big enough star to get that sort of arrangement--that's the sort of deal that even Tom Cruise and Will Smith would be hard-pressed to achieve without serious salary concessions --most actors only ever achieve a portion of the gross if they _forgo_ their salary and participate in principal financing.

<comment><AUTHOR> Braff owns all rights to _this_ movie. He _is_ the studio.

I never said he got $2/ticket from Garden State.

</comment></comment><comment><USER19> It seems like much of the "backlash" comes down to speculation based on bad information and a generally negative attitude about "the rich".

If you use google it'll tell you that Zach Braff is worth over $20 million. Where does that come from? No clue, it might just be speculation, but it's out there. A lie with its pants on, to paraphrase Mark Twain. In his reddit AMA he specifically refuted the notion that he was worth anywhere near that amount. According to wikipedia, most of the time Scrubs was merely a top 100 show, it seems safe to say that Braff never had the opportunity to negotiate upwards on his contract and overall lifetime royalties from the show are not as impressive as some folks imagine.

More importantly, I think the assumption is that the kickstarter is the only funding for the project, though Braff has also stated publicly that he is kicking in a lot of his own personal funds.

There have been many times where I've seen widespread accusations of a "massive cash grab", either related to kickstarter campaigns or elsewhere, and most of the time it's so hilariously wrong it's just sad.

I'm not sure whether this stems from a poor understanding of business fundamentals, meaningless hatred of people who are successful, or something else.

<comment><USER22> The $20 million figure is not based on nothing there's a lot of public information about how much Braff made from scrubs (e.g. $350k per episode in the 2007-2008 season.)

The fact is he doesn't need this Kickstarter to make this movie, he COULD do it himself. But he doesn't want to risk ONLY his own money. So he's taking advantage of the public.

<comment><USER19> Right, the season that was 11 episodes? At best that accounts for about $2 million after taxes, assuming his agent takes nothing and without taking into account any expenses. Where's the rest?

Scrubs may be a popular show among a certain cohort, it may be highly acclaimed, and it may be quite popular in syndication, but people tend to forget that while it was running it had mediocre ratings and it was effectively cancelled twice.

You have no clue how much money he has, your accusation that he's "taking advantage of the public" is just baseless libel.

<comment><USER22> That's $2.5 million before taxes, agents, etc. _for one season out of 9_ and not including syndication money or the fact that his previous movie made $35 million box office plus DVD sales, etc.

Give me a break with this horseshit. The dude obviously has many, many millions of dollars.

</comment></comment></comment></comment><comment><USER23> Off topic, but I would love a tool that corrects awkward sentences / mistakes that authors, who don't read their articles, make.

 _A small fraction of them (1% of the 1%) will be fund the creation of the content,[...]_

I'm not even talking about grammar or word order preferences. I just mean the errors you could catch if you read through what you wrote for 5 minutes before posting.

<comment><AUTHOR> Corrected. Thanks.

<comment><USER23> Thanks, Dan. That came off more angry than I intended upon re-reading what I said.

<comment><AUTHOR> Hah, no worries.

</comment></comment></comment></comment><comment><USER24> Financial matters aside, the 'free' press that comes from being a celebrity running a kickstarter campaign is quite valuable. Even if it's false indie cred, people will actively talk about this project before it's created and also as it progresses to the target and begins shooting.

For campaigns like this I don't think the founder's financial status is even a question we should be asking.

<comment><AUTHOR> Sure, but that's only because this is new.

</comment></comment><comment><USER25> On one forum, I've noticed that the amount of posts in a thread is usually about 10 times less than the amount of views it gets.</comment>


Dream Job Interrupted: Is the Job of the Future Creating an Unhappy Generation? - <AUTHOR> https://email@example.com/dream-job-interrupted-is-the-job-of-the-future-creating-an-unsatisfied-generation-7ca170dacb07#.uq0u3zxl0 <comment><USER2> Go to India. Have mind blown.

Come back, boot up laptop.

Ask. Why? I'll be dead in a few decades.

Close laptop.

Go to Goa.

Find cool hacker babe from Oslo.

Take drugs.

Watch Sunrise.

Open up laptop.

Wow, new framework.

Drop GF.

Head back to Jersey.

Say, "well at least I did it!"

:-)</comment>


Ask HN: Are you doing async programming with Python? - <AUTHOR> If yes, what are you building, and what's your opinion of async Python? <comment><USER2> Bit of an unconstructice rant, but this always bothered me: Async is the nail in the coffin of The Zen of Python.[1]

Open a python REPL, type:

      >>> import this

_…_

 _There should be one—and preferably only one—obvious way to do it_

 _…_

It has not been true for years. Python 3 especially, took a sledgehammer to that ole poem.

See [http://journal.stuffwithstuff.com/2015/02/01/what-color- is-y...](http://journal.stuffwithstuff.com/2015/02/01/what-color-is-your- function/) which is about this effect. I am reminded of that blog post every single time I work with async in Python :/

[1] [https://www.python.org/dev/peps/pep-0020/](https://www.python.org/dev/peps/pep-0020/)

<comment><USER3> The story of "import this": [https://www.wefearchange.org/2010/06/import-this- and-zen-of-...](https://www.wefearchange.org/2010/06/import-this-and-zen-of- python.html)

<comment><USER4> There's also:

from __future__ import braces

and

import antigravity

</comment></comment></comment><comment><USER5> I've been writing web apps using Tornado since 2013 and that has been an excellent experience.

But I'm not sure if I have the same opinion of asyncio. To be honest, I don't even know if I understand it completely. There are so many concepts and IMHO they're not really intuitive, so it's difficult to put pieces together and find out how those individual concepts relate to each other or work with each other.

On the surface it looks simple, but it's really like going down a rabbit hole. The more I try to understand it, the more I agree with Armin Ronacher's article on asyncio [1].

[1]: [http://lucumr.pocoo.org/2016/10/30/i-dont-understand- asyncio...](http://lucumr.pocoo.org/2016/10/30/i-dont-understand-asyncio/)

</comment><comment><USER6> Yes - and it was great fun!

There was a post on HN that was asking about real-world examples of asyncio code that wasn't `asncio.sleep()`. I think my project is pretty good example for that - and a strange example too because it involved a lot of hardware interfaces.

I've been meaning to open-source the project ever since we axed it. I was the only real programmer on the job, so I'm itching for feedback on it. So if anyone's interested I'll post it here.

I had actually written it 3 times over. First as raw socket server, then in twisted, then on top of asyncio.

So yes, asyncio is a bit of a mess. It's documentation is a bit odd and I have several gripes. What helped we was realising that there was an 'async way' and an 'callback way' to everything in asyncio. So not mixing the two together and ignoring the callback parts really _really_ helped.

I don't know if this is true, but I recall reading somewhere that asyncio was not designed with coroutines initially and this explains the dual-personality of the library. I can't find any evidence that asyncio existed before 3.3, so I can't back that up.

<comment><USER7> I would be interested in seeing and reviewing your asyncio work gwillz! I have a small (750 sloc) network service implemented with asyncio and ran into some design problems around modularly handling healthchecking, exception handling/monitoring, and auto recovery/restart. I was unable to find much in the way of large software written with asyncio to learn better patterns from, so ended up with what, to me, feel like mediocre solutions. My email is in my profile.

</comment></comment><comment><USER8> Yes, and it is...not great. It's generally fine as far as the language goes (considering it's a retrofit), but the builtin asyncio library is not the way to go in my opinion. trio is _far_ better for just aping a lot of the Erlang way of things.

But even then it's hard to debug, or work out ideas in the REPL, testing is a bit more complex than it should have to be, etc. There are probably better languages to reach for (I'd love to see rust firm up a one true way of async).

<comment><USER9> FWIW, I was at a talk by an asyncio core developer at EuroPython and he said they are looking very closely at how to improve the asyncio API in upcoming 3.8/3.9 releases. In particular, looking at good ideas they can pull in from libraries such as trio.

Maybe Python 4 will mark a maturing of asyncio?

</comment></comment><comment> petr-k Yes, and it has been a good experience so far. Mostly we've been doing applications involving several RabbitMQ producers/consumers, a HTTP server and database access here and there. It relies on the fact that there already are asyncio-enabled libraries for the particular technologies we routinely use.

Note that our use case might be different to many in this thread - in contrast to HTTP, we write mainly event-driven message-oriented applications. It is often practical to have e.g. multiple different consumers within one process - without async, we'd need to resort to threads which brings a plethora of new problems. Async Python does offer a good solution for this.

That said, there are a lot of places where async could be improved.

Language-wise it's pretty okay, but the asyncio library contains too many concepts (some perhaps introduced historically and now deprecated) and the docs aren't doing very good job explaining those. IO loop management could be simplified and some of the related functions should have different, better names. Error messages and stack traces could also be better when async is involved. As far as testing goes, pytest-asyncio could also enjoy some love.

But overall, no major complaints. Few catches aside, it works pretty much the same as in C# or JavaScript syntax-wise, which is what you would expect from this approach to asynchronous programming.

</comment><comment><USER10> You might want to ask this question over at [https://github.com/home- assistant/home-assistant](https://github.com/home-assistant/home-assistant). They have been porting most of their codebase from threads and such to Python3 async over the past months/years. I'm sure the've hit almost all corners of async doing that.

I did some small contributions for HA components and didn't have to get deep into async just yet, but my general feeling is that it is less 'natural' that async programming in a language like Go. But Go has the bigger advantage is was born with async in mind, so it doesn't lag behind that much with 3rd party libraries support like Python does.

</comment><comment><USER11> Honestly, no. Despite all the supposed advantages of async, I haven't found a use for it. When it comes to web apps a nginx + uwsgi + a sync framework is an unbeatable combination. The only times I have used async were when I made website scrapers and telegram bots for And if I was to scrape websites now, I would just use scrapy. My favorite telegram bot framework is synchronous too.

<comment><USER5> There are some use cases in web programming. For example, if a request handler (view, in Django's terminology) is in turn calling out some external endpoints, you don't want those external requests to block other requests to your API. For things like those, async is actually quite nice.

<comment><USER12> You can mix asynchronous code with Django?

<comment><USER13> You kick off an async task in celery or use some other way to keep track of it. Then return a key, and have your front end poll for status

</comment></comment></comment></comment><comment><USER14> Yes, in [https://apility.io](https://apility.io) all the backend services, API endpoints at the edge and parsing services take 'advantage' of async in Python >3.

My opinion is -like somebody said- it breaks the Zen of Python. When I started using it I had doubts about moving to a more async 'friendly' language. But I decided to stick with my old friend Python... even when I don't recognize him very much after some changes after version 3.

</comment><comment><USER15> Yeah I'm using it plenty for web services where I've got a concurrent app but most data processing is done upstream.

It's pretty easy to get started with and with the new keywords simple enough to teach. The testing story is a bit horrible due to how coroutines work though, having to create asynchronous True and False when patching returns for example is a pain.

</comment><comment><USER16> Using it for what you might describe as API proxies (take requests, fetch a bunch of other APIs, combine/transform their results to a different format, deliver to client). Works for that case well, but it's admittedly basically the perfect application for it.

</comment><comment><USER17> Yes.

Can not really tell what I am working on, but so far I am more or less happy with it.

It is not as simple as advertised though ("just use async/await"). In order to write stable, performant applications you have to understand more or less the underlying mechanisms of asyncio (what are tasks/futures, how does their lifecycle work). Then there are quite a few things which work not as expected and you have to understand them as well (e.g. exception handling). If you get into the nitty-gritty details you will have a good experience with asyncio. If you don't you better stay away from it or you will have a hard time.

Performance wise it seems pretty good so far btw.. Did not really hit its limit yet though.

</comment><comment><USER18> I'm a beginner with python as my first language.

I used it to write an arbitrage trading bot. I learned python and asyncio just for this, and it is working as intended.

Asyncio with aiohttp is used to capture price data from 4 websockets and handle requests to exchanges via their APIs.

Python was easy to learn with "learning python the hard way", asyncio was also easy to learn thanks to lots of available material online, and it looked less confusing than threading.

Again, speaking as a beginner, I quite like asyncio because to me it looks just like synchronous code. To me it's easier to think about and keep track of the control flow and shared data than with threading.

Asyncio looked like the easiest and fastest way to accomplish my goal, and it worked.

</comment><comment><USER19> We had a couple services in Twisted. Aptly named. It was a big reason I've enjoyed Go so much.

One was an in-house DB abstraction/API that handled multiple DB hosts, read/write query routing, connection pooling, query queueing, metrics, and more. The other was a link forwarding service that took encoded links, decoded and tracked them and their metadata, and forwarded the user.

</comment><comment><USER20> Yes, we are using it to build a set of system configuration and monitoring daemons, controlled through D-Bus.

It's okay, it can be a a little confusing at first but worth the time investment required to understand it. The API has been improved with all of the recent 3.x dot releases. The new run command in 3.7 should make it a lot easier for folks to get started.

</comment><comment><USER21> I have implemented the Raft algorithm with asyncio. Although this was an academic exercise and I would choose something else for real world usage, I was pleasantly surprised with the performance: [https://github.com/simonacca/zatt](https://github.com/simonacca/zatt)

</comment><comment><USER22> A lot of machine learning datasets only include metadata with a link to the original source (e.g., a full resolution image which might be too wasteful to include with the dataset).

So the first step is to write a crawler and async is a really fast way to do that because everything is network IO bounded.

</comment><comment><USER23> Async programming in python? yes, as part of distributing parameter finding for genetic algorithms and backtesting.

Does it use 'asyncio'? Nope.

</comment><comment><USER24> I would if there was an async sql server driver... Thread pools don't cut it.

I don't have my hopes high for this one though.

</comment><comment><USER25> Check out the asphalt project if you'd like to give a native asyncio framework a try.

</comment><comment><USER26> I love python but if I wanted a fast async app, I would prefer to write it in go with goroutines. I don't like the async programming style where every function involved in the logic chain has to be async. Goroutines with channels are just nicer.

Python is awesome for a lot of things but go really shines for async style programs.</comment>


Ask HN: In Palo Alto for the week (first time), any suggestions/meetup? - <AUTHOR>

I'm in Palo Alto for the week. I'm here from today until Thursday afternoon. Does anyone have any good suggestions for food/drinks/etc in the evening or lunch? Also, would anyone want to meetup? I'm a UI/front-end designer (https://twitter.com/bluetidepro) and would love to meet people while I'm here for work (I work at Angie's List). Always enjoy meeting new people and making new connections. I'm staying at a place I found on Airbnb and I'm right off the Stanford campus.<p>Thanks! -Zach <comment><USER2> Tamarine ($$$): <http://www.yelp.com/biz/tamarine-palo-alto>

NOLA: <http://www.yelp.com/biz/nola-restaurant-and-bar-palo-alto>

La Bodeguita: <http://www.yelp.com/biz/la-bodeguita-del-medio-palo-alto> Good arroz con pollo.

Jin Sho (Steve Jobs' favorite restaurant): <http://www.yelp.com/biz/jin-sho- palo-alto>

Palo Alto Creamery: <http://www.yelp.com/biz/palo-alto-creamery-palo-alto-2>

Jing Jing: [http://www.yelp.com/biz/jing-jing-szechwan-hunan-gourmet- pal...](http://www.yelp.com/biz/jing-jing-szechwan-hunan-gourmet-palo-alto-2) Salty/Savory/Spicy Chinese food. Not high class... but Stanford's CS department is known to order large quantities of food from here (for research group meetings).

Taipan ($$$): <http://www.yelp.com/biz/taipan-palo-alto> If you want classier Chinese food (and tasty dimsum), go here instead of Jing Jing.

Ike's Place Sandwiches: <http://www.yelp.com/biz/ikes-place-stanford-3> This is on the Stanford campus (in the Huang engineering building), and the lines are long. The sandwiches are great!

Gelato Classico: <http://www.yelp.com/biz/gelato-classico-palo-alto>

Cafe Venetia, Philz Coffee, and Coupa Café

Red Rock Coffee in Mountain View <http://www.yelp.com/biz/red-rock-coffee-co- mountain-view> Lots of hackers hang out upstairs. It's one block from the Castro Caltrain station.

Enjoy your visit!

<comment><USER3> Seconded on the food recommendations, and I'd also recommend Oren's Hummus: <http://www.yelp.com/biz/orens-hummus-shop-palo-alto> .

</comment></comment><comment><USER4> I'd suggest the Computer History museum - Great institution, worth checking out for the selection of books in the Gift Shop alone! ;)

PG wrote up a list a few years back, you can also check that out. <http://www.paulgraham.com/seesv.html>

<comment><AUTHOR> Great suggestion! I will definitely check that out. And thanks for the PG post link, lots of good info in there too!

<comment><USER5> It's closed Monday & Tuesday. (Turns out that I had plenty of time Monday and Tuesday to visit, but everything else filled up; wish I'd thought to look that up)

</comment></comment></comment><comment><USER5> While you're in Mountain View to check out the Computer History Museum, check out Hacker Dojo, and try and find a contact at Google to feed you (their campus is a wonderland).

Meetup.com worked out great for finding ways to fill up those awkward spaces in between events and attractions.</comment>


Have We Really Wiped Out 60 Percent of Animals? - <AUTHOR> https://slashdot.org/story/347944 <comment><USER2> Secondary source.</comment>


Ask HN: Best Laptop for Gaming? - <AUTHOR> Any suggestions under 1k? <comment><USER2> Not a direct answer.

If you're willing to wait, Nvidia is launching their 7nm Ampere line of cards likely in the middle of this year [1].

[1] [https://hothardware.com/news/nvidia-7nm-ampere-gpu-tipped- gt...](https://hothardware.com/news/nvidia-7nm-ampere-gpu-tipped- gtc-2020-what-we-know)

</comment><comment><USER3> New Ryzen 7 4800H + GPU are coming soon, supposedly best for less</comment>


Animo.farm: Request yet uninvented products and services - <AUTHOR> https://animo.farm <comment><USER2> I'd like to see all the postings, not only the "latest", but it doesn't seem possible.

<comment><AUTHOR> As the service has just started, atm 'latest' shows all the postings. As soon as the list grows, more display options will be added.</comment></comment>


Needs More Whitespace - <AUTHOR> http://boxofchocolates.ca/archives/2009/10/11/needs-more-whitespace/

<comment><USER2> Interesting metaphor -- whitespace separating the elements of one's day (and life), i.e. don't crowd your schedule.</comment>


Developers Shouldn't Have Access to The Operating System - <AUTHOR> http://bretthard.in/2012/12/dont-give-developers-access-to-the-operating-system/#.UMpYQHPjn3w <comment><USER2> Users can download and install native apps, written in C/C++ (or even assembler) which can access the OS with impunity. Given that, I'm not seeing how exposing more OS level functionality up through the browser is such a big deal.

And some low level functionality _is_ crucial (or at least damn important) for certain types of apps. What sounds like a "bad idea" to me, is to indiscriminately rule out entire classes of applications because something bad might happen.

<comment><AUTHOR> I should be more clear. The scary thing is having malicious sites exploit the functionality. URI overflow attacks and Gifar attacks can be exploited at the website level. Exposing this functionality to the developers is unnecessary. If a developer wants to run as a native application, then they should. Not run as a chrome plugin pretending to be a native application.

</comment></comment><comment><USER3> The important thing is the ability of the _user_ to differentiate between the local system and sandboxed internet content. Dancing pigs notwithstanding, a big part of desktop security still relies on the assumption that the legitimate user will refuse to authorize malicious content when they have all the information they need to recognize it.

So blurring the lines between browser sandboxed content and desktop applications _will_ decrease security. Anyone remember the MSIE desktop integration debate?

</comment><comment><USER4> Couldn't disagree more. Any sufficiently advanced platform will give developers the ability to do potentially dangerous things.

How will Google manage this risk? The same way Apple does with the app store. Google will act as gatekeeper for downloading and installing packaged apps via the Chrome Web Store.

Is this perfect? No. Will some bad apps get through? Yes. But the security tradeoff is worth it to get apps that are more powerful and more useful.</comment>


Ask HN: What do REAL programmers use for full-text searching? - <AUTHOR>

What's the best solution for someone writing a large/small scale application to use for text-searching. At the moment, I'm using SQLite and PHP in a CGI environment.
The problem is that this creates some interesting tasks to solve. I can cache search results, but thats against what I want (no cache, but still fast).
The problem comes down to pagination for me; I want to support an admin searching 1000 users for the string "duck" and coming up with "dicktracy1023" and "DucksRock"
Right now I'm using PHP's String Distance but it runs through my full database in order to. is there a better way? <comment><USER2> ElasticSearch/Lucene is pretty cool

<http://www.elasticsearch.org/>

"Lucene supports fuzzy searches based on the Levenshtein Distance, or Edit Distance algorithm. To do a fuzzy search use the tilde, "~", symbol at the end of a Single word."

[http://lucene.apache.org/java/2_4_0/queryparsersyntax.html#F...](http://lucene.apache.org/java/2_4_0/queryparsersyntax.html#Fuzzy%20Searches)

<comment><USER3> <http://framework.zend.com/manual/en/zend.search.lucene.html>

Lucene port in php.

</comment></comment><comment><USER4> Real programmers use grep.</comment>


Show HN: Organized Wonder - <AUTHOR> http://www.organizedwonder.com/

<comment><USER2> "Follow people you admire and share your wonders with others." (from <http://www.organizedwonder.com/>)

You keep using that word. I wonder if it means what you think it means.

</comment><comment><USER3> Very cool. I'm a huge fan of this kind of content and the design is just beautiful.

</comment><comment><USER4> This is great. One request: make video times visible from the listing page.

</comment><comment><USER5> Some great feedback, thanks everyone.

@koglerjs — I understand where you're coming from. The goal of Organized Wonder is to 1) share the videos that you find interesting and 2) Follow people who share similar interests as you so you can watch what they're watching. #2 is where some of the quality control is going to come in, although I realize this isn't as obvious yet since we just launched the beta 3 days ago, and so a lot of the functionality is still waiting to be implemented.

@wcarss — This definitely something we're working on adding.

\- Sawyer, Founder of Organized wonder

</comment><comment><USER6> Cant read the titles properly which is off putting since i cant determine fully what the video is about without clicking on it.

<comment><USER7> Hover your mouse over the titles...

</comment></comment><comment><USER8> loving it. signing up and hoping it grows with great content. rss/json feed for saves please (so we can grab it and embed in blogs and stuff)

</comment><comment><USER9> Love the design!

</comment><comment><USER10> Successful sharing sites are highly democratized, which means in some sense catering to the lowest common denominator.

Put another way, you need volume to gain any traction.

Reddit has a lot of crap because it has a lot of volume: but as a sharing site it has mechanisms to let people en masse filter the crap for the gems. Such as they are, in a place like /r/adviceanimals.

HN has a fair amount of quality because it caters to a very specific crowd and it self-moderates much more mercilessly than reddit; but it still has to deal with the problem of crap.

Upvotes are highly visible. Stories fail. Anyone can say anything. The crap and the site's system for reacting to it makes the process of content gaining traction _demonstrably valid_ to a visitor to the site.

If none of this is immediately obvious in your sharing site, I don't expect it to gain the critical mass it needs for success.

(You might think TED is a counter-example in the Wonderful Videos domain, but the obvious difference is that TED is a content provider, not a sharing site.)

Edit: And you've got the social bubble virus, in that your 'social network' requires people to once again set a glorified address book in order to really leverage your resources. You're too specific for people to want to spend a lot of time cultivating!

Was it really that long ago that "Build a social network for {{x}}" was regarded as a bad idea?

<comment><USER11> > Was it really that long ago that "Build a social network for {{x}}" was > regarded as a bad idea?

I understood everything else you said, but I'm unsure what you mean by this. Could you explain?

<comment><USER10> I have this vague memory that investors or startup advisors used to laugh at any startup idea along the lines of "We want to build a social network, but for florists!"--and that seems to have receded in the last year.

<comment><USER12> The difference is that the new niche social networks are centered around selling stuff rather than making money from ads. Niche networks can't get big enough to make money from ads. They can get plenty big enough to sell stuff though.

<comment><USER10> This site doesn't sell stuff.</comment></comment></comment></comment></comment>


NYC to Allow Indoor Dining in Restaurants at 25 Percent Capacity - <AUTHOR> https://www.nytimes.com/2020/09/09/nyregion/indoor-dining-coronavirus.html <comment><USER2> Indoor dining can resume in NY on Sept. 30

* 25% occupancy limit

* All patrons must have temperature checked at door

* One member of each party will be required to provide restaurant with contact info for tracing if needed

* No service after midnight

* No bar service

* Masks must be worn when not seated at a table; tables must be 6 feet apart

* Strict adherence to all State-issued guidance

* Enhanced air filtration, ventilation, and purification standards

[https://twitter.com/NYGovCuomo/status/1303744894658371587?s=...](https://twitter.com/NYGovCuomo/status/1303744894658371587?s=20)</comment>


How much does it cost to build a website like hunter io? - <AUTHOR> How much does it cost to build a website like hunter io? <comment><USER2> Its not a website, its a business.

<comment><AUTHOR> ok, how estimate this business ?</comment></comment>


Cautiously Optimistic About Cisco's New Android-based Tablet - <AUTHOR> http://www.itworld.com/open-source/112584/cautiously-optimistic-about-ciscos-new-android-based-tablet <comment><USER2> The thing is -- Apple can toss something out with nothing but a "customers- will-buy-this-just-because-it's-so-cool" marketing plan -- and customers _will_ buy it, just because it's so cool.

No other manufacturer can do this.

Cisco is trying to sell a hamstrung, not-quite-an-iPad at considerable markup. Won't work.</comment>


Immediate Mode GUI - <AUTHOR> http://behindthepixels.io/IMGUI/ <comment><USER3> Oh no, not again! (Just kidding :) )

Immediate mode UIs come up every now and then, especially in games, and for relatively simple things they're a neat idea (imagine not retaining any extra view state!) But - and there's a big _" but"_ coming up - it does not scale to complex and stateful UIs.

The problem is that, for games that have complex needs - think simulation and strategy games, not racing or arcade - complex UIs are needed to express complex relationships between underlying data and the relevant UX flows. But how do you do that in IMGUI? This information about UI state, layout, etc. is not in the UI anymore, but it has to live _somewhere_ \- so you end up having to build _your own_ layout and UI management stuff, and basically duplicate what a RMGUI library would offer, but now with less generality and potentially more bugs.

For the probably best known example, Unity used to have an IMGUI [1] but they've actively moved away from it. It's still there in vestigial form, the API is not removed, but game developers don't really use it.

[1] [https://docs.unity3d.com/Manual/GUIScriptingGuide.html](https://docs.unity3d.com/Manual/GUIScriptingGuide.html)

PS. And there's also the lack of visual layout tools, which is directly related to IMGUI's reliance on code to produce layout.

<comment><USER4> > For the probably best known example, Unity used to have an IMGUI [1] but > they've actively moved away from it. It's still there in vestigial form, the > API is not removed, but game developers don't really use it.

It's true that the newer retained mode GUI has supplanted the older IMGUI for "game UI" (e.g. what users interact with when playing an actual game built with Unity). On the other hand, the Unity editor itself is still built entirely with their immediate-mode GUI library, and I haven't heard of any plan to move away from that. Building "editor-like" tools (including custom user tools) is still significantly easier to accomplish using immediate-mode libraries.

<comment><USER3> Oh, they're switching to RMGUI in the editor as well, though more slowly. More info here:

[https://blogs.unity3d.com/2019/04/23/whats-new-with- uielemen...](https://blogs.unity3d.com/2019/04/23/whats-new-with-uielements- in-2019-1/)

</comment></comment></comment><comment><AUTHOR> TLDR;

Typically we build GUIs using event driven callbacks. This causes problems in managing life times, dynamic layouts, threading issues etc. The idea behind immediate mode GUI is that you get a frame and in each frame you create/update layout, check for user actions - just like you do in render frame in game loop. So there are no call backs and you don't have to worry about issues arising from event-driven code.

<comment><USER5> Does this pretty-much rule out (without a huge amount of effort) nonmodal GUIs? It seems without callbacks, you would need to roll your own window management, Z-ordering of overlapping UI elements, state transition validation (e.g. clicking on the parent dialogue's Cancel button while a child window is still open), ...

<comment><USER6> Here's an browser demo for dear imgui ([https://github.com/ocornut/imgui](https://github.com/ocornut/imgui)) library:

[https://pbrfrat.com/post/imgui_in_browser.html](https://pbrfrat.com/post/imgui_in_browser.html)

For modal demo check "Popups & modal windows" -> "Modals" example.

This is how it looks in C++ code: [https://github.com/ocornut/imgui/blob/master/imgui_demo.cpp#...](https://github.com/ocornut/imgui/blob/master/imgui_demo.cpp#L2273)

<comment><USER7> Here's another

[https://greggman.github.io/doodles/glfw-imgui/out/glfw- imgui...](https://greggman.github.io/doodles/glfw-imgui/out/glfw-imgui.html)

In the "ImGUI Demo" window start expanding the collapsed items or from the menus pick "Examples"

Note that no effort has been spent to actually make the demo web browser friendly so there are rough edges.

</comment></comment></comment></comment><comment><USER8> Note to authors: please define your terms when you first use them, or provide links to the definitions.

Of course I know what a GUI is. I've been building them for decades, and building tools that other developers have used to build GUIs. (I was one of the authors of the "visual" part of Visual Basic.)

But I have never before seen the terms "immediate mode GUI" or "retained mode GUI". And I'm pretty sure there are many developers like me who will have no idea what you're talking about. It takes only a moment to add a quick definition or a link the first time you mention a specialized term, and your readers will definitely appreciate it. Thanks!

(Edited to remove fluff and make the essential point more clear.)

<comment><USER7> What a rude comment. It's not a specialized term. It's a common term. Immediate mode GUI as a concept is well known. Tens of thousands of programmers use Immediate Mode GUIs. There are several well known Immediate Mode GUI libraries used by tens of thousands of projects.

When I don't know a term I google it. I don't assume the entire world revolves around me and that it's the author job to make their article more verbose because everyone reading it might not know every term.

Here's are galleries of some from one of the more popular libraries

[https://github.com/ocornut/imgui/issues/2265](https://github.com/ocornut/imgui/issues/2265) [https://github.com/ocornut/imgui/issues/1902](https://github.com/ocornut/imgui/issues/1902) [https://github.com/ocornut/imgui/issues/1607](https://github.com/ocornut/imgui/issues/1607) [https://github.com/ocornut/imgui/issues/1269](https://github.com/ocornut/imgui/issues/1269)

<comment><USER9> I don't think it's rude at all. I did Google "immediate mode GUI" after reading the first paragraph, because I also didn't know what it meant. The first three results were a Wikipedia snippet which didn't help my understanding at all, a Gist that begins with "Before you continue, if you don't know what IMGUI is don't bother reading this", and then third result was this HN comments section.

I would argue that "immediate mode GUI" is an extremely specialised term.

<comment><USER10> Specialised enough that I didn't come across it during my years of work on Qt. Work that included reading all the manuals, style guides and UI books we could get hold of.

<comment> loup-vaillant > _Specialised enough that I didn 't come across it during my years of work on > Qt._

Of course you didn't, Qt is retained.

It's a bit like imperative programming vs functional programming. Before functional programming gained any significant traction, imperative programming was just "programming".

<comment><USER10> _Of course_ I didn't? I filled a wall with the books I bought and didn't come across the term. What did I do wrong, what books could I have bought but didn't?

<comment> loup-vaillant How many of those books weren't about the mainstream GUI toolkits (Qt, GTK, MFC, Cocoa, Swing…)? Has even _one_ of those books described something that resemble "let's redraw everything every frame"? If so, how that technique was called?

> _what books could I have bought but didn 't?_

Possibly none at all. Immediate mode _anything_ is mostly a game dev thing, and what happens in game dev tends to stay in game dev. They don't seem to document their practices as much as other fields do.

Hence my suspicion that the authors of your books didn't even know about IMGUI. They just knew about "the" way to do GUI, which happens to involved retained state.

<comment><USER10> You're letting the tail wag the dog. You're assuming that people know terms that are used in "possibly none [no books] at all", or put differently, that the set of terms used in books for software developers is uncorrelated with the set of terms software developers may be assumed to know.

BTW, the code in Qt that draws rotated/sheared text/pixmaps was influenced in part by a book or chapter by Michael Abrash, as well as by articles in either Graphics Gems or conference papers (memory's fallible I'm afraid).

</comment></comment></comment></comment></comment></comment></comment></comment><comment><USER11> _Some also argue that executing UI logic of every widget is wasteful. This might indeed be a concern when implemented poorly_

For a game, which is already quite busy even when "idle" (and there are probably other things going on in each frame which take far more CPU and GPU to render), it won't be much of a concern; but with an application where most of the time is spent waiting for user input, spinning the CPU to re-render the GUI every frame is very energy-inefficient.

<comment><USER12> I don't think that an imgui app will eat more resources than a comparable electron app.

Thus the Performance Argument against any IMGUI is pretty pointless.

<comment><USER13> I disagree. With all downsides of electron, it does not generally re-layout and re-render entire screen on any mouse move. IMGUI does.

So while Electron will lose in memory/disk used, IMGUI will lose in CPU usage (battery life) once the software is complex enough.

<comment><USER7> I disagree with your disagreement :)

Electron (and nearly all retained mode GUIs) will execute 10x more code trying not to execute the rendering code. Just skipping all that checking and jumping to the rendering code is arguably a win in many many cases.

To put some empirical data on it, game devs use ImGUIs because they keep up with perf where as that 10x overhead of retained mode guis creating gui objects, deleting gui objects, marshaling data into and out of gui objects, adding and removing event handlers and callbacks, and then trying to write a bunch more code to optimize all of that never leads to a GUI that is performant enough for the GUIs needed for game dev.

I think if you check actual apps, especially phone apps, you'll find it's not so clear which one wins. Phone apps almost always move in relation to the users fingers meaning the screen is being re-rendered. Usually new GUI elements are moving on and off the top/bottom of the screen. The overhead of creating/deleting/managing those objects is arguably greater than just re- rendering. The screen is already going to be re-rendered. At best you're getting a few cached textures from your retained mode gui all at the expensive of managing GUI objects.

For desktop apps it really depends on the app. It's got nothing to do with the complexity of the UI and everything to do with what the app does. A text editor might be a win for a retained mode GUI. Photoshop/Maya it's less clear. For example Unity is ImGUI and has very complex UI. Much of the UI has to respond in realtime to the state of the user's document that is changing constantly.

<comment><USER13> > Electron (and nearly all retained mode GUIs) will execute 10x more code > trying not to execute the rendering code. Just skipping all that checking > and jumping to the rendering code is arguably a win in many many cases.

How do you figure? Rendering a single Truetype letter will have dozens of conditional branches, use complex floating point math, and touch tens of kilobytes of cache. And there are many thousands of them in the GUI. Even if you have rendered cache, there is still lots of memory pressure copying data back and forth.

Compared to that, retained mode GUIs should be much more efficient. Even 50 checks are nothing compared to ability to void rendering one line.

Note this is all predicated on screen being mostly unchanging. For example, as I am typing this comment, everything is stationary except for a single line where I am typing.

> The screen is already going to be re-rendered.

This is the key! As you said, if you have to re-render whole screen anyway, then retained mode GUIs will have to maintain draw state _and_ re-render every element every time anyway -- a strictly worse performance.

But most of the regular apps, like editors and chat clients and web browsers, do not re-render whole screen every time. They only do one thing at a time.

For an empirical evidence, look at WinAPI design: this is a retained mode GUI, with lots of effort dedicated to figuring out invalidated rectangles and which controls need to be rendered. This was the only way to make a GUI which is performant enough.

<comment><USER7> And yet the WinAPI is not actually preformant for types of apps that an ImGUI excels at

There's best case for Retained mode GUIs and best case for ImGUIs. ImGUIs excel when lots is changing. In a scrolling mobile app the entire page is being re-rendered constantly as the user moves the page up and down. GUI widgets get created and deleted, data gets marshalled in and out, various algorithms are applied to try to minimize re-creating stuff, all code that doesn't need to be executed in ImGUI mode code.

There are tons of cases where ImGUIs win in perf. In fact the reason they are so popular with for game dev is exactly because they vastly out perform retained mode guis. There's a reason there are 100s of books and 1000s of blog posts and articles trying to get retained mode guis to run smoothly. They almost always fail without lots and lots of specialized client side code to try to minimize GUI widget object creation/deletion, reuse objects, minimize state changes, etc, all that code disappears in an ImGUI and they run at 60fps where as all the retained mode guis struggle to get even 20fps consistently as they hiccup and sputter.

</comment></comment></comment></comment></comment></comment><comment><USER14> IMGUI always brings a couple of things to mind for me, which don't seem to be discussed often:

Smalltalk/Self GUIs:

AFAIK, the idea (or at least terminology) of MVC comes from the Smalltalk80 GUI. MVC seems to be intrinsically retained-mode: the "view objects" (buttons, forms, etc.) are separate to the "model objects".

Self was inspired by Smalltalk, and its Morphic UI seems to be immediate-mode: the UI objects often _are_ the model objects. This idea is more explicit in the "Naked Objects" approach. Squeak Smalltalk uses Morphic, although its descendents (e.g. Pharo and Newspeak) seem to have replaced it (I'm not sure of their paradigm though)

Denotative, Continuous-Time Programming (DCTP):

This was originally called "Functional Reactive Programming" ( [http://conal.net/papers/frp.html](http://conal.net/papers/frp.html) ), but that term is now mainly applied to discrete, event-driven systems like Elm and React, which can make some articles/papers a bit confusing to read ;)

In this approach, anything which varies over time (e.g. user input, display widgets, application state, etc.) becomes a function taking the current time as a parameter, called a "behaviour". These behaviours can be composed together in various ways to create an application's overall behaviour, still parameterised by time. The "main loop" just samples this behaviour at an appropriate rate, e.g. a fixed frame rate, or varying based on system load, how much activity is happening, etc.

This is very much IMGUI, but has some nice advantages over the fixed ticking of a traditional main loop. For example, different components of a behaviour can be sampled at different rates, e.g. rapid sampling for smooth animations, coarse sampling for expensive calculations. Interpolation behaviours can remove jerkiness (e.g. a smooth animation based on an expensive simulation).

<comment><USER15> > Squeak Smalltalk uses Morphic, although its descendents (e.g. Pharo and > Newspeak) seem to have replaced it (I'm not sure of their paradigm though)

Pharo is still using Morphic, though there is a new graphics layer called Bloc (vector and constraints based) that has been under development to replace it.

</comment></comment><comment><USER16> Immediate mode GUIs are an extension of the simple display update loop: (1) update display, (2) check input, (3) goto (1). Immediate mode GUIs add a _context_ parameter to the update function. In the _draw_ context, the update function draws to the screen. In the _input_ context, the update function doesn't draw; instead it checks if mouse clicks or keystrokes should do something.

For example, part of the update function might look like this:

        if (Button("Do That Thing"))
            doThatThing();

In the draw context, the call to Button will draw a button on the screen and return False. In the input context, the call to Button will check if a mouse click fell within the area it would have drawn. If so, it will return True and the callback will run.

An immediate mode GUI is basically the opposite of a typical Model-View- Controller GUI because it deliberately mixes the Model, View, and Controller together into one function. Just one function draws the GUI based on whatever state it's in and whatever the model is. The same function gets reused in a different context to update the GUI state or handle callbacks.

<comment><USER7> I'd argue an ImGUI does't mix anything. It's just a library. If you want MVC it's up to you to implement your MVC and use your ImGUI as a library. Retained mode GUIs don't magically make your code MVC and ImGUIs don't magically make your code not MVC. That's entirely up to you.

Also ImGUIs are not multiple pass. That's in implementation detail. Unity's ImGUI is multi-pass. One of the most popular ImGUIs (Dear ImGUI) is single pass

[https://github.com/ocornut/imgui](https://github.com/ocornut/imgui)

</comment></comment><comment><USER17> I've taken part in some WPF application development and I think there are some benefits in immediate-mode rendering of the UI. Particularly when the UI changes faster than a monitor refresh rate or there's too much data complexity and you want the data update and redraw processes to be independent.

For my first example, updating controls and overall layout in a WPF application feels much more lightweight than in WinForms because the renderer just shows the result at the next monitor refresh instead of trying to update the layout in realtime or using hacks that disable redraw until you do everything.

For the second example, I've used SciChart to display trading data and it again was much more responsive because it replaced a control-based rendering pipeline with just an immediate-mode canvas tgat would render the selected data window once per monitor refresh rate.

And I think overall once you hit the performance barrier where you can't just fill a panel with controls and let them render and instead have to make a custom draw routine, the immediate-mode rendering adds this extra smoothness to the UI and gives you a bit more performance headroom.

</comment><comment><USER18> I find it ironic that Unity is used as an example... the immediate mode UI was/is considered a joke.

Terrible performance, doesn't scale to UIs more complex than a form (... like the ones many games tend to have)

It got to the point where there was a website dedicated to track when we'd get the current non-immediate UI, and Unity actually hired the developer of the leading non-immediate mode UI library in the asset store to work on their own offering.

<comment><USER7> I think you're mis-understanding why Unity switched. They only switched their in game GUI system. The entire app of Unity itself uses an ImGUI system and it is massively more complex than any Game UI and runs just fine.

The reasons they switched the in game system are many but they have nothing to do with performance.

<comment><USER18> The editor has none of the constraints the games made with it have... like running on mobile and maintaining 60 FPS while doing it.

... but IMGUI is on the way out there too: [https://docs.unity3d.com/Manual/UIElements.html](https://docs.unity3d.com/Manual/UIElements.html)

The old system would stack up draw calls like nobody's bussiness, doubling drawcalls if you used the built in layout tools. OnGUI being called period would be expensive, even when you had properly implemented your rendering logic, so you'd have to disable the entire game object when you didn't want to draw.

The docs for mobile literally used to say not to use the OnGUI stuff during gameplay.

</comment></comment></comment><comment><USER19> While I find the idea appealing, I haven't used them because I haven't figured out how to make immediate GUIs accessible to people who are visually impaired. How do you make them work with screen readers? You're drawing text onto a canvas but you don't retain a copy of the text for the screen reader.

<comment> loup-vaillant I don't know about screen reader APIs, but… can't you just send the text you're drawing to the screen reader when you drawing it?

How do screen readers work anyway?

<comment><USER19> Good question. I don't know. When you use the native GUI you get all of that for free. You don't have to do anything special for accessibility. So I always thought that screen readers somehow traversed the window/control hierarchy to find the control that has the focus and ask it for any text that should be read.

Maybe you're right and you can send the text to be read directly to the screen reader. Not sure how well that works when your GUI updates every 20ms. You don't want to keep resetting the reader.

<comment> loup-vaillant I was thinking maybe resend the stuff only when the text changes, so you'd have to have a cache of some sort, hidden in the library.

Anyway, I believe Qt is screen reader compatible, so it must access the relevant API _somehow_. I'd be surprised if it was the exclusivity of the OS vendor.

</comment></comment></comment></comment><comment><USER20> I'm going to date myself here, but this reminds me in some ways of Microsoft's BASIC 7.0 (circa 1989).

One of the new features of 7.0 was a library for producing text mode GUIs with dialog boxes and the like. Because the language didn't support anything resembling a callback, everything had to be written in what was essentially "immediate mode". Lots of control flow that would normally be down in the library stayed up in user code. The net result aligned well with the description in this article: "...much shorter but more intensive, every thing is packed in a single function."

This approach also presented lots of opportunities for errors caused by failing to correctly code something that would be default behavior in a normal library.

Never seen anything else quite like it, aside from this. (Which, quite frankly, I'm happy about.)

</comment><comment><USER21> Please add [2015] to title

<comment><USER22> Also, 2011, 2007, 2001, 1996 :)

Immediate vs deferred, is just another paradigm that goes back and forth in trends like keyboard input/buffering, deffered/one pass lighting, monoliths vs modules, State vs events, flat vs 3D

</comment></comment><comment><USER23> Are there any popular implementations of immediate mode GUI for the web? It might be interesting to have one that could then "eject" into a stateful UI for when things start to get more complicated.

<comment><USER24> I think that React is like 90% of the way there and you would just need to mess around with the VDOM a bit for this.

To be honest, given that web render output is a tree instead of flat "render to screen" stuff, writing a nice immediate mode GUI is not obvious.

If you're... very clever you could take React and the State stuff, at least conceptually, and get what you want here.

<comment><USER25> wouldn't you need some sort of gpu access to have a smooth UI rendering with immediate gui(in production)?

<comment><USER24> This is if you expect to build an immediate mode with the same flat rendering model.

imgui's model is "you draw onto pixels". You could create another mental model which is "you draw onto a tree." so instead of saying "drawText(x, y, text)" you would do something like "drawText(domLocation, text)"

Granted, this model gets a bit messier, and _some_ might say defeats the purpose of immediate mode. But I think you could still get conciseness benefits on this.

</comment></comment></comment></comment><comment><USER26> How does Flutter sit in the spectrum from Immediate mode to Retained mode? I presume it might provide an interesting erspective. On the one hand widgets are constructed on the fly, on the other it uses an OOP language to do so. So I suspect this maps to statefulness and statelessness?

<comment><USER27> Flutter is implemented in layers. The RenderObject layer looks very much like a traditional retained mode UI. It's _possible_ to write Flutter entirely at this level, nobody forces you to use the Widget layer above it. The Widget layer is basically React-style, where the API looks fairly similar to immediate mode, but it uses caching and diff computation to reflect everything into the retained RenderObjects below it.

</comment></comment><comment><USER28> Again IMGUI. Several years ago there was a chain of videos and blog posts by different authors. People were drawing two buttons and saying "see how easy it is".

In this post the author seems to go further than two buttons, but I'm skeptical. I wish there was a video showing how it works in dynamics - <USER2> clicked, texts entered, scrollbars scrolled, dialogs dragged around. Or source code available to build and try locally.

From the code in the post I suppose the majority of UI is dead - can not be interacted with.

I think IMGUI can only be convenient for very simple cases.

In real frameworks the lowest level is immediate mode (see WM_PAINT in WinAPI), but real UI needs quickly evolve them into the traditional RMGUI.

BTW, this thinking is my source of doubts about React.

<comment><USER7> I think you have it exactly backwards. Most ImGUI use cases are extremely complex UIs and that's where they excel.

One of the most complex apps out there, Unity, is entirely ImGUI based for the app itself and often has 1000s of controls visible. Going though the screenshots of typical ImGUI usage most of them are on the complex side.

[https://cloud.githubusercontent.com/assets/8225057/20628927/...](https://cloud.githubusercontent.com/assets/8225057/20628927/33e14cac-b329-11e6-80f6-9524e93b048a.png)

[https://raw.githubusercontent.com/wiki/ocornut/imgui/web/v16...](https://raw.githubusercontent.com/wiki/ocornut/imgui/web/v160/editor_white.png)

[https://user- images.githubusercontent.com/16171743/50757906-...](https://user- images.githubusercontent.com/16171743/50757906-f2bace80-1260-11e9-9ce5-4173b68cd9a2.jpg)

[https://user- images.githubusercontent.com/8225057/51042368-6...](https://user- images.githubusercontent.com/8225057/51042368-65f37600-15bc-11e9-99cf-36e9f9822610.jpg)

[https://user- images.githubusercontent.com/870320/51073482-ba...](https://user- images.githubusercontent.com/870320/51073482-ba0c6200-1671-11e9-9b44-0c573ab0fae5.png)

See [https://github.com/ocornut/imgui#Gallery](https://github.com/ocornut/imgui#Gallery) for more

</comment></comment><comment> alex-e Do you think it's possible to build an immediate UI wrapper on top of Win32 and Cocoa?

</comment><comment><USER29> 2015</comment>


Show HN: Golang – Level 7 Load Balancer and Cache - <AUTHOR> https://github.com/CoderCookE/goaround <comment><USER2> Did you mean to title this "GoAround"?

<comment><AUTHOR> Oppps yea guess that would've made more sense.</comment></comment>


Ask HN: are there tech jobs that require very little time? - <AUTHOR>

Having been in the startup gauntlet as a CTO for a couple of years now, I'm finally starting to feel the weight of 60-70 hours a week on my social existence. Having gone through major relationship changes recently (because of the work), and having spent this Thanksgiving, Christmas and NYE at the office working, I'm starting to reconsider my priorities in light of an ever-advancing age.
Hypothetically, if I were to quit and just try to stay afloat for a while optimizing for me time, what could I do? I'm fairly good at my role and I'm sure I'd bring a lot of value to any organization, but I just don't want to work more than 5-6 hours a day. Having lived on savings for the past few years, I'm also very frugal, so I wouldn't need much for sustenance. A room with a nice bed and a shared kitchen is probably good enough.
What kind of role would you recommend? Any companies out there that can accommodate for that kind of thing? Do I pretty much have to work on my own for that kind of lifestyle?
Tips would be really appreciated. <comment><USER2> It's not the role, it's the organization that's the problem. There's an excellent thread on HN: [https://news.ycombinator.com/item?id=7001929](https://news.ycombinator.com/item?id=7001929)

It's more than just about vacation. It's about having a good work/life balance, something that's oddly missing in a lot of American companies. My current work/life balance is excellent (I'm Dutch, BTW): I work 4 days a week as a dev/marketing guy, I get to work from home when I want to and nobody bats an eye if I take 25 days paid time off a year.

The main thing in my opninion: be crystal clear when you're appplying for a job that you value your free time. Motivation does not equal time spent at the jobsite.

There are several companies that have a 4-day work week, Treehouse for example. Other companies like 37signals also propagate a healthy work/life balance.

<comment><AUTHOR> It's tough because, at least early stage, you're always on the brink of dying as a company, so you're hoping that by putting in crazy hours you might have more shots at survival you otherwise would have.

</comment></comment><comment><USER3> If you have the skills to charge 125-150/hour or more you could live very comfortably on 80 hours of work a month (10-12k gross). As long as you can keep your clients happy in that amount of time. There is other overhead to this kind of business of course. I'm bootstrapping my startup this way and I have a family as well.

I guess you could always go work for a big software company as an eng. manager or whatever. There are orgs out there where 5PM is quitting time believe it or not. Frankly, as CTO, you should set a better example at your startup. 60-70 hours a week is not sustainable and does not a better company make.

<comment><AUTHOR> Do you know where I could find out more about the kind of work you mention in your first paragraph? Is this just general consulting or are you thinking of something in particular? Any chance you might have a blog where you talk about the experience? Also, any books / reading you might recommend to understand the field better?

Regarding your second assertion, that's true, there's no denying that. Our employees actually work normal hours, but as founders we feel guilty not working insane schedules and it's an attitude I've so far been unable to defeat at the company.

<comment><USER4> My attorney is $250/hour, I think? patio11 talked about billing out at five figures per week: [https://training.kalzumeus.com/newsletters/archive/consultin...](https://training.kalzumeus.com/newsletters/archive/consulting_1)

My starting figure for freelancing was around $1000/day, as a designer. I've developer friends whose base rate is $300 and $500/hour. (I've also friends whose base rate is less.) You could probably go work as a CTO-in-residence with an incubator, overseeing technology for a stable of startups, just being a guiding hand. Or do freelance systems architecture design, partner up with a project manager, oversee complicated system integration contracts for companies without a lot of in-house skill and overworked IT departments.

But I think the real issue isn't changing jobs, it's changing you. Are you really going to go work somewhere else and magically not feel like you have to work an 80 hour week? Normally that's something we put on ourselves, and as a founder, it's not like there's anyone who will fire you if you don't overwork. (Practically, this probably means you don't know how to delegate; that's a skill you'd have to develop, too.)

If you're going to overdo it, in the end, no matter what, then you have to take the initiative to change that. You have to make it okay, starting with you, to not do that, and you can do that just as well in your current job as in a new job. There's a great lede in an old BW story about Best Buy's move to flexible work hours (since rescinded):

 _One afternoon last year, Chap Achen, who oversees online orders at Best Buy Co. (BBY), shut down his computer, stood up from his desk, and announced that he was leaving for the day. It was around 2 p.m., and most of Achen 's staff were slumped over their keyboards, deep in a post-lunch, LCD-lit trance. "See you tomorrow," said Achen. "I'm going to a matinee."_

[http://www.businessweek.com/stories/2006-12-10/smashing- the-...](http://www.businessweek.com/stories/2006-12-10/smashing-the-clock) (they killed the program six years later)

When I work as an in-house designer, I set parameters from day 1, not by asking permission, but through my behavior. I don't show up before 10am. I decline any meeting scheduled for the same day. I leave meetings where we're not getting anything done or there's no agenda. I leave the building for lunch and I take at least an hour. I am comfortable leaving after my last meeting if no-one's expecting anything from me, even if that's at 3 in the afternoon. I show up after lunch or leave early on days when I'm hosting meetups. I book multi-hour blocks in Outlook, and often also in meeting rooms, so I can focus, which means if you want my time, book me in Outlook, because I have work to do.

When I am working, I am _working_ , and I make sure I am able to be productive, and the rest of the time, I may not even be in the office.

And for over six years, I get my work done, and no-one has ever cared that I took a three-hour lunch to see Iron Man again.

<comment><AUTHOR> That's very interesting, thank you for clarifying. Those are pretty great rates, even despite taxes and all. Something to look into for sure.

Even more, I like your attitude, I think that's key.

</comment></comment></comment></comment><comment><USER5> There are lot of companies that hire project/engineering managers where the work will mostly revolve around dealing with people - clients and your team. They will still be 8h work days, but far less intense.

Some will suggest software consulting, but there is a lot of things to manage there unless you're familiar with how the consulting world operates already and you've done it in the past. You will have to spend a lot of time setting up schedules, deadlines, prospecting for new customers etc.</comment>