Thursday, May 24, 2012

dead lock with insert

Recently I encountered a strange problem of dead lock. Our code deadlocks when 2 process insert record into the same table (Both process insert into table A with different record). I was amazed that this could happen, since a deadlock always requires 2 resources and the table only have 1 index. A closer look and the table was selected before, got rangeS-S lock, and the insert tries to upgrade to rangeI-N, which dead locked with the first. But why this have not happened before? Well this will only happen for serialize isolation level. Our database is on read committed, and after I took the code out and run in multiple test programs they are all fine, this lead me to the last suspect, nservicebus (we use it to receive messages). NserviceBus default to serialized isolation level, so one line of code to set it to read committed fixed the dead lock.

Thursday, November 17, 2011

NHibernate metadata reader closed problem

Encountered that exception, had no idea what it is. Googled and some people suggest it is a bad table, some suggested it is the session out of scope. None fits my situation. So I go ahead setup the nhibernate/active record/fluent source, did some debugging. What happened is someone is using StructureMap's ObjectFactory.Get() method inside a domain model's constructor, and while nhibernate is constructing that object, the constructor is doing more nhibernate calls via IOC. That is just bad, and now it is solved :-)

Tuesday, October 18, 2011

R.I.P Dennis Ritchie

Such tragedy. Just a few days ago it was Steve Jobs, now Ritchie. I am so sorry I didn't post this on time. Ritchie is not as famous as Jobs, but I do fee just as important. He is the co-funder of C language, I still remember the feel when I switched from basic to C. C is simple and flexible (so flexible my wife still have nightmares with pointers), I feel in love with it more and more. Of course time moves on and we went to C++/Java/C#, but you can see C in all of them. Attached is a link to The Development of the C Language.

Thursday, October 6, 2011

R.I.P Steve Jobs

Even though I am on vacation and is really tired from a full day of activities, I just have to drag myself off the bed and do a short note. Just 2 days ago me and a friend was taking about how amazing Jobs is, how fiction like his life was, and now he becme a legend. Just want to say Jobs well done!

Monday, September 5, 2011

Hough Transform

I was doing some research on de-skew a image, and found this page about Hough Transform A interesting read, and the idea is very simple and easy to use. It is very interesting as how presenting data in a different way will lead to a much easier understanding of it. The other example I can think of is Fourier Transform, I have done multiple applications that requires FFT, and it do wonders to some instances. A note about FFT is the 2D FFT. I remember had the question about if doing vertical FFT on a FFTed graph make sense, but since I was a bad student (always want to play games first) never asked this question. Think back, the way 2d FFT is performed makes no sense, but since it does present a usable solution (for compression etc) we are just doing it :-)

Monday, August 15, 2011

Cisco VPN service network troubles

Wife suddenly started to complain about trouble to connect to our server (at home). I thought a simple reboot will fix the problem but nope. Can ping other computer from server but can't ping the server from other computers.

Firewall is off, and after some research I found it is the Cisco VPN service. As long as the VPN service is started, even if VPN is not connected it will still prevent connections.

So problem solved :-)

Wednesday, August 10, 2011

MS security updates

Yesterday night I posted about how I got a virus by just using IE9 to view drudge report (even after I denied the UAC requests), MS released 13 patches, once of them is this:

Cumulative Security Update for Internet Explorer 9 for Windows 7 for x64-based Systems (KB2559049)

Download size: 20.9 MB

You may need to restart your computer for this update to take effect.

Update type: Important

Security issues have been identified that could allow an attacker to compromise a system that is running Microsoft Internet Explorer and gain control over it. You can help protect your system by installing this update from Microsoft. After you install this item, you may have to restart your computer.

More information:
http://go.microsoft.com/fwlink/?LinkID=221946

Help and Support:
http://support.microsoft.com