f



Recursive delete of directory - Directory not empty error

I'm trying to remove a directory and all its contents from within a
script.  I wrote a recursive function to take care of it, but when I
run it I get random "Directory not empty" error messages.

I dropped some code in to echo out the name of the file that's about
to be rmdir()ed or unoink()ed (depending if it's a file or a
directory) to see if it was choking on a particular subdirectory, but
doing that causes all the error messages to stop appearing!

It looks to me as if at some stages of the script the delete commands
are being issued too rapidly and the result is that an attempt to
delete a parent is made before its children have all been deleted.
The code I added to echo out the directory name first probably
introduces just enough of a delay for this problem to go away.

Obviously just doing something in the function to cause a delay isn't
a good solution, is there a better way of handling this problem?

I'm running PHP 5 on a Windows development machine through Apache.
Directory listings are being retrieved from a database.
0
gordon.mcvey (380)
4/14/2008 4:14:44 PM
comp.lang.php 32646 articles. 0 followers. Post Follow

8 Replies
786 Views

Similar Articles

[PageSpeed] 42

Gordon wrote:
> I'm trying to remove a directory and all its contents from within a
> script.  I wrote a recursive function to take care of it, but when I
> run it I get random "Directory not empty" error messages.
>
> I dropped some code in to echo out the name of the file that's about
> to be rmdir()ed or unoink()ed (depending if it's a file or a
> directory) to see if it was choking on a particular subdirectory, but
> doing that causes all the error messages to stop appearing!
>
> It looks to me as if at some stages of the script the delete commands
> are being issued too rapidly and the result is that an attempt to
> delete a parent is made before its children have all been deleted.
> The code I added to echo out the directory name first probably
> introduces just enough of a delay for this problem to go away.
>
> Obviously just doing something in the function to cause a delay isn't
> a good solution, is there a better way of handling this problem?
>
> I'm running PHP 5 on a Windows development machine through Apache.
> Directory listings are being retrieved from a database.

Damn it. I started looking at your problem and my crystal ball went down!

Maybe someone else's crystal ball is still working and they can see you 
code. 


0
paul.lautman (522)
4/14/2008 9:04:03 PM
On Apr 14, 10:04 pm, "Paul Lautman" <paul.laut...@btinternet.com>
wrote:
> Gordon wrote:
> > I'm trying to remove a directory and all its contents from within a
> > script.  I wrote a recursive function to take care of it, but when I
> > run it I get random "Directory not empty" error messages.
>
> > I dropped some code in to echo out the name of the file that's about
> > to be rmdir()ed or unoink()ed (depending if it's a file or a
> > directory) to see if it was choking on a particular subdirectory, but
> > doing that causes all the error messages to stop appearing!
>
> > It looks to me as if at some stages of the script the delete commands
> > are being issued too rapidly and the result is that an attempt to
> > delete a parent is made before its children have all been deleted.
> > The code I added to echo out the directory name first probably
> > introduces just enough of a delay for this problem to go away.
>
> > Obviously just doing something in the function to cause a delay isn't
> > a good solution, is there a better way of handling this problem?
>
> > I'm running PHP 5 on a Windows development machine through Apache.
> > Directory listings are being retrieved from a database.
>
> Damn it. I started looking at your problem and my crystal ball went down!
>
> Maybe someone else's crystal ball is still working and they can see you
> code.

I am trying to trim the code down to what's pertinant, but there are a
few classes involved.  Please bear with me a moment.
0
gordon.mcvey (380)
4/15/2008 8:46:47 AM
On Apr 14, 10:04 pm, "Paul Lautman" <paul.laut...@btinternet.com>
wrote:
> Gordon wrote:
> > I'm trying to remove a directory and all its contents from within a
> > script.  I wrote a recursive function to take care of it, but when I
> > run it I get random "Directory not empty" error messages.
>
> > I dropped some code in to echo out the name of the file that's about
> > to be rmdir()ed or unoink()ed (depending if it's a file or a
> > directory) to see if it was choking on a particular subdirectory, but
> > doing that causes all the error messages to stop appearing!
>
> > It looks to me as if at some stages of the script the delete commands
> > are being issued too rapidly and the result is that an attempt to
> > delete a parent is made before its children have all been deleted.
> > The code I added to echo out the directory name first probably
> > introduces just enough of a delay for this problem to go away.
>
> > Obviously just doing something in the function to cause a delay isn't
> > a good solution, is there a better way of handling this problem?
>
> > I'm running PHP 5 on a Windows development machine through Apache.
> > Directory listings are being retrieved from a database.
>
> Damn it. I started looking at your problem and my crystal ball went down!
>
> Maybe someone else's crystal ball is still working and they can see you
> code.

On Apr 14, 10:04 pm, "Paul Lautman" <paul.laut...@btinternet.com>
wrote:
> Gordon wrote:
> > I'm trying to remove a directory and all its contents from within a
> > script.  I wrote a recursive function to take care of it, but when I
> > run it I get random "Directory not empty" error messages.
>
> > I dropped some code in to echo out the name of the file that's about
> > to be rmdir()ed or unoink()ed (depending if it's a file or a
> > directory) to see if it was choking on a particular subdirectory, but
> > doing that causes all the error messages to stop appearing!
>
> > It looks to me as if at some stages of the script the delete commands
> > are being issued too rapidly and the result is that an attempt to
> > delete a parent is made before its children have all been deleted.
> > The code I added to echo out the directory name first probably
> > introduces just enough of a delay for this problem to go away.
>
> > Obviously just doing something in the function to cause a delay isn't
> > a good solution, is there a better way of handling this problem?
>
> > I'm running PHP 5 on a Windows development machine through Apache.
> > Directory listings are being retrieved from a database.
>
> Damn it. I started looking at your problem and my crystal ball went down!
>
> Maybe someone else's crystal ball is still working and they can see you
> code.

