判断手机有没有被root
2013年5月31日 16:53
原文链接
http://code.google.com/p/roottools/
if (RootTools.isRootAvailable()) { // your app has been granted root access } if (RootTools.isAccessGiven()) { // your app has been granted root access }
whenever执行时一直报错
2013年5月29日 21:35
在rails项目中使用使用whenever时,一直报各种找不到命令,如:zsh: command not found: Gemfile,等等等。。。。。。
查了好多资料,一直没解决,今天在unbuntu上新建了一个空项目能正常使用,于是把笔记本上的项目拷到ubuntu上,还是报错,/usr/bin/env :ruby.exe 找不到指令或文件,最开始没注意到,后来一看,ubuntu上怎么会用到exe?于是网上又查找,把项目中/script/rails文件中的#!/usr/bin/env ruby.exe修改成#!/usr/bin/env ruby,果然好了。原来的项目是在windows下生成的,所以才会有这种问题。真尼玛。
Mac上的项目执行whenever还是报错env: ruby: No such file or directory,不过手动执行脚本可以运行。
于是把/script/rails中的#!/usr/bin/env ruby 改成了 #!/Users/username/.rvm/rubies/ruby-1.9.3-p0/bin/ruby
Mac上也可以运行了。
这段时间记录的一些杂七杂八的笔记
2013年5月28日 17:06
ruby代码
1.upto 10 do |i| puts i if i==3..i==5 end
sql代码
--方法1 慢。。。。。 select postby,(select count(*) from articles where status=1 and postby=ar.postby) as art_num,(select count(*) from articles where status=1 and isgood=1 and postby=ar.postby) as goodart_num,title from articles as ar group by postby order by goodart_num desc,art_num desc limit 10 --方法2 快。。。。。 select postby,sum(case when status=1 then 1 else 0 end) as art_num,sum(case when status=1 and isgood=1 then 1 else 0 end) as goodart_num,title from articles group by postby order by goodart_num desc,art_num desc limit 10;
What's the difference between .bashrc, .bash_profile
2013年5月28日 10:26
/bin/bash The bash executable /etc/profile The systemwide initialization file, executed for login shells ~/.bash_profile The personal initialization file, executed for login shells ~/.bashrc The individual per-interactive-shell startup file ~/.bash_logout The individual login shell cleanup file, executed when a login shell exits ~/.inputrc Individual readline initialization file
Python and MongoDB: A Quick Reference to PyMongo
2013年5月23日 11:09
Installing the MongoDB Library
$ easy_install pymongo or # sudo easy_install pymongo
Importing the MongoDB Library
from pymongo import MongoClient
Connecting to MongoDB
client = MongoClient("192.168.1.1", 27017)
Selecting a Database
client = MongoClient("192.168.1.1", 27017) db_instance = client["database_name"]
The 100 Words That Will Get You Hired Anywhere
2013年3月07日 11:08
You should hire me because I will work harder than anyone else you’re going to talk to. On Sunday evenings I process all of my email and write out my goals for the week. I show up an hour before everyone else each morning to make the coffee and get my most important task for the day done. I spend as many lunches and breakfasts as possible with prospective or current clients. And I take the local train instead of the express so I can write thank you cards or notes to clients. That’s why you should hire me.