How a differential gear works (1937) [video] - <AUTHOR> https://www.youtube.com/watch?v=K4JhruinbWc <comment><USER2> Wow, that was a fantastic video. I could understand it easily only because they iteratively added complexity to the models. It's amazing how well they have made the tutorial for the layman.

Thanks a lot for sharing.

<comment><USER3> If you liked that, you might like this similar video about how a mechanical watch works:

[http://www.youtube.com/watch?feature=player_detailpage&v=508...](http://www.youtube.com/watch?feature=player_detailpage&v=508-rmdY4jQ#t=315)

<comment><USER2> Enjoyed watching it. Thanks. :-)

</comment></comment></comment><comment><USER4> Nice to follow that with this short video illustrating how one type of locking differential works to eliminate some of the disadvantages of an open differential.

[https://www.youtube.com/watch?v=MCxqUJCZGNU](https://www.youtube.com/watch?v=MCxqUJCZGNU)

<comment><USER5> So, one wheel starts spinning, and then, at a certain speed, it gets immediately locked into the other wheel which isn't moving at all? How does that not blow up the entire differential?

<comment><USER6> With a hard-locking differential ("lockers", generally used off-road), engagement while one wheel is spinning is ill-advised. They're generally toggled on at low/zero speed by the operator in anticipation of a traction- loss situation.

The variety of differential which does not immediately lock one wheel into another is [http://en.wikipedia.org/wiki/Limited- slip_differential](http://en.wikipedia.org/wiki/Limited-slip_differential) .

<comment><USER7> Yup. And they typically have to be unlocked when not needed as it is almost impossible to turn with the rears locked. However, with pneumatic or electrical operation from the driver's seat this is pretty convenient.

The type of locker I'm more familiar with takes a different approach: the rear end is locked by default but unlocks when it needs to. e.g., going around a turn causes the outside tire to turn faster than the inside one, and the teeth in the locker are angled so the speed difference causes them to cam out and decouples one axle shaft from the diff, letting it spin independently while the inner axle shaft is under power.

I had that system in my Toyota pickup and even in 2WD, it was absolutely unstoppable offroad.

</comment></comment></comment></comment><comment><USER8> I use this video quite often to show an example of one of the best educational videos I have ever seen. The language, presentation, use of graphics (impressive for the time) and demonstrations is just superb.

</comment><comment><USER9> I like how they start ghost riding the whip at 8:45 [https://www.youtube.com/watch?v=K4JhruinbWc#t=519](https://www.youtube.com/watch?v=K4JhruinbWc#t=519)

</comment><comment><USER10> _Around the Corner_ (1937)

Producer: Handy (Jam) Organization ☞

Sponsor: Chevrolet Division, General Motors Corporation

Probably the source of this re-encode, with significantly less artifacts, on archive.org: [https://archive.org/details/Aroundth1937](https://archive.org/details/Aroundth1937)

☞ Named after Jam Handy: [https://en.wikipedia.org/wiki/Jam_Handy](https://en.wikipedia.org/wiki/Jam_Handy)

</comment><comment><USER11> If you like videos like this, check out Retrotechtacular on Hackaday. They have a series on mechanical firing computers on navy ship that is nothing short of mech-eng porn, and I mean the classy kind.

<comment><USER12> That was amazing, thanks. I found the integrator and multiplier especially simple and clever.

Here is a link to a youtube playlist: [https://www.youtube.com/user/navyreviewer/videos?query=mecha...](https://www.youtube.com/user/navyreviewer/videos?query=mechanical+computer)

</comment></comment><comment><USER13> My favorite: Wave Behavior from Bell Labs: [https://www.youtube.com/watch?v=DovunOxlY1k](https://www.youtube.com/watch?v=DovunOxlY1k)

</comment><comment><USER14> Excellent use of graphics, created in the age before computer graphics.

<comment><USER15> A World War 2 training video for evading flak cannon fire is one of the best examples of graphical information presentation that I've seen. [https://www.youtube.com/watch?v=qP_-WUMi- nw](https://www.youtube.com/watch?v=qP_-WUMi-nw)

It features smoothly animated and highly functional designs as well as overlaying graphics on real footage to achieve a fashion of "augmented reality". The production quality is astounding and it is amazing to think that it was produced in the 40s. The entire video is an inspiring example of conveying information.

<comment><USER16> That was really interesting. I never knew there was this kind of strategy behind flak evasion. Man, must have taken some stones to do a bomber mission. I knew an old timer that flew bombers in WW2 and he said towards the end of the war the germans were running out of metal and all sorts of things were used as flak. He said nuts and bolts were pretty common. He'd find them embedded inside the cabin after close flak fire. Pretty scary to think that your end might come from a washer.

<comment><USER17> RAF Bomber Command had appalling rates of attrition through WWII.

[http://en.m.wikipedia.org/wiki/RAF_Bomber_Command](http://en.m.wikipedia.org/wiki/RAF_Bomber_Command)

The wiki article gives good explanation of how bombing developed during WWII - starting as a weapon to terrible to be used (based on poor quality data); with general agreements not to kill civilians; realising that bombers were hopelessly inaccurate; changing tactics to allow bombing of civillian populations, including the (to my mind) war crimes of fire bombing.

> Bomber Command crews also suffered an extremely high casualty rate: 55,573 > killed out of a total of 125,000 aircrew (a 44.4% death rate), a further > 8,403 were wounded in action and 9,838 became prisoners of war.

That's pretty much "toss a coin".

</comment></comment></comment></comment><comment><USER18> Wow! Amazing.

There's another video from 1949 about 'How a Watch Works' — [http://www.youtube.com/watch?v=508-rmdY4jQ](http://www.youtube.com/watch?v=508-rmdY4jQ)

</comment><comment><USER19> I had not seen this particular video but have seen the "How a manual transmission works" from the same series.

[https://www.youtube.com/watch?v=aAWxZRuBXtw](https://www.youtube.com/watch?v=aAWxZRuBXtw)

</comment><comment><USER20> An interesting mechanism using differential gears, doubling the speed while only using gears of the same size:

[http://507movements.com/mm_226.html](http://507movements.com/mm_226.html)

</comment><comment><USER21> The way the teaching was sequential really made it an understandable to a layman like myself.

</comment><comment><USER22> There's a chap who collects tons of videos like this on YouTube. He was mentioned on MetaFilter the other day: [http://www.metafilter.com/143903/Do- you-like-vintage-trainin...](http://www.metafilter.com/143903/Do-you-like- vintage-training-educational-fims-Meet-Jeff-Quitney)

Or you can find his channel direct on [https://www.youtube.com/user/webdev17/videos](https://www.youtube.com/user/webdev17/videos)

</comment><comment><USER23> This is the best technical education video I've ever seen. If all information were available in such an easy to understand form, the world would be full of geniuses.

The level of effort is astounding. The "support" part holding the spokes looks cast. They couldn't have possibly cast that part specifically for this video... could they?

<comment><USER24> casting one-offs with a disposable form (wax, styrofoam) isn't particularly difficult or expensive. They use big basins full of super-fine sand: a great insulator and the grains are too tightly packed for the liquid metal to flow into the tiny spaces between them. We used to do it in high school shop class.

</comment></comment><comment><USER25> Brilliant video. It's definitely a lot better to see the basic principles and evolution of those principles in action.

</comment><comment><USER26> I remember reading through David Macaulay's "The Way Things Work" as a kid, soaking up the illustrations until I understood each one. It was life- changing. However, I remember having trouble with one page in particular -- the one describing differential gears. Of course, video would probably have helped a lot :)

</comment><comment><USER27> I remember seeing this a while back and realizing I learned more from this video than I learned in class during my college course. Amazing production value. We should properly catalog such gems so that students and even professors can use these to teach (instead of attempting to reinvent the wheel)

</comment><comment><USER28> I'd like to see a Torsen gearcase. Strange little things, they look like pepper grinders.

</comment><comment><USER29> I remember building lego cars which had a differential: [http://groups.csail.mit.edu/drl/courses/cs54-2001s/images/le...](http://groups.csail.mit.edu/drl/courses/cs54-2001s/images/legodiff.jpg)

</comment><comment><USER30> The actual explanation doesn't start until about 2 minutes in: [https://www.youtube.com/watch?v=K4JhruinbWc#t=110](https://www.youtube.com/watch?v=K4JhruinbWc#t=110)

</comment><comment><USER31> I was generally not bad at physics but I remember not getting my head around this one...

What a great lesson for decoupling systems. I wonder what's the software equivalent in design pattern land. The facade maybe ?

<comment><USER32> Not sure about a corresponding design pattern, but the content neatly maps (no pun intended) to function composition.

</comment></comment><comment><USER33> some may also enjoy a 3d-printed triple gear

[https://www.youtube.com/watch?v=I9IBQVHFeQs](https://www.youtube.com/watch?v=I9IBQVHFeQs)

<comment><USER34> Does this have any possible practical applications? Or is it just cool?

</comment></comment><comment><USER35> Is it possible to create a "negative differential gear" that puts more torque into the wheel that is stuck? (in the hopes of forcing it unstuck)

<comment><USER36> Yes. You are referring to a locking differential, of which there are several types. Some use clutch plates, and will work even if one wheel has no traction at all, others use more complex gearing and can transfer torque from one to another at some multiple (called a Torsen Differential) and cannot drive when one wheel is completely unloaded.

<comment><USER35> Awesome, thank you!

</comment></comment></comment><comment><USER37> It is just too awkward that I learned how they work with the same video last year, still better than my University's _current_ presentations

</comment><comment><USER38> Differential -- the most misused word in sports. The video is a great explanation about the automobile version.

</comment><comment><USER39> I'd have loved it if these guys had made a video on fly wheels. Dying to know more about those.

</comment><comment><USER40> @edferda: props for posting this; the pedagogy here is just terrific!

</comment><comment><USER41> Any idea for what purpose was this video originally made?

</comment><comment><USER42> I guessed some of the next steps, and considering I have the automobilic knowledge of the ancient greeks, that was pretty impressive.

An education in how to present to a lay audience.

</comment><comment><USER43> love the clarity, simplicity and enunciation

</comment><comment><USER44> Great Video:)

</comment><comment><USER45> Best spent 8minutes today, thanks!

</comment><comment><USER46> Interesting

</comment><comment><USER47> Amazing!

</comment><comment><USER48> We know. I put a link to that video (to the Internet Archive, not YouTube) on Wikipedia years ago.

There's a whole series of Chevrolet films from the Jam Handy organization at the Internet Archive. "Take it Easy", "Spring Harmony" and "Shockproof" cover how auto suspensions work. "Facts on Friction", "Hydraulics" and "What stops them" explain brakes. "Head on" and "No Ghosts" \- auto frames. "Water Boy" \- cooling. "Free Air" \- carburetor. There's more.

<comment><USER49> I had never seen this, so i appreciate the link. Is there any similar video for a limited slip differential?

<comment><USER50> Here's a good start. Alter search query to taste.

[https://archive.org/search.php?query=creator%3A%22Handy%20%2...](https://archive.org/search.php?query=creator%3A%22Handy%20%28Jam%29%20Organization%22%20suspension)</comment></comment></comment>


$400K income in Silicon Valley is still middle-class - <AUTHOR> https://finance.yahoo.com/news/silicon-valley-expensive-people-400-191800814.html?utm_content=buffer651e3&utm_medium=social&utm_source=facebook.com&utm_campaign=yahoofinance <comment><USER2> That will sound crazy to people not from the west coast or Manhattan, but it's not as crazy as it sounds.

A house price-to-income of 1.5x - 3x was long considered normal, and is still obtainable in middle America, the south, upstate NY and much of the NE, etc. But certainly not out west.

Meanwhile on the west coast, price-to-income is routinely in the realm of 10x - 20x, with the upper end being the norm in Silicon Valley.

Consider Palo Alto, where median household income is $137,000 a year and median housing currently is $3,000,000, making price-to-income 21x.

[https://www.census.gov/quickfacts/fact/table/paloaltocitycal...](https://www.census.gov/quickfacts/fact/table/paloaltocitycalifornia/PST045216)

[https://www.zillow.com/palo-alto-ca/home- values/](https://www.zillow.com/palo-alto-ca/home-values/)

Now if you really want to ponder how far things have gone awry, consider what the typical middle class lifestyle of 1960s America was then, and what that same lifestyle would cost today, as this article does:

[http://www.theamericanconservative.com/articles/are-you- real...](http://www.theamericanconservative.com/articles/are-you-really- middle-class/)

Put simply, you need to earn more than you think, and if you want a typical "middle class" lifestyle on a regular income, you should probably not live on the west coast.

<comment><USER3> it does sound crazy...for a different reason, what I don't really understand is why the big difference compared to other places isn't significant enough to do dev elsewhere? Maintain a smaller presence in SV? Or a lot more remote workers?

Or is the investment money so good that no one really cares?</comment></comment>


Newsweek reviewer uses Heysan as IM workaround on iPhone - <AUTHOR> http://www.msnbc.msn.com/id/19444948/site/newsweek/page/5/ <comment><USER2> "Sign up to try the pre-launch version of Heysan IM"

[enters email address]

"Sorry, the beta signup is not available right now, please try again later!"

That was lame... I did find <http://m.heysan.com/> on Google though.

</comment><comment><USER3> This is very good publicity..

Did Heysan change their product but retain the name? Just curious.

<comment><USER4> No, you just didn't know what their product was. It's not your fault. I didn't know what their product was either until around about demo day (two months into the Winter Founders Program). They've got some fruity MySpace widget that they built for marketing purposes and everybody thinks it's their product...their product is actually universal IM for mobile devices. Way cooler than yet another MySpace widget, eh?

Matters aren't helped by the fact that the widget was released months before the product (the product is still not properly launched, I don't think).

<comment><USER5> I had the exact same question; thanks for the explanation.

This does not seem to be very efficient branding. Either you haven't heard of them yet or you're left thinking something along the lines of "Looks like that widget company has given up and switched to mobile im, maybe Slide or someone scared them off"

</comment></comment></comment><comment><USER6> For an IM web work around, I personally prefer Meebo (<http://meebo.com)> since it works for Google talk, Yahoo messaging, AIM, etc. It would be nice if they have an iPhone version available.

<comment><USER7> Heysan's advantage is that it runs (very well) on the crappy browsers most cellphones come with. I imagine, if anything, the iPhone has made Meebo more of a competitor to Heysan than before, given that the iPhone comes with a fully working web browser.

But congrats to Heysan on a great press hit and a great product!

<comment><USER8> thanks a lot!

Iphone is an awesome device - for sure. a lot of our american users are already using it. but the iphone is released in a country where people have computer access almost everywhere. compare that to South Africa which has 5 times as many mobile internet users as computer internet users. the landscape is very different

Gustaf, heysan</comment></comment></comment>


Browser performance comparison (2009) - <AUTHOR> http://sixrevisions.com/infographs/browser-performance/

<comment><USER2> Keep in mind that this is from Oct 2009.

<comment><USER3> Yeah. A lot has changed since then. Opera 10.5 has a new JavaScript engine said to be as fast as V8, plus other performance improvements.

</comment></comment><comment><USER4> outdated benchmark. Opera javascript is _substantially_ faster now

</comment><comment><USER5> How is it possible that Chrome is quicker than Firefox in every respect except for page load time? Isn't page load time just a cumulative result of all the other categories?

<comment><USER6> I guess the page load is tested by loading a blank page and therefore just testing the networking stuff and not the rendering, javascript, etc.

<comment><USER7> It's a test of loading yahoo.com, not a blank page.

</comment></comment></comment><comment><USER8> 'comaprison' is a funny word. I think you meant to type 'comparison' in the title though.

<comment><AUTHOR> :) yeah. Thanks editors for changing it

</comment></comment><comment><USER9> note: all tests run on windows. should include a test on mac os x.

<comment><USER10> And Linux, the hacker's OS.

</comment></comment><comment><USER11> With the exception of narrowly beating out Safari on cache speed, IE is last in every category. Heh.

</comment><comment><USER12> I just retested Firefox v. Chromium on Sunspider and Chromium is still more than 2x faster. Really disappointing. Mozilla really needs to step it up on the performance if they want to keep Firefox relevant.</comment>


Australian Apple iDevices hijacked, held to ransom - <AUTHOR> http://www.smh.com.au/digital-life/consumer-security/australian-apple-idevices-hijacked-held-to-ransom-20140527-zrpbj.html

<comment><USER2> Might be password re-use?

I wonder how many of them used the same details for eBay and Apple?</comment>


The Junior Jump – Life After Coding Bootcamps - <AUTHOR> http://blog.carbonfive.com/2014/03/03/the-junior-jump-life-after-coding-bootcamps/

<comment><USER2> This is very relevant to recent college graduates, as well. Being a junior dev. myself (albeit at a much larger company), I think the key advice is: Ask a lot of questions. If you don't understand something, _just ask somebody_.

Like it or not, 90% of documentation for enterprise code bases, websites, frameworks, etc. is in developers' heads. It's not written down. It's not obvious from the code. There are edge cases you don't understand. There are hidden dependencies. There is tight coupling and opaque architecture. You _have_ to ask. It won't bother people... much.</comment>


Samsung's Gear VR Is a Portable Oculus Rift for the Galaxy Note 4 - <AUTHOR> http://www.theverge.com/2014/9/3/6098745/samsung-gear-vr-oculus-announcement-hands-on

<comment><USER2> You know what this is going to be great for? Travelling.

I'm facing a flight from Scotland to Australia in December where I'm going to be sat in economy class on a no-frills Air-China flight for god-only-knows how long, and my options to distract myself are currently either read a book on my kindle, or play or watch something on the iPad. I would kill for one of these.

The problems with my existing options are that I can be distracted by seeing people moving around next to me, or I can check my watch absent mindedly, or one of many things might happen that could bring me back into the reality of being sandwiched into a sweaty tin can. Time can pass very slowly when you're travelling.

VR on the other hand completely transports your mind to a place where time isn't really relevant anymore. You need to block out all of your surroundings to really make it work, which means no seeing other passengers get up for toilet breaks, no listening to the engine buzzing along as you read. If I could put this headset on with a decent pair of headphones, and all of a sudden be flying around space in some mobile equivalent of Elite:Dangerous or watching a movie in properly immersive 3D then time would just speed by and my flight wouldn't be so bloody awful.

I've got an Oculus DK2, but I sadly can't lug my beast of a desktop PC on to a flight with me to power it. In terms of being the VR headset of choice for gamers, I'm pretty convinced that Sony will eventually win that battle with their PS4 Project Morpheus headset. This won't compete with either of those two excellent experiences, but I think that as a traveling accessory at least, a wireless headset that uses your phone as a screen could be a god-send.

<comment><USER3> Great, but be sure to pack a good book for the remaining 13 hours of flight time after your devices have used up their battery.

Editing comment to respond to replies in one place instead of individually.

1) The Note 4 is housed inside the Gear VR. Larger battery pack probably won't fit. You will need to carry spare batteries. Possibly the next generation might solve this.

2) I may have missed it, but I didn't see anyway to charge the Note 4 while using the Gear VR. So assuming you do have a charging port, you would need to stop and charge the device. Or carry a spare device to charge your spare battery while you use the Gear VR.

Just to be clear, I am not criticizing the Gear VR. My response was only targeted at the Parent comment's use case. I think it is really cool that Samsung is trying to think out of the box and come up with innovations. Some will stick, some won't. We will see.

<comment><USER4> Are there flights without charging ports nowadays?

<comment><USER5> In economy? Uhh yes. A lot.

In business class and above? Fewer.

</comment></comment></comment></comment><comment><USER6> Their presentation, featuring John Carmack at 1:32:45.

[https://www.youtube.com/watch?v=VRLy0QQI6xU](https://www.youtube.com/watch?v=VRLy0QQI6xU)

<comment><USER7> And so you don't have to skip through it yourself: [https://www.youtube.com/watch?v=VRLy0QQI6xU&feature=youtu.be...](https://www.youtube.com/watch?v=VRLy0QQI6xU&feature=youtu.be&t=1h32m33s)

Edit: Oh man, he sure doesn't hold back on the technical lingo.

</comment></comment><comment><USER8> It doesn't appear to have positional sensors (the Oculus DK2 does, with a stationary dongle to compare your relative head movements).

It is very disorienting if you only have rotational support (as if your head's at the same point in space) and not also positional (head moving forward, backward, up, down, left, right, etc.)

<comment><USER9> Is there any sensor or combination of sensors in modern phones capable of doing this?

I suppose the obvious one is to use the front-facing camera and some external markers but that might be very CPU-intensive.

<comment><USER10> Google Tango is attempting to accomplish it by using the camera sensor to measure positional changes.[1] They showed it off at Google I/O, but it was a bit eclipsed by Cardboard (probably to the chagrin of the Tango team).

[1] [https://www.google.com/atap/projecttango/](https://www.google.com/atap/projecttango/)

<comment><USER11> Project Tango doesn't just use a camera to track position, it uses structured light - like the first kinect - with an infrared projector and camera to build up a 3D model of the environment.

[https://www.ifixit.com/Teardown/Project+Tango+Teardown/23835](https://www.ifixit.com/Teardown/Project+Tango+Teardown/23835)

</comment></comment></comment></comment><comment><USER12> A teardown last year showed the Oculus DK2 was using a Galaxy Note 3 as its screen system [0]. Being able to pull the phone out seems like a logical enough step. Though I wonder how much of the 'other stuff' like positional sensors etc they decide to include.

[https://www.ifixit.com/Teardown/Oculus+Rift+Development+Kit+...](https://www.ifixit.com/Teardown/Oculus+Rift+Development+Kit+2+Teardown/27613)

<comment><USER13> Thanks for the link, but perhaps you meant last month? The tear down appears to be from 33 days ago.

</comment></comment><comment><USER14> If you can use the mobile's back camera like Structure Sensor does, it could even choose between VR and AR based on the app :)

Also if you later can use Google Tango with it, you'd even have both depth + color feeds for AR, not just color, which helps realism when you add 3D elements in it, or even simply to sneak parts of the real world into VR (like in youtu.be/fEiyzJDFiJI).

Natural interactions, realistic rendering, latency (and battery life :) are definitely the next big battlefields.

</comment><comment><USER15> Before graphics cards were standard, very few games supported them. Eventually more and more games started supporting specific cards, and then people started buying the cards. Today virtually all games support them, and if you have a gaming PC, you have a card.

While the Oculus still looks to be competitively better, seeing the market expand can only be a positive signal for VR.

</comment><comment><USER16> Interesting brand dilution for Oculus there.

<comment><USER17> It's almost like they're prepping consumers for 'real' VR by giving them something that's obviously a half measure but still works decently well.

</comment></comment><comment><USER9> In case people have forgotten there are many similar DIY solutions based on this: [https://cardboard.withgoogle.com/](https://cardboard.withgoogle.com/)

I've got one and there's quite a few fun demos and small games in the Play Store that work with it.

</comment><comment><USER18> Did anyone see the bloomberg coverage of the event? Completely whacky, it's all about how Samsung is fake launching stuff to get ahead of apple without talking about VR at all. Sooo weird, it just goes to show how far the media has its ass stuck up its head sometimes.

</comment><comment><USER19> I'm confused. Is this a preview of what the CV1 will be? Or is this a separate product?

<comment><USER20> All I know of it is from the article, but it seems to be a separate product, one that uses the Samsung Note 4 entirely for display and sensors. It is more like a really fancy version of the Google Cardboard VR (and one that only fits a Note 4) than a Rift, AFAICT.

I assume whatever Oculus helped with was mostly to do with software and/or helping Samsung spec out the sensors used in the phone to give a decent VR experience.

</comment></comment><comment><USER21> Facebook is starting to kick ass. They have the coolest platform. Again.</comment>


Ask HN: What's your SaaS stack recommendation? - <AUTHOR>

I'm interested in hearing recommendations for web app stacks for SaaS applications.  I know this is broad -- here's my attempt at narrowing it down

   * For a side project that I hope to grow to a business.
   * Cheap for MVP / Customer Dev period
   * Not gigantic scale: B2B app where 500 customers would be successful
   * I'd like to host on something more like Heroku than Amazon (need ease of use over power)
   * Probably will be in python / Django
   * Would like very simple payments integration. Ideally, I don't need a merchant account to start
   * Email processing (sending and receiving), but not high volume
 Heroku looks good -- but, some of their add-ons look like they'd be ruby-only.  Looks like you can start at $50/month (web dyno + prod DB) -- any other options? <comment><USER2> You might want to check out Microsoft Azure. I use it and it is powerful and has a good free trial. Only thing that is bad about it is fairly long deployment times (10 to 30 minutes). As a disclaimer I currently use it with C#, but it recently added support for python. Other than that, Heroku is a good choice. Google App Engine may be another possibility, though I haven't used it nor do I know a lot about it.

For e-mail I recommend Sendgrid, you can get 200 e-mails a day free. Also easy to integrate in.

For payments I've used Braintree and I like it. I didn't set up the account but I was given a sandbox account to try it out and it should be possible to get one. Easy to use, especially if all you are doing are transactions (even though subscriptions aren't bad on Braintree either).

</comment><comment><USER3> Cheap for MVP / Dev = Dotcloud [<http://dotcloud.com/>]. Costs nothing to use as a dev platform, you just get few resources (which you don't need, since you have no users). Publish it live, enable billing, and scale up or down as needed. Scale down to keep costs low where not needed. SUPER easy to use, especially with Python.

Scale doesn't really affect recommendations either way if you're using Python/Django. You'll still want to use Celery, but scaling everywhere except DB is fairly prescriptive. Not knowing how the data is structured, be sure to look at Mongoengine. I've been using it with Django lately and loving the simplicity.

Ease of use for hosting = Dotcloud again. Super super simple. Promise. Integrates with github to version your app, no cost to get started, and deploys are as simple as 'dotcloud push . <appname>'.

Simple payments integration = Stripe [<http://stripe.com>]. My last app went from not having billing to doing recurring subscription billing with Stripe in about 20 minutes. It's hard to get easier than that. Similar terms to Paypal, supports major CCs.

For email processing, a lot of people recommend Sendgrid or Mailgun, but I've found that I actually really like Amazon SES for this. There's no free tier, but it's dirt cheap to use, and once you'd get into the paid tiers for the other services, I've found that SES still comes out cheaply.

<comment><USER4> I've never used Dotcloud (my go-to is AWS) but I strongly agree with all the other suggestions.

You didn't mention a web framework, but I've found Bottle.py [<http://bottlepy.org/>] to be great for putting together projects of all sizes. Set yourself up with Github and write some deployment scripts with Fabric [<http://fabfile.org/>] and you're all set.</comment></comment>


Up to 25 cups of coffee a day still safe for heart health, study says - <AUTHOR> https://lite.cnn.io/en/article/h_6decc22b30997e1b62c2b80c45a2a828 <comment><USER2> When we parametrize complex systems in studies such as this, I feel we tend to lose the forest for the trees.

Okay, so maybe 25 cups of coffee a day won't destroy my heart.

But this is what happens when I have 5 cups of coffee a day:

1) I get jumpy and I feel anxious. If I drink too much I start to feel what I can only describe as existential dread (I know it's weird).

2) I can't hold on to things because my hands are shaking.

3) I don't sleep as well at night, even if I don't drink any coffee after 12pm.

4) My lymph nodes start to swell. (This last one was really weird for me when I found out that it was caffeine that was causing the lumps in my breast. I'm pretty sure it's the caffeine since both times I had the lumps I quit coffee cold-turkey and the lumps disappeared.)

I now limit myself to two cups of coffee per day. If I'm feeling indulgent I may have a third cup, but that's not daily.

<comment><USER3> I think the point here is that people with heart disease needn't worry too much about coffee/caffeine intake. Heart disease affects a large part of the population and even among those who are not effected heart health is still something to be conscious of, especially in middle and old age.

<comment><USER4> Agreed, they're not condoning or advocating for high consumption. They're simply establishing that even when drinking absurd amounts of coffee you're not at increased risk, therefore it is ok to drink coffee.

</comment></comment></comment><comment><USER5> Maybe one day we'll reach the final headline:

Coffee Drinking Irrelevant To Heart Health, Unsure Why We Were Always Writing About The Health Effects Of Coffee Or Why We Repeatedly Rotated Through Every Possible Position On What They May Or May Not Have Been

</comment><comment><USER6> Having not drunk an ANSI cup of ISO coffee, what is the approximate amount being discussed? A pack a day (of ground beans)? How many GreatBrittan cups are in, e.g. a typical Swedes' coffee?

<comment><USER7> I would guess 25 cups translates to an excessive amount anywhere in the world.

</comment></comment><comment><USER8> 25 cups of coffee in a day sure seems like an unhealthy amount of caffeine.

it seems the only factor they were checking for (?) was arterial stiffness? if you're arteries aren't stiff but you're hyped and anxious out of this world and have a very elevated heart rate... not sure the stiffness is what matters anymore

1 cup typical drip coffee = ~70-120mg caffeine

25 cups = ~1750-3000mg caffeine

Examine ([https://examine.com/nutrition/caffeine- consumption/](https://examine.com/nutrition/caffeine-consumption/)) recommends up to 400mg/day as safe for healthy adults as in "most healthy people won't experience side effects at this level". It seems like 1000mg is the "beginning" of toxicity for a healthy person. Of course, half-life and time between consumption of different sources makes a difference too.

But 1500, 2000+ in a day? Phew, maybe I'm overly cautious but that just seems unwise for anyone

<comment><USER9> British study. We can infer instant coffee was the main preparation recorded in the study, which has a lower caffeine content than fresh brewed.

~70-120mg look like drip brew numbers. Instant tends to run from 30-50mg.

25 cups of instant == ~750-1250mg

<comment><USER8> Good point, hadn't considered that, which does make a significant difference.

</comment></comment></comment><comment><USER10> This article does not mention "mg", "milligram", or even just the word "caffeine", not links out to the actual research. So whoever upvoted this to the front page: shame on you. We can be more judicial than that.

</comment><comment><USER11> I quit caffeine altogether a while ago, and it's made a huge difference to my quality of life and work.

When I wake up, I'm actually awake. When I go to bed, I'm actually sleepy. I don't wake up several times during the night anymore, and I'm not falling sleep mid-afternoon ever day.

<comment><USER12> I've had some brief breaks recently, and abstaining leads to actually feeling tired around bedtime, falling asleep in a few minutes and waking up feeling very refreshed. I'd recommend every regular caffeine user give it a try.

</comment></comment><comment><USER13> I drank five to six cups a day, and felt like I desperately needed it, and scoffed at anyone who suggested I try getting by with less.

At some point I stumbled on an article about the adenosine receptors in your brain will actually compensate for this much caffeine by just growing more of them. I also read that you can actually "kill" these extra receptors by going cold turkey for a week.

So I did it, and it sucked (the second and third days were the worst). But that was a year ago and I now get an equal if not better effect from two cups a coffee each day.

<comment><USER14> I didn't have to go cold turkey; I simply stopped drinking as much and my receptors managed.

The funny thing is, the craving for coffee when I'm at work is when I'm stressed out and want control over something. Well, coffee has a very neat little cause-effect system that would give me something to change reliably.

The problem is, I don't even particularly like the effects of that second or third cup of coffee; I just wanted the control to change my state of mind.

I'm not perfect and I still do reach for that 2nd or 3rd cup sometimes but by realizing I'm a better coworker with just the one first thing in the morning helps a lot.

</comment></comment><comment><USER15> > Although some participants in the study drank 25 cups a day, the average > intake among the highest coffee consumption group was five cups a day

There's an obvious sampling bias, where if Joyful Joe is happily guzzling his 25 cups a day, he's probably not fighting weird heartbeats and trouble breathing the whole time, whereas Jittery Jim has one cup and talks the ears off his local beleaguered 7-11 worker and has to be dragged out by security only to spend the night awake in bed chewing every loose bit and bob off his own fingers.

Also, IIRC when people say people with heart conditions shouldn't drink coffee they mean "because stimulant overdoses screw up the heart's electrical rhythms and can turn not-so-good oopsies into fatal oopsies" and not "because you'll have a heart attack in 50 years". Heart attacks in 50 years are, however, a good reason to keep away from the delicious cookies you are probably disappearing into your hungry feeding tube washed down with a milk-and-sugar mixture sold at a huge markup because it contains 0.5g of plant material painstakingly harvested by faraway children, but definitely not 25 times a day, because no one's that rich.

> The research also showed that moderate and heavy coffee drinkers were most > likely to be male, smoke and consume alcohol regularly

Oh, well, they're dying of heart disease either way, might as well have fun doing it.

</comment><comment><USER16> "Health" here is a soft term to mean "won't kill you quickly or effect your tissue for a long time".

Talking about the effect of healthy hearts obscures the effects. I am in stage 2 heart failure (as I have been for a long time). I cannot drink coffee, as it aggravates the tissue.

The study can say whatever it wants about coffee (without caffeine), but the effect of 100mg of caffeine on the heart is detrimental. That dread is the same as many heart-attack-precursor feelings (also documented in EMT training), that racing heart rate is aggravation of the left atrium, that shaking is the fight-or-flight adrenaline (which is what makes us feel good). This looks like a proletariat study. "Sure you can drink as much coffee as you want, as long as you feel good about producing. It's fine until it isn't."

</comment><comment><USER17> I love coffee but I feel three per day is pushing it. Do people really drink much more than that?

<comment><USER18> I drink about a couple of liters per day, sometimes less, depending on the mood. I think I have no caffeine sensitivity at all, since I have normal BP, no sleep problems, and am able to stop drinking all caffeinated beverages for a few weeks without any (obvious) problems (did it several times after getting tired of the taste).

All these personal anecdotes ( _when I stopped drinking coffee, my wife returned to me, and I won in Powerball!_ ) sound very strange to me.

<comment><USER15> People greatly enjoy feeling like they made a worthwhile sacrifice and giving up coffee is an easier achievement than running a half-marathon (though that one is also a popular cause of returning wives and Powerball wins).

Anyway, I'm like you, and actually once said "I have no caffeine sensitivity LIKE AT ALL", and then I cut down from "last coffee before dawn" to "around 1.5L" and the amount of psychological side effects I stopped having did change my life (no Powerball involved). At the time, of course, I would have called such side effects "that's just me". So, mileage varying. And some people are super sensitive to that somewhat racing adrenaline feeling, even though it is not actually dangerous.

</comment></comment></comment><comment><USER19> I'm curious if this was done with filtered drip coffee vs espresso. I'm a bit ignorant on this subject but I've read some arguments that drip coffee is filtered & therefore may be better for your heart as it filters out certain elements.

I don't have a reference on this, purely looking to learn more about the differences.

</comment><comment><USER20> I almost spit out my coffee upon reading "25 cups of coffee a day" \-- wait, what!?

Then I read the OP... and yes, it turns out there are people who routinely drink that much coffee in the UK.

Wow.

Can you imagine what one's body would feel like after ingesting 25 -- _twenty five_ \-- cups of coffee in a 24-hour period?[a]

[a] Assumes zero hours of sleep per day.

<comment><USER21> Cutting back to single digits is the hardest part!

My company had a row of 3 automated espresso machines so I timed the dispensing delay (which happened to be almost exactly the grind time) so that I could pipeline the process using all of them. People were moderately horrified as I filled my coffee cup with a hexa-shot of espresso... but why waste time hanging around the water cooler when you can vibrate in front of your computer?

</comment></comment><comment><USER22> Last time I looked to an article for caffeine advice it said 600mg per day was the number to not go over.

Common caffeine contents: Double Espresso ~100mg Starbucks small coffee ~200mg

</comment><comment><USER23> I tried to find the original source for this, but this is all I could find: [https://www.bhf.org.uk/what-we-do/news-from-the-bhf/news- arc...](https://www.bhf.org.uk/what-we-do/news-from-the-bhf/news- archive/2019/june/coffee-not-as-bad-for-heart-and-circulatory-system-as- previously-thought)

It doesn't go into too much detail on the research.

</comment><comment><USER24> This article is plastered all over the web with similar title and content wording as if it was copy-pasted and slightly edited numerous times. Sadly no article links.

Eventually I found this PDF: [https://heart.bmj.com/content/heartjnl/105/Suppl_6/A8.2.full...](https://heart.bmj.com/content/heartjnl/105/Suppl_6/A8.2.full.pdf)

</comment><comment><USER25> >The research also showed that moderate and heavy coffee drinkers were most likely to be male, smoke and consume alcohol regularly.

So this shows an obvious problem with the study. They did not rule out co- factors. If the moderate to heavy coffee drinkers are also smoke and consume alcohol regularly, then this already puts them at a higher risk for heart disease, and likely completely dwarfs any effect of caffeine.

</comment><comment><USER26> > even those who drank up to 25 cups a day were no more likely to experience > stiffening of the arteries than someone drinking less than a cup a day.

Stiffening of the arteries was not what the doctor at the emergency room mentioned when he told me that I needed to reduce my caffeine intake.

</comment><comment><USER27> This was a longitudinal study that which controlled for blood pressure. What about people for whom habitual heavy coffee consumption causes high blood pressure? The study just looked at MRI heart scans. This sort of interaction won't show up in that setting.

</comment><comment><USER28> There's also the acrylamide, though. (I wonder how much we should really worry about it?)

</comment><comment><USER29> Forget the cups, what's the milligrams? Cups can vary by hundreds.

<comment><USER30> [https://en.wikipedia.org/wiki/Cup_(unit)](https://en.wikipedia.org/wiki/Cup_\(unit\))

<comment><USER31> The comment was about caffeine content, which varies wildly depending on bean, roast, brewing method....

</comment></comment></comment><comment><USER32> It's safe for the heart because the stomach will kill us first?

</comment><comment><USER33> this is simply not truth, at least to me. I tried couple of coffees around a week and then suddenly my heart went to nearly broken. For most of people, I guess too much coffee will do more harm to heart than good.

That's why I always say Study and Research is an ongoing process which people tend to understand the universe, and it maybe wrong and wrong again, until u finally veiled the final secret.

</comment><comment><USER34> I don't believe many studies these days....industry lobbyists carry scientists around in their pockets like so many nickels and dimes...

<comment><USER35> This is so sad, but unfortunately so true :(

And I really have no idea how to solve it without an effective replication/peer-review process, which is currently not popular for scientists trying to make a name for themselves.

</comment></comment><comment><USER36> Looks like I've been cutting myself off at 400mg caffeine daily for no reason. Good to hear, I'll start drinking more.

</comment><comment><USER37> I wonder why they didn't compare results for those that don't drink coffee at all?

</comment><comment><USER38> I don't have any links to hand but I'm fairly darn certain that arrhythmias start showing up way before anyone gets to 25 cups per day, not to mention fluid balance/kidney issues, which can lead to congestive heart failure.

TLDR; arterial stiffness is only one measure of "heart health".

</comment><comment><USER39> Two things:

1\. I have the feeling both this study and the ones it is trying to contradict are not reproducible, like 99% of other health food type studies

2\. Your kidneys are probably going to be the bigger sufferers in this scenario

</comment><comment><USER40> But it's that 26th cup that puts me in the zone!

</comment><comment><USER41> I get dizzy from drinking two cups.

</comment><comment><USER42> I've only drank coffee a total of probably six times in my life. I seem to be getting by just fine without it.

<comment><USER43> It's a great performance enhancer if you take it rarely enough, and it's entirely legal to use at academic competitions :)

</comment></comment><comment><USER44> So, those of us at 26 need to cut back a bit.

</comment><comment><USER45> Self reported survey without a dose of caffeine. This is less than useless

</comment><comment><USER30> sure, pack of cigs a day u can also become 100+ years old.

don't forget about the impact on your mental processes and other effects these substances have on you though. they are arguably much worse than cutting off a few of your life years...

i used to drink loads of coffee. now i only drink it on occasion, and really it's helped my attention become a lot more stable. caffeine and other substances have varying levels of effect on people. for me it's pretty intense, but for the person next to me, they feel nothing of it.

long story short: listen to your own mind and body when it comes to your diet. it will tell you what is good and bad if you listen carefully. if you don't listen, perhaps it will become ill as a form of yelling at you to get your attention... ;D

<comment><USER46> > Professor Metin Avkiran, associate medical director at the British Heart > Foundation, said in a press release: "There are several conflicting studies > saying different things about coffee, and it can be difficult to filter what > we should believe and what we shouldn't. This research will hopefully put > some of the media reports in perspective, as it rules out one of the > potential detrimental effects of coffee on our arteries."

They aren't saying that drinking coffee doesn't have problems, all they are saying is that it doesn't appear to affect the arteries. They aren't trying to provide an anecdote about simple living, it's testing a hypothesis.</comment></comment>


Postgres Job Queues and Failure by MVCC - <AUTHOR> https://brandur.org/postgres-queues <comment><USER2> (I'm the author of Que, the job queue discussed in the post most extensively)

This isn't terribly surprising to me, since I have an appreciation for what long-running transactions will do to a system, and I try to design systems to use transactions that are as short-lived as possible on OLTP systems. I realize that this should be explicitly mentioned in the docs, though, I'll fix that.

I'll also note that since the beginning Que has gone out of its way to use session-level locks, not transaction-level ones, to ensure that you can execute long-running jobs without the need to hold open a transaction while they work. So I don't see this so much as a flaw inherent in the library as something that people should keep in mind when they use it.

(It's also something that I expect will be much less of an issue in version 1.0, which is set up to use LISTEN/NOTIFY rather than a polling query to distribute most jobs. That said, 1.0 has been a relatively low priority for much of the last year, due to a lack of free time on my part and since I've never had any complaints with the locking performance before. I hope I'll be able to get it out in the next few months.)

<comment><USER3> > I'll also note that since the beginning Que has gone out of its way to use > session-level locks, not transaction-level ones, to ensure that you can > execute long-running jobs without the need to hold open a transaction while > they work. So I don't see this so much as a flaw inherent in the library as > something that people should keep in mind when they use it.

+1! I tried to clarify in the "Lessons Learnt" section that this isn't so much a problem with Que, but something that should be kept in mind for any kind of "hot" Postgres table (where "hot" means lots of deletions and lots of index lookups). (Although many queues are more vulnerable due to the nature of their locking mechanisms.)

But anyway, thanks for all the hard work on Que. The performance boost upon moving over from QC was nice, but I'd say that the major win was that I could eliminate 90% of the code where I was reaching into QC internal APIs to add metrics, logging, and other missing features.

<comment><USER2> Thank you!

</comment></comment></comment><comment><USER4> Thanks for the article, very interesting. Just one point on the solution. To my understanding, you prefer a queue implemented on a DB because transactions guarantee that a task could not start unless the task before as succeeded and committed the required data on the DB. In our environment we run tasks on RabbitMQ/Celery. One of the nice feature that I believe exists also in Sidekiq is that it allows you to create chain (or more complex structure) of task and the worker itself will take care of synchronizing them removing your problem (when a task finishes successfully it commits on the db and triggers the next step). The only problem we had where on entry points were we create the task chains and we fire them before committing the transaction. One solution was manually committing before firing the task. But that was somewhat difficult. What we have implemented was a Python decorator to have the tasks actually fired after the function completion (thus after the transaction commit). In Go we achieve the same result in a more simple way using the defer statement. In my experience, all these solutions are local to the process that fires the task, so there is less risk of interaction with other process, easy to implement and more robust compared to other solution.

<comment><USER3> > Thanks for the article, very interesting.

Thanks!

> What we have implemented was a Python decorator to have the tasks actually > fired after the function completion (thus after the transaction commit). In > Go we achieve the same result in a more simple way using the defer > statement. In my experience, all these solutions are local to the process > that fires the task, so there is less risk of interaction with other > process, easy to implement and more robust compared to other solution.

Oh yes, totally. I've seen this same pattern in Ruby before whereby a job enqueue is put on something like an ActiveRecord `after_commit` hook.

One (overly) pedantic observation is that this still leaves you with the possibility of having your transaction and data safely committed in your database, but with your job not enqueued if something happens to your process between the time of commit and time of enqueue. Admittedly though, this probably doesn't happen all that often in real life.

Probably the best answer I have is that we take this approach for the sheer convenience. We can do things like this:

      def create_user(email, password)
        User.transaction do
          user = User.new email: email
          user.set_password_hash(password)

          check_for_abuse!

          # make an account ID queue job to create record in billing system
          user.billing_account_id = uuid()
          async_create_account_in_billing_system(user)

          # queue job to send an e-mail invite
          async_send_invite_email(user)

          create_auditing_record

          ...
        end
      end

You can build out very explicit chains of actions that may enqueue jobs or call into other chains that may enqueue their own jobs and all the while never have to worry about any kind of ordering problem while working anything. There are no hidden callbacks anywhere, but you still get to keep perfect correctness: if anything fails at any point, the whole system rolls back like it never happened.

<comment><USER4> The observation on failure modes is correct. When you process thousands of tasks every day even problems with low probability happens. What bugs me with the transaction approach is that you loose all the information (except probably for logs). In your example, if I signup on your service and for any reason the process fails (maybe after I received the confirmation that everything is ok) I will end up having no record stored for my account. This is problematic for post mortem diagnosis, for customer support (although its easy to ask the customer redo the signup) and so for and so on. Imagine you are handling payment with an external provider (e.g: Paypal). I could end up being billed without a trace on your system that I've paid. I'm not saying that my approach is correct. I'm saying that just assuming that transactions will save all your problems discount the fact that your system, to be useful, has side effects (not using the term in a strict way) on your customer and possibly on systems outside your organization. I prefer to plan for actively manage the possible failure modes and to detect and correct quickly anomaly. For this reason inconsistent data is sometime better than no data. Another point on the database approach that I haven't thought before: In the past we designed a system that stored and updated user timelines on MySQL. It has always been a nightmare. SQL databases are not designed with an high ratio of write operation in mind. The indexes get quickly fragmented, even deleting entries doesn't immediately deflate the disk consumption etc. I don't see this being a problem immediately applicable to a queue use case. But with your service growing in size there's a risk of hitting scalability problem. Obviously you could react like we have done, use a bigger database, use better disks, create cleanup jobs. But it is bad software engineering and you are just buying more time.

</comment></comment></comment><comment><USER5> Good article!

I am currently implementing a project in which we use Postgres to track job state (eg., run status, failures, timings, resource usage, related log entries), but Kafka as the actual queueing mechanism -- thus bypassing the challenges mentioned in the article but still getting the best of Postgres.

This way we have complete, introspectable, measurable history about every queue item. It greatly simplifies the Postgres part of it (state updates are always appends, no locking) and thanks to Kafka, increases performance and scalability.

It also adds a measure of safety: We can detect "lost" jobs that disappear because of data failure, bugs in Kafka, failing clients etc. We know that if a job was never logged as "complete", it probably died.

The job log also functions as an audit log, and we also intend to use it for certain jobs that benefit from being incremental and from able to continue from when it last left (for example, feed processing).

<comment><USER3> Interesting approach!

I'd be curious to hear about the mechanic that you came up with for division of labor among workers — since every client is essentially reading the same stream, I guess you'd have to distribute jobs based on job_id modulo worker_number or something like that?

<comment><USER5> I suppose one could use a round-robin sharding approach like you mention, but it goes against Kafka's design, and it's not necessary.

Kafka divides a queue into partitions. Each partition is a completely independent silo. When you publish messages, Kafka distributes them across partititons. When you read messages, you always read from a partition.

This means partitions are also the unit of parallelism: You don't want multiple workers on a single partition (because of the labour division problem you mention). Rather, Kafka expects you to have one partition per worker.

This is more elegant than it sounds if you're coming from something like RabbitMQ. Partitions (ie., queues) in Kafka are append-only and strictly linear; unlike RabbitMQ, you can never "nack" a message in a way that results in the message ending up at the back of the queue and thus violating the original message order. Rather, Kafka expects each consumer to maintain its "read position" in the queue. Failure handling, then, is simply a matter of winding back the read position. And unlike RabbitMQ, there's less need for complicated routing, dead-letter exchanges and so on, because rather than move messages around, you're just moving a cursor.

Of course, message order is only preserved within a single partition; if you publish messages A, B and C and you have 3 partitions and 3 workers, then in a real world, messages may be processed in the order C, B, A. That sounds bad, but then other queue solutions such as Que or RabbitMQ suffer from the exact same problem: If you run 3 workers against one queue, your queue may supply each worker with messages in the right order, but there's no guarantee that they will be _processed_ in that order. The only way to guarantee ordering is to have just one worker per queue, using some kind of locking (RabbitMQ does support "exclusive" consumers). But then you don't get any parallelism at all. So I think Kafka's solution is quite sane, even if it's more low-level and less developer-friendly than AMQP.

</comment></comment></comment><comment><USER3> I'd be curious to hear what the general community thinks of putting a job queue in a database and if there are a lot of other QC/Que users out there.

FWIW, the transactional properties of a Postgres-backed queue were so convenient that we took advantage of them for a long time (and still do) despite the fact that they have a few caveats (e.g. poor degraded performance as outlined in the post), but more recently there's been a bit of a shift towards Sidekiq (probably because it's generally very problem-free and has some pretty nice monitoring tools).

(Disclaimer: I authored this article.)

<comment><USER6> We are using Postgres as our queue backing store. I tried switching to Sidekiq but ran into issues (read here [https://github.com/mperham/sidekiq/pull/624](https://github.com/mperham/sidekiq/pull/624)). Fortunately our job throughput is small enough to not hit any scaling issues with Postgres, so I stuck with that because of my confidence and experience w/Postgres over the years. The issues I ran into on Sidekiq just made me skeptical of their architecture/code maturity, though that was several years ago and it may be much improved by now.

We use JQJobs (which we authored) to manage queueing and it's architected such that it could be ported to Redis or some other better backing store, or potentially even to QC/Que, which I wasn't aware of until your article (so thanks for that!).

<comment><USER3> Ah, nice, thank-you!

> Fortunately our job throughput is small enough to not hit any scaling issues > with Postgres, so I stuck with that because of my confidence and experience > w/Postgres over the years.

I think we're in a pretty similar situation. For what it's worth, I think that a queue in PG can scale up about as well as Postgres can as long as you keep an eye on the whole system (watch out for long-lived transaction and the like).

</comment></comment></comment><comment><USER7> This was a well written article with an interesting investigation.

However, storing small, ephemeral messages like jobs in a queue within Postgres is a bad idea and the pain far outweighs the benefits of transactional rollback for jobs.

Instead, a much simpler solution is to plan for jobs to run at least once, use a more appropriate datastore like Redis or RabbitMQ, and build in idempotency and error handling at the job layer.

Postgres used as a system of record shouldn't be used for ephemeral message queues.

<comment><USER8> Well, it's not necessarily that simple. It can be very interesting to be able to directly enter jobs into a queue in a transactional manner, with very low latency. Say from a trigger.

Edit: typo

<comment><USER7> For the sake of error handling on rollback, you're usually better delayed job enqueueing events to after commit hooks if you're concerned about failures resulting in a rollback.

<comment><USER9> Doing anything after committing misses the point. If you can do that, you don't need postgres.

For example, suppose you mark an account closed, commit, and then enqueue an event to issue a refund from another system. It's possible that your process may crash or be killed at just the wrong time leaving you with a closed account but no refund.

So what if you enqueue the event before you commit? In that case, you might crash before committing which will automatically rollback. Now you've done a refund on a non-closed account.

Transactions make it trivial to guarantee that either both happen or neither do. There are other ways to get that guarantee, but they require more work and are more error prone.

</comment></comment></comment></comment><comment><USER10> Were you using SERIALIZABLE isolation level in your application, as one code example in your article seems to show? Would using READ COMMITTED level have made a difference?

</comment><comment><USER11> The long-lived transaction that keeps the deleted jobs from being reclaimed - is that process working with the job queue table, or is it working with other tables in the database?

<comment><USER12> Even if the long-running transaction hasn't accessed the job queue table yet it might do so before it completes. Postgres needs to keep the "dead" tuples accessible as long as there are active transactions that started before the deletion.

<comment><USER11> Right, that's what I thought. Is there value in giving the job queue its own database then, or are they taking advantage of the fact that the jobs modifications can be included in transactions that involve other tables?</comment></comment></comment>


Show HN: Bato – A Filipino Programming Language - <AUTHOR> https://github.com/jjuliano/bato <comment><USER3> Awesome stuff - i think this kind of languages are more important than most people (esp with strong english school background assume). I could see this as educational language for kids.

Related to this: In the 80/90s i saw a German BASIC variant floating around. Unfortunately i couldnt find it online

But… if you are into alternative-language programming languages i highly recommend you reading up on Plankalkül[1] - written by Zuse (after whom SuseLinux is named) which inspired ALGOL

Also worth knowing about is obviously GERMAN[2] a programming language much like brainfuck that is redused to only the most important German words.

Example code

          SCHNITZEL BEER BEER BEER BEER BEER BEER BEER
          SCHNITZEL BEER SCHNITZEL SCHNITZEL SCHNITZEL BEER SCHNITZEL BEER
          SCHNITZEL BEER SCHNITZEL SCHNITZEL BEER BEER SCHNITZEL SCHNITZEL
          SCHNITZEL BEER SCHNITZEL SCHNITZEL SCHNITZEL BEER BEER SCHNITZEL

More links: [https://en.wikipedia.org/wiki/Non-English- based_programming_...](https://en.wikipedia.org/wiki/Non-English- based_programming_languages)

[1]: [https://en.wikipedia.org/wiki/Plankalk%C3%BCl](https://en.wikipedia.org/wiki/Plankalk%C3%BCl)

[2]: [https://esolangs.org/wiki/German](https://esolangs.org/wiki/German)

<comment><USER4> > I could see this as educational language for kids.

In Greece we had (and maybe still have, but it has been almost two decades since i was there) programming lessons in high school. For the most part it was laughable (and TBH almost everyone ignored them) but what i personally found interesting was that someone went and designed a Pascal+BASIC hybrid where everything is in Greek. There wasn't any official implementation since this was supposed to be theory only (one of the laughable parts - how are you going to learn programming without actually doing it in a computer?), but some people decided to make their own implementations. I was one of them, but mine never went beyond a simple command-line interpreter which i gave to some of my classmates.

However there was a professor who went the extra mile and built an entire interactive IDE with interpreter, debugger and a full reference (the name of the language is simply "LANGUAGE" and the Greek word for that is the same as for tongue so the icon is a tongue :-P). Apparently he even got some certification from the government about it as being usable for actual learning in schools. You can see screenshots from it at [1]. It is in Greek of course, but it has a fairly simple UI (it actually looks a bit how QBasic would look if it was a Windows program around the late 90s/early 2000s :-P). The main window is an editor, at the bottom there is an "Execution" panel where you see the program output and interact with it, a watches panel for the debugger and at the right you can see a panel with all available commands, a panel with the variables (when in the debugger) that you can inspect and edit and a panel with an input file (IIRC the language doesn't have I/O support beyond some predefined files - it wasn't needed for the educational purpose after all).

There was also a Greek compiler for another Pascal-like language during the late 80s or early 90s (this was unrelated to the "LANGUAGE" i mention above which AFAIK was designed in the very late 90s). It was made for DOS and it came with an IDE that looked a lot like a Turbo Pascal 5.x (but in monochrome UI). This one generated actual standalone executables. I found it on a coverdisk much later but i don't know what happened to that and i can't find it today (thanks to the "LANGUAGE" having such a generic name all searches in Google give me that instead of what i want :-P).

[1] [http://alkisg.mysch.gr/screenshots/](http://alkisg.mysch.gr/screenshots/)

<comment><USER5> It strikes me that in a language like Common Lisp, where the identifiers are not strings but symbols with a name, you could give the symbols a map from language->name and have the input language be nearly irrelevant: as long as it was standard practice to distribute source as serialized symbols rather than as text files.

<comment><USER5> Or, maybe, you could add another segment analogous to the package segment to each read symbol, e.g.:

        (defpackage :foo
          (:use :cl)
          (:source-language :en))
        (in-package :foo)

        (defun show (:translations :de schau) ()
          ...)

EDIT (forgot): and then, if you needed to access the symbol directly by some particular language's representation, do something like foo:en:show

</comment></comment></comment></comment><comment><USER6> One thing I'm completely ignorant of is how to people from countries where non-latin alphabets are write code? Eg if you're Chinese, Arabic even Russian do you have to do everything in English and English characters?

I'd hope there is a Unicode mapping into other characters - is there any language that supports this? Even for libraries would be nice.

<comment><USER7> Russian reporting in. I think everyone here who writes code knows Latin alphabet. It's just a basic requirement - it's a given that if you want to code you'd better learn English, let alone alphabet.

In schools, kids learn to code using Algol-like language with identifiers in Cyrillic (essentially, Russian) abbreviations, e.g. "нц для i от 1 до n" rather than "for i := 1 until n do", but even here you see Latin letter "i" ;) However, it's not uncommon to just go with e.g. BASIC or Pascal.

There is also de-facto standard accounting & ERP software producs from 1C which use Visual Basic-like language with Russian identifiers like "Константа" for "Const", etc. It's widespread in its domain, but not used anywhere else. 1C programmers are sometimes (half-jokingly) considered to be of a different caste. Sort of like COBOL programmers, maybe, or - probably closer - <USER2> developers.

I don't think anyone has any serious issues with basic English language for identifiers. Literature, documentation, discussion - here, language barriers do matter (a lot!), but not for programming languages themselves. That is, unless someone wants to show off as a true hardcore Russophile, of course.

Code comments, identifier names and e.g. log messages are different matter. I don't think there is any common practice for this - more like a matter of personal preferences. Some try to stick with English, some use Russian or transliterated Russian (mixing it with some English) liberally so it's not uncommon to see something like `log.Error("Дом не найден %s, %s: %s", ulica, nomerDoma, responseText) /* TODO: Добавить поиск лучшего совпадения */` in their code.

<comment><USER8> > some use Russian or transliterated Russian (mixing it with some English) > liberally so it's not uncommon to see something like `log.Error("Дом не > найден %s, %s: %s", ulica, nomerDoma, responseText) /* TODO: Добавить поиск > лучшего совпадения */` in their code.

This gives me nightmares of dealing with an old patched Joomla install, where the developers had managed to bring in plugins etc. that used multiple inconsistent encodings in comments, so you could get all of the code to render correctly with any single terminal setting.

<comment><USER7> > old patched Joomla

Been there, saw that. The quoted part alone is way more than enough to give nightmares. I bet, encoding issues is just the icing on the cake. ;)

</comment></comment></comment></comment><comment><USER9> Another natural language programming language (in Finnish): [https://github.com/fergusq/tampio](https://github.com/fergusq/tampio)

It's technically somewhat amusing as it runs a morphological parser in order to deal with the Finnish word inflection system, which is then utilized as an integral part of the language grammar. As a consequence, since this allows relaxing constraints e.g. on word order, the resulting code does actually read like natural language.

<comment><USER10> Finn here: it reads like language that's tediously formal to the point of being awkward, kind of like an old translation of the Bible ("And verily X did beget Y").

"Natural" spoken Finnish abbreviates a lot and dispenses with many conjugations. Maybe I should fork this and build a Helsinki slang version...

</comment></comment><comment><USER11> I've had ideas of where we abstract the syntax of a program language in a way that there would be multiple 'views' of the code.

What if you could run a program that would translate Bato programs into Ruby and vice versa? The variables would be a hard part so maybe it would hint you at a translation of it or you could add a hint yourself.

Or what if you had a language that had a javascript like syntax and a lisp like syntax. You would run a program that would translate it from one syntax for the other. You could add or subtract syntactic sugar.

<comment><USER12> I read about isomorf yesterday... it might be kinda like what you're looking for?

Possibly relevant blog post from Brian McKenna, too: [https://brianmckenna.org/blog/polymorphic_programming](https://brianmckenna.org/blog/polymorphic_programming)

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

<comment><USER13> This sort of translation is definitely part of our syntactic sugar mission. If anyone wants to beta test particular languages for us just reach out.

</comment></comment></comment><comment><USER14> A few months ago, I was daydreaming about creating a new programming language and started thinking about language internationalization. I found this page, with some interesting comments: [https://blogs.msdn.microsoft.com/alfredth/2011/07/21/why- are...](https://blogs.msdn.microsoft.com/alfredth/2011/07/21/why-are-all- programming-languages-in-english/)

As an aside, this one stuck out to me: "One of the difficulties in allowing the keyword to be switched on the fly to a different language is that keywords have to be 'reserved' such that they cannot be used as identifiers"...

I find the concept of reserved keywords kind of strange. It seems like a "smarter" language/parser should be able to handle a keyword being used as an identifier.

<comment> yoz-y It is always good to not have possible ambiguity in a language though.

A classic example is a C++ line such as:

        a ** b

Before you know if a and b are variable names or type names, you do not know whether this line is a variable declaration or a multiplication or a syntax error.

My point is that some keywords could be used as identifiers in some situations, but this might not always be the case.

One option would be to not have any keywords, just operators. Or maybe a special keyword decoration.

<comment><USER15> > Or maybe a special keyword decoration.

What you're asking for is called stropping [0], and it's actually a very old concept going back to the early days of Algol.

Algol didn't have any concept of reserved words. Instead, keywords were _typographically_ distinguished from identifiers. In publications, keywords were typically rendered in bold and/or underline, and identifiers were not. Representing this in a computer encoding proved problematic, so people came up with a number of ways to distinguish keywords from identifiers. The most common way was to enclose keywords in 'apostrophes', and from there 'strop' originated as an abbreviation for 'apostrophe', giving rise to the term 'stropping'.

But despite the etymology, stropping doesn't have to use apostrophes. When Algol 68 came out, the spec defined three acceptable styles, called 'stropping regimes'. 'Quote' stropping was the traditional form using 'apostrophes', .point stropping would prefix .keywords with a .decimal .point, UPPER stropping would render keywords in ALL CAPS (which forces identifiers to be all-lowercase, but that's ok because Algol 68 offers something much better than CamelCase). There was actually a fourth stropping regime, res stropping, which is different because it would treat keywords as reserved words and thus restrict how you can use identifiers.

a68g, the only modern-day Algol 68 interpreter I know of, can be configured to use either UPPER or res stropping. UPPER stropping is preferred, as res stropping changes the way the language works (for the worse, IMO).

The really cool thing about stropping is that it enables you to put spaces in your identifiers, since something other than whitespace is used to separate your identifier names from keywords [2] [3].

[0] [https://en.wikipedia.org/wiki/Stropping_(syntax)](https://en.wikipedia.org/wiki/Stropping_\(syntax\))

[1] Example from an HTML-ized copy of the spec: [http://www.masswerk.at/algol60/report.htm](http://www.masswerk.at/algol60/report.htm)

[2] Here's an example from Algol 68 of a function called _days in month_ (yes, with spaces), taken from Wikipedia. I've rendered the keywords using UPPER stropping for the benefit of anyone wanting to try it in a68g:

        PROC days in month = (INT year, month)INT:
          CASE month IN
            31,
            IF year MOD 4 EQ 0 AND year MOD 100 NE 0  OR  year MOD 400 EQ 0 THEN 29 ELSE 28 FI,
            31, 30, 31, 30, 31, 31, 30, 31, 30, 31
          ESAC;

[3] Another Wikipedia example of a variable delcaration, showing how stropping enables both spaces in identifiers and identifiers that share words with keywords:

        INT a real int = 3;

<comment> yoz-y It feels good that somebody thought about the trouble that spaces in identifiers can bring.

I am currently using the robot framework language which combines the worst of all worlds. It supports spaces in identifiers, but it does so by using "more than one white space" as a separator for everything. No parentheses, no commas, and of course identifiers are case insensitive.

</comment></comment></comment></comment><comment><USER16> There are already way too many languages on this planet being kept alive by all those pathetic governments limiting their citizens to their own (little) country. English should already long be the World's 1st language for every human being IMAO. I'm Dutch and it took me ages of struggling to get to my current level of English and I'm still learning..

So, this feels like a huge step back and a great way for Filipino developers and companies to completely limit and restrict their selves.

It's a fun coding experiment, but my negative response is because you shouldn't want something like this to become popular.

<comment><USER17> I agree that the would already should have had a lingua franca, but I must say that it English is far from the best candidate. The language is huge, and the grammar is full of irregularities. Pronunciation must be learnt case by case (why are "women" pronounced "wee-men"?).

(also recall this cute poem: [http://www.ling.upenn.edu/~beatrice/humor/english- lesson.htm...](http://www.ling.upenn.edu/~beatrice/humor/english-lesson.html) )

<comment><USER18> This is a common complaint, and one the purist in me is sympathetic to. These days, I have a more nuanced perspective on English.

Yes, English is huge and complex. However, the things we are trying to express are themselves huge and complex. A big language gives us many many colors to paint with. I mean different things when I say I am "sad", "down", "blue", "disconsolate", or "woebegone". There is a learning burden on English speakers to loading such a large language in their heads, of course. But, in return, we get a higher-bandwidth communication protocol.

The complaints about pronunciation are also common and valid in many cases. Things like the Great Vowel Shift lead to words that no longer sound like they are written for little useful reason. But in some cases, pronunication varies between similar-spelled words because their etymology is wildly different.

A word's spelling carries both pronunciation and meaning. When the pronunciation varies, it is often because the underlying morphemes are different even though they are spelled the same. This means the spelling doesn't teach you to pronounce it as well as you like, but once you _can_ pronounce it, the pronunciation helps you know what it _means_.

And, as a lingua franca for the world, I think English is great. English is riddled with loanwords and is constantly assimilating terms from other languages that can't already be expressed well. In many senses, it's a global language because it is the set _union_ of them.

<comment><USER19> One of my favorite quotes from James Nicoll:

"The problem with defending the purity of the English language is that English is about as pure as a cribhouse whore. We don't just borrow words; on occasion, English has pursued other languages down alleyways to beat them unconscious and rifle their pockets for new vocabulary."

</comment></comment></comment></comment><comment><USER20> Clojure seems to be very conducive to this by importing a library of words in another language:

[https://github.com/echeran/clj- thamil/blob/master/src/clj_th...](https://github.com/echeran/clj- thamil/blob/master/src/clj_thamil/%E0%AE%AE%E0%AF%8A%E0%AE%B4%E0%AE%BF%E0%AE%AF%E0%AE%BF%E0%AE%AF%E0%AE%B2%E0%AF%8D.cljc)

Elango Cheran gave a talk about this: [https://www.youtube.com/watch?v=MqjMZNwnYCY](https://www.youtube.com/watch?v=MqjMZNwnYCY)

</comment><comment><USER21> TIL That Ruby lets you modify keyword parsing at runtime: [https://github.com/jjuliano/bato/blob/master/lib/bato/ruby_p...](https://github.com/jjuliano/bato/blob/master/lib/bato/ruby_parser_patches.rb)

</comment><comment><USER22> This reminds me of [http://nas.sr/%D9%82%D9%84%D8%A8/](http://nas.sr/%D9%82%D9%84%D8%A8/) (Lisp in Arabic(?))

<comment><USER23> Yes, that's Arabic, and it does indeed look like an Arabic Lisp!

</comment></comment><comment><USER24> Is it just Ruby with Filipino words?

<comment><USER25> A language with Internationalized keywords would be pretty dope.

<comment><USER26> That's what they do with formulas in Excel. There it sucks HARD. Try googling for documentation on StackOverflow for example. Anything you want to copy paste doesn't work because Excel is expecting the commands in a different language.

<comment><USER27> If you google in your native language you'll get results in that language. I agree that it takes a bit to relearn all formulas (and I find it too confusing to use different versions at the same time) but when I was still using a non- English version I had no problems finding solutions.

I think it was exactly the right thing to do. Excel formulas are often used by people with little knowledge of programming who aren't aware that "if" is a common keyword. Using the local variant makes formulas much easier to understand (and to get people closer to actual programming).

<comment><USER26> I agree it's a good move from Microsoft to make Excel more accessible. It's just not something I was expecting the first time I stumbled upon the problem.

I have a programming background so I'm used to searching everything in English, even though that's not my native language.

I inserted sqrt() in my non-English Excel and it didn't work. I thought I had a completely broken version of the program. Took a while to figure out it was a language problem!

</comment></comment></comment></comment></comment><comment><USER28> The effort into this I must say (I speak as someone who came from the Philippines and knows the language by heart) is quite impressive.

But for someone who is used to coding in the _English_ language and syntax, they may find some of the wordings harder to understand and apply.

</comment><comment><USER29> Meanwhile, duolingo still doesn't support Taglog, much to my annoyance–since my wife is half-Filipino but doesn't know it–and we thought it'd be a fun challenge to learn it together.

</comment><comment><USER30> Alternatively, you could skip the hegemony debate and just abandon natural languages altogether...

[http://www.eecg.toronto.edu/~jzhu/csc326/readings/iverson.pd...](http://www.eecg.toronto.edu/~jzhu/csc326/readings/iverson.pdf)

</comment><comment><USER31> At first I thought this was kidney, then upon reading github it hit me that stone is the meaning ala Ruby.

Thanks for sharing.

</comment><comment><USER32> It's really interesting to see non-English languages being used as programming languages.

I recall Aheui (아희) programming language that was posted on HN a while back. It's truly exotic.

[https://aheui.github.io/specification.en](https://aheui.github.io/specification.en)

> 밤밣따빠밣밟따뿌 빠맣파빨받밤뚜뭏 돋밬탕빠맣붏두붇 볻뫃박발뚷투뭏붖 뫃도뫃희멓뭏뭏붘 뫃봌토범더벌뿌뚜 뽑뽀멓멓더벓뻐뚠 뽀덩벐멓뻐덕더벅

will print hello world according to the example. Reading it phonetically in Korean, makes no sense at all.

If I knew how to design programming languages I would do it like this:

> ㅍㄾㄴHello Worldㄱ

this is the equivalent of the acronym for 프린트 (ㅍㄹㅌ) or print (english word phonetically typed in Korean) and then using the "N" and "G" Korean alphabet to depict a square parentheses.

> prt(Hello World)

인쇄(印刷) would be the more formal word in which case further simplifies the acronym.

> ㅇㅅㄴHello Worldㄱ

<comment> half-kh-hacker I feel like using 니은 and 기윽 for your quotations limits you in terms of keywords quite a bit. AFAIK, in Korean, they use <텍스트> for their quotations.

<comment><USER32> ㅋㅋㅋ perhaps in the capitalist counterparts. I'm envisioning a new Korean alphabet only programming language, staying true to the Juche philosophy of self-reliance!

I would replace all operators with Korean characters:

* is ㅆ

|| is ㅣㅣ

&& is ㅃ

\+ is ㅏ

= is ㄹ

\- is ㅡ

== is ㅌ

> is ㅋ

< is ㄷ

</comment></comment></comment><comment><USER33> Guess "boto" was already taken.</comment>


Godaddy DNS down? - <AUTHOR>

GoDaddy DNS seems to be down for us. Anyone else noticing this? <comment><USER2> Yeah same here. I can't even get godaddy.com to load. I haven't read about this issue anywhere yet.

UPDATE: DNS seems to be working now...

</comment><comment><USER3> [https://news.ycombinator.com/item?id=5927820](https://news.ycombinator.com/item?id=5927820)</comment>