0

【越狱】20款 Prison Break 风格 WinXP登陆界面


 

windows Xp Prison Break登陆界面.rar  1027X768格式)

安装方法:

将logonui.exe文件解压到 X:\\system32下替换原文件
(X 指系统盘)

如显示windows保护提示

取消windows保护-点击-是!(取消windows保护.JPG)

替换前请先自行备份原logonui.exe文件!

替换后按注销系统或按WINKEY+L键 即可查看效果~!

也可以使用压缩包内工具替换

0

【越狱】T-BAG 扮演者罗伯特·内珀 [精彩写真和人物简介和FANS漫画]


人物简介:罗伯特·内珀 (Robert Knepper)
Robert Knepper的主要代表做有电影《Good night and good Lunch》,《Hostage》,《Love&Sex》 等,电视剧有《Carnivale》, 《Thieves》,《Haunted》,《Presidio 》等。在戏院工作的Knepper的母亲对他的演艺事业起着很重要的作用,正是他母亲让Knepper对演戏产生兴趣 ,并顺利进入西北部的专业戏剧学院学习。

作 品 年 表
演 出
1 Hostage 火线对峙 【2005】
人质/硬汉也有迟暮时/火线对峙
2 "Prison Break" 越狱 【2005】
3 Species III 异种 3 【2004】
4 Absence of the Good (TV) 魔鬼猎杀 【1999】
魔鬼猎杀(台)
5 Phantoms 幻觉 【1998】
幻觉(中)/地心骇客(台)/末世魔煞(港)
6 Jaded 激情的控诉 【1996】
激情的控诉(其他)
7 Search and Destroy 狙击手 【1995】
狙击手(港)
8 Getting Out (TV) 母爱光辉 【1994】
母爱光辉(其他)
9 When the Bough Breaks 魔鬼刽子手 【1993】
当树枝折断时(中)/魔鬼刽子手(台)
10 Gas Food Lodging 【1992】
11 Session Man (TV) 会议人 【1992】
会议人(其他)
12 Young Guns II 年轻枪手 2 【1990】
年轻枪手2(中)/少壮屠龙阵 2(台)/龙威虎将 2(港)
13 Renegades 赤色雄狼 【1989】
叛徒(其他)
14 D.O.A. 死亡旋涡 【1988】
死亡旋涡(台)/零时亡点(港)
15 Made in Heaven 天上人间 【1987】
天上人间(台)/天堂制造
16 That’s Life! 生之乐章 【1986】
生之乐章(港)

  

  

 

     

 

 

 

 

0

【越狱】最新官方 超清晰 壁纸下载 1600×1200


 

 

 

 

0

【越狱】中各大角色今后现实生活中的职业!


知道这个疯子后来去哪了么?

有证据显示,他染了头发去NBA打球去了!     

Mahone后来改行做什么去了知道么?

他居然也投身体育界,并且成为世界第一守门员!MyGOD!   

你猜他是否也成为体育健将?

他其实是F1赛场上的悲情人物—巴里切罗    

0

JavaScript 加载 XML 文件 二 (For Mozilla and IE)


In my article, "Read and Display Server-Side XML with JavaScript", I discussed the manipulation of XML files using in Microsoft Internet Explorer. In this article, I’ll explain how to read and use XML file data using in Mozilla. We will see how to display tag values, tag attribute values, and more.

Henceforth, I won’t explicitly mention Mozilla in this article, because we will be dealing with Mozilla only, which includes Netscape 6.x, 7.x. I’ll let you know specifically when I’m referring to Microsoft Internet Explorer (MSIE, or simply IE), however.

The Sample XML File

I’ll use the same XML file that I used in my last article, so it’s easier for those who have already dealt with that file to understand. Consider the following XML file:

<?xml version="1.0" ?>  
<company>
 <employee id="001" sex="M" age="20">Premshree Pillai</employee>
 <employee id="002" sex="M" age="24">Kumar Singh</employee>
 <employee id="003" sex="M" age="21">Ranjit Kapoor</employee>
 <turnover>
   <year id="2000">100,000</year>
   <year id="2001">140,000</year>
   <year id="2002">200,000</year>
 </turnover>
