I am using SVN for my code management, and recently I needed to get only the files that where commited on a particular version. Looking around there was no straight way of doing this. But, this can be achived by the following steps.,
Get the list of files commited on a particular revision number.
svn log </local/svn/checkout/path/> -qv -r<revision_number> | awk '/\//{print $2}'
svn log /home/raja/coderepo/ -qv -r12423 | awk '/\//{print $2}'
Export the files one by one by specifying the filename & revision number explicitly.
svn export -r<revision_number> <repository_url> <target_directory>/<file_name>
svn export -r12423 http://svn.rajavarma.com/trunk/ /home/raja/svndump/r12423/myfile.php
Have wrapped the process in a simple PHP script which you can download svn.export.revision.files.php here.
A ‘daemon’ in Linux is program that runs continuously in the background without user intervention processing data.
For instance if we need to parse a log file, or process uploaded videos.
So we write a script and `fork` it separately as an individual process, this can be done in PHP using the Process Control Extensions. Getting a good grip on it, will take some studying. Though the time spent on it would be a valuable if you are in for a lot a heavy duty processing. The pcntl extensions are not available in PHP by default, you have to compile the CGI or CLI version of PHP with –enable-pcntl configuration option when compiling PHP to enable Process Control support.
An another way to run a script in background when pcntl functions are not available to you, would be by writing the script in a unconditional while loop. But make sure you have the logic to stop the process on failure within the loop.
while (1) {
//The complete process
if (condition_to_stop === true) {
break;
}
Then execute this from a control script. Start this a separate process redirecting all the out put to the void.
$processId = shell_exec("nohup /usr/bin/php process.php 1>/dev/null 2>&1 &");
Make sure you do not depend on any output printed in the screen by process.php, as in the above command we send all the output including the error’s into the /dev/null black hole.
A Web bug is an invisible 1×1 clear gif that is embedded in a web page or e-mail. These can be used in your emailers to track the actual views of your marketing mailers, capture user data on navigation patterns and high visit areas on your site.
Leave it to your imagination as to what to do with it.
We need the following list of operations in our tracker, for it to be of any use.
We need a appropriate p3p policy.
header("P3P: CP="NOI DSP COR NID ADMa OPTa OUR NOR"");
We need a transparent 1×1 pixel gif image.
//Image header
header("Content-Type: image/gif");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-cache");
header("Cache-Control: post-check=0, pre-check=0");
header("Pragma: no-cache");
//Image Data
$gifData = base64_decode("R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==") ;
echo $gifData;
When we have cleared this 2 points, we log the data we need.
On this script, we have a day wise table rotator, a new table will be created for every day.
The script is pretty much self descriptive.
So, go ahead and give it a try.
Download the Tracker Script here.