visual studio 2017
在工具選項的javascript/TypeScript的Language Service 把啟用新的JavaScript Language Service的打勾移除
另外作法:
在js檔中加入下列一段,會自動參考(版本自行替換)
/// <reference path="Scripts/jquery-2.0.0.min.js" /> /// <reference path="Scripts/jquery-2.0.0.intellisense.js" />
2017年10月19日 星期四
dapper 連接資料庫
連接資料庫有ado.net,dapper,Entity Framework
Imports System.Transactions //可以加快速度
1.開啟NuGet管理視窗下載Dapper
C#
顯示在gridview
protected void Page_Load(object sender, EventArgs e)
{
GridView1.DataSource = ReadAll();
GridView1.DataBind();
}
public class conference
{
public 資料庫欄位型別 資料庫欄位名稱 { get; set; }
//出來的資料也只有定義在類別(這裡)的資料
}
public List<con> ReadAll()
{
using (IDbConnection db = new SqlConnection(ConfigurationManager.ConnectionStrings["xxx"].ConnectionString))
{
return db.Query<con>
("Select * From 資料庫 m" Where xxx=@xxx",
new { xxx = 1 }).ToList();
}
}
2017年10月18日 星期三
MVC api教學網站
http://kirkchen.logdown.com/pages/use-aspnet-mvc-to-develop-api
http://kirkchen.logdown.com/posts/246422-aspnet-mvc-using-aspnet-idetity-integrate-google-login
http://kirkchen.logdown.com/posts/246422-aspnet-mvc-using-aspnet-idetity-integrate-google-login
2017年10月17日 星期二
C#return和yield return心得
return
yield return
yield return 會回到以前的程式執行,看起來都是迴圈之類的程式 ,不斷地把符合程式的資料丟出來,return大概只會丟一次
public static void foreach(Collection<String> collection) {
Iterator<String> iterator = collection.iterator();
while(iterator.hasNext()) {
System.out.println(iterator.next());
}
}
現在,無論是List或Set,無論真正的實作是ArrayList、LinkedList、HashSet...,都可以使用這個foreach方法來 顯示內部所收集的物件。
int x = (int)Days.Sun;
string y = Days.Sun.ToString();
Console.WriteLine("Sun = {0}", x);---->得到位置的值 0
Console.WriteLine("Fri = {0}", y);------>得到值 sum
enum Days { Sun, Mon, Tue, Wed, Thu, Fri, Sat };
可能是方便給值又有數字 就是每個值都要代表的數字 方便取值
和swich使用
structure
structure enum class 一ㄗ
可不用宣告
不用new
表某一個群組
像是 structure 農場
{
雞
鴨
}
yield return
yield return 會回到以前的程式執行,看起來都是迴圈之類的程式 ,不斷地把符合程式的資料丟出來,return大概只會丟一次
public static void foreach(Collection<String> collection) {
Iterator<String> iterator = collection.iterator();
while(iterator.hasNext()) {
System.out.println(iterator.next());
}
}
現在,無論是List或Set,無論真正的實作是ArrayList、LinkedList、HashSet...,都可以使用這個foreach方法來 顯示內部所收集的物件。
int x = (int)Days.Sun;
string y = Days.Sun.ToString();
Console.WriteLine("Sun = {0}", x);---->得到位置的值 0
Console.WriteLine("Fri = {0}", y);------>得到值 sum
enum Days { Sun, Mon, Tue, Wed, Thu, Fri, Sat };
可能是方便給值又有數字 就是每個值都要代表的數字 方便取值
和swich使用
structure
structure enum class 一ㄗ
可不用宣告
不用new
表某一個群組
像是 structure 農場
{
雞
鴨
}
class TheClass { public int x; } struct TheStruct { public int x; } class TestClass { public static void structtaker(TheStruct s) { s.x = 5; } public static void classtaker(TheClass c) { c.x = 5; } public static void Main() { TheStruct a = new TheStruct(); TheClass b = new TheClass(); a.x = 1; b.x = 1; structtaker(a); classtaker(b); Console.WriteLine("a.x = {0}", a.x); Console.WriteLine("b.x = {0}", b.x); } }雖然感覺用不到
C#unity教學網頁
http://www.cg.com.tw/Unity/
http://readandplay.pixnet.net/blog/post/203728573-unity%E6%95%99%E5%AD%B8-2d%E5%B0%8F%E9%81%8A%E6%88%B2%E8%A3%BD%E4%BD%9C-part-4-%28end%29
http://readandplay.pixnet.net/blog/post/203728573-unity%E6%95%99%E5%AD%B8-2d%E5%B0%8F%E9%81%8A%E6%88%B2%E8%A3%BD%E4%BD%9C-part-4-%28end%29
Angular筆記
ng-app
在裡面才能用angularjs
ng-model
在input 輸入的地方 值會給ng-bind 或是使用="值" 給 {{ 值}}
ng-bind
產出的地方 接收ng-model
ng-init
angularjs的變數放的地方 可以給其他
例如
ng-bind {{}} ng-model value
像是var 可以是任何東西
ata-ng-init
data-ng-bind
ng-app vs data-ng-app
ng-app="myApp"
ng-controller="myCtrl"> 宣告controller
<script>
宣告一個function 給 app
var app=angular.module("名字",[]);
控制controller
app.controller("controller的名字",fuction($scope){
$scope.firsname="###"; 宣告 controller的變數的值是多少
});
</script>
可以直接取名字使用
<div ng-app="pp" -test-directiv></div>
<script>
var app = angular.module("pp", []);
app.directive("TestDirectiv", function() {
return {
template : "I s made in a directive constructor!"
};
});
</script>
<div ng-app="" ng-init="names=['Jani','Hege','Kai']">
<ul>
<li ng-repeat="x in names">
{{ x }}
</li>
</ul>
</div>
<ul>
<li ng-repeat="x in names">
{{ x }}
</li>
</ul>
</div>
<div ng-app="" ng-init="names=[
{name:'Jani',country:'Norway',alien:'ton'},
{name:'Hege',country:'Sweden',alien:'lee'},
{name:'Kai',country:'Denmark',alien:'hey'}]">
<p>Looping with objects:</p>
<ul>
<li ng-repeat="x in names">
{{ x.name + ', ' + x.country+','+x.alien }}</li>
</ul>
<form ng-app="" name="myForm">
Email:
<input type="email" name="myAddress" ng-model="text">
<span ng-show="myForm.myAddress.$error.email">Not a valid e-mail address</span>
</form>
<form ng-app="" name="myForm">
Email:
<input type="email" name="myAddress" ng-model="text">
<span ng-show="myForm.myAddress.$error.email">Not a valid e-mail address</span>
</form>
The
ng-model
directive adds/removes the following classes, according to the status of the form field:- ng-empty
- ng-not-empty
- ng-touched
- ng-untouched
- ng-valid
- ng-invalid
- ng-dirty
- ng-pending
- ng-pristine
All applications have a
$rootScope
which is the scope created on the HTML element that contains the ng-app
directive.
The rootScope is available in the entire application.
If a variable has the same name in both the current scope and in the rootScope, the application use the one in the current scope.
AngularJS Filters
AngularJS provides filters to transform data:
currency
Format a number to a currency format.date
Format a date to a specified format.filter
Select a subset of items from an array.json
Format an object to a JSON string.limitTo
Limits an array/string, into a specified number of elements/characters.lowercase
Format a string to lower case.number
Format a number to a string.orderBy
Orders an array by an expression.uppercase
Format a string to upper case.- <div ng-app="" ng-init="mySwitch=true">
<p>
<button ng-disabled="mySwitch">Click Me!</button>
</p>
<p>
<input type="checkbox" ng-model="mySwitch">Button
</p>
<p>
{{ mySwitch }}
</p>
</div>
<p ng-show="true">I am visible.</p>
<p ng-show="false">I am not visible.</p>
<p ng-show="false">I am not visible.</p>
<p ng-show="hour > 12">I am visible.</p>
ng-blur
ng-change
ng-click
ng-copy
ng-cut
ng-dblclick
ng-focus
ng-keydown
ng-keypress
ng-keyup
ng-mousedown
ng-mouseenter
ng-mouseleave
ng-mousemove
ng-mouseover
ng-mouseup
ng-paste
form>
Check to show a header:
<input type="checkbox" ng-model="myVar">
</form>
<h1 ng-show="myVar">My Header</h1>
Check to show a header:
<input type="checkbox" ng-model="myVar">
</form>
<h1 ng-show="myVar">My Header</h1>
<form>
Pick a topic:
<input type="radio" ng-model="myVar" value="dogs">Dogs
<input type="radio" ng-model="myVar" value="tuts">Tutorials
<input type="radio" ng-model="myVar" value="cars">Cars
</form>
Pick a topic:
<input type="radio" ng-model="myVar" value="dogs">Dogs
<input type="radio" ng-model="myVar" value="tuts">Tutorials
<input type="radio" ng-model="myVar" value="cars">Cars
</form>
<form>
Select a topic:
<select ng-model="myVar">
<option value="">
<option value="dogs">Dogs
<option value="tuts">Tutorials
<option value="cars">Cars
</select>
</form>
Select a topic:
<select ng-model="myVar">
<option value="">
<option value="dogs">Dogs
<option value="tuts">Tutorials
<option value="cars">Cars
</select>
</form>
<script>
var app = angular.module('myApp', []);
app.controller('formCtrl', function($scope) {
$scope.master = {firstName: "John", lastName: "Doe"};
$scope.reset = function() {
$scope.user = angular.copy($scope.master);
};
$scope.reset();
});
</script>
var app = angular.module('myApp', []);
app.controller('formCtrl', function($scope) {
$scope.master = {firstName: "John", lastName: "Doe"};
$scope.reset = function() {
$scope.user = angular.copy($scope.master);
};
$scope.reset();
});
</script>
<!DOCTYPE html>
<html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
<link rel="stylesheet" href="/w3css/4/w3.css">
<body>
<script>
var app = angular.module("myShoppingList", []);
app.controller("myCtrl", function($scope) {
$scope.products = ["Milk", "Bread", "Cheese"];
$scope.addItem = function () {
$scope.errortext = "";
if (!$scope.addMe) {return;}
if ($scope.products.indexOf($scope.addMe) == -1) {
$scope.products.push($scope.addMe);
} else {
$scope.errortext = "The item is already in your shopping list.";
}
}
$scope.removeItem = function (x) {
$scope.errortext = "";
$scope.products.splice(x, 1);
}
});
</script>
<div ng-app="myShoppingList" ng-cloak ng-controller="myCtrl" class="w3-card-2 w3-margin" style="max-width:400px;">
<header class="w3-container w3-light-grey w3-padding-16">
<h3>My Shopping List</h3>
</header>
<ul class="w3-ul">
<li ng-repeat="x in products" class="w3-padding-16">{{x}}<span ng-click="removeItem($index)" style="cursor:pointer;" class="w3-right w3-margin-right">×</span></li>
</ul>
<div class="w3-container w3-light-grey w3-padding-16">
<div class="w3-row w3-margin-top">
<div class="w3-col s10">
<input placeholder="Add shopping items here" ng-model="addMe" class="w3-input w3-border w3-padding">
</div>
<div class="w3-col s2">
<button ng-click="addItem()" class="w3-btn w3-padding w3-green">Add</button>
</div>
</div>
<p class="w3-text-red">{{errortext}}</p>
</div>
</div>
</body>
</html>
http://code-beginner.logdown.com/posts/307101-start-angularjs-theme-wonderful-tap-ng-click
calendar
<script>
$(document).ready(function () {
$('#calendar').fullCalendar({
buttonText: { today: '今天', prev: '上個月', next: '下個月',month:'月',agendaWeek:'週',agendaDay:'日',list:'明細' },
header: { left: 'prev,next', center: 'title', right: ' month,agendaWeek,agendaDay,today,list' },
events: "/Handler.ashx"
});
});
</script>
public void ProcessRequest (HttpContext context) {
context.Response.ContentType = "text/plain";
context.Response.Expires = -1;
IList<CalendarDTO> tasksList = new List<CalendarDTO>();
tasksList.Add(new CalendarDTO
{
id = 1,
title = "Google search",
start = "2017-09-25T12:18Z",
end = "2017-09-25T18:18Z",
url = "www.google.com"
});
System.Web.Script.Serialization.JavaScriptSerializer oSerializer =
new System.Web.Script.Serialization.JavaScriptSerializer();
string sJSON = oSerializer.Serialize(tasksList);
context.Response.Write(sJSON);
}
private long ToUnixTimespan(DateTime date)
{
TimeSpan tspan = date.ToUniversalTime().Subtract(
new DateTime(1970, 1, 1, 0, 0, 0));
return (long)Math.Truncate(tspan.TotalSeconds);
}
public bool IsReusable
{
get
{
return false;
}
}
public class CalendarDTO
{
public int id { get; set; }
public string title { get; set; }
public string start { get; set; }
public string end { get; set; }
public string url { get; set; }
}
https://www.tad0616.net/modules/tad_book3/html.php?tbdsn=774
select to_timestamp('1985-02-07T00:00:00.000Z', 'YYYY-MM-DD"T"HH24:MI:SS.ff3"Z"')
from dual;
http://big5.webasp.net/article/19/18829.htm
SQL> SELECT CAST(date1 AS TIMESTAMP) "Date" FROM t;
Date
'2017-09-26'
http://compilerok.blogspot.tw/2014/09/aspnet-ashxsession.html
http://compilerok.blogspot.tw/2014/09/aspnet-ashxsession.html
visual studio 2017的sass安裝
在visual studio 2017使用sass
在工具
擴充功能和更新
下載
gulp snippet pack
npm task runner
web compiler
在工具
擴充功能和更新
下載
gulp snippet pack
npm task runner
web compiler
訂閱:
文章 (Atom)