Sunday, October 13, 2013

cara mendisable dns recursion vps

pakai ssh
instruksi :
To disable DNS recursion:

nano -w /var/named/chroot/etc/named.conf

Add the following text at the end of this file:

options {
recursion no;
};

then restart the named service (service named restart)

Tuesday, October 8, 2013

menghapus duplicate row di sql menggunakan excel

expor dulu table ke dalam format xls(ada di menu export phpmyadmin)
lalu buka file export dngn excel.
lakukan tips ini :
  1. Select all the rows, including the column headers, in the list you want to filter.
Tip
Click the top left cell of the range, and then drag to the bottom right cell.
  1. On the Data menu, point to Filter, and then click Advanced Filter.
  2. In the Advanced Filter dialog box, click Filter the list, in place.
  3. Select the Unique records only check box, and then click OK.
The filtered list is displayed and the duplicate rows are hidden.
  1. On the Edit menu, click Office Clipboard.
The Clipboard task pane is displayed.
  1. Make sure the filtered list is still selected, and then click Copy .
The filtered list is highlighted with bounding outlines and the selection appears as an item at the top of the Clipboard.
  1. On the Data menu, point to Filter, and then click Show All.
The original list is re-displayed.
  1. Press the DELETE key.
The original list is deleted.
  1. In the Clipboard, click on the filtered list item.
The filtered list appears in the same location as the original list.

mengatasi error Duplicate entry '1' for key 1

misal perintah sql :
INSERT INTO mobiware2 (idkw, kw) VALUES
(1, ' how to turn off facebook contacts on a samsung galaxy 3'),

padahal di table sudah terdapat idkw 1 maka error  error Duplicate entry '1' for key 1 akan muncul

cara mengatasi :
INSERT INTO mobiware2 (idkw, kw) VALUES
(null, ' how to turn off facebook contacts on a samsung galaxy 3'),

null akan menjadi id secara otomatis di idkw paling ahir alias auto increment.

tampilkan random search term stt2 terbaru

tambahkan fungsi untuk tampilkan random search term stt2 terbaru :
function stt_rand_terms($count=10){
    global $wpdb;
    $start_time = round(microtime(),3);
    $options = get_option('pk_stt2_settings');
    $sql = "SELECT `meta_value`,`meta_count`,`post_id` FROM `".$wpdb->prefix."stt2_meta` ORDER BY RAND() LIMIT ".$count.";";
    $searchterms = $wpdb->get_results($sql);
    if(!empty($searchterms)) {
          $result = pk_print_searchterms($searchterms,$options);
      return $result;
    } else {
        return false;
    }
}

lalu pasang di widget :
<?php if(function_exists('stt_rand_terms')) echo stt_rand_terms(10) ;?>