torsten's .NET blog In the end, everything is a gag [Ch. Chaplin]
# Tuesday, November 02, 2010
There are people that like my site...

... and rssbandit.org - not meant sarcastic: see the new navigation section "Site supporters" at left side. More are very welcome.

Technorati tags:  | 
Tuesday, November 02, 2010 11:41:46 AM (W. Europe Standard Time, UTC+01:00)    #  Comments [2]  | 
# Saturday, January 31, 2009
How to prevent the configuration file watcher thread in Microsoft Enterprise Library 3.1

I have not blogged very much the last time, but now I'm back to write about some interesting things again. Lets start with the Microsoft Enterprise Library. For some reasons we are still bound to version 3.1, so the following is valid for that version only - it might not work with the newer version 4.x yet available.

So what I'm writing about? If you ever run a trace tool for an application using the Entlib you might have considered a separate thread "ConfigurationChangeFileWather" (right, it is misspelled - but that thread name is set by the Entlib, sorry). How comes? If you don't need this service (config changes are monitored while the application is running) there is not much information about it how to disable that (especially if you run in ASP.NET with the Entlib). Google around, the most answers I found are: you cannot disable that without modifying the Entlib source code (you can, but who will ever really do this and maintain it over the versions?). So I will describe a scenario, how we use it and how we disable that thread (consuming resources, because it polls the file change date).

For all, that don't like to read the full story: you just have to call

FileConfigurationSource.ResetImplementation(filePath, false);

The filePath variable should point to the Entlib configuration file you use, the important parameter is the boolean. That's it!

But, you know that filePath is also a configuration entry, and hard-coding that is not really what you want. Our app.config files are looking like this, your file might be similar:

 <configuration>
 <configSections>
  <section name="enterpriseLibrary.ConfigurationSource" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ConfigurationSourceSection, Microsoft.Practices.EnterpriseLibrary.Common, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
  </configSections>
 <enterpriseLibrary.ConfigurationSource selectedSource="File Configuration Source">
 <sources>
  <add name="File Configuration Source" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.FileConfigurationSource, Microsoft.Practices.EnterpriseLibrary.Common, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" filePath="Module.EnterpriseLibrary.config" />
 </sources>
</enterpriseLibrary.ConfigurationSource>
 

The interesting parts are marked red. As you can see: you can have multiple sources, but only the selected source is important here. It has the filePath attribute, that points to the real Enterprise Library configuration file (that is monitored by the thread). So to make the call above dynamic, you have to get the value from the filePath attribute:

  public static string ModuleConfigurationFile
  {
    get {
      ConfigurationSourceSection section = ConfigurationSourceSection.GetConfigurationSourceSection();
      if (section != null && !String.IsNullOrEmpty(section.SelectedSource) &&
          section.Sources.Count > 0)
        {
          FileConfigurationSourceElement e = section.Sources.Get(section.SelectedSource) as FileConfigurationSourceElement;
          if (e != null)
            return e.FilePath;
          }
          return null;
        }
    }

First we get the section (enterpriseLibrary.ConfigurationSource) to read the selectedSource attribute content. If it is set, we read the corresponding source element and return the file path.

So now call the function mentioned above with the dynamic ModuleConfigurationFile property somewhere in your application startup phase -- no configuration file watcher anymore!

Technorati tags:  | 
Saturday, January 31, 2009 12:08:49 PM (W. Europe Standard Time, UTC+01:00)    #  Comments [4]  | 
# Sunday, May 18, 2008
WebBrowser control hosting and build-in zoom: how to get it work again

You may have noticed the zoom keyboard shortcuts (CTRL+mouse wheel forward/back, CTRL+PLUS SIGN, and CTRL+MINUS SIGN) are not enabled by default when hosting the WebBrowser control if you have installed IE7, while it does without any problem with older IE versions. This was now an issue for a long time in RSS Bandit, that we couldn't fix. Yesterday I did a research again and found this page: MSDN about IZoomEvents. We already implemented the font size change using a menu (see KB 304103) but it offers not the same usability that you have with older IE x and loose if you switch from IEx to IE7 and run RSS Bandit. Now it works again like a charm and for your convenience I repeat the important part you have to apply in your own IE hosting code:

"To enable this behavior, call IWebBrowser2::ExecWB with OLECMDID_OPTICAL_ZOOM, passing 100 in pvaIn. Once set, the keyboard shortcuts remain available as long as the host navigates to HTML content because the same instance of MSHTML is used. However, if the host navigates to Active documents, such as XML or Portable Document Format (PDF) files, optical zoom is disabled and will need to be enabled again."

What the docs are not mention: you should call this at a time the hosted control is visible and fully initialized, or you will get wired COM exceptions...

Technorati tags:  |  |  | 
Sunday, May 18, 2008 1:50:20 PM (W. Europe Daylight Time, UTC+02:00)    #  Comments [0]  | 
# Wednesday, February 27, 2008
Now I'm a WOT Notary

As you also can imagine by the new batch left side down this page: I'm now a WOT notary! So what does WOT mean? Here is a short cite:

"The thawte Web of Trust (WOT) is a Certification system that allows your identity to be validated for use in your Personal Certificate."

By default if you acquire a free e-mail Certificate from thawte, the Certificate is a general one: your name is not included in the Certificate properties nor in the trust chain. By identity validation (task of a WOT notary) you get a fully personalized Certificate including your name!

I like to spread and support e-mail signing/encryption to fight the Spam - so I decided to support (regional) users to get that personal free certificate to keep the e-mail system up and running: just filter for signed mails. I use it now for some years, believe me: if you once have the Cert., it's really easy to use. So if you ever get a mail sent by me but not signed, just move it to your waste basket...

