李順利
          隨筆-50  評論-170  文章-0  trackbacks-0

          程序員的第一篇博客,一般都是Hello World,我也習俗下。

          以下用幾種方式(Octopress)來貼HelloWorld的代碼

          • Backtick Code Blocks
          HelloWorld.java
          1
          2
          3
          4
          5
          6
          7
          8
          9
          
          /**
           *
           * @author ShunLi
           */
            public class HelloWorld {
            public static void main(String[] args) {
                System.out.println("Hello World!");
            }
          }
          
          • Include Code Snippets
          (HelloWorld.java)download
          1
          2
          3
          4
          5
          6
          7
          8
          9
          
          /**
           *
           * @author ShunLi
           */
          public class HelloWorld {
              public static void main(String[] args) {
                  System.out.println("Hello World!");
              }
          }
          
          • Gist Embedding
          • Inline Code Blocks
          1
          2
          3
          4
          5
          6
          7
          8
          9
          
          /**
           *
           * @author ShunLi
           */
            public class HelloWorld {
            public static void main(String[] args) {
                System.out.println("Hello World!");
            }
          }
          

          B.T.W. 我以后應該比較常用Backtick code blocks 和 Include code sinipets.

          P.S. 悲催地體驗——在Windows下安裝Octopress

          在Windows下體驗Ruby,真的是一件很痛苦的事情,有打算遷移到Ubuntu環境了。 這里記錄下載Windows下安裝Octopress的步驟,有些真是很痛苦。

          • 安裝 ruby 
            如果你不怕麻煩的話,可以選擇裝ruby+Devkit(Devkit也要安裝不然在bundle install這步附近應該會有問題),Windows下安裝ruby可以通過RubyInstaller(不過好像經常需要翻Wall過去才能打開),更方便地方法是直接通過
            railsinstaller 來安裝,里面包括很多需要的工具。

          • 安裝 python 這個真的需要,ruby核心部分有用到。如果沒有安裝Python的話,在Octopress的代碼高亮(include_code 等)部分可能會出現問題: 
            比如:

          1
          2
          3
          
          Liquid error: No such file or directory - python -c import sys; print sys.executable
          # or
          Liquid error: undefined method `Py_IsInitialized’ for RubyPython::Python:Module
          

          請先安裝 python-xxx.msi,然后把python home(e.g. C:\Python27)加到windows環境變量下 
          請注意,一定要把python home加到windows環境變量下。

          如果還不行的話,請參考這個issue,應該能夠解決。

          • 安裝octopress 
            這個官網已經有介紹了,應該比較簡單。

          • 中文問題
            Windows下如果有中文的話,在generate步驟就會失敗,網上給出的解決方法也很簡單,就是設置自己本機的環境變量 
             
            具體的就是這樣設置的

          1
          2
          
          set LC_ALL=zh_CN.UTF-8
          set LANG=zh_CN.UTF-8
          
          • 還有一個問題 
            對有序序列支持不好,我已經提了一個
            bug了。

          • 就請歡樂地擁抱Octopress/Jekyll吧。

          后記

          Octopress 重裝記

          1. 參考本文 ,安裝ROR,Python并配置好環境配置(中文編碼、python)
          2. git clone git@github.com:lishunli/lishunli.github.com.git (change it by yourself)
          3. git checkout source
          4. bundle install or bundle update
          5. rake setup_github_pages
          6. rake generate, rake preview, rake deploy
          7. rake new_post[“title”] 新建的文章默認是ANSI編碼的,這會導致generate步驟失敗,請轉換為UTF-8格式的文件后重新來過,如果還有問題,嘗試其它的解決辦法。

          順利更新于2012年12月17日



          博客中的一些下載已經放到了百度云了,請根據需要下載。【點我去百度云下載】

          最后弱弱地說一下,如果可以的話,轉載請提供出處( ),謝謝。
          posted on 2012-03-18 00:04 李順利 閱讀(7968) 評論(3)  編輯  收藏

          評論:
          # re: 試用Octopress 2012-03-18 11:43 | 李順利
          @tb
          我知道,我只是寫一些我自己使用過程中的一些問題,在Windows下,有太多問題了。  回復  更多評論
            
          # re: 試用Octopress 2012-03-18 13:57 | liang
          不錯  回復  更多評論
            
          # rake deploy 錯誤 2013-07-30 11:44 | abdong
          d:\GitHub>git clone git://github.com/imathis/octopress.git abdong.github.com
          Cloning into 'abdong.github.com'...
          remote: Counting objects: 10661, done.
          remote: Compressing objects: 100% (5052/5052), done.
          remote: Total 10661 (delta 5434), reused 9941 (delta 4748)
          Receiving objects: 100% (10661/10661), 2.58 MiB | 39.00 KiB/s, done.
          Resolving deltas: 100% (5434/5434), done.

          d:\GitHub>cd abdong.github.com


          d:\GitHub\abdong.github.com>gem install bundler
          Successfully installed bundler-1.3.5
          1 gem installed
          Installing ri documentation for bundler-1.3.5...
          Installing RDoc documentation for bundler-1.3.5...

          d:\GitHub\abdong.github.com>bundle install
          Fetching source index from http://ruby.taobao.org/


          d:\GitHub\abdong.github.com>rake setup_github_pages
          Enter the read/write url for your repository
          (For example, 'git@github.com:your_username/your_username.github.io)
          or 'https://github.com/your_username/your_username.github.io')
          Repository url: git@github.com:abdong/abdong.github.com.git
          Added remote git@github.com:abdong/abdong.github.com.git as origin

          d:\GitHub\abdong.github.com>rake install

          d:\GitHub\abdong.github.com>rake new_post["第一篇博客"]

          d:\GitHub\abdong.github.com>rake generate


          d:\GitHub\abdong.github.com>rake preview


          d:\GitHub\abdong.github.com>rake deploy
          ## Deploying branch to Github Pages
          ## Pulling any updates from Github Pages
          cd _deploy
          ERROR: Repository not found.
          fatal: Could not read from remote repository.

          Please make sure you have the correct access rights
          and the repository exists.
          cd -
          rm -rf _deploy/index.html

          ## Copying public to _deploy
          cp -r public/. _deploy
          cd _deploy

          ## Commiting: Site updated at 2013-07-30 02:49:26 UTC
          [master 37e047c] Site updated at 2013-07-30 02:49:26 UTC
          61 files changed, 1118 insertions(+)
          .................................................
          create mode 100644 stylesheets/screen.css

          ## Pushing generated _deploy website
          ERROR: Repository not found.
          fatal: Could not read from remote repository.

          Please make sure you have the correct access rights
          and the repository exists.

          ## Github Pages deploy complete
          cd -


          請問是什么原因,多謝!~  回復  更多評論
            

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 巢湖市| 兴山县| 武宁县| 江达县| 太康县| 新竹县| 修水县| 岳池县| 施秉县| 江华| 鹤庆县| 云龙县| 临沧市| 固原市| 旬邑县| 富民县| 龙川县| 监利县| 绍兴市| 苏尼特左旗| 海阳市| 广平县| 基隆市| 百色市| 绥滨县| 泽库县| 曲阜市| 铜鼓县| 威信县| 宝清县| 平武县| 达拉特旗| 纳雍县| 兰坪| 酉阳| 江源县| 奉化市| 合山市| 永顺县| 南丹县| 伽师县|