</company>

As you can see, the above XML file shows a company’s employees’ details, with the name as the tag <employee>‘s main (or node) value; other details such as an employee’s id, sex and age are given as attributes id, sex and age within the same tag. The file also shows the company’s turnover, with the turnover figure as the tag <turnover>‘s node value, and the year as an attribute year within the same tag.

In the sections that follow, we’ll manipulate the above XML file, so that it makes sense to us.

XML and JavaScript

Before we actually get into reading and further manipulating the XML file, it’s important to know whether the visitor is using Mozilla or some other browser.

Test for Mozilla

Obviously, you will not be coding your XML-based JavaScript application for one particular browser, when you can so easily extend support for other browsers. Yet, the way you code your application will depend on which browser the visitor is using.

To test for Mozilla, we can use a simple variable as follows:

var moz = (typeof document.implementation != 'undefined') && (typeof
document.implementation.createDocument != 'undefined');

The above variable can be used as a boolean variable:

if(moz) {
 // Mozilla!!
} else {
 // Something else...
}

Load the XML File

Once we’ve identified the browser, it’s time to load the XML file:

var xmlDoc=document.implementation.createDocument("", "doc", null)
xmlDoc.load("someXMLFile.xml");
xmlDoc.onload = someProcessingFunction;

The first line in the above code creates an instance of the xmlDoc object; the second line loads the XML file we want (someXMLFile.xml, in this case); the third line is used to further process, or manipulate, the XML file we’ve just loaded.

Now, it would be better to create a different function to load the XML file:

var xmlDoc;
function importXML(file) {
 xmlDoc=document.implementation.createDocument("", "doc", null)
 xmlDoc.load(file);
 xmlDoc.onload = readXML;
}

Most of the manipulation techniques used for Mozilla will also work with IE. However, the XML file is loaded differently in each, so let’s look at a function that will load an XML file in Mozilla as well as IE:

var xmlDoc;
function importXML(file) {
 var xmlDoc;
 var moz = (typeof document.implementation != 'undefined') && (typeof
document.implementation.createDocument != 'undefined');
 var ie = (typeof window.ActiveXObject != 'undefined');

 if (moz) {
   xmlDoc = document.implementation.createDocument("", "", null)
   xmlDoc.onload = readXML;
 } else if (ie) {
   xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
   xmlDoc.async = false;
   while(xmlDoc.readyState != 4) {};
 }
 xmlDoc.load(file);
}

The above function can be used to load an XML file for both Mozilla and IE. Now, to load a XML file, the function must be called as:

importXML("YourXMLFile.xml");

Note that the variable ie is used to test for IE. IE uses an ActiveX Object to load an XML file using the Microsoft.XMLDOM object. In the following section, we’ll explore a few methods we can use to access the XML file data.

getElementsByTagName()

The getElementsByTagName method is the most commonly used method available in the XML DOM (Document Object Model) object. As the function's name suggests, this function returns all the elements (or tags) with the given name within the specified element. Basically, it returns an object collection. For example:

var xmlFile = xmlDoc.getElementsByTagName("company");

In the above code, an object collection containing all the <company> elements in the document is stored in the variable xmlFile. Note that the argument you pass to getElementsByTagName() is case-sensitive, i.e. getElementsByTagName("company") is different from getElementsByTagName("ComPanY").

Find the Number of Elements of a Tag

In the XML file illustrated at the beginning of this article, we see exactly one <company> tag. The object collection returned by getElementsByTagName() has a length method that gives the number of elements in the collection. For example, to find the number of <company> tags, the following code is used:

var noOfCompanyTags = xmlDoc.getElementsByTagName("company").length;

Displaying the variable noOfCompanyTags using document.write() will display 1.

Display the Content of a Tag

