Search found 435 matches

by jareds
Sat Dec 07, 2013 6:14 am UTC
Forum: News & Articles
Topic: In other news... (humorous news items)
Replies: 15205
Views: 2712950

Re: In other news... (humorous news items, etc)

For point of reference, I came up with the same explanation as the McDonald's spokesperson before I read her quoted explanation. I clicked the "McDonald's website" link in the article , which brought me to mcdonalds.mynurturlife.com, which identifies as "Copyright 2013 Nurtur Health I...
by jareds
Tue Nov 19, 2013 12:39 am UTC
Forum: News & Articles
Topic: Eat Too Much, Get Too Little
Replies: 69
Views: 13053

Re: Eat Too Much, Get Too Little

If you are homeless, guess what? Foodstamps are mainly good for things you can cook. So you end up either trading foodstamps to buy junk food or you go dumpster diving... SNAP (food stamps) can be used for most any non-heated non-alcoholic food item from a grocery or convenience store, without nutr...
by jareds
Sun Nov 17, 2013 12:57 am UTC
Forum: Computer Science
Topic: Computability: how is this function computable?
Replies: 15
Views: 10030

Re: Computability: how is this function computable?

*) there is an infinitely long sequence of '5's in pi => f(x) = 1 always **) the longest sequence of '5's in pi is k : => f(x) = 1 if x <= k , f(x) = 0 otherwise. There is another case here. Consider the sequence 01001000100001000001000000100000001000000001000000000100...etc. There isn't any longes...
by jareds
Wed Oct 23, 2013 5:57 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 10016
Views: 2035175

Re: Coding: Fleeting Thoughts

Now, that said: off the top of my head I think the following should be a pretty good identifier for whether a function is "pure", though I don't know how it matches the proposed [[pure]] attribute: a function f is pure iff the compiler can safely optimize x1 = f(y); ...; x2 = f(y); into x...
by jareds
Wed Oct 23, 2013 3:30 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 10016
Views: 2035175

Re: Coding: Fleeting Thoughts

I think I see the point to it - the fact that you have to pass in the pointer as an argument means the side effect won't take a programmer/reader by surprise - but I think "pure" is the wrong word to use here. I'd say "no hidden side effects", or something like that. The idea of...
by jareds
Wed Oct 16, 2013 7:00 am UTC
Forum: Coding
Topic: making a small, simple Python script to help memorize things
Replies: 8
Views: 4273

Re: making a small, simple Python script to help memorize th

This isn't a coding answer, but since you said you're not looking to learn programming you may just want an existing solution: "BSD games" is a collection of classic UNIX text games. It includes the program "quiz", which can quiz you on anything you want if you provide your own i...
by jareds
Wed Oct 16, 2013 5:24 am UTC
Forum: Computer Science
Topic: Algorithm to stitch overlapping logs together.
Replies: 15
Views: 8566

Re: Algorithm to stitch overlapping logs together.

The magic words are "shortest common superstring problem". Unfortunately, this is NP-complete. Fortunately, you may notice that patching together a bunch of overlapping substrings back into the original string bears a certain resemblence to DNA sequencing, which has received a reasonable a...
by jareds
Mon Oct 14, 2013 8:23 pm UTC
Forum: Coding
Topic: I made a Java test. Can you beat it? Also can you hack it?
Replies: 6
Views: 3307

Re: I made a Java test. Can you beat it? Also can you hack i

Well, here's some free bug testing: Numbers 26-28 (recurse) Combos, Variations, Permute ; fail to run even with an empty function (so no recursion): Runtime error At line -47, the submission threw the exception: java.lang.ClassNotFoundException: not in allowed classes: java.lang.StackOverflowError N...
by jareds
Mon Oct 14, 2013 6:51 am UTC
Forum: Coding
Topic: C - Int question
Replies: 9
Views: 3239

Re: C - Int question

I take it that moving the declaration out of the function just places the integer somewhere before in the stack and instead I'm overwriting some other part of the memory? That's the right idea. Global variables don't actually go on the stack at all. Since the amount of memory is known at build time...
by jareds
Sun Oct 13, 2013 1:23 am UTC
Forum: Coding
Topic: C - Int question
Replies: 9
Views: 3239

Re: C - Int question

