Search found 417 matches

Sun Jan 13, 2019 10:24 am UTC
Forum: Mathematics
Topic: Math: Fleeting Thoughts
Replies: 408
Views: 132444

Re: Math: Fleeting Thoughts

1 degree is about -25.56 dB. The units check out.
Fri Jan 11, 2019 7:03 pm UTC
Forum: Mathematics
Topic: Math: Fleeting Thoughts
Replies: 408
Views: 132444

Re: Math: Fleeting Thoughts

Mon Jan 07, 2019 6:03 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9907
Views: 1856773

Re: Coding: Fleeting Thoughts

Collins Scrabble Words 2015 (276,643 words) (not linking it here, apparently word lists can be copyrighted..) The largest component has 85,526 words. Everything else is in components with 100 or less. 44692 words have no neighbour at all; making it very tempting to sneak one of them into the word ga...
Fri Jan 04, 2019 12:25 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9907
Views: 1856773

Re: Coding: Fleeting Thoughts

The longest path problem is NP-hard. No good approximations are known. I wouldn't advise trying to solve this exactly on >100k nodes. Memory is not going to be a problem, but there's just too many possible paths to check them all. The good news is that we can place an upper bound k on the amount of ...
Tue Jan 01, 2019 2:03 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9907
Views: 1856773

Re: Coding: Fleeting Thoughts

To me that reads "initialize no members to a particular value" i.e. don't initialize anything. Why did the C people decide that all unlisted members in an initializer list should be zeroed? I wasn't part of that decision, but I can take a guess. An initializer list is not a shorthand for ...
Mon Dec 31, 2018 12:27 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9907
Views: 1856773

Re: Coding: Fleeting Thoughts

It would have performance impact on some code bases. You'd have to add a way to create uninitialized data for those that care. But there already is a compatible and standardized way to specify whether you want initialized or uninitialized memory for your struct. To create uninitialized data you wri...
Wed Dec 19, 2018 12:23 pm UTC
Forum: Science
Topic: What is my Exact Mailing Address?
Replies: 11
Views: 894

Re: What is my Exact Mailing Address?

Your exact mailing address depends on the address format expected by your postal service. Name, Street, City, State, Country seems popular for classic parcel delivery, but I'm sure there are some delivery methods that prefer lat/lon coordinates. To satisfy your curiosity, the hierarchy beyond that i...
Wed Dec 12, 2018 3:01 pm UTC
Forum: Science
Topic: Building a chair out of glue
Replies: 6
Views: 648

Re: Building a chair out of glue

The premise is a bit simplified. Wood is likely to split along the grain, and its strength depends a lot on the orientation of the wood and the type of force you apply. If you apply forces that the wood is weak against, then it'll often break along the grain instead of along a glued seam. For differ...
Wed Dec 05, 2018 5:13 pm UTC
Forum: Science
Topic: disproof of boltzman brain?
Replies: 55
Views: 4660

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...
Tue Dec 04, 2018 12:47 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9907
Views: 1856773

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...
Mon Dec 03, 2018 11:53 pm UTC
Forum: Gaming
Topic: I need a Game Recommendation
Replies: 1559
Views: 363491

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...
Mon Dec 03, 2018 11:08 am UTC
Forum: Science
Topic: How does calibrating hygrometers with salt work?
Replies: 4
Views: 676

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...
Sat Dec 01, 2018 12:29 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9907
Views: 1856773

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...
Wed Nov 21, 2018 8:53 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9907
Views: 1856773

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...
Wed Nov 21, 2018 6:34 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9907
Views: 1856773

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...
Tue Nov 20, 2018 5:53 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9907
Views: 1856773

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...
Wed Nov 14, 2018 5:51 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9907
Views: 1856773

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...
Wed Nov 14, 2018 9:59 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9907
Views: 1856773

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...
Mon Oct 29, 2018 10:45 am UTC
Forum: Coding
Topic: avoiding coding "representation errors"
Replies: 20
Views: 9287

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...
Fri Oct 26, 2018 10:40 pm UTC
Forum: Coding
Topic: avoiding coding "representation errors"
Replies: 20
Views: 9287

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...
Fri Oct 26, 2018 3:02 pm UTC
Forum: Coding
Topic: avoiding coding "representation errors"
Replies: 20
Views: 9287

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...
Wed Oct 24, 2018 12:29 pm UTC
Forum: Fictional Science
Topic: Asimov's 3 laws
Replies: 17
Views: 3848

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...
Sat Oct 20, 2018 9:42 am UTC
Forum: Science
Topic: disproof of boltzman brain?
Replies: 55
Views: 4660

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...
Fri Oct 19, 2018 9:18 pm UTC
Forum: Science
Topic: disproof of boltzman brain?
Replies: 55
Views: 4660

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...
Fri Oct 19, 2018 8:15 pm UTC
Forum: Coding
Topic: Tree diagrams
Replies: 2
Views: 3238

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...
Fri Oct 19, 2018 5:12 am UTC
Forum: Science
Topic: disproof of boltzman brain?
Replies: 55
Views: 4660

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...
Mon Oct 15, 2018 10:18 pm UTC
Forum: Coding
Replies: 18
Views: 5153

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. ...
Mon Oct 15, 2018 3:36 pm UTC
Forum: Coding
Replies: 18
Views: 5153

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...
Thu Oct 11, 2018 4:54 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9907
Views: 1856773

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...
Fri Oct 05, 2018 7:32 pm UTC
Forum: Mathematics
Topic: Equivalency on Mutliple Intervals
Replies: 10
Views: 9554

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...
Thu Oct 04, 2018 11:32 pm UTC
Topic: 2054: "Data Pipeline"
Replies: 30
Views: 4459

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'...
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: 2153

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...
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: 2153

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...
Thu Sep 27, 2018 12:33 pm UTC
Forum: Science
Topic: Is the universe a black hole? No
Replies: 26
Views: 5164

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, ...
Mon Sep 24, 2018 6:00 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9907
Views: 1856773

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...
Sat Aug 25, 2018 11:10 am UTC
Topic: 2016: "OEIS Submissions"
Replies: 31
Views: 7089

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...
Tue Jul 31, 2018 8:57 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9907
Views: 1856773

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); })();...
Tue Jul 31, 2018 5:39 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9907
Views: 1856773

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...
Tue Jul 31, 2018 11:43 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9907
Views: 1856773

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 = ...
Fri Jul 06, 2018 11:56 pm UTC