原文 Assembler / なぜx86ではMBRが"0x7C00"にロードされるのか?(完全版)
感謝 descent 大大分享本文,隨便看隨便譯。本文不是逐句譯,同時也不是這方面的專家 (不管是語言或技術),用語不一或缺漏錯誤在所難免,歡迎自行 fork 修正指教
誰適合看本文?
對 x86 架構與組合語言有基礎認識,以及從 MBR 到載入 OS 這一段過程有興趣的人 (還有談到中斷向量或 INT xxx 時不會一臉茫然的人)
; Fibonacci n-th number (modulo 2^32) | |
; | |
; input: | |
; ecx = n | |
; modifies: | |
; eax, ecx, edx | |
; ouput: | |
; eax = number | |
; size: | |
; 15 bytes |
function ltrim(s) { sub(/^[ \t\r\n]+/, "", s); return s } | |
function rtrim(s) { sub(/[ \t\r\n]+$/, "", s); return s } | |
function trim(s) { return rtrim(ltrim(s)); } | |
BEGIN { | |
# whatever | |
} | |
{ | |
# whatever | |
} | |
END { |
原文 Assembler / なぜx86ではMBRが"0x7C00"にロードされるのか?(完全版)
感謝 descent 大大分享本文,隨便看隨便譯。本文不是逐句譯,同時也不是這方面的專家 (不管是語言或技術),用語不一或缺漏錯誤在所難免,歡迎自行 fork 修正指教
誰適合看本文?
對 x86 架構與組合語言有基礎認識,以及從 MBR 到載入 OS 這一段過程有興趣的人 (還有談到中斷向量或 INT xxx 時不會一臉茫然的人)
-- show running queries (pre 9.2) | |
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
FROM pg_stat_activity | |
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
ORDER BY query_start desc; | |
-- show running queries (9.2) | |
SELECT pid, age(clock_timestamp(), query_start), usename, query | |
FROM pg_stat_activity | |
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
In August 2007 a hacker found a way to expose the PHP source code on facebook.com. He retrieved two files and then emailed them to me, and I wrote about the issue:
http://techcrunch.com/2007/08/11/facebook-source-code-leaked/
It became a big deal:
http://www.techmeme.com/070812/p1#a070812p1
The two files are index.php (the homepage) and search.php (the search page)
# to generate your dhparam.pem file, run in the terminal | |
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048 |
createElement.js lets document.createElement use CSS selectors.
This is a pretty useful library for building out DOM elements. The whole thing runs on one regex and a for loop, so it’s plenty fast. The script is 300 bytes when compressed and gzipped. For 524 bytes (advanced), it includes nesting support and can generate entire DOM hierarchies, including text nodes.
document.createElement(); // generates <div />
This is an ad-hoc Java-to-Dart translator originally written on two (admittedly long) evenings.
See http://sma.github.io/stuff/java2dartweb/java2dartweb.html for a demo.
Note: It doesn't support the complete Java grammar specification and cannot translate everything. It only translates syntax and does not attempt to translate Java library classes and methods to Dart equivalents (with the exception of String.charAt
and StringBuffer.append
). You will have to make changes to the resulting Dart code. It does not support anonymous inner classes.
However, I was able to successfully convert a 7000+ line command line application with only minimal fixes in 30 minutes.
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> | |
<input id="file" type="file" accept="image/*" /> | |
<br/> | |
<h2>As read:</h2> | |
<img id="placeholder1" width=300/><br/> | |
<h2>Rotated by exif data:</h2> | |
<img id="placeholder2" width=300/> | |
<script> |