Search found 388 matches

by Tub
Fri Oct 05, 2018 7:32 pm UTC
Forum: Mathematics
Topic: Equivalency on Mutliple Intervals
Replies: 9
Views: 616

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: 1599

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: 563

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: 563

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: 16
Views: 1350

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: 9870
Views: 1779988

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: 4681

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: 9870
Views: 1779988

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: 9870
Views: 1779988

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: 9870
Views: 1779988

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: 4681

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: 1496

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: 3633

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: 3633

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: 2221

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: 11321

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: 4910

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: 1798

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: 4910

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...
by Tub
Wed May 02, 2018 2:23 pm UTC
Forum: Science
Topic: Quick Burning Paper
Replies: 47
Views: 4910

Re: Quick Burning Paper

I think that any cryptographic approach to secrecy is going to be vastly superior to an option where you have to be physically present to set something on fire. It's probably superior against most attacks, but it has a downside: encryption does not destroy information. If a spy runs off with an enc...
by Tub
Sun Apr 29, 2018 5:00 pm UTC
Forum: The Help Desk
Topic: Compressing video and photo or I lose my job
Replies: 7
Views: 1776

Re: Compressing video and photo or I lose my job

Most video or audio formats are already compressed. Applying a lossless compression algorithm (like zip or rar) won't do anything, as you've seen.

If you need them to be smaller, you need to re-encode them with a different lossy method, but that's going to degrade quality.
by Tub
Wed Apr 25, 2018 4:06 pm UTC
Forum: Science
Topic: Science-based what-if questions
Replies: 622
Views: 90038

Re: Science-based what-if questions

If such a black hole were to instantly evaporate into radiation, that would be equivalent to 100 earth-sized balls of TNT going off. "Fortunately", such a black hole would actually take 2.7e24 years to evaporate. True if gradual evaporation via hawking radiation is the only relevant effec...
by Tub
Tue Apr 24, 2018 2:09 pm UTC
Forum: Science
Topic: Science-based what-if questions
Replies: 622
Views: 90038

Re: Science-based what-if questions

There are several lower bounds for black hole size. The uncertainty principle says that you cannot confine mass in an arbitrarily small volume, so any black hole's size (schwarzschild radius) cannot be smaller than the planck length (which is tiny), but such a black hole would have a mass of planck ...
by Tub
Mon Apr 23, 2018 6:26 pm UTC
Forum: Science
Topic: Science-based what-if questions
Replies: 622
Views: 90038

Re: Science-based what-if questions

If Gardevoir is capable of conjuring objects inside his crank case, it really wouldnt have to be a black hole to wreck his day. How about just a modest sized iron canonball? How about 1kg of glitter in the driver's compartment? Bigger takes longer, and an earth-radius black hole would require almos...
by Tub
Mon Apr 23, 2018 10:23 am UTC
Forum: Computer Science
Topic: Analysis of the Java RNG
Replies: 4
Views: 1617

Re: Analysis of the Java RNG

There's plenty of research about Linear Congruential Generators, if you feel like diving in. They have a few weaknesses, but AFAIK none that would help you here. The state of the RNG has 48 bits, thus only 2^48 of the possible 2^64 different longs can ever be returned by nextLong. According to the d...
by Tub
Wed Apr 18, 2018 8:34 am UTC
Forum: Computer Science
Topic: What to learn to be able to make some money?
Replies: 18
Views: 3817

Re: What to learn to be able to make some money?

WanderingLinguist wrote:[...]

Thank you for your insights, that was helpful.

