This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
USE DATABASENAME | |
GO | |
SELECT IDENT_CURRENT('TABLENAME') + IDENT_INCR('TABLENAME') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static string ToReadableString(this TimeSpan span) | |
{ | |
string formatted = string.Format("{0}{1}{2}{3}", | |
span.Duration().Days > 0 ? string.Format("{0:0} day{1}, ", span.Days, span.Days == 1 ? String.Empty : "s") : string.Empty, | |
span.Duration().Hours > 0 ? string.Format("{0:0} hour{1}, ", span.Hours, span.Hours == 1 ? String.Empty : "s") : string.Empty, | |
span.Duration().Minutes > 0 ? string.Format("{0:0} minute{1}, ", span.Minutes, span.Minutes == 1 ? String.Empty : "s") : string.Empty, | |
span.Duration().Seconds > 0 ? string.Format("{0:0} second{1}", span.Seconds, span.Seconds == 1 ? String.Empty : "s") : string.Empty); | |
if (formatted.EndsWith(", ")) formatted = formatted.Substring(0, formatted.Length - 2); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public string TimespanInWords(DateTime oDtTo, DateTime oDtFrom) | |
{ | |
TimeSpan oTs = oDtTo >= oDtFrom ? oDtTo - oDtFrom : oDtFrom - oDtTo; | |
if (oTs.TotalSeconds < 30) | |
return "less than a minute"; | |
if (oTs.TotalSeconds < 90) | |
return "1 minute"; | |
if (oTs.TotalSeconds < 44 * 60 + 30) | |
return (int)oTs.TotalMinutes + " minutes"; | |
if (oTs < new TimeSpan(0, 89, 30)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://gitstack.com/how-to-migrate-from-tfs-to-git/ | |
http://stackoverflow.com/questions/19548659/migrate-from-tfs-to-git-on-visualstudio-com/19550144 | |
git-tfs clone --username=mumair85 --password=xxxx https://mumair85.visualstudio.com/DefaultCollection $/uGen | |
After that clone the new repository or Push an existing repository | |
From Visual Studio | |
You can Push a repository after connecting with Team Explorer and adding the Git repo to your list of Local Git Repositories. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AjaxJsonPostCall = function (fullUrl, dataObj, callbackFunction) { | |
$.ajax({ | |
type: 'post', | |
url: fullUrl, | |
data: JSON.stringify(dataObj), | |
dataType: 'json', | |
cache: false, | |
success: function (data) { callbackFunction(GetJson(data)); }, | |
error: function (XMLHttpRequest, textStatus, errorThrown) { | |
console.log("error :" + XMLHttpRequest.responseText); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From: http://www.csharp-examples.net/string-format-datetime/ | |
String Format for DateTime [C#] | |
This example shows how to format DateTime using String.Format method. All formatting can be done also using DateTime.ToString method. | |
Custom DateTime Formatting | |
There are following custom format specifiers y (year), M (month), d (day), h (hour 12), H (hour 24), m (minute), s (second), f (second fraction), F (second fraction, trailing zeroes are trimmed), t (P.M or A.M) and z (time zone). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UPDATE TableName | |
SET DBTextField = REPLACE(CAST(DBTextField AS varchar(MAX)), 'SearchText', 'ReplaceText') | |
FROM TableName | |
WHERE CHARINDEX('SearchText', CAST(DBTextField as varchar(MAX))) > 0 | |
Example: | |
UPDATE [database].[dbo].[table] | |
SET [column_name] = REPLACE(CAST([column_name] AS varchar(MAX)), 'OLD_WORD', 'NEW_WORD') | |
FROM [database].[dbo].[table] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected void Button1_Click(object sender, EventArgs e) | |
{ | |
Page.Validate(); <--- you need this | |
if (Page.IsValid) | |
{ | |
lblResult.Text = "All Good"; | |
} | |
else | |
{ | |
lblResult.Text = "The words you entered are incorrect"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://www.codeproject.com/Articles/657264/Couple-of-not-so-different-approaches-to-paging-in | |
http://www.codeproject.com/Articles/533932/Custom-ASP-NET-MVC-ActionResults | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DBCC CHECKIDENT (tableName, RESEED, 10) | |
Note that the next value will be whatever you reseed with + 1, so in this case I set it to 10 so that the next value will be 11. |