gradle faile to sync

有一阵子没用一台Linux机器上的开发环境,gradle在同步时报”Broken Pipe”.

还是stackoverflow上的答案靠谱:

1
2
iptables -t nat -F
echo 0 > /proc/sys/net/ipv4/ip_forward

该解决这个IllegalStateException的问题了

水手放映室 偶尔会遭遇这个问题:

1
2
3
4
5
6
java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
at android.support.v4.app.FragmentManagerImpl.checkStateLoss(FragmentManager.java:1365)
at android.support.v4.app.FragmentManagerImpl.enqueueAction(FragmentManager.java:1383)
at android.support.v4.app.BackStackRecord.commitInternal(BackStackRecord.java:636)
at android.support.v4.app.BackStackRecord.commit(BackStackRecord.java:615)
at com.crixmod.sailorcast.view.AlbumDetailActivity$3.run(AlbumDetailActivity.java:343)

这个错误造成的原因是因为在异步的网络请求返回后操作了fragment的commit。该请求返回时可能当前的activity已经在Pause或者Stop状态了,就会报这个状态不一致的异常。详细解释参见:
http://www.androiddesignpatterns.com/2013/08/fragment-transaction-commit-state-loss.html

准备参考 http://stackoverflow.com/questions/8040280/how-to-handle-handler-messages-when-activity-fragment-is-paused 这篇文章来解决一下这个问题。

git force push

如下命令可以强行push当前的版本库到远程,github上的将会被覆盖

1
git push -u git@github.com:fire3/fire3.github.io.git master:master --force

kernel定时炸弹

这个需求很bt,在内核中给客户埋一个定时炸弹。在适当的时间段,检测系统时间,如果发现当前时间已经是某一天,boom,核心panic。

more >>

vim submodules

最近开始用submodule管理vim插件,但是有一个烦人的事情:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
fire3@fire3-Lenovo:~/.vim$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
(commit or discard the untracked or modified content in submodules)
modified: bundle/CuteErrorMarker (untracked content)
modified: bundle/OmniCppComplete (untracked content)
modified: bundle/VisIncr (untracked content)
modified: bundle/autoclose (untracked content)
modified: bundle/javacomplete (untracked content)
modified: bundle/matchit (untracked content)
modified: bundle/snipmate-snippets (modified content)
modified: bundle/vim-multiple-cursors (untracked content)
modified: bundle/xmledit (untracked content)
modified: bundle/yankring (untracked content)
no changes added to commit (use "git add" and/or "git commit -a")

出现了很多modified状态。仔细一看都是生成了doc/tags文件。解决方法:

1
2
3
4
$ vim ~/.gitignore
doc/tags
$ git config --global core.excludesfile ~/.gitignore

当然,也可以选择无视,呵呵。