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

Thursday, July 21, 2011

Starcraft match, Baby vs Killer

http://www.youtube.com/watch?v=1VXIE0o9Qbo&feature=feedu

See link above. I was surprised by who finally win :-)

Thursday, July 14, 2011

javascript math

So what is 70.18*100 in javascript? It might be surprise you that the result is 7018.00000000001.

And number.toFixed() should fix this nicely.

Another interesting thing about jqGrid. I have a date column that requires a customized format but needs to be sorted as date. I did some research and none of the online solution works (my jqGrid version is 3.6.5). So I download the source, and what's going on is jqGrid parse the date with y,m,d,h,i,s A (as year, month, date, hour, minute, second, AM/PM). So the solution is:

sorttype: 'datetime', datefmt: 'm-d-y h:i:s A' (I am mm-dd-yyyy hh:mm:ss AM/PM format).

Wednesday, July 6, 2011

Cool jQuery UI

Haven't been doing scripts for a while, and there is one from msdn that looks pretty cool: http://msdn.microsoft.com/en-us/scriptjunkie/hh127352.aspx

Kind of surprised how easy it is doing round corner UIs :-)

Sunday, June 26, 2011

OSL JD vs Flash

Another great battle between 2 best players.
http://www.youtube.com/watch?v=DExusOePdSA&feature=feedu

Saturday, April 2, 2011

Paul Graham on Tablets

I think it is just a great read. Kind of showed how good hardware helps innovation. The PC world on the other hand used to be race to the bottom. Still remember how dyanmic ram wins over static ram Back when I read the first book on CPUs, I can't understand why people would save half the transistor count and make the product slower. However the use of SDRAM is a good choice, as that small performence is not as good as adding a accelerometer.

Monday, February 14, 2011

How different are you from a Christian

I compiled a list of requirements to be a Christian, most likely not complete. #6 and #8 is likely the most impossible, I will never give my bank account to my neighbor at least.

1. No idol worshiping
2. don't kill
3. don't steal
4. don't enoy your neighbor's belongs, including his/her wife/husband (2x2 metrix)
5. respect your parents
6. Respect the sabboth and don't work on that day. (Jew/Christian/Islam only)
7. Don't judge other people
8. love your neighbor as you love yourself
9. donate 1/10th to charity.

Thursday, January 6, 2011

Some Javascript basics

I used javascript for many years, did many things that solved hard problems at work. However I recently changed work, and this company used javascript heavily.

Through my recent debugging and fixing of the code, I found some old javascript tricks that I never know!!

1. === and !==. "===", the triple equal sign, means compare with type. So even though 2=="2" is true, 2 === "2" is false because their types are different. Same with !==. I found this one while I was reading jQuery code.

2. function closures.
(function(){
//do something without affect globals.
})();

2. call and apply.
Suppose you have a function doSomething(a,b). You can call itwith a new "this" by using call and apply. i.e

3. arguments
It is a variable made available by javascript that contains current function call's arguments.

function doSomething(a,b){
alert(this.id + ' ' + a + b);
}
var obj = {id:'me'};
var func = doSomething;
func.call(obj, 1, 2);
(function(){func.apply(obj, arguments);})(1,2);

the above code will show "me 12" twice.

Because I never know those before, the first time I saw them, I thought they are either typos or some home made functions!!