<?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>Working Beta &#187; Mysql</title>
	<atom:link href="http://seeds.workingbeta.com/category/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://seeds.workingbeta.com</link>
	<description>a bounch of nearly working code</description>
	<lastBuildDate>Wed, 10 Feb 2010 21:25:11 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>ready&#8230; set&#8230; go!</title>
		<link>http://seeds.workingbeta.com/2009/05/14/ready-set-go/</link>
		<comments>http://seeds.workingbeta.com/2009/05/14/ready-set-go/#comments</comments>
		<pubDate>Thu, 14 May 2009 18:44:22 +0000</pubDate>
		<dc:creator>gc</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Mysql]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[IDE]]></category>
		<category><![CDATA[RAD]]></category>
		<category><![CDATA[VISUAL PHP]]></category>

		<guid isPermaLink="false">http://seeds.workingbeta.com/?p=49</guid>
		<description><![CDATA[Hi all,
so much time since my last post! I&#8217;ve been involved into so many interesting projects that I could&#8217;t even login.
In the meantime a brand new side project idea is born.. All stats looking at the bleeding edge of the CMS/CMR/Framework panorama that I&#8217;ve encountered in the last month. None of them is really well [...]]]></description>
			<content:encoded><![CDATA[<p>Hi all,<br />
so much time since my last post! I&#8217;ve been involved into so many interesting projects that I could&#8217;t even login.</p>
<p>In the meantime a brand new side project idea is born.. All stats looking at the bleeding edge of the CMS/CMR/Framework panorama that I&#8217;ve encountered in the last month. None of them is really well suite for rapid application developement in  L(W)AMP environments. What is missing actually is a real visual IDE that fits into your browsers, and helps you deploy a consisten, secure, fast paced application starting from a simple set of tables/relations.</p>
<p>Something like the old visual basic stuff, but integrated with all the latest AJAX widgets and user experience. why should people still develop every single template/form/interface instead of simply concentrate in business logic?</p>
<p>so stay tuned, first lines of code are ready, as usual with prototype &amp; usual suspects in the frontline.<br />
I will publish one module/element/schema/idea per week, any help is greatly appreciated!!</p>
]]></content:encoded>
			<wfw:commentRss>http://seeds.workingbeta.com/2009/05/14/ready-set-go/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>managing [many] uploaded files</title>
		<link>http://seeds.workingbeta.com/2008/12/11/managing-many-uploaded-files/</link>
		<comments>http://seeds.workingbeta.com/2008/12/11/managing-many-uploaded-files/#comments</comments>
		<pubDate>Thu, 11 Dec 2008 22:44:10 +0000</pubDate>
		<dc:creator>gc</dc:creator>
				<category><![CDATA[Mysql]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[file upload]]></category>
		<category><![CDATA[multimedia]]></category>
		<category><![CDATA[thumbnail generation]]></category>

		<guid isPermaLink="false">http://seeds.workingbeta.com/?p=43</guid>
		<description><![CDATA[most  web applications have to deal with user provided files. Being them photos, word files, compressed archives, the big problem is what can happen when they become to be so many that become to reach the system limits of your filesystem.
Just think about sites like myspace, hacebook, flikr: they must provide upload features for [...]]]></description>
			<content:encoded><![CDATA[<p>most  web applications have to deal with user provided files. Being them photos, word files, compressed archives, the big problem is what can happen when they become to be so many that become to reach the system limits of your filesystem.<br />
Just think about sites like myspace, hacebook, flikr: they must provide upload features for millions of files/day and every each node of their webfarm cluser should be able to get it in milliseconds.<br />
The solution I usually provide in such case, creates a n-levels of directoryes  generating a unique 32-chars wide filename foreach file uploaded and then storing it. this method can fulfill the usual requirements for a medium sized high traffic application, and can store millions of files with no fear for performances.<br />
Each file can be retrieved with a simple numeric ID or a supersecret 32bit key adding security or applications requiring privacy protection.<br />
Also ther&#8217;s thumbnail generating method with caching mechanism if eeded.</p>
<p><a href="http://www.workingbeta.com/seeds/class.multimedia.php.zip">here</a> you can find it: too much code to explain, but if you don&#8217;t understand something, let me know</p>
]]></content:encoded>
			<wfw:commentRss>http://seeds.workingbeta.com/2008/12/11/managing-many-uploaded-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>class.dbmanager.php</title>
		<link>http://seeds.workingbeta.com/2008/11/18/classdbmanagerphp/</link>
		<comments>http://seeds.workingbeta.com/2008/11/18/classdbmanagerphp/#comments</comments>
		<pubDate>Tue, 18 Nov 2008 15:51:28 +0000</pubDate>
		<dc:creator>gc</dc:creator>
				<category><![CDATA[Mysql]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[dbmanagement]]></category>
		<category><![CDATA[patterns]]></category>
		<category><![CDATA[singleton]]></category>

		<guid isPermaLink="false">http://seeds.workingbeta.com/?p=19</guid>
		<description><![CDATA[here we go, a simple, very basic class to manage DB connections; I know there are so many around BUT

it&#8217;s very lightweight because it:
makes use of the &#8220;singleton&#8221; pattern, so you can start make a mess with patterns [if you've never do so]
ther&#8217;s soo much room for improvement
since I use it on an almost everyday [...]]]></description>
			<content:encoded><![CDATA[<p>here we go, a simple, very basic class to manage DB connections; I know there are so many around <strong>BUT</strong></p>
<ol>
<li>it&#8217;s very lightweight because it:</li>
<li>makes use of the &#8220;<a href="http://en.wikipedia.org/wiki/Singleton_pattern" target="_blank">singleton</a>&#8221; pattern, so you can start make a mess with <a href="http://en.wikipedia.org/wiki/Design_pattern" target="_blank">patterns</a> [if you've never do so]</li>
<li>ther&#8217;s soo much room for improvement</li>
<li>since I use it on an almost everyday basis anyother of my seeds will use it, so get used to it!</li>
</ol>
<p>When you deal with mysql connections you should keep in mind that every single connection takes its load or system resources, and if you don&#8217;t pay attentio you could easily end up into a &#8216;<em>too many connections</em>&#8216; error and a faulty applications.<br />
The very first solutions would be trying to use persistent connections, and this works very well on the mysql side: every page builds just one connection. The singleton pattern is chosen here because off it has a very low footprint into system resources: this means that you free more resources for the rest of your <span style="text-decoration: line-through;">crappy</span> code.</p>
<p>After creating your <strong>dbmanager</strong> Object, you have to <strong>dbmanager::connect </strong>giving host, user, pwd, db as always. from now on, you will have basically two methods:</p>
<p style="text-align: center;"><strong>dbmanager::assocQuery($sql)</strong> and <strong>dbmanager::sqlQuery($sql)</strong></p>
<p>those two methods just query the database with the given query [there are also some nice counters if you wanna know how many querys ar made for every page you build].<br />
The nice thing about dbmanager::assocQuery($sql) is how the result is returned: an associative array with fieldnames as keys: that&#8217;s really useful when you then have to cycle through your recordset and build tables, analyze data and so on.</p>
<blockquote><p><code><br />
$db=new dbconnection("mysql");<br />
$db-&gt;connect($host,$login,$password,$database);<br />
$recordset=$db-&gt;assocQuery("SELECT * FROM TABLENAME WHERE CONDITIONS...");<br />
foreach($recordset as $record){<br />
&nbsp;&nbsp;&nbsp;&nbsp;// here goes your code<br />
&nbsp;&nbsp;&nbsp;&nbsp;}</code>
</p></blockquote>
<p>very straightforward, isn&#8217;t it???</p>
<p>uh.. the code is <a href="http://www.workingbeta.com/seeds/dbmanager.zip">here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://seeds.workingbeta.com/2008/11/18/classdbmanagerphp/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
