All the posts, comments and answers that developed today in me trying to solve a mysterious issue.
http://stackoverflow.com/q/36327747/1219280
http://stackoverflow.com/q/36329642/1219280
Keeping track of interesting places I put my feet on in the software development world.
Search This Blog
Thursday, March 31, 2016
Monday, February 22, 2016
C# Regex Positive Lookbehind
An example of positive lookbehind (Matches a group before the main expression without including it in the result):
var str = @"System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.ApplicationException: MQException is caught. Reason code: 2033, completion code: 2. ---> CompCode: 2, Reason: 2033
--- End of inner exception stack trace ---
at Multiconn.ZZZ.Web.Services.Port.EndProcess(IAsyncResult asyncResult)
at Multiconn.ZZZ.Demo.K.M.E(IAsyncResult asyncResult, WsEsParams1Response& result1, MyType result3)
--- End of inner exception stack trace ---";
Regex r = new Regex(@"(?<=Reason code: )\d+");
foreach (Match m in r.Matches(str))
Console.WriteLine(m.Value);
var str = @"System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.ApplicationException: MQException is caught. Reason code: 2033, completion code: 2. ---> CompCode: 2, Reason: 2033
--- End of inner exception stack trace ---
at Multiconn.ZZZ.Web.Services.Port.EndProcess(IAsyncResult asyncResult)
at Multiconn.ZZZ.Demo.K.M.E(IAsyncResult asyncResult, WsEsParams1Response& result1, MyType result3)
--- End of inner exception stack trace ---";
Regex r = new Regex(@"(?<=Reason code: )\d+");
foreach (Match m in r.Matches(str))
Console.WriteLine(m.Value);
Sunday, February 21, 2016
Impefect Content-Type http response headers
Monday, December 28, 2015
Make sure you are testing/playing with regular expressions in an environment that follows the same regular expression behavior of the programming language you are using
Upon posting this question, I learn that it is mandatory, whenever testing/playing with regexes, to make sure you are using an environment that follows/matches the Regular Expression behavior of the language you are programming with.
Otherwise things will not make sense.
Check this for online sandboxes for regex testing, per programming language.
Otherwise things will not make sense.
Check this for online sandboxes for regex testing, per programming language.
Wednesday, December 16, 2015
Nuget Helpers Package
Uploaded a nuget package containing methods I have been using very often in new projects.
Below is a list of all methods provided at this point:
Nuget install command: Install-Package Helpers
Below is a list of all methods provided at this point:
Nuget install command: Install-Package Helpers
Sunday, December 13, 2015
Enforcing a given number of digits in a numeric value in Javascript
Javascript does not a built-in functionality like C#'s .ToString("0000").
To accomplish the same I came up with the following:
function setNumericFormat(value, numOfDigits, paddingChar) {
var length = value.toString().length;
if (length < numOfDigits) {
var prefix = "";
for (var i = 1; i <= numOfDigits - length; i++) {
prefix += paddingChar;
}
return prefix + value.toString();
}
return value.toString();
}
Resembles a LeftPad function...
To accomplish the same I came up with the following:
function setNumericFormat(value, numOfDigits, paddingChar) {
var length = value.toString().length;
if (length < numOfDigits) {
var prefix = "";
for (var i = 1; i <= numOfDigits - length; i++) {
prefix += paddingChar;
}
return prefix + value.toString();
}
return value.toString();
}
Resembles a LeftPad function...
Wednesday, November 25, 2015
Need to migrate your sql server database and wondering how will you get all the objects sql scripts ?
Found out that it is quite simple.
In case the link gets broken:
In case the link gets broken:
- Mouse right-click on the database in question, in the database explorer
- Select Tasks
- Select Generate Scripts
- Choose all the objects you want the scripts to be generated.
That's all.
Subscribe to:
Posts (Atom)
