Search found 469 matches

by Tub
Tue Feb 27, 2018 8:11 am UTC
Forum: Individual XKCD Comic Threads
Topic: 1960: "Code Golf"
Replies: 25
Views: 6783

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 ...
by Tub
Sun Feb 25, 2018 5:53 pm UTC
Forum: Fictional Science
Topic: Magitech society needs a heat engine
Replies: 41
Views: 13489

Re: Magitech society needs a heat engine

Hm. Is a high heat capacity a good thing? I thought a lower heat capacity means less energy is required to generate a particular temperature difference? The carnot efficiency is independent of the working fluid. Lower heat capacity just means that you need a larger volume to transform the same amou...
by Tub
Fri Feb 23, 2018 5:17 pm UTC
Forum: Fictional Science
Topic: Magitech society needs a heat engine
Replies: 41
Views: 13489

Re: Magitech society needs a heat engine

A heat engine requires neither combustion nor vaporization. It requires a hot end, a cold end and a working substance in between. Taking any real-world heat engine and replacing coal fire with a magic spell should be straightforward. Look at engines or power plants developed by humanity when we had ...
by Tub
Wed Feb 21, 2018 10:39 pm UTC
Forum: Fictional Science
Topic: Airlock full of water exposed to vacuum
Replies: 10
Views: 5997

Re: Airlock full of water exposed to vacuum

Haven't seen the movie (not that popular, apparently), but here's the phase diagram of water: https://upload.wikimedia.org/wikipedia/commons/0/08/Phase_diagram_of_water.svg There are plenty of youtube videos of water in a vacuum chamber, and in many of them the water will boil violently for a while,...
by Tub
Tue Feb 20, 2018 12:53 pm UTC
Forum: Individual XKCD Comic Threads
Topic: 1957: "2018 CVE List"
Replies: 36
Views: 11986

Re: 1957: "2018 CVE List"

I'm glad the pedants decided to step forward. Now go start working on that list!
by Tub
Tue Feb 20, 2018 8:29 am UTC
Forum: Individual XKCD Comic Threads
Topic: 1957: "2018 CVE List"
Replies: 36
Views: 11986

Re: 1957: "2018 CVE List"

Still, I contend that in analysis of algorithmic complexity, the n is usually the length of the input , so n is already the log of the input value, i.e. the prime itself. On that basis, by your argument, the algorithm for factorising a known prime would be O(n). I usually expect to read O(b) if we'...
by Tub
Mon Feb 19, 2018 2:03 pm UTC
Forum: Individual XKCD Comic Threads
Topic: 1957: "2018 CVE List"
Replies: 36
Views: 11986

Re: 1957: "2018 CVE List"

orthogon wrote:You can factorise primes in O(1) if you know they're primes. Non-primes are trickier to factorise.

Well, a prime number n has O(log(n)) bits. If numpy makes a copy somewhere, then the algorithm is O(log(n)) as stated in the comic.
by Tub
Wed Feb 07, 2018 8:05 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9989
Views: 1999019

Re: Coding: Fleeting Thoughts

Yeah, that's the idea. a is no longer a local variable, but a a global variable, i.e. property of the global object. Properties can have getters! Getting the global object in a compatible way is tricky, but possible: call a function without a context, then it'll use the global object as 'this'. Exce...
by Tub
Wed Feb 07, 2018 9:36 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9989
Views: 1999019

Re: Coding: Fleeting Thoughts

Points to hotaru for this one. When comparing an object to a native value, javascript will first try to "unbox" the object, which is why new Boolean(false) == false and 42 == [42]. Unboxing may also include calling valueOf() or toString(). But you don't need unboxing. You don't need 'a' to...
by Tub
Tue Feb 06, 2018 10:46 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9989
Views: 1999019

Re: Coding: Fleeting Thoughts

I'd say that Flumble got it, but there's something wrong with that list. For example: > 2: ["0", false, [1]] b == c doesn't hold, because false == [1] is false. There are other examples involving [1] that appear wrong. The gist however is that type coercion in JavaScript is weird , and Flu...
by Tub
Tue Feb 06, 2018 12:13 pm UTC
Forum: Science
Topic: Expansion in the long... (very) long term
Replies: 9
Views: 4217

