SQL Server: Hiding your prod data and built-in function STUFF()

If you need to use production data for your testing and don’t want to expose any sensitive data on your development environment, you should look at obfuscating them.  This article shows the common obfuscation methods in use: character scrambling, repeating character masking, numeric variance, nulling, artificial data generation, truncating, encoding, and aggregating.

Also, if you are looking for a function in SQL Server that pretty much does like the function REPLACE() but only replaces one substring in a specific position and length, then STUFF() might be the one.

Writing to an output text file and finding out extra characters or lines in it?

If you’re using File.OpenWrite() to create the output file, make sure the output file does not exist.  This MSDN article explains what happens if output file exists:

For an existing file, it does not append the new text to the existing text. Instead, it overwrites the existing characters with the new characters. If you overwrite a longer string (such as “This is a test of the OpenWrite method”) with a shorter string (such as “Second run”), the file will contain a mix of the strings (“Second runtest of the OpenWrite method”).

What’s new in C# 6?

Even though I’m still using VS2013 for all the projects I’m working on, it won’t hurt to know the new features of C# 6 in VS2015.  I might start converting some of them or maybe start the new projects in VS2015, who knows.

I won’t try to write about the new features in C# 6 in this post as I am pretty sure you can find them on the Internet.  Though there is one that I like and it’s New Language Features in C# 6.  I hope this helps.

Display Bootstrap’s Navbar Dropdown Menu On Hover


Using only 3 simple CSS rules, you can have your Bootstrap’s navbar menu dropdown display on hover seamlessly.  Below is the CSS code:

/* display dropdown menu on hover
   only when navbar is not in mobile mode (hamburger menu mode) */
@media (min-width: 768px) 
	/* display submenu on hover */
	.dropdown:hover .dropdown-menu {
		display: block;

	/* since submenu gets displayed too when dropdown menu is clicked 
		and remains displayed until dropdown menu is clicked again,
		we need to hide submenu */
	.open > .dropdown-menu {
		display: none;

	/* also dropdown menu is highlighted when clicked,
		so we need to unhighlight dropdown menu */
	.navbar-default .navbar-nav > .open > a, 
	.navbar-default .navbar-nav > .open > a:focus {
		background-color: transparent;