Hacker News new | past | comments | ask | show | jobs | submit | 0xff00ffee's comments login

Yeah, I wanna see shell scripts, puppet and vimrc files, C++ tricks, coding techniques, circuit teardowns, MCU hacks, and docker discussion...! (Seriously) Not WikiLeaks and censorship and vote suppression!

I've been spending more time on stackexchange, it is probably better suited to what I'm looking for.


> Repeat after me: all technical problems of sufficient scope or impact are actually political problems first.

How does a "fat pointer in C" or "devops for ML" become political? I'm joking, but I think too many deliberately charged issues make it to the top. I popped over to slashdot for the first time in years and it has become a right-wing megaphone. It is very sad. I would prefer to not see HN go this way. (Mea culpa: I'm partially to blame for this because politics makes my blood boil... but it would be nice to just say 'no' at some point...)


> I popped over to slashdot for the first time in years and it has become a right-wing megaphone.

That's the trouble with faux neutrality and negative peace: It will be exploited by people who want their "side" to win. Given enough time and people with colluding self-interest, and an inflexible moderation policy, they will.

> It is very sad. I would prefer to not see HN go this way.

I agree, but there's not much we can do about it except flag flame-bait topics (i.e. anything that's purely political or religious and non-technical).


The number of people in this thread defending the right to spread billionaire-funded lies, propaganda, and misinformation under the guise of free-speech is drop-dead astonishing. Like, I can see why civilization could fail on a massive scale if a critical mass of the population starts to believe the opposite of the truth, and declares war on those trying to explain.


> billionaire-funded lies

Pretty sure most people are forming their opinions on their own. That some of them you don't care for doesn't mean they've been bought by some mind-melding monster.


Facts are different than opinions. When you lie you lie. If you're so distorted by Trump's daily lies, then I pity you.


I find it amusing that I can't tell what side you are on.


[flagged]


Well now I'm concerned that I'm on the same side of an argument with someone like you.


Heisencomment.


Are you referring to Bill Gates?


[flagged]


I don't think either side wants to help people, other than their donors.


I guess if you go through life with your eyes closed, or only listening to one side, then I can see how you'd think that. There's no place to start with someone as ignorant as you. Literally, I could list all of the ways the US left has helped improved the quality of living, and all the ways the US right has actively hurt people and you'd shrug and still spout the same ignorant comments. So all I have left for you and your type is contempt. Utter contempt.


We've banned this account for repeatedly breaking the site guidelines. Sorry for the delay, but I only just saw your recent comments and it's not ok to abuse the site like this.

https://news.ycombinator.com/newsguidelines.html


>Literally, I could list all of the ways the US left has helped improved the quality of living

Yes, please list the ways the left has helped improve the quality of living for the US. I'd prefer the list only be things that occurred this century. Lip service doesn't count either. Sanders is the only one I can think of that's done anything, and The Party shut him out twice.


Hmmm... I would find this extremely error-prone. Probably due to my own issues, but flipping through multiple remote sessions in tmux in the same window would get confusing after N=2 terminals.

But who manages THAT many remote sessions? Seems like an upstream problem to me, no?


I always want to emulate my seemingly-more-efficient colleagues. One of them had a set of 6 sessions in some layer talking to screen which was talking to vim or XXsh (bash, zsh, or something), and he had memorized an arrangement whereby he could think "I'm in this one and I want that one" and he'd go left-left or right-up and be in the right one. But he always had one unused when I would visit him and would pursue a search in that one. None of this was remote by the way. This inspiration got me to try screen but I didn't like it after all. It in no way inspired me to run Vim because I already preferred Emacs.


> I always want to emulate my seemingly-more-efficient colleagues

Heh, well put. Me too. I come to HN looking for... well... "hacks".


Yep. Agree 100%. It is like the blue dress.

I think the problem is the repeating function. Infinite things are non-intuitive and should be presented differently.

Even here on HN you still see people confused about "convergence" and "identity". 0.999... doesn't CONVERGE, it literally is 1.

I suspect this persists even with students that have had second year college calculus that discusses convergent series and sums.


Fine. Define 0.999... as the limit of the series sum(n=1 ... N)(10^-n), as N-> infinity. This is standard high school calculus. "Number" and "series" and "limit" and "convergence" don't all mean the same thing. However this number is defined as the limit of a convergent series. So the question really is meaningful. (One clue that this question is meaningful is the amount of space introductory calculus textbooks use to address it.)

