Friday, May 31, 2013

CSS Basic



#leftcolumn a:link{
background-color: #F6F4F0;
color: #000000;
text-decoration: none;
/*display: block;*/
padding: 2px;
border: 3px solid #e5e5e5;
margin-top: 3px;
border-radius: 5px;
}









*#leftcolumn a:link, #leftcolumn a:visited, #leftcolumn a:hover, #leftcolumn a:active {*/
#leftcolumn a:link{
background-color: #F6F4F0;
color: #000000;
text-decoration: none;
display: block;
padding: 2px;
border: 3px solid #e5e5e5;
margin-top: 3px;
border-radius: 5px;
}
















http://www.w3schools.com/cssref/playit.asp?filename=playcss_display&preval=block


注意到的是這些屬性是有順序的:

在網站超連結效果使用上常常用到 a:link / a:visited / a:hover / a:active 這幾個css屬性
但是在使用上必須注意到的是這些屬性是有順序的

#Problem:



div.scroll
{
background-color:#00FFFF;
width:100px;
height:100px;
overflow:scroll;
}

div.hidden 
{
background-color:#00FF00;
width:100px;
height:100px;
overflow:hidden;
}





Thursday, May 30, 2013

Vaadin + CSS

#
https://vaadin.com/forum#!/thread/223864


#note:
The stylename you give to a component is added to the root element of a component (in addition to the original style of the component postfixed with the stylename). So in case of the button the following hierarchy of classes is created:

1.v-button-my-stylename .my-stylename
2    .v-button-wrap
3        .v-button-caption

You can then use the following selector to match different styled buttons:

1.my-stylename .v-button-caption {
2    color: ...
3}



# <div

CSS 語法 – float 浮動排列 – 表格做不到的功能



Wednesday, May 29, 2013

多開放原始碼的套件


網路上有很多開放原始碼的套件可用:
論壇有phpBB、Discuz
影音網站有osTube
形像網站有xoops
購物商城有TWE、oscommerce
辦公室群組eGroupWare



@Gigabit 實測:
http://tomy168.twbbs.org/myblog/index.php/diy/64-cat5e-vs-cat6-in-gigabit-1000m.html

dante-server


#

Username Authentication


基本設定:

認證設定:

Server privileges

#server identities (not needed on solaris)
user.privileged    : root
user.notprivileged : socks
For the server to be able to access the system password file, it will typically have to be started with root privileges. In this case, theuser.privileged and user.notprivileged keywords should be set to ensure that the server will run as an unprivileged user when it does not need root privileges.

Example clientmethod usage

This authentication method cannot be used as a clientmethod.

Example method usage

#authentication methods
method: username
#generic pass statement - bind/outgoing traffic
pass {  
        from: 0.0.0.0/0 to: 0.0.0.0/0
        command: bind connect udpassociate
        log: error # connect disconnect iooperation
        method: username
}


Make sure the firewall is open. Add appropriate rule as on Iptables_Firewall. Test also with winscp or putty.

Other SOCKS Servers

Note that putty itself can provide a SOCKS 5 server!! (But putty needs to be able to connect to an external server/computer firstly!)
To configure socks to act as a socks v5 server:
Open Putty, Go to CONNECTION -> SSH -> TUNNELS
In the Source Port - put 1080
In the Destination Port - put 1080
Click on the Dynamic radio button for "Dynamic Port Forwarding"
Connect to an server with external access. Telnet localhost 1080 and it should connect.
Also note - SOCKS v5 can be setup using ssh on the command line.
ssh user@server.com -D 1080
# -D is for Dynamic Port Forwarding.

More info on Dante's Config at:

Proxychains

http://packages.debian.org/sid/dante-client

#Use Proxychains

#need modify the proxychains.conf

http://www.360doc.com/content/10/1007/12/296547_59036038.shtml

使用方法:
$proxychains firefox


$ sudo proxychains apt-get update

