Mar 26 2008

卫星电视

Category: 技术ssmax @ 21:57:03

今天不知道为啥点了进去一个卫星电视的网站,然后看了一下,真想搞一套玩玩啊,如果警察叔叔不来抓的话,哈哈

新手必看:卫星电视从入门到精通卫星电视从入门到精通发烧手册-【引言】

卫星电视广播是高科技发展对人类社会生活的赐福。当您做在家里,用一只直径不及1米的抛物面天线对准相对静止轨道上的广播卫星时,天下山

川、民俗民情、新闻要讯尽入眼底,此时您定有天涯咫尺之叹!人们倍感人类生存空间的距离大大地缩小了。

天空中单颗卫星上百余套高清晰电视节目、数字广播,是不是吸引着您?几百套节目的同时接收也不是梦幻,高科技的成就振奋人心。

小型地面接收站的建设,要有一个基本的原则,首要的一点是既要有满意的效果,又要少投入,实现资源的最优配置。但是您是不是苦于自己知识有

限,什么机器是自己合适的选择?怎么安装呢?身边又没有懂的朋友,找谁去问呢?况且具体问题一句话、两句话也说不清楚。自己上网去查吧,茫

茫网络,我到哪里去寻找,知识太多了,从什么地方开始学起,遇到难题,网上又没有网友给你解答时,苦苦寻觅,一熬就是半夜。如果您已经拥有

了器材,那您对自己的器材了解多少?是否能熟练的驾御它,还有如何让它发挥最大的最用?

虽然我自己懂的东西也不多,还有很多东西没有研究过,但我还是抽出了一段时间总结了这本手册,为没有接触过卫星的朋友简单介绍下,让您早日

拥有自己的器材,早日看到精彩的节目。

文章介绍本人在卫星电视接收过程中的经验教训,并普及一些卫星电视接收的知识。此外,转载和介绍一些实用的文摘、器材制作,为广大卫视爱好

者服务。文章尽量通俗易懂,真正做到让您从《入门到精通》

http://www.cnsat.net/

这里是我国上空可以收看到的卫星和每个卫星上的节目内容,哈哈,慢慢看吧,很多啊!用一段时间选选自己想看节目.推荐看(亚太2R 76.5°E、中新一号 88.0°E、亚洲二号 100.5°E、亚洲3S 105.5°E、鑫诺一号 110.5°E、马布海一号 146.0°E等)

大部分是中文节目啊,能看懂,如果您非要看外文节目想学外语、看看国外生活方式等,可以啊,这里面也有很多。还不成的话,您就

看别的星。

(1) 频率在3、4千的那些4位数字的都是C段节目,由于频率低、功率小,需要正馈大天线(直径1.2米-3、4米等)。频率在10000

以上的5位数字那些都是KU段节目,频率高、功率大,用偏馈小天线(直径0.35米—1.2米等)就可以接收。

前面对抛物面天线的作用已经介绍了,那么正馈和偏馈天线有什么区别呢?它们不仅是大小的区别。偏馈称为”偏”,因为它是正馈天

线的一部分做成的,也就是由于KU波段功率高,只需要正馈中的这部分就可以拉。一般偏馈均是一次冲压成型,而正馈多为分辨形式

。这样你应该也可以明白了用大的正馈天线也是可以接收KU节目的,但是实际中KU节目小天线就可以,何必浪费呢?

(2)知道这些后,结合寻星参数中每颗星下面国内各个地区场强覆盖图,根据KU和C的场强选择天线尺寸大小

(对照下面的图表选择天线尺寸)

http://www.weixingtv.net/ruanjian/xunxing.rar

