2006-11-30

Cmd

http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/cmd.mspx?mfr=true

2006-11-24

Bootcfg

http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/bootcfg.mspx?mfr=true

Boot.ini Boot Parameter Reference

http://msdn2.microsoft.com/en-us/library/ms791480.aspx

Info: /cygdrive/c/EmbestIDE/Build/xgcc-arm-elf/bin/arm-elf-ld: cannot find -lc

FAQ

Please set the searching path of c library and gcc library correctly. Select the menu Project> Settings, open project configuration box, select the linked page and the option to add library searching path in drop-down box:
..\..\..\build\xgcc-arm-elf\arm-elf\lib\arm-inter
..\..\..\build\xgcc-arm-elf\lib\gcc-lib\arm-elf\3.0.2\arm-inter

The above path is the relative path of Embest IDE, users can also set absolute path.

2006-11-20

jmsort2.c


#include
//#include "algo.h"

void msort2(int lo, int hi, int S[]);
void mg2(int lo, int mid, int hi, int S[]);


void msort2(int lo, int hi, int S[])
{
int mid;
if ((lo < hi) && ((hi - lo) > 1))
{
mid = (lo + hi) / 2;
//printf(".S[%d]: %d, S[%d]: %d\n", lo, S[lo], mid, S[mid]);
msort2(lo, mid, S);
//printf("..S[%d]: %d, S[%d]: %d\n", mid + 1, S[mid + 1], hi, S[ hi]);
msort2(mid + 1, hi, S);
// Upper is OK
printf("\nlo: %d, mid: %d, hi: %d\n", lo, mid, hi);
mg2(lo, mid, hi, S);
}
}


void mg2(int lo, int mid, int hi, int S[])
{
int i = lo;
int j = mid + 1;
int k = lo;
int U[16];

while ((i <= mid) && (j <= hi))
{
if (S[i] < S[j]) U[k] = S[i++];
else U[k] = S[j++];
k++;
}

int a;
if (i < mid)
for (a = i; a <= mid; a++)
U[a+k] = S[i+a];
else
for (a = j; a <= hi; a++)
U[k+a] = S[j+a];

for (a = lo; a <= hi; a++)
{
S[a] = U[a];
printf("S[%d]: %d, ", a, S[a]);
}
printf("\n");
}


int main(void)
{
int S[] = { 27, 10, 12, 20, 25, 13, 15, 22 };
int sz = sizeof(S) / 4;
int lo = 0;
int hi = sz - 1;

msort2(lo, hi, S);


printf("\nFinally: ");
int a;
for (a = 0; a < 8; a++)
printf("%d, ", S[a]);
printf("\n");

return 0;
}

2006-11-19

HTML <> 的特殊用法

http://www.w3.org/TR/html4/charset.html


"&lt;" represents the < sign.
"&gt;" represents the > sign.
"&amp;" represents the & sign.
"&quot; represents the " mark.

見鬼了,指標無敵啦!

說什麼 in-place 可以節省記憶體空間。只要餵 pointer 過去就無敵了,可是怎麼偵測正確的 sizeof() 呢? o_O? 頭大!


Code:

    #include <stdio.h>

    int foo(int *pA);
    int foo2(int A[]);

    int main(void)
    {
    int A[] = { 5, 7 };
    int *pA = A;

    printf("%d\n", sizeof(A));
    printf("%d\n", sizeof(*pA)); // 其實我是第一個元素的大小
    printf("%d\n", sizeof(*(pA + 1))); // 我是第二個元素的大小
    printf("%d\n", foo(pA));
    printf("%d\n", foo2(A)); // 其實我也是傳第一個指標過去而已
    return 0;
    }

    int foo(int *pA)
    { return sizeof(*pA); }

    int foo2(int A[])
    { return *(A + 1); }


Output:

    8
    4
    4
    4
    7

2006-11-18

終於完成

17:45:29 :: images $ ls -lh
total 503k
-rw-r--r-- 1 a2n None 1.0k Nov 18 17:37 romfs.img
-rwxr-xr-x 1 a2n None 502k Nov 18 17:42 zImage
17:45:30 :: images $


明天的 TODO

    把 MicroWindow 或 MiniGUI 把玩一下。


話說 ARM9 tutorial 我跑不起來,心中有一股怨恨,也想列為 TODO,可是時間上不允許吧。 :-)

Err Log 2006-11-18

在全新的 XP 系統下編譯,在 make clean 出現以下的 err:

--

--
見鬼,重編譯後又沒事。

有個傢伙一直來撞牆



220.134.0.85

要把他 ban 掉!

$grep "220.134.0.85" auth.log |wc -l
346

從 Nov 18 11:00:09 開始撞,Nov 18 11:06:04 結束。

*為了不出現把自己鎖在牆外的窘境,先把作業寫好再說。

