spam就是一颗毒瘤。无孔不入,无所不在。
技术日益先进,手段也日益丰富。
今天就收到一份颇有创新精神的spam邮件。咋一看还以为是应聘信息。顺便提一句,本人正在招聘WEB开发工程师(PHP/js/xhtml/css),有意者可邮件联系我。
点击小图看大图。
Tags: spam原来今天是秋分..
所谓多事之秋,在这几天一一应验了!
上火!忙碌!焦躁!困惑!无奈!
USB2.0!
几个结论..
1、匹配用户名
规则:
正则表达式:
/^[a-zA-Z0-9_]{3,16}$/
代码示例:
function validate_username( $username ) {
if(preg_match(’/^[a-zA-Z0-9_]{3,16}$/’, $_GET['username'])) {
return true;
}
return false;
}
2、匹配XHTML或XML标签
正则表达式:
{]*>(.*?)}
代码示例:
function get_tag( $tag, $xml ) {
$tag = preg_quote($tag);
preg_match_all(’{<'.$tag.'[^>]*>(.*?)'.$tag.'>.’}',
$xml,
$matches,
PREG_PATTERN_ORDER);return $matches[1];
}
3、匹配确定属性值的XHTML或XML标签(例如:class或tag)
正则表达式:
{]*attribute\\s*=\\s*(["'])value\\\\1[^>]*>(.*?)}
代码示例:
function get_tag( $attr, $value, $xml, $tag=null ) {
if( is_null($tag) )
$tag = ‘\\w+’;
else
$tag = preg_quote($tag);$attr = preg_quote($attr);
$value = preg_quote($value);$tag_regex = “/<(".$tag.")[^>]*$attr\\s*=\\s*”.
“(['\\"])$value\\\\2[^>]*>(.*?)<\\/\\\\1>/”preg_match_all($tag_regex,
$xml,
$matches,
PREG_PATTERN_ORDER);return $matches[3];
}
4、匹配和解析email地址
代码示例(比较复杂些):
function is_valid_email_address($email){
$qtext = ‘[^\\x0d\\x22\\x5c\\x80-\\xff]‘;
$dtext = ‘[^\\x0d\\x5b-\\x5d\\x80-\\xff]‘;
$atom = ‘[^\\x00-\\x20\\x22\\x28\\x29\\x2c\\x2e\\x3a-\\x3c'.
'\\x3e\\x40\\x5b-\\x5d\\x7f-\\xff]+’;
$quoted_pair = ‘\\x5c[\\x00-\\x7f]‘;
$domain_literal = “\\x5b($dtext|$quoted_pair)*\\x5d”;
$quoted_string = “\\x22($qtext|$quoted_pair)*\\x22″;
$domain_ref = $atom;
$sub_domain = “($domain_ref|$domain_literal)”;
$word = “($atom|$quoted_string)”;
$domain = “$sub_domain(\\x2e$sub_domain)*”;
$local_part = “$word(\\x2e$word)*”;
$addr_spec = “$local_part\\x40$domain”;return preg_match(”!^$addr_spec$!”, $email) ? 1 : 0;
}
5、匹配URL
正则表达式:
{
\\b
# Match the leading part (proto://hostname, or just hostname)
(
# http://, or https:// leading part
(https?)://[-\\w]+(\\.\\w[-\\w]*)+
|
# or, try to find a hostname with more specific sub-expression
(?i: [a-z0-9] (?:[-a-z0-9]*[a-z0-9])? \\. )+ # sub domains
# Now ending .com, etc. For these, require lowercase
(?-i: com\\b
| edu\\b
| biz\\b
| gov\\b
| in(?:t|fo)\\b # .int or .info
| mil\\b
| net\\b
| org\\b
| [a-z][a-z]\\.[a-z][a-z]\\b # two-letter country code
)
)# Allow an optional port number
( : \\d+ )?# The rest of the URL is optional, and begins with /
(
/
# The rest are heuristics for what seems to work well
[^.!,?;"\\'<>()\[\]\{\}\s\x7F-\\xFF]*
(
[.!,?]+ [^.!,?;"\\'<>()\\[\\]\{\\}\s\\x7F-\\xFF]+
)*
)?
}ix
完整的文章请访问这里阅读(英文)
Tags: 正则表达式 regular国外的网站在推出中文版本时,大都存在这样一个问题,没有针对中文字体调整字体大小。仍然使用英文字体的10px或者11px。结果导致中文版看起来很不舒服。例如 flickr、last.fm、facebook,等等。
看图
我常用的日程管理工具,Google 日历也同样存在这个问题,中文字体在XP下看起来很不舒服。
于是,我自己动手进行了一些修改。
基本上把我看起来感觉不舒服的地方调整了。
先对比下修改前后的效果,
修改前:
修改后:
————————————————————-
注:只方法只适用于 Firefox。
那么,如何修改呢?按照下面这个步骤来:
1、首先安装 Firefox 扩展 Stylish (点击这里下载),这个扩展允许你为某个或多个指定网站使用自定义的CSS。
2、安装Stylish之后,在管理样式中选择“撰写”,描述信息可以随便写,比如“Google日历”。
3、粘贴下面代码到文本框。
blockquote i{font-style:normal!important;font-size:12px!important;}.noleft nobr,.listv .event-title,.lkh,.cheadToday,.cheadNotToday > span,#expand_all_link,#collapse_all_link,.calListLabel,.newdate,.titlecell div li,.chipbody dd div span,.chipbody dt .timelabel,#eventowner .month_event span.event-title span,#eventowner .moreevents{font-size:12px!important;}
看图:
4、保存
5、打开Google日历,在火狐右下角的Stylish图标中选中你刚才添加样式表。
希望这篇文章对你有用。 ![]()
超链接A的4个CSS属性是有顺序的。
错误的顺序会导致一些问题,例如:超链接访问过后 hover 样式就不出现。
正确的顺序应该为,link-visited-hover-active。
a:link {
color: #676777;
text-decoration: none;
}
a:visited {
color: #676777;
text-decoration: none;
}
a:hover {
color: #90909F;
text-decoration: underline;
}
a:active {
color: #676777;
text-decoration: none;
}
温故而知新:
延伸阅读:《web标准常见问题集合》
Tags: css