logic

Best technology layer to start with

When I first started out in programming, the first technology I learned was C++. I got a little disheartened with it because I had to put in a lot of effort to get a rather crappy result. Once I learned PHP however, that quickly became my favourite language because I could get stuff to render on my web page straight away and get some co...

Business and application logic?

Hi all, I often see the phrases 'business logic' and 'application logic' in terms of web development (I assume it also applies to programming in general rather than just web development). This is quite new to me so I don't really know what it means, could anyone please explain me what is exactly meant by this? Is it just a 'buzz word'...

Using JavaScript/jQuery to generate fixtures

I'm putting together a tool for a colleague which helps to create a nice fixture list. I got about 2/3 through the tool, collecting various data ... and then I hit a brick wall. It's less of a JavaScript problem and more of a maths/processing brainblock. Lets say I have 4 teams, and they all need to play each other at home and away. Usi...

Logic question (universal and existential quantifications)

Hi there, I have a logical statement that says "If everyone plays the game, we will have fun". In formal logic we can write this as: Let D mean the people playing. Let G be the predicate for play the game. Let F be the predicate for having fun. Thus [VxeD, G(x)] -> [VyeD, F(y)] V is the computer science symbol for universal quantifi...

C# code only gives expected results on step through?

Ok so I have a dice throw app... When I step through the code it functions normally and 'results' contains the correct number of throw results and they appear to be random, when I leave the code to run and do exactly the same thing it produces a set of identical numbers. I'm sure this is a logical error I cannot see but fiddling with i...

For Loop do action every 5 results

can someone tell me the logic (in any language ) including pseudo code. on how to create a for loop an have it fire an action every 5 results it spits out. basically I'm just trying to emulate a table with 5 columns. Thanks! ...

Why does a "&&=" Operator not exist?

(a && b) has the same value as (a & b), but with && the expression b is not executed if a is false. In Java there is also an operator &=. a &= b is the same as a = a & b. Question: Why isn't there an operator &&=, at least in Java. Is there some reason why I would not make sense to have it, or is it simply that no one cares or needs it...

Crystal Reports compare does not work without trim

{AR_Customer.CustomerType} is a 4 character field {AR_Customer.CustomerType}<>"S" does not return all records where this is true unless I do it this way: trim({AR_Customer.CustomerType})<>"S" in the actual database the NULL fields are the ones I'm missing. So this tells me than NULL is the same as "S" -- I don't think so, but that's h...

MVC: Just me or is IsValidField illogical

While I was writing some code to print out JS when a field is not valid in the ModelState is came to the following method: ModelState.IsValidField(string key) The comment in IntelliSense tells me: Returns true if there is any System.Web.Mvc.ModelError associated or prefixed with the specific key. While I ask whether a field is ...

Is there a short-circuit OR in PHP that returns the left-most value?

In some languages, you can do $a = $b OR $c OR die("no value"); That is, the OR will short-circuit, only evaluating values from left to right until it finds a true value. But in addition, it returns the actual value that was evaluated, as opposed to just true. In the above example, in PHP, $a will be the value 1 if either $a or $b are...

Learning Java and logic using debugger. Did I cheat?

After a break from coding in general, my way of thinking logically faded (as if it was there to begin with...). I'm no master programmer. Intermediate at best. I decided to see if i can write an algorithm to print out the fibonacci sequence in Java. I got really frustrated because it was something so simple, and used the debugger to ...

Algorithm for finding failure cases in a communication "web"

I am trying to enumerate a number of failure cases for a system I am working on to make writing test cases easier. Basically, I have a group of "points" which communicate with an arbitrary number of other points through data "paths". I want to come up with failure cases in the following three sets... Set 1 - Break each path individuall...

How to prove inconstructable cryptographic scheme?

Hi, I realize this question might not be that programming related, and that it by many will sound like a silly question due to the intuitive logical fault of this idéa. My question is: is it provable impossible to construct a cryptographic scheme (implementable with a turing-complete programming language) where the encrypted data can...

C++ interview preparation

I have a Phone interview coming up next with with a company which works in financial software industry. The interview is mainly going to be in C++ and problem solving and logic. Please tell me the method of preparation for this interview. I have started skimming through Thinking in C++ and brushing up the concepts. Is there any other way...

How often do You Encounter so called "Frame Problem" while Describing an App. Domain?

Have you experienced such stress in a real-world task and how did you get rid of it? I hope that my question is OK, otherwise feel free to close it. ...

Hilbert System - Automate Proof

I'm trying to prove the statement ~(a->~b) => a in a Hilbert style system. Unfortunately it seems like it is impossible to come up with a general algorithm to find a proof, but I'm looking for a brute force type strategy. Any ideas on how to attack this are welcome. ...

Fastest way of finding the middle value of a triple?

I've got the following scenario: There are three ("pseudo" randomly chosen) int or float values which represent indices of an array. Now I'd like to compare the appropriate values from that array. After having compared them I'd like to know the middle value of the three and use this specific element for some further array operations. T...

Convergence of Mathematics and Programming Languages

It seems that there is a strong movement for the convergence of mathematics and computer programming languages, this is notably evidenced by the influence of the lambda calculus on modern languages. Most of the time I do not think with mathematics, I think with logic. It seems to me that many of the phenomenon that can be modeled mathema...

Distinguishing extra element from two arrays?

One of my friend was asked this question in an interview - You have given two integer arrays each of size 10. Both contains 9 equal elements (say 1 to 9) Only one element is different. How will you find the different element? What are different approaches you can take? One simple but lengthy approach would be - sort both arrays,...

Game Engine Falty Animation Flipping Logic

Hi Everyone, I am currently working on a nice little 2D game engine in AS3. You can even load in different flash movie clips through XML for the different animations. One of the features also allows you to flip an animation when you perform a certain action. That way you could have 1 animation for both left and right (as usual). I have t...