2014年12月1日 星期一
Vistual Studio 2013開發工具與路徑
2013開發人員命令列工具:
C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\Shortcuts\
執行Developer Command Prompt for VS2013.exe(英文版)
IIS Express 站台設定檔位置:
C:\Users\USER\Documents\IISExpress\config
IIS Express 命令列位置:
C:\Program Files\IIS Express
appcmd.exe list site 列出站台
appcmd.exe site /? 站台可執行命令
iisexpress.exe /site:1 啓動IIS Express 站台1
更多內容可以參考:
http://www.iis.net/learn/extensions/using-iis-express/running-iis-express-from-the-command-line
開啓IIS Express站台供外部連結:(失敗)
用筆記本開啓 C:\Users\USER\Documents\IISExpress\config\applicationhost.config
將localhost 已為*
最後再新增保留區
netsh http add urlacl url=http://*:(埠號)/ user=everyone
20141130:在window8上測試失敗,使用IP方式出現503錯誤,localhost則正常
2014年11月24日 星期一
Coding First Data Annotations (Model屬性的相關標註說明)
假設有一個Model的類別
[Key]:索引鍵
[Key,Column(Oerder=n)]複合索引鍵:
[MaxLength(n),ErrorMessage=”your message“,MinLength(n)]:最大和最小值和自訂錯誤訊息
[NotMapped]:不須建立資料庫的欄位
[Table][Column]:自訂資料庫表格和欄位名稱
[Index]:欄位建立搜尋索引EF6.1以後版本才有此功能,預設的索引名稱是IX_
需要參考以下兩個組件:
public class User {
public int Id { get; set; }
public string PersonalId { get; set; }
public string Name { get; set; }
}
[Key]:索引鍵
[Key]
public int Id { get; set; }
[Key,Column(Oerder=n)]複合索引鍵:
[Key]
[Column(Order=1)]
public string PersonalId { get; set; }
[Key]
[Column(Order=2)]
public string Name {get;set;}
[Required]:必要欄位不可為空
[Required]
public int Id { get; set; }
[MaxLength(n),ErrorMessage=”your message“,MinLength(n)]:最大和最小值和自訂錯誤訊息
[MaxLength(2),ErrorMessage=”姓名欄位請輸入2~5個字“,MinLength(5)]
public string Name { get; set; }
[NotMapped]:不須建立資料庫的欄位
[NotMapped]
string sex = PersonalId.Substring(1, 1)=="1"?"男":"女";
[Table][Column]:自訂資料庫表格和欄位名稱
[Table("MyUser")]
public class UserModel{
[Column("Myid",TypeName="ntext")]
string PersonalId{get;set;}
}
[Index]:欄位建立搜尋索引EF6.1以後版本才有此功能,預設的索引名稱是IX_
[Index("MyIndexName")]
public string Name {get;set;}
}
需要參考以下兩個組件:
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
2014年11月23日 星期日
各版本的Sql connection 字串寫法
LocalDB:
SQL Azure:
Entity Framework Database:
Sql Compact:
<add name="ConnectionStringName" providerName="System.Data.SqlClient" connectionString="Data Source=(LocalDB)\v11.0;AttachDbFileName=|DataDirectory|\DatabaseFileName.mdf;InitialCatalog=DatabaseName;Integrated Security=True;MultipleActiveResultSets=True" />Sql Express:
<add name="ConnectionStringName" providerName="System.Data.SqlClient"
connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=DatabaseName;Integrated Security=True;MultipleActiveResultSets=True"/>
Sql Server:<add name="ConnectionStringName" providerName="System.Data.SqlClient"
connectionString="Data Source=ServerName;Initial Catalog=DatabaseName;Integrated Security=False;User Id=userid;Password=password;MultipleActiveResultSets=True" />
SQL Azure:
<add name="ConnectionStringName" providerName="System.Data.SqlClient"
connectionString="Data Source=tcp:ServerName.database.windows.net,1433;Initial Catalog=DatabaseName;Integrated Security=False;User Id=username@servername;Password=password;Encrypt=True;TrustServerCertificate=False;MultipleActiveResultSets=True" />
Entity Framework Database:
<add name="ConnectionStringName" providerName="System.Data.EntityClient"
connectionString="metadata=res://*/ ContextClass.csdl|res://*/ ContextClass.ssdl|res://*/ ContextClass.msl;provider=System.Data.SqlClient;provider connection string="Data Source=ServerName;Integrated Security=False;User Id=userid;Password=password;MultipleActiveResultSets=True"" />
Sql Compact:
<add name="ConnectionStringName" providerName="System.Data.SqlServerCe.4.0"
connectionString="Data Source=|DataDirectory|\DatabaseFileName.sdf" />
2014年11月20日 星期四
Adjacent selectors的用法,li中的範例
<style type="text/css">
li{
color: maroon;
}
li+li{
color: silver;
}
li+li+li{
color: blue;
}
</style>
<body>
<ol>
<li>第1個重點</li>
<li>第2個不太重要</li>
<li>第3個太不重要了</li>
</ol>
</body>
結果:
2014年11月19日 星期三
child selector 與 descendant selector的差異性
<style type="text/css">
div{
font-size:x-large;
background-color:black;
}
//descendant selector 後代
div span{
background:red;
}
//child selector 孩子
div > span{
background:blue;
}
</style>
<body>
<div><span>123</span><span>456<span>789</span></span></div>
</body>
結果:
div{
font-size:x-large;
background-color:black;
}
//descendant selector 後代
div span{
background:red;
}
//child selector 孩子
div > span{
background:blue;
}
</style>
<body>
<div><span>123</span><span>456<span>789</span></span></div>
</body>
結果:
2014年11月12日 星期三
[Database] 在Ubuntu安裝sqlite和sqlitebrowser
安裝sqlite
sudo apt-get install sqlite3
試看看是否可以登入sqlite3 (資料庫不存在的話會自動建立)
sqlite3 [DatabaseName]
例:sqlite3 test.db
.help 顯示相關命令
.databases 顯示資料庫
.table 顯示表格
.exit or .quit 離開
安裝sqlite browser
英文文件請參考:https://github.com/sqlitebrowser/sqlitebrowser/blob/master/BUILDING.md
請先安裝libqt4-dev和libsqlite3-dev 和 qp-sdk
sudo apt-get install libqt4-dev
sudo apt-get install libsqlite3-dev
sudo apt-get install qp-sdk
下載:source 檔案
https://github.com/sqlitebrowser/sqlitebrowser/zipball/master
更多檔案格式請見官網:http://sqlitebrowser.org/
============安裝=================
- 打開終端機進到你的解壓縮的目錄
- 建立build資料夾 mkdir build
- 進去資料夾 cd build
- 執行cmake ..
- make
- sudo make install
註.cmake前請先檢查寫入權限問題,請用chmod改變權限
make過程
sudo make install
再來執行 /usr/local/share/applications/sqlitebrowser.desktop 就可以了
圖形還是比較人性化,這樣建schema就大大方便了
出現could not exec gnu/qt4/bin/qmake 的錯誤就是沒有安裝上面libqt4-dev和libsqlite3-dev
![]() |
2014年11月9日 星期日
[NO SQL] MongoDB 安裝
原文內容請直接參考:
http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/
第一步:取得金鑰
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
第二步:增加更新來源的網址
echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list
第三步:sudo apt-get update
第四步:安裝mongoDB
sudo apt-get install -y mongodb-org
MongoDB資料放在/var/lib/mongodb
log檔放在 /var/log/mongodb
啟動設定檔放在/etc/mongod.cnf,使用port:27017為預設連接port
啟動:sudo service mongod start
停止:sudo service mongod stop
訂閱:
文章 (Atom)
熱門文章
-
解決辦法:(沒實際試過僅供參考) 1. ASP.NET預設連結資料庫的Connection數為100個,在Connection String裡加入Max Pool Size=xxx的設定 2. 重啓SQL資料庫的服務 查詢目前DB連線數 USE mast...
-
===終端機命令列上執行=== 版本查詢:mysql --version MariaDB啟動的參數內容:mysqld --verbose --help === MY SQL 內執行=== 顯示目前MariaDB的設定值:show variables;show...
-
執行Eclipse時出現 ADB server didn't ACK 的錯誤時可以參考 Error : ADB Server Didn't ACK on Windows 另外要找哪一個PID佔用的5037(ADB的Port)有時會很長一串,如果要分...
-
修改 /etc/mysql/my.cnf sudo vim /etc/mysql/my.cnf 在[mysqld]中加上此行 ============================= [mysqld] character-set-server=utf8mb4...
-
2015.06.07 安裝mono sudo apt-get install mono-complete sudo apt-get install mono-runtime ==================下面是舊文章僅供參考================...
-
首先檢查Eclipse版本 我的版本是Kepler Service Release 2 接下來複製要更新語言包的網址 http://www.eclipse.org/babel/downloads.php 再來打開Eclipse工具...
-
先安裝Python的Mysql連線模組(請用管理員身份開啟命令字元) pip install MySQL-python 出現錯誤,必須要安裝Microsoft Vistual C++ 14.0 https://www.micros...
-
開發時,有時需要倒一下線上機的資料來測試時 線上機( Ubuntu ) : mysql -u root -p SELECT * FROM [TABLE_NAME] INTO OUTFILE "/PATH/FILE_NAME.TXT"; 本地...
-
終於找到UBUNTU 15.04開機進入COMMAND LINE 的方式了(趕緊記錄一下) sudo vim /etc/default/grub 1. 將 GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" 註...













