I have several chunks of PCM audio (G.711) in my C++ application. I would like to visualize the different audio volume in each of these chunks.
My first attempt was to calculate the average of the sample values for each chunk and use that as an a volume indicator, but this doesn't work well. I do get 0 for chunks with silence and differ...
Hi, I'm trying to find a way to find the shortest path through a grocery store, visiting a list of locations (shopping list). The path should start at a specified startposition and can end at multiple endpositions (there are multiple checkout counters).
Also, I have some predefined constraints on the path, such as "item x on the shoppin...
I'm trying to write a decorator that 'refreshes' after being called, but where the refreshing only occurs once after the last function exits. Here is an example:
@auto_refresh
def a():
print "In a"
@auto_refresh
def b():
print "In b"
a()
If a() is called, I want the refresh function to be run after exiting a(). If b() is ...
In the upcoming version of Photoshop there is a feature called Content-Aware fill.
This feature will fill a selection of an image based on the surrounding image - to the point it can generate bushes and clouds while being seamless with the surrounding image.
See http://www.youtube.com/watch?v=NH0aEp1oDOI for a preview of the Photoshop ...
I like the algorithm mentioned in this question: "How does this work? Weird Towers of Hanoi Solution"
http://stackoverflow.com/questions/2209860/how-does-this-work-weird-towers-of-hanoi-solution
Is there any way to scale that non-recursive solution of Towers of Hanoi to use X disks and Y towers, with towers represented as stacks?
...
we have two databases of size n containing numbers without repeats. So, in total we have 2n elements. They can be accessed through a query to one database at a time. The query is such that you give it a k and it returns kth smallest entry in that database. we need to find nth smallest entry among all the 2n elements in O(logn) queries. t...
Let's say I define a few functions to do certain matplotlib actions, such as
def dostuff(ax):
ax.scatter([0.],[0.])
Now if I launch ipython, I can load these functions and start a new figure:
In [1]: import matplotlib.pyplot as mpl
In [2]: fig = mpl.figure()
In [3]: ax = fig.add_subplot(1,1,1)
In [4]: run functions # run the f...
Hello, I'm developing an AI sandbox and I would like to calculate what every living entity can see.
The rule is to simply hide what's behind the edges of the shapes from the point of view of the entity. The image clarifies everything:
I need it either as an input to the artificial intelligence either graphically, to show it for a spe...
EDIT I'm looking for the actual one or two liner that does what the answer with a lot of upvote suggest.
I've got a little problem to solve in a very real software and I'm looking for an easy way to solve it.
I've got two fixed points on screen (they're fixed, but I don't know beforehand their position) that are not at the same locati...
Hello, I have map (openstreetmap project) with many buildings. Each building is a polygon. How can I make saddle roof parts polygons for every building outline?
Algorithm should transform one polygon in 2D to set of polygons in 2D (or 3D).
Reason for this transformation is visualization - better rendering isometric view.
For example (...
I have a set of N positive numbers, and a rectangle of dimensions X and Y that I need to partition into N smaller rectangles such that:
the surface area of each smaller rectangle is proportional to its corresponding number in the given set
all space of big rectangle is occupied and there is no leftover space between smaller rectangles
...
When you search in Google "100F to C" how does it know to convert from Fahrenheit to Celsius? Similarly, conversion from different currencies and simple calculation.
What is the data structure used, or is it simple pattern matching the strings?
...
Given a dictionary of words and an initial character. find the longest possible word in the dictionary by successively adding a character to the word. At any given instance the word should be valid word in the dictionary.
ex : a -> at -> cat -> cart -> chart ....
...
I want to know what are the best links in a site are? It may be pagerank wise or popularity wise. For example http://www.pragprog.com is a site. I want to find out what are the most relevant links this site has. The links should not be external pointing links. It should be of the same site. Do google or any similar site can tell such inf...
Hello,
I have a set of N non-decreasing functions each denoted by Fi(h), where h is an integer. The functions have numeric values.
I'm trying to figure out a way to maximize the average of all of the functions given some total H value.
For example, say each function represents a grade on an assignment. If I spend h hours on assignme...
What is an algorithm for joining PCM files? I have several PCM files I need to Join them in a way like speakers are speac at the same time.
So How to Join PCM files?
...
I'm learning Weka and I'm trying to figure out how to do fuzzy clustering. I found an old site that listed 2 fuzzy clusterers (by Frank Weber & Robin Senge), but I could not add their .jar file to the existing .jar file to use the algorithms.
Does anyone know where I can find fuzzy clustering algorithms for Weka? If not, is there an...
hey ,
I'd like to make a recursive function using C++
I make this class
class linklist
{
private:
struct node
{
int data;
node *link;
}*p;
};
void linklist::print_num(node* p)
{
if (p != NULL)
{
cout << p->data << " ";
print_num (p->link);
}
}
in the main program what should I write ...
...
Hey everyone,
I am interested in doing some document clustering, and right now I am considering using TF-IDF for this.
If I am not wrong, TFIDF is particularly used for evaluating the relevance of a document given a query. If I do not have a particular query, how can I apply tfidf to clustering?
...
Latest news about underground bombing made me curious about the following problem. Assume we have a weighted undirected graph, nodes of which are sometimes removed. The problem is to re-calculate shortest paths between all pairs of nodes fast after such removals.
With a simple modification of Floyd-Warshall algorithm we can calculate ...