How I can set log4net to log my files into different folders each day?

Try this (It should be OK!): <appender name=”LogFileAppender” type=”log4net.Appender.RollingFileAppender”> <file value=”logs\\” /> <appendToFile value=”true” /> <DatePattern value=”yyyy\\\\MM\\\\dd’.inf.log'” /> <rollingStyle value=”Date” /> <param name=”StaticLogFileName” value=”false” /> <layout type=”log4net.Layout.PatternLayout”> <header value=”[Header]&#13;&#10;” /> <footer value=”[Footer]&#13;&#10;” /> <conversionPattern value=”%date [%thread] %-5level %logger [%ndc] &lt;%property{auth}&gt; – %message%newline” /> </layout> </appender> It will create a logfile named ‘logs\2010\04\02.inf.log’ (let date be … Read more

How can you bind to a DynamicResource so you can use a Converter or StringFormat, etc.? (Revision 4)

Binding to a DynamicResource in WPF TL;DR Warning! This is one #$%* long post! I wrote this post with the intent of taking those interested on a deep dive into understanding exactly what’s going on under the hood when using a DynamicResource (or any MarkupExtension for that matter), why this may at first seem impossible … Read more

Order Statistic Tree in C++

Here is the example of GNU Policy-Based STL MAP implemented as order statistic tree (tested on Linux gcc 4.6.1): #include <iostream> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; typedef tree< int, int, less<int>, rb_tree_tag, tree_order_statistics_node_update> map_t; int main() { map_t s; s.insert(make_pair(12, 1012)); s.insert(make_pair(505, 1505)); s.insert(make_pair(30, 1030)); cout << s.find_by_order(1)->second << ‘\n’; … Read more

Finding the address range of the data segment

If you’re working on Windows, then there are Windows API that would help you. //store the base address the loaded Module dllImageBase = (char*)hModule; //suppose hModule is the handle to the loaded Module (.exe or .dll) //get the address of NT Header IMAGE_NT_HEADERS *pNtHdr = ImageNtHeader(hModule); //after Nt headers comes the table of section, so … Read more

Make a window topmost using a window handle

You need to use P/Invoke with SetWindowPos to accopmlish this: [DllImport(“user32.dll”)] static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, uint uFlags); static readonly IntPtr HWND_TOPMOST = new IntPtr(-1); const UInt32 SWP_NOSIZE = 0x0001; const UInt32 SWP_NOMOVE = 0x0002; const UInt32 SWP_SHOWWINDOW = 0x0040; // Call this way: SetWindowPos(theWindowHandle, … Read more