这里面有我国各个地方的经度、纬度和您地区接收卫星的时候天线所要调成的仰角和方位角、极化角等。
(4)记录所需参数
准备一张纸上面写下你需要调的卫星所需要的三个角度和这颗卫星上节目的信号最强参数(用于寻星),最弱参数(用于细调达到最
佳效果和固定)。
比如:76.5(KU):最强:东森、Tvbs都很强 :12528V30000 或弱的12278 V 22425
88(C):强:3582 H 12860 弱:3632 V 26667
105.5(C):最强:4094 H 5555 阳光卫视
146(KU):最强:都很强
138的KU:12301垂直30000强
这些数据您可以多记几个,多实验几个,因为有的时候星星上的节目强度也要变化的。(注意以上仅供参考,各个地区,以及不同时

间、参数等可能发生变化)
(5)测量用器具
量角器、铅垂(重物+细线DIY),用于量天线的仰角,这个是最重要的!
指南针(实际上指南针我认为没有什么大的必要,方位角大体可以估计出来的)
(6)小电视、电源线
如果您要到楼顶或者到离电视较远的地方安装天线的话,还建议您找个小电视一般100多元一个,作为监视器,因为调星的时候要边

看电视边调锅的。还有长的电源线也要准备好。

三、正装还是倒装天线

对于正馈大天线来讲就没有这些内容了,也就是说正馈不存在正装到装的话题,您只需用上面软件计算出来的参数直接调就可以了,

以后我们还要学习正馈的调星方法。但是偏馈小锅下面的内容您必须要看了。

正装偏馈:

http://www.weixingtv.net/jihua.swf
Flash:
http://www.weixingtv.net/jihua.swf【第三章 调星经验】

想必您的天线和机器已经到了吧,哈哈,终于可以去调拉!先别着急,看看接收机说明书,看看如何寻星,不同机器的寻星菜单位置

可是不一样的啊,有的很方便,有的可就不一定好找拉。 另外430多系统机器是没有随机说明书的,但是可以参考本站为您准备的关

于430的详细使用说明,器材指南中有!

实际上无论用什么机器调星星,无非大家要了解下面几个内容:

1、设置正确的降频器本振(也就是高频头本振,一般KU头是11300、10750,C头是5150,单位都是MHZ)

2、在机器中找到寻星菜单,机器不同,菜单有难易区别,只要您努力都能上手

3、输入正确的寻星参数http://www.cnsat.net/

调星应该注意的内容:
1、一定要先调好天线仰角,高频头的极化角度也要大概先调准确。
2、然后找到正南后,(不用指南针的,大体估计就可以了)找到大致方位角来回慢慢调整(切记不要着急)
3、 根据信号强度/信号质量、信躁,先强后弱来调整。
首先选择信号强度较高的频道,如76.5度星的12730V30000(现在已经没有这个参数了,可以更换其他,别的星星道理一样)粗调便
于确定天线大致位置。然后选择信号最弱的频道,如76.5度星的12642H21500一组,细调三个角度以尽可能收到更多的节目,并确保

收视效果。
4、反复调整天线的方位和仰角,直到信号质量最好。
5、最后慢慢调极化角,使信号质量、收看效果最好!
6、注意正确使用器材,在调之前好好看看相关使用说明。尤其是初哥,在机器中不知道如何输入自己高频头的本振频率,一般高频

头上都有标记的,有的是在上面贴上纸片上写11300或者11.3 表示的就是11300的本振,有的是在给出写出很多本振 然后在本品的真

正本振上面打个标记。

补充介绍:
A、75CM天线角度差大概20度左右,60CM角度差大概24度左右
B、一定要先把高频头极化调成基本正确的位置(C头更重要)
C、仰角一般不可能第一次就调节的非常好,所以第一次在大概位置来回转方位角度的时候没有信号质量(信躁)的话,我们就增减

一下仰角,然后再来回寻找卫星,直到出现信号!
D、出现信号后,强弱信号对比输入后,仔细调整3角达到所有信号都可以下来后,就固定天线!

如果没有问题的话,这么做基本大功告成,
回家参考说明书和网上节目参数,加入节目欣赏去吧。

注意:经常有朋友问我 调星星的时候有信号强度指示,就是没有信号质量、信燥,那么给您的答案就是没有对准星星呢,反过来再

好好看看上面我让掌握的三个角度,以及机器中需要注意的内容,看您注意了吗?如果不是设置问题,就是没有对准,不要着急,一

