Long Luo's Life Notes

每一天都是奇迹

By Long Luo

昨天在开发一个项目时,在Android Studio中编译时,gradle编译之后出现了如下错误:

Error:Execution failed for task ':samples-simplevideowidget:processDebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'E:\Android\SDK\build-tools\23.0.1\aapt.exe'' finished with non-zero exit value 1

首先看到这个错误之后,因为移植的代码在之前的eclipse编译时OK的,所以先检查了下Android Studio项目中资源,代码有无提示的错误,经过确认没有之后,将错误信息在Google中搜索。

经过搜索之后,在StackOverflow和CSDN上发现有很多人遇到了这个错误,不过解决方法却各不相同。有的建议Clean然后Rebuild,有的建议修改使用内存,有的说是代码问题,也有的说是资源问题,比如本来是jpg图片,文件后缀却是png也会导致问题…

我按照以上方案一一检查,还是未能解决,于是只能自己动手排查原因了!

1. 定位错误点

在项目root路径,命令行输入:

gradlew processDebugResources --debug

然后项目开始编译,屏幕上输出大量编译Log信息,从Log中找到了输出的出错信息:

org.gradle.process.internal.DefaultExecHandle] Changing state to: FAILED
org.gradle.process.internal.DefaultExecHandle] Process 'command 'E:\Android\SDK\build-tools\23.0.1\aapt.exe'' finished with exit value 1 (state: FAILED)
org.gradle.api.Project] Unknown source file : ERROR: In <declare-styleable> ListItemLinearLayout, unable to find attribute singleLine

org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Finished executing task ':samples-simplevideowidget:processDebugResources'
E] [class org.gradle.TaskExecutionLogger] :samples-simplevideowidget:processDebugResources FAILED

从上述Log信息,我们可知出错点是ERROR: In <declare-styleable> ListItemLinearLayout, unable to find attribute singleLine,那么肯定是attrs文件的ListItemLinearLayoutstyleable出错了。

2. 错误原因

经过上述分析,我们进入attrs.xml文件,找到ListItemLinearLayout,如下所示:

    <declare-styleable name="ListItemLinearLayout">
    <attr name="singleLine" />
    <attr name="titleSize" format="dimension" />

可以看出singleLine没有对应的format属性,确定singleLine没有在代码中使用之后,将此属性删掉。

重新编译之后,问题解决。

Completed by Long Luo at 2016-04-09 00:36 @Shenzhen, China.

By Long Luo

自从2013年建了第一个个人网站(博客搭建,传送门:如何一步一步建立一个属于你自己的个人网站? ),折腾了好几个博客系统。

第一个网站购买了VPS,使用LNMP架构,博客系统使用Wordpress。使用了半年左右,觉得Wordpress太重了,看到了其他技术博主使用 Octopress ,简洁,于是切换到Octopress。

最近一次则是Hexo ,非常简洁,而且很快,于是很快将个人网站切换到Hexo。

目前使用Hexo+Next主题,非常简洁。

这里记录一些Hexo

最开始是讲述了如何利用Github Pages建立一个属于自己的静态博客,下面这篇文章主要讲的是hexo的常见指令及说明,定位于Hexo的入门指南

Hexo

Hexo文档

Hexo手册文档: https://hexo.io/zh-cn/docs/

Hexo命令

命令行中输入:

1
$hexo help

列出了Hexo常用命令:

Commands:
  clean     Removed generated files and cache.
  config    Get or set configurations.
  deploy    Deploy your website.
  generate  Generate static files.
  help      Get help on a command. 查看帮助信息
  init      Create a new Hexo folder. init [文件夹名]: 创建一个hexo项目,不指定文件夹名,则在当前目录创建
  list      List the information of the site
  migrate   Migrate your site from other system to Hexo.
  new       Create a new post.
  publish   Moves a draft post from _drafts to _posts folder.
  render    Render files with renderer plugins.
  server    Start the server.
  version   Display version information. 查看hexo的版本