Re: Expansion in the long... (very) long term

If space keeps expanding then yes, our "local bubble" will get smaller and smaller until eventually it only contains the milky way, and then eventually only the solar system...but it doesnt stop. If the future of our universe contains a big rip, then it'll be very far in the future, based...
by Tub
Tue Feb 06, 2018 12:12 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9989
Views: 1999019

Re: Coding: Fleeting Thoughts

I stumbled over this special case again, so here's a riddle for you. Insert values into this JavaScript snippet to trigger the condition. var a = ...; var b = ...; var c = ...; if (a == b && a == c && b != c) console.log("what?");
by Tub
Mon Feb 05, 2018 4:56 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9989
Views: 1999019

Re: Coding: Fleeting Thoughts

It's one solution, though. I wouldn't define a full Minecraft-like environment as a Dictionary-indexed 'array' with so many cells filled (even if air=null). Unsurprisingly, there's been quite a bit of research on the best in-memory structure for minecraft-like worlds, and they're interesting to rea...
by Tub
Mon Feb 05, 2018 9:18 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9989
Views: 1999019

Re: Coding: Fleeting Thoughts

Requiring string manipulation (thus possibly memory allocations), hash calculations and several indirects to get a value will have a performance impact. If your algorithm is lots of accesses and few calculations (like matrix multiplication), that is going to be noticeable. I don't know much about py...
by Tub
Wed Jan 24, 2018 10:47 am UTC
Forum: The Help Desk
Topic: Best Anti-virus Software of Linux
Replies: 10
Views: 6745

Re: Best Anti-virus Software of Linux

[..]the fact that the vast majority of the time, you're safer using an AV scanner than without if you're going to use the internet So far, that's an unproven claim, and it's a claim I keep disagreeing with. But that's not the point I was making. The point I was making is that you're safer using san...
by Tub
Tue Jan 23, 2018 5:24 pm UTC
Forum: The Help Desk
Topic: Keyboard issue
Replies: 5
Views: 4211

Re: Keyboard issue

Does tab still work as tab, or has that suddenly become ctrl? If the keys are switched, I'd just switch them back via software (~/.Xmodmap on linux). You know, take the lazy solution . Did you do a cold reboot (remove power and battery for a minute), then enter the bios directly? Still swapped? Then...
by Tub
Tue Jan 23, 2018 1:16 am UTC
Forum: The Help Desk
Topic: Best Anti-virus Software of Linux
Replies: 10
Views: 6745

Re: Best Anti-virus Software of Linux

Well, nothing's going to stop a PEBCAK with an admin account anyway. Maybe we need to sandbox the user instead of the software? :roll: microsoft's statement about meltdown/AV : During testing, we discovered that some third-party applications have been making unsupported calls into Windows kernel mem...
by Tub
Mon Jan 22, 2018 11:12 pm UTC
Forum: The Help Desk
Topic: Best Anti-virus Software of Linux
Replies: 10
Views: 6745

Re: Best Anti-virus Software of Linux

a good, solid AV tool I wasn't aware such a thing existed. All the major ones had catastrophic bugs at one point or another, where one would've been better off not running an AV tool at all. Remember, just this month, when meltdown patches couldn't be installed while certain AV tools were running? ...
by Tub
Mon Jan 22, 2018 6:58 pm UTC
Forum: The Help Desk
Topic: Best Anti-virus Software of Linux
Replies: 10
Views: 6745

Re: Best Anti-virus Software of Linux

I wasn't aware that "being careful" will in any way protect against malware, unless "being careful" means "doing a complete audit of the delivered binary before installing". Authors sell out and bundle malware, servers get hacked and downloads are replaced, software oft...
by Tub
Fri Jan 19, 2018 12:13 pm UTC
Forum: Computer Science
Topic: Finding a subgraph with given properties.
Replies: 3
Views: 5110

Re: Finding a subgraph with given properties.

