Please create an account to participate in the Slashdot moderation system

 



Forgot your password?
typodupeerror
For the out-of-band Slashdot experience (mostly headlines), follow us on Twitter, or Facebook. ×

Comment: Re:That's what you'd call an anti-pattern! (Score 1) 486 486

It's even worse - they had to rig the code badly to make their point - and the original is still in the comments!

catString = addString + concatString # modified: concatString = concatString + addString

Here, they are *prepending* catString with addString, which means that catString has to be re-allocated and re-copied every single iteration (EXPENSIVE!)

If you revert the code to the original, it runs about twice as fast as the naive straight-to-disk writer. This is due to a cPython optimization that actually extends the memory the string is stored in, and pastes the second string into it, without re-allocating and copying it, thus preventing the quadratic performance of the anti-pattern.

in-memory: String took 0.17798614502, file took 0.00357103347778
disk-only: file took 0.225710868835

When I re-wrote it using a string join, it came out like this:
in-memory: done properly 0.169091939926, file took 0.00345587730408

Comment: That's what you'd call an anti-pattern! (Score 1) 486 486

This:

for i in range(0, numIter):
    concatString = addString + concatString # modified: concatString = concatString + addString ...from the in-memory part of the experiment. Any Python programmer knows you don't do it this way. Strings in Python are immutable, so this re-allocates concatString every time round the loop, most likely causing multiple garbage collection cycles. It's obvious that this is not written by a Pythonista, as it's not "Pythonic" code. No wonder it's slow.

Better (maybe not the best, tho. Call me lame... )

concatList = []
for i in range( numiter ):
    concatList.insert( addString )
concatString = "".join( concatList )

Comment: Re:The Selfish Gene (Score 1) 249 249

I'm actually reading that at the moment, and this point is made multiple times; charity towards others that almost certainly contain some of the same /genes/ as yourself, is at its basic level, just your genes being selfish. Dawkins also talks about game theory, saying it backs up his theory (I don't have the book with me right now, so I can't quote the researchers he quoted, nor their theories, sorry).

Comment: Re:Not interesting (Score 1) 85 85

Bacteria have NOT stopped evolving (nor has anything else). Evolution is a constant process anyway, but for specific proof, new strains of infectious bacterial diseases are constantly appearing - this is evolution. For a specific example, the use of Penecillin and similar anti-biotics has been an evolutionary selector for microbes that are capable of surviving these drugs - where we now have certain "superbugs" which have evolved from "normal" bacteria. In this case, humans have influenced the process of natural selection, and the result is that only those fit to survive Penecillin have survived in these environments. That's how evolution works.

Comment: Re:What? My 8y/o Peugeot 307 does about 60MPG (Score 1) 717 717

However, whilst answering another post above, I realised I'd made an incorrect assumption: American Gallons not the same volume as Imperial (UK) Gallons, so the American figure is deflated in our eyes.

What Americans call 54MPG the we in the UK would call 64.8MPG.

That probably puts it into perspective for us in the UK. But my 8y/o Peugeot still has a book rating of 62MPG "extended urban cycle".

Comment: What? My 8y/o Peugeot 307 does about 60MPG (Score 1) 717 717

I guess they must be talking about getting traditional US gas guzzler sedans and MPV's to do 54MPG.

Here in the UK, with fuel prices at an all time high, I'm buying diesel at about £6.50 a gallon (£1.43/litre). That's about $10.40 a gallon ($2.29/litre), and most of the difference between UK and US is made up for by tax.

That and a higher population density is probably why we tend to buy smaller, more economical cars here in the UK. I have just switched cars from a 12 year old 1.4 litre petrol (i.e. gasoline) engine to a turbo diesel engine of the same size, and slashed my fuel bill by almost 50% - it was costing me about £300 ($480) per month on fuel, as I commute for 1 hour each way to and from work. So now it's down to about £155 per month. The only reason I didn't do it sooner is because I had to save up two and a half grand to buy a newer car. Over the next two years, I'll recoup the cost of this newer car in fuel savings alone!

So it seems to me that the most obvious way for the US to achieve this goal is to go the same route as we have - tax fuel at a similar rate. But we all know that's not going to happen...

