Friday, December 24, 2010

compile with hidden classes on android

in Android SDK (not AOSP)
sometimes you need to use some 'hidden' classes ( with @hide annotations)

here is how I do it with ant build

first you need to get the whole Android framework jars
it's located in 
mydroid/out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes.jar

1:
copy it to your project/lib/   
(not libs/,  because ant build will include the jars in libs, but here we just need to use it for symbol resolution)

2: 
customize your ant build.xml
copy the templates from 
  • for cupcake donut
    • platforms/$API_LEVEL/templates/android_rules.xml
  • for eclair froyo
    • platforms/$API_LEVEL/ant/ant_rules_r2.xml
  • gingerbread 
    • tools/ant/main_rules.xml

3.
  add a path before the compile task <compile>
 <path id="boot.class.ref">
        <fileset dir="./lib">
            <include name="*.jar" />
        </fileset>
    </path>

then

add a line after <javac>

<compilerarg value="-Xbootclasspath/p:${toString:boot.class.ref}"/$gt;

here I try to update the boot class path with -Xbootclasspath/p option






Monday, December 20, 2010

vim 的達文西密碼

:help holy-grail


本來標題差點打成達爾文的密碼.....

Friday, December 17, 2010

cpp的member variable

member variable, or field
跟member function (or method)不一樣
不是存在v-table裡的
而是存在每個class裡

在 http://www.go4expert.com/forums/showthread.php?t=8403
的Exmaple 2裡
可以發現 dTest其實有另外存一份 Test的a 跟b
即使 a ,b 是private的
所以他的size是12

所以可以像Example 5一樣  加上 dTest 並來改 Test的a,b
Test 裡的 a ,b 是public的
所以也可以從dTest直接修改a b
像Example 5的例子 是用pointer來改
所以即使a, b是private的話也可以work

Thursday, December 16, 2010

3gpp format

介紹3gpp的網站

簡中:
http://www.cnitblog.com/zouzheng/archive/2007/04/04/25155.html

這個有點看不洞
http://blog.csdn.net/zblue78/archive/2010/12/15/6078040.aspx

parse atom的tool
http://atomicparsley.sourceforge.net/mpeg-4files.html

spec:
http://standards.iso.org/ittf/PubliclyAvailableStandards/c051533_ISO_IEC_14496-12_2008.zip

video broadacast on android


http://www.mattakis.hu/blog/kisg/20090708/broadcasting-video-with-android-without-local-files
談論到如何將recorder錄下來的video 藉由socket 送出去
(與onPreviewFrame不同的是  recorder已經把這data encode過了
onPreviewFrame是 raw data)

但其實在Android上 camrecorder 是在stop record之後
才把moov atom送出去
所以即使另一邊用socket來收這個stream
也無法來作streaming play的動作

而在上面那個link的comment 也討論到
即使是把他作成RTP  也還是要產生SDP


PS:
將moov從後面搬到前面的tool MP4BOX
http://gpac.cvs.sourceforge.net/viewvc/gpac/gpac/applications/mp4box/

Tuesday, December 7, 2010

javascript的arguments Object


http://dmitrysoshnikov.com/ecmascript/chapter-2-variable-object/
提到了 arguments

特別的是
他在foo(x,y,z)裡提到了一個例子 並且還在例子後註明了這是個chrome的bug


例子是:
如果改了arguments[2] 那z 同時也會改變嗎?
一般的javascript variable是不會的
但這裡是個特別的例子 blog的作者可能有點誤會了
在這裡  arguments[2]跟z是shared同個reference的


但ECMA  spec裡講到

10.1.8 Arguments Object
...........略
• For each non-negative integer, arg, less than the value of the length property, a property is created with name
ToString(arg) and property attributes { DontEnum }. The initial value of this property is the value of the
corresponding actual parameter supplied by the caller. The first actual parameter value corresponds to arg = 0,
the second to arg = 1, and so on. In the case when arg is less than the number of formal parameters for the
Function object, this property shares its value with the corresponding property of the activation object. This
means that changing this property changes the corresponding property of the activation object and vice versa.

在Javascript: The Definitive Guide也有提到這件事





Section 8.2.2
page 130

龍馬傳 #16 勝麟太郎

昨天作的劇情是 龍馬去跟勝麟太郎拜師
但有一說是當時龍馬是要去暗殺勝麟太郎的 
從あつひめ劇中就是這樣作的



http://ja.wikipedia.org/wiki/%E5%9D%82%E6%9C%AC%E9%BE%8D%E9%A6%AC#cite_note-115