Per your description, the smallest subgraph satisfying your requirements is the empty graph. I assume you're starting with either a product or leaf, and you're looking for the smallest subgraph telling you how to build that product with the least amount of processing steps? And if I understand your ...
by Tub
Wed Jan 10, 2018 9:53 pm UTC
Forum: Mathematics
Topic: PI - Invention or Discovery
Replies: 88
Views: 18150

Re: PI - Invention or Discovery

Your nose is a hole in your body for the ingress and egress of air. By definition, it's a vent. If you put your finger in there, you've also in-vented it.
by Tub
Sun Jan 07, 2018 9:27 pm UTC
Forum: Mathematics
Topic: PI - Invention or Discovery
Replies: 88
Views: 18150

Re: PI - Invention or Discovery

It was discovered that the ratio between a circle's circumference and diameter is a constant. Eventually someone invented a name for it.

Now make up and debate something more meaningful.
by Tub
Thu Dec 28, 2017 10:22 pm UTC
Forum: The Help Desk
Topic: Win 10: reading old hard drive w/USB to SATA cable
Replies: 8
Views: 7650

Re: Win 10: reading old hard drive w/USB to SATA cable

That's a 3.5" drive. An USB port provides enough power for many 2.5" drives, but most 3.5" drives exceed 4.5W during load, and IIRC they often require 10-25W for spin up. What you're seeing on windows is probably some fake hardware information provided by the converter cable, not data...
by Tub
Sat Dec 16, 2017 11:05 am UTC
Forum: Coding
Topic: What sort of language do you think was used to make Xcom Apocalypse?
Replies: 26
Views: 13584

Re: What sort of language do you think was used to make Xcom Apocalypse?

I think your fear of "limitations" is unfounded. Sure, there are some very specific game engines meant to support only a single genre, and they won't help you much. But there are also game engines specifically designed to work for a variety of game types. They're versatile and extensible. ...
by Tub
Fri Dec 15, 2017 7:37 pm UTC
Forum: Science
Topic: Computer Graphics from Chaos
Replies: 6
Views: 2138

Re: Computer Graphics from Chaos

Arent some common data-compression techniques fractal based? Most of the data you're handling is not the result of a simple fractal. It's not a suitable approach for general purpose compression, and I'm not aware of any common software that used it. There's been research though: https://en.wikipedi...
by Tub
Fri Dec 15, 2017 7:25 pm UTC
Forum: Coding
Topic: What sort of language do you think was used to make Xcom Apocalypse?
Replies: 26
Views: 13584

Re: What sort of language do you think was used to make Xcom Apocalypse?

I think the most important knowledge you lack is an appreciation for how complex development actually is. XCom was developed by dozens of experienced developers over several years, and they weren't slacking. You won't live long enough to even match their work on your own. I understand the desire to ...
by Tub
Fri Dec 15, 2017 12:16 pm UTC
Forum: Science
Topic: Computer Graphics from Chaos
Replies: 6
Views: 2138

Re: Computer Graphics from Chaos

Really short version, why does this not take up a huge amount of processing power? You don't use these algorithms to render each frame, you use them to generate models and textures, and then you use those models and textures for rendering as usual. For complex algorithms, you can pre-calculate ever...
by Tub
Thu Dec 14, 2017 4:28 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9989
Views: 1999019

Re: Coding: Fleeting Thoughts

No loop, just a "where in" clause which apparently caused the actual read rows to grow exponentially as the number of items in the list grew. WHERE IN (1, 2, 3, 4) or WHERE IN (SELECT ...) ? The first shouldn't be much of a problem for short lists, but you'd need to figure out if longer l...
by Tub
Wed Dec 13, 2017 11:12 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9989
Views: 1999019

Re: Coding: Fleeting Thoughts

Well, they are open source... And so is Linux. That doesn't mean it is reasonable to learn how Linux kernel overall architecture design by reading the source. ;) Eh, if you wish to save time, just skip the comments. ;) Source, Sink and Pipe are 3 kinds of graphs. They can be composed in certain way...
by Tub
Tue Dec 12, 2017 12:39 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9989
Views: 1999019

Re: Coding: Fleeting Thoughts

