Follow Slashdot blog updates by subscribing to our blog RSS feed

 



Forgot your password?
typodupeerror
Note: You can take 10% off all Slashdot Deals with coupon code "slashdot10off." ×

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).

https://www.fcc.gov/guides/ama...

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

if(x1!=x2)
{
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:Hmmm .... (Score 1) 100

There likely are specific laws, likely related to holocaust and Armenian genocide denial and such, that would allow a group like the Sikhs to sue a US firm that aids and abets such calumnies.

Considering the 1980s attack on the Sikh ethnic group by Hindis was a well organized and deliberate attempt at genocide, I would suggest that they have a good case.

More personally - Zuckerberg you goddamn moral coward, if Facebook doesn't support groups like this, it serves no useful purpose other than data mining and privacy undermining.

If bankers can count, how come they have eight windows and only four tellers?

Working...