Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!


Forgot your password?
What's the story with these ads on Slashdot? Check out our new blog post to find out. ×

Comment Test code (Score 1) 285

Write code to test your code. Hit every edge case hard, every boundary condition.

All too often we tend to test our code by just running the overall program, but this is not good enough. Running the overall program does not introduce a wide enough range of input parameters to every function.

Write test code. Write code to log your inputs and outputs to files early in the development cycle. Don't get swamped down in the land of trying to debug code that was never written to be debugged.

I had many many tough bugs back in the day before I learned this lesson. Once I got this behind me, it was a lot easier.

Comment Re:I hope he wins in court (Score 1) 1197

Hmm... let's re-word that a bit and see how you feel from the other side:

Flying a drone in a populated area is unsafe in nearly every circumstance. Just because there's no malfunction doesn't mean there couldn't be. If the done had suddenly dropped altitude, would the pilot have tracked it like a skilled operator to land it? Would that have brought the craft down to a point where the pilot could have endangered neighbors? What if the drone landed in the pool? Was the pilot certain that in all cases his flight-range was clear before flying? These are all things which a responsible drone owner thinks about.

I hope the pilot gets a big-ass fine (I'd hate to pay for his jail food out of taxes). I also hope the flier gets a fine for trespassing - or even just gets called into court and let of with a warning. The lawyers fees will probably be 10x what the drone cost to begin with.

Comment Re:Buy an rf jammer, become a drone collector (Score 1) 1197

Also, that would be willful interference.

  Section 97.101(d) of the Commission's Rules prohibits amateur operators from willfully or maliciously interfering with or causing interference to any radio communication or signal. 47 C.F.R. 97.101(d).


But hey, I think you can argue the situation calls for it anyway!

Comment Only for developers: replace numbers with symbols (Score 1) 698

Try this one out: remap the upper numeric keys from numbers to the symbols they have above the numbers. When you need a number, hit shift to get the numbers or use the numeric keypad.

I find it very annoying to hold down shift so often while coding. I almost never use the upper-row numbers as numbers, but I hit a lot of symbols coding in C and C++. I definitely use the symbols more, why do I have to hit shift to get to them?

Just look at a hunk of your favorite OSS project's code. Are there more numbers or symbols?

Granted, any facebook/gmail computer user wouldn't get this at all...

Comment Re:Hell No! (Score 1) 1067

Come to think of it though, if you are working in uint space (that is, unsigned ints), than you *can't* have approached from below zero.

And if you were for some reason working with unsigned ints that were always multiplied by -1 than I think you'd still be ok with -1 * inf as your result.

Just so we're clear: this is stupidity -- the algorithm is not returning useful data and it will only mess up everything down the line. Sanitize before you divide, handle divide by zero as an error or a special case.

Comment Re:I'm tired, too (Score 1) 1067

slope = (y2-y1) / (x2-x1);

If x1 == x2, you probably don't actually *need* a slope. You can mark those shapes or lines as perfectly vertical. Any algorithms that process based on slope would just skip those lines. A simple bool array that accepted pixel or shape (not really sure of the application) coordinates could return several useful parameters that would keep other algorithms from tripping up.

You might think this is a lot of overhead, but passing uint(-1) to an algorithm needlessly, or rotating your entire scene to avoid this is also a lot of overhead. If you just make a single pass over the scene and store the parameters (remember, memory is plentiful these days compared with CPU), then you can do very simple logic on the processing side, re-using the stored results.

You can fix the math by fixing the algorithm, no need to return results when the results are not only undefined but also not useful.

Comment Re:Be Careful What You Wish For (Score 1) 631

You might be right that this is a loaded Trojan horse.

However, I have no problem with what is on the surface. These are good ideas -- the internet is very much deserving "public utility" status. I'm not worried about fast lanes, I'm worried about intentionally making competition-owned services slower. The internet is a freaking power outlet, it should not matter what brand of hair dryer I plug in. If I need more power, I buy more power (bandwidth). But it doesn't matter what I am using it for.

The thing is we're worried about what comcast "might" do. And you're worried about what the NSA/government "might" do. Well maybe we're both right, did that ever occur to you? Maybe the government wants to overreach, to spy on your ebay shopping and snoop on your email. Maybe private industry wants insert extra ads while I web surf, or slow down Skype so that I am more likely to use iMessage, or make Amazon faster than Netflix in return for a little cash on the side. or whatever. Lots of maybe here.

We have to attack on both fronts. Neither party is trustworthy here.

Comment Re:Yep it is a scam (Score 1) 667

I'd say they are as qualified as the democrats. The democrats are convinced and will vote for anything related to it. The republicans are convinced the other way. Neither party is being particularly scientific about this or any other political issues. And yes, this is only politics. Climate science deserves a lot more than a binary vote.

There are no significant differences in the senators between the two parties. They both wine and dine together, both came from big old-school money, went to Harvard, etc. Mostly law degrees. What did you think, the democrats were all scientists and the republicans all oil surveyors?

Grow up, take the blindfold off. You have been pulled into drinking the party's punch. Stop before it's too late.

To downgrade the human mind is bad theology. - C. K. Chesterton