Comment: Nearly 20 years worth of Linux! (Score 2) 867 867

I've been using Linux for nearly 20 years, and have used whatever seemed most useful at the time or whatever was dictated by the organisation I worked at. I used Ubuntu on my desktop/laptop for about 5 years, until Unity came along, then hopped about for a while looking for an alternative to Gnome 3, even trying Fedora 13 with KDE for a while. On servers, I have historically favoured CentOS/Red Hat based systems, but in latter years have moved over to pure Debian.

1993 Yggdrasil - floppy disk install
1994 Slackware
1995 Red Hat 2 - CDROM install
1999 Red Hat 9
2000 Mandrake
2005 Ubuntu 5.04| Fedora Core 4
2006 Ubuntu 6.x|Fedora Core 6|CentOS 4.x
2008 Ubuntu 8.x|CentOS 4.x|Red Hat Enterprise Linux 5.x
2009 Ubuntu 9.x|CentOS 5.x|Red Hat Enterprise Linux 5.x|Slackware 9(?)|Fedora Core 8
2010 Ubuntu 10.10|CentOS 5.x|Red Hat Enterprise Linux 5.x|Fedora Core 8!|Proxmox VE 1.x|Debian Lenny
2011 Fedora Core 13 KDE|Linux Mint 11(?) Debian Edition|CentOS 5.x|Red Hat Enterprise Linux 5.x|Debian Lenny|Proxmox VE 1.8
2012 CrunchBang Statler|CentOS 5.x|Red Hat Enterprise Linux 5.x|Debian Squeeze|Proxmox VE 2.1|Scientific Linux 6.x

Comment: Misdirection or smear campaign (Score 1) 343 343

Sounds like some kind of warped attempt to discredit FOSS to me. It just doesn't sound like the sort of thing that "the community" would do. It's rather counter-productive if someone thinks it will make people start to take FOSS more seriously. I can't help thinking that this is only part of the story.

Comment: Back it up and nuke it! Then scan the backup. (Score 2) 320 320

Back up all the data and then re-install the OS from scratch. Before restoring the data, do a thorough threat scan on it, to make sure there are no nasties lurking in there. If the machine has been rooted, then you simply can't guarantee that anything else you do to clean it up will get rid of all threats. Hope that helps! (I missed a chance there to evangelise on Linux!)

Comment: Autism/Aspergers is not "learned" behaviour (Score 1) 223 223

Everyone seems to be missing the point - autism/aspergers is a neurophysical difference from the "typical" brain structure. It means that people with ASD (Autistic Spectrum Disorder) have a different brain structure than "normal" people - meaning they percieve the world differently, and even think diferently. Although brain structure and development are affected by environmental issues, the structure is largely genetically determined, i.e. some people have a predisposition for ASD. Obviously "too much" TV or YouTube or whatever can be an environmental pressure, but if the predisposition isn't there in there in the first place, I can't see how the drastic structural changes can come about without something like disease to cause it. I'm not a brain doctor, I'm a geek. I also hate TV (we don't even have one at home) and I do firmly believe that it rots your brain, but I love computers. I didn't have access to a TV until I was about 4, despite my dad being a TV engineer, and even when I did, there were only kid's programmes on for 1.5 hours a day, in the afternoon - we're talking early seventies era here. I've just (last week) been "informally" diagnosed with Aspergers, and from the research I've been doing, I'm fairly certain that my father and grand-mother on his side had it too. Two of my nephews were diagnosed with ASD's last year too. One of them is profoundly deaf and wasn't interested in TV until he had cochleal implants fitted 2 or 3 years ago. My 20 month old son is also showing some signs - lining toys up, sorting them, good with puzzles, extremely high IQ... I'm SO glad we don't have a TV, though, as I'm certain it makes things worse. I AM however, considering getting a tablet computer for him once he's physically able to use one without destroying it! My recent diagnosis has certainly put things in perspective, but in the end, it's shaped who I am. I'm not totally socially unaware or unreachable, but I'm just different (some say odd). Autism isn't a disability, it's a DIFFability.

Torque is cheap.

Working...