Search found 281 matches

by Tub
Sat Jun 17, 2017 7:31 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9676
Views: 1428829

Re: Coding: Fleeting Thoughts

Let me clarify my issues about the talk: a) he refuses to educate the viewer about performance issues. Every time he mentions performance, he acts as if there's no performance hit at all. Of course there must be one, but instead of talking about it, he does his usual handwaving and skipping the issu...
by Tub
Fri Jun 16, 2017 11:38 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9676
Views: 1428829

Re: Coding: Fleeting Thoughts

The graph is just the squiggly line, and the coordinate axes are only there to show which part of the graph you're displaying. Thus, rename the part that does the coordinate system to "GraphDisplay", and the actual line to "Graph" Thanks. I was afraid I'd end up with something a...
by Tub
Fri Jun 16, 2017 3:22 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9676
Views: 1428829

Re: Coding: Fleeting Thoughts

" There are 2 hard problems in computer science: cache invalidation, naming things, and off-by-1 errors. " If we start numbering those problems at 0, then I'm currently stuck with the first problem: naming things. This is about graphs. Not networks of vertices and edges. I'm talking about ...
by Tub
Sun May 28, 2017 4:13 pm UTC
Forum: Science
Topic: Superconducting CPU?
Replies: 66
Views: 1843

Re: Superconducting CPU?

Suppose I make it "compute" hard enough to draw all 800W. Congratulations, your computer is on fire. Is it putting out exactly 800W of heat? The energy contained in the computer when it isn't running doesn't change much, but it changes. For example, a magnetized bit on a hard drive has a ...
by Tub
Tue May 23, 2017 3:54 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9676
Views: 1428829

Re: Coding: Fleeting Thoughts

So now we have a couple of opinions saying that javascript is stupid for silently inserting a semicolon when it appears that the user wanted one; and we also have an opinion saying that C# is stupid for NOT silently inserting a break when it appears that the user wanted one. I personally value clear...
by Tub
Tue May 23, 2017 8:19 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9676
Views: 1428829

Re: Coding: Fleeting Thoughts

sure, but since fall-through is only allowed for empty cases, why do we need to spell the break out in non-empty cases? Consistency of course. If no break means "fallthrough" on empty cases but "break" on non-empty cases, how many people would be struck by inexplicable and diffi...
by Tub
Mon May 22, 2017 10:01 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9676
Views: 1428829

Re: Coding: Fleeting Thoughts

Hm. ok, i didn't know about the goto case, but the break seems still unnecessary. case Colors.Green: case Colors.Blue: Console.WriteLine("Primary"); break; case Colors.Green: break; case Colors.Blue: Console.WriteLine("Primary"); break; There is a difference. if ($color == 'red'...
by Tub
Sun May 21, 2017 9:30 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9676
Views: 1428829

Re: Coding: Fleeting Thoughts

What's the point of the switch statement? DO switch on enums. At least in C/C++, the compiler may helpfully complain if you forgot a value. MAYBE switch on strings, when you're parsing enum-like user input, and your language supports it. DON'T switch on numeric values, unless your language supports...
by Tub
Sun May 21, 2017 12:09 am UTC
Forum: Coding
Topic: var == 'value' vs 'value' == var
Replies: 6
Views: 532

Re: var == 'value' vs 'value' == var

I think the two reasons this would be done are that in C, it prevents accidental assignment due to a typo: It's useless in C, because: /tmp> gcc -Werror=parentheses test.c test.c: In function 'main': test.c:4:2: error: suggest parentheses around assignment used as truth value [-Werror=parentheses] ...
by Tub
Mon May 08, 2017 2:24 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9676
Views: 1428829

Re: Coding: Fleeting Thoughts

Nobody said anything about passing a long-lived object around and expecting invariants to be maintained by pixie magic. The example was about guaranteeing an invariant on the return value of a single function. What does or does not constitute an "exception" could be debated for hours, so i...
by Tub
Fri May 05, 2017 8:04 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9676
Views: 1428829

Re: Coding: Fleeting Thoughts

