IE8 bug on jquery’s finding td[colspan] elements
by admin on Aug.30, 2010, under Music
when using jQuery: $(‘td[colspan]‘), you will find ff and chrome will return all these tds with colspan >1
but in ie8 (not tested other ie versions), it will return all the tds which seems all the tds have the default colspan attr with value “1″.
so for ie8, I use $(‘td:not([colspan=1])’) to do the work, which doesn’t work on ff and chrome.
Also, for large tables, this find operation will make ie8 stuck.
Bells of Freedom
by admin on May.05, 2010, under Music
I have walked all alone
On these streets, I call home
Streets of hope, streets of fear
Through the sidewalk cracks
Time dissapears
I was lost, on my knees
On the eve of defeat
As i choked back the tears
There’s a silent scream no-one could hear
So far away from everything, you know it’s true
Something inside that makes you know what you’ve got to do
Ring the bells, ring them loud
Let them ring here and now
Just reach out and ring the bells of freedom
When your world’s crashing down like you’ve lost every round
Stand your ground
And ring the bells of freedom
Up the steps of the church
Through the fields in the dirt
In the dark I have seen
That the sun still shines for the one who believed
So far away, so full of doubt, you needed proof
Just close your eyes, and hear the sound inside of you
微软硬件跟金士顿,你们能好好管理么
by admin on Feb.06, 2010, under Music
不想多说什么了,买了台电脑,配了两根Kingston的骇客神条ddr2 1066 2G的内存条, 其中一根一直有问题。开始以为是跟主板不兼容,升级了一下主板bios,问题依旧。于是用排除法,只插一根,发现其中的一根有问题。昨天拿去换,换的时候没拿去上机测试,结果回家插上后机器启动不能。。今天再拿去换,特意上机测试了一下,能顺利进入系统,于是拿回家。没想到刚才一开游戏,1分钟之后蓝屏。于是单插,5分钟后再次蓝屏。。看来明天还要再跑一次了
键盘买的是微软的人体工学键盘4000,不时出现串键问题,而且串的还是数字键,也就意味着没办法正常用拼音输入法。去年11月拿去修,说是需要2个星期到1个月,等了2个多月也没消息,于是打电话到送修的地方,被告知微软需要提供发票,而且发票上还要有键盘的序列号。。打电话给微软投诉,被告知会在3天内处理。。等了一个星期却依然没任何结果。。。失望之余只好把发票拿过去,被告知不知道什么时候才会修好。。我@#$@#$@%!
通过这次的事情,我想我以后是尽量不会买这两家公司的产品了,同时也不会推荐其他人购买,或者劝其他人不要买。
回想我前两台电脑,每一台都用了4年左右,从来没有遇到过这么严重的质量问题,而且售后服务之差让人无语。微软跟金士顿,都是响当当的大公司,可是这产品跟服务,简直跟卖地摊货的没任何区别。
联想到最近的谷歌推出中国事件中微软的态度,你们这些外国企业在中国搞本土化,大肆敛财的时候,是不是把自己企业的魂也丢掉了?
IMG tag xss attacks
by admin on Jan.16, 2010, under Music
It is interesting for the cases that some sites allow user to upload html code with img tag.
One simple example is if user type something like this:
<img src=”http://www.google.com/accounts/Logout” />
and anyone visits these pages that include this html code, will be forced to logged out on google.
The way it works is browsers will send a request to get the img, with current user’s information, like cookies.
Here maybe more serious problems: if the code becomes <img src=”http://www.somesite.com/admin/delete_post?post_id=1″ />, then when the admin of that site visits this page, the post with id 1 will be removed on somesite.
However, the main problem here is some sites use cookie to authenticate login information, I have no idea for now on how to prevent this problem.
ActiveRecord validations get passed after update_attribute
by admin on Dec.31, 2009, under Ruby on Rails
Example:
Production has a uniqueness validation on “name”.
and if we do:
p = Production.find(2)
# there is already a production named “p1″ so this is invalid
p.name = ‘p1′
p.update_attribute(‘model’, ‘modelA’)
# it will pass… from the log, no validation sql runs
p.save!
When doing update_attribute, rails won’t do the validations, and it set the object as validation passed, so when doing the save action, no validations will be performed.
one way to fix the problem is to move the update_attribute above the setting attribute codes, like:
p.update_attribute(…)
p.name = ‘p1′
p.save!
and now rails will perform the validations.
moving gnome panels in ubuntu 9.10
by admin on Oct.30, 2009, under Ubuntu
I just upgrade my ubuntu from 9.04 to 9.10.
I have a laptop and a LCD monitor. It used to be the LCD monitor as the primary screen which is just I want. But after the upgrade, the gnome panels stays in the laptop monitor.
I tried to find the option of setting primary screen, like in the display setting window, but failed.
As ubuntu 9.10 comes out today, so there are also no so many posts about its problems.
Then I changed the way to moving the gnome panels. But I can’t move it by mouse directly.
Finally I found a way to move the panels: right click on a panel, and click properties, uncheck the Expand option. You will see the panel get shorter, and then use your mouse drag it. OH YEAH! it moves right? Put it into another screen, and check the Expand option again. DONE!
Unspecified error in IE7
by admin on Oct.15, 2009, under Music
Got this error on ie7 today, but not always get this error. Found it happens sometime the page is loaded slowly.
After some search, got the reason that it is caused by the vml namespace setting in javascript.
Changed the page namespace to
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd“>
<html xmlns=”http://www.w3.org/1999/xhtml” xmlns:vml=”urn:schemas-microsoft-com:vml“>
and add try&catch for the js adding name space line:
this.doc.namespaces.add(“v”, “urn:schemas-microsoft-com:vml”, “#default#VML”);
seems to prevent the error now.
Ruby Yaml 中数组的缩进bug
by admin on Sep.09, 2009, under Ruby on Rails
很显然
{“a”=>[{"a"=>1, "b"=>2}, {"c"=>1, "d"=>2}], “b”=>111}
如果变成yaml应当是
—
a:
- a: 1
b: 2
- c: 1
d: 2
b: 111
然而ruby(1.8.7)使用YAML.dump得到的结果却是
—
a:
- a: 1
b: 2
- c: 1
d: 2
b: 111
区别就在于数组元素的缩进消失了。
虽然在Ruby中用YAML.load依然能正确的返回原来的对象,但是这段非标准的yaml在JYaml里面就会parse失败。
这应当是一个bug.不过奇怪的是网上居然没有文章提到这个,至少我没有找到。