使用到的一些firefox插件

download them all 下载管理
adblock 取出广告
autopage 自动翻页
copy links 复制选择的链接
evernote clipper 不说
firebugs 调试网页
foxyproxy 多代理设置
google/yandex search link fix 去除google搜索时自己加的链接跳转
stylish() 自定义某些页面

如何获得unix domain socket的对端PID

1. 什么是unix domain socket

http://en.wikipedia.org/wiki/Unix_domain_socket

2. 有两种方法,第一种是通过猜测,第二种是debug linux内核

第一种方法的示例:

[test@localhost ipc]$  /usr/sbin/lsof -p 31854
COMMAND   PID     USER   FD   TYPE             DEVICE SIZE/OFF      NODE NAME
server  31854 test  cwd    DIR               0,26     4096  15746636 /home/test/workspace_ipc/ipc
server  31854 test  rtd    DIR                8,2     4096         2 /
server  31854 test  txt    REG               0,26     8702  15746641 /home/test/workspace_ipc/ipc/server
server  31854 test  mem    REG                8,2   144776  52035586 /lib64/ld-2.5.so
server  31854 test  mem    REG                8,2  1722328  52035588 /lib64/libc-2.5.so
server  31854 test    0u   CHR              136,2      0t0         4 /dev/pts/2
server  31854 test    1u   CHR              136,2      0t0         4 /dev/pts/2
server  31854 test    2u   CHR              136,2      0t0         4 /dev/pts/2
server  31854 test    3u  unix 0xffff8101c8d39180      0t0 650000043 ./socket
[test@localhost ipc]$  /usr/sbin/lsof -p 32028
COMMAND   PID     USER   FD   TYPE             DEVICE SIZE/OFF      NODE NAME
client  32028 test  cwd    DIR               0,26     4096  15746636 /home/test/workspace_ipc/ipc
client  32028 test  rtd    DIR                8,2     4096         2 /
client  32028 test  txt    REG               0,26     8199  15746715 /home/test/workspace_ipc/ipc/client
client  32028 test  mem    REG                8,2   144776  52035586 /lib64/ld-2.5.so
client  32028 test  mem    REG                8,2  1722328  52035588 /lib64/libc-2.5.so
client  32028 test    0u   CHR              136,2      0t0         4 /dev/pts/2
client  32028 test    1u   CHR              136,2      0t0         4 /dev/pts/2
client  32028 test    2u   CHR              136,2      0t0         4 /dev/pts/2
client  32028 test    3u  unix 0xffff810010eaa080      0t0 650002435 socket
[test@localhost ipc]$ netstat -na | grep 65000
unix  2      [ ACC ]     STREAM     LISTENING     650000043 ./socket
unix  3      [ ]         STREAM     CONNECTED     650002215 ./socket
unix  3      [ ]         STREAM     CONNECTED     650002435

上例中是通过65000来grep的,这就是猜测。

第二种方法:

http://stackoverflow.com/questions/11897662/identify-other-end-of-a-unix-
domain-socket-connection

http://unix.stackexchange.com/questions/16300/whos-got-the-other-end-of-
this-unix-socketpair

不能直接获得对端的信息的原因是,因linux内核对user space是不可见的。

The number shown in /proc/$pid/fd/$fd is the socket’s inode number in the
virtual socket filesystem. When you create a pipe or socket pair, each end
successively receives an inode number. The numbers are attributed
sequentially, so there is a high probability that the numbers differ by 1, but
this is not guaranteed (either because the first socket was _N_ and _N_ +1 was
already in use due to wrapping, or because some other thread was scheduled
between the two inode allocations and that thread created some inodes too).

将水电气的抄表动作自动化

1.做一个简单的嵌入式系统,它可以连到水电气的读表接口,再连到internet上,以便远程操作;

2.如果自来水公司想查看当前水表的度数,只需要远程点一个按钮,度数就会通过这个嵌入式系统返回给自来水公司;

然后自来水公司可以给客户发短息或者别的什么途径通知客户来缴费。

注:当然也可让设定嵌入式系统在特定时间内给自来水公司返回当前水表度数,自来水公司的系统自动计算费用然后

提示用户缴费。

为什么我的plugin不work了

查看eclipse的log。

如何查看呢?

eclipse -vm c:\jdks\java_1.4.2_06\jre\bin\java.exe -console -consoleLog -debug -vmargs -Xmx384M

Gathering Information About Your Plug-in

http://www.eclipse.org/eclipse/platform-core/documents/3.1/debug.html

-debug options_file_full_path
if set to a non-null value, the platform is put in debug mode. If the value is
a string it is interpreted as the location of the .options file. This file
indicates what debug points

如果有debug,那么platform将进入debug模式。options_file_full_path是options文件的全路径。这个文件会给出哪些plugin的debug参数被设置成true,哪些debug参数

are available for a plug-in and whether or not they are enabled. If a location
is not specified, the platform searches for the .options file under the
install directory.

被设置成false。如果没有设置options_file_full_path,platform将在安装目录下面找.options文件。

-consolelog
if “true”, any log output is also sent to Java’s System.out (typically back to
the command shell if any). Handy when combined with -debug