All pointers can be null. They are a nullable type. Whoa. Are you really arguing that APIs must not make any guarantees except returning the correct type? Are you also opposed to sort() returning a sorted array? Will you argue that arrays are an unsorted type, and it's valid for sort() to return an...
by Tub
Tue May 02, 2017 2:40 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9676
Views: 1428829

Re: Coding: Fleeting Thoughts

Or you could just grab an std::any implementation; it'll likely compile in c++11, too. And when you switch compilers, you just switch to std::any and remove your code, because you've already used the correct API. btw, std::any allows casting to any compatible type, not just to the exact type entered...
by Tub
Tue May 02, 2017 2:05 pm UTC
Forum: Mathematics
Topic: An Eigenbasis Problem
Replies: 5
Views: 546

Re: An Eigenbasis Problem

You've been told that B -1 AB is a diagonal matrix, which means that once you have B -1 and thus B -1 AB, you can easily calculate (B -1 AB) n All you need to figure out is a way to get from (B -1 AB) n to A n . (Or you could calculate A 100 with no more than 8 matrix multiplications without any kno...
by Tub
Sat Apr 29, 2017 9:12 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9676
Views: 1428829

Re: Coding: Fleeting Thoughts

In other "ugly side of programming" news: I made a class that makes heavy use of std::shared_ptr<void> -types. Hang on.. are you screwing around with a custom deleter and (possibly) an enum for type tracking during dereferencing? What advantage does this have over, say, a base class with ...
by Tub
Wed Apr 26, 2017 8:18 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9676
Views: 1428829

Re: Coding: Fleeting Thoughts

WORKAROUND: Name each new variable <globally unique contributor name><unix time> where <unix time> is the time value at the time of writing. (be sure to sleep for 1 second after naming the variable) I'd ask you not to write code during leap seconds. But with your knowledge of unix time, I guess you...
by Tub
Sun Apr 23, 2017 11:16 am UTC
Forum: Science
Topic: Lay question about entropy
Replies: 29
Views: 2241

Re: Lay question about entropy

To put it another way, if we take a tenseless view of the universe, and we pick some point in time at random, we can equally well predict that the entropy at any other nearby point in time will be equal or greater. There is no law saying that it must be higher moving in one direction and lower movi...
by Tub
Fri Apr 21, 2017 8:52 am UTC
Forum: Science
Topic: News: Physicists create negative mass
Replies: 6
Views: 716

Re: News: Physicists create negative mass

The paper does not claim anything to have negative mass. That's the result of horrible journalism (and thread titles). The title of the paper begins with the words "Negative-Mass". One word short. It starts with "negative mass hydrodynamics". Those belong together. I'm not objec...
by Tub
Thu Apr 20, 2017 8:06 pm UTC
Forum: Science
Topic: Lay question about entropy
Replies: 29
Views: 2241

Re: Lay question about entropy

If you are actually a lay person, Carroll's book is p aight Can confirm that his book "The Big Picture" is a good read for lay persons. His older book "From Eternity to Here" probably has more details on entropy, but I haven't read it. Can also recommend searching talks from Sea...
by Tub
Thu Apr 20, 2017 7:51 pm UTC
Forum: Science
Topic: Lay question about entropy
Replies: 29
Views: 2241

Re: Lay question about entropy

Entropy is not order. I know that entropy is often explained as being a measure of order, and that works out for a few simple examples. But is it really more ordered to have all the particles of the universe randomly strewn about on planets and stars? I know that when my socks are randomly dispersed...
by Tub
Thu Apr 20, 2017 8:18 am UTC
Forum: Science
Topic: News: Physicists create negative mass
Replies: 6
Views: 716

Re: News: Physicists create negative mass

The paper does not claim anything to have negative mass. That's the result of horrible journalism (and thread titles). What the paper claims is that (under certain circumstances) the particles behave as if they had a negative m in F=m*a. To put it in a lot less exciting terms: "Scientists revea...
by Tub
Sun Apr 16, 2017 2:58 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9676
Views: 1428829

Re: Coding: Fleeting Thoughts

