How $_POST store array elements in PHP

Sometime we need an array form elements like this

1
2
3
4
<input type="text" name="foo[]" value="a" />
<input type="text" name="foo[3]" value="b" />
<input type="text" name="foo[]" value="c" />
<input type="text" name="foo[7]" value="d" />

Read More

OS X failed bundle install

When I try to setup octopress in OS X, I run bundle install, it always come out an error like:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
$ bundle install
Fetching gem metadata from http://rubygems.org/.......
Fetching gem metadata from http://rubygems.org/..
/Users/jslim/.rvm/gems/ruby-1.9.3-p327@global/gems/bundler-1.2.3/lib/bundler.rb:263: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777
Using rake (0.9.2.2)
Installing RedCloth (4.2.9) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

/Users/jslim/.rvm/rubies/ruby-1.9.3-p327/bin/ruby extconf.rb
checking for main() in -lc... *** 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
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/Users/jslim/.rvm/rubies/ruby-1.9.3-p327/bin/ruby
--with-redcloth_scan-dir
--without-redcloth_scan-dir
--with-redcloth_scan-include
--without-redcloth_scan-include=${redcloth_scan-dir}/include
--with-redcloth_scan-lib
--without-redcloth_scan-lib=${redcloth_scan-dir}/lib
--with-clib
--without-clib
/Users/jslim/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/mkmf.rb:369:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /Users/jslim/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/mkmf.rb:449:in `try_link0'
from /Users/jslim/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/mkmf.rb:464:in `try_link'
from /Users/jslim/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/mkmf.rb:607:in `try_func'
from /Users/jslim/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/mkmf.rb:833:in `block in have_library'
from /Users/jslim/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/mkmf.rb:778:in `block in checking_for'
from /Users/jslim/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/mkmf.rb:272:in `block (2 levels) in postpone'
from /Users/jslim/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/mkmf.rb:242:in `open'
from /Users/jslim/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/mkmf.rb:272:in `block in postpone'
from /Users/jslim/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/mkmf.rb:242:in `open'
from /Users/jslim/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/mkmf.rb:268:in `postpone'
from /Users/jslim/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/mkmf.rb:777:in `checking_for'
from /Users/jslim/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/mkmf.rb:828:in `have_library'
from extconf.rb:5:in `<main>'


Gem files will remain installed in /Users/jslim/.rvm/gems/ruby-1.9.3-p327/gems/RedCloth-4.2.9 for inspection.
Results logged to /Users/jslim/.rvm/gems/ruby-1.9.3-p327/gems/RedCloth-4.2.9/ext/redcloth_scan/gem_make.out
An error occurred while installing RedCloth (4.2.9), and Bundler cannot continue.
Make sure that `gem install RedCloth -v '4.2.9'` succeeds before bundling.

Read More

ls command in OS X

ls by default in OS X has no --group-directories-first

Open up your terminal

1
$ brew install coreutils

Read More

Delete Linux partition from dual-boot (Windows 7 &amp; Linux)

First time I did this by just delete the partition via Disk Management on Windows 7. What is the consequence?

Read More

Switch Fedora 17 to classic mode

Although the OS that I like the most is Ubuntu 11.04. Unfortunately, a lot of new packages or drivers were not supported. Thus, I give myself to try on other distro — Fedora 17

Read More

Setup Subversion server with HTTP on Ubuntu 11.04

Install Apache server and subversion

1
$ sudo apt-get install apache2 subversion libapache2-svn

Read More

Embed GVIM into Eclipse with Eclim on Ubuntu

Eclim allowed us to embed Vim into Eclipse.

Read More

JDK installation on Ubuntu

There may have many ways to install Java on Ubuntu. However, in this example I’ll show the manual way which is download the JDK from the official website.

Read More