2012年6月6日 星期三

VBA KeyDown

輸入完按 Enter 跳至下一個輸入框
Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
        If KeyCode = 13 Then
                TextBox2.SetFocus
        End If
End Sub




Reference :
Excel VBA textbox判斷是否有按Enter鍵-彰化一整天的Blog留言版
如何利用 Enter 鍵作為 Tab 鍵? / Visual Basic 6.0/VBA / 程式設計俱樂部

2012年6月5日 星期二

建立 Android 開發環境 (手動版)

1. 安裝 Java SDK
# apt-get install sun-java6-jdk sun-java6-jre

2. 安裝 Eclipse
下載 Eclipse IDE for Java Developers 版本

3. 安裝 Android Development Tools (ADT)
開啟 eclipse -> Help -> Install New Softare -> Add -> 輸入 Name 「ADT」 與 URL 「http://dl-ssl.google.com/android/eclipse/site.xml 」-> OK -> Eclipse 會搜尋一下 -> 選擇 Developer Tools 含底下項目後 -> 一直 Next 後 Install -> 完成後重新啟動 eclipse

4. 安裝 Android SDK
從 http://developer.android.com/sdk/index.html 下載 android-sdk_r18-linux.tgz 解壓至 ~/

開啟 eclipse -> Window -> Android SDK Manager

回報錯誤訊息
Fetching https://dl-ssl.google.com/android/repository/addons_list-1.xml
Failed to fetch URL https://dl-ssl.google.com/android/repository/addons_list-1.xml, reason: peer not authenticated
Fetching URL: https://dl-ssl.google.com/android/repository/repository-6.xml
Failed to fetch URL https://dl-ssl.google.com/android/repository/repository-6.xml, reason: peer not authenticated

在 Android SDK Manager -> Tools -> Manage Add-on Sites, 新增
http://dl-ssl.google.com/android/repository/addons_list-1.xml
http://dl-ssl.google.com/android/repository/repository-6.xml

可以安裝 API 15、14、....

安裝 API 時出現
This package depends on 'Missing SDK Platform Android, API 15'.

要手動從 https://dl-ssl.google.com/android/repository/repository-6.xml 下載 Platform 檔案, 解壓至 ~/android-sdk-linux/platforms

https://dl-ssl.google.com/android/repository/android-15_r03.zip

5. 新增 AVD
開啟 eclipse -> Window -> AVD Manager

新增完後開啟 AVD 出現
Unable to find a 'userdata.img' file for ABI armeabi to copy into the AVD folder.

要手動從 https://dl-ssl.google.com/android/repository/repository-6.xml 下載 image 檔案, 解壓至 ~/android-sdk-linux/system-images

https://dl-ssl.google.com/android/repository/sysimg_armv7a-15_r02.zip




Reference :
android 4.0 sdk直接下载地址 - cmoaciopm的专栏 - 博客频道 - CSDN.NET

Missing android-sdk-linux/tools/lib/proguard-project.txt - 异读心寒 - ITeye技术网站
Android 4.0:Unable to find a 'userdata.img' file for ABI armeabi to copy into the AVD folder. - 懒人的技术笔记 - 博客频道 - CSDN.NET
报错“Unable to find a userdata.img file for ABIarmeabi to copy into the AVD folder.”_移动开发_电脑学网(Xue5.CoM)

2012年6月4日 星期一

no swt-pi-gtk-3740 in java.library.path

$ vi /home/yan/.eclipse/org.eclipse.platform_3.7.0_155965261/configuration/1338821859239.log

!SESSION 2012-06-04 22:57:33.880 -----------------------------------------------
eclipse.buildId=I20110613-1736
java.version=1.6.0_26
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=linux, ARCH=x86, WS=gtk, NL=zh_TW
Command-line arguments:  -os linux -ws gtk -arch x86

!ENTRY org.eclipse.osgi 4 0 2012-06-04 22:57:45.020
!MESSAGE Application error
!STACK 1
java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons:
        no swt-pi-gtk-3740 in java.library.path
        no swt-pi-gtk in java.library.path
        Can't load library: /home/yan/.swt/lib/linux/x86/libswt-pi-gtk-3740.so
        Can't load library: /home/yan/.swt/lib/linux/x86/libswt-pi-gtk.so


解:
$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/jni/
$ eclipse




Reference :
How do you set a library path in java ? (Java in General forum at JavaRanch)

2012年6月3日 星期日

Specified key was too long; max key length is 1000 bytes

建立索引时,数据库计算key的长度是累加所有Index用到的字段的char长度后再按下面比例乘起来不能超过限定的key长度1000

如果表是UTF8字符集,那索引还是建立不了。




在安裝 Gerrit 時發生了這個問題, 或許創建資料庫時使用就不使用 utf8 改用 latin1 或其他




Reference :
YOYO’S BLOG » Blog Archive » MySQL错误“Specified key was too long; max key length is 1000 bytes”的解决办法