I was hoping the problem would be generic enough (trying to
recursively delete a directory) that someone else would have already
run into this problem and found a solution, but no search on either
thr group or Google turned anything up, the only thing my code is
doing that's significantly different from the other recursive delete
examples I've found is that it's using a database to fetch subdirs
instead of filesystem functions.

abstract class CmsItem
{
	const		TYPE_SITE			= 0x1;
	const		TYPE_DIR			= 0x2;
	const		TYPE_DOC			= 0x4;
	const		TYPE_ASSET			= 0x8;
	const		TYPE_TEMPLATE		= 0x40000000;
	const		TYPE_TRASH			= -0x80000000;	// Negative because postgress
doesn't have an unsigned int type

	protected	$database			= NULL;
	protected	$user				= NULL;

	public		$itemProps			= array (
		'itm_id'		=> 0,
		'itm_type'		=> 0,
		'itm_parent' 	=> 0,
		'tpl_id' 		=> 0,
		'itm_title' 	=> '',
		'itm_path'		=> '',
		'itm_summary'	=> '',
		'itm_keywords'	=> '',
		'itm_notes'		=> ''
	);

	abstract protected function getItem ($id);
	public static function factory ($className, $id, Database $dbHandle,
CmsUser $user = NULL)
	{
		// Create new item
		$newItem	= new $className ($id, $dbHandle, $user);
		// Fail if an ID was specified but no item state was returned
		if (($id) && (!($newItem -> itemProps ['itm_id'])))
		{
			$newItem	= NULL;
		}
		return ($newItem);
	}
	protected function pathToUrl ($path = NULL, $type = NULL)
	{
		if ($path === NULL)
		{
			$path	= $this -> itemProps ['itm_fullpath'];
		}
		if ($type === NULL)
		{
			$type	= $this -> itemProps ['itm_type'];
		}
		$url	= 'http://';
		if ($type == self::TYPE_SITE)
		{
			// For sites the URL is the same as the fullpath
			$url	.=  $path . '/';
		}
		else
		{
			// Insert the prefix into the full path value and use as the URL
			$url
			.= substr ($path, 0, strpos ($path, '/'))
			. CFG_CONTENT_URL_PREFIX
			. substr ($path, strpos ($path, '/'));
		}
		// Folders should get a trailing slash
		if ($type == self::TYPE_DIR)
		{
			$url	.= '/';
		}
		return ($url);
	}
	protected function spawn ($id, $type)
	{
		switch ($type)
		{
			case	self::TYPE_SITE		:	$className	= 'CmsSite';		break;
			case	self::TYPE_DIR		:	$className	= 'CmsDir';			break;
			case	self::TYPE_DOC		:	$className	= 'CmsDoc';			break;
			case	self::TYPE_ASSET	:	$className	= 'CmsAsset';		break;
			case	self::TYPE_TEMPLATE	:	$className	= 'CmsTemplate';	break;
			//case	self::TYPE_TRASH	:	$className	= 'CmsTrash';		break;
			default						:
			break;
		}
		//echo ('id: '.$id.' type: '.$type.' ClassName: '.$className."<br>
\n");
		if ($className)
		{
			return (self::factory ($className, $id, $this -> database, $this ->
user));
		}
	}
	public function getChildren ($showSys = NULL, $showPub = NULL,
$showDel = 'FALSE')
	{
		// prepare query and arguments
		$id = $this -> itemProps ['itm_id'];
		$params []	= $id;
		$query	=	'SELECT *
					FROM cms_v_items
					WHERE itm_parent = ? ';
		// Handle the case where the showSys string has been set
		if ($showSys)
		{
			$params []	= $showSys;
			$query	.=	'AND itm_system = ? ';
		}
		// Handle the case where the showPub string has been set
		if ($showPub)
		{
			$params []	= $showPub;
			$query	.=	'AND
						(
							itm_publish = ?
							OR itm_type != ' . intval (self::TYPE_DOC) . '
						)';
		}
		$query	.=	'ORDER BY itm_system DESC, itm_type, itm_sort, itm_path;';
		$preparedQuery	= $this -> database -> prepare ($query);
		// Get child items
		//if ($preparedQuery -> execute (array ($id)))
		if ($row = $preparedQuery -> ask ($params))
		{
			//while ($thisRow = $preparedQuery -> fetch (PDO::FETCH_ASSOC))
			foreach ($row as $thisRow)
			{
				//print_r ($thisRow);
				$thisRow ['itm_date_create']	= strtotime ($thisRow
['itm_date_create']);
				$thisRow ['itm_date_modify']	= strtotime ($thisRow
['itm_date_modify']);
				$thisRow ['itm_fullpath']		= $this -> itemProps ['itm_fullpath'] .
'/' . $thisRow ['itm_path'];
				$thisRow ['itm_url']			= $this -> pathToUrl ($thisRow
['itm_fullpath'], $thisRow ['itm_type']);
				$result []	= $thisRow;
			}
			return ($result);
		}
	}
	public function getChildObjects ($showSys = NULL, $showPub = NULL,
$showDel = 'FALSE')
	{
		if ($childList = $this -> getChildren ($showSys, $showPub))
		{
			$objectArr	= array ();
			foreach ($childList as $thisChild)
			{
				$objectArr []	= $this -> spawn ($thisChild ['itm_id'], $thisChild
['itm_type']);
			}
			return ($objectArr);
		}
	}
	public function deleteItem ()
	{
		// Following line added for debugging but it caused the problem to
disappear!
		echo ($this -> itemProps ['itm_fullpath'].'<br>');
		$query	=	'DELETE FROM cms_items
					WHERE itm_id = ?;';
		$preparedQuery	= $this -> database -> prepare ($query);
		// Delete item
		return (($preparedQuery -> tell (array ($this -> itemProps
['itm_id']))) == 1);
	}
}


