主题没有,内容瞎写

芳草伴青山, 雲影入湖心, 松梢鶴嘯長, 蘆屋酣夢沉。

0%

As I experieced many times before, migrating/upgrating a database always hurts. That’s the reason I won’t upgrade my Postgresql to the latest version until I have to. And the day finally comes.

I have to upgrade my Postgresql server from 9.4.9 to 9.6.1 with pg_upgrade. Otherwise, I can not properly install postgis, which is another long story. I am surely not the first one who is doing this upgrading. Olivier Lacan has a great post about Postgresql database migrating. But the thing is, I still can not run the pg_upgrade command properly after unloading the homebrew.mxcl.postgresql.plist. And the most weird thing is I can not even kill the postgres process even with kill -9. After each time I enter the kill command, the postgres services appear again with a new PID just like a ghost virus program. And the pg_ctl stop command, of course, doesn’t work with whatever mode option. Finally, I figure out that there is another pList - homebrew.mxcl.postgresql.plist.bak still active in the ~/Library/LaunchAgents/ directory. And it IS the control script that starting the current Postgresql service. So I immediatly launchctl unload it, then all the postgres services are gone.

All done? Don’t be naive. After running the command

1
pg_upgrade -b /usr/local/Cellar/postgresql94/9.4.9_1/bin -B /usr/local/Cellar/postgresql/9.6.1/bin -d /usr/local/var/postgres.9.4.9.bak -D /usr/local/var/postgres

I got the error (from pg_dump_log):

