theory

Designing MVC URL scheme for hierarchical system

So imagine I'm building a Multi User Dungeon system using a MVC web application. To describe the areas the player can explore, the system can contain a number of Maps, which will consist of Rooms and Doors - where doors connect two Rooms. Consider the authoring part of the system. To create a Map is easy - I need URLs like: /Author/Map...

Relational Databases and Mathematics?

Can anyone suggest resources that take a mathematical approach to relational databases? Essentially relational algebra I'd guess. I have a mathematics background and now work a great deal with databases and would like to close the gap. ...

Best-case Running-time to solve an NP-Complete problem?

What is the fastest algorithm that exists up with to solve a particular NP-Complete problem? For example, a naive implementation of travelling salesman is O(n!), but with dynamic programming it can be done in O(n^2 * 2^n). Is there any perhaps "easier" NP-Complete problem that has a better running time? I'm curious about exact solutions...

Serialization to Disk inplace of creating a simple database... Is there a pattern or industry name for this approach?

I am leading a development team of 5 or so developers and we have a need to persist a small amount of data. I am thinking we do not need to employ a full DB engine and instead we can simply serialize our data to disk. We would serialize our collections of object to and from disk as needed at runtime instead of to a DB where we have to ...

Are there any good resources on real world practical uses of programming theory?

Can anyone recommend any good material that seeks to provide a real world perspective on programming theories? I'm speaking from my perspective as a long time professional software engineer slash ex-cs student. When I say real world, I mean stuff like "Why should I use interfaces? Doesn't that go against DRY principles? It just seems l...

How to write an enumeration of all computable functions?

Motivation: I'd like to be able to use toy functional programming in languages without first-order functions, by using natural numbers instead of functions. A universal function is a function f : N -> (N -> N), equivalently f : N * N -> N that enumerates all possible computable functions. In other words, there's a number k such that f(k...

Exactly what is the difference between a "closure" and a "block"?

I've found that lots of people use the words closure and block interchangeably. Most of these people can't explain what they're talking about. Some Java programmers (even ones from really expensive consultancies) talk about anonymous inner classes as "blocks" and "closures" - but I know this isn't true. (You can't pass mutable variables...

How to store a list of users, and let the users know they are on that list

Im building a site where a user can add people to their "list". This list belongs to the user, but im wondering whats the best way to store/retrieve/loop through this list in a function, to show the people who are on the list, that they are there and who created it. So once the list of usernames is created, i would assume store it in a ...

Is transactions over machine boundary (via tcp-ip) possible?

Hi, Theoretically, can one define a protocol where one machine does some remote calls on another machine (or more than one), and where in any part of the process, if any of the machines (or operations) fails, or the communication drops, everything is rolled back? (just like databases can) I ask this, since on the hardware level, one a...

How can I learn about compiler theory - online/free resources

I'm interested in learning - at depth - about compiler theory... parsing EBNF LALR? Are all terms I'm familiar with but don't really understand how to actually implement/use.. I'm looking for links, tutorials, and other resources; all online, preferably all free... I'm more interested in simple / complete implementations, than comp...

How to choose and set the correct loop invariant?

Hi, I've been given the following problem about loop invariants: Consider x=4; for(i=5;i<k;i++) { a=a+x+i; x=x*2; } Define the appropiate loop invariant that utilizes a closed formula for a and x. Now, How do you know you have the right loop invariant here? I mean you can set the loop invariant to be: "At j'th iteration 'x' is less...

From a coder's perspective, what kind of project should I choose python over php for where both could do the job?

I've never used python before. I've used php for about 5 years now. I plan to learn python, but I'm not sure what for yet. If I can think of a project that might be better to do in python, I'll use that to learn it. Edit: just to add this as an important note, I do mean strictly for linux, not multi-platform. Edit 2: I'm hoping for obje...

What is the reason for not allowing in C++ a default value for a variable to be a non-static method or member of a class ?

I wanted to know why the default value for a variable for a method of a class, cannot be a non-static method or member of the same class. Is there a reason for that ? Could not the compiler provide to the method the position in the class of the non-static default value ? I tried to google quickly for an answer but I could not come up w...

Not-mathematical description of NL-complexity

NL-Complexity appears to be related to NP-complexity, and i would like a non-mathematic explanation (being that i only have a passing familiarity with the level of mathematics used in that article). Can someone provide a description of how it relates to programming and NP-complexity? ...

Developing my own RDBMS

I've always been fascinated by how these huge RDBMS servers can work for months, shuffling data all around without losing it, perform all kinds of queries and generally being very complex beasts. I understand how much effort it takes to create even something as "simple" as SQLite, but I cannot resist the desire to try and develop my own...

Recursive Sets vs Recursive Functions

What s the difference between a recursive set and recursive function? ...

Is there an algorithm which prints out a shuffled list without actually modifing the list?

After reading this question I started to wonder: is it possible to have a shuffling algorithm which does not modify or copy the original list? To make it clear: Imagine you are given a list of objects. The list size can be arbitrary, but assume it's pretty large (say, 10,000,000 items). You need to print out the items of the list in ra...

Why does ReSharper want to use 'var' for everything?

I've just started using ReSharper with Visual Studio (after the many recommendations on SO). To try it out I opened up a recent ASP.NET MVC project. One of the first and most frequent things I've noticed it suggesting is to change most/all my explicit declarations to var instead. For example: //From This: MyObject foo = DB.MyObjects.Sin...

datatype programming

I know of "imperative" and "functional" programming but there was little I could find on "datatype" programming. Is there such a thing and how is it related to the other paradigms? ...

Who invented the throw/try/catch[/finally] kind of error handling?

My questions are more of historical nature than practical: Who invented it? Which language used it first (and to what extent)? What was the original idea, the underlying concept (which actual problems had to be solved these days, papers welcome) ? Is LISPs condition system the ancestor of current exception handling? ...