[有進步] Once I've used freopen, how can I get the original stdout (or stdin) back?

今天遇到的,有進步。

http://c-faq.com/stdio/undofreopen.html


FILE *fp;
freopen("foo.txt", "w", stdout);
fprintf(fp, "Hello, World\n");
fclose(fp);
printf("Hello, World2\n");


#Output
Hello, World2

And the "Hello, World" is write into *fp points to, "foo.txt".


Mistake example


    FILE *fp = freopen("foo.txt", "w", stdout);
    printf("Hello, World\n");
    fclose(fp);
    printf("Hello, World2\n");


    #Output
    (nothing)

    Because the "Hello, World" was be redirect to "foo.txt", althought it was already excused fclose(fp), but we got nothing from stdout. So the better way is to using fprintf().

2006-11-17

Err Log

pushd: not found
Makefile:40: WARNING: No kernel PCMCIA support found and PCMCIA_PATH is not defined
Makefile:47: WARNING: Linux wireless extensions, CONFIG_NET_RADIO, not enabled in the kernel
make[2]: *** [include/bits/getopt.h] Error 1
configure: error: `LDFLAGS' was not set in the previous run
configure: error: `CFLAGS' was not set in the previous run
configure: error: `CC' was not set in the previous run
configure: error: changes in the environment can compromise the build
configure: error: run `make distclean' and/or `rm config.cache' and start over
make[2]: *** [config.status] Error 1
make[2]: [_mopup] Error 1 (ignored)
make[2]: [_mopup] Error 1 (ignored)
make[3]: *** No rule to make target `clean'. Stop.
make[2]: [_tidy] Error 2 (ignored)
../../miniperl: not found
make[3]: *** No rule to make target `clean'. Stop.
../../miniperl: not found
make[3]: *** No rule to make target `clean'. Stop.
../../miniperl: not found
make[3]: *** No rule to make target `clean'. Stop.
../../miniperl: not found
make[3]: *** No rule to make target `clean'. Stop.
../../../miniperl: not found
make[3]: *** No rule to make target `clean'. Stop.
../../../miniperl: not found
make[3]: *** No rule to make target `clean'. Stop.
../../../miniperl: not found
make[3]: *** No rule to make target `clean'. Stop.
../../miniperl: not found
make[3]: *** No rule to make target `clean'. Stop.
../../../miniperl: not found
make[3]: *** No rule to make target `clean'. Stop.
../../miniperl: not found
make[3]: *** No rule to make target `clean'. Stop.
../../../miniperl: not found
make[3]: *** No rule to make target `clean'. Stop.
../../miniperl: not found
make[3]: *** No rule to make target `clean'. Stop.
../../miniperl: not found
make[3]: *** No rule to make target `clean'. Stop.
../../miniperl: not found
make[3]: *** No rule to make target `clean'. Stop.
../../miniperl: not found
make[3]: *** No rule to make target `clean'. Stop.
../../miniperl: not found
make[3]: *** No rule to make target `clean'. Stop.
../../../miniperl: not found
make[3]: *** No rule to make target `clean'. Stop.
../../../miniperl: not found
make[3]: *** No rule to make target `clean'. Stop.
../../miniperl: not found
make[3]: *** No rule to make target `clean'. Stop.
make[2]: [_tidy] Error 2 (ignored)
make[2]: *** No rule to make target `clean'. Stop.
awk: build-config.awk:16: fatal: cannot open file `Config.h' for reading (No such file or directory)
make[2]: *** [config.h] Error 2
configure: error: C compiler cannot create executables
See `config.log' for more details.
make[2]: *** [config.status] Error 77

BlueScreen Screen Saver v3.2

好物!

BlueScreen Screen Saver v3.2

Author 是 Mark Russinovich,害我以為是上次我去要 Logitech 的好人,哈哈。

2006-11-09

[Windows script] backup.bat



:: Author: Alan Lu
:: Date: 2006-11-09
:: Purpose: Backing up one directory by 7-zip compressor.
:: Ref: http://www.microsoft.com/technet/abouttn/flash/tips/tips_053106_2.mspx
:: Usage:
:: $> backup.bat
:: or
:: $> at 03:00 /every:Sunday backup.bat


@echo off
cls


::
:: %workspace% is a directory name where you want backup.
:: Don't forgot modify the %workspace%'s default value.
set workspace=foo

:: Setting environment variables with todoy's date values
for /f "tokens=1-4 delims=/" %%i IN ('date /t') DO (
set year=%%i
set month=%%j
set day=%%k
)

for /f "tokens=1-3 delims=:" %%i IN ('time /t') DO (
set hour=%%i
set minute=%%j
)

7z a -mx=9 "%year%-%month%-%day%-%hour%-%minute%.7z" %workspace%