class CmsDir extends CmsItem
{
	public function deleteItem ($deleteFile = true)
	{
		$error	= false;
		$this -> database -> beginTransaction ();
		// Deal with any child nodes this directory might hold
		if ($children	= $this -> getChildObjects ())
		{

			foreach ($children as $thisChild)
			{
				if (!$thisChild -> deleteItem ($deleteFile))
				{
					$error	= true;
					break;
				}
			}
		}
		// If child nodes were successfully handled then remove the
directory itself
		if (!$error)
		{
			if (parent::deleteItem ())
			{
				// Deal with the actual directory
				$this -> uncache ();
				if ((!deleteFile)
				|| (!file_exists (CFG_CONTENT_ROOT . '/' . $this -> itemProps
['itm_fullpath']))
				|| (rmdir (CFG_CONTENT_ROOT . '/' . $this -> itemProps
['itm_fullpath'])))
				{
					clearstatcache ();
					$this -> database -> commit ();
					return (true);
				}
				else
				{
					// Something went wrong removing the directory
					$this -> database -> rollback ();
				}
			}
			else
			{
				// Error occured deleting the database record
				$this -> database -> rollback ();
			}
		}
		else
		{
			// Error occured deleting children
			$this -> database -> rollback ();
		}
	}
	public function uncache ()
	{
		$path		= CFG_CONTENT_ROOT . '/' . $this -> itemProps
['itm_fullpath'] . '/' . CFG_DIR_INDEXFILE;
		$success	=  ((!file_exists ($path))
		|| (unlink ($path)));
		clearstatcache ();
		return ($success);
	}
}
0
gordon.mcvey (380)
4/15/2008 9:48:18 AM
Gordon escribi�:
> I'm trying to remove a directory and all its contents from within a
> script.  I wrote a recursive function to take care of it, but when I
> run it I get random "Directory not empty" error messages.

In the manual page for unlink() there's a user comment with sample code 
for recursive deletion. I haven't tried it but who knows:

http://php.net/unlink




-- 
-- http://alvaro.es - �lvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programaci�n web: http://bits.demogracia.com
-- Mi web de humor al ba�o Mar�a: http://www.demogracia.com
--
0
4/15/2008 12:32:09 PM
�lvaro G. Vicario wrote:
> Gordon escribi�:
>> I'm trying to remove a directory and all its contents from within a
>> script.  I wrote a recursive function to take care of it, but when I
>> run it I get random "Directory not empty" error messages.
> 
> In the manual page for unlink() there's a user comment with sample code 
> for recursive deletion. I haven't tried it but who knows:
> 
> http://php.net/unlink
> 
> 
> 
> 
Normally thats because there are hidden or wrong permission files in it.

I suspect you need more subtle code, and if in Linux etc, some form of 
attention to permissions if these are the problem.
0
The
4/15/2008 1:28:11 PM
On Apr 15, 2:28 pm, The Natural Philosopher <a...@b.c> wrote:
> =C1lvaro G. Vicario wrote:
> > Gordon escribi=F3:
> >> I'm trying to remove a directory and all its contents from within a
> >> script.  I wrote a recursive function to take care of it, but when I
> >> run it I get random "Directory not empty" error messages.
>
> > In the manual page for unlink() there's a user comment with sample code
> > for recursive deletion. I haven't tried it but who knows:
>
> >http://php.net/unlink
>
> Normally thats because there are hidden or wrong permission files in it.
>
> I suspect you need more subtle code, and if in Linux etc, some form of
> attention to permissions if these are the problem.

I don't think permissions are the problem, because the development
machine is Windows, and the error message being given is Directory Not
Empty.  No Permission Denied errors are popping up in the output.  I
also mentioned that the problem went away when I introduced a line of
code for debugging purposes into CmsItem::deleteItem(), which echos
the path being deleted to the output.  My suspicion is that the calls
to rmdir are happening more rapidly than the filesystem can cope with
them.  The debug code introduced just enough of a delay for the code
to work properly but without it attempts to delete a parent directory
can occur before the deletion of its children has completed, causing
the not empty error.
0
gordon.mcvey (380)
4/15/2008 2:02:57 PM
Gordon wrote:
> On Apr 15, 2:28 pm, The Natural Philosopher <a...@b.c> wrote:
>> �lvaro G. Vicario wrote:
>>> Gordon escribi�:
>>>> I'm trying to remove a directory and all its contents from within a
>>>> script.  I wrote a recursive function to take care of it, but when I
>>>> run it I get random "Directory not empty" error messages.
>>> In the manual page for unlink() there's a user comment with sample code
>>> for recursive deletion. I haven't tried it but who knows:
>>> http://php.net/unlink
>> Normally thats because there are hidden or wrong permission files in it.
>>
>> I suspect you need more subtle code, and if in Linux etc, some form of
>> attention to permissions if these are the problem.
> 
> I don't think permissions are the problem, because the development
> machine is Windows, and the error message being given is Directory Not
> Empty.  No Permission Denied errors are popping up in the output.  I
> also mentioned that the problem went away when I introduced a line of
> code for debugging purposes into CmsItem::deleteItem(), which echos
> the path being deleted to the output.  My suspicion is that the calls
> to rmdir are happening more rapidly than the filesystem can cope with
> them.  The debug code introduced just enough of a delay for the code
> to work properly but without it attempts to delete a parent directory
> can occur before the deletion of its children has completed, causing
> the not empty error.

