I'm displaying a small Google map on a web page using the Google Maps Static API.
I have a set of 15 co-ordinates, which I'd like to represent as points on the map.
Due to the map being fairly small (184 x 90 pixels) and the upper limit of 2000 characters on a Google Maps URL, I can't represent every point on the map.
So instead I'd l...
Maybe you have noticed, but cartoon-ifying your photos is the latest rage on the internet. My boss now wants our product, which works with photos and videos of people, to cartoonify them. So I need an algorithm to do it manually (we use c++/Qt for our product, which has image manipulation classes) or perhaps some CLI program that will do...
We have a language X, which has one byte and two byte characters. This language has following characteristics.
Single byte character value will always be less than or equal to 127.
In Two byte character, First byte will always be greater than 127 and second byte value can be anything.
The problem is, We are given an arbitrary length ...
I want to know what will be the best case for a bubble sort ? There may be a case wherein there may be no swapping for the say last 2 passes for example. I'm doing my program in C language.
Suppose i have an array of 5 elements and i give the elements as 1 2 5 4 3 then there would be no change in the last 2 passes?
...
I have an array of uint-types in C#, After checking if the program is working on a little-endian machine, I want to convert the data to a big-endian type. Because the amount of data can become very large but is always even, I was thinking to consider two uint types as an ulong type, for a better performance and program it in ASM, so I am...
The question is related to financial products, interest rates and two properties that determine which interest a certain product has. But I think fruits and baskets are easier to visualize for this.
First, we have fruit. Fruit can have a specific size (Small, medium, Large) and colour (Red, Green, Blue). These will be two different enum...
Consider the requirement to find a matched pair of set of characters, and remove any characters between them, as well as those characters/delimiters.
Here are the sets of delimiters:
[] //square brackets
() //parenthesis
"" //double quotes
'' //single quotes
Here are some examples of some strings that should match:
**Given** ...
Consider a string array shaped like this:
string[] someName = new string[] { "First", "MiddleName", "LastName" };
The requirement is to get the first character from each element in the array.
i.e.
FML
Previously have tried:
string initials = string.Concat(someName.Select(x => x[0]));
Question: What LINQ query would you wri...
When dealing with a series of numbers, and wanting to use hash results for security reasons, what would be the best way to generate a hash value from a given series of digits? Examples of input would be credit card numbers, or bank account numbers. Preferred output would be a single unsigned integer to assist in matching purposes.
My ...
The interrupt service routine (ISR) for a device transfers 4 bytes of data from the
device on each device interrupt. On each interrupt, the ISR executes 90 instructions
with each instruction taking 2 clock cycles to execute. The CPU takes 20 clock cycles
to respond to an interrupt request before the ISR starts to execute instructions.
Ca...
Not that it's a lot of work, but the only way I know to convert a non-decimal to another non-decimal is by converting the number to decimal first, then take a second step to convert it to a new base. For example, to convert 456 (in base 7) to 567 (in base 8), I would calculate the decimal value of 456, then convert that value into base 8...
I've been trying to come up with an interest point detection algorithm and this is what I came up with:
You go through the X and the Y axises 3n pixels at a time creating 3n x 3n squares.
For the the n x n square in the middle of the 3n x 3n square (let's call it square Z), the R, G, and B values are averaged and rounded to preset valu...
I have a data set of players' skill ranking, age and sex and would like to create evenly matched teams.
Teams will have the same number of players (currently 8 teams of 12 players).
Teams should have the same or similar male to female ratio.
Teams should have similar age curve/distribution.
I would like to try this in Haskell but the...
I've 3 tables.
Users (id, mail, username, etc..)
Practices (id, name)
UsersPractices (userId, practiceId)
The last one is the relational table which is n-n.
I'd like to update this one, depending on the user's will.
It means, that he could want to add, or remove some his practices.
What algorithm could i use to do this ?
Should i...
I'm having trouble distinguishing between these these two. Can someone please explain the differences to me? I'm a little slow, so examples would probably help.
Thanks
...
I have the following formula
float mean = (r+b+g)/3/255.0f;
I want to speed it up. There are the following preconditions
0<= mean <= 1 and 0 <= r,g,b <= 255 and r, g, b are unsigned chars
so if I try to use the fact that >> 8 is like dividing by 256 and I use something like
float mean = (float)(((r+b+g)/3) >> 8);
this will al...
I have a list of X sites that I need to classify in some way. Is the site about cars, health, products or is it about everything(wikihow, about.com, etc?) What are some of the better ways to classify sites like this? Should I get keywords that bring traffic to the site and use those? Should I read the content of some random pages and j...
I am looking for a general algorithm to help in situations with similar constraints as this example :
I am thinking of a system where images are constructed based on a set of operations. Each operation has a set of parameters. The total "gene" of the image is then the sequential application of the operations with the corresponding param...
I'm not sure exactly how to explain this, so I'll just start with an example.
Given the following data:
Apple
Apricot
Blackberry
Blueberry
Cherry
Crabapple
Cranberry
Elderberry
Grapefruit
Grapes
Kiwi
Mulberry
Nectarine
Pawpaw
Peach
Pear
Plum
Raspberry
Rhubarb
Strawberry
I want to generate an index based on the first letter of my data...
The problem is I have 10 nodes(say) and there are some connections between them. Now I want to draw a visual graph depicting the above with circles as nodes and lines as connections between them. My problem is what is the algorithm for placement of nodes on screen, say we have drawn one circle, then the other circle should be drawn as no...