2013年4月30日 星期二

Gerrit Fixing the email address


select * from ACCOUNT_EXTERNAL_IDS;
 
 
 
 
Reference : 
Git, Gerrit Review and Jenkins or Hudson CI Servers 

Gerrit 使用 http 驗証

version : gerrit-full-2.5.2.war

(gerrit)$ ./review_sites/bin/gerrit.sh stop
(gerrit)$ vi ./review_sites/etc/gerrit.config
[gerrit]
        basePath = git
[database]
        type = MYSQL
        hostname = localhost
        database = reviewdb
        username = gerrit
[auth]
        type = HTTP
[sendemail]
        smtpServer = localhost
[container]
        user = gerrit
        javaHome = /usr/lib/jvm/java-6-openjdk-amd64/jre
[sshd]
        listenAddress = *:29418
[httpd]
        listenUrl = proxy-http://127.0.0.1:8081/
[cache]
        directory = cache
(gerrit)$ ./review_sites/bin/gerrit.sh start


# vi /etc/apache2/sites-enabled/000-default

    ProxyRequests Off
    ProxyVia Off
    ProxyPreserveHost On

 
    Order deny,allow
    Allow from all
 


 
    AuthType Basic
    AuthName "Gerrit Code Review"
    Require valid-user
    AuthBasicProvider file
    AuthUserFile /home/gerrit/review_sites/etc/htpasswd_gerrit
 


    ProxyPass / http://127.0.0.1:8081/
#    ProxyPassReverse / http://127.0.0.1:8081/
# /etc/init.d/apache2 restart




Reference :
Gerrit复核服务器搭建简易教程(Ubuntu 12.10)
Chromatic Coder: 架設Gerrit和Git

2013年4月29日 星期一

Push existing git repositories to Gerrit

$ git push ssh://user@gerrit.server:22/home/gerrit/review_sites/git/my_project.git HEAD:refs/heads/master


* 不要向 Gerrit server port 推送 (port 29418) (not using the Gerrit server’s SSH port)




Reference :
One or more refs/for/ names blocks change upload

Python get CPU frequency


import re
pattern = re.compile("^cpu MHz\s*:\s*(?P.+)$", re.M)
for line in open('/proc/cpuinfo'):
    match = pattern.search(line)
    if match:
        return 'Cpu: %.1f GHz' % (float(match.group('cpu_frequency').strip()) / 1000)




Reference :

Python get CPU temperature

cat = lambda file: open(file, 'r').read().strip()
temp = cat('/sys/class/thermal/thermal_zone0/temp')
print '%1.f°C' % (float(temp) / 1000)


# http://www.mjmwired.net/kernel/Documentation/hwmon/sysfs-interface

$ cat /sys/class/hwmon/hwmon0/temp1_input




Reference :

Getting CPU temperature using Python? - Stack Overflow

qtile config

$ vi ~/.config/qtile/config.py




Reference :
Qtile Documentation — Qtile 0.5 documentation
Qtile - ArchWiki


Паста №241

2013年4月24日 星期三

Jenkins phpmd

# pear channel-discover pear.phpmd.org
# pear channel-discover pear.pdepend.org
# pear install --alldeps phpmd/PHP_PMD

phpmd . html codesize,unusedcode,naming,design --reportfile build/phpmd.html || :



2013年4月23日 星期二

Several checkstyle reports in jenkins

build/checkstyle-*.xml




Reference :
continuous integration - Several checkstyle reports in jenkins - Stack Overflow

Jenkins JSHint

執行 Shell
/usr/local/bin/jshint --checkstyle-reporter html/_js/ --config /root/node_modules/jshint/jshint.json >> build/checkstyle-jshint.xml || exit 0



Publish Checkstyle analysis results
Checkstyle results build/checkstyle-*.xml


Report Violations
checkstyle 10 999 999 build/checkstyle-*.xml




Reference :
Jenkins & JSHint – Integrating with Checkstyles and Violations « Brian Wigginton

JSHint '$' is not defined

Add this at the top of the script file:

/*global $:false, jQuery:false */





Reference :
javascript - JSHint strict mode and JQuery: '$' is not defined - Stack Overflow

/usr/bin/env: node: No such file or directory

# ln -s /usr/bin/nodejs /usr/bin/node




Reference :
run npm command gives error \"/usr/bin/env: node: No such file or directory\" · Issue #3911 · joyent/node · GitHub

JSHint

# apt-get install nodejs npm
# npm install jshint
 
 
 
 
Reference :
Install — JSHint

debian 安裝 nodejs、npm

nodejs - Node.js event-based server-side javascript engine
npm - package manager for Node.js


nodejs 和 npm 還在 debian sid,還沒進 wheezy


套件庫安裝方式:
# vi /etc/apt/sources.list
deb http://ftp.de.debian.org/debian sid main
# apt-get update
# apt-get install nodejs npm


手動安裝方式可參考:


於 Debian Linux (wheezy) 安裝 Node.js | Tsung's Blog

Jenkins and PHP





