|
return0 posted:if( ((num-1) & (num)) == 0 ) is not a test for evenness, it's checking for if num is a power of two. But zero is a power of two. 2**64 = 0.
|
# ¿ Jun 7, 2008 04:36 |
|
|
# ¿ Apr 29, 2024 16:44 |
|
BattleMaster posted:God drat, I wrote something in Python that was under 200 lines that could do the same thing, except it went from 0 to 999,999. And it sure as hell didn't take me 6 hours! I wrote one in XSLT
|
# ¿ Jul 11, 2008 14:15 |
|
N.Z.'s Champion posted:How did you do that? Wouldn't the nesting of call-templates cause a stack overflow? There really aren't that many levels of recursion needed, I don't know what kind of crazy algorithm you're thinking of. sarehu fucked around with this message at 04:27 on Jul 14, 2008 |
# ¿ Jul 14, 2008 02:31 |
|
I sawcode:
|
# ¿ Aug 28, 2008 07:32 |
|
HappyHippo posted:For 11,000 lines. This is in C#. Ignoring problems with the program's structure, I was able to turn this into about 5 lines of code with reflection. Then you better start posting your own code too, bub.
|
# ¿ Sep 8, 2008 03:15 |
|
That is bogus, because how easy something to internalize is depends on how complicated it is. Multi-threaded problems vs. single-threaded problems is one example, but really in general, the ability to understand something is related more closely to the size of the state space and not how many lines of code it takes.
|
# ¿ Sep 22, 2014 16:27 |
|
Soricidus posted:On my PC? Not such an obvious choice. If you would be screwed by a lost password then you'd also be screwed by a hard drive failure.
|
# ¿ Oct 23, 2014 06:27 |
|
Or some random Joe stealing your laptop or PC and then having to change all your passwords, and hoping you've remembered to cleanse your browsing history of those "furry rave" youtube history, or having them upload your gf's pictures to a revenge porn website. It's pretty hard to forget a disk encryption password, and if it is not, just write it down somewhere.
|
# ¿ Oct 23, 2014 10:11 |
|
KaneTW posted:I don't really know where else to post this but let's say you have a function I think you mean f(m,n) = m & (1<<n).
|
# ¿ Oct 27, 2014 21:02 |
|
foo, bar, baaz, khan, quux, bah, blah, are mine. Sometimes I use aa, bb, cc, etc.
|
# ¿ Nov 7, 2014 13:44 |
|
ratbert90 posted:The real horror is using strcmp instead of strncmp. There's nothing wrong with using strcmp and it's the right thing to use here because you've got two null-terminated strings you're comparing. (Just because strncpy is better than strcpy, that doesn't mean every C string function should use the "n" version.)
|
# ¿ Nov 14, 2014 18:23 |
|
Subjunctive posted:strncpy is definitely not better than strcpy, Oh right. Oh god no. Well, I wouldn't know because I don't use them!
|
# ¿ Nov 14, 2014 20:18 |
|
Doesn't that violate aliasing or something? Use a union.
|
# ¿ Nov 19, 2014 17:42 |
|
Honestly Java without an IDE is fine. It's better than Python or Ruby (or any dynamically typed language) without an IDE.
|
# ¿ Dec 5, 2014 18:48 |
|
Python is your basic dynamically typed language. Are there any real flaws, other than that and whitespace sensitivity, that isn't just really petty spergation? Like, flaws that really affect work?
|
# ¿ Dec 9, 2014 18:13 |
|
Why would you guess C++?
|
# ¿ Dec 9, 2014 22:35 |
|
TheresaJayne posted:I saw the maddest thing yesterday, a friend's son is learning python at school... I'm shocked, shocked that the public school system has a mediocre CS class. I, in 2003, got taught BASIC based on an understanding of the language formed in 1979, and I had to number all my lines when using QBASIC.
|
# ¿ Dec 11, 2014 07:39 |
|
If I have debug print statements I want to leave around, I make a new macro that expands to do { } while (0) for that specific file or that specific set of debug print statements, so that they can all be turned on easily. I've also commented them out, which is fine, but suboptimal. With a debug printf line, it's immediately obvious what the purpose of that code was -- it's not like it's some bit-rotting function.
|
# ¿ Dec 17, 2014 18:54 |
|
Blotto Skorzany posted:2-byte floats?! For what it's worth in the past I've considered using 1-nibble floats with 3 bits of exponent and 1 bit of mantissa.
|
# ¿ Dec 20, 2014 03:19 |
|
Dr. Stab posted:Did you include infinity, zero and NaN? No. No sign bit either. Also the only operation was "convert from int to the nearest float" (and back).
|
# ¿ Dec 22, 2014 01:32 |
|
return0 posted:Don't see what's special about crypto. Try looking.
|
# ¿ Dec 23, 2014 00:07 |
|
apseudonym posted:There have been instances of the NSA both helping (S boxes) and hurting (Dual_EC_DRBG) crypto with their advice Those were different eras.
|
# ¿ Dec 23, 2014 03:39 |
|
return0 posted:Obviously don't write your own crypto lib, but only in the same way you don't write your own database engine, programming language or operating system (i.e., it shouldn't be special) "Don't do your own crypto" does not mean don't write your own crypto lib, it means don't use a crypto lib directly. And it's not the same thing as writing your own database engine at all. Source: My coworkers that I was making a database engine and programming language with tried to do their own crypto. Also, there's nothing wrong with making operating systems. What are you, some pussyfooted little human being that's afraid to dip down into ring zero? The real rule is "don't write your own web server." Possibly the one thing that's worse than using a crypto lib directly. Source: That database engine I was talking about? It has its own widdle bespoke web server. Making a page cache or filesystem isn't really that hard, compared to having a web server that isn't a buggy insecure piece of poo poo.
|
# ¿ Dec 23, 2014 21:00 |
|
Uh no, people don't deploy their own custom OS or compiler because that's a lot of effort. Deploying your own custom crypto is very little effort.
|
# ¿ Dec 24, 2014 03:46 |
|
Use a library that does what your actual goal is. For example, if you want to do password hashing, use a password hashing library. If you want to communicate securely over bytestreams, use a secure bytestream communication library.
|
# ¿ Dec 24, 2014 03:54 |
|
Suspicious Dish posted:Freeing data on the heap doesn't necessarily meaning freeing pages. I actually don't know what happens if you access free'd heap memory that's within a still-mapped page. Nothing happens. Maybe you corrupt the heap, if an allocation happened between the free and the write. Or eventually something gets allocated on top of what you wrote. Valgrind would catch the error though.
|
# ¿ Dec 25, 2014 21:46 |
|
Yes, see http://www.daemonology.net/blog/2014-09-04-how-to-zero-a-buffer.html and then http://www.daemonology.net/blog/2014-09-06-zeroing-buffers-is-insufficient.html. I wouldn't be able to tell you how far those posts descend into spergatory, or if they enter it at all.
|
# ¿ Dec 26, 2014 04:07 |
|
TDD isn't "testing," it's orthogonal to the question of whether you have tests. For UI stuff it'd be real annoying because you'd be writing UI tests before writing the UI, and that just slows down the UI design iteration process down because the tight loop 99% of the time should be around quality of user interaction. sarehu fucked around with this message at 15:14 on Dec 31, 2014 |
# ¿ Dec 31, 2014 14:56 |
|
Generally speaking, I have found mocking most useful for:
I can also think of some cases where I wanted to be able to test "was pow called" in a test. For example, sometimes I wanted to make sure my unit tests overflows some memory buffer that causes stuff to need to get pushed to disk. So I wanted to be able to have the test see that such an overflow really happened, otherwise the disk-touching code isn't going to get tested. Edit: Really I just found myself wanting the regular code to spit out a log of everything it does, and then have the unit test inspect it after the fact. sarehu fucked around with this message at 11:32 on Jan 2, 2015 |
# ¿ Jan 2, 2015 11:28 |
|
My only group project in CS was in a class where we were all told to find some people to team up with after people proposed certain projects in the software design and documentation class, and bam, the five of us that didn't find our own team got put together. I think all five of us were all thinking, man, I don't want to get stuck with those bozos (the other teams and proposed projects) and we ended up making a video game. Also had no problem with groupmates in some kewl philosophy class, even the stoner-type wasn't a slacker-stoner. The worst was chemistry 101, doing labs, because man do some people (my inferiors ofc.) have issues following instructions at high speed.
|
# ¿ Jan 5, 2015 04:12 |
|
I'm glad people are still putting in a space between the <br and the />, because they don't want to give up Netscape 4 compatibility.
|
# ¿ Jan 6, 2015 12:53 |
|
They forgot 57.
|
# ¿ Jan 10, 2015 05:59 |
|
Suspicious Dish posted:Linus is really terrible. He has some bad idea about something, and then thinks anybody who doesn't agree with his interpretation of complex issues, and I quote, "should be retroactively aborted. Who the f*ck does idiotic things like that? How did they noty die as babies, considering that they were likely too stupid to find a tit to suck on?" Or maybe you could just not be a pissy little pussy.
|
# ¿ Jan 29, 2015 01:11 |
|
Suspicious Dish posted:My former coworker was Jerome Glisse, not Rik. He's going to continue working on HMM, but he expressed frustration when trying to convey his ideas to Linus. He's not overly abusive in that thread, no, but he was wrong. He's expressing confusion and openly stating he might not understand things in that email and the follow up. You're also using the word "abusive" in a new recently-made-popular way to describe comments made online that doesn't actually correspond to anything known as "abuse." Linus is not abusing the recipient of his email, nor is he abusing the email system. So his email is not abusive. Unless you really think having and sharing beliefs about code being bad is a way to abuse somebody and also think having that having and sharing uncertain beliefs while going out of your way to point out that you might be wrong is a way to abuse somebody. (It seems to me you just like to try hard to hate people for no reality-based reason. See for example you calling me a racist because of a post that Skuto made.)
|
# ¿ Jan 29, 2015 06:47 |
|
Look Around You posted:I'm pretty sure he's not saying the criticism itself is abusive, but rather the manner in which it's delivered is. There's way more professional and tactful ways to express disagreement/misunderstanding than literally saying "WHAT? \n NONE OF WHAT YOU SAY MAKES ANY SENSE." and other very vitriolic poo poo ("you should be retroactively aborted", etc). Talking to someone that way (esp. in a semiprofessional environment) honestly is abusive. *For example you'd have to be emotionally retarded to view that sentence as vitriolic too. And I mean materially vitriolic, with actual vitriol behind it.
|
# ¿ Jan 29, 2015 09:04 |
|
Look Around You posted:Also in what loving world do you live in where repeatedly posting/sending death threats to "express disagreement" to someone online is not abusive? Or having multiple people do it? How about posting their address and threatening to rape and murder them? How is any of that not abusive? Like do you honestly think that the #gamergate bullshit is actually about "ethics in video game journalism" and not a way to further disempower and subjugate women to push them further away from their sacred loving video games or whatever the gently caress their goal is now? What.
|
# ¿ Jan 29, 2015 09:06 |
|
In "the real world" it's not abusive to make statements of the form Linus made either. That is, saying "people that read bytes one at a time deserve to be retroactively aborted" is not abusive. It's hyperbolic nonsense and meant to be taken that way. The same goes for saying somebody likes seeing their name on "acked-by" lines, in the context that it was in. I have no idea why you're talking about people saying other people should be raped, Linus is not doing that. People that find the word abusive useful for being unspecific and non-falsifiable have begun using it to talk about Linus. And other people repeat it word by word like the good little followers they are.
|
# ¿ Jan 29, 2015 20:43 |
|
Snapchat A Titty posted:I'm pretty sure the majority of people would find it hostile if someone said they should be retroactively aborted. You're not responding to a post that was talking about whether something should be considered hostile. That does not mean the same thing as the word abusive.
|
# ¿ Jan 29, 2015 21:33 |
|
it is posted:I won't take advice from you, because you're an idiot. , says the 2011 regdate. Enjoy your arbitrary rules not based on a sensible theory of harm.
|
# ¿ Feb 4, 2015 01:47 |
|
|
# ¿ Apr 29, 2024 16:44 |
|
If only we had 12 fingers so that we could have 144x engineers.
|
# ¿ Feb 4, 2015 18:37 |