[php] kurs walut - trzecie podejście - cześć 1
Sunday, 22. June 2008, 20:12:07
(!ereg("^http://", $url)) ? $this->url = "http://" . $url : $this->url = $url;
Sunday, 22. June 2008, 20:12:07
Thursday, 17. May 2007, 19:39:11
function ivtf($ANo)
{
if(ereg('^[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}$', $ANo) == True)
{
$date = explode(':', $ANo);
if(
($date[0] < 24) AND ($date[1] < 60) AND ($date[2] < 60)
) return True;
else return False;
}
else
{
return False;
}
}
function calkowita($ANo) {
return ereg('^[+-]?[0-9]+$', $ANo);
}
function zmiennoprzecinkowa($ANo) {
return ereg('^[+-]?[0-9]*\.?[0-9]+$', $ANo);
}
Thursday, 17. May 2007, 13:28:47
$uchwyt = fopen("slowa-win.txt", "rb");
$tresc = NULL;
while (!feof($uchwyt)) {
$tresc .= fread($uchwyt, 16384);
++$a;
}
fclose($uchwyt);
$tmp = explode("\n", $tresc);
$ile = count($tmp);
while ($a < $ile) {
if((strlen($tmp[$a]) > 3)) {
if($tmp[$a][2] != $tmp[$a-1][2]) {
$plik = substr($tmp[$a], 0, 2) . "_max.txt";
}
$fp = fopen($plik, "a+");
fputs($fp, $tmp[$a]);
fclose($fp);
}
++$a;
}Jeżeli macie wystarczająco dużo czasu żeby bawić się w przetwarzanie ponad 30 megowego txt w PHP - śmiało, musicie tylko zmienić jeszcze dyrektywy w php.ini odpowiadające za maksymalny czas wykonywania skryptów oraz ilośc pamięci na to przeznaczonejmax_execution_time = 3600 ; Maximum execution time of each script, in seconds memory_limit = 64M ; Maximum amount of memory a script may consume (8MB), a to może okazać się jeszcze za mało ;D
Wednesday, 25. April 2007, 06:34:32
Wednesday, 18. April 2007, 18:52:45
FUNCTION werele($nazwa) {
RETURN EREG('^[_A-Za-z:]+[-_A-Za-z0-9.;]*$', $nazwa);
}
Monday, 16. April 2007, 06:21:57
<?
$_POST['a'] = -10;
$_POST['b'] = 10;
$e = 0.001;
$k = 0.61803398;
function oblicz($x) {
return ($x - 3.1415) * ($x - 3.1415);
}
$_POST['ciecie_lewe'] = $_POST['b'] - $k * ($_POST['b'] - $_POST['a']);
$_POST['ciecie_prawe'] = $_POST['a'] + $k * ($_POST['b'] - $_POST['a']);
$_POST['wartosc_lewa'] = oblicz($_POST['ciecie_lewe']);
$_POST['wartosc_prawa'] = oblicz($_POST['ciecie_prawa']);
$i++;
while(($_POST['b'] - $_POST['a']) > $e) { $i++;
if (oblicz($_POST['ciecie_lewe']) < oblicz($_POST['ciecie_prawe'])) {
$_POST['b'] = $_POST['ciecie_prawe'];
$_POST['ciecie_prawe'] = $_POST['ciecie_lewe'];
$_POST['wartosc_prawa'] = oblicz($_POST['ciecie_prawe']);
$_POST['ciecie_lewe'] = $_POST['b'] - $k * ($_POST['b'] - $_POST['a']);
$_POST['wartosc_lewa'] = oblicz($_POST['ciecie_lewe']);
} else {
$_POST['a'] = $_POST['ciecie_lewe'];
$_POST['ciecie_lewe'] = $_POST['ciecie_prawe'];
$_POST['wartosc_lewa'] = oblicz($_POST['ciecie_lewe']);
$_POST['ciecie_prawe'] = $_POST['a'] + $k * ($_POST['b'] - $_POST['a']);
$_POST['wartosc_prawa'] = oblicz($_POST['ciecie_prawa']);
}
$_POST['ciecie_srodek'] = ($_POST['a'] + $_POST['b']) / 2;
}
echo "<b>". $_POST['ciecie_srodek'] . "</b> za <b>" . $i . "</b> razem.";
?>
Wednesday, 4. April 2007, 21:11:21
# autor: Fabian Lenczewski
# data: 2007-04-04
# Uniwersytet w Białymstoku, Instytut Informatyki
function oblicz($x) {
# przykładowa funkcja
return ($x - 3.1415) * ($x - 3.1415);
}
# granice przedziału
$_POST[a] = -10;
$_POST[b] = 10;
# epsilon
$e = 1.3;
# echo "Max. ilosc kroków: ". $il_krokow = ($_POST[b] - $_POST[a]) / $e . "\n";
for($i = 1; $i<$il_krokow; $i++) {
$_POST[l] = $_POST[b] - $_POST[a];
$_POST[ciecie_srodek] = ($_POST[a] + $_POST[b]) / 2;
$_POST[ciecie_lewe] = $_POST[a] + $_POST[l] / 4;
$_POST[ciecie_prawe] = $_POST[b] - $_POST[l] / 4;
$_POST[wartosc_lewa] = oblicz($_POST[ciecie_lewe]);
$_POST[wartosc_srodek] = oblicz($_POST[ciecie_srodek]);
$_POST[wartosc_prawa] = oblicz($_POST[ciecie_prawe]);
if ($_POST[wartosc_lewa] > $_POST[wartosc_srodek]) {
$_POST[a] = $_POST[ciecie_srodek];
} else if ($_POST[wartosc_prawa] <= $_POST[wartosc_srodek]) {
$_POST[a] = $_POST[ciecie_lewe];
$_POST[b] = $_POST[ciecie_prawe];
} else {
$_POST[b] = $_POST[ciecie_srodek] ;
}
}
echo $_POST[ciecie_srodek];
Tuesday, 23. January 2007, 11:20:20
# IS VALID DATE FORMAT, RRRR-MM-DD
function ivdf($ANo)
{
if(ereg('^[0-9]{4}-[0-9]{1,2}-[0-9]{1,2}$', $ANo) == True)
{
$date = explode('-', $ANo);
if (checkdate($date[1], $date[2], $date[0])) {
return True;
} else {
return False;
}
}
else
{
return False;
}
}
Monday, 22. January 2007, 09:38:43
function del_numeric($data){
return $data = preg_replace('/[0-9.]/', '', $data);
}
dodane: function save_numeric($data){
return $data = preg_replace('/[^0-9.]/', '', $data);
}
Showing posts 1 - 10 of 27.
anonymous
pietro writes: Poszukuje algorytmu DTC. Za wszelkie informacje ...
anonymous
piotr writes: http://my.opera.com/lenczewski/blog/matlab-powiek ...
anonymous
Maciek writes: Można krócej: function ivdf($ANo) { if(ereg ...
anonymous
anonymous
| M | T | W | T | F | S | S |
|---|---|---|---|---|---|---|
|
| ||||||
| 1 | 2 | 3 | 4 | 5 | 6 | |
| 7 | 8 | 9 | 10 | 11 | 12 | 13 |
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| 28 | 29 | 30 | 31 | |||