You're exceeding array bounds and overwriting it. In C, an array of size N can be indexed from 0 to N-1. There might be other problems. You're quite inconsistent about HEIGHT versus WIDTH, but that's not causing you problems yet because they're defined to be the same thing.
by jareds
Thu Oct 03, 2013 6:33 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 10016
Views: 2035175

Re: Coding: Fleeting Thoughts

Because you're developing for an architecture that is compatible with machine code written back when the Cold War was still a major going concern? I'm being flippant, but the reason genuinely is that the x87 instruction set is the instruction set of the 8087, which was a physical FPU with a separate...
by jareds
Thu Aug 22, 2013 7:54 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 10016
Views: 2035175

Re: Coding: Fleeting Thoughts

Capturing variables by reference (by capturing the current lexical environment) is how closures normally work. It's the loop that's not working like you'd expect. In languages where people normally get exposure to closures, variable bindings tend not to be altered except by explicit mutation (if tha...
by jareds
Wed Aug 21, 2013 6:41 am UTC
Forum: Coding
Topic: Please help check my Box-Muller vectorized code
Replies: 3
Views: 3265

Re: Please help check my Box-Muller vectorized code

High level comments: While I'm not familiar with OS X specifically, it seems rather abnormal to use /dev/random or /dev/urandom other than (1) to get a seed for a PRNG or (2) for cryptographic applications. Generating normal deviates suggests a statistical, not a cryptographic, application, so I wou...
by jareds
Thu Aug 15, 2013 6:59 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 10016
Views: 2035175

Re: Coding: Fleeting Thoughts

Say we are sorting n strings of length k. A comparison sort will perform O(n log n) comparisons of cost O(k), for a running time of O(n k log n). Comparing strings of length k is worst-case O(k), but average-case O(1) as long as your strings are somewhat random. That sentence is true standing alone...
by jareds
Wed Aug 14, 2013 5:37 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 10016
Views: 2035175

Re: Coding: Fleeting Thoughts

If you know your list consists of 32 bit ints, loading it into a std::map< int, counter > is linear time. Each lookup in the std::map will take no more than lg(2^32) time. For each int in our input, we look it up in the map, then increment the counter. O(N). Then we iterate over the map and print o...
by jareds
Tue Aug 13, 2013 7:54 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 10016
Views: 2035175

Re: Coding: Fleeting Thoughts

Integrating std::string would definitely be much more radical than that, but I think it wouldn't be so out of place provided that there was a way to specify that, for example, an interpolated string should be able to use a different instantiation of basic_string , as you mostly point out later. I'l...
by jareds
Tue Aug 13, 2013 6:01 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 10016
Views: 2035175

Re: Coding: Fleeting Thoughts

Good point, I wasn't thinking in the context of C backwards compatibility. Also, I'm pretty much assuming std::string as opposed to null-terminated char*, so that might make a difference. And that's why your idea goes wrong. Setting aside that the user is not intended to be forced to use std::basic...
by jareds
Sat Aug 10, 2013 2:25 am UTC
Forum: Serious Business
Topic: Minimum tax for high bracket
Replies: 27
Views: 9434

Re: Minimum tax for high bracket

The coffee company’s UK unit, for instance, is required to pay a royalty rate of 6 per cent of sales to Starbucks for using its intellectual property. It is not clear where this money goes. Note: That's 6% on sales not profits - ie. 60x the rate the OP proposes... Again, a gross revenue tax (as pro...
by jareds
Fri Aug 09, 2013 4:16 am UTC
Forum: Serious Business
Topic: Minimum tax for high bracket
Replies: 27
Views: 9434

Re: Minimum tax for high bracket

A gross revenue tax is unlike a sales tax or VAT because those are designed to be a fixed percentage of the final sale price only. The effect of this is to reward vertical integration. For example, suppose you have the following supply chain: 1. Lumberjack sells tree to sawmill for $100. 2. Sawmill ...
by jareds
Thu Aug 01, 2013 9:48 am UTC
Forum: News & Articles
Topic: US Fast Food Strikes
Replies: 327
Views: 87521

Re: US Fast Food Strikes

Or you could just require the higher wages and not care fuck all about how the corporates maintain their bottom line. Try it and see. Indeed, I would hope it was obvious that the possibilities I outlined were not mutually exclusive and that the standard of "rationality" I was using for th...
by jareds
Thu Aug 01, 2013 6:54 am UTC
Forum: News & Articles
Topic: US Fast Food Strikes
Replies: 327
Views: 87521

Re: US Fast Food Strikes

