Tampilkan postingan dengan label Pemograman. Tampilkan semua postingan
Tampilkan postingan dengan label Pemograman. Tampilkan semua postingan

Kamis, 23 Mei 2013

Redirect Menggunakan Javascript


All About Komputer - Disini saya akan share lagi tentang cara redirect kali ini denan javascript :D yuk intip :D


<script language=javascript>
setTimeout("location.href='[url-tujuan]'", [waktu]);
</script>

 
Silakan ganti [waktu] dengan berapa mili detik delay yang Anda inginkan. parameter ini akan menghentikan browser selama beberapa waktu sesuai keinginan Anda.

Untuk mengeset web site tujuan, Anda bisa menggunakan parameter [url-tujuan].
 
  
 
Berikut contohnya:
setTimeout("location.href='http://www.prothelon.com'", 5000);

Code Perintah .htaccess

#   buat komen
[F]   Forbidden: instructs the server to return a 403 Forbidden to the client.

[L]    Last rule: instructs the server to stop rewriting after the preceding directive is processed.

[N]   Next: instructs Apache to rerun the rewrite rule until all rewriting directives have been achieved.

[G]    Gone: instructs the server to deliver Gone (no longer exists) status message.

[P]    Proxy: instructs server to handle requests by mod_proxy

[C]    Chain: instructs server to chain the current rule with the previous rule.

[R]    Redirect: instructs Apache to issue a redirect, causing the browser to request the rewritten/modified URL.

[NC]   No Case: defines any associated argument as case-insensitive. i.e., "NC" = "No Case".

[PT]   Pass Through: instructs mod_rewrite to pass the rewritten URL back to Apache for further processing.

[OR]   Or: specifies a logical "or" that ties two expressions together such that either one proving true will cause the associated rule to be applied.

[NE]    No Escape: instructs the server to parse output without escaping characters.

[NS]    No Subrequest: instructs the server to skip the directive if internal sub-request.

[QSA]   Append Query String: directs server to add the query string to the end of the expression (URL).

[S=x]   Skip: instructs the server to skip the next "x" number of rules if a match is detected.

[E=variable:value]   Environmental Variable: instructs the server to set the environmental variable "variable" to "value".

[T=MIME-type]   Mime Type: declares the mime type of the target resource.


[]   specifies a character class, in which any character within the brackets will be a match. e.g., [xyz] will match either an x, y, or z.


[]+  character class in which any combination of items within the brackets will be a match. e.g., [xyz]+ will match any number of x’s, y’s, z’s, or any combination of these characters.


[^]    specifies not within a character class. e.g., [^xyz] will match any character that is neither x, y, nor z.

[a-z]    a dash (-) between two characters within a character class ([]) denotes the range of characters between them. e.g., [a-zA-Z] matches all lowercase and uppercase letters from a to z.

a{n}    specifies an exact number, n, of the preceding character. e.g., x{3} matches exactly three x’s.

a{n,}   specifies n or more of the preceding character. e.g., x{3,} matches three or more x’s.

a{n,m}   specifies a range of numbers, between n and m, of the preceding character. e.g., x{3,7} matches three, four, five, six, or seven x’s.

()   used to group characters together, thereby considering them as a single unit. e.g., (perishable)?press will match press, with or without the perishable prefix.


^    denotes the beginning of a regex (regex = regular expression) test string. i.e., begin argument with the proceeding character.


$    denotes the end of a regex (regex = regular expression) test string. i.e., end argument with the previous character.


   declares as optional the preceding character. e.g., monzas? will match monza or monzas, while mon(za)? will match either mon or monza. i.e., x? matches zero or one of x.

    declares negation. e.g., “!string” matches everything except “string”.

.    a dot (or period) indicates any single arbitrary character.

-    instructs “not to” rewrite the URL, as in “...domain.com.* - [F]”.

   matches one or more of the preceding character. e.g., G+ matches one or more G’s, while "+" will match one or more characters of any kind.


*    matches zero or more of the preceding character. e.g., use “.*” as a wildcard.

|    declares a logical “or” operator. for example, (x|y) matches x or y.


   escapes special characters ( ^ $ ! . * | ). e.g., use “\.” to indicate/escape a literal dot.

\.    indicates a literal dot (escaped).

