<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在线电影网| 久久91亚洲精品中文字幕| 四虎影视大全免费入口| 18禁在线无遮挡免费观看网站| 亚洲资源最新版在线观看| 亚洲无码精品浪潮| 免费人成视频在线| 波多野结衣免费一区视频 | 亚洲狠狠婷婷综合久久蜜芽| 亚洲精品无码av人在线观看| 国产电影午夜成年免费视频| www在线观看播放免费视频日本| 亚洲国产精品美女| 亚洲一区二区三区在线观看精品中文| 免费a级毛片高清视频不卡| 好吊色永久免费视频大全| 亚洲日本va一区二区三区| 久久夜色精品国产噜噜噜亚洲AV| 亚洲Av无码乱码在线znlu| 久久不见久久见中文字幕免费| 久久精品电影免费动漫| 国产视频精品免费视频| 国产精品亚洲专区无码WEB| 亚洲色图视频在线观看| 亚洲人成伊人成综合网久久久| 在线免费视频一区二区| **实干一级毛片aa免费| 最新亚洲成av人免费看| 免费国产在线精品一区 | 国产成人精品免费午夜app| 中文字幕av无码不卡免费 | 成人免费无码视频在线网站| 久操视频免费观看| 中文字幕a∨在线乱码免费看| 一级视频免费观看|