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

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

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

    posts - 11,  comments - 21,  trackbacks - 0

    使用eclipse的nodejs的插件,右鍵運行app.js,控制臺一閃而過,沒有啟動起來.

    通過搜索,發(fā)現(xiàn)原來是JDK版本的問題,我用的是JDK6,不好使,使用JDK7就好使了.

    如果有多個JDK版本共存,可以使用在eclipse安裝目錄下的文件eclipse.ini指定要使用的JDK:

    -vm
    C:/Program Files/Java/jdk1.7.0_55/bin/javaw.exe

    posted @ 2014-04-25 03:52 xmlspy 閱讀(222) | 評論 (0)編輯 收藏

    很多人在安裝完Eclipse之后什么都不設置,直接用默認的設置,默認的設置有很多問題。
    在項目管理中應該統(tǒng)一Eclipse的設置。

    通過菜單Window->Preferences打開設置窗口。

    • General->Editors->Text Editors:
      選上Insert spaces for tabs : 縮進使用空格,不使用Tab.原因是當把代碼復制給網(wǎng)絡上的顯示的時候,
      Tab經(jīng)常會被刪除,導致格式完全亂套.
      選上Show line numbers : 顯示行號,這個在debug的時候快速定位非常方便.
      選上Show print margin,然后在下面的Print margin column輸入框中輸入120 : 顯示一條豎線,
      用于標示打印機打印時的寬度.這里用于代碼自動換行的寬度. 設置為120個字符.這個同樣在Java
      代碼格式化的時候用到,后繼會說到.
      Y3RDP4``Q@][2]JX]3DYVA7[4]
    • General->Workspace
      在Text file encoding中選擇Other,然后在下拉框中選UTF-8 : 這樣所有項目都是用UTF-8編碼.默認的是GBK.
    • Java->Code Style->Formatter
      這里是Java代碼格式化相關的選項, 要修改默認的設置,需要新建一個配置.

      點擊按鈕 New… 在彈出框中的 Profile name 輸入框輸入新配置的名稱,這里輸入 11, 然后點擊OK按鈕.
      在新彈出的配置窗口中,選擇標簽Indentation, 在Tab policy下拉框中選擇 Spaces only : 縮進使用空格.
      這里需要注意,如果在General->Editors->Text Editors中選擇了Insert spaces for tabs, 而在格式化選項中
      沒有改成使用空格,那么在Java代碼格式化后,仍然使用Tab.

      選擇標簽 Line Wrapping,在Maximum line width輸入框輸入120 : 在120個字符后換行, 上面的 Print margin column
      也用的120,這樣就知道換行的標示了.

    其他如果有Editor的地方,縮進也都要改成4個空格. 比如: Web節(jié)點下面的CSS Files, HTML Files.

    posted @ 2013-11-17 15:32 xmlspy 閱讀(2714) | 評論 (2)編輯 收藏

    使用這個東西的好處是,可以發(fā)布到多個Blog上,免得使用Web編輯器苦逼地編輯.

    下載地址: http://windows.microsoft.com/zh-cn/windows-live/essentials-other#essentials=overviewother

    * 使用Live Writer在oschina上寫B(tài)log: http://my.oschina.net/javayou/blog/39107

    * 使用Live Writer在BlogJava上鞋Blog: http://www.tkk7.com/vulcan/archive/2010/11/05/337323.html

    注意:  - 在日志類型中選擇Metaweblog API

              - API連接為: http://www.tkk7.com/你的blog名稱/services/metaweblog.aspx

    posted @ 2013-10-02 22:46 xmlspy 閱讀(228) | 評論 (0)編輯 收藏

    更新了最新Android ADT工具后,出現(xiàn) TypeError: argument of type 'NoneType' is not iterable.

    O{J4%Z8HX[DQ%ORWFHNWGUC

    解決:

        復制 build-tool/17.0.0/ 下所有內(nèi)容到 platform-tools 目錄下.

    參考:

    https://developer.appcelerator.com/question/152497/titanium-sdk-310-error-typeerror-argument-of-type-nonetype-is-not-iterable-on-building-android-app

    posted @ 2013-05-31 09:05 xmlspy 閱讀(588) | 評論 (0)編輯 收藏

    有時候Titanium中的終端會顯示:

    This Terminal Emulator is not functional because no 'bash' shell could be found.
    
    Please correct the problem and restart the IDE.

    解決辦法:

    • Team / Git / Git Executable (was empty)   --指定正確的git.exe文件位置
    • Titanium Studio / NodeJS / Node Executable (was empty also) ---- 指定NodeJS的node.exe的位置

     

    然后重啟終端就好了.

    posted @ 2013-05-30 19:33 xmlspy 閱讀(220) | 評論 (0)編輯 收藏

    1.目的

    在WebView控件中,如果頁面中調(diào)用了javascript腳本console.log 方法,就調(diào)用一個Java方法.

     

    2.默認實現(xiàn)方法

    在Android的WebView控件中,有一個setChromeClient(WebChromeClient)方法,

    此方法的參數(shù)是WebChromeClient對象,通過重載此對象中的onConsoleMessage方法就

    可以達到此目的.看代碼:

    WebView webView = new WebView();
    webView.setWebChromeClient(new DefaultWebChromeClient);
    
    // 以上代碼放在在Activity或則Fragment中的onCreate方法中
    
    private class DefualtWebChromeClient extends WebChromeClient {
        @Override
        public boolean onConsoleMessage(ConsoleMessage consoleMessage) {
            String message = consoleMessage.message();
            int lineNumber = consoleMessage.lineNumber();
            String sourceID = consoleMessage.sourceId();
            String messageLevel = consoleMessage.message();
    
            Log.i("[WebView]", String.format("[%s] sourceID: %s lineNumber: %n message: %s",
                    messageLevel, sourceID, lineNumber, message));
    
            return super.onConsoleMessage(consoleMessage);
        }
    
        @Override
        public void onConsoleMessage(String message, int lineNumber, String sourceID) {
            Log.i("[WebView]", String.format("sourceID: %s lineNumber: %n message: %s", sourceID,
                    lineNumber, message));
            super.onConsoleMessage(message, lineNumber, sourceID);
        }
    }

    第一個方法onConsoleMessage(ConsoleMessage consoleMessage)是新版本的android才有的方法,第二個方法是舊版本的.

    第二個方法已經(jīng)不推薦使用了,但是在舊版本的android中,仍然需要此方法.所以最好兩個方法都實現(xiàn).

     

    3.問題

    默認的實現(xiàn)在某些版本的手機中不好使,onConsoleMessage方法死活不被調(diào)用

     

    4.解決方案

    使用WebView的addJavascriptInterface方法:

    // 首先,定一個類,叫什么名稱都可以,但是里面的方法名必須與
    // Javascript的console中的方法名對應
    private class Console{
        private static final String TAG="[WebView]";
        public void log(String msg){
            Log.i(TAG,msg);
        }
    	// 還可以添加其他的方法,比如: warn,assert等等
    }
    
    // 然后,為WebView添加對應的接口
    webView.addJavascriptInterface(new Console, "console");

     

    這個解決方案有一個不好的地方,就是輸出的內(nèi)容沒有onConsoleMessage方法那么詳細,比如行號,就沒法輸出.

    所以,我們應該在onConsoleMessage好使的時候使用onConsoleMessage,不好使的時候在使用我們自定義的方式.

    那么,如何來判斷onConsoleMessage是否好使呢? 我們可以在程序初始化的時候,先在WebView中運行一下console.log,

    如果onConsoleMessage運行了,就添加一個標記,表示默認的實現(xiàn)是好使的.

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        // 這些代碼也可以放到onCreate方法中
    	
        this.webView = (WebView) layout.findViewById(R.id.webview);
        WebSettings webSettings = webView.getSettings();
        webSettings.setJavaScriptEnabled(true);
        
        // Set WebChromeClient
        WebChromeClient webChromeClient = new TestConsoleMessageWebChromeClient();
    	// 先執(zhí)行console.log,測試是否調(diào)用了onConsoleMessage
        webView.loadUrl("javascript:console.log('testConsoleMessage')");
    	
        if (((TestConsoleMessageWebChromeClient)webChromeClient).isConsoleMessageOK()){
    	    // 這里額外使用了一個新的類 TestConsoleMessageWebChromeClient
    		// 如果不適用TestConsoleMessageWebChromeClient,就需要在
    		// DefaultWebChromeClient中添加標記字段 consoleMessageOK,
    		// 這樣如果方法onConsoleMessage好使,那么每次都給consoleMessageOK賦值,
    		// 這個有些多余,也影響性能.
            webChromeClient = new DefualtWebChromeClient();
        }else{
    	    // onConsoleMessage不好使,就使用這種方式,第二個參數(shù)值必須是"console"
            webView.addJavascriptInterface(new Console(), "console");
        }
        
        webView.loadUrl("http://www.baidu.com");
    
        return super.onCreateView(inflater, container, savedInstanceState);
    }
    
    // 當默認的onConsoleMessage不好使的時候使用的類
    private class Console {
        private static final String TAG = "[WebView]";
    
        public void log(String msg) {
            Log.i(TAG, msg);
        }
    	// 這里還可以添加其他方法console對象中有的方法,比如 assert
    }
    
    // 默認
    private class DefualtWebChromeClient extends WebChromeClient {
        @Override
        public boolean onConsoleMessage(ConsoleMessage consoleMessage) {
            String message = consoleMessage.message();
            int lineNumber = consoleMessage.lineNumber();
            String sourceID = consoleMessage.sourceId();
            String messageLevel = consoleMessage.message();
    
            Log.i("[WebView]", String.format("[%s] sourceID: %s lineNumber: %n message: %s",
                    messageLevel, sourceID, lineNumber, message));
    
            return super.onConsoleMessage(consoleMessage);
        }
    
        @Override
        public void onConsoleMessage(String message, int lineNumber, String sourceID) {
            Log.i("[WebView]", String.format("sourceID: %s lineNumber: %n message: %s", sourceID,
                    lineNumber, message));
            super.onConsoleMessage(message, lineNumber, sourceID);
        }
    }
    
    // 用于測試onConsoleMessage是否調(diào)用的類
    private class TestConsoleMessageWebChromeClient extends WebChromeClient {
        private boolean consoleMessageOK = false;
    
        @Override
        public boolean onConsoleMessage(ConsoleMessage consoleMessage) {
            this.consoleMessageOK = true;
            return super.onConsoleMessage(consoleMessage);
        }
    
        @Override
        public void onConsoleMessage(String message, int lineNumber, String sourceID) {
            this.consoleMessageOK = true;
            super.onConsoleMessage(message, lineNumber, sourceID);
        }
    
        public boolean isConsoleMessageOK() {
            return this.consoleMessageOK;
        }
    }
    
    posted @ 2013-04-28 01:46 xmlspy 閱讀(3022) | 評論 (0)編輯 收藏

    匿名立即執(zhí)行函數(shù)

       1:  // 方式一,這種方式多用了一個括號,看著別扭
       2:  (function(param) {
       3:      alert(param);
       4:  })(10);
       5:   
       6:  // 方式二,使用 ! 操作符
       7:  !function(param) {
       8:      alert(param);
       9:  }(10);

    使用匿名立即執(zhí)行函數(shù)的好處是,可以避免變量沖突.

    條件判斷

       1:  //========================= 條件判斷
       2:  var sabiable = true;
       3:  //普通方式
       4:  if (sabiable) {
       5:      alert('You are sability!');
       6:  }
       7:   
       8:  //詭異方式,利用 ||和 && 操作符
       9:  // a||b : 只有在a為fasle或者返回false時才會執(zhí)行b,當a為true時,直接返回a,后面的b不會執(zhí)行
      10:  // a&&b : 只有在a為true或者返回true時才會執(zhí)行b,當a為時,直接返回a,后面的b不會執(zhí)行
      11:   
      12:  // 上面的代碼可以改為:
      13:  sabiable && alert('You are sability!');
    posted @ 2013-04-01 06:57 xmlspy 閱讀(201) | 評論 (0)編輯 收藏

    問題: 以下代碼,tab1的click事件在Android中生效,在iOS不生效

       1:  function ApplicationTabGroup(Window) {
       2:      //create module instance
       3:      var self = Ti.UI.createTabGroup();
       4:   
       5:      //create app tabs
       6:      var win1 = new Window(L('home')), win2 = new Window(L('settings'));
       7:   
       8:      var tab1 = Ti.UI.createTab({
       9:          title : L('home'),
      10:          icon : '/images/KS_nav_ui.png',
      11:          window : win1
      12:      });
      13:      win1.containingTab = tab1;
      14:   
      15:      var tab2 = Ti.UI.createTab({
      16:          title : L('settings'),
      17:          icon : '/images/KS_nav_views.png',
      18:          window : win2
      19:      });
      20:      win2.containingTab = tab2;
      21:   
      22:      self.addTab(tab1);
      23:      self.addTab(tab2);
      24:   
      25:      tab1.addEventListener('click',function(){
      26:          //這個事件在iOS中不會被觸發(fā)
      27:      });
      28:   
      29:      return self;
      30:  };
      31:   
      32:  module.exports = ApplicationTabGroup;

    解決方案:

    通過看Titanium附帶的示例程序 Kitcken Sink , 找到了解決方案.

    為TabGroup添加focus事件,然后對事件參數(shù)進行判斷,來確定當前被點擊的是那個tab.

     

       1:  function ApplicationTabGroup(Window) {
       2:      //create module instance
       3:      var self = Ti.UI.createTabGroup();
       4:   
       5:      //create app tabs
       6:      var win1 = new Window(L('home')), win2 = new Window(L('settings'));
       7:   
       8:      var tab1 = Ti.UI.createTab({
       9:          title : L('home'),
      10:          icon : '/images/KS_nav_ui.png',
      11:          window : win1
      12:      });
      13:      win1.containingTab = tab1;
      14:   
      15:      var tab2 = Ti.UI.createTab({
      16:          title : L('settings'),
      17:          icon : '/images/KS_nav_views.png',
      18:          window : win2
      19:      });
      20:      win2.containingTab = tab2;
      21:   
      22:      self.addTab(tab1);
      23:      self.addTab(tab2);
      24:   
      25:      self.addEventListener('focus', function(e) {
      26:   
      27:          var info = Titanium.API.info;
      28:   
      29:          // 在iOS中, e.source 是 TabGroup對象,
      30:          // 在Android中,e.source 是 Tab對象
      31:          var src = e.source;
      32:          var tab = e.tab;
      33:          var preTab = e.previousIndex;
      34:   
      35:          // e.tab 是當前獲得焦點的tab
      36:          // e.index 當前獲得焦點的tab的索引,首次為-1
      37:          // e.previousTab 上個tab
      38:          // e.previousIndex 上個tab的索引,首次為null
      39:   
      40:          // On iOS, the "More..." tab is actually a tab container, not a tab. When it is clicked, e.tab is undefined.
      41:          if (!tab) {
      42:              info('在iOS中點擊了"More..."');
      43:              return;
      44:          }
      45:   
      46:          // 首次
      47:          if (!preTab) {
      48:              info('首次進入');
      49:              return;
      50:          }
      51:   
      52:          if (tab === tab1) {
      53:              info('點擊了tab1');
      54:          } else if (tab === tab2) {
      55:              info('點擊了tab2');
      56:          }
      57:      });
      58:   
      59:      return self;
      60:  };
      61:   
      62:  module.exports = ApplicationTabGroup;
    posted @ 2013-03-31 02:54 xmlspy 閱讀(239) | 評論 (0)編輯 收藏

    以下的插件都可以使用Eclipse Marketplace進行查找,安裝.

     

    1. AnyEdit Tools 
      介紹地址: http://marketplace.eclipse.org/content/anyedit-tools#.UQLITyd6OTU
      更新地址: http://andrei.gmxhome.de/eclipse/

      在更新地址中Eclipse3.5-4.2版本的分支里,沒有找到AnyEdit Tools,
      使用Eclipse Marketplace在里面查找anyedit,之后點擊Install按鈕可以安裝.
    2. Eclipse Explorer
      介紹: 主要用于 在操作系統(tǒng)資源管理器打開文件夾. 可以避免以下啰嗦操作:
              在資源上點擊右鍵然后選擇屬性,然后在復制資源的系統(tǒng)路徑,然后打開系統(tǒng)資源管理器,復制地址,回車…
    3.   Eclipse Color Theme
      介紹: 各種定義好的編輯器代碼顏色模版.
    4.   Java Source Attacher Feature
      介紹: 可以幫助你查找你的jar包的源碼, 這樣在Java編輯器中點擊ctrl+右鍵就可以查看jar包對應類的源碼了,
              如果找不到會彈出對話框讓你手動指定.
              這個非常有用,在做Android開發(fā)時, Android插件不允許你通過在jar上點擊右鍵->Attach source,
              搞得好多jar包都無法實時查看方法的注釋,使用這個插件就可以了.
    5.   Eclipse EGit
      介紹: git的Eclipse插件.
    6. Advanced Prototyping tool - Prototyper Free Edition 2.1 (在Marketplace中搜索 Prototyper)
      介紹: 非常好用的 手機、平板、桌面應用和網(wǎng)站的原型設計工具,幾乎支持現(xiàn)在市面上所有類型的手機、平板,如: iPhone、iPad、
               Android、BlackBerry、WindowsPhone等等。并且有大量可下載的模版和Widget。拖拖拽拽就可以做出原型。
               TM截圖未命名

              其實這個不是Eclipse的插件,至少在Marketplace中找到后,無法直接安裝的.不過可以進入頁面中提供的主頁鏈接
              到這個工具的網(wǎng)站下載.
      網(wǎng)站地址: http://www.justinmind.com/
    posted @ 2013-01-26 03:15 xmlspy 閱讀(1939) | 評論 (0)編輯 收藏

    一安裝插件eclipse就提示
    ?? Properties Search for Eclipse 3.1.x (2.0.0) requires plug-in "org.eclipse.search (3.1.0)", or equivalent.

    靠,搞得我什么插件都安裝不了 :(
    ??

    posted @ 2006-12-13 19:46 xmlspy 閱讀(3277) | 評論 (3)編輯 收藏
    僅列出標題  下一頁

    <2025年5月>
    27282930123
    45678910
    11121314151617
    18192021222324
    25262728293031
    1234567

    常用鏈接

    留言簿(2)

    隨筆分類

    隨筆檔案

    文章分類

    文章檔案

    搜索

    •  

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 亚洲国产精品SSS在线观看AV| 亚洲JIZZJIZZ中国少妇中文| 亚洲天堂中文资源| 三年片免费高清版| 久久久久无码精品亚洲日韩| 日韩免费无码一区二区三区 | av免费不卡国产观看| 亚洲美女aⅴ久久久91| 99久久99这里只有免费费精品 | 亚洲精品无码专区在线| 日本无吗免费一二区| 亚洲精华国产精华精华液好用| 日韩中文无码有码免费视频| 亚洲AV无码一区二区乱子仑| 在线免费观看亚洲| 国产高清不卡免费在线| 中文字幕亚洲男人的天堂网络| 大学生一级特黄的免费大片视频| 国产亚洲综合视频| 亚洲国产无套无码av电影| 2021国内精品久久久久精免费| 亚洲国产区男人本色在线观看| 四虎影视免费永久在线观看| 国产成人精品免费视频大全| 亚洲第一精品福利| 成全高清视频免费观看| av成人免费电影| 亚洲国产成人无码av在线播放| 国产麻豆免费观看91| 国产男女爽爽爽免费视频| 亚洲熟妇无码爱v在线观看| 永久免费看mv网站入口| 91在线视频免费观看| 亚洲无吗在线视频| 亚洲精品动漫人成3d在线| 久久国产乱子伦精品免费一| 亚洲精品无码成人| 久久精品国产亚洲AV网站| 日韩黄色免费观看| 91成人在线免费视频| 边摸边吃奶边做爽免费视频网站|