Posted in April 15, 2010 ¬ 9:33 pmh.cuplis
nih mumpung masih hangat, salah satu algoritma deret fibonacci :
flowchart :
contoh program :
$limit = 10;
$fibonacci = "";
for($i=1;$i<=$limit;$i++){
if($i == 1){
$value[$i]=1;
}else{
$value[$i]=$value[$i-2] + $value[$i-1];
}
$fibonacci .= $value[$i]." ";
}
echo $fibonacci;
output :
1 1 2 3 5 8 13 21 34 55
Bookmarks:
Read the rest of this entry »
Posted in April 15, 2010 ¬ 8:16 pmh.cuplis
mumpung masih hangat, berikut ini salah satu contoh algoritma segitiga pascal beserta contoh codingnya di php
flowchart :
contoh program :
$limit = 6;
$pascal = "";
for($i=1;$i<=$limit;$i++){
for($j=1;<=$i;$j++){
if($j==1 || $j==$i){
$value[$i][$j] = 1;
}else{
$value[$i][$j] = $value[$i-1][$j] + $value[$i-1][$j-1];
}
$pascal .= $value[$i][$j]." ";
}
$pascal .= "
\n";
}
echo $pascal;
output :
Bookmarks:
Read the rest of this entry »
Posted in October 4, 2009 ¬ 5:27 pmh.cuplis
install php
user@computer:$ sudo apt-get install php5-cgi
buat file /etc/default/php-fastcgi
user@computer:$ sudo vim /etc/default/php-fastcgiSTART=yes# Which user runs PHP? (default: www-data)EXEC_AS_USER=www-data# Host and TCP port for FASTCGI-Listener (default: localhost:9000)FCGI_HOST=localhostFCGI_PORT=8888# Environment variables, which are processed by PHPPHP_FCGI_CHILDREN=4PHP_FCGI_MAX_REQUESTS=1000
Bookmarks:
Read the rest of this entry »
Posted in January 19, 2008 ¬ 10:45 amh.cuplis
Sebagian besar dari programmer pasti sudah mengetahui, bahkan sudah banyak yang mampu membuat kode keamanan untuk menangani spam atau biasa dikenal sebagai Completely Automated Public Turing test to tell Computers and Humans Apart (Captcha) :thumbs . Captcha berfungsi sebagai penguji otomatis untuk membedakan antara komputer dan manusia. Algoritma CAPTCHA ini digunakan untuk melawan spambot, [...]
Read the rest of this entry »
Posted in December 16, 2007 ¬ 2:57 pmh.cuplis
Berikut ini adalah contoh script php yang bisa dipakai jika kita ingin membuat file CSV. Bisa juga dikombinasikan dengan data2 yang ada di dalam database.
<?php
$list = array (
‘aaa,bbb,ccc,dddd’,
‘123,456,789′,
‘”aaa”,”bbb”‘
);
$fp = fopen(‘file.csv’, ‘w’);
foreach ($list as $line) {
fputcsv($fp, split(‘,’, $line));
}
fclose($fp);
?>
Bookmarks:
Read the rest of this entry »
Posted in December 16, 2007 ¬ 1:55 pmh.cuplis
Dalam pembuatan sebuah website interaktif tak jarang kita memanfaatkan fasilitas upload pada website tersebut. Sedangkan untuk script upload yang biasa digunakan dalam php adalah upload dengan method post. Fasilitas ini seharusnya diikuti dengan menggunakan validasi PHP dan memanipulasi sebuah fungsi, dan anda memiliki kontrol penuh untuk mengizinkan orang-orang dengan hak akses tertentu untuk melakukan proses [...]
Read the rest of this entry »