Search found 409 matches

by Tub
Wed Dec 05, 2018 5:13 pm UTC
Forum: Science
Topic: disproof of boltzman brain?
Replies: 49
Views: 2952

Re: disproof of boltzman brain?

That then raises the question of refining our definition of “creates more”—do we consider the creation of a small number N minds which then reproduce P offspring as being the same probability as the de novo creation of N+P minds? You don't calculate the chance of an organic brain appearing. You cal...
by Tub
Tue Dec 04, 2018 12:47 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9890
Views: 1823241

Re: Coding: Fleeting Thoughts

This could be perfectly harmless, if your total average throughput matches what the disk supports. In a perfect world, network speed would adjust to disk speed, but several layers of buffers and queues may prevent that. IIRC there are a few procfs/sysctl knobs you can try to influence dirty page han...
by Tub
Mon Dec 03, 2018 11:53 pm UTC
Forum: Gaming
Topic: I need a Game Recommendation
Replies: 1559
Views: 356336

Re: I need a Game Recommendation

I have a few more recommendations that I have enjoyed with my partner. * Stardew Valley. It recently got a multiplayer update. * Heroes of Hammerwatch. Very fun roguelike dungeon crawler. * Victor Vran. Action RPG with an approachable combat system. Has a rather clicheed story but excellent storytel...
by Tub
Mon Dec 03, 2018 11:08 am UTC
Forum: Science
Topic: How does calibrating hygrometers with salt work?
Replies: 4
Views: 217

Re: How does calibrating hygrometers with salt work?

Story time. I once bought a bunch of cheap DHT22 sensors to measure temperature and humidity at home. They're digital, "no calibration needed", yet no two sensors would agree on a value. IIRC the largest span was a difference of 10% humidity, which can be the difference between "you n...
by Tub
Sat Dec 01, 2018 12:29 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9890
Views: 1823241

Re: Coding: Fleeting Thoughts

EDIT: completely unrelated, but in modern C++, what is the consensus on defining inline functions in header files: good practise or bad? .cpp file: "Eh, I guess a really smart compiler could still inline it" .h file: as inline "I trust the compiler to make a good choice. The linker w...
by Tub
Wed Nov 21, 2018 8:53 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9890
Views: 1823241

Re: Coding: Fleeting Thoughts

The ABI's consistent If that is the case, then you'd expect v1 to be a symlink to v2, and you wouldn't have this trouble. If you wish to override a vendor-supplied binary, you can use LD_PRELOAD to make app use your system's v2. "foo" and "bar" are C (and we can compile both). H...
by Tub
Wed Nov 21, 2018 6:34 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9890
Views: 1823241

Re: Coding: Fleeting Thoughts

my intuition tells me that "bad things" could happen. That is a reasonable default assumption. If you wish to dive into the inner workings of symbol resolution, read this: https://akkadia.org/drepper/dsohowto.pdf >> Are there two instances of "foo" loaded? Yes. Unless they're th...
by Tub
Tue Nov 20, 2018 5:53 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9890
Views: 1823241

Re: Coding: Fleeting Thoughts

There are a bunch of nice css transforms, powerful enough to create a full animated 3d layout, if you like. When clicking somewhere, the browser will reverse those transforms, accurately determining which element was under the mouse pointer at the time of the event. At the same time, the browser wil...
by Tub
Wed Nov 14, 2018 5:51 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9890
Views: 1823241

Re: Coding: Fleeting Thoughts