Again referring to the XML file, suppose we want to display the name of the first employee. Now, the <employee> tag is within the <company> tag; so, first we need to get the collection of all the <company> tags, and through this tag get a collection of all <employee> tags. Let’s take a look at how to display the name step by step:

var companies = xmlDoc.getElementsByTagName("company");

The above code returns an object collection for the <company> tag to the companies variable. Note that companies is an array.

var employees = companies[0].getElementsByTagName("employee");

The above code returns an object collection for the <employee> tag to the employees variable, again in an array. Note the index used in the company variable; this is used because we need to access only the first element of the array. There may only be one <company> tag, but it's still an array, so we use the index 0 to get the element.

To display the name of the first employee, we use the following code:

document.write(employees[0].firstChild.nodeValue);

The above code will display Premshree Pillai. As is clear, employees is a 3-element array. So, to display the name of the second employee, the code would be:

document.write(employees[1].firstChild.nodeValue);

The above code will display Kumar Singh. All the above steps we used to display the employee name (Premshree Pillai) can be integrated into a single code snippet as follows:

document.write(xmlDoc.getElementsByTagName("company")[0].getElementsByTagName("employee")[0]
.firstChild.nodeValue);

Access Tag Attributes

Storing information in XML files in the form of attributes is very common. Consequently, it is important that we are able to access attributes in XML files. In our example XML file, we have stored various employee details, including id, sex, and age, in the <employee> tag. To extract the age of the first employee, we could use the following code:

document.write(employees[0].getAttribute("age"));

The above code will output 20. The code used the getAttribute() method on the employees[0] object. Alternatively, we could use the following code to obtain the same result:

document.write(xmlDoc.getElementsByTagName("company")[0].getElementsByTagName("employee")[0]
.getAttribute("age"));

Now, suppose you want to display the details of all employees (id, sex, age) in a tabular form. To do this, we must loop through all the <employee> tags. Following is the entire code to do this (excluding the code that loads the file):

var companies=xmlDoc.getElementsByTagName("company");
var employees=companies[0].getElementsByTagName("employee");
document.write('<table border="1">');
document.write('<tr><th>id</th><th>Sex</th><th>Age</th></tr>');
for(var i=0; i<employees.length; i++) {
 document.write('<tr>');
 document.write('<td>' + employees[i].getAttribute("id") + '</td>');
 document.write('<td>' + employees[i].getAttribute("sex") + '</td>');
 document.write('<td>' + employees[i].getAttribute("age") + '</td>');
 document.write('</tr>');
}
document.write('<table>');

The output of the above code in Mozilla looks like this:

1268_image

Is it Possible to Write to an XML File?

No, it’s not possible to write to an XML file using client-side JavaScript. You can manipulate all the contents of an external XML file and use it for display purposes in your client-side JavaScript application, but it is not possible, for instance, to take input from the user, and make changes to the XML file using JavaScript.

Conclusion

We now know how to test for Mozilla, load an XML document using JavaScript, and manipulate the contents of an XML file using JavaScript in Mozilla. Using XML and client-side JavaScript, several simple applications can be created:

  • you could use XML files to store small databases, then use JavaScript to display the data according to your needs
  • you could create something like a news “ticker”, where you store the news items in a XML file and your JavaScript reads the contents of the file and ticks the news items on the screen

 

These are just a few examples where XML and client-side JavaScript could be used. I hope this article has given you an introductory idea of using XML and client-side JavaScript in Mozilla.

0

Javascript 加载本地 XML 文件


之前自己写的两个小函数.

/*

 * @file : localxml.js
 * @date : 2006-05-09
 * @auth : dengwei
 
 */

// 查找对象
function findobj(s)
{
 return document.getElementById(s);
}

