命运乎
你现在的生活是你三年前的选择和努力所决定的,而你现在的选择和努力又会决定你三年后的生活会是个什么样。
所以,你现在晚上加班到十点吃不上饭,没啥可抱怨的,你要为你三年前所荒废的时间付出代价;我们也没有必要更没有权利去同情可怜谁,这是他之前轻视自己生命的代价。
这就是命。
对过去的生活我们已无能为力,但是对我们以后的生活,我们还可以选择,还可以通过自己的努力去改变。你可以成为一个很成功的商人,或者是一个上市公司的 CXO,或者是你自己创业当老板,享受别人对你的一呼百应。
这同样是命。
不同的只是你对待他的态度。老天爷都是公平的,你得到多少,你就要失去多少;你享受多少,就要遭罪多少。
Memcache using notes
telnet 127.0.0.1 11211
Commands:
get/set/add/replace/append/prepend/incr/decr/delete
flush_all
stats
cmd_get 查询缓存操作,uptime 是运行秒数,cmd_get/uptime 是平均每秒请求缓存次数。
缓存命中率 = get_hits/cmd_get
Ubuntu 安装 Memcache 支持 Discuz X
安装 Memcached 和 php-memcache 模块:
sudo apt-get install memcached php5-memcache
默认安装后会自动在 php.ini 添加启用 extension=memcache.so
运行 memcached(-d启动守护进程,-m指定memcached内存):
memcached -d -u root -m 64 -l 127.0.0.1 -p 11211
重启 apache:
sudo /etc/init.d/apache2 restart
orsudo service apache2 restart
为安全起见可以先测试一下 memcache。
配置 Discuz! X 使用 Memcacha 内存优化,修改 config/config_global.php
$_config['memory']['memcache']['server'] = '127.0.0.1';
Done.
定时备份MySQL数据库到邮箱
照网上例子写了个 bash 脚本,自动备份 MySQL 数据库,并通过 mutt 发邮件到邮箱。
先设置 mutt:vim ~/.muttrc
set envelope_from=yes
set [email protected]
set realname="DBBackup"
set use_from=yes
Bash 脚本内容,vim back.sh
#!/bin/bash
date=date +%Y%m%d
mysqldump DBNAME -u USERNAME -pPASSWORD > /backup/$date.sql
tar czPf /backup/$date.tar.gz /backup/$date.sql
mutt -s "DBBackup" [email protected] -a /backup/$date.tar.gz < /backup/mailContent
rm -f /backup/$(date +%Y%m%d -d "5 days ago").sql
rm -f /backup/$(date +%Y%m%d -d "5 days ago").tar.gz
权限修改:chmod +x back.sh
更新 crontab:27 3 * * * root /back/back.sh
Sizes of iPhone UI Elements
Window (including status bar) -> 320 x 480px
Status Bar -> 20px
View inside window(visible status bar) -> 320 x 460px
Navigation Bar -> 44px
Nav Bar Image -> up to 20 x 20 px (transparent PNG)
Tab Bar -> 49px
Tab Bar Icon > up to 30 x 30 px (transparent PNG)
Text Field -> 31px
Height of a view inside a navigation bar -> 416px
Height of a view inside a tab bar -> 411px
Height of a view inside a nabber and a tab bar -> 367px
Portrait Keyboard height -> 216px
Landscape Keyboard height > 140px
References:
- Sizes of iPhone UI Elements
- The UIBarButtonItem Class Reference says “Typically, the size of a toolbar and navigation bar image is 20 x 20 points.”
- The UITabBarItem Class Reference says “The size of an tab bar image is typically 30 x 30 points.”
2010-10
各种不顺倒霉后,我赶到家,看了爷爷最后一眼,睡的很安静,没有吼人,反而有那么点不适应。回来之前接到爸的电话,说爷爷去了,我第一反应不是我没见着爷爷最后一面,是爷爷没能看一眼他的孙媳妇,爷爷最宠爱的大孙子的老婆,就差那么两天,爷爷等不了。
陪爸妈下地,跟小妹打闹,宠她惯她,紧着时间跟他们在一块,好想不离开家不工作,陪在他们跟前,粘着他们,也挺好。
陪爸妈到半夜,唠叨家里的房子,收成,村里的那些事儿,我们陪爸妈的时间太少了,也真的没有太多了。
妹说:哥,我只能再看你两天了,你又该走了… 那一瞬间,没哭,只流泪。
姐回去之前都不知道爷爷已经走了,大家都不想告诉她,让她开开心心的结婚;到家的那天,我不敢先回去,听爸说姐哭的一塌糊涂。
很巧,姐回门那天正好是爸的生日,爸的本命年。多少年没有在家给爸过生日了,爸,生日快乐,身体健康。
这个假期是这几年离开时我最难受的一个假期,爷爷的离去让我感到陪家人的时间确实太少,妹的懂事让我好不舍得,爸妈的劳累让我好想在家帮他们一把,分担一些,再好好照顾他们一下。
妞妞,五年前的十一,我们认识;三年前的十一,经历了那么多以后我们在一起;原本想今年十一订婚,画个分隔符,从此你是我的未婚妻,我是你的未婚夫,因为爷爷的突然离去,我们没有订婚。乖,你我都知道这只是个时间问题,也只是个形式问题,因为你已经是我的妻,我是你的夫。不管遇到什么,记住我会一直陪在你身边,我会每天都在老地方等你回来,每天通过彼此的那些小时间来记录我们的大幸福。我要你开开心心的,做我的新娘,孩子的妈,那个老婆子。
爷爷走了
2010-09-29 13:17
爷爷走了
他最喜欢的大孙子没能见他最后一面
他也没能看一眼他的孙媳妇
遗憾,是这个世界上最让人无法释怀的
Most commonly used commands in GDB Console
load program
Load the program into the target.
b main
Set a breakpoint in function main.
c
Continue after a breakpoint.
l
View a listing of the program.
n
Step one line (stepping over function calls).
s
Step one line (stepping into function calls).
info reg
View register values.
p xyz
Print the value of xyz data.
watch gvar1
Set Watchpoint on Global Variable gvar1.
Objective-C Notes
//string1 将被自动释放
NSString* string1 = [NSString string];
//必须在用完后手工释放
NSString* string2 = [[NSString alloc] init]; [string2 release];
Typically, each class gets two files: a header file that contains the @interface for the class and a dot-m file that holds the @implementation.
类的接口(interface)通常存放在类似ClassName.h的文件中,在这里,我们定义实例变量和公用(public)方法。
类的实现存放在ClassName.m这样的文件中,它包含了这些方法的实际实现代码。它通常还定义了客户类不能访问的私有(private)方法。
方法名字前面的单个减号(-)表明该方法是一个实例方法。如果方法名字前面是一个加号(+),则表明该方法是一个类(static)方法。
dealloc方法在一个对象从内存中删除时被调用。通常在这个方法里面释放所有对象里的实例变量。
Objective-C的内存管理是基于引用计数的。
一个实例变量的设置器(setter)会自动释放(autorelease)原来引用的对象,同时保留(retain)新的。你只需要保证在dealloc函数中释放 (release)了它就行了。
- When you create an object using new, alloc, or copy, the object has a retain count of 1. You are responsible for sending the object a release or autorelease message when you’re done with it. That way, it gets cleaned up when its useful life is over.
- When you get hold of an object via any other mechanism, assume it has a retain count of 1 and that it has already been autoreleased. You don’t need to do any further work to make sure it gets cleaned up. If you’re going to hang on to the object for any length of time, retain it and make sure to release it when you’re done.
- If you retain an object, you need to (eventually) release or autorelease it. Balance these retains and releases.
如果过你通过alloc或者copy创建了一个对象,在函数结尾的地方给它发送一个release或者autorelease消息就行了。如果你是通过其它方式创建的对象,就什么也别做。“If I get it from new, alloc, or copy, I have to release or autorelease it.”
类目允许你为一个已存在的类添加一些方法而不用子类化该类,也不需要你了解该类的实现细节。
@property (retain) NSString* caption;
@property 是Objective-C语言的一个指令,通过它声明属性。带括号的”retain”指示设置器(setter)要保留输入值,该行后面的是指定属性的类型以及名称。
@synthesize 指令为我们主动生成了setter和getter.
@class sets up a forward reference. This is a way to tell the compiler, “Trust me; you’ll learn eventually what this class is, but for now, this is all you need to know.”
The colored boxes next to the name indicate what the symbol is: E for an enumerated symbol, f for a function, # for a #define, m for a method, C for a class, and so on.
Chose File-Make Snapshot (or its handy shortcut, Command-Control-S) and Xcode will remember the state of your project.
#!/usr/bin/env python vs #!/usr/local/bin/python
#!/usr/bin/env python
Will figure out the correct location of python and make that as the interpreter for rest of the script.
#!/usr/local/bin/python
Pointing to python is located at /usr/local/bin/python.
简单说 /env python 就是查找系统环境变量中的 python 并默认选择 path 里第一个。/usr/local/bin/python 就是指定使用这个路径下的 python,可能不同机子不同环境下 python 位置稍有差别,就有可能 /usr/local/bin/python 不存在。
via Here