RSS
 

Posts Tagged ‘troubleshooting’

INPUT中attribute和property的差异

11 Aug

今天在firefox下遇到一个奇怪的问题。

html中有下面一个INPUT元素

<input id="q" name="q" value="123"/>

使用input.getAttribute可以取得该input的值

document.getElementById("q").getAttribute("value"); //return 123

但是当通过界面输入将INPUT的值改为456之后,在通过input.getAttribute的方式取值,仍然返回123,但是使用input.value可以返回456.

document.getElementById("q").getAttribute("value"); // return 123
document.getElementById("q").value;          //return 456

下面的网页中有对该问题的完整的分析和测试(已被墙,请用代理访问)

http://updatepanel.net/2008/12/31/more-on-getattribute-setattribute-and-the-value-attribute/

参考上面的分析可以还原出firefox下的实现

假设

  • “value” property is element.value;
  • “value” attribute is element.getAttribute(”value”);
  • HtmlElement中存在_properties[]和_attributes[]两个关联数组来存放propertie和attribute属性

那么在firefox中

htmlElement.value作为等式右值时等价于

function(){
return this._properties["value"]||this._attributes["value"]
}

htmlElement.value作为等式左值时等价于

function(right_value){
this._properties["value"]=right_value;
}

htmlElement.getAttribute(“value”)等价于

function(){
return this._attributes["value"];
}

htmlElement.setAttribute(“value”,”123″)等价于

function(name,value){
this._attributes[name]=value;
}

而在IE中property和attribute的值是完全等价的不存在差异。

 
 

Ubuntu强制卸载ksplice-uptrack

19 Jul

使用常规方法卸载

$ sudo apt-get remove ksplice-uptrack

正在读取软件包列表… 完成
正在分析软件包的依赖关系树
正在读取状态信息… 完成
下列软件包是自动安装的并且现在不再被使用了:
python-decoratortools python-pycurl libyaml-0-1 kerneloops python-yaml
使用’apt-get autoremove’来删除它们
下列软件包将被【卸载】:
ksplice-uptrack
共升级了 0 个软件包,新安装了 0 个软件包,要卸载 1 个软件包,有 0 个软件未被升级。
解压缩后将会空出 786kB 的空间。
您希望继续执行吗?[Y/n]y
(正在读取数据库 … 系统当前总共安装有 192832 个文件和目录。)
正在删除 ksplice-uptrack …
You are running an unofficial kernel from the “mainline” PPA:
<http://kernel.ubuntu.com/~kernel-ppa/mainline>.  Ksplice
Uptrack for Ubuntu only supports kernels that were actually released
with Ubuntu Jaunty or one of its official updates.

dpkg:处理 ksplice-uptrack (–remove)时出错:
子进程 pre-removal script 返回了错误号 1
正在处理用于 python-support 的触发器…
在处理时有错误发生:
ksplice-uptrack
E: Sub-process /usr/bin/dpkg returned an error code (1)

无法卸载,使用如下方法可以强制卸载

cd /var/lib/dpkg/info/
sudo rm ksplice-uptrack.*
sudo aptitude purge ksplice-uptrack
sudo aptitude update
sudo aptitude upgrade

参考:[问题]如何强制卸载未正确安装的软件包

 
5 Comments

Posted in ubuntu

 

libstdc++.so.6链接库问题

15 Jul

ubuntu上某个未知的操作导致了firefox、opera以及很多C++实现的程序无法运行,包括apt-get,network-manager。重新启动后甚至连Xwindow也无法启动。

命令行抛出如下错误

/usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.9′ not found

在命令行执行如下命令

$ strings /usr/lib/libstdc++.so.6 | grep GLIBC

返回结果中并不存在GLIBCXX_3.4.9

$ ls -l  /usr/lib/libstdc++.so.6

返回如下结果

lrwxrwxrwx 1 root root 28 2009-07-15 10:30 /usr/lib/libstdc++.so.6 -> /usr/lib/libstdc++.so.6.0.10

原来真身是libstdc++.so.6.0.10,再比对其他机器上相同版本的ubuntu后发现文件libstdc++.so.6.0.10大小不同。

拷贝覆盖该文件后,再执行startx,看见了久违gnome窗口。

 
No Comments

Posted in linux

 

SSH实现Sock5代理

15 Jul

“你有张良计,我有过墙梯”。直面GFW,大家八仙过海,各显神通。

$ sudo ssh -D 127.0.0.1:3721 remote_host -l login_name

浏览器设置为SOCK5代理,SOCK host:127.0.0.1,PORT:3721

如果在控制台抛出如下错误

channel 2: open failed: administratively prohibited: open failed

需要修改服务器sshd_config文件的配置

AllowTcpForwarding yes

GatewayPorts yes

 
No Comments

Posted in GFW, linux