hacker news with inline top comments    .. more ..    14 Sep 2017 News
home   ask   best   3 months ago   
Autonomous Robots Plant, Tend, and Harvest Entire Crop of Barley ieee.org
130 points by bansheehash  4 hours ago   66 comments top 12
thomas_howland 3 hours ago 6 replies      
The amount of labor involved in grain crops like barley per dollar of output is minimal already - the guy running the tractor/combine/etc is mostly making sure nothing breaks and keeping an eye on things (which is important when you're operating $N00,000 worth of heavy equipment on open ground). You do need guys, however, for when things do go wrong, and for all the other farm tasks (equipment maintenance, fencing, maintaining irrigation, and so on).
DesiLurker 2 hours ago 1 reply      
what I am interested in is robots that can reforest unused land. Imagine the possibilities with having armies of robots re-establishing green cover in Amazon delta. kinda like this but with robots:https://en.wikipedia.org/wiki/Project_GreenHands

good thing is that would be not require nearly as much 'babysitting' as growing crops just ability to charter uneven terrain.

randomdata 3 hours ago 3 replies      
> Theres still dirt, early mornings, dirt, more dirt

I have always wondered who are these farmers in the dirt in the early morning? Where I farm the environment is rarely suitable for 'being in the dirt' in the morning. Typically the field work starts in the mid-afternoon after the sun has had a chance to dry up the morning's dew or previous days rain. There are definitely some late nights though.

zeristor 2 hours ago 0 replies      
There were a series of talks at the Royal Society about Robot Farming a few months back.

This video, by the head of Harper Adams College, goes into a lot more detail:


Agricultural machinery size is now limited by train tunnel size for delivery.

Larger farm vehicles, although more productive per person are heavier and cause soil compaction, which then requires further treatments to fix. Mention was made of light robot tractors able to work wet fields earlier before they are dry enough for a heavy human tractor so extending they growing season. They show an example of a light weight tractor that can drive up and down on a wet field without turning it into mud.

akgerber 2 hours ago 0 replies      
While in rural Japan, I noticed a lot of tiny combine rice harvesters in tiny rice paddies, as opposed to mega-scale American agriculture:https://en.wikipedia.org/wiki/Rice#/media/File:Rice-combine-...

Perhaps these would be a model for smaller autonomous combines.

jefflombardjr 2 hours ago 1 reply      
Do this for small scale non-monoculture farming and I will be impressed. This is just a marginal productivity gain for factory farming.
Taniwha 47 minutes ago 0 replies      
Somewhere out the back is another bunch of fields where they test the robots, they're probably full of crops in various states of destruction
TaylorAlexander 2 hours ago 1 reply      
If anyone is in to this I write speculative fiction about this kind of thing:


(I also build robots) :)

Ballantara 25 minutes ago 0 replies      
meri_dian 4 hours ago 1 reply      
Automate the supply chains. Start with what is essential then move on from there.
samstave 3 hours ago 1 reply      
It said that the capital to do this was $200,000 -- what was the inventory of robots required to accomplish this.

What will it take to have a small fleet of robots to manage small farms - but many small farms.

What if a community of gardens and farms were dispersed around a neighborhood/small town - and the town shared the use of the autonomous robots wherever possible.

Which robots are common to all farms and which robots are specific to a given crop?

Also, the downplay the robot-management tasks (refueling, recharging, interceding in really bad weather to tell the robots "that'll do robot, no farming today" sort of stuff)

An open library of farm robots, the tasks they can do, their cost options, how much crop area /number of farms/acres they can manage, if they can multi-task between activities specific to tomatoes in one farm and corn in another etc...

That would be interesting data.

Then couple that with the open source civilization plans - and update those to make those items more intelligent for efficiencies in their designed tasks.

In 100 years, if we can get an atmosphere on mars, we just send a fully automated pre-colonizing farm fleet to prep our invasion.

bobsgame 3 hours ago 0 replies      
I love this so much. This is the coolest thing in the world.
Windows for Linux Nerds jessfraz.com
178 points by geostyx  5 hours ago   115 comments top 20
blunte 10 minutes ago 0 replies      
Want to _really_ impress us, Microsoft? Give us a Windows Subsystem for Linux.

I chose a maxxed out Dell XPS15 laptop with Windows 10 to replace my 3 year old rMBP with the (foolish) expectation that it could replace my Mac. Apple had lost sight of what mattered to developers, and I was angry. But now, 2 months later, here I continue developing and existing on my old rMBP.

Bash in Windows is incredibly slow on some actions. I didn't document all my activities, so I can't point to which thing was slow. But for a developer using Python, Elixir, Node, Nginx, PostgreSQL, MySQL, Git! SSH! and some other smaller accessories, WSL was far less performant than a Linux VM on my Mac. And it was far, far less performant than on native Mac.

I very much appreciate what Microsoft is trying to do. Perhaps in a generation or three they will finally leave behind most of their protectionist behaviors and embrace what works for them (for better or worse) - MS Office and the host of Windows apps that businesses depend on.

Apple is no saint or savior. But thankfully, some of what they did in the years past (dare I say during the reign of Jobs) is what has made them special. #1 - latency. My Macs work 99% of the time as expected. They run for weeks or months. My high end Android phone, even after factory reset, has occasional mind-boggling hangs (after which 1000 UI events register and take effect). The same applies to Windows 10! It works fine, sometimes, for a few things. Then it goes nuts. Wipe and reinstall (remove the Dell bloatware) and it's better. But it still lags so far behind macOS.

There is no utopia. There is only pain, frustration, and anger on the part of users. But please, give us developers (who practically _live_ in your environments) something.

userbinator 2 hours ago 4 replies      
If you need to access files in VolFS, you can use bash.exe to copy them somewhere under /mnt/c, use Windows to do whatever on it, then use bash.exe to copy them back when you are done.

IMHO this is the worst-designed(?) part of the whole WSL. Copying files back and forth is the antithesis of a "seamless Windows and Linux experience", to put it mildly. From that perspective it's no better than running an isolated VM. To add insult to injury, although I haven't personally tried it, apparently trying to access the files directly from Windows as if they were both on the same filesystem (which they are) results in all sorts of ridiculous breakage: https://news.ycombinator.com/item?id=12980380

I have mounted CIFS/SMB shares from Windows machines onto Linuxes and Macs, and gone in the opposite direction with Samba; in both of these cases, there is no need for wasteful copying and managing two files; Windows and Linux can essentially use the same files simultaneously.

Going in the other direction, WINE also allows Windows apps to work directly with the same files as Linux ones.

One then wonders, when a networked filesystem with all its complexity can be used nearly effortlessly across different OSes running on completely different machines, and WINE is like the inverse of WSL, why couldn't Microsoft do the same with two subsystems on the same machine using the same filesystem!?

tootie 3 hours ago 4 replies      
A lot of snarky comments here, but I've been using Ubuntu shell on Win 10 for the past few weeks and it's really fantastic. Way faster than a VM and much more compatible than cygwin or msys.
eksemplar 12 minutes ago 0 replies      
I've been a Microsoft developer for a long time, but in recent years it's become increasingly hard to justify and the Linux subsystem hasn't helped. Not because it's not an interesting feature, but because my desktop has become even more useless as anything but development than it already was with Visual Studio infecting everything.

I'm sure it's a step in the right direction for a lot of people, but I bought an old 2015 MacBook and it's been a so much better experience than windows that I'm actually considering getting a ubuntu machine to see if it can work as my main machine. If this sounds odd to you, you haven't programmed on a MacBook with a Danish keyboard.

Honestly Microsoft does a lot of things right these days, but it all comes with terrible user experiences. .Net core is great, but the devops required to run it in production, frankly has us considering java spring.

Sorry about the rant, but the fact that you even needed to write this blog is a good illustration of what's wrong with Microsoft. Tech is supposed to run out of the box, with minimal effort required.

cypher543 2 hours ago 1 reply      
I really, really wish Microsoft would open up the Pico Process APIs to third-party driver developers. Right now, WSL is the only driver allowed to install Pico Process callbacks. It would be cool to implement a Darwin layer or a Classic Xbox emulator with that tech.
nunez 2 hours ago 0 replies      
Congrats, Jess!

LXSS is amazing, but I had to stop using it because mounted volumes in Docker straight up don't work within it.

How don't they work? When you do a "docker run -v $PWD:/whatever <image>", "/whatever" will be blank. This occurred even when I tried to mount a directory on the FUSE mount to the Windows filesystem.

I'm guessing that given her experience in hacking container runtimes, she can probably lend a big hand towards fixing it. I'm currently using Vbox + Vagrant as a substitute, and it works well, but I'd prefer to use WSL.

pbnjay 2 hours ago 1 reply      
TBH I dug out my Surface Pro when Jess started talking up WSL... Finally got Windows Insider Preview going so that I could try it out for myself.

I spend most of my days in a text editor and a terminal, and macOS has been making even that painful sometimes. Linux was my desktop for ages before I switched to mac ~7 years ago, so it'll be nice to see what it can do now.

dhruvb14 3 hours ago 0 replies      
For anyone wanting to automate using boxstarter and chocolatey without finding all the packages manually I created this GUI about a year back.

It has a search bar to search chocolatey's repository automatically.

It has search and allows you to save the GIST straight to github and then invoke installer straight from website. Uses cookies to store script on machine so you can come back to it and add/remove more.

Was a quick 2-3 hour job so it may have bugs


all_blue_chucks 16 minutes ago 0 replies      
All the linux commands I need I can find in windows-native format using scoop.sh. No filesystem trickery needed.
seiferteric 3 hours ago 3 replies      
> Imagine a Linux setup where you can launch PowerPoint without a VM


shmerl 2 hours ago 2 replies      
Why would you use WSL instead of straight VM for example (assuming you are somehow banned from running Linux proper directly on your hardware)? And I'm a bit confused about the benefit of launching PowerPoint from WSL, when you have the Windows host itself sitting there.
makmanalp 1 hour ago 0 replies      
Very neat! This reminds me of lx branded zones in illumos: https://www.youtube.com/watch?v=TrfD3pC0VSs&list=PLH8r-Scm3-...
galaxyLogic 2 hours ago 1 reply      
Linux on Windows 10 seems like a good thing. I plan to use it for testing a Node.js application developed on Windows
domenukk 3 hours ago 3 replies      
Install hyper terminal, it is a lot more bearable than the ugly default console emulation on Windows.
Wehrdo 1 hour ago 0 replies      
I have been super impressed with WSL after using it for close to a year now. The Creators Update fixed some issues like file watching and symbolic links which had been preventing certain programs from begin usable.

I now do all my C++ and node.js development through WSL so I can still use all the Windows GUI applications (which tend to have fewer bugs and be easier to use than Linux GUI apps, in my experience). VS Code even allows you to run gdb on WSL, and interface with it on Windows, if you can get the setup right.

tkubacki 2 hours ago 0 replies      
WSL is waste of time if you work with docker - Linux desktop experience (not laptop) is just good enough these days (and future seems even brighter since Ubuntu goes back to Gnome)
dingle_thunk 3 hours ago 1 reply      
Author should check out this script for an even more minimal setup :)


