In this blog I will show how to replace underscores with hyphens in a string with REGEX. Let's say we have a string "This_is_test_string" and we want to replace underscores with hyphens ...
In this blog I will show how to get number only from a string with REGEX. Let's say we have a string "Hello 123456789 user 456 welcome." and we want the output to be "123456789456&q...
In this blog I will show how to validate a string to allow alphanumeric characters only in a string with REGEX. Below is the sample code to do the same: using System; using System.Text.RegularExpressi...
In this blog I will show how to remove all non numeric characters from a string with REGEX. Let's say we have a string "(912)-555-7777" and remove all non numeric characters so that the ...
In this blog I will show how to remove all non alpha numeric characters from a string with REGEX. Let's say we have a string "Hello!@#$123456789~~-_user456welcome" and remove all non alp...
In this blog I will show how to reverse all numbers in string with REGEX. Let's say we have a string "Hello 123456789 user 456 welcome." and we want to reverse it like "Hello 987654...
I encountered a piece of code where regex replacement was done in the following way: Regex.Replace(@"\d+", m => new string(m.Value.Reverse().ToArray())); It was giving the following e...
In this blog I will show how to replace multiple spaces with a single space with REGEX. Let's say we have a string "a b c d e f g" and we want to replace multiple spaces with a single sp...
I was getting the folowing screen while loading IntelliJ IDEA editor: Plugin com.intellij failed to initialize and will be disabled: null The solution for this issue was to set the JAVA_HOME path in E...
In this blog I will show how to validate whether a string is a valid IP address not with REGEX. Below is the sample code to check the same: using System; using System.Text.RegularExpressions; namespac...
Let's say we have a string and we want to match that string not containing a word say alpha . I have used Regex class in order to do so
I encountered with a piece of code today where anchor tag was having label tag inside it like this: <a href="/targeturl" class="no-underline"> <label> D...
Today we faced a weird issue. We noticed that on one machine images were not displaying in browser. On taking screenshot of same window the images appeared in the screenshot. After checking the Firebu...
While using Directory.GetFiles I started getting the following excpetion Path too long error message when exceeding MAX_PATH Luckily I came across the following library: Delimon.Win32.I​O Library (V4....
While using the File.Move method to move a file from one location to other: File.Move(oldPath, newPath); I was getting the following exception: Access to the path is denied. Exception Details: System....
When IIS sends the response to browser it also sends "X-Powered-By" HTTP Headers along with the response. It can pose security risk to your server. It can be removed via adding following cod...
Whenever a browser makes an HTTP request to a web server, the webserver sends the response along several HTTP headers. SOme of them are necessary and tehre are few others like "Server" "...
If you are struggling with the small font size Firebug don't worry it has solution. It is configurable. This can be done via clicking firebug icon and then selecting the menu as shown in image:
There are situations when you have very large .sql files and you want to execute them. The issue comes when you have to open those files in SSMS. They start giving out of memory exceptions. The soluti...
If you have SQL Server 2012 and want to create Schema and data script for SQL Server 2008 R2 you can follow the following steps: Right click the DB. Select "Generate Scripts" Go to Set Scrip...
If you are using SQL Server Management Objects (SMO) and want to take backup of a database the following code will help you: private static void BackupDatabase(string dbName, string backupPath) { // F...
You all might be familiar with Assembly.LoadFrom method which can be use to get the version of the assembly but this method has a disadvantage as it will load the assembly into the domain and you will...
On starting IIS on my machine I was getting Cannot start service W3SVC on computer '.' message: The solution was to run the following command via command prompt: net start w3svc After running ...
I was creating sql backup via an ASP.NET application. On running the code written for creating backup I was getting the following exception: Backup Failed for Server 'xxxxx' Operating system e...
I was working with a project using SQL Server SMO to connect/communicate with SQL server. For that I needed SQL Server SMO dlls. After struggling a bit I was able to locate it and the path for those d...