2017年12月26日

系統需求

Front-End 前端

  • 瀏覽器/版本
  • UI (framework、css)
  • 元件
        Datepicker
        下拉選單 (多選/搜尋)
        表格 (排序/編輯/分頁)
        分頁
        Popup Window
  • 輸入驗證/邊際值/顯示最大數量(筆數)
  • layout/partial view
        動態增減輸入區塊/欄位 (含驗證)
  • RWD
  • Report 報表
        Crystal Report
        SQL Server Reporting Services
  • 匯出檔案
        Excel
        Word (ContentControll替換文字)
        PDF (word轉 pdf)
  • Search Engine Optimization (SEO)
  • Logging all API/WCF/WebService called records

Middleware 中介

  • GraphQL
  • Message Queue (Apache Kafka、Redis<NoSQL DB>)

Backend 後端

  • Membership
  • Single Sign-On
  • Session:Read-only、Read/Write
  • ORM (SQL mapper Object)

Database 資料庫

  • Relational Database Management System
        Index
  • NoSQL
  • Read-Only DB、read/write DB

Server 伺服器

  • 前端、後端、資料庫
  • 數量
  • 環境
        Dev
        SIT
        UAT

Common 共通

  • Coding Style
  • 版本控制
        SVN
        Team Foundation Server
        Git
  • Issue Tracking System
        Team Foundation Service
        Redmine
  • 測試環境
        Dev
        SIT
        UAT
  • Migration
    功能測試 for 新資料 (SIT、UAT)
    功能測試 for 舊資料 (SIT、UAT)
  • Log
        to File
        to DB
        敏感資料 (個資)
  • Deploy (CI、CD ...)
        Rollback計畫
  • Security
        XSS (前端)
        SQL injection (後端)
        Authenticator 權限控管
        https
        Encrypt/de 加密/解密
            MD5
            RSA
        Exception Handler
  • 文件
        Word
        Excel
        PDF
  • 難字集
  • 效能要求
  • 批次作業
        Archive Log files

2017年5月17日

[CrystalReport] Crystal Report 視窗大小設定

使用者提出 Crystal Report視窗太小,看資料不方便,希望能放大
當初開發時雖然也這麼覺得,但是那時 google了相關的資料找不到解決方案,就先放著不管
現在使用者提出來就逃不掉了
但是一樣 google了一整天,都沒有滿意的方案,無法從 Crystal Report的元件或設定等地方做調整
最後索性使用 js直接調整視窗大小
done

(該不會就是因為解決方案太簡單所以網路上都沒人詢問或分享吧  囧)

window.resizeTo(screen.width, screen.height)

2017年3月31日

小工具開發紀錄

紀錄在工作上為了哪些事情個別寫程式去解決或縮短工作時間:
  • 台新 SPTS
    使用 iBatis.NET + log4net以文字檔儲存 sql紀錄,因為是用參數傳入的語法,若要人工剪下貼上參數,數量一多就很費時費力

    => 寫一支 iBatisLogParser,複製 iBatis的 log貼上,自動轉換成參數已經代入好的 sql句,本質上就是字串內容的辨識及取代
    .
  • 台新 SPTS
    開發環境封閉,無法連外網,有時需要看 Json格式但沒排版過的 log會很痛苦

    => 寫一支 JsonPrettyOffline,排版美化 Json格式的 log,易於閱讀
    .
  • 台新 SPTS
    檢查以 xml格式儲存 key/value的 wording,避免 key值重複取錯值

    => 寫一支 MessageListChecks,自動檢查
    .
  • 台新 SPTS
    每天要從 tfs抓取當天的 bug、CR數量等紀錄,並統計各 PG每天完成哪些 bug、CR

    => 寫一支 WorkItemTracer,自動產生統計表格及產生圖表
    .
  • 遠通 eTag Portal

    => 改寫以 vbs開發的壓縮 txt log程式

2017年1月16日

MS SQL專案 產生 script後使用 sqlcmd執行

利用 SQL專案的結構描述比較功能,在比較並產生指令碼後,產出的結果無法直接在 SSMS上直接執行
大概是長這個樣子
/*
TestDB 的部署指令碼

這段程式由工具產生。
...
*/
...
:setvar DatabaseName "TestDB"
:setvar DefaultFilePrefix "TestDB"
...

/* 偵測 SQLCMD 模式,如果不支援 SQLCMD 模式,則停用指令碼執行。
...
*/
...

使用 sqlcmd執行此 script的方式:
開啟 cmd,輸入下方指令後再按 Enter
sqlcmd -S TestDB -U userId -P password -i C:\TestDB_Update.publish.sql -o C:\output.txt

2016年12月5日

[VS] Visual Studio 更新服務參考過久的問題

開發的方案裡面有 FE、AP兩個專案
AP內有 N個 WCF給 FE使用
更新 FE的 Service Reference時會更新很久,甚至看起來跟當機有 87分像

最後找到問題是 FE專案參考的某些 dll會造成此情況 
此次案例的問題點是 FE有參考 DocumentFormat.OpenXml.dll

解決方式可以在設定 Service Reference時取消勾選重複使用所有組件
改成一個一個勾選且避開 DocumentFormal.OpenXml.dll

或是每次更新 Service Reference前先移除參考 DocumentFormal.OpenXml.dll,更新完再加入

