Have you found yourself frustrated about Visual Studio acting retarded on the values specified in search dialog ? I sure did. It was so frustrating when I wanted to search through whole project, no matter what file extensions and without ‘Word match’ option turned on. What Visual Studio has to say on this topic ? No can do mister..You specified few days ago, in one of your searches, that you want narrow your results to *.cs files and the search phrase have to match exactly the word, so from that moment on, I assume you want to search for it EVERY SINGLE TIME you open the search dialog..

Yes Visual Studio, you are right, I specified that, but you are just a retard to assume that I wanted those setting to be treated as a default

Anyhow..I was just tired of seeing this window, every time I clicked CTRL + SHIFT + F to search through the whole project, and having to clear those preserved and unwanted settings, that for some, unknown for me, reasons Visual Studio keeps them and treats as default. So annoying..

visual_studio_search_dialog

Unfortunately there’s no easy way of removing those settings. What you have to do is to open the registry and change some values. I’m opening Registry Editor with the shortcut of WINDOW BUTTON + R (opens a Run window) and typing, in it, regedit and hitting enter

run_window_with_regedit

after that you should be prompted with this window

registry_editor

Now you have to navigate to (bear in mind that your version of Visual Studio might be different)

HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0\Find

registry_editor_visual_studio_find

Locate the Filter # item(s) and DialogOptions. Those are the ones that are responsible for your misery and they need to ‘vanish’. What you want to do is to clear the values of the Filter # ones (set to empty string) and for the DialogOptions you have to change (in my case) WholeWord flag to be 0. BEFORE you start doing changes in the registry ALWAYS make a backup by Exporting.. the registry to a file

registry_backup

Second thing BEFORE making changes to those items (Filter # and DialogOptions) is to close all the Visual Studio instances that you’re currently running. If you won’t close them the settings will keep coming back. My guess is that when you close Visual Studio it updates those values in registry with whatever it has in cache, hence your changes will be overridden. So..having that done we can start making amendments in the registry entries.

modifying_registry_entry

registry_entry_edition

After making those changes, your registry view should be something like so (blanks for Filter # and changed flags for DialogOptions)

registry_edition_finished

Now, your search dialog should get back to normal (default)

First of, you have to have a library that you want to add to GAC. In my case it will be a Microsoft.Smartdevice.Connectivity.dll, which, version 10.0.0.0, you can find on google code.

Secondly, you need to have PowerShell installed on your machine. If you don’t have it, it’s a part of the Windows Management Framework and can be installed from there.

Having those prepared we can start installation process. Run PowerShell as administrator

running_powershell_as_administrator

After having PowerShell window in front of you, we will set alias to gacutil.exe so we could use this executable with a simple alias. What you have to do i is to type Set-Alias command in the PowerShell command and press return (hit enter). You will be asked to specify Name of our alias and Value you want to correlate with this name. The code itself will look like so

Set_Alias_in_powershell_for_gacutil

Bear in mind your Windows version, for me it’s Windows 8.1, hence the path is v8.1A. You can go to the directory

C:\Program Files (x86)\Microsoft SDKs\Windows

and chose the folder with the version of your Windows. After having this done, we can proceed to the installation with our just created alias. It’s done by just one line of code, which is

gacutil /i “<your_path_to_the_dll_file_you_want_to_install_in_GAC>\Microsoft.Smartdevice.Connectivity.dl”

Remember to put the path in between quotes e.g. “<path>”, because if there are spaces in the path, it will be misinterpreted by the gacutil and installation will fail. For me it looked like so

library_successfully_added_to_gac

In the end you can check if your library is truly in the GAC by going to the path

%windir%\Microsoft.NET\assembly

mine was installed in here

library_installed_in_gac

System_Update_Requirement_Microsoft.SmartDevice.Connectivity_Version_11

I wanted to install, as it later turns out extremely useful tools for Windows Phone development, Windows Phone Power Tools on my machine and soon after downloading installation file clicking Install I got prompted with information

Unable to install or run the application. The application requires that assembly Microsoft.SmartDevice.Connectivity Version 11.0.0.0 be installed in the Global Assembly Cache (GAC) first. More information on this system update can be found by visiting the site here

and I was not able to install it after all. Obviously, first thing I did was to check the Internet what it has to say about this condition. I was a bit disappointed, because all I found was only this thread which states that you have to make some amendments to the sources and then you’re good to go. I truly wasn’t pleased that I have to go through so much effort to just install one tool and what’s worse I had to have this tool for yesterday, because I had to do some storage testing (creating and removing files and directories). Fortunately the one that posted about changing sources provided a link to already prepared package for the Microsoft.SmartDevice.Connectivity and Windows Phone Power Tools problems.

I actually did not check if those sources work because they are compressed with RAR and I did not have any tool to unpack it…who packs things with RAR ? Eh..anyway, I came to conclusion that if this installer is expecting Version 11 in the GAC I will give it to him ;]

I opened GAC directory

Starting with the .NET Framework 4, the default location for the global assembly cache is %windir%\Microsoft.NET\assembly. In earlier versions of the .NET Framework, the default location is %windir%\assembly.

And looked for a folder named Microsoft.SmartDevice.Connectivity, for me the path was

C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.SmartDevice.Connectivity\v4.0_10.0.0.0__b03f5f7f11d50a3a

in which you can find another folder with an older or newer version (e.g. v4.0_10.0.0.0__b03f5f7f11d50a3a) of Microsoft.SmartDevice.Conectivity library. If you cannot find it go to my other post, how to install library (dll) in GAC using PowerShell

Microsoft_Smartdevice_Connectivity_dll_directory

The only one thing you have to do is to create a new directory which will point to “expected version”,

Microsoft_Smartdevice_Connectivity_dll_new_fake_directory

then you will copy the same *.dll that already ‘sits’ in the old / newer version folder to the one that you just created.

Microsoft_Smartdevice_Connectivity_dll_in_fake_directory

Now try to install tools again. You fooled installer that you actually have version that it requires ;]

