Search found 469 matches

by Tub
Sat Nov 18, 2017 11:46 pm UTC
Forum: Mathematics
Topic: Assassin Problem over the Internet
Replies: 40
Views: 10228

Re: Assassin Problem over the Internet

@Xanthir: you're letting a single person generate all randomness, and the full random order is public, and both make me feel uneasy.. but as long as the private emails remain private until the game is over, I can't find any way to exploit that. So sure, your's is simpler and less fiddly than what I ...
by Tub
Sat Nov 18, 2017 1:01 am UTC
Forum: Mathematics
Topic: Assassin Problem over the Internet
Replies: 40
Views: 10228

Re: Assassin Problem over the Internet

As for doing this remotely (over the internet) as Eebster requested, I haven't found a solution that doesn't involve some trusted third party. By using internet messages, you're already involving trusted third partys to relay the messages. Let's assume that people can create email addresses and sen...
by Tub
Sat Nov 11, 2017 11:03 pm UTC
Forum: Hardware
Topic: Best Hard Drive For Gaming?
Replies: 15
Views: 11082

Re: Best Hard Drive For Gaming?

Uh, what? For around the same price, you can get either one of these: - 32 GB of Optane M.2, 1350 MB/sec read, 290 MB/sec write - 120 GB of M.2 SSD, 3000 MB/sec read, 2400 MB/sec write - 256 GB of SATA SSD, ~600 MB/sec read, ~500 MB/sec write I'm not sure why you'd ever consider the first on a gamin...
by Tub
Thu Nov 09, 2017 11:35 pm UTC
Forum: Coding
Topic: Minimizing traffic on a server for a web app
Replies: 10
Views: 7473

Re: Minimizing traffic on a server for a web app

The part that has been worrying me is I have no perspective/experience in how to measure this web app's potential impact on the dozens of different servers it will be interacting with. Like I said, start by estimating the number of queries per second. You won't have actual load measurements until y...
by Tub
Thu Nov 09, 2017 3:13 pm UTC
Forum: Mathematics
Topic: Assassin Problem over the Internet
Replies: 40
Views: 10228

Re: Assassin Problem over the Internet

I don't get it. What exactly is meant by the requirement for the cycle to be "secret"? If it just means that nobody can pick their target, then taking a stack of cards and shuffling will suffice. If it means that at the end of the procedure, everybody knows their target, but nobody else's ...
by Tub
Wed Nov 08, 2017 9:31 pm UTC
Forum: Coding
Topic: Minimizing traffic on a server for a web app
Replies: 10
Views: 7473

Re: Minimizing traffic on a server for a web app

I'm not sure what exactly you're doing. Your web server is getting requests, including an ID. You then query multiple database servers for the existence of that ID, on indexed columns, but fetch no additional data. Then what? Do you just return a list of all databases the ID was found in, possibly w...
by Tub
Tue Nov 07, 2017 7:51 am UTC
Forum: Coding
Topic: Minimizing traffic on a server for a web app
Replies: 10
Views: 7473

Re: Minimizing traffic on a server for a web app

Closing the DB connection after success is unwise. Reopening a connection is much more costly than just having an idle connection sitting around. Read up on the connection pool of your language of choice, and use that. You might ask your DBAs to issue you a read-only user with proper load limits and...
by Tub
Sat Oct 28, 2017 4:39 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9990
Views: 2000375

Re: Coding: Fleeting Thoughts

Sorry, I don't believe in dates before 1970.

Seriously, do you have a source for that? Google is surprisingly resistant against the search terms I'm using..
by Tub
Fri Oct 27, 2017 2:04 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9990
Views: 2000375

Re: Coding: Fleeting Thoughts

My favorite is stuff is financial rules like "find the third wednesday of the month that date X is in, unless it's a red day, then the following business day". That's... kinda hard. Is it? You're only working with dates, thus no timezones, leap seconds or anything actually troublesome. An...
by Tub
Tue Oct 17, 2017 8:15 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9990
Views: 2000375

Re: Coding: Fleeting Thoughts