nunez 2 hours ago 0 replies      
Also, for anyone with a Windows 10 (Anniversary Edition or above) machine that wants to try this, try the quick PowerShell script I wrote some time back that sets this up for you: https://carlosonunez.wordpress.com/2016/12/01/enable-linux-o...

Also, note that WSL can be disabled via Group Policy, and it is possible that your sysadmins may have done so.

hacking_again 3 hours ago 3 replies      
Why not just use Cygwin?
bactrian 3 hours ago 5 replies      
This post was interesting in a morbid way but you can count the Linux nerds that want leave the open world of Linux for Microsoft very easily. They all work at Microsoft.

Microsoft is losing on mobile, desktop, servers, and IoT. Their entire ecosystem is a technological deadend.

If you're a Linux Nerd, you should probably keep using Linux if you care about having a good career going forward.

Artificial Intelligence Uses Videogame Footage to Recreate Game Engine gatech.edu
135 points by ingve  6 hours ago   24 comments top 6
stephengillie 5 hours ago 5 replies      
This is reminiscent of the Tribes 2 development, when the developers revealed they lost the original Tribes source code, and thus the physics calculations.

Beta testers constantly complained that falling didn't feel right, jetting and skiing (the game's main movement) was slow and soupy. Players were leaking videos and photos showing the differences in motion.

At one point, Dynamix hired a top player to playtest, as he "remembered the best" how it felt. All to reclaim the physics calculations of some game from the Leisure Suit Larry company.

egypturnash 5 hours ago 2 replies      
It sounds like the only input is video. Video plus the user's controls might be much more interesting; there's a huge archive of input recordings available at tasvideos.org that could conceivably be used as a source, rather than making people actually play the damn things.

Or you could just take some of the other AIs designed to play games based on video and wire them up. Then just let your system learn to play AND run Mega Metroid Brothers.

jordache 1 hour ago 1 reply      
the examples had the character move precisely like in the reference video. This just looks like the AI recorded the original video and played it back.

I thought the AI created a playable game engine from the reference video? If so, why did it need to replicate the exact movement of the game character? Why not come up with its unique set of movements in a fully flexible game engine?

ZirconCode 5 hours ago 3 replies      
I don't have any experience in the field, but reading the paper, it seems impossibly weak and almost useless. This should only work for a very limited type of game, in which case it will never help anyone speed up game construction more than a simple sprite engine. It seems more an exercise in using openCV.

What am I missing here, because I'm positive that I am missing something?

Upvoter33 5 hours ago 0 replies      
more AI theater. there will be a moment in about five years when people are like "what happened to all that stuff about auto-driving cars, evil AI, etc.?"
bllguo 5 hours ago 0 replies      
The algo learned about the underlying rules of its environment - the physics - by watching video. Imagine applying this to more complex games, and then to the real world (the ultimate game!). Cool approach; to me it seems to really resemble how people learn in real life.
Sublime Text 3.0 sublimetext.com
1400 points by fbnlsr  14 hours ago   599 comments top 103
alexggordon 13 hours ago 2 replies      
While I know it might be a little hidden, I'd just like to say I'm really glad Will Bond of Package Control[0] was able to join[1] the Sublime Text team. Having first class support for Package Control in ST is definitely one of the features I value the most out of Sublime Text and IMHO one of the things that still keeps it very competitive with Atom other text editors.

I use packages from ST almost every day and plus I wouldn't have gotten my first job without Will (thanks for hiring me even after seeing all that terrible code I wrote), so I can actually say my life would be a lot different without his influence. I'm really happy he's officially part of the team.

[0] https://packagecontrol.io/

[1] https://www.sublimetext.com/blog/articles/sublime-text-3-bui...

lvoudour 13 hours ago 3 replies      
Sublime is probably the first GUI text editor that left me satisfied. Everything else over the years was either non-portable, slow or lacking features. After two months of use I just had to buy it, it's worth the price.

- It's fast and responsive, can handle large files and personally I've never seen it leaking memory or crashing

- Love the goto anything and command palette, brilliant

- Text editing is great and can be easily enhanced with existing plugins

- Theming is great

- Project handling is a bit weird, but once you get the hang of it it's fantastic

I don't do use IDE-like features (auto-complete, linting, compiling, etc.) nor integration features (version control for example) so I can't say how it fares in that aspect.

Recently I tried VSCode and Atom. They are portable and feature rich out of the box, but God are they slow and memory hungry. I can definitely see the appeal for web devs but it doesn't work for me, I value responsiveness above all else (that's the main reason I avoid dedicated IDEs)

kylebebak 11 hours ago 5 replies      
Sublime Text is among the best pieces of software I've used. I bought the license a couple of years ago, and would gladly pay the same amount again.

I love its core functionality: speed and stability, search, command palette, file navigation, Goto. I've used a number of editors over the years, and none have felt as fundamentally sound as Sublime Text.

The best feature of all is the Python plugin API. Sublime lacks some OOTB functionality of newer editors, but the plugin ecosystem makes this a non-issue if you're willing to invest in extending your editor. If you write code 6+ hours a day, you should be. Git integration (GitGutter and GitSavvy) is awesome, as is linting (SublimeLinter) and project management (ProjectManager).

I wrote an HTTP client plugin for Sublime called Requester (https://github.com/kylebebak/Requester) in a few thousand lines of code. It matches Postman, Insomnia, Paw et al. on features, and in my opinion handily beats them on usability. It's the plugin API that makes this possible.

Here's my guess on what Jon Skinner set out to do with Sublime Text: build a rock-solid text editor and make it as extensible as possible. Until someone does this better, Sublime is the best editor out there.

saikatsg 0 minutes ago 0 replies      
Finally it has arrived :)
Sir_Cmpwn 14 hours ago 4 replies      
>apt/yum/pacman repositories for Linux

Major kudos to these guys for distributing their software properly on Linux!

jcolella 14 hours ago 2 replies      
"One of the areas I'm especially proud of in Sublime Text 3 is performance". I totally agree with this statement. Writing software in sublime has certainly made my life easier. Kudos to Jon and team.
bad_user 12 hours ago 2 replies      
I like Sublime Text, but one thing that has really annoyed me is the lack of support for font ligatures.

See https://github.com/tonsky/FiraCode

It's a superficial reason, but I've gotten very used to them in Emacs, IntelliJ IDEA, VS Code and Atom, yes, I'm still using all of them interchangeably :-(

mstade 14 hours ago 31 replies      
I honestly can't believe I'm saying this, but: can you please enable me to buy a new license for 4.0 even though it may not even be on the road map yet? Or switch to / enable a subscriber model which is paid yearly and gives access to all upgrades?

I rely so much on sublime for my day to day work and I fear the $80 or whatever I paid for it whenever ago is too cheap for the amount of value I'm getting out of it, and I'd hate to see this magnificent piece of software fall by the wayside because of an unsustainable business model.

Of course, if the business is perfectly sustainable then you know, carry on as you where.

evv 13 hours ago 7 replies      
I see the author, jskinner, is hanging out on this thread!

Have you ever considered open-sourcing SLT? This is your only route to immortalize this amazing piece of software. I'm sure you'd receive immense community contributions and widespread support. If you switch to a donation model + enterprise support plans, I think you're likely to earn greatly more than you currently do.

I love SLT and have used it throughout my career, but I still feel more comfortable depending on Atom because I know it will be supported by the community in the event that something bad happens with the ownership. If you don't open-source SLT, I sadly believe that open alternatives like Atom will outlive it.

joncalhoun 14 hours ago 5 replies      
Kudos to the ST team for never trying to patent or sue random companies for using the multi-select feature. That feature alone has helped improve so many editors.
lopatin 13 hours ago 1 reply      
Still the gold standard as far as I'm concerned. It seems to be the only editor that focuses on my happiness by providing a flawless text editing experience. It feels like using a modern iPhone compared to a 2005 Android phone (and yes, the Android phone was probably more extensible).
losvedir 14 hours ago 0 replies      
Heh, I was confused at first before remembering that what I have been using for these past years was a "beta". Unfortunately, I guess that means all these great new features in the announcement are ones that I'm already completely familiar with. But I suppose I should still go and upgrade my license. It's been my daily driver editor for more than 5 years now, and it's easily worth the $30 to upgrade my ST2 license!
giancarlostoro 14 hours ago 3 replies      
I gotta say their new homepage looks like eye candy:


jrwiegand 11 hours ago 0 replies      
ST2 was the first text editor that really caught my eye. They have also been great with allowing users to permanently "trial" the software. I moved to ST3 beta as soon as it came out and the transition was mostly smooth.

Then VSCode came out and I loved every second of it. It does take more up more memory and is a bit slower but they are quality software and the difference to me is negligible. I cannot see myself going back. SublimeHQ lost me when they stopped updating the software regularly. I know it was rock solid software but the project seemed to be a standstill and VSCode grabbed my attention. Now it has many more features and better support from MS. I cannot imagine a reason to switch unless ST3 gets the same level of love.

kabdib 12 hours ago 1 reply      
I bought ST2 in 2013, and I'm a littled bummed they pushed the "your license works for ST3" back that far. They deserve more; I might buy another copy anyway.