点一点的对,肯定可以的!其中有信号强度,代表机器没有问题,以及您的馈线、高频头、机器连接正确,剩下的就是按照正规操作

方法 把他对准!

补充:测量仰角的方法

角度1是用您软件计算出来的角度-20(60CM天线角度差)
角度2是与这个-20(角度差)后的角度互余的
(我想上面这些的几何道理大家都应该明白)

调星的时候使用这2个角度都可以,因为可能工具不同就看您测量哪个方便拉,至于说其他的内容,继续欣赏本文章。

制作量仰角的工具请参考:


Mar 25 2008

To remove a file whose name starts with a ‘-’

Category: 技术ssmax @ 10:11:37

in man rm…..

       To remove a file whose name starts with a ‘-’, for example ‘-foo’, use one of these commands:

              rm — -foo

              rm ./-foo


Mar 18 2008

torrents文件的java解释

Category: 技术ssmax @ 21:40:43

翻代码翻出n年前写的东西,当初还想做个tracker的,还去sourceforge申请个项目,没通过。。。怀念一下:

import java.util.*;

public class BitDecoder
{
 //0
 public static final byte ZERO_BYTE = 0x30;
 
 //9
 public static final byte NINE_BYTE = 0x39;
 
 //-
 public static final byte MINUS_BYTE = 0x2D;
 
 //:
 public static final byte COLON_BYTE = 0x3A;
 
 //d
 public static final byte d_BYTE = 0x64;
 
 //e
 public static final byte e_BYTE = 0x65;
 
 //i
 public static final byte i_BYTE = 0x69;
 
 //l
 public static final byte l_BYTE = 0x6c;
 
 //n
 public static final byte NULL_BYTE = 0x6e;
 
 //最大解释层数
 public static int MAX_LAYER = 8;
 
 private int now_layer = 0;
 private String index_key = “”;
 private int key_start = 0;
 private int key_end = 0;
 
 public BitDecoder(String key)
 {
  if(key!=null)
   index_key = key;
 }
 
 public void reset(String key)
 {
  now_layer = 0;
  key_start = 0;
  key_end = 0;
  if(key!=null)
   index_key = key;
  else
   index_key = “”;
 }
 
 public String getkey()
 {
  return index_key;
 }
 
 public int getKeyStart()
 {
  return key_start;
 }
 
 public int getKeyEnd()
 {
  return key_end;
 }
 
 //解出int,用String保存
 private BTDecodeObj decode_int(byte [] bytes,int index) throws Exception
 {
  int till_index = ++index;
  
  byte workingbyte = bytes[till_index];
  
  if(workingbyte == MINUS_BYTE)
  {
   workingbyte = bytes[till_index+1];
   if(workingbyte == ZERO_BYTE)
    throw new Exception(“number -0 is not allowed”);
   else if(workingbyte == e_BYTE)
    throw new Exception(“only minus is not allowed”);
   else if(workingbyte>NINE_BYTE || workingbyte<ZERO_BYTE)
    throw new Exception(“number must be 0-9”);
   else
    till_index++;
  }
  
  while(true)
  {
   workingbyte = bytes[till_index];
   if(workingbyte == e_BYTE)
    break;
   else if(workingbyte>NINE_BYTE || workingbyte<ZERO_BYTE)
    throw new Exception(“number must be 0-9”);
   else
    till_index++;
  }
  
  if(bytes[index]==ZERO_BYTE && till_index!=index+1)
   throw new Exception(“number 0 must be alone”);
  else  
   return new BTDecodeObj(new String(bytes,index,till_index-index),till_index+1);
 }
 
 //解出String
 private BTDecodeObj decode_string(byte [] bytes,int index) throws Exception
 {
  int colon_index = index;
  byte workingbyte = 0x00;
  while(true)
  {
   workingbyte = bytes[colon_index];
   if(workingbyte == COLON_BYTE)
    break;
   else if(workingbyte>NINE_BYTE || workingbyte<ZERO_BYTE)
    throw new Exception(“string length must be 0-9”);
   else
    colon_index++;
  }
  
  if(bytes[index] == ZERO_BYTE && colon_index!=index+1)
   throw new Exception(“string length 0 must follow by :”);
  
  index = Integer.parseInt(new String(bytes,index,colon_index-index));
  colon_index++;

  return new BTDecodeObj(new String(bytes,colon_index,index,”8859_1″),colon_index+index);
 }
 