2016年10月19日

金額 format string

var result = '0,0.' + Array(decimalPlace + 1).join('0')
result = result.replace(/\.\s*$/, "");
decimalPlace 0: "0,0"
decimalPlace 1: "0,0.0"
decimalPlace 2: "0,0.00"

參考:

Repeat Character N Times

2016年10月13日

懸浮按鈕 & 自動填入表單

懸浮按鈕
<input type="button" value="Import" style="positionL fixed; z-index: 10000; top: 95%; left: 5px;" onclick="$('#importFile').click()" />
<input id="importFile" type="file" style="position: fixed; z-index: 10000l top: -100px; left: -100px;" onchange="Import(this)" />
function Import(fileInput) {
    var reader;
    if(window.File && window.FileReader && window.FileList && window.Blob) {
        reader = new FileReader();
    }
    else {
        return;
    }

    var txtContent;
    if(fileInput.files && fileInput.files[0]) {
        reader.onload = function (e) {
            txtContent = e.target.result;
            console.log(txtContent);

            // Custom Code
            // End of Custom Code
        }
        reader.readAsText(fileInput.files[0]);

        //Reset
        fileInput.value = '';
    }
}

2016年9月10日

VS 專案 檔案異動沒有自動出現在包含的變更(Pending Changes)

前一陣子應客戶需求
獨立負責令一個專案開發
架構要跟原本開發的案子一樣
所以我直接複製整個專案,改名,再做一些加工後就丟上 TFS

但是修改過的檔案都不會自動出現在包含的變更(Pending Changes)清單
讓人困擾

解決方式:
檔案 → 原始檔控制 → 進階 → 變更原始檔控制 → 全選 繫結 → 簽入

2016年7月21日

Bootstrap modal prevent close (datepicker input in modal)

有個功能是 Bootstrap modal內有 datepicker input,還有一個 OK按鈕
如果不是按 OK就把 modal關閉的話,modal中輸入欄位的值要還原
如果是按 OK關閉 modal的話,檢核輸入值,檢核未過則 modal取消關閉

搜尋取消關閉 modal的範例後寫出大致如下的程式:
$('.modal').on('hide.bs.modal', function (e) {
  if (CheckClosedByBtnOK()) {
    if (!ValidInput()) {
      e.preventDefault();
      e.stopImmediatePropagation();
    }
  }
  else {
    ResetInput();
  }
});
但是發現使用 datepicker選完日期並關閉小視窗後也會觸發 hide.bs.modal,導致每次選完值就還原,有選跟沒選一樣

Bootstrap modal的官方文件中有說明 events還有一種 hidden.bs.modal,直接拿來套用,改成
$('.modal').on('hidden.bs.modal', function (e) { ...
現在不會選完值就還原了,也就是 hidden.bs.modal只有在 modal關閉時才會觸發,datepicker關閉時不會
但是另一個問題又來了,preventDefault、stopImmediatePropagation現在無效了

因為英文不好,對 Bootstrap modal官方文件的 Events說明琢磨了一會還是看不懂差異在哪:
hide.bs.modalThis event is fired immediately when the hide instance method has been called.
hidden.bs.modalThis event is fired when the modal has finished being hidden from the user (will wait for CSS transitions to complete).

只好寫程式來觀察:
$('.modal').on('hide.bs.modal', function (e) {
  console.log(this);
  console.log('hide');
}).on('hidden.bs.modal', function (e) {
  console.log(this);
  console.log('hidden');
});
得出 hidden.bs.modal是在 modal被關閉後才觸發,所以 preventDefault當然沒有效果
hide.bs.modal是關閉前觸發,但是 modal內的 datepicker關閉時也會觸發 hide.bs.modal

所以改成先判斷 hide.bs.modal是否為 datepicker被關閉時觸發即可

var isUsingDatepicker = false;

$('.modal').on('show.bs.modal', function (e) {
  isUsingDatepicker = ($(div.datepicker-dropdown).length > 0);
}).on('hide.bs.modal', function (e) {
  if (!isUsingDatepicker) {
    if (CheckClosedByBtnOK()) {
      if (!ValidInput()) {
        e.preventDefault();
        e.stopImmediatePropagation();
      }
    }
    else {
      ResetInput();
    }
  }
  isUsingDatepicker = ($(div.datepicker-dropdown).length > 0);
});

2016年2月1日

提早 Timeout

客戶反應未到四小時就被登出
檢查 Web程式的 web.config
Session Timeout和 Form Auth Timeout都是設定 240(分)
Log紀錄也有正常的 Timeout紀錄

可能是因為 Load Balance的 Sticky Timeout只設 60(分)

2015年11月16日

瑜珈課的體悟

同一個口令/指示 有多少人就有多少不同的動作

需要老師輔助

超越極限

個體能力不同

2015年10月28日

javascript 一個元件用兩個 class註冊同一種事件的觸發順序

<input class="A B" />

$('.A').keyup(function () {
  ...
});

$(document).delegate('.B', 'keyup', function () {
  ...
});

B會比 A先執行

2015年10月23日

開發時各項工具的選擇 要考慮後續維護使用

做台新專案的經驗
PM堅持 UML用 Astah做
但是接手的台新 IT團隊都用 Enterprise Architech