| Subcribe via RSS

Viagra online
XANAXadderall onlineLevitraPuppies for sale

Read XML Files from Directory & Process

March 16th, 2010 | No Comments | Posted in Linux, PHP Snippets

Read files in a directory. Ignore hidden files. Processed XML based on first couple characters of file name.

 
$xmlDirectory = opendir($this->xml_dir);
while($entryName = readdir($xmlDirectory)) {
	$dirArray[] = $entryName;
}
closedir($xmlDirectory);
 
$indexCount	= count($dirArray);
//Print ("$indexCount files<br>\n");
sort($dirArray);
for($index=0; $index < $indexCount; $index++) {
	if (substr("$dirArray[$index]", 0, 1) != "."){ // don't list hidden files
		if(substr("$dirArray[$index]", 0, 4)=='some'){
			$this->somefiletype_path= $this->xml_dir.$dirArray[$index];
			$this->doSomething();
		}else{
			//do something else
		}
	}
}
 
Tags: , , ,

Cron Jobs in Linux through SSH

March 11th, 2010 | No Comments | Posted in Linux

Moving to Mac means finally losing PUTTY for the native Terminal.

1. Login:

 
ssh myuser@mydomain.com
 

2. Edit crontab:

 
crontab -e
 

3. Add 1 or more cron jobs:

 
10 */2 * * * /var/www/html/somedir/?c=import
10 */14 * * * /var/www/html/somedir/?c=import
 

4. Save: Use keystrokes ctrl + e
5. Type "y" to accept changes
6. Ignore next screen and just click Enter
7. Check to see if new job is listed:

 
crontab -l
 

Here's a quick format reference:
at that interval.
* * * * * command to be executed
- - - - -
| | | | |
| | | | +----- day of week (0 - 6) (Sunday=0)
| | | +------- month (1 - 12)
| | +--------- day of month (1 - 31)
| +----------- hour (0 - 23)
+------------- min (0 - 59)

Tags: , , , ,

Remote Directory Access on Linux

March 5th, 2009 | No Comments | Posted in Linux

The path:

 
http://username:passowrd@domain.com/directory/
 

.htaccess should look something like:

 
AuthName "Password Protected Area"
AuthType Basic
AuthUserFile /usr/local/webpassword/wp001.dat
Require valid-user
Options +Indexes