Windows_Phone_Power_Tools_Installing

You can run into same problem but with Microsoft.VisualStudio.DeviceConnectivity.Interop.11.0 library. If you do, apply same “technic” as with Microsoft.SmartDevice.Connectivity library.

Microsoft.VisualStudio.DeviceConnectivity.Interop.11.0

 

Disclaimer: You have to be aware that this is not actually the *.dll that you should have in the folder that you just created, and other applications that rely on this specific version can just break or do not work properly.

This blog was lacking, from the very beginning, a new comment email notification. Finally, today, I’ve had enough of this feature not functioning properly. I did a research, I asked, as always, google for answers but I couldn’t get it to work easily.

What I found out after couple of google queries, is the official answer on this subject, which states that you should double check three things:

  • First check to make sure you are the author on the post where the comments are getting added.
  • Check the Settings → Discussion page to make sure email notifications are turned on.
  • Check the spam/junk folder in your email program to make sure the messages weren’t filed there by mistake.

I double checked those and all was fine. In that case WordPress official site suggest that you should contact with them about this issue. I didn’t, but feel free to do that. What I did was, to investigate a bit more. I finally found Chad Butler blog who wrote few articles about wp_mail method – which WordPress engine uses to send emails. I started with the one that talks about testing your wp_mail method, and used his code to check if my wp_mail method works:

It did not.

Then I went deeper into his articles and found the one that he writes about troubleshooting with the wp_mail function. He explains in it, why wp_mail method can fail to send an email. Then I read another of his blog posts, which talks about how to turn your wp_mail function to use other email address without using a plugin which in the end took me to the last, but not least, of his blog posts about turning your wp_mail method to use SMTP server without using a plugin. I followed his guildlines and used his code:

I specified my own – taken from web hosting that I’m using – SMTP configuration values, then I created an email address, in my web hosting administration panel, which could be then used as $phpmailer->Uername and $phpmailer->Password and then I pasted the code at the end of my function.php file, but before closing tag ?>. Afterwards I tested it by adding a new comment to one of my posts and waited for the notification.

It came after few seconds! It finally works!

Thanks Chad!

Actually I lied in the title, I haven’t learned it today but there was a day when I’ve stumble upon this attribute in someone’s code and started using it ever since. This is one of these things that makes your life much easier while debugging. What does this DebuggerDisplay attribute do exactly ?

Let’s start from the beginning. By default when inspecting an object e.g. House:

we will se something like this:

default_disply_of_the_object_while_debugging

You can say, but that’s not so bad, because we can inspect this object in details really easily by just expanding information about it, indeed:

checking_the_details_of_the_object

As you know this process, which sometimes cannot be omitted, could drive you mad, especially when you are almost at the end of expanding really complex object and then you miss clicked the last expanding arrow, so everything collapsed, and you’ve to start ‘digging’ from the beginning. Even though it could be a painful process it’s pretty straight forward to inspect whatever information you’re looking for. Things could get bit more annoying when you’re dealing with collections.

default_debugger_display_of_objects

This collection is just an example, of really small one, that still could be handled by this ‘clicking and expanding’ process, but imagine a collection with tens or hundreds of elements (probably you don’t have to imagine anything ‘cause you’re deal with those on regular basis) in which you want to check some deeply hidden property of a child of a child of a child of a child of your object. That would be a nightmare. With help comes DebuggerDisplay attribute which is used as simple as writing something like this

which gives us an effect of showing whatever information you need (even the one deeply hidden inside an child of a child etc.)

debuggerdisplay_attribute_in_action

Now you’re ready to use it and make your debugging life much easier. BEFORE that, though, you have to be aware of some possibilities and good practices in this subject. You can write basically any code you want in the attribute {string}. This expression is going to be evaluated and than presented while debugging. Previous chunk of code (with DebuggerDisplay attribute) is BADLY written and I’ve put it only for exampling purposes. The first BAD thing about it is that it’s going to evaluate three expressions, and evaluation costs. Second BAD thing is putting a collection indexer reference in it, which can cause exception. So how it should look like ? Like this:

The best practice for DebuggerDisplay attribute is to use as less expression to evaluate as possible and this can be achieved using one property which is going to present your object as you wish. For more specific information(and what this ‘nq‘ thing is doing in the DebuggerDisplay attribute {string}) go to this msdn blog post, which explains in details good and bad practices. It’s not so long and it’s definitely worth reading