<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    posts - 88, comments - 3, trackbacks - 0, articles - 0
      BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理

    直接上C的實現
    typedef struct Foo {
        
    int len;
        
    char name[100];
    } Foo_t;

    JNIEXPORT jint JNICALL
    Java_TestJNI_foo(JNIEnv 
    *env, jobject obj, jobject fooObj) {

        Foo_t 
    * bar = malloc(sizeof(Foo_t));
        jclass clazz;
        jfieldID fid;

        
    //init the bar data of C
        strcpy(bar->name, "Yachun Miao");
        bar
    ->len = strlen(bar->name);

        
    // mapping bar of C to foo
        clazz = (*env)->GetObjectClass(env, fooObj);
        
    if (0 == clazz) {
            printf(
    "GetObjectClass returned 0\n");
            
    return (-1);
        }
        fid 
    = (*env)->GetFieldID(env, clazz, "len""I");
        (
    *env)->SetLongField(env, fooObj, fid, bar->len);

        fid 
    = (*env)->GetFieldID(env, clazz, "name""Ljava/lang/String;");
        jstring name 
    = (*env)->NewStringUTF(env, bar->name);
        (
    *env)->SetObjectField(env, fooObj, fid, name);

        free(bar);
        
    return 0;
    }

    對應的Java調用
    public class Foo {
        
    protected int len;
        
    protected String name;
    }


        
    private static native int foo(Foo fooObj);

        
    public static void main(String args[]) {
            System.loadLibrary(
    "mylib");

            Foo foo 
    = new Foo();
            foo(foo);
            System.out.println(foo.name);
            System.out.println(foo.len);

        }

    參考鏈接
    http://www.steveolyo.com/JNI/JNI.html#CSTRCJ
    http://docs.oracle.com/javase/6/docs/technotes/guides/jni/spec/types.html

    posted @ 2012-10-12 16:40 Milo的海域 閱讀(3865) | 評論 (0)編輯 收藏

    平時要用惡心的citrix Xenapp & citrix receiver 工作環境,裝完后發現client端不能復制內容到server端,這樣會對工作造成很大的困擾。
    偶然發現citrix receiver的進程上有個-file的選項,會指定個臨時配置文件,里面提及
    ClipboardAllowed=off
    于是grep下這個關鍵字,發現~/ICAClient/linuxx86/config/All_Regions.ini 也有個類似的
    ClipboardAllowed=*
    改為
    ClipboardAllowed=true
    然后重新開Xenapp session之后發現已經可以黏貼了。

    按照這個思路,使用windows的同事使用如下的方式打通兩端clipboard
    1. 打開系統注冊表編輯器
    2. 定位HKEY_CURRENT_USER\Software\Citrix\ICA Client\Engine\Lockdown Profiles\All Regions\Lockdown\Virtual Channels\Clipboard
    3. 修改ClipboardAllowed為1
    4. 注銷當前用戶(或許需要)

    如果Xenapp server上使用vnc viewer之類的Xclient,如果想打通到vnc server的clipboard,還需要在vnc server所在linux主機開啟以下進程
    vncconfig -nowin &
    這個有點不理解,但確實可行。待真相。。

    posted @ 2012-09-10 15:55 Milo的海域 閱讀(3491) | 評論 (1)編輯 收藏


    miaoyachun@ymiao:~$ /usr/lib/i386-linux-gnu/ibus/ibus-x11 --kill-daemon
    ^Z
    [1]+  Stopped                 /usr/lib/i386-linux-gnu/ibus/ibus-x11 --kill-daemon
    miaoyachun@ymiao:~$ bg
    [1]+ /usr/lib/i386-linux-gnu/ibus/ibus-x11 --kill-daemon &
    miaoyachun@ymiao:~$
    然后就可以了。。

    posted @ 2012-09-04 17:12 Milo的海域 閱讀(558) | 評論 (0)編輯 收藏

    今天發現ubunto12.4沒有默認的瀏覽器,導致所有的鏈接打開的時候從用gedit。google上找到了解決方法:
    編輯以下內容:
    [Desktop Entry]
    Version
    =14.0
    Name
    =Mozilla Firefox Web Browser
    Comment
    =Browse the World Wide Web
    GenericName
    =Web Browser
    Keywords
    =Internet;WWW;Browser;Web;Explorer
    Exec=/opt/firefox/firefox %u
    Terminal
    =false
    X-MultipleArgs
    =false
    Type
    =Application
    Icon
    =firefox
    Categories
    =GNOME;GTK;Network;WebBrowser;
    MimeType=text/html;text/xml;application/xhtml+xml;application/xml;application/rss+xml;application/rdf+xml;image/gif;image/jpeg;image/png;x-scheme-handler/http;x-scheme-handler/https;x-scheme-handler/ftp;x-scheme-handler/chrome;video/webm;application/x-xpinstall;
    StartupNotify=true
    Actions
    =NewWindow;
    到文件~/.local/share/applications/firefox.desktop, 并保存退出。
    執行:
    update-desktop-database ~/.local/share/applications/

    配好以后"System Settings -> Detail -> Default Applications -> Web" list里就會有firefox了。

    Ref: http://askubuntu.com/questions/166455/how-do-i-make-luakit-my-default-browser

    posted @ 2012-08-20 11:28 Milo的海域 閱讀(1027) | 評論 (0)編輯 收藏

    When play with eclim (eclipse style vim), i found its "LocateFile" command not work well when "invpaste" enabled in vim.
    Solution is disable it by
    " set invpaste

    posted @ 2012-08-06 14:56 Milo的海域 閱讀(264) | 評論 (0)編輯 收藏

    發現用curl從jetty服務器上download文件的速度比較慢大概只有4M/s, 開始以為curl有默認的limit-rate,設置為1G以后發現還是慢。
    然后開始懷疑是jetty server的問題??碨slSelectChannelConnector的responseBufferSize比較像,反復實驗發現原來是由于headerBufferSize太小。
    改為32K以后:
            SslSelectChannelConnector connector = new SslSelectChannelConnector();
            
            connector.setRequestBufferSize(
    32768);

    效果:
    curl -k https://USER:PASSWD@HOST:PORT/api/internal/file?filename=/path/to/file > /dest/to/file
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                                 Dload     Upload   Total   Spent     Left   Speed
    100  723M  100  723M    0     0   29.3M      0       0:00:24  0:00:24 --:--:-- 29.4M

    ref: http://wiki.eclipse.org/Jetty/Howto/Configure_Connectors

    posted @ 2012-07-18 18:22 Milo的海域 閱讀(612) | 評論 (0)編輯 收藏

    PHP curl option "CURLOPT_SSL_VERIFYPEER=false"  is same thing of '-k or --insecure' option of curl command.

    ref: http://curl.haxx.se/docs/sslcerts.html

    posted @ 2012-07-17 17:39 Milo的海域 閱讀(813) | 評論 (0)編輯 收藏

    assume gprof and gprof2dot.py, graphviz be installed.


    1. checkout memcached src code from git server
    2. sh autogen.sh & ./configure
    3. modify Makefile about CFLAGS, append option '-pg', after that do make
    4. run memcached & do some actions by telnet
    5. terminate memcached process, a gmon.out file will be generated.
    6. gprof memcached gmon.out | /usr/bin/gprof2dot.py -n0 -e0 -c bw | dot -Tpng -o memcached_callgraph.png

    posted @ 2012-07-16 18:03 Milo的海域 閱讀(333) | 評論 (0)編輯 收藏

    The scriptlets also take an argument, passed into them by the controlling rpmbuild process. This argument, accessed via $1 is the number of packages of this name which will be left on the system when the action completes, except for %pretrans and %posttrans which are always run with $1 as 0 (%pretrans and %posttrans are available in rpm 4.4 and later). So for the common case of install, upgrade, and uninstall we have:


    install upgrade uninstall
     %pretrans $1 == 0 $1 == 0 (N/A)
     %pre $1 == 1 $1 == 2 (N/A)
     %post $1 == 1 $1 == 2 (N/A)
     %preun (N/A) $1 == 1 $1 == 0
     %postun (N/A) $1 == 1 $1 == 0
     %posttrans $1 == 0 $1 == 0 (N/A)

    Scriptlets ordering

    The scriptlets in %pre and %post are respectively run before and after a package is installed.
    The scriptlets %preun and %postun are run before and after a package is uninstalled. The
    scriptlets %pretrans and %posttrans are run at start and end of a transaction.

    On upgrade
    , the scripts are run in the following order:

         %pretrans of new package
         %pre of new package
        (package install)
         %post of new package
         %triggerin of other packages (set off by installing new package)
         %triggerin of new package (if any are true)
         %triggerun of old package (if it's set off by uninstalling the old package)
         %triggerun of other packages (set off by uninstalling old package)
         %preun of old package
        (removal of old package)
         %postun of old package
         %triggerpostun of old package (if it's set off by uninstalling the old package)
         %triggerpostun of other packages (if they're setu off by uninstalling the old package)
         %posttrans of new package

    For detail, will ref:
    http://fedoraproject.org/wiki/Packaging:ScriptletSnippets

    posted @ 2012-07-06 13:41 Milo的海域 閱讀(413) | 評論 (0)編輯 收藏

    關于SQL連接查詢的圖形表示SQL連接查詢

    posted @ 2012-07-04 09:35 Milo的海域 閱讀(277) | 評論 (0)編輯 收藏

    僅列出標題
    共9頁: 上一頁 1 2 3 4 5 6 7 8 9 下一頁 
    主站蜘蛛池模板: 亚洲激情黄色小说| 久久精品国产亚洲av水果派| 亚洲av日韩综合一区二区三区| 免费阿v网站在线观看g| 亚洲一区动漫卡通在线播放| 日本免费xxxx| 亚洲精品视频在线免费| 18禁止观看免费私人影院| 亚洲精品视频观看| 成年女人免费视频播放77777 | 亚洲国产精品久久久久婷婷老年| 成人免费无码H在线观看不卡| 中文字幕亚洲图片| 无码成A毛片免费| 亚洲国产成人va在线观看网址| 亚洲国产精品免费在线观看| 亚洲色图激情文学| 国产成人涩涩涩视频在线观看免费| 无套内射无矿码免费看黄| 亚洲无码视频在线| 久久青草免费91观看| 亚洲激情校园春色| 免费的涩涩视频在线播放| www在线观看免费视频| 国产成人综合亚洲AV第一页| 97青青草原国产免费观看| 亚洲制服丝袜中文字幕| 国产日产成人免费视频在线观看| www在线观看免费视频| 亚洲黄色网站视频| 国产成人aaa在线视频免费观看| 国产大片免费天天看| 亚洲国产精品第一区二区| 在线免费观看一级毛片| 精品国产呦系列在线观看免费| 亚洲欧洲日韩不卡| 国产成人免费片在线视频观看| 国产在线观看免费视频软件 | 亚洲成aⅴ人在线观看| 国产乱子伦精品免费无码专区| 热久久这里是精品6免费观看|