Ah. Caching.

I've had a similar problem with PHP creating a file that didn't actually 
exist on disk till PHP exited.


So your are suggesting that PHP doesn't actually delete the files until 
after the call to unlink the directory is received?

I would NOT be surprised. PHP'S file handling seems to be a bit flaky in 
this area.


Windows should be capable of processing the calls as fast as they can be 
sent: IT *should* simply block if the directory is still busy.

My guess - and its only a guess - is that PHP itself is caching the file 
deletes. But not the directory deletes.

Or spitting them out in random order.

Maybe its possible to force a buffer flush in PHP.
0
The
4/15/2008 2:27:53 PM
On Apr 15, 3:27 pm, The Natural Philosopher <a...@b.c> wrote:
> Gordon wrote:
> > On Apr 15, 2:28 pm, The Natural Philosopher <a...@b.c> wrote:
> >> =C1lvaro G. Vicario wrote:
> >>> Gordon escribi=F3:
> >>>> I'm trying to remove a directory and all its contents from within a
> >>>> script.  I wrote a recursive function to take care of it, but when I
> >>>> run it I get random "Directory not empty" error messages.
> >>> In the manual page for unlink() there's a user comment with sample cod=
e
> >>> for recursive deletion. I haven't tried it but who knows:
> >>>http://php.net/unlink
> >> Normally thats because there are hidden or wrong permission files in it=
..
>
> >> I suspect you need more subtle code, and if in Linux etc, some form of
> >> attention to permissions if these are the problem.
>
> > I don't think permissions are the problem, because the development
> > machine is Windows, and the error message being given is Directory Not
> > Empty.  No Permission Denied errors are popping up in the output.  I
> > also mentioned that the problem went away when I introduced a line of
> > code for debugging purposes into CmsItem::deleteItem(), which echos
> > the path being deleted to the output.  My suspicion is that the calls
> > to rmdir are happening more rapidly than the filesystem can cope with
> > them.  The debug code introduced just enough of a delay for the code
> > to work properly but without it attempts to delete a parent directory
> > can occur before the deletion of its children has completed, causing
> > the not empty error.
>
> Ah. Caching.
>
> I've had a similar problem with PHP creating a file that didn't actually
> exist on disk till PHP exited.
>
> So your are suggesting that PHP doesn't actually delete the files until
> after the call to unlink the directory is received?
>
> I would NOT be surprised. PHP'S file handling seems to be a bit flaky in
> this area.
>
> Windows should be capable of processing the calls as fast as they can be
> sent: IT *should* simply block if the directory is still busy.
>
> My guess - and its only a guess - is that PHP itself is caching the file
> deletes. But not the directory deletes.
>
> Or spitting them out in random order.
>
> Maybe its possible to force a buffer flush in PHP.

Yes, I'm caching database-stored content to disk as HTML in a
directory structure so only the first view of a page causes the actual
script to run, do the DB lookup, build the page and all the other time-
consuming jobs involved in presenting the content to the user (My 404
page is actually a PHP script that takes care of all this).

Like you said, I think that PHP is simply dispatching filesystem
commands to a queue of some sort rather than waiting for each one to
complete before moving on to the next, resulting in directories not
being empty when an unlink attempt is made on them, even though all
their contents has already also been unlinked.

I had thought of the possibility that there was a buffer problem
somewhere, and I tried adding clearstatcache calls in strategic places
in the code but that doesn't seem to have helped.

0
gordon.mcvey (380)
4/15/2008 2:41:11 PM
Reply:

Similar Artilces:

parse error or infinite loop? a blank screen, yet the php error log is empty
Imagine a template system that works by getting a file, as a string, and then putting it through eval(), something like this: $formAsString = $controller->command("readFileAndReturnString", $formName); // 06-22-07 - the next commands try to import all the functions that the form // contains, so we don't get "Fatal Error: Undefined Function". $arrayOfNeededFunctions = $controller->command("matchAllPhpFunctionsInString", $formAsString); $arrayOfTrueAndFalseResults = $controller->command("loopArray", $arrayOfNeededFunctions, "getNeededFunctionsEach"); // 06-22-07 - (must end php or I get errors) $phpEnd = "?"; $phpEnd .= "> "; $formAsString = $phpEnd.$formAsString; echo "<p>in importForm: <hr> $formAsString"; eval($formAsString); The echo statement, which I just put there, shows the string about like what I'd expect. Yet, on this page, I get a blank: http://www.cyberbitten.com/my_private_page.php?formName=mp_sharing_wall_other_peoples_posts.htm A blank in the middle of the page, where I am trying to import a sub-template. Normally, if I get blank, it means that there is a parse error in the file being included. And yet, if I ssh to the server and examine the error log, it is empty. If I deliberately invoke an error on another page (in this case, weblog.php), then that appears in the error log, but no parse error does: root@ldc310:/u...

