因為看到MiPony可以快速下載freakshare.net的檔案,所以就想裝來試試看~
在Linux下,只能用wine,我用的版本是1.3。你得先安裝winetricks(sudo apt-get install winetricks),然後用winetricks裝上 gdiplus, fontfix, dotnet20, ie6(winetricks gdiplus fontfix dotnet20 ie6)。接著再用wine裝上MiPony,就可以了。
目前下載了十幾個檔案,都沒問題,真是太好了!!
星期四, 1月 27, 2011
星期三, 1月 26, 2011
Google reader expanded/list hack
最近把Google reader的tag都設到書籤裡去,想說這樣會比較快。
可是卻遇到一個問題,某些tag要看的時候想用Expanded,但某些tag卻想用List。本想說Google reader是不是可以藉著設URL Parameter的方式來解決這問題,查了Unofficial 的 Google reader API,卻沒找到答案。
只能手動 Hack 了。
啟用神兵 Firebug 查看以後,Google reader要show Expanded/List,是送 POST 到 https://www.google.com/reader/api/0/preference/set?client=scroll ,然後帶上3個參數:T、k、v ,T 用途不明,k 總是 is-card-view,v 在 Expanded 時是 true,List 時則是 false。
所以,看來是沒辦法,除非是書籤改用 javascript,寫成 bookmarklet 的方式才能達成。
可是卻遇到一個問題,某些tag要看的時候想用Expanded,但某些tag卻想用List。本想說Google reader是不是可以藉著設URL Parameter的方式來解決這問題,查了Unofficial 的 Google reader API,卻沒找到答案。
只能手動 Hack 了。
啟用神兵 Firebug 查看以後,Google reader要show Expanded/List,是送 POST 到 https://www.google.com/reader/api/0/preference/set?client=scroll ,然後帶上3個參數:T、k、v ,T 用途不明,k 總是 is-card-view,v 在 Expanded 時是 true,List 時則是 false。
所以,看來是沒辦法,除非是書籤改用 javascript,寫成 bookmarklet 的方式才能達成。
標籤(Label):
瀏覽器(browser),
javascript,
note
星期二, 1月 25, 2011
GNU IceCat Privacy extension安裝總是失敗
之前都沒注意,直到GreaseMonkey升級,跑不起來,才發現這事情的嚴重性。
上網找了一下,果然已經有人跳腳:http://osdir.com/ml/bug-gnuzilla-gnu/2010-12/msg00057.html
就follow裏面的提供的網址:http://kb.mozillazine.org/Installing_extensions#Global_installation ,照裏面的指示去手動解壓縮 /usr/lib/icecat/extensions/privacy_ext.xpi 到 /usr/lib/icecat/extensions/privacy_features@gnuzilla.gnu.org 就行了。
上網找了一下,果然已經有人跳腳:http://osdir.com/ml/bug-gnuzilla-gnu/2010-12/msg00057.html
就follow裏面的提供的網址:http://kb.mozillazine.org/Installing_extensions#Global_installation ,照裏面的指示去手動解壓縮 /usr/lib/icecat/extensions/privacy_ext.xpi 到 /usr/lib/icecat/extensions/privacy_features@gnuzilla.gnu.org 就行了。
標籤(Label):
瀏覽器(browser),
linux
DDMS抓圖
會看這個,是因為抓圖失敗...
ddms 會開啟本地的port 5037,這是由host端的adbd所listen的。接著寫入"framebuffer:" (AdbHelper.getFrameBuffer)。
target端的adbd收到以後,會建立一個thread,thread跑的是framebuffer_service.c裡的code。裏面很簡單,就開啟/dev/graphics/fb0,然後取 fb_var_screeninfo 的值,再根據得到的值來決定要讀多少bytes,寫回去到host端,最後寫完就關閉。
為什麼會抓不到圖呢?不知道,還找不到原因。
ddms 會開啟本地的port 5037,這是由host端的adbd所listen的。接著寫入"framebuffer:" (AdbHelper.getFrameBuffer)。
target端的adbd收到以後,會建立一個thread,thread跑的是framebuffer_service.c裡的code。裏面很簡單,就開啟/dev/graphics/fb0,然後取 fb_var_screeninfo 的值,再根據得到的值來決定要讀多少bytes,寫回去到host端,最後寫完就關閉。
為什麼會抓不到圖呢?不知道,還找不到原因。
星期一, 1月 17, 2011
加快linux開機速度
在 1 second Linux boot to Qt! 看到的,標題超聳動,不過實際看到影片,真的是很嚇人,根本就是瞬間就開好了。投影片在這裡:The Right Approach to Minimal Boot Times
這個 topic 前兩年很熱門,當然啦,現在因為 Android 的關係,應該會更熱。下面是我看完的一些紀錄跟想法:
參考資料:
這個 topic 前兩年很熱門,當然啦,現在因為 Android 的關係,應該會更熱。下面是我看完的一些紀錄跟想法:
- 使用 Arjan van de Ven 對 kernel aync 的 patch
- 把不重要的 module 改成 loadable
- 修改init/do_mounts.c以提早mount root
- 修改init/main.c裡的init_post,看了以後,我想應該是避免掉open /dev/console還有移掉不必要的步驟以提速。
- improve memcpy (這我不知道是哪裡的,要再查看看)
- reduce kernel size:這可以加快 u-boot 載入時間。一般手段就移掉不必要的driver/module。
- reduce u-boot delay time:u-boot 預設有 delay time,這可以改掉
- kernel 壓縮或不壓縮:用zImage的話可以減少kernel大小,可是要評估解壓縮時間跟載入時間的平衡來決定壓縮或不壓縮。
- 利用 gcc 的 --finstrument-functions --function-sections 去 profile function 的時間 (簡報說加了這兩個 argument,就可以在 __cyg_profile_func_enter/__cyg_profile_func_exit 裡放 code,這個要鑽研 gcc 試試看。)
- 利用ubootchart/bootchart.org工具來測時間。
參考資料:
星期四, 1月 13, 2011
Lex 練習
看 lex & yacc 第一章的練習,然後改用 glib 的 GList 來做:
Lex 是用來 tokenize 輸入用的,也就是用來辨識說輸入裡有哪些東西是你要的。這個例子書上沒針對怎麼使用做解說,乍看之下,不容易懂。其實使用上就是打 verb is,表明說 is 是 verb,你可以一直輸入 verb read、verb write、noun book、noun dog....程式就會把你輸入的這些內容分類、放到list裏面去,之後你輸入 read、write、book 時,程式就會告訴你 read、write 是 verb,book 是 noun 。
改用 glib,是因為想練習 glib。g_list_find_custom令人意外地沒範例,不過用法挺簡單,主要變化在第二個參數,第二個參數是一個 function。該 function 第一個參數是 list 裡的元素,第二個參數就是 g_list_find_custom 裡的第二個參數,你可以參考 compare_word,應該是不難懂。
參考資料:
%{
#include <glib.h>
#include <stdlib.h>
/* token recognizer */
enum {
LOOKUP = 0, /* default is lookup, not add */
VERB,
ADJ,
ADV,
NOUN,
PREP,
PRON,
CONJ
};
int state;
int add_word( int type, char* word );
int lookup_word( char* word );
int print_word( gpointer data, gpointer userdata );
%}
%%
\n {state=LOOKUP;} /* go back to default */
^verb {state=VERB;}
^adj {state=ADJ; }
^adv {state=ADV; }
^noun {state=NOUN; }
^prep {state=PREP; }
^pron {state=PRON; }
^conj {state=CONJ; }
[a-zA-Z]+ {
if( state!=LOOKUP ) {
add_word( state, yytext );
}
else {
switch( lookup_word( yytext ) ) {
case VERB:
printf("%s: verb\n", yytext);
break;
case ADJ:
printf("%s: adjective\n", yytext);
break;
case ADV:
printf("%s: adverb\n", yytext);
break;
case NOUN:
printf("%s: noun\n", yytext);
break;
case PREP:
printf("%s: preposition\n", yytext);
break;
case PRON:
printf("%s: pronoun\n", yytext);
break;
case CONJ:
printf("%s: conjuction\n", yytext);
break;
default:
printf("%s: don't recognize\n", yytext );
break;
}
}
}
. /* ignore other characters. */
%%
GList* list=NULL;
int main( int argc, char* argv[] )
{
yylex();
g_list_foreach(list, (GFunc)print_word, NULL);
g_list_free(list);
}
struct word {
GString* word_name;
gint word_type;
};
int print_word( gpointer data, gpointer userdata ) {
struct word* word=(struct word*)data;
g_printf( "word=%s type=%d\n", word->word_name->str, word->word_type );
return 0;
}
int add_word( int type, char* word) {
struct word* wp;
if( lookup_word( word )!=LOOKUP ) {
printf("!!! Warning: word %s already defined.\n", word );
return 0;
}
wp = g_new0(struct word, 1);
wp->word_name=g_string_new( word );
wp->word_type=type;
list = g_list_append(list, wp);
return 1;
}
gint compare_word( gconstpointer a, gconstpointer b) {
struct word *p1=(struct word*)a;
GString* s=g_string_new( (char*)b );
int ret=0;
if( !g_string_equal( p1->word_name, s ) )
ret=1;
g_string_free(s, FALSE);
return ret;
}
int lookup_word( char* word ) {
GList* found=g_list_find_custom( list, word, compare_word );
if( found )
return ((struct word*)found->data)->word_type;
return LOOKUP;
}
Lex 是用來 tokenize 輸入用的,也就是用來辨識說輸入裡有哪些東西是你要的。這個例子書上沒針對怎麼使用做解說,乍看之下,不容易懂。其實使用上就是打 verb is,表明說 is 是 verb,你可以一直輸入 verb read、verb write、noun book、noun dog....程式就會把你輸入的這些內容分類、放到list裏面去,之後你輸入 read、write、book 時,程式就會告訴你 read、write 是 verb,book 是 noun 。
改用 glib,是因為想練習 glib。g_list_find_custom令人意外地沒範例,不過用法挺簡單,主要變化在第二個參數,第二個參數是一個 function。該 function 第一個參數是 list 裡的元素,第二個參數就是 g_list_find_custom 裡的第二個參數,你可以參考 compare_word,應該是不難懂。
參考資料:
訂閱:
文章 (Atom)