Tag Archives: algorithm

Creating timer algorithm in php

I’m working on an application that sends alerts to users via email. The user chooses a time-frame and sets up any number of alerts to receive in that time-frame.
The goal is to send the alerts at equal time intervals.… Continue reading

Tagged , , , , | Leave a comment

Anagram Algorithm in PHP

I’m totally a newbie with PHP. Today I just got a problem that I can’t know how to solve, even after searching google and digging SOF. It’s the Anagram algorithm.
So basically, I understand the problem here : When user… Continue reading

Tagged , , | Leave a comment

Pattern Recognition Algorithms in PHP?

I would like to begin experimenting with algorithms that recognize patterns in data. I deal with many types of sequences (image pixels, text input, user movement), and it would be fun to make use of Pattern Recognition to try to… Continue reading

Tagged , , , | Leave a comment

Implement Atwood's Equipping our ASCII armor in PHP

I’m trying to implement in PHP something similar to Jeff Atwood’s
Equipping our ASCII armor.
Here’s C# Implementation of ASCII85.
Here’s PHP Implementation of ASCII85
Here’s how I convert the string to byte array:

$byteArr = str_split($uid);
foreach ($byteArr as 

Continue reading

Tagged , , , , | Leave a comment

Any flaws in this method of selecting random records from the db?

I have a db table filled with about ~30k records.
I want to randomly select a record one at a time (when demanded by users), delete the record from the table, and insert it in another table.
I’ve heard/found that… Continue reading

Tagged , , , | Leave a comment

algorithm to find most realistic market price average in dataset

What I have:

users are selling foobars on an auction site.
each foobar is identical.
price of foobar determined by user.
i will be scrapping each price listing to form a data set that looks like:
$prices = (‘foobar’ =>… Continue reading

Tagged , , | Leave a comment

PHP: How to sort values of an array in alphabetical order?

I want to sort values of an array in alphabetical order in PHP. If all values started with same character then they should be sorted using second character and so on. Ignore case sensitive.
For Example:

before:
values[0] = "programming";

Continue reading

Tagged , , , | 2 Comments

ESL Elo formula (something wrong)

I’m trying to implement ELO formula like ESL portal have. ( http://cheater.esl.eu/uk/faq/rankmodules/ )
A first example corresponds to the example of ESL but the second and third give crazy results. Where I’m wrong?

    function eloEsl($k1, $k2, $g1, $g2)
{
    $per1 

Continue reading

Tagged , | Leave a comment

How to extend ELO rating?

In my soccer league Im using (where users play with teams) ELO rating. Everything works fine. I need advice on how to extend the formula to reflect the addition of the coefficient and power of the team players. (Teams have… Continue reading

Tagged , | Leave a comment

Calculating Floating Point Powers (PHP/BCMath)

I’m writing a wrapper for the bcmath extension, and bug #10116 regarding bcpow() is particularly annoying — it casts the $right_operand ($exp…) to an (native PHP, not arbitrary length) integer, so when you try to calculate the square Continue reading

Tagged , , , , | Leave a comment
8 pages