Just connect to an SQL server and SELECT DATEDIFF($date1, $date2) :roll: With a date library based on unix time, it's rather simple. function date_diff(date1, date2) { var diff_in_ms = Math.abs(date1.getTime() - date2.getTime()); return diff_in_ms / 1000 / 60 / 60 / 24 / 365.25; // close enough. } B...
by Tub
Mon Oct 16, 2017 9:53 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9990
Views: 2000375

Re: Coding: Fleeting Thoughts

The bad news: dates are hard. The good news: if you cheat, the client (probably) won't notice. Because the client doesn't understand dates either, they have no idea what they're requesting, and thus won't notice even if your results are a few millenia off. Then again, even though your problem is und...
by Tub
Mon Oct 09, 2017 9:19 pm UTC
Forum: The Help Desk
Topic: Computer Dying Randomly [Seems it was the PSU]
Replies: 12
Views: 9352

Re: Computer Dying Randomly

Overheating, eh? That would be consistent with my observation that the fans don't seem to be making nearly as much noise as they used to. I've never been quite sure as to what exactly is the noisiest fan in the system, but I reckon the PSU would be the biggest. Bigger fans are usually quiter. They ...
by Tub
Mon Oct 09, 2017 10:00 am UTC
Forum: The Help Desk
Topic: Computer Dying Randomly [Seems it was the PSU]
Replies: 12
Views: 9352

Re: Computer Dying Randomly

Might be the PSU, might be overheating, might be a damaged motherboard, might even be a faulty USB device. If you mention crashes when moving the mouse, then check the mouse first. Do you have a spare mouse and keyboard? If so, unplug *all* USB devices, plug in the spares, see if the problems persis...
by Tub
Sat Sep 23, 2017 11:09 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9990
Views: 2000375

Re: Coding: Fleeting Thoughts

I can let the monitor purposefully stop with an error code to trigger OnFailure , but that's as ugly as having a separate script to send emails. What's ugly about that? Your watchdog reports failure via exit code, and systemd does the notification as configured. That seems like it's working as inte...
by Tub
Sat Sep 02, 2017 10:45 am UTC
Forum: Coding
Topic: View XKCD from a terminal.
Replies: 5
Views: 9824

Re: View XKCD from a terminal.

you should use the json interface instead of trying to parse HTML with sed. Yes. Parsing json with sed is the superior solution. is there a convenient command-line interface for something like aalib? aview is an image viewer using aalib, but I doubt the results will be readable. Unless you have a v...
by Tub
Wed Aug 16, 2017 10:32 am UTC
Forum: Computer Science
Topic: No Longer a potential proof of P != NP
Replies: 3
Views: 5405

Re: Potential proof of P != NP

Proofs about this are very common, Odds are that this one is just as flawed as the others.

There's already a discussion over at reddit. I don't see anyone pointing out the fatal flaw (yet), but the proof doesn't pass the basic smell tests that you'd expect a valid proof to pass.
by Tub
Tue Aug 08, 2017 4:23 pm UTC
Forum: Mathematics
Topic: Foolish question debunked. Move on, nothing to see.
Replies: 80
Views: 14743

Re: Does the Banach–Tarski Paradox prove that you can't see the edge of the universe?

I cannot claim to fully understand your proof, but I get the impression that you're only using a simple geometric translation of a sphere or of a point of reference. The interesting part of Banach-Tarski is that you can disassemble the sphere and re-assemble it into *two* equal spheres, effectively ...
by Tub
Mon Aug 07, 2017 7:19 am UTC
Forum: Mathematics
Topic: Foolish question debunked. Move on, nothing to see.
Replies: 80
Views: 14743

Re: Does the Banach–Tarski Paradox prove that you can't see the edge of the universe?

I think you're assuming euclidean space somewhere. If the universe has an edge, you can bet that its surroundings are highly non-euclidean.
by Tub
Wed Jul 19, 2017 10:03 pm UTC
Forum: Computer Science
Topic: chess under duress
Replies: 27
Views: 13971

Re: chess under duress