Because I can still ask, in black and white, what law of "equality" do I use to establish that my limit equals 1? (It does, if I import the definition of "equality" from the real numbers. That's what they do in calculus class. )


Thanks to a commenter who pointed out that my sum above should be

sum(n=1 ... N)(9*10^-n).

I can't, uh ... fully endorse that comment, which is not entirely accurate and doesn't answer my question. But I sure did miss the '9'.


You asked for a "law" of equality (whatever that is) and provided an answer that proves it converges to 1. What more could you possibly want?


We seem to agree on this: you don't think there's any need for a way to determine whether two real numbers are equal.

For ordinary math, though, using some criterion for equality (for example x>=y and y>=x) is basic and not controversial. So it seems unconvincing (to me) when you seem to imply the opposite.


There is an easy way to prove two numbers are equal. Typically in the reals there are three possibilities: a > b, a < b, a = b. If you eliminate a > b and a < b then you are left to conclude a = b. And this is exactly what is done in Apostol's Calculus Vol 1 (IMHO the greatest calc book ever written) chapter 1 when he proves that the area under n^2 is EXACTLY (n^3)/3, with no "calculus". You would be shocked how far into calculus the author gets with just that theorem. Can't recommend that book enough.


Thanks, I'll take a look. I like that kind of thing very much.

I use applied math. I haven't taken a class in real analysis. But it's fun how often grinding out the solution to a "real world," practical PDE turns out not to actually be the nicest (simplest and/or clearest and/or sufficiently insight-producing) way to understand the (hopefully) corresponding physical problem in the lab.

Stripping off the "calculus" and replacing it by limits sometimes seems to help highlight alternate perspectives that the magic "integrals" and "derivatives" kind of conceal.

Even when it's not more effective, it's definitely more fun.


> you don't think there's any need for a way to determine whether two real numbers are equal.

You are putting words in my mouth.

And you clearly do not understand the answer.

I guess I'm not very good at ELI5 because I very clearly answered your question with your own proposal.

Maybe when you get to college a professor can do a better job explaining it to you (if you actually make it to college, because you're going to struggle very hard if that's how you think when an answer is spoon-fed to you).


I'm not sure if you are asking for an answer or a rhetorical question? I'll assume the former.

Your terms are bit jumbled, so let's keep it simple: you're asking how to prove if an infinite sum converges and what its value is. Convergence proofs require analytic thought: meaning there may not be an immediate look-up. You need to convert the problem into the known corpus of convergent sums or use one of many tests (bounds test, integral test, etc) to show it converges analytically. Which you only learn through experience and memorization (unless you want to re-prove hundreds of series... maybe you do!) Fortunately this one is easily re-written as a known convergent sum.

First, you missed a term in your sum (9), re-written here:

sum(n=1..inf) 9 * 10^-n

Step 1: you pull out the 9 and it becomes 1/10+1/100+1/1000...

Step 2: Then we shift to n=0 by subtracting 1/10^0 from the series so that it is in the form n=0..k-1

1/10^0 + 1/10 + 1/100 + 1/1000 + ... + 1/10^-n - 1/10^0

Step 3: Now we've got ourselves a geometric series of just 1/10^n .. wikipedia does a great job explaining the sum convergence for GS from n=0...inf: https://en.wikipedia.org/wiki/Geometric_series

Step 4: compute geometric convergence

(1-r^n)/(1-r) = (1-(1/10)^n)/(1-1/10) = 1/(1-1/10) = 10/9

So we have 10/9 as the solution to Sum[n=0...inf](1/10^n)

Step 5: the remaining arithmetic

Now subtract our 1/10^0 ... and then * 9 = 1


You can't have a double-blind with only one side. Unfortunately the other side is unethical.


TXT2MOB IS DEAD!

LONG LIVE TXT2MOB!


> I say this as someone who passed 2 semesters of graduate QM.

THat's funny because my EE math concentration was on advanced calculus. I took two semesters of a-calc and got A's, but I only know how to compute a Jacobian and apply it, not its origin story. It's a very weird feeling to understand the motions but not the ... depth?


Short answer: there isn't an easy answer. Yet. (Give QC another 50 years).

Proof? Just look at all the replies you got: each one is dozens of pages of complex (imaginary) math, control theory, and statistics.

The hardest part of QC is exactly what you described: how to extract the answer. There is no algorithm, per se. You build the system to solve the problem.

This is why QC is not a general purpose strategy: a quantum computer won't run Ubuntu, but it will be one superfast prime factoring coprocessor, for example (or pathfinder, or root solver). You literally have to build an entire machine to solve just one problem, like factoring.

Look at Shor's algorithm: it has a classical algorithm and then a QC "coprocessor" part (think of that like an FPU looking up a transcendental from a ROM: it appears the FPU is computing sin(), but it is not, it is doing a lookup... just an analogy). The entire QC side is custom built just to do this one task:

https://en.wikipedia.org/wiki/Shor%27s_algorithm

In this example he factors 15 into 5x3, and the QC part requires FFTs and Tensor math. Oy!

Like I said, it will take decades for this to become easier to explain.

For fun, look at the gates we're dealing with, like "square root of not": https://en.wikipedia.org/wiki/Quantum_logic_gate


This feels like the high-level missing piece in my understanding of its use. Do you know any resources that expand on QC’s effective potential more from this point of view?


IMO one of the effective potential of a QC is `Secure Encrypted communications`. There is a research project named QUESS (https://en.wikipedia.org/wiki/Quantum_Experiments_at_Space_S...).

This project involves a minisatellite (capable of generating entangled photons in space) to establish a space platform with long-distance satellite and ground quantum channel, and to carry out a series of tests about fundamental quantum principles and protocols in space-based large scale


Sorry, I do not.


All good. I appreciate the perspective you’ve given!


I always skip to the async part of JS text because explaining it is a bit like handing a shotgun to a five year old. I think the folks over at risingstack have the best explanations, IMHO.

I'm surprised they attempted timeouts in promises with so little text, that's actually pretty dangerous pattern because it glosses over the complexity in actually stopping an in-flight promise. It is VERY easy to end up with hundreds of thousands of unresolved promises with their pattern. Dangerous!

There is a great repo on this issue.... aand I can't for the life of me find it. Basically there's a github project that uses generators and passes an atom down through the call stack to ensure everything below the race promise is aware that it is being halted. And even that doesn't handle all the nuances of this pattern.

And if anyone knows what github repo I'm talking about, I'll give you ... 50 DKP?


I used to use more "Promises" but now I mostly code with plain callbacks if possible. It is just simpler, less thinking needed. I spend that thinking-budget on other things.

One thing that is tricky with async is that nobody tells you if the async function never does what it should. I wish they would add some more built-in support for that in the next JS version.

Promises hold promise (pun intended) but they are a bit too complicated for my brain.


I also find promises problematic. I do like async/await though, except for the fact that it relies on promises.

I've been toying with the idea of a promise free async/await implementation lately. I'm interested in feedback anyone would have.

https://github.com/bessiambre/casync


Very interesting. I just don't have time to try it out right now.

Perhaps if you create and publish a simple comparison solving a given problem with Promises vs. CaSync it would show that CaSync takes much less code?

That could convince more people to take the time to try it out.


I'm not sure it's much less code. Especially that async/await is integrated into the language now. It's less state, less corner cases, more encapsulation and better performance.

I'm thinking of trying (if I have time) to build a babel transpiler plug-in so you could use it with keywords like async/await instead of explicitly wrapping generator functions. I think the syntax would end up very simple.


Callbacks are a bit too much of an eye sore imo.

>One thing that is tricky with async is that nobody tells you if the async function never does what it should

Could you clarify this?


In sync programming if your function does the wrong thing you typically get an error thrown or you get a result which you check for its correctness.

But when you call an async-function that is supposed to do something like say write to a file or database maybe there is an error which makes it never do its job, and never call the callback you gave it. But the rest of your program just hums along happily. There is no error. The error does not "happen" but the error is that "something did NOT happen". And when something does not happen you don't get an error or notification saying that something did not happen.

You run your program but expected results do not show up in database. But you don't know why, because the problem is that some of your async functions did NOT call something they should have called.

It's hard to detect that something does not happen.

Some kind of built-in support for callback-timeouts might alleviate this problem.


What are you talking about? if you're async operation fails then your callback should always still be called but just with an error message in the second parameter typically. And what are you doing still giving call backs to async functions? Why are you not using promises?


I think previous poster is talking about a bug where the promise is never resolve nor rejected. So it just hangs out there, unresolved, forever.

I don't think using explicit callbacks helps, though, which has the same potential issue (worse really, since you're probably handling callbacks directly more often, depending on the patterns you use).


Right. Except I was able to experiment with a wrapper-function which set up a timeout on the callback which threw an error if the callback was not called within a set interval of time.

It helped to detect some flaws in my program.

A similar thing could no doubt be done with promises. But I think the best solution would be if there was a built-in facility to detect callbacks that were not called within a required or default time interval.

Eventually I stopped using the timeout wrapper, it didn't help very much, but made the code more complex. More but easier to understand code is often my preferred choice.

Whereas if language itself offers built-in facilities then fine since they are more likely to be bugfree than my own code.


Javascript code doesn't just stop executing for no reason, if the callback needs to stop executing, it should reject the promise or throw an error. Or resolve with an error value. That's like saying "in sync programming, if you don't check for error conditions, your code continues humming along happily just the same".

If there is an error when reading a file or accessing a database, unless the file or database API is horrendously designed, it will reject the promise or throw.


> Javascript code doesn't just stop executing for no reason,

I would say it stops unless there is something keeping it running.

Think about your single-page-web-app. When you click on some widget on it a click-handler triggers and executes that code. But then it stops. When the user doesn't interact with your web-app no JavaScript is typically executing, unless you have set up a repeating polling loop with setInterval().


The scenario you described is a classic one and I really don't think it's as problematic as you may think. I had to reread it because it sounded too trivial. How about just throwing an error when the async function fails to write to the db?

>maybe there is an error which makes it never do its job

You can throw an error regardless of the reason why it failed to do its job. If the write to the db does not success, you can throw an error.


You are supposed to call fs.write() etc. But you do it only under certain logical conditions. Those logical conditions do not arise like you would expect because of logic errors elsewhere in your code.

So your async function never calls fs.write() even though it was your intention that it should. Is that an error? Definitely, the file was never written to, it now has wrong content. But the problem is, as you run your program you do not get any error thrown at you, therefore you don't even know there is a problem. Later on you may, or may not, realize that the content of the file is wrong. And then it's hard to say what caused that error.

What "caused something not to happen" is a difficult question to answer because you can't pinpoint the exact location in time and code where it did not happen. Why? Because it did not happen anywhere, ever :-)


Btw this same issue exhibits in python with threads. If you spawn an async computation in a thread and an uncaught error is raised, the thread disappears silently, leaving you with a callback that’s never called or a future that’s never resolved.


Ah interesting to know it's not only JavaScript.

But I assume in a thread-based language like Java all asynchronicity happens due to threads. Then from the programmers' point of view method-calls always either return a result or throw an error. They don't just silently stop executing


Funny, I now treat everything as a promise: all my functions are async because it keeps the interface simpler: if they don't return a promise, they are just a normal function, no harm, no foul.

I see no reason to use callbacks, unless the NodeJS module dev didn't implement promises. And even then I write a wrapper. I'm glad to see later versions of Node include promisified versions of things like File IO.


> glad to see later versions of Node include promisified versions of things like File IO.

I agree. They are easier to use. But they require more effort to write. Promises are easier to use than create. Maybe they are the direction in which public APIs will go but I do find they take extra effort to write, compared to callbacks


Regarding your second point: This sounds similar to .NET‘s CancellationToken. It works very well there.

What are those nuances in JavaScript which aren’t handled by it?


I think you're going to point out that I'm about to demonstrate non-JavaScript nuances, but here are issues I've encountered:

Let's take a great of example of where promises are used most often: AJAX. If the endpoint isn't RESTful and there is state on the other end, cancelling a promise requires updating the entire module of the new state. There can be multiple reasons for cancelling, and the code needs to be aware of what is happening beyond a simple timeout.

Same thing goes for USB devices (via libusb+ffi) and serial-ports (via serialport). In flight requests can disturb state if cancelled, and it makes the programming very complex to just time-out.

One could argue AJAX and hardware programming are outside the domain of JavaScript, but I wouldn't.

I guess it is more than a "nuance", it is the observance that cancelling an asynchronous operation in general can have unintended consequences if not handled correctly ... beyond memory leaks from unresolved promises.


Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: