Showing posts with label Tutorial. Show all posts
Showing posts with label Tutorial. Show all posts

Instalasi Shareholic di Blogspot

10:03 AM | , , ,

Langkah Ke-1 : Setup Shareholic

  1. Jika anda belum memiliki akun shareholic anda dapat mendaftar di https://www.shareaholic.com/ (bisa menggunakan alamat email maupun menggunakan signup from facebook & twitter)
  2. Jika sudah selesai registrasi lalu login dengan akun shareholic anda dan masuk pada menu Site Tools kemudian klik Add Website




















  3. Isikan alamat url blog anda dan nama blog pada isian Domain dan Name. Misal : domain : newbiebehappy.blogspot.com dan name : Newbie Be Happy
  4. Klik tombol Continue untuk menyimpan
  5. Klik Get Setup Code untuk mendapatkan kode javascript shareholic. Copas script tersebut ke notepad















Langkah Ke-2 : Memasang Shareholic pada Blogger

  1. Pasang setup code yang sudah kita copas ke notepad tadi ke template blogger
    • Buka blog anda dan jangan lupa login :)
    • Klik mennu Template 
    • Klik tombol Edit HTML
    • Klik pada editor template blogger lalu cari tag </head> dengan cara Ctrl + F lalu isikan </head>
    • Pasang kode shareholic tadi di atas </head> lalu klik Save Template










  2. Verifikasi website
    • Masuk pada menu Site Tools pada shareholic lagi
    • Klik tombol Verify Site
      Jika versifikasi berhasil maka akan muncul tanda checklist warna hijau sebagai berikut


Langkah Ke-3 : Memasang Share Button di Artikel

  1. Setup Share Button pada Shareholic
    • Masuk pada menu Site Tools pada shareholic lagi
    • Klik Add App Location lalu pilih Share Button
    • Atur tampilan Share Button sesuai keinginan
    • Klik tombol Save Settings
    • Klik tombol Code Snipet icon </> lalu copas kode share button
  2. Pasang kode share button pada blogger post page
    • Buka menu Template pada Blogger lalu klik Edit HTML
    • Tambahkan kode share button setelah kode <div class='post-header-line-1'>









    • Kemudian klik tombol Save Template
    • Share Button sudah terpasang pada blog anda
Read More

PHP Code : How to Check If Key Array Is Exist

5:02 PM | , , , , , , ,

Check if key array is exist with function array_key_exists

Syntax
bool array_key_exists ( mixed $key , array $array )
array_key_exists() returns TRUE if the given key is set in the array. key can be any value possible for an array index.

<?php
$search_array 
= array('first' => null'second' => 4);
// returns falseisset($search_array['first']);
// returns truearray_key_exists('first'$search_array);?>
Read More

Using JQuery Array

10:12 AM | , , , , , , , , ,

1. Array Push

var fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.push("Kiwi")

The result of fruits will be:
Banana,Orange,Apple,Mango,Kiwi

2. Remove Array Elemen

var y = [1, 2, 3];
var removeItem = 2;

y = jQuery.grep(y, function(value) {
  return value != removeItem;
});
or
var y = [1, 2, 3];
var removeItem = 2;
y.splice( $.inArray(removeItem, y), 1 );
or
var y = [1, 2, 3];
y.remove(2);
The result of fruits will be:
1,3


Read More

Redirect Page and Send Some Post Data

7:28 PM | , , , , , , , ,

Iseng-iseng bikin fungsi untuk redirect form sekaligus mengirimkan data dengan method POST tanpa menggunakan ajax. Fungsi ini gunanya untuk mengirimkan data sekaligus redirect ke halaman tertentu tetapi variabel yg dikirimkan berbeda-beda pada beberapa kasus.

function redirect_post($url, array $data) {
?>
<html xmlns="http://www.w3.org/1999/xhtml">
   <head>
       <script type="text/javascript">
           function closethisasap (){
               document.forms["redirectpost"].submit();
           }
       </script>
       <body onload="closethisasap();">
           <form name="redirectpost" method="post" action="<? echo $url; ?>" >
               <?
               if (!is_null($data)) {
                   foreach ($data as $k => $v) {
                       echo '<input type="hidden" name="'.$k.'" value="'.$v.'"> ';
                   }
               }
               ?>
           </form>
       </body>
   </head>
</html>
<?
exit();
}

Cara pemanggilan fungsinya:

$data['varname1'] = "value1";
$data['varname2'] = "value2";
$url = "Some location";
redirect_post($url, $data);
Read More

Membuat Fungsi Terbilang

7:16 PM | , , , , , , ,


Iseng-iseng aja berbagi fungsi terbilang gunanya untuk mengubah angka menjadi kata terbilangnya.
Misalnya angka 12 maka akan keluar "dua belas"
function fx_terbilang($bilangan){
     $bilangan = abs($bilangan);
     $angka = array("Nol","satu","dua","tiga","empat","lima","enam","tujuh","delapan","sembilan","sepuluh","sebelas");
      $temp = "";

if($bilangan < 12){
$temp = " ".$angka[$bilangan];
}else if($bilangan < 20){
$temp = terbilang($bilangan - 10)." belas";
}else if($bilangan < 100){
$temp = terbilang($bilangan/10)." puluh".terbilang($bilangan%10);
}else if ($bilangan < 200) {
$temp = " seratus".terbilang($bilangan - 100);
}else if ($bilangan < 1000) {
$temp = terbilang($bilangan/100). " ratus". terbilang($bilangan % 100);
}else if ($bilangan < 2000) {
$temp = " seribu". terbilang($bilangan - 1000);
}else if ($bilangan < 1000000) {
$temp = terbilang($bilangan/1000)." ribu". terbilang($bilangan % 1000);
}else if ($bilangan < 1000000000) {
$temp = terbilang($bilangan/1000000)." juta". terbilang($bilangan % 1000000);
}

return $temp;
}

cara memakainya

echo fx_terbilang(12);

silakan mencoba :)
Read More

How To Set Up Wireless Ad Hoc in Windows 8

5:13 PM | , , , , , ,

Procedure
Step 1: Launch an elevated command prompt under Windows 8 (one with administrator privileges).
Open windows explorer than press menu File > Open command prompt > Open command prompt as administrator













Step 2: Run the following command to verify that your network interface supports virtualization:
netsh wlan show drivers




















If Hosted network supported says Yes, you’re all set. Otherwise, you need to upgrade your hardware, if the software update doesn’t fix it.

Step 3: Now, set up the ad hoc wireless network using this command. Replace the parts in markup tags with your own choices
netsh wlan set hostednetwork mode=allow ssid=<enter_network_name_here> key=<enter_password_here>










Step 4: Until now, your hosted network has been created. Now, you need to start it. Use the command below:
netsh wlan start hostednetwork










Step 5: You’re all set, with just one thing remaining. If it’s not already enabled, you need to allow Internet Connection Sharing (ICS) for your currently-active internet connection. Simply head over to Network & Sharing Center, and in the properties for the current internet connection, enable ICS. Make sure to select the ad hoc connection under Home networking connection.


Read More

CARA MUDAH MENGHAFAL Al-QURAN, BISA DICOBA

4:35 PM | , , , ,



Segala puji Bagi Allah Rabb semesta alam, shalawat dan salam semoga terlimpahkan kepada Nabi kita Muhammad SAW. Dalam tulisan ini akan kami kemukakan cara termudah untuk menghafalkan al quran. Keistimewaan teori ini adalah kuatnya hafalan yang akan diperoleh seseorang disertai cepatnya waktu yang ditempuh untuk mengkhatamkan al-Quran. Teori ini sangat mudah untuk di praktekan dan insya Allah akan sangat membantu bagi siapa saja yang ingin menghafalnya. Disini akan kami bawakan contoh praktis dalam mempraktekannya :

Misalnya saja jika anda ingin menghafalkan surat Al - Mulk, maka anda bisa mengikuti teori berikut ini :

1. Bacalah ayat pertama 20 kali
2. Bacalah ayat kedua 20 kali
3. Bacalah ayat ketiga 20 kali
4. Bacalah ayat keempat 20 kali
5. Kemudian membaca 4 ayat diatas dari awal hingga akhir menggabungkannya sebanyak 20 kali.
6. Bacalah ayat kelima 20 kali
7. Bacalah ayat keenam 20 kali
8. Bacalah ayat ketujuh 20 kali
9. Bacalah ayat kedelapan 20 kali
10. Kemudian membaca ayat kelima hingga ayat kedelapan untuk menggabungkannya sebanyak 20 kali.
11. Bacalah ayat ke 1 hingga ayat ke 8 sebanyak 20 kali untuk memantapkan hafalannya.

Demikian seterusnya hingga selesai seluruh al Quran, dan jangan menghafal dalam sehari lebih dari seperdelapan juz, agar tidak berat bagi anda untuk mengulang dan menjaganya.

Salah satu keutamanan membaca Al-quran adalah perniagaan atau perdagangan yang tidak pernah merugi.

{الَّذِينَ يَتْلُونَ كِتَابَ اللَّهِ وَأَقَامُوا الصَّلَاةَ وَأَنْفَقُوا مِمَّا رَزَقْنَاهُمْ سِرًّا وَعَلَانِيَةً يَرْجُونَ تِجَارَةً لَنْ تَبُورَ (29) لِيُوَفِّيَهُمْ أُجُورَهُمْ وَيَزِيدَهُمْ مِنْ فَضْلِهِ إِنَّهُ غَفُورٌ شَكُورٌ (30)}

“Sesungguhnya orang-orang yang selalu membaca kitab Allah dan mendirikan salat dan menafkahkan sebahagian dari rezeki yang Kami anugerahkan kepada mereka dengan diam-diam dan terang-terangan, mereka itu mengharapkan perniagaan yang tidak akan merugi”. “Agar Allah menyempurnakan kepada mereka pahala mereka dan menambah kepada mereka dari karunia-Nya. Sesungguhnya Allah Maha Pengampun lagi Maha Mensyukuri.” (QS. Fathir: 29-30).
Dari artikel 'Keutamaan Membaca Al Qur’an — Muslim.Or.Id'
Read More

Wow, Jolicloud Desktop Environment In Ubuntu

4:47 PM | , , , , , , ,


Jolicloud Desktop Enviroment is a small minimalist desktop environment based on HTML 5 for netbook.
For installing Jolicloud in Ubuntu please open your terminal and follow this step.
  1. Add PPA repository
    sudo add-apt-repository ppa:jolicloud-team/ppa
  2. Update source repository
    sudo apt-get update
  3. install Desktop Enviroment
    sudo apt-get install jolicloud-desktop-environmentya
After installation finished, logout your computer. Next login choose jolicloud Desktop Environment.



Read More

Menambah Kapasitas Limit File Upload di Apache

4:44 PM | , , , , , ,


Untuk menambah kapasitas limit file upload di webserver yang menggunakan apache maka kita harus mengubah file konfigurasi php.ini di komputer kita.

Langkah yang harus dilakukan
1. Buka file konfigurasi php.ini

sudo gedit  /etc/php5/apache2/php.ini
2. Setelah itu ubah konfigurasinya cari settingan memory_limit, upload_max_filesize dan post_max_sizenya.

memory_limit = 32M
upload_max_filesize = 10M
post_max_size = 20M
3. Restart apache

sudo service apache2 restart

Read More

Menghapus semua direktori .svn

1:41 PM | , , , , , ,

Mengapa ini diperlukan ? Pemicunya adalah ketika saya memiliki sebuah source yang biasanya di update dengan Subversion (SVN) tapi karena suatu sebab harus saya pindahkan ke tempat lain dan akan di import ulang ke SVN server lain. Di dalam direktory source tersebut sudah memiliki direktory2 ‘.svn’ yang mengacu kepada server SVN sebelumnya. Karenanya perlu di hapus. Karena setiap direktory yang ada dipastikan terdapat direktory tersebut, maka sangat tidak efisien kalau harus menghapusnya satu persatu.
Setelah membaca dari beberapa sumber di om Google dan Stackoverflow, maka berikut adalah beberapa hal yang dapat dilakukan (sebenarnya juga bisa berlaku untuk nama direktori yang lain selain ‘.svn’)
Perintah utama sebenarnya adalah :  rm -rf  yang akan diulang-ulang untuk setiap direktori .svn.
Untuk itu kita perlu perintah   xargs  yang akan melempatkan hasil perintah sebelumnya menjadi parameter dari perintah yang menggunakannya.
hasil dari perinah find adalah nama direktory lengkap dengan struktur direktory nya, kemudian ditangkap oleh xargs dan menjadi parameter dari rm – rf  yang ada disamping xargs.
Catatan : harap berhati-hati dengan perintah rm – rf karena akan menghapus direktory dan semua direktori dan files di bawahnya sekaligus.

(http://openstat.sekolahku.org)
Read More

Tutorial phpCAS di Linux

9:37 AM | , , , , , ,

Apa itu phpCAS ? silakan baca di sini

Langkah-langkah menginstal phpCAS
1. Jika anda belum menginstal php-pear di komputer anda maka instal terlebih dahulu
sudo apt-get install php-pear
2. Lalu jalankan perintah di bawah ini
sudo pear install  http://downloads.jasig.org/cas-clients/php/current.tgz
3. Setelah instalasi selesai maka phpCAS sudah bisa digunakan
4. Untuk memahami cara penggunaan phpCAS anda bisa menggunakan script berikut lalu di simpan ke file config.php


/**
 * The purpose of this central config file is configuring all examples
 * in one place with minimal work for your working environment
 * Just configure all the items in this config according to your environment
 * and rename the file to config.php
 *
 * PHP Version 5
 *
 * @file     config.php
 * @category Authentication
 * @package  PhpCAS
 * @author   Joachim Fritschi <jfritschi@freenet.de>
 * @author   Adam Franco <afranco@middlebury.edu>
 * @license  http://www.apache.org/licenses/LICENSE-2.0  Apache License 2.0
 * @link     https://wiki.jasig.org/display/CASC/phpCAS
 */
$phpcas_path = '/usr/share/php';
///////////////////////////////////////
// Basic Config of the phpCAS client //
///////////////////////////////////////
// Full Hostname of your CAS Server
$cas_host = 'sso.sample.com';
// Context of the CAS Server
$cas_context = '/cas/';
// Port of your CAS server. Normally for a https server it's 443
$cas_port = 443;
// Path to the ca chain that issued the cas server certificate
//$cas_server_ca_cert_path = '/path/to/cachain.pem';
//////////////////////////////////////////
// Advanced Config for special purposes //
//////////////////////////////////////////
// The "real" hosts of clustered cas server that send SAML logout messages
// Assumes the cas server is load balanced across multiple hosts
$cas_real_hosts = array('cas-real-1.example.com', 'cas-real-2.example.com');
// Database config for PGT Storage
$db = 'pgsql:host=localhost;dbname=phpcas';
//$db = 'mysql:host=localhost;dbname=phpcas';
$db_user = 'phpcasuser';
$db_password = 'mysupersecretpass';
$db_table = 'phpcastabel';
$driver_options = '';
///////////////////////////////////////////
// End Configuration -- Don't edit below //
///////////////////////////////////////////
// Generating the URLS for the local cas example services for proxy testing
if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {
    $curbase = 'https://' . $_SERVER['SERVER_NAME'];
} else {
    $curbase = 'http://' . $_SERVER['SERVER_NAME'];
}
if ($_SERVER['SERVER_PORT'] != 80 && $_SERVER['SERVER_PORT'] != 443) {
    $curbase .= ':' . $_SERVER['SERVER_PORT'];
}
$curdir = dirname($_SERVER['REQUEST_URI']) . "/";
// CAS client nodes for rebroadcasting pgtIou/pgtId and logoutRequest
$rebroadcast_node_1 = 'http://cas-client-1.example.com';
$rebroadcast_node_2 = 'http://cas-client-2.example.com';
// access to a single service
$serviceUrl = $curbase . $curdir . 'example_service.php';
// access to a second service
$serviceUrl2 = $curbase . $curdir . 'example_service_that_proxies.php';
$pgtBase = preg_quote(preg_replace('/^http:/', 'https:', $curbase . $curdir), '/');
$pgtUrlRegexp = '/^' . $pgtBase . '.*$/';
$cas_url = 'https://' . $cas_host;
if ($cas_port != '443') {
    $cas_url = $cas_url . ':' . $cas_port;
}
$cas_url = $cas_url . $cas_context;
// Set the session-name to be unique to the current script so that the client script
// doesn't share its session with a proxied script.
// This is just useful when running the example code, but not normally.
session_name(
    'session_for:'
    . preg_replace('/[^a-z0-9-]/i', '_', basename($_SERVER['SCRIPT_NAME']))
);
// Set an UTF-8 encoding header for internation characters (User attributes)
header('Content-Type: text/html; charset=utf-8');

nb. perintah yg ditebalkan diubah sesuai setting di server sso yang akan kita tuju.

5. Buat file script_info.php yang berisi perintah berikut

<?php
/**
 *  Small script to add some info about the example script that is running.
 *  Adds some info that makes it easier to distinguish different proxy sessions
 *
 * PHP Version 5
 *
 * @file     script_info.php
 * @category Authentication
 * @package  PhpCAS
 * @author   Joachim Fritschi <jfritschi@freenet.de>
 * @author   Adam Franco <afranco@middlebury.edu>
 * @license  http://www.apache.org/licenses/LICENSE-2.0  Apache License 2.0
 * @link     https://wiki.jasig.org/display/CASC/phpCAS
 */ ?>
    <dl style='border: 1px dotted; padding: 5px;'>
      <dt>Current script</dt><dd><?php print basename($_SERVER['SCRIPT_NAME']); ?></dd>
      <dt>session_name():</dt><dd> <?php print session_name(); ?></dd>
      <dt>session_id():</dt><dd> <?php print session_id(); ?></dd>
    </dl>

6. Terakhir buat file utama untuk mendapatkan otentikasi dan informasi dari sso server. Contoh

<?php
/**
 *   Example for a simple cas 2.0 client
 *
 * PHP Version 5
 *
 * @file     example_simple.php
 * @category Authentication
 * @package  PhpCAS
 * @author   Joachim Fritschi <jfritschi@freenet.de>
 * @author   Adam Franco <afranco@middlebury.edu>
 * @license  http://www.apache.org/licenses/LICENSE-2.0  Apache License 2.0
 * @link     https://wiki.jasig.org/display/CASC/phpCAS
 */
// Load the settings from the central config file
require_once 'config.php';
// Load the CAS lib
require_once $phpcas_path . '/CAS.php';
// Uncomment to enable debugging
phpCAS::setDebug();
// Initialize phpCAS
phpCAS::client(CAS_VERSION_2_0, $cas_host, $cas_port, $cas_context);
// For production use set the CA certificate that is the issuer of the cert
// on the CAS server and uncomment the line below
// phpCAS::setCasServerCACert($cas_server_ca_cert_path);
// For quick testing you can disable SSL validation of the CAS server.
// THIS SETTING IS NOT RECOMMENDED FOR PRODUCTION.
// VALIDATING THE CAS SERVER IS CRUCIAL TO THE SECURITY OF THE CAS PROTOCOL!
phpCAS::setNoCasServerValidation();
// force CAS authentication
phpCAS::forceAuthentication();
// at this step, the user has been authenticated by the CAS server
// and the user's login name can be read with phpCAS::getUser().
// logout if desired
if (isset($_REQUEST['logout'])) {
phpCAS::logout();
}
// for this test, simply print that the authentication was successfull
?>
<html>
  <head>
    <title>phpCAS simple client</title>
  </head>
  <body>
    <h1>Successfull Authentication!</h1>
    <?php require 'script_info.php' ?>
    <p>the user's login is <b><?php echo phpCAS::getUser(); ?></b>.</p>
    <p>phpCAS version is <b><?php echo phpCAS::getVersion(); ?></b>.</p>
    <p><a href="?logout=">Logout</a></p>
  </body>
</html>

7. Jalankan program namun jangan lupa alamat domain anda harus sudah terdaftar pada sso server

Selamat mencoba :)

Read More

Belajar Pemrograman Ruby Dasar - 1

9:26 AM | , ,



Tutorial ini diambil dari http://tryruby.org

1. Operasi Matematis

Untuk menghitung operasi matematis di ruby tidak perlu sintaks-sintaks khusus cukup memasukan operasi tersebut. Contoh:
4*5+3
maka akan ditampilkan pesan
=> 23

2. Menampilkan sebuah string

Untuk menampilkan sebuah string maka cukup menambahkan tanda  double quote ("...") di antara string tersebut. Contoh:
"Alir"
=> "Alir"

3. Menampilkan reverse string

Untuk menampilkan sebuah string dari huruf belakang ke depan cukup menambahkan kata kunci reverse pada string tersebut. Contoh:
"Alir".rev­erse
=> "rilA"

4. Menghitung panjang karakter

Untuk menghitung panjang karakter maka kita cukup menambahkan kata kunci length pada string. Contoh:

"How long"­.length
=> 8

5. Mengulang string

Untuk melakukan perulangan string maka kita tinggal menambahkan tanda * diikuti jumlah perulangan yang diinginkan. Contoh:

"Help.."*3­
=> "Help..Help..Help.."


6. Melakukan reverse pada angka

Untuk melakukan reverse pada angka maka kita harus merubahnya menjadi string terlebih dahulu dengan menggunakan fungsi to_s. Contoh

527.to_s.r­everse
=> "725"

7. Mengubah angka ke string, string ke angka, string ke array

Untuk mengubah angka ke string kita menggunakan to_s seperti pada poin sebelumnya , sedangkan sebaliknya untuk mengubah string ke angka kita gunakan to_i. Untuk menjadikan isi string ke dalam sebuah array maka kita menggunakan to_a. Contoh:

60.to_s
=> "60"


"50".to_i*­4
=> 200





Read More