function LocalXML()
{
 if( window.ActiveXObject )
 {
  var oDoc = new ActiveXObject("Microsoft.XMLDOM");
 }
 else if( document.implementation && document.implementation.createDocument )
 {
  var oDoc = document.implementation.createDocument("", "", null);
 }
  
 this.loadXML = function(sFilename, sFunction)
 {
  if( sFunction )
  {
   this.onchange(sFunction);
  }

  this.async(false);

  try
  {
   oDoc.load(sFilename);
  }
  catch (e)
  {
   // no such file
   return;
  }
 }
 
 this.getNode = function(sXpath)
 {
  var iRetval = "";
  var iValue = oDoc.selectSingleNode(sXpath);
 
  if (iValue)
  {
   iRetval = iValue.text;
  }
  return iRetval;
 }

 this.selectNodes = function(sXpath)
 {
  return oDoc.selectNodes(sXpath);
 }
 
 this.readyState = function()
 {
  return oDoc.readyState;
 }
 
 this.loaded = function()
 {
  if( this.readyState() == 4 )
  {
   return true;
  }
  return false;
 }
 
 this.onchange = function(sFunction)
 {
  oDoc.onreadystatechange = eval(sFunction);
 }
 
 this.async = function(bType)
 {
  oDoc.async = bType
 }
}

0

scriptaculous学习笔记


scriptaculous学习笔记(三)
 
Slider滑动杆
滑动杆是通过两个Div嵌套而成的。一个是滑动槽,一个是滑动杆。将这两个div注册为滑动杆就可以了。

 

<div ID="track1" STYLE="width:200px;background-color:#aaa;height:5px;">

    <div ID="handle1" STYLE="width:5px;height:10px;background-color:#f00;"> </div>

</div>

<script>

 new Control.Slider(‘handle1′,’track1′,{

      sliderValue:0.5,

      onSlide:function(v){$(‘1′).innerHTML=’slide: ‘+v},

      onChange:function(v){$(‘debug1′).innerHTML=’changed! ‘+v}});

</script>

 

程序通过new Control.Slider( )来注册滑动杆。第一个id是滑动杆,可以以[‘id1’,’id2’,…]的方式来注册多个滑动杆

第二个id是滑动槽。

后面花括号{}中的参数:

sliderValue:滑动杆初始值,当有多个滑动杆的时候,用 [v1,v2,…]的方式指定多个缺省值

range: $R(2,15) 滑动槽的值的上下限范围。默认是0~1

axis: ‘vertical’, 可以获得一个上下拖动的滑动杆.缺省为水平.

restricted:true, 多个滑杆时,初始值大的滑杆与初始值小的滑杆不能互相倒置大小.

values: [1,2,3…] 滑动槽的多个预设值。滑杆只能滑动到其中的某个值。

onSlide:function(v) 事件:滑动时触发。V是滑杆当前值。

onChange:function(v) 事件:值改变时触发。V是滑杆当前值。

滑杆区域:(多个滑杆之间围成的上下界区域)

spans:['span7-1','span7-2'],

startSpan:’span7-start’,

endSpan:’span7-end’,

这个地方还没有仔细看,不是非常明白。

注意:当存在多个滑杆时,滑动槽设为relative,滑动杆应设为display:absolute;left:0 ;top:0;

 

scriptaculous学习笔记(二)
 
Effect效果对象
下拉效果&上拉效果
 

<div id="d1">

 aaaaaaa<p>bbbbbbbbbbbbbbbbb<p>ccccccccccccc<p>

</div>

 <a href="#" onclick="Effect.BlindDown(‘d1′,{});; return false;">BlindDown()</a>

<p>

  <a href="#" onclick="Effect.BlindUp(‘d1′,{});; return false;">BlindUp()</a>

Effect.BlindDown(‘d1′,{})函数的花括号里面{}可以跟参数:

 duration:1.0; 这个数字表示动作持续时间。

delay: 0.5   延迟0.5秒再启动效果

如果想让一个Div开始的时候隐藏,点击下拉的时候才拉下,那么只需要将此Div的属性设为:display: none

 

上滚&下滚效果
这一组函数:

Effect.SlideUp(‘d1′,{});

Effect.SlideDown(‘d1′,{});

