correctness

What is your experience with software model checking?

What types of applications have you used model checking for? What model checking tool did you use? How would you summarize your experience w/ the technique, specifically in evaluating its effectiveness in delivering higher quality software? In the course of my studies, I had a chance to use Spin, and it aroused my curiosity as to how...

Is this minimum spanning tree algorithm correct?

The minimum spanning tree problem is to take a connected weighted graph and find the sub set of it's edges with the lowest total weight that keeps the connected restriction but results in an acyclic graph. The algorithm I am considering is: Find all cycles. remove the largest edge from each cycle. The impetus for this version is an ...

Proving correctness of multithread algorithms

Multithread algorithms are notably hard to design/debug/prove. Dekker's algorithm is a prime example of how hard it can be to design a correct synchronized algorithm. Tanenbaum's Modern operating systems is filled with examples in its IPC section. Does anyone have a good reference (books, articles) for this? Thanks! ...

Loop termination conditions

These for-loops are among the first basic examples of formal correctness proofs of algorithms. They have different but equivalent termination conditions: 1 for ( int i = 0; i != N; ++i ) 2 for ( int i = 0; i < N; ++i ) The difference becomes clear in the postconditions: The first one gives the strong guarantee that i == N after...

Random Number Generator: Class level or Method level?

Hi! When using a Random Number Generator, which is the better way to use it for greater randomness of the new value: Have a method that instantiates a new instance of the RNG each time and then returns a value? Have an instance of the RNG at the class level, which is instantiated once in the Constructor, and all subsequent calls for a...

Best design for RadioButtonList usage

I have a problem and i would like to learn the correct way to solve this. I have a Data Objeckt class LinkHolder { public string Text; public string Link; } I would like to present to the user a RadioButton list that uses the LinkHolder.Text value as descriptive text. Then on the postback, i would like to do a Server.Trans...

Are there any software guarantees in critical systems?

Are there systems or is there software out there that is developed with a proof of correctness to back it up? Or are all critical systems developed merely with an aggressive code review and test cycle? ...

Correctness testing for process modelling application

Our group is building a process modelling application that simulates an industrial process. The final output of this process is a set of number representing chemistry and flow rates. This application is based on some very old software that uses the exact same underlying mathematical model to create the simulation. Thousands of variables...

Unit Testing - Is this the 'right' way or the 'wrong' way?

If you were testing a count function like the one below, is it considered to be 'right' or 'wrong' to test multiple things for the function in one function vs having a test function for each of the tests? function testGetKeywordCount() { $tester = $this->getDatabaseTester($this->CompleteDataFile); $tester->onSet...

How to build without using locally installed artifacts

Is there any way to force Maven to use remote artifacts and not those installed on your machine? since I worry about runtime errors and not compilation errors build server is not valid option. P.S. I know I could delete or rename the .m2 folder, but I bet there is some more clever way of doing this. Maybe some plugin or special command ...

Counting trailing zeros of numbers resulted from factorial

I'm trying to count trailing zeros of numbers that are resulted from factorials (meaning that the numbers get quite large). Following code takes a number, compute the factorial of the number, and count the trailing zeros. However, when the number is about as large as 25!, numZeros don't work. public static void main(String[] args) { ...

is my Enumeration correct ?

All over our project, we have this kind of enums. They works just fine, but we are not sure about them. Specially with the getDocumentType(String) method. Is there a way to avoid the iteration over all the Enums field ? public enum DocumentType { UNKNOWN("Unknown"), ANY("Any"), ASSET(Asset.class.getSimpleName()), ME...

Is there an easy way to verify replication articles are correct?

On a Publication (secondarily, a Subscription), is there a script or command I can run that verifies that the articles currently in place match what is expected and/or correct? If changes were manually made to a replication database (i.e. a table's "MSMerge_ins_..." trigger is modified or deleted, causing replication of that table to fu...

Checking Python code correctness

In C++ I have compiler that tell me if something wrong with my code after refactoring. How to make sure that Python code is at least correct after changes? There may be some stupid error like wrong function name etc. that pretty easy to find in compile time. Thanks ...

How to write correct code at the first time?

I usually make lots of mistakes (logic errors, syntax errors) in the first attempt to accomplish some programming tasks. I have to write unit test to detect those bugs. This is especially problematic when I am in an interview. In that situation, I am under pressure and I can not test my code with compiler and unit test. My question is t...

Formally verifying the correctness of an algorithm

First of all, is this only possible on algorithms which have no side effects? Secondly, where could I learn about this process, any good books, articles, etc? ...

When do I need to specify the JavaScript protocol?

I was under the impression that I only need to specify the "protocol" when using JavaScript in URL attributes, such as in hrefs. Is this the only "useful" context for javascript:? Sensible: <a href="javascript:alert('Hello')">World!</a> Silly: <form onsubmit="javascript:alert('oops!')"> Is this right? Or is there some obscure bug/...

"Sign In" or "Log in" or "Login"

Possible Duplicate: UI Terminology: Logon vs Login Which is the right one to use - Sign in - Log in - Login Being a non-native English speaker it is difficult to distinguish them. I guess I should have asked at dictionary.com forum but I need a technical answer. ...

What is the appropriate way to intercept WSGI start_response?

I have WSGI middleware that needs to capture the HTTP status (e.g. 200 OK) that inner layers of middleware return by calling start_response. Currently I'm doing the following, but abusing a list doesn't seem to be the “right” solution to me: class TransactionalMiddlewareInterface(object): def __init__(self, application, **config): ...

assign member based on string value

I need start off with code because I am not sure what terminology to use. Lets say I have the following code: class Node { public: void Parse(rapidxml::xml_node<> *node) { for (rapidxml::xml_attribute<> *attr = node->first_attribute(); attr; attr = attr->next_attribute()) { std::stringstream converter;...