SmartGit/Svn http://www.syntevo.com/
方便在mac底下查看更改的地方(因為有時可能不只一個檔案)來決定要將那些檔案 commit/push
- utf8 setting for smartSvn6.6
Project/Setting/Text file encoding/ set to UTF8 - utf8 setting for smartGit
still no solution
my 3 or 2 words; thinkness, speakless
SmartGit/Svn http://www.syntevo.com/
方便在mac底下查看更改的地方(因為有時可能不只一個檔案)來決定要將那些檔案 commit/push
【環境】
【目的】
【Pre-requisites】
【步驟】
$ cd ~/.ssh
$ ssh-keygen -t rsa -C "your_email@where.com"
$ cp * ~/ssh
$ ssh git@github.com
在 MacOS要設定的話, 可直接由Spotlight叫出AirPort工具程式.
【參考】
Google code http://code.google.com/intl/zh-TW/
【使用】
這邊記一下我常會忘記的東西。
【參考】
(tbd)
【目的】
【步驟】
void MainWindow::on_pushButton_clicked() { QPropertyAnimation *animation = new QPropertyAnimation(ui->pushButton, "geometry"); animation->setDuration(10000); animation->setStartValue(QRect(0, 0, 100, 30)); animation->setEndValue(QRect(250, 250, 100, 30)); animation->start(); }
void MainWindow::on_pushButton_clicked() { QPropertyAnimation *animation = new QPropertyAnimation(ui->pushButton, "pos"); animation->setDuration(10000); animation->setStartValue(QPoint(0, 0)); animation->setEndValue(QPoint(250, 250)); animation->start(); }
【參考】
【軟體參考】
一些蠻有趣的CAI軟體提供參考
Qt Quick http://qt.nokia.com/products/qt-quick#what-is-qt-quick
【步驟】
【問題】
【範例】
【參考】
DIR-300 b1 是一台平價的 11n Router,也可加入 VPN 功能。摘錄一下重點,當做參考
【參考】
【目的】
【環境】
【說明】
先由一些資料建立觀念
Cannot retrieve debugging output!
#include <QtGui/QApplication> #include "dialog.h" #include <windows.h> int main(int argc, char *argv[]) { QApplication a(argc, argv); OutputDebugString(L"Echo Message to DebugView"); Dialog w; w.show(); return a.exec(); }
#include <QtGui/QApplication> #include "dialog.h" #include <qDebug> void myMessageOutput(QtMsgType type, const char *msg) { switch (type) { case QtDebugMsg: fprintf(stderr, "Debug: %s\n", msg); break; case QtWarningMsg: fprintf(stderr, "Warning: %s\n", msg); break; case QtCriticalMsg: fprintf(stderr, "Critical: %s\n", msg); break; case QtFatalMsg: fprintf(stderr, "Fatal: %s\n", msg); abort(); } } int main(int argc, char *argv[]) { qInstallMsgHandler(myMessageOutput); QApplication a(argc, argv); Dialog w; w.show(); qDebug("Dialog is shown"); return a.exec(); }
#include <QtGui/QApplication> #include "dialog.h" #include <qDebug> #include <windows.h> void myMessageOutput(QtMsgType type, const char *msg) { char str[255]; switch (type) { case QtDebugMsg: sprintf(str, "Debug: %s", msg); break; case QtWarningMsg: sprintf(str, "Warning: %s", msg); break; case QtCriticalMsg: sprintf(str, "Critical: %s", msg); break; case QtFatalMsg: sprintf(str, "Fatal: %s", msg); abort(); default: sprintf(str, "Unknown: %s", msg); } OutputDebugStringA(str); } int main(int argc, char *argv[]) { qInstallMsgHandler(myMessageOutput); QApplication a(argc, argv); Dialog w; w.show(); qDebug("Dialog is shown"); qWarning("Dialog is shown"); qCritical("Dialog is shown"); //qFatal("Dialog is shown"); return a.exec(); }
#incluse <syslog.h> main(int argc,char *argv[]){ char *str = "test"; openlog(argv[0],LOG_PID,LOG_USER); syslog(LOG_INFO,"%s\n",str); closelog(); }
#ifndef NDEBUG #define printd(msg, args...) \ do { \ openlog("[Log]",LOG_PID,LOG_USER); \ syslog(LOG_INFO, msg, ##args); \ closelog(); \ }while(0) #else #define printd(msg, args...) do { } while(0) #endif
void myMessageOutput(QtMsgType type, const char *msg) { openlog(argv[0],LOG_PID,LOG_USER); switch (type) { case QtDebugMsg: syslog(LOG_INFO,"Debug : %s\n",str); break; case QtWarningMsg: syslog(LOG_INFO,"Warning : %s\n",str); break; case QtCriticalMsg: syslog(LOG_INFO,"Critical: %s\n",str); break; case QtFatalMsg: syslog(LOG_INFO,"Fatal : %s\n",str); //abort(); } closelog(); }
const char* logfile = "/var/log/log.txt"; void myMessageOutput(QtMsgType type, const char *msg) { FILE *fp = fopen(logfile, "a"); if (fp) { switch (type) { case QtDebugMsg: fprintf(fp, "Debug : %s\n", msg); break; case QtWarningMsg: fprintf(fp, "Warning : %s\n", msg); break; case QtCriticalMsg: fprintf(fp, "Critical: %s\n", msg); break; case QtFatalMsg: fprintf(fp, "Fatal : %s\n", msg); //abort(); } fclose(fp); } }
busybox syslogd -R 192.168.1.1:601
【想法】
【參考】
【目的】
【環境】
【說明】
【問題】
【參考】
首先複習一下 sqlite shell 的用法,驗證幾個重點
【Sqlite】
firstname(名) | lastname(姓) | |
第一筆資料 | 功蓋 | 許 |
第二筆資料 | Ира | Chen |
$ sqlite3 p.db SQLite version 3.6.16 Enter ".help" for instructions Enter SQL statements terminated with a ";"
sqlite> create table person (firstname varchar(20), lastname varchar(20));
sqlite> .table person
sqlite> .schema person CREATE TABLE person (firstname varchar(20), lastname varchar(20));
sqlite> insert into person values('功蓋', '許'); sqlite> insert into person values('Ира', 'Chen');
sqlite> select rowid from person; 1 2
sqlite> select * from person; 功蓋|許 ира|Chen
sqlite> select * from person where lastname='Chen'; ира|Chen
sqlite> create view pv as select lastname from person; sqlite> select * from pv; 許 Chen
sqlite> sqlite> update person set firstname='May' where lastname='Chen'; sqlite> select * from person; 功蓋|許 May|Chen
sqlite> delete from person where lastname='Chen'; sqlite> select * from person; 功蓋|許
sqlite> alter table person add id integer; sqlite> .schema person CREATE TABLE person(firstname varchar(20), lastname varchar(20), id integer);
sqlite> alter table person remane to p; sqlite> .schema p CREATE TABLE "p"(firstname varchar(20), lastname varchar(20), id integer);
$sqlite3 p.db “.dump” > p.sql
$ sqlite3 p.db < p.sql
sqlite> .quit $
【Sqliteman】
【C】
在 C 的使用 (目前沒有用C特別處理 Unicode的問題,參考 http://evanjones.ca/unicode-in-c.html)
$ apt-get install libsqlite3-dev
#include <stdio.h> #include <sqlite3.h> static int callback(void *NotUsed, int argc, char **argv, char **azColName){ int i; for(i=0; i<argc; i++){ printf("%s = %s\n", azColName[i], argv[i] ? argv[i] : "NULL"); } printf("\n"); return 0; } int main(int argc, char **argv){ sqlite3 *db; char *zErrMsg = 0; int rc; if( argc!=3 ){ fprintf(stderr, "Usage: %s DATABASE SQL-STATEMENT\n", argv[0]); return 1; } rc = sqlite3_open(argv[1], &db); if( rc ){ fprintf(stderr, "Can't open database: %s\n", sqlite3_errmsg(db)); sqlite3_close(db); return 1; } rc = sqlite3_exec(db, argv[2], callback, 0, &zErrMsg); if( rc!=SQLITE_OK ){ fprintf(stderr, "SQL error: %s\n", zErrMsg); sqlite3_free(zErrMsg); } sqlite3_close(db); return 0; }
$ gcc -o p p.c –lsqlite3
$./p p.db "select * from person;" firstname = 功蓋 lastname = 許 id = NULL firstname = ира lastname = Chen id = NULL
【Qt】
配合QT的使用。其中需要注意的是,Sqlite內部編碼為 unicode, 而Qt 我們指定為 UTF-8。
Qt 寫入 Sqlite 需先將內容轉換成 Unicode,而Qt 讀取Sqlite時不需要,因 Qt 會自行偵測。
以下只擷取出重點程式碼。
#include <QtSql> #include <QTableView> #include <QMessageBox>
bool Dialog::SqliteTest() { QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE"); db.setDatabaseName("database.dat"); if (!db.open()) { QMessageBox::warning(0, QObject::tr("Database Error"), db.lastError().text()); return false; } QSqlQuery rs(db); rs.exec("CREATE TABLE person (firstname varchar(20), lastname varchar(20))"); QByteArray strSql("insert into person(firstname,lastname) \ values('Ира', 'Chen')"); QTextCodec *codec = QTextCodec::codecForName("UTF-8"); QString string = codec->toUnicode(strSql); rs.exec(string); QSqlQueryModel *model = new QSqlQueryModel; model->setQuery("SELECT * FROM person"); model->setHeaderData(0, Qt::Horizontal, "firstname"); model->setHeaderData(1, Qt::Horizontal, "lastname"); QTableView *view = new QTableView; view->setWindowTitle("QSqlQueryModel"); view->setModel(model); view->show(); db.close(); }
【參考】
【目的】
【方法】
方法一
方法二
方法三
【程式】
【參考】
【其它參考】
參考價值不大。
Qt Embedded 分成 Linux/Windows CE/Symbian 三種,此處指 Linux 平台。
【目的】
【基本環境】
$apt-get install libxtst-dev libxrender-dev libdirectfb-dev
【步驟】
$ wget http://get.qt.nokia.com/qt/source/qt-everywhere-opensource-src-4.6.3.tar.gz
$ tar zxvf qt-everywhere-opensource-src-4.6.3.tar.gz $ cd qt-everywhere-opensource-src-4.6.3 $ ./configure -embedded x86 -qvfb $ make $ sudo make install
$ vi ~/.bashrc加入下面的設定,主要是 QTEDIR/PATH/LD_LIBRARY_PATH
export QTEDIR=/usr/local/Trolltech/QtEmbedded-4.6.3 export PATH=/usr/local/Trolltech/QtEmbedded-4.6.3/bin:$PATH export LD_LIBRARY_PATH=/usr/local/Trolltech/QtEmbedded-4.6.3/lib:$LD_LIBRARY_PATH之後記得使用 ldconfig 讓設定生效
$ source ~/.bashrc $ ldconfig
$ tar -zxvf qt-x11-opensource-src-4.6.3.tar.gz $ cd qt-x11-opensource-src-4.6.3 $ ./configure $ make $ sudo make install
$ cd /usr/local/Trolltech $ ls Qt-4.6.3 QtEmbedded-4.6.3
$ cd qt-x11-opensource-src-4.6.3/tools/qvfb $ make $ sudo make install $ cp qvfb /usr/bin
$ cd ~/qt-everywhere-opensource-src-4.6.2/tools/qvfb $ sudo make install install -m 644 -p "../../bin//`basename ../../bin/qvfb`.debug" "/usr/local/Trolltech/Qt-4.6.2/bin/`basename ../../bin/qvfb`.debug" install -m 755 -p "../../bin/qvfb" "/usr/local/Trolltech/Qt-4.6.2/bin/qvfb" strip "/usr/local/Trolltech/Qt-4.6.2/bin/qvfb" $ cp /usr/local/Trolltech/Qt-4.6.2/bin/qvfb /usr/bin
$ cd ${QTEDIR}/demos/chip $ qvfb & $ ./chip -qws
$ wget http://get.qt.nokia.com/qtcreator/qt-creator-linux-x86-opensource-1.3.1.bin $ chmod 777 qt-creator-linux-x86-opensource-1.3.1.bin $ ./qt-creator-linux-x86-opensource-1.3.1.bin這樣就會帶出下面視窗進行安裝,一直按著下一步下一步就可以安裝完成了。
$ /usr/local/Trolltech/Qt-4.6.2/bin/qvfb -depth 16 -width 1024 -height 768& $ qte-file -qws
$ ldd qte-file linux-gate.so.1 => (0xb7f09000) libQtGui.so.4 => /usr/local/Trolltech/QtEmbedded-4.6.2/lib/libQtGui.so.4 (0xb758e000) libQtNetwork.so.4 => /usr/local/Trolltech/QtEmbedded-4.6.2/lib/libQtNetwork.so.4 (0xb74a3000) libQtCore.so.4 => /usr/local/Trolltech/QtEmbedded-4.6.2/lib/libQtCore.so.4 (0xb7216000) libpthread.so.0 => /lib/tls/i686/cmov/libpthread.so.0 (0xb71f0000) libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb70fd000) libm.so.6 => /lib/tls/i686/cmov/libm.so.6 (0xb70d8000) libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb70cd000) libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb6f7e000) libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0xb6f79000) libz.so.1 => /usr/lib/libz.so.1 (0xb6f64000) librt.so.1 => /lib/tls/i686/cmov/librt.so.1 (0xb6f5b000) /lib/ld-linux.so.2 (0xb7f0a000)
【問題】
【參考】
桌面抓圖軟體,Vista適用。
PicPick Tools - All-in-one Design Tools http://picpick.wiziple.net/features
【功能】
抓取整個視窗:Print Screen
抓取活動視窗:Screen Capture->Active Window; 或 Alt+Print Screen。
類似軟體:MWSnap
【參考】
先收集一些資料
【參考】
Jocr http://home.megapass.net/~woosjung/Index_Download.html
【安裝】
【參考】
Ubuntu Hardware Summit Agenda
因為我沒機會去參加,就看一下簡報,記一下筆記(目前還是已 2009 年文件為主)。
P.6 Keynote Ubuntu : Past, Present and Future
P.41 Networking Architecture
P.69 An Introduction to the ACPI Extra Driver
P.93 Ubuntu Desktop Roadmap
P.106 QA Process Within OEM Services
P.125 給Subversion使用者的Git指南
(TBD, 先跳過)
P.245 Working with the Linux Kernel Community
P.276 Linux Kernel Debugging
先停一下,事情好多。
【參考】
【步驟】
$ cat /proc/bus/usb/devices
$ usb-devices或
$ lsusb (可以加上所需要的參數)
T: Bus=04 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=12 MxCh= 0 D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=32 #Cfgs= 1 P: Vendor=2087 ProdID=0b03 Rev=02.02 S: Manufacturer=Cando S: Product=11.6 C: #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=100mA I: If#= 0 Alt= 0 #EPs= 1 Cls=03(HID ) Sub=00 Prot=00 Driver=usbhid
T: Bus=01 Lev=02 Prnt=02 Port=05 Cnt=03 Dev#= 5 Spd=12 MxCh= 0 D: Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=0eef ProdID=72aa Rev=10.00 S: Manufacturer=eGalax Inc. S: Product=USB TouchController C: #Ifs= 1 Cfg#= 1 Atr=a0 MxPwr=100mA I: If#= 0 Alt= 0 #EPs= 1 Cls=03(HID ) Sub=01 Prot=02 Driver=usbhid
【其它】
Protocol Code | Description |
0 | None |
1 | Keyboard |
2 | Mouse |
3-255 | Reserved |
【參考】
Ed32. Copyright 2008 All Rights Reserved Revolution Two Church theme by Brian Gardner Converted into Blogger Template by Bloganol dot com