这组函数效果与Blind那一组基本一样,效果粗看起来差不多……我也是细心比较才发现的。原来Blind这一对内容是不会随着上拉或下拉而动的。而Slide中的内容会被拉上或拉下。

 

变色闪动效果
Effect.Highlight(‘d1′,{duration:1.5})

此元素将会改变几次颜色并最终返回原来的颜色。

 

渐变显示效果
Effect.Appear(‘d1’,{})

原来的元素初始CSS为display:none,用此效果后渐渐显示,渐变的alpha滤镜效果。

膨胀消失效果
Effect.Puff(‘d1’,{})

 

消失后可以使用Element.show(‘d1′) 再次将元素显示出来。

 

渐渐消失效果
Effect.Fade(‘d1′)

渐渐显示效果
Effect.Appear(‘test_img’)

震动效果
Effect.Shake(‘d1’,{})

此元素将会左右震动

闪烁效果
Effect.Pulsate(‘d1′,{})

此函数通过alpha滤镜来进行闪烁。

 

长大效果
 Effect.Grow("d1",

{duration:5.0, direction: ‘bottom-right’, opacityTransition: Effect.Transitions.linear});

其中:direction 是指的元素从什么方向进入。

如果不指定后面的参数,元素缺省是从下面的中间开始变大。没有alpha效果。

萎缩效果
Effect.Shrink(“d1”,{})

长大效果Grow()的相反效果。

 

Toggle各种效果
汉语里面不知道怎么翻译Toggle,大体意思是:当某物打开的时候触发就关闭,而关闭的时候触发就打开 的一种像”乒乓开关”的行为。这种行为在做页面时特别有用。

Effect.toggle(‘d2′,’BLIND’)

Effect.toggle(‘d2′,’appear’)

Effect.toggle(‘d2′,’slide’)

似乎所有这种有着相反效果的函数都可以在这里设置Toggle, ’BLIND’中的效果名大小写不敏感。

 

 

取消效果函数
这几个函数真是乏善可陈……唯一要提的就是关于中止这几个动画过程的函数:cancel()

例如:

effect1=new Effect.SlideUp(‘d1’,{duration:10.0});

想要在这10秒钟中止动画过程: effect1.cancel()

 

效果队列
这个神秘的queue属性,还有待进一步学习……

  function startTimeline() {

    // 3x highlight in front

    for(var i=0; i<3; i++)

      new Effect.Highlight(‘d3′, { duration: 1.0, queue: ‘front’ });

   

    // insert scale at very beginning

    new Effect.Scale(‘d1′, 75, { scaleContent: true, duration: 1.0, queue: ‘front’ });

   

    // parallel implied, delay 0.5 sec

    new Effect.Highlight(‘d1′, { delay: 0.5 });

   

    // puff at end

    new Effect.Puff(‘d2′, { duration: 4.0, queue: ‘end’ });

  }

 
scriptaculous学习笔记(一)
 
这两篇文章是我昨天一天的成果。scriptaculous真的是一个很好的类库,不过国内的资料似乎很少(起码我没有搜索到),正好是在学习这个咚咚,写个笔记来记录一下吧。
准备
包含库文件:

<script src="../prototype.js" type="text/"></script>

  <script src="../scriptaculous.js" type="text/javascript"></script>

可排序对象
例子:
以下代码将创建一个列表,并且可以拖动排序,每次移动户都将触发一个可以返回列表顺序的函数,并且已经序列化,可以通过Ajax传给服务器端。

//建立列表:

<ul id="x">

<li id="item_1">1</li>

<li id="items_2">2</li>

<li d="items_3">3</li>

<li d="items_4">4</li>

</ul>

//开始建立可排序组件

<script type="text/javascript" language="javascript" charset="utf-8">

// <![CDATA[

   Sortable.create('x',    

{overlap:'horizontal',

ghosting:true,

constraint:false,

    onUpdate:function(sortable){alert(Sortable.serialize(sortable))},

    onChange:function(element){$('state').innerHTML = Sortable.serialize(element.parentNode)}

  });

