Ask HN: Is Bash for Windows good enough to replace a Linux/Mac terminal? - <AUTHOR> I know the Interop feature is coming to Bash for Windows (https://blogs.msdn.microsoft.com/commandline/2016/10/19/interop-between-windows-and-bash/) which to me seems to solve the complaints I had with the initial implementation.
Can anyone comment on their experiences using Bash for Windows for development full-time?
Thanks! <comment><USER2> I've been watching the whole Bash on Windows thing since it launched and it blows my mind in almost every possible way, the project has all the potential to make Windows a viable programming environment, specially for PHP and Ruby folks, which need to run Apache and all that stuff.

It won't replace a full Linux install, but it might be enough for most use cases (it doesn't run X yet, for example). So virtual machines aren't exactly going to be replaced by Bash on Windows.

But for people who buy Macs just because it is a Unix machine that runs Photoshop, and use Homebrew and Macports, which let's be clear apt-get wins hands-down, Bash on Windows is a strong alternative for these types of users.

I own a Macbook Air 2011, Apple prices skyrocketed in Brazil and for me to pay that price on a machine that has soldered RAM, almost no ports, having to buy expensive adapters, to use a shitty package manager with an OS that makes me dual-boot with Windows/Linux for some things, I am definitely considering a Lenovo or Dell machine with Windows for my next development environment.

Of course, not all things are perfect, while the project seems to be moving at an awesome pace and the future is bright, it is still in Beta, and lots of things are broken for now, if it becomes as stable as it should be, it will be big. I am eagerly waiting for the stable version of it.

<comment><USER3> It is possible to run X programs with Bash on Windows. You need to run a Windows port of an X server, like Xming[1]. Even programs like Firefox work, though it's a bit laggy. It's good enough to run gvim, though.

