Programming Gotchas

陷阱是什么?这些都是会咬你一口的小细节,因为你没有在按回车键的时候说出这个秘密词或揉你的肚子3次。明白了!

Internet Explorer

  • You can’t have a popup window with aspace in the name.
  • When making an HTA, don’t open links inside the HTA. You can’t usejavascript:void(0)链接,当它试图作为一个新页面打开时,你会得到令人愉快的安全警告。使用“#”(不幸的是,这会导致你在屏幕上跳来跳去。Then use #top…)

Firefox

Programming

  • Always, always rebuild clean. Check this first – you could be using old files, be in the wrong directory, or in the wrong terminal window.

Shell Scripting

  • Beware newlines: Ran a commmand like this ver = “svn info | grep “Revision” | gawk …” to parse some input. Unfortunately, did not “chomp” off the newline at the end. The newline went into other commands, caused problems, and was hard to see.

Javascript

  • object[name] != object['name']. Beware a string in variable name and the string “name”. Confusing? Yes. Maybe there’s something to hungarian notation after all (no, no, just kidding!)

  • CSS:font-size: 10pxbecomes variableobject.style.fontSizein javascript. CSS proprties without dashes are the same (i.e., height).

  • onpaste/oninputdetects paste events inside an input area from the mouse (onkeypresswon’t work).

Apache

  • Need the qsa flag in order to pass the query string through for mod-rewrite rules (otherwise, you just get the page and not the query).

WordPress

  • If your comments disappear suddenly, do a repair table with PhpMyAdmin (Operations > Repair Table)

Join 450k Monthly Readers

Enjoy the article? There's plenty more to help you build a lasting, intuitive understanding of math. Join the newsletter for bonus content and the latest updates.