If you wish to call a template (like std::conditional), then all template parameters need to be valid. SFINAE does not apply here, and std::conditional cannot conditionally evaluate its parameters (even though it would be useful). underlying_type<int>::type does not exist, so it cannot be a template...
by Tub
Sun Apr 16, 2017 8:47 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9676
Views: 1428829

Re: Coding: Fleeting Thoughts

Is this a good practice? Or am I being a little overcautious, here? It is neither good nor bad practice; it depends on your requirements. Your function or method is supposed to have certain guarantees, for example on sort(): "when it returns, it outputs a sorted list, containing the same eleme...
by Tub
Fri Apr 14, 2017 9:03 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9676
Views: 1428829

Re: Coding: Fleeting Thoughts

They're white-space sensitive JavaScript (ugly), but if anyone is interested they can copy the code as if it were an address and paste it into a new bookmark. They're not whitespace-sensitive, but they are url encoded. You need to replace spaces with %20. I used to type them in a text editor in a s...
by Tub
Thu Apr 13, 2017 9:29 pm UTC
Forum: Computer Science
Topic: Favorite Programming Language
Replies: 13
Views: 2685

Re: Favorite Programming Language

And I was trying SO hard not to bash anything :roll: Sure, java got a lot of things wrong that c# eventually got right, but writing code for the JVM opens up a whole ecosystem of useful tools for deploying, managing, juggling and even cloudifying the resulting software. That's unlikely to be useful ...
by Tub
Wed Apr 12, 2017 10:57 am UTC
Forum: Computer Science
Topic: Favorite Programming Language
Replies: 13
Views: 2685

Re: Favorite Programming Language

Languages are tools, not pets. Use the right tool for the right job. As awesome as rust's safety guarantees are, sometimes a bash one-liner is all you need.

So far, every language I met had *some* use case where it shines, and *some* use case where it's a poor choice.
by Tub
Mon Mar 27, 2017 8:04 am UTC
Forum: Computer Science
Topic: Deliberately bad algorithms
Replies: 120
Views: 27824

Re: Deliberately bad algorithms

Interesting tradeoff. Though I have yet to meet a problem that requires checking existence of a path without actually returning the path. it uses O(log^2 n) extra space. (the undirected case can be done with O(log n) space) Really? It would seem that the call stack is at most O(log n) calls deep, an...
by Tub
Sat Mar 25, 2017 10:41 pm UTC
Forum: Science
Topic: Toothbrush, glasses, and clock
Replies: 15
Views: 1243

Re: Toothbrush, glasses, and clock

ThirdParty wrote:I also tried applying the toothbrush to the cell phone while taking the picture. Still normal.

Only a true scientist would apply a toothbrush to a cell phone and consider that process "normal". Well done.
by Tub
Sat Mar 18, 2017 12:17 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9676
Views: 1428829

Re: Coding: Fleeting Thoughts