1
2
3
4
command: "/usr/local/Cellar/postgresql/9.6.1/bin/pg_dump" --host '/usr/local/var/log' --port 50432 --username 'user' --schema-only --quote-all-identifiers --binary-upgrade --format=custom  --file="pg_upgrade_dump_16417.custom" 'dbname=mmrp_munich' >> "pg_upgrade_dump_16417.log" 2>&1
pg_dump: [archiver (db)] query failed: ERROR: could not access file "$libdir/postgis-2.1": No such file or directory
pg_dump: [archiver (db)] query was: SELECT a.attnum, a.attname, a.atttypmod, a.attstattarget, a.attstorage, t.typstorage, a.attnotnull, a.atthasdef, a.attisdropped, a.attlen, a.attalign, a.attislocal, pg_catalog.format_type(t.oid,a.atttypmod) AS atttypname, array_to_string(a.attoptions, ', ') AS attoptions, CASE WHEN a.attcollation <> t.typcollation THEN a.attcollation ELSE 0 END AS attcollation, pg_catalog.array_to_string(ARRAY(SELECT pg_catalog.quote_ident(option_name) || ' ' || pg_catalog.quote_literal(option_value) FROM pg_catalog.pg_options_to_table(attfdwoptions) ORDER BY option_name), E',
') AS attfdwoptions FROM pg_catalog.pg_attribute a LEFT JOIN pg_catalog.pg_type t ON a.atttypid = t.oid WHERE a.attrelid = '28564'::pg_catalog.oid AND a.attnum > 0::pg_catalog.int2 ORDER BY a.attrelid, a.attnum

So it’s postgis’s show time. could not access file "$libdir/postgis-2.1": No such file or directory. Of course you could not access the file because it has already upgraded to 2.3. I tried relaunching the old 9.4.9 server, but failed because all the client toolset are already 9.6.1 which reported incompatibility FATAL error. I feel so helpless. And I think a better workflow should be:

  1. Upgrade the postgis extention of your spatial database instances
  2. Stop old postgresql service
  3. Move old postgresql’s data cluster directory to a backup location
  4. Install new postgresql server
  5. Init new postgresql data cluster (with initdb)
  6. Stop new postgresql service
  7. Upgrade postgresql server (with pg_upgrade)

I don’t think there are many choices for me. So I decide using Postgres.app instead, and just give up all the postgresql stuff from Homebrew. I hope that will bring less pain in the future. How about the data? Don’t worry, I still have a running database on AWS.

Kindergartens in Heidelberg

《死神(Bleach)》也要完结了,下下周的686话将是最终话。我本来以为怎么也能凑个700再完结的,但看来98并没有填坑的计划,这也正常,毕竟坑太多了,灵王、星十字、蓝染、零番队、虚圈、破面、假面、完现术等等主线,以及银和乱菊、8600和剑八、现世那边的龙贵等人、一心和龙弦等等花边。

比起火影,我感觉死神的完结更加戛然而止。虽然我觉得说是烂尾,对这二者都多少有些不公,但说这哥儿俩虎头蛇尾还是不委屈他们的。其实这种热血漫画,如果没有在一开始有个比较完整的构思,然后逐步展开,前面挖坑后面填,主线支线配合,正叙与插叙交织,完全可以让读者面对眼前徐徐展开的恢宏画卷而高潮迭起。对没错,我说的就是《海贼王》。比起WT,98和AB还是属于那种想到哪画到哪的类型,当然,他们已经做得不错了。

火影完结的时候,我并没有写点什么,但死神完结我会写,因为其中有我和老婆的美好回忆。想到死神,我就会想起北院那个家属楼。虽然那里简陋的连独立厨卫都没有,虽然它早在几年前就被推掉了,但还是留下了我们很多美好回忆,包括一起看《死神》的日子。

时隔将近20年了,终于又重新做了一次模型。而且这次是EW版的重装高达!与初中那会比起来,总算是做了一回日本原产的正版模型,而且也用了更加专业的工具。前后耗时6小时左右,虽然只是拼接,没有上任何涂装,对切口的处理也比较粗躁,但还是十分令人满意的。对了,目前暂时还没有贴贴纸。

刚刚开始:

preparing

完成胸部和头部(到最后安装背包的时候才发现在组装胸部的第二步少装了一个零件,只能拆开补。。)

head and chest

完成上半身:

with arms

完成主体:

whole body

手持武器、背包和弹仓安装完成:

finished

来个活力全开的:

in battle

转个身:

back

组装模型是对耐心、细心的锻炼,是有效治愈手残症的良方。虽然正版模型有点小贵,但做工真的是超赞。做完赶紧留影纪念,因为不知道它在大魔王的手里能存活多久…T_T

我觉得今后呢,如果是写技术方面的东西,那么就默认使用英文,而如果是生活吐槽扯淡方面的就用中文,这样是比较合理的。

Let me make a convention about the blog writing language. From now on, the posts will be in English if they are categorized in “Programming”, or in Chinese if they are in “Life”.

I have just run a brew cleanup command to release some of my hard drive space. But after that, I suddenly found my python doesn’t work:

1
pyenv /usr/local/var/pyenv/shims/python: line 21: /usr/local/Cellar/pyenv/20160310/libexec/pyenv: No such file or directory

As it says, the directory of /usr/local/Cellar/pyenv/20160310/ really does not exist. And the solution can be found from brew info pyenv:

1
2
3
4
5
To use Homebrew's directories rather than ~/.pyenv add to your profile:
export PYENV_ROOT=/usr/local/var/pyenv

To enable shims and autocompletion add to your profile:
if which pyenv > /dev/null; then eval "$(pyenv init -)"; fi

They are obviously already in my .bash_profile file. The only necessary action is to do source ~/.bash_profile.

Problem solved.

在经历过几个月的动荡之后,开发工作必须要重新启动了,而且是要保持较高的强度。

首先做的是从vim迁移至neovim,把插件管理器从Vundle改成了vim-plug,并借此机会把所有的插件又重新梳理了一遍,保留了这些:

  • vim-colors-solarized
  • gruvbox
  • nerdtree
  • nerdcommenter
  • deoplete.nvim
  • syntastic
  • vim-flake8
  • vim-easy-align
  • vim-clang-format
  • vim-airline
  • fzf
  • fzf.vim
  • vim-surround
  • vim-fugitive
  • vim-multiple-cursors
  • vim-racket

其实还是有点多,而且有些用的很不熟练,但本着先利其器的原则还是把它们装上了。这也是在强迫自己保持对新工具的折腾精神。

多年以来的经验告诉我,以具体的项目驱动仍然是我学习新知识新技能的最高效选择,看书补理论是绝对必要的但一定要放在一段工程实践的后面,而且不能看太久,一定要在适当的时候重新开始一段新的实践。

这个难熬的四月,到上周五晚上11点,终于结束了。命令在当晚7点多到了学校,而且没有再节外生枝。在这件事情上,我不再想看到任何支线情节。

这本来应该是20多天,不,应该是两年多以来睡得最踏实的一晚,但我那天几乎彻夜未眠。

新的旅程终于可以开始了。

本章并不是想对C语言进行致命打击。C是一门神奇的编程语言,具有许多优点。它是一种非常流行的实现语言,被许多平台所选用,而它确实也值得人们如此看重。但是,正如我的祖母曾说过的那样,当在超导条件下进行超级碰撞时不可能连一个原子也不撞碎。所以在欣赏C语言的优点时也不要忘了分析一下它的缺陷。总结——进步是计算机软件工程和编程语言设计艺术逐步发展的重要动因。这也是为什么C++语言令人失望的原因:它对C语言中存在的一些最基本问题没有什么改进,而它对C语言最重要的扩展(类)却是建立在脆弱的C类型模型上。所以,本着改进未来编程语言的探索精神,让我们对C语言进行望闻问切,详细记录病例。

本段摘自Peter Van Der Linden所著,徐波翻译的《C专家编程》,人民邮电出版社,2008年第二版第28页。我喜欢这段话。

在经历了反复的思想斗争之后,我还是在老婆的不断催促下决定卖掉我的Thinkpad T60,但我真的十分不舍。

昨天,我把它从柜子里拿出来时,上面有一层薄薄的灰尘,但用3M布轻轻一掸就光洁如新了,就像2007年刚买回来时一样。从2007年到2012年MBA成为主力机之前,它一直是我最稳定可靠的工作伴侣,性能下降曲线十分平缓,说明了小黑硬件设计师和工程师们的深厚功力。而它也是最后一代拥有IBM血统的小黑,尽管上面已经开始在屏幕下方和电源上出现了恶心的Lenovo标记,但那时它还仅仅是个标记,暂时没有如T61那样深度腐蚀Thinkpad的肉体和精神。从这点上说,我觉得非常幸运。

然而,再顽强坚固耐用的电子产品也难逃贬值到报废的魔咒,西门子和诺基亚的手机如此,Thinkpad也一样。尽管它陪伴了我的整个博士阶段,从中国到德国再回到中国,依然运行良好,依然被我擦拭的一尘不染,但它还是已经老去了,该退出历史舞台了。

为了延续它的生命,我早就为它换装了Ubuntu。当我昨天时隔将近两年再次启动它时,它没有任何抱怨,进入系统依然如丝般顺滑。但既然已经决定和他告别,就要让他有尊严的离开,备份了重要的数据,全新安装了Ubuntu 14.04.4,然后关机,缓缓合上了盖子。

小黑T60

上闲鱼,卖货。