Debug Notes to Self

  • use forever to run node server, pls check which user
  • Apache ProxyPass, did you even open the port on AWS?
  • Order directive is only under <Directory>
  • You almost always need export NODE_ENV=production
  • Chrome caches EVERYTHING without letting you know
  • Pls, if you are putting virtualhost files into sites-available, check whether you have symlink in sites-enabled
  • Apache config file must end with .conf, it seems
  • In new versions of apache2, 'Satisfy Any' and 'Require all granted' are needed
  • It seems by default it's specified somewhere that Apache listen to 80. Don't put
  • Listen 80 at the front of your virtualhost file. Listening to other ports is fine
  • When random newly added files cannot be read/found, do vagrant reload
  • Wondering why can't access a certain port? Is it forwarded from host to guest?
  • When you have your <?php tag wrong, it reports funny syntax errors
  • Remote access to MySQL, you have quite some to do and check:
    • Open port
    • my.cnf comment out bind-addr and skip-network
    • Grant privileges
    • CORRECT username and pw
    • Restart server
  • Know the thing you paste! "Grant ... Identified by" is for specifying password
  • Finally. This thing dragged me for more than 5 hours. See cant-connect-to-mysql-from-php-but-is-able-to-connect-from-remote-machine. So the conclusion is, % sign would not work. Maybe MySQL doesn't allow connect from everywhere using the % sign. Use localhost.
  • MPVolumeView does not appear on simulaor, but only on iPad. Watch out for elements like that.
  • The sequence at which you do things matters. So if in Step 1 you changed an object via its reference, don't expect it to be intact in Step 2.
  • Sometimes you are just too happy that you pass the wrong parameters (yet of same type). Be ware.
  • Be careful whether the coordinates are relative to the view or screen
  • It's important to do explicit type casting carefully. int and NSUInteger can be very different, especially with 0;
  • Error messages, even the unreasonable ones such as Objective-C linker error code, are meant to be read. Read it and a lot of problems become crystal clear and trivia to solve
  • The sequence at which one does fork() and doSth() matters a lot!
  • When bug is not at where you are looking, you can't find it. Check whether control even passes the statements?
  • When you can't update a package using npm, you might be using (running) it
  • When you have something like: <img alt="" /> <img alt="" /> You will see a small gap in between. That's because it's displaying the newline character.
  • jquery has .height(), .innerHeight(), .outerHeight()
  • Just can't get encode/decode right: the Unicode that we can see and understand encodes to Bytes that is binary and non-readable. The non-readable Bytes be decoded into Unicode
  • When there is a space in file name, you will be able to open that resource in new tab from chrome console. But it can't be properly loaded as a background-image with invalid property value error
  • Java applet no longer works on webpages as of recent versions of chrome
  • When need to do "match X (e.g. character class), but can't be exactly YY or YYY", use non consuming regex group. E.g. need to match /someFile/../, but not /./../ or /../../: /\/(?!\.\.\/)([^/]+)\/\.\.\//
  • What's still not working with Bash on Ubuntu on Windows?
    • phantomjs-prebuilt. It doesn't know whether you are ubuntu or windows. pulls the wrong binary - solution: install phantomjs globally (sigh...)
    • Old ver of ubuntu (14.04)
    • Arrow keys not working, ComEmu + UBW + vim
    • yarn pkg doesn't work because no network interface
  • Ign xxx.source.list is normal output from ubuntu - simply means "no change in this source list"
  • windows show listening ports netstat -a -b -o
  • When you just can't figure out why port can't be connected or why it's being listened - remember you are in a big mist of subsystems. Do you have it in one of your vbox, and port is forwarded to host? Do you have it running in BUW?
  • It's a redux devtools but that if a dispatch is called in dom event handler, it's not caught by devtools. But it will be caught by redux store
  • It's important and tricky to create minimal repro for bug. Most of the times you would think the problem is in your code - not always! Sometimes it IS in the library or tool that you are using. Either way, create what works and what doesn't, approach each other from both sides, as appropriate
  • For jQuery posting JSON (application/json), you must give serialized JSON string in data
  • Email regex:
  • Silly bug. I change js file and restart node process, and then grep log for keyword A (cache_purge). I wonder why my logging of xxxx doesn't show up. Lesson: use grep -C 3
  • SSH never works for me. Check your username, check keys, use -vvv to debug
  • What is tilda in bash? It's available only in terminal, not in .bashrc (because you don't have a HOME at that time?). Use $HOME in .bashrc etc
  • vue cmd not found. 一开始认定肯定不在path, 后来看pkg自己都没有bin? 原来装错了, cli-global-service是专给serve用的plugin, 但是在这之前先装@vue/cli才行

  • 然后因为一些神秘的原因找不到vue.esm.js, 直接给一个绝对路径反而就import成功了, good job webpack (no pun intended)

  • getMonth 从0开始数

  • fs.writeFileSync 不认识 ~ home directory

  • ssh-agent要想跑多个subprocess cmd要这样 ssh-agent bash -c 'ssh-add /home/ubuntu/go/src/; cd ${DFE3_PATH}; git push origin master'

  • Your current version of Yarn is out of date “npm upgrade –global yarn” should be “npm install –global yarn” #3042

  • 可以格盘么?意思是可以整盘摧毁么?mkfs -f /dev/diskAccessPoint 或者 dd if=/dev/zero of=/dev/diskAccessPoint bs=1M count=1000 find /forRemovePath/* -exec rm -f {} \;

  • git rev-list --all --pretty "%H %an %at"

  • All these workarounds didn’t work for me: In the end I must move the one in 8.4.4?? But moving the .o in 8.4.3 has effect - it crashes

  • Was filing a bug report to jest / webpack because I think it messed up node require logic in their Runtime.requireModuleOrMock. Turned out I was wrong. It gave wrong results because alias was defined in webpack conf, so webpack doing the wrong resolution of modules

  • 一开始是以为React component, purecomponent没有re-render, 导致还是旧的数据. 后来仔细看了一下做的都是对的, 有re-render. 那么怎么回事呢? 原来在selectedRows 里面, 我放的不是idx (或hash) 而是整个data obj. 所以不跟着更新. 是个subtle bug, 留pointer最好, 或者留key

  • 踢到Spring的铁板. 一开始以为所有properties file和yaml file全都100%兼容, 后来发现在阴暗的角落里竟然: @PropertySource只能用properties

  • Vault, 原来api_addr和vault_addr不是一回事. vault_addr不能在config文件里写, 但是却有个默认值, 是127.0.0.1. 而其他几个addr就设成 (也应该) 是127.0.0.1. 导致快疯了. 最后还是CLI传, 或者envvar

  • Python logging, setLevel放在handler这一层, 结果还是总用default last resort (也就是WARN). 幸好发现得早, 没有乱找. 最后发现是handler和logger都需要setLevel, logger那一层先筛

  • “极端情况下ETH的bug”, 是说前一个交易广播出去但是在pool里没有进块. 这时钱还在. 然后又发后一个交易. 然后前一个交易成功进块了. 最后钱不够后一个交易了, 后一个交易永远卡死.

  • alphavantage的json api:
      "Realtime Currency Exchange Rate": {
          "1. From_Currency Code": "USD",
          "2. From_Currency Name": "United States Dollar",
          "3. To_Currency Code": "USDT",
          "4. To_Currency Name": "Tether",
          "5. Exchange Rate": "0.99588996",
          "6. Last Refreshed": "2019-10-21 15:12:10",
          "7. Time Zone": "UTC",
          "8. Bid Price": "-",
          "9. Ask Price": "-"
  • Why you can’t fake your IP? Because 1. Reply TCP packets will not deliver 2. If you fake an IP that this exit router doesn’t expect, it will drop. Unless you control all exit routers.

  • RocketMQ问题, 先从 no route info开始 (client报的), 然后全线不能发消息. 很慌. 后来分析, MQclient连不上rocketMQ, 然后有的币对还正常, 最后发现rocketMQ的机器正常, 但是有台新机器没有加安全组所以新机器连不上rocketMQ. 还是有几个问题: client连不上我, 为什么我rocketMQ还知道要报错? 后来基本全不行, 是因为碰巧两个API都到了那台27新机器吗? 还是因为机器人所在机器和我的机器都碰巧连同一个API? 后来resequence花了好久 (虽然说出现的错误是经典的卡在submitted状态, 不能取消), 为什么呢? 是不是因为现在的配置还远不如当年的benchmark
Written on December 1, 2013