(I know that's kind of dangerous because you now have two places where you can modify the set, but in this context, I'm pretty sure it's okay) Either wrap all related sets in another class, which guarantees that additions/deletions are propagated correctly, or (in C++) use a combination of shared_p...
by Tub
Thu Mar 16, 2017 5:48 pm UTC
Forum: Hardware
Topic: Best Hard Drive For Gaming?
Replies: 11
Views: 1631

Re: Best Hard Drive For Gaming?

I hope you mean $250 on a 1TB SSD: https://www.newegg.com/Product/Product.aspx?Item=N82E16820226596 "bucks" is a currency that may or may not be similar to either us dollars or euros and may or may not include VAT. That one is 280€ here, and a 500GB drive is just over half of that. But th...
by Tub
Thu Mar 16, 2017 4:25 pm UTC
Forum: Science
Topic: Free Will
Replies: 161
Views: 5307

Re: Free Will

Note that I'm talking about processes and not the universe as a whole. This process could be any subset of the universe and, assuming the universe is infinite (and so an observer is guaranteed access to more resources than exist in the subset), it is, in principle, possible for an observer to predi...
by Tub
Thu Mar 16, 2017 3:42 pm UTC
Forum: Hardware
Topic: Best Hard Drive For Gaming?
Replies: 11
Views: 1631

Re: Best Hard Drive For Gaming?

M.2 is electically compatible with PCIe, so adapter cards are cheap - there's not a single controller chip on them. But I doubt the old computer has PCIe 3.0, and 4x PCIe 2.0 is limited to 2000MB/sec. It would be cruel to buy a 3200MB/sec drive and put it in there. I expect the additional speed to b...
by Tub
Wed Mar 15, 2017 11:07 pm UTC
Forum: Science
Topic: Free Will
Replies: 161
Views: 5307

Re: Free Will

An observer can, in principle, predict with certainty the outcome of a deterministic process. To prevent anyone from getting the wrong idea, I think it's worth pointing out that determinism does not imply predictability. For any observer inside of the deterministic process we call "universe&qu...
by Tub
Wed Mar 15, 2017 10:38 pm UTC
Forum: Science
Topic: Eternalism. Does it allow free will?
Replies: 16
Views: 1241

Re: Eternalism. Does it allow free will?

If you really believe so, then try going without the strong force for a day.
by Tub
Fri Mar 10, 2017 10:51 pm UTC
Forum: Science
Topic: Science-based what-if questions
Replies: 274
Views: 17346

Re: Science-based what-if questions

So I have a question - if you are orbiting a neutron star at say 1AU and look at it, what do you see? You probably won't see a neutron star. Those things are tiny. The exact details depend on the neutron star, of course. At 1 AU, a 10km big ball is very hard to see, no matter its mass. There's a bi...
by Tub
Fri Mar 10, 2017 6:52 pm UTC
Forum: Science
Topic: Free Will
Replies: 161
Views: 5307

Re: Free Will

doogly wrote:And I throw these links out there like pearls before swine.

Take solace in the many worlds interpretation, and know that somewhere, in some remote part of the wavefunction, someone actually clicked your link. Most certainly not in *your* part of the wavefunction, but somewhere.
by Tub
Thu Mar 09, 2017 1:29 pm UTC
Forum: Science
Topic: Free Will
Replies: 161
Views: 5307

Re: Free Will

Copenhagen is the most used, accepted, and "standard" interpretation out there. Other interpretations are mostly considered semantics at best. Many worlds is "what if there's an infinite exponential amount of worlds that never interact otherwise and you can never prove and makes no c...
by Tub
Thu Mar 09, 2017 9:09 am UTC
Forum: Science
Topic: Free Will
Replies: 161
Views: 5307

Re: Free Will

Yes, quantum things are probabilistic in nature, so you have an appearance of randomness in measurements. That does not contradict the deterministic evolution of the underlying quantum states (including all its probabilities). The only interpretation with non-determinism is the copenhagen interpreta...
by Tub
Thu Mar 09, 2017 8:08 am UTC
Forum: Science
Topic: Free Will
Replies: 161
Views: 5307

Re: Free Will

I think that it is real and that determinism is wrong, but I'd like to know if you guys have any scientific evidence of free will existing that I could use. Since you're mentioning determinism: Current scientific consensus is that the universe is deterministic. See the Schrödinger Equation , an equ...
by Tub
Thu Mar 09, 2017 7:45 am UTC
Forum: Individual XKCD Comic Threads
Topic: 1808: "Hacking"
Replies: 32
Views: 3904

Re: 1808: "Hacking"

xtifr wrote:Actually, the first thing I do after compiling is usually linking.

Really? The first thing I do after compiling is to fix all the typos that caused the compilation to fail.

If only gcc had a switch to automatically run that step.
by Tub
Wed Mar 08, 2017 6:09 pm UTC
Forum: Individual XKCD Comic Threads
Topic: 1808: "Hacking"
Replies: 32
Views: 3904

Re: 1808: "Hacking"

pogrmman wrote:That would be a great switch to have -- what's the first thing most people do after compiling? Run the executable they just made. Why not make it easier?

The switch is called

Code: Select all

&& ./a.out

and must be appended at the end of the command line. :roll:

Go to advanced search