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

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

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

    West Farm
    吾本布衣,生于川北,躬耕于代碼的田地上。
    posts - 16,  comments - 15,  trackbacks - 0
    天天冒出一堆新的東西!讓人不知所措。

    舉個例子:jquery - angular - react - vue

    這語言真的有毒。

    如今的硬件,恐怕在瀏覽器中實現(xiàn)強類型語言JAVA來作為腳本語言都不比JS弱吧,哎真替applet感到冤枉。

    老夫一直就覺得,瀏覽器一直是一個很奇葩的東西,HTML+CSS+JS本身,難道不能發(fā)明一種語言通過HTTP傳輸,然后直接調(diào)用OS級別的UI來渲染不就完了嗎?

    網(wǎng)頁能實現(xiàn)的界面,我不信用操作系統(tǒng)的UI組件做不出來。
    posted @ 2018-04-01 00:19 West Farmer 閱讀(170) | 評論 (0)編輯 收藏
    原文地址:https://weblogs.java.net/blog/pat/archive/2004/10/stupid_scanner_1.html

    正則表達式中,\A是指一個字符串的開頭,可能大家用慣了^,而忽略了這個\A, 但是^其實是指一行的開始,而不管一個字符串里面包含多少行,\A都只匹配第一行的開頭。
    那么我們可以用
    \A做點什么呢?,看下面這個例子:
    static String convertStreamToString(java.io.InputStream is) {
        java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
        return s.hasNext() ? s.next() : "";
    }
    相信大家都看懂了,用\A作為分隔符,那么得到的當然就只有一個token,那就是整個字符串了。再配合Scanner,就輕易的將一個輸入流轉(zhuǎn)換為一個字符串了。
    注意當需要做編碼轉(zhuǎn)換時,Scanner是有支持編碼參數(shù)的構(gòu)造方法的。
    posted @ 2013-11-28 09:38 West Farmer 閱讀(1015) | 評論 (0)編輯 收藏
         摘要: Gson is library created by google guys, it is used for java bean to json serialization/deserialization. Gson can serialize any java bean, collection, map to json, and don't need to care about the...  閱讀全文
    posted @ 2013-11-22 19:22 West Farmer 閱讀(5323) | 評論 (3)編輯 收藏
    If we observe a property of SWT controls, and bind it to another observable value, you must take care of those method calls which will change the property indirectly.
    for example, we have a Combo whose "text" property is bound to a bean's "name" property like this:
    IObservableValue nameObservable = BeansObservables.observeDetailValue(obserabedDriverProfile, "name", String.class);

    ISWTObservableValue nameComboObservable = SWTObservables.observeText(driverClassCombo);

    bindingContext.bindValue(nameComboObservable , nameObservable, new UpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE), null);

    The variable "obserabedDriverProfile" is a observed selection in a ListViewer, it's in a master-detail scenario. If we add some code like this:
    obserabedDriverProfile.addValueChangeListener(new IValueChangeListener(){

                @Override
                public void handleValueChange(ValueChangeEvent event) {
                    DriverProfile dp = (DriverProfile)event.diff.getNewValue();
                    driverClassCombo.removeAll();
                    driverClassCombo.add(dp.getName();
                    driverClassCombo.setText(driverClassCombo.getItem(0));
                }
                
            });
    every time you change the selection in the ListViewer,  the selected bean's "name" property will be set to a empty string. Why?  The removeAll method of Combo will clear it's text, and combo's "text" property is bound to selected bean's "name" property. So, the right way is:
    obserabedDriverProfile.addValueChangeListener(new IValueChangeListener(){

                @Override
                public void handleValueChange(ValueChangeEvent event) {
                    DriverProfile dp = (DriverProfile)event.diff.getNewValue();
                    String name = dp.getName;
                    driverClassCombo.removeAll();
                    driverClassCombo.add(name);
                    driverClassCombo.setText(driverClassCombo.getItem(0));
                }
                
            });
    posted @ 2013-04-14 15:24 West Farmer 閱讀(251) | 評論 (0)編輯 收藏
    本文用英文寫的,主要是考慮到本文分享的內(nèi)容即使在google上也搜索不到(至少我是沒有搜索到)。

    My English is at a very low level, don't care about this fact, just focus on the idea shared here.

    The idea comes from the source code of ConfigurationElement which is located in package org.eclipse.core.internal.registry, If you read through the source code, you can also get it. But I found there is no documentation about this topic, so I wrote this.

    Sometimes we need to contribute java class to a extension point. And we can use ConfigurationElement#
    createExecutableExtension(String attributeName) to create an instance of it, if such a class is just a normal class, eclipse will  call class#newInstance(). But there is obvious restriction for using this approach, can't pass parameter in to create instance for example.

    There are three different way how eclipse create instance of your class.

    1. normal, call class#newInstance()
    2. if your calss implements IExecutableExtension interface, IExecutableExtension#setInitializationData(IConfigurationElement config, String propertyName, Object data) will be called on the instance returned by class#newInstance()
    3. if your calss implements IExecutableExtensionFactory interface, IExecutableExtensionFactory#create() will be called

    When you use the second method or the third method, you can pass in parameters, check the source code of ConfigurationElement, you will know how to do that. :D forgive me, I'm lazy. 
    posted @ 2012-04-15 16:33 West Farmer 閱讀(329) | 評論 (0)編輯 收藏

    <2012年4月>
    25262728293031
    1234567
    891011121314
    15161718192021
    22232425262728
    293012345

    常用鏈接

    留言簿

    隨筆分類

    隨筆檔案

    相冊

    搜索

    •  

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 亚洲色av性色在线观无码| 一本色道久久88亚洲精品综合 | 免费影院未满十八勿进网站| 在线看片人成视频免费无遮挡| 国产国拍亚洲精品福利 | 亚洲国产精品VA在线看黑人| 亚洲成a∧人片在线观看无码| 无码精品一区二区三区免费视频 | 日韩色视频一区二区三区亚洲| 999任你躁在线精品免费不卡| 亚洲成a人片在线播放| 亚洲人成77777在线播放网站不卡 亚洲人成77777在线观看网 | 99在线热视频只有精品免费| 97亚洲熟妇自偷自拍另类图片| 色www免费视频| 性xxxx视频播放免费| 亚洲A∨精品一区二区三区下载| 亚洲国产精品免费观看| 久久亚洲精品国产精品婷婷 | 国产高清在线免费视频| 亚洲色成人网一二三区| 青青视频观看免费99| 欧美亚洲精品一区二区| 中文亚洲AV片不卡在线观看| 免费人成大片在线观看播放电影| 成人性生活免费视频| 亚洲an日韩专区在线| 亚洲视频免费观看| 亚洲国产老鸭窝一区二区三区| 久久国产乱子伦精品免费午夜| 内射无码专区久久亚洲| 老妇激情毛片免费| 亚洲AV日韩精品久久久久久| 免费国产成人午夜在线观看| 亚洲国产精品成人精品无码区| 2021久久精品免费观看| 亚洲H在线播放在线观看H| 亚洲AV之男人的天堂| 5555在线播放免费播放| 四虎影视久久久免费观看| 亚洲一区二区三区在线观看精品中文|