Search found 8012 matches

by phlip
Wed Sep 21, 2016 1:42 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9944
Views: 1910871

Re: Coding: Fleeting Thoughts

Naturally, the only things worth checking in a code-review are things that could be fixed by a pre-commit hook.
by phlip
Wed Sep 21, 2016 1:40 pm UTC
Forum: Coding
Topic: faster function than 1/x?
Replies: 18
Views: 9365

Re: faster function than 1/x?

The memcpy version: float fastinvert3(float x) { uint32_t asint; memcpy(&asint, &x, 4); asint ^= 0x7FFFFFFF; memcpy(&x, &asint, 4); return x; } compiles with GCC identically to the pointer-casting version, even without optimisation (which makes sense, if you unroll the memcpy call th...
by phlip
Wed Sep 21, 2016 7:09 am UTC
Forum: Coding
Topic: faster function than 1/x?
Replies: 18
Views: 9365

Re: faster function than 1/x?

↶ In C, it is not UB -- rather, it just produces a perhaps-partially-un specified result. Ah, I do sometimes get undefined and unspecified mixed up. I think I remembered seeing it in the list in J.1 but misremembered what the list was. In which case, sure, this is safer: float fastinvert(float x) {...
by phlip
Wed Sep 21, 2016 12:01 am UTC
Forum: Coding
Topic: faster function than 1/x?
Replies: 18
Views: 9365

Re: faster function than 1/x?

I'm pretty sure using a union is also undefined behaviour? That reading from a field of a union that's not (a compatible type of) the one you wrote to isn't strictly allowed. Or something like that, it's been a while since I read the standard. Point being that if we're talking strict by-the-standard...
by phlip
Tue Sep 20, 2016 12:50 pm UTC
Forum: Coding
Topic: faster function than 1/x?
Replies: 18
Views: 9365

Re: faster function than 1/x?

↶ The fastest way would be to roll your own bit level hacks. Floating points are of the form m * 2^e, where 1 < m < 2, so if you negate both the exponent and the mantissa separately, it might work. Construct a floating point number that reads (2-m) * 2^(-e), which can be done using nothing but bit ...
by phlip
Mon Sep 19, 2016 11:22 am UTC
Forum: General
Topic: Thoughts for ships
Replies: 90128
Views: 8709562

Re: Random natterings

Something something Real Media.
by phlip
Thu Sep 15, 2016 1:28 pm UTC
Forum: News & Articles
Topic: Police misbehavior thread
Replies: 6751
Views: 1052482

Re: Police misbehavior thread

I believe most style guides say to use the apostrophe when pluralising single letters. It doesn't make a lot of logical sense, but it just reads a lot easier.

Um... which is why the police are terrible. Yes.
by phlip
Wed Sep 14, 2016 11:52 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9944
Views: 1910871

Re: Coding: Fleeting Thoughts

↶ Suffice to say, the first time I heard of Node was the Great leftpad Debacle. That pretty well encapsulated everything I needed to know about it. Having never used npm, the most interesting thing I learned from some of the stories from the leftpad stuff: there is a module called "is-positive...
by phlip
Wed Sep 14, 2016 6:06 am UTC
Forum: News & Articles
Topic: Police misbehavior thread
Replies: 6751
Views: 1052482

Re: Police misbehavior thread

I had a double-take before I realised they didn't mean 57 gigadollars...
by phlip
Wed Sep 07, 2016 2:26 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9944
Views: 1910871

Re: Coding: Fleeting Thoughts

Sure, that lets you find the .bar elements that are children of any .foo elements. But how to find the .bar elements that are children of a specific .foo element? Specifically, the one I have in this variable here? There's Element.querySelector when you're looking specifically for descendants, but n...
by phlip
Wed Sep 07, 2016 1:53 pm UTC
Forum: General
Topic: The "I can't find a particular XKCD comic" thread
Replies: 162
Views: 124983

Re: The "I can't find a particular XKCD comic" thread

I'mOkWithThis.jpg
by phlip
Wed Sep 07, 2016 7:05 am UTC
Forum: General
Topic: The "I can't find a particular XKCD comic" thread
Replies: 162
Views: 124983

Re: The "I can't find a particular XKCD comic" thread

I don't think there's anyone I know who tells stories like the first panel of that one...
by phlip
Wed Sep 07, 2016 12:00 am UTC
Forum: General
Topic: Thoughts for ships
Replies: 90128
Views: 8709562

Re: Random natterings

A significant number of my aborted posts are when I'm replying to a thread to add extra detail or context, or clarify something someone else already posted... and then I read it back when I'm done and I realise I haven't actually added anything, everything I've said is already covered in the previou...
by phlip
Fri Sep 02, 2016 5:03 pm UTC
Forum: Mathematics
Topic: Math: Fleeting Thoughts
Replies: 427
Views: 140564

Re: Math: Fleeting Thoughts

I'm not sure how spoilery this suggestion is compared to what you want, so I've broken it up into two... When I'm working on this sort of thing, I'll usually work backwards from the solution, rather than forward from the question... asking not "what can I construct from what I have?&quo...
by phlip
Wed Aug 17, 2016 11:49 am UTC
Forum: Coding
Topic: Python - Is this an anti-pattern for yield keyword?
Replies: 5
Views: 5081

Re: Python - Is this an anti-pattern for yield keyword?

Which is why I prefer to use @contextmanager rather than trying to remember exactly how __enter__ and __exit__ work when writing these things...
by phlip
Wed Aug 17, 2016 8:03 am UTC
Forum: News & Articles
Topic: Police misbehavior thread
Replies: 6751
Views: 1052482

Re: Police misbehavior thread

"But in light of that, this is a positive story. … This case is a prime example of how things should be done."
by phlip
Mon Aug 15, 2016 1:24 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9944
Views: 1910871

Re: Coding: Fleeting Thoughts

Out of curiosity... are the files actually different?

Code: Select all

md5sum VoidRewardParser/Localization/German.txt
git show HEAD:VoidRewardParser/Localization/German.txt | md5sum
And what does a "git diff" from the command line say?
by phlip
Wed Aug 10, 2016 11:34 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9944
Views: 1910871

Re: Coding: Fleeting Thoughts

Flumble wrote:
Are you implying I have a bad taste in porn?! :o

I'm more intrigued by your porn-viewing sessions that last in the order of weeks...
by phlip
Sun Aug 07, 2016 8:10 am UTC
Forum: The Help Desk
Topic: Wanted: "Layered/tiered" password manager
Replies: 15
Views: 9415

Re: Wanted: "Layered/tiered" password manager

For Google Authenticator (and other TOTP apps), it doesn't need any Internet connection to work... as long as you connect to it for long enough for it to sync the clock on your phone every now and again (because if the clock on your phone is out by more than a minute or so, depending on what you're ...
by phlip
Thu Aug 04, 2016 1:03 am UTC
Forum: Site/Forum issues
Topic: 1663
Replies: 1
Views: 4568

Re: 1663

We have a thread for this already.

Short version: don't use HTTPS for this one. http://xkcd.com/1663/ works.
by phlip
Fri Jul 22, 2016 2:49 pm UTC
Forum: News & Articles
Topic: Police misbehavior thread
Replies: 6751
Views: 1052482

Re: Police misbehavior thread

Say you were in a situation where there were two people, and you thought one was a threat. Even putting aside how ridiculous it is to think that, let's grant that for the sake of argument. You fire three shots at them... two miss, and one hits the wrong guy. What's the chain of logic from there to h...
by phlip
Mon Jul 18, 2016 4:42 am UTC
Forum: Coding
Topic: How do you manage Python dependencies?
Replies: 8
Views: 5341

Re: How do you manage Python dependencies?

I believe this is the traditional method.

The short version: list the requirements in a text file called requirements.txt, one per line. Then people can run "pip install -r requirements.txt" and grab everything.
by phlip
Wed Jul 13, 2016 3:48 pm UTC
Forum: General
Topic: XKCD, where they talk shit about you in a secret subforum
Replies: 150
Views: 30911

Re: XKCD, where they talk shit about you in a secret subforum

↶ Not yet gotten around to joining in, and it seems wrong to leap in after this public 'announcement' likely draws in other non-members to apply. Not saying this to argue with you, but just as an FYI for others reading the thread: it's not so much an application as it is an opting-in... maybe it wa...
by phlip
Thu Jun 23, 2016 5:00 am UTC
Forum: Coding
Topic: Good books for learning to create proxy servers?
Replies: 18
Views: 8906

Re: Good books for learning to create proxy servers?

Yeah, you're being incredibly cagey with what you're actually trying to do... We're not going to just sit here and help you try vainly not to get caught at whatever nonsense you're planning to get up to. I highly recommend either explaining what you're trying to do, if it's legitimate, or just leav...
by phlip
Wed Jun 15, 2016 1:01 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9944
Views: 1910871

Re: Coding: Fleeting Thoughts

↶ Python's operators seem particularly bizarre to me... [...] The only rhyme or reason here seems to be sgn(a%b)==sgn(b) . But what's the point of that? That's the usual div/mod definition... The point is that, for b > 0 you can always say 0 <= a%b < b. Which makes modular arithmetic a lot easier. ...
by phlip
Fri Jun 10, 2016 12:14 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9944
Views: 1910871

Re: Coding: Fleeting Thoughts

Yeah, there used to be this thing where if you clicked a link and then clicked back to return to the results, there'd be a couple of options underneath the search result, one of which was "stop showing results from w3schools.com", which applied until your preferences cookie expired (or unt...
by phlip
Thu Jun 09, 2016 11:19 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9944
Views: 1910871

Re: Coding: Fleeting Thoughts

Once upon a time, Google had an option to hide results from domains of your choice, so you could hide w3schools results and be at peace. But they removed that option years ago.
by phlip
Tue Jun 07, 2016 7:45 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9944
Views: 1910871

Re: Coding: Fleeting Thoughts

↶ The following code turns std::vector into a Functor: template<typename X, typename G> std::vector<std::result_of_t<G(X)>> fmap(G g, const std::vector<X> &m) { std::vector<std::result_of_t<G(X)>> r; std::transform(m.begin(), m.end(), std::inserter(r, r.begin())); return r; } I'm not super fami...
by phlip
Tue May 24, 2016 12:02 pm UTC
Forum: School
Topic: Forum Migration
Replies: 412
Views: 950604

Re: Forum Migration

↶ It may be that that's specifically hardcoded into phpBB and not available for custom bbcodes, though. That one. The built-in tags are handled by a bunch of overcomplicated spaghetti code deep in the bowels of phpBB. The custom tags are just turned into regex search/replaces. This is why, for exam...
by phlip
Fri May 13, 2016 1:59 pm UTC
Forum: Coding
Topic: arithmetic on functions in haskell
Replies: 4
Views: 4422

Re: arithmetic on functions in haskell

Others have pointed out ways of doing a more fundamental rearranging of the code, but I will point out that this:
>-) wrote:

Code: Select all

bar op f g x = op (f x) (g x)
is liftA2 (or, alternatively, liftM2).
by phlip
Wed May 11, 2016 5:26 am UTC
Forum: General
Topic: The "I can't find a particular XKCD comic" thread
Replies: 162
Views: 124983

Re: The "I can't find a particular XKCD comic" thread

FreshPrinceofXKCD wrote:
it was definitely an xkcd comic.

Bet you five bucks it isn't.
by phlip
Sun May 08, 2016 12:28 pm UTC
Forum: School
Topic: Forum Migration
Replies: 412
Views: 950604

Re: Forum Migration

Hold up, load of BBCode suggestions comin' through, most of which are from my own forum. Hmm... [box], [float], [font], [hr] - Sure, I guess? Not sure I see the use-case, but I'm sure people would find one. Though, for [float] especially, I'm sure the potential for messing up the board layout by mi...
by phlip
Fri May 06, 2016 6:49 am UTC
Forum: School
Topic: Forum Migration
Replies: 412
Views: 950604

Re: Forum Migration

Huh. Pretty sure last time I used Chrome it worked like that, but that was a long time ago. Good to know.
by phlip
Thu May 05, 2016 10:35 am UTC
Forum: School
Topic: Forum Migration
Replies: 412
Views: 950604

Re: Forum Migration

↶ It's always been a little choppy with many or slow-loading images on a page. Once it's all loaded (and thrown the view out of place), select the address bar and hit enter, and you should be back at the intended post. Wouldn't that just jump to the top of the next page (or the current page, if it'...
by phlip
Thu May 05, 2016 1:02 am UTC
Forum: Computer Science
Topic: Fleeting Thoughts (CS Edition)
Replies: 99
Views: 68474

Re: Fleeting Thoughts (CS Edition)

To preempt the inevitable question in the comments section: yes, we did run these Turing machines for a while, and no, none of them had halted after a day or so. But before you interpret that as evidence in favor of Goldbach, Riemann, and the consistency of ZFC, you should probably know that a Turi...
by phlip
Fri Apr 29, 2016 6:34 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9944
Views: 1910871

Re: Coding: Fleeting Thoughts

Man, been a while since I found an actual dangling else in real production code.

I haven't missed it.
by phlip
Fri Apr 22, 2016 1:48 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9944
Views: 1910871

Re: Coding: Fleeting Thoughts

↶ Interesting... I've never thought about how similar a function declaration and an object declaration are in C++. Huh, phlip's code is actually valid C++. Okay, sign me up for the C++ syntax hate club. Oh, that's far from the only ambiguity in C++, though it's probably the most fun simple exam...
by phlip
Fri Apr 22, 2016 6:17 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9944
Views: 1910871

Re: Coding: Fleeting Thoughts

Code: Select all

struct A { A(int) {} };
int x;
typedef int y;

A foo(x), bar(y);
by phlip
Fri Apr 22, 2016 1:05 am UTC
Forum: Mathematics
Topic: Pi from the Menger Sponge
Replies: 9
Views: 4478

Re: Pi from the Menger Sponge

1 dimension works, but the sponge definition gets a bit degenerate... ↶ (specifically, remove any subhypercube that is in the middle third on at least two axes ) Since we don't have two axes, there are no intervals (hypocubes?) that are in the middle on at least two axes, so we never remove anything...
by phlip
Thu Apr 21, 2016 6:33 am UTC
Forum: Mathematics
Topic: Pi from the Menger Sponge
Replies: 9
Views: 4478

Re: Pi from the Menger Sponge

Yeah, I tried coming at it from a similar angle... but that addition inside the product term makes manipulating the product complicated, and the fact that "n" makes an appearance as a multiplicand, rather than just exponents, makes inducting on it also complicated...

Go to advanced search