More can be added as needed, of course (-pthread always works with my preferred configuration, and I'm not going out of my way to test vastly different configurations until someone else hits a snag). That seems reasonable. If you take a closer look at that SO thread you linked, you'll notice that t...
by Tub
Wed Nov 14, 2018 9:59 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9890
Views: 1823241

Re: Coding: Fleeting Thoughts

clang generally does not require -stdlib=libstdc++. That SO link is quite old, and the runtime error suggests that the then-recent version of libc++ simply lacked support. I think the autotools way would be to attempt different configurations until one compiles and works (starting with no parameters...
by Tub
Mon Oct 29, 2018 10:45 am UTC
Forum: Coding
Topic: avoiding coding "representation errors"
Replies: 19
Views: 7540

Re: avoiding coding "representation errors"

Jose, if you really wish to make the point that string concatenation is fine for html creation, please start by implementing that clean() function that you keep using, such that it produces correct and safe html in any case. Multiple people have explained to you why that's problematic, but you've ig...
by Tub
Fri Oct 26, 2018 10:40 pm UTC
Forum: Coding
Topic: avoiding coding "representation errors"
Replies: 19
Views: 7540

Re: avoiding coding "representation errors"

Because $start+$middle+$end could contain a $middle that accidentally closes a tag in $start? Creating html via string concatenation is bad for the same reason that creating database queries with string concatenation is bad . One leads to XSS attacks, the other to sql injection. The same problem ex...
by Tub
Fri Oct 26, 2018 3:02 pm UTC
Forum: Coding
Topic: avoiding coding "representation errors"
Replies: 19
Views: 7540

Re: avoiding coding "representation errors"

On the topic of "making wrong code look wrong", the two things that look wrong when I read the article are: * using string concatenation to generate html * cleanup code outside of a destructor or finally block Clean code is a rather subjective and debatable thing, but in this case I'd rath...
by Tub
Wed Oct 24, 2018 12:29 pm UTC
Forum: Fictional Science
Topic: Asimov's 3 laws
Replies: 17
Views: 3049

Re: Asimov's 3 laws

For reference: https://en.wikipedia.org/wiki/Three_Laws_of_Robotics As you'd expect, if you try to boil down a legal system into three simple statements, there will be loopholes. The three laws don't deal with conflicting human commands, they don't resolve all the moral dilemmas involving train trac...
by Tub
Sat Oct 20, 2018 9:42 am UTC
Forum: Science
Topic: disproof of boltzman brain?
Replies: 49
Views: 2952

Re: disproof of boltzman brain?

But if you looked at another planet and saw it was in a low entropy state, wouldn't your conclusion be that most likely life was on there? You snuck in a claim here, implying that earth has the lowest entropy of the planets in the solar system, because there's life on it. As far as I can see, our a...
by Tub
Fri Oct 19, 2018 9:18 pm UTC
Forum: Science
Topic: disproof of boltzman brain?
Replies: 49
Views: 2952

Re: disproof of boltzman brain?

I'll ignore all the unrelated and unscientific drivel about gods for now.. I'm a bit burnt out right now so these are not the clearest thoughts, but it seems intuitively wrong to me that specifically a fully-formed brain having (illusory) experiences or memories of a universe like ours is more likel...
by Tub
Fri Oct 19, 2018 8:15 pm UTC
Forum: Coding
Topic: Tree diagrams
Replies: 2
Views: 2961

Re: Tree diagrams

If you want to draw it yourself, recursively printing each node and its children with indentation is easy, like sin / + * alpha 2 5 57.29577951308232 For some actual graphical output, use a library. My favorite tool for graph drawing is graphviz; it does have a javascript port. d3 is also popular. A...
by Tub
Fri Oct 19, 2018 5:12 am UTC
Forum: Science
Topic: disproof of boltzman brain?
Replies: 49
Views: 2952

Re: disproof of boltzman brain?

So i read the wikipedia page on boltzman brains, saying that self-aware observers are probably spontaneous fluctuations. If our universe is in thermal equilibrium, with any low-entropy structures arising as the result of random fluctuations, then most observers would be bolzmann brains. That's a bi...
by Tub
Mon Oct 15, 2018 10:18 pm UTC
Forum: Coding
Topic: write a C++ please
Replies: 18
Views: 4148

Re: write a C++ please

Did I do good? You're mixing std::endl with "\n". The standard does not guarantee those to be equal. It's not going to be portable to my upcoming operating system, which uses utf8 emojis instead of ASCII control characters or ANSI escape sequences. Otherwise, I see no portability issues. ...
by Tub
Mon Oct 15, 2018 3:36 pm UTC
Forum: Coding
Topic: write a C++ please
Replies: 18
Views: 4148

Re: write a C++ please

You know, OP requested C++, so why don't you post C++ solutions? #include <iostream> #include <stdexcept> // We need to model the positive integers in a portable and standard compliant way. // We chose to use Peano Numbers for the following reason: // * There are no overflows, hence there's no undef...
by Tub
Thu Oct 11, 2018 4:54 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9890
Views: 1823241

Re: Coding: Fleeting Thoughts

A shell can only do very limited selection, because it isn't a terminal. It simply doesn't know (or care) what's on your screen at the moment. A shell can only copy parts of the current command line - and even bash can do that. It'll go into a bash-internal buffer though, so you cannot copy/paste be...
by Tub
Fri Oct 05, 2018 7:32 pm UTC
Forum: Mathematics
Topic: Equivalency on Mutliple Intervals
Replies: 10
Views: 9044

Re: Equivalency on Mutliple Intervals

Step 1) write down the requirements in a precise, mathematical notation Step 2) write the theorem down in a precise, mathematical notation Step 3) be understood. I think you're thinking about something that can be proven, but what you've written is ambiguous nonsense. The first step to tackle the pr...
by Tub
Thu Oct 04, 2018 11:32 pm UTC
Forum: Individual XKCD Comic Threads
Topic: 2054: "Data Pipeline"
Replies: 30
Views: 3648

