Home
Programming
AD 連線工具:Active Directory Explorer
2018.11.14
最近在弄專案有需要透過 AD 做帳號的驗證,在寫程式之前需要使用連線工具來測試一下連線是否正確,以前雖然用過類似的工具,但是沒有記錄下來,太久沒用也會忘記以前用的工具是哪套了,所以這次還是紀錄一下好了。
這次我使用的工具是 Active Directory Explorer,對我來說只要輸入相關的資訊之後可以取得資訊我就當作驗證成功,驗證成功後就可以開始寫程式做測試了。
Active Directory Explorer v1.44
$.ajax is not a function
RojerChen.2018.10.17
今天發現先前改的程式 AJAX 功能失效,出現了這樣的錯誤 Uncaught TypeError: $.ajax is not a function ,查了一下,主因好像是先前更新了 bootstrap 之後,把 jquery 改成了 jquery-3.3.1.slim.min.js 這個了。
今天發現先前改的程式 AJAX 功能失效,出現了這樣的錯誤 Uncaught TypeError: $.ajax is not a function ,查了一下,主因好像是先前更新了 bootstrap 之後,把 jquery 改成了 jquery-3.3.1.slim.min.js 這個了。
TDD LeetCode:905. Sort Array By Parity
RojerChen.2018.10.01
Given an array
A of non-negative integers, return an array consisting of all the even elements of A, followed by all the odd elements of A.
You may return any answer array that satisfies this condition.
Example 1:
Input: [3,1,2,4] Output: [2,4,3,1] The outputs [4,2,3,1], [2,4,1,3], and [4,2,1,3] would also be accepted.
Note:
1 <= A.length <= 50000 <= A[i] <= 5000
TDD LeetCode:461. Hamming Distance
The Hamming distance between two integers is the number of positions at which the corresponding bits are different.
Given two integers
x and y, calculate the Hamming distance.
Note:
0 ≤
0 ≤
x, y < 231.
Example:
Input: x = 1, y = 4 Output: 2 Explanation: 1 (0 0 0 1) 4 (0 1 0 0) ↑ ↑ The above arrows point to positions where the corresponding bits are different.
TDD LeetCode:804. Unique Morse Code Words
RojerChen.2018.09.17
International Morse Code defines a standard encoding where each letter is mapped to a series of dots and dashes, as follows:
"a"maps to ".-", "b" maps to "-...", "c" maps to "-.-.", and so on.
For convenience, the full table for the 26 letters of the English alphabet is given below:
[".-","-...","-.-.","-..",".","..-.","--.","....","..",".---","-.-",".-..","--","-.","---",".--.","--.-",".-.","...","-","..-","...-",".--","-..-","-.--","--.."]
Now, given a list of words, each word can be written as a concatenation of the Morse code of each letter. For example, "cab" can be written as "-.-.-....-", (which is the concatenation "-.-." + "-..." + ".-"). We'll call such a concatenation, the transformation of a word.
Return the number of different transformations among all words we have.
Example: Input: words = ["gin", "zen", "gig", "msg"] Output: 2 Explanation: The transformation of each word is: "gin" -> "--...-." "zen" -> "--...-." "gig" -> "--...--." "msg" -> "--...--." There are 2 different transformations, "--...-." and "--...--.".
Note:
- The length of
wordswill be at most100. - Each
words[i]will have length in range[1, 12]. words[i]will only consist of lowercase letters.
TDD LeetCode:771. Jewels and Stones
RojerChen.2018.09.12
You're given strings
You're given strings
J representing the types of stones that are jewels, and S representing the stones you have. Each character in Sis a type of stone you have. You want to know how many of the stones you have are also jewels.
The letters in
J are guaranteed distinct, and all characters in J and S are letters. Letters are case sensitive, so "a" is considered a different type of stone from "A".
Example 1:
Input: J = "aA", S = "aAAbbbb" Output: 3
Example 2:
Input: J = "z", S = "ZZ" Output: 0
Note:
SandJwill consist of letters and have length at most 50.- The characters in
Jare distinct.
LeetCode:196. Delete Duplicate Emails
RojerChen.2018.08.31
今天在解 LeetCode 196. Delete Duplicate Emails 這題,剛好遇到了問題紀錄一下,以下是這題的題目。
Write a SQL query to delete all duplicate email entries in a table named
Person, keeping only unique emails based on its smallest Id.+----+------------------+ | Id | Email | +----+------------------+ | 1 | john@example.com | | 2 | bob@example.com | | 3 | john@example.com | +----+------------------+ Id is the primary key column for this table.
For example, after running your query, the above
Person table should have the following rows:+----+------------------+ | Id | Email | +----+------------------+ | 1 | john@example.com | | 2 | bob@example.com | +----+------------------+
Note:
Your output is the whole
Person table after executing your sql. Use delete statement.關於 Microsoft Fake 的使用情境與除錯
RojerChen.2017.06.03
最近在看這篇文章的時候,遇到了一些 Fake 的問題,因此紀錄一下
※使用 Fake 的情境
假設每到星期五的時候就要來點折扣,所以我需要一個功能來去判斷今天是不是星期五,如果是的話就需要特價。
最近在看這篇文章的時候,遇到了一些 Fake 的問題,因此紀錄一下
[30天快速上手TDD][Day 7]Unit Test - Stub, Mock, Fake 簡介
※使用 Fake 的情境
假設每到星期五的時候就要來點折扣,所以我需要一個功能來去判斷今天是不是星期五,如果是的話就需要特價。
public class eCommerical { public bool isTimeToDiscount() { bool result = DateTime.Today.DayOfWeek == DayOfWeek.Friday; return result; } }
在寫測試的時候我可能就會這樣寫,只不過這樣寫的問題在於,如果今天是星期五執行測試,那會通過沒有問題,但是如果是非星期五的時候,執行測試就會失敗。
[TestMethod] public void Test_Is_Time_To_Discount() { //arrange bool expected = true; MyLibrary.eCommerical eCom = new eCommerical(); //act bool actual = eCom.isTimeToDiscount(); //assert Assert.AreEqual(expected,actual); }
如何使用 NHibernate 連接 Sybase ASE
RojerChen.2014.05.09
最近因為工作的關係要連接 Sybase ASE 資料庫,原本是想要使用 Entity Framework,不過目前 Sybase 只支援到 EF 4.3 、VS2008、VS2010,因為遍尋不著 Entity Framework Data Provier for Sybase,只好選擇 NHibernate。
1.使用 Visual Studio 透過 NuGet 安裝 NHibernate,或是連到 官網 下載
最近因為工作的關係要連接 Sybase ASE 資料庫,原本是想要使用 Entity Framework,不過目前 Sybase 只支援到 EF 4.3 、VS2008、VS2010,因為遍尋不著 Entity Framework Data Provier for Sybase,只好選擇 NHibernate。
1.使用 Visual Studio 透過 NuGet 安裝 NHibernate,或是連到 官網 下載
Could not create the driver from NHibernate.Driver.SybaseAseClientDriver.
RojerChen.2014.05.09
目前我的環境是要透過 NHibernate 連接 Sybase ASE 資料庫,不過程式會跑出這樣的錯誤
Could not create the driver from NHibernate.Driver.SybaseAseClientDriver。
原本以為是 NHibernate 不知道目前我使用環境的版本,結果不是。
※系統環境
VS2013
NHibernate 3.3.3.4001
Sybase Adaptive Server Enterprise 15.7.0
目前我的環境是要透過 NHibernate 連接 Sybase ASE 資料庫,不過程式會跑出這樣的錯誤
Could not create the driver from NHibernate.Driver.SybaseAseClientDriver。
原本以為是 NHibernate 不知道目前我使用環境的版本,結果不是。
※系統環境
VS2013
NHibernate 3.3.3.4001
Sybase Adaptive Server Enterprise 15.7.0
PHP Smart 框架 assign 傳遞參數
PHP 可以用 Smarty 這個 Framework 框架來做網頁上面的開發,讓 PHP 和 HTML 分離,比方說可以透過下面這種方式來載入 HTML 檔案。
當我 HTML 裡面有值要傳入的時候,可以先在 PHP 上面先設定參數的值,然後再顯示出來。
$smarty->display("XXX.HTML");
當我 HTML 裡面有值要傳入的時候,可以先在 PHP 上面先設定參數的值,然後再顯示出來。
#XXX.PHP
設定值
$smarty->assign("data","value);
#XXX.HTML
顯示資料
<%$data%>
MySQL:Error Code 1449 There is no account@localhost registered
RojerChen.2013.07.25
最近在處理 MySQL 的資料備份和移機,只不過當資料都轉移到新機器後,卻發現有個程式的資料一直沒有寫進資料庫來,找了很久直到我自己下SQL指令測試後,才發現到系統拋出這個錯誤訊息:Error Code 1449 There is no account@localhost registered
由於該 INSERT 的語法會觸發 Trigger ,但是該 Trigger 裡面卻是這樣寫的,因為系統沒有這個帳號所以在寫入的時候會寫入失敗,所以將 Trigger 的內容修改成系統有的帳號,並且確認該帳號有無寫入更新的權限即可。
CREATE
DEFINER=`account`@`localhost`
TRIGGER `db`.`INS_TABLE`
AFTER INSERT ON `db`.`table`
最近在處理 MySQL 的資料備份和移機,只不過當資料都轉移到新機器後,卻發現有個程式的資料一直沒有寫進資料庫來,找了很久直到我自己下SQL指令測試後,才發現到系統拋出這個錯誤訊息:Error Code 1449 There is no account@localhost registered
由於該 INSERT 的語法會觸發 Trigger ,但是該 Trigger 裡面卻是這樣寫的,因為系統沒有這個帳號所以在寫入的時候會寫入失敗,所以將 Trigger 的內容修改成系統有的帳號,並且確認該帳號有無寫入更新的權限即可。
CREATE
DEFINER=`account`@`localhost`
TRIGGER `db`.`INS_TABLE`
AFTER INSERT ON `db`.`table`
Javascript:Array.prototype 的使用
RojerChen.2013.01.29
最近專案都在寫 JS,在處理陣列的時候有內建的 PUSH、POP、SPLICE 等功能可以來取得、刪除資料,只不過當我要把資料刪除、插入等等功能好像就沒有提供得很完整,所以就需要稍微客製化一下!
首先我們先來看 W3C 對於 Array Prototype 的說明:
最近專案都在寫 JS,在處理陣列的時候有內建的 PUSH、POP、SPLICE 等功能可以來取得、刪除資料,只不過當我要把資料刪除、插入等等功能好像就沒有提供得很完整,所以就需要稍微客製化一下!
首先我們先來看 W3C 對於 Array Prototype 的說明:
Definition and Usage
The prototype constructor allows you to add new properties and methods to the Array() object.
When constructing a property, ALL arrays will be given the property, and it's value, as default.
When constructing a method, ALL arrays will have this method available.
Note: Array.prototype does not refer to a single array, but to the Array() object itself.
Note: Prototype is a global object constructor which is available for all JavaScript objects.
jQuery 的學習筆記-1:jQuery 的載入
RojerChen.2012.01.05
jQuery 這個東西我記得我在 /* 程式碼無所不在,與生活環環相CODE */ VS2010產品上市發表會那個時候就有聽過了,只不過一直以來我在工作上比較少開發網頁,所以對於 jQuery 這個 javascript framework 一直沒有去熟悉如何使用,直到最近案子上的需要才開始接觸到。
使用 jQuery 到現在也快一個多月,雖然程式能跑不過卻不是很知其所以然來,所以還是需要看書、看文章來練習一下基本功,就先就從 Hello jQuery 開始吧!
jQuery 這個東西我記得我在 /* 程式碼無所不在,與生活環環相CODE */ VS2010產品上市發表會那個時候就有聽過了,只不過一直以來我在工作上比較少開發網頁,所以對於 jQuery 這個 javascript framework 一直沒有去熟悉如何使用,直到最近案子上的需要才開始接觸到。
使用 jQuery 到現在也快一個多月,雖然程式能跑不過卻不是很知其所以然來,所以還是需要看書、看文章來練習一下基本功,就先就從 Hello jQuery 開始吧!
訂閱:
文章
(
Atom
)