(My phone is for phone calls, alarm clock, notes and a web browser. I'm totally out of the loop with the app market.)
by Tub
Tue Apr 17, 2018 9:50 am UTC
Forum: Computer Science
Topic: What to learn to be able to make some money?
Replies: 18
Views: 3817

Re: What to learn to be able to make some money?

Speaking for my part of the industry (keep in mind, this is not general advice): Mobile app development is big these days, and there's a shortage of programmers who can go beyond the simple "static" mobile app that just duplicates a web site. If I may pop in for a quick question, what's y...
by Tub
Thu Apr 05, 2018 8:49 am UTC
Forum: Computer Science
Topic: What to learn to be able to make some money?
Replies: 18
Views: 3817

Re: What to learn to be able to make some money?

What Yakk said isn't entirely wrong, but only a small part of all software development is meant to produce software sold to customers. Most software development is meant to solve some internal business need - automating processes, monitoring work results, data mining, totally boring business databas...
by Tub
Wed Apr 04, 2018 12:20 am UTC
Forum: Coding
Topic: An amateur has tried to build a website in raw HTML
Replies: 56
Views: 9728

Re: An amateur has tried to build a website in raw HTML

Warning, strong opinions about jQuery ahead. I did use jQuery a lot back in the day, when it had its uses. But believe it or not, for a couple of years I've been programming without ever thinking "This problem would be easier to solve with jQuery." I haven't had much issues with br...
by Tub
Tue Apr 03, 2018 2:44 pm UTC
Forum: Computer Science
Topic: What to learn to be able to make some money?
Replies: 18
Views: 3817

Re: What to learn to be able to make some money?

The first thing you should learn is to write code and comments in english. Always. If you want feedback from others, then english is the one language that everyone in the tech world understands. You also need to get rid of the Allman brace style. As much as I love that style, there are some unfortun...
by Tub
Tue Apr 03, 2018 1:19 pm UTC
Forum: Coding
Topic: An amateur has tried to build a website in raw HTML
Replies: 56
Views: 9728

Re: An amateur has tried to build a website in raw HTML

I have a suggestion which is not directly "easy to program" because you have to learn some new things first, but: in the long term, you can make programming (in JavaScript) easier for yourself by using some libraries. You could start with jQuery and Lodash . jQuery is largely obsolete (un...
by Tub
Sat Mar 31, 2018 6:35 pm UTC
Forum: Science
Topic: Science-based what-if questions
Replies: 622
Views: 90038

Re: Science-based what-if questions

A dark matter black hole may or may not be a tiny bit darker than a regular black hole :roll: Seriously, if you put heavy stuff within a region smaller than its schwarzschild radius, then you'll get a black hole. Dark matter has mass, so it'll work. From the outside, it won't look any different - al...
by Tub
Tue Mar 27, 2018 1:09 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9870
Views: 1779988

Re: Coding: Fleeting Thoughts

There's extensive documentation about the calculation and interpretation of those values. I bet you haven't produced a single UML diagram, barely did any testing, and there's zero documentation, so your 700 loc aren't finished yet. Sloccount is also highly inaccurate in small projects. Writing the f...
by Tub
Fri Mar 23, 2018 9:24 am UTC
Forum: Science
Topic: Quantum Question
Replies: 110
Views: 15327

Re: Quantum Question

Assuming determinism and no cp-violations, time reversal gets you back to exactly the previous state, not to a different random low-entropy state. In a hypothetical classical world, time reversal means turning those particles around by negating all velocities. In a quantum world, time reversal is a ...
by Tub
Thu Mar 22, 2018 1:46 pm UTC
Forum: Science
Topic: Quantum Question
Replies: 110
Views: 15327

Re: Quantum Question

If you understand the state of the universe as the whole wave function, then its temporal evolution is deterministic (see: Schrödinger equation ) and it is time reversible. Randomness only appears when you try to force said wave function into a classical notion of particles with fixed positions and ...
by Tub
Thu Mar 22, 2018 10:34 am UTC
Forum: Science
Topic: Quantum Question
Replies: 110
Views: 15327

Re: Quantum Question

it implies that there are just as many possible states of the universe that, left to their own devices, would tend toward lower entropy, as there are possible states of the universe that tend toward higher entropy. If you pick a random configuration with a given low entropy, then you'll find that b...
by Tub
Fri Mar 09, 2018 8:13 am UTC
Forum: Science
Topic: Science-based what-if questions
Replies: 622
Views: 90038

Re: Science-based what-if questions

You cannot have a single giant particle in this universe. You cannot push multiple matter particles together as close as you like, either. The closest you can compress matter (without converting it into something else) is what you'll find in a neutron star. So for some fun with actual science, I rec...
by Tub
Mon Mar 05, 2018 10:34 pm UTC
Forum: Mathematics
Topic: My take on Godel's incompleteness theorems
Replies: 42
Views: 7388

Re: My take on Godel's incompleteness theorems

Is what is true/truth with mathematicians not necessarily true/truth in the empirical world of non-mathematician mankind? In a mathematical formal system, you start with a set of axioms, and you try to figure out everything that follows from those axioms. An axiom is just a premise, something that ...
by Tub
Wed Feb 28, 2018 2:01 pm UTC
Forum: The Help Desk
Topic: Mac hard disk corruption
Replies: 1
Views: 1544

Re: Mac hard disk corruption

Even booting from the corrupt drive will cause further writes to the drive. If that drive contains the only copies of important files, I'd avoid that. See if you can get your time machine working before you touch the corrupt mac again. If the time machine is lost, the first step would be to make a c...
by Tub
Tue Feb 27, 2018 8:11 am UTC
Forum: Individual XKCD Comic Threads
Topic: 1960: "Code Golf"
Replies: 25
Views: 4624

Re: 1960: "Code Golf"

The convention should've been "don't write a language where..." Unfortunately, end-user-programmers don't get to design their own language[...] End users can choose to enable compiler flags that turn accidental assignments into warnings or errors. For scripting languages, the same can be ...

Go to advanced search