cannot delete file
cannot delete file - http://LongPathTool.com can fix it Do you have error messages?, like : Path too long. Error cannot delete file: cannot read from source file or disk Cannot delete file: Access is denied There has been a sharing violation. Cannot delete file or folder The file name you specified is not valid or too long. Specify a different file name. The source or destination file may be in use. The file is in use by another program or user. Error Deleting File or Folder Make sure the disk is not full or write-protected and that the file is not currently in use. Error Copy...

cannot delete file
cannot delete file - http://LongPathTool.com can fix it Do you have error messages?, like : Path too long. Error cannot delete file: cannot read from source file or disk Cannot delete file: Access is denied There has been a sharing violation. Cannot delete file or folder The file name you specified is not valid or too long. Specify a different file name. The source or destination file may be in use. The file is in use by another program or user. Error Deleting File or Folder Make sure the disk is not full or write-protected and that the file is not currently in use. Error Copy...

[Apache+PHP] Error building PHP
Hi, I am building php 4.3.10 on slackware 10.1.0 and I got an error. More in details: I've successfully installed apache_1.3.33. In php-4.3.10 directory, I typed # ./configure --with-mysql --with-apxs=/usr/local/apache/bin/apxs --enable-module=so and i got the following error: # ---------------------------------------- Configuring SAPI modules checking for AOLserver support... no checking for Apache 1.x module support via DSO through APXS... Sorry, I was not able to successfully run APXS. Possible reasons: 1. Perl is not installed; 2. Apache was not compiled...

Re: PHP/MySQL: using MIN() on an empty set of rows -> query error
It might depend on how you are processing the returned resultset. The documentation implies that for certain versions of PHP if a column is null then the associative array element for that column is not set. For later versions the column exists but has no value ie isset() is false. I experimented here (PHP 4.3.4) and I get a resultset ie mysql_num_rows() == 1, the array element exists but is not set: $p_strQuery = 'SELECT MIN(objid) AS MinObjID FROM MinTest WHERE objid > 6'; $t_datResult = mysql_query( $p_strQuery, $m_objSQLConnection ); print "mysql_num_rows: " . my...

http://LongPathTool.com - Copy, Unlock and Delete Path Too Long files http://LongPathTool.com
http://LongPathTool.com - Copy, Unlock and Delete Path Too Long files http://LongPathTool.com - Copy, Unlock and Delete Path Too Long files Do you have error messages?, like : Path too long. Error cannot delete file: cannot read from source file or disk Cannot delete file: Access is denied There has been a sharing violation. Cannot delete file or folder The file name you specified is not valid or too long. Specify a different file name. The source or destination file may be in use. The file is in use by another program or user. Error Deleting File or Folder Make sure the disk i...

Apache2Triad PHP Errors without Error Messages
How do I get Apache2Triad to print the reason it stops while executing my PHP programs? ...

About PHP::: Error/Problem PHP Warning: mysql_fetch_array():
Hi Everyone ============================================================== About PHP::: Error/Problem PHP Warning: mysql_fetch_array(): ============================================================== In the past i use my code/script work fine with Mandrake 9.1 - 10.1 ( + apache ,mysql ) Now i move to redhat EL4 with the same code/script I got error can't login to my code. and found error on /var/log/httpd/error_log like this PHP Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /var/www/html/website_in_server/showdata.php or PHP Warning: my...

