how server in china pissed me when configuring ntp for Raspberry Pi

so i got a Raspberry Pi recently and when compiling stuff, i got the time screwed error, clearly the system time is not right as rpi don’t have a hwclock.

after some easy googling i know i can use ntp to sync time with network  server whenever rpi boots, then i got this page to guide me through the set up. after some messing around and reading the whole article several times, i found my problem is ntpd -qg simply won’t return.

as you can read from that article, ntpd -qg should say “ntpd: time set +%%%%%%s” in the end, but i can’t get that message. running with some debug information with ntpd -qgd showed the ntpd seems can’t get a answer from the server, so i’m still in 1970.

then i find the official page and get more dump commands. ntpq -p gives a abnormal output: all delay, offset, jitter is 0, and the refid is .INIT., this is very bad. then i tried ntpdate pool.ntp.org, and it tells me there is no suitable server to sync the time, omg!

in /etc/ntp.conf, you can check which server ntp is using. mine is the default one: 0.pool.ntp.org, 1.pool.ntp.org, 2.pool.ntp.org, there should be some redirecting stuff, you can see with ping 0.pool.ntp.org, the address i get starts with 202., so it’s a china server(also from the domain name). it’s sensible because it always choose the closest one for you. now that is the problem, how can i trust a chinese server to deliver ntp service properly?

now the solution would be pretty obvious: use a eu or us server. just prepend pool. with us., you got 0.us.pool.ntp.org, 1.us.pool.ntp.org, 2.us.pool.ntp.org. this time ntpd -qgd would happily tells me it has got the time set properly, and ntpq -p also prints sensible results.

welcome back to 2014!

how to get nexus 7 2013 otg working with usb mass storage

nexus 7 2013 has out-of-box support for otg wired mouse and keyboard, if you root it and install stickmount, you can mount usb thumb drive, but not your hard drive, the reason is pretty simple, your hard drive need a 5V voltage drive to work, but that otg cable from your tablet can’t provide that. some people suggested hack open a otg cable and wire a extra usb head just for 5V power, connect that usb head to your computer ‘s usb port(which has standard 5V power), and it works. i don’t have tools for that but found my own way:

just buy a 3 headed usb cable that use 1 of the heads to draw power if needed

the good thing about this is 3 headed usb cable is a standard product, you can buy it easily, you don’t have to hack open a existing cable to make your own gear.

i thought this was a obvious solution, not sure if anyone has find it before me, but i can confirm it did works, for my nexus 7 2013.

android 4.4 kitkat wallpaper location

so i need to find wallpaper location for my new nexus 7 2013(4.4 upgraded). not just the current wallpaper, i want to find all of them.

after a bit of messing around with my tablet, i found the hideout of those wallpapers is still in launcher2.apk, i don’t know when google has moved it, but now launcher2.apk is inside /system/priv-app/, not in /system/app/, after catching launcher2.apk, the remaining task is easy: just extract it and look into res/, interestingly those wallpapers is inside a folder called drawable-sw600dp-nodpi, i would expect something like drawable-hdpi(hight dpi), or drawable-xhdpi(extra high dpi), but not -nodpi(no dpi??)

so there you go, if you want to find stock wallpapers for nexus 7 2013(kitkat upgraded), look for /system/priv-app/Launcher2.apk, extract it, then go to res/drawable-sw600dp-nodpi/, all yours.

坐过站

在一辆火车上

你到站了

却因为出神忘了下

当你发现时

车已经开了

从来都是从这站下

这站是家

而下一站呢?

突然你发现你从来都不知道下一站是什么

但这时火车已经开了

去旅行

回来时应在这下

却不小心坐过站

或者下一站是陌生的世界

或者没有返回的车票

或者

火车不会再停

没有下站了

(quote: watch spirited away for this feeling. In that, there is a train invoking and interact with this)