According to the wikipedia page EvanED linked, if you touch a piece, then you must move it if you can move it. Touching a piece without valid moves appears to have no consequences. You have 6 unmovable pieces at your first move, giving you ~2.6 bits per touch until either your message is sent, or th...
by Tub
Tue Jul 18, 2017 9:36 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9990
Views: 2000375

Re: Coding: Fleeting Thoughts

GIF isn't bad. It's just a format that was invented and optimized for blinking "under construction" signs of the 90s web, e.g. animated pixel art. And it works really well for those. If people abuse it to encode full motion video, then you cannot blame gif for not being efficient at it. Gi...
by Tub
Wed Jul 12, 2017 12:32 pm UTC
Forum: Computer Science
Topic: chess under duress
Replies: 27
Views: 13971

Re: chess under duress

Why not just send longitude and latitude? How many bits does it take to communicate those to, say, 100 meters of precision? In binary lat/long, ~30 bits should suffice for 1km precision, ~37 for 100m, ~44 for 10m etc. But as flumble said, there are better encodings when you realize that you're prob...
by Tub
Sun Jul 09, 2017 11:40 pm UTC
Forum: Computer Science
Topic: chess under duress
Replies: 27
Views: 13971

Re: chess under duress

english has less than 1.5 bits of entropy per character Entropy is a lower bound for compression, not something guaranteed to be achievable. The secret to entropy coding is to make a good guess at the next character given all the previous characters. More precisely, you need to list all the possibl...
by Tub
Sun Jul 09, 2017 12:50 pm UTC
Forum: Computer Science
Topic: chess under duress
Replies: 27
Views: 13971

Re: chess under duress

There's two parts: translating chess moves into a bit sequence, and translating the bit sequence into a message. Let me start with the second. ASCII is a bit wasteful (do you really need control characters in your message?), you can get away with 5 bits per character (lowercase letters only, no numb...
by Tub
Sat Jul 08, 2017 3:27 pm UTC
Forum: Individual XKCD Comic Threads
Topic: 1860: "Communicating"
Replies: 60
Views: 12882

Re: 1860: "Communicating"

chrisjwmartin wrote:Yep, that sounds like a conversation with a woman.

What makes you think the egg is a woman?
by Tub
Thu Jul 06, 2017 1:49 pm UTC
Forum: Computer Science
Topic: A bit, on average
Replies: 2
Views: 4877

Re: A bit, on average

It depends on the data that is stored. Compressed or encrypted data should appear uniformly random, i.e. have roughly equal parts 0 and 1. Other data often favors 0: in ASCII-text, the leading bit of each character is always 0 (but most small letters have the second bit as 1, so it almost evens out)...
by Tub
Tue Jun 27, 2017 1:59 pm UTC
Forum: Coding
Topic: Multi-line Anonymous Functions in Python
Replies: 32
Views: 41629

Re: Multi-line Anonymous Functions in Python

Let's name EVERYTHING! Alright. Your name is now Bob. Seriously though, some projects use coding guidelines that prohibit unnamed constants. Instead of sleep(3600); you'd have to write const ONE_HOUR = 3600; sleep(ONE_HOUR); In other words, there really are projects where you are required to name e...
by Tub
Sat Jun 17, 2017 11:10 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9990
Views: 2000375

Re: Coding: Fleeting Thoughts

Oh neat, I didn't know about the nullable unique constraint trick. It's very useful, but AFAIK not portable. IIRC allowing multiple NULL values in a UNIQUE constraint actually violates the sql standard (but don't quote me on that). I had this thought in the shower. I'm not sure if it's an improveme...
by Tub
Sat Jun 17, 2017 7:31 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9990
Views: 2000375

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: 9990
Views: 2000375

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: 9990
Views: 2000375

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

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: 9990
Views: 2000375

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: 9990
Views: 2000375

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: 9990
Views: 2000375

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: 9990
Views: 2000375

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: 20
Views: 14601

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: 9990
Views: 2000375

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: 9990
Views: 2000375

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: 9990
Views: 2000375

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

Go to advanced search