(My favorite editor is an Emacs clone called Epsilon. It hasn't been updated in a decade, but it still works great. On the other hand, it hasn't been updated in a decade and I think the writing is on the walls, and I'll have to move to something else. 25 years of muscle memory are hard to deal with, though. I'd definitely throw some money the author's way if he ever decided to do a new release).

AdmiralAsshat 14 hours ago 1 reply      
Bar none, my favorite editor. I try to use Vim only sometimes to make sure I keep those commands in shape, but Sublime remains for hardcore work. It breaks my heart that it's closed source.

I do wonder sometimes how much the app makes and/or how much someone would have to pay the developer to open source it.

8draco8 14 hours ago 1 reply      
I think they finally faced the truth that over 90% of users was using "beta" version (actually their words and stats) and listened to some comments on HN. Good job guys! I'm glad that my favourite editor is finally out.

EDIT: https://news.ycombinator.com/item?id=14424220

macrael 10 hours ago 3 replies      
May this be a thread where people post their favorite ST tweaks. Things that really make a difference day to day.

I for one swapped the mapping of paste and paste and indent because I want the latter's behavior to be default.

I also use a proportional font and love it. Something I can't get vim to do.

I like gitgutter though it doesn't refresh properly always.

What are your favorite plugins?

dham 14 hours ago 1 reply      
Love Sublime Text. Haven't been able to switch to any of the Electron editors because of the horrible font rendering on Mac(Chrome issue). One note: Jon needs to show the new adaptive theme with matching title bar for MacOS on the main page.
funnelsgun 6 hours ago 0 replies      
I bought my Sublime Text 2 license in 2012. 5 years later and its the best $80 I've ever spent. I'm so pleased Jon finished 3.0. Subscription upgraded.
schneidmaster 13 hours ago 0 replies      
Thrilled to finally see ST3 out of beta, it's like Christmas in September. I've used ST3 beta for literally thousands of hours since 2013, and ST2 before that. I've tried many newer options (Atom, VSCode, etc) but nothing has come close to matching the stability, speed, and reliability. I echo the other comments that I would gladly pay far more than the $70 I spent 5 years ago.
jrochkind1 13 hours ago 3 replies      
What with being in beta for so long, I expected the actual 3.0 to be much like the (last beta) that I had been using. But there are significant changes to the UI, that I'll have to get used to or figure out how to customize (or wait for plugins to customize).

What's with the "/" 'icon' next to many files? I'm not sure what it's supposed to indicate. As you can see in the screenshot in the announcement, some files have a rectangular 'document' icon (unrecognized format?), some have a '<>' icon (html/markdown-type format?), and some have a '/' icon... no idea? Is that supposed to mean "source code"? I am not a fan.

Varcht 7 hours ago 1 reply      
500+ comments and no mention of the touch bar support?

Not really surprised, after 6 mos I don't think I've used the touch bar for anything other than mute / volume.

agentgt 12 hours ago 7 replies      
One of the reasons I still use both Emacs and Vim (yes I strangely use both) is because I can go execute them on a terminal (terminal, tmux, screen, etc).

There are just so many times I need to SSH into a machine. I know Emacs has some remote file editing capabilities but for some reason I never liked it (I can't recall why now... I think it was the need to sudo).

So I'm wondering what sublime text fans do for remote editing?

herf 14 hours ago 0 replies      
I'm a daily user since 2012, and I'm glad they made me pay for the upgrade. Best editor ever.

Sublime makes cross-platform development easy, and it's so much faster than the alternatives.

Finnucane 14 hours ago 1 reply      
I've been using ST 3 long enough that I forgot it was still technically beta.
JCSato 12 hours ago 0 replies      
Finally bought a license a week ago - happiest I've been to spend money in a long time. Every other editor I use, I end up doing a bunch to try to make it more like Sublime. Congratulations to the team!
eptakilo 14 hours ago 7 replies      
I primarily use VSCode as my editor but I used Sublime back in the days.

I haven't touched it in a while. How do these two editors compare lately?

tuananh 14 hours ago 2 replies      
$80 for something we make a living on is very reasonable.
danieldk 14 hours ago 1 reply      
In my experience, the beta had been stellar for ages. But now I can finally drop the money on them ;).

Purchased the upgrade license at and incredibly modest price of $30.

cypher543 13 hours ago 0 replies      
I'm surprised the "minihtml" HTML/CSS engine is buried in the release notes. That sounds like an amazing little component and something that would be extremely useful for projects that don't want to embed an entire browser engine. Even if Sublime itself remained closed, I would love to see minihtml open sourced!
m_st 14 hours ago 0 replies      
Finally! I was using Build 3126 just about 2 hours ago and thinking that I haven't seen an update in a looong time. And there it is now. Congratulations to the team at Sublime HQ. Keep up the great work!
samueloph 14 hours ago 7 replies      
imagine living in a world where a good software like sublime text was free software...

i know i know, to monetize selling free software is impossible (when people say they're monetizing selling free software they're actually selling services related to that free software, not the software itself), but one can dream...

edit-> some people are confusing the term "free software", i'd like to clarify that i mean free as in free speech, not free as in free beer.

tkubacki 10 hours ago 0 replies      
I love Sublime because it's rare example of quality linux app.
jasonrhaas 1 hour ago 1 reply      
Woo hoo! I love ST. I think the biggest thing lacking now is a solid package manager. I like how on VSCode and Atom you can kind of see the "stars" or popularity of the package before you install it.
emh68 9 hours ago 3 replies      
ST is the only editor with non-insane indentation controls: it's right there at the bottom of the window (want to start using 4-space indent in a JS file in the middle of a project full of C++ code that's tab indented? In a project where some C++ devs wrote 4-space indebted JS, when you normally prefer 2, but what to stay consistent? No problem, it's a click away). IntelliJ enforces per-language indentation (what if you have multiple projects with 2 or 4 space indent? Tough luck) and IIRC Atom requires you to download a barely-maintained plugin just to get something even resembling indentation control (and you have to edit a config file to change it - on the fly this ain't!)
esolyt 11 hours ago 0 replies      
Sublime's startup time (even before 3.0) never failed to amaze me, especially compared to Atom and VSCode.

And now it starts even faster.

thecrumb 14 hours ago 0 replies      
I bought my 2.0 license in 2011. Penciling in 4.0 for 2023 :)
Nvorzula 14 hours ago 10 replies      
I took a dive away from Sublime Text over to Atom a few years ago because I was starting up some contract work, didn't want to pay for a copy, and didn't want to continue doing the hokey thing of using a friend's license for work purposes. So I got use to Atom just fine, plus the UI is nice.

I mean, Atom is nice. The package management is all there and frequent updates are great, but...I don't write JS/HTML/CSS/PHP. I typically write Python, Go, Java, and heck even Prolog. Reading the changelog you can clearly see that they have a target audience, and I am not in it.

On the performance side (you knew it was coming!) I am mostly fine except for opening a project directory. I swear Atom has a coded in `sleep` whenever you try to open a file explorer. At first, I thought that this was a cute little quirk that would disappear after an update one day. But that update never came.

So I'll download Sublime again. Spend a morning to get it "just so" for, at the very least, Python and Go. I can easily see Sublime winning me back if I reinvest in it.

mixmastamyk 11 hours ago 2 replies      
Looking at the screen shot, I still find it odd that, they use a white background for the file panel on the left. This has the effect of drawing the eye to it, making it the focal point of the window.

That's the least important part of my editor honestly. Would expect it be a lot more low-key.

jdc0589 12 hours ago 0 replies      
wow, congrats Jon and Will, this has been a long time coming. I can not think of more than maybe one other piece of software I gladly pay for and look forward to new releases.

Also, Will: I apologize for being one of those assholes with a moderately popular plugin that still hasn't updated the thing to follow Package Control best practices.

I'm sure you guys have discussed it somewhere in the past, but would you comment on where you see Sublime heading feature wise now that there is, arguably, some competition in the same general editor market (vs code, atom, etc...)? I don't like comparing stuff and saying "why can you just do that" but some of those editors, even with all their shortcomings, have massively benefited from good debugger support (vs code), and a pretty well though out set of features to support plugin developers (dependency management, testing, etc...).

jokoon 5 hours ago 0 replies      
A little late to the party, but I'm glad to see folding code doesn't happen at a new line.

Although there is still no blinking block caret. The size can be changed but it's a solid color, not transparent.

Also I wonder if I could change the background color of the brace matching highlight.

arh68 7 hours ago 0 replies      
Note: if for some reason your b3126 doesn't work properly after running b3143, I found that deleting just the Packages folder from my data folder [0] was enough to get b3126 back to normal.

[0] https://www.sublimetext.com/docs/3/revert.html

longsangstan 10 hours ago 2 replies      
I love Sublime. Tried Atom, but too slow on my 2012 Macbook Air.

One question:How is sublime sustainable economically? I mean alternatives like Atom is free & open source, supported by a big company. With a infinite free trial model, how can sublime survive?

Mahn 14 hours ago 3 replies      
Tangential, but is everyone using Sublime comfortable with the sidebar on the left? Moving the sidebar to the right is the first thing I do in every editor, and the few times I tried Sublime I was surprised that for all its customizability that option doesn't exist. I was skimming through the changelog now and it seems like this is still true today.
tarikjn 11 hours ago 0 replies      
I have used Sublime for many years, but had to switch to Atom for a large mono-repo codebase, because there is no decent plugin on Sublime to exclude Git-ignored files from search. The only one available froze my computer every minute.
gkya 12 hours ago 1 reply      
As an enthusiastic Emacs user I can say that Sublime Text is one of the best text editors out there, together with Emacs and Vi-family. I've only sporadically used it but it's really nice. If I was using my "text editor" only for text-editing (I use Emacs apps like Gnus, Elfeed and Org-mode, and really enjoy Elisp and the programmable environment it provides), I'd definitely use it.

One thing that I don't understand is though, when I buy ST, what do I buy? I've only seen others use full versions but as far as I can tell it's only the [UNREGISTERED] bit in the titlebar and the random "please buy me" popup. It's understandable that one would pay merely to sustain its development but is there any actual differences?

ericthor 12 hours ago 1 reply      
Can any active users comment on the package ecosystem. Active? Running into any problems?
funkjunky 12 hours ago 0 replies      
Just adding my voice to the chorus of users that love sublime text so much that we are begging you to take more of our money. I cannot live or function without it, I use it for everything I do.

Discovering sublime text was crucial to my early development as a programmer, I can easily see myself losing interest in it without having such a powerful, efficient, intuitive, and FUN tool at my fingertips. Yeah I said it: fun. Sublime text is fun for me. I even type my emails and web form responses in it, just because.

Anyway, congrats on the release, I love sublime text, you already have my money but seriously, I'll give you more

mathnode 9 hours ago 0 replies      
I moved from Vim to ST around 2012, I missed the textmate hype, and never looked back.

Since then it has been my main editor, cross platform for php, then python, then ruby, to java (...yup), and now clojure and racket. And of course all the SQL, shell scripts, and config file munging in between.

Maybe one day I will learn emacs, but for the meantime I am happy and productive.

reimertz 13 hours ago 0 replies      
These news was a good reminder that I still used the trial version of the app. I somehow managed to getting used to all those "on-save reminder" you'd get every now and then.

Just bought it.

AJRF 9 hours ago 1 reply      
Is Sublime super good for webdev or something? Does it have a bunch of indespensible plugins for webdev? I cant see upside when comparing it to Vim, but I see lots and lots of folks rave about it so im willing to admit Im wrong but would like to know why people love it so much.
gapo 14 hours ago 7 replies      
I think Sublime is a great editor.

I enjoy a lot of the nice UI based workflows Sublime provides - but always felt that mastering VIM / emacs would provide me a far better pay out. Does any body else agree ?

gespadas 14 hours ago 0 replies      
Finally! Congrats devs! :-)
IshV 3 hours ago 0 replies      
Is it just me or does the new logo look a lot like Winamp's logo?
NuSkooler 12 hours ago 0 replies      
Thank you for your hard work! THIS is the editor I use on Windows, Linux, and OS X. You will not find a box that I work on without Sublime running.
ghostbrainalpha 13 hours ago 0 replies      
Sublime is so good, I just started using it to replace my Note Pad app for non-dev related stuff. For example shopping lists, meeting notes, and to do lists.

I found it was just easier to have one app to do everything.

Even though I don't have certain nice text formatting features, I use Code Comments to make certain lines distinct.

That's how you know you LOVE a product, when you still prefer to use it even for things it isn't designed for.

faaq 9 hours ago 1 reply      
What theme Are They using in the screen-capture [0] of sublime text?

[0] - https://www.sublimetext.com/screenshots/3.0/linux.png

