Sorry, this entry is only available in 中文.
How many 3-pters do I need to have a 3-hit?
FaceTime
Backslashes in WP LaTeX
Just newly upgraded to WordPress 3.4.1, and I’m dismayed to find that whenever I try to type a LaTeX formula, the backslash disappears. I have to replace \ with \\, but every time I do a save, the two becomes one, and next time it becomes none. After some investigation, I finally got the culprit:
/wp-includes/load.php
function wp_magic_quotes() { // If already slashed, strip. if ( get_magic_quotes_gpc() ) { $_GET = stripslashes_deep( $_GET ); // $_POST = stripslashes_deep( $_POST ); $_COOKIE = stripslashes_deep( $_COOKIE ); } // Escape with wpdb. $_GET = add_magic_quotes( $_GET ); $_POST = add_magic_quotes( $_POST ); $_COOKIE = add_magic_quotes( $_COOKIE ); $_SERVER = add_magic_quotes( $_SERVER ); // Force REQUEST to be GET + POST. $_REQUEST = array_merge( $_GET, $_POST ); }
Comment out this line and everything’s fine.
png support for Emacs
Notes on Computational Electromagnetics
Today I uploaded an old set of notes (in CHINESE) that I made when I was in grad school. Check it out if you are interested:
Sudoku Solution – Project Euler #96
This is a Python solution for Project Euler #96, to find the solution for sudokus.
The speed is modest (0.750s with pypy on Windows 7 @ i5 2.60GHz), but the code is relatively short and hopefully the idea is clear. Enjoy.
1. Find candidates for all items. If only one exists for a blank, fill it in.
2. Note down the blank with least but more than one candidates.
3. Copy the matrix and trial the candidates recursively until all blanks are filled.
Continue reading “Sudoku Solution – Project Euler #96”
宫怨
常居深里负春光
灯冷窗明夜未央
滴漏声枯催人老
何年再斗画眉长
早春一首
应水源古典诗词板早春诗会活动
长天漠漠冬已深
雪尽冰留雨又频
幼草依稀时现影
轻风料峭总撩人
前年去雁应归里
旧日蛰虫或醒身
待到山花齐放处
谁谈曾历苦寒辛