Langsung ke konten utama


Menampilkan postingan dari 2012

Ubuntu delete whitespace using vim

MacVim icon, glossy style (Photo credit: Wikipedia)

Well, I share to you to delete white space using vim. Please follow me.
1. Copy function below to ~/.vimrc

function! DelWhiteSpace()
autocmd BufWritePre     *.rb :call DelWhiteSpace()

2. Open a file that has whitespace and write
:call DelWhiteSpace()
3. And write to save and quit

Hopefully this article is useful. :)

fancybox making function condition

Hello guys,
I would to share about making function. You can take condition on your fancybox. In my case:
I have checkbox that should be checked to show the fancybox.

<script type="text/javascript">
    'onStart': function()
      var $list_friends = $('input[id^="friends"][type="checkbox"]:checked');
      var condition_friend = $list_friends.length
      if (condition_friend > 0) {
      } else {

Hopefully this article to be useful. :)

Ubuntu An error occurred while loading the archive.

Ubuntu-logo-unique-image (Photo credit: Jeffpro57) Archive:  /home/lap048/Documents/ahjah/ [/home/lap048/Documents/ahjah/]   End-of-central-directory signature not found.  Either this file is not   a zipfile, or it constitutes one disk of a multi-part archive.  In the   latter case the central directory and zipfile comment will be found on   the last disk(s) of this archive. zipinfo:  cannot find zipfile directory in one of /home/lap048/Documents/ahjah/ or           /home/lap048/Documents/ahjah/, and cannot find /home/lap048/Documents/ahjah/, period.

Solution: 1. Open Terminal and go to     cd ~/Document/ 2. run this:     jar xvf
Hopefully this article useful. Thanks

Bahaya bahasa Alay :D

Gambar ini dapat dari facebook.

Ruby on Rails creating constant on model

Ruby on Rails (Photo credit: Wikipedia) Follow me to create a constant on model. Many people ask where a good place to take a constant. I recommend to you to take a constant on your model.

For instance:
1. I have song.rb

class Song < ActiveRecord::Base   #--   # constants   #++   KEY_SIMBOLS = [ "C", "C#", "D", "D#", "E", "F", "F#", "G",      "G#", "A", "A#", "B" ] #-- # public class methods #++ def initial_key initial_key_sym = KEY_SIMBOLS endend 2. I have constant KEY_SIMBOLS
3. You can access with:
song = Song.first
song.initial_key Thanks

Kurnia Nurhajijah Profile

Muhamad Akbar Bin Widayat dan Kurnia Nurhajijah
Ini adalah foto saya dengan adik saya.  Foto ini diambil di Klatakan - Tanggul, Jember. Ini adik saya suka di foto. hehe

Vim Highlight baris dan setting maksimal karakter

1. masuk ke .vimrc. Dengan: vim ~/.vimrc
2. Ketikkan  match ErrorMsg '\%>80v.\+'
3. Save dan keluar ketik: wq

Semoga bermanfaat

Ubuntu cara mengganti / mengubah password mengunakan command line atau console atau terminal

Ini langkah - langkahnya:
1. Buka terminal atau console. Klik menu Applications > Accessories > Terminal 2. Ketik passwd 3. Isi current password sekarang 4. Isi password baru 5. Isi confirmation password 6. Maka akan mucul pesan "password updated successfully"
Semoga bermanfaat.

Ubuntu Cara menggunakan Vim

vim logo (Photo credit: Wikipedia) Bagi pengguna Vim pada Ubuntu ini ada beberapa settingan default saat menggunakan Vim.

1. Ketika sudah menginstall vim.
2. Buat file pada menggunakan vim.
3. Ketik vim ~/.vimrc
4. Kemudian ketik
:set number
:set smartindent
:set tabstop=2
:set shiftwidth=2
:set expandtab
5. Kemudian ketik :wq

Saya akan jelaskan satu persatu
1. :set number untuk menambahkan line
2. :set smartindent untuk auto indent line
3. :set tabstop untuk menambahkan tab 2 spasi

Semoga bermanfaat..

vim copy and paste outside terminal

When you want to copy, cut, and paste line outside terminal. Please follow me.

1. Putset clipboard=unnamed on .vimrc
2. restart your vim
3. write v and select what line that you want
4. press p on another file

I hope you can success.

Note: for the first point, you can put set using gedit or nano.
      for instance: nano ~/.vimrc
      do not forget save this file.

Iphone 4 Cara Setting Internet XL

Saat ini saya akan berbagi pengalaman untuk Setting Internet XL pada iPhone 4.. 1. Masuk ke Setiing icon 2. Kemudian pilih General 3. Kemudian pilih Network 4. Aktifkan 3G menjadi On 5. Aktifkan Cellular Data menjadi ON 4. - Setting APN: internet     - Setting Username: (di kosongin saja)     - Setting Password: (di kosongin saja) 5.  Ketika icon 3G belum muncul pada menu bar paling atas      Cobalah di restart iphonenya.

Semoga bermanfaat

ruby on rails devise skip validation of password, when edit user in user form

If you want to skip password validation in devise login. In users controller, you only add line below:

sign_in @user, :bypass => true unless params[:user][:password].blank?

for example:
def update
    if @user.update_user_data(params[:user])
      sign_in @user, :bypass => true unless params[:user][:password].blank?
      if current_user.is_admin?
        redirect_to users_path
        redirect_to edit_user_path(current_user)
      render :action => :edit

rails 3 Installing pg (0.11.0) with native extensions Unfortunately, a fatal error has occurred. Please report this error to the Bundler issue tracker at so that we can fix it. Thanks!

Installing pg (0.11.0) with native extensions Unfortunately, a fatal error has occurred. Please report this error to the Bundler issue tracker at so that we can fix it. Thanks! /home/lap048/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:552:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError) /home/lap048/.rvm/rubies/ruby-1.9.2-p180/bin/ruby extconf.rb --with-pg-config=/usr/local/Cellar/postgresql/9.1.2/bin/pg_config Using config values from /usr/local/Cellar/postgresql/9.1.2/bin/pg_config *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options. Provided configuration options: --with-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-l…

Ubuntu 10.10 how to install netbeans for rub on rails

Install netbeans for ruby on rails di ubuntu 10.10
2. Download netbeans for ruby
3. In terminal you should to go to the directory after you finished to download. for example: cd home/your_computer/Downloads
4. sudo apt-get install openjdk-6-jdk
5. sudo sh  ./
6. finish.

JavaScript how to count of length the array

var lost = [4, 8, 15, 16, 23, 42];
var count = lost.length;

var isLost = function (n) {
  for ( i=0; i<6; i++ ) {
    if ( n === lost[i]) {
      return true;
  return false;

if ( isLost(12) ) {
  console.log('12 is a lost number');

if ( isLost(16) ) {
  console.log('16 is a lost number');

ruby on rails helper category

    def category
               str = "<ul>"
          Category.parent_categories.each do |parent|
    str +=  "<li>#{link_to, category_path(}<li>"
            parent.child_categories.each do |child|
       str += "<ul><li>#{}</li></ul>"
    str += "</ul>"  
    return str