Your leaking thatched hut during the restoration of a pre-Enlightenment state.

 

Hello, my name is Judas Gutenberg and this is my blaag (pronounced as you would the vomit noise "hyroop-bleuach").



links

decay & ruin
Biosphere II
Chernobyl
dead malls
Detroit
Irving housing

got that wrong
Paleofuture.com

appropriate tech
Arduino μcontrollers
Backwoods Home
Fractal antenna

fun social media stuff


Like asecular.com
(nobody does!)

Like my brownhouse:
   automatically quantifying the pace of change
Thursday, October 11 2007
Working with the large code library behind my PHP-based SQL tools has been complicated by issues with versions. The libary is designed to be backwards compatible to all previous projects, but sometimes things will break if some libraries are updated and others are not. So last night I began and today I further developed a version calculator for this system (which I refer to as "Tableform"). The version calculator determines version based on modification dates, which it compares to manually-selected moments in time. I decide the large-grain versions manually (versions such as 0.5, 1.0, or 1.1) and then add to those bases tiny fractions calculated automatically based on the time that has elapsed since those large-grain-keyed moments in time. But the amount added to the base version does not increase linearly; it increases with the square root of time passed, which corresponds better to the way actual manually-set versions change. (This is, evidently, also the pace at which language itself changes.)
Mind you, such a system is far from perfect. Some fool can change a library and in so doing render it the "latest" version, even if he breaks it in the process. A better system would calculate versions based only on modification dates that happened on my computer (since I am the version dictator of the entire code base), but as far as I know there is no operating system that tracks separate modification dates based on the machine doing the modifying. Doing so would require a file system to come equipped with its own relational database, which would (I think) be an excellent idea. It's a serious indictment of Microsoft Vista that its file system is still basically the same one as the one used by Windows 95. You'd think by now there would be built-in ways to attach meta-information to files in the file system completely outside the structure of the file hierarchy.

Here, by the way, is the code I used in my version calculator.

function DetermineVersion()
{
//comes back with a version numbers for admin scripts based on mod dates
//the base version is set as the first items in $versionconfig, corresponding 
//to the timestamp of the mod date, the second items
//this base is added to the results of some wacky math designed to keep 
//the calculated version after that base timestamp low.
//the result versions (to be added to the base) tend to be smaller than "0.001" 
//unless the file is very much beyond the base timestamp for that version.
//this system will automatically scan through the list 
//of files given in the ddl called $strConfig, 
//labeling them with the second fields in that ddl.
	$strClassFirst="bgclassfirst";
	$strClassSecond="bgclasssecond";
	$strConfig="tableform.php|Tableform-admin_functions.php|
		Core function library-tableform_js.js|
		Core javascript  library-tablemaker.php|
		Tablemaker-tablemaker_js.js|Tablemaker javascript-saveform.php|
		Tableform saver library-dbtools.php|
		Database tools-dump.php|CSV tools-backup_functions.php|
		Backup functions-frontenddbfunctions.php|
		Frontend db functions-genericuserfunctions.php|
		Generic user functions";
	$versionconfig="0.5|1182650153-1|1191945058";
	$date=filemtime("admin_functions.php");
	$datearray=getdate($date);
	$thisyear=$datearray["year"];
	$previousversion="0.5";
	$arrVersions=explode("-", $versionconfig);
	$thismonth=str_pad($datearray["month"], 2, "0", STR_PAD_LEFT);
	$thisday=str_pad($datearray["mday"], 2, "0", STR_PAD_LEFT);
	$out="";
	$out.="<table cellpadding=\"0\" cellspacing=\"1\" ";
	$out.="border=\"0\" width=\"450\" class=\"bgclassline\">\n";
	$out.="<tr><td class=\"heading\" colspan=\"2\">";
	$out.="Tableform Database Tool</td></tr>\n";
	$arrConfig=explode("-", $strConfig);
	foreach($arrConfig as $thisConfig)
	{
		$arrData=explode("|", $thisConfig);
		$strFile=$arrData[0];
		$strThisBgClass=Alternate($strClassFirst, 
			$strClassSecond, $strThisBgClass);
		$out.="<tr class=\"" . $strThisBgClass . "\"><td>";
		if (file_exists($strFile))
		{
			$moddate=filemtime($strFile);
			for($i=0; $i<count($arrVersions); $i++)  
			{
				$thisversion=$arrVersions[$i];
	 
				$bwlWeHaveAnother=false;
				if($i<count($arrVersions)-1)
				{
					$arrnextVersionData=
						explode("|", $arrVersions[$i+1]);
					$bwlWeHaveAnother=true;
				}
				//echo $thisversion . "--<br>";
				$arrVersionData=explode("|", $thisversion);
				if($bwlWeHaveAnother)
				{
					//echo "*<br>";
					if (intval($arrVersionData[1])<intval($moddate)  
						&& 
						intval($arrnextVersionData[1])>
						intval($moddate))
					{
						$baseversion=$arrVersionData[0];
						$basemoddate=$arrVersionData[1];
						//echo $basemoddate . "++<br>";
						break;
					}
				}
				else
				{
					if (intval($arrVersionData[1])<
						;intval($moddate))
					{
						$baseversion=$arrVersionData[0];
						$basemoddate=$arrVersionData[1];
						break;
						//echo $basemoddate . "&&<br>";
					}
					else
					{
						$baseversion=0;
						$basemoddate=1000650153;
						break;
					}
				
				}
			}
			$version= $baseversion + 
				pow(($moddate - $basemoddate)/100000000000,.5);
			$out.= $arrData[1] . "</td><td> version: " 
				. NanHandler(substr($version, 0, 8)
				, $previousversion);// . " " 
				. $moddate;
		}
		else
		{
			$out.= $arrData[1] . "</td><td>not present" ;
		
		}
		$out.="</td></tr>\n";
 	}
	$out.="</table>\n<p/><br>";
	return $out;
}


For linking purposes this article's URL is:
http://asecular.com/blog.php?071011

feedback
previous | next