Stay home science project: Enlarge gummy bears to reveal the secrets of osmosis - <AUTHOR> https://www.popsci.com/story/diy/osmosis-gummy-bears/ <comment><USER3> My wife made a whole YouTube series on fun experiments you can do with young kids. This one creates beautiful art by utilizing syphoning and chromatography on toilet roll using normal colored pens! [https://youtu.be/U41HIDxertg?t=149](https://youtu.be/U41HIDxertg?t=149)

The USP of the videos is to create something the kids want to watch in parallel to the adult learning the experiment. It tries to avoid the split attention and bored kids you get when following experiment notes. Also she avoids difficult ingredients

<comment><USER4> "something the kids want to watch in parallel to the adult learning the experiment"

This is brilliant, and exactly what I'm looking for. There's so much good stuff out there, but I need to figure it out first and then walk my (young) kids through it.

Much thanks to your wife for making these, and you for posting it here!

I skimmed the video so I've got an idea of what/how to pitch it to my kids and I'm hoping we can do this later today. Wish me luck! :)

<comment><USER3> Good luck! Let us know how it goes!

<comment><USER4> The good news: The video was awesome. It got their attention, it was easy to follow, and I could also see what needed to happen after.

The bad news: I did a bad job pitching it. In retrospect I should have waited until they were bored. What I did was excitedly show it to them even though they were hoping to do other things.

D'oh!!!!!!