Gerrit 安裝

[Server]
# apt-get install mysql-server mysql-client postfix sun-java6-jre

mysql -u root -p
mysql> CREATE USER 'gerrit'@'localhost' IDENTIFIED BY 'gerrit';
mysql> CREATE DATABASE reviewdb;
mysql> ALTER DATABASE reviewdb charset=latin1;
mysql> GRANT ALL ON reviewdb.* TO 'gerrit'@'localhost';
mysql> FLUSH PRIVILEGES;

# useradd -m gerrit
# su - gerrit

$ wget http://gerrit.googlecode.com/files/gerrit-2.4.war
$ chmod 744 gerrit-2.2.1.war
$ java -jar gerrit-2.2.1.war init -d review_sites

*** Gerrit Code Review 2.4
***


*** Git Repositories
***

Location of Git repositories   [git]:

*** SQL Database
***

Database server type           [MYSQL/?]:
Server hostname                [localhost]:
Server port                    [(MYSQL default)]:
Database name                  [reviewdb]:
Database username              [root]: gerrit
Change gerrit's password       [y/N]? y
gerrit's password              :
              confirm password :

*** User Authentication
***

Authentication method          [OPENID/?]:

*** Email Delivery
***

SMTP server hostname           [localhost]:
SMTP server port               [(default)]:
SMTP encryption                [NONE/?]:
SMTP username                  :

*** Container Process
***

Run as                         [gerrit]:
Java runtime                   [/usr/lib/jvm/java-6-sun-1.6.0.24/jre]:
Upgrade /home/gerrit/review_sites/bin/gerrit.war [Y/n]?
Copying gerrit.war to /home/gerrit/review_sites/bin/gerrit.war


*** SSH Daemon
***

Listen on address              [*]: Listen on port                 [29418]:

*** HTTP Daemon
***

Behind reverse proxy           [y/N]?
Use SSL (https://)             [y/N]?
Listen on address              [*]:
Listen on port                 [8080]:
Canonical URL                  [http://localhost:8080/]:

Initialized /home/gerrit/review_sites

$ ~/review_sites/bin/gerrit.sh restart


 [Client]
進入 Gerrit 網頁 http://localhost:8080/
Registered the first user with openid. // 註冊的第一位使用者將自動成為主管理員
Add SSH Public Keys
 
$ ssh -p 29418 yan@your_domain
  ****    Welcome to Gerrit Code Review    ****

  Hi yan, you have successfully connected over SSH.

  Unfortunately, interactive shells are disabled.
  To clone a hosted Git repository, use:

  git clone ssh://yan@localhost:29418/REPOSITORY_NAME.git

Connection to localhost closed.


$ ssh -p 29418 yan@localhost gerrit create-project -n sandbox
$ git clone ssh://yan@localhost:29418/sandbox.git 
Cloning into 'sandbox'...
warning: remote HEAD refers to nonexistent ref, unable to checkout.
$ cd sandbox
$ touch README
$ git add *
$ git commit
$ git push origin master
Counting objects: 3, done.
Writing objects: 100% (3/3), 202 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
remote: Processing changes: refs: 1, done   
To ssh://yan@localhost:29418/sandbox.git
 ! [remote rejected] master -> master (can not create new references)
error: failed to push some refs to 'ssh://yan@localhost:29418/sandbox.git'

原因:Gerrit不希望我们直接覆写Git代码库中的任何分支

$ git config remote.origin.push refs/heads/*:refs/for/*
or
$ git config remote.origin.push HEAD:refs/for/master

$ git push origin


* 專案管理可用 git-review 工具代替


進入網頁 http://localhost:8080/ 選單 My -> Changes 即可看到待審核的提交






Reference :
Cherry-picking Pearls in San Francisco: My take on installing gerrit (git code review tool) on ubuntu
Gerrit unter Ubuntu installieren | seeseekey.net
InfoQ: Git、Gerrit与Jenkins/Hudson CI服务器
John Hsing's Blog: 初试 Gerrit


Further :
隨手誌: git push到gerrit review server的方法與設定

Error: unrecognized/unsupported machine ID


u-boot 與 linux kernel 的 machine ID不一致所導致


方法一、把Uboot中board init中更改为MACH_TYPE_AT91RM9200DK

方法二、把MACHINE_START(AT91RM9200DK, "Atmel AT91RM9200-DK")更改为MACHINE_START(AT91RM9200, "Atmel AT91RM9200-DK")。



open http://blog.csdn.net/adigita/article/details/5588819

open http://blog.csdn.net/adigita/article/details/5588902

open http://blog.csdn.net/bailang326/article/details/6237293

open http://hi.baidu.com/zybuaa/blog/item/5ef9164c12fe8afcd72afc9c.html

open http://www.360doc.com/content/12/0114/16/8388102_179361051.shtml

open http://read.newbooks.com.cn/info/195648.html