So come on: sign your mails!

Technorati tags:  |  | 
Wednesday, February 27, 2008 1:19:25 AM (W. Europe Standard Time, UTC+01:00)    #  Comments [2]  | 
# Monday, December 24, 2007
Merry Christmas, and thank you

I wish you a merry christmas and a happy new year 2008! Thank you for your support of the Open Source project, for your pacience if we did not get a bug fixed within a day and for the time you waiting to get your huge feedlist loaded - sorry for that ;-)

But as Dare Obasanjo wrote, we will get a new release 1.6.x running on CLR 2.0 only out these days so there is a good chance the annoying issues you may have considered get fixed meanwhile.

Also a warm welcome to the new team member Oren - looks like he was just waiting for the moment we start using the newest bits - CLR 2.0 and above - to jump into code, thanks Oren! Think, we will have a good time next year too...

Technorati tags:  | 
Monday, December 24, 2007 1:40:09 PM (W. Europe Standard Time, UTC+01:00)    #  Comments [0]  | 
# Saturday, November 10, 2007
Information r/evolution...

I really like that animation movie:

(source: information r/evolution movie @ information aesthetics)

Technorati Tags:
Technorati tags:
Saturday, November 10, 2007 11:55:17 PM (W. Europe Standard Time, UTC+01:00)    #  Comments [0]  | 
# Friday, October 19, 2007
Get the local mapped network drives using WMI

Today I helped a coworker to get the local mapped network drives using WMI instead of COM Interop/native windows API. Just to keep the code as a reminder and help others with the same problem I provide it here.

The result of the code below is in general the same you will get if you hit the "net use" command at the windows command shell prompt. For further infos and reading I suggest http://msdn2.microsoft.com/en-us/library/aa394173.aspx (Win32_LogicalDisk; MSDN WMI Reference); for immediate results of query the WMI you should use Scriptomatic (download from http://www.microsoft.com/downloads/details.aspx?familyid=09DFC342-648B-4119-B7EB-783B0F7D1178&displaylang=en).

Little bit optimization is yet possible providing the drive type in the WQL as a where clause parameter, so here it is:

/// <summary>
/// Container for Share entries
/// </summary>
public struct SharePathEntry
{
  public string Name;
  public string Path;
  public SharePathEntry(string n, string p) {
    Name = n;
    Path = p;
  }
}

// for other types see: http://msdn2.microsoft.com/en-us/library/aa394173.aspx
const int NetworkDriveType = 4;

public static List<SharePathEntry> GetLocalShares()
{
  List<SharePathEntry> allLocalShares = new List<SharePathEntry>(); // a container

  WqlObjectQuery objectQuery = new WqlObjectQuery("select DriveType,DeviceID,ProviderName from Win32_LogicalDisk");
  ManagementScope scope = new ManagementScope(@"\\.\root\cimv2"); // local WMI namespace
  scope.Options.Impersonation = ImpersonationLevel.Impersonate;
  scope.Options.EnablePrivileges = true;
  ManagementObjectSearcher searcher = new ManagementObjectSearcher(scope, objectQuery);
  foreach (ManagementObject share in searcher.Get())
  {
    int driveType = Convert.ToInt32(share["DriveType"]);
    if (driveType == NetworkDriveType) {
      object objName = share["DeviceID"];
      object objPath = share["ProviderName"];
      if (null != objName && null != objPath)
      {
        allLocalShares.Add(new SharePathEntry(objName.ToString(), objPath.ToString()));
      }
    }
  }
  return allLocalShares;
}
Technorati tags:  |  | 
Friday, October 19, 2007 11:02:12 AM (W. Europe Daylight Time, UTC+02:00)    #  Comments [0]  | 
# Friday, September 21, 2007
We break the million: overall downloads

It seems we hit the high border some days ago: the overall download counter at SF is above one million for the favorite newsreader...

Thank you all, that love the project - you are the real motivation engine!

Technorati tags:
Friday, September 21, 2007 2:31:22 PM (W. Europe Daylight Time, UTC+02:00)    #  Comments [5]  | 
# Thursday, September 20, 2007
Project source browsing with FishEye

You may have noticed we released v1.5.0.17 of my favorite feed reader (and refreshed the installer meanwhile) - for the coding guys we now have even more: Project Supported by FishEye

Thanks to the folks at atlassian we are now have the comfortable source browsing tool running on the SF repositories (CVS with the CLR 1.1 code and SVN for CLR 2.0). Most I like the diffs view and RSS link in the top right - there the circle closes (subscribed).

Technorati tags:  |  | 
Thursday, September 20, 2007 8:23:26 AM (W. Europe Daylight Time, UTC+02:00)    #  Comments [0]  | 
# Thursday, August 02, 2007
Make use of it: the portable Bandit

Is I wrote recently, I worked to get RSS Bandit running as a portable application. Now it is time to test it: you can download the ShadowCat Beta 2 release installer, then read how you get it done.

Technorati tags:  |  | 
Thursday, August 02, 2007 3:17:27 PM (W. Europe Daylight Time, UTC+02:00)    #  Comments [4]  | 
Navigation

Like RSS Bandit? Make a donation to help support its development and maintenance. As little as 1€ will help.

Make payments with PayPal - it's fast, free and secure!
Site supporters
On this page....
<November 2010>
SunMonTueWedThuFriSat
31123456
78910111213
14151617181920
21222324252627
2829301234
567891011

SUBSCRIBE RSS GeoURL e-mail

Search
Categories
Blogroll

newtelligence dasBlog 2.3.9074.18820

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

Join WebHost4Life.com