theory

Basic options with an Authorisation system?

Simple situation. An existing project will need authentication and authorization and I need to design it. First of all, I choose to divide the whole thing into two modules, one for authentication and the other for authorization. Both will be seen as blackboxes for the project. For now, the authentication module will just use the Windows ...

Practical consequences of formal grammar power?

Every undergraduate Intro to Compilers course reviews the commonly-implemented subsets of context-free grammars: LL(k), SLR(k), LALR(k), LR(k). We are also taught that for any given k, each of those grammars is a subset of the next. What I've never seen is an explanation of what sorts of programming language syntactic features might req...

Why is "explicitness" considered a Good Thing?

I often hear people praise languages, frameworks, constructs, etc. for being "explicit". I'm trying to understand this logic. The purpose of a language, framework, etc. is to hide complexity. If it makes you specify all kinds of details explicitly, then it's not hiding much complexity, only moving it around. What's so great about exp...

Are semaphores "complete"?

Can every imaginable synchronization problem be solved with judicious use of semaphores? What about weak semaphores? ...

How do I mimic access modifiers in JavaScript with the Prototype library?

I've been working with the prototype library for some time now and occasionally find myself wishing I had multiple access levels (public, private, and protected). The closest I've come so far is the following: SampleBase = Class.create({ /* virtual public constructor */ initialize: function(arg1, arg2) { // private ...

Theory of Computation

Hi, Can anybody please explain me use/importance of studying Theory of Computation. I had course on the same subject during graduation but I did not study is seriouly. I also found following link where some video lecture are available. http://aduni.org/courses/theory/index.php?view=cw ...

OOP Game Design Theory

I've tried to develop a 2D game with C++ in the past using mere objects, however, in the design process I don't know how and what parts of the engine I should split into smaller objects, what exactly they should do and how to make them interact with each other properly. I'm looking for books, tutorials, papers, anything that explains the...

Is there a more efficient way of coding this?

The code in question is the code contained within the 2nd foreach loop, the purpose of which is to prevent exact duplicate latitude and longitudes. foreach($aUsers as $k => $v) { // generate address $aAddress = array(); if(!empty($v['city_location'])) $aAddress[] = $v['city_loc...

SUBSET-SUM, upper bound on number of solutions

As you probably know, the SUBSET-SUM problem is defined as determining if a subset of a set of whole numbers sum to a specified whole number. (there is another definition of subset-sum, where a group of integers sum to zero, but let's use this definition for now) For example ((1,2,4,5),6) is true because (2,4) sums to 6. We say that (2,...

SQL Query theory question - single-statement vs multi-statement queries

When I write SQL queries, I find myself often thinking that "there's no way to do this with a single query". When that happens I often turn to stored procedures or multi-statement table-valued functions that use temp tables (of one sort or another) and end up simply combining the results and returning the result table. I'm wondering if...

Setting Up Multiple Classes to Represent Real-World Objects

PHP: If I have a customer class, and the customer can have a car and an invoice, and I want to have separate car and invoice classes, what is the most efficient way of setting them up? So, I have three different classes: customer.class.php customer_car.class.php customer_invoice.class.php What's the best way to set up the relation...

Standard Regex vs python regex discrepancy

I am reading a book and they provide an example of how to match a given string with regular expressions. Here is their example: b*(abb*)*(a|∊) - Strings of a's and b's with no consecutive a's. Now I've tried converting it to python like so: >> p = re.compile(r'b*(abb*)*(a|)') # OR >> p = re.compile(r'b*(abb*)*(a|\b)') # BUT it still...

theory of computers and programming (HELP)

I am a student who has done a course in Haskell and I am currently doing object oriented programming using Java. Haskell was great and I did do really well and I am getting on fine with the Java. But I feel that I need to learn more about the underlying theories behind computing and programming in order to really become a good programm...

A method to calculate the centre of mass from a .stl (stereo lithography) file?

I am trying to calculate the centre of mass (x,y,z) coordinates of an object defined in an STL file (stereo lithography, not to be confused with the standard template library). The STL file contains a closed object (or objects) defined by a boundary made of triangles. The triangles themselves are not necessarily in any order, the file is...

Theory about Object Relation Mapping methodlogy

Are there any books or theory how orm systems should be designed or how they should be architecturaly designed .I want to give these to a fresh developer so that they can understand the internals of what they are working with. ...

State Space and circuit simulator.

As far as I know there is no state-space based general purpose circuit simulator around. Though there are certain algorithm to figure out how to find state-spaces (unique?) in a circuit (represented by graphs). Has anyone tried writing a program to simulate some basic circuit elements? [ref] 1. Sheshu and Reed, Electrical networks and ...

How does a non deterministic turing machine work?

I understand they aren't real and they seem to branch computation whenever there are 2 options, instead of picking one. But, for example, if I say this: "Non deterministically guess a bijection p of vertices from Graph G to Graph H" (context here is Graph Isomorphism) What is that supposed to mean? I understand the bijection, but it sa...

Names of HTML form naming conventions

In Rails and CakePHP1.2, forms tend to include input elements with names like the following: <input name="comment[author]" /> Is there a formal name for the notation used in the "name" attribute? Likewise, in CakePHP1.1 I do believe that the same would have looked like this: <input name="comment/author" /> Again, is there a formal...

What are the useful limits of Linear Bounded Automata compared to Turing Machines?

There are languages that a Turing machine can handle that an LBA can't, but are there any useful, practical problems that LBAs can't solve but TMs can? An LBA is just a Turing machine with a finite tape, and actual computers have finite storage, so it would seem to me that there's nothing of practical importance that an LBA can't do. E...

What is an FFP machine?

In R. Kent Dybvig's paper "Three Implementation Models for Scheme" he speaks of "FFP languages" and "FFP machines". Apparently there is some correlation between FFP machines, and string-reduction on multiple processors. Googling doesn't really uncover much in terms of explanations or examples. Can anyone shed some light on this topic? ...