 //解出List
 private BTDecodeObj decode_list(byte [] bytes,int index) throws Exception
 {
  now_layer++;
  if(now_layer > MAX_LAYER)
   throw new Exception(“too many list or dictionary layer!”);
  
  index++;
  ArrayList resultlist = new ArrayList();
  
  BTDecodeObj tempobj = null;
  
  while(bytes[index] != e_BYTE)
  {
   tempobj = bdecode(bytes,index);
   index = tempobj.getIndex();
   resultlist.add(tempobj.getObj());
  }
  
  now_layer–;
  return new BTDecodeObj(resultlist,index+1);
 }
 
 //解出dict
 private BTDecodeObj decode_dict(byte [] bytes,int index) throws Exception
 {
  now_layer++;
  if(now_layer > MAX_LAYER)
   throw new Exception(“too many list or dictionary layer!”);
  
  index++;
  HashMap resultmap =  new HashMap();
  
  BTDecodeObj tempobj = null;
  String lastkey = “”;
  String nowkey = null;
  
  while(bytes[index] != e_BYTE)
  {
   tempobj = decode_string(bytes,index);
   nowkey = (String)tempobj.getObj();
   if(nowkey.compareTo(lastkey) <= 0)
    throw new Exception(“dictionary lexicographically order error!”);
   
   lastkey = nowkey;
   index = tempobj.getIndex();
   if(key_start==0 && index_key.equals(lastkey))
   {
    key_start = index;
   }
   
   tempobj = bdecode(bytes,index);
   index = tempobj.getIndex();
   if(key_start!=0 && index_key.equals(lastkey))
   {
    key_end = index;
   }
   
   resultmap.put(nowkey,tempobj.getObj());
  }
  
  now_layer–;
  return new BTDecodeObj(resultmap,index+1);
 }
 
 private BTDecodeObj bdecode(byte [] bytes,int index) throws Exception
 {
  if(bytes[index]>=ZERO_BYTE && bytes[index]<=NINE_BYTE)
   return decode_string(bytes,index);
  else if(bytes[index] == d_BYTE)
   return decode_dict(bytes,index);
  else if(bytes[index] == l_BYTE)
   return decode_list(bytes,index);
  else if(bytes[index] == i_BYTE)
   return decode_int(bytes,index);
  else
   throw new Exception(“torrent bencode format error!”);
 }
 
 public Object bdecode(byte [] bytes) throws Exception
 {
  BTDecodeObj resultobj = bdecode(bytes,0);
  if(resultobj.getIndex() != bytes.length)
   throw new Exception(“torrent bencode format error,length exception!”);
  
  return resultobj.getObj();
 }
 
 public int getNowLayer()
 {
  return now_layer;
 }

 public static class BTDecodeObj
{
 Object obj = null;
 int index = 0;
 
 public BTDecodeObj(Object obj,int index)
 {
  this.obj = obj;
  this.index = index;
 }
 
 public Object getObj()
 {
  return obj;
 }
 
 public int getIndex()
 {
  return index;
 }
}
}


Mar 18 2008

Hex转换

Category: 技术ssmax @ 21:28:58

n年前的课题了,今天要用,都忘记了,记录一下

byte to hex 直接java方法:

// convert a single byte b to a 2-char hex string
// with possible leading zero.
String s2 = Integer.toString( ( b & 0xff ) + 0x100, 16 /* radix */ )
		.substring( 1 );

