Another Captcha Plug-in in Joomla - OSOLCaptcha
Previously, I used "Joo ReCaptcha". That is very a good plug-in. But ReCaptcha got a bug in IE. When its captcha text field will disappear when I use jQuery.blur() or focus(). I used superfish menu. It used these two jQuery methods a lot. When I show the sub-menu, then captcha text field will disappear. I have spent a day to fix it but I cannot find a solution or work around.
Thus, I gave it up. I used another Captcha Plug-in which is not using ReCaptcha. That is OSOLCaptcha. This is very similar with ReCaptcha, but it can convert captcha text to speech. This may be some accessibility issue. Besides of this, that is very similar with Joo ReCaptcha. You just need to install the plug-in, then it will works in Contact form, login and register form. That is good.
Related post:
Good captcha plug-in in Joomla
Wordpress 3.3.1 is released
Wordpress 3.3.1 is released. That is only a security and maintenance update. That is not much update! Please click here to download the latest version or use the update function in your wordpress dashboard.
"Invalid attempt to call Read when reader is closed" in LINQ DataContext
I got a lot of error from a LINQ DataContext, such as "Invalid attempt to call Read when reader is closed" . That is because I was using a singleton for DataContext in a multi-threads.
The codes like that:
Code
private static ExampleDataContext Context; | |
private static ExampleDataContext GetContext() | |
{ | |
if(Context == null) | |
{ | |
Context = new ExampleDataContext(); | |
} | |
return Context; | |
} |
That is not very thread-safe. A thread will close the DataContext, but others threads are still using DataContext. Then it will throw the error above.
I changed the DataContext in a pre-thread. I initialize the DataContext in each thread. The errors are gone! You also can do the DataContext in a pre-object. That is simpler.
Mutex Lock Example
I have written an example project in C#. This example will shows how to use Mutex Lock. Moreover, it will demonstrate how to create a thread with parameters. Please click here to download.
Please remember to use "System.Timers.Timer" in Windows Service
I am implementing a Windows Service. I did a foolish mistake. I opened the design view of windows service and drag-and-drop the Timer from toolbar. Because I need the windows service to execute some code periodically. I found the timer won't triggered at all. I found that is Timer in Windows.Forms. It never works in Windows Service. You need to create a timer of System.Timers. Like the example following:
Code
System.Timers.Timer timer2 = new System.Timers.Timer(); | |
timer2.Interval = 10000; | |
timer2.Enabled = true; | |
timer2.Elapsed += new System.Timers.ElapsedEventHandler(timer2_Elapsed); |