[1]: [https://sourceforge.net/projects/xming/](https://sourceforge.net/projects/xming/)

</comment></comment><comment><USER4> In short: yes. I recently went through this with a new work laptop.

I checked a couple boxes, restarted, and installed ConEmu.

I added symlinks in my bash home directory for "c", "docs", and "downloads", and pinned my Linux installation as a favorite in Windows Explorer, which makes file management between the two systems incredibly easy.

I installed git, and zsh, and a lot of the other basics. Zero issues. It's a normal Ubuntu installation.

I've been thrilled with it, so much so that I just plunked down some money for my first Windows laptop in years, and I'm selling my old Macbook Pro.

It's the real deal. Microsoft is on fire lately.

<comment><USER5> And recent insider update lets you install ubuntu 16.04 and run Windows commands from bash. Neat.

</comment></comment><comment><USER6> I have not tried Bash for Windows, but I've been a Cygwin user for almost a decade.

The main problem I have with using any kind of shell on Windows is that process spawning takes much, much longer than on *nix systems. I regularly find myself optimizing my scripts not for readability or elegance, but for total number of calls to executables.

To illustrate, opening a new Cygwin Bash shell on this machine takes 3 seconds, almost all of which is spent executing .bashrc. On Linux, with the same .bashrc (modulo a few platform-specific settings) that's under 0.2 seconds.

So, far from perfect, but is it 'good enough'? I'd say yes. Bash is just so much nicer than CMD, and while I hear good things about PowerShell, I can't be bothered to learn a different shell for every platform I use.

Whether there are additional tradeoffs with Bash for Windows, I cannot judge.

<comment><USER7> One cannot infer the behaviour of the Windows Subsystem for Linux from the behaviour of Cygwin. The two are quite different things.

You're also being misled by the misleading "Bash on Windows" marketing name. It's not bash, even primarily. It's a "personality" subsystem for running Linux binaries on top of the Windows NT kernel. And that's what jiantastic is asking about: whether _the subsystem_ , with what Linux programs it can run and what limitations it has, is "good enough" as a development environment, which includes considering everything from running compilers to hosting test rigs. Xe is not asking whether the Bourne Again shell is better than some other command interpreter.

</comment></comment><comment><USER8> There's also Babun[1] which is a pre-configured Cygwin with a lot of addons as they say themselves. It also uses oh-my-zhs.

When I have to use a Windows OS for some reason I install this, it at least makes me feel a little bit at home.

[1][http://babun.github.io/](http://babun.github.io/)

</comment><comment><USER9> My experience and usecase is limited - I just use my Windows machine for game development - but I've dealt with more headaches trying to get Bash for Windows + git to play nice with Unity that I've just gone back to using Git for Windows and its bash exe.

Probably the weirdest problem I've ran into are shader files in my git repo being locked to requiring administrative rights for either Unity or Bash for Windows to be able to open them.

<comment><USER10> @eswat : So long as your shader files are stored in a non-protected folder (e.g. C:\Windows, C:\Program Files, etc.), you shouldn't need Admin rights to load them.

</comment></comment><comment><USER11> It's not 100% there yet but it's pretty damn close for me. If you are set on running a stable build of Windows then there are still some bugs out there that range from annoying to possible deal breakers. The two that come to mind is the stable version doesn't support 256 colors (annoyance) but then there are issues like this that stop me from being able to totally use go: [https://github.com/Microsoft/BashOnWindows/issues/638](https://github.com/Microsoft/BashOnWindows/issues/638)

Most of these are fixed in the insider builds of Windows but that means you have to run full insider builds, you can't pick and choose components, so sometimes that is a non-starter for people.

Some of the annoying (color, cut & paste, etc) things can be fixed by using something like ConEmu (what I use).

I've actually stopped using my macbook and am now just using my company provided Windows machine for day-to-day stuff and it's been pretty smooth for the most part.

full disclosure: I work at Microsoft

</comment><comment><USER12> If you're switching platforms you should test the software you plan to run, there are still some small gaps that may kill your workflow (eg zeromq doesn't run out of the box, which means jupyter doesn't either).

It's been pretty good to me, but I'm normally a Windows user, so roadblocks in WSL just send me back to my old workflows rather than causing me headaches.

</comment><comment><USER13> I have tried using it for the past couple of weeks, and had to fiddle a lot for the first week or so to get it working nicely. The package state is stuck at 14.04 but you can upgrade[0] to 16.04 with dirty[1] trick. After the initial setup, Windows Bash worked just fine for my Rust / Go / Python needs.

What would you mainly use the bash environment for ?

[0]([http://www.omgubuntu.co.uk/2016/08/upgrade-bash- windows-10-u...](http://www.omgubuntu.co.uk/2016/08/upgrade-bash- windows-10-ubuntu-16-04-lts)) [1]([https://github.com/Microsoft/BashOnWindows/issues/482#issuec...](https://github.com/Microsoft/BashOnWindows/issues/482#issuecomment-235449454))

<comment><USER12> You can install 16.04 now, but you have to blow away your Linux install to do so [https://blogs.msdn.microsoft.com/commandline/2016/10/19/wsl-...](https://blogs.msdn.microsoft.com/commandline/2016/10/19/wsl- adds-ubuntu-16-04-xenial-support/)

<comment><USER5> I didn't have to. Upgraded nicely using do release upgrade

</comment></comment></comment><comment><USER14> What exactly are people using the linux shell for? It's fun, but given that you can't easily access windows files and you can't use it to run things like the visual C++ compiler you can't easily use it to script windows programs.

What do people actually use it for?

<comment><USER10> Bash <\--> Windows interop arrived in build #14951: [https://blogs.msdn.microsoft.com/commandline/2016/10/19/inte...](https://blogs.msdn.microsoft.com/commandline/2016/10/19/interop- between-windows-and-bash/) allowing you to call Windows apps from within bash, and capture and process the output of Bash scripts and/or Linux tools from Windows.

What else can you use Bash for? Using apt-get to install your favorite dev tools, libraries, platforms and languages inc. node.js, Ruby, Python, gcc, go, Rust, htop, Apache, MySQL, Jekyll, etc., and then building and running your code with little/no change vs. running on Linux natively.

</comment></comment><comment><USER15> Personally, I dislike it. I have been a Cygwin user for a few years and I desperately want to like LSFW, but I just can't. I find the customization options of Cygwin to be much more and I can get things like Tmux working on it without any issues.

I also have a ton of docker compatibility issues when trying to work with containers, ultimately I just wrote a power shell script to get my docker- compose environment up and running and go from there.

As far as I know, you also can't run nginx on port 80 which makes it challenging for web development (i'm sure I can run things on different ports, but who wants to do that).

I think it's promoting, but not quite ready to replace my MacBook & Linux partitions yet.

</comment><comment><USER16> I've been using it for some web development tasks. Mainly for git, ssh, perusing my file system, and PHP/Python programming. It's worked well so far.

For a terminal emulator, I set up Conemu ([https://conemu.github.io/](https://conemu.github.io/)) which is pretty swell.

I hit a road block when I need to use vagrant for my development environment. I need to hop into powershell to fire up vagrant as virtualization doesn't seem to work in WSL. Otherwise it seems to work for most of my use cases.

<comment><USER17> In the latest build you can run Windows executables directly from bash so you can run vagrant from the windows installation without switching shell.

</comment></comment><comment><USER18> I've been using Bash for Windows at work for a couple of months, and it's mostly been good enough that I don't need to fire up my ubuntu vm anymore.

The biggest problem I've run into lately is that I _really_ want to be able to run GUI-based programs, and even though that does worth with VcXWin, it's kind of crappy, especially for font rendering.

Anyone know of a free (or cheap) x window server for windows that does anti- aliasing?

<comment><USER19> I wonder if MS finds a way to port open source Linux apps in Windows 10.

<comment><USER20> Isn't WSL the shotgun approach to answer your question? There's no need to port thousands of useful tools; create the WSL and poof! most of it runs out of the box, natively, in Windows.

</comment></comment></comment><comment><USER21> Last I tried, absolutely not. There is a bug with TCP/IP that apparently prevents nodejs from doing anything networking related. So for example, express will not run because it can't find to the port to listen for HTTP.

Its been documented and seemingly ignored by the bash team every time I've checked so I may stuck sticking with a laptop that doesn't have an escape key.. :(

Proceed with caution, for now.

<comment><USER22> It's actually not being ignored, the fix is in active development: [https://github.com/Microsoft/BashOnWindows/issues/468#issuec...](https://github.com/Microsoft/BashOnWindows/issues/468#issuecomment-251298565)

</comment></comment><comment><USER19> I do scientific programming using FORTRAN 90 and Python. I am Windows Insider with fast build releases set up in my Dell XPS. For my needs it has served well. But I request MS developers to give more control over how to utilize system resources more efficiently. It needs to be more transparent and documented for users of procexp.

<comment><USER17> A change in a recent build lets you see which particular OS process is using the CPU instead of previously all being combined into one.

I know this is not exactly what you are looking for but it's a step in the right direction.

</comment></comment><comment><USER23> Bash for Windows is open source, right?

Is there anyway for me to get just bash binary to run? or build it from source and run it instead sign up for the insider program.

I tried to signed up as insider a few times on couple win 10 systems, failed and completely gave up on that.

<comment><USER24> You don't need to be an insider to run it. It is available in the current version of Windows 10 (Build 1607 - AKA Anniversary Update). Then go to `Settings -> Update and Security -> For Developers -> Developer Mode`. Next, search for `Optional Features` Start Menu (Just start typing that in the Start Menu, it will show up) and check the box next to `Bash for Windows`.

</comment></comment><comment><USER25> I used it at work last summer, and it was fine-- did everything you'd expect it to, etc. I found that I missed my Mac for a few reasons, but those seem to be mostly idiosyncratic.

</comment><comment><USER26> But.. Why.. Why would you want to do that. And I am not asking to be clever. I just can't imagine why anyone wouldn't just run Linux?

<comment><USER7> Then that's a major failure of imagination. (-:

It's actually quite easy to imagine scenarios such as _it is not your computer_ and the person whose computer it is (such as an employer) requires for whatever reasons that it run Windows.

That said, it should be noted that in many discussions of the Windows Subsystem for Linux people have observed that this is not being aimed at people who run Linux. This is being aimed at people who would otherwise be migrating from Windows to (say) a Mac. (And also at those who have already migrated, and might be reconsidering migrating back.)

For those people, jiantastic's question is important. They want to know whether their needs can be met by staying on Windows and using the Windows Subsystem for Linux, whether it is "good enough" as a development environment to do all of the things that they may need to do as a developer (from installing and running development tools to hosting test rigs), or whether it doesn't meet those needs and they should instead consider the more drastic course of replacing Windows with something else.

</comment></comment><comment><USER27> I can do almost everything I want in bash except run anything that needs a list of network interfaces. I would like to run gulp with browsersync.

</comment><comment><USER28> Why not a Virtual Machine on your PC?

<comment><AUTHOR> For my use case I would prefer to have 100% of system resources on one OS. Also, I'm coming from a Mac and would prefer the "integrated" feel if that makes sense

<comment><USER29> The VM's are amazing.

You don't have to dual boot.

You can have on one screen Ubuntu, on the other, windows. So you can use all your photoshoppy design programs on windows and the best coding on linux.

Best of both worlds.

You can also intall cygwin in windows which gives you a terminal on windows. Although there may be be a better program now than cygwin

Also, not sure if this is any good: [http://www.pcworld.com/article/3106463/windows/how-to-get- ba...](http://www.pcworld.com/article/3106463/windows/how-to-get-bash-on- windows-10-with-the-anniversary-update.html)

<comment><USER30> > You can also intall cygwin in windows which gives you a terminal on windows. > Although there may be be a better program now than cygwin

Yes, like WSL, which OP is asking.

<comment><USER29> Nothing wrong with broadening an answer, no need to be black and white. Cygwin has been around for ages.

<comment><USER10> There's a big difference between Cygwin and Bash on Windows though: Cygwin is a Win32 port of the GNU tools, whereas Bash on Windows is a Linux kernel emulation layer that allows you to run unmodified Linux binaries directly on Windows.

</comment></comment></comment></comment></comment></comment><comment><USER31> Multi-tabbed-putty

[http://ttyplus.com/multi-tabbed-putty/](http://ttyplus.com/multi-tabbed- putty/)</comment>


Ask HN: Transitioning From PHP to Django - <AUTHOR>

If I've written a web application in PHP as a learning project, but at some point I may want to re-write using the Django framework, what would be the difficulties?
I feel like my primary concern would be getting the new Django app to play nice with the existing mysql database.
Has anyone had any experience doing this?  Thanks. <comment><USER2> I've worked with SQL for a long time, with a variety of implementations and front-ends. Django's object model hurt my head. I didn't get it. There's simply too much black magic.

e.g, how is:

      Entry.objects.filter(
        headline__startswith='What').exclude(
            pub_date__gte=datetime.now()).filter(
                pub_date__gte=datetime(2005, 1, 1))

(from <http://www.djangoproject.com/documentation/db-api/>)

easier than:

      SELECT * from Entry where headline like "What%" and pub_date...  wha?  see?  wtf is that chaining filter actually doing?

my 2 cents: write your own DB access layer, fight the obscure black magic.

(nothing but quibbles with the templating engine, though)

<comment><USER3> the filter gives you a tangible "query" to work with so that you can continually add criteria as you build your query.

for example, i can say:

      grants = Grants.objects.filter(is_approved=True)

to get all of the Grants to an Organization, and then

      if not request.user.is_superuser:
          grants = grant.filter(sponsoring_trustee=request.user)

to filter out grants that only pertain to a certain user.

"grants" isnt evaluated (queried) until its iterated over or otherwise called (print, for example), so i can keep building what i want as i go without having several sql calls or managing building a query via string concatenation. personally, i've always found django's orm to feel natural.

</comment></comment><comment><USER4> The first thing I'd try is to reverse engineer the model from the database (this is something that django can do).

As long as your database design is somewhat decent you'll likely be ok. if not... well you might want to build a new model and migrate your data :)

</comment><comment><USER5> How popular is the app? Does it work nicely now? Depending on your answers to those, do you really need to rewrite?

<comment><AUTHOR> Right. That is a different question all together. I'm really more curious about Djangos ability to tap into an existing database. I've heard that RoR has a very difficult time doing this.

But to answer your question, there probably wouldn't be any need to rewrite my application. PHP is very adaptable and scalable and will probably continue to suit my needs.

<comment><USER6> Stick with PHP, Noel. :-)

<comment><AUTHOR> But how do I resist the hype around all these frameworks?! haha jk.</comment></comment></comment></comment>


Would you notice if your calculator was lying? Research says probably not - <AUTHOR> https://cosmosmagazine.com/technology/would-you-notice-if-your-calculator-was-lying-to-you <comment><USER2> I've personally witnessed scammers using people's trust in calculators being correct to cheat them.

It was at the Zambia-Zimbabwe border at Victoria Falls in 1999. We needed to change USD into Zimbabwe dollars and were approached by an informal money changer who ostentatiously did the calculation on his calculator in full view. We knew roughly what the exchange rate should be and confirmed that the money changer was using close to that on the calculator. However, the final result of the multiplication on the calculator was fraudulently low. I thought the result was "off" but given the relatively high exchange rate (this was pre- hyperinflation), by the time I'd done the math in my head he'd taken our USD and disappeared. Not a huge deal as we were only out by maybe tens of USD, and we had to grudgingly admit that it was a very effective scam.

<comment><USER3> > I've personally witnessed scammers using people's trust in calculators being > correct to cheat them.

Whenever people shove a calculator into my face, I expect a scam. One of the oldest, used a lot in restaurants: 50+0 (showing customer the zero) + one coffee + ...

<comment><USER4> Without calculator how would one calculate things in places like Zimbabwe or any Mom-Pop place where there are no computers.

Apart from building 'trust', calculator plays important job of communication - people in places like Zambia probably do not know how to write in numbers in English (or are not very fluent) and also probably do not know how to say the numbers in English.

Being traders however they would _recognize_ numbers readily, so they communicate via calculator by punching out the numbers. That is, calculator is used even when there is no calculation involved.

[Edit - Corrected the Roman numerals to English numbers]

<comment><USER5> > Without calculator how would one calculate things in places like Zimbabwe or > any Mom-Pop place where there are no computers.

People can calculate things in their heads, have you never bought something where there wasn't a calculator?

<comment><USER6> Also I feel like most people now own smartphones?

<comment><USER7> nah, there's no computers or anything in africa :'D

</comment></comment></comment></comment></comment></comment><comment><USER8> On a related note, I was listening to a talk on information security the other day when the speaker gave "balancing your checkbook" as an example of a control/check on a process. And the funny thing was he didn't ask the audience " _do_ you balance your checkbook?", he asked "how _often_ do you balance your checkbook?"

Anyway, this is why Fermi estimation is worthwhile; I never understood why people hate it or think it's pointless. Anything you don't check on for not being absurd will eventually get absurd enough for you to notice.

Also, when it comes to phishing, the paragraph on why we can't train people to recognize phishing ignores (as usual) the elephant in the room - corporate and government environments are plagued with _legitimate_ emails that are full of red flags, thus training people to ignore things like misspellings, weird source addresses, and so on.

You'll never make any progress on a problem when you're studiously ignoring the important factors...and assuming people balance their checkbooks.

<comment><USER9> To add to this, even if you don't own a checkbook, keeping a tracking budget with something like YNAB, Mint Wallet, or Personal Capital makes a huge difference. I've caught so many weird charges on my credit card that way. It also let me know when my bank decided to start charging a "Checking Fee" on their "Free" checking account >_<

<comment><USER8> I have a bad habit of reading the agreements, and I can't stomach the ones for services like that. Lots of stuff about power of attorney...

<comment><USER9> Yeah that's part of why I don't use the account imports and do everything manually. Plus it's pretty limited. For example, from YNAB:

"FOR PURPOSES OF THIS AGREEMENT AND SOLELY TO OBTAIN AND PROVIDE THE ACCOUNT INFORMATION TO YOU AS PART OF THE SERVICES, YOU GRANT THE COMPANY A LIMITED POWER OF ATTORNEY,"

</comment></comment></comment></comment><comment><USER10> Reminds me of when I was TA for calculus at university. Lots of people got one answer wrong, having done the calculations correctly. Found out roughly half of the calculators gave the answer in a different than expected quadrant.

Found the picture: [https://imgur.com/a/Ve8DVXu](https://imgur.com/a/Ve8DVXu)

<comment><USER11> Unless I'm missing something the right half of that picture is simply wrong, not just another quadrant.

tan(-1/3 pi) = -sqrt(3), so arctan(sqrt(3)/-1) = arctan(-sqrt(3)) = -1/3 pi != 1/3 pi

Why do they use sqrt(3)/-1 instead of simply -sqrt(3)? I have the impression something else is going on. Are we seeing the last line of a multi-line expression? Why do we see the bottom curls of the parentheses but not the top curls?

<comment><USER12> Despite convention, it is reasonable to consider sqrt(3) to have ambiguous sign since inverse(square) is a multi-valued function (as is arctan). So you can have arctan(-sqrt(3)) = arctan(sqrt(3)) = pi/3 (allowing for arbitrary selection from multi-valued functions)

This is a problem in general with the design of calculators and single-result algorithms in general.

The -1 might be needed to trigger the bug.

The Citizen calculator has a reputation for bad math:

[https://forum.kerbalspaceprogram.com/index.php?/topic/119681...](https://forum.kerbalspaceprogram.com/index.php?/topic/119681-stupid- calculators/)

</comment></comment></comment><comment><AUTHOR> The original study that's mentioned here: [https://journals.plos.org/plosone/article?id=10.1371/journal...](https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0223736)

Abstract:

> Calculators are often unnecessary to solve routine problems, though they are > convenient for offloading cognitively effortful processes. However, errors > can arise if incorrect procedures are used or when users fail to monitor the > output for keystroke mistakes. To investigate the conditions under which > people's attention are captured by errant calculator outputs (i.e., from > incorrectly chosen procedures or keystroke errors), we programmed an > onscreen calculator to "lie" by changing the answers displayed on certain > problems. We measured suspicion by tracking whether users explicitly > reported suspicion, overrode calculator "lies", or re-checked their > calculations after a "lie" was presented. In Study 1, we manipulated the > concreteness of problem presentation and calculator delay between subjects > to test how these affect suspicion towards "lies" (15% added to answers). We > found that numeracy had no effect on whether people opted-in or out of using > the calculator but did predict whether they would become suspicious. Very > few people showed suspicion overall, however. For study 2, we increased the > "lies" to 120% on certain answers and included questions with "conceptual > lies" shown (e.g., a negative sign that should have been positive). We again > found that numeracy had no effect on calculator usage, but, along with > concrete formatting, did predict suspicion behavior. This was found > regardless of "lie" type. For study 3, we reproduced these effects after > offering students an incentive for good performance, which did raise their > accuracy across the math problems overall but did not increase suspicion > behavior. We conclude that framing problems within a concrete domain and > being higher in numeracy increases the likelihood of spotting errant > calculator outputs, regardless of incentive.

</comment><comment><USER13> My cousin lived in rural Moldova from 2002-2004. She said at many markets, vendors had both calculators and abaci. The vendors mostly totalled bills with an abacus, because customers assumed the calculators were built to cheat them, and they could follow the summing when performed on an abacus.

I wonder how it goes now, with more penetration of technology. What would a calculation interface designed for verification look like? How could you build a calculator app that's as trusted as an abacus?

<comment><USER14> If people are unwilling to do the math themselves, then it becomes a question of what can you trust?

Something physical (an abacus, say) could potentially be manipulated by slight of hand or optical illusion.

Something digital (an iPhone app) could silently do the same.

But what if you make it really easy for the user to do the math themselves, by explicitly breaking down the calculation into a video of smaller steps where the numbers move to show the calculation.

E.g. $19 + $25 + $28 on such an app:

19

25

+28

\---

10

20

14

+28

\---

10

20

10

20

+12

\---

30

10

20

+12

\---

40

20

+12

\---

60

+12

\---

72

<comment><USER15> > _" Something physical (an abacus, say) could potentially be manipulated by > slight of hand or optical illusion."_

That's true, but people often overestimate their ability to see through such ploys. That's why the shell game ([https://en.wikipedia.org/wiki/Shell_game](https://en.wikipedia.org/wiki/Shell_game)) is thousands of years old and still going strong, across the world.

</comment></comment></comment><comment><USER16> _Would you notice if your calculator was lying?_

Well no, because thats the point of calculators, right? You trust them to get it right but if its something important you run it through twice just in-case you made a mistake.

Its like saying " _Would you notice if your coffee machine was adding a bit of alcohol to your coffee?_ " . We're obviously not expecting mundane appliances to do weird shit to us, and it would mostly be a waste of time and energy to worry about things like that.

<comment><USER17> Calculators generally don't lie [1], but people do frequently make mistakes pressing their buttons. Calculators' accuracy cannot be trusted, because people's accuracy cannot be trusted. I think this experiment is really simulating things like entering mistakes, and you _should_ pay attention and notice when the numbers seem off. I just finished marking an exam question that depended heavily on calculator work, and quite a few people need to work on their calculator mistrust...

[1] Well, they do! But only things like small rounding errors that _usually_ don't matter.

<comment><USER16> Dealing with operator error is different from having doubts about the accuracy of an appliance. For quite a lot of things done on a calculator, trying to judge whether the numbers seem 'right' is going to be difficult. A more reasonable way to reduce operator error is to key the calculation through the device a couple of times and make sure you get the same answer.

<comment><USER17> For purely keying errors, yes, but at least as big a problem are errors in translating formulas to the calculator, like leaving out parentheses, and these errors will probably just be repeated.

</comment></comment></comment></comment><comment><USER18> I had a calculator from 1985 a TI Scientific SLR solar powered. I did not know it had a bug in the square root function. It was enough to flunk Algebra and get a C in Statistics. I bought a more modern calculator later on when I went back to college and learned the older one had a square root bug. I never learned to do the math in my head, that would have been a neat trick.

<comment><USER19> Arbitrary precision sqrt in your head:

There are two ways to do it, one is via a process that looks like long division, the other is via newtons method. I find the latter more useful because I for me its easier to remember and even a single step of it gives a pretty good result.

First guess get an initial guess. If you're good with base-2, you can crop off half the number's binary digits. Otherwise, think of the number in scientific notation and take the sqrt of the mantissa and halve the exponent. Alternately, guess and check some nearby squares.

Now we apply newton's method using the derivative of sqrt() to refine your guess:

guess_n+1 (x) = 0.5 __* (guess_n + x /guess_n)

That division is a PITA mentally, so don't be a chump-- keep your intermediate results in rational form and keep multiplying up the denominator (the rapidly bloating denominator also gives you an idea of how fast the precision of this process increases-- very fast...).

Sometimes I get the sign wrong, but that or any other mistake I've encountered obvious really fast.

<comment><USER20> That algorithm should be called square rootus horribilis.

Let's say we're square rooting a 3-4 digit number (or you can multiply/divide out the exponent accordingly).

I recommend starting with the (x + .5)^2 = x(x+1) + .25 shortcut, multiplied by 100, to be able to compute all multiple-of-five squares 5, 10, 15, 20, ..., 95. Then, from some multiple of 5 that is x, with k in {-2,-1,0,1,2}, use (x+k)^2 = x^2 + 2xk + k^2 to tweak that to a particular perfect square. E.g. 42^2 = 1764 = 1600+160+4. Now, we're square rooting a number, so find the two nearest perfect squares. Depending on how close you are to halfway between them, and depending on if you're in the mood for that sort of thing, poke it up by <0.25 to account for the quadratic factor of whatever you're square rooting (because (x+.5)^2 is 0.25 less than the average of x^2 and (x+1)^2), and then linearly interpolate between the two perfect squares. (You don't really have to calculate both neighboring squares to interpolate, because the difference is about 2x, and you probably already calculated that when you did the 2xk calculation.)

So for example, what's the square root of (types randomly) 5719? Why, 56 is 7*8, so 5625 is 75^2. We're like, 95 more than that, out of 150? So, 75.6 and change. Or more exactly, 94/151? That's like a +4% -.6% adjustment of .6 [1], so maybe 75.62. Or even closer, you might use 94.2/151, sure.

[1] (a+n%)/(b+m%) can be approximated (a/b) + n% - m%, for small percentages.

</comment></comment></comment><comment><USER21> I bought a QAMA calculator to improve my estimating abilities, but then put it in a drawer and forgot about it.

[http://qamacalculator.com/index.html](http://qamacalculator.com/index.html)

</comment><comment><USER22> At the bottom of the article, it links to [1] as the original article. Could we please update the link?

[1] [https://theconversation.com/would-you-notice-if-your- calcula...](https://theconversation.com/would-you-notice-if-your-calculator- was-lying-to-you-the-research-says-probably-not-126027)

</comment><comment><USER23> I work in data engineering, and we have multiple systems built by other people talking to our pipeline. Just one of them being off by a little might send the KPIs, the machine learning models and much more into a spiral where they end up completely wrong.

This has unfortunately made me paranoid and uncertain of anything data or calculation related. I cross check all my day to day calculations and, annoyingly, my friends' calculations too. Any known remedies from people with similiar problems would be appreciated.

</comment><comment><USER24> In 1998 my first job involved manually checking very large xl sheets for government cases to confirm that the math was right.

If there are $s involved, someone will notice.

<comment><USER25> Was the maths ever wrong on the Excel spreadsheets? What was the cause when that happened?

<comment><USER26> The fdiv bug in the Pentium x87 unit was discovered because someone was manually checking their Excel spreadsheets.

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

<comment><USER25> Waow, nuts/interesting.

Thanks

</comment></comment></comment></comment><comment><USER27> I recall this being researched in the 1970s. The calculators had to be off by a factor of 2 before people became suspicious.

</comment><comment><USER28> Back in the day it was not uncommon to do important calculations twice, once on HP and once on TI, just in case of bugs.

</comment><comment><USER29> Once my friend wrote a program for an hp48sx that would add 1 to any calculation. He tried to let people borrow his calculator.

<comment><USER30> Did he teach them how to use RPN before letting them borrow it?

<comment><USER29> Most of us geeks already knew rpn. He was an uber geek. :-)</comment></comment></comment>


Women leaders are responding best to the Coronavirus pandemic - <AUTHOR> https://www.forbes.com/sites/avivahwittenbergcox/2020/04/13/what-do-countries-with-the-best-coronavirus-reponses-have-in-common-women-leaders/#3f270b9a3dec <comment><USER2> Apart from a clickbait title this article offers zero evidence (or even plausible arguments) why the presented responses were "the best".

3k deaths in Germany is already a lot and, as far as I know (correct me if I'm wrong), they classify COVID-19 deaths with pre-existing medical conditions as not covid-related. Also, Germany is a very rich country which clearly helps.

Norway and Finland are sparsely populated (with low total population) and New Zealand / Iceland are isolated islands (also with low population totals). I do find these explanations more plausible and consistent with other countries.

Taiwan is a different ballgame as they had rough time with the previous SARS epidemic. Instant lockdown was the winning play here, correctly implemented. I see zero connection with woman being the leader here.

<comment><USER3> I think there are advantages during these kind of events (caveat - no violence is involved).

Two reasons -

[1] Men respond to stress differently from women - [https://en.wikipedia.org/wiki/Tend_and_befriend](https://en.wikipedia.org/wiki/Tend_and_befriend)

For men stress response is more or less always fight or flight. And that instinct increases quick as unknowns multiply as with covid and pressure builds on leaders.

[2] Its a Hyperconnected world these days. Tend and befriend keeps as many of those connections intact while fight or flight breaks connections. While dealing with unknowns/hard problems (like covid) producing good outcomes really hinge on having access to the largest widest distribution of skills and knowledge, unlike when dealing with known issues.

Women leaders will enable different outcomes in this hyperconnected world as they take advantage of that tend and befriend instinct in a hyperconnected setting.

How much better or worse these outcomes will be we will see in the coming years...

<comment><USER4> Having experienced the decisions of our fearlful german woman leader, it's clear that she didn't act by reason, only by fear. Why did no politican look at the numbers by themselves, and rather trust "interesting" advisers? Esp. when knowingly throwing the world into a global crisis, which could be worse than in the 20ies. Which brought us WW2. The numbers clearly tell that the death threat is no death threat, that flattening the curve will cause at least two times more dead than letting it running its spike for 4 weeks. Hundreds of thousands of dead? Give me a break. A flu season has 550.000, how much have we got now for COVID-19? The normal flu still caused many more dead than COVID-19.

Every medium flu season is more deadly than this one. By far. Keeping people locked in at home and keeping the schools closed will only help to keep the virus alive which should be already dead by now, if people would go out into the sun. There is no chance for a vaccine, there is no chance to keep the spread under control with lockdowns with an R0 of over 5. There is no danger with an IFR of 0.3 - 0.6% (0.4% looking the most reliable number for now). Italy always has an IFR of 1% for every such flu outbreak. But they went bonkers when they saw the military vans on TV. Well done.

The women leaders I see were all hysterical. While the men around her (the neighboring countries) did respond in a more rational and less hysterical fashion.

4 weeks lockdown ok, why not. Does not do much harm. But the whole summer? Closing all summer events? Pure insanity. That way they will never get it under control and reach herd immunity before fall. They already found out about their massive mistake, now they are only doing damage control by controlling the message, censorship, fearing a political turmoil in the next elections.

<comment><USER3> You sound pretty hysterical dude to be honest.

<comment><USER4> Yeah, and I spared you from my opinion on Macron, luckily. Should be added to the same category.</comment></comment></comment></comment></comment>


Reddit's top user says he's 'done' after being outed - <AUTHOR> https://www.dailydot.com/debug/reddit-moderators-quit/ <comment><USER2> I left Reddit over a year ago when I was banned unnecessarily from several subreddits that I had never previously known about. Supposedly that was because of my throwaway comment about a photograph in one particular subreddit. When I complained about that, my complaint was censored.

I walked out the door immediately. And that was after I had been 10 years as a Redditor.

</comment><comment><USER3> This should be a full time job at Reddit moderating the most popular subs. I think they should just quit this thankless job. Once the most popular subreddit's are filled with hate content, the Reddit team will understand importance of these moderator jobs. Facebook is known to hire a bunch of moderators to keep its site clean and I think Reddit should too

</comment><comment><USER4> most of the "power mods" are likely semi-bots reposting from other subredddits anyway. i won't be surprised if they're internally created.</comment>


Webpack: The Missing Tutorial - <AUTHOR> https://github.com/shekhargulati/52-technologies-in-2016/blob/master/36-webpack/README.md <comment><USER2> There's no shortage of Webpack tutorials, and this one looks fine so props to the author. However, the _best_ Webpack tutorial I've seen for beginners (and experts!) is this video that explains it from a conceptual point of view[1], explaining what exactly Webpack does and not just how to use it:

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

[1] This thread's post does this too, which is awesome!

<comment><USER3> I may be in the minority, but I don't want to watch videos when learning how to use things. I want written tutorials that I can refer back to when necessary.

My big problem with tutorials in JS-land is that so many seem to assume too much background knowledge in the reader. Webpack has been no exception; as someone who generally doesn't do front-end stuff I have really had to dig around to find out how things actually work and find things like lists of valid options for different sections.

<comment><USER4> I love videos to learn... but as someone working for a company that don't allow any videos through the firewall... written posts are also useful.

</comment></comment></comment><comment><USER5> Odd that 7 years later, and JS build tools still don't match the level of optimization you get in Closure Compiler.

IMHO, the speed of the build tool is less of a priority than the speed of the code it produces. You pay the cost of the build tool mostly in integration tests or production builds but shouldn't pay it during development.

However your users pay for inefficiencies times the number of times the app is loaded. The state of JS tooling is woefully behind other languages and IMHO still behind the state of the art 5 years ago. Any non trivial sized app for example will require global dead code analysis and method and field level pruning as your dependencies grow over the lifetime of your app, all apps tend to bloat from unneeded code pulled in.

<comment><USER6> I think closure compiler is the perfect example of how saving extra 100kb is has never been worth the poor user experience. Despite the pain in setting up webpack, the result is an excellent collection of features that goes beyond just JavaScript.

<comment><USER5> By "user" you mean developer, but you're trading off compile time pain for you, and saddling everyone else with downloading an extra 100kb, which on mobile networks or in developing countries is unforgivable.

<comment><USER6> True, which is why we haven't ignore this and are hoping to add features like scope hoisting (and personally I'd love to pass the AST program that webpack's parser creates right in to closure compiler js to see how "advanced" it can compiler) and other features. Because in the end, the api possibilities that webpack provides for plugins makes the tool limitless.

<comment><USER5> Closure Compiler also has pluggability, however the plugins must be written in Java, which is a downside for the JS ecosystem. For example, asset packaging wise, there's stuff like GSS Compiler integration, where goog.getCssName('foo') is translated into an obfuscated short className, while the GSS compiler optimized, prunes, and combines GSS.

GWT was the same way, asset packaging was a core feature even in 2009. For example, it would automatically compile CSS, UI templates, and images, auto- optimizing them, and auto-sprite-sheeting everything, while packaging things into as few HTTP requests as possible.

The real issue is that to do this in a safe way for JS requires coding conventions be adhered to, or the adoption of TypeScript and annotations. Closure's advanced mode will break JS that tries to get too fancy with dynamism.

</comment></comment></comment></comment></comment><comment><USER7>
        require('style!css!../css/style.css');

What is this I don't even.

<comment><USER8> In case it was really a question: this passes `../css/styles.css` into the css loader then the style loader when `require`-ing. Normally this is setup in a webpack.config so you can just do `require('../css/styles.css')` normally

</comment></comment><comment><USER9> Be careful jumping into webpack and getting it to load everything (JSON, style sources, HTML partials (!)) with require/import. It can wreak havoc with your testing.

<comment><USER10> Couldn't agree more. Also, if you want server side code to work without bundling you'll want to be careful there too.

I have css requires restricted to the client entry file to keep other modules testable/usable server side otherwise.

</comment></comment><comment><USER11> I hate to say it (I've enjoyed the benefits of using webpack on a few projects now) but I feel like it's all a bit too late for webpack (2).

Rollup or Brunch seem to offer a preferable alternative with speed, ease of use, and optimisation.

<comment><USER12> What is Rollup vs Brunch? Coming from someone who just understood why we have Webpack vs Browserify.

<comment><USER11> They're both alternative build tools

Rollup is very similar to Webpack but is architectually different to allow it to optimise assets further and faster.

Brunch has actually been around since before Grunt, it's just not marketed. It works in very simple fashion, just install plugins via npm and start using them, no need to edit configuration files (unless you have very specific requirements).

I would consider Rollup as the new hotness, building upon the success of other tools and starting from a better position to create an optimised tool.

Brunch is a long time standing tool that does a job very well and if your project doesn't require any special configuration or architecture it's so easy to use (it can be configured though).

<comment><USER13> How fast is Brunch and Rollup compared to Webpack? Is there something similar to Webpack dev server [0] in Rollup?

[0] - [https://webpack.github.io/docs/webpack-dev- server.html](https://webpack.github.io/docs/webpack-dev-server.html)

<comment><USER6> Here is a up to date write-up for our proposal and review of performance in our repo [https://github.com/webpack/webpack/issues/2873#issuecomment-...](https://github.com/webpack/webpack/issues/2873#issuecomment-241458071)

<comment><USER13> Thank you for the link. This sounds scary though.

> Webpack will perform less-favorably compared to Rollup as the number of > modules increases.

<comment><USER6> It's not, in the end load and runtime perf boil down more to what and how much you load up front.</comment></comment></comment></comment></comment></comment></comment>


An 85-year old millionaire hides $1M treasure in the Rocky Mountains (2016) - <AUTHOR> http://www.npr.org/2016/03/13/469852983/seeking-adventure-and-gold-crack-this-poem-and-head-outdoors <comment><USER3> Worth noting people have died looking for it, which makes me believe the claim is likely real, especially given Fenn has charted private helicopters to help search for those lost and known to be searching for the treasure:

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

Fenn hasn't been out in the Rocky Mountains, north of Santa Fe, to check on the chest since he hid it, but he knows it's still there.

My guess is that the prize is not inside, but with Fenn; which explains why he checks to see if someone has found it and requests they provide proof of what is inside.

Fenn has more clues posted here: [http://www.oldsantafetradingco.com/the- thrill-resource-page](http://www.oldsantafetradingco.com/the-thrill-resource- page)

<comment><USER4> That is not a plausible theory. Sure, the treasure might be elsewhere, but I wouldn't keep the prize in my own possesion if I were over 70 years old. What if someone finds the chest after his death.

I would rather believe it contains a note requesting that Fenn should be contacted by the lucky one.

<comment><USER3> Assure you that there are ways to deal with Fenn dieing and still require the party finding it to make contact with someone to claim the prize; in fact, Fenn planned this when he thought he would die from cancer.

<comment><USER5> From Wikipedia: "He filled the chest with "treasure" containing gold nuggets, rare coins, jewelry and gemstones, along with a jar holding his autobiography. He intended to hide it and end his life nearby, with the treasure as a legacy.[2] However, he survived his illness and waited until he was 79 or 80 to hide the treasure."

These are all bearer instruments. You may not know if it's found. 79-80 is 2009-2010. If he had a cellphone, there's a trail for some enterprising telcom worker or NSA analyst to follow (base station->sector->signal strength if not outright location). Presumably he drove there, maybe some ALPR database to mine.

</comment></comment></comment></comment><comment><USER6> If he's confident that no one else knows where it is, either he killed someone, or it is in a place where an 85 year old man can carry a 40lb chest. I know some AT thru hikers that old, but I don't think their packs were that heavy, and the load was better distributed/more ergonomic.

If I had to guess, the location is within an 8 hour hike (12 miles at that age) of a road or jeep trail. Between that and the water clue, I think the field is considerably more narrow than the 5,000ft map in the article.

dang. I think i got bit by this gold bug ;)

<comment><USER7> From the clues, I have a suspicion that it is on a river that is accessible only by rafting. An 80 year old man could easily raft to a location on his own depending on difficulty of the river.

<comment><USER8> That's certainly the _obvious_ meaning of that one stanza. Put in on a river and paddle downstream a distance that would be too far to walk. (Of course, he would need to get back to his car somehow unless there was a second person with him who could drive to the take-out. And this doesn't really square with his supposedly taking two trips.)

<comment><USER9> Depends on how far he had to raft, it could be a hundred yards between where he enters the river and where he leaves it. He's been hiking those forests for years.

</comment></comment></comment></comment><comment><USER10> Before getting too carried away, I'd suggest reading this piece [1], about the search for Randy Bilyeu, the missing treasure seeker mentioned int the NPR article. It provides lot more background and context, and is enjoyable as far as long form journalism goes.

Like many, I've casually followed the story over the years, but in the 5280 article, the reporter interviews Fenn in the context of the manhunt. To me, Fenn comes off as someone whose obsession with his own eccentric idea of a "game" overrides the very real life-and-death situations created as a result of that game.

The NPR article is surprisingly blase considering the dangers involved.

[1] [http://www.5280.com/news/magazine/2016/07/how-one- colorado-m...](http://www.5280.com/news/magazine/2016/07/how-one-colorado-man- disappeared-while-hunting-hidden-treasure)

</comment><comment><USER11> There was a neat little mini-documentary by Vox [1] that went over the details of this, talked to a few other people obsessed by this treasure hunt. Pretty good overview of the history and current state of the hunt.

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

</comment><comment><USER12> This is the first time I'm hearing of this treasure - fun stuff!

Reading the poem, the first place that popped into my head is Brown's Canyon National Monument, just outside of Salida, Colorado.

[https://www.fs.fed.us/visit/browns-canyon-national- monument](https://www.fs.fed.us/visit/browns-canyon-national-monument)

It's just 3.5 to 4 hours north of Santa Fe, is an area with multiple hot springs (Mt. Princeton, Poncha Springs, etc.), and downstream (Arkansas River) you go through Bighorn Sheep Canyon and the Royal George.

It's just an amazing area on this Earth.

<comment><USER13> So maybe go to Nathrop, CO, put your raft on Arkansas River where Chalk Creek, Gas Creek, or Cottonwood Creek joins it, then go downstream past 2 Class IV rapids (Canyon Doors, Pinball) and "put in" below Browns Creek.

There is a rail line there, so if you are squeamish about whitewater, it probably wouldn't be difficult to portage around the 12 named rapids on that section of the river. You could probably park at Hecla Junction and reach the search area by land.

Below Widowmaker (IV) rapids is an intermittent creek bed ("no paddle") to the west, that runs into some trees surrounded by big boulders ("heavy loads").

I'd start at 38.668777 N, 106.055444 W and follow the dry creek bed up to at least 38.670606 N, 106.063440 W, myself, but I'm not likely to ever visit that part of the country. If you find the chest there, send me a gloating postcard.

The place appears to be surrounded by ATV trails within 200 feet, so it's likely the guy just claimed "someone has been within 200 feet" because people are within 200 feet of it frequently, just from riding the trails.

<comment><USER14> I suspect that 200 feet off any walkable/drivable path is too easy for such a treasure. It's more likely within 200 feet of a river/stream/creek - <USER2> assumption being that there are people canoeing past without getting out and traversing overgrowth with no obvious man made paths.

The only detail that really matters in terms of whether someone can ever even find it is whether it is buried. If it's buried with no markers, the odds of stumbling upon it even with a metal detector are so incredibly low.

<comment><USER13> If I were nearly 80 years old, I'd skip the shovel, and either drop it in a natural crevice or dump it underwater. Then mark a blaze on a vertical surface, so that it's only visible from ground level.

Also, 200 horizontal feet does not account for terrain. 2/3 of the way across a football field is not equivalent to 200 feet across a hedge maze.

<comment><USER14> I love your way of thinking. Assuming proper waterproofing, hiding it underwater would be the most unexpected thing you could do. I'm a smart guy and that thought hadn't occurred to me, even if I only dedicated 3 minutes of my time to the process. The majority of people would naturally assume it's on land; to place it in the water automatically ruins the consensus assumption.

<comment><USER15> Weird. This is the very first thing I thought of. That, or properly secured way up in a huge tree. How many people are looking up, right? Although, the tree thing doesn't fit with his ability as a ~80 year old to put it up there.

I believe the reason my mind first went here is because of Star Trek II: The Wrath of Kahn - in the climax of the film Spock analyzes Kahn's movements and informs Kirk, "his pattern suggests two dimensional thinking."

<comment><USER13> You also have to account for wildlife and weather. You wouldn't want a big blow or a bear to knock your chest down and scatter the contents. But you're correct that most people don't look in all directions when they walk.

Underwater was actually the first thing I thought of. Why a bronze chest, after all? Gold doesn't corrode, and bronze doesn't float.

I recall tales of WW2 military units tasked with cleverly camouflaging things. Technology has progressed. You can now take a photograph of terrain and print that exact photo onto a cloth which can then be epoxied over a fiberglass form and decorated with local surface features.

So I could make a fake fiberglass rock large enough to cover a 10" cube, perfectly camouflage it with a custom print shop order and about $80 in supplies, and anchor it to the ground. You might not realize it was a treasure cache even if you tripped and landed with your face one meter away from it. But that's not necessary if you just control sight lines.

<comment><USER16> Those are interesting ideas, but those kinds of techniques would violate the spirit of the deal. By creating such a large search area, he tacitly agrees to not hide the box itself too well.

<comment><USER13> "The deal", as I see it, is to find the treasure by solving the riddles and clues, not by stumbling across it by chance.

If the clues were sufficient to pinpoint the location with 1m precision, it would be acceptable to hide something so well that you would have to be within 1m to notice it. A buried treasure would require this magnitude of precision.

If the clues give 10m precision, I'd expect that the target should blend in a bit, but still be detectable from 3m away. A buried or submerged treasure marked with an obvious blaze could get away with this magnitude.

At 100m precision, you actually need to be sort of obvious. At 1km precision, it should be painted hunters orange and shoot fireballs into the air periodically. At 10km precision... you probably should have taken some of that treasure and hired Will Shortz or some other professional puzzlemaster as a consultant.

</comment></comment></comment></comment></comment></comment></comment></comment></comment><comment><USER17> If you're into that sort of things, you can have a look at [https://en.wikipedia.org/wiki/On_the_Trail_of_the_Golden_Owl](https://en.wikipedia.org/wiki/On_the_Trail_of_the_Golden_Owl).

<comment><USER11> Also the Book of Masquerade [1] which was a pretty fascinating little treasure hunt. There's a great lecture [2] on game design and eastereggs that gives a great overview of the events surrounding it.

[1] [https://en.wikipedia.org/wiki/Masquerade_(book)](https://en.wikipedia.org/wiki/Masquerade_\(book\))

[2] [http://ludix.com/moriarty/psalm46.html](http://ludix.com/moriarty/psalm46.html)

<comment><USER18> Psalm 46 was what I've been thinking of when reading the article, especially after this bit:

>For further clues, you have to read the poem in his self-published book, The Thrill of the Chase.

He might actually make money on this, lol.

<comment><USER19> So at the end of the day, the guy might be giving away $1 million, but it's likely he will also make more than that from the book sales, or at least something close.

No wonder he has a million to throw around!

</comment></comment></comment></comment><comment><USER20> Has he ever confirmed whether the treasure is still at the location?

What if someone found it long ago, not knowing that it was part of a scavenger hunt, and decided to hide their discovery?

<comment><USER11> I'm not sure how old this information is, but I remember him confirming it still is and also saying that someone once made it within 200 feet of it (I'm not sure how he knows that, I wonder if he has cameras setup there?).

Actually, looking at the wikipedia page [1] for it, it seems to be from August 20, 2016.

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

<comment><USER21> >someone once made it within 200 feet of it (I'm not sure how he knows that)

There's at least one forum [1] where people post reports of their search. He's probably just keeping an eye on where people say they've gone looking for it.

[1][http://www.chasechat.com/](http://www.chasechat.com/)

<comment><USER8> It also occurs to me that if you do get to the general location by paddling, as many have speculated, if someone posted or emailed him with the correct put-in spot he would know that they would have passed by the treasure.

</comment></comment></comment></comment><comment><USER22> The podcast Everything is Stories did an episode on Mr. Fenn and his hidden treasure in March 2014. For anyone interested it fills out the picture a bit of his life and his motivation for doing this.

[http://www.eisradio.org/item/003](http://www.eisradio.org/item/003)

</comment><comment><USER23> Random related story:

I was in New Mexico recently to see family and my brother said he had recently picked up a hitchhiker who had been searching for the treasure. She had started in Colorado and apparently been following clues found in the poems with geological features to travel along the Rio Grande in search of it. She believed based on her searching at the time (this was 1-2 months ago) that the treasure was likely hidden somewhere in Pilar. Apparently she had found marks on rocks in Embudo that led her to believe it was apparently on the other side of a rock formation she was near.

I wouldn't put too much faith in this person's account, but she had apparently been searching for it non-stop for several months and had been led to Pilar by these "clues".

</comment><comment><USER24> This is interesting especially since I just started reading Read Player One.

<comment><USER25> Ohh. Good book imo. I get that a lot of people think the references are annoying, but I found them to be rather charming. Of course I'm young so I probably didn't get them all

<comment><USER26> I actually had the same thoughts about ready player one when I read this article. It was such a interested book and being able to be part of something like that in real life sounds like it would take over my life.

</comment></comment></comment><comment><USER27> Sounds like the Rocky mountain version of the Lost Dutchman's Gold Mine

</comment><comment><USER28> Could it be that he never checked whether all the hints he gave sufficiently narrow down the location to just one spot? That he has additional knowledge for every line, knowledge which he thinks is self-evident, but knowledge with is actually just very personal to him, and cannot be inferred?

In this case, the riddle might never be solved, and he might die in the self delusion that all the attention this raised is because he is a gifted writer, when the reality is much more sad: he was a terrible riddle author that threw away a million bucks.

<comment><USER29> It's a quirky guy who buried treasure - actual treasure - along with a riddle. That's fucking magical and fun... it's beautiful. You'd have to be pretty sad to think that "reality is much more sad" for him.

<comment><USER11> Exactly, he most definitely didn't do it for designing a riddle, he did it for the fun of seeing how people would respond and seeing them struggle and go beyond expectations.

</comment></comment></comment><comment><USER30> Vox had a good video about this recently: [https://www.youtube.com/watch?v=j4ahNpQLgdk](https://www.youtube.com/watch?v=j4ahNpQLgdk)

</comment><comment><USER31> Bet satellite recordings know where he hid it. Some spy is chortling.

<comment><USER32> What if he hid it on a cloudy/rainy/snowy/foggy day?

<comment><USER33> There are wavelengths other than visible light that satellites use.

<comment><USER32> Yeah, and which of those go through rain? The atmosphere blocks lots of wavelengths outside of visible light. Rain fade is huge above 11 GHz. Good luck imaging a person from orbit at a low RF frequency.

[http://www.geo.mtu.edu/~scarn/teaching/GE4250/transmission_l...](http://www.geo.mtu.edu/~scarn/teaching/GE4250/transmission_lecture.pdf)

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

</comment></comment></comment></comment><comment><USER34> Outside has published a number of columns on this usually accompanied with crazy stories of treasure hunters. If nothing else, it's a great way to get some folks into the wild :)

</comment><comment><USER35> Some friends and I decided to have a go at the treasure a few years back. It was a good excuse to go out camping and road-tripping with some mates. We identified a spot we each thought it may have been and then spend some weekends one summer checking them out. One place we found outside of Estes Park, CO did have a rather large hole dug out right next to a 'swamp'/water- filled depression, there were a LOT of beer cans and champagne bottles around from at least a winter beforehand. The place fit all the bills for the treasure's location, at least to our minds. Maybe the people that found it are mum, the tax reasons would be enough to shut my mouth too.

The treasure has been around for so long, and there have been so many attempts at it, I figure there is no way that it has not been discovered yet, if the thing really exists. Maybe Fenn put some note in there that says to contact him for more cash or something, so that he'll know that it was found. I doubt this. More than likely, there is no treasure at all and it is an intentional wild-goose chase and the 'real treasure is friendship'. But that doesn't square with all the deaths people have had looking for it. If the 'real treasue is friendship' then Fenn has real blood on his hands. We all had a great time camping at least.

<comment><USER36> >The treasure has been around for so long, and there have been so many attempts at it, I figure there is no way that it has not been discovered yet, if the thing really exists.

I think you are vastly underestimating the size of the rockies. The clues are so vague that there are probably thousands of square miles that match the poem description [1].

1\. [http://www.npr.org/2016/03/13/469852983/seeking-adventure- an...](http://www.npr.org/2016/03/13/469852983/seeking-adventure-and-gold- crack-this-poem-and-head-outdoors)

<comment><USER37> > I think you are vastly underestimating the size of the rockies.

I would bet there is probably more than $1M worth of (naturally available) gold to be found in the Rockies, and it is spread around, so it's much easier to find than a single treasure.

<comment><USER32> Way more than that. The Cripple Creek & Victor Gold Mine produces over 200,000 ounces of gold per year. Not to mention countless closed mines that are probably yet to be played out.

</comment></comment></comment></comment><comment><USER38> If this interests you, I highly recommend checking out book The Secret. Super interesting. [http://thesecret.pbworks.com/w/page/22148559/FrontPage](http://thesecret.pbworks.com/w/page/22148559/FrontPage)

</comment><comment><USER39> Reminds me [https://en.m.wikipedia.org/wiki/On_the_Trail_of_the_Golden_O...](https://en.m.wikipedia.org/wiki/On_the_Trail_of_the_Golden_Owl), which is hidden in France and people have been searching for it for decades.

</comment><comment><USER40> Maybe I should start off with Pokemon Go first to get warmed up. Similar concept where Fenn wants people to bring out their inner Indiana Jones. Instead of giving away a fortune, the makers of Pokemon Go were trying to make one.

<comment><USER41> Or, the makers of Pokemon Go were installing a system to easily obtain video footage of any urban location (less easily, other areas).

If the Fenn-treasure-seeker ground penetrating radar drone teams do materialize, they will almost certainly locate archeological sites, which is pretty cool. The algorithms ought to also pick up petroglyphs while searching for blazes.

</comment></comment><comment><USER42> If this interests you, you might like the book Daemon by Daniel Suarez. (Ready Player One also deals with similar themes)

</comment><comment><USER43> Is it not possible someone's already found it? Whoever finds it would have to pay taxes if they report it.

</comment><comment><USER44> Seems like he'd be setting himself up for a kidnapping?

</comment><comment><USER45> I am not sure I would publicly claim to be the only person who knows where there is an untraceable million-dollar stash, whether it is true or not.

</comment><comment><USER46> (2016)

</comment><comment><USER47> Let me get this straight. People have died and this geriatric narcissist hasn't yet decided that maybe 4 dead people are too many and maybe, possibly, it would be a better karmic strategy for him to forgoe his little scheme and just call the thing off?

<comment> nommm-nommm [http://www.coloradoan.com/story/sports/outdoors/2016/03/04/r...](http://www.coloradoan.com/story/sports/outdoors/2016/03/04/rocky- mountain-national-park-fatalities/81268090/)

>Since 2011, 21 people have died in Rocky Mountain National Park, eight of those fatalities coming in 2014 alone. While grim, Rocky Mountain's annual death toll pales in comparison to that of Grand Canyon National Park, which averages 12 fatalities each year... About 150 people die in national parks each year, according to the latest federal data, tracked between 2007 and 2013.

Yet we don't go shutting down the National Parks or accuse the Federal government of bad karma.

</comment></comment><comment><USER44> Seems like he's setting himself up for a kidnapping?

</comment><comment><USER48> He even hid a bottle of wine behind those books on his shelf...

</comment><comment><USER49> > The most recent was Randy Bilyeu who went missing in January 2016 and was > later found dead in July of that year.

I wonder how he feels knowing at least one person died because of his actions :(</comment>


Live Note - Realtime document collaboration - <AUTHOR> http://www.livenote.org

<comment><USER2> How is this different from google docs?</comment>


Heartleech: Automated OpenSSL private key extraction tool using Heartbleed - <AUTHOR> https://github.com/robertdavidgraham/heartleech <comment><USER3> _This should be a useful tool on its own, but I wrote it primarily because the pattern-matching rules for Snort are inadequate. IDS vendors won 't fix their stuff until I can prove they are inadequate._

Ugh. In the old days the mantra of full-disclosure was "well, if we don't make exploit tools, then the vendors won't issue patches." And then it became "well, if we don't make exploit tools, then the sysadmins won't patch." Apparently the bar has sunk so low that people personally pushing out Snort rules on snort-users aren't actually catching all instances of the bug is the justification for releasing tools to steal private keys.

In reality, lots of people in the security community just like seeing chaos in the world, because it makes for even more news headlines and in their mind this increases the status of the security community. Then it's time for the _post hoc_ justifications for their behavior.

<comment><USER4> I would imagine the motivation is less about money and more about having fun breaking stuff (and bragging rights).

I agree though. Hard to argue that this particular security issue needed any extra attention in order to get it fixed.

<comment><USER3> One of the biggest root causes of problems in the security industry is that often the only way to make a name for yourself is to cause pain to others. (It's not too hard to convince yourself that those others deserved it.)

If you went back in time two years and fixed the Heartbleed bug, no one would be writing newspaper articles about you.

<comment><USER5> Nobody is writing articles at Neel Mehta, the guy who discovered the bug. They should, he's a god.

</comment></comment></comment></comment><comment><USER6> I have a few ubuntu servers. When I do a "check for heartbleed" check with various tools, it says they are not vulnerable. However, these servers were installed 6 months ago and not updated for at least 2 months. How can they not be vulnerable?

<comment><USER7> Most reports about Heartbleed kept repeating that the vulnerability was introduced 2 years ago (Dec '12, which isn't even 2 years - but anyway) it was committed to a version of OpenSSL (v1.0.1) that wasn't widely distributed until the middle of last year.

The time surface of the Heartbleed attack is a lot smaller than what most think. Debian and the BSD projects moved to v1.0.1 earliest, around March/April last year.

Ubuntu only upgraded two months ago (in 12.04.4) on the 6th of Feb:

[http://fridge.ubuntu.com/2014/02/06/ubuntu-12-04-4-lts- relea...](http://fridge.ubuntu.com/2014/02/06/ubuntu-12-04-4-lts-released/)

Redhat with 6.5 in November 2013:

[https://access.redhat.com/site/documentation/en- US/Red_Hat_E...](https://access.redhat.com/site/documentation/en- US/Red_Hat_Enterprise_Linux/6/html/6.5_Release_Notes/bh-chap-security.html)

CentOS Feb 26th 2014:

[http://wiki.centos.org/Manuals/ReleaseNotes/CentOS6.5](http://wiki.centos.org/Manuals/ReleaseNotes/CentOS6.5)

<comment><USER8> Fedora has been on OpenSSL 1.0.1 since maybe March 14, 2012 (that was when the .spec was bumped, anyway)[0]. So quite a long window for Fedora users, unfortunately.

[0]: [http://pkgs.fedoraproject.org/cgit/openssl.git/commit/?h=f18...](http://pkgs.fedoraproject.org/cgit/openssl.git/commit/?h=f18&id=0f0ab241767afcda7d3a21a5b8e7bc770516f2ea)

<comment><USER8> Whoah, downvote for this? I thought this was factual and helpful... if you disagree, can you at least let me know what's wrong? Thanks.

For more details: Fedora 18 shipped with OpenSSL 1.0.1c on 11-Sep-2012: [http://mirrors.kernel.org/fedora/releases/18/Everything/x86_...](http://mirrors.kernel.org/fedora/releases/18/Everything/x86_64/os/Packages/o/). So that's 18 months of exposure for Fedora users (including me).

</comment></comment></comment></comment><comment><USER9> While I know private keys are important and you really don't want to leak them, I have to wonder if the security community's focus on the private keys as the crown jewels that heartbleed accesses is a little misplaced.

If someone can steal your private key, yes, they can now impersonate your SSL server. For HTTPS, they'll need to actually perform a DNS spoof or similar to truly exploit that change, though. I guess there might be more of a concern about things like DKIM keys being stolen. We have to be a little less trusting of SSL certs to verify identity.

But in all this fuss about the keys, we seem to be forgetting that the heartbleed vulnerability allowed attackers to sniff random cleartext as it passed through OpenSSL. Session identities, usernames, passwords, sure - <USER2> again, the security industry focuses on credentials being stolen as the worst case scenario. But what about all the other private data going across the SSL connection?

This reminds me a little of the focus on operating system security preventing privilege escalation, while ignoring the risk of malware trashing all of a user's own data - you might lose all your photographs, but at least the device drivers will be safe.

When it comes to heartbleed, users might legitimately fear that data they sent over SSL could have been eavesdropped by anybody; but the security industry doesn't seem to care about that as much as it does about whether the private key could have been compromised.

<comment><USER10> Preface: I don't understand this stuff much at all.

I was under the impression that stuff gets encrypted with the public key, and can only be decrypted with the private key. Doesn't owning the private key let you snoop on all traffic, all of the time, forever until they change the keys?

<comment><USER5> You still have to be in a spot to snoop. If you are a random hacker wanting to snoop on a Russian bank, once you get their private key, you have to now tap into the network. This is unlikely to be within your ability. You might fly to Russia and sit in cybercafe's open to catch people on the open WiFi, but it's not something that's easy.

On the other hand, as the above comment says, you can use heartbleed in other ways, such as catching people's cookies from memory, then insert those cookies into your own browser and hijack their connection.

Among the things I'm famous for is having written a proxy server you can aim your browser through in order to do cookie hijacking: [https://github.com/robertdavidgraham/hamster/](https://github.com/robertdavidgraham/hamster/)

</comment></comment></comment><comment><USER11> Well, with the exploits for this vulnerability now showing up everywhere i _almost_ feel bad for the people that still have not-patched servers lying around.

<comment><USER12> Feel no pity whatsoever for the sysadmins. Feel pity for the users, who are unwittingly using a vulnerable service.

<comment><USER3> Maybe the sysadmin took a vacation. Fuck him, why should he spend time with his family?

<comment><USER13> Well if you're the only sysadmin for a company and they let you travel without the ability to both contact you and have emergency work done, you're pretty lucky. I would hope no company would let their one and only fulltime sysadmin take a vacation without having backup personnel on-hand

<comment><USER3> Not every company in the world has sysadmins three levels deep. Lots of companies don't even have sysadmins _one_ level deep.

</comment></comment></comment></comment></comment><comment><USER14> It could be just my perception but it seems like the authors of Heartbleed exploit code are focusing on www and email servers.

Doesn't OpenVPN use OpenSSL?

<comment><USER15> I believe so, yes. It often provides a certificate with the configuration settings. Many screen sharing and remote access tools use some form of TLS/SSL too.

</comment></comment><comment><USER16> Will these automated tools work on vulnerable Android devices? If so this seems a little irresponsible, I mean it is one thing to stick it to lazy sysadmins but making it easy to exploit peoples phones seems evil.

<comment><USER17> I'm confused how openSSL on Android is a problem... isn't openSSL a server technology? Do the clients use a heartbeat for something?

Or is this only relevant when you're running a server on your client device?

Is OpenSSL always running as a server on Android?

<comment><USER4> Heartbeat goes both ways. If you can be tricked to accessing a malicious HTTPS server, it can extract data from the _client_. [http://blog.meldium.com/home/2014/4/10/testing-for- reverse-h...](http://blog.meldium.com/home/2014/4/10/testing-for-reverse- heartbleed)

<comment><USER17> ... wow, the media firestorm around heartbleed was so fixated on the server- side issue that this completely slipped by me. I guess it's only relevant to one particular Android version and a handful of Linux-based versions where patching is expected to occur automatically and quickly, and nobody cares about desktop Linux.

<comment><USER4> I wonder how many different ways you can trick a server into accessing a HTTPS site. Seems like lots of services check links in comments or load remote images or run webhooks...

I can definitely see how a server could slip through the cracks if it has a broken HTTPS client, but the site it's serving is fine. No automated scanner is gonna pick that up from the outside.</comment></comment></comment></comment></comment>


Online vs Offline Stores? - <AUTHOR>

Which one is better? <comment><USER2> Depends on what you're buying/selling and to whom.

<comment><AUTHOR> Lets assume it online fashion store.For everyone</comment></comment>


(1..100).inject(&:+) - <AUTHOR> http://weblog.raganwald.com/2008/02/1100inject.html

<comment><USER2> I use Symbol#to_proc every day. I've never cared for the term "inject", though (or Python's "reduce", for that matter); I find SICP's "accumulate" much more mnemonic.

For what it's worth,

(1..100).to_a.sum

works in Rails, though

(1..100).sum

doesn't.

</comment><comment><USER3> Hahaha... Reg, it's like you wrote this in response to the recent article on Monkeypatching floating around here... Thanks! I enjoyed your writing as much as always... and it's especially timely today.

(<http://news.ycombinator.com/item?id=123071> if you don't know to which I am referring.)

<comment><USER4> Weeeel...

The truth is, I wrote the idea behind this a while back using String#to_proc to compare the way Ruby (roll your own) and Python (Guido decides) evolve. But considering I have no Python experience, I never published the post.

Then today, for some reason, I was thinking about Open Classes again :-)

</comment></comment><comment><USER5> Anyone want to explain that code to someone who doesn't know Ruby?

<comment><USER6> The way to write this in ruby without extending the symbol class is

      (1..100).inject { |acc, n| acc + n }

inject is a left fold or a reduce- it applies the function {acc + n} to each element in a list (or array) where acc is the result of the last function application.

For such a simple function, all we need is the knowledge that we are adding, which is contained in the symbol '+', representing the addition method. So Ideally we would like to write

      (1..100).inject( :+ )

The semicolon is how you tell ruby you are using a symbol. Yes, you can write a simple sum function, but the point is that this code is more flexible in a very powerful way- we can use other functions then inject and add.

Method calling in Ruby is actually message passing. So instead of calling

       1.+ 2   # => 3

You can say

      1.send( :+, 2 )   # => 3

So we are not trying to convert a symbol to a proc. What we are trying to do is continually send the message ':+' to inject's built in accumulator, with every member of the list (or array) as an argument.

In ruby, the brackets are like a function, but it is actually a closure of class Proc. You can convert a different class to a proc (if it supports it) by calling to_proc.

Ruby has a syntactic shortcut, '&' for converting to a proc. Normally it actually makes the code clearer because it is also used when passing Procs onto other methods, and is a nice type annotation. So we can hack this syntactic shortcut to create

      (1..100).inject( &:+ )

So by defining how '&' works by defining to_proc, we can make it create a closure (or Proc) which sends the ':+' symbol, along with any arguments that are yielded to the Proc. In this case, every value from (2..100) is yielded to the Proc. (1 will be the starting value of the accumulator.)

You can accomplish a lot of things with a closure, including this hack. But to me this shows that ruby was not designed as a functional programming language, and how by using Ruby's dangerous flexibility you can manage to warp it towards your needs.

After learning more languages, Ruby is starting to become pretty ugly to me, but somehow people keep managing to ignore all its faults, make little hacks like these, and be very productive with it.

<comment><USER4> "After learning more languages, Ruby is starting to become pretty ugly to me, but somehow people keep managing to ignore all its faults, make little hacks like these, and be very productive with it."

When I first saw it, I wondered why anyone would want this irregular little language when they could just use Smalltalk or Scheme. An early rant asked why I have to know the difference between a block and a Proc: why the &^(%*)(& do I have to know when to use a block, when to use a Proc, and how to convert between them???

<comment><USER7> For those who think the above is pretty tame and have been using it for years, we've got a series on our blog where we introduce and discuss a new method every day.

<http://blog.rubyenrails.nl/articles/category/daily_method>

Here we create a to_proc method for Hash: [http://blog.rubyenrails.nl/articles/2008/02/26/a-hash-is- a-f...](http://blog.rubyenrails.nl/articles/2008/02/26/a-hash-is-a-function- hash-to_proc)

<comment><USER4> I subscribe to the series and enjoy it. I hadn't seen Hash#to_proc, I look forward to considering the possibilities carefully...

</comment></comment></comment></comment></comment><comment><USER8> The VB.NET equivalent is Enumerable.Range(1, 100).Sum, which seems clearer to me. Why is this so impressive? If Visual Basic comes close to your beloved code snippet, it's probably not that big of a deal.

In real life, the answer is to know some math and realize that 1 + ... + n = n(n+1)/2, so the entire thing is pointless anyway.

(And if you want to add methods to a given class ad-hoc, you can do it statically with extension methods; Sum is an extension method.)

<comment><USER4> The article does _not_ claim that this is a good thing! It claims that the line of code says a lot about Ruby the language.

<comment><USER8> That it's obsessed with obfuscatory, slow language constructs?

<comment><USER4> Let me ask you a question: you arrived at the top of the article with a preconceived idea about Ruby. Did reading the article give you any insight, did you learn something about Ruby or about yourself by reading the post?

If not, please downmod it, I have failed.

<comment><USER9> _or about yourself_

At the risk of getting even _more_ downmods for saying true things here, can I just point out that it's a little arrogant to pretend that a blog post about Ruby is going to move someone towards self-actualization?

Anyway, have you failed? No. You wanted to show us your favorite line of Ruby code, and you did.

As for me, I don't really have a favorite "one line" of code, but I fondly remember when I was a kid typing in Nibble Magazine's "one and two-liner" programs. Actually, the "lines" were lines as defined by the Apple II's command line buffer limit. Here's an example:

[http://www.apple2.org.za/mirrors/ground.icaen.uiowa.edu/appl...](http://www.apple2.org.za/mirrors/ground.icaen.uiowa.edu/apple8/Pgms/rotatecube.bas)

Maybe I'm not a sufficiently abstract person. My favorite two lines of code was an honest-to-god graphical car driving program in two lines of APPLESOFT BASIC [1]. Two lines of code in a language so crappy it's basically a joke. And yet...a full-on-graphical-car-racing program. I'm strongly tempted to think that APPLESOFT BASIC is superior to Ruby, based on the evidence I've seen.

Point is: The next time you show a feature of a langauge, maybe make it solve a problem, or create something real, rather than just showing how few characters it takes to do something banal. Adding numbers together? Seriously, it's a solved problem.

[1] Sorry for the capital letters, but I'm in Apple mode now:

<http://www.apple2.org/images/Literature/a2/BlueBook.JPEG>

<comment><USER4> "have you failed? No. You wanted to show us your favorite line of Ruby code, and you did."

Actually, I wanted to discuss how Ruby's open classes promote language innovation from the fringe, not to try to impress you with how clever that line of code is.

"The next time you show a feature of a langauge, maybe make it solve a problem, or create something real, rather than just showing how few characters it takes to do something banal."

And there you have why my article failed you: you think it is about how useful that line of code is, or how clever it is, or what problem it solves, when I think it is an example of how Ruby is different from centrally planned language.

Is it great code? Of course not. Symbol#to_proc may even be an evolutionary dead end, AFAICT it's just a way to make OO code pretend that it's functional code.

Your criticisms point out that I need to work harder on establishing and communicating my theses, thank you.

</comment></comment></comment></comment></comment></comment><comment><USER10> If Symbol#to_proc is so great, I'd like to see how it can elegantly express something that can't be hidden behind a simple library function. In any decent language the programmer would write "sum(1,100)". Even if the function's implementation in Python/Java/C++/Smalltalk/Lisp/etc required a few more characters, it wouldn't be a meaningful difference. Does Symbol#to_proc add any _real_ power to Ruby or beyond enabling such linguistic brain teasers?

<comment><USER4> Your question takes my breath away. May I quote you?

<comment><USER10> Only if you first answer it.

<comment><USER4> There are so many answers! Here are a few:

The article does not claim that (1..100).inject(&:+) is great. It claims that it is a totemic example of Ruby code.

There is nothing that technique X can do that technique Y cannot do given that X and Y are both Turing Equivalent. Of course you can write a library function to sum numbers. Do you also need a library function for the product of numbers?

If so, you now know of a salient difference between the two approaches. One needs a function for each thing you want to do, the other gives you some pieces you combine in different ways to do what you want. Is one better than the other? That's up to you to decide, you are the programmer. Ruby lets you write your program either way.

Now, Symbol#to_proc doesn't, in my opinion, add what I would call power. That's because you can always use a block or a lambda wherever you would use a symbol. But I may not have written the article well: the powerful and dangerous feature in Ruby is not Symbol#to_proc, it's _Open Classes_. Symbol#to_proc is an example of something you can do with an Open Class. Something else you can do with an Open Class is Hash#to_proc. Something else is Object#andand, a low-rent version of the Maybe Monad in Haskell.

I consider Open Classes to be powerful and dangerous. Am I advocating them? Of course not, it is up to you to decide whether they are a good idea or not. What I find interesting about them is that Rubyists are pushing the language in new directions with them, like Symbol#to_proc. The idea of a language growing from the fringe is also powerful and dangerous. The fringe is an uneducated, seething mass.

</comment></comment></comment></comment><comment><USER11> To some degree, using open classes is just how you write functions in Ruby.

Say there exists a class called Errors in some Ruby library. It doesn't have an each() method, but I'd like it to. Nobody would complain if I wrote a function each_error() which took an Errors object as an argument. Reopening the Errors class and giving it an each() method is the way you do that in Ruby, and it's not really any more dangerous.

<comment><USER12> Then lets say you packaged that up as a library. Another guy did the same thing, but it worked a little different. Now random code breaks.

<comment><USER13> It turns out not to be a problem in practice. I could list the 20 things I hate most about Ruby and the 20 things I hate most about Rails, and this wouldn't make either list. I don't know that I've ever seen it happen.

And on the "technically, could it happen?" side, sure, it could. You can also write a Java library that, in weird cases, could screw up other Java libraries, but the Java folks (even as much as they love to try to keep you safe) don't care, either.

Besides, "each" is quite standard in Ruby. Defining it to mean something other than "call the proc with each element, in order" would be weirdbad, like a C++ programmer defining operator+ to mean subtraction. If you do something weirdbad like that, your library deserves to lose.

</comment></comment></comment><comment><USER9> That sort of thing, for all of its doubtless glories, represents nothing so much as a contempt of the _next programmer_ who has to deal with it. We're just moving bits and bytes around here, people. Please sum up the numbers and don't introduce any mysteries into the plumbing.

 _ALL OF THE REAL INNOVATION IN SOFTWARE IS RELATED TO THE PROBLEM DOMAIN AND NOT THE LANGUAGE_

<comment><USER14> If you're saying something that's actually true, you don't need to use all uppercase.

<comment><USER9> ONE PLUS ONE EQUALS TWO.

God, I hope I didn't just rip open the space/time continuum.

<comment><USER15> Indeed you did. I'm from the future to tell you that really don't need to use caps.

</comment></comment></comment></comment><comment><USER16> Actually he is wrong about Java: people did add features to it without changing Java itself, for example AspectJ, and CLIB (I think is the name) that generates Java Code on the fly. Hibernate uses it, for example, to change the behaviour of the mapped Objects behind the scene.

<comment><USER4> You would be amazed what people will do to Java. Just the other day I was reading something here about writing Java code using an Excel spread sheet. I'm pretty sure that wasn't in any of the JSRs.

</comment></comment><comment><USER17> Why I hate ruby.

<comment><USER18> Since I don't use ruby either...I tried a web based interpreter.

       >> (1..100).inject(&:+)
       TypeError: wrong argument type Symbol (expected Proc)
         from (irb):1

I also am not a fan of doing things a thousand different obscure ways. I like doing things one way, and having that way highly optimized. Typing 10 characters or 20 characters doesn't impact my programming speed, I spend far more time thinking about how to do things the right way.

edit:

Ok, did his monkeypatch and it worked. You get 5050. So it is equiv to sum(range(101)) in python, and much less readable. I fail to see why this is a good thing.

<comment><USER4> "I fail to see why this is a good thing."

Why _what_ is a good thing? Why that line of code is a good thing? maybe it isn't, maybe arrays need a sum method, maybe you could just write:

(1..100).inject { |acc, n| acc + n }

...and get the same result. But the article has nothing to do with why that line of code is a good thing, it is about the fact that being able to modify the Symbol class in this manner is what makes a langauge like Ruby evolve from the bottom up.

So... do you think _that_ is a good thing? Or a bad thing?

<comment><USER18> I think that style of code is rather hard to read and really doesn't add any functionality that couldn't be done in a much more readable way in the same number of characters.

So I am wondering why the author thinks its so fantastic.

As for developing the language, I am usually for flexibility and allowing anything to be modified, however this type of change strikes me as not very useful.

<comment><USER4> "I am usually for flexibility and allowing anything to be modified, however this type of change strikes me as not very useful."

That's entirely the point. If you are in favour of flexibility, you have to accept that people will use it for all sorts of things, not just ones you like.

<comment><USER18> I was talking about the fact that they are making that change on the core language. Providing the flexibility is different from putting it in the language.

Anyways, I don't really care, saying anything other than 'I love ruby' is shunned anyways.

<comment><USER4> "saying anything other than 'I love ruby' is shunned anyways."

Well... I welcome criticism of Ruby. Please say whatever you like in a comment right on the post.

I've never shied away from writing about the things in Ruby that irritate me. How else will we progress if we don't scratch when we have an itch?

</comment></comment></comment></comment></comment></comment></comment><comment><USER19> So just out of curiosity .. what do you think is the most beautiful way to right the equivalent code in arc?

<comment><USER20> In this case, the "equivalent" code isn't a line that produces the same result, but is instead a line that illustrates the dynamic culture of the given language's evolution.

For Arc, right now, practically every line is an equivalent.

<comment><USER19> Well okay let me elaborate on my question.

pg has stated that code brevity is one of the main design goals of arc. But what is pretty obvious is that code brevity is not the only consideration. It is desirable to be able to write very short code, but it should be readable as well. If you write very short code that is difficult for other people to read, that is bad enough. If you write very short code that ends up being difficult even for yourself to read -- then we have a problem.

The above ruby code snippet is a great example of code where reducing the length not only did not reduce readability, but actually increased it. I know some people have complained about it being obfuscated on this board. But to me, and I am sure to a number of other people on this board, it was easy to understand, intuitive even.

so .. in arc, what would be a similar way to create a list of numbers from 1 to 100, and to evaluate the sum of that list?

<comment><USER20> That question is somewhat interesting just a little off-topic in this thread.

In Arc, that line would be:

       (reduce + (range 1 100))

which is nice, but not much different from Scheme. Pretty readable.

</comment></comment></comment></comment><comment><USER21> What does the &: do in Ruby?

<comment><USER4> Actually, it's &(:+) not &:(+). The & takes its argument and converts from a Proc to a block. :+ is a symbol that implements the method #to_proc to give you a block that sums its receiver and its argument.

<comment><USER21> Oh, cool. I knew the colon meant a Ruby symbol, but I did not know that you could use & to convert a Proc to block.</comment></comment></comment>