2011
大门的关闭,被逼迫寻找另一条小路。
青春と気づかないまま
在我眼前那极高的梯级
要爬了多少 调匀呼吸
才能觉得轻松
夕阳斜射进窗口的对面
未来的景色能够看见吗?
梦想显得辉煌吗?
和回忆相反的
渐渐消逝的日子
让青春和草率的心
随着时间的流失
将一直撒娇的校服脱掉
成为大人
在那个时候大家一起唱着的
那首歌谣
直到现在才终于明白了其中的意义
在油毡地板上响个不停的拖鞋
似乎在为了追求什么而拼命跑
因为到了尽头而心受创伤
不知何时 在相簿中
和朋友微笑着互相拥抱
的照片 我一直望着
新的人生
虽然非常期待…
让青春和草率的心
随着时间的快步走
将刚画完的未来的地图修正
然后称为大人
在那时候 唱了不知多少遍
非常喜欢的那首歌
不知为何现在却无法记起歌词了
青春和草率的心
一直都消遣地
将眼前发生的重要的事情
全都忽略
终于爬上了楼梯的顶端
虽然来到了上面
如今我却无法唱歌了…
掌の砂
究竟要有多少个明天
才能够到达
在眼前 宽敞的道路
那遥远的彼方…
如果在途中停止
那梦想 就会到此结束
不管是多长的路程
都会有个开始
TRUE ROAD
张开的手掌
无法装下任何沙粒
但是只要用力 握紧拳头
就可以不放弃任何事情继续下去
从少年时期
一直 无法忘记
我愿望的沙粒
什么都没有变
如今也还在
有些时候 雨会倾盆
风也会吹起
即使心被悲伤沾满
即使迷失了方向…
找得见的光芒
要到处去寻找
微笑着的朋友 就在身边
将手伸出
TRUE FRIEND
有些人的手掌
一直都非常温暖
将一起生活的这段日子
照得如同太阳一般
流眼泪这件事
并不是什么害羞的事情
我愿望的沙粒
为了让花绽开
下起了雨
如同世界的人数
手掌和愿望也那么多
如果开始相信
那么就不会有争执…
TRUE LIFE
自己的手掌
究竟紧握着些什么?
放松 如果将手掌打开
就能看见当时下定的决心
为了成为大人
如同溢出来般的疑问
为什么会活着?
问一问沙粒
我为什么在这儿…
secret base ~君がくれたもの~
送给所有值得我称“朋友”的朋友们
随着和你在一起的夏天的结束 未来的梦想
伟大的希望 我不会忘记
深信我们会在 10年后的8月 再次相遇
成为最美好的回忆…
和你相遇的时候 只是一瞬间 在回家路上的路口
你对我开口说「一起回吧」
我 非常害羞地
用书包藏着自己的脸
心里却 非常 非常的 高兴
啊~ 烟花在夜空 非常漂亮地绽放 有一点痛苦
啊~ 风也随着时间一起 流走
非常高兴 非常快乐
冒了险也 做了很多很多事情
在两人 秘密的 基地里
随着和你在一起的夏天的结束 未来的梦想
伟大的希望 我不会忘记
深信我们会在 10年后的8月 再次相遇
你一直到最后 在心里
喊着「谢谢」这件事情 我知道
忍着泪水 笑着说再见
非常痛苦吧 成为最美好的回忆…
啊~ 暑假也 只剩下那么一点 就会结束
啊~ 太阳和月亮 感情很亲密
非常悲伤 非常寂寞
吵了架也 做了很多很多事情
在两人 秘密的 基地里
你一直到最后 在心里
喊着「谢谢」这件事情 我知道
忍着泪水 笑着说再见
非常痛苦吧 成为最美好的回忆…
突然的 转校 没有任何办法
我会写信 也会打电话的
不要忘记啊 我的事情
一直在 属于两人的 基地中
随着和你在一起的夏天的结束 一直聊着天 看着夕阳也瞭望天上的星星
你的脸颊边 留下的眼泪 永远都不会忘记
你一直到最后都 大力的向我挥着手 一定不会忘记
所以 就这样 在梦中 一直永远地…
随着和你在一起的夏天的结束 未来的梦想
伟大的希望 我不会忘记
深信我们会在 10年后的8月 再次相遇
你一直到最后 在心里
喊着「谢谢」这件事情 我知道
忍着泪水 笑着说再见
非常痛苦吧 成为最美好的回忆…
成为最美好的回忆…
Footnote: 希望我们10年后能够再次相遇
From PHP to Go
Disclaimer: This article is not and does not intend to be an introduction to the Go programming language.
Recently I’ve been learning the Go language created by Googlers, it’s a nice and elegant new language that seems to have a bright future.
Coming from a PHP background, there are a few things that I totally don’t understand (initially). PHP is a loosely typed programming language, you can convert int to string anytime anywhere and convert back as well. It’s the first time I meet up with a static typing language, that caused me quite some trouble in the beginning but I have been getting used to it ever since (and maybe beginning to appreciate it as well).
Besides that I have totally no concept about pointers as well, I’ve dealt them a little in PHP but in other languages like C, C++ it’s all about pointers. That makes it difficult for me. Luckily, Go has very little to do with pointers, I was quite relieved when I knew about that.
PHP array equivalence
Well, there are arrays in Go, but they’re different from PHP. For instance, to create an array one can do something like this:
1 | for ($i=1;$i<=10;$i++) $array[] = $i; |
It is possible to append to an array directly with $array[] and you don’t have to initialize nor declare the length of the array before you use it. In Go it’s a totally different thing (basically, in all other languages it is a totally different thing), you need to declare and initialize the array before use.
1 2 3 4 | tmpArray := [10]int for i := 1; i <= 10; i++ { tmpArray[i-1] = i } |
Note that you can’t just append items to arrays with tmpArray[], you have to specify an index. But what if I don’t know exactly how big my array is gonna be? That’s when you should use slice. A slice allows you to dynamically extend your arrays, and make it as long as possible.
1 2 3 4 | tmpArray := make([]int, 0) for i := 1; i <= 10; i++ { tmpArray = append(tmpArray, i) } |
Note that I declared and initialized a tmpArray with 0 length, then I looped 10 times and added items to it. But I suppose that this operation is expensive because if you need to extend the slice’s size it will initialize a new slice with the larger length, copy all items over and give it back to you, so it’s always good to either determine how large you need the slice to be before you begin.
What about associative arrays? Associative arrays in PHP are extremely useful and I personally use them all the time. In Go however, they aren’t called arrays, they’re maps.
To initialize a map, you do make(map[string]string), code example as below:
1 2 | maps := make(map[string]string) maps["test"] = "Hello!" |
Notice that you can assign new items right away. If you want to assign when you declare the variable, you can do so:
1 | maps := map[string]string {"test": "Hello!"} |
A very handy and useful functionality in Go.
Regular Expressions In Go
I can’t cover too much in this area, as I have also yet to explore on regular expressions in Go yet. But I can provide some basic information on how to use regular expressions in Go.
In PHP, we do preg_match("/([a-zA-Z0-9]+)/", $string, $results) to find all alphanumeric characters. The equivalence in Go is the following:
1 2 3 | import "regexp" rx_alphanumeric := reegxp.MustCompile("([a-zA-Z0-9]+)") match := rx_alphanumeric.FindStringSubmatch(stringToFind) |
You then have all the matches in match, which is an array of type [][]string, all the match results are stored in match[1] just like in php. Besides FindStringSubmatch, there are still a lot of functions you should read the documentation.
isset()
Performing an operation on an uninitialized variable will cause the whole program to terminate immediately. PHP has a useful function called isset(), but how do we use the equivalent on Go?
It turns out, in Go, assignments actually return 2 variables. The 2nd variable indicates if the operation is a success. So if you’re not sure whether the variable notSet is set or not, do the following:
1 2 3 4 5 | if val, exists := notSet; exists { println("Is set!") } else { println("Not set") } |
Conclusion
The only painful part of transitioning from PHP to Go is that every time you make some changes you have to recompile it to see the effect. In PHP you just have to tap Cmd+R in your browser to see the changes in effect. Besides that, resources on the Go programming language is still scarce and libraries aren’t quite available yet.
Other than that, I don’t see any reasons why we shouldn’t use Go.
踏上 NoSQL 之路
最近的项目中,异想天开突然想要引进一些新的技术。这个项目其实我已经开发了 3 个月了,是一个非常普通的 PHP + MySQL 的 Web 项目。所以我一开始所想的不是要将 MySQL 去掉完全利用 NoSQL,而是在想如何在我的项目中利用 NoSQL。
在这之前,我对于 NoSQL 几乎没半点概念,只知道 NoSQL 似乎是为了解决 RDBMS 扩展问题 (scaling problem) 而出现的。除此之外真的一点也不知道 NoSQL 有什么功用。于是乎我就开始在网上搜索资料,对 NoSQL 进行学习。有不少说明何谓 NoSQL 的资料,过程中我也了解到 NoSQL 有 4 种 [1],这 4 种都有不同的功能。
在清楚何谓 NoSQL 之后就开始进行思考了,究竟要如何在项目中利用 NoSQL?恰巧在 HN 上读到一篇文章 [2],发现原来 Redis 可以这么利用,而且文章也指出 Redis 在处理排行榜中的各种优势,于是就决定将项目中有关排行榜的那一部分从 MySQL 移植到 Redis。
之前,我对于排行榜的处理方式是将分数与玩家资料放在一起。由于某些页面有必要获取玩家的排名,因此就预先将排名算好当做玩家资料的表格的另一个栏储存起来。每次分数有所更动就必须全部重新计算,计算时间其实相当长。
在 Redis 则利用 Sorted Sets,只须将玩家的 ID 和分数记录下来,每次更动也无需进行任何计算,要获取玩家排名也不过直接 zrevrank ID 就可以了,非常方便。利用 Redis 之后,我也可以增加一些新的功能,比如根据玩家的种族进行排名,诸如此类在 MySQL 上会相当麻烦且花时间的功能都能够轻易实现。
成功利用 Redis 之后,我就看了看其他的 NoSQL 如 MongoDB,发现其实项目中暂时没有适合利用这种 NoSQL 的地方。当然,如果硬要利用 MongoDB 那还是可以的,但是其实没有这个必要。MongoDB 是一种 Document store database,这类数据库相关资料都必须放在同一个 Document 中,举例来说就是博客中 Article, Comments 和 Author 都必须在同一个 Document,在这个 Document 中的关系是每个 Article 都有多个 Comments 和一个 Author。对于我目前这个项目来说,各个元素之间有相当复杂的关系,如果要利用这种数据库会搞到一个 Document 非常巨大,结果可能不理想。
直到目前来说,还没有想到项目中还有哪一个部分可以移植到 NoSQL 去。但是就目前这个状况,我也挺满足的了。
少女たちよ
photo © 2008 Smithsonian Institution | more info (via: Wylio)“洒满天空的星星当中
哪一颗是最耀眼的?”即使被这样问道
也必定没有人能够回答
黑暗的前方有着这里看不见的光芒
舞台的角落里,持续挣扎
在充满遗憾、空虚的青春时期
少女们啊
黎明就快要来了
梦想中的未来从现在开始
wow wow
少女们啊什么也别放弃
抛弃所有悲伤的事情
用全力 全力去奔跑
能够照进人的眼帘的星星和
无法让人留意的星星
这其中到底
有什么差别?
是连光也无法到达的距离呢
还是因为云的关系呢
想要得到一个答案
无法像想象那样生活
那样的自己
如果因失意而感到恐慌的话
那么就给自己一个推力吧
懊恼的过程中
会不知不觉变强
今日的泪水将成为明日的力量
wow wow
懊恼的时候也要向前踏一步
若是止步的话一切就在那儿结束了
加油 加油 要相信自己的力量
少女们啊
黎明就快要来了
梦想中的未来从现在开始
wow wow
少女们啊什么也别放弃
抛弃所有悲伤的事情
用全力 全力去奔跑
这个世界上任何事情都是相对的,有最受注目的,也有完全没有受到任何人注意的。即使是目前最耀眼的星星,也必定经过或者将经历一段完全没有人注目的时期。这种时候,秉持着自己的信念,相信自己的力量,继续往前走是最重要的。要是因为觉得没有希望而放弃,那么一切就真的没有希望了。在这世上,任何事情都是被允许的,只要你想要那个结果,那么就做出自己的行动,自己去争取。
即使第一次没有成功,也不表示下一次会失败。或许有些事情不允许重来,但是事事都有例外,只看自己要不要争取。来到这个世界上已经 19 年了,一路走过来,发现自己许多事情想做,却没有去做,一路懊悔下来,已经不知有多少件了。如果想要的话,就要自己付出,自己行动。实现的力量已经在你的手上,只是看你想不想或者要不要去用而已。
With Great Power Comes Great Responsibility
Recently there were a lot of troubles here and there. It was coming from both the admin side and the technical side. I mostly work as a developer but with the prefix there, I might have been seen as an admin as well from the outside.
When some decisions aren’t discussed nor informed prior to announcement, it causes confusion within the crew. When most crew don’t know about the situation, they are on the same level as the users, how will they answer the users’ questions? This might have caused an impact on the crew’s image, after all we are the people “inside”, we should know more. Yet in reality, we don’t. People from the “outside” might speculate as to “are you really a crew member?” or some other thoughts.
I have absolutely no problem with the leader making up decisions by himself, even after discussion. But announcing to the “outside” without actually telling the internal is kinda unacceptable. Imagine that Steve Jobs announces iPad 3 and lets the whole world know about it even before any internal employee in Apple, ridiculous isn’t it? In this case, most employee will go crazy, flaming Steve Jobs for such decision, but the fact that the decision itself isn’t wrong, just the way of doing it is wrong.
I know I have no rights nor knowledge nor experience to talk about this, but I want to express my thoughts. As a leader, you are taking responsibility on the performance of a whole group of the crew facing the public. The public is important when money comes from them, but without a proper crew and “internals” you can’t please the public. Discussing about issues within the crew but ruling over the entire crew’s decision is fine, you’re just gonna take the responsibility for it if it ever fails. But if you don’t let them know what you think, they never know what they’re working for. The core of the crew is the leader, if there is no connection between the core and the surrounding, the surrounding will simply leave. Just like if Jupiter suddenly loses its gravity, all of its satellite will fly away.
Being a leader is difficult, and its an endless learning cycle. The best of the best makes mistakes, but not twice. You can feel free to make mistakes as much as you want to but please do not repeat them.
Side note: I find it easier to rant about things when I’m not in charge, or when I’m not the person responsible. I find this situation similar to Japan.
Teams and Players
SWL final was yesterday, it was both an exciting match and disappointing match at the same time. While I was considered neutral (as in, not supporting either of the team), I was rooting for KT to win. KT dominated much of the SWL rounds 3 and 4. However yesterday’s match was unexpectedly one-sided, as SKT’s s2 pulled off a 3-kill, KT Flash only made 1-kill before falling to Bisu.
Had KT’s coach sent more reliable players (as in not sending a Zerg to fight a Zerg), or calculated/make strategies according to map order, should Flash ever fall early he should still be able to pull off at least 2 kills. KT does have both skilled and experience players, it is not like the whole match is dependent on Flash’s performance. Of course, Flash’s performance yesterday was terrific, absolutely first class, but that was only his reactions to his opponent’s build. Had he not been Flash, he would have dropped the game in the first 5 minutes. But most of the times in team games, strategy > skills.
If KT does not learn and continues thinking of Flash as the final boss, they can continue inheriting the “Kong” line. No problem for me of course.
桜の木になろう
在微带春色的天空下
你一个人开始步行
就好像一直梦见的景色一般
描绘着已经走过的漫长的路程
穿着校服的日子
现在已经变成了回忆
看着你的背后
已经蜕变了的生活
我不安地转过身
你却不得不微笑时
从脸颊边掉落的眼泪
是为了长大成人的过程
让我们成为永恒的樱花树吧
我会一直在这里
即使你在人生的路上迷了路
我会站在你看得见的爱的地方
在阳光照射的教室中
和同学谈起过未来
现在 你却先走了一步
就在离我一步的前方
只有在花开的季节
你不能说“令人怀念”
在面对令人发抖的寒风
花过了冬天就会绽放
在没有人的校舍
我独自一人回到这个地方
和毕业的那一天
满面春风的你
相遇
让我们成为永恒的樱花树吧
作为“开始”的记号
即使所有的花瓣都散落开来
树枝也会张开双手将花瓣接住
任何人都有像花一样压在心里的
遗忘过的决心
回忆起来吧
樱花盛开的季节
记得我——
记得那一棵树——
让我们成为永恒的樱花树吧
我会一直在这里
即使你在人生的路上迷了路
我会站在你看得见的爱的地方
届かない思い出
Request timeout for icmp_seq 20110301
Request timeout for icmp_seq 20110302
Request timeout for icmp_seq 20110303
Request timeout for icmp_seq 20110304
Request timeout for icmp_seq 20110305
Request timeout for icmp_seq 20110306
Request timeout for icmp_seq 20110307
— 謎の名 ping statistics —
20110307 packets transmitted, 0 packets received, 100.00% packet loss
届かない思い出は、届けません。