Slashdot is powered by your submissions, so send in your scoop


Forgot your password?

Comment: Re:Yes if you can afford the time (Score 5, Insightful) 244

by flargleblarg (#49622435) Attached to: Is It Worth Learning a Little-Known Programming Language?

The simple answer is that once you learn how to code it doesn't matter what the language is.

I couldn't disagree with this more. I don't mean to be flippant or argumentative; I simply want to say that my experience has been quite different. I think the langauge you write programs in is incredibly important. You want the right language for the task at hand. Just as an example, I often prototype new ideas for algorithms in Perl as a prelude to rewriting them in C. Perl (and I'm sure Python is as well) is great for a quick prototype and for proof-of-concept testing. But it's terrible for speed (compared to C/C++), and is also terrible at type-safety. When I rewrite something in C, it often runs 100 or 200 times faster than the Perl version. (Not for parsing and string-based stuff, but for integer numerical analysis stuff). But exploring the data structures and getting them worked out first is easier in a high-level language like Perl, with its dynamic arrays, hashes, autovivification, and so forth. Anyway, I rarely prototype something C, and I rarely write production code in Perl. For me, the choice of the language is one of the most important decisions I make on a daily basis.

Comment: Re:Interesting since Aspartame spiked Sachirine (Score 1) 629

by flargleblarg (#49563367) Attached to: Pepsi To Stop Using Aspartame

Stevia is, to me, the best tasting of the non-calorie sweeteners, and I use it in my coffee, and in my homemade grape soda.

I prefer stevia as well. But I find that I only like it in my tea and not in my coffee (although I used to like sugar in my coffee just fine). Out of curiosity, which brand of stevia do you like best? Maybe I need to switch.

Comment: Re:History repeating (Score 2) 85

by flargleblarg (#49448413) Attached to: Intel's Core M Performance Is Erratic Between Devices

[...] early Apple III computers where heat would cause chips to expand out of their sockets, [...]

“It’s not wise to upset an Apple III.”
“But one worries about upsetting a Droid.”
“That’s ’cause a Droid don’t cause people’s chips to expand out of their sockets. Apple IIIs have been known to do that.”
“I suggest a new strategy, Artoo. Let the Apple III win.”

Comment: Re: Tabs vs Spaces (Score 1) 428

by flargleblarg (#49431843) Attached to: Stack Overflow 2015 Developer Survey Reveals Coder Stats
I actually use spaces-only in my own personal code — personally, I hate tabs... BUT — on larger projects where tabs are part of the team culture, the rules listed really do work wonderfully. Everybody can have their own tabstop setting and nobody gets messed up by indentation. I agree that spaces will maintain what you want the code to look like regardless of what settings someone else's editor has, but you can get the same effect by using tabs intelligently. And finally, the example I gave with the for loop actually doesn't break readability at all — it works for tabstop of any size.

Comment: Re:Tabs vs Spaces (Score 1) 428

by flargleblarg (#49427069) Attached to: Stack Overflow 2015 Developer Survey Reveals Coder Stats

Pretty much. And the issue is that tabs gone wrong is only visible once its viewed by someone with different settings.

Not exactly true. You can pretty easily write a tool that scans a source module for problematic mixing of tabs and spaces. Just require that all changes pass that scan before they are allowed to be checked in.

Comment: Re: Tabs vs Spaces (Score 1) 428

by flargleblarg (#49427057) Attached to: Stack Overflow 2015 Developer Survey Reveals Coder Stats

Which only matters if all indentation, including alignment, is done with tabs. The moment you throw in a few spaces to line something up on a non-tab boundary (say, to align a second line of arguments with the first argument), then you have a mess, unless your tab width is set to exactly the value that whoever touched the code before you set it to.

What?? Nonsense. Using spaces to line something up on a non-tab boundary is exactly what avoids a mess, not creates it.

To use tabs in code, with zero problems whatsoever, follow these simple rules:

1. Use tabs only for indentation, never for alignment.
2. Tabs may never appear anywhere in the source code except as a contiguous sequence of zero or more tabs at the beginning of a line.
3. Use spaces for alignment, never for indentation.
4. Spaces may follow tabs, but tabs may never follow spaces.

All the lines in your module should match the following regex: /^\t*[^\t]*$/

If you have a for (...) loop that splits across three lines, there should be n tabs leading up to the for, and then on each of the following two lines there should be n tabs followed by 5 spaces, for proper alignment.

Comment: Re:Too many pixels = slooooooow (Score 1) 263

by flargleblarg (#49418143) Attached to: LG Accidentally Leaks Apple iMac 8K Is Coming Later This Year
Actually, there is no such thing as pure retina resolution. There is only retina resolution as a function of pixel density and viewing distance. So, 4k on a 32" monitor at an 24" viewing distance is retina resolution at typical viewing distance. However, 4k on a 32" monitor at much shorter viewing distance is not.

Comment: Re:BCD mode (Score 1) 140

by flargleblarg (#49400135) Attached to: Building an NES Emulator
Actually, it was very useful when the 6502 was introduced. Remember, computers were slow back then. Converting a binary number to decimal was especially slow, since it involves division with remainder in a loop, once for each digit produce, and the 6502 had no hardware multiplication or division instructions.

Also — and this is even true today — if you do all your calculations in base 10 instead of binary, you get a different (sometimes more desirable) behavior of rounding. For example, financial calculations are almost always best done in base 10 rather than base 2. No self-respecting spreadsheet program does its financial arithmetic in base 2.

Comment: Re:BCD mode (Score 1) 140

by flargleblarg (#49399155) Attached to: Building an NES Emulator
BCD mode is useful when you are working with numbers that you want to display to humans often. That is, you can do all the arithmetic in base 10 instead of binary. BCD is slower to work with than binary, but much faster to convert in and out of, since there's basically no conversion other than adding 0x30 (ASCII '0') to the nybble you want to display.

Working in binary, on the other hand, requires costly conversion in and out of human-readable decimal. For example, converting decimal to binary requires a costly multiplication (by 10) on each digit consumed, and converting back to decimal from binary requires a costly division (by 10) one each digit produced.

So for things like scores in games, yeah, BCD is a nice thing.

Humanity has the stars in its future, and that future is too important to be lost under the burden of juvenile folly and ignorant superstition. - Isaac Asimov