2015年4月27日 星期一

bootstrap 第一天實驗

1.網頁為MVC架構,前端主要為html,javascrip,css三者所構成。
   框架的跟目錄為 \partjs-master\public
   例如:include css檔放在 <link href="/index.css" rel="stylesheet">
   其中index.css所在的目錄為\partjs-master\public\index.css

2.自動更新網頁的工具gulp

  • 安裝gulp: npm -g i gulp
  • 編輯gulpfile.js   在gulp.task('serve', function () 加入
           browserSync.init(null, {

                  server: {
                        baseDir: ['app', '.tmp']
                   },
                  notify: false
          });


         gulp.watch(['public/index.cssl'], reload); 


  • 執行 gulp serve 
3.minify
  • 方法一 grunt build
  • 方法二 修改Gruntfile.js
           uglify: {
                     less: {
                              views: {

                                         files: [{
                                                 expand: true,
                                                 cwd: 'public/',
                                                 src: ['*.css'],
                                                 dest: 'public/',
                                                 ext: '.min.css'
                                         }

                              }   
                     }             
           }
         
         執行grunt less:views
4.jade jade file可編譯成html語法上用縮排來代表巢狀結構
   找到routes.js檔找到//partjs boilerplate
   參考 app.get('/dashboard',requirre(./views/index').dashboard);
   由此可知道在views底下有一個index.jade檔將他打開來後在檔案的頭有一行
   extend layouts/default 然後去views/layouts
   底下找到default.jade就可以找到相對應的jade檔案設定再根據裡面的設定去修改他。


Bootstrap 環境架設

Bootstrap:
1.網頁APP的主流框架,但不知緣目前依些網頁設計工具
2.其特色是使用command line方式來操作

環境架設
windows:
1.安裝node js  https://nodejs.org/
2.安裝python 2.7.X  https://www.python.org/downloads/
3.安裝git for windows  http://git-scm.com/download/win
4.下載 partjs  https://github.com/partjs/partjs  解壓縮到 C:\底下
5.申請 mongolab 帳號 https://mongolab.com/
   在MongoDB deployment增加一個plan,然後在plan創建一個user
6.打開命令提示字元進入C:\partjs-master
7.cp config.example.js config.js
8.然後打開config.js修改紅色字的地方
  uri: process.env.MONGOLAB_URI || process.env.MONGOHQ_URL || 'localhost/drywall'
改成申請的帳號跟密碼'mongodb://<dbuser>:<dbpassword>@ds041387.mongolab.com:41387/moko365_test'
ps:此字串在mongolab中申請得到的
9.install 一些npm工具
   npm update -g bower
   npm i -g bower
   npm -g i forever
   npm -g i grunt-cli
10.執行node app.js
11.開瀏覽器輸入http://localhost:3000/

就可以看到網頁的畫面

一些free source的網站
http://getbootstrap.com/
http://bootsnipp.com/
https://github.com/erikflowers/weather-icons
https://unsplash.com/
http://designmodo.github.io/Flat-UI/


ps:過程中出現"Error: Cannot find module 'express'"這個錯誤
     決方法:執行 npm install



2015年4月17日 星期五

Conversion From ' ' To Non-Scalar Type ' ' Requested

CeMMCDriver *pFDriver = new CeMMCDriver ();
CFlash tflash = new CFlash(pFDriver );

以上的 code編譯後將出現
Conversion From ' CFlash ' To Non-Scalar Type ' CFlash ' Requested 的錯誤

若將程式碼改成
CeMMCDriver *pFDriver = new CeMMCDriver ();
CFlash *tflash = new CFlash(pFDriver );

CeMMCDriver *pFDriver = new CeMMCDriver ();
CFlash *tflash ;
tflash = new CFlash(pFDriver );
則沒問題