matching

Comparing 2 huge lists using C# multiple times (with a twist)

Hey everyone, great community you got here. I'm an Electrical Engineer doing some "programming" work on the side to help pay for bills. I say this because I want you to take into consideration that I don't have proper Computer Science training, but I have been coding for the past 7 years. I have several excel tables with information (a...

How can I match two songs?

What is the best way to match two songs? IE. Have a song stored in the database in whatever format is best and then play another song and match the two together? In Python ideally please. Thanks! ...

Improving my regular expression skills

I've been wanting to improve my regex skills for quite some time now and "Mastering Regular Expressions" was recommended quite a few times so I bought it and have been reading it over the past day or so. I have created the following regular expression: ^(?:<b>)?(?:^<i>)?<a href="/site\.php\?id=([0-9]*)">(.*?) \(([ a-z0-9]{2,10})\)</a>(...

A/V pattern matching software

Hi All, I need a software that can do pattern matching of audio and video on a stream of data captured from say a Radio/TV. The software will know what to look for in the stream AND all this pattern matching should happen in real time. So, Is there any open source software that can do this. I know of commercial products. I m looking ...

Hungarian Algorithm and multiple factors

I have a situation where I need to allocate people to several events. If we just had a price as a factor, it would be fine, but there is a number of factors that come in. First, some background. This is for a non-profit organization that promotes story hours for children that are hospitalized for any reason, so they depend on voluntary ...

Regex to match content of HTML body in PHP

I need a regex in php for matching contents between tags of an element, e.g. <body> and </body> with the perl compatible preg_match. So far I tried with: // $content is a string with html content preg_match("/<body(.|\r\n)*\/body>/", $content, $matches); print_r($matches); …but the printout is an empty array. ...

Can a range be matched in Scala?

Is it possible to match a range of values in Scala? For example: val t = 5 val m = t match { 0 until 10 => true _ => false } m would be true if t was between 0 and 10, but false otherwise. This little bit doesn't work of course, but is there any way to achieve something like it? ...

matching against words with accent marks, umlauts, etc. mysql/php

I've got a website for which I just wrote a great search function. I just realized that I have some words in my db with accent marks. So when somebody types in the word to search for, without the accent mark of course, they don't find what they are looking for. most search functions have solved this problem by now; how do they do it? T...

Multiple events matching algorithm

Hi, I have a task to match multiple events(facts) with each other by some their properties. As a result of events matching some action should be generated. Action can be generated when events of all exists types were matched. Is there any algorithm which could be used for such task? Or any direction? Thanks Example: We have several e...

Maximum bipartite graph (1,n) "matching"

I have a bipartite graph. I am looking for a maximum (1,n) "matching", which means that each vertex from partitation A has n associated vertices from partition B. The following figure shows a maximum (1,3) matching in a graph. Edges selected for the matching are red and unselected edges are black. This differs from the standard bipa...

rolling checksums in the rsync algorithm

I'm trying to understand how the rsync algorithm works with respect to rolling checksums and blocks that match in a staggered fashion. The wikipedia page seems to suggest that the sender and receiver both calculate and exchange rolling checksums for all possible blocks. But that would mean sending essentially one checksum per byte! I mu...

How to check if cards in hand match cards on table?

There are 8 cards on the table, with four faces visible and four hidden. Click on a card to turn it and if there's a pip-match or suit-match, show sparks around the associated cards. Problem is, I'm either doing something wrong logic-wise, or .concat() is not working. Because some sparks show and some do not. The whole game could proba...

Query for match in MySQL ListOfValues

Whats the best way to query MySql when I want the query return all rows where at least one value in a list of values matches at least one value in a list of values? example If my table contains the following rows: name groups item1 gr1, gr2 item2 gr1,gr2,gr3 item3 gr1,gr3 And I have a list of values: "gr...

How do i go about matching three fields from two tables in order to update the same tables in case of match

Given two tables A and B in a MySQL Database, how can one update a field in a row of table A if and only if certain fields in the fore-mentioned row in table A exactly match fields in a distinct row of table B. The rows in table B must be used once and only once for each comparison. As such, a row in Table B that has fields matching a ro...

Problem in using Sed to remove leading and trailing spaces

Hi all, I am using the following code to remove both leading and tailing spaces from all lines of a file A.txt sed 's/^[ \t]*//;s/[ \t]*$//' ./A.txt > ./B.txt The problem occurs on the lines where there is a t in the beginning or at the end. So say for example, the original line that starts with the string "timezone" becomes "imezon...

How do I grab only one capture out of a Perl regular expression?

Is there an easier way to grab only one element out of a match other than doing the followng: my $date = ($xml_file =~ m/(\d+)-sys_char/)[0]; # or my $date = $1 if $xml_file =~ /(\d+)-sys_char/; Is there a flag to specify that m doesn't return an array but just one concatenated value of all the $# matches, so I can do:? my $date = ($...

Type Matching in Haskell

If SomeType is defined as: data SomeType = X {myBool :: Bool} | Y {myString :: String} | Z {myString :: String} and I will update an arbitrary X, dependent of his type as follows: changeST :: SomeType -> SomeType changeST (X b) = (X True) changeST (Y s) = (Y "newString") changeST (Z s) = (Z "newStrin...

Give me some idea : How do I match photographer?

I have photographer in my database such as PhotographerID, PhotographerName, JobArea, BestPhotography, FavoritePhotography. And I want to match some photographer from my database. The question that I will ask the user before matching photographer is.. Area or province that you want to hire a photographer? Type of photography? How do...

Select substring based on a string of options.

I have the following code // this text box can contain a URL such as: // http://vimeo.com/ // http://www.youtube.com/ // and so on. var text = $('#myTextBox').val(); var providers = "youtube|flickr|viddler|qik|revision3|hulu|vimeo"; if( text.match(providers).length > -1) { var selectedProvider = ???; } the match method looks i...

Find all subtrees in a tree matching a given subtree in Java

I am writing code in Java that uses an unordered, rooted tree where each node may have any number of child nodes. Given a tree T and a subtree S, I want to be able to find all the subtrees in T that match S (that is all the subtrees in T that are isomorphic to S). A subtree of T is isomorphic to S, if the nodes of S can be mapped to nod...