Convert *real* machines to VMWare images, for Free
Digg - Convert *real* machines to VMWare images, for Free
- Convert Physical Machines to Virtual Machines – Free! - 這個好阿,以後只需要 maintain 一份就好了。
一個簡單的 bookmarklet,可以快速的複製某個網頁的 title,這樣如果要寫 blog 的話比較方便,設定position是因為怕版型亂調,設定zIndex是怕被網頁的內容蓋住。點一下可以取消。
要注意的是 if(input.parentNode){input.parentNode.removeChild(input);}
,這邊如果寫 if(input)
會 always true,even被從DOM tree remove 掉,所以這邊檢查的是 input.parentNode
genTitle
<a href="javascript:
var title = document.getElementsByTagName('title')[0];
titleText = (typeof title == 'undefined')?
'Error: no title element': title.innerHTML;
if(typeof input=='undefined')
input = document.createElement('input');
var _scrolltop;
if (document.documentElement && document.documentElement.scrollTop){
_scrolltop = document.documentElement.scrollTop;
}
else if(document.body){
_scrolltop = document.body.scrollTop;
}
input.style.fontFamily = 'arial';
input.style.border= '1px solid gray';
input.style.padding = '1px 5px';
input.style.fontSize = '1em';
input.style.width = '20em';
input.style.backgroundColor = '#eee';
input.style.position = 'absolute';
input.style.left = '0';
input.style.top = _scrolltop+'px';
input.style.zIndex = '999';
input.value = titleText;
if(document.body)
document.body.insertBefore(input, document.body.firstChild);
input.select();
document.onclick = function(e){
if(input.parentNode){
input.parentNode.removeChild(input);
}
document.onclick = null;
};
void 0; ">genTitleNew</a>
Reverse proxy - Wikipedia, the free encyclopedia
Typically, reverse proxies are utilized in front of webservers. All connections coming from the Internet addressed to one of the webservers are routed through the proxy server, which may either deal with the request itself or pass the request wholly or partially to the main webserver.
Ubuntu不知道從哪一版就沒了 /etc/inittab,最近要改 runlevel 找不到原來是改成 /etc/event.d/rc-default 來管理,修改 runlevel 就修改 /etc/event.d/rc-default 即可
rc-default 也是會去檢查是否存在 /etc/inittab
start on rcS/stop
script
runlevel --reboot || true
if grep -q -w -- "-s\|single\|S" /proc/cmdline; then
telinit S
elif [ -r /etc/inittab ]; then
RL="$(sed -n -e "/^id:[0-9]*:initdefault:/{s/^id://;s/:.*//;p}" /etc/inittab || true)"
if [ -n "$RL" ]; then
telinit $RL
else
telinit 2
fi
else
telinit 2
fi
end script
標籤: Linux
Bytecode is a binary representation of an executable program designed to be executed by a virtual machine rather than by dedicated hardware. Since it is processed by software, it is usually more abstract than machine code.
After compiling to bytecode, the resulting output may be used as the input of a compiler targeting machine code, or executed directly on a virtual machine.
bytecodes encode the results of semantic analysis such as the scope of each variable access (that is, whether the variable is global or local). Thus, performance is usually better than interpretation of source code.
Some systems, called dynamic translators, or "just-in-time" (JIT) compilers, translate bytecode into machine language as necessary at runtime.
For example, Java and C# code is typically stored in bytecoded format, which then uses a JIT compiler to translate the bytecode to machine code before execution. This introduces a delay before a program is run, when bytecode is compiled to native machine code, but improves execution speed considerably compared to interpretation - normally by several times.
just-in-time compilation (JIT), is a technique for improving the runtime performance of a computer program. It converts, at runtime, code from one format into another, for example bytecode into native machine code. The performance improvement originates from caching the results of translating blocks of code, and not simply evaluating each line or operand separately.
The goal is to combine many of the advantages of native and bytecode compilation: Much of the "heavy lifting" of parsing the original source code and performing basic optimization is handled at compile time, prior to deployment: compilation from bytecode to machine code is much faster than from source.
However, JIT may have a drawback by causing a slight delay in initial execution of an application, due to the time taken to compile the bytecode. Sometimes this delay is called "startup time delay".
JIT compilation is considered advantageous in many scenarios because of its portability, flexibility and performance. The only major drawback probably is the startup time delay.
Universal binaries typically include both PowerPC and x86 versions of a compiled application. The operating system detects a universal binary by its header, and executes the appropriate section depending on the architecture in use. This allows the application to run natively on any supported architecture, with no performance impact.
In Microsoft Windows terminology, managed code is computer instructions — that is, "code" — executed by a CLI-compliant virtual machine, such as Microsoft's .NET Framework Common Language Runtime, or other CLI implementations from The Mono Project or the DotGNU Project.
Before the code is run, the Intermediate Language is compiled into native machine code. Since this compilation happens by the managed execution environment's own runtime-aware compiler, the managed execution environment can guarantee what the code is going to do. It can insert garbage collection hooks, exception handling, type safety, array bounds, index checking, etc.
看看老外怎么做乘法 - 檔主席精心挑選 - 優仕網共產檔
Mobile01-[吉田鞄勸敗網站] 想入手日本吉田鞄的各位非看不可~~[Cool Cat購物流程圖解]
Getting Rich with PHP 5,中文翻譯
YouTube - Lightsaber Strikes Back
一隻貓在洛杉磯: Big Game - l老鼠媽媽的故事
一隻貓在洛杉磯: 殺鼠人迷魂曲 (上)。
一隻貓在洛杉磯: 殺鼠人迷魂曲 (下)。
這些老鼠可是一隻價值四十美金的基因轉殖老鼠呢,住的是有衡溫衡濕自動空調每間只能住四隻的標準老鼠套房,每個禮拜有專人固定打掃,喝的是滅菌過的水,吃的是特製的飼料,生病了有富士蘋果可以吃,每個房間每天還要付一塊美金! 實驗室有三個老鼠房,大概三四百個老鼠小套房,最高紀錄每個月要為老鼠付出大約三萬美金的生活費!
使blogger的編輯畫面增加三個按鈕,第一個可以把選取範圍的內容的 < >換成相對應的HTML entities,第二個可以把選取的範圍加上 <pre class="code"> <>,第三個可以把選取的範圍加上<blockquote><div> </div></blockquote>,因為我的blockquote有兩張底圖,所以要<blockquote>裡面要用<div>多包一層。算是第一個稍具實用性的script。
// ==UserScript==
// @name blogger little toys
// @namespace http://birdegg
// @description add useful editing tools to blogger
// @include http://*.blogger.com/post-create.g?blogID=*
// @include http://*.blogger.com/post-edit.g?blogID=*
// ==/UserScript==
function replaceLtGt(){
var f = document.getElementById('textarea');
var s1 = f.value.substring(0, f.selectionStart);
var s2 = f.value.substring(f.selectionStart, f.selectionEnd);
var s3 = f.value.substring(f.selectionEnd, f.textLength);
s2 = s2.replace(/</ig, '<').replace(/>/ig, '>');
f.value = s1+s2+s3;
}
function wrapSelection(left, right){
var f = document.getElementById('textarea');
var s1 = f.value.substring(0, f.selectionStart);
var s2 = f.value.substring(f.selectionStart, f.selectionEnd);
var s3 = f.value.substring(f.selectionEnd, f.textLength);
s2 = left + s2 + right;
f.value = s1+s2+s3;
}
function wrapSelectionWithBlockquote(){
return wrapSelection('<blockquote><div>', '</div></blockquote>');
}
function wrapSelectionWithPre(){
return wrapSelection('<pre class="code">', '</pre>');
}
function run(){
var f = document.getElementById('textarea');
var htmlbar = document.getElementById('htmlbar');
var btn1 = document.createElement('input');
btn1.value = '<>';
btn1.type = 'button';
btn1.addEventListener("click", replaceLtGt, false);
var btn2 = document.createElement('input');
btn2.value = '<BlockQuote>';
btn2.type = 'button';
btn2.addEventListener("click", wrapSelectionWithBlockquote, false);
var btn3 = document.createElement('input');
btn3.value = '<Code>';
btn3.type = 'button';
btn3.addEventListener("click", wrapSelectionWithPre, false);
btn1.style.padding = btn2.style.padding = btn3.style.padding = '0';
btn1.style.border = btn2.style.border = btn3.style.border = '1px solid black';
btn1.style.backgroundColor = 'white';
btn2.style.backgroundColor = 'white';
btn3.style.backgroundColor = 'white';
anchor = document.getElementById('key_commands');
anchor.appendChild(btn1);
anchor.appendChild(btn3);
anchor.appendChild(btn2);
}
(
function(){
run();
}
)();
var squares = function(x){ return x*x; }
var square = new Function("x", "return x*x;");
Object Literals
var point = new Object({x:2.3, y:-1.2});var point = {x:2.3, y:-1.2};
var point = new Object({x:2.3, y:-1.2});
var a = [1.2, "Javascript", true, {x:1, y:3}];
var a = new Array(1.2, "Javascript", true, {x:1, y:3});
最近常看到 IMHO,查了一下才知道是 In my humble opinion
List of Internet slang phrases - Wikipedia, the free encyclopedia - 有完整的列表
IMO/IMHO/IMNSHO/IMAO - In my (humble / honest / not so humble / arrogant) opinion
轉自 PTT Blog 版 R: 給那些濫用flickr的blogger們
<a href="http://www.flickr.com/photos/xxxxx@N00/xxxxx/" title="Photo
Sharing"><img src="http://photos8.flickr.com/xxxxxx_xxxxx_o.jpg"
width="450" height="306" alt="xxxxxxx" /></a>
這樣圖片本身就會變成hyperlink,可以讓觀看者按圖片進到Flickr的photo page裡
或者是另外放個hyperlink讓觀看者可以連到放置相片的Flickr photo page去
而不能只是取用
<img src="http://photos8.flickr.com/xxxxxx_xxxxx_o.jpg"
width="450" height="306" alt="xxxxxxx" /></a>
這樣的語法來把Flickr當作免費的放圖空間
總之就是要有<a href=....這樣的語法啦
讓 http://tw.yahoo.com 的搜尋改成google的,
重點是 form1.id='Form1nnew'; 如果不把form1的id換掉,只改form的action是不行的。
// ==UserScript==
// @name google search at yahoo
// @namespace http://birdegg
// @description
// @include http://tw.yahoo.com/
// ==/UserScript==
function googleAtYahoo(){
form1=document.getElementById('Form1');
form1.action='http://www.google.com.tw/search';
form1.id='Form1nnew';
i=document.getElementById('p');
i.name='q';
fr=document.getElementById('fr');
fr.parentNode.removeChild(fr);
ei=document.getElementsByTagName('fieldset')[0].getElementsByTagName('input')[2];
ei.parentNode.removeChild(ei);
}
(
function(){
googleAtYahoo();
}
)();
這次改版重點是整齊,清潔,簡單,樸素,迅速,確實
<form action="/search" name="f">
<input value="" name="q" size="25" title="站內搜尋"/>
<input value="search" type="submit"/>
</form>
假設我希望在開啟每一個 .py 檔的時候都執行上面 modeline 的那些指令,可以設定一個以下的 autocmd (寫在你的 .vimrc 或 Windows 下的 _vimrc 裡):
au BufRead *.py set ai et nu sw=4 ts=4 tw=79
* script [filename] # 開始記錄(Terminal 中的內容)
* exit # 此時就會將 Terminal 的內容寫入 [filename] 中
標籤: Linux
var numMinutes = 20;
window.setTimeout("document.location.reload();", numMinutes*60*1000);
running ftp clients in (traditional) "active" mode requires you to open a huge port range on the client hosts. While this is mitigated by passive ftp, passive mode is impractical across a University/enterprise-sized organization, because of the intense user education cost. Even when we switch to passive mode clients, this requires the server's firewall to open up a sizable port range.
標籤: Linux
另外,我們可以把設定過的 putty session 存起來,這樣只要在桌面上建立一個新的 putty 捷徑,並在命令列的地方加上 “-load” 就會自動載入設定,使用起來就更方便了。
標籤: Linux
【食】上華鹽酥雞
新竹市~上華鹽酥雞....超好吃推薦
鳥窩看到的:
1. 請於晚上八點後再去,早到是沒有開的!
(有鑒於上次推薦延平大飯店時,有鳥友中午殺過去而煞羽而歸,把這點放最前面)
4. 我女友喜歡點甘梅薯條,但我覺得味道太鹹,不過真的很好吃!
5. 炭烤雞排可以請老闆剪開,這樣比較好吃,不過就比較容易軟掉喔~
6. 個人喜好不同,不過甜不辣炸的很酥、米血和米腸也很夠味,雞屁股是一定都會點。
Dropbear - 一個輕量級的SSH server
今年も出ましたっ!「こっ、これは?」なVAIO - VAIO也有便當盒, 還是圓形的
Express PDF - convert web page to pdf. online - 中文OK
Bribing Bloggers
Joel寫出他對微軟送出預先安裝vista的acer法拉利notebook的看法.
下面是他對vista的看法
1. Do not, under any circumstances, consider upgrading an XP system to Vista... even if it's fairly new and even if it's Vista Supremo Premium Ultra-Capable.
2. When you get a new computer, if it comes with Vista pre-installed, that's when you'll upgrade.
3. Don't buy a new computer now just to get Vista. If your current system meets your needs, stick with it until you really need a new system. Vista is not reason enough for a new PC.
4. Need more details? Read Paul Thurrott's review.
Mastering Ajax, Part 1: Introduction to Ajax
Mastering Ajax, Part 2: Make asynchronous requests with JavaScript and Ajax
Mastering Ajax, Part 3: Advanced requests and responses in Ajax
Mastering Ajax, Part 4: Exploiting DOM for Web response
Mastering Ajax, Part 5: Manipulate the DOM
Mastering Ajax, Part 6: Build DOM-based Web applications
掌握 Ajax,第 1 部分: Ajax 简介
掌握 Ajax,第 2 部分: 使用 JavaScript 和 Ajax 发出异步请求
掌握 Ajax,第 3 部分: Ajax 中的高级请求和响应
掌握 Ajax,第 4 部分: 利用 DOM 进行 Web 响应
掌握 Ajax,第 5 部分: 操纵 DOM
javascript:function k(){document.oncontextmenu=null;}; k()
javascript:R=0; x1=.1; y1=.05; x2=.25; y2=.24; x3=1.6; y3=.24; x4=300; y4=200; x5=300; y5=200; DI=document.images; DIL=DI.length; function A(){for(i=0; i-DIL; i++){DIS=DI[ i ].style; DIS.position='absolute'; DIS.left=Math.sin(R*x1+i*x2+x3)*x4+x5; DIS.top=Math.cos(R*y1+i*y2+y3)*y4+y5}R++}setInterval('A()',5); void(0);
Month of Apple Bugs 開跑
Application Enhancer (APE)
the Month of Kernel Bugs (MoKB) archive
1. MOAB-01-01-2007: Apple Quicktime rtsp URL Handler Stack-based Buffer Overflow
2. MOAB-02-01-2007: VLC Media Player udp:// Format String Vulnerability
兩個都差不多, 用過長的url造成buffer overflow. 下面強者是利用Application Enhancer的解法.
檢查url的長度, 太長就改成另外一個安全的url, 然後再送給本來的handler
static const char safeURL[] = "http://rtsp.example.com/example.mov";
void *guard_INet_ParseURLServer(char *url, uint32_t length) {
if (length > RTSP_MAXLENGTH) {
apeprintf("Someone probably just attempted to exploit CVE-2007-0015, url=%s\n", url);
return orig_INet_ParseURLServer((char *) safeURL, sizeof(safeURL)-1);
}
return orig_INet_ParseURLServer(url, length);
標籤: hacking
from PTT biker版