遇到新問題:proxychains openssl s_client -crlf -connect imap.gmail.com:993
ProxyChains-3.1 (http://proxychains.sf.net)
|DNS-request| imap.gmail.com
|S-chain|-<>-10.61.13.49:1080-<><>-4.2.2.2:53-<><>-OK
|DNS-response| imap.gmail.com is 173.194.79.108
gethostbyname addr is not AF_INET
connect:errno=0





socks与http的區別


來源:


#socks5 v.s Squid3

# socks与http的區別

SOCKS是一组由Internal工程工作小组(IETF)所开发出来的开放软件开放标准,用来处理网络安全的事宜。SOCKS象一堵墙被夹在 Internal服务器和客户端之间,对于出入企业网络的资讯提供流量和安全的管理。SOCKS这个名词并不是一组英文字头的缩写,而是一个和 TCP/IP的Socket端口有关的安全标准,一般防火墙系统通常是象网关(Gateway)一样是作用在OSI模型的第七层也就是应用层上,对 TCP/IP的高级协议,如Telnet、FTP、HTTP和SMTP加以管制,而SOCKS作用在OSI模型的第四层也就是会话层上,象一个代理一样对客户端到服务器端或服务器和服务器之间的数据联系,提供安全上的服务。由于SOCKS作用在会话层上,因此它是一个提供会话层到会话层间安全服务的方案,不受高层应用程序变更的影响。 Socks代理只是简单地传递数据包,而不必关心是何种应用协议(比如FTP、HTTP和NNTP请求),所以Socks代理服务器应用层代理服务器要快的


Tuesday, May 28, 2013

利用 SSH over HTTP 突破 Proxy Firewall

http://merckhung.blogspot.tw/2008/08/ssh-over-http-proxy-proxy-firewall.html

Transparent Proxy(TP) ?

http://nsysumis94.pixnet.net/blog/post/18180600-transparent-proxy%E6%9E%B6%E8%A8%AD%E5%82%99%E5%BF%98%E9%8C%84



#squid
squidclient yahoo.com

it shows me foll. error

client: ERROR: Cannot connect to localhost:3128: Connection refused


Openssl through proxy



#Problem: after run the openssl proxy, it route to proxy, but from the squid3 log:

TCP_DENIED/407 3541 CONNECT smtp.gmail.com:465

Transparent proxies via Squid.

http://www.debian-administration.org/?article=71

how to install smtp server on ubuntu

Java email : connect to Gmail fail


# Problem:

[28/05/2013 10:11:41.033][INFO]--+++ Java Mail:MessagingException
[28/05/2013 10:11:41.034][INFO]--??? ->javax.mail.MessagingException: Could not connect to SMTP host: localhost, port: 25;
  nested exception is:
java.net.ConnectException: 連線被拒絕


#Copy Ans:
http://www.coderanch.com/t/416516/java/java/connect-SMTP-host-localhost-port

The question is the same: 
Do you have an SMTP server running on localhost on port 25? If so, check its log files for messages. If not, then that's your problem.

#
http://blog.longwin.com.tw/2010/09/google-gmail-set-value-2010/
Google Gmail 得 IMAP, SMTP, POP3 得設定值, 整理如下:

http://email.about.com/od/accessinggmail/f/Gmail_SMTP_Settings.htm


#Problem:

#

javax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 587;
  nested exception is:
java.net.ConnectException: 連線被拒絕


Could not connect to SMTP host: smtp.gmail.com, port: 465;
  nested exception is:
java.net.ConnectException: 連線被拒絕


解答:
http://www.mkyong.com/java/javamail-api-sending-email-via-gmail-smtp-example/




#Problem:

#openssl s_client -host smtps.gmail.com -port 465
gethostbyname failure
connect:errno=110


#官方文件
https://support.google.com/mail/answer/13287?hl=en




#imap works :
openssl s_client -crlf -connect imap.gmail.com:993''

http://www.tannerjepsen.com/posts/imap-ssl-using-openssl-on-gmail

#step by step: IMAP works.
http://delog.wordpress.com/2011/05/10/access-imap-server-from-the-command-line-using-openssl/

#how to setup ssl squid3 for smtp.gmail.com

# Example rule allowing access from your local networks.
# Adapt to list your (internal) IP networks from where browsing
# should be allowed
#acl localnet src 10.0.0.0/8 # RFC1918 possible internal network
#acl localnet src 172.16.0.0/12 # RFC1918 possible internal network
#acl localnet src 192.168.0.0/16 # RFC1918 possible internal network
#acl localnet src fc00::/7       # RFC 4193 local private network range
#acl localnet src fe80::/10      # RFC 4291 link-local (directly plugged) machines

acl SSL_ports port 443
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
acl Safe_ports port 70 # gopher
acl Safe_ports port 210 # wais
acl Safe_ports port 1025-65535 # unregistered ports
acl Safe_ports port 280 # http-mgmt
acl Safe_ports port 488 # gss-http
acl Safe_ports port 591 # filemaker
acl Safe_ports port 777 # multiling http
acl CONNECT method CONNECT


Squid3的設定:

# Deny requests to certain unsafe ports
http_access deny !Safe_ports

# Deny CONNECT to other than secure SSL ports
http_access deny CONNECT !SSL_ports





#Squid3 log:

Squid Proxy Sever View logs / log files




Monday, May 27, 2013

資料庫-教學筆記




CHAR and VARCHAR的差別

CHAR and VARCHAR


http://dev.mysql.com/doc/refman/5.0/en/char.html


The following table illustrates the differences between CHAR and VARCHAR by showing the result of storing various string values into CHAR(4) and VARCHAR(4) columns (assuming that the column uses a single-byte character set such as latin1).
ValueCHAR(4)Storage RequiredVARCHAR(4)Storage Required
'''    '4 bytes''1 byte
'ab''ab  '4 bytes'ab'3 bytes
'abcd''abcd'4 bytes'abcd'5 bytes
'abcdefgh''abcd'4 bytes'abcd'5 bytes
The values shown as stored in the last row of the table apply only when not using strict mode; if 

javax.net.ssl.SSLHandshakeException


#Problem
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

how to package a java program as an executable application on ubuntu

#Problem:
how to package a java program as an executable application on ubuntu

Ans:
http://stackoverflow.com/questions/5293321/create-a-java-executable-with-eclipse

SIOCADDRT: 不適用的引數


#Problem:
SIOCADDRT: 不適用的引數


#copy
http://www.linuxdiyf.com/bbs/thread-166011-1-1.html

用route命令增加路由表项时, 屡次失败,见下面:
[root@localhost ~]# route add -net 202.117.77.0 netmask 255.255.255.0 gw 0.0.0.0 dev eth0
SIOCADDRT: Invalid argument

我的IP是202.117.77.78 , 掩码255.255.255.128  ,其实就是增加个到本地局域网的路由


问题解决,应该是:
#route add -net 202.117.77.0 netmask 255.255.255.128 dev eth0

另外有两个问题:
1.  到本地局域网的命令不用些gw吗? 如果可以写gw,  gw 应该写什么?
2. 上述命令中的netmask 是指 本地网络出口的netmask还是目的地址/网络的netmask?


#Problem 2:
route: netmask doesn't match route address


解法:
http://forum.ubuntu.org.cn/viewtopic.php?f=50&t=154995

例子:
root@ellawu-desktop:~# route add -net 192.168.76.2 netmask 255.255.255.0 dev eth0
route: netmask doesn't match route address

-net 后加的是网段,不是IP。
试试 192.168.76.0

how to write a mouse listener

http://docs.oracle.com/javase/tutorial/uiswing/events/mouselistener.html


@
http://docs.oracle.com/javase/1.4.2/docs/api/java/awt/event/MouseEvent.html

@system level :
http://stackoverflow.com/questions/504559/is-it-possible-to-have-a-mousemotionlistener-listen-to-all-system-mouse-motion-e