这样一个可以排序的列表就作好啦~~恭喜~!

 

讲解:

其中,Sortable.create()的作用是将这个id=”x”的<UL>转化为可排序控件。第一个参数’x’便是此控件的ID。 花括号{ }内的属性列表是一些预置属性和各种动作的触发函数:

各个属性的意义:

l         overlap : horizontal | vertical指明了列表是水平方向还是垂直方向排列。(在constraint属性中会和此属性有关)

l         ghosting: true | false这个属性指明了拖动行时是否会在原来位置显示虚影占位。

l         constraint: 'vertical' | 'horizontal' | false 这个属性指明了是否会被约束拖动方向。

l         onUpdate:function(sortable){} :update事件将会在完成一次排序行为时(拖动后鼠标松开时)被触发。”sortable”参数中将会传入被绑定的<UL>对象。

l         onChange:function(element){} :此事件将会在鼠标拖动时被触发,每移动一下都将触发此事件。注意:此事件传入的element参数是<UL>下被拖动的<LI>而非整个<UL>

 

构造函数中的参数列表:
 

     

参数名          初始值                     说明

element:          element

tag:                'li',                // assumes li children,标签内可被拖动的子标签名

      dropOnEmpty:       false,               ??

      tree:               false,               // fixme: unimplemented ??

      overlap:            'vertical',            // one of 'vertical', 'horizontal'

      constraint:          'vertical',            // one of 'vertical', 'horizontal', false

      handle:            false,               // or a CSS ,CSS样式是此handle指定样式的标签部分可拖动如为false则整体可拖.      

      only:              false,                ???

      hoverclass:         null,                //被拖入位置的CSS

      ghosting:          false,                //显示残影占位

      format:            null,                 //???

      onChange:         Prototype.emptyFunction,

      onUpdate:         Prototype.emptyFunction

     dropOnEmpty:       true              //or false 指定此<UL>等可排序区域可否接受其他<UL>中的元素

      containment:        ["list1","list2"]      当dropOnEmpty设为true,在此参数中设置可接受的列表id

 

 

除了构造函数,其余的常用方法:
 

l          Sortable.serialize(sortable)  静态方法。返回一个当前sortable对象的按照排序顺序先后排列序号的字符串:如x[]=1& x[]=2& x[]=3,每一个<Li>的序号通过<li id="item_1">1</li>的下滑线后面的数字指定。下滑线前面的单词在一组排序中应使用一个相同的前缀。不同的组,前缀应该不同。

l          Sortable .destroy(sortable)  静态方法。撤销此对象的排序属性。

 

 

常见问题:
当我们给<UL>外面加上DIV,比如<div style=”overflow-y:scroll;height:100px;”>

我们会发现页面一团糟了,UL溢出了DIV, 页面乱七八糟。

不用急,在Div的Style中加入 “position:relative;”就解决了<UL>不听指挥的问题。

现在再用一下,拖动有点问题……我们会发现定位不准确了,这是因为没有考虑到滚动条的偏移量。

我们在Sortable的构造函数前加上一句:

Position.includeScrollOffsets = true;

此问题便会迎刃而解~~!哈。

0

解决 AJAX 跨域方案二(Rewrite)


AJAX的跨域问题,一直是一个另广大程序员深为头痛的问题,虽然解决的方法很多,但是,都不太理想。
比如PHP里面,可以用file_get_contents类似的函数,将远程页面的HTML代码取回来,再交给AJAX来处理。 但此类通过服务器中转的方法,效率上,实在是不敢恭维,对服务器也会造成比较大的压力。
最近在看Apache相关的模块介绍的时候,发现了一个好东东,实验了一下,还真的似乎能解决这个问题,就是使用Apache自带的2个Mod,完成代理服务这个艰巨的使命。 这样,完全可以骗过JavaScript,爽啊。
首先你要启用这2个模块,需要在httpd.conf文件中,去掉这2个模块前面的注释符号。

程序代码 程序代码

LoadModule rewrite_module modules/mod_rewrite.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so