Reference :
Template for Jenkins Jobs for PHP Projects
Using PHP static analysis tools with Jenkins | Mark Story
Continuous Integration In PHP w/Jenkins | Agile Zone
Integrating PHP Projects with Jenkins: Safari Books Online

jenkins ignore exit code

Build step 'Execute shell' marked build as failure



Usually you can ignote command exit code by
|| :




Reference :
Jenkins users - using execute shell

Using PHP static analysis tools with Jenkins | Mark Story

2013年4月22日 星期一

ASP 三元表示式

asp不支持三元运算符




Reference :
asp三元运算符怎么用_百度知道

asp switch case

Dim myNum
myNum = 5
Select Case myNum
Case 2
Response.Write("myNum is Two")
Case 3
Response.Write("myNum is Three")
Case 5
Response.Write("myNum is Five")
Case Else
Response.Write("myNum is " & myNum)
End Select




Reference :
ASP Tutorial - Select

2013年4月21日 星期日

白酒燉雞



花椰菜濃湯



白花椰菜
洋蔥


奶油
低筋麵粉

雞高湯
牛奶
鮮奶油

肉桂葉 1片

南瓜濃湯

 

南瓜 切塊 (去籽)
洋蔥 切絲

奶油

雞湯
牛奶
液態鮮奶油


義大利香料


1. 南瓜蒸熟
2. 奶油炒洋蔥與蒜
3. 將 (1)、(2) 放涼後放入果汁機打成泥
4. (3)加高湯煮,起鍋前加入牛奶或開水
5. 加入鮮奶油、香料調味

2013年4月12日 星期五

naturaldocs python block comments

def Multiply(x, y):
    """/*
       Function: Multiply

       Multiplies two integers.

       Parameters:

          x - The first integer.
          y - The second integer.

       Returns:

          The two integers multiplied together.

       See Also:

          
    */"""


$ naturaldocs -i me_project -o HTML html -p build

$ vi build/Languages.txt
Alter Language: Python
Block Comment: """/* */"""

$ naturaldocs -i me_project -o HTML html -p build --rebuild




Reference :
Documenting Python with NaturalDocs - Stack Overflow

naturaldocs 產生程式碼文件

$ naturaldocs -i me_project -o HTML html -p build





Reference :
Documenting Your Code - Natural Docs

2013年4月9日 星期二

php pear 自動下載相依函示庫

phpunit/phpcpd requires package "channel://components.ez.no/ConsoleTools" (version >= 1.6)
phpunit/FinderFacade requires package "channel://pear.netpirates.net/fDOMDocument" (version >= 1.3.1
)phpunit/FinderFacade requires package "channel://pear.symfony.com/Finder" (version >= 2.1.0, version <= 2.1.99)

# pear config-set auto_discover 1




Reference :
php - PEAR package install fails - Stack Overflow

phpcdp 安裝

$ pear channel-discover pear.phpunit.de 
$ pear install phpunit/phpcpd





若出現缺少含式庫的訊息
phpunit/phpcpd requires package "channel://components.ez.no/ConsoleTools" (version >= 1.6) 
phpunit/FinderFacade requires package "channel://pear.netpirates.net/fDOMDocument" (version >= 1.3.1) 
phpunit/FinderFacade requires package "channel://pear.symfony.com/Finder" (version >= 2.1.0, version <= 2.1.99)

$ pear config-set auto_discover 1




$ phpcdp ./project/ 




Reference :
Detecting duplicate code in PHP files

debian/ubuntu 安裝 php pear

# apt-get install php-pear

2013年4月1日 星期一

xrandr 投影

$ xrandr --output LVDS --mode 1024x768




Reference :
Xrandr - ArchWiki
xrandr 與筆電的 VGA 輸出

Windows XP MTP 驅動

1. Windows XP 需更新至 SP3

2.下載安裝 Media Transfer Protocol Porting Kit 或升級 Windows Media Player 到11版

* 若是辨認不到裝置則手動修改 C:\WINDOWS\inf\wpdmtp.inf,新增裝置的 VID 和 PID

原來的:
[Generic.NTx86]
%GenericMTP.DeviceDesc%=MTP, USB\MS_COMP_MTP

[Generic.NTamd64]
%GenericMTP.DeviceDesc%=MTP, USB\MS_COMP_MTP

修改後:
[Generic.NTx86]
%GenericMTP.DeviceDesc%=MTP, USB\MS_COMP_MTP
%GenericMTP.DeviceDesc%=MTP, USB\VID_18D1&PID_4E42&MI_00

[Generic.NTamd64]
%GenericMTP.DeviceDesc%=MTP, USB\MS_COMP_MTP
%GenericMTP.DeviceDesc%=MTP, USB\VID_18D1&PID_4E42&MI_00



* 查看裝置 VID 和 PID 的方法:

裝置管理員 -> 對著此裝置按右鍵 ->  內容 -> 詳細資料 -> 硬體識別碼







Reference :
解決Nexus 7使用USB無法和Windows XP連線問題 - Carlos' Life Book
Garmin 部落格. » 使用Windows XP 無法連結 nuvi3595解決方式