can someone help me to fix this error(Error using ==> kmeans at 382 An empty cluster error occurred in every replicate)
??? Error using ==> kmeans at 382 An empty cluster error occurred in every replicate. Error in ==> segmentizeImage1 at 25 [cluster_idx cluster_center] = kmeans(ab,nColors,'distance','sqEuclidean', ... Error in ==> bui_simple>start_snap_Callback at 108 segmentizeImage1; Error in ==> gui_mainfcn at 96 feval(varargin{:}); Error in ==> bui_simple at 42 gui_mainfcn(gui_State, varargin{:}); Error in ==> @(hObject,eventdata)bui_simple('start_snap_Callback',hObject,eventdata,guidata(hObject)) ??? Error while evaluating uicontrol Callback ...

Fatal error: main(): Failed opening required 'DB.php' (include_path='.:/usr/lib/php:/usr/local/lib/php')
I installed PEAR HTTP_Upload to my new server and now im getting this error when runnign the script. any help? Maximus wrote: > I installed PEAR HTTP_Upload to my new server > and now im getting this error when runnign the script. > > > any help? > permissions problem? where is DB.php located? does DB.php reside in the include_path directories? The message is self explanatory. -- Michael Austin. DBA Consultant Donations welcomed. Http://www.firstdbasource.com/donations.html :) Try on your command line as root: >pear install DB Alex http://prepared-stateme...

When is an error not an error?
When it's OSS slopware, of course. http://www.angelfire.com/planet/dfs0/Knode_send_error.png On 2006-09-12 02:42, * DFS wrote: > When it's OSS slopware, of course. > > http://www.angelfire.com/planet/dfs0/Knode_send_error.png > Well, some time ago I had a problem with OE - too long reference line to other posts, and OE of course refused to send... then crashed. Should I name it a feature? -- Andrea On Tue, 12 Sep 2006 03:25:29 +0200, Andrea wrote: > On 2006-09-12 02:42, * DFS wrote: >> When it's OSS slopware, of course. >> >> http:/...

recurse and recursive
I'm trying to make use of B. J. Rodriguez BNF parser at http://www.jwdt.com/~paysan/screenful.html and http://www.forth.org/literature/bnfparse.html but am having trouble with the word: recursive. It is mentioned without any definition at http://pfe.sourceforge.net/manual/rn01re928.html but not mentioned at all in the ANS docs at http://ficl.sourceforge.net/dpans/dpansf.htm The usage is: : bnf: ( -- sys ) : postpone recursive postpone <bnf ; immediate What does "recursive" indicate in this context and is there an ANS substitute for the behaviour? Where should I have loo...

When is empty not empty?
On PHP 5.1.6, the attached script prints: "$a isn't empty and its length is 0". Can you confirm and/or explain this? I haven't found any bug reports about it... -----BEGIN SCRIPT----- #!/usr/bin/php <? $a = `date | grep slowday`; // should come up empty if ($a !== '') echo '$a isn\'t empty and its length is '.strlen($a)."\n"; ?> ------END SCRIPT------ -- ~> cat /etc/redhat-release && uname -a Scientific Linux SL release 5.2 (Boron) Linux acerrimo.local 2.6.18-92.1.18.el5 #1 SMP Wed Nov 12 06:49:06 EST 2008 i686 athlon i386 GNU/Linux 7252d9cf@example.invalid wrote: > On PHP 5.1.6, the attached script prints: > "$a isn't empty and its length is 0". > > Can you confirm and/or explain this? I haven't found any bug reports > about it... > > > -----BEGIN SCRIPT----- > #!/usr/bin/php ><? > $a = `date | grep slowday`; // should come up empty > if ($a !== '') echo '$a isn\'t empty and its length is '.strlen($a)."\n"; > ?> > > ------END SCRIPT------ Confirm and partly explain. When back-ticks `....` or shell_exec() run a command which produce no output at all, it returns NULL rather than an empty string. So ($a !== '') is not true because $a is NULL not a string. But empty($a) would test as true. This doesn't seem to be documented anywhere I could find. From experience, I suspect if you submit a bug re...

When is an error not an error?
The Java language specification claims in: 8.8.7.1 Explicit Constructor Invocations .... "If an anonymous class instance creation expression appears within an explicit constructor invocation statement, then the anonymous class may not refer to any of the enclosing instances of the class whose constructor is being invoked." Helpfully it gives an example: "For example: class Top { int x; class Dummy { Dummy(Object o) {} } class Inside extends Dummy { Inside() { super(new Object() { int r = x; }); // error } Inside(final int y) { super(new Object() { int r = y; }); // correct } } } " Notice the word 'error' in the comment. This example compiles without error and produces the correct code. In what sense is it an 'error'? It is not a compiler error, it is not a runtime error. To quote Douglas Adams "this must be some new meaning of the word 'error' with which I am unfamiliar". Any idea what's gone wrong? In article <gepkhr$rop$1$8302bc10@news.demon.co.uk>, Anon <blackhole@nowhere.com> wrote: > The Java language specification claims in: > 8.8.7.1 Explicit Constructor Invocations [<http://java.sun.com/docs/books/jls/third_edition/html/classes.html#8.8. 7.1>] > Notice the word 'error' in the comment. This example compiles without > error and ...

empty
searching the manual gives lots of hits, none of which appear relevant (at least by the title). I had the following code in a scheduling class: if ($ptNum == "empty") { $ptNum = 0; $status= "e"; } I pass the string "empty" to the function as a patient number if we are creating an empty appointment slot. now, this fails because with a patient number of 0 the if returns true. I am aware of the function empty() that would work like that, but do not understand why the compare fails with the constant, "empty." I fixed the function by making it a strict compare, but would like to know why the regular compare is true with the numeric value of zero. bill bill wrote: > searching the manual gives lots of hits, none of which appear relevant (at > least by the title). > > I had the following code in a scheduling class: > > if ($ptNum == "empty") { > $ptNum = 0; > $status= "e"; > } > > I pass the string "empty" to the function as a patient number if we are > creating an empty appointment slot. > > now, this fails because with a patient number of 0 the if returns true. > > I am aware of the function empty() that would work like that, but do not > understand why the compare fails with the constant, "empty." I assume you are comparing 0 and not the string "0", this makes you are comparing integer with string, there ain't any type ...

delete on delete !
Hi, If I do another delete on an object which has been deleted earlier, then how is the system expected to behave ? Is it an unpredictable behavior ?? Thanks Sandeep Sandeep Grover wrote: > Hi, > > If I do another delete on an object which has been deleted earlier, then > how is > the system expected to behave ? > > Is it an unpredictable behavior ?? > Yes, unpredictable. Some will choke, some destructors SEGV, it goes on and on. Sandeep Grover wrote: > If I do another delete on an object which has been deleted earlier, then > how is the system expected to behave? > > Is it an unpredictable behavior ?? It's undefined, so in theory, yes; anything could happen. S > Sandeep Grover wrote: > > > If I do another delete on an object which has been deleted earlier, then > > how is the system expected to behave? > > > > Is it an unpredictable behavior ?? > > It's undefined, so in theory, yes; anything could happen. > > S Thanks ! So, if I have an array of pointers; more than one of the entries could point to the same chunk of memory (allocated using new). How do I ensure that I end up deleting that entry only once. I dont want to use reference-counting kind of thing in constructor. On Fri, 11 Jul 2003 16:53:31 -0700, Sandeep Grover <sandeep@magma-da.com> wrote: >[I]f I have an array of pointers; more than one of the entries could >point to the same chunk of memo...

Recursive PHP?
Do PHP support recursive calling, like this: function some_func ($some_arg) { $count = 0; // some code while (<some condition>) { if (<some condition>) { $count += some_func ($some_arg); } else { ++$count; } } return $count; } -- J�rn Dahl-Stamnes http://www.dahl-stamnes.net/dahls/ J�rn Dahl-Stamnes said the following on 18/12/2005 09:42: > Do PHP support recursive calling, like this: > > function some_func ($some_arg) > { > $count = 0; > // some code > while (<some condition>) > { > if (<some condition>) > { > $count += some_func ($some_arg); > } else { > ++$count; > } > } > return $count; > } > Did you not think to just try it out? -- Oli On Sun, 18 Dec 2005 10:42:16 +0100, J�rn Dahl-Stamnes <newsmanDELETE@REMOVEdahl-stamnes.net> wrote: >Do PHP support recursive calling http://www.php.net/manual/en/language.functions.php -- Andy Hassall :: andy@andyh.co.uk :: http://www.andyh.co.uk http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool Oli Filth wrote: > J�rn Dahl-Stamnes said the following on 18/12/2005 09:42: >> Do PHP support recursive calling, like this: >> >> function some_func ($some_arg) >> { >> $count = 0; >> // some code >> while (<some condition>) >> { >> if (<some condition>) >>...

#ERROR #DELETED
How come I get #deleted or #error notation on several of my fields and it won't allow me to remove it or change it.? Whenever I access the particular field I get an error message that says: "The Microsoft Database engine stopped the process because you and another user are attempting to change the same data at the same time" (Note: I am the only one using the program). How to I get rid of the data in that field? And, how can I get rid of seeing this problem? Ernesto ...

Delete error
try { if (System.getProperty("java.vendor").equals("Microsoft Corp.")) Class.forName("com.ms.jdbc.odbc.JdbcOdbcDriver"); else // Non-visual J++ Users Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); // Setup connection to DBMS Connection conn = DriverManager.getConnection("jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=C:/MyDocs/My Java/MyProjects/ListSaver2/DCF.mdb"); // Create statement Statement stmt = conn.createStatement(); String sql; sql = "DELETE FROM MAIN WHERE name = " + lstCurrentItems.getSelectedValue().toString(); stmt.executeUpdate(sql); Error is on executeUpdate - [Microsoft][ODBC Microsoft Access Driver]Too Few Parameters. Expected 1.java.sql.SQLException }catch(Exception ex){ JOptionPane.showMessageDialog(null, ex.getMessage() + ex.toString(),"Error", JOptionPane.INFORMATION_MESSAGE); } >sql =3D "DELETE FROM MAIN WHERE name =3D " + > lstCurrentItems.getSelectedVal=ADue().toString(); You should use: sql =3D "DELETE FROM MAIN WHERE name =3D '" + lstCurrentItems.getSelectedVal=ADue().toString()+"'"; BTW, you can use HXTT Access (www.hxtt.n...

DELETE CASCADE
I try to make a script for generating backend databases. When I try to make a relationship between a table named 'users' and another table name 'layouts' an error occurs. Option 1: CurrentDB.Execute "ALTER TABLE layouts ADD CONSTRAINT users_layouts FOREIGN KEY (user_id) REFERENCES users(id) ON UPDATE CASCADE" Option 2: DoCmd.RunSQL "ALTER TABLE layouts ADD CONSTRAINT users_layouts FOREIGN KEY (user_id) REFERENCES users(id) ON UPDATE CASCADE" All environments are set to ANSI 92. I prefer to use Option 1 which fails, Option 2 doesn't. Could anybody give an explanation for this? "HH" <harm.horstman@hwits.nl> wrote in message <1168530590.640402.233640@i39g2000hsf.googlegroups.com>: > I try to make a script for generating backend databases. When I try > to make a relationship between a table named 'users' and another > table name 'layouts' an error occurs. > > Option 1: > CurrentDB.Execute "ALTER TABLE layouts ADD CONSTRAINT users_layouts > FOREIGN KEY (user_id) REFERENCES users(id) ON UPDATE CASCADE" > > Option 2: > DoCmd.RunSQL "ALTER TABLE layouts ADD CONSTRAINT users_layouts > FOREIGN KEY (user_id) REFERENCES users(id) ON UPDATE CASCADE" > > All environments are set to ANSI 92. > > I prefer to use Option 1 which fails, Option 2 doesn't. Could anybody > give an explanation for this? If you need to use DDL, I think this can ...

about php lang
plz told me that what is the php lang., how does it works and where it used. mani <msb.jod@gmail.com> wrote: > plz told me that what is the php lang., how does it works and where it > used. There is a good explanation at http://lmgtfy.com/?q=php regards Henrik -- The address in the header is only to prevent spam. My real address is: hc3(at)poolhem.se Examples of addresses which go to spammers: root@localhost postmaster@localhost On 16 Jun 2009, mani <msb.jod@gmail.com> wrote: > plz told me that what is the php lang., how does it works and > where it used. Lulz. <http://www.google.com/> -- ~Curtis Anonymous (1984 IOCCC winner): int i;main(){for(;i["]<i;++i){--i;}"];read('-'-'-',i+++"hell\ o, world!\n",'/'/'/'));}read(j,i,p){write(j/p+p,i---j,i/i);} mani schreef: > plz told me that what is the php lang., how does it works and where it > used. http://en.wikipedia.org/wiki/Php Tip: If you want to learn something about a subject totally new to you, try wikipedia for a reasonable intro. Regards, Erwin Moller -- "There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult." -- C.A.R. Hoare ...

PHP & Sybase Error -- php: dblib.c:303
Hi, I get errors when doing this in PHP: $db = sybase_connect("$servername:$portnumber", "$username", "$password"); $database = "master" ; sybase_select_db ( "$database" ); $q = sybase_query("sp_tables", $db); $syb_num_fields = sybase_num_fields( $q ) ; $syb_num_rows = sybase_num_rows( $q ) ; php: dblib.c:303: buffer_add_row: Assertion `row_size <= buf->element_size' failed. Aborted Any ideas? It works fine if I do SQL statements like "select * from sysobjects" but when I try to run stored procedures it dies. I even added these env vars... putenv ("SYBASE=/opt/sybase"); putenv ("SYBPLATFORM=linux"); putenv ("LD_LIBRARY_PATH=/opt/sybase/lib"); putenv ("LC_ALL=default"); putenv ("PATH=\"/opt/sybase/bin:$PATH\""); putenv ("DSQUERY=SYBASE"); Thanks in advance! -DG- On Tue, 15 Feb 2005 19:19:33 -0500, Data Goob wrote: > Hi, > > I get errors when doing this in PHP: > > $db = sybase_connect("$servername:$portnumber", "$username", "$password"); > $database = "master" ; > sybase_select_db ( "$database" ); > $q ...

php error
Hi Folks, I've tried using the PHP included with my copy of Linux, as well as recompiling and installing PHP myself, but I keep getting this error: Fatal error: Call to undefined function mysql_connect() My PHP code doesn't perform any kind of module-include of MySQL, since so far I haven't seen an example of PHP MySQL code that uses one. But is that required to get rid of this error? Thanks. 333 > I've tried using the PHP included with my copy of Linux, > as well as recompiling and installing PHP myself, but > I keep getting this error: > Fatal error: Call...

deleting error
Hello, Intermittently, I get the following error message when using the command "file delete -force $dirPath": error deleting "value_of_dirPath/subDir/subSubDir": file already exists Does anyone know what this means? To me, the message itself makes no sense. Why is a file's existence a reason for its being undeletable? The error is NOT duplicatable. If I run the same command again, it almost always works. But then a few minutes later it fails on another directory. DirPath is a directory, not a file. I'm expecting the command to do a ...

PHP/Perl/Unix Virus: delete config.php files asap
There were some strange requests to my server asking for config.php file (which I do not have in the requested location). I did some investigation. Seems to be a virus written in perl, exploiting a vulnerability in php code. The requests are like this 216.120.231.252 - - [30/Aug/2006:13:28:03 -0500] "GET /algebra/about/history/config.php?returnpath=http://domates.1gig.biz/spread.txt? HTTP/1.1" 404 561 "-" "libwww-perl/5.805" File spread.txt contains this: <? passthru('cd /tmp;wget http://domates.1gig.biz/tmr;perl tmr;rm -f tmr*'); pas...

Web resources about - Recursive delete of directory - Directory not empty error - comp.lang.php

Recursive definition - Wikipedia, the free encyclopedia
This definition is valid for all n , because the recursion eventually reaches the base case of 0. The definition may also be thought of as giving ...

Watch this awesome recursive 'Lego Movie,' 'Simpsons' mashup
The third layer of a recursive video mashing up 'The Simpsons' and the 'Lego Movie.' (Credit: Screen shot by CNET) Love "The Simpsons" and love ...

This Function is Not Tail Recursive
Tail recursion seems to be an easy concept, but most people get it wrong – including me. Reading the latest German Java SPEKTRUM, I’ve found ...

My continuing love affair with ReSharper: Indicating Recursive Calls
... code is doing, it could probably be refactored to be more readable and/or intention revealing. One exception that I’ve often made is for recursive ...

Behold the recursive weirdness of a subreddit made entirely of bots
The bots have spoken. Deep within Reddit ’s concentric circles of recursive weirdness, something even weirder is happening. There, like some ...

Recursive Google Image Search Is Mindflippingly Nuts
As you may know, you can search for photos by dropping a picture on Google Images . It shows you images that are equal or similar to yours. This ...

Recursive Soldering Iron Hacking
We’ve all done it. You’re walking out the door or maybe you’ve even gotten on the road when the question hits, “Did I leave the [coffee pot - ...

GIF: Recursive Maru
Love cyoot and funneh animal gifs? Check out our brand new gif site!

Recursive Book Cover Is Recursive
The cover art for Paul Halmos' book on Naive Set Theory plays with the self-referential nature of Russel's Paradox , to humorous visual effect. ...

Recursive Drawing App by Toby Schachman
Recursive Drawing by artist Toby Schachman is a simple web app for creating images out of recursive shapes, in other words, shapes that repeat ...

Resources last updated: 3/23/2016 6:27:09 PM