然后,需要添加Rewrite规则,比如:

程序代码 程序代码

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^/proxy/(.*)$ http://$1 [P,L]
</IfModule>

需要日志的话,可以加上:

程序代码 程序代码

RewriteLogLevel 9
RewriteLog logs/rewrite.log

好了,现在试试http://localhost/proxy/www.163.com看看,嘿嘿!

0

解决 AJAX 跨域方案一(PHP Proxy)


在工作中需要用到 跨域技术,并且在各个外部服务器上修改 httpd.conf 代价太大,所以先用 Proxy 来解决。以下是 Yahoo! 的解决方法。

Why You Need a Proxy

All modern browsers impose a security restriction on network connections, which includes calls to XMLHttpRequest. This restriction prevents a script or application from making a connection to any other than the one the page originally came from (Internet Explorer will allow cross-domain requests if the option has been enabled in the preferences). If both your application and the XML data that application uses come directly from the same server, then you do not run into this restriction.

If, however, you serve your web application from one web server and you make web service data requests to another server — for example, to the Yahoo! Web Services — then the browser prevents the connection from being opened at all. Bummer.

There are a number of solutions to this problem but the most commonly-used one is to install a proxy on your web server. Instead of making your XMLHttpRequest calls directly to the web service, you make your calls to your web server proxy. The proxy then passes the call onto the web service and in return passes the data back to your client application. Because the connection is made to your server, and the data comes back from your server, the browser has nothing to complain about.

For security reasons it’s a good idea for any proxy you install on your web server should be limited in use. An open proxy that passes on connections to any web site URL is open to abuse. Although it is difficult to limit the connections to your proxy from only your application, you can prevent the proxy from making connections to servers other than those you specify. Hard code the URL to connect to in the proxy itself or provide limited options. This makes the proxy less open and less useful to users other than your client application.

PHP Proxy for Yahoo! Web Services

For the Yahoo! Developer Network JavaScript Developer Center we have provided sample code for a simple web proxy, written in PHP, that takes requests for the Yahoo! Search APIs. You can install this proxy on your own web server in any convenient location (your web server must be set up to run PHP).

