發表文章

ng2-smart-table 自定 column 資料

import { DecimalPipe , PercentPipe } from '@angular/common' ; settings = { columns: { name: { title: '名稱' , type: 'string' , sort: false , }, current: { title: '當期' , type: 'custom' , sort: false , class: 'text-right' , renderComponent: TrendInfoNumberComponent , }, before: { title: '前期' , type: 'html' , sort: false , class: 'text-right' , valuePrepareFunction: ( cell , row ) => { let value ; if ( row . id === '1' ) { value = this . percentPipe . transform ( cell / 100 , '1.2-2' ); // return `<div class="text-right">${value.toLocaleString('en-US', { style: 'percent' ...

Windows Server 2016 安裝 Msdeploy

圖片
Windows Server 2016 安裝 Msdeploy 新增角色及功能精靈 1. 安裝管理服務 伺服器角色 => 網頁伺服器 => 管理工具 => 管理服務 或用 PowerShell以指令安裝 Install-WindowsFeature Web-Mgmt-Service 2. 當「管理服務」安裝完成後,還必須「修復」或「重新安裝」 "web deploy 3.6"。 才能在網站的右鍵選單看到「部署 / 啟用 Web Deploy 發行」 使用 control userpasswords2 加入群組  MSDepSvcUsers Now go to Groups add new group if it does not exists MSDepSvcUsers, Double click on it and add your User as a member. Go to Services and restart the Web Deployment Agent Service. Now try and run your MSDeploy.

ASP.NET MVC RouteConfig 設定讓瀏覽器能取得根目錄的 html

讓瀏覽器能使用靜態檔案,例如: html, js, css 其它格式必須再加設 MIME type public class RouteConfig { public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.IgnoreRoute(""); // 加入這一行即可 //routes.RouteExistingFiles = true; routes.MapRoute( name: "Default", url: "{controller}/{action}/{id}", defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } ); } } MIME 的設定方式: 以加設一個 .woff 字型為例: <system.webServer> ... <staticContent> <remove fileExtension=".woff" /> <mimeMap fileExtension=".woff" mimeType="application/font-woff" /> </staticContent> </system.webServer>

查出哪個程式佔用 port 443

圖片
今天要使用 IIS 開 443 port 測試 設定好確無法啟動網站,所以查了語法 netstat -ano|findstr "0.0.0.0:443" 查到pid 4836 正在使用 port 然後再查一下 pid 4836 是什麼程式 tasklist|findstr "4836" 發現是 vmware-hostd.exe 正在使用,透過下列步驟關閉 It's easier to change the port in VMware Workstation: Edit > Preferences; Shared VMs tab; Disable; Change port; Enable. Done.

在 VS2015 使用 gulp-sass ,Task Runner Explorer 的 Gulpfile.js 發生錯誤

圖片
今天試著用 visual studio 2015 建立 web 專案,在專案中加入  gulp-sass 時遇到錯誤 最初我以為需要重新安裝 node-sass 或是 rebuild,但是持續出錯,然後在 stackoverflow M1Les 的回復  看到解決方法。 我的 gulp-sass 發生錯誤的過程: 首先透過 npm 命令安裝 gulp 和 gulp-sass npm install gulp --save-dev npm install gulp-sass --save-dev 當我在 gulpfile.js 加入 var sass = require('gulp-sass'); Task Runner Explorer 重新整理就出現如下面的錯誤訊息 按 Ctrl + Alt + O 切換到輸出視窗(Output) 看到下行的錯誤訊息。  Error: `libsass` bindings not found ... Try reinstalling `node-sass` 完整錯誤訊息如下: Failed to run "C:\code\Project\src\Web\Gulpfile.js"... cmd.exe /c gulp --tasks-simple Error: `libsass` bindings not found in C:\code\Project\src\Web\node_modules\gulp-sass\node_modules\node-sass\vendor\win32-ia32-11\binding.node. Try reinstalling `node-sass`? at Object.sass.getBinaryPath (C:\code\Project\src\Web\node_modules\gulp-sass\node_modules\node-sass\lib\extensions.js:148:11) at Object. (C:\code\Project\src\Web\node_modules\gulp-sass\node_modules\node-sass\lib\index.js:16:36...

C# Create An AutoComplete TextBox on WinForm

圖片
WinForm 的 TextBox 製作簡單的 AutoComplete 功能 1. Form 加上 TextBox 2. 設定 AutoCompleteCustomSource,  AutoCompleteMode 和 AutoCompleteSource private AutoCompleteStringCollection stringCollection; private void Form1_Load(object sender, EventArgs e) { stringCollection=new AutoCompleteStringCollection(); stringCollection.AddRange(new[] {"dog", "cat", "mouse", "fish"}); textBox1.AutoCompleteCustomSource = stringCollection; textBox1.AutoCompleteMode= AutoCompleteMode.Suggest; textBox1.AutoCompleteSource= AutoCompleteSource.CustomSource; } 範例程式碼 範例執行檔 範例程式執行畫面:

KendoGrid move the grid's row up and down

kendo version: 2014.2.903 基於 kendo grid 拖拉排序 改成按鈕的方式對grid 的 row 排序 references: drag and drop / reordering (Nikolay Rusev the Telerik team)