In many applications, we have some progress bar for a file download, for a compression task, for a search, etc. We all often use progress bars to let users know something is happening. And if we know some details like just how much work has been done and how much is left to do, we can even give a time estimate, often by extrapolating fro...
I'm doing a presentation on MD5 collisions and I'd like to give people any idea how likely a collision is.
It would be good to have two blocks of text which hash to the same thing, and explain how many combinations of [a-zA-Z ] were needed before I hit a collision.
The obvious answer is hash every possible combination until hit two has...
I'm trying to write a Windows Filtering Platform Callout Driver for a parental control program. Unfortunately, I've never written a driver before, and the MSDN documentation on it isn't too helpful unless you already know the basics (I'm guessing).
Does anyone know of any good resources on the subject? Books, online samples, documenta...
We are developing software with pattern recognition in video. We have 7 mathematicians who are creating algorithms. Plus we have 2 developers that maintain / develop the application with these algorithms. The problem is that mathematicians are using different development tools to create algorithm like Matlab, C, C++. Also because the...
So, suppose you have a collection of items. Each item has an identifier which can be represented using a bitfield. As a simple example, suppose your collection is:
0110, 0111, 1001, 1011, 1110, 1111
So, you then want to implement a function, Remove(bool bitval, int position). For example, a call to Remove(0, 2) would remove all items...
I need to test if one variance matrix is diagonal. If not, I'll do Cholesky LDL decomposition. But I was wondering which would be most reliable and fastest way to test is matrix diagonal? I'm using Fortran.
First thing that come to my mind is to take sum of all elements of matrix, and substract diagonal elements from that sum. If the an...
Spent me 3 hours to get a good regex finished for parsing these 3 main possible situations.
Redden, Taylor Captain Hasting Jr.
Redden, Taylor Hasting Jr.
Redden, Taylor Hasting
full, l, f, m1, m2, s = /your_regex_here/.match("Redden, Taylor Captain Hasting Jr.").to_a
I want to see what other possible answers there are beside min...
What are some examples where Big-O notation[1] fails in practice?
That is to say: when will the Big-O running time of algorithms predict algorithm A to be faster than algorithm B, yet in practice algorithm B is faster when you run it?
Slightly broader: when do theoretical predictions about algorithm performance mismatch observed runnin...
What is QuickSort with a 3-way partition?
...
since we suffer from creeping degradation in our web application we decided to monitor our application performance and measure individual actions.
for example we will measure the duration of each request, the duration of individual actions like editing a customer or creating an appointment, searching for a contract.
in most cases the d...
I have noticed that a recurring question is: “What is a good network graph library for language X”. I have played with quite a few of the libraries and I can share my experiences with you.
Python:
NetworkX is a robust library which has built-in visualization but also has an interface to Graphviz using pyGraphviz. (pyGraphviz and Network...
So I have some C++ code for back-tracking nodes in a BFS algorithm. It looks a little like this:
typedef std::map<int> MapType;
bool IsValuePresent(const MapType& myMap, int beginVal, int searchVal)
{
int current_val = beginVal;
while (true)
{
if (current_val == searchVal)
return true;
MapType::i...
Given a list of words, how would you go about arranging them into a crossword grid?
It wouldn't have to be like a "proper" crossword puzzle which is symmetrical or anything like that: basically just output a starting position and direction for each word.
...
When I write code I only write the functions I need as I need them.
Does this approach also apply to writing tests?
Should I write a test in advance for every use-case I can think of just to play it safe or should I only write tests for a use-case as I come upon it?
...
A friend just asked me if I could help him in automating something that is taking up a lot of his time. He grades essays online so basically there is a website that he logs into and sits on a page refreshing it until some data appears (new essays to be graded). Instead of doing this he would like to simply be notified when there are ne...
I'm trying to make my code easily understood by future readers.
I've always had issues with how to word my if statement comments to make it the most understandable.
Maybe it seems trivial, but it's something that's always bothered me
Here's an example:
if ( !$request ) {
$request = $_SERVER['REQUEST_URI'];
}
Here are some way I...
Which models of algorithm running time exist?
We all expect mergesort to be faster than bublesort, and note that mergesort makes O(n log n) comparisons vs. O(n2) for bubblesort.
For other algorithms, you count other operations (than compares and swaps), such as pointer dereference, array lookup, arithmetic on fixed-size integers, etc.
...
In exams and interview situations, it's common to need to either write or review code that's not on a screen.
Whether it's on paper or a whiteboard, what tips can you offer for both the writing and reviewing/debugging processes?
...
Functional Decomposition, what is it useful for and what are it's pros/cons? Where are there some worked examples of how it is used?
...
Calculating the k-core of a graph by iteratively pruning vertices is easy enough. However, for my application, I'd like to be able to add vertices to the starting graph and get the updated core without having to recompute the entire k-core from scratch. Is there a reliable algorithm that can take advantage of the work done on previous it...