字典法和反向转换,记录自己在无线时候写的一个:

        /*
         *取得byte的16进制字符串
        */     
        private static final String HexString = “0123456789ABCDEF”;
       

        public static String getHexString(byte [] msg_byte)
        {
                StringBuffer sb = new StringBuffer(msg_byte.length * 2);
                for(int i =0;i<msg_byte.length;i++)
                {
                        sb.append(HexString.charAt(0xf&msg_byte[i]>>4)).append(HexString.charAt(msg_byte[i]&0xf));
                }
                return sb.toString();
        }      
               
        public static byte[] getBytesFromHexStr(String s)
        {              
                try    
                {              
                        int i = s.length();
                        byte result[] = new byte[i >> 1];
                        for(int k = 0; k < i;)
                                result[k >> 1] = (byte)(Integer.parseInt(s.substring(k,k+=2),16));
                        return result;
                }
                catch(Exception ex)
                {
                        //ex.printStackTrace();
                        return null;
                }
        }


Mar 14 2008

apache 2 internal dummy connection

Category: 技术ssmax @ 22:54:17

这几天mima的机器经常死,看了一下apache的log,发现很多::1的请求

 ::1 – – [13/Mar/2008:23:59:02 +0800] “GET /” 400 460 “-” “-”

看不懂,到apache 的userlist里面问了一下,原来是::1是ipv6的本机表示,真实out了,ipv6都不知道。。。

然后就用tcpdump看了一下

tcpdump -A -s0 -i any tcp src host ::1

发现了请求内容,原来是。。。Apache internal dummy connection。。。汗啊汗,开头我还以为linux中木马了。。。

google了一下,官方没有找到什么说明,找到一个blog有写一点

http://vdachev.net/blog/2007/02/01/apache-internal-dummy-connection/ 

I Google’d for “(internal dummy connection)”. There were only a few results explaining what was really happening… many of them were rumors. I found an entry in Yenya’s blog with the same issue. It suggested this is a replacement in Apache 2.x of sending signals to its processes as signals are not available on all platforms. This means during graceful restart, instead a SIGUSR1 to be sent to all child processes, a subrequest is made. The CodeSearch results seem to confirm this. Now, let’s say my server is running ~100 processes and I change anything in my configuration. Would this mean ~100 subrequest at a time ? Yeah, this would be an overhead (over- an already loaded server’s -head) ! Oh, my web servers is being gracefully reloaded each time a log is rotated… ~50 times.  

It seems this feature exists in the whole 2.x series so a downgrade to 2.0 would not solve this issue. It’s just in versions prior to 2.2.0 there was no indication of such internal requests. Some people proposed switching to Worker MPM. However people say that on 2.6.x boxes (my case) Prefork MPM runs faster. Additionally, PHP is not thread-safe by default (the Worker MPM is thread based) and it should be compiled with Zend Thread Safety libraries (–enable-experimental-zts). I don’t think it’s worth… It would be great if there was a way to switch back to the old behaviour on platforms that support it… it’s odd otherwise. Now I’ve disabled the logging for the default website and I’ve left mod_redirect (as I don’t think Apache would follow redirects internally).

P.S.: I suppose signals are also used to terminate a child then the number of request reaches MaxRequestsPerChild, so I experimentaly disabled this limit as it’s used to protect the system from any memory leaks in child processes. However, I haven’t noticed any by now. I hope this will decrease the number of signals sent to the child processes. Let’s check this out…

大概就是一种新的内部通信机制,代替了发进程信号,好像是2.0就开始有了,但是2.2没有从log中过滤,不知道有什么影响,在官方的buglist上面看到好像2.2.6有点问题,tmd服务器刚好就是2.2.6,下周顺便升级了丫的。。。


Mar 14 2008

还是ip统计。。。

Category: 技术ssmax @ 09:55:29

昨晚小汪子过来,看见偶统计ip的程序,说。。。其实一行就可以做到了。。。

cat access_log|awk ‘{print $1}’|sort |uniq -c|sort -nr

 狂晕ing,对linux命令还是不熟悉啊。。。


Mar 13 2008

perl进行单词计数,ip统计

Category: 技术ssmax @ 13:48:18

今天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 12 2008

Spring 和 Struts2 的小冲突。。。

Category: 技术ssmax @ 14:25:53

昨天写发送邮件的时候用了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 11 2008

java mail smtp simple auth

Category: 技术ssmax @ 22:23:21

