mysql>use mysql
mysql>update user set password=password("new_pass") where user="root";
mysql>flush privileges;
1,下载 http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
2.下载好以后解压,并移动文件的位置
sudo tarzxvf ./jdk-7-linux-i586.tar.gz -C /usr/lib/jvm
cd/usr/lib/jvm
将jvm 下的文件夹名称改为 java-7-sun
Alt+F2
: 快速打开搜索栏。
Alt+Tab
: 不同应用之间的切换,选中某一个,再Alt+~
即可放大当前栏目。
下载了Sublime Text 之后,我们需要建立一个快捷命令
sudo mv Sublime\ Text\ 2 /opt/
sudo ln -s /opt/Sublime\ Text\ 2/sublime_text /usr/bin/sublime
共同点在于:都有 ToUserName,FromUserName,CreateTime,MsgType, 这四个字段。
在信息接收方面,分为“普通消息”、“事件推送”,“语音识别结果(微信用户发送语音,微信服务器翻译成文本,只不过比语音消息多一个识别结果字段:Recognition)”。
- 文本消息(通过“Content”关键字来获取文本内容,这点比较重要,也是使用比较多的场合)
- 图片消息
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ApplicationController < ActionController::Base | |
... | |
#Problem: | |
#In rails 3.0.1+ it is no longer possible to do this anymore; | |
# rescue_from ActionController::RoutingError, :with => :render_not_found | |
# | |
#The ActionController::RoutingError thrown is not caught by rescue_from. | |
#The alternative is to to set a catch-all route to catch all unmatched routes and send them to a method which renders an error | |
#As in http://techoctave.com/c7/posts/36-rails-3-0-rescue-from-routing-error-solution |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fork 了某个开源项目,发了PR后,需要更新master的代码的做法: | |
git remote add --track master upstream git://github.com/upstreamname/projectname.git | |
git fetch upstream | |
git merge upstream/master | |
注意:upstream 是定义名称。 |
In August 2007 a hacker found a way to expose the PHP source code on facebook.com. He retrieved two files and then emailed them to me, and I wrote about the issue:
http://techcrunch.com/2007/08/11/facebook-source-code-leaked/
It became a big deal:
http://www.techmeme.com/070812/p1#a070812p1
The two files are index.php (the homepage) and search.php (the search page)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Dragon; end | |
# 使用 def 定義 class method | |
Dragon.instance_eval do | |
def foo | |
puts "bar" | |
end | |
end | |
Dragon.foo # bar |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Comments start with semicolons. | |
; Clojure is written in "forms", which are just | |
; lists of things inside parentheses, separated by whitespace. | |
; | |
; The clojure reader assumes that the first thing is a | |
; function or macro to call, and the rest are arguments. | |
; | |
; Here's a function that sets the current namespace: | |
(ns test) |