Global Options:
  --config  Specify config file instead of using _config.yml config-path:指定配置文件,代替默认的_config.yml
  --cwd     Specify the CWD cwd-path:自定义当前工作目录
  --debug   Display all verbose messages in the terminal 调试模式,输出所有日志信息
  --draft   Display draft posts
  --safe    Disable all plugins and scripts 安全模式,禁用所有的插件和脚本
  --silent  Hide output on console 无日志输出模式

Hexo常用命令也可以使用以下缩写:

1
2
3
4
hexo n == hexo new
hexo g == hexo generate
hexo s == hexo server
hexo d == hexo deploy

清除生成内容

1
$ hexo clean

执行此操作会删除 public 文件夹中的内容。 以上就是经常使用的命令。

一键三连:

1
2
hexo clean && hexo g -d
hexo clean && hexo g && hexo s --debug
阅读全文 »

By Long Luo

今天下午去深圳玛格丽特音乐文化教育中心以地板价试听了一节钢琴课,学到了很多东西,再结合自己的一些思考,在此简单记录下来。

对于成人学钢琴来说,一大问题是时间有限,如果你是个上班族,不可能有很多时间让你去学习和练习,所以你得用脑子去学习。美女老师说,你的脑子里得时时刻刻有钢琴这东西。这种潜意思的学习,你可以在脑海中想象去弹琴,多思考,多分析,多总结,带着疑问去学习,这样才会学得快。

学习一样新东西,无法就是学习,模仿,练习,实践。掌握了正确的学习方法,可以达到事半功倍的效果。

阅读全文 »

By Long Luo

一、

冬天的太阳,比起夏天的太阳,大了很多倍,从山顶探出头来,漏出一片红色的光,落在结了一层白色的霜的屋顶上。这个时候就是吃完饭准备走去学校的时候了。

抬头一看,只有一片蓝色,云朵都藏起来了。

四周没有多少声息,只听到一些叽叽喳喳的鸟叫声。那时的我,穿的严严实实,挑着有光的路走。红色的光在手背停留了许久许久,但就像火柴的火一样,烤不热这一团已经发红发麻的大冰块。直到上完前3节课,冰块才完全融化,所以小学课本里的笔记有的地方一片歪歪扭扭,那就说明是在上午前3节课记下的。

路边的田里覆盖着一层稀稀疏疏的白色,偶尔可以看见几片青色的野草叶子。一排排白色的稻茬排列在田间,像阅兵的方队,等候着我们的检阅。

我们看着前方,太阳已经离开山顶几丈高了,照亮了更远处的村落和山坡。模模糊糊的远方,有更高的山,其实也只是几缕山的形状。我不知道何时能走到那山脚,看看那山里面到底是什么?

当太阳已经挂在学校低矮的屋顶时,我们的心已经蠢蠢欲动了。随着老师的一声下课,我们一边站起来说,“老师再见”,另一边两只手已经抓牢了课桌里的书包。不同于早上的慢慢吞吞,下午我们的精力异常的旺盛,一路追着跑着,跑累了就停下来走一走。

太阳仍然在离地很近很近的高处挂着,将那一片的云从白色烧成通红。不同于八九月的傍晚,尤其是在下午下了一阵雨以后,那时候有很多的云,被烧成了一片红,将大地镀上了一层金色。云彩也飞快的移动着,变化成不同的形状。多年之后我才在课本里知道这叫火烧云。

太阳仿佛在和我们玩捉迷藏,将自己藏在山里面,只露出了一个头偷偷地看着我们。我们又努力向前跑着,终于又看见它了,不过一小会,它又藏在更远处的山顶。我想山那边会是什么样子?也有像我一样的孩子么?这个世界上会有另外一个我吗?

Created by Long Luo at 2016.02.07 @Jiangxi, China.

By Helen Keller

I

All of us have read thrilling stories in which the hero had only a limited and specified time to live. Sometimes it was as long as a year; sometimes as short as twenty-four hours. But always we were interested in discovering just how the doomed man chose to spend his last days or his last hours. I speak, of course, of free men who have a choice, not condemned criminals whose sphere of activities is strictly delimited.

