[WEB]Zen Coding style筆記
| 符號 | 說明 |
|---|---|
| # | id屬性 |
| . | class屬性 |
| [] | 自訂屬性 |
| > | 子元素 |
| + | 兄弟元素 |
| ^ | 升層 |
| * | 複製數量 |
| $ | 增量變數 |
| $$ | 增量變數(2位數) |
| {} | 文字節點 |
| 符號 | 說明 |
|---|---|
| # | id屬性 |
| . | class屬性 |
| [] | 自訂屬性 |
| > | 子元素 |
| + | 兄弟元素 |
| ^ | 升層 |
| * | 複製數量 |
| $ | 增量變數 |
| $$ | 增量變數(2位數) |
| {} | 文字節點 |
用途: redirect action
使用者可以使用『上一頁』的功能
1 | $location.path(); // 取得目前的路徑 |
使用者沒有辦法使用『上一頁』
1 | $location.path('path'); |
取得完整的路徑
取得 # 之後的內容
get/set search part of the current URL
get the URL of the current page
目的: 取得最後一筆的聊天紀錄
1 | var result = (from o in db.messages |
緣由:Bluhost決定將所有的php版本升級到5.4.20, 那這樣子的行為會讓phalcon.so(php 5.3.27版本) 失效,然後問Bluehost, 他們不會提供降級的服務,也不會幫忙complie phalcon.so…所以,自己做。
作法:設定一個跟網頁空間一樣的環境, same os and php version, 然後在編譯phalcon, 成功編譯後上傳phalcon.so到主機上面。
步驟: 我是選擇centos6版,下載與主機服務商一樣作業位元的作業系統. (64bit or 32bit)
yum update 讓系統先將所有的套件更新到最新的狀態yum groupinstall "Development Tools" 安裝一些跟開發有關係的元件,例如 git (必須安裝)rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpmyum list | grep php 顯示跟php有關的套件。php54w就是我們要安裝的套件yum install php54w php54w-mysql php54w-develgit clone --depth=1 git://github.com/phalcon/cphalcon.gitcd cphalcon/build./install

#流程
#開發環境 python 3.3
#有用到的package
其實在使用bs4的過程中,也是花最多時間的地方是如何讓中文正常的顯示出來。其實在第一段要取得信件裡的內容時,就遇到中文編碼的問題。
demo code
1 | import imaplib,email,re |
在3.3裡, email.message_from_string 傳進去的文字如果不加decode,會傳錯誤訊息出來。
1 | email.message_from_string(response_part[1].decode()) |
發布文章到wordpress 參考網址: http://python-wordpress-xmlrpc.readthedocs.org/en/latest/index.html
class postToWP:
def post(title,content,tag):
client = Client('http://blog url//xmlrpc.php', 'username', 'password')
post = WordPressPost()
post.title = title
post.content = content
post.terms_names = {
'post_tag': [tag], # 標籤(Tag)
'category': [tag], # 分類(Categories)
}
post.post_status = 'publish' # 如果沒有這一個,就會是草稿狀態
post.id = client.call(NewPost(post))
#Grunt Need: Node.js installed
Install Steps
1 | npm install -g grunt-cli |
1 | { |
1 | module.exports = function (grunt) { |
這樣子 grunt 就會監控 在 app 資料夾下的 ts 檔案異動,並同時做 complie 的動作,如果有錯誤,會產生 complie error 的訊息。
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
<TypeScriptTarget>ES3</TypeScriptTarget>
<TypeScriptIncludeComments>true</TypeScriptIncludeComments>
<TypeScriptSourceMap>true</TypeScriptSourceMap>
<TypeScriptModuleKind>AMD</TypeScriptModuleKind>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
<TypeScriptTarget>ES3</TypeScriptTarget>
<TypeScriptIncludeComments>false</TypeScriptIncludeComments>
<TypeScriptSourceMap>false</TypeScriptSourceMap>
<TypeScriptModuleKind>AMD</TypeScriptModuleKind>
</PropertyGroup>
<Import Project="$(VSToolsPath)\TypeScript\Microsoft.TypeScript.targets" />
在重新載入專案
#Form Validation with angularJs Basic: in .js $scope.form = {} $scope.form.$valid ==> 判斷form(name=「form」)內的物件是否有驗證有錯誤的物件存在
用法: formName.inputFieldName.property
Unmodified form A boolean property that tells us if the user has modified the form. This is true if the user hasn’t touched the form, and false if they have:
1 | formName.inputFieldName.$pristine; |
Modified form A boolean property if and only if the user has actually modified the form. This is set regardless of validations on the form:
1 | formName.inputFieldName.$dirty |
Valid form A boolean property that tells us that the form is valid or not. If the form is currently valid, then this will be true:
1 | formName.inputFieldName.$valid |
Invalid form A boolean property that tells us that the form is invalid. If the form is currently invalid, then this will be true:
1 | formName.inputFieldName.$invalid |
The last two properties are particularly useful for showing or hiding DOM elements. They are also very useful when setting a class on a particular form.
Errors Another useful property that AngularJS makes available to us is the $error object. This object contains all of the validations on a particular form and if they are valid or invalid. To get access to this property, use the following syntax:
1 | formName.inputfieldName.$error |
###Addtional CSS classes ng-valid Is set if the form is valid. ng-invalid Is set if the form is invalid. ng-pristine Is set if the form is pristine. ng-dirty Is set if the form is dirty.
##Input Validation
1 | <input |
####可驗證項目(內建) requried ng-minlength ng-maxlength
####$error所對應的項目 formName.inputfieldName.$error.requried formName.inputfieldName.$error.minlength formName.inputfieldName.$error.maxlength
民國103年1月1日起,網際網路電子發票開始限制發票字軌只能使用丁種字軌,然後又推說如果利用網際網路電子發票開立B2B交易情形,只能接受丁種字軌,這表示,另外一方也必須用網際網路電子發票…看來國稅局在103年度要強推B2B的電子發票了。
不管怎樣,這個也是一個趨勢,雖然現在開立的方法或是平台(還得獎…這好笑了吧, 請個F2E處理一下你的頁面吧。還是說設計者都沒有自己操作過)都還很鳥,如果要利用媒體檔上傳的方式,這個門檻又很高,因為那個該死的規格書又寫的很艱澀。(只是要罵一下)…
還是稍微整理一下開立流程:
銷項發票狀態 開立 :已新增發票,尚未憑證寄送 已寄送:已憑證寄送,資料傳送中 已讀取:買方已讀取 尚未完成進項發票寄送確認 已確認:買方已完成進項發票寄送確認 進項發票狀態 開立 :賣方已憑證寄送發票,買方尚未讀取 已讀取 :買方已讀取發票,尚未完成進項發票寄送確認 確認寄送中:進項發票寄送確認,資料傳送中 已確認 :買方已完成進項發票寄送確認
請賣方營業人至基本資料/交易對象資料維護建立買方資料並設定交易暗語,買方即可以交易暗語寄送發票。 惟作廢發票及發票退回確認僅能使用憑證接收,不得使用交易暗語接收。
很像list,但是一旦建立後值就沒有辦法被更改 (ex. list[1]= 『b』 <=會出錯) 用途: 用來儲存一些常用(const)變數
set會將重複得值給排除掉(有distinct的味道) 建立set的方式有set() 或 a= {『something』,『something』} 如果要建立空的set,只能透過set()的方式
1 | >>> a = set('abracadabra') |
#Dictionaries as c# Dictionary<string, string> 操作方式
建立的方式
1 | >>> dict([('sape', 4139), ('guido', 4127), ('jack', 4098)]) |
##looping
1 | >>> knights = {'gallahad': 'the pure', 'robin': 'the brave'} |
#More on Conditions 比較的方法:
比較可以連續串接: eg: a<b==c tests whether a is thess then b and moreover b equals c
比較的順序: 左到右