I need a model for finding all of the regular expressions that would match a particular string. Basically, I need an algorithm for doing what I do to generate a regex search string from some pattern.
My purpose for this to create a list of potential regular expressions from a selection of text and order that list from least specific (i...
The challenge
The shortest code by character count to draw an ASCII representation of a Code 39 bar code.
Wikipedia article about Code 39: http://en.wikipedia.org/wiki/Code_39
Input
The input will be a string of legal characters for Code 39 bar codes. This means 43 characters are valid: 0-9 A-Z (space) and -.$/+%. The * character w...
Given a directed graph with weighted edges, what algorithm can be used to give a sub-graph that has minimum weight, but allows movement from any vertex to any other vertex in the graph (under the assumption that paths between any two vertices always exist).
Does such an algorithm exist?
...
Is there a known algorithm or method to find all complete sub-graphs within a graph? I have an undirected, unweighted graph and I need to find all subgraphs within it where each node in the subgraph is connected to each other node in the subgraph.
Is there an existing algorithm for this?
...
I understand the reasons for compiler/interpreter language extensions but why is behaviour that has no valid definition allowed to fail silently/do weird things rather then throwing a compiler error? Is it because of the extra difficulty(impossible or simply time consuming) for the compiler to catch them)?
P.S. what languages have undef...
I was wondering if someone could help me understand this problem. I prepared a small diagram because it is much easier to explain it visually.
Problem I am trying to solve:
1. Constructing the dependency graph
Given the connectivity of the graph and a metric that determines how well a node depends on the other, order the dependencies...
I have photo of a room with three walls and floor/ceiling or both. I am trying to reconstruct this room in 3d asking user for minimal input. Right now I use 8 points defined by user, angles of left and right wall(they can be quite different from 90) and one size "InLeftBottom-InRightBottom"(I need to have real size of this room for later...
In the context of social networks, what is a good measure of strength of a link between two nodes? I am currently thinking that the following should give me what I want:
For two nodes A and B:
Strength(A,B) = (neighbors(A) intersection neighbors(B))/neighbors(A)
where neighbors(X) gives the total number of nodes directly connected to X...
I'm sitting here writing a function that I'm positive has been written before, somewhere on earth. It's just too common to have not been attempted, and I'm wondering why I can't just go to a website and search for a function that I can then copy and paste into my project in 2 seconds, instead of wasting my day reinventing the wheel.
Su...
Triangulation works by checking your angle to three KNOWN targets.
"I know the that's the Lighthouse of Alexandria, it's located here (X,Y) on a map, and it's to my right at 90 degrees." Repeat 2 more times for different targets and angles.
Trilateration works by checking your distance from three KNOWN targets.
"I know the that's the ...
Hi folks,
I am working on one feature i.e. to apply language segmentation rules ( grammatical ) for Latin based language ( English currently ).
Currently I am in phase of breaking sentences of user input.
e.g.:
"I am working in language translation". "I have used Google MT API for this"
In above example i will break above sentence ...
Following reading various questions on reading and writing Streams, all the various answers define something like this as the correct way to do it:
private void CopyStream(Stream input, Stream output)
{
byte[] buffer = new byte[16 * 1024];
int read;
while ((read = input.Read(buffer, 0, buffer.Length)) > 0)
{
output.Wri...
Any libraries to aid writing programs with source code shaped like drawings
(such as http://www.ioccc.org/1998/banks.c or http://groups.google.com/group/comp.lang.c/msg/e105e5d339edec01). For any language.
...
Given two strings with * wildcards, I would like to know if a string could be created that would match both.
For example, these two are a simple case of overlap:
Hello*World
Hel*
But so are all of these:
*.csv
reports*.csv
reportsdump.csv
Is there an algorithm published for doing this? Or perhaps a utility function in Windows or...
I need a function to find the shortest distance between two line segments. A line segment is defined by two endpoints. So for example one of my line segments (AB) would be defined by the two points A (x1,y1) and B (x2,y2) and the other (CD) would be defined by the two points C (x1,y1) and D (x2,y2).
Feel free to write the solution in an...
Somebody please re-tag with appropriate tags
Hello,
This is my story but I guess it holds true for all programmers.
We begin programming with some simple Hello World program. We practice & add functions/classes to the program. But they still maintain the Hello World style. function calling some other functions standard library.
But w...
Is there any deeper meaning in the fact that the word "statement" starts with the word "state", or is that just a curious coincidence? Note that english is not my native language, so the answer might be obvious to you, but not me ;)
...
One thing that I've always noticed with my unit tests is that they get to be kind of verbose; seeing as they could also be not verbose enough, how do you get a sense of when your unit tests are the right size?
I know of a good quote for this and it's:
"Perfection is achieved, not when
there is nothing left to add, but when
there...
How do you know if you "Test Fixture" is right-sized. And by "Test Fixture" I mean a class with a bunch of tests in it.
One thing that I've always noticed with my test fixtures is that they get to be kind of verbose; seeing as they could also be not verbose enough, how do you get a sense of when your unit tests are the right size?
My ...
Hello, Can someone tell me if this class structure is bad?
class abstract Parent{
public Child Foo(){
return new Child();
}
}
class Child : Parent{}
I've heard that referring to a derived type from a base type is always bad and signs of bad design. Can someone tell me why this is bad or even if it is bad?
...