Installing memcache on osx for php

Finally got memcache working! I am compiling the steps here in case I need to do it again. First install libevent. This is a dependency to memcached, so need to get it. cd /tmp curl -OL https://github.com/downloads/libevent/libevent/libevent-2.0.17-stable.tar.gz tar -xvzf libevent-2.0.17-stable.tar.gz cd libevent-2.0.17-stable* ./configure make sudo make install Then install memcached. # Compile memcached utility cd /tmp curl -O http://memcached.googlecode.com/files/memcached-1.4.13.tar.gz tar -xvzf memcached-1.4.13.tar.gz cd memcached-1.4.13* ./configure make sudo make install At this point, if everything goes well, the memcache daemon should be ready to run. You can try the following to see if memcached returns anything to you. ...

June 21, 2012 · 2 min · birdchan

Words for Small Sets

link: http://xkcd.com/1070/

June 19, 2012 · 1 min · birdchan

20美元變一萬個熱狗 現實裡五餅二魚故事

http://www.ctitv.com.tw/flash/ctiplayer.swf What it means to give. 我們花了兩個星期時間,在美國採訪貧窮問題,最後在LA認識了一個傳奇的台灣人,她的名字是amywang,在台灣沒唸過甚麼書,因為一些機遇,抱著剛生下來,沒有父親的孩子到了美國,想賺錢,但結果過著流落街頭的生活,因為極度的飢餓和寒冷,她的人生到了死亡的邊源,四十年過去,她從一個無家的人,變成一個專門幫助無家者的人。 ref: http://www.ctitv.com.tw/newchina_video_c134v70467.html

June 2, 2012 · 1 min · birdchan

Hide qtip2

Sometimes when you click on a qtip2 popup, you may want to close the popup somehow. For example, if your qtip2 popup contains a list of links, and clicking on the links will open up more popups. In that case, you would really want to close the previous qtip2 popup upon each link click. Well, here is how you can do that programmatically. $('.qtip:visible').qtip('hide'); Yeah, that’s it. Clean screen. Yeah~~~

May 29, 2012 · 1 min · birdchan

Custom sorting in Datatable

My datatable was acting cool and all until I added a link to each integer element of a particular column. All of a sudden the sorting feature was acting weird. Before I had something like this 23 After adding a link, I have 23 It turns out after I added the links, the default sorting function is treating everything as string. So to fix that I will need to add custom sort function to explicitly tell datatable how I want to do my sorting. ...

May 25, 2012 · 2 min · birdchan

TextMate drawer disappeared...

Sometimes after working on a few TextMate windows, one of them will have its file directory tree drawer missing. I don’t know why this happens but to bring back the drawer, just go to the menu bar and click View -> Show Project Drawer. Also another tip is, if you prefer the drawer to come out from the right side but it always comes out from the left, all you need to do is 1. Hide the drawer 2. Move your TextMate window to the left side of your screen so there is not much space to display the drawer on the left 3. Show the drawer ...

May 25, 2012 · 1 min · birdchan

Changing qTip2 width

It took me a while to find this out. If you need to change the default max width of qTip2, here is how. First set up a new style class. .my_width_setting_class { max-width: 1200px; min-width: 0px; } Then in the qtip style attribute, insert our newly created css class. style: { classes: 'ui-tooltip-wiki ui-tooltip-light ui-tooltip-shadow my_width_setting_class' } That will then override the default settings in jquery.qtip.css. ref: http://craigsworks.com/projects/qtip2/tutorials/styling/#dimensions ...

May 22, 2012 · 1 min · birdchan

Adding shadow to wp-codebox

Too bad wp-codebox contains two divs namely wp_codebox_msgheader and wp_codebox, we cannot simply give the box-shadow to one single div. After playing with this a bit, here is my parameters. The css file is located at /your-wp-root/wp-content/plugins/wp-codebox/css/codebox.css. .wp_codebox_msgheader { box-shadow: 6px 14px 11px #808083; } .wp_codebox { box-shadow: 7px 10px 10px #888; } The overlapped area seems smooth with this setting. I also added bottom margin to the codebox, see if you like it. ...

May 19, 2012 · 1 min · birdchan

Installing Ruby on Rails in osx

Install Xcode first. You will need the one from the Mac App Store. You will need version 4.3 or above. Then install homebrew. Go to this link ( https://github.com/mxcl/homebrew/wiki/installation) to find the installation command. As of May 2012, the command is: /usr/bin/ruby -e "$(/usr/bin/curl -fsSL https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)" Then after the process finishes (it took like 30 seconds), run brew doctor This is just to make sure your environment is good to move on. If your Xcode is old you will get a complain here like the following: ...

May 19, 2012 · 3 min · birdchan

Check the existence of an element in jquery

When dealing with dynamic creation of DOM objects, sometimes you need to check if a certain element exists. Below is how you check: if ($('#my_element').length > 0){ // it exists! } If you need to check whether a dropdown has any options, here is how if ($('#my_dropdown option').length > 0){ // contains options }

May 16, 2012 · 1 min · birdchan