Using Redis.

Readis

Redis is an open source, BSD licensed, advanced key-value store. It is often referred to as a data structure server since keys can contain strings, hashes, lists, sets and sorted sets.

1.Installation

a.Mac OSX

螢幕快照 2014-07-04 10.28.21

b.Ubuntu

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
-> % sudo apt-get install redis-server 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  libjemalloc1 redis-tools
The following NEW packages will be installed:
  libjemalloc1 redis-server redis-tools
0 upgraded, 3 newly installed, 0 to remove and 84 not upgraded.
Need to get 410 kB of archives.
After this operation, 1,272 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://archive.ubuntu.com/ubuntu/ trusty/universe libjemalloc1 amd64 3.5.1-2 [76.8 kB]
Get:2 http://archive.ubuntu.com/ubuntu/ trusty/universe redis-tools amd64 2:2.8.4-2 [65.7 kB]
Get:3 http://archive.ubuntu.com/ubuntu/ trusty/universe redis-server amd64 2:2.8.4-2 [267 kB]
Fetched 410 kB in 2s (176 kB/s)       
Selecting previously unselected package libjemalloc1.
(Reading database ... 300693 files and directories currently installed.)
Preparing to unpack .../libjemalloc1_3.5.1-2_amd64.deb ...
Unpacking libjemalloc1 (3.5.1-2) ...
Selecting previously unselected package redis-tools.
Preparing to unpack .../redis-tools_2%3a2.8.4-2_amd64.deb ...
Unpacking redis-tools (2:2.8.4-2) ...
Selecting previously unselected package redis-server.
Preparing to unpack .../redis-server_2%3a2.8.4-2_amd64.deb ...
Unpacking redis-server (2:2.8.4-2) ...
Processing triggers for man-db (2.6.7.1-1) ...
Processing triggers for ureadahead (0.100.0-16) ...
ureadahead will be reprofiled on next reboot
Setting up libjemalloc1 (3.5.1-2) ...
Setting up redis-tools (2:2.8.4-2) ...
Setting up redis-server (2:2.8.4-2) ...
Starting redis-server: redis-server.
Processing triggers for libc-bin (2.19-0ubuntu6) ...
Processing triggers for ureadahead (0.100.0-16) ...
stevelo@stevelo-pc [12:01:47] [~]

Read More

