昨晚小汪子过来,看见偶统计ip的程序,说。。。其实一行就可以做到了。。。
cat access_log|awk ‘{print $1}’|sort |uniq -c|sort -nr
狂晕ing,对linux命令还是不熟悉啊。。。
Mar 14 2008
昨晚小汪子过来,看见偶统计ip的程序,说。。。其实一行就可以做到了。。。
cat access_log|awk ‘{print $1}’|sort |uniq -c|sort -nr
狂晕ing,对linux命令还是不熟悉啊。。。
Mar 13 2008
今天mima的tomcat又挂掉了,写一段够短的程序分析一下独立ip数量。。。
本来用sed写,写到一半好像写不下去了。。。
cat access_log | sed “s/ – – .*//” |sort |????
然后用perl写了一个
perl countip.pl access_log |head
countip.pl
#!/usr/bin/perl
while(<>){
chomp();
$_ =~ s/ – – .+//g;
$count{$_}++;
}
foreach $word (sort by_count keys %count){
print “$word occurs $count{$word} times\n”;
}
sub by_count {
$count{$b} <=> $count{$a}
}
sort使用了一个子例程作参数来定义排序规则
Mar 13 2008
某人说,hoop现在比mop更yy,更爽了,去看了一下,果然,转一篇:
20连!休斯敦火箭要与世界为敌 !
Houston Rockets, men against the world!!!
83比75!手感冰凉又怎样,客场不利纪录又怎么样,有令人窒息的防守,就有20连胜!瞠目结舌吧,所有人!
尽管今天的比赛场面很难看,效率很低下,但是一场实实在在的胜利是最重要的,历史上终于有了第三支连胜场次的十位数能够达到2的球队,恭喜火箭队,贺喜火箭队,其实现在的每一场比赛,火箭队的对手都会竭尽所能去拦阻纪录的诞生,谁都不想成为历史纪录里那不甚光彩的助教,好比面对张伯伦的尼克斯,面对科比的猛龙。火箭队的这场东征赢得不能说光辉灿烂,但是能够达成20场连胜,火箭已经可以去面对所有当初不屑的眼神,不要再去说火箭的对手没有强队、火箭的胜利充满偶然、火箭的纪录不值一提了,现在的休斯顿火箭队,可以挺起胸膛说自己给尘封了30年的历史拂去灰尘,每一场胜利都是货真价实的,让这么一群平民球员的面前只剩下当年那支比尔-夏曼(Bill Sharman)执教、拥有篮球皇帝威尔特-张伯伦(Wilt Chamberlain)和Logoman杰里-韦斯特(Jerry West)的梦一样的湖人队,就是足以让我们这一辈球迷可以津津乐道的回忆。以后我们回想起当年的看球历史,我们也可以装成资深专家一样给人们详细讲述着这20场荡气回肠的胜利。而火箭队也通过本场比赛的胜利超越了今天负于黄蜂的马刺,上升到了西部第二位,在魔鬼的西南区,用20场不可思议的连胜,火箭队登上了含金量十足的王座。
所有纪录的存在,只是为了被打破——我们的身前,只剩下了33连胜那高山仰止的神迹,也许我们不能够超越他,但至少在那个数字面前,我们还会不断地激励自己继续前行,超越不了别人,我们还可以超越我们自己——而超越自己,就超越了一切。
休斯顿-20连胜-火箭队,要与世界为敌,就要战胜一切!
Mar 12 2008
明日西部将有一场值得关注的大戏,由马刺客场挑战黄蜂。而根据火箭与马刺胜负的不同,将产生多种多样的结果。如果火箭胜且马刺负,那么火箭将顺利登上西部“榜眼”的位置;火箭胜同时马刺胜,那么排名将保持不变,但火箭与黄蜂的差距将拉大到1场;当然一旦火箭输球而黄蜂赢球,那么火箭将被甩到第五的位置……一场之差,天上地下。
Mar 12 2008
昨天写发送邮件的时候用了spring一个property loader,今天发现所有struts2的页面都返回input validation错误了。。。查了半天,查到fielderror是某个mail的properties,为啥struts2回去读那个properties呢。。。原来是spring loader惹的祸。。。
<bean id=”MailProperties” class=”org.springframework.beans.factory.config.PropertiesFactoryBean”>
<property name=”location”>
<value>/WEB-INF/classes/pwrl.mail.properties</value>
</property>
</bean>
就是这个PropertiesFactoryBean的东东,和struts2的 org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor 存在一些数据共享关系,再详细看看源代码才知道。。。
Mar 12 2008
昨天消失多天的天上猪终于出现,原来是侍候老婆坐月子去了,哈哈,被我说中了,生了个公子,被折腾得不行了,估计在崩溃中,痛苦并幸福快乐着。
前几天在大学同学的群里,又有一个mm刚坐完月子,在组织baby聚会呢。。。好像群里也有五六个baby了。。。
Mar 11 2008
今天写个后台发送,连到smtp要登录的,我见java mail里面api默认就可以在connect的时候输入密码,以为直接用就可以啦,谁知道sun 的smtp实现default不打开auth,google一下,记录一些文档。。。还搜到某个猪头说session参数就只有一开始那几个,其实可以有很多很多的。。。
明天回去还要加上 msg.saveChanges(); 不知道有啥用。。。
好像是保存message状态和header的,The send
method calls the saveChanges
method on the message before sending it. 看来不用改了。。。
An SMTP protocol provider for the JavaMail API that provides access to an SMTP server. Refer to RFC 821 for more information.
When sending a message, detailed information on each address that fails is available in an SMTPAddressFailedException
chained off the top level SendFailedException
that is thrown. In addition, if the mail.smtp.reportsuccess
property is set, an SMTPAddressSucceededException
will be included in the list for each address that is successful. Note that this will cause a top level SendFailedException
to be thrown even though the send was successful.
The SMTP provider also supports ESMTP (RFC 1651). It can optionally use SMTP Authentication (RFC 2554) using the LOGIN, PLAIN, and DIGEST-MD5 mechanisms (RFC 2592 and RFC 2831).
To use SMTP authentication you’ll need to set the mail.smtp.auth
property (see below) and provide the SMTP Transport with a username and password when connecting to the SMTP server. You can do this using one of the following approaches:
mail.smtp.user
property can be set to provide a default username for the callback, but the password will still need to be supplied explicitly.This approach allows you to use the static Transport send
method to send messages.connect
method explicitly with username and password arguments.This approach requires you to explicitly manage a Transport object and use the Transport sendMessage
method to send the message. The transport.java demo program demonstrates how to manage a Transport object. The following is roughly equivalent to the static Transport send
method, but supplies the needed username and password:Transport tr = session.getTransport(“smtp”);
tr.connect(smtphost, username, password);
msg.saveChanges(); // don’t forget this
tr.sendMessage(msg, msg.getAllRecipients());
tr.close();
When using DIGEST-MD5 authentication, you’ll also need to supply an appropriate realm; your mail server administrator can supply this information. You can set this using the mail.smtp.sasl.realm
property, or the setSASLRealm
method on SMTPTransport
.
SMTP can also optionally request Delivery Status Notifications (RFC 1891). The delivery status will typically be reported using a “multipart/report” (RFC 1892) message type with a “message/delivery-status” (RFC 1894) part. JavaMail does not currently provide direct support for these new MIME types, but you can process them as any other “multipart” or “message” content, using MimeMultipart
and MimeMessage
objects.
See below for the properties to enable these features.
Note also that THERE IS NOT SUFFICIENT DOCUMENTATION HERE TO USE THESE FEATURES!!! You will need to read the appropriate RFCs mentioned above to understand what these features do and how to use them. Don’t just start setting properties and then complain to us when it doesn’t work like you expect it to work. READ THE RFCs FIRST!!!
The SMTP protocol provider supports the following properties, which may be set in the JavaMail Session
object. The properties are always set as strings; the Type column describes how the string is interpreted. For example, use
props.put("mail.smtp.port", "888");
to set the mail.smtp.port
property, which is of type int.
Name | Type | Description |
---|---|---|
mail.smtp.user | String | Default user name for SMTP. |
mail.smtp.host | String | The SMTP server to connect to. |
mail.smtp.port | int | The SMTP server port to connect to, if the connect() method doesn’t explicitly specify one. Defaults to 25. |
mail.smtp.connectiontimeout | int | Socket connection timeout value in milliseconds. Default is infinite timeout. |
mail.smtp.timeout | int | Socket I/O timeout value in milliseconds. Default is infinite timeout. |
mail.smtp.from | String | Email address to use for SMTP MAIL command. This sets the envelope return address. Defaults to msg.getFrom() or InternetAddress.getLocalAddress(). NOTE: mail.smtp.user was previously used for this. |
mail.smtp.localhost | String | Local host name used in the SMTP HELO or EHLO command. Defaults to InetAddress.getLocalHost().getHostName() . Should not normally need to be set if your JDK and your name service are configured properly. |
mail.smtp.localaddress | String | Local address (host name) to bind to when creating the SMTP socket. Defaults to the address picked by the Socket class. Should not normally need to be set, but useful with multi-homed hosts where it’s important to pick a particular local address to bind to. |
mail.smtp.localport | int | Local port number to bind to when creating the SMTP socket. Defaults to the port number picked by the Socket class. |
mail.smtp.ehlo | boolean | If false, do not attempt to sign on with the EHLO command. Defaults to true. Normally failure of the EHLO command will fallback to the HELO command; this property exists only for servers that don’t fail EHLO properly or don’t implement EHLO properly. |
mail.smtp.auth | boolean | If true, attempt to authenticate the user using the AUTH command. Defaults to false. |
mail.smtp.submitter | String | The submitter to use in the AUTH tag in the MAIL FROM command. Typically used by a mail relay to pass along information about the original submitter of the message. See also the setSubmitter method of SMTPMessage . Mail clients typically do not use this. |
mail.smtp.dsn.notify | String | The NOTIFY option to the RCPT command. Either NEVER, or some combination of SUCCESS, FAILURE, and DELAY (separated by commas). |
mail.smtp.dsn.ret | String | The RET option to the MAIL command. Either FULL or HDRS. |
mail.smtp.allow8bitmime | boolean | If set to true, and the server supports the 8BITMIME extension, text parts of messages that use the “quoted-printable” or “base64” encodings are converted to use “8bit” encoding if they follow the RFC2045 rules for 8bit text. |
mail.smtp.sendpartial | boolean | If set to true, and a message has some valid and some invalid addresses, send the message anyway, reporting the partial failure with a SendFailedException. If set to false (the default), the message is not sent to any of the recipients if there is an invalid recipient address. |
mail.smtp.sasl.realm | String | The realm to use with DIGEST-MD5 authentication. |
mail.smtp.quitwait | boolean | If set to false, the QUIT command is sent and the connection is immediately closed. If set to true (the default), causes the transport to wait for the response to the QUIT command. |
mail.smtp.reportsuccess | boolean | If set to true, causes the transport to include an SMTPAddressSucceededException for each address that is successful. Note also that this will cause a SendFailedException to be thrown from the sendMessage method of SMTPTransport even if all addresses were correct and the message was sent successfully. |
mail.smtp.socketFactory.class | String | If set, specifies the name of a class that implements the javax.net.SocketFactory interface. This class will be used to create SMTP sockets. |
mail.smtp.socketFactory.fallback | boolean | If set to true, failure to create a socket using the specified socket factory class will cause the socket to be created using the java.net.Socket class. Defaults to true. |
mail.smtp.socketFactory.port | int | Specifies the port to connect to when using the specified socket factory. If not set, the default port will be used. |
mail.smtp.mailextension | String | Extension string to append to the MAIL command. The extension string can be used to specify standard SMTP service extensions as well as vendor-specific extensions. Typically the application should use the SMTPTransport method supportsExtension to verify that the server supports the desired service extension. See RFC 1869 and other RFCs that define specific extensions. |
mail.smtp.starttls.enable | boolean | If true, enables the use of the STARTTLS command (if supported by the server) to switch the connection to a TLS-protected connection before issuing any login commands. Note that an appropriate trust store must configured so that the client will trust the server’s certificate. Defaults to false. |
mail.smtp.userset | boolean | If set to true, use the RSET command instead of the NOOP command in the isConnected method. In some cases sendmail will respond slowly after many NOOP commands; use of RSET avoids this sendmail issue. Defaults to false. |
mail.smtp.ssl.protocols | string | Specifies the SSL protocols that will be enabled for SSL connections. The property value is a whitespace separated list of tokens acceptable to the javax.net.ssl.SSLSocket.setEnabledProtocols method. |
mail.smtp.ssl.ciphersuites | string | Specifies the SSL cipher suites that will be enabled for SSL connections. The property value is a whitespace separated list of tokens acceptable to the javax.net.ssl.SSLSocket.setEnabledCipherSuites method. |
In general, applications should not need to use the classes in this package directly. Instead, they should use the APIs defined by javax.mail
package (and subpackages). Applications should never construct instances of SMTPTransport
directly. Instead, they should use the Session
method getTransport
to acquire an appropriate Transport
object.
Mar 10 2008
今天龙哥和向总来给我们上课,热烈欢迎啊,讲的是lex和yacc
以前在comx那猪装的服务器上面,编译apache的时候没找到(那猪用的是最小最小安装的那种)。。。找了半天才装上,用来做语法分析和编译。。。一个字就是,烦。嘿嘿,当年的编译原理,什么状态机啊都忘记得差不多了,不过手动写一个状态机还是很过瘾的。。。
上午保安打电话上来说,有包裹,好大的一个包裹,下去签收,保安一直在那笑,上面写着1.8米大熊哦,晚上帮mm扛回家了,真是很大很大很大一只熊,还是色熊,粉色的熊。。。。
Mar 09 2008
今天一堆人去爬白云山,山上全都是人,从正门上到天南第一峰。。。鸣春谷。。。上一次从正门爬上来应该是20年前,那时候刚有缆车,上来的路是山路,走了几个小时才到,现在都是石级和水泥路,不用半个小时就上去了,汗。。。
后来一堆人要去看桃花涧,偶可没兴趣了,那边可不是一般的远,和mm从柯子岭那边下山,跑回来看火箭录像了,MD强悍啊,18连胜了,估计到21连胜没问题,爽啊~
mm太缺乏运动了,现在已经困得不行了,睡着了,上来发个blog,其实头发也不是很丑的啦,小丸子还是挺可爱的,哈哈哈哈~
Mar 08 2008
【NBA简介】
NBA是National Basketball Association的缩写(国际篮球协会)。总裁:大卫·斯特恩。
现有球队:
东部联盟(east):
大西洋赛区 :尼克斯队、网队、凯尔特人、猛龙队、76人队
中部赛区 :活塞队、步行者队、骑士队、雄鹿队、公牛队
东南部赛区 :热队、魔术队、奇才队、老鹰队、山猫队
西部联盟(west ):
西北赛区 :森林狼队、掘金队、爵士队、开拓者队、超音速队
太平洋赛区:国王队、湖人队、太阳队、勇士队、快船队
西南部赛区:马刺队、火箭队、小牛队、灰熊队、黄蜂队
NBA成立于1946年6月6日。成立时叫BAA,即全美篮球协会(Basketball Association of America),是由十一家冰球馆和体育馆的老板为了让体育馆在冰球比赛以外的时间,不至于闲置而共同发起成立的。
BAA成立时共11支球队:纽约尼克斯队、波士顿凯尔特人队、华盛顿华盛顿国会队、芝加哥牡鹿队、克利夫兰叛逆者队、底特律猎鹰队、费城武士队、匹兹堡铁人队、普罗维登斯蒸气队、圣路易斯轰炸机队和多伦多爱斯基摩人队。1949年BAA吞并了当时的另外一个联盟(NBL),并改名为NBA 。1949-50赛季,NBA共17支球队。1976年NBA吞并了美国篮球协会(ABA),球队增加到22支。 1980年达拉斯小牛队加入NBA。1988年,夏洛特黄蜂队和迈阿密热火队加入NBA。1990年奥兰多魔术队和明尼苏达森林狼队加入NBA。1995年两支加拿大球队加入NBA,多伦多猛龙队和温哥华灰熊队,使NBA的球队达到29支。2004年的山猫队的加入达到30支。
【NBA历史】
1896年,美国第一个篮球组织“全国篮球联盟(简称NBL)”成立,但当时篮球规则还不完善,组织机构也不健全,经常一名队员在一个赛季中可以代表几个队参赛, 经过几个赛季后,该组织就名存实亡了。
1946年4月6日,由美国波士顿花园老板沃尔特·阿·布朗发起成立了“美国篮球协会(英文简称BAA)”,布朗首次提出了后来成为现代职业篮球两大基石的高薪制和合同制,高薪制是指职业篮球必须有雄厚的财政支援,这样才能使比赛保持在高水平上,吸引观众,求得生存。合同制是指一名选手只能与一家俱乐部签订合同,并设立选手储备制,以防球员突然离队时受到损失。
1949年,在布朗的努力下,美国两大篮球组织BAA和NBL合并为“全国篮球协会(简称NBA)”。布朗也成为后来著名的波士顿凯尔特人队的创始人。NBA成立 时拥有17支球队,分成三个赛区比赛,来自NBL的明尼阿波利斯湖人队依靠身高 2.09米的美国第一中锋乔治·迈肯的帮助获得NBA第一个赛季的冠军。
从1954-55赛季起,NBA经自然淘汰只剩下东部联盟和西部联盟两大赛区。其中,东部联盟又分大西洋区、中区;西部联盟又分中西区、太平洋区。
1952年,NBA为了限制第一中锋迈肯的得分能力,将篮下3秒禁区宽度由原来的6英尺扩大到12英尺。到了60年代,由于另一位超级中锋张伯伦的出现,NBA又将禁区宽度扩大到16英尺。 由于NBA的球队在比分领先时常采用拖延战术,使比赛不能吸引观众,从1954-1955赛季起,NBA开始实行24秒制,即每队每次进攻不得超过24秒。
1973年,美国哥伦比亚广播公司以2700万美元买下NBA比赛3年播映权,从而使NBA比赛首次走上电视,但由于当时还不具备实况转播的条件,所以只能播放录像。
1967年,一个新的篮球组织ABA(美国篮球协会)宣告成立,乔治·迈肯任第一位主席。ABA采用红、白、蓝三色篮球,并实行远投三分制,每年还举办扣篮大赛。 这些措施在NBA是不允许的。但由于经营不善,ABA于1976年被美国NBA吞并,从此,NBA形成对美国篮球业的垄断。 1979年起,NBA开始实行3分远投制。为避免各队的实力悬殊太大,NBA建立了每年一度的“NBA新秀选拨制度”,将当年毕业的大学生选手按水平高低排出名次,然后由各俱乐部按当年联赛的最后排名依次挑选, 排名靠后者先选,每轮各队只能选择一名,这样就保证了实力最弱的球队能得到水平最高 的新秀,选到新星的弱队在新赛季中往往会脱胎换骨。为避免财大气粗的球队用高薪垄断明星球员,NBA规定了每支球队的工资总额限制。如用很多钱购买明星,则就无力买到其它优秀球员。这一制度保证了最好的明星平均分布在各个球队,使各队实力十分接近。 如果说“高薪制”和“合同制”是NBA两大基石,那“新秀选拨制”和“薪金限额制”则确保了NBA比赛的激烈和精彩,比赛的不可预测性将众多的美国球迷吸引到篮球场。
NBA联赛还实行转会制度,NBA球员转会不得买卖,只能以人换人。从赛季开始到第16个星期四晚9时止,球队可自由交换球员。此后一直到常规赛季结束,各队人员 全部“冻结”。NBA转会是连人带合同一起交换。
吹灭了第58根生日蜡烛,蛋糕上是幅2005年最新版的NBA版图。夏洛特山猫,成了奶油铺张上的又一颗樱桃。三十,不是纹理沉淀的旧年轮,而是内存扩张的新时空,从1946到2004,球队条形码从No.11到No.30,规模空前的NBA,三十而立。