Feb 4, 2014

Compile Mathex (A Latex CGI to generate image)

Mathtex from http://www.forkosh.com/mathtex.html

If we careless compile, we can easily produced the error:
cc: error: –DSOMETHING="xyz": No such file or directory
Which really not makes sense at all.
Actually, it maybe some switches is not supported, or the value is not correctly quoted.

I made it worked with Nginx by using fcgiwrap
       location ~ ^/tex.cgi$ {
                gzip off;
                fastcgi_pass unix:/var/run/fcgiwrap.socket;
                include fastcgi_params;
        }
Complie:
cc mathtex.c -o tex.cgi -DDVIPNG=\"/usr/bin/dvipng\" -DLATEX=\"/usr/bin/latex\" -DCACHE=\"cache\/\" DWORK=\"cache\/\"

The most important switches are DCACHE (set up relative cache dir) and DWORK (set up temporary place for the CGI works). They should both writable by the script tex.cgi under fcgiwrap's run user.

Then place stuff using at this structure:
/public
          /cache
          tex.cgi



Feb 1, 2014

Jan 29, 2014

Github

If using HTTPS link, we cannot utilize public key auth for Github.
So, using this URL pattern to clone your repository:

ssh://git@github.com/username/reposname.git

Sep 12, 2013

Bỏ qua khoảng trắng khi diff

Trong git khi chuyển đổi giữa Windows và Linux hay bị vấn đề CR - LF làm cho cả file bị đánh dấu là sửa trong khi đó chỉ là khác biệt khoảng trắng

Nhiều khoảng trắng thêm bớt cũng bị coi là sửa => ko hay

Chỉ cần đặt thông số sau và ~/.gitconfig là ổn :D
[core]
        autocrlf = true
        safecrlf = false
        eol = lf

        whitespace = -trailing-space,-indent-with-non-tab,-tab-in-indent
 
[color]
        ui = auto
[push]
        default = simple
[apply]
        ignorewhitespace = true

Sep 11, 2013

Phím tắt khi gõ tiếng Nhật (MS Input IME)

F7 -> Chuyển từ Hiragana sang Katakana
F10 -> chuyển từ Hiragana sang Romanji
Dấu cách -> Chuyển sang Kanji

Sep 10, 2013

Sử dụng grep

grep "string" --color -r -n --include=*.{html,php} --exclude=*\.svn* .


-n hiển thị dòng chứa kết quả tìm thấy.

Phần mềm vẽ minh họa

Dia với các hình dạng có sẵn dung để thiết kế biểu đồ.
Đặc biệt, với dàn cairo nó khá phù hợp để dàn trang.

Tải về: http://dia-installer.de/download/index.html.en