Well, except for the caveat that Five Guys is a sit down restaurant, but that's a mere result of you comparing apples and oranges. Your Five Guys has a wait staff? Weird. The one I went to for lunch today is a fast food restaurant that sells burgers and is evidence that fast food places can pay abo...
by jareds
Wed Jul 31, 2013 1:09 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 10016
Views: 2035175

Re: Coding: Fleeting Thoughts

In C++, can't you just doubleResult = anInteger / double(anotherInteger); ? I seem to vaguely remember such a construct anyway. You can, but if "T(exp)" is a functional cast of one argument, it is semantically equivalent to "(T)(exp)". Yakk's point is that it's risky to be in th...
by jareds
Sat Jul 27, 2013 4:16 am UTC
Forum: Computer Science
Topic: Windows Calculator "invalid input for function"
Replies: 18
Views: 17070

Re: Windows Calculator "invalid input for function"

Did it with python. Here's the result. Clocks in at 315,653 bytes, exactly as jaap calculated. I did the same thing, just for grins. It takes python almost a full minute to calculate it on my machine: $ time echo "print 2**(1024**2)" | python 6741140125499073402269065104704245437620185948...
by jareds
Sat Jul 20, 2013 2:11 am UTC
Forum: Computer Science
Topic: Avoiding password reuse defeated by accidents
Replies: 19
Views: 10468

Re: Avoiding password reuse defeated by accidents

Finding a password character-by-character calls for the classic Tenex password story.
by jareds
Thu Jul 18, 2013 1:43 am UTC
Forum: News & Articles
Topic: In other news... (humorous news items)
Replies: 15205
Views: 2712950

Re: In other news... (humorous news items, etc)

Bernie Ecclestone indicted on bribery charges . But wait: The charge relates to a $44m (£29m) payment to German banker Gerhard Gribkowsky of Bayern Landesbank, linked to the sale of a stake in F1. Mr Ecclestone denies bribing Gribkowsky, and says the money was intended to stop the banker from expos...
by jareds
Mon Jul 08, 2013 10:39 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 10016
Views: 2035175

Re: Coding: Fleeting Thoughts

As for the remaining 155 107 bytes, if I can find or invent a space-optimised uint32_t divmod10 routine, I'm probably done. ;) Well, there's some pretty slick divide by 10 code in this thread, courtesy of jareds, although it's for uint16. I might be able to turn that into something I can use (my br...
by jareds
Mon Jul 08, 2013 4:47 am UTC
Forum: Books
Topic: Harry Potter and the Methods of Rationality
Replies: 1036
Views: 414584

Re: Harry Potter and the Methods of Rationality

That's funny. I changed my mind so I now believe Harry took her whole body. I predicted he'd take just her brain to avoid notice (surely there would be no Muggle autopsy, and I doubt morticians routinely open skulls), but I was wrong. I do think Harry is willing to state outright fa...
by jareds
Thu Jul 04, 2013 10:22 pm UTC
Forum: Books
Topic: Harry Potter and the Methods of Rationality
Replies: 1036
Views: 414584

Re: Harry Potter and the Methods of Rationality

I'm honestly not quite sure what happens, but I pretty much guarantee that, as of Chap 92, Harry did SOMETHING to preserve her. It almost certainly involved time travel, because now that that's unlocked, it's too GD useful to not come up in some way. I'm quite certain that the waiti...
by jareds
Thu Jul 04, 2013 8:07 am UTC
Forum: Books
Topic: Harry Potter and the Methods of Rationality
Replies: 1036
Views: 414584

Re: Harry Potter and the Methods of Rationality

Prediction, maybe somewhat obvious: Hermione's brain has been transfigured into a diamond that will soon be on Harry's ring in place of the rock. On very close inspection, a piece of her skull has been removed by thin, perfectly circular cut and set back in place with Chekhov's superglue...
by jareds
Fri Jun 28, 2013 7:14 am UTC
Forum: Computer Science
Topic: Bitwise AND of encrypted bits?
Replies: 9
Views: 5870

Re: Bitwise AND of encrypted bits?

Do other uses of MPC implement off-site redundancy or something like it, or do most uses of it not worry about one party getting the answer without letting the other get it? I'm pretty sure it's purely an academic field of cryptography at this point, so it would be more like reliability is just ass...
by jareds
Tue Jun 25, 2013 6:11 am UTC
Forum: Computer Science
Topic: Bitwise AND of encrypted bits?
Replies: 9
Views: 5870

