Нещо, което отдавна исках да споделя, един уникално як пост от блога на Георги Кременлиев.
Enjoy
28.08.2009 г.
14.04.2009 г.
My first paragliding experience
This Sunday me and my wife went to a village near Sopot to see an ex-colleague of mine named Christo. He is keen on paragliding and along with other people like him get together almost every weekend to conquer the clouds. This time I used the chance to join him and take a ride with him. It was great to feel the wind and also to see the land with a hawk eye. Thank you Christo for the wonderful ride.
Here is some multimedia from the event:


Here is some multimedia from the event:
Do not buy yourself a Renault...really don't.
I've heard lots of stories about how awful Renault cars are. And I believe those stories. So I'm proud with my "Made in Germany" car which is a crap too, but at least is a German crap :) So enough for my ride and lets go back on the Renaults. Not so far ago while driving to work I managed to take the following photos. They are Photoshop free and absolutely genuine.

Can't see anything strange??? Look closer :)
Can't see anything strange??? Look closer :)
31.03.2009 г.
Loading a custom config file instead of app.config
Today happily I found a solution for the problem explained in a yesterday post in my blog.
The solution is to implement a class that changes the configuration file, associated with the project. Here is some working code doing that:
This really worked for me. I use .Net Framework 3.5 sp1 but I think this will work for .Net Framework 2.0 and above.
The idea is that this code sets the value for app.config path that the framework is going to use and then forces it to reload its configuration by setting 's_initState' to false and 's_configSystem' to null.
The class implements IDisposable to be able to revert to the old configuration file.
So it is good to use the using pattern as follows:
Where SecurityServiceClient is my service client proxy.
Enjoy :)
P.S. I of course didn't came to that solution while dreaming tonight, so I should give my thanks to the author of THIS article (see also comments under the article).
The solution is to implement a class that changes the configuration file, associated with the project. Here is some working code doing that:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
namespace OmeksOfficeTools
{
public class ConfigurationFileChanger : IDisposable
{
private string currentConfigFilePath;
private string newConfigFilePath = @"YourLibraryPathHere";
public ConfigurationFileChanger()
{
currentConfigFilePath = AppDomain.CurrentDomain.GetData("APP_CONFIG_FILE").ToString();
ChangeConfigFile(newConfigFilePath);
}
protected void ChangeConfigFile(string newConfigFilePath)
{
AppDomain.CurrentDomain.SetData("APP_CONFIG_FILE", newConfigFilePath);
FieldInfo[] fiStateValues = null;
Type initStateType = typeof(System.Configuration.ConfigurationManager).GetNestedType("InitState", BindingFlags.NonPublic);
if (initStateType != null)
{
fiStateValues = initStateType.GetFields();
}
FieldInfo fiInit = typeof(System.Configuration.ConfigurationManager).GetField("s_initState", BindingFlags.NonPublic | BindingFlags.Static);
FieldInfo fiSystem = typeof(System.Configuration.ConfigurationManager).GetField("s_configSystem", BindingFlags.NonPublic | BindingFlags.Static);
if (fiInit != null && fiSystem != null && null != fiStateValues)
{
fiInit.SetValue(null, fiStateValues[1].GetValue(null));
fiSystem.SetValue(null, null);
}
}
public void Dispose()
{
ChangeConfigFile(currentConfigFilePath);
}
}
}
This really worked for me. I use .Net Framework 3.5 sp1 but I think this will work for .Net Framework 2.0 and above.
The idea is that this code sets the value for app.config path that the framework is going to use and then forces it to reload its configuration by setting 's_initState' to false and 's_configSystem' to null.
The class implements IDisposable to be able to revert to the old configuration file.
So it is good to use the using pattern as follows:
using (ConfigurationFileChanger cfch = new ConfigurationFileChanger())
{
SecurityServiceClient client = new SecurityServiceClient();
//Do your service operation calls here...
}
Where SecurityServiceClient is my service client proxy.
Enjoy :)
P.S. I of course didn't came to that solution while dreaming tonight, so I should give my thanks to the author of THIS article (see also comments under the article).
Абонамент за:
Публикации (Atom)