tips Archive

0

Mysql innodb ibdata文件瘦身

转载请注明出处: http://www.liubida.com/uncategorized/mysql_innodb_ibdata_file/

今天给开机之后ubuntu更新, 竟然提示说磁盘空间满. df一看, 根目录只有不到190MB. 但是根目录没道理用的这么快, 于是检查下, 看看是哪个文件占用了大量的磁盘. 如果有必要, 以下命令可能需要加上sudo.

du -m –max-depth=1 | sort -g
du -h –max-depth=1 /var/*

层层递进之后发现是因为mysql目录下的ibdata文件太大, 竟然就占用了5G大小, 用了很长时间, 也是该清理下了. 思路很简单, 就是先备份数据库, 然后删除, 再还原数据库就行了.

# 备份数据库
mysqldump -uDBuser -pPassword –quick –force –routines –add-drop-database –all-databases –add-drop-table > /home/liubida/backup.sql

# 关闭mysql服务
sudo service mysql stop

# 手动删除除mysql之外所有文件
sudo rm /var/lib/mysql/ib*
sudo rm /var/lib/mysql/armory -rf

# 启动mysql服务
sudo service mysql start

# 还原数据库
mysql -uDBuser -pPassword < /home/liubida/backup.sql

最后, 看看根目录的变化吧. Read the rest of this entry »

1

在eclipse中查看android源码

开发android不能看到源码实在是一件非常不爽的事情, 不过要把android的源码attacht到eclipse里也不是那么的容易. (真不知道google是怎么想的, 把这个东西搞的这么麻烦..).所以得空的时候, 花了点时间, 把源码这货给搞定了. 需要提醒的是,这活对网络要求很高, 源码下载大概得2-3G, 所以您要是网络不太好, 推荐您在晚上睡觉前开始做这事儿, 一个晚上应该能下完.

大致的环境:
eclipse: Indigo
os: ubuntu11.04(32bit)

需要预装的命令包:
git : sudo apt-get install git-core

1. 先到android source上下载源码包命令很简单, 照做就行.

“To check out a branch other than “master”, specify it with -b:
$ repo init -u https://android.googlesource.com/platform/manifest -b android-4.0.1_r1″

这个命令的意思是去下载android-4.0.1_r1分支, 而不是从主干(master)上下东西. 具体查看每个分支的名字, 可以这样点这里.
如果这个步骤还不是很清楚, 可以参看这个post http://android.yaohuiji.com/archives/2652

执行 “$ repo init -u https://android.googlesource.com/platform/manifest -b android-4.0.1_r1″时
要进入你要下载的目的文件夹($DEST)里面, 不然会载的满地都是. 下载的时候会提示你输入用户名, 邮箱之类的, 按部就班即可.

2.下载完成之后, 在你的$DEST目录下就会有若干的文件夹, dalvik, bootable之类的, 这些就是android的源文件了, 有底层的cpp, 也有应用层的java. 但是我们需要的java散落在各个目录下, 如何整理起来使之能够attach到eclipse上呢?
这里, 作者写了个python脚本, 能够按照包名来抓取所需的java文件. Read the rest of this entry »

0

查看android源码的branch列表

Following directions on Android’s main website to pull down sources, I’m looking at this command to initialize repo for the cupcake branch:
repo init -u git://android.git.kernel.org/platform/manifest.git -b cupcake

How can I view all available branches besides cupcake, i.e eclair, donut, etc…?
$ git clone git://android.git.kernel.org/platform/manifest.git
$ cd manifest
$ git branch -r

来自这里

0

httpd: Could not reliably determine the server’s fully qualified domain name, using 127.0.0.1 for ServerName

httpd: Could not reliably determine the server’s fully qualified domain name, using 127.0.0.1 for ServerName

启动APACHE时出现的提示:
httpd: Could not reliably determine the server’s fully qualified domain name, using 127.0.0.1 for ServerName

解决办法:只要把/conf/httpd.conf文件的#ServerName 前的#去掉,然后重启下服务就好了。

httpd.conf的内容:
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn’t have a registered DNS name, enter its IP address here.
#
ServerName 127.0.0.1:80

感谢他们:
http://yinqingsong520.blog.163.com/blog/static/3921002009663949562
http://hi.baidu.com/zeldady/blog/item/93153533a64fe9f41a4cffe9.html