2010年7月25日 星期日

nfsd privileged port

http://mars.netanya.ac.il/~unesco/cdrom/LDP/NFS/HTML_FORMAT/NFS-HOWTO-6.html

Another important thing is to ensure that nfsd checks that all it's requests comes from a privileged port. If it accepts requests from any old port on the client a user with no special privileges can run a program that's is easy to obtain over the Internet. It talks nfs protocol and will claim that the user is anyone the user wants to be. Spooky. The Linux nfsd does this check by default, on other OSes you have to enable this check yourself. This should be described in the nfsd man page for the OS.

Another thing. Never export a file system to 'localhost' or 127.0.0.1. Trust me.

新版的說
http://nfs.sourceforge.net/nfs-howto/ar01s06.html
The TCP ports 1-1024 are reserved for root's use (and therefore sometimes referred to as "secure ports") A non-root user cannot bind these ports. Adding the secure option to an /etc/exports means that it will only listed to requests coming from ports 1-1024 on the client, so that a malicious non-root user on the client cannot come along and open up a spoofed NFS dialogue on a non-reserved port. This option is set by default.

舊的版本說,只要相信從1024以下來的client,而且不要給localhost連線。這有點道理,如果相信從localhost來的1024以上的連線,可能是假造的。
但是應該只要做其中一項就好了吧,外部的連線不管是不是1024以下的都有可能會是假的。

不知道為什麼linux的實作還是這樣。

在mac上面mount_nfs要加上
-o resvport
Use a reserved socket port number. This is useful for mounting
servers that require clients to use a reserved port number on the
mistaken belief that this makes NFS more secure
. (For the rare
case where the client has a trusted root account but untrustwor-
thy users and the network cables are in secure areas this does
help, but for normal desktop clients this does not apply.)

意思就是說這樣根本沒什麼用就對了。

如果沒有加這個的話,會出現 /Volumes/nfs: Permission Denied

或是在nfs server /etc/exports 加上 insecure

2010年7月19日 星期一

AAC+/eAAC/AAC plus/Enhanced AAC

Shared library libaacplus
http://tipok.org.ua/node/17

with patch for ffmpeg, need to download source code from 3GPP.


3GPP Reference encoder
Floating Point: http://www.3gpp.org/ftp/Specs/html-info/26410.htm
Fixed Point: http://www.3gpp.org/ftp/Specs/html-info/26411.htm



aacplusenc
http://teknoraver.net/software/mp4tools/#download
Also with binary for Win/Linux/Mac platform.


NeroAAC
http://www.audiocoding.com/nero_aacenc.html
No source code


DarkGiank's enhAacPlusEnc
http://dgaapenc.berlios.de/en/#ins




To support 80kbps encoding, edit sbr_main.c

{ 64000, 80001, 24000, 2, 12, 9, 3, 0, -3, SBR_SWITCH_LRC, 2 }, /* nominal: 80 kbit/s 48khz*/
{ 64000, 80001, 22050, 2, 12, 9, 3, 0, -3, SBR_SWITCH_LRC, 2 }, /* nominal: 80 kbit/s 44.1khz*/


不知道為什麼不要乾脆都用AAC+ 80kbps來存音樂就好。thepiratebay上面有人分享48kbps的AAC+音樂, 可是種子太少沒有下載來聽。iTunes也支援最高到80kbps。

另外, Ogg Vorbis @48kbps 聽起來其實也不錯。

2010年7月17日 星期六

新酷音測試




/* 
 * File:   main.cpp
 * Author: adolf
 *
 * Created on 2010年7月17日, 上午 1:11
 */

#include <stdlib.h>

#include <stdio.h>
#include <chewing/chewing.h>
#include <chewing/global.h>
#include <chewing/chewingio.h>
#include <string.h>

using namespace std;

/*
 * 
 */
int main(int argc, char** argv) {

    if (0 != chewing_Init("/Users/adolf/chewing/0.3.2/share/chewing/", ".")) {
        fprintf(stderr, "chewing_Init failed\n");

        exit(-1);
    }
    ChewingConfigData config;

    ChewingContext * ctx = chewing_new();

    chewing_set_maxChiSymbolLen(ctx, 16);
    chewing_set_candPerPage(ctx,10);

    char * str0 = "w96j0 eji6 g wu3 au4z/ ";
    //char * str = "1";
    for (int i = 0; i < strlen(str0); i++) {

        //printf("%d\n",i);
        chewing_handle_Default(ctx, str0[i]);
        chewing_cand_Enumerate(ctx);

        if (chewing_cand_TotalChoice(ctx) >0) {
            while (chewing_cand_hasNext(ctx)) {

                char* str = chewing_cand_String(ctx);
                if (str) {

                    //converted_string = utf8_mbstowcs( str );
                    printf("candidates %s\n", str);
                    chewing_free(str);
                }
            }
        } else {

            if (chewing_buffer_Check(ctx)) {
                char * str = chewing_buffer_String(ctx);

                if (str) {
                    printf("buffer %s\n", str);
                    chewing_free(str);
                }
            }
        }

        if (chewing_commit_Check(ctx)) {
            char* str = chewing_commit_String(ctx);

            if (str) {
                printf("%s\n", str);
                chewing_free(str);
            }
        }
    }

    chewing_handle_Left(ctx);
    chewing_handle_Left(ctx);
    /*
    chewing_handle_Down(ctx);
    chewing_handle_Down(ctx);
    chewing_handle_Enter(ctx);*/
    chewing_handle_Default(ctx,'v');

    chewing_handle_Default(ctx,'u');
    chewing_handle_Default(ctx,'l');
    chewing_handle_Default(ctx,'3');

    if (chewing_buffer_Check(ctx)) {
                char * str = chewing_buffer_String(ctx);

                if (str) {
                    printf("buffer %s\n", str);
                    chewing_free(str);
                }
            }

    return 0;
}

2010年7月8日 星期四

android超級好用注音輸入法 1.0.2

1.0.3 新增功能說明

輸入'中'的時候,會出現

文,文系,了,共,區,午,原,古,和,國....樞神經,正大學,正機場,氣不足,泰賓館...

很多以中開頭的詞彙。

要一直翻到最後一頁的話乾脆就自己打完了。

這時候只要打注音ㄍ,就會出現中之後注音開頭ㄍ的詞彙前三個,例如 共,古,廣

如果打ㄍㄨㄛ... 就會出現 國人,國城,國菜...

不用打聲調, 打ㄍㄨㄛㄖㄣ,就會變成國人了。同理,打ㄊㄞㄅ一,就會出現泰賓館。

不喜歡的請到開發者網頁下載舊版1.0.2

不喜歡1.0.3的選詞功能的請下載這個

另外

會在背景時候清理資料庫(vacuum), 最多一天一次。

某些rom會擋掉廣告,這些不能切換成中文鍵盤。