Re: 2054: "Data Pipeline"

Contest Time! Write a one-line shell command (80 char or less) using all of grep, sed, and awk that actually does something recognizable. Prizes will be given on the basis of both style and output. Points taken off if the output is useful. Judges' determination of "useful" is final. Here'...
by Tub
Thu Oct 04, 2018 4:10 pm UTC
Forum: Coding
Topic: Is is better to think of methods as active (X does Y to Z) or passive (Y is done to Z by X)?
Replies: 4
Views: 1766

Re: Is is better to think of methods as active (X does Y to Z) or passive (Y is done to Z by X)?

One more point I wish to make. We've talked about the low-level details, but we also need to consider the proper top-down approach. This is based on a few year of experience developing games, and inheriting projects from other people developing games. MVC is a good thing. Even if you're just running...
by Tub
Wed Oct 03, 2018 1:28 pm UTC
Forum: Coding
Topic: Is is better to think of methods as active (X does Y to Z) or passive (Y is done to Z by X)?
Replies: 4
Views: 1766

Re: Is is better to think of methods as active (X does Y to Z) or passive (Y is done to Z by X)?

Disclaimer: good design is more of an art than a science, and anything that's not a technical requirement is highly subjective. Strive for consistency. First of all, Player::tackle(Player &) should cause the 'this' player to tackle the player passed via parameter, never the other way around. If...
by Tub
Thu Sep 27, 2018 12:33 pm UTC
Forum: Science
Topic: Is the universe a black hole? No
Replies: 26
Views: 4235

Re: Is the universe a black hole? No

Is there any school of thought that says "Look, we currently have very-little-to-no idea what it is like inside a black hole, in physical reality, so the question is unverifiable either way and therefore meaningless." ? We have zero experimental evidence about the inside of a black hole, ...
by Tub
Mon Sep 24, 2018 6:00 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9890
Views: 1823241

Re: Coding: Fleeting Thoughts

Errors coming from one module typically indicate a particular failure, usually handled by just waiting for a device controller (represented by mod_1_object) to auto-restart and trying again. "typically"? Is there an exception that cannot be handled by retrying? Exceptions for invalid argu...
by Tub
Sat Aug 25, 2018 11:10 am UTC
Forum: Individual XKCD Comic Threads
Topic: 2016: "OEIS Submissions"
Replies: 31
Views: 6620

Re: 2016: "OEIS Submissions"

Also, you're supposed to put the BWT before your RLE. Why RLE first? bzip has two RLE steps. RLE -> BTW -> MTF -> RLE Both RLEs have different encodings and maximum run lengths. The first one is supposed to guard against worst-case inputs; due to its inefficient (but fast) encoding it will actually...
by Tub
Tue Jul 31, 2018 8:57 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9890
Views: 1823241

Re: Coding: Fleeting Thoughts

I've done some benchmarks. const LOOPS = 10000000; const ITERATIONS = 10; (function() { const PROP = '_private_data'; let o = {}; bench('prop-single', function() { o[PROP] = { a: 1, b: 1 }; }, function() { let p = o[PROP]; let sum = p.a + p.b; p.a = p.b; p.b = sum; } ); console.log(o[PROP].a); })();...
by Tub
Tue Jul 31, 2018 5:39 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9890
Views: 1823241

Re: Coding: Fleeting Thoughts

I'm aware, but being collision-free and non-enumerable is enough to prevent accidental bugs when multiple separate modules mess with the same object. You can access or change private members in Java with the reflection API, but we still consider them private. You can mangle symbol properties in Java...
by Tub
Tue Jul 31, 2018 11:43 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9890
Views: 1823241

Re: Coding: Fleeting Thoughts