I might give it another shot, but I think I missed the window :(

<comment><USER3> Maybe try a different video. The paper cutting one is popular too, and u only need scissors, pens and paper: [https://youtu.be/-_QgA767lvw](https://youtu.be/-_QgA767lvw)

</comment></comment></comment></comment></comment><comment><USER5> I tried getting an egg inside an impossibly narrow mouthed glass container by soaking it in vinegar for a few days.

The vinegar dissolved the shell very efficiently, but it also swelled the size of the egg by maybe 25%.

<comment><USER6> [https://twitter.com/chipspopandabar/status/11544814373088829...](https://twitter.com/chipspopandabar/status/1154481437308882945)

</comment></comment><comment><USER7> About #6: Measure each bear and write it down, but also takes photos, preferably the three bears in the same photo with a ruler and a coin for scale. For bonus points do this each hour.

I don't like that the recipe is too loose with the concentration of the salt. I tried to look at the numbers an 1 tablespoon is not enough to get a saturated solution. (I need 5 in my approximate calculations.) I'd prefer to use a saturated solution, because it's better to reproduce the result. It may be too much for the bear. (The saturation level changes with temperature, but let's ignore that.)

<comment><USER8> Any cook should know that a simple volume measurement of salt is useless - <USER2> 1 tbsp of kosher flake salt is way less salt than 1 tbsp table salt

<comment><USER9> Mass would be more accurate.

<comment><USER7> Mass is too difficult for a DIY recipe, specially for small amounts of things or for unusual items. I think it's fine to say "1 tablespoon of salt", but for a small increase of reproducibility I'd prefer a saturated solution.

Here in Argentina the cooking recipes we don't use "cups", we instead use mass for some materials, like flour or sugar, 200 grams of flour is something like a small glass or something. You can buy a measuring glass that has the marks for the common cooking elements like sugar, flour, water, ... assuming a standard density.

Also, the cooking books have a very inaccurate conversion table that says how many grams has a glass full of each material. (For an ideal glass of 250ml probably, my glasses are bigger, something like 300ml or 350ml, so I have to fix the numbers.)

</comment></comment></comment></comment><comment><USER10> All I see are "Sponsored Links by Taboola".

<comment><USER11> All I see are two layers of requests that they would please like to violate my privacy. Not surprised to hear that there are Taboola links somewhere underneath.</comment></comment>


Don't abbreviate 2020. It's for your own good - <AUTHOR> https://edition.cnn.com/2020/01/04/us/dont-abbreviate-2020-date-fraud-trnd/index.html <comment><USER2> Wow, I never thought about this. Worth the short read.

<comment><USER3> Indeed. It has literally blown the minds of everyone I have mentioned this to since reading the article.

OTOH my sister thought it would also be a potential way to "prove" you don't even have to make a payment until sometime a year or years later. And she has a very good point: the risk goes both ways. As a consultant, I could theoretically get a customer who changes my invoice to another year and blames some rogue middleman for the error.</comment></comment>


Ask HN: What's the best way to separate work and personal projects on a Mac? - <AUTHOR>

I've started using my "work" MacBook Pro for passion /side projects (really don't want to carry two laptops around), and I'm just curious if any developers have advice for how to separate work/fun projects.<p>Do you just create a separate account on the Mac? <comment><USER2> Do you own the machine? If not, I wouldn't build any personal projects on them unless you don't mind your company owning them.

On my machine (which I own), I just keep them in different folders. I tend to use the same environments for work and side projects.

What problems are you having keeping them separate?

</comment><comment><USER3> Macbook Pros are powerful - working in virtual machines is usually a good experience, given the right virtualization software (i.e. you can do better than VirtualBox). Using a VM for work or personal, and the host machine for the other, has been sufficient for me in most cases. As for which one you put in a VM, that depends on the nature of your work compared to that of your personal projects.

<comment><USER4> To add to this: If you're comfortable with command-line utilities, Vagrant is amazing for VM management.

<comment><AUTHOR> Thanks! Using Vagrant already.

</comment></comment></comment><comment><USER5> How about dual-booting? A Macbook Pro will boot from an SD card or USB 3.0. You can happily run OS X from an SSD in a USB 3.0 enclosure. Just hold down the 'option' key during power-up.

As others have said, you could use virtualisation software. However, this will only work if you're happy installing that on your regular hard drive, and if you don't need hardware-accelerated graphics in an OS X guest.

</comment><comment><USER6> What's wrong with seperate accounts? Provides the right level of easily switching between projects vs. too hard to switch when distracted.

</comment><comment><USER7> > Do you just create a separate account on the Mac?

Yes. It's the easiest option and you can always remove the personal account if work doesn't allow it.</comment>


Show HN: How I built an image proxy in Go to anonymise images in 20 mins - <AUTHOR> https://blog.machinebox.io/how-i-built-an-image-proxy-server-to-anonymise-images-in-twenty-minutes-e550466ea09e <comment><AUTHOR> The code is at [https://github.com/machinebox/toys/blob/master/anonproxy/mai...](https://github.com/machinebox/toys/blob/master/anonproxy/main.go)

<comment><USER2> The link is not working

<comment><AUTHOR> Which link? They both work for me.

<comment><USER3> I suspect the github repo is private.

<comment><AUTHOR> You suspect correctly :-| Doh

</comment></comment></comment></comment></comment><comment><USER4> Cool, but if you are truly concerned about privacy, I don't think that sending the pictures for facial recognition to a third party service is a great idea.

<comment><USER5> I think "censor" is the word OP is looking for, not "anonymise".</comment></comment>


Visa card vulnerability can bypass contactless limits - <AUTHOR> https://www.ptsecurity.com/ww-en/about/news/visa-card-vulnerability-can-bypass-contactless-limits/ <comment><AUTHOR> > Positive Technologies found that both of these checks can be bypassed using > a device which intercepts communication between the card and the payment > terminal. This device acts as a proxy and is known to conduct man in the > middle (MITM) attacks. First, the device tells the card that verification is > not necessary, even though the amount is greater than £30. The device then > tells the terminal that verification has already been made by another means. > This attack is possible because Visa does not require issuers and acquirers > to have checks in place that block payments without presenting the minimum > verification.

That's the first time I hear about RFID/NFC MITM, neat.

<comment><USER3> > That's the first time I hear about RFID/NFC MITM, neat.

That's been a thing for quite a few years now in the context of pentesting, e.g. for badge cloning / proxying for access control systems, see for example [1] for an overview presentation. There's quite a few BlackHat talks on that space that give a good overview at this point. This attack is intruiging since it circumvents more complex measures by manipulating the communication and obviously has practical and direct impact on a monetary asset.

I've read elsewhere ([2], German) that Visa declines to fix this with the explanation that it would require attackers to steal the card in the first place and is technologically too complex to be seen in the real world, which is kind of weird. The hardware required is pretty accessible at this point but I guess their risk assessment determined that the actually occurring fraud with this method is currently not worth fixing anything.

[1] [https://www.bishopfox.com/files/slides/2016/InfoSec_World_20...](https://www.bishopfox.com/files/slides/2016/InfoSec_World_2016-RFIDiggity- Brown-05Apr2016.pdf)

[2] [https://www.heise.de/security/meldung/Bezahlen-ohne-PIN- und-...](https://www.heise.de/security/meldung/Bezahlen-ohne-PIN-und- Unterschrift-Forscher-hacken-VISAs-50-Euro-Limit-4484956.html)

</comment></comment><comment><USER4> At the time those cards came out I was very skeptical about their safety (and of course have been called paranoid/excessive/etc. by everyone).

After all I wasn't that much off, my theory was that anyone in a crowded environment (bus, train, etc.) could get a "payment" by simply being "near" the card (be it in a wallet , in your pocket or in a bag).

The objection was that there were much more sophisticated controls by Visa on the "other side" (reputability of the account where the money would go, etc. ) and that the sheer number of micro-payments needed to make the theft profitable (and thus the number of complains) would have easily triggered off the various automated alarms.

But if someone can obtain a Visa/bank account and credit it with a small number of (delinquent) transactions each of relatively high amount, get the money and close the account in a short time it can probably become viable.

<comment><USER5> How would you credit your account with fraudulent transactions?

<comment><USER4> There is no fraudulent transaction, or - probably saying it better - <USER2> transaction is not fraudulent until it is detected as such or reported as such.

The whole point of the (rightful) "objection" I mentioned is that there are mechanisms of alarm that would be triggered by - say - a new (delinquent) account receiving one hundred 25 US$ (or Euros) transactions (and no other transaction) in a small amount of time and then, a few hours or days later the sum is transferred to another account and cashed or spent.

But if it is a couple transactions of 1,500 US$ each (or whatever sum that - while being substantial - is below a given triggering alert level) would the alarm be triggered?

Or will it be triggered only after - say - 2/3 of the credit is spent?

<comment><USER5> You have to be a merchant to receive any transactions.

<comment><USER4> Sure, as if fake merchant accounts are not possible:

[https://www.finextra.com/blogposting/14769/three-types-of- me...](https://www.finextra.com/blogposting/14769/three-types-of-merchant- fraud-a-guide-for-merchant-acquirers)

<comment><USER5> If you manage to get a merchant account (mule, homeless credentials) you dont need additional technologically advanced/complicated exploits involving getting physically close to people. You just open internet shop, list highend multimedia equipment(TV, consoles, laptops, phones) at 30% off prices and spam FB/coupon/deal sites.

</comment></comment></comment></comment></comment></comment><comment><USER6> I wonder what the absolute limit would be. Could you buy something for like 1 Billion?

<comment><USER4> Well a VISA card has usually a (daily or monthly or both) drawing/spending limit, the monthly usually being AFAIK in the 1,500-5,000 US$ or Euro range.</comment></comment>


Dat: non-profit, secure, and distributed package manager for data - <AUTHOR> https://datproject.org/ <comment><USER2> Dat is both a protocol and a toolset. The protocol is basically an improved version of BitTorrent that supports changes and versioning (here's a short page on its technical merits [1]). The toolset is a commandline and some desktop apps, and we use it in the Beaker Browser.

Dat couldn't be made by nicer people [2]. It's a non-profit led by Max Ogden [3] and the protocol work is led by Mafintosh [4], both of whom are pretty well known in the nodejs community. The project started as a way for academics to work on tabular datasets, but they pretty quickly found out that academics more often want to work on unstructured (or custom-structured) files. So Max recruited Mafintosh and they started working on the p2p protocol, which focused on improving archival and data-sharing flows within labs.

There's a pretty simple CLI you can install from NPM (npm i -g dat). Give it a try. Also, they need help securing grants, so if you have a talent or a connection in that area, definitely get in touch with them. They're doing good work.

1\. [https://beakerbrowser.com/docs/inside- beaker/](https://beakerbrowser.com/docs/inside-beaker/)

2\. [https://datproject.org/team](https://datproject.org/team)

3\. [https://twitter.com/denormalize](https://twitter.com/denormalize)

4\. [https://twitter.com/mafintosh](https://twitter.com/mafintosh)

<comment><USER3> I've contributed to a couple of Mafintosh's projects. the dude is impressively prolific and writes good code. Nice to see him get some recognition here.

</comment></comment><comment><USER4> Hi everyone, I'm one of the core contributors to Dat, @joeahand. Happy to answer any questions. It's an interesting time to see this posted because I've been working on a new datproject.org site recently =).

Dat Project started with a focus on increasing access to research & public data. To support the data tools we built a peer-to-peer protocol. People are doing some really cool stuff on top of Dat (such as Beaker Browser), we're really excited about it and want to make sure to support all the neat use cases.

We'll be launching an updated site soon to highlight more of the work around the protocol and what the community is building. Our main use case will still be data management but most of what you see on the current site will shift to a new domain.

<comment><USER5> Care to explain how this is different then Resilio [https://www.resilio.com/](https://www.resilio.com/)

I use this with encryption for my data folders on my projects.

<comment><USER4> Ya, there are a few other related questions below. Resilio is BitTorrent- based. But I'm not 100% familiar with how Resilio differs from BitTorrent.

The core difference is in our approach. We're all open source and a non- profit. We're also really focused on the research data use case where BitTorrent is less easily deployed.

We hope that making an open and easy to use p2p protocol will enable other developers to build applications on top, and something like Resilio could be one.

</comment></comment></comment><comment><USER6> So how does this compare with quilt? From what I see

1\. Quilt is for profit while Dat is non-profit.

2\. Dat has ~20 datasets that are public Quilt has 50+ that are public

3\. Dat is on a shared network while Quilt is hosted on a centralized server

4\. Both of them offer version control and hosting. Quilt has private hosting for a fee. Dat seems to have only public hosting

5.Quilt is funded by YC. Dat is funded by non profits.

6\. Quilt has a Python interface while Dat has one in Javascript

I understand who Quilt is targeting but I'm having trouble understanding who Dat is targeting?

<comment><USER7> I'm one of the creators of the Beaker browser[1] and the reason we use Dat is that as a p2p protocol, it offers a lot of neat properties, including making datasets more resilient. As long as one peer on the network is hosting a dataset, it will be reachable, even if the original author has stopped hosting it.

I won't speak authoritatively on behalf of the Dat team, but I believe one of their goals is to make it difficult for public scientific datasets to be lost, and data living on a centralized server is particularly vulnerable to that.

1\. [https://github.com/beakerbrowser/beaker](https://github.com/beakerbrowser/beaker)

<comment><USER8> The use case really speaks to me, but I'm not convinced that decentralization is going to help datasets not to get lost.

I spent a while trying to download recent updates to the Reddit comment corpus [1], which is hosted on BitTorrent. The downloads never seem to finish.

It seems to me that decentralization means that, when a dataset stops being new and exciting, it will disappear. How will Dat counter this?

[1] [https://www.reddit.com/r/datasets/comments/65o7py/updated_re...](https://www.reddit.com/r/datasets/comments/65o7py/updated_reddit_comment_dataset_as_torrents/)

<comment><USER9> Because Dat is just a protocol, decentralization is a choice. For quick, ephemeral exchanges direct P2P works brilliantly. For longer lived data sets, sharing it with a (commercial) mirror might make sense. Or perhaps you host it yourself. The beauty is that you, as a user of the protocol, get to decide what works best for you.

</comment></comment></comment></comment><comment><USER10> The p2p and security aspects look very interesting[1] - apart from the obvious network effect/existing user base and tooling - are there any reasons to not prefer dat to bittorrent for all the things?

It looks like an interesting way to store/share backups and server images - easily scaling bandwidth and availability with the nerd to spin up new instances, or shifting across data centers?

Maybe also as an apt back-end similar to:

[https://wiki.debian.org/DebTorrent](https://wiki.debian.org/DebTorrent)

[1] [https://docs.datproject.org/security](https://docs.datproject.org/security)

<comment><USER7> To draw a quick contrast between Dat and BitTorrent, BitTorrent magnet links are static, meaning if you change the content, you get an entirely new magnet link. Dat archives (a networked directory, essentially) are mutable, so you can publish modifications at a consistent address.

I'm not familiar with DebTorrent, but if you're interested to learn more about the innards of Dat, this post by pfraze is a good place to start:

[https://beakerbrowser.com/2017/06/19/cryptographically- secur...](https://beakerbrowser.com/2017/06/19/cryptographically-secure- change-feeds.html)

</comment></comment><comment><USER11> I can think of one use for this. I run computational plasma physics simulations for a living, and while some of us have gotten better about sharing code, sharing simulation results for published papers would be beneficial. Will have to think about this.

<comment><USER2> You should jump on #dat or get in touch with someone on the team via twitter. They'd be happy to help you get setup.

</comment></comment><comment><USER12> This is very cool, but I think you need to go down to fine-grained permissions to be truly effective. Otherwise , it is pretty much bittorrrent with a private tracker.

For example, I should be able to give unique URLs (for the same data) to different users and expire one but continue for the other,etc.

<comment><USER13> One other crucial difference between dat and bittorrent is that dat allows you to update datasets. In bittorrent, you can't change/add files once you've shared your torrent

<comment><USER12> the DHT mutable data BEP-46 is proposing to take care of that.

[http://www.libtorrent.org/dht_store.html](http://www.libtorrent.org/dht_store.html)

previous HN discussion - [https://news.ycombinator.com/item?id=12257065](https://news.ycombinator.com/item?id=12257065)

<comment><USER14> No, BEP46 only allows you to mutate DHT items, not torrent. By construction torrents are immutable (if you change one bit, or the name of the files) then the torrent identity changes.

What you need to mimic dat is a more integrated way to tell other peers that the torrent changed and to check the new one... which is not there yet.

<comment><USER12> I'm not an expert at this, but this is what the RFC says:

[http://www.bittorrent.org/beps/bep_0046.html](http://www.bittorrent.org/beps/bep_0046.html)

> _The intention is to allow publishers to serve content that might change > over time in a more decentralized fashion. Consumers interested in the > publisher 's content only need to know their public key + optional salt. For > instance, entities like Archive.org could publish their database dumps, and > benefit from not having to maintain a central HTTP feed server to notify > consumers about updates. _

You are technically right that the torrent file is immutable, but basically this lets clients know that the torrent is updated using the DHT data. The outcome is the same.

</comment></comment></comment></comment></comment><comment><USER15> It looks cool, but I don't completely understand what this is about. Is it a way to share files over a P2P network? Isn't this basically the same as Torrent or IPFS?

<comment><USER13> It's very similar to bittorrent but with a few key differences. For one, bittorrent doesn't allow you to update/add files in a dataset once you've shared the torrent. Dat does. Dat also has versioning built in.

IPFS seems to me to be a bit over-engineered whereas dat is a lot more simple/low level - something that suits my way of working really well.

<comment><USER15> > IPFS seems to me to be a bit over-engineered whereas dat is a lot more > simple/low level

I also love simpler things. I'd be curious to understand where is IPFS over- engineered and where is Dat better, instead.

<comment><USER13> I probably didn't give IPFS enough credit. What I should have said was that IPFS does way more than I need. Dat seems to hit the sweet spot for me

</comment></comment></comment></comment><comment><USER5> This seems like my setup but I use Resilio (Bittorrent Sync) with encryption. I don't need version control for my data but you get archives if you want one.

</comment><comment><USER11> I recall at least two other "data package managers" out there being shared on HN a couple of months back.

<comment><USER16> You happen to remember which ones? Would be interested in checking them out.

<comment><USER11> I was thinking it would take a while to look back, but the new "upvoted submissions" tool is more useful than I thought. The project was Quilt[0] and here[1] is the comments on it. The other project I saw referenced in the comments was Pachyderm[2]. It looks like Dat indeed was referenced in the comments, and the main difference is Dat is distributed while Quilt is centralized (like github)...and Pachyderm is more like git.

[0] [https://quiltdata.com/](https://quiltdata.com/)

[1] [https://news.ycombinator.com/item?id=14771406](https://news.ycombinator.com/item?id=14771406)

[2] [http://www.pachyderm.io/](http://www.pachyderm.io/)

EDIT: Annnd...looking up, I see others have already referenced quilt in other comments here.

</comment></comment></comment><comment><USER17> naive me's first thought would be: Why not use git? Can someone with more experience in this area explain?

<comment><USER18> The git toolset is, out of the box, weak on tabular data. Also out of the box large file support requires one central repository.

None of that is true for Dat

<comment><USER19> _out of the box large file support requires one central repository._

How so? As far as I know, git doesn't treat large files any differently than small ones.

<comment><USER13> I'll try to answer your question, but it's been a while since I last looked at it, so I might get some/most of this wrong - so don't shoot me:

As far as I know git isn't good at storing binary data. Git depends on line breaks to be able to diff and make change sets. If you store a binary file in git and make an update to it - even though that update only changed 1 byte, the entire new version of the file is stored again. Dat uses Rabin fingerprinting to intelligently slice binary files into chunks that are less likely to change. That make dat a lot more efficient at storing, versioning, and syncing videos, images, and other large binary files.

<comment><USER19> Conceptually, git doesn't use change-sets, each commit is a snapshot of all the files in the current version. For storage and transmission efficiency, though, it can store and send them in packfiles, which use delta compression based on LibXDiff - which uses Rabin's fingerprint algorithm (as well as other algorithm by Joshua P. MacDonald) for binary files.

</comment></comment></comment></comment></comment><comment><USER20> Can the fetch command be "get-dat"?...

Please?!

<comment><USER21> You could easily make an alias.

</comment></comment><comment><USER22> There was a startup I came across recently doing about the same thing... I don't recall the name.

<comment><USER21> Do you mean Quilt Data, Inc with the product Quilt? Its being mentioned all over this thread.

</comment></comment><comment><USER23> Dat being short for data, would a package for the state assemblies be "Dat Ass"?

<comment><USER24> Astute.</comment></comment>


Ask HN: How to teach someone programming? - <AUTHOR> I'd like to mentor a friend to learn programming. She tried some bootcamps but they weren't very successful for her.
I'm thinking the best way would be rather than teaching frameworks and algorithms, to actually pick a project and build something and learn as you go. I'm leaning towards something with instant gratification, like an iPhone app or a video game.
Any other ideas? <comment><USER2> In my own experience, bootcamps or other made up stages are about to fail because of the fact they have prerequisites that are not shown.

For your friend (and you), I will recommend to start with basic knowledge. What is Boole's logic? What is a microship? How to control a microship.

An example will be : [http://www.nand2tetris.org/](http://www.nand2tetris.org/)

Begin with a (only one) project will fall in some pitfalls: \- do not cover basic principles \- assume to know a framework, or to use bad practices \- do not teach programming, but a language for only one purpose

(sorry for my bad english)

</comment><comment><USER3> Just introduce him/her freecodecamp.com</comment>


Is Grammar an Outdated Technology? - <AUTHOR> https://medium.com/remotely-useful/is-grammar-an-outdated-technology-5fb7416c16a5#.6tdcpkbth <comment><USER2> If grammar were all that bad, and lack of grammar not a handicap, we'd all be using rebuses, or flash cards, instead of talking and writing.

Really, in this day and age, everybody even vaguely technical should be aware of the fact that you can express more in a language with a grammar, than a language without a grammar. That's Chomsky's Hierarchy at it's most basic. Ignorance of that language hierarchy leads CxO's to believe that all any of their employee's need is a Windows laptop with "Word" on it.

</comment><comment><USER3> I read this twice and... I'm afraid I still don't understand what it is trying to get across. I feel like the paragraphs were strung together by a Markov chain.

This is my summary of the article:

"Reads, sentences, phone. Work/Life balance. Feeling limited by mobile devices because grammar. Remove words. Cyborgs! More mobile devices, we've become cyborgs. Grammar is clumsy. Good user experience. Library searching. Latin sentence structure (SOV). Virtual Reality - technology needs to adapt."

Either I'm at fault here or I advise Ms. Megan to run this past an editor because whatever meaning that was meant to be conveyed was completely lost on me. I'm left completely confused.</comment>


Android & iPhone App Design: Is it twice the work? - <AUTHOR> http://johnnyholland.org/2010/09/06/android-iphone-app-design-is-it-twice-the-work/ <comment><USER2> This was mentioned in the article of course, but it bears repeating. I don't think there's any way around doing extra work when you target another platform. The UX guidelines for the Android and iPhone are different and you want to work within those guidelines.

HTML5 may be a way out of this, since the user is in a different contextual frame of mind, but if you want folks to think it's an "app" then you should still be aware of (and target) specific UX recommendations.

<comment><USER3> I agree. While having to design once for both platforms could be great for the designer, it isn't for the user. Following the guidelines of the specific platform cut enormously the learning curve and makes the use of the app more natural. Just think about all the fuss about the three buttons in iTunes 10 placed vertically instead of horizontally, moving away from the standard position.

</comment></comment><comment><USER4> I'm inclined to think that eventually html5 "apps" will largely displace native apps for the same reasons so many desktop functions have migrated to the web. The porting issues this article describes are just some of the many disadvantages of native interfaces.

<comment><USER5> How do Html5 apps get paid? If those are integrated into the Markets, then there will be a boon to them. Otherwise, it will be just like the Flash apps.

<comment><USER6> You can use Google's Chrome Web Store to sell HTML5 apps. For info, how to integrate with your apps, see: <http://code.google.com/chrome/webstore/docs/index.html>

</comment></comment></comment><comment><USER7> Looks like an interesting article. It's too bad some of the text is hidden behind ads (Chrome 6 beta/Win7).

<comment><USER8> Same problem here. Safari for iPhone.

<comment><USER8> Actually "readability" made it work.

</comment></comment></comment><comment><USER9> Not if you make a slick html5 mobile version instead.</comment>


Show HN: Dynamic bookmarks for you and your team - <AUTHOR> https://route.run <comment> 97-109-107 I'm sorry I don't get what this about - the landing page doesn't make it clear. I think I'm interested, but I'm not sure what this is. Could you explain a bit more here and we could figure out a better wording?

</comment><comment><USER2> Yeah, I think I may want to know more but I'm a bit confused.</comment>


Simple toy lets you build anything you can imagine out of drinking straws - <AUTHOR> http://www.kickstarter.com/projects/1624049406/strawbees-dream-big-build-bigger

<comment><USER2> coooo</comment>


Ask HN: What kind of side business is good to start during an economic crisis? - <AUTHOR> Anytime we have to ask money during an economic crisis seems unjust and I'm not sure what kind of business would look ethical to start and charge during an economic crisis?<p>Companies like Zoom and many other companies are riding on this wave. But if i launch something during this time that's particularly to leverage this situation, does it count unethical? <comment><USER2> I'll give you an obvious example.

A service business that helps established businesses shift more of their work to remote. The demand is enormous right now. Service businesses are labor intensive, they don't scale easily, so during a boom demand time there is never enough specialized labor to go around.

That will taper off after a while. So as you build the business, begin offering other services to your new customers (services that are sustainable after the remote boom fades).

Look for enduring businesses that are unlikely to fail short-term during the economic disaster; businesses that have some forced regulatory-based demand are ideal (certain small to mid-size insurance agencies; some things in real- estate; law firms depending on the segment; and so on).

</comment><comment><USER3> Stealing and coercing people is unethical.

Lying or misleading is unethical.

Offering a product or a service for someone who willingly wants to pay for the product or service is not unethical at any level.

</comment><comment><USER4> A company like Zoom is "riding on this wave" because they've been working hard until they reached this "overnight success".

I see a lot of people thinking they can do the same by "trying to ride the wave", but I think that's short term thinking. If you build a startup just for this situation, you will probably end up building opportunistic business that has not much to do with your own vision.

Instead you should build something that is NOT obviously attractive during this time so as not to jump into a red ocean. You should build something that is unattractive today but powerful in the long run, because no one else would be building this today while you pick up your users one by one. The key is you should focus on building a great product instead of trying to make money during this time.

</comment><comment><USER5> Well Amazon is in the process of automating package delivery and cashiers. The current pandemic has only sped up their efforts IMO. So anything in relation to automating what you do in the office like IT or automating away parts of sales will be in demand. Yes these are difficult problems, but they wouldn't be multibillion dolar problems if they were easily solved.

</comment><comment><USER6> Alcohol does well in recessions. There are lists out there for sectors that have low beta w.r.t. recessions

How is it unethical to ask for compensation for your work or the value you provide? Why would a downturn change this?

</comment><comment><USER7> Provide value.

If your business provides value/solve a pain point it will do well.</comment>


HTTP-Headers Status Diagram - <AUTHOR> http://thoughtpad.net/alan-dean/http-headers-status.gif <comment><USER2> If ever there was an existence proof of why flowcharts disappeared from engineering discourse, this is it. Seriously, which would be easier to understand: this monster or the 80 lines of code that it would take to actually implement it?

</comment><comment><USER3> Web programmers everywhere should put this on their cubicle wall, to convince people how difficult their job is. (I saw a seven-layer-networking-cake diagram which served a similar purpose).

<comment><USER4> Web programmers can actually completely ignore the lion's share of the complexity represented in this diagram.

This concerns only web server implementors... and even then, a lot of web servers simply don't need to support the full set of operations.

<comment><USER5> Web programmers who follow your advice usually sound like idiots who don't know much about what they're doing. Lots of them like to reimplement wheels like HTTP caching, HTTP authentication and content negotiation, even error codes (!). I have grown tired of stupid shit web "programmers" without knowledge of HTTP are capable of generating. Especially when paid by an hour.

<comment><USER4> Relax... First, I had HEAD, PUT and DELETE in mind as stuff you usually don't need to support explicitly as a web developer...

I admit I went a bit overboard with saying "can completely ignore the lion's share" but I obviously didn't mean you should go out of your way to skip the absolute basics that caching, content negotiation, error codes etc. are.

I wasn't "advising" against learning HTTP, I just think lots of web developers get away with not learning much about it (I'm NOT saying that's a good thing.)

edit: Damn, the more I reread my previous post the stupider it sounds :|

</comment></comment></comment></comment><comment><USER6> Honestly, that's _way more_ than I ever wanted to know about HTTP header status.

But certainly useful.</comment>


My Best Practical JavaScript Debugging Skills - <AUTHOR> https://www.tutorialdocs.com/article/8-practical-javaScript-debugging-skills.html <comment><USER2> Great article. As someone who is starting to play more with Javascript is it always good to start down a good path</comment>


Arthur Whitney's One-page Interpreter (1992) - <AUTHOR> http://www.jsoftware.com/jwiki/Essays/Incunabulum <comment><USER2> Interpreter of what? "J", apparently, from context and inference, but that should have been in the post title.

What's an "interpreter fragment"? Most of the Google results for that term point to the same story.

I know this is Hacker News and everyone is supposed to know everything about everything already, but on obscure topics it's nice to take a moment and explain what you're talking about.

</comment><comment><USER3> When code is bulky, you can excuse your ego because your visibility is limited in a literal sense. But when it's dense like this you actively know, as you try and fail to skim it, that you can only usefully focus on a small segment at a time. So you blame the code instead of yourself.

<comment><USER4> I think it's fair to blame the code in this case. It's not written at all for readability (by anyone other than the author while he was writing it). Of course he knew what those 1 or 2 letter variable names meant when he came up with them, so it's a lot easier to load into memory. But I doubt Whitney could easily coming back to this code after any length of time.

<comment><USER5> He is famous or notorious for rewriting from scratch every few years. So, your impression sounds plausible.

<comment><USER6> You think Arthur doesn't look to his code back for those few years between rewritings?

<comment><USER7>
        BC: Do you ever look at your own code and think, "What the hell was I doing here?"

        AW: No, I guess I don't.

Of course, maybe he was answering the first 8 words.

[http://queue.acm.org/detail.cfm?id=1531242](http://queue.acm.org/detail.cfm?id=1531242)

<comment><USER5> Logically, he could be answering the entire question truthfully, except that he doesn't look at old code at all. He'a clearly somebody very focused on the current "working set", with his rewrites and one-page files. As opposed to the kind of programmer who curates a sprawling historic code base.

</comment></comment></comment></comment></comment></comment><comment><USER8> I am at a vacation and bored, so I decided to try to actually understand this. I do not know much APL/K/J, but for a start, here is a version with more traditional line breaking:

[https://gist.github.com/anonymous/f72e5c4a432492abce59](https://gist.github.com/anonymous/f72e5c4a432492abce59)

Some basic observations:

\- He uses all the obscure C features, like the ability to not declare the type of an argument or return value and let the compiler fill in, and also the old school style of declaring functions:

      foo(x,y) int x, y { return 0; }

Instead of:

      int foo(int x, int y) { return 0; }

Since the compiler will infer the int, and since he uses R for return this example eventually becomes:

      foo(x,y){R(0);}

\- Variables, or really registers, are only accessible as letters from a to z, and the "st" array stores the values of all registers. Numbers entered in the REPL have to be between 0 and 9, and hence he avoids the dirty work of making a proper lexer. It's also super easy to trigger a segfault since any error handling is non-existent.

\- DO(n,x) is a C macro that evaluates the given expression "x" for all numbers between 0 and "n"

\- V1 is a C macro that defines unary operators for the interpreted language, and V2 defines binary operators. In V1 definitions the operand is called "w", in V2 the operands are called "a" and "w".

\- For example ",", which calls the cat function, is a binary operator that creates vectors:

      1,2,3,4
      4
      1 2 3 4

\- The vt, vd and vm arrays map ascii symbols to the functions defined with V1 and V2. { is the second symbol in vt, so when used as a unary operator it calls "size" (second non-null element of vm):

      {5,6,7,8

      4

and when used as a binary operator it calls "from" (second non-null element of vd).

\- wd is a parser that goes from the original input string to a weird intermediate form that is an array of longs. Each input character gets mapped one-to-one to an item in this intermediate form.

      If the input character was a number between 0 and 9:
        Value type instance gets allocated
        Intermediate form for this input character consists of the address of the allocated instance

      If the character is a letter between "a" and "z":
        Intermediate form consists simply of this character

      If the character represents an operator
        Intermediate form consists of the index of the operator in the vt array

In other words, the intermediate form is an array where some elements are ascii characters, others are memory addresses and yet other indices into some array. This part is really something.

\- The ex function executes the intermediate form. Since everything in the input is fixed length, and there is no syntax checking, it just indexes into the intermediate form assuming everything is well formed, while the parser did not check that so it's not really guaranteed - again a source of easy segfaults. The execution goes from left to right and consists of looking at the first position in the intermediate form and then making recurrent calls if necessary (let X be the current item in the intermediate form):

      If X is a character
        Lookahead one item
        If it is a '=' char
          Assign the result of executing everything after the '=' to the register indicated by X
        Assign to X the value of the register named by X
      If X is not a character and is a small integer
        We are applying a binary operator
        X is the index into the "vm" array
        Fetch the function from "vm", apply it to the result of executing the rest of the intermediate form
      Otherwise:
        If there is any more input remaining other than the current item, we are applying a binary operator
        Lookup the function in "vt", apply it to the result of executing the intermediate form to the left and to the right of the operator

\- I have the biggest problem with understanding that "a" struct, that represents all values in the interpreted language, which are arrays. ga is clearly the basic allocation function for it, "plus" obviously adds two arrays, so it's clear the "p" field holds the actual contents, but that's where things get very shady.

<comment><USER6> Didn't look at this piece, but more recent J interpreter is here - [https://github.com/openj/core](https://github.com/openj/core) . I think the main idea for "a" struct (it is here - [https://github.com/openj/core/blob/master/jt.h](https://github.com/openj/core/blob/master/jt.h)) is that it has "rank" \- the single integer which is the number of dimensions, then array of dimensions - "shape" of length equal to "rank", then "data" part which has the size equal to multiplication of all elements in "shape".

Edit: the structure is at [https://github.com/openj/core/blob/master/jtype.h](https://github.com/openj/core/blob/master/jtype.h) .

<comment><USER8> Thank you, I was wondering about the purpose of the tr function, which calculates the product of all elements in the vector, now it's clear that it goes from the array of lengths in each dimension to the total "flat" number of elements.

So the "r" field in the "a" struct is the number of dimensions of the array that "a" holds, and the "d" field is the array that holds the length of the array "a" in each dimension.

</comment></comment></comment><comment><USER9> This is a perfect illustration why normal people (like me, unlike Arthur) have problems working with his apparently brilliant creations, such as the k language. The amount of information required to efficiently read (let alone write) such texts just does not fit into normal people's working memory. One- letter names and the absence of comments don't help either.

(WRT weird names: IIRC, some time ago kdb featured a number of functions named with digits, like '2' being the function to connect to a socket or something.)

<comment><USER10> As a guy with a terrible memory, I think of it the opposite way. For Q (and more so K), the actual number of distinct items to remember is very small, as basically anything complex is created by composition of the simple functions/variables. This way you don't need to remember nearly as many libraries/variables/function names, and also the function itself becomes its own description.

That being said, for more production-heavy applications and interfacing with other languages, variable/function naming could be more descriptive :)

<comment><USER11> Agreed. The small(ish) vocabulary of operators makes K easier for me to use.

Would you rather write/read:

DIVIDE X BY 5 GIVING Y

or

y=x/5;

The first is COBOL (designed to make code easier for "normal" people to read. The second is C (which looks more like the math that we learn in grade school).

k/APL/J simple moves further in the direction of math.

As a far as descriptive names go, in k, names can always be aliased with longer names (assuming no conflicts). I do this when exposing a library k code as a web interface.

</comment></comment></comment><comment><USER12> I want to offer a bounty for a version that compiles with a contemporary C compiler. There's some magic going on with longs being treated as pointers here.

<comment><USER6> That's a rather normal situation - when your long is 32 bits long and the pointer is also 32 bits long, to satisfy a strict C compiler you just need a cast - which will be a no-op in machine code. This approach was used quite a bit...

<comment><USER13> Still segfaults with gcc -m32. There's some seriously nonportable, noncompliant type abuse going on in there.

<comment><USER14> Try 3+5. Worked for me. I think it's very rudimentary and doesn't handle very much.

I agree, I would very much like a ansified very that doesn't crash on unsupported features, but still in this style and in a single file.

<comment><USER12> 3+5?

<comment><USER14> My point was that very few things work and that was an example. Multi digit numbers will fail. Here's a few examples that doesn't segfault:

3+7

a=3+7

a,a,a

b=a,a,a

{b

b+9

p=2,3,5,7

2{p

{p

~8

<~8

#~8

4#3

c=b#2

c,c

</comment></comment></comment></comment></comment></comment><comment><USER14> This transcript of Roger Hui's talk casts more light on the general idea: [http://archive.vector.org.uk/trad/v094/hui094_85.pdf](http://archive.vector.org.uk/trad/v094/hui094_85.pdf)

It's interesting that what he calls "Parsing" is more typically known as term reduction by pattern matching in the functional world.

</comment><comment><USER15> He "cheats" by putting multiple statements on one line:

noun(c){A z;if(c<'0'||c>'9')R 0;z=ga(0,0,0); _z- >p=c-'0';R z;}

would be

      noun(c){
       A z;
       if(c<'0'||c>'9')
         R 0;
       z=ga(0,0,0);
       *z->p=c-'0';
       R z;
      }

In this forms, it's still cryptic, but not quiet as inscrutable.

<comment><USER16> Except this isn't him "cheating", this is his preferred coding style, for readability!

<comment><USER6> To avoid scrolling, which he says he hates.

</comment></comment></comment><comment><USER17> Isn't it wonderful that many wall st firms use k/q to write some of the most complex analytics ?

Of course, it is understandable. NOT.

<comment><USER6> [http://kaleidic.com/2009/composing-j-in-my- mind/](http://kaleidic.com/2009/composing-j-in-my-mind/)

"J is conducive to thinking about computation because a lot is expressed by combining even a few components. With J it is natural to think in code, not just about code."

</comment></comment><comment><USER13> Complete shit. C was a mature language in 1989. Even for banging out a quick hack, and forgiving the gets into a 99 byte stack array, this is crap by any standard.

I can compile and run pretty much any K&R code from the C Programming Language in 1978 with no problem. Finding the appropriate compiler, I can do the same with BCPL, the Language and its Compiler (1981). And the code is actually understandable.

This, on the other hand, is an obfuscated mess that segfaults on any input, J or otherwise. I'll be damned if I spend 5 minutes debugging it, ex() segfaults with infinite recursion. It's not worth the trouble.

Not saying this isn't worth sharing as a curiousity or an artifact, but this is not a work of genius and it is not defensible or to be emulated. Do your colleagues a favor and don't write like this.

<comment><USER6> > Do your colleagues a favor and don't write like this.

I'd second this - in any normal situation.

If you're really aspiring to form the future, strive to be extremely productive, demands that from your colleagues - that's another thing.

Sigh - industry as a whole isn't nearly on the level to use those advanced tools.

<comment><USER13> >Sigh - industry as a whole isn't nearly on the level to use those advanced tools.

Is this a parody?

Is J a language for writing personal code with personal meaning only that you can only run in your head?

There is nothing professional about this. Sounds more like a mental illness.

<comment><USER6> I once needed to develop an algorithm for a underspecified task. Something like "generate a real-looking map of the floor - with walls, windows, doors, corridors..." . Took me 40 minutes to try several variants in J. Then some 3 hours more to complete C# code. I don't know how long it would took if I'd experiment directly in C#. Probably not too long - but iterations would surely be more painful; too much boilerplate code.

In my experience, J is closer to thought process than many other languages. Really. You just have to try - and get used a little bit.

<comment><USER13> There's a reason that APL never gained a foothold and J has not been adopted by software engineers. You can program at the speed of thought in TECO as well, but the reasons for its limitations and peculiar history vanished long ago.

There are far better tools available these days for rapid prototyping; interpreted languages with REPLs and libraries for just about everything-- without resorting to a write-only line-noise language and actually ending up with a usable product.

For that matter, I suppose it's possible to write understandable, maintainable TECO, APL and J with some effort if you don't value obscurity and cleverness over simplicity, correctness, maintainability and understandability.

If your business logic or product is written in line noise written by some lone J genius, your company is fucked when your guy inevitably gets hit by a bus, goes nuts, or leaves for greener pastures.

<comment><USER11> The same could be said for writing a document in Chinese, Arabic or Hebrew. They all look like "line noise" until you make an effort to learn them.

"For that matter, I suppose it's possible to write understandable, maintainable TECO, APL and J with some effort if you don't value obscurity and cleverness over simplicity, correctness, maintainability and understandability."

Yes. I do separate long functions in k onto separate lines. However, long functions in k are rare (and usually) an indication that I haven't arrived at a simple solution.

Writing in J/k/APL allows to think in chunks where the chunk is an algorithm - not all of the tiny steps in an algorithm. It is a higher level of abstraction - not unlike programming in C versus assembly language or machine code.

E.g.

The sum of a list (of any type) in k (APLis similar):

sum:+/x / read "plus over x" or "reduce x with plus"

versus (C code fragment) which computes the sum of integers only:

int sum=0: for(int i=0; i<n; ++i) { sum = sum + x[i]; }

Btw, John Von Neumann once chastised a grad student for writing an assembler. Perhaps real software engineers only write in machine code.

"If your business logic or product is written in line noise written by some lone J genius, your company is fucked when your guy inevitably gets hit by a bus, goes nuts, or leaves for greener pastures."

I think the larger issue is documentation. Undocumented code (of any kind) is a liability. When I write in k, Every line of k is documented (as text past column 80). In addition, there is header documentation that described the purpose and approach of the code in the file/module. The number of lines of code in a file is typically no more than 10 lines.</comment></comment></comment></comment></comment></comment>


Micromotors Take Their First Swim in the Body - <AUTHOR> http://cen.acs.org/articles/93/web/2015/01/Micromotors-Take-First-Swim-Body.html

<comment><USER2> > Two gold-nanoparticle-carrying micromotors zip through gastric acid by > reducing hydrogen ions into hydrogen gas.

I'm reminded of those little "soap boats" that ride along a gradient caused by changing the water's surface-tension.</comment>


Are Software Developers Respected by "Business People"? - <AUTHOR> http://www.mattblodgett.com/2015/06/software-developers-respected-business-people.html

<comment><USER2> From the blog post: _Is this true? Are software developers "geeks" that lack clout and respect with the "business people"?_

Oh, yes, absolutely. You don't see H-1B visas for "business people" or lawyers do you? That alone should tip off who's in charge. Those in charge are not going to import cheap replacements for themselves, only for those not in charge.

As for "why", I suspect that the significant fraction of programmers who don't play office politics (I grant that it's not all programmers, but a large portion of them) means that there's no respect. Also, I believe that "business people" are at least subconsciously afraid of getting automated out of existence, or of having their secret(s) stolen. So, they marginalize programmers. I think you also have to consider that scapegoats are necessary for large projects - major portions of any large project come in late and over budget, or maybe just wrong. Gotta have a scapegoat to hang that on. Programmers are an obvious target due to the lack of political savvy, and having to deal with the reality of hardware, software, etc. Hang blame on a convenient group often enough, and that group ends up not being respected.</comment>


The broadest cross-industry effort to advance the Internet of Everything - <AUTHOR> https://allseenalliance.org

<comment><AUTHOR> Sigh, the home page is kinda hard to understand but as HN prefer the source and not a blog write up but the verge did do an easier to understand write up [http://www.theverge.com/2013/12/10/5194342/one-standard- to-s...](http://www.theverge.com/2013/12/10/5194342/one-standard-to-sync-them- all-allseen-alliance-forms-to-accelerate)</comment>


Open Source as a Habit - <AUTHOR> https://medium.com/@micahhausler/open-source-as-a-habit-56583e928008

<comment><USER2> I like it. I also think that writing code with the intention of releasing it under your own name forces you to write good documentation, clean code and test properly.

Of course, just like my plans to read books every single day, I never succeeded in keeping that up.

<comment><AUTHOR> Worth noting: I'm releasing it all under my employer's organization. I'm still making the commits and getting the 'credit.'</comment></comment>


A $5 Lamp Powered Solely by Gravity - <AUTHOR> http://enpundit.com/a-5-lamp-powered-solely-by-gravity/ <comment><USER3> Previously submitted and seriously doubted:

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

In that thread[0] revelation[1] said:

        At perfect efficiency, this seems to give you about
        55mW for a hour, if I asked Wolfram correctly (for
        20kg lifted one meter) - [2] - So probably a hoax.

[0] <http://news.ycombinator.com/item?id=4889426>

[1] <http://news.ycombinator.com/user?id=revelation>

[2] [http://www.wolframalpha.com/input/?i=20+kilogram%E2%80%90for...](http://www.wolframalpha.com/input/?i=20+kilogram%E2%80%90force+meters+in+milliwatt+hours)

<comment><USER4> If you read some of the followups and tweak the math a little bit, it works out reasonably well. Instead of 20kg and 1m, 20lb and 2m, which comes out about the same (49.42mWh). If you have to lift it every half hour, that's 100mW for a half hour. That's more than enough power to get a useful amount of light out of an LED.

For example, this LED uses 68mW <https://www.sparkfun.com/products/531> and is marketed as "so bright that it hurts to look directly at them"

<comment><USER5> It's hurts to look at it because it's focused into a very narrow beam. Very bright sure - in one tiny spot, and totally useless to illuminate a room.

They even include a photo of the beam pattern - it's almost as focused as a laser.

(You can tell on an LED by looking a the top - round tops are focused, flat ones spread out.)

<comment><USER4> That's fine! It's enough to read a book or do homework after the sun sets. We're not talking first-world style lighting; we're talking about a $5 light that is better than sitting in the dark because you have no electricity and ran out of kerosene to burn.

</comment></comment></comment></comment><comment><USER6> Not to nitpick, bit it's not powered by gravity, it is powered by people going over every 30 minutes and lifting a weight back up to its top position.

EDIT: Apparently people don't understand that using gravity to generate energy is a thing, and the title "Powered Solely" suggested someone found a way to do that.

<comment><USER7> People couldn't lift the weight without consuming energy from food. Doesn't mean that it's powered by food.

The machine converts gravitational potential energy to electromagnetic radiation. People generate the gravitational potential energy by lifting the weight using kinetic energy, which was likewise created by converting chemical energy.

It's easier just to say "Gravity" because, without gravity, it wouldn't work with its inanimate weight.

<comment><USER8> I suppose it all ultimately comes from solar energy, which, in turn, comes from nuclear fusion.

<comment><USER9> And the nuclear fusion is started if not powered by the heat and pressure caused by, wait for it...

GRAVITY!!!

</comment></comment></comment></comment><comment><USER10> Some people get excited by F1 racing, the Bugatti Veyron, or stuff like the latest iPhone, telling you they are technology enthusiasts or engineering fans.

But if you ask me, it's always at the low end of things - like this project - where the really inventive, exciting engineering happening.

Sure, something like an F1 car is impressive after a fashion, but considering the price, yeah, well, it _better_ knock my damn socks off or it just looks stupid. Unlimited budgets do not make for impressive engineering, really.

Making something that is truly, spectacularly useful like this for $5 ot $10? That is genuinely impressive.

<comment><USER11> _"To define it rudely but not inaptly, engineering is the art of doing that well with one dollar which any bungler can do with two after a fashion."_ \-- Arthur M. Wellington

<comment><USER12> My favorite way of expressing the same thing: "Anyone can design a bridge that will stand up. It takes an engineer to design a bridge that will _barely_ stand up."

Not sure where this came from -- Douglas Adams, maybe?

</comment></comment></comment><comment><USER13> Maybe I'm stupid for asking but what is the advantage of this over a spring powered wound clock? My wristwatch can tick for two days on a wind, and while it isn't as cheap as this gravity powered wound clock I'm sure it could be made cheaper. There is nothing special about this invention; purely mechanical "gravity powered" clocks have existed for centuries in the form of old grandfather clocks etc.

<comment><USER14> The advantage of this lamp over a spring powered wound clock would be that it emits light. The disadvantage is that it's comparatively poor at keeping the time.

<comment><USER13> True, but my question is if a clock winding mechanism can keep going for days without need of winding could a clock winding style mechanism be more efficient than a gravity weight powered one.

<comment><USER14> SCNR. I suppose the advantage of clock winding mechanisms is that they can deliver (mechanically) a constant, relatively low level of power. Compared to an LED, a wristwatch uses _very_ little power (about 1µW according to Wikipedia). Of course this lamp may be more comparable to a grandfather clock than a wristwatch; I don't know how much power a grandfather watch requires, but the energy you store winding it up can't be that high since it's not that much work, and the strength of the mechanism is that the stored energy is then delivered over a long time, ie. days.

Also, with clocks, you get to skip the conversion of the energy completely. That immediately gets you a much higher efficiency than this lamp, which is potential energy converted to electricity (losing heat), converted to light (losing heat). Of course energy transmission losses still apply, ie. it's not free to get the mechanical energy from the spring to the hands of the watch.

</comment></comment></comment></comment><comment><USER15> I use kerosene lights by choice in the winter in weeks like this one when there is no sunshine. So, here's my firstish world problems take on it. May not apply to people for whom a gallon of kerosine is a significant fraction of their monthly income.

I have a hard time seeing myself using something like this, except as task lighting. I'd be fine to have to lift a weight if I was only going to be using the kitchen for 30 minutes (it could even serve as a useful timer), or similar. But getting up every 30 minutes rules out using it anywhere I need longer duration light for eg, reading.

Also, anywhere I could use this, I could use any of the many inexpensive crank LED lamps available everywhere, which run for similar amounts of time.

The pity is that, with the right design, this could support a longer cord for a further lift distance, so it'd run an hour. Or multiple weights used in sequence or parallel so it can be primed for even longer (iirc that's how my grandparent's cuckoo clock worked). From what I can see, it's not designed to be very hackable, and something like this needs hackability.

The LED light is the other problem with it; I'd much rather have a well ventilated kerosine light than blue tinged LED for almost any task. (I'm curious to see studies about kerosine health risks however.) Since this light cannot be moved, it has to illuminate the whole area, and its light doesn't seem up to it, so I'd be doubtful about eg, reading by it either.

<comment><USER16> This idea just hit me, and it's so powerful I'm still reeling. What if someone built a battery-powered weight lifter that would go off every 1/2 hour? You wouldn't have to keep getting up to do it yourself!

Not sure if I should patent this, or just donate it to the greater good of mankind.

<comment><USER17> are you proposing propetual motion? if you have the energy to lift the mass, you have the energy to power the light directly and bypass the losses of setting up the dravity weight again.

</comment></comment></comment><comment><USER18> First thing I thought when I saw the title was: Linux, apache, mysql, php...

<comment><USER19> I'm not sure why you were downvoted, as I bypassed the article probably at least a couple times before realizing that it didn't say "Lamp Server" and just said "Lamp".

<comment><USER20> "A $5 LAMP Server Powered Solely by Gravity", if I read that I would have clicked instantly.

</comment></comment></comment><comment><USER21> Technically powered by the effort of lifting it.

<comment><USER22> Technically powered by the food eaten to lift it.

Technically powered by the sun.

Technically shut up with useless pedanticism.

<comment><USER23> It's not very useless. The title suggests a perpetual motion machine, so I was wondering what that was doing on HN. Knowing you have to lift it first (from the article or from the comments) is important to know and lets one think this isn't necessarily made up.

<comment><USER22> You _infer_ a perpetual motion machine, they say it is 'powered by gravity'.

<comment><USER24> Which is something I infered as well, and probably many others. The title is confusing and that is all the OP was pointing at, so you know, be nice - <USER2> wasn't trying to undermine the achievements, if any.

</comment></comment></comment></comment></comment><comment><USER25> Similar in concept to the Waka Waka light, except that's powered by a solar panel (and some quite nifty electronics):

<http://www.wakawakalight.com/>

</comment><comment><USER26> As always, the devil is in the details here. Does this lamp produce enough light for a family to be motivated to actually lift it every N minutes (e.g. does it produce enough light to read comfortably, or to cook a meal)? Is it durable enough to survive in essentially outdoors conditions in terms of heat and humidity? If the answers to these questions are positive, it's certainly a great invention. If not, back to the drawing board.

</comment><comment><USER27> As we all argue over whether this is powered by gravity, or food, or nuclear fusion, somewhere in a dark hut someone is lifting a weight to attend to the baby that just woke up in the middle of the night.

</comment><comment><USER28> This is not a new idea. Cuckoo clocks, which is common in germany, works without a battery. we need to pull up the weights everyday.

</comment><comment><USER29> I don't seem to be in the target audience but the first question that came up is: How much noise does it make?

</comment><comment><USER30> I don't quite understand HOW does it turn the weight into energy. Could someone enlighten me?

<comment><USER31> the weight is on a string. That string is connected to a crank that turns a generator as it falls.

<comment><USER30> Oh, and as I understand, the amount of weight is important due the resistance of the crank?

</comment></comment></comment><comment><USER32> It's not powered 'solely by gravity'

It's powered by a human lifting the weight.

</comment><comment><USER33> If it's real, I wonder if the gears are noisy...

</comment><comment><USER34> Pretty cool idea.</comment>


Basscss – Low-level CSS toolkit - <AUTHOR> http://www.basscss.com/ <comment><USER2>
      .italic  { font-style: italic }

from [0]

This is certainly odd considering how far we've come in embracing semantic markup and styling.

[0]: [http://www.basscss.com/docs/utility- typography/](http://www.basscss.com/docs/utility-typography/)

<comment><USER3> Considering how we build HTML from templates anyway, this form might be more useful, especially in something like React components. I.e. you build the full class string in code rather than defining separate CSS classes for each component. Your components are obviously named semantically and all relevant CSS styles / transitions / animations are defined inside the component code.

<comment><USER4> the ypeface isn't semantic so the name reflecting the typeface isn't either. emphasis has semantic value (think of the latex command \emph), but italics is styling

</comment></comment></comment><comment><USER5> <div class="col col-6 sm-col-4 md-col-3 lg-col-2 px2 mb3">...

Another example of something that's tiny and super fast for prototyping but produces code bloat and non-semantic classes. Looks great otherwise. No SASS version?

<comment><USER6> I get the non-semantic classes argument, but I've never seen a solution that is generic, responsive, and semantic. Any leads?

<comment><USER7> The idea is more to write it for each site, so you have site specific design

<comment><USER5> Right. I use mixins to apply these declarations to classes. Which has its own drawbacks.

</comment></comment></comment></comment><comment><USER8> What does "immutable" mean in the context of CSS?

<comment><USER8> Found their definition[0] of what immutable means. Apparently the idea is that you can trust that the rules in an immutable CSS selector will never change in the future. "Immutable" seems like a pretty confusing term for this.

[0] [http://www.basscss.com/docs/reference/principles/#immutable-...](http://www.basscss.com/docs/reference/principles/#immutable- utilities)

<comment><USER9> I guess after "Object-oriented CSS" it was inevitable we would get Functional CSS...

</comment></comment></comment><comment><USER10> I really really want to love this. I'm so close to loving it.

I'm a fan of utility classes. I don't think that classes should be named based on their content, or that we should be using stupidly specific and complex selectors so we can keep our markup clean (clean markup has nothing to do with class names or selectors); But I feel like this takes to too far.

What do I gain over inline styles? This doesn't seem to be too much more maintainable than that.

<comment><USER11> You gain a significant amount of performance. And readability. You would also lose a lot of the benefits of framework level variables with only using inline styles.

</comment></comment><comment><USER12> Looks nice! But I wonder, what is the reason to use this over something like bootstrap?

<comment><USER13> I initially thought, hey great that's something you simply include and have a base layout that's a great starting point for any type of project, but after looking through the document I realized that it comes with as many "modules" as bootstrap or other full-blown "css-frameworks". Wish they just made a better and more consize and proven {normalize.css reset.css base.css}

Some of the styles are nice and ready to copy though, ie. the table styles, but not sure what the intention of this project is.

\--

→ What lightweight css-starter-kit would you choose for any of your upcoming projects? Other than reset.css or normalize.css of course :)

I don't like bootstrap and similar, because it's just too large and most people end up using all of the classes and the whole javascript instead of only the stuff they need. Bootstrap is absolutely great for projects that quickly need a whole "UI Theme" fix.

<comment><USER14> I like Nicolas Gallagher's SUIT CSS style foundation, utilities and components. [https://suitcss.github.io/](https://suitcss.github.io/)

<comment><USER13> That's completely new to me, but it looks nice. Thank you. I only knew about stylus, [http://learnboost.github.io/stylus/](http://learnboost.github.io/stylus/) but that's just a preprocessor.

</comment></comment></comment></comment><comment><USER15> "low level" CSS? It's a sad day when a collection of CSS classes is referred to as "low level". Lower level than bootstrap, I assume?

<comment><USER16> Yeah, confusing. "Low level" CSS at best seems to refer to composable and minimal.</comment></comment>


A Virus Found in Lakes May Be Literally Changing the Way People Think - <AUTHOR> http://www.businessinsider.in/A-Virus-Found-In-Lakes-May-Be-Literally-Changing-The-Way-People-Think/articleshow/44985570.cms

<comment><AUTHOR> [http://www.pnas.org/content/early/2014/10/23/1418895111](http://www.pnas.org/content/early/2014/10/23/1418895111)

<comment><USER2> Thanks for the link. I have bin swimming in lakes a lot wen i was a kid, makes you think...</comment></comment>


Howland Will Forgery Trial - <AUTHOR> https://en.wikipedia.org/wiki/Howland_will_forgery_trial <comment><USER2> While I appreciate that they attempted to use some kind of scientific reckoning, using a weak science (handwriting analysis) and then adding ridiculously high numbers to it (1/2.666E21) is a really bad way to decide on this.

Link below [2] explains that the probability was NOT 1/2.666E21 that it was not fake, because it is more likely than that that the science of handwriting analysis is incorrect, or that the analysis was done incorrectly, or anything similar (i.e. A one-in-a-trillion chance is more likely to be incorrect than one-in-a-trillion).

Bonus round: They also commit the "Prosecutor's fallacy" [1], where they explain how likely the evidence is given the hypothesis instead of explaining how likely the hypothesis is given the evidence. Example: You are found in a store and accused of robbing it. They ruled that you were accused of robbing the store, and you being in the store fits this theory, when they should have ruled on how likely you were to have robbed a store when they only knew you were in it (not very likely, lots of people may have been in the store).

[https://www.lesswrong.com/posts/GrtbTAPfkJa4D6jjH/confidence...](https://www.lesswrong.com/posts/GrtbTAPfkJa4D6jjH/confidence- levels-inside-and-outside-an-argument)

<comment><USER3> > using a weak science (handwriting analysis) and then adding ridiculously > high numbers to it (1/2.666E21) is a really bad way to decide on this.

Ah, but ridiculously high numbers get such a nice emotional reaction from a jury.

I once had a conversation with a guy who fiercely proclaimed that if you shuffle a deck of cards, the resulting ordering is likely to be utterly unique in the history of all shuffled decks ever, because there are <dramatic pause /> 8E67 possibilities!1! Same as the number of atoms in our galazxy!

I went on to explain that while in theory this is true, in practice there are a lot of caveats. Since brand new unopened deck of cards are usually all in the same order, and since a perfect cut and a perfect riffle shuffle (left/right/left/right/left etc) will always produce one of two orderings, depending on whether you start with the left or right decks, etc etc, it lowers the odds drastically. And it would be more proper to say that if you sloppily shuffle a deck about 7 times, _then_ the original claim is probably true.

But I lost the crowd. They had already had an emotional reaction to the enormous number .

</comment></comment><comment><USER4> How is it possible that a wiki page about a trial neglects to mention the outcome?

> The Circuit Court finally refused to admit the complainant's testimony, and > dismissed the bill with costs. An appeal was taken, but withdrawn, on a > settlement between the parties whereby the complainant received her > expenses, costs, and counsel fees. The probate of the will of September I, > 1863, therefore, remained undisturbed,

From [https://scholarship.law.upenn.edu/cgi/viewcontent.cgi?refere...](https://scholarship.law.upenn.edu/cgi/viewcontent.cgi?referer=https://www.google.com/&httpsredir=1&article=4300&context=penn_law_review)

Which references as the original source:

> The American Law Review (vol. 4, pages 629-54)

<comment><USER5> Not sure if this was added before or after your comments, but at the time I'm looking, the last scene sentence in the second to last paragraph of the intro is "The case was ultimately decided against Robinson after the court ruled that the clause invalidating future wills and Sylvia's signature to it were forgeries"

<comment><USER4> Looking at the edit history it seems that someone came in and gave the article a general cleaning.

I wonder if it's a viable strategy to post sub-par, but interesting pages to HN in order to attract high-quality edits...

</comment></comment></comment><comment><USER6> A one in 2,666,000,000,000,000,000,000 chance that 2 signatures would match... Sounds about right for my own signatures ;-) When signing multiple documents I get very different versions each time. As in.. some expert would probably think they'd be fakes.

Are signatures still this valuable in court, in this day and age? Given that they should be easy enough to properly forge, instead of straight out copy.

<comment><USER7> I used to get stressed at supermarket checkouts back when you had to sign your name on the credit card slip. More than once I was asked to do it again and then you felt all eyes on you and it was even harder.

</comment></comment><comment><USER8> Signatures are bullshit. And the line:

> the probability that all 30 downstrokes should coincide in two genuine > signatures was 1 2.666 × 10 21 {\displaystyle \textstyle {\frac > {1}{2.666\times 10^{21}}}} \textstyle\frac{1}{2.666 \times 10^{21}}. That is > one in 2,666,000,000,000,000,000,000, in the order of magnitude of > sextillions.

is such outrageous bullshit that I'm saddened he wasn't immediately laughed out of court.

<comment><USER9> Outrageous bullshit like this appears in modern court cases all the time today. For example, it is common to cite astronomically small odds that a DNA match is in error, completely ignoring the far higher odds that the sample was accidentally contaminated, or the lab deliberately falsified the result to satisfy prosecutors, etc. I'm not saying that DNA evidence is bullshit, only that the only way to get something like a 10^-21 odds of error is to ignore all the largest possible error sources.

</comment></comment><comment><USER7> So one way of determining if an instance of a signature is genuine is that it should differ to a significant degree with all other known previous instances. What a brilliant use of probability so long ago

</comment><comment><USER10> Similar to will forgery, deed forgery is still a problem today. In fact, it is a growing problem, as forgers have the information and access they need through online land records. While online land records have greatly simplified real estate closings, this is one downside. County recorders are unable to stop these forged deeds, as they are legally required to record all deeds that are appropriately formatted.

Many counties have deed recording alerts that alert property owners to documents recorded against their name or property. However, many counties do not offer this service, leaving property owners unaware of these forged or fraudulent deeds, until they receive an eviction or foreclosure notice. As such, we are offering a Title Watch service to inform you about potential forged or fraudulent deeds recorded in your name or against your property. Please visit us at [https://plathq.com](https://plathq.com)

<comment><USER11> (1) Interesting connection to the original story. This is the sort of not- exactly-an-ad-because-it-is-related mention that I find cool about Hacker News.

(2) Let me see if I get this right: you offer a service that simply monitors deeds and mortgages recorded against a specific plat and sends an alert to to the subscriber if something is recorded (which is an extremely rare event). And you charge $10/month/property for this service? What about the problem makes it so expensive? Why aren't you likely to be disrupted by someone like Zillow offering this $10/month service for FREE (and making money off the address list they develop from it, plus advertising to all the homeowners)?

<comment><USER10> Glad you liked the "not-exactly-an-ad-because-it-is-related mention." While the probability of a forged deed is relatively low, the impact is not. In addition to the risk of a thief just forging a deed to a property they have no connection to, there is also the risk of intra-family deed/mortgage forgery. This intra-family forgery is likely substantially underreported, and causes the family to lose the property it has acquired through hard work because of one bad apple.

In addition, people are (rightly) highly risk-averse about anything that affects their family, their home, or the assets that they built over years and decades. For example, real estate investors commonly put their property into an LLC (which costs $800/year in CA) or buy liability insurance, even though the probability of incurring a large liability is low.

With respect to costs, even though land records are public, machine-parseable title/recorder data is expensive. Data from the tax assessor (even machine- parseable) is relatively cheap, but is not as complete as recorder data. For example, it does not have mortgages. We intend to achieve economies-of-scale with respect to recorder data. At that point we intend to offer additional value at the same price (for example, insurance) and add a free-but-sell-leads service.

</comment></comment></comment><comment><USER12> The Peirce family are some of America's most under appreciated mathematicians and logicians.

</comment><comment><USER13> It must be supremely frustrating to a quantitative person when the statistics meet reality: a jury that says, "well, there's still a possibility he didn't do it, isn't there? You want to have us convict someone on math?"

<comment><USER14> The standards in question are preponderance of the evidence (civil) and beyond a reasonable doubt (criminal). The standard is never "any possible way" or "no possible way."

So my response would be that at a certain point, a tiny possibility does not amount to reasonable doubt.

<comment><USER13> Many people, especially when you have average people on a jury, are not very good at drawing lines where the certain % or probability equals less than a reasonable doubt.

</comment></comment></comment><comment><USER15> When I read this quote, I think that either - we have lost a great deal of literary education - or we have lost a lot of hogwash.

      "So vast improbability is practically an impossibility.
      Such evanescent shadows of probability cannot belong to
      actual life. They are unimaginably less than those least
      things which the law cares not for. ... The coincidence
      which has occurred here must have had its origin in an
      intention to produce it. It is utterly repugnant to sound
      reason to attribute this coincidence to any cause but
      design."

</comment><comment><USER16> > _The coincidence which has occurred here must have had its origin in an > intention to produce it._

That is awesome!

</comment><comment><USER17> But did they find out if she was a witch?</comment>


Mruby – Ruby in your browser - <AUTHOR> http://joshnuss.github.io/mruby-web-irb/ <comment><USER2> Since this project depends on webruby and webruby uses emscripten, it could get close to 2x native performance in browser(only firefox nightly) because of the awesome asm.js support.

I am a big supporter of asm.js after reading John Resig's post on it(<http://ejohn.org/blog/asmjs-javascript-compile-target/>).

</comment><comment><USER3> Nice to see! Some things are working very well:

      >> class Fixnum; def even?; self%2==0; end; end;
      >> (1..100).to_a.select{|i| i.even? }

But some basic things are broken:

      >> n = 5
      => 5
      >> n
      => RuntimeError: arena overflow error

<comment><USER4> local scope is now fixed.

</comment></comment><comment><USER5> Very cool. We wrote a post about different techniques to getting Ruby in the browser on our blog: <http://blog.bloc.io/running-ruby-in-your-browser>

Webruby (Mruby.js) was one of the options we considered but ultimately didn't use.

</comment><comment><USER6> I was at a talk on mruby at a recent conference. It's some interesting stuff: the program size footprint is only something like 40k , and memory usage is around the same when running. It was initially meant for embedded systems, but seeing it here is also an interesting use case.

</comment><comment><USER7> Cool! When I read the title I immediately thought - it must be done via emscripten, and it turned out that I was right :)

</comment><comment><USER8> It'd be nice if someone could show an example of a webpage embedding some ruby code interacting with some js code/framework or something like html5 canvas. Just to see how they "communicate".

<comment><USER9> They did: <https://gist.github.com/xxuejie/5023857>

</comment></comment><comment><USER10> I remember you could also get it into iOS. Perfect if you wanted to script some stuff in Ruby. I'm currently using JS for that, but Ruby should do as well.

<comment><USER11> In fact, I've made an mruby REPL for iOS: <https://github.com/jzzocc/mirb-iOS>

</comment></comment><comment><USER12> Multiplying two large Fixnum, gives a float value.

<comment><USER13> Javascript doesn't have integer types.

</comment></comment><comment><USER14> This makes it crash

1000000.times{|i| puts "hello #{i}"}

</comment><comment><USER4> couple of tips:

jquery's $() is aliased to j() in ruby. Try:

j('body').css background: 'pink'

window is alias to w(). E.g.:

w.alert('hello from ruby')

puts w.prompt('saywhat?')</comment>


Lthread - C coroutine lib with multicore support - <AUTHOR> https://github.com/halayli/lthread?id=1 <comment><USER3> This looks kind of neat. Too bad about the GPL license though -- I'll probably never get a chance to use it.

<comment><USER4> My excitement level went from very high to instantly zero because of GPL. A real shame. I wonder if they'd consider switching to a more open license.

<comment><AUTHOR> I am not married to the license. I noticed several complaints, so I am going to reconsider it. :)

<comment><USER5> _I am not married to the license. I noticed several complaints, so I am going to reconsider it. :)_

So did any of them actually make specific complaints (e.g. "I can't link this to with my already-developed proprietary project because your code is GPL. LGPL would work great."), or is it just the usual whiners who complain about anything GPL?

<comment><USER4> I do iOS development where GPL source code can't be used so it's an automatic non-starter.

<comment><USER6> Then you'd be even more bummed to discover that even if halayli changes the license to BSD (which I hope he does not), you won't be able to use it because it is x86/AMD64 only.

<comment><USER7> There's no reason that a contributor can't develop ARM support. A contributor can't change the license.

</comment></comment></comment></comment></comment></comment></comment><comment><USER8> How does it compare with Russ Cox's libtask, which includes channels? <http://swtch.com/libtask/>

<comment><USER9> "Libtask gives the programmer the illusion of threads, but the operating system sees only a single kernel thread."

</comment></comment><comment><USER10> Looks really cool.

If I understand it correctly, the first call to lthread_create() in the main thread will create a new pthread with a local scheduler. Each call to lthread_create() in that lthread will create local lthreads in that scheduler, so in essence each lthread pool is actually single threaded unless there is a non exclusive or blocking operation you can run lthread_compute_begin()/lthread_compute_end() on. This is opposed to something like Grand Central Dispatch where you can assign "tasks" to the scheduler which will schedule them on an available thread pool.

<comment><AUTHOR> It will not create a new pthread in the local scheduler but a local lthread scheduler gets created in the thread context. So if you want to create more than one lthread scheduler, you just have to create a pthread first and the new lthreads created in the pthread will be bound to that pthread.

lthread_compute_begin()/end() moves the lthread into a separate pthread and resumes it there. That pthread is called lthread compute scheduler, its job is to resume lthreads that will take relatively long time to finish a task. lthread compute schedulers are created as needed and they stay alive for 60 secs after which they die of inactivity. If it fails to create a new pthread (max pthreads reached for example) to resume the lthread, then it will get queued in the least busy compute scheduler. When few lthread compute schedulers get created, they act as a pool accepting new lthreads and resuming them, when they cannot handle the load, the pool grows until the pthread limit is reached and jobs will get queued up.

I believe this is close to what GCD does but probably not exactly the same.

<comment><USER11> rather than queuing in the least busy scheduler, they could perhaps be queued centrally waiting for a scheduler?

Knowing when a long-running task finishes is not easy to guess.

<comment><AUTHOR> I have a requirement that I couldn't get rid of yet, which requires me to know which scheduler it is going to run on before I let go of it. Once I manage to find a way around it I'll move to a global queue model.

</comment></comment></comment></comment><comment><USER12> The autoconf script checked into the repository assumes that I have aclocal-1.10, but I have aclocal-1.11, so I autoreconf -fi to fix it. (I recommend not checking this stuff into the repository.) Then the build fails because of -Werror=unused-but-set-variable (it's better to cast return to void than to try to trick the compiler by assigning to a variable that you don't look at). You have two versions of the README that are both in markdown, but differ in a few lines. There doesn't seem to be any automated support for building and running the tests.

</comment><comment><USER13> I believe we, developers, would love to see benchmarks or a few small code snippets rather than pure documentation. By the way, I have noticed that Ryan Dahl of node.js has mentioned you on twitter @ryah:

> Cute but only a fool would introduce this complexity and overhead for easing > their C programming experience.

Anyway, that's cool. Keep up good work, tebrikler :)

<comment><USER14> Ryan has a vested interest in not having people adopt coroutines since they show that his stupid "events with callbacks are faster and easier than threads" is bullshit. The truth is if you have coroutines (and these are really easy in unix with C), then you don't need callbacks and you can make an event based system look and work exactly like a thread based system without the shared resource drawbacks. With coroutines you can also do callbacks, so you can get the best of all worlds, which you can't get with pure callbacks only system like Node.js has.

<comment><USER15> Coroutines do impose some overhead - each coroutine still requires its own stack. You either have to allocate a stack big enough for the maximum depth that a coroutine will need (and when you're making complex library calls, that can be pretty deep) - OR - you save memory by assuming that the "suspend" call will only occur when there's relatively little stack space used, in which case you manually save/restore the stack by copying - and hope that the overhead of copying a stack for each context switch isn't a killer.

I'm also guessing that it's also not entirely true that there are no shared resource drawbacks. Whenever lthread moves a heavy computation into a pthread, all synchronization bets are presumably off. If you've got two "CPU intensive" workers that reference the same data structures, then you're still going to need mutexes, right?

<comment><AUTHOR> Yes a coroutine user has to be aware that allocating on the stack has a penalty, similar to being aware that you cannot make a blocking call in an IO loop for example.

On average, yielding ~10 calls deep results in copying ~75 to 100 bytes but it all depends on what has been on the stack. One advantage in lthread is it's easy to take advantage of cores which isn't very natural in IO loops.

Yes you'll need a synchronization mechanism when accessing shared data structures from multiple CPU intensive workers.

<comment><USER6> Wait a sec .. I just realized you're copying the entire stack. If I understand correctly, that means that when you move stuff to a compute_lthread, the addresses of local variables change, don't they?

I often take addresses of local variables -- if I understood correctly, this deserves a huge warning in the documentation.

<comment><AUTHOR> Correct. The local variables address change, but you can still access them, and pass them to functions. What you cannot do is save a pointer of a variable and access inside begin()/end().

I thought I added a warning in the lthread_compute_begin() section but apparently not. I'll go ahead and add it.

<comment><USER6> It might also be possible to have a "debug mode" that scans the stack while copying it to the lthread_compute_begin() thread, and warns you if any of it looks like pointers that point into the copied stack. It will probably be negligible compared to a long-running thread (compare 60 pointers against a lower and upper bound), and it might have false positives occasionally -- but could save a lot of debugging time...

</comment></comment></comment></comment></comment></comment></comment><comment><USER16> Very cool. I'm try to understand the stack handling in lthread_compute.c - <USER2> you explain briefly how this works? What is the memcpy for in _lthread_compute_save_exec_state?

</comment><comment><USER17> Looks extremely nice.

<comment><AUTHOR> Thanks!

<comment><USER11> Very nice :)

[http://williamedwardscoder.tumblr.com/post/17112393354/a-sol...](http://williamedwardscoder.tumblr.com/post/17112393354/a-solution- to-cpu-intensive-tasks-in-io-loops) might be an interesting distraction ;)

<comment><AUTHOR> I am against IO event loops :).

Scroll down to the bottom of the README and look for fibonacci(35) to see how I solve the problem mentioned in the link. The example is a naive HTTP server that computes fibonacci on every request and replies back.

<comment><USER11> Yes I saw before I posted :)

You move it explicitly to its own thread. What would happen if you didn't do that?

My article is applicable to `lthread` too. Its a discussion about what happens to fib(35) or any blocking task running in a multiplexing-tasks-in-a-thread setup really.

<comment><AUTHOR> What happens is that it will block the other lthreads, bringing down the RPS to its knees. lthreads are simply coroutines and cooperation/trust are required to maintain fairness.

</comment></comment></comment></comment></comment></comment><comment><USER18> looks not bad. If can provide more benchmarking d be good

</comment><comment><USER19> Lemme see if I understood this right: you rewrote a large part of the kernel because you think your code will be better than code that's been tested by (literally!) billions of people over the course of 15 years?

Not that there is anything wrong with this approach (I rewrote glib'c memory allocator, which is atrociously broken for modern systems), but you better have a _very good_ explanation for why you did this.

P.S. I won't touch on the fact that a good scheduler will necessarily need to run in kernel-mode, not user-mode. But that's a subject for another discussion.

<comment><AUTHOR> This has nothing to do with the kernel scheduler. lthread is a coroutine library, you can think of it as a micro task scheduler inside the process (userland). It's ideal for socket programming because it avoids using callbacks and minimizes complexity.

<comment><USER19> It has _everything_ to do with the kernel. You've taken a piece of code that belongs in kernel-space and put it into a user-space process.

There _might_ be valid reasons to do so, but since I haven't seen any good explanation I'd just assume this project was coded for lulz or out of technical ignorance.

P.S. "avoids callbacks" and "minimizes complexity" is a red herring; all threaded code has these properties, regardless of how the threading engine is implemented behind the scenes.

<comment><USER6> It has _little_ to do with the kernel. There, are we friends yet?

Here's a valid explanation, which wasn't explicitly given, although it was hinted at: kernel threads take resources that become significant when you want a very large number of threads (say, one million). The per thread overhead, including user stack, kernel stack and control structures are at a minimum of ~8K. That's 8GB for a million threads before you actually get to do anything useful.

However, lthreads can realistically take as little as 100 bytes per thread, which puts us at a 100MB footprint for the same case. That's a huge difference.

There are tradeoffs, but that's a potentially useful use case which kernel threads do not support (and which, in general, requires async programming, which lthread implements while emulating a thread API).

</comment></comment></comment></comment><comment><USER20> It's GPL, not LGPL and therefore uninteresting for most potential users.

<comment><USER14> Even though it's GPL you should still read the code. It's very well written and educational. If GPL means you refuse to even read the code then I'm sad for you.

<comment><USER21> Technically if you read GPL'd code, you can't reproduce it as whole or in part under anything else but GPL (as this creates a derivative work). One of the reasons why some people take extreme care when dealing with GPL'd sources - one person reads it, then describes to others and they act on that.

<comment><USER22> Wrong, GPL is protected by copyright just like all the other licences, so as long as the reproduction is not verbatim but instead your own implementation based on the information you gathered while examining the code then there's no copyright violation.

<comment><USER23> Copyright violation isn't restricted to verbatim reproductions. I sympathize with eps. There are also a good number of people, believe it or not, who think that GPLv3 is too vague with its "distribution" criteria that a court could determine that it's effectively the same as AGPLv3. So if there's a policy not to use AGPL, which is fairly common because SaaS is an easy way to create the "secret money making sauce" of a business otherwise built on open source, GPLv3 will also suffer adoption.

eps' general concern is that this is entirely a court matter; the spirit of the GPL and sharing is meaningless to the law because at the end of the day there are only so many ways you can type "LIST_INIT(&new_sched->new);" and if a shitty programmer/programmer's company is suing you and has evidence you looked at that line of code that may be enough for a shitty judge to side with them. For similar reasons I don't have a habit of looking at patents (though that's usually because patents, even non-software-patents, are shit and obvious to the layman let alone someone in the field), but I do read (and have contributed to) GPL code.</comment></comment></comment></comment></comment>