2021-07-15

MCU 分類

ATMEL STM MICROCHIP

2015-09-17

 
int main()
{
    printf("Hello World!\n");
    return 0;
}

2013-07-24

C Struct Malloc 演示

 
struct mem_t{
    int x;
    int y;
};
 
int main()
{
    struct mem_t *p,*p2;
 
    p = (struct mem_t *) malloc(sizeof(struct mem_t));
 
    p->x = 24;
    p->y = 52;
 
    printf("p->x=%d\n"
           "p->y=%d\n",p->x,p->y);
    p2 = p;
    printf("p2->x=%d\n"
           "p2->y=%d\n",p2->x,p2->y);
 
    free(p);
    free(p2);
    return;
}

C 字串轉16進字串 + 0x ,Windows Live Writer google blogger

int main(void)
{
CURL *curl;
CURLcode res;

curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "curl.haxx.se");
res = curl_easy_perform(curl);

/* always cleanup */
curl_easy_cleanup(curl);
}
return 0;
}

str to hex

void printfHex(unsigned char *str)
{
    int i,j;
    int len = strlen(str);
    for( i=0,j=0; i

C# Barcode 讀碼讀取, 自動更新

        private void tbxSerial_KeyPress(object sender, KeyPressEventArgs e)
        {
              
            if (barcode == "")
            {
                tbxSerial.Text = "";
            }           

            barcode += e.KeyChar;          

            if (e.KeyChar == (char)Keys.Enter)
            {
                //tbxSerial.Text = "";
                tbxSerial.Text = barcode;
                barcode = "";
            }
        }

2012-12-14

How to Create subversion server , 簡單快速


環境 ubuntu 11.04 i386 32bit on v-box
使用者名為 linux

1. $ sudo apt-get install subversion    /* 安裝subversion */

2. $ mkdir -p /home//svn/repository   /* 建立 subversion 放的位置 */

3. $ cd /home//svn/repository        
    $ svnadmin create  /home//svn/repository   /* 建立suversion的資料庫,                                                                                                             名字可自取  */

4. 檢視一下建立的狀況


5. 設定相關存取的權限 ***重要 !!!***
 $ sudo chown -R root:admin /home//svn/repository
 $ sudo chmod -R ug+rwX,o= /home//svn/repository

6. $ cd /home/linux/svn/repository/project/conf
    $ vim authz
      linux = rw      /* 加入這行, */

    $vim pwd
      linux = passwd /*加入這行*/

6.啟動 svn
svnserve -d -r /home//svn/repository

7. 從svn serve commit project
    $ cd ~
    $  svn co svn:///project

8. 建立 branches
    $ cd ~/project
    $ svn mkdir branches tags trunk , tags, trnk 資料夾   


 /* 這裡還沒傳到svn server 上, 只是在本地端先建立而已 */


9.設定帳密及權限
$ vim svnserve.conf
password-db = passwd  //指定 passwd 的檔名為何, 沒設定的話會不能 ci

$ vim svnserve.conf
[users]
linux = linux             // 帳號 / 密碼


10. 第一次 commit