Archive for 四月, 2010

.htaccess – typo3

RewriteEngine on
#RewriteBase /
RewriteRule ^typo3$ typo3/index_re.php [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l

RewriteRule .* index.php [L]

AuthName “Website”
AuthType Basic
AuthUserFile /www/.htpasswd
require valid-user

htpasswd -c /home/doe/public_html/.htpasswd username111


TSconfig – RTE

RTE.default {
blindImageOptions = magic, dragdrop
#contentCSS = fileadmin/templates/inc/css/global.css
showTagFreeClasses =
classesCharacter =
classesParagraph =
classesImage =
classesAnchor = external-link, internal-link, download, mail, thickbox
classesAnchor.default {
page = internal-link
url = external-link
file = download
mail = mail
}
classesTable =
classesTD =
classesUL =
classesHR =
enableWordClean = 1
removeTrailingBR = 1
removeComments = 1
removeTags = sdfield, font
removeTagsAndContents = style, script
useCSS = 1

# blockstylelabel, blockstyle, textstylelabel, textstyle, fontstyle, fontsize, formatblock, bold, italic, underline, strikethrough, subscript, superscript, lefttoright, righttoleft, left, center, right, justifyfull, orderedlist, unorderedlist, outdent, indent, textcolor, bgcolor, textindicator, emoticon, insertcharacter, line, link, image, table, user, acronym, findreplace, spellcheck, chMode, inserttag, removeformat, copy, cut, paste, undo, redo, showhelp, about, toggleborders, tableproperties, rowproperties, rowinsertabove, rowinsertunder, rowdelete, rowsplit, columninsertbefore, columninsertafter, columndelete, columnsplit, cellproperties, cellinsertbefore, columninsertafter, celldelete, cellsplit, cellmerge
# showButtons = *
# hideButtons = blockstylelabel, blockstyle
# toolbarOrder = blockstylelabel, blockstyle, bar, textstylelabel, textstyle, bar, formatblock, linebreak, bold, italic, underline, unorderedlist, bar, link, image, bar, removeformat, copy, cut, paste, undo, redo, bar, chMode, linebreak, table, toggleborders, tableproperties, rowproperties, rowinsertabove, rowinsertunder, rowdelete, rowsplit, columninsertbefore, columninsertafter, columndelete, columnsplit, cellproperties, cellinsertbefore, columninsertafter, celldelete, cellsplit, cellmerge, textstyle
showButtons = formatblock,bold, underline, italic, left, center, right, justifyfull, orderedlist, unorderedlist, insertcharacter, link, image, removeformat, copy, cut, paste, undo, redo, subscript, superscript, findreplace, textindicator, user, chMode,
# hideButtons = blockstyle, blockstylelabel,fontstyle, formatblock, fontsize, lefttoright, righttoleft, textcolor, bgcolor, emoticon, spellcheck, inserttag, outdent, indent, acronym, line, table, toggleborders, tableproperties, rowproperties, rowinsertabove, rowinsertunder, rowdelete, rowsplit, columninsertbefore, columninsertafter, columndelete, columnsplit, cellproperties, cellinsertbefore, cellinsertafter, celldelete, cellsplit, cellmerge, showhelp, about, textstyle, textstylelabel, insertcharacter, underline, strikethrough
hideTableOperationsInToolbar = 0

disableContextMenu = 0
disableTYPO3Browsers = 0
disableSelectColor = 0
disableEnterParagraphs = 0
hidePStyleItems = pre,address,blockquote,div
hideFontSizes =
fontSizes =
hideTags = 0
disableColorPicker = 1
showStatusBar = 1
defaultLinkTarget = _self
buttons.formatblock.removeItems = pre,address,blockquote,div
}

RTE.classesAnchor {
internalLink {
class = internal-link
type = page
image >
titleText >
}
externalLink {
class = external-link
type = url
image >
titleText >
}
download {
class = download
type = file
image >
titleText >
}
mail {
class = mail
type = mail
image >
titleText >
}
}

RTE.default.proc {
overruleMode = ts_css
remapParagraphTag = p
dontConvBRtoParagraph = 1
internalizeFontTags = 1
allowTagsOutside = img, table, br, span, hr, h1, h2, h3, h4,h5,h6,embed,object,param
# table, tbody, tr, th, td, h1, h2, h3, h4, h5, h6, div, p, br, span, ul, ol, li, pre, blockquote, strong, em, b, i, u, sub, sup, strike, a, img, nobr, hr, center, font, tt, q, cite, abbr, acronym, sdfield
allowTags = table, tbody, tr, th, td, h1, h2, h3, h4, h5, h6, div, p, br, span, ul, ol, li, blockquote, strong, em, b, i, u, sub, sup, strike, a, img, nobr, hr,embed,object,param
denyTags = *
preserveTags = div, span, & &quote;
keepPDIVattribs = id,class,style,align

# Allow embed (Youtube) HTML tags in the RTE
allowTags := addToList(object,param,embed)
allowTagsOutside := addToList(object,embed)
entryHTMLparser_db.allowTags < RTE.default.proc.allowTags

allowedClasses =
entryHTMLparser_db = 1
entryHTMLparser_db {
allowTags < RTE.default.proc.allowTags
denyTags >
htmlSpecialChars = 0
tags {
div.remap >
## REMOVE IMG TAGS
# img.allowedAttribs = 0
# img.rmTagIfNoAttrib = 1
## CLEAN ATTRIBUTES ON THE FOLLOWING TAGS
span.fixAttrib >
# span.fixAttrib.style.unset = 1
# p.fixAttrib.align.unset = 1
# div.fixAttrib.align.unset = 1
# hr.allowedAttribs = class
# b.allowedAttribs = xml:lang
# blockquote.allowedAttribs = xml:lang
# cite.allowedAttribs = xml:lang
# em.allowedAttribs = xml:lang
# i.allowedAttribs = xml:lang
# q.allowedAttribs = xml:lang
# strong.allowedAttribs = xml:lang
# sub.allowedAttribs = xml:lang
# sup.allowedAttribs = xml:lang
# tt.allowedAttribs = xml:lang
}
removeTags = sdfield
rmTagIfNoAttrib >
keepNonMatchedTags = protect
}

HTMLparser_db {
noAttrib = b, i, u, strike, sub, sup, strong, em, quote, blockquote, cite, tt, br, center
xhtml_cleaning = 1
}

exitHTMLparser_db = 1
exitHTMLparser_db {
tags.b.remap = strong
tags.i.remap = em
keepNonMatchedTags = 1
htmlSpecialChars = 0
}
}

RTE.default.FE < RTE.default

#mod.SHARED {
# defaultLanguageLabel = Deutsch
# defaultLanguageFlag = de.gif
#}

## Default RTE configuration

RTE.default.buttons.indent.useBlockquote = 1
RTE.default.buttons.left.useAlignAttribute = 1
RTE.default.buttons.center.useAlignAttribute = 1
RTE.default.buttons.right.useAlignAttribute = 1
RTE.default.buttons.justifyfull.useAlignAttribute = 1

RTE.default.buttons.left.useClass = test-left

RTE.default.buttons.center.useClass = test-center

RTE.default.buttons.right.useClass = test-right


typo3 TCA Flexform CSH

也就是说我们已经为TCA的字段加上了一个说明,那如何实现这个效果呢,步骤如下:
1. 创建一个csh(context sensitive help)文件(比如我的文件是locallang_csh_pages.php),这个文
件存储了,你在tca中要用到了所有的description信息.
$LOCAL_LANG = Array (
‘default’ => Array (
‘fieldname.title’=>titile, 标题
‘fieldname.description’=>description是一个简要的介绍信息,
‘fieldname.details’=>details是当你鼠标hover过去的时候看的详细信息,
)
)
2. 在你的ext_tables.php中引入这个csh的文件。
t3lib_extMgm::addLLrefForTCAdescr(‘tx_davtravel_catalogue’,’EXT:dav_travel/locallang_csh_pages.php’);

注意:tx_davtravel_catalogue为数据库表名,dav_travel 为插件名
3.在你的tca.php中的interface这个数组中加入always_description如下:
“interface” => Array (
“always_description” => 1
),

Flexform
Add context sensitive help (CSH) to FlexForm fields

1. FILE: your_extkey/pi1/flexform_ds.xml


  
    1
  
  
    
      
        
          The title of the sheet
          LLL:EXT:your_extkey/pi1/locallang_csh_flexform.xml
        
        array
        
          
            
              
              
                ... field configuration ...
              
            
          
        
      
    
  



2. FILE: your_extkey/pi1/locallang_csh_flexform.xml



  
    CSH labels for FlexForm fields
    CSH
    
    EXT:your_extkey/pi1/locallang_csh_flexform.xml
    
  
  
    
      
      
      
      
      
      
      
    
  


typo3 mail

1.sendnotifyemail (前台)

$this->cObj->sendNotifyEmail($msg, $recipients, $cc, $email_from, $email_fromName=”, $replyTo=”)

typo3.org/fileadmin/typo3api-4.2.6/df/d65/classtslib__cObj.html#bf556a717be8d450ebd66870e9d13f50

2.sendHTMLMail (前后台)

require_once PATH_tslib.’media/scripts/fe_adminLib.inc’;

user_feAdmin::sendHTMLMail($content,$recipient,$dummy,$fromEmail,$fromName,$replyTo=”);

typo3.org/fileadmin/typo3api-4.2.6/da/d94/fe__adminLib_8inc-source.html#l01536

Emailconf example


$confemail = array ('###SITENAME###' => $GLOBALS['TSFE']->TYPO3_CONF_VARS['SYS']['sitename']);
foreach ($GLOBALS['TSFE']->fe_user->user as $key1=>$val1){
$confemail['###'.t3lib_div::strtoupper($key1).'###'] = $val1;
}
/** * Application for alteration of personal information via e-mail
* @return success/failed message
*/
function sendNotifyEmail($confemail = array()) {
//get email content
$emailContent = $this->lConf ['emailtitle'] . chr(10) . $this->lConf ['emailcontent'];
//send email
if (! empty ( $confemail )) {
foreach ( $confemail as $key => $val ) {
$emailContent = str_replace ( $key, $val, $emailContent );
}
}
if ($this->cObj->sendNotifyEmail (
$emailContent, $this->lConf ['emailto'], '', $this->lConf ['emailfrom'], $this->lConf ['emailfromname'] )) {
return $this->cObj->wrap($this->pi_getLL ( 'emailsuccess' ),'|

‘); } else {
return $this->cObj->wrap($this->pi_getLL ( ’emailerror’ ),’|

‘); } }

3. t3lib_htmlmail(前后台)
####6.2####
$this->objectManager->get(‘TYPO3\\CMS\\Core\\Mail\\MailMessage’);

require_once(PATH_t3lib.’class.t3lib_htmlmail.php’);

// Prepare mailer and send the mail
$mailer = t3lib_div::makeInstance(‘t3lib_htmlmail’);
$mailer->start();
$mailer->useBase64();
$mailer->from_email = ”;
$mailer->from_name = ”;
$mailer->charset = ‘iso-8859-1′;
//$mailer->replyto_email = $this->reply_email;
//$mailer->replyto_name = ‘TEST-TASK’;
$mailer->subject = ”;
//$mailer->addPlain($mailBody);
$mailer->addHTML($url); //支持图片CID
$mailer->setRecipient(recipient@email.com);
$mailer->setHeaders();
$mailer->setContent();
$mailer->sendtheMail();

4. t3lib_mail_message (前后台)

$mail = t3lib_div::makeInstance(‘t3lib_mail_Message’); 
$mail->setFrom(array($email => $name)); 
$mail->setTo(array($email => $name)); 
$mail->setReplyTo(array(test_replyto@test.com => ‘name2′)); 
$mail->setSubject($subject); 
$mail->setBody($body, ‘text/html’, ‘iso-8859-1′); 
$mail->send();

相关:http://buzz.typo3.org/teams/core/article/your-first-blog/

Practical samples
The best way to explain is to show a few examples

Regular syntax

$mail = t3lib_div::makeInstance(‘t3lib_mail_Message’);
$mail->setFrom(array($email => $name));
$mail->setTo(array($email => $name));
$mail->setSubject($subject);
$mail->setBody($body);
$mail->send();
Concatenated syntax

Because most methods return the message object the calls can also be concatenated:

$mail = t3lib_div::makeInstance(‘t3lib_mail_Message’);
$mail->setFrom(array($email => $name))
->setTo(array($email => $name))
->setSubject($subject)
->setBody($body)
->send();
Extra options

The class t3lib_mail_Message extends the class Swift_Message, so all the magic of Swift Mailer is available in the t3lib_mail_Message. One of the things added by t3lib_mail_Message is the send() method. This takes care of all the ‘transport’ and ‘mailer’ magic. It will use the settings from the Install Tool, so all mails from TYPO3 will use the same transport method.

HTML and plain text mails

It’s easy to add alternative body parts. Swift Mailer will add the appropriate boundaries and MIME-part headers:

$mail->setBody($bodyHtml, ‘text/html’);
$mail->addPart($bodyText, ‘text/plain’);
Attachments

Again Swift Mailer will take care of the encoding, MIME part headers, etc.

$mail->attach(Swift_Attachment::fromPath($theFile));
Want to set the filename of the attachment?

$mail->attach(Swift_Attachment::fromPath($theFile)->setFilename($theName));
Inline images

If you want to embed images in HTML text Swift Mailer can help you too

$cid = $mail->embed(Swift_Image::fromPath($theFile);
The $cid contains the id you can use in the HTML content in the src attribute of the img tag.

 

使用cid:标记,表明图形是放在一个叫123的附件中的 然后加入一个附件,指定为 content-type: image/gif content-id: <123> 即上面那个123 content-disposition: inline; filename=sdfsdf filename是随便指定的 content-transfer-encodinf: base64 这里是附件内容要求用base64编码。

Legacy code
Existing extensions will use various mail functions in the current TYPO3 API. To make sure that all mails sent from the TYPO3 installation use the new transport mechanisms an adapter is included which catches all calls to the ‘old’ functions and forwards them to the Swift Mailer functions. This adapter is not 100% perfect, so in case of problems you can disable this adapter:

$TYPO3_CONF_VARS[‘MAIL’][‘substituteOldMailAPI’] = 0

以下是cid demo from FMOT:

$mail = t3lib_div::makeInstance('t3lib_mail_Message');
            $mail->setFrom(array($sender => $sender_name));
            $mail->setReplyTo($reply_to);
            $mail->setTo($row['email']);
            $mail->setSubject($subject);

            $body = t3lib_div::getUrl($url = $GLOBALS['TSFE']->baseUrl.$this->getLinkUrl('', '&action=newwindow&query_id='.$row['uid']));

            preg_match_all("/\embed(Swift_Image::fromPath($src));
                    if($cid){
                        $body = str_replace($src, $cid, $body);
                    }
                }
            }
            $mail->setBody($body, 'text/html', 'utf-8');
            return $mail->send();

StartPoint

1.取值(array)

$startPoint = $this->cObj->data[‘pages’];

2.去掉startpoint

ext_tables.php
t3lib_div::loadTCA(‘tt_content’);

$TCA[‘tt_content’][‘types’][‘list’][‘subtypes_excludelist’][$_EXTKEY.’_pi1′]=’layout,select_key,pages,recursive‘‘;

3.startpoint多级

$this->storagePid = $this->pi_getPidList($this->cObj->data[‘pages’], $this->cObj->data[‘recursive’]);

后台用户菜单树不显示解决

1. 将用户归入后台用户组editor中
2. editor组属性中DB Mounts:一定要设置.新建File Mounts:时注意指定fileadmin下子目录,否则filelist不会显示。
3. Access权限group选为editor.
后台用户菜单树不显示解决 - 天才bobo仔 - 天上人间*bobo之家后台用户菜单树不显示解决 - 天才bobo仔 - 天上人间*bobo之家


给z-blog加入audio player flash播放器

1、解压文件(audioplayer.swf、audioplayer.js)到SCRIPT中

2、在模版文件catalog.html、default.html、search.html、single.html、tags.html中
加入

<script type="text/javascript" src="<#ZC_BLOG_HOST#>SCRIPT/audioplayer.js"></script>

3、打开FUNCTION目录中的c_system_event.asp

找到:

ElseIf (CheckRegExp(strFileType,"\.(rm)$")=True) Then 
      strFileName="[R A=True]upload/"&objUpLoadFile.FileName&"[/R A]"

在下面加上:

ElseIf (CheckRegExp(strFileType,"\.(mp4)$")=True) Then 
      strFileName="[MP4]upload/"&objUpLoadFile.FileName&"[/MP4]"

4、打开FUNCTION目录中的c_function.asp

找到:

If ZC_UBB_MEDIA_ENABLE And Instr(strType,"[media]")>0 Then

在下面加上:

‘[MP4]
    dim rndID
    objRegExp.Pattern = "(\[MP4\])(.+?)(\[\/MP4\])"
    rndID=Int(100000 * Rnd)
        strContent = objRegExp.Replace(strContent,"<object type=""application/x-shockwave-flash"" data="""&ZC_BLOG_HOST&"SCRIPT/audioplayer.swf"" width=""290"" height=""24"" id=""audioplayer"&rndID&"""><param name=""movie"" value="""&ZC_BLOG_HOST&"SCRIPT/audioplayer.swf"" /><param name=""FlashVars"" value=""playerID="&rndID&"&bg=0xCDDFF3&leftbg=0x357DCE&lefticon=0xF2F2F2&rightbg=0x357DCE&rightbghover=0x4499EE&righticon=0xF2F2F2&righticonhover=0xFFFFFF&text=0x357DCE&slider=0x357DCE&track=0xFFFFFF&border=0xFFFFFF&loader=0x8EC2F4&soundFile=$2"" /><param name=""quality"" value=""high"" /><param name=""menu"" value=""false"" /><param name=""wmode"" value=""transparent"" /></object>")

5、重建文件

6、参数说明

bg= 播放器背景色
leftbg= 播放器左侧按钮背景色
lefticon= 播放器左侧声音图标颜色
rightbg= 播放器右侧按钮背景色
righthover= 播放器右侧按钮活动状态背景色
righticon= 播放器右侧按钮的播放图标颜色
righticonhover= 播放器右侧按钮的播放图标活动状态颜色
text= 播放器显示文字颜色
slider= 时间轴滑块颜色
track= 时间轴背景色
border= 时间轴边线颜色
loader= 载入条颜色
autostart=yes 自动播放
loop=yes 循环播放

演示效果:

7、 点击下载SCRIPT.rar

 (大小:6KB,包含audioplayer.js和audioplayer.swf)

使用方法::[MP3]http://www.lzly.gov.cn/addnew/music/zqf.mp3[/MP3]

8、请把上面出现的 MP4 改为 MP3


google map api

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>      
    <html xmlns=”http://www.w3.org/1999/xhtml” xmlns:v=”urn:schemas-microsoft-com:vml”>      
    <head>      
       <meta http-equiv=”content-type” content=”text/html; charset=utf-8″/>      
    <title>Google 地图 JavaScript API 示例: 简单的地图</title>      
     <script src=”http://ditu.google.cn/maps?file=api&v=2&key=ABQIAAAAzr2EBOXUKnm_jVnk0OJI7xSosDVG8KKPE1-m51RBrvYughuyMxQ-i1QfUnH94QxWIa6N4U6MouMmBA&hl=zh-CN” type=”text/javascript”></script>      
       <script type=”text/javascript”>      
         function initialize() {       
             var map = new GMap2(document.getElementById(“map_container”));       
             map.setCenter(new GLatLng(39.917, 116.397), 14);     
             map.addControl(new GLargeMapControl());        //添加一个大的方向盘控件  
             map.addControl(new GScaleControl());           //添加一个缩放级别控件尺寸
             map.enableScrollWheelZoom();    //鼠标滑轮缩放地图   
             map.enableContinuousZoom();     //放大缩小时启用动画效果   
             map.doubleClickZoomEnabled()    //鼠标双击放大地图  
             map.addControl(new GOverviewMapControl()); //右下角
             map.addControl(new GMenuMapTypeControl());  //右上角

             new GKeyboardHandler(map);  //向地图中添加键盘绑定

/**
 * Classic 10 random markers  now equipped with bounds
 * var markerBounds is a GatLngBounds() that contains the ten markers
 */
//var markerBounds = new GLatLngBounds();
var bounds = map.getBounds();
var southWest = bounds.getSouthWest();
var northEast = bounds.getNorthEast();
var lngSpan = northEast.lng() – southWest.lng();
var latSpan = northEast.lat() – southWest.lat();
for (var i=0; i<10; i++){
  var point = new GLatLng(southWest.lat() + latSpan * Math.random(),
        southWest.lng() + lngSpan * Math.random());    
  map.addOverlay(new GMarker(point));

//markerBounds.extend(point);
}

map.addOverlay(new GMarker(new GLatLng(29.45873118535534,113.02734375)));//武汉标记
        }       
     </script>      
   </head>      
   <body onload=”initialize()” onunload=”GUnload()”>      
    <div id=”map_container” style=”width: 800px; height: 600px”></div>      
  </body>      
 </html>

方法二.

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN””http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”><html>
  <meta http-equiv=”content-type” content=”text/html; charset=utf-8″ />
  <head>
<!–
Copyright 2008 Google Inc.

Licensed under the Apache License, Version 2.0 (the “License”);
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an “AS IS” BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
–>
    <title>Hello Google Earth!</title>
    <!– *** Replace the key below below with your own API key, available at http://code.google.com/apis/maps/signup.html *** –>
    <script src=”http://www.google.com/jsapi?key=ABQIAAAAwbkbZLyhsmTCWXbTcjbgbRSzHs7K5SvaUdm8ua-Xxy_-2dYwMxQMhnagaawTo7L1FE1-amhuQxIlXw”></script>
    <script>
google.load(“earth”, “1”);

var ge = null;

function init() {
  google.earth.createInstance(“map3d”, initCallback, failureCallback);
}

function initCallback(object) {
  ge = object;
  ge.getWindow().setVisibility(true);
}

function failureCallback(object) {
}
    </script>

  </head>
  <body onload=’init()’ id=’body’>
    <center>
      <div>
        Hello, Earth!
      </div>

      <div id=’map3d’ style=’border: 1px solid silver; height: 600px; width: 800px;’></div>
    </center>
  </body>

</html>


MTU值的修改

默认和最大 PPPoE MTU 大小为 1,480 字节。对于某些 Internet 服务提供商 (ISP),您可能需要将 PPPoE 连接的 MTU 大小降至 1,400 和 1,480 之间的一个值

要修改 PPPoE MTU 大小,请创建以下注册表项: HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Ndiswan\Parameters\Protocols\0

并添加下列注册表值: 数值名称:ProtocolType
数据类型:REG_DWORD
数值数据:0x00000800

数值名称:PPPProtocolType
数据类型:REG_DWORD
数值数据:0x00000021

数值名称:ProtocolMTU
数据类型:REG_DWORD
数值数据适当的 MTU 大小(十进制)

修改网卡的MTU:
注册表:HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces
此项中有许多个子项,子项里内容最多的为你的网卡。(IPAddress项的数值是你的IP地址。)
进入该子项,在右边的窗口里按鼠标右键,选择“新建”->“双字节值”,输入名称“MTU”,按回车。再用鼠标双击“MTU”,弹出修改窗口:
  填入MTU的值。填写前请先把基数设为十进制。
  设置好后,需要重启机器才能生效。

WIN7下在CMD中直接输入

     netsh interface ipv4 show subinterface
这个是查看当前MTU的。

    netsh interface ipv4 set subinterface "本地连接" mtu=1450 store=persistent
这个是修改MTU数值的
XP不可用。
 

 

附:

什么是MTU? MTU是Maximum Transmission Unit的缩写。意思是网络上传送的最大数据包。MTU的单位是字节。 大部分网络设备的MTU都是1500。如果本机的MTU比网关的MTU大,大的数据包就会被拆开来传送,这样会产生很多数据包碎片,增加丢包率,降低网络速度。把本机的MTU设成比网关的MTU小或相同,就可以减少丢包。 3、如何检测网关的MTU? 在本机打开dos窗口,执行: ping -f -l 1472 192.168.0.1 其中192.168.0.1是网关IP地址,1472是数据包的长度。请注意,上面的参数是“-l”(小写的L),而不是“-1”。 如果能ping通,表示数据包不需要拆包,可以通过网关发送出去。 如果出现: Packet needs to be fragmented but DF set. 表示数据包需要拆开来发送。此时,减少数据包长度,再执行上面的ping命令。从1400到1472之间多试几次,就能找到合适的数据包长度了。把数据包长度加上数据包头28字节,就得到MTU的值。 如果检测到网关的MTU值是1500,不需要修改。 如果网关有防火墙ping不通,可以试试直接把MTU设为1400。 4、如何修改本机的MTU? 修改方法如下: (1)、运行regedit (2)、浏览到: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces 如图2 (3)、Interfaces下有多个子项,每个子项对应一个网卡。请按如下方法选择网卡: (a)确定本机用来连接Internet的网卡或拨号连接的IP,如192.168.0.19; (b)用鼠标点击Interfaces上的子项,查看键值列表中的IPAddress项; (c)如果IPAddress的键值与(a)中的IP相同,即192.168.0.19,则该子项就是要找的网卡。 (4)、进入该子项,在右边的窗口里按鼠标右键,选择“新建”->“双字节值”,输入名称“MTU”,按回车。再用鼠标双击“MTU”,弹出修改窗口: 如图3: 填入MTU的值。填写前请先把基数设为十进制。 设置好后,需要重启机器才能生效。


wow sound

/script PlaySoundFile(“Sound\\Music\\ZoneMusic\\DMF_L70ETC01.mp3”)


Copyright © 1996-2010 Add Lives. All rights reserved.
iDream theme by Templates Next | Powered by WordPress