<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>xiphux &#187; mdb</title>
	<atom:link href="http://www.xiphux.com/tag/mdb/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.xiphux.com</link>
	<description></description>
	<lastBuildDate>Sat, 28 Jan 2012 17:05:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>MDB 0.0.8</title>
		<link>http://www.xiphux.com/2008/08/21/mdb-008/?&#038;owa_medium=feed&#038;owa_sid=</link>
		<comments>http://www.xiphux.com/2008/08/21/mdb-008/#comments</comments>
		<pubDate>Thu, 21 Aug 2008 18:41:24 +0000</pubDate>
		<dc:creator>xiphux</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[mdb]]></category>

		<guid isPermaLink="false">http://www.xiphux.com/?p=441</guid>
		<description><![CDATA[As mentioned in this post, there is a bug in MDB &#60;= 0.0.7 that inhibits downloading of files larger than your output buffer&#8217;s size (usually 128M), which makes file downloads particularly useless in an app like this that was originally designed to archive tv/anime show episodes that are usually over that size.  I don&#8217;t foresee my schedule ]]></description>
			<content:encoded><![CDATA[<p>As mentioned in <a href="http://www.xiphux.com/2008/08/08/php-projects/">this post</a>, there is a bug in MDB &lt;= 0.0.7 that inhibits downloading of files larger than your output buffer&#8217;s size (usually 128M), which makes file downloads particularly useless in an app like this that was originally designed to archive tv/anime show episodes that are usually over that size.  I don&#8217;t foresee my schedule letting me get much work done on MDB so as I promised, I&#8217;ve released a new version of MDB with that fixed.  Get it on the <a href="http://www.xiphux.com/programming/php/mdb/">mdb page</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.xiphux.com/2008/08/21/mdb-008/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>php projects</title>
		<link>http://www.xiphux.com/2008/08/08/php-projects/?&#038;owa_medium=feed&#038;owa_sid=</link>
		<comments>http://www.xiphux.com/2008/08/08/php-projects/#comments</comments>
		<pubDate>Fri, 08 Aug 2008 15:17:58 +0000</pubDate>
		<dc:creator>xiphux</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[codex]]></category>
		<category><![CDATA[mdb]]></category>

		<guid isPermaLink="false">http://www.xiphux.com/?p=409</guid>
		<description><![CDATA[MDB has a bug inhibiting downloading of files larger than a certain size.  Output buffering was accidentally left on during file download, so files larger than the output buffer (usually 128M) are truncated to that size.  The one little fix is a bit too small for a whole release right now, so I&#8217;ll either have ]]></description>
			<content:encoded><![CDATA[<p>MDB has a bug inhibiting downloading of files larger than a certain size.  Output buffering was accidentally left on during file download, so files larger than the output buffer (usually 128M) are truncated to that size.  The one little fix is a bit too small for a whole release right now, so I&#8217;ll either have to wait to do more fixes or until a little time has passed and I feel that no other fixes will be coming.  Either way, the fix is in gitphp so if it&#8217;s a problem you can grab the snapshot.</p>
<p>Codex is currently getting the same massive revamp, feature boost, and cache framework that MDB got.  It&#8217;s my oldest full fledged PHP/SQL project so it has the crappiest code and could benefit the most from such a thing.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.xiphux.com/2008/08/08/php-projects/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MDB 0.0.7</title>
		<link>http://www.xiphux.com/2008/07/14/mdb-007/?&#038;owa_medium=feed&#038;owa_sid=</link>
		<comments>http://www.xiphux.com/2008/07/14/mdb-007/#comments</comments>
		<pubDate>Mon, 14 Jul 2008 17:27:11 +0000</pubDate>
		<dc:creator>xiphux</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[mdb]]></category>

		<guid isPermaLink="false">http://www.xiphux.com/?p=319</guid>
		<description><![CDATA[As mentioned in my previous post, here is the new version of mdb with caching integrated. There are a few minor bugfixes and adjustments listed in the changelog at the end of the post, but the main bulk of the change is the caching framework. The architecture is described in the other post memcached and ]]></description>
			<content:encoded><![CDATA[<p>As mentioned in my previous post, here is the new version of mdb with caching integrated.  There are a few minor bugfixes and adjustments listed in the changelog at the end of the post, but the main bulk of the change is the caching framework.  The architecture is described in the other post <a href="http://www.xiphux.com/2008/07/11/memcached-and-smarty-in-mdb/">memcached and smarty in mdb</a>.  The framework is set up such that each type of cache is a self contained class, therefore caches can be switched out without changing the rest of the code.<br />
0.0.7 contains three cache types &#8211; the <a href="http://www.danga.com/memcached/">memcached</a> class, an <a href="http://eaccelerator.net/">eaccelerator</a> class, and an on-disk filecache.  I will list the pros/cons of each.</p>
<p><strong>Memcache</strong><br />
<strong>Pros:</strong> Extremely fast hashtable in memory.  Runs as a separate server and is therefore not bounded by the limitations of the webserver.  Can be distributed among multiple servers (not implemented in mdb currently, but will be).<br />
<strong>Cons:</strong> Requires admin rights to get memcached up and running in the first place.  Requires an extra daemon to be running.</p>
<p><strong>Eaccelerator</strong><br />
<strong>Pros:</strong> Has the performance gain of memcached without necessarily requiring a separate server.<br />
<strong>Cons:</strong> Requires the eaccelerator php extension, which also probably requires admin rights.  Has a performance boost but is not as scalable as memcache due to being bound by the limitations of the webserver (tends to be limited as a php extension &#8211; cache memory, etc).  No gain over filecache if eaccelerator is set to use the disk as cache, instead of shared memory.<br />
<strong>Notes:</strong> There is a known bug with the eaccelerator cache class right now.  Eaccelerator&#8217;s shared memory was not really designed to be used as a cache, it was designed to share data between repeated executions of a source file.  After updating the database, the cache will not be cleared using eaccelerator, you will have to manually clear the cache by using &#8220;cacheflush&#8221; on the database page with an admin user.  I think it may have to do with the fact that eaccelerator doesn&#8217;t work with the commandline php client; I need to find a way around this.</p>
<p><strong>Filecache</strong><br />
<strong>Pros:</strong> Simple on-disk caching of serialized data.  Does not require admin rights to run a daemon or install an extension, just a directory writable by the web server.  Simple cache that&#8217;s useful if your disk is fast and your database and/or web server is slow.<br />
<strong>Cons:</strong> Bound heavily by I/O.  It will improve execution time by eliminating some of the repeated unnecessary processing, but if your disk is slow to access the cache, then the benefit is eliminated.  Also, heavy disk I/O sometimes alerts the admin, which could be a problem if the admin isn&#8217;t you.<br />
<strong>Notes:</strong> To try and avoid heavy disk I/O, you could try having a cache directory that&#8217;s mounted as a ramdrive, but setting up a ramdrive usually requires admin rights, in which case you might as well use one of the other solutions.  Or you could hope that your server&#8217;s /tmp directory is mounted in ram and world-writable.</p>
<p>So, in summation, the memcache is good for scalability (supporting many many clients), performance (speed of page execution), and load (how much I/O or processing is done by the server/database).  Eaccelerator cache is good for perfomance and load, as long as eaccelerator is using shared memory for caching.  The disk cache is good for performance, and lightens cpu/database load but increases disk load.</p>
<p><strong>Changelog</strong></p>
<ul>
<li>Strip out non-alphanumeric characters when adding tags &#8211; preventing tags such as &#8220;genderbending&#8221; and &#8220;gender bending&#8221; being treated as two different tags</li>
<li>Exclude ext3&#8242;s &#8220;lost+found&#8221; directory by default</li>
<li>The dbcheck page now scans for files that are in the database but no longer exist on disk</li>
<li>Persistent connections disabled by default</li>
<li>Debugging no longer interferes with file downloads</li>
<li>When loading a title&#8217;s page, list of titles on the right will automatically open to the correct letter</li>
<li>Apply smarty&#8217;s trimwritespace filter to all templates</li>
<li>Organizational cleanup</li>
<li>Cache framework, including cache stats on the dbstats page, cache info in the footer (type/hits/misses), and an option on the db management page to flush cache</li>
<li>Memcached cache type</li>
<li>Eaccelerator cache type</li>
<li>File cache type</li>
</ul>
<p>Get it at the <a href="http://www.xiphux.com/programming/php/mdb/">MDB page</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.xiphux.com/2008/07/14/mdb-007/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>memcached and smarty in mdb</title>
		<link>http://www.xiphux.com/2008/07/11/memcached-and-smarty-in-mdb/?&#038;owa_medium=feed&#038;owa_sid=</link>
		<comments>http://www.xiphux.com/2008/07/11/memcached-and-smarty-in-mdb/#comments</comments>
		<pubDate>Fri, 11 Jul 2008 16:10:19 +0000</pubDate>
		<dc:creator>xiphux</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[mdb]]></category>
		<category><![CDATA[memcached]]></category>
		<category><![CDATA[smarty]]></category>

		<guid isPermaLink="false">http://www.xiphux.com/?p=316</guid>
		<description><![CDATA[I&#8217;ve recently begun to work on improving performance in MDB. Since MDB is very much a write-once-read-many setup (where the write-once is the scanning and indexing of the files into your database, and the read-many is the repeated fetching of this data while browsing through the collection), I felt it would benefit very much from ]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve recently begun to work on improving performance in MDB.  Since MDB is very much a write-once-read-many setup (where the write-once is the scanning and indexing of the files into your database, and the read-many is the repeated fetching of this data while browsing through the collection), I felt it would benefit very much from a caching solution or two.  I looked at a number of different solutions, and have decided to go with optional <a href="http://www.danga.com/memcached/">Memcached</a> support.  Memcached is a distributed object caching system &#8211; it runs as a server that you can connect to and store/fetch items to/from a memory cache.  It can also be distributed among multiple Memached servers.  It pretty much works as an enormous hash table &#8211; you associate a key with some data, and that key gets hashed to find the location of the data in the hash table.  Any data can be stored &#8211; basic data such as strings are stored straight, and more complex data such as multi-dimensional php arrays are stored serialized.  The server can also be set up to compress data that&#8217;s above a certain size, as long as there is a certain percent of space gain by compression.</p>
<p>I essentially implemented memcached caching on a two-layer approach.  The first layer is caching of data from the database.  Anytime a chunk of data is requested from the database and parsed into a data structure, the data is cached in memcached.  This means that when you&#8217;re running with the data cached into memcached (cache hot), it is possible to completely eliminate all database activity.  There are certain limitations to this though &#8211; for example, one query that cannot be cached is the check to see if the database is still updating, using the mutex stored in the database.  Caching this check would kind of defeat the purpose of a live check.  Also, caching any of the database status pages &#8211; the update page, the database consistency check page, and the database stats page, would also defeat the purpose of live checks.  But aside from these exceptions, it is possible to cache all other database queries, cutting down a page&#8217;s query count from 13 or so to 1 or 2.  Since most of the data fetched from the database is stored in a user-agnostic form, it means that this cached data can be used for multiple users.  The cache data is expired when something in it is modified.  For example, adding a new tag will expire the cached list of tags, requiring it to be fetched and cached again (cache miss) on the next run.</p>
<p>The other layer of caching that is done is the caching of Smarty template output.  Smarty has its own caching system, but I chose to use memcached to manually cache the output of Smarty templates &#8211; more on this decision later.  The output of the Smarty template &#8211; essentially, the finished HTML that gets sent to the user &#8211; is stored in memcached.  This means that, in a similar manner as the database caching, if you&#8217;re running cache hot then it&#8217;s possible to entirely eliminate the need for any smarty parsing on a page load, which also eliminates the need to fetch any database data, hence the two layer approach.  The equivalent speed in that case is almost as fast as serving a straight HTML page to the user.</p>
<p>In general, most of the data being fetched from the database is stored in a user-agnostic format, and the templates are what customize a page to a specific user.  For example, when fetching a list of files in a title from the database, it&#8217;s just stored as a chunk of data.  However, when rendering the page for the user, it&#8217;s tailored to that user&#8217;s view &#8211; making some of the links downloadable if a user has access, giving the option to add and remove tags, etc.  Therefore, if both the file data and the template output of a title for a user with download rights is cached, and an anonymous user comes and tries to fetch the same title page, the template output will be a cache miss since the anonymous user is supposed to see a version without download links.  However, the database data will still be a cache hit, since it&#8217;s the same list of files.  So this cached database data will be used to render the anonymous user&#8217;s template without download links, and this new template output will then also be cached for subsequent accesses by anonymous users.  Therefore, in this situation, only one layer of caching was a cache miss (the template), and another layer was still a cache hit (the database).</p>
<p>This has allowed me to see enormous speedups, especially for data that is either complicated to render (a title with many many files in it) or very frequently displayed (the list of titles on the right side that shows up on every single page).  Plus, Memcache allows for a great deal of scalability as you have more and more users on the page &#8211; this wasn&#8217;t something that I could test, though, as I&#8217;m the only user using my home copy of MDB.</p>
<p>I have some very rough benchmarks (these were just 2-second tests, not nearly quantitative in any way.  Just to get an idea of the difference):</p>
<p>Listing a title with 78 files in 4 folders:<br />
Database cache miss, template cache miss (no cache at all): 0.15322113 sec<br />
Database cache hit, template cache miss: 0.11778903 sec<br />
Database cache hit, template cache hit: 0.00953102 sec<br />
Speedup: about 16x faster</p>
<p>Rendering a tag cloud with 8 tags:<br />
Database cache miss, template cache miss (no cache at all): 0.05347109 sec<br />
Database cache hit, template cache hit: 0.00882792 sec<br />
This page isn&#8217;t user specific so there&#8217;s no way the template cache would miss but the database cache would hit.<br />
Speedup: about 6x faster</p>
<p>Keep in mind that my server is pretty fast (I was already getting tenth of a second times or less before caching), so a slower server, or a setup where mysql is running on a different server, would see even more speedup.  Also keep in mind that on the very first startup the cache is entirely cold and therefore everything will need to be fetched from the database.  Only as it&#8217;s used more will the cache warm up.  Also please note that after a database update (where the entire list of files may be changed), the entire cache is marked expired so it will be entirely cache cold again.  Updating the database is a generally infrequent operation, though, so you don&#8217;t have to worry about this too often.</p>
<p>Also, although I post benchmarks here, and it is faster, really the biggest goal of memcached is to lighten the load for scalability &#8211; lighten the database load, lighten the cpu load, serve more pages in a given time period, etc.  Enable mysql&#8217;s query cache along with this and you&#8217;ll have a system that barely uses any cpu or database at all.</p>
<p>So why did I choose not to use smarty caching?<br />
The first strike was that after enabling caching, things slowed down.  I don&#8217;t know why, it may have been a misconfiguration on my part.  It wasn&#8217;t because of a cold cache, I tried multiple times.  But whatever, this actually isn&#8217;t the main reason.<br />
Another reason is that Smarty caches compiled templates to disk, not into memory.  There are apparently other cache handlers that allow you to use things such as memcached for smarty caching, but after some browsing through some solutions I didn&#8217;t feel like lumping a whole bunch of other people&#8217;s stuff with mdb.<br />
The third, and probably biggest reason, is that smarty caches on a per-template basis.  This means it caches the entire template, and only one template, at a time.  Caching in smarty is actually a pain to implement if your system wasn&#8217;t written to take advantage of caching from the start.  My templates are a big combination of dynamic and non-dynamic data for ease of development.  To actually cache as much as possible many of these templates would have to be broken up into multiple sub-templates and/or rewritten, making things more difficult.  Speaking of sub-templates, this is also another problem with caching on a per-template basis.  My pages are already made up of a number of templates.  There is the left nav template, the right titlelist template, and the middle.  The middle is where all the complicated stuff happens &#8211; for example, when drawing the list of files in a title to be dynamically collapsible by folder, each file needs to have a class that depends on the class of the parent folder before it, meaning all files need to be looped through and given certain CSS classes/ids.  I chose to make a template that shows one file in the table &#8211; therefore the css classes can be figured out, and displayed using the template, and then it&#8217;ll move on to the next file.  The other way of doing it &#8211; looping through and adding extra data into the array that stores the files, before sending it to the template to be displayed (looped through again to be displayed as table rows), would have almost doubled the work it was doing.  The problem is that smarty would try and cache that one row for that one file, meaning if your file database has 9631 files, you&#8217;d have 9631 cached copies of the single row template, each with a different cache id.  Why bother?  Even with cache, you&#8217;d still be iterating through files on each title page display.  With memcache being used outside of smarty I can append all the bits and pieces of template HTML that make up a title&#8217;s file list into a single html chunk, then cache that whole title&#8217;s chunk of html once.  On the next load, I&#8217;d just pull up the full cached HTML for that title and never have to iterate at all.</p>
<p>But anyway, memcached support is in MDB now.  It&#8217;s available in gitphp right now.  I&#8217;m still working on integrating the last couple parts of it, and it still needs to go through some testing to make sure that cached data is being expired properly where appropriate.  But after that I will probably release a new version with all the memcache updates as well as the other minor fixes I&#8217;ve done.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.xiphux.com/2008/07/11/memcached-and-smarty-in-mdb/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MDB 0.0.6</title>
		<link>http://www.xiphux.com/2008/06/19/mdb-006/?&#038;owa_medium=feed&#038;owa_sid=</link>
		<comments>http://www.xiphux.com/2008/06/19/mdb-006/#comments</comments>
		<pubDate>Thu, 19 Jun 2008 18:11:04 +0000</pubDate>
		<dc:creator>xiphux</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[mdb]]></category>

		<guid isPermaLink="false">http://www.xiphux.com/?p=311</guid>
		<description><![CDATA[Just over a week after the last update, here is MDB 0.0.6. MDB had the most potential for features to be added, so that&#8217;s what I focused on. Here is the rather large changelog: Database update times are logged in a table The updatedb page shows the output of the status test if something goes ]]></description>
			<content:encoded><![CDATA[<p>Just over a week after the last update, here is MDB 0.0.6.  MDB had the most potential for features to be added, so that&#8217;s what I focused on.  Here is the rather large changelog:</p>
<ul>
<li>Database update times are logged in a table</li>
<li>The updatedb page shows the output of the status test if something goes wrong</li>
<li>PHP commandline binary used in db updates is configurable</li>
<li>Allow setting a cooloff time between database updates (for example, if last update was less than X seconds ago, skip update)</li>
<li>Fixed the shell hack mutex test in some places</li>
<li>Allow using the database to store update status (rather than just testing with ps and grep) &#8211; please read the notes in the config file before enabling this!</li>
<li>Add debug option to dump a bunch of info during execution</li>
<li>Fix OPTIMIZE TABLE calls that weren&#8217;t working</li>
<li>The optimize configure option now applies to updatedb (so optimizing after updating can be optional too)</li>
<li>Updatedb status test reports when cooloff time hasn&#8217;t been met</li>
<li>Mapping sanity check has been moved to a more generic db check page that will also check consistency of dbmutex</li>
<li>Optimizing is done on dbcheck page instead of during db stats</li>
<li>Use php&#8217;s builtin uname for dbstats page instead of running external uname</li>
<li>Clean up uptime output on dbstats page</li>
<li>Avoid caching password hash in session key</li>
<li>Add user management page so admins can add and delete users, and change user privileges (from/to admin)</li>
<li>Add preferences page for users to change passwords</li>
<li>Metadata links for titles have been moved to a generic links table, rather than an AnimeNFO-specific table</li>
<li>Title list no longer depends on images that I couldn&#8217;t include &#8211; colored by CSS now</li>
<li>Use newer mootools rather than old moo.fx for javascript effects (scripts included now)</li>
<li>CSS split into themes &#8211; formatting is in a core css file and colors/styles are in separate theme files.  Comes with three themes &#8211; Dark Aqua, Dark Lime, and Light</li>
<li>Users can set their preferred css theme on their preferences page</li>
<li>Some PHP warnings are cleaned up</li>
<li>Chooses an optimal title listing method (SQL queries or iteration) by the number of titles in the system</li>
<li>Title listing using SQL uses prepared statements for speedup</li>
<li>A footer now shows db status (size, titles, files, etc), the number of queries executed, and the execution time of the page</li>
<li>Footer and main page show a warning when database is upgrading</li>
<li>ADOdb caching now works (it didn&#8217;t before) &#8211; please read the notes in the config file about adodb caching&#8217;s performance hit before enabling!</li>
<li>Remove limit statements to be more portable with other databases</li>
<li>Remove file_title association table and embed the title id in the file database instead &#8211; files can only have one title</li>
<li>Fix bug with tag substring collisions (e.g. &#8220;girls&#8221; and &#8220;girls with guns&#8221; being treated as the same tag)</li>
<li>Change delete links to submit buttons that use POST &#8211; safer to avoid accidental triggering by spiders (although I don&#8217;t know why you&#8217;d spider this in the first place)</li>
<li>Database operations (updatedb, dbstats, dbcheck) are now all triggered from one admin-only database page</li>
<li>Minor optimizations of SQL queries</li>
<li>Only count directories as titles</li>
<li>Filelist on title page is now shown hierarchically indented by directory</li>
<li>Directories on title page are now collapsible by javascript.  All files are shown by default, so will degrade gracefully if javascript is off &#8211; directories just won&#8217;t collapse</li>
</ul>
<p>This version has significant architectural differences from the previous versions.  Everything is included now so you may want to get rid of your own copies of moo.fx and titlelist images.  The database is also structurally different.  I unfortunately have not written a database upgrade script.  In general though, the following changes are required:</p>
<ol>
<li>Add the dbupdate table</li>
<li>Add the preferences table</li>
<li>Remove the file_title table and add the new field to the files table.  If you know how to do this yourself by phpmyadmin or the like then the description of the field is in the SQL file.  If not, then delete the table and recreate it using the one in the SQL file.  Either way, run updatedb to restore consistency to the database.</li>
<li>Delete the animenfo table and create the links table.  Unfortunately there isn&#8217;t really an easy way to migrate the data from one table to another.  If you really have a lot of data in the animenfo table you want migrated, I can help you write the SQL to do so.</li>
</ol>
<p>All other tables have remained the same, so you can keep your same users and stuff.  But since some tables have changed and some tables haven&#8217;t, it may be easiest to just drop all tables in the database, import the SQL fresh, and update your db.  I apologize for any inconvenience.</p>
<p>If you have no users and have trouble figuring out how the users table works (I know I forgot to include a default user before), I have included an SQL file that creates an admin user with username/password root/root.  From there you can add more users and delete the root user if you&#8217;d like.  Of course, make sure you have at least 1 admin!</p>
<p>The tarball is on the <a href="http://www.xiphux.com/programming/php/mdb">MDB page</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.xiphux.com/2008/06/19/mdb-006/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>hat trick</title>
		<link>http://www.xiphux.com/2008/06/09/hat-trick/?&#038;owa_medium=feed&#038;owa_sid=</link>
		<comments>http://www.xiphux.com/2008/06/09/hat-trick/#comments</comments>
		<pubDate>Tue, 10 Jun 2008 04:51:43 +0000</pubDate>
		<dc:creator>xiphux</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[codex]]></category>
		<category><![CDATA[gitphp]]></category>
		<category><![CDATA[mantis]]></category>
		<category><![CDATA[mdb]]></category>

		<guid isPermaLink="false">http://www.xiphux.com/?p=308</guid>
		<description><![CDATA[I&#8217;ve been going through and doing some cleanup on my old php projects. Some of them had some pretty crappy coding practices, since they were written back when I was still learning PHP and SQL. For example, they had all functions lumped together in one function library &#8211; made it easier to write, but it ]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been going through and doing some cleanup on my old php projects.  Some of them had some pretty crappy coding practices, since they were written back when I was still learning PHP and SQL.  For example, they had all functions lumped together in one function library &#8211; made it easier to write, but it meant that every single operation loaded all the code for every single function into php&#8217;s memory.  Why load 10 functions into memory when you&#8217;re only using one of them?  Also, SQL functions were mainly used for fetching records, and most of the sorting/association was done by PHP.  I did it at the time because I knew PHP a lot better than I did SQL, and it meant I could avoid some of the more complicated SQL stuff such as JOINs and subqueries.  However in practice it&#8217;s better to have as much of that done by the SQL server as possible, since it&#8217;s much faster and more efficient than PHP at managing data.  So I managed to do major cleanup of all three of my PHP projects.  Unfortunately I didn&#8217;t really get around to adding new features, which is why the three projects were only bumped minor versions, and not major versions.</p>
<p>The changelogs are as follows:<br />
<a href="http://www.xiphux.com/programming/php/codex">Codex</a>:</p>
<ul>
<li>Move config to its own directory</li>
<li>Smarty and ADOdb prefixes are now configurable</li>
<li>Break up function library into a file for each function that&#8217;s loaded on demand</li>
<li>Remove usage of obsolete HTTP_GET_VARS and HTTP_POST_VARS</li>
<li>Rewrite matchup_data to use SQL and be more efficient</li>
<li>SQL file is now included in tarball</li>
<li>Use a more sane versioning scheme (e.g. 0.3.3 instead of v03c)</li>
</ul>
<p>Codex actually still has some speed issues &#8211; part of it is due to some more shitty code that needs to get cleaned up, part of it is due to the sheer amount of data it fetches and cross-references at any given time.</p>
<p><a href="http://www.xiphux.com/programming/php/mdb">MDB</a>:</p>
<ul>
<li>Prevent SQL injections in searches</li>
<li>Move config to its own directory</li>
<li>Break up function library into a file for each function that&#8217;s loaded on demand</li>
<li>Made ADOdb prefix configurable</li>
<li>Rewrite SQL/PHP in functions unmapped, taglist, prunetags, userhistory, titlelist</li>
<li>Fixed file download function which broke in some browsers</li>
<li>Use a transaction during database update to avoid users seeing corrupt data during update</li>
</ul>
<p><a href="http://www.xiphux.com/programming/php/gitphp">GitPHP</a>:</p>
<ul>
<li>Move config to its own dir</li>
<li>Break up function library into a file for each function that&#8217;s loaded on demand</li>
<li>Use a more sane versioning scheme (e.g. 0.0.4 instead of v01d)</li>
<li>Fix broken snapshot URL on some pages</li>
<li>Fix missing header that broke formatting on tag page</li>
<li>Fix duplicated &#8220;&#8230;&#8221; that appeared on truncated shortlogs</li>
<li>Fix sorting functions on main project list page</li>
<li>Project lists searching a directory (rather than using a predefined list in the config) now search recursively</li>
<li>Add &#8220;TXT&#8221; plaintext project list link on front page</li>
<li>Fix ref icons next to commits with tags/heads</li>
<li>Some adjustments to links on pages to match more closely with current gitweb</li>
<li>Links to files on commitdiff pages now work</li>
<li>Diff binary path is now configurable</li>
<li>Now works on Windows with <a href="http://code.google.com/p/msysgit/">msysgit</a>! Thanks to testing and bugfixes from Slash</li>
</ul>
<p>Slash was a big help with much of the Windows testing/bugfixes on this release, as I don&#8217;t have any windows boxes.  GitPHP can now work drop-in on Windows as long as you read the config and set the paths to your binaries correctly.</p>
<p>Tarballs of all new releases are available on their respective project pages.  Since the directory structure of these releases have changed significantly, I recommend deleting files from the previous version before extracting this version.</p>
<p>I have also added a bugtracker on this site for people to report bugs with the software, at <a href="http://mantis.xiphux.com">http://mantis.xiphux.com</a>.  Given how many people actually use anything I write (countable on one hand), I don&#8217;t forsee it being used much, but at least it&#8217;s there if I or anyone else ever needs it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.xiphux.com/2008/06/09/hat-trick/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MDB 0.0.4</title>
		<link>http://www.xiphux.com/2007/07/14/mdb-004/?&#038;owa_medium=feed&#038;owa_sid=</link>
		<comments>http://www.xiphux.com/2007/07/14/mdb-004/#comments</comments>
		<pubDate>Sun, 15 Jul 2007 03:37:24 +0000</pubDate>
		<dc:creator>xiphux</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[mdb]]></category>

		<guid isPermaLink="false">http://www.xiphux.com/2007/07/14/mdb-004/</guid>
		<description><![CDATA[Minor release of MDB, adding optional support for logging a user&#8217;s downloads. Keeps track of files a user&#8217;s downloaded, their size, total downloaded amount, and IP that requested the download (with WHOIS lookup support). Anonymous users aren&#8217;t logged (obviously), normal users can see their own downloads, and privileged users can see their own plus other ]]></description>
			<content:encoded><![CDATA[<p>Minor release of MDB, adding optional support for logging a user&#8217;s downloads.  Keeps track of files a user&#8217;s downloaded, their size, total downloaded amount, and IP that requested the download (with WHOIS lookup support).  Anonymous users aren&#8217;t logged (obviously), normal users can see their own downloads, and privileged users can see their own plus other users&#8217; downloads.<br />
Also fixed a bug with database updates of titles beginning with the same prefix.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.xiphux.com/2007/07/14/mdb-004/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MDB 0.0.3</title>
		<link>http://www.xiphux.com/2006/08/15/mdb-003/?&#038;owa_medium=feed&#038;owa_sid=</link>
		<comments>http://www.xiphux.com/2006/08/15/mdb-003/#comments</comments>
		<pubDate>Tue, 15 Aug 2006 10:33:40 +0000</pubDate>
		<dc:creator>xiphux</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[mdb]]></category>

		<guid isPermaLink="false">http://www.thelightofthesoul.com/2006/08/15/mdb-003/</guid>
		<description><![CDATA[New release of MDB, including: - Support for migrating tags/links when titles are moved across titlebases (in my case, between RAIDs) - Support for AnimeNFO link(s) for titles - My weak attempt at a nicer site design - Support for excluding certain file extensions - Configurable AJAX updatedb query interval - Untagging (removing a single ]]></description>
			<content:encoded><![CDATA[<p>New release of MDB, including:</p>
<p>- Support for migrating tags/links when titles are moved across titlebases (in my case, between RAIDs)<br />
- Support for AnimeNFO link(s) for titles<br />
- My weak attempt at a nicer site design<br />
- Support for excluding certain file extensions<br />
- Configurable AJAX updatedb query interval<br />
- Untagging (removing a single tag from a single title) support<br />
- Config option to allow/disallow file downloads entirely<br />
- Several bugfixes</p>
]]></content:encoded>
			<wfw:commentRss>http://www.xiphux.com/2006/08/15/mdb-003/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MDB 0.0.1</title>
		<link>http://www.xiphux.com/2006/06/06/mdb-001/?&#038;owa_medium=feed&#038;owa_sid=</link>
		<comments>http://www.xiphux.com/2006/06/06/mdb-001/#comments</comments>
		<pubDate>Wed, 07 Jun 2006 03:18:49 +0000</pubDate>
		<dc:creator>xiphux</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[mdb]]></category>

		<guid isPermaLink="false">http://www.thelightofthesoul.com/2006/06/06/mdb-001/</guid>
		<description><![CDATA[MDB (Media DataBase), a php webapp I use to index my anime on my fileserver, has an initial version up under programming/php. ]]></description>
			<content:encoded><![CDATA[<p>MDB (Media DataBase), a php webapp I use to index my anime on my fileserver, has an initial version up under programming/php.</p>
<p><a href="http://www.thelightofthesoul.com/programming/php/mdb">MDB</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.xiphux.com/2006/06/06/mdb-001/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