sercand 10 hours ago 0 replies      
This week SourceTree also changed its icon, two favorite developer tool icon changes confuse me all day.
johnmc408 11 hours ago 0 replies      
Do they support "virtual cursor" yet? (that is where you can move the cursor up/down/left/right over "empty" space and not have the cursor "hug" the text...I really miss this feature and didn't see it in Sublime or VSCode (never tried Atom)
donatj 13 hours ago 0 replies      
I use Sublime mostly for large files and it's awesomly quick and useful search. I've switched to VSCode for most other tasks however.
vijaybritto 14 hours ago 0 replies      
I was wondering in the afternoon about when the next sublime would be released and what it would contain. Flabbergasted to see it trending no 1 in HN!!
wnevets 13 hours ago 0 replies      
> Startup is faster, opening files is faster, and scrolling is more efficient.

This is a big reason why I still use sublime over atom.

dsego 11 hours ago 1 reply      
If anybody is looking for a more "pro" ui theme, try monokai.pro/sublime-text. You have to buy a license though. It's actually made by the same guy who created the original monokai theme. There is a vscode version as well.
OutsmartDan 14 hours ago 2 replies      
Amazing, I don't think i've ever used "beta" products for so long. Glad it's finally official!
mcemilg 8 hours ago 0 replies      
What is the message behind the showing tensorflow cpp codes on the update image? Even cpp programmers can code on the Sublime Text?
cdnsteve 12 hours ago 0 replies      
Does anyone knowledge of what version 3 is written in, still C++ as version 2? https://news.ycombinator.com/item?id=2822114
roystonvassey 14 hours ago 2 replies      
As someone who greatly under-utilizes Sublime, I'm still amazed at the ease with which it handles crazy, large files. I never even notice it until someone remarks on how I'm able to open a ~20 Mb file without hassle.
ntrepid8 9 hours ago 0 replies      
I love it! Sublime Text is an excellent editor and I use it every day. It's worth every penny for a paid license.
speleding 13 hours ago 0 replies      
It's just $11 to upgrade from version 2... that's a steal
jokoon 14 hours ago 0 replies      
It's even faster than before... Atom has more catching up to do...
willcodeforfoo 11 hours ago 0 replies      
Long-time ST2 and ST3 user. I think I've more or less moved to VS Code but wanted to chime in: Great website! And loads super fast.
kahlonel 13 hours ago 0 replies      
I've been a loyal user of Sublime until a few years ago when I switched to Vim. Still have this beauty in my computer because of how happily it handles large files <3
skinnymuch 13 hours ago 1 reply      
For people on Mac, which plugins make Sublime better than current Textmate? I've never switched from it just because, but wouldn't mind switching or paying.
skybrian 11 hours ago 1 reply      
I'm curious how the language support works? There is apparently a plugin for language server protocol, but it's in beta.
wintorez 12 hours ago 0 replies      
No matter how many other editors or IDEs I tried, I always went back to Sublime. It's much faster than Atom, VSCode, etc.
dna_polymerase 13 hours ago 0 replies      
I just updated my Sublime and switched to the new layout. Woa! Once again I'm happy I invested in this beautiful piece of software!
nik736 14 hours ago 2 replies      
Does Sublime come with a Git integration like Atom does?
lowsenberg 14 hours ago 0 replies      
I don't know how often I type 'subl3 -n' every day. One of my all-time favorite tools. I'm happy to pay for the upgrade.
ijafri 5 hours ago 0 replies      
wow!! just ended my evaluation with this release and purchased the license...
keypress 8 hours ago 0 replies      
Is it open source?
nkkollaw 13 hours ago 0 replies      
Touchbar support? Does it still sort files in the tree view with folders first on Mac?
mundanevoice 13 hours ago 1 reply      
Thanks for building a great editor that just works and is fast enough. It has the lowest barrier to entry and is mostly free due to unlimited trial. 5 years ago, when I started writing code professionally, Sublime made things so easy because I didn't have to learn an IDE to write code.

Many kudos and one day I will definitely buy a LICENSE.

xs 13 hours ago 1 reply      
Is there an option to print yet?
betadreamer 11 hours ago 1 reply      
can you guys share what you LOVE about sublime? I mostly just use it as regular editor with Command P to open other files. I know I can do more than this...
Phenix88be 11 hours ago 0 replies      
Too late ! I m a spacemacs user now !

Seriously, this release took ages...

daok 13 hours ago 2 replies      
I don't understand that a product oriented for software engineer use sentence like "Significantly improved startup time" instead of real numbers. What does that mean "significantly"? 10%...50%?
pjmlp 14 hours ago 0 replies      
Congratulations on the release, getting a new license later on.
macksol 11 hours ago 0 replies      
Can't imaging going back to Sublime after switching to VS Code a few months ago.
macksol 11 hours ago 0 replies      
Can't imagine going back to Sublime after switching to VS Code a few months ago.
undoware 6 hours ago 0 replies      
Has anyone tried both Sublime Text 3 and Atom 1.20? I'd love to see a compare/contrast
beamatronic 13 hours ago 0 replies      
Does it support printing?
ddingus 10 hours ago 0 replies      
I love this program. Will buy another license.

Thank you for it.

Jeaye 10 hours ago 0 replies      
Is it still proprietary nagware?
m6g6a 12 hours ago 0 replies      
whipoodle 13 hours ago 0 replies      
Best editor out there. Congrats!
EGreg 13 hours ago 0 replies      
Just curious, how would this Sublime compare to the latest TextMate?
nolepointer 13 hours ago 1 reply      
Does anyone else see the old icon when pinned to the taskbar?
peteretep 14 hours ago 2 replies      
Linux finally has a decent text editor!
PopsiclePete 12 hours ago 0 replies      
my second fav. text editor after vs code. I gotta say tho, VS Code did get the plugin story better - they don't seem to clash/conflict with each other and with global settings the way they did (for me at least) with sublime.
paultopia 14 hours ago 0 replies      
It came out of beta? It came out of beta!!1!11111
jenkijo 14 hours ago 2 replies      
Oh shit! It come back
jgh 13 hours ago 1 reply      
is everyone just going to ignore that awful tab bar at the top?
I dont know who the Web Audio API is designed for mecheye.net
216 points by gulbanana  10 hours ago   103 comments top 25
symstym 7 hours ago 6 replies      
I've spent quite a lot of time working with the Web Audio API, and I strongly agree with the author.

I got pretty deep into building a modular synthesis environment using it (https://github.com/rsimmons/plinth) before deciding that working within the constraints of the built-in nodes was ultimately futile.

Even building a well-behaved envelope generator (e.g. that handles retriggering correctly) is extremely tricky with what the API provides. How could such a basic use case have been overlooked? I made a library (https://github.com/rsimmons/fastidious-envelope-generator) to solve that problem, but it's silly to have to work around the API for basic use cases.

Ultimately we have to hold out for the AudioWorklet API (which itself seems potentially over-complicated) to finally get the ability to do "raw" output.

greghendershott 7 hours ago 4 replies      
My first lesson in this was the Roland MPU-401 MIDI interface. It had a "smart mode" which accepted timestamped buffers. It was great... if you wanted a sequencer with exactly the features it supported, like say only 8 tracks. It was well-intentioned, because PCs of that era were slow.

The MPU-401 also had a "dumb" a.k.a. "UART" mode. You had to do everything yourself... and therefore could do anything. It turned out that early PCs were fast enough -- especially because you could install raw interrupt service routines and DOS didn't get in the way. :)

As a sequencer/DAW creator, you really want the system to give you raw hardware buffers and zero latency -- or as close to that as it can -- and let you build what you need on top.

If a system is far from that, it's understandable and well-meaning to try to compensate with some pre-baked engine/framework. It might even meet some folks' needs. But....

cyberferret 51 minutes ago 0 replies      
I had a discussion on Twitter recently about a possible use case for WebAudio - and that was a sound filters - in pretty much the same way as Instagram popularised image filters for popular consumption.

One thing that really irks me at the moment is the huge variation in sound volume of the increasing plethora of videos in my social media feed. If there was some way we could use a real time WebAudio manipulation on the browser to equalise the volume on all these home made videos, so much the better. Not just volume up/down, but things like real time audio compression to make vocals stand out a little.

Add delay and reverb to talk tracks etc. for podcasts.

EQ filters to reduce white noise on outdoor videos etc. also would be better. People with hearing difficulties in particular ranges, or who suffer from tinnitus etc. would be able to reduce certain frequencies via parametric equalisation.

It would be intriguing to see a podcast service or SoundCloud etc. offer real time audio manipulation, or let you add post processing mastering effects on your audio productions before releasing them in the wild.

kowdermeister 6 hours ago 4 replies      
Stopped reading at: "Something like the DynamicsCompressorNode is practically a joke: basic features from a real compressor are basically missing, and the behavior that is there is underspecified such that I cant even trust it to sound correct between browsers. "

Then if you look into it:

 dictionary DynamicsCompressorOptions : AudioNodeOptions { float attack = 0.003; float knee = 30; float ratio = 12; float release = 0.25; float threshold = -24;
Which are indeed the basics that you need and totally enough for most use cases.

Check out a vintage compressor that has a dozen implementation as VST plugins:


fzzzy 5 hours ago 1 reply      
Mozilla had a competing api that just worked with sample buffers. Unfortunately it didn't win the standardization battle.


Tanner 7 hours ago 1 reply      
This article focuses on emscripten examples and for good reason! The effort to resolve the differences between OpenAL and Web Audio has been on-going and exacerbated by Web Audio's API churn, deprecations and poor support.

That said, this current pull request on emscripten is a fantastic step forward and I'm very excited to see it's completion: https://github.com/kripken/emscripten/pull/5367

fenomas 2 hours ago 1 reply      
I have to cast a vote in opposition here.

I've been heavily into procedural audio for a year or two, and have had no big issues with using Web Audio. There are solid libraries that abstract it away (Tone.js and Tuna, e.g.), and since I outgrew them working directly with audio nodes and params has been fine too.

The big caveat is, when I first started I set myself the rule that I would not use script processor nodes. Obviously it would be nice to do everything manually, but for all the reasons in the article they're not good enough, so I set them aside, and everything's been smooth since.

So I feel like the answer to the articles headline is, today as of this moment the Web Audio API is made for anyone who doesn't need script nodes. If you can live within that constraint it'll suit you fine; if not it won't.

(Hopefully audio worklets will change this and it'll be for everyone, but I haven't followed them and don't know how they're shaping up.)

cromwellian 3 hours ago 2 replies      
Isn't Web Audio based off of MacOS'x Audio API?

I think the whole point is that Javascript used to be slow, and using the CPU as a DSP to process samples prevents acceleration. Seems to me what is needed is like "audio shaders" equivalent to compute/pixel shaders, that you farm off to OpenAL-like API which can be compiled to run on native HW.

Even if you grant emscripten produces reasonable code, it's still bloated, and less efficient on mobile devices than leveraging OS level DSP capability.

throwa34943way 4 hours ago 0 replies      
For reference : https://www.audiotool.com/app ( using Flash ).

You just can't do that with the same level of tightness of rhythm on low hardware with web techs today. Flash was bad yet Flash also opened up insane possibilities on the web when it comes to multimedia applications that just can't be matched with Webtechs. ASM.js might fill the gap, but i haven't seen any equivalent yet.

barryhoodlum 7 hours ago 3 replies      
How to play a sine wave:

 const audioContext = new AudioContext(); const osc = audioContext.createOscillator(); osc.frequency.value = 440; osc.connect(audioContext.destination); osc.start();
"BufferSourceNode" is intended to play back samples like a sampler would. The method the author proposes of creating buffers one after the other is a bizarre solution.

captn3m0 7 hours ago 0 replies      
I once attempted to do RS232 decoding in WebAudio (A speedstack timer of mine does RS232 over aux) and faced these exact issues before giving up.
trejj 6 hours ago 0 replies      
Curiously, reading through Web Audio API bug tracker find items such as https://github.com/WebAudio/web-audio-api/issues/1305 and https://github.com/WebAudio/web-audio-api/issues/938, that echo the point from the article quite well. Oh dear..
diminish 7 hours ago 4 replies      
>> Can the ridiculous overeagerness of Web Audio be reversed? Can we bring back a simple play audio API

To be frank, graphics world had some type of standard (OpenGL) long time ago, next to DirectX. So WebGL had a good example. However in the audio world we haven't seen a cross platform quasi-standard spec covering Mac, Linux and Windows. So IMHO, non-web audio lacks also common standards for mixing, sound engineering, music-making. That's why web audio appears to lack a use case. IMHO, that smells opportunity.

I use Web Audio, in canvas-WebGL based games where music making is needed. I understand the issues - we definitely need more than "play" functionality.

jancsika 5 hours ago 2 replies      
Just from skimming the spec, the AudioWorklet interface looks very close to what is needed to build sensible, performant frameworks for audio profs and game designers.

So the most important question is: why isn't this interface implemented in any browser yet?

That a BufferSourceNode cannot be abused to generate precision oscillators isn't very enlightening.

cyberferret 4 hours ago 1 reply      
I worked on a (now abandoned) project a while back using Web Audio API, but it was NOT for Audio at all - in fact, it was to build a cross platform MIDI controller for a guitar effects controller.

As someone mentioned elsewhere on this thread Android suffered from a crappy Audio/MIDI library. iOS's CoreMIDI was great, but not transportable outside of iOS/OSX. Web Audio API's MIDI control seemed a great way to go - just build a cross platform interface using Electron App and use the underlying WebAudio to fire off MIDI messages.

Unfortunately, at the time of developing the project, WebAudio's MIDI SYSEX spec was still too fluid or not completely defined, so I had trouble sending/reading SYSEX messages via the API, and thus shelved the project for another day.

rl3 4 hours ago 0 replies      
>It [WebGL] gives you raw access to the GPU ...

Not to be semantic, but that's technically incorrect. Indeed, if WebGL were to be supplanted by a lower-level graphics API, that would make a lot of people happy.[0]

As far as the author's thesis concerning the Web Audio API: I agree that it's a total piece of shit.

[0] https://news.ycombinator.com/item?id=14930824

k__ 7 hours ago 1 reply      
Are there any good audio APIs out there?

Video AND audio? They good you all covered with nice APIs!

Just audio? You're screwed!

pcsanwald 5 hours ago 0 replies      
Kinda tagential to the thread, but what's the best book for an introduction to audio programming for an experienced, language agnostic coder (java, c, c++, obj-c, etc)?
derefr 5 hours ago 1 reply      
Question: is the "point" of Web Audio to expose the native hardware-accelerated functionality of the underlying audio controller, through a combination of the OS audio driver + shims? Or is it more an attempt to implement everything in userspace, in a way equivalent to any random C++ DSP graph library? I've always thought it was the former.
Pxtl 2 hours ago 0 replies      
So it sounds like the web audio API is every good at modeling audio as the web GUI API is at modeling GUIs.
Camillo 28 minutes ago 0 replies      
The font on this page is insanely thin on my browser (Chrome, OS X).
aaroninsf 7 hours ago 0 replies      
Plus one for sure.

I put some weekends into trying to build a higher-level abstraction framework of sorts for my own sound art projects on top of Web Audio, and it was full of headaches for similar reasons to those mentioned.

The thing that I put the most work into is mentioned here, the lack of proper native support for tightly (but prospectively dynamically) scripted events, with sample accuracy to prevent glitching.

Through digging and prior work I came to a de facto standard solution using two layers of timers, one in WebAudio (which support sample accuracy but gives you hook to e.g. cancel or reschedule events), and one using coarse but flexible JS timers. Fugly, but it worked. But why is this necessary...!?

There's a ton of potential here, and someone like myself looking to implement interactive "art" or play spaces is desperate for a robust cross-platform web solution, it'd truly be a game-changer...

...so far Web Audio isn't there. :/

Other areas I wrestled with: buffer management, especially with CORS issues and having to write my own stream support (preloading then freeing buffers in series, to get seamless playback of large resources...) lack of direction on memory management, particularly, what the application is obligated to do, to release resources and prevent memory leaks the "disposable buffer" model makes perfect sense from an implementation view but could have easily been made a non-issue for clients. This isn't GL; do us some solids yo.

Will keep watching, and likely, wrestling...

revelation 7 hours ago 1 reply      
The major problem of this API is that they couldn't just copy something designed by people with actual knowledge, as in WebGL. So it was design by committee that does so much the application should handle but has so deficient core capabilities no application can rectify any of it.
dmitriid 7 hours ago 1 reply      
One word: w3c.

I've said it before, I'll say it again: it exists in a vacuum, and is run by people who have never done any significant work on the web, with titles like "Senior Specifications Specialist". Huge chunks of their work is hugely theoretical (note: not academical, just theoretical) and have no bearing on the real world.

megamindbrian 7 hours ago 1 reply      
Web audio can be used with this: https://wavesurfer-js.org/
How JavaScript works: memory management and common memory leaks sessionstack.com
274 points by zlatkov  13 hours ago   45 comments top 8
pizlonator 7 minutes ago 0 replies      
> As of 2012, all modern browsers ship a mark-and-sweep garbage-collector. All improvements made in the field of JavaScript garbage collection (generational/incremental/concurrent/parallel garbage collection) over the last years are implementation improvements of this algorithm (mark-and-sweep), but not improvements over the garbage collection algorithm itself, nor its goal of deciding whether an object is reachable or not.

WebKit uses a constraint-based garbage collector that does not rely on reachability alone. This is an improvement over the classical garbage collection algorithm.

vvanders 12 hours ago 5 replies      
Wait, is #3 for real? If that's the case it seems like a huge oversight.
randomguy1254 10 hours ago 2 replies      
Nice article. Minor gripe about the static vs dynamic memory section. The requirement that the data sizes be known at compile-time for static memory (with the example of an array allocated to a user-inputted size), seems to be based on a past restriction of the C language. C has since remove the requirement that stack-based arrays are sized with a compile-time constant; there is nothing at the hardware/assembly level which prevents such arrays. So these stack-based non-compile-time-sized arrays don't fit into either the static or dynamic memory categories presented here.
fenwick67 11 hours ago 4 replies      
Who is this article written for? There's a whole section on "What is memory?". If you are optimizing to remove memory leaks I really hope you already know what memory is.
styfle 10 hours ago 1 reply      
Jump straight to "The four types of common JavaScript leaks" section:


irtefa 11 hours ago 0 replies      
Haven't read such an easy to read technical article in a while. Kudos!
dispo001 12 hours ago 2 replies      
having stuff do stuff for you is useful until it doesnt
jnordwick 9 hours ago 0 replies      
More extremely junior posts being rated to the front page. Y combinator is changing and i don't like its new junior tutorial level.
ASCII and Unicode quotation marks cam.ac.uk
121 points by anschwa  10 hours ago   121 comments top 21
lisper 7 hours ago 7 replies      
The fact that ASCII does not have balanced quotes is one of the great catastrophes of computing. It makes everything more complicated than it needs to be, from embedding code in strings to parsing CSV files, to regexps. For example, if I want to embed a quoted string in another quoted string, I have to escape the inner quotes like so:

"This is string containing an embedded \"quoted\" string"

Then I have to think about whether or not the system I'm going to send that string to is going to "helpfully" remove the backslashes, in which case I need to write:

"This is a string containing an embedded \\"quoted\\" string"

God help you if you want to go two levels deep.

All this horrible complexity could have been avoided if we could just write:

This is a string containing an embedded quoted string


peapicker 9 hours ago 6 replies      
I'm pretty sure text like:

Is how you're supposed to write short quotes in the TeX/LaTeX typesetting system.

[edit: My point being that the author seems to think this type of quoting originated with X11... which is actually newer than TeX (X11 was first released in 1984), and that the prevalence of this type of quoting likely originated with TeX when it was released in 1978... which isn't mentioned at all in the article. In fact, since TeX/LaTeX is what all the CS, Physics, and Math types were using for journal articles, it is likely the X11 font bitmap glyphs were intentionally shaped like curly quotes to make editing your TeX source files prettier.

At least, that's how I remember it...]

darkengine 9 hours ago 1 reply      
MS PGothic, a very common font in Japan, still uses this type of quote. "Quoting like this'' (double quote, then two single quotes) looks the most natural in this font. "Using two double quotes" looks quite odd (see screenshot) [1]

If you've ever seen an English-language page on a Japanese website that used weird quotes, this is probably why.

[1] https://i.imgur.com/zcuFZa1.png

mirimir 39 minutes ago 0 replies      
In another life, I analyzed enterprise data. Variation in quotation marks was a common problem. I mean, is it "D'arcy" or "Darcy"? Sometimes, I think, people would mangle data in spreadsheets, with auto-correct on.
sengork 24 minutes ago 0 replies      
Things become really fun when you're trying to figure out why that command fails when you've copy/pasted it from another application window.

Often it's the quotes which have been silently (automatically) converted to a visually similar (but functionally incompatible) character variant.

ttepasse 3 hours ago 1 reply      
The usage of of an accent as syntax in markup and programming languages annoys me to no end. And it will still be used, to this day, the latest example are template string in Javascript.

It is semantically idiotic because it's an accent, not a character.

It is visually annoying because you almost can't see the thing.

It is bad for usability, because on non-US keyboards the accents are implemented as dead keys. Yes, accent + space gives you the character but that's really unintuitive for people who grew up expecting accents only over letters.

garou 9 hours ago 2 replies      
It's very odd for me to see the grave accent (`) as quoting mark in bash and other programming languages.I understand that the accent alone lose its function for the human language. But still uncomfortable to se an accent as delimiter to a string.
13of40 2 hours ago 1 reply      
CSB: Years ago I was working on a team that developed a scripting language and we had this recurring problem where someone would write up a code sample in a Word document and it would break if you cut and pasted it because all of the single and double quotes would be Unicode. My boss was this tough guy who tried to snap the whole team to a standard of strictly disabling that behavior in all of our Office applications, but I piped up and said maybe we should just make the language treat all of those characters like apostrophes and quotes.... I think around version 5 they finally made an API for doing proper anti-injection escaping because you pretty much needed a PhD to get it right due to all of the variations introduced by the extended characters.
mxfh 8 hours ago 1 reply      
to add to the confusion:

' PRIME (U+2032)

" DOUBLE PRIME aka inch mark (U+2033)

have their own codepoints


which describes implications for typesetting coordinates and other things:

118 19 43.5

118 19 43.5wrong (curly quotes, although it renders identical in some fonts)

118 19' 43.5"right

alanh 2 hours ago 0 replies      
While I cant expect many to follow suit, I myself often type educated quotes and nice apostrophes. The macOS keyboard combinations (nearly-intuitive combinations of Option-(Shift)-[ and -] for ) have long been committed to muscle memory. And since nearly all (web) file formats seem to be UTF-8, the days of manually typing &ldquo; and friends are long, long gone.

Benefits of typing and using typographers quotes directly in your JS/JSON/HTML/source:

1. No backslashes or other escape sequences needed!


3. Retina screens and gorgeous modern fonts mean that your sloppy quotes will look extra bad if you just use ASCII quotes

jiggunjer 1 hour ago 0 replies      
So why isn't there a straight single quotation, but there is a straight double quotation? I get it probably arose from compatibility reasons, but nowadays Unicode should be able to offer something?

P.S. Major coincide I was googling this very question yesterday?

treve 8 hours ago 2 replies      
It just occurred to me how much easier certain text-operations (like syntax highlighting, regular expressions and other parsers) if we consistently used the right unicode symbols for quotes and apostrophes
ratmice 9 hours ago 1 reply      
FYI For a long time GNU coding standards prescribed using the grave accent, but this changed some years ago now


kazinator 8 hours ago 2 replies      
> Please do not use the ASCII grave accent (0x60) as a left quotation mark together with the ASCII apostrophe (0x27) as the corresponding right quotation mark (as in `quote').

Tell that to GCC:

 /usr/lib/gcc/i686-linux-gnu/4.6/../../../i386-linux-gnu/crt1.o: In function `_start': (.text+0x18): undefined reference to `main'
Looks good to me, by the way.

> Where ``quoting like this'' comes from

I did it for a while out of a habit acquired from working with TeX. In TeX, it is the source code syntax for encoding quotes. Of course, it is lexically analyzed and converted to proper typesetting.

> If you can use only ASCIIs typewriter characters, then use the apostrophe character (0x27) as both the left and right quotation mark (as in 'quote').

It looks like shit in any font in which the apostrophe is a little nine, which is historically correct. What you want is a little "six" on one side and a "nine" on the other, or at least some approximation thereof. Even if the apostrophe is crappily rendered as a little vertical notch, it still pairs with a backwards-slanted `.

(The representation of apostrophe as a little vertical notch, I suspect, caters to literals in programming languages.)

> If you can use Unicode characters ...

then you should still stick to ASCII unless you have other good reasons to. ``Can'' is not the same thing as ``should'', let alone ``must''.

> For example, 0x60 and 0x27 look under Windows NT 4.0 with the TrueType font Lucida Console (size 14) like this:

The idea that people should change their behavior because of which font is default on the Windows cmd.exe console is laughable.

jrochkind1 2 hours ago 0 replies      
MRI ruby still does this in some error messages. I hate it. Always messing up my copy-and-paste into `` markdown too.
rdtsc 6 hours ago 0 replies      
> The Unix m4 macro processor is probably the only widely used tool that uses the `quote' combination as part of its input syntax; however, even that could be modified via changequote.

I remember staring for a long time at the file when I first saw an m4 macro. My brain was telling, surely this has go to be a typo, but then everything worked as expected. Then I learned that's a proper way of quoting there.

gumby 7 hours ago 1 reply      
I find it interesting that the article includes a German keyboard that doesn't include the proper ,,'' (or ,') quotation glyphs. However it does include grave and acute accents as well as French primary quotations (<< and >>) though not the secondary guillemots (quotation characters < and >) none of which are used in German text.

And of course I used ascii analogues to type these into HN :-(

exikyut 5 hours ago 0 replies      
For reference, the BIOS text-mode font included with some IBM PCs (I've observed this on NetVistas and ThinkPads myself, at least) renders ` as a nice-looking opening quote, and ' looks like a nice closing quote.
tempodox 9 hours ago 1 reply      
I would fain use the curly quotes if only Darwin's groff(1) wouldn't barf on them. For the time being, man pages for one still need to quote like ``this''.
audiodude 4 hours ago 0 replies      
Honestly I've been seeing `quote' in bash and other CLIs for my entire career and always thought they were just funny or strange, but carried no meaning.
dmitriid 7 hours ago 1 reply      
It's worse for other languages. Russian quotation marks are and . Thanks to early computers being predominantly from/designed in the US, they are now highjacked by American quotes.

Same probably goes for French and other languages with their own sets of quotation marks.

Java Reflection, 1000x Faster norswap.com
74 points by norswap  7 hours ago   24 comments top 8
btown 6 hours ago 2 replies      
> The simple approach is to simply add a children() method to the interface and implement it in every kind of node. Very tedious, and boilerplaty as hell.

The best approach without boilerplate would be to generate this at compile time, not runtime. You could use an approach like in http://hannesdorfmann.com/annotation-processing/annotationpr... to create at compile-time, using reflection, a ChildWalker class that accesses the relevant properties for every class annotated with @Node. At runtime, the JIT should get this down to a vtable lookup and field lookups - just about as optimized as you can get.

EDIT: Always remember https://xkcd.com/1205/ - if it would take 5 seconds to write each children() method, and you write no more than 5 Node classes per day (amortized), then you shouldn't spend more 12 hours writing the code for this blog post ;) Unless, of course, that was the point all along!

jtmarmon 6 hours ago 2 replies      
Seems to me this is approaching this totally the wrong way. First off, the current implementation is just looping through all the methods of the implementing class and the first one that matches a Node or [Node] return type is supposedly its children? That seems extremely brittle.

The fact that you have 100 classes implementing this is a good sign you should turn the design on its head. Why not just have a single tree structure built using generics?

edit: also I would point out that you're not really making reflection any faster, just your code

hota_mazi 4 hours ago 1 reply      
If you are using reflection and encountering performance problems, the correct approach is pretty much always to write an annotation processor and generate that code instead.
joemag 2 hours ago 0 replies      
In the past, I've used Introspector API [1] for property reflection. It's part of the JDK, and provides a lot of the caching this article is talking about. Doubt this would provide the same level of improvement as adding the direct children() method, or even ASM based approaches, but it's certainly faster than naked reflection.

[1] https://docs.oracle.com/javase/7/docs/api/java/beans/Introsp...

kodablah 5 hours ago 0 replies      
Didn't look too deep, but this might be due to the fact that call sites are memoized for invoke calls as part of the invokedynamic improvements (but really MethodHandle::invoke and MethodHandle::invokeExact are where the magic is as is mentioned by the JVM spec IIRC).

Regardless, MethodHandle invocations are always going to be faster than reflection Method invocations. A primary reason is that the parameters for invoke and invokeExact are not subject to the same boxing and runtime-validation requirements as reflection.

xenadu02 6 hours ago 2 replies      
I assume the JIT isn't optimizing until the functions execute a certain number of times. Given the speed difference maybe it isn't even natively compiling at first and using the interpreter.

I don't know about Java but in .NET there's a call you can make to force the dynamically generated lamba expression to be compiled immediately.

Of course if you're being really adventurous you can use IL emit to build a function up from IL opcodes.

solomatov 6 hours ago 2 replies      
There's another, and IMO, a better way to make Java reflection faster. It's to disable checks on reflection calls. Just call setAccessible(true), and you will notice substantial improvement.
agumonkey 4 hours ago 0 replies      
I wonder if the clojure devs use these techniques. IIRC clojure relies a lot on reflection.
Ford disguised a man as a car seat to research self-driving techcrunch.com
290 points by gopalakrishnans  9 hours ago   101 comments top 28
michaelbuckbee 9 hours ago 5 replies      
It sounds goofy, but this strikes me as really clever. Compared to almost anything else with self driving cars adding a few indicators to outwardly show what it's going to do next (for pedestrians and other drivers) is a huge win.

There is a fair amount of waving for someone else to go first at a turn, seeing if a driver is distracted (on their phone) at a stop, making eye contact while using a cross walk etc that gets lost with SDVs.

Also, I really feel like they stole this idea from Raid 2 https://youtu.be/ErrRhXItBWc?t=118

mykeliu 8 hours ago 2 replies      
People in the comments are making references to prank videos and film techniques, but this type of research study has also been conducted multiples times in the last few years by institutions such as Stanford [1], UC San Diego [2], Virginia Tech [3], and more.

[1] http://wendyju.com/publications/RO-MAN2016-Rothenbucher.pdf

[2] http://www.sandiegouniontribune.com/news/science/sd-me-ghost...

[3] https://www.citylab.com/transportation/2017/08/heres-the-rea...

shangxiao 9 hours ago 4 replies      
A reporter apparently tried to talk to one of the drivers and they refused to acknowledge his presence: https://twitter.com/AdamTuss/status/894627339891609602
rurounijones 27 minutes ago 0 replies      
I have been in a situation when I was mid-crosswalk when an idiot came screaming round a long shallow corner too fast (fast enough to have the white-line between his wheels).

I had a 50/50 choice. Keep going or run back. In the 3 or so seconds I had we made eye contact and I saw him return his eyes to my front (i.e. he was trying to get back on to his side of the road) so I moved backwards.

Not sure what I would have done if it were a self-driving car and unable to do the visual communication (Although the entire point might be moot since a self-driver wouldn't be in that situation)

josefresco 9 hours ago 12 replies      
"they just needed people to believe wholeheartedly they were using one."

Don't they mean "seeing one" instead of "using one"? Or am I missing something?

"fill in gaps where we currently communicate via subtle gestures, eye contact and other less obvious mechanisms."

This also struck me as odd - do pedestrians and other drivers really make "eye contact" with drivers to gauge their intention? I guess it's possible, but in many cases you can't see the driver's head, let alone eyes.

ATsch 7 hours ago 1 reply      
It's interesting, everybody is thinking about how this was used for pranks and films, but I immediately thought of the much more sinister attempts to flee east Germany. I was unable to find a photo, but I remember seeing a car that was modified so a person could be sewn into the seat in a Berlin Museum.
otakucode 9 hours ago 2 replies      
This is really quite common. I read an article about a car in Pittsburgh where a driver was similarly disguised in order to research specifically other peoples reactions to driverless vehicles on the road. In the article I read, I believe it occurred in Pittsburgh, PA and the researcher was affiliated with a university (maybe Carnegie Melon?). The reporter was able to speak with the costumed researcher just briefly, but got a more substantive statement from the org doing the research.
VMG 9 hours ago 0 replies      
dpflan 8 hours ago 1 reply      
Seems like they need to turn the cameras inward too (or has this been done already?); they can start observing "good" drivers providing signs to other drivers to then learn how to communicate a driving decision better.
riphay 9 hours ago 0 replies      
Really interesting study, would have liked to see some preliminary or even anecdotal findings discussed in the article.

I've seen some Youtubers pranking drive-through windows in the same way and they're pretty funny at the very least.

BjoernKW 9 hours ago 0 replies      
The setup reminds me of a pretty weird story called "The Human Chair": https://en.wikipedia.org/wiki/The_Human_Chair
zaroth 8 hours ago 0 replies      
Looks like they put a cylon indicator on it? Not terrifying at all...

As for devising new signals which other drivers are supposed to watch to understand what the car plans to do, I'd say we need a lot more research to understand if this actually helps or just distracts.

kornork 8 hours ago 0 replies      
So what were the results? Are pedestrians jerks? Do other cars cut them off?
firefoxd 8 hours ago 0 replies      
New Turing test:

Is the driver in the car in front of you a human driver or a computer.

ourmandave 4 hours ago 0 replies      
Prediction: this is the sell out costume for Halloween.
foota 6 hours ago 2 replies      
This article confused me a lot more before I realized Ford meant the company, not the individual.
askvictor 6 hours ago 0 replies      
The conspiracy theorist in me figures this kind of research will be used by companies that are falling behind in the self driving car race (no pun intended) to get governments to regulate against self driving cars.
jedberg 7 hours ago 0 replies      
Off topic, but man do I hate looping gifs in my articles. It's so incredibly distracting.

Sure, play it once, maybe even twice. But an endless loop? That's just unnecessary.

joshdance 6 hours ago 0 replies      
Reminds me of the magician who goes through drive throughs in that costume.

I like the idea of an indicator showing what the car is 'doing'.

neves 6 hours ago 0 replies      
In London, with their right positioned drivers, more than once I got a scare of the phantom drivers. :-)
ramasterson 7 hours ago 0 replies      
Leslie Nielsen did this forever ago: https://www.youtube.com/watch?v=xqJ3lx43lMg
nomoral 7 hours ago 0 replies      
trhway 7 hours ago 0 replies      
a programmer disguised as HM Aeron chair ... probably makes for more serene looking open floor office, and also minimizes the chances of the others bugging you with various stuff.
ProAm 9 hours ago 1 reply      
So they re-did a prank from 2013 but for science [1]

[1] https://www.youtube.com/watch?v=xVrJ8DxECbg

bitwize 9 hours ago 3 replies      
This isn't even the most elaborate market-research stunt I've seen.

Some of you older folk may remember an 80s sitcom called Small Wonder, which was a typical American suburbia family sitcom, except the youngest daughter, Vicki, was a robot. What I found unusual about the show was its copyright message: "1987 The Small Wonder Joint Venture". In later years I found out that the show was produced in part for market research purposes, to solicit feedback about how Americans might feel about robots in the home -- especially robots that look and behave like humans. It was the 80s and we all thought that was coming Real Soon Now.

harveywi 5 hours ago 0 replies      
Not quite the promotion to deputy chair that he had expected.
nobodyorother 7 hours ago 0 replies      
I can't wait until somebody patents "signaling pedestrians" and we all have to deal with brand-specific signaling mechanisms.

Thank Zod QWERTY was invented so long ago.


MrBlue 8 hours ago 0 replies      
Going off on a tangent here but is the HDR filter really necessary for those images? What is gained by using it? /rant
EFF, ACLU Sue Over Warrantless Phone, Laptop Searches at U.S. Border eff.org
405 points by DiabloD3  10 hours ago   83 comments top 8
wallace_f 1 hour ago 1 reply      
Isn't the US Constitution the highest law in the US? The Fourth clearly states people should be secure from search or seizure of their personal effects and papers, which obviously extends to electronic devices.

So my question is, shouldn't there be extroardinary consequences for breaking laws such as these?

Why does it appear so easy for government to get away with this? Is it a really bad thing thay constitutional rights are being easily trampeled on? It seems like a bad deal to me.

greymeister 6 hours ago 2 replies      
The US extends the border-search exception to anywhere within 100 miles of an airport with international fights, meaning something like 60% of the US lives within a "border zone" as most international airports are close to dense population centers.
ironix 8 hours ago 6 replies      
I'm going on a trip to Canada within the next month, from the US, as a US citizen.

I want to be let into Canada without issue, so am taking a burner smartphone connected to a non-critical gmail account that is plausibly-maybe my "real" personal one. But not really. The maximum threat to me is detention, or more likely, refused entry. If I am asked to unlock the device, I will.

Crossing back into the US, I am less concerned. If I am asked to unlock the device, I will NOT. The maximum threat to me is semi-indefinite detention, and I know at the end of it, I can reach out to the EFF to seek representation in a larger action.

Does anyone else have any tips/tricks/ideas here? I realize trying to subvert any Canadian border search is not a good idea, but it's a good middle-grounds vs. "don't go to Canada" or "give them all your private data", I think. On the other hand, I am willing to be more stringent with the US border because (A) I am a citizen, I cannot be refused entry, and (B) this is a cause I would like to participate in, so invite any negative outcome caused by my refusal to unlock the device or share any logins.

aey 9 hours ago 2 replies      
Donate to the eff. They will send you an awesome hoodie.
derefr 8 hours ago 2 replies      
Interesting question to me: is any country offering easy-to-attain diplomatic-courier status, such that I could (legitimately) label my laptop bag as a diplomatic pouch to protect it from search?

(Yes, it's more complex than this; you'd have to be able to upload a manifest of what's in the bag and what it weighs to some service of that country's government, and then the country's embassy here would forward the manifest to the State Dept and they'd send you a sticker for your bag, etc.)

meri_dian 8 hours ago 6 replies      
If they can search your bags without a warrant at the border, why can't they search your phone or laptop?

Edit: Contraband can be both physical and digital. If the government can conduct searches for physical contraband then searches for digital contraband in certain circumstances like border crossings seems reasonable.

rdiddly 8 hours ago 1 reply      
I wish I could thank these guys with big hugs but instead I'll probably have to settle for donating.
tonyztan 9 hours ago 1 reply      
Dupe: https://news.ycombinator.com/item?id=15240700

Edit: Saw the downvotes, so just wanted to note that the linked post was submitted before this one, and hence this comment. Not that it matters. :)

Overthinking Fizzbuzz with Monoids fayr.am
89 points by KirinDave  9 hours ago   39 comments top 8
paultopia 7 hours ago 2 replies      
Python can produce extensible solutions! It can!

(Edit from sillier comment.)

 def fizzbuzz(n): outstring = "" outputs = {5: "buzz", 3: "fizz", 7: "bar"} for x in sorted(outputs.keys()): if n % x == 0: outstring += outputs[x] if outstring: return outstring return n
Then all you gotta do to add more prime numbers is stick them in the dict (or factorize composite numbers you want to put in). Which is more idiomatic in python than endless if elif elif elif elif.

pja 7 hours ago 2 replies      
No where near compact (or possibly obtuse?) enough for a Haskell version, surely? Here's one I found elsewhere on the net sometime ago:

 (~>) :: (Integral a) => a -> String -> a -> Maybe String (n ~> str) i = str <$ guard (i `mod` n == 0) fizzbuzz = 3~>"Fizz" <> 5~>"Buzz" main = mapM_ putStrLn $ catMaybes $ fizzbuzz <$> [1..100]
At least it generalises nicely to arbitrary fizzbuzz numbers! (edit: as noted below this version as written fails to print the non fizzbuzz digits. An exercise for the reader :) )

nicolashahn 8 hours ago 2 replies      
I took a course that focused on Haskell in college. I enjoyed it. I love reading articles about how neat Haskell is. I've still never been convinced that I should use Haskell over a more mundane language for any actual project.
101km 7 hours ago 1 reply      

 from functools import partial def rem(i, n, message): return message if not (i % n) else '' [(''.join([ partial(rem, message='fizz', n=3)(i), partial(rem, message='buzz', n=5)(i) ]) or i) for i in range(1,101)]

 {-# LANGUAGE MonadComprehensions #-} module Main where import Data.Monoid (mappend) import Data.Maybe (fromMaybe, listToMaybe, maybe) import System.Environment (getArgs) fizzbuzz i = fromMaybe (show i) $ mappend ["fizz" | i `rem` 3 == 0] ["buzz" | i `rem` 5 == 0] -- mapM_ is our iterator, putStrLn writes to console. main = mapM_ putStrLn [ fizzbuzz i | i <- [1..100] ]

cdevs 5 hours ago 1 reply      
Just pass in a associative array with numbers 3 and 5 for keys and what to say if mod that key value == 0, extendable, done, clock out.
kbenson 6 hours ago 1 reply      
There's some interesting Perl 6 implementations here[1] (and in the discussion of that), which shows some interesting capabilities of multiple dispatch, and farther down using subtypes along with multiple dispatch.

I particularly like this terse one:

 sub fizzbuzz($n, $_ = [$n % 3, $n % 5]) { when [0, 0] { "fizzbuzz" } when [0, *] { "fizz" } when [*, 0] { "buzz" } default { $n } }
That's fairly tight, while remaining somewhat readable. There's a version that adds a line or two by moving $_ into the body of the sub as well in case that's more readable to some.

1: https://gist.github.com/masak/b9371625ad85cfe0faba

Zelizz 5 hours ago 3 replies      
We can go a little shorter with C :)


framebit 8 hours ago 3 replies      
No discussion of overthinking FizzBuzz is complete without a shoutout to the glorious EnterpriseFizzBuzz: https://github.com/EnterpriseQualityCoding/FizzBuzzEnterpris...
What Monoids teach us about software deque.blog
146 points by adamnemecek  13 hours ago   163 comments top 18
wyc 9 hours ago 5 replies      
Here's the ELI5 of monoids used in programming that might help get the idea across:

Conceptually, a monoid is anything that:

- Has a "zero-value" (mempty, e.g., 0)

- Can be "appended" together (mappend, e.g., +)

- Has an identity with the zero-value: x + 0 == x, 0 + x == x

- Is associative: x + y + z == (x + y) + z == x + (y + z)

This isn't limited to just arithmetic with operators like +. You can define whole new types as monoids if they have these characteristics. For example, we can merge together configuration files by using monoid operators (in pseudo-code):

 -- Zero Value mempty == {} -- Append {"color": "Blue"} `mappend` {"fontSize": 12} == {"color": "Blue", "fontSize": 12} -- Identity {"color": "Blue"} `mappend` {} == {"color": "Blue"} {} `mappend` {"fontSize": 12} == {"fontSize": 12} -- Associativity {} `mappend` {"a": "b"} `mappend` {"c": "d"} == ({} `mappend` {"a": "b"}) `mappend` {"c": "d"} == {} `mappend` ({"a": "b"} `mappend` {"c": "d"})
There's no need to break out the really formal definitions if you're just trying to get some nice working code.

Borrowing from mathematics is beneficial because we can work with structures that have simple but useful guarantees. In Haskell, you can expect all the above to be true for correct type instances of Monoid, without the implementation details at hand. It's a core tenet of functional programming to disarm complexity with simplicity.

dkural 10 hours ago 7 replies      
It's always amusing to watch programmers learn a tiny piece of mathematics and turn into a totem. All those data structures would work just as fine without a monoid formalization, and one can use all their power with no attention given to algebraic axioms that define a monoid.
kens 10 hours ago 5 replies      
I'm not sure why it's interesting to label all these things as monoids. It seems kind of the tail wagging the dog.

More concretely, "monoid" seems both too general and too specific to be useful. Things that commute and things that don't commute are lumped together as monoids, and that seems to be a much more useful distinction.

Consider the monoids described in the article. For concatenation and file paths, order is important. On the other hand, multiplication, addition, maps, sets, and the shape examples all commute, so the ordering a monoid gives you is irrelevant. How does it help to consider both concatenation and addition as monoids?

(I'm honestly trying to see the relevance of monoids.)

dkarl 10 hours ago 1 reply      
This post does a great job of linking the elements of the mathematical definition of a monoid with their usefulness in code, helping explain why monoids are so outstandingly useful in programming. If you've ever wondered why it's monoids that come up over and over again in programming instead of another mathematical abstraction, this article will help.
vertex-four 10 hours ago 6 replies      
OK... So exactly why is it useful to me, as someone writing programs in the real world rather than theorising about how computation works, that a list type under concatenation and a money type under summation are monoids? Can I actually write useful code with this knowledge?
ShaneWilton 11 hours ago 1 reply      
This is a great introduction to monoids. The shape example actually appeared in a study performed in the early 90s [0]. I'm not convinced that you can draw too many valuable conclusions from the study, but it's a fun, quick paper to read.

[0] "haskell vs. ada vs. c++ vs awk vs ... an experiment in software prototyping productivity" - http://www.cs.yale.edu/publications/techreports/tr1049.pdf

mazelife 11 hours ago 0 replies      
There's a good blog post as a kind of follow-up to this one that talks about how thinking in terms of monoids helps enable flat architectures and composability in Haskell:http://www.haskellforall.com/2014/04/scalable-program-archit...
kstrauser 10 hours ago 0 replies      
This is awesome. That's the first explanation of the subject that actually made sense to me, and made me understand why I should care. Thanks for sharing!
goostavos 5 hours ago 0 replies      
Could anyone provide a "real world," or generic business coding (database, input validation, etc, etc..) example that demos rates their usefulness outside of a pure "mathy" domain.

I find that most of these fp examples tend to focus on simple things like shapes which tend to already have monoid properties built in. I'd be interested in seeing examples of how they help your kind of run of the mill business coding.

Vunovati 6 hours ago 0 replies      
Coming from an OOP background what made me connect some dots about what the monoids are and what are they good for after reading the article is that they can also be viewed as the GOF composite pattern.

I've just stumbled upon an article that describes this:


davexunit 10 hours ago 1 reply      
For those that like SICP, the picture language in section 2.2.4 describes a monoid, though they don't call it that because the term hadn't yet been adopted. Even so, I found it very helpful in understanding what all the monoid literature was going on about because I'm much more familiar with Lisp than I am statically typed ML-family languages.


ksenzee 8 hours ago 3 replies      
> f is associative: for all a, b and c, we have f(f(a, b), c) == f(a, f(b, c))

> Relative paths in a file system form a Monoid under appending

How can appending be associative?

graphememes 6 hours ago 0 replies      
monoids taught me that you can use overly complex statements to solve trivial ideas
yexponential 10 hours ago 1 reply      
> Given a value, we do not have to care how it was built, and whether it is a composite or not. We might not be even to tell (*).

missed a word: Able to tell.

baybal2 11 hours ago 5 replies      
I still didn't get it. I need a simpler explanation and examples
imtringued 5 hours ago 1 reply      
When I tried haskell I wanted to use wreq library to do some simple post and get requests.

I took a look at docs and found the function definition for a post request.


 post :: Postable a => String -> a -> IO (Response ByteString)
We can see that the second parameter should be an instance of the Postable typeclass.

The examples mention using a JSON value as a parameter

 >>> r <- post "http://httpbin.org/post" (toJSON [1,2,3])
By looking at the definition of toJSON definition we know that toJSON returns a value


Just seeing a single example isn't enough for me to generalise though.

I proceed to go to the definition of the Postable typeclass.


Unfortunately it doesn't list the instances of the typeclass so I decide to use hoogle.


No results found.

I then start looking at the source code of the library until I found this file which contains the Postable instance for json values.


 import Data.Aeson (Value, encode) instance Postable Value where postPayload = putPayload
Why is it so difficult to do a simple task like finding all instances of a typeclass? In a Java IDE finding the implementations of an interface is just a single button away and fully automated. Of course I'm assuming that you've already imported the library that contains the typeclass instance. In this case the instances are part of the wreq library themselves and not of aeson or some plugin that you use to connect wreq and aeson. If hoogle worked as I think it should it could even be superior to a local search that only considers libraries that are part of your project. I'm a big fan of self documentation and like the type-aware documentation but this is a case where although it took a short time I've wasted more time than I'm comfortable with for a simple program that could be written in python or whatever instead.

I don't care about category theory at all and you can have all the practical benefits of category theory without putting it on a pedestial. It's neat to write more generic functions and stuff but there is no need to glorify it.

From a practical standpoint monoid, monad and functor you can think of them as an interface. When your code accepts a specific implementation like ArrayList you can in some cases instead use the java interface List to make your code more generic. When your code accepts a specific implementation like Maybe or List then sometimes you can use the Monad typeclass to make your code more generic.

abritinthebay 10 hours ago 1 reply      
Monoids (& monads) are one of those tools that I think help shape your thinking (like FP) and, even if you dont use them daily or regularly... still help make you a better programmer to understand.

The concepts are actually very simple but their effects are complex. This is great introduction though I think a little high level for beginners.

Show HN: GameOfCoins.de Virtual Cryptocurrency Trading gameofcoins.de
45 points by eralpb  7 hours ago   30 comments top 10
noddy1 5 hours ago 0 replies      
Next step is to rank the participants, start making actual trades based on the top 50%, then ICO a coin promising a share of those profits for $30 million in ETH
eralpb 7 hours ago 1 reply      
Hello, I created this for fun, although more professional tools are available for virtual trading this one is just focused on cryptocurrencies and for the fun aspect.The cryptocompare's API is used.I am willing to develop this a bit further, currently it's just a day old project.
Geee 3 hours ago 0 replies      
You can make much more profit trading here than is actually possible, because buying virtually won't affect the market.
brut 6 hours ago 1 reply      
I'm jealous. I've been working on almost the exact same thing for a week now.

Really jealous.

And a bit angry! Haha.

Retr0spectrum 3 hours ago 0 replies      
Someone seems to have hacked it already: https://gameofcoins.de/portfolio/bury

Race condition?

hayksaakian 4 hours ago 0 replies      
would be nice to track my trade history so i can see when i'm up or down on an particular coin
luismmolina 4 hours ago 0 replies      
Where is IOTA? I want to "buy" it. Keep working on it, its really nice!
ringaroundthetx 6 hours ago 1 reply      
Can't go short? nobody can make returns on a down day except possibly selling back to USD?
drakmail 6 hours ago 2 replies      
Sqlite in production? Seriously? And Python 2.7... Move to 3.x and PostgreSQL at least ;-)

PS. Nice idea

bastijn 6 hours ago 1 reply      
Not sure if this is a nice idea, a nice execution, or nothing at all. There was a HN post not too long ago on "please tell us what you do first thing". Guess you should (re)read that. Any action requires my twitter or a new account. And you call people without Twitter old school?

Jokes on you!


1. create a proper landing page

2. Allow us to check on what this is without sharing our data with you; because we won't without knowing what this is in this era.

3. Twitter new school? Ha!)

Painless NGINX Ingress danielfm.me
150 points by danielmartins  13 hours ago   37 comments top 12
trjordan 10 hours ago 0 replies      
I think this blog post is one turn of the crank away from a truth we're all about to learn: don't hand roll your own Kubernetes ingress.

Dealing with the traffic handling between your users and your code is not a trivial problem. Like all good ops problems, you can fix it with good tools, deep knowledge of those tools, fine-grained observability, and smart people running all that.

This has been the recipe for a couple of really successful SaaS offerings. Individual servers? Datadog. CDN? Akamai / Fastly.

Disclaimer: I work at one of those companies, Turbine Labs, and we're trying to make ingress better. Here's a presentation from our CEO on Kubernetes ingress, and why the specification creates the problems that this blog post is trying to fix. https://www.slideshare.net/mobile/MarkMcBride11/beyond-ingre...

odammit 11 hours ago 2 replies      
This is a great read. I know the single cluster for all env is something that is sort of popular but it's always made me uncomfortable for the reasons stated in the article but also for handling kube upgrades. I'd like to give upgrades a swing on a staging server ahead of time rather than go straight to prod or building out a cluster to test an upgrade on.

I tend to keep my staging and prod clusters identical, even names of services (no prod-web and stage-web, just web).

I'll set them up in different AWS accounts to clearly separate them and the only difference they have is the DNS name of the cluster and who can access them.

Edit: I suck at italicizing and grammar.

hltbra 13 hours ago 1 reply      
Cool read. I don't use Kubernetes but I learned a few things from this blog post that are applicable to my ECS environment.

The NGINX config part is tricky and it didn't come to mind that many programs will try to be smart about machine resources and it won't work in the container world as expected. This was a good reminder. OP didn't mention what Linux distro he's using and what are all of the OS-level configs he changed in the end of the day; I'd like to see that (was there any config not mentioned in the post?).

It's awesome that OP had lots of monitoring to guide him through the problem discovery and experimentation. I need more of this in my ECS setup. I didn't hop on the Prometheus train yet, by the way.

hardwaresofton 10 hours ago 0 replies      
Shameless plug! The insights in this article are pretty deep but if you're looking for just a clumsy step 1 to setting up the NGINX ingress controller on Kubernetes, check out what I wrote:


The most important thing that I found out while working on the NGINX controller was that you can just jump into it and do some debugging by poking around at the NGINX configuration that's inside it. There's no insight in there as deep as what's in this article, but for those that are maybe new to Kubernetes, hope it's helpful!

manigandham 6 hours ago 0 replies      
NGINX also has their own ingress controller (in addition to the kubernetes community version): https://github.com/nginxinc/kubernetes-ingress
Thaxll 7 hours ago 2 replies      
"Most Linux distributions do not provide an optimal configuration for running high load web servers out-of-the-box; double-check the values for each kernel param via sysctl -a."

This is not true, if you run Debian / CentOS7 / Ubuntu, out of the box the settings are good. The thing you don't want to do is start to modify the network stack by reading random blogs.

zaroth 7 hours ago 1 reply      
Am I correct in assuming that there is the Kube Service IP routing happening via iptables DNAT to get the request into the Kube running the Ingress Controller, and then the Ingress Controller is on top of that routing traffic to another Service IP which also has to go through the iptables DNAT?
ultimoo 9 hours ago 2 replies      
Great read!

>> "Let me start by saying that if you are not alerting on accept queue overflows, well, you should."

Does anyone know how to effectively keep a tab on this on a docker container running nginx open source? I have an external log/metrics monitoring server that could alert on this, but I'm asking more on the lines of how to get this information to the monitoring server.

rjcaricio 12 hours ago 1 reply      
Thanks for sharing your experience. I've got great insights to double check in my current environment.

Could you share which version of NGINX you found the issue with the reloads? Which version the fix was released?

PS.: I find it interesting/brave that you use a single cluster for several environments.

tostaki 10 hours ago 0 replies      
Great read! Especially the part on ingress class which I didn't know about. Would you mind sharing some of your grafana dashboards?
fulafel 10 hours ago 3 replies      
Why does everyone use reverse proxies? It seems complex and inefficient. Why not serve xhr's and other dynamic content from the app server(s) and static content from a static webserver?
sandGorgon 10 hours ago 0 replies      
ingress+overlay network confusion was the reason why we moved from k8s to Docker Swarmkit.

I still keep hoping for kubernetes kompose (https://github.com/kubernetes/kompose) to bring the simplicity of Docker Swarmkit to k8s.

Or will Docker Infrakit bring creeping sophistication first and eat kuberentes lunch ? (https://github.com/docker/infrakit/pull/601)

       cached 14 September 2017 04:02:01 GMT