Catch up on stories from the past week (and beyond) at the Slashdot story archive

 



Forgot your password?
typodupeerror

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 sir...no 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.

Comment: Re:BCD mode (Score 2) 140

by flargleblarg (#49398727) Attached to: Building an NES Emulator
Hmm, you know what? Damn. I misremembered how it worked, and I didn't read closely enough at the link I provided. So, to stand corrected, the D flag was something you set (or cleared) proactively using the SED or CLD instruction. It actually indicated a mode you were in, rather than being a flag in the usual sense (such as a carry or a zero flag).

Comment: BCD mode (Score 3, Interesting) 140

by flargleblarg (#49398525) Attached to: Building an NES Emulator
BCD (Binary-Coded Decimal) mode was cool because it changed the way adding and subtracting worked. If you added 0x01 to 0x29, you'd get 0x30 instead of 0x2A. This was possible because there were actually two carry flags on the 6502 — one (named C) which was set upon overflow of values greater than 255, and the other (named D) which was set upon overflow of the low nybble (e.g., the low 4 bits).

6502.org Tutorials: Decimal Mode

Comment: Re:Gotta disagree strongly . . . (Score 1) 109

by flargleblarg (#48857929) Attached to: <em>Star Trek Continues</em> Kickstarter 2.0
Watched Mind-Sifter. I liked it. They got the lighting and the camera style all wrong, though, whereas Star Trek Continues nails these things. Mind-Sifter did not at all feel to me like a a continuation of 60s Trek — it felt more like a reboot. I appreicate that they tried, but they missed the mark. I did really enjoy the tip of the hat to "Nightmare at 20,000 Feet", though, which was playing on the B&W television. :)

The price one pays for pursuing any profession, or calling, is an intimate knowledge of its ugly side. -- James Baldwin

Working...