Phalcon framework testing

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
luosteve@SteveMac [10:55:51] [~/tmp]
-> % git clone --depth=1 git://github.com/phalcon/cphalcon.git
Cloning into 'cphalcon'...
remote: Counting objects: 1437, done.
remote: Compressing objects: 100% (971/971), done.
remote: Total 1437 (delta 593), reused 799 (delta 352)
Receiving objects: 100% (1437/1437), 2.08 MiB | 792.00 KiB/s, done.
Resolving deltas: 100% (593/593), done.
Checking connectivity... done.
luosteve@SteveMac [10:56:01] [~/tmp]
-> % cd cphalcon/build
root@SteveMac [10:56:35] [~/tmp/cphalcon/build] [master]
-> # ./install
.
.
.
.
.
.
une=native -O2 -finline-functions -fomit-frame-pointer -fvisibility=hidden   -o phalcon.la -export-dynamic -avoid-version -prefer-pic -module -rpath /Users/luosteve/tmp/cphalcon/build/64bits/modules  phalcon.lo
gcc ${wl}-flat_namespace ${wl}-undefined ${wl}suppress -o .libs/phalcon.so -bundle  .libs/phalcon.o   -march=native -mtune=native
dsymutil .libs/phalcon.so || :
warning: no debug symbols in executable (-arch x86_64)
creating phalcon.la
(cd .libs && rm -f phalcon.la && ln -s ../phalcon.la phalcon.la)
/bin/sh /Users/luosteve/tmp/cphalcon/build/64bits/libtool --mode=install cp ./phalcon.la /Users/luosteve/tmp/cphalcon/build/64bits/modules
cp ./.libs/phalcon.so /Users/luosteve/tmp/cphalcon/build/64bits/modules/phalcon.so
cp ./.libs/phalcon.lai /Users/luosteve/tmp/cphalcon/build/64bits/modules/phalcon.la
----------------------------------------------------------------------
Libraries have been installed in:
   /Users/luosteve/tmp/cphalcon/build/64bits/modules
 
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `DYLD_LIBRARY_PATH' environment variable
     during execution
 
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
 
Build complete.
Don't forget to run 'make test'.
 
Installing shared extensions:     /Users/luosteve/.phpbrew/php/php-5.5.10/lib/php/extensions/no-debug-non-zts-20121212/
 
Thanks for compiling Phalcon!
Build succeed: Please restart your web server to complete the installation
./install  27.78s user 3.81s system 99% cpu 31.690 total

Read More

Go 語言~ 初學筆記

主要學習文件依照下面的連結閱讀
https://github.com/astaxie/build-web-application-with-golang
首先安裝Go,Go也有第三方套件做版本切換gvm.
https://github.com/moovweb/gvm
依照只是裝好後.

1
2
3
4
5
6
7
$ gvm install go1
Downloading Go source...
Installing go1...
 * Compiling...
$ gvm use go1
Now using version go1
$

接下來可以開始試用Go !!

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
$ go 
Go is a tool for managing Go source code.
 
Usage:
 
	go command [arguments]
 
The commands are:
 
    build       compile packages and dependencies
    clean       remove object files
    doc         run godoc on package sources
    env         print Go environment information
    fix         run go tool fix on packages
    fmt         run gofmt on package sources
    get         download and install packages and dependencies
    install     compile and install packages and dependencies
    list        list packages
    run         compile and run Go program
    test        test packages
    tool        run specified go tool
    version     print Go version
    vet         run go tool vet on packages
 
Use "go help [command]" for more information about a command.
 
Additional help topics:
 
    gopath      GOPATH environment variable
    packages    description of package lists
    remote      remote import path syntax
    testflag    description of testing flags
    testfunc    description of testing functions
 
Use "go help [topic]" for more information about that topic.

關於幾個重要系統環境變數.gvm都幫你切換好了!

1
2
3
4
5
6
7
GVM_ROOT=/Users/luosteve/.gvm
GVM_VERSION=1.0.16
GVM_PATH_BACKUP=/Users/luosteve/.gvm/bin:/Users/luosteve/.rvm/gems/ruby-1.9.3-p374/bin:/Users/luosteve/.rvm/gems/ruby-1.9.3-p374@global/bin:/Users/luosteve/.rvm/rubies/ruby-1.9.3-p374/bin:/Users/luosteve/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/local/go/bin:/Users/luosteve/mybin:/Users/luosteve/bin/google_appengine:/Users/luosteve/.rvm/bin
gvm_go_name=go1
gvm_pkgset_name=global
GOROOT=/Users/luosteve/.gvm/gos/go1
GOPATH=/Users/luosteve/.gvm/pkgsets/go1/global

再來是開發的$GOPATH環境變數
$GOPATH環境變數主要為工作目錄,可為多個.

1
    export GOPATH=~/apple/mygo1;~/apple/mygo2

以上 $GOPATH 目錄主要有三個內容:

  • src 原始碼(比如:.go .c .h .s等)
  • pkg 編譯後的包(比如:.a)
  • bin 編譯後的文件為可執行檔

依照範例建立一個sample,執行go install後會編譯好檔案.

1
2
3
4
-> % ll
total 8
-rw-r--r--  1 luosteve  staff  2108  2 19 10:36 mymath.a
luosteve@SteveMac [10:36:40] [~/Go/pkg/darwin_amd64]

在依照範例建立好mathapp,執行go build產生mathapp執行檔.
螢幕快照 2013-02-19 上午10.45.05

Ruby Version Manager

Ruby Version Manager

介紹

最近同事都在看Ruby,想說跟進一下神人們的腳步.看看是不是可以開竅點@@
Ruby 依照以前安裝套件經驗,版本是最難搞的.
慶幸有很多開發人員先鋒,做的很多貢獻.
如今才有RVM Ruby Version Manager 誕生!!解決很多初學者很多困擾障礙.
RVM是一套Ruby版本控管可以在各版號切換.甚至自定版號與安裝套件之間切換.
Read More

FreeBSD 安裝Gitlab 4.1

GitLab

logoGitLab 是一套webbase的管理系統,與有名的github 非常類似.
特性 快速, 安全與穩定的方案使用 Rails & Gitolite開發,並且使用MIT License授權.
如果這樣還沒有概念那就看看官網的 screenshots.
再來看怎摸安裝…
FreeBSD官網不支援,觀玩建議安裝使用Debian/Ubuntu 其他如RedHat linux bases都有人安裝成功過.
就是沒有FreeBSD!!!!!!!!!阿阿阿阿阿阿阿阿阿阿

再來只好花費週末8個小時撞牆來安裝.
Read More