/*    zero or more slashes.

.*    zero or more arbitrary characters.

^$    defines an empty string.

^.*$     the standard pattern for matching everything.

[^/.]     defines one character that is neither a slash nor a dot.

[^/.]+    defines any number of characters which contains neither slash nor dot.

http://     this is a literal statement — in this case, the literal character string, “http://”.

^domain.*    defines a string that begins with the term “domain”, which then may be proceeded by any number of any characters.


^domain\.com$    defines the exact string “domain.com”.

-d    tests if string is an existing directory

-f    tests if string is an existing file
-s    tests if file in test string has a non-zero value

Semoga Bermanfaat.

Selasa, 29 Januari 2013

Structured Query Language (SQL)

SQL
Merupakan bahasa yang dapat digunakan untuk berkomunikasi dengan server Terbagi menjadi 3 bagian yaitu:
DML (Data Manipulation Language)
DDL (Data Definition Language)
DCL (Data Control Language)

DML (Data Manipulation Language)
Perintah SQL untuk memilih, memasukkan data (baris),serta mengupdate atau menghapus data. 
SELECT - extracts data from a database 
UPDATE - updates data in a database 
DELETE - deletes data from a database 
INSERT INTO - inserts new data into a database 

DDL (Data Definition Language)
Perintah pembuatan, pengubahan, atau penghapusan tabel itu sendiri. 
CREATE DATABASE - creates a new database 
ALTER DATABASE - modifies a database 
CREATE TABLE - creates a new table 
ALTER TABLE - modifies a table 
DROP TABLE - deletes a table

DCL (Data Control Language)
Berhubungan dengan pengaturan akses ke data.
GRANT - untuk memberi user akses terhadap sejumlah perintah
REVOKE- untuk mencabut akses yang sebelumnya di-GRANT




from : allaboutalgoritma

Minggu, 06 Januari 2013

Program C++ : Membuat Belah Ketupat

#include <iostream.h>
#include <conio.h>

int main()
{
int tinggi;
cout<<("input : ");
cin>>tinggi;
int l = 1;
int n = tinggi/2;
cout<<"\n";
for(int i=1;i<=n;i++){
for(int k=n;k>i;k--){
cout<<" ";
}
for(int j=1;j<=l;j++){
cout<<"*";
}
l+=2;
cout<<"\n";
}
l -= 4;

for(int i=(n-1);i>=1;i--){
for(int k=i;k<=(n-1);k++){
cout<<" ";
}
for(int j=l;j>=1;j--){
cout<<"*";
}
l-=2;
cout<<"\n";
}
getch();
}




 

Cara Mengaktifkan .htaccess di localhost (xampp).



Okeh, .htaccess ternyata bikin pusing juga, berawal dari tantangan si bos nyuruh nambahin halaman di website PHP, dan terakhir ngerjain PHP itu pas semester 6. wkwkw alkhasil mesti buka dan bongkar-bongkar om google lagi.


Nah, masalah muncul setelah selesai instal xampp, setting koneksi.php dan taruh mysql. Setelah buka localhost/portal. Ooo.. muncul eror

OBJECT NOT FOUND
The requested URL /someone/mistyped/a/link.html was not found on this server.


setelah bertapa sedikit dan mengingat-ngingat semedi di kamar mandi akhirnya dapat kesimpulan masalah nya ada di .htaccess .

Ternyata sangka ga disangka setelah kita selesai instalasi xampp kita harus mengaktifkan fungsi .htaccess agar file .htaccess bisa terbaca.

Cara Mengaktifkan File .htaccess di localhost (xampp)

1. Buka file httpd.conf di directory \xampp\apache\conf
2. Cari baris code
#LoadModule rewrite_module modules/mod_rewrite.so

3. Ubah dengan menghapus tanda '#' sehingga code menjadi
LoadModule rewrite_module modules/mod_rewrite.so

4. Save
5. Restart server apache

Sumber : allaboutalgoritma.

Sabtu, 10 November 2012

Do A Barrel Roll – Sulap Baru Dari Google Search


Jika pikiran Anda sedang tak mood saat ini, atau apalah keadaan hati Anda saat ini maka saya yakin Anda akan sedikit terobati dan menemukan kegembiraan dengan trik baru yang di tampilkan oleh Google.com. Percayalah ini benar-benar 100% sangat menyenangkan.
Kunjungi situs pencarian terbesar di dunia Google.com, dan ketikan di kolom yang disediakan ‘do a barrel roll’ tanpa tanda petik ya. Kemudian klik tombol ‘search’ dan Amati apa yang terjadi kemudian.
Viola!!!!! Anda sudah mendapatkan apa yang saya maksud? Yeahh, halaman pencarian yang disajikan oleh Google berputar 360 derajat. Seperti bola biliard yang di sodok menggelinding dan berputar. Keren bukan?
Entah apa yang ingin ditunjukkan oleh Google dengan trik yang menghebohkan situs jejaring Twitter ini. Namun notifikasi yang diberikan Google menjelaskan bahwa trik ini diciptakan oleh insinyur Google untuk menunjukkan sedikit kehebatan CSS3.
“Hal menyenangkan hari ini, ‘do a barrel roll’ diciptakan oleh seorang insinyur perangkat lunak Google dengan tujuan untuk menghibur pengguna Google dengan menampilkan kekuatan CSS3, sebuah alat presentasi yang ada di fitur browser modern’,” demikian notifikasi Google.
Oh ya kemungkinan efek berputarnya halaman pencarian ini tidak bisa dinikmati jika Anda menggunakan web browser versi lama. Brower vrsi terbaru yang mensuport HTML5 akan membuat kode konten tersebut bekerja.
Secara harfiah ‘do a barrel rol’ bisa diartikan sebagai manuver pesawat yang bisa membuat putaran secara penuh dengan lintasan sarah dengan sumbu axis pesawat tersebut. Arti lain adalah nasihat yang diberikan oleh seseorang untuk membuat hal penting dalam hidup Anda. Sebagai contoh, jika teman Anda mengeluh dengan mengatakan, kemarin sungguh hal terburuk terjadi dalam hidupku, saya kehilangan pekerjaan dan pacar saya meninggalkanku. Apa yang harus saya lakukan teman?, Anda pun bisa menjawabnya dengan jawaban singkat do a barrel roll.
Tak peduli apa arti sesungguhnya dari do a barrel roll tapi yang penting disini adalah Google telah memberikan hiburan yang menarik yang belum prnah ditunjukkan oleh pesaingnya. Setuju?

sumber : MCI