Has anyone found a valid use case for a WeakMap in JavaScript? It's supposed to prevent memory leaks, by allowing you to attach data to objects without leaking the data. The example for a key is often a DOM element, because those tend to disappear every now and then. let wm = new WeakMap(); let e = ...
by Tub
Fri Jul 06, 2018 11:56 pm UTC
Forum: Individual XKCD Comic Threads
Topic: 2016: "OEIS Submissions"
Replies: 31
Views: 6620

Re: 2016: "OEIS Submissions"

psst… use a run-length encoder first. Backreferences are just as good as run-length encoding, the limit here is that common implementations (zip/gzip/deflate etc) have a fixed bit-size for the "length" parameter. For example, a backreference in DEFLATE is at least 24 bits long but has jus...
by Tub
Wed Jul 04, 2018 11:31 pm UTC
Forum: Mathematics
Topic: Question I Stumbled Across
Replies: 1
Views: 2123

Re: Question I Stumbled Across

Each step is a transformation of a 2-vector (a, b) into a new 2-vector (a+b, a). This is a simple linear transformation, so you can find a 2x2-matrix M such that M * (a, b) = (a+b, a) = T(a, b) Repeated application of a linear transformation is simply repeated multiplication T^n(a, b) = M * M * ... ...
by Tub
Sun Jun 10, 2018 9:17 am UTC
Forum: Computer Science
Topic: Help me prove (or disprove) the following problem NP-hard
Replies: 7
Views: 4497

Re: Help me prove (or disprove) the following problem NP-hard

But there is no trivial assignment at the start. If the assignment w2={j1} is tried, then no solution is possible. w1={j2, j5} w2={j1, j4} w3={j3, j6} I'm a bit short on time right now, so that's all I'm going to add. Implementing the algorithm might find us a better counter-example. This just scre...
by Tub
Sun Jun 10, 2018 12:52 am UTC
Forum: Computer Science
Topic: Help me prove (or disprove) the following problem NP-hard
Replies: 7
Views: 4497

Re: Help me prove (or disprove) the following problem NP-hard

Your reduction is invalid - you cannot "add a vertex of the worker's color"; the coloring problem starts with an entirely uncolored graph. We don't know the complexity of your variant of the coloring problem - adding constraints can both increase or decrease the complexity. Doesn't matter ...
by Tub
Mon May 28, 2018 6:48 pm UTC
Forum: Science
Topic: How much is 1e340 j of energy?
Replies: 19
Views: 3268

Re: How much is 1e340 j of energy?

(Besides, I can write "Graham's number" on the back of a postage stamp. How big could it be?) Roughly twice as big as 1e340, because I can write 1e340 on the back of that stamp twice. :roll: There is probably some plank minimum number of joules below which the concept stops making sense (...
by Tub
Wed May 23, 2018 8:53 am UTC
Forum: What If?
Topic: What-If 0157: "Earth-Moon Fire Pole"
Replies: 30
Views: 12946

Re: What-If 0157 "Earth-Moon Fire Pole"

That last image eloquently illustrates one of the problems inherent in a 2 dimensional world. The only option for the poor surface folk is to attempt to outrun the pole or find an underground bunker instead of simply stepping to the side. They can't really outrun the pole when there's an unpassable...
by Tub
Thu May 03, 2018 9:26 pm UTC
Forum: Science
Topic: Quick Burning Paper
Replies: 47
Views: 6730

Re: Quick Burning Paper

You could spell out your information will 2mm ballbearings on a huge flat floor, like a warehouse. Men in Black come calling? Just tilt the floor by a degree or two. a suspicious pattern of dust-free spots emerges on the floor. You really need to turn that warehouse upside-down and shake it a coupl...
by Tub
Thu May 03, 2018 12:30 pm UTC
Forum: Coding
Topic: In search of a good build system for C++
Replies: 5
Views: 2577

Re: In search of a good build system for C++

If your build system is as simple as "compile every single file in this directory into an executable", then a simple Makefile will do. See here, for example . This has minimal dependencies, but isn't easily portable to toolchains that don't use gcc/clang's command line syntax. For example,...
by Tub
Thu May 03, 2018 10:34 am UTC
Forum: Science
Topic: Quick Burning Paper
Replies: 47
Views: 6730

Re: Quick Burning Paper

Technically , nothing a person does can actually destroy information due to the Laws of Thermodynamics. Being true to the comic, everything following "Technically" is complete nonsense. As far as I know, you still cant beat one-time-pads for secure encryption. All asymmetrical cyphers rel...

Go to advanced search