Postingan

Menampilkan postingan dari Juni, 2013

Introduction Regular Expression part 1 by muhamad akbar bin widayat

Gambar
regex to transform StudlyCase to camelCase (Photo credit: chris.corwin ) Hi, all I will share you about learning regular expression(regex) . The concept to make regex is about determining pattern of string or word or anything that have pattern. What the first you do?. I try to share to you about creating simple regex first. On making regex you should know what the pattern your string after that you should make from simple first regex. Because when you start with simple regex first is began to make you more complex regex. 1. I have string       "111-111".     scenario pattern: should the first word is integer the first integer include only 3 number include (-) after integer after that should include only 3 number in last string. 2. After determining pattern, you should write the regex. Add /^/ is means the start of first character Add /\d{3}/ is means the string include only 3 number Add /-/ is pattern of string Add /\d{\}/ is means only 3

Ruby on Rails Regex Delete Array in string or word or in sentences.

Gambar
Official Ruby logo (Photo credit: Wikipedia ) Hi all, I will share to you to delete array in string using regex. Please follow me: 1. using regex str.match(/^.*KOPIKO.*$/) for example   def self.delete_string_with_regex     str = "KOPIKO RASA JERUK MANIS DAN MINT"     arr = ["KOPIKOS", "JERUK", "COY"]     arr.delete_if {|arr| str.match(/^.*#{arr}.*$/)}   end

Ubuntu Import or Dump MySQL databases

Hi All, I will share to you about import data on MySQL. Please follow me: 1. prepare your file city.sql 2. use this in your command line.     mysql -u root -p database_name < city.sql I hope this article can help you.

Object Oriented Programming (OOP) on Ruby on rails part 1

Gambar
Ruby on Rails logo (Photo credit: Wikipedia ) Hi all, Currently, I want to share to you about applying Object Oriented Programming (OOP) on Ruby on Rails. When you want to make object oriented programming in Ruby on rails please do this. 1. Read about Object Oriented Programming concept first.      http://docs.oracle.com/javase/tutorial/java/concepts/ 2. Read about object oriented programming on ruby on rails.      http://objectsonrails.com/ On above is concept first what you should know on applying object oriented on Ruby on Rails. I hope this article can help you to make you code more apply the Object Oriented Programming concept.

Ruby on Rails Multiple ssh on Github

Hi All, I want to share to you about setting multiple git account on your computer. Please follow me: - Generate new ssh-key:    ssh-keygen -t rsa -f ~/.ssh/accountB -C "your_email@youremail.com" - Create or Modify the .ssh/config    #office account    Host github.com-office      HostName github.com        User git IdentityFile ~/.ssh/office    #project account    Host github.com-project      HostName github.com        User git IdentityFile ~/.ssh/private - When you clone project office:    git clone git@github.com-office:project/project.git - When you clone project private:   git clone git@github.com-private:project2/project2.git I hope this article can help you.

Ruby On Rails submit with image button

Gambar
Hi all, I will share you about adding image on rails. Please follow me. 1. code html: product search 2. code rails: <%= form_tag fast_tracks_path, :method => 'get' do %> product search <%= image_submit_tag("/assets/icon-search.png") %> <%= text_field_tag 'variant[name]' %> <% end %> Please using image_submit_tag I hope this article is usefully.