如果设置了该参数,任何输出到log文件的log都会被输出到命令行。它和-debug参数一起使用很方便。
-console
if set to a non-null value, the OSGi console (if installed) is enabled. This
is handy for investigating the state of the system. If the value is a suitable
integer, it is interpreted

如果设置了该参数,OSGi的console会被打开(前提是OSG已经安装)。这个参数用来调查系统状态很好用。如果设置了端口好,

as the port on which the console listens and directs its output to the given
port. If the value is not a suitable integer (including the empty string) then
the console will listen

会监听这个端口,然后将输出重定向到给定的端口中去,如果没有指定端口

System.in and direct its output to System.out.

console将会在System.in上获得输入,然后在System.out上输出


http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fmisc%2Fruntime-
options.html

将osgi中的所有debug参数设置成true的options文件:

#Master Tracing Options
#Fri Oct 19 15:59:34 CST 2012
org.eclipse.osgi/debug=true
org.eclipse.osgi/monitor/resources=true
org.eclipse.osgi/debug/messageBundles=true
org.eclipse.osgi/debug/objectPool/adds=true
org.eclipse.osgi/eclipseadaptor/debug/platformadmin/resolver=true
org.eclipse.osgi/profile/debug=true
org.eclipse.osgi/debug/services=true
org.eclipse.osgi/resolver/generics=true
org.eclipse.osgi/eclipseadaptor/debug=true
org.eclipse.osgi/monitor/classes=true
org.eclipse.osgi/eclipseadaptor/debug/location=true
org.eclipse.osgi/eclipseadaptor/debug/cachedmanifest=true
org.eclipse.osgi/resolver/requires=true
org.eclipse.osgi/profile/startup=true
org.eclipse.osgi/monitor/activation=true
org.eclipse.osgi/resolver/cycles=true
org.eclipse.osgi/eclipseadaptor/converter/debug=true
org.eclipse.osgi/resolver/imports=true
org.eclipse.osgi/defaultprofile/logsynchronously=true
org.eclipse.osgi/resolver/wiring=true
org.eclipse.osgi/defaultprofile/logfilename=
org.eclipse.osgi/debug/startlevel=true
org.eclipse.osgi/defaultprofile/buffersize=256
org.eclipse.osgi/debug/manifest=true
org.eclipse.osgi/trace/activation=true
org.eclipse.osgi/debug/packageadmin=true
org.eclipse.osgi/debug/security=true
org.eclipse.osgi/trace/filename=runtime.traces
org.eclipse.osgi/resolver/debug=true
org.eclipse.osgi/resolver/uses=true
org.eclipse.osgi/trace/filters=trace.properties
org.eclipse.osgi/debug/objectPool/dups=true
org.eclipse.osgi/debug/bundleTime=true
org.eclipse.osgi/profile/impl=org.eclipse.osgi.internal.profile.DefaultProfileLogger
org.eclipse.osgi/debug/filter=true
org.eclipse.osgi/debug/loader=true
org.eclipse.osgi/debug/events=true
org.eclipse.osgi/trace/classLoading=true
org.eclipse.osgi/profile/benchmark=true
org.eclipse.osgi/eclipseadaptor/debug/platformadmin=true

如果想试一试-console ,请参见:


http://pic.dhe.ibm.com/infocenter/wasinfo/v8r5/index.jsp?topic=%2Fcom.ibm.websphere.wlp.nd.doc%2Ftopics%2Ftwlp_setup_osgi_console.html


http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Fguide%2Fconsole_shell.htm

eclipse中的Menu,toolbar path

create a hello world plug-in in eclipse.
1. if you want to add a menu after “Edit” menu, change the path to “Edit”
2. if you do not want to set the menu location in eclipse main menu, just
leave it empty or set it to “additions”
3. if you want to add this action to “help/helpStart”, change the menubarPath
of “Sample Action” to “help/helpStart”
4. if you want to add this action to “file/import.ext”, change the
menubarPath of “Sample Action” to “file/import.ext”
5. if you want to add this action to debug action set in main toolbar, change
the the toolbarPath of “Sample Action” to
“org.eclipse.debug.ui.launchActionSet/debug”
then if you start the plugin, and try to drag debug action set, the “Sample
Action” will move with the debug action set
6. if you want to add this action to debug action set in main toolbar, change
the the toolbarPath of “Sample Action” to
“org.eclipse.debug.ui.launchActionSet/external”
then if you start the plugin, you will see the “Sample Action” and debug
action set seperated with a separeator,
try to drag debug action set, the “Sample Action” will move with the debug
action
7. if you want to add this action additions set in main toolbar, change the
the toolbarPath of “Sample Action” to “additions”

then if you start the plugin, and try to drag debug action set, the “Sample
Action” will not move with the debug action set

In one words:

A complete menu path is simply “menu name/group name.”
A complete toolbar path is simply “action set ID/toolbar group name.”

org.eclipse.ui.menus

http://help.eclipse.org/helios/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Fguide%2Fworkbench_cmd_menus.htm

Menu and toolbar paths

http://help.eclipse.org/helios/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Fguide%2Fworkbench_menupaths.htm

Eclipse Platform Extension Points

http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fextension-
points%2Findex.html