Re: Bitwise AND of encrypted bits?

Because the protocol just not finishing is plausibly deniable as not cheating. Maybe Bob's power went out at just the wrong time. Maybe a third party attacker cut their network cable in the middle of the transmission. Now Alice doesn't know whether Bob knows a. That's clearly impossible to avoid. O...
by jareds
Mon Jun 24, 2013 10:14 pm UTC
Forum: Computer Science
Topic: Bitwise AND of encrypted bits?
Replies: 9
Views: 5870

Re: Bitwise AND of encrypted bits?

What if b is 1, and Bob terminates the protocol right after verifying the decryption of x b , but before revealing it? Doesn't he now know a without Alice being able to learn b? This is the type of objection I was trying to forestall: I would say that it should be allowed for Alice to learn b as lo...
by jareds
Mon Jun 24, 2013 6:18 am UTC
Forum: Computer Science
Topic: Bitwise AND of encrypted bits?
Replies: 9
Views: 5870

Re: Bitwise AND of encrypted bits?

The search term you want is "secure multiparty computation" (or perhaps "secure 2-party computation"). We can do an AND pretty simply, assuming I'm not screwing anything up (I'm not a cryptographer). I would say that it should be allowed for Alice to learn b as long as she cannot...
by jareds
Tue Jun 18, 2013 8:08 pm UTC
Forum: Computer Science
Topic: How do certificates / certificate authorities work?
Replies: 5
Views: 5560

Re: How do certificates / certificate authorities work?

However, since i downloaded my browser, there is still a possibility that it could be modified to contain erroneous root certificates. It seems as if i have to trust some potentially insecure source one way or another and it doesn't seem as if there is there any way of communicating securely withou...
by jareds
Wed Jun 12, 2013 7:20 am UTC
Forum: News & Articles
Topic: In other news... (humorous news items)
Replies: 15205
Views: 2712950

Re: In other news... (humorous news items, etc)

I can actually see theft, sure. Theft only at night? That's just frigging weird. If it's ok to defend property at night, it should be ok to defend property in the day. However, one must differentiate between a clear case of theft and a business disagreement. Someone carjacking you? Yeah, theft, obv...
by jareds
Wed Jun 12, 2013 2:32 am UTC
Forum: News & Articles
Topic: In other news... (humorous news items)
Replies: 15205
Views: 2712950

Re: In other news... (humorous news items, etc)

Take it to small claims court, complain to the escort agency, but there should be absolutely no reason to point a gun at someone, let alone shoot them, unless you have reason to believe your life is in danger. Whether or not she stole, whether or not she should have given the money back, whether or...
by jareds
Tue Jun 11, 2013 2:20 am UTC
Forum: Computer Science
Topic: Non-Erasable Turing Machine
Replies: 1
Views: 2896

Re: Non-Erasable Turing Machine

Yes, it's Turing complete. See my first post on the forums, but replace "candy" with "blank" and "eaten" with "shaded".
by jareds
Thu Jun 06, 2013 10:01 pm UTC
Forum: Computer Science
Topic: Could a Turing Machine run on ALL strings in parallel?
Replies: 5
Views: 4324

Re: Could a Turing Machine run on ALL strings in parallel?

If there's an n such that the machine halts in n steps on an infinite length string s , then the machine also halts on a finite prefix of s of length n , since a TM can't possibly read more than the first n characters of a string in n steps. Your proposal is equivalent to examining all finite string...
by jareds
Sun Jun 02, 2013 4:33 am UTC
Forum: Coding
Topic: The "IT DOESN'T WORK!" thread
Replies: 1963
Views: 572430

Re: The "IT DOESN'T WORK!" thread

Just to expand on that a bit, your actual problem is presumably that you're building your assembly version of the program in such a way that the entry point is your "main" function. For a console application linked with the Visual Studio C run-time (MSVCRT), you need the entry point to be ...
by jareds
Mon May 20, 2013 7:47 am UTC
Forum: Individual XKCD Comic Threads
Topic: 1214: "Geoguessr"
Replies: 102
Views: 34309

Re: 1214: "Geoguessr"

My very first GeoGuess: "OK, this street sign looks Dutch, but this is quite a rural area." Zoom in on Netherlands, click on a patch of farmland at random... and of course the right answer is in South Africa.

Go to advanced search