今天写个后台发送,连到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.  看来不用改了。。。

Package com.sun.mail.smtp Description

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:

  • Provide an Authenticator object when creating your mail Session and provide the username and password information during the Authenticator callback.Note that the 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.
  • Call the Transport 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 04 2008

Apache ErrorDocument 跳转到 jsp后没有 REDIRECT_URL header

Category: 技术ssmax @ 17:10:23

嗅嗅今天发了个问题,apache REDIRECT_URL not set

  <LocationMatch “/web/.*\.html”>
        Options FollowSymLinks Includes
        AllowOverride None
        ErrorDocument 404 /detail.jsp
  </LocationMatch>

 在jsp里面拿不到  REDIRECT_URL 头

 一开始我还不知道有这个东西,上去apache查文档。。。

Purpose
Additional functionality. Allows webmasters to configure the response of Apache to some error or problem.Customizable responses can be defined to be activated in the event of a server detected error or problem.

e.g. if a script crashes and produces a “500 Server Error” response, then this response can be replaced with either some friendlier text or by a redirection to another URL (local or external).

Old behavior
NCSA httpd 1.3 would return some boring old error/problem message which would often be meaningless to the user, and would provide no means of logging the symptoms which caused it.
New behavior
The server can be asked to;

  1. Display some other text, instead of the NCSA hard coded messages, or
  2. redirect to a local URL, or
  3. redirect to an external URL.

Redirecting to another URL can be useful, but only if some information can be passed which can then be used to explain and/or log the error/problem more clearly.

To achieve this, Apache will define new CGI-like environment variables, e.g.

REDIRECT_HTTP_ACCEPT=*/*, image/gif, image/x-xbitmap, image/jpeg
REDIRECT_HTTP_USER_AGENT=Mozilla/1.1b2 (X11; I; HP-UX A.09.05 9000/712)
REDIRECT_PATH=.:/bin:/usr/local/bin:/etc
REDIRECT_QUERY_STRING=
REDIRECT_REMOTE_ADDR=121.345.78.123
REDIRECT_REMOTE_HOST=ooh.ahhh.com
REDIRECT_SERVER_NAME=crash.bang.edu
REDIRECT_SERVER_PORT=80
REDIRECT_SERVER_SOFTWARE=Apache/0.8.15
REDIRECT_URL=/cgi-bin/buggy.pl

note the REDIRECT_ prefix.

At least REDIRECT_URL and REDIRECT_QUERY_STRING will be passed to the new URL (assuming it’s a cgi-script or a cgi-include). The other variables will exist only if they existed prior to the error/problem. None of these will be set if your ErrorDocument is an external redirect (i.e., anything starting with a scheme name like http:, even if it refers to the same host as the server).

 原来还有这样的东东,对apache的稳定性有信心,那应该就是resin的问题了,mod_caucho经常有各种奇怪的行为,上去resin网站一查。。发现:

3.0.18 – Feb 23, 2006

  • ConnectionPool needs to be a lifo to avoid accumulating too many pool items (rep b Kaminsky Leonid)
  • max-create-connections wasn’t included in DBPool (rep by Kaminsky Leonid)
  • (2006-02-15) mod_caucho was not properly handling check-interval larger than 32-bits (#926, rep by Mutsubu Inayama)
  • Changes in ./configure and Makefile for MacOSX EGREP libtool issue (#432, rep by jdane)
  • (2006-02-09) class-loader can now appear anywhere, not just first element (#924, rep by dlcr)
  • Amber inheritance needs to work with CMR (#301, rep by Francois Bertrand)
  • JMX Notifications on restart (#195, #237, rep by Erik Hartenian, Glenn Rush)
  • fmt:param wasn’t printing children for validation (#893, rep by Ed Hollingsworth)
  • Apache2 mod_caucho needs to grab REDIRECT_URL and REDIRECT_QUERY_STRING (#87, rep by A Jacklin)
  • change escaping of command line argument for WIN32 service installation (#141, rep by Steve Arbour)
  • 哈哈,就这样解决了,升级吧。。。。


    « Previous PageNext Page »