我们所有人都曾读过些动人心弦的故事,讲述主人翁们余时不多的有限生命,或是仅余一年,或是仅余一日。其中最能引我们入胜的,往往是如此一个疑问:这些已被录入死神裁决书的人们,是如何度过他们最后的时日的?当然,我并非在说那些被严酷地限制着人身自由的犯人,这里我所要谈到的,是自由如我们这样,有着充分选择权的人们。

Such stories set us thinking, wondering what we should do under similar circumstances. What events, what experiences, what associations should we crowd into those last hours as mortal beings? What happiness should we find in reviewing the past, what regrets?

这样的故事让我们思考:如果有一天,相同的情境里代入了我们自己,我们在生命仅剩的片断中该做些什么,想些什么?当我们回首过往,看见的又会是如何的幸福,如何的遗憾?

Sometimes I have thought it would be an excellent rule to live each day as if we should die tomorrow. Such an attitude would emphasize sharply the values of life. We should live each day with a gentleness, a vigor, and a keenness of appreciation which are often lost when time stretches before us in the constant panorama of more days and months and years to come. There are those, of course, who would adopt the Epicurean motto of “Eat, drink, and be merry,” but most people would be chastened by the certainty of impending death.

有时我会想,也许最好的生活方式便是将每一天当作自己的末日。用这样的态度去生活,生命的价值方可得以彰显。我们本应当纯良知恩、满怀激情地过好每一天,然而一日循着一日,一月接着一月,一年更似一年,这些品质往往被时间冲淡。当然也有人自得其乐于伊壁鸠鲁派 “人生得意须尽欢”的生活,但死亡的迫近往往能让大多数人惶惶恐恐不可终日。

In stories the doomed hero is usually saved at the last minute by some stroke of fortune, but almost always his sense of values is changed, he becomes more appreciative of the meaning of life and its permanent spiritual values. It has often been noted that those who live, or have lived, in the shadow of death bring a mellow sweetness to everything they do.

在故事中,主人翁通常会在命悬一刻时得到幸运女神的垂青,但他的价值观也总是因此而改变——生命的意义与其永生的精神价值将在他心中升华凝结。我们常注意到,那些过去曾经,或是如今正活在死亡阴影之下的人们,他们每做一件小事,都充盈着甜蜜的动力。

Most of us, however, take life for granted. We know that one day we must die, but usually we picture that day as far in the future. When we are in buoyant health, death is all but unimaginable. We seldom think of it. The days stretch out in an endless vista. So we go about our petty tasks, hardly aware of our listless attitude toward life.

然而,我们大多数人都将生命视作天经地义、理所应当。我们知道有一天我们必将溘然长逝,但我们觉得那一天是在遥远的未来!在我们年壮身强的日子里,死亡是不可想象的。我们也很少去思考它。时间无限地向前延展,我们做着这些那些琐琐碎碎的事,根本觉察不到我们对生活的冷漠。

The same lethargy, I am afraid, characterizes the use of all our faculties and senses. Only the deaf appreciate hearing, only the blind realize the manifold blessings that lie in sight. Particularly does this observation apply to those who have lost sight and hearing in adult life. But those who have never suffered impairment of sight or hearing seldom make the fullest use of these blessed faculties. Their eyes and ears take in all sights and sounds hazily, without concentration and with little appreciation. It is the same old story of not being grateful for what we have until we lose it, of not being conscious of health until we are ill.

恐怕当我们在利用自己的感官和能力之时,也是同样地懒惰。只有聋子才珍惜听觉,只有盲人才能够体会光明那无尽的美好。对于那些在成年之后才失去听觉或是视力的人们更是如此。那些从未在视觉和听觉方面感受过障碍的人们,往往很少充分利用自己这些天赐的珍贵能力。他们的眼睛和耳朵模糊地吸收着所见的事物和听到的声音,不集中注意力,也不心存感激。常言说,失去之后方知珍惜,久病卧床才知要强身健体,正是如此啊!

I have often thought it would be a blessing if each human being were stricken blind and deaf for a few days at some time during his early adult life. Darkness would make him more appreciative of sight; silence would teach him the joys of sound.

