3,608 karma · joined Jun 9, 2011 (15y ago) · 1,202 submissions
comment 12y ago · link · parent
from collections import defaultdict
FIZZ=3
BUZZ=5
cache = defaultdict(str)
for i in xrange(FIZZ-1, FIZZ*BUZZ, FIZZ):
cache[i] = 'Fizz'
for i in xrange(BUZZ-1, FIZZ*BUZZ, BUZZ):
cache[i] += 'Buzz'
for i in xrange(100):
print cache.get(i%(FIZZ*BUZZ), i+1)
But I'm rather partial to the generator versions you and others posted.comment 12y ago · link · parent
I don't know about what other operating systems do.
Apparently all modern unixes overcommit address space in
much the same way as Linux. However, i can't believe that
FreeBSD handles this as crassly as Linux does.
Solaris does not (generally, unless you use MAP_NORESERVE w/ mmap).In general, the Linux kernel's default OOM behaviour is undesirable for the vast majority of enterprise use cases. That's why RedHat and many other vendors used to disable it by default (unknown who still does).
Why is it bad? Simple; imagine your giant database is running with a large address space mapped. Another program decides to allocate a large amount of memory. The Linux kernel sees the tasty database target, kills it, and gives the smaller program its memory. Congratulations, your database just went poof.
There's an article that discusses the advantages/disadvantages with respect to Solaris here:
http://www.oracle.com/technetwork/server-storage/solaris10/s...
The article (while old) still applies today.
comment 12y ago · link · parent
I'm just trying to point out that attempting to compare applications from a certain period in computer history to modern applications is doomed to fail.
While I certainly believe optimisation work would help some modern editors, it would be silly to attempt to blame that all on optimisation work instead of recognising that the world is different now.
comment 12y ago · link · parent
I say this as a long-time vim/emacs user... (yes, I've learned and use both although I primarily use vim).
So while I'll readily agree that I doubt they work as much at optimisation, they're also being asked to do significantly more.
comment 12y ago · link · parent
Also, one of the Solaris Security Engineers wrote about random number generation on Solaris extensively just last year:
https://blogs.oracle.com/darren/entry/solaris_random_number_...
Some blogs from other Solaris Security engineers:
Valerie Fenwick: http://bubbva.blogspot.com/
Dan Anderson: https://blogs.oracle.com/DanX/
Darren Moffat: https://blogs.oracle.com/darren
...and last, but not least, Enrico Perla (doesn't have a blog at the moment as far as I know) did author this book and is a Solaris Engineer and someone that works on Solaris Security-related things:
http://www.amazon.com/Guide-Kernel-Exploitation-Attacking-Co...
comment 12y ago · link · parent
For example, on Solaris from random(7D):
The /dev/random and /dev/urandom files are suitable
for applications requiring high quality random numbers
for cryptographic purposes.
...
While bytes produced by the /dev/urandom interface are
of lower quality than bytes produced by /dev/random, they
are nonetheless suitable for less demanding and shorter
term cryptographic uses such as short term session keys,
paddings, and challenge strings.
In short, on Solaris, you can use either one although you are encouraged to only use /dev/urandom for specific cases.comment 12y ago · link · parent
Also, I'm confused by the claim that Solaris doesn't have the vfsstat utility; yes, it doesn't have that utility, but it does have "fsstat" which provides VFS-level statistics. So it'd be helpful to see a more detailed comparison.
comment 12y ago · link · parent
comment 12y ago · link · parent
Your task now should be obvious: Come up with an agreed-upon definition of "the Linux community", and run a valid survey.
That's your problem not mine; history has already established a precedent and you seem deadset to prove otherwise. I don't need to disprove what is already apparent. You've established nothing more than that the kernel contributors are willing to work within that framework, not that they feel the same as Linus does.
No, I've established that not only are they willing to work within that framework, but that it's logical to assume that they agree with both the licensing and direction. Otherwise, why would they devote so much time and energy?As they, "actions speak louder than words" -- and your words seem very dim compared to the action of thousands of contributors.
comment 12y ago · link · parent
And you can't seriously convince me for a moment that the vast majority of the Linux community doesn't agree with Linus.
Every single kernel contributor must at least feel partially the same way, after all, they agreed to contribute under the existing license terms which (as Linus pointed out) can effectively never be changed.
comment 12y ago · link · parent
As an example, John Carmack (formerly of ID Software) recently posted this on twitter:
GPL never did really do anything for game code, and I do
wonder whether it was a fundamental cultural
incompatibility.
https://twitter.com/ID_AA_Carmack/status/434005981379309568When I was merely a user of free software, I too believed as others did, that a more restrictive (or "stronger" if your prefer) copy-left license was better. However, the more years I've spent in the software industry, the more my opinion has varied.
I think it ultimately comes down to who the primary "users" of your code are. If it's an application, it's probably ok to use more restrictive licensing. If it's a library, or code that's in any way intended to be reused by others more generally, the licensing should have very few restrictions if you want to encourage wide usage and to discourage others from duplicating the work.
comment 12y ago · link · parent
I also find the "never seems to fit into the OS" argument a bit silly as most of the popular IDEs don't really "fit" either. For example, XCode's UI design is all over the place -- it doesn't match a lot of what users expect from OS X. Visual Studio has screaming uppercase menus and odd controls (among other oddities). Eclipse, well, it's never even come close to looking like a native application.
So perhaps the more interesting question I'd ask is what IDE have you used actually feels, looks, and acts like a truly "native" application?
In the end, I care more about a usable application that works on the platforms I use consistently then one that works wildly differently on every platform just so it can "feel native".
comment 12y ago · link · parent
The Chromium project doesn't build on many platforms, and the build system they use for it is minimally documented.
While individual bits of code might be reusable on other platforms, I'd be hesitant to base any project I create on Google's codebase given the lack of portability and their reliance on arcane buildsystems.
comment 12y ago · link · parent
Making go-routines map to OS-level threads is a pain. And as much as I hate to trot out this old chestnut, the lack of generics is also a real pain.
I've gotten too used to having generic containers to go back, and the various hacks available just aren't worth it.
I still can't believe Go doesn't have some of the "basic" data types that older languages do such as Python's set() objects and the various operators.
That said, if was writing a small command-line utility for text manipulation or something else similar in scale that doesn't involve dealing with POSIX threading, I'd probably use it instead of Python, C, or C++.
comment 12y ago · link · parent
Intel could easily offer ECC support in its consumer line of desktop (none) and laptop processors (only offers it on 3 of them: http://ark.intel.com/search/advanced/?s=t&FamilyText=4th%20G...), but doesn't.
To me, ECC support should be like SSL/TLS for modern applications; don't do it without it!
comment 12y ago · link · parent
However, I stand corrected in two regards. The first is that as of gcc 4.6+, the sed example the author provided is no longer allowed even if the structs are unnamed. (I was testing with gcc 3.4.) I verified that gcc 3.4 would happily allow me to use the provided sed example as long as I removed the names from the structs.
Second, the C11 standard specifically does not allow for the sed example provided because the structs in the unions contain duplicate members.
I had seen reasoning that hinted at what you're saying in one of the comments posted on the author's blog entry.
Regardless, thanks for encouraging me to dig deeper.