The proxy encodes the Yahoo! Web services site URL in a global variable called HOSTNAME. ou will need to modify this variable to refer to the Yahoo! Web Services API you’ll be using. This is the domain used by the Yahoo! Search web services; other domains include Yahoo! Local (http://api.local.yahoo.com) and Yahoo! Travel (http://api.travel.yahoo.com).

define ('HOSTNAME', 'http://api.search.yahoo.com/');

To use the PHP web proxy in your client application, the URL for the request in the code includes the path for the Yahoo! Web Services request, minus the domain name. The domain name is added by the proxy itself on the server side. This code snippet comes from a more complete XMLHttpRequest code sample on our JavaScript Developer Center.

// The web services request minus the domain name
var path = 'VideoSearchService/V1/videoSearch?appid=YahooDemo&query=madonna&results=2';

// The full path to the PHP proxy
var url = 'http://localhost/php_proxy_simple.php?yws_path=' + encodeURIComponent(path);
... // core xmlhttp code
xmlhttp.open('GET', url, true);

Note that although this example uses an HTTP GET request, the sample PHP web proxy also supports POST.

You could modify the proxy to do post-processing of the data you get from the request on the server side, for example, to strip out only the elements you’re interested in or the parse the XML into a format you can more comfortably handle in JavaScript.

Other Solutions

In addition to using a web proxy to pass web services data to your application, there are several other options to working around cross-domain browser restrictions:

  • Use ’s mod_rewrite or mod_proxy to pass requests from your server to some other server. In your client code you just make the request as if it was actually on your server — no browser problems with that. Apache then does its magic and makes the request to the other server for you.
  • Use JSON and dynamic <script> tags instead of XML and XMLHttpRequest. You can get around the browser security problem altogether by making your web services request directly inside a <script> tag. If the Yahoo! Web Service you’re using can output JSON (using the output=json and callback=function parameters), the data you get back from the web service is evaluated as a JavaScript object when the page is loaded. See our JSON Documentation for an example of how to do this in your own scripts.
  • Digitally sign your scripts. In Firefox you can apply a digital signature to your script and those scripts will then be considered "trusted" by the browser. Firefox will then let you make XMLHttpRequests to any domain. However, no other browsers support script signing at this time, so this solution is of limited use.

For More Information

For more information on JavaScript, XMLHttpRequest, Yahoo! Web Services APIs and other JavaScript development topics, see The Yahoo! Developer Network JavaScript Developer Center.

0

解决 IE 因交叉(循环)引用导致内存泄漏的方法


很好的一篇文章,可能标题我翻译得不是很准。

Closures and IE Circular References

A little tip for you advanced Javascripters…

First, if you are not familiar with closures, I highly recommend you read up on them. They are extremely powerful. However, they are also very unforgiving in they quickly generate memory leaks. IE has an issue where it leaks memory when a circular reference is created between a com object and a object. In IE, the DOM is implemented via com.

So looking at a simple closure (noticed the nested function):

function DoThis()
{
  var el = document.createElement("div");
  el.attachEvent("onclick",DoThis);
  function DoThis()
  {
    alert("clicked");
  }
}

creates a new scope and generates a circular reference that will leak memory in IE. This memory is not reclaimed until the browser closes. The simplest solution is to pretend there is no garbage collector for objects and make sure you always clean-up after yourself.

Fixed version:
function DoThis()
{
  var el = document.createElement("div");
  el.attachEvent("onclick",DoThis);
  window.attachEvent("onunload",Cleanup);
  function DoThis()
  {
   alert("clicked");
  }
  function Cleanup()
  {
    el.detachEvent("onclick",DoThis);
    window.detachEvent("onunload",Cleanup);
    el = null;
  }
}

I will go into more details on closures in a follow-up post as they a very powerful for encapsulating functionality and creating reusable code.

原文地址:http://siteexperts.spaces.live.com//cns!1pNcL8JwTfkkjv4gg6LkVCpw!338.entry

Previous Page Next Page

Random Posts Recent Comments

  • Nouramohsen88 Says:

    http://goo.gl/vFWge لدينا ثلاجات عرض جديدة ومستعملة للبيع ولدينا ثلاجات عرض سوبر ماركت وحلويات في ست...

  • Nouramohsen88 Says:

    http://www.drdrahem.com/home دكتور رجيم دكتور تخسيس الكرش والارداف مركز تخسيس في مدينة نصر ...

  • Nouramohsen88 Says:

    شركه تصنيع صاعق ناموس http://www.grandelectronic-eg.com/...

  • Nouramohsen88 Says:

    شركة كشافات اضاءة في مصر http://www.grandelectronic-eg.com/ ...

  • Nouramohsen88 Says:

    http://www.grandelectronic-eg.com/ شركة كشافات طواريء في مصر...

  • Nouramohsen88 Says:

    anti-mosquitocompany.blogspot.com شركة جراند الكترونيك هي شركة مصرية متخصصة في تصنيع الكشافات الكهرب...

  • Nouramohsen88 Says:

    insect--killer.blogspot.com شركة جراند الكترونيك هي شركة مصرية متخصصة في تصنيع الكشافات الكهربية وك...

  • Nouramohsen88 Says:

    http://genius-square.com/ شركه للتدريب والاستشارات | متخصصون في التنمية البشرية...

  • Er Says:

    我了个去,我也是用的phpo ..... 看来大家的思绪差不多。。。。...

  • Fasf Says:

    SYM_TYPE * pType;改为SYM_TYPE pType;...

Tag Cloud

arm audio blog brew cache class debug flash google html j2me java javascript Joke linux lua mobile mtk php python ror ruby server shell stream unix web windows 优化 动态加载 女人 女生 平台 开发 手机 技术 流媒体 测试 漫画 生活 男人 男生 缓存 芯片