I've poked at them, but documentation tends to focus on *using* them, not how they where written and how they work. Well, they are open source... I'm not entriely sure I read your notation right, but you seem to try mixing the two fundamental control principles of streams: push and pull. In push-ba...
by Tub
Wed Nov 29, 2017 5:31 am UTC
Forum: Science
Topic: Artificial Stupidity
Replies: 52
Views: 8323

Re: Artificial Stupidity

Evidence can be anything that points toward, suggests, or otherwise indicates the presence of souls. No, that definition is too broad in practice. Evidence must have sufficient persuasive power, or it's useless. Take Elvis for example. There are people who believe that he's alive. If we accept the ...
by Tub
Wed Nov 29, 2017 3:17 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9989
Views: 1999019

Re: Coding: Fleeting Thoughts

Why would they need to be declared const? That would prevent the variables from being bound to new values, but PHP imposes no such constraints. $a = 3; // valid js (but it's a global), valid php var $a = 3; // valid js, invalid php let $a = 3; // valid js, invalid php const a = 3; // valid js, vali...
by Tub
Tue Nov 28, 2017 2:52 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9989
Views: 1999019

Re: Coding: Fleeting Thoughts

Yeah, I already checked, the only way to solve it in a syntax compatible way is to require all variables to be declared const :roll:
by Tub
Tue Nov 28, 2017 2:24 pm UTC
Forum: Science
Topic: Artificial Stupidity
Replies: 52
Views: 8323

Re: Artificial Stupidity

Humans are not evolutionary selected to be smart, or to do high-level math in their head. We're selected for survival and reproducing, and higher intelligence has historically not been a major factor for that. With AIs on the other hand, we can control what they're selected for. Humans have a genera...
by Tub
Mon Nov 27, 2017 1:39 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9989
Views: 1999019

Re: Coding: Fleeting Thoughts

I meant to end the post on a flippant twist, but.. yeah, sarcarsm and the internet. Apologies. I do encourage your friend to extend the documentation though. He's clearly trying to get others to use the code, with a name and no less than two domains and everything, but then he refuses to even mentio...
by Tub
Sun Nov 26, 2017 5:34 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9989
Views: 1999019

Re: Coding: Fleeting Thoughts

This wasn't a lot of code, right? Very manageable, very readable, even tested and correct. Did you spot the problem? Aww, nobody wanted to bite. Here's the thing: php does not have variable declarations. You just initialize them, and then you have your variable. $i = 0; Functions generate a new sco...
by Tub
Sat Nov 25, 2017 11:32 pm UTC
Forum: Fictional Science
Topic: How do you define..."you"?: Question about Infinite Universe
Replies: 22
Views: 7921

Re: How do you define..."you"?: Question about Infinite Universe

Uh...I'm not talking about that, either, but forgive me for ambiguous language. I just mean a realatively simple situation, in which you discover that you're in a multiverse, and each verse have a different kind of You in it. That doesn't make sense, not even in fiction. Even if we assume that eart...
by Tub
Fri Nov 24, 2017 3:18 pm UTC
Forum: Fictional Science
Topic: How do you define..."you"?: Question about Infinite Universe
Replies: 22
Views: 7921

Re: How do you define..."you"?: Question about Infinite Universe

AFAIK even an infinite universe is supposed to spawn infinite copies of you, me and everything, assuming the laws of physics are constant, and the starting configuration of the universe is roughly uniform. This follows from a probabilistic argument: you're the outcome of a random experiment with P(y...
by Tub
Tue Nov 21, 2017 4:56 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9989
Views: 1999019

Re: Coding: Fleeting Thoughts

My friend's project, Cassis, is a subset of JS and PHP that works the same across both languages (plus a supporting library to get a bunch of functions working in both). You can write code in Cassis and deploy it both in browsers and servers. ^_^ That's great, now all I need is a JavaScript to Cass...
by Tub
Sun Nov 19, 2017 10:51 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9989
Views: 1999019

Re: Coding: Fleeting Thoughts

Today's random thought: "I wish I had a javascript-to-php transpiler."

As horrible as that sounds, it would solve a real problem I have.

Go to advanced search