我常常会想,如果让一个刚刚成年的人盲上些日子,或是聋上些日子,这或许也是种恩赐。因为黑暗将使他更加珍惜光明,而一片死寂才更能让他体会到声音的可贵。

Now and then I have tested my seeing friends to discover what they see. Recently I was visited by a very good friend who had just returned from a long walk in the woods, and I asked her what she had observed. “Nothing in particular,” she replied. I might have been incredulous had I not been accustomed to such responses, for long ago I became convinced that the seeing see little.

时不时地,我会询问我那些有正常视力的朋友们,问他们看见了什么。最近,一位挚友从林中散步归来,前来探访我,我便问她看到了什么。“没什么特别的呀。”她答道。其实对这样的回答我早已习惯,因为长时间以来,我已慢慢知道,视力正常的人看不见什么东西。

How was it possible, I asked myself, to walk for an hour through the woods and see nothing worthy of note? I who cannot see find hundreds of things to interest me through mere touch. I feel the delicate symmetry of a leaf. I pass my hands lovingly about the smooth skin of a silver birch, or the rough, shaggy bark of a pine. In the spring I touch the branches of trees hopefully in search of a bud, the first sign of awakening Nature after her winter’s sleep. I feel the delightful, velvety texture of a flower, and discover its remarkable convolutions; and something of the miracle of Nature is revealed to me. Occasionally, if I am very fortunate, I place my hand gently on a small tree and feel the happy quiver of a bird in full song. I am delighted to have the cool waters of a brook rush thought my open finger. To me a lush carpet of pine needles or spongy grass is more welcome than the most luxurious Persian rug. To me the pageant of seasons is a thrilling and unending drama, the action of which streams through my finger tips.

我问自己,以常人的视力享受了一个小时的林中漫步而没有发现任何值得看的事物,这怎么可能?我这个看不见东西的盲人,尚能通过触摸发觉到成百上千充满趣味的事物。我曾感受叶子精巧的对称,我也曾细抚白桦柔滑的皮肤和松树粗糙不平的表皮。春日里我渴望在树干上发现一簇嫩芽,因为那预示着久经寒冬的大自然正从长眠中醒来。我感受着花瓣们令人惊喜的天鹅绒般的触感,发觉它们特别的弧线,领略大自然的鬼斧神工。偶尔,当我将双手放在小树上的时候,还能幸运地感受到高歌的鸟儿身体那愉悦的颤抖。当清凉的小溪水从我指间流过,我更是满心欢喜。苍翠的松针或柔嫩的青草铺就的郁郁葱葱的地毯,比奢美华丽的波斯地毯还要让我倾心。对我而言,一年四季壮美的变幻就是一出动人心弦、永不会落幕的戏剧,情节如小溪流的水一般,顺着我指尖缓缓流过。

At times my heart cries out with longing to see all these things. If I can get so much pleasure from mere touch, how much more beauty must be revealed by sight. Yet, those who have eyes apparently see little. The panorama of color and action which fills the world is taken for granted. It is human, perhaps, to appreciate little that which we have and to long for that which we have not, but it is a great pity that in the world of light the gift of sight is used only as a mere conveniences rather than as a means of adding fullness to life.

有时我是如此渴望目睹这一切。仅凭触摸便能得到如此多的欢乐,若是能够亲眼望见,又将是多么地美好。然而视力正常的人们却什么也看不见,世界的五光十色、光怪陆离对他们来说只是理所应当的存在。也许人类的悲哀便在于此,拥有的东西不去珍惜,对于得不到的却永远渴望。在触得到光明的世界里,上天赋予的视力并非为已经很完美的生活锦上添花的手段,而只是一个便利,这真是太遗憾了。

If I were the president of a university I should establish a compulsory course in “How to Use Your Eyes”. The professor would try to show his pupils how they could add joy to their lives by really seeing what passes unnoticed before them. He would try to awake their dormant and sluggish faculties.

如果我是大学校长,我一定会开设必修课“如何使用你的眼睛”。教授们应该教导学生如何唤醒自己因沉睡已久而变得迟钝的感官,来抓住那些曾经无声流逝却不被重视的美好,从而使自己的生活更加幸福。

阅读全文 »
0%