language-agnostic

Searching algorithm

I'm looking for a efficient searching algorithm to get the longest shortest repeated pattern in a collection (~2k of integers), where my collection is made of this repeated pattern only (there is no noise between repeated patterns), but the last occurence of pattern may be incomplete. Examples: I've got: [2,4,1, 2,4,1, 2,4,1, 2,4,1, 2,4...

What language features are required in a programming language to make a compiler?

Programming languages seem to go through several stages. Firstly, someone dreams up a new language, Foo Language. The compiler/interpreter is written in another language, usually C or some other low level language. At some point, FooL matures and grows, and eventually someone, somewhere will write a compiler and/or interpreter for FooL i...

Should I still code to the interface even if I am ONLY EVER going to have ONE implementation?

I think the title speaks for itself guys - why should I write an interface and then implement a concrete class if there is only ever going to be 1 concrete implementation of that interface? ...

To init or to construct

I'm reviewing some code and I'm seeing a lot of this: class Foo { public: Foo() { // 'nuffin } void init() { // actual construction code } } ; The only advantage I can see is if you create a Foo without using a pointer and you want to hold off its construction code until later, then you can. Is this a good idea o...

So was that Data Structures & Algorithms course really useful after all?

I remember when I was in DSA I was like wtf O(n) and wondering where would I use it other than in grad school or if you're not a PhD like Bloch. Somehow uses for it does pop up in business analysis, so I was wondering when have you guys had to call up your Big O skills to see how to write an algorithm, which data structure did you use to...

What characters would you make invalid for a password?

A hypothetical situation: you've implemented a password handling system, and it doesn't impose any limitations at all on what characters can be used. You want to set up some rules that are a reasonable compromise between two things - Allow the user as much freedom as possible. Allow for the possibility that you may change how you handl...

Micro-ISV License Costs - .NET Or Open-Source?

I've started developing a website in ASP.NET MVC and have taken part in the BizSpark program. The only part that concerns me is the licensing cost of SQL Server Enterprise after the three year period is up. Given this cost, and the potential outcome that this product may not 'take off'; should I rewrite the application in a 'free' plat...

How to store a large directed unweighted graph with billions of nodes and vertices

The graph size is in the billions of nodes, and tens of billions of vertices. It will store webpages urls, and links between webpages and it will be used for testing ranking algorithms. Any language is fine but java is prefered. Solutions i found so far: neo4j storing in sorted flat files Yes, i have already read Best Way to Store...

Recursive function best practices; What are they?

Hello, What are some other language independent ways of designing recursive functions other than the typical: if (counter < 1) return output; else callSelf(); Do other methods even exist? Whenever viewing examples I always see a version of the code above. Thanks! :) ...

What is "Orthogonality"?

What does "orthogonality" mean when talking about programming languages? What are some examples of Orthogonality? ...

Language Syntax Comparison

I'm interested in learning a new language. Does anyone know of a website with the same program (maybe a Hello World) written in several different languages (maybe 10-15 or so), so that I can get an idea of how the syntaxes compare. ...

Support vector machines - separating hyperplane question

From what I've seen, seems like the separation hyperplane must be in the form x.w + b = 0. I don't get very well this notation. From what I understand, x.w is a inner product, so it's result will be a scalar. How can be it that you can represent a hyperplane by a scalar + b? I'm quite confused with this. Also, even if it was x + b ...

What are the implications of deleting a user account?

Most of the websites I've used in the past (including this one) do not offer an option to delete your own account. I think the main reason is to avoid the orphanage of the items created (or the delete on cascade of those items). Modern sites (like this one) have a place where those items go when an account is abandoned (in the case of ...

What USEFUL bitwise operator code tricks should a developer know about?

I must say I have never had cause to use bitwise operators, but I am sure there are some operations that I have performed that would have been more efficiently done with them. How have "shifting" and "OR-ing" helped you solve a problem more efficiently? ...

Graph Expansion

I'm currently working on an interesting graph problem, I can't find any algorithms or other stackoverflow questions which mention anything like this. If I have a graph (undirected, cyclic) and a list of commonly used paths, what is the best way to reduce the average path length by adding in N more edges? EDIT:: Important point, which m...

Which design pattern looked the most horrendous upon first glance, but ended up being the most beautiful once implemented?

I ask because most patterns are pretty intimidating at first glance, and I haven't had much experience coding them. Most that I've had the chance to implement were worth the effort, but some made me feel like I wasted my time. I'd like to try taking down a beast and finding that it was not as much of a struggle as it initially seemed. H...

Crappy Random Number Generator

This may sound like an odd question, but where can I find a random number generator that works in C or C++ that is not very good? Context: I'm creating some tree graph plotting software and testing it by using multi-digit random numbers (so each digit becomes a node in the tree). The random number generator I've been using - which is th...

On Test Driven Development BUT in REVERSE

I appreciate TDD and think it indispensable but always write my tests ONLY after I write my source code then refactor accordingly. I can never bring myself to write the test first then the source to pass the test. So I always reverse the process. Is this a bad practice on my part? What are the disadvantages of doing it in reverse like me...

What problems have you solved using genetic algorithms/genetic programming?

Genetic algorithms (GA) and genetic programming (GP) are interesting areas of research. I'd like to know about specific problems you - the SO reader - have solved using GA/GP and what libraries/frameworks you used if you didn't roll your own. Questions: What problems have you used GA/GP to solve? What libraries/frameworks did you us...

Access video frame by frame

What is the easiest-to-code-in technology that would give me real time access to a video's frames, and allow me to modify them. I am aware of DirectShow, but it's programming model seems to be quite complicated. Is there a framework that makes programming such a frame filter easier? ...