MySQL 『Noinstall Zip Archive』 安裝
(1) 解壓後放在C:\Apache2.2\mysql
(2) 建立 C:\WINNT\my.ini 檔, 內容如下:
----------my.ini內容----------
[mysqld]
basedir=C:/Apache2.2/mysql
datadir=C:/Apache2.2/mysql/data
----------my.ini內容----------
(3) 到Dos-mode下command:
> cd c:\apache2.2\mysql\bin
> mysqld-nt --install
* --install意思是說register成windows service去管理start/stop/restart
2007年9月27日 星期四
MySQL 『Noinstall Zip Archive』 安裝
在Win2K上安裝 phpMyAdmin-2.11.1-all-languages
在Win2K上安裝 phpMyAdmin-2.11.1-all-languages
(1) 解壓縮到C:\Apache2.2\htdocs\ 並改名為 phpMyAdmin
(2) 複製config.sample.inc.php to config.inc.php
(3) 修改 config.inc.php內容
----------config.inc.php內容----------
$i++;
/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'http'; /*將cookie改為http*/
/* Server parameters */
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
/* Select mysqli if your server has it */
$cfg['Servers'][$i]['extension'] = 'mysql';
$cfg['Servers'][$i]['user'] = '登入MySQL資料庫帳號';
$cfg['Servers'][$i]['password'] = '登入MySQL資料庫密碼';
----------config.inc.php內容----------
(4) 修改C:\WINNT\php.ini內容, 將extension=php_mysql.dll 前面的『;』comment取消
(5) Restart Apache
(6) 從C:\Apache2.2\php-5.2.4\ext\下複製php_mcrypt.dll,php_mysql.dll and libmysql.dll 到 C:\WINNT\下.
(7) 執行 http://localhost/phpmyadmin/index.php 就可以看到內容.
* 如果步驟(4)跟(6)沒有做到,就會出現『無法讀取 mysql 模組』訊息.
另外在舊資料庫轉移後會出現亂碼, 是因為舊資料庫是採latin1編碼, 而新版5.x版MySQL的default編碼是utf-8,
所以必須要在C:\Apache2.2\htdocs\phpMyAdmin\libraries\select_lang.lib.php修改內容:
找到底下,並將zhtw-utf-8的array內容改為chinese_traditional-big5:
'zhtw-big5' => array('zh[-_](tw|hk)|chinese traditional', 'chinese_traditional-big5', 'zh-TW', '中文'),
'zhtw-utf-8' => array('zh[-_](tw|hk)|chinese traditional', 'chinese_traditional-big5', 'zh-TW', '中文'),
---
再找到底下:
/**
* @global array MySQL charsets map
*/
$GLOBALS['mysql_charset_map'] = array(
...
'big5' => 'latin1', /*修改為 latin1*/
'utf-8' => 'latin1', /*修改為 latin1*/
...
);
存檔後refresh web page...
2007年9月25日 星期二
Pointer 與 Structure 運用.
/*
* 說明: (*pz).a = pz->a
first member before the function call 11, Address = 4598856
first member inside the function 11
first member before the function call 12, Address = 4598976
first member after the function call 12 Address = 4606680
first member before the function call 12, Address = 4606704
Address of y.d = 4606728
Address of y->d = 4606752
*/
struct y{
int d;
int e;
};
struct x{
int a;
int b;
int c;
struct y ys;
};
void function(struct x *);
main(){
struct x z, *pz;
pz = &z;
z.a = 10;
z.a++;
printf("first member before the function call %d, Address = %u\n", pz->a, malloc(sizeof(pz->a)));
function(pz);
printf("first member before the function call %d, Address = %u\n", pz->a, malloc(sizeof(pz->a)));
printf("first member after the function call %d Address = %u\n", (*pz).a, malloc(sizeof((*pz).a)));
printf("first member before the function call %d, Address = %u\n", z.a, malloc(sizeof(z.a)));
printf("Address of y.d = %u \n", malloc(sizeof(z.ys.d)));
printf("Address of y->d = %u \n", malloc(sizeof(pz->ys.d)));
}
void function(struct x *pz){
printf("first member inside the function %d \n", pz->a);
pz->a++;
}
C/C++: Structure Vs Union
A structure is a collection of items of different types; and each data item will have its own memory location. Where as only one item within the union can be used at any time, because the memory allocated for each item inside the union is in a shared memory location i.e., only one memory location will be shared by the data items of union.
Size of union will be the size of the biggest variable.
Why do we need Union in the first place?
Sometimes we may not need the data of all the (related) data items of a complex data structure and be storing/accessing only one data item at a time. Union helps in such scenarios.
e.g.,
typedef union
{
int Wind_Chill;
char Heat_Index;
} Condition;
typedef struct
{
float temp;
Condition feels_like;
} Temperature;
Wind Chill is only calculated when it is cold and heat index is used only when it is hot. There is no need for both of them at the same time. So when we specify the temp, feels_like will have only one value - either wind chill or heat index, but not both.
The following simple program illustrate the above explanation:
% cat structunion.c
#include
#include
typedef union
{
int Wind_Chill;
char Heat_Index;
} Condition;
typedef struct
{
float temp;
Condition feels_like;
} Temperature;
void main()
{
Temperature *tmp;
tmp = (Temperature *)malloc(sizeof(Temperature));
printf("\nAddress of Temperature = %u", tmp);
printf("\nAddress of temp = %u, feels_like = %u", &(*tmp).temp, &(*tmp).feels_like);
printf("\nWind_Chill = %u, Heat_Index= %u\n", &((*tmp).feels_like).Wind_Chill, &((*tmp).feels_like).Heat_Index);
}
% cc -o structunion structunion.c
% ./structunion
Address of Temperature = 165496
Address of temp = 165496, feels_like = 165500
Wind_Chill = 165500, Heat_Index= 165500
2007年9月20日 星期四
Close beep sound in Vmware config.ini
Add the following to C:\Documents and Settings\Administrator\Application Data\VMware\preferences.ini
mks.noBeep = "TRUE"
2007年9月19日 星期三
微處理器 相關概念
Microprocessor
http://en.wikipedia.org/wiki/Microprocessor
VHDL
http://en.wikipedia.org/wiki/VHDL
Introduction to Watchdog Timers
http://www.netrino.com/Publications/Glossary/WatchdogTimer.php
--- Google Book ---
單晶片原理與應用
微控制器原理與應用
微機原理、匯編與接口技術
嵌入式C語言編程
C語言相關書籍
2007年9月18日 星期二
C語言中volatile關鍵字
volatile (C++)
Reference: MSDN
const and volatile Pointers
Reference: MSDN
volatile關鍵字是一種類型修飾符,用它聲明的類型變數表示可以被某些編譯器未知的因素更改。
用volatile關鍵字聲明的變量 i 每一次被訪問時,執行時都會從 i 相應的記憶體位址中取出 i 的值。
沒有用volatile關鍵字宣告的變數 i 在被訪問的時候可能直接從CPU的暫存器中取值
(因為之前 i 被訪問過,也就是說之前就從暫存中取出 i 的值保存到某個暫存器中)。
之所以直接從暫存器中取值,而不去記憶體中取值,是因為編譯器優化代碼的結果
(讀取CPU暫存器比讀取記憶體快得多)。
以上兩種情況的區別在於compiler時用debug mode或release mode的結果,兩者是不一樣的。會這樣做是因為變數 i 可能會經常變化(volatile),所以需保證對特殊記憶體位址的值被正確讀取。
---
volatile關鍵字是一種類型修飾符,被宣告的變數表示可以被某些編譯器未知的因素更改,例如:操作系統、硬件或者其它線程等。遇到這個關鍵字聲明的變數,編譯器對讀取該變數的程式碼就不再進行優化,從而可以提供對特殊記憶體位址的值被正確讀取。
例如:
volatile int i=10;
int a = i;
int b = i;
上面程式碼 volatile 指出 i是隨時可能發生變化的,所以每次使用它的時候必須從 i 的記憶體位址中讀取,因而編譯器生成的彙編代碼會重新從 i 的地址讀取數據放在 b 中。而優化做法是,由於編譯器發現兩次從 i 讀數據的程式碼之間的程式碼沒有對 i 進行過操作,它會自動把上次讀的數據放在b中。而不是重新從 i 裡面讀。
#include
void main()
{
int i=10;
int a = i;
printf("i= %d\n",a);
//下面彙編語句的作用就是改變記憶體中 i 的值,但是又不讓編譯器知道
__asm {
mov dword ptr [ebp-4], 20h
}
//dev c++ __asm{} must change to __asm("mov ...");
int b = i;
printf("i= %d\n",b);
}
然後,在debug mode執行程式,輸出結果如下:
i = 10
i = 32
然後,在release mode執行程式,輸出結果如下:
i = 10
i = 10
輸出的結果明顯表示,release mode下,編譯器對程式碼進行了優化,所以第二次沒有輸出正確的 i 值。
下面,我們把 i 宣告成volatile關鍵字,看看有什麼變化:
#include
void main()
{
volatile int i=10;
int a = i;
printf("i= %d\n",a);
__asm {
mov dword ptr [ebp-4], 20h
}
int b = i;
printf("i= %d\n",b);
}
分別在debug mode 和release mode 執行程式,輸出都是:
i = 10
i = 32
表示這個關鍵字發揮了它的作用!
TOP / BOTTOM Boot Block
Reference URL
Vlsi-design Of Non-volatile Memories
By Giovanni Campardo, Rino Micheloni, David Novosel
P526
Digital Design with CPLD Applications and VHDLBy Robert K. Dueck
P851
Floorplan (integrated circuits)
Floorplan (integrated circuits)
In semiconductor device design, a floorplan of an integrated circuit is a diagram of the actual placement of its major components within the chip area. The image below is a mock chip floorplan, shown in an IC layout editor window.
The creation or design of a floorplan is an important aspect of integrated circuit design, since the layout of the major components on the chip affects their connectivity and performance, and the aspect ratio of the chip depends on the floorplan (long thin chips are avoided in favor of square or nearly square chips.
URL:http://en.wikipedia.org/wiki/Floorplan_%28integrated_circuits%29
英式鄉村風-4F書房
英式鄉村風-3F客房
英式鄉村風-2F主臥房
英式鄉村風-客廳
這是客廳要進廚房的那一面,原本是沒有隔間的,風水上說:廚房灶台忌從大門口可以直接看到。所以為了壁免這個問題,然後又不想讓整體空間視覺變小,所以我選擇了用玻璃拉門,拉門的玻璃不能太小片哦,不然看起來會很小氣,大片一點,當然為了安全問題,所以我們採用安全玻璃,這個拉門一片也很大片,重重的,光是這個門的顏色就花了油漆師傅幾天的時間,因為我用了鋼琴烤漆的方式去漆,這樣木頭表面才會光滑,比較不會留手汗,時間久了手把旁邊才不會黑黑的手印。
白色拉門上方是隱藏式冷氣的出風口,為了要讓出風口的位置能夠跟拉門對齊,出風管還是特別訂製。