** tableize
rails console下,執行"Post".tableize 得到posts,table名稱
----------------------
sinatra 在tux下執行
** singularize 複數變單數
執行上方式同上
** pluralize 單數變複數
執行上方式同上
http://api.rubyonrails.org/classes/ActiveSupport/Inflector.html
ruby on sinatra 正式開發上線 發現問題
基本上,很多人用 rank db:migrate, 看日本的範例是直接開mysql資料庫,那時候不懂,他的做法出乎意外,因為大部份的範例不是這樣,現在才知道為什麼。
rank db:create_migration NAME=xxx 建立後,再改xxx.rb檔,設完後,rank db:migrate就產生大問題了!
在開發環境,用sqlite3, 是的,可以用,但到正式mysql資料庫,能用,但編碼是litaxxxx ....不是UTF8;那在xxx.rb 文件內強制設定option
create_table :tops, options: 'DEFAULT CHARSET=utf8'
當然就不發生錯誤,但回到sqllite3就錯了!因為sqlite3沒支援這語法......那這樣怎麼處理? 寫程式,因為xxx.rb,是ruby語法。
但這樣有比較快嗎?
還是直接把 cretae table schema和insert sql直接另外做文件,進mysql和sqlite3執行sql比較快....
mysql 當然更快是直接把table名稱改掉,新增 新的table;
sqlite3 直接copy一個新的sqlite3,進去刪掉table更快...
也許是我不了解rank db,但目前的了解就是這樣子....
另外有試著把mysql的db,需設成utf8,但租的主機有時候是不能亂改的.....哈,無解
rank db:create_migration NAME=xxx 建立後,再改xxx.rb檔,設完後,rank db:migrate就產生大問題了!
在開發環境,用sqlite3, 是的,可以用,但到正式mysql資料庫,能用,但編碼是litaxxxx ....不是UTF8;那在xxx.rb 文件內強制設定option
create_table :tops, options: 'DEFAULT CHARSET=utf8'
當然就不發生錯誤,但回到sqllite3就錯了!因為sqlite3沒支援這語法......那這樣怎麼處理? 寫程式,因為xxx.rb,是ruby語法。
但這樣有比較快嗎?
還是直接把 cretae table schema和insert sql直接另外做文件,進mysql和sqlite3執行sql比較快....
mysql 當然更快是直接把table名稱改掉,新增 新的table;
sqlite3 直接copy一個新的sqlite3,進去刪掉table更快...
也許是我不了解rank db,但目前的了解就是這樣子....
另外有試著把mysql的db,需設成utf8,但租的主機有時候是不能亂改的.....哈,無解
[轉]database.yml &, <<, *
http://stackoverflow.com/questions/6651275/what-do-the-mean-in-this-database-yml-file
The & marks an alias for the node (in your example &defaultaliases the development node as "default")
* references the aliased node with the name "default".
<<: inserts the content of that node.
test: &test <<: *default
default_env:
<<: *production
The & marks an alias for the node (in your example &defaultaliases the development node as "default")
default_env:
<<: *production
sinatra mobile app cordova -- just for note
https://gauntface.com/blog/2014/02/05/cordova-web-best-practices-v2-0
http://spiritmachineblog.tumblr.com/post/41432461669/a-simple-openlayers-app-with-yeoman-sinatra-mongodb
HTML5 Boilerplate
Sass with Compass
Modernizr
http://thibaultdenizet.com/tutorial/cors-with-angular-js-and-sinatra/
=====
簡單說:發現現在要走moble app,要有yoeman的產生的網頁檔,或是 走Angular.js, jquerymobile, bootstrap三個來做。
新增、修改、刪除 走Restful,看上面範例。這樣產出來的網頁能適用 手機和平板。
但要把 程式轉成可以用cordova,要用Compass之類的,把所有的js, css, html5 三個檔。
http://vimeo.com/35998909
https://www.youtube.com/watch?v=e4yUTkva_FM
https://www.youtube.com/watch?v=wVntVkRLR3M
bit.ly/zen-ng-phonegap
Angular UI部份
這看起來有點像官方Angular原生
http://angular-ui.github.io/bootstrap/
這是另一個整合好Bootstrap and Angular JS
http://mobileangularui.com/
這是angular+ionic
http://ionicframework.com/
http://ionicframework.com/docs/overview/#download
http://ionicframework.com/docs/components/
==================
**SASS (Sass)
**require jquery.mobile 21:13
http://demos.jquerymobile.com/1.2.0/
http://demos.jquerymobile.com/1.2.0/docs/pages/page-anatomy.html
css style => data-role
http://mobileangularui.com/demo/#/
http://ionicframework.com/
============
https://www.youtube.com/watch?v=sCnGSOaaZFo
http://jaydata.org/blog/angularjs-with-jaydata%E2%80%93-the-todo-example-with-the-itemstore-api
http://jaydata.org/
=======
Three-way data-binding sync 同步
--
http://fitc.ca/presentation/4-way-data-binding-offline-data-synchronization-in-angularjs/
http://fitc.ca/presentation/mobile-offline-data-synchronization-in-angularjs/
--
CouchDB comes with a suite of features, such as on-the-fly document transformation and real-time change notifications, that makes web app development a breeze. It even comes with an easy to use web administration console. You guessed it, served up directly out of CouchDB!
--
The Database that Syncs!
PouchDB is an open-source JavaScript database inspired by Apache CouchDB that is designed to run well within the browser.
===============
http://deployd.com/
http://remotestorage.io/ https://unhosted.org/
--https://togetherjs.com/
--http://socket.io/
--http://pusher.com/
--https://parse.com/plans ,but free good
$$ https://backendless.com/
$$ http://www.kinvey.com/pricing
Examples of open source backend systems are usergrid_, BaasBox, DreamFactory, deployd,Meteor, sockethub, and Hoodie.
Examples which have not yet shut down are Kinvey, Apigee,Backendless, Kii, built.io, Firebase, Encore.io, AppearIQ, AnyPresence,FeedHenry, Syncano, Apstrata, FanIgnite, CloudMine, iKnode, FatFractal,Kumulos, Netmera, Buddy, apiOmat, Applicasa (especially for in-app purchases), AppGlu (especially for product catalogs), Flurry (especially for advertising and analytics), Facebook's Parse, Appcelerator (includingsingly), Amazon's AWS Mobile Services (including Cognito, analytics, storage, and push notifications), and Apple's CloudKit.
http://spiritmachineblog.tumblr.com/post/41432461669/a-simple-openlayers-app-with-yeoman-sinatra-mongodb
HTML5 Boilerplate
Sass with Compass
Modernizr
http://thibaultdenizet.com/tutorial/cors-with-angular-js-and-sinatra/
=====
簡單說:發現現在要走moble app,要有yoeman的產生的網頁檔,或是 走Angular.js, jquerymobile, bootstrap三個來做。
新增、修改、刪除 走Restful,看上面範例。這樣產出來的網頁能適用 手機和平板。
但要把 程式轉成可以用cordova,要用Compass之類的,把所有的js, css, html5 三個檔。
http://vimeo.com/35998909
https://www.youtube.com/watch?v=e4yUTkva_FM
https://www.youtube.com/watch?v=wVntVkRLR3M
bit.ly/zen-ng-phonegap
Angular UI部份
這看起來有點像官方Angular原生
http://angular-ui.github.io/bootstrap/
這是另一個整合好Bootstrap and Angular JS
http://mobileangularui.com/
這是angular+ionic
http://ionicframework.com/
http://ionicframework.com/docs/overview/#download
http://ionicframework.com/docs/components/
==================
**SASS (Sass)
**require jquery.mobile 21:13
http://demos.jquerymobile.com/1.2.0/
http://demos.jquerymobile.com/1.2.0/docs/pages/page-anatomy.html
css style => data-role
%meta{name: 'viewport', content: 'width=device-width, initial-scal-1')
http://demos.jquerymobile.com/1.2.0/docs/lists/lists-collapsible.html
**haml
http://html2haml.heroku.com/
**haml
http://html2haml.heroku.com/
=====
phonegap 41:01
開一個android專案,但只是把網頁load進來.....真是簡單
開一個android專案,但只是把網頁load進來.....真是簡單
www/index.html
1. script include: phonegap-1.3.0.js
2. onBodyLoad(){
document.addEventListener("dviceready", onDeviceready, false);
windows.location.href = 'http://localhost:3000'
}
http://mobileangularui.com/demo/#/
http://ionicframework.com/
============
https://www.youtube.com/watch?v=sCnGSOaaZFo
http://jaydata.org/blog/angularjs-with-jaydata%E2%80%93-the-todo-example-with-the-itemstore-api
http://jaydata.org/
=======
Three-way data-binding sync 同步
AngularJS model change and view change together
現在只有firebase,要看有沒有別的專案
簡單說,ng會定時去檢查,如果有任何動動作,就會主動去更新
model一改變,view就改變,所以model要綁定remote Restful
大概是這意思,綁定就行了
綁定後,如果model有改變,對應的view就會變
另外就正websocket, WebHooks, PubSubHubbub
$evalAsync()
Wrap code that depends on ng-init in $scope.$evalAsync(), which forces it to run on the next $digest() phase:
簡單說,ng會定時去檢查,如果有任何動動作,就會主動去更新
model一改變,view就改變,所以model要綁定remote Restful
大概是這意思,綁定就行了
綁定後,如果model有改變,對應的view就會變
另外就正websocket, WebHooks, PubSubHubbub
http://www.troikatech.com/blog/2014/02/26/websocket-webmachine/
https://github.com/simulacre/sinatra-websocket
http://xh-css.cn/2013/11/watch-how-the-apply-runs-a-digest/https://github.com/simulacre/sinatra-websocket
$evalAsync()
Wrap code that depends on ng-init in $scope.$evalAsync(), which forces it to run on the next $digest() phase:
--
http://fitc.ca/presentation/4-way-data-binding-offline-data-synchronization-in-angularjs/
http://fitc.ca/presentation/mobile-offline-data-synchronization-in-angularjs/
--
CouchDB comes with a suite of features, such as on-the-fly document transformation and real-time change notifications, that makes web app development a breeze. It even comes with an easy to use web administration console. You guessed it, served up directly out of CouchDB!
--
The Database that Syncs!
PouchDB is an open-source JavaScript database inspired by Apache CouchDB that is designed to run well within the browser.
===============
http://deployd.com/
http://remotestorage.io/ https://unhosted.org/
--https://togetherjs.com/
--http://socket.io/
--http://pusher.com/
--https://parse.com/plans ,but free good
$$ https://backendless.com/
$$ http://www.kinvey.com/pricing
Examples of open source backend systems are usergrid_, BaasBox, DreamFactory, deployd,Meteor, sockethub, and Hoodie.
Examples which have not yet shut down are Kinvey, Apigee,Backendless, Kii, built.io, Firebase, Encore.io, AppearIQ, AnyPresence,FeedHenry, Syncano, Apstrata, FanIgnite, CloudMine, iKnode, FatFractal,Kumulos, Netmera, Buddy, apiOmat, Applicasa (especially for in-app purchases), AppGlu (especially for product catalogs), Flurry (especially for advertising and analytics), Facebook's Parse, Appcelerator (includingsingly), Amazon's AWS Mobile Services (including Cognito, analytics, storage, and push notifications), and Apple's CloudKit.
訂閱:
文章 (Atom)