Posted by david on December 21, 2009
Recently I heard about OpenCV and some applications for AI using this library. This is a interesting topic and very powerful. There is many examples in C, C++ and Python, but I really surprised because I found 2 implementations in PHP. First of all, What Face Detection/Recognition is? Is a computer technology that determines the [...]
Share on Facebook
Posted by david on November 4, 2009
This is a very simple function, but ver useful. Enjoy it! function getRepetitions($value, array $values){ $length = count($values); if($length==0) return FALSE; $repetitions = 0; foreach($values as $v){ if($v==$value) $repetitions++; } return $repetitions; } print getRepetitions(3,array(3,3,3,5,6,4,3,6,5,4,6,3,2,8,8))."\n"; Share on Facebook
Share on Facebook
Posted by david on November 4, 2009
In statistics, the mode is the value that occurs the most frequently in a data set or a probability distribution. In some fields, notably education, sample data are often called scores, and the sample mode is known as the modal score. Like the statistical mean and the median, the mode is a way of capturing [...]
Share on Facebook
Posted by david on November 3, 2009
This was a quick modification to use use MicroUri, instead bit.ly on Tweetme plugin. We just need to change a function called tweetme_bitly_link(). function tweetme_bitly_link($id) { if (function_exists(’revcanonical_shorten’) && $link = revcanonical_shorten($id)) { return $link; } else { $link = get_permalink($id); /**Williams Mendez **/ $ob = @simplexml_load_file(’http://api.microuri.com/get.php?url=’.$link); if(is_object($ob) && isset($ob->Response) && strlen($ob->Response)) return [...]
Share on Facebook
Posted by david on November 1, 2009
This php function Validate an IP Address using PHP and Regular Expressions, returns 1 if the IP is valid or 0 if is invalid. The regular expression rather ugly, but still functional and can be very useful. Enjoy it! function valid_ip($ip) { return preg_match("/^([1-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])" . "(\.([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])){3}$/", $ip); } Share on Facebook
Share on Facebook