theory

Is Java orthogonal?

Hi, I am wondering if Java is orthogonal or not, and if yes, then which are its features that make it orthogonal. How can you determine if a language is orthogonal or not? For example, I found on some website that C++ is not orthogonal, but no explanations, why not. What other languages are orthogonal? Please help me, because there is a...

What is a full powered closure?

I was at a Java conference on Scala the other day and the speaker referred to 'full powered closures'. I am having a hard time nailing down a definition that makes sense to me. I have read the wiki page on closures but it really didn't answer it for me. Can someone help me with a clear cut definition? Maybe even include a simple examp...

What's a buffer?

Hello! As far as my understanding of languages goes, a buffer is any portion of memory in which a data is stored like an int,float variables, character arrays etc. However, I was reading buffer overflows and came across this link while reading about stack http://www.tenouk.com/Bufferoverflowc/Bufferoverflow2a.html The diagram in this li...

How to solve the following graph game

Consider the following game on an undirected graph G. There are two players, a red color player R and a blue color player B. Initially all edges of G are uncolored. The two players alternately color an uncolored edge of G with their color until all edges are colored. The goal of B is that in the end, the blue-colored edges form a connect...

PHP - create a search on a static site

I have a site which does not have a DB in the back-end but one day could possibly have one. I currently need the capability to search my existing site from the homepage. My first question is it a good idea to search a site consisting of only static pages? I was hoping to somehow leverage google for this so I do not have to write my own...

difference between string object and string literal

what is difference between String str = new String("abc"); and String str = "abc"; ...

UX: Edit in place vs. separate edit page / modal ?

I have some data that is broken up into sections, much like the Resume feature of StackOverflow Careers (it's not resume data, though), that is editable/create-able via a jQuery web app. It's a bit more hierarchical (jobs can have sub-jobs, etc.) so depending on what method of CRUD I take, it means differing amounts of work. I don't mind...

Example of Call by name.

In my principles of programming class we are talking about different calling methods. Some we discussed were: call by value call by reference call by value/result and call by name I can't find an example of how call by name works. Anyone care to give me an example? I think that when you take an xml file as input this is similar to...

What is linear programming?

I read over the wikipedia article, but it seems to be beyond my comprehension. It says it's for optimization, but how is it different than any other method for optimizing things? An answer that introduces me to linear programming so I can begin diving into some less beginner-accessible material would be most helpful. ...

how to create a collection with O(1) complexity

I would like to create a data structure or collection which will have O(1) complexity in adding, removing and calculating no. of elements. How am I supposed to start? I have thought of a solution: I will use a Hashtable and for each key / value pair inserted, I will have only one hash code, that is: my hash code algorithm will generate ...

What are the theoretical implications of unbounded lookbehind?

Most languages allow fixed-length or finite-length lookbehind. One notable exception is .NET, which allows the use of the * operator. However, .NET regexs can already recognize balanced parentheses using named capture, which is not a regular language. Are regexs still regular with * in lookbehind? Extended answers for subexpressions ...

Thread.Abort and alternatives

This is more out of personal curiosity/interest than a specific problem I'm trying to solve. Suppose you have a program that is performing some operation on user-supplied information (such as a search string) that changes as the user types it. Suppose that you want to show the user the most relevant information for what they've typed at...

Binary to ternary representation convertion

Hi, Does anybody know (or may point to some source to read about) a method or algorithm to convert a number represented in binary numeral system into the ternary one (my particular case), or universal algorithm for such conversions? The solution I've already implemented is to convert a number to decimal first and then convert it into r...

Python - threaded pyinotify output. Better to write to file or to a string

Hi all, I have a pyinotify watcher running threaded, called as a separate class, at the moment it just prints its discoveries in a terminal window, if I wanted my script to make an action based on those changes am I better to: A) modify an array with each notification B) write to a file in /tmp and fetch it from my main script? c) gi...

dfs search question

Possible Duplicate: graph theory dfs search I need help solving this question: Write an algorithm that given a simple directed graph G = (V, E) generates and returns the component graph (gscc graph) of G in linear time. ...

What is the technical definition of theoretical computer science? What subfields are included?

What is the technical definition of theoretical computer science? (Or, what should it be?) What main subfields does it include, and what is the commonality that separates them from the rest of computer science? More specifically: if some particular research has direct practical motivations, goals and outcomes but mostly involves very ...

Form and movement representation of a hexagonal plane.

The most basic way of representing a quadrile plane (a bunch of squares) is to use a two-dimensional array. In C# we declare this as int[,] and can make our plane as big as we want: string[3,3] => tic-tac-toe board (or similar) string[8,8] => chess or checkers board To "move" an item on the plane, we would just asign it toa new "posi...

Modelling combinatorial optimization? problem

I've been unable to match this problem into some canonical one, and I would like some guides to build/use an algorithm and solve it. Description is as follows: We have some people who want breakfast. Each one may order any number of coffee, juice and toast. We accumulate the order for all the group. InitialOrder = { C1, J1, T1 } wit...

P != NP question

Not a 'pure' programming question, but since it is deeply involved in programming theory, I thought it best to ask here. Regarding the P NP problem, this excerpt from http://en.wikipedia.org/wiki/P_versus_NP_problem : "In essence, the question P = NP? asks: Suppose that yes answers to a yes or no question can be verified quickly. Then, ...

Can the SO community shed some light on the recent P != NP proof ?

Can the SO community shed some light on the recent P != NP proof ( http://www.hpl.hp.com/personal/Vinay_Deolalikar/Papers/pnp12pt.pdf ) by Vinay Deolalikar @ HP What does the SO community think about it ? I know Scott Aaronson and other smart theorists are on top of it like white on rice, and has been blogging ( http://scottaaronson.c...