- difference between caches_page and caches_action: the former just caches the page content to a file, the latter called some before filters in the action before do the cache ( the action itself won’t be called, just its before filters).
- expire_page, expire_action
true( be careful if you are in development env; it will do the cache and your action change will NOT have effect immediately. I would set it to be false in development env.)
An integrated development environment (IDE) or interactive development environment is a software application that provides comprehensive facilities to computer programmers for software development. An IDE normally consists of a source code editor, build automation tools and a debugger. Several modern IDEs integrate with Intelli-sense coding features.
Some IDEs contain a compiler, interpreter, or both, such as Microsoft Visual Studio and Eclipse; others do not, such as SharpDevelop and Lazarus. The boundary between an integrated development environment and other parts of the broader software development environment is not well-defined. Sometimes a version control system and various tools are integrated to simplify the construction of a GUI. Many modern IDEs also have a class browser, an object inspector, and a class hierarchy diagram, for use with object-oriented software development.
sublime editor : http://www.sublimetext.com/
Sublime Text is a cross-platform text and source code editor, with a Python API. The chrome was inspired by Vim. Its functionality is also extendable with sublime-packages; Sublime Text is not open source software nor free software, but some of the extending packages have free-software licenses and are community-built and maintained.
Malware, short for malicious (or malevolent) software, is software used or programmed by attackers to disrupt computer operation, gather sensitive information, or gain access to private computer systems. It can appear in the form of code, scripts, active content, and other software. ‘Malware’ is a general term used to refer to a variety of forms of hostile or intrusive software
If you have access to a Mac or Linux server, chances are you may already have a really simple http load generating tool installed called Apache Bench, or ab. If you are on windows and have Apache installed, you may also have ab.exe in your apache/bin folder.
Suppose we want to see how fast Yahoo can handle 100 requests, with a maximum of 10 requests running concurrently:
ab -n 100 -c 10 http://www.yahoo.com/
It will then generate output as follows:
Concurrency Level: 10
Time taken for tests: 1.889 seconds
Complete requests: 100
Failed requests: 0
Write errors: 0
Total transferred: 1003100 bytes
HTML transferred: 949000 bytes
Requests per second: 52.94 [#/sec] (mean)
Time per request: 188.883 [ms] (mean)
Time per request: 18.888 [ms] (mean, across all concurrent requests)
Transfer rate: 518.62 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 57 59 1.7 59 64
Processing: 117 126 7.5 124 162
Waiting: 57 62 7.0 60 98
Total: 175 186 8.0 184 224
Percentage of the requests served within a certain time (ms)
100% 224 (longest request)
As you can see this is very useful information, it returned requests at a rate of 52.94 requests per second, the fastest request was 175ms, the slowest 224ms
So the next time you are tempted to whip out cfloop and GetTickCount to do some benchmarking on a piece of code, give ab a try, it’s easy to use, and will yield much more realistic results.
Because ab supports concurrency, this has two big advantages over cfloop. The main one is that it allows you to test how your code runs concurrently, this can help you identify any possible race conditions, or locking issues. Concurrent requests are also a more natural simulation of load than loops.
Suppose you wanted to test multiple url’s concurrently as well? You can do this by creating a shell script, with multiple ab calls. At the end of each line place an & this makes the command run in the background, and lets the next command start execution. You will also want to redirect the output to a file for each url using > filename For example:
define your own way to marshal
calling Marshal.dump(Myobj.new(“name”, “v”, “data”)) will call the marshal_dump method in the Myobj class
class MyObj def initialize name, version, data @name = name @version = version @data = data end def marshal_dump [@name, @version] end def marshal_load array @name, @version = array end end
- why git?
- git features
- most operation is local, no need to connect to server
- create a new branch and switch between branches is cheap
- easy to share
- deal with untracked files
- whitelist = a list of things to include; blacklist = a list of things to exclude
- Don’t use git merge, use rebase if you want to sync...
- git commands
- git commit is to commit your change to your LOCAL repository
- git commit -a will commit all files you changed (new files won’t be added)
- git remote show origin check which local brach push to or pull from remote branch
- git branch -vv check local branch version
- git reset –hard HEAD delete last commit from local repository, making local repository pointing to last commit
- git branch -d branch_name delete the branch you are done with
git reset HEAD fileunstage a file (undo git add file)
- git rebase –interactive HEAD~n squash the first n commits into one, you need to change “pick” to “s” ; see a very clear explanation here http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html
- git remote show origin show the origin from which the local reposity is cloned
- git rebase another_branch replay the changes on another_branch to current branch
rebasecommand, you can take all the changes that were committed on one branch and replay them on another one. see http://git-scm.com/book/en/Git-Branching-Rebasing (Note that your current branch will still have the change made already, it is not a copy of another_branch)
- git pull –rebase make local repository to be synced from remote repository ( do this when you have msg like “Your branch is ahead of ‘master’ by 1 commit “)
Rebase the current branch on top of the upstream branch after fetching