585 karma · joined July 16, 2010
http://www.beyond-syntax.com/
* man page: http://manpages.ubuntu.com/manpages/trusty/man1/pollinate.1....
* Q&A style blog post: http://blog.dustinkirkland.com/2014/02/random-seeds-in-ubunt...
* A "why this is scary" blog post: https://tim.siosm.fr/blog/2014/04/25/why-not-ubuntu-14.04-lt...
In the context of this thread, brghts states that this is dangerous because if you compile with -DNDEBUG the assert is optimized away.
So if I copy that code with the assert statement, it will be optimized away and your code no longer performs the NULL check. This is bad.
As you mention, beginners tend to copy code off the Internet and cause bugs. If you recognize this and claim to be teaching people you should not use bad practices in your example code. Period.
If you don't want to muddy the waters with your custom debug macros, then you should still play it safe when checking return values the a beginner may simply copy and think is correct.
[1]: http://c.learncodethehardway.org/book/krcritique.html#code--...
> The problem is, as with every book with code ever in the universe, beginners will copy that code out and use it somewhere else and then the function is wrong.
Yet, if a beginner copied some of the code in this chapter they'd have the exact bug you are talking about here (using the NULL pointer returned from malloc()).
I think you should probably expand that into the safer checks (don't forget to free(line) if longest is NULL too!).
Other than that this seems like a great improvement!
The creation occurs in the --setup portion. The field accesses occur in the actual looping portion of the timeit code.
The timed portion is simply the field accesses.
My reading of the docs[1] has always led me to believe that it doesn't. For example, "It is possible to provide a setup statement that is executed only once at the beginning"
$ python -m timeit --setup "from collections import namedtuple; Point = namedtuple('Point', ['x', 'y']); p = Point(x=0, y=0)" "p.x + p.y"
1000000 loops, best of 3: 0.284 usec per loop
vs. $ python -m timeit --setup "p = {'x': 0, 'y': 0}" "p['x'] + p['y']"
10000000 loops, best of 3: 0.0737 usec per loop
Maybe the use isn't right because I agree with your belief that namedtuple is suppose to be more performant.But the article does cover more than just the incident, I found the whole thing fairly interesting.
Beyond the passing knowledge I have from growing up in Chicago-land around the time and the Wikipedia article on the subject, I thought it contextualized the FCC policies around the time of the incident and how the hack worked (from a high level). It also pointed out other signal intrusions from the same period and the FCC/FBI's methods to track down the perpetrators.
[1]: http://en.wikipedia.org/wiki/Max_Headroom_broadcast_signal_i...
Source: Former Chicago native that purchased Safeway branded food at Dominick's.
The same thing happened to be when I ordered a MacBook back in 2007, where a few days later they announced better specs and I got a notification saying they updated my order to reflect the changes.
It's one of the reasons my next laptop will probably still be Apple.
Evidently, only 0.0085% of users toggle on the "Use a master password"
There is a filter tab in the Disqus admin area, one of those tabs is "filter," here is the text around below the restricted words input box:
"Separate words with commas. You may use .* (dot asterisk) as wildcard, but be careful not to be too aggressive. For example, s.*ck will match suck, but also sock and stack. Words must be at least 3 characters in length.
Here is a sample list of restricted words[1]."
[1] http://mediacdn.disqus.com/1362527340/sample-badwords.txt
(I wouldn't mind my bank using this, it's better than what they have in place...)
Is it harsh? Would it be harsh to judge an authentication scheme that stores all passwords in plaintext? Server logs don't typically contain data that should be considered secret. IF this authentication scheme led to secret information being stored in a file that wasn't expected to be secure, that would be a major problem, wouldn't it?
This type of authentication hasn't stood up to a large amount of scrutiny, so it is important to think through some attack vectors that might be opened up. This was one I thought up, but it isn't an issue since the tokens are one-shot.
For the record, I like this authentication scheme but that doesn't mean it shouldn't be challenged.
Hmmm, it looks like you might be right. I tried it earlier with one in a private window and it worked twice, but when I just tried again it was invalid/expired (though the email is 50 minutes old).
And I certainly agree that if the server is compromised you've got more problems, but in the IEEE example the server wasn't hacked they just made a mistake by making the logs available.
Edit: yup, I must have made a mistake (not closing private window or using non-private window) in my test.
Usually username and password are sent via POST not GET so the logs don't have that data (unless you're IEEE and user GET and have your logs available through FTP).
Just because Spotify accidentally (or purposefully) took advantage of that hole doesn't mean it's not Facebook at fault here.