2016年5月24日 星期二

Context - Android

參考:Context都沒弄明白,還怎麼做Android開發?


/**
 * Interface to global information about an application environment.  This is
 * an abstract class whose implementation is provided by
 * the Android system.  It
 * allows access to application-specific resources and classes, as well as
 * up-calls for application-level operations such as launching activities,
 * broadcasting and receiving intents, etc.
 */
public abstract class Context {
    /**
     * File creation mode: the default mode, where the created file can only
     * be accessed by the calling application (or all applications sharing the
     * same user ID).
     * @see #MODE_WORLD_READABLE
     * @see #MODE_WORLD_WRITEABLE
     */


凡是跟UI相關的,都應該使用Activity做為Context來處理

2016年5月20日 星期五

Chrome run Android app ! ?


參考:免模擬器!直接用 Chrome 在電腦跑 Android App!

[ 環境預備 ]
1. 下載 ARChon Custom Runtime
2. 在 Android 安裝 ARChon Packager (Google Play) 或 bpear96/ARChon-Packager
3. 在 Android 執行 ARChon Package ,選擇目標 app ,作出來的檔案會在  /sdcard/ChromeAPKS 的目錄中,AppName.zip

[ 安裝方式 ]
1. 解壓縮 ARChon Custom Runtime ,會是像 vladikoff-archon-6ad1d59d5f1a 的資料夾

2. 在Chrome的網址列輸入 chrome://extensions
勾選「開發人員模式」,並選擇「載入未封裝的擴充功能」,然後將路徑指到步驟1的資料夾


3. 將 AppName.zip 解壓縮,一樣選擇「載入未封裝的擴充功能」,然後將路徑指到 AppName 解完壓縮的資料夾 (有 _locales, vendor 資料夾的上一層)

4. 在Chrome的網址列輸入chrome://apps,就可以看到App圖示。

5. 不一定可以執行
註:FMX 作的 PSC.app 就不能執行

[ twerk ] 將 Android APP (APK 檔案) 包裝成 Chrome 瀏覽器外掛

2016年5月17日 星期二

HTML 常用備忘


[電腦] 特殊字元 HTML 編碼對照表

因為這些是特殊符號,在 html 裡面,要用下列方式代替

  • And 符號 ' & ' (ampersand) becomes '&'
  • 雙引號 ' " ' (double quote) becomes '"'
  • 單引號' ' ' (apostrophe/single quote) becomes '''
  • 小於符號' < ' (less than) becomes '&lt;'
  • 大於符號' > ' (greater than) becomes '&gt;'
  • 空白符號 ' ' (no-break space) becomes '&nbsp;'
常用標籤:
<p>分段
<br /> break 換行 

2016年5月16日 星期一

Blogger 如何設定 Syntaxhighlighter 讓程式碼更容易讀

「我的網誌」管理頁面 > 範本 > 編輯 HTML
在 </head> 的上面,加入這個部分的程式碼,然後按儲存範本

<!-- BEGIN SyntaxHighlighter BEGIN -->
<link href='http://alexgorbatchev.com/pub/sh/current/styles/shCore.css' rel='stylesheet' type='text/css'/>
<link href='http://alexgorbatchev.com/pub/sh/current/styles/shThemeDefault.css' rel='stylesheet' type='text/css'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushAppleScript.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushAS3.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushBash.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushColdFusion.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushCpp.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushCSharp.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushCss.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushDelphi.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushDiff.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushErlang.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushGroovy.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJava.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJavaFX.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJScript.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPerl.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPhp.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPlain.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPowerShell.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPython.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushRuby.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushSass.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushScala.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushSql.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushVb.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushXml.js' type='text/javascript'/>
<script language='javascript' type='text/javascript'>
 SyntaxHighlighter.config.bloggerMode = true;
 SyntaxHighlighter.defaults['auto-links'] = false;
 SyntaxHighlighter.defaults['toolbar'] = false;
 SyntaxHighlighter.all();
</script>
<style type="text/css">
  .syntaxhighlighter { 
     overflow-y: hidden !important; 
     overflow-x: auto !important; 
  }
</style>
<!-- END SyntaxHighlighter END -->


使用方式,在編輯 html 時,加入
<pre class="brush:cpp;" name="code">
程式碼...
</pre>
cpp 可改成對應的語言
我第一次設定時,程式碼排版異常,最後是把範本砍掉重練,然後照上述方式再次設定,才 OK

使用注意事項:https://github.com/syntaxhighlighter/syntaxhighlighter/wiki/Usage
轉換 html 網站:http://accessify.com/tools-and-wizards/developer-tools/quick-escape/default.php