<?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>Next Web Designs &#187; Software Design</title>
	<atom:link href="http://nextwebdesigns.com/category/software/feed/" rel="self" type="application/rss+xml" />
	<link>http://nextwebdesigns.com</link>
	<description>Growing the Artistic Web</description>
	<lastBuildDate>Wed, 14 Jul 2010 13:23:35 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Simple MySQL Stored Procedure</title>
		<link>http://nextwebdesigns.com/2009/02/14/simple-mysql-stored-procedure/</link>
		<comments>http://nextwebdesigns.com/2009/02/14/simple-mysql-stored-procedure/#comments</comments>
		<pubDate>Sat, 14 Feb 2009 16:39:04 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Software Design]]></category>

		<guid isPermaLink="false">http://nextwebdesigns.com/?p=58</guid>
		<description><![CDATA[Here's a simple stored procedure I find myself using for MySQL over and over again.  If you use a person's email address as a database key, you may need to occasionally update their email address, and as such, you should update all references.  Here's a simple stored procedure to accomplish this:
DELIMITER $$

DROP PROCEDURE IF EXISTS [...]]]></description>
			<content:encoded><![CDATA[<p>Here's a simple stored procedure I find myself using for MySQL over and over again.  If you use a person's email address as a database key, you may need to occasionally update their email address, and as such, you should update all references.  Here's a simple stored procedure to accomplish this:</p>
<pre>DELIMITER $$

DROP PROCEDURE IF EXISTS changeEmail $$
CREATE PROCEDURE changeEmail (oldEmail varchar(100), newEmail varchar(100))
BEGIN
 -- First check our arguments and that the old email exists
 IF (oldEmail IS NOT NULL) AND (newEmail IS NOT NULL) AND
    (EXISTS (SELECT * FROM users WHERE email=oldEmail))
 THEN
   -- Update all references of the old email to the new one here
   UPDATE users set email=newEmail WHERE email=oldEmail LIMIT 1;
   UPDATE billing set email=newEmail WHERE email=oldEmail;
   UPDATE cards set email=newEmail WHERE email=oldEmail;
   UPDATE orders set user_email=newEmail WHERE user_email=oldEmail;
 END IF;
END $$

DELIMITER ;</pre>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://nextwebdesigns.com/2009/02/14/simple-mysql-stored-procedure/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>App.config Settings for a Project with no Output</title>
		<link>http://nextwebdesigns.com/2008/10/17/appconfig-settings-for-a-project-with-no-output/</link>
		<comments>http://nextwebdesigns.com/2008/10/17/appconfig-settings-for-a-project-with-no-output/#comments</comments>
		<pubDate>Fri, 17 Oct 2008 19:58:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Software Design]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[Add new tag]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://nextwebdesigns.com/?p=42</guid>
		<description><![CDATA[Sometimes more than just connection strings need to be stored to a settings or configuration file of some kind. If you are building a mult-tier application and your project is a class library with no run-able code, you can't just throw settings into an app.config file. Likewise, you wouldn't want to put your tier-specific settings [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes more than just connection strings need to be stored to a settings or configuration file of some kind. If you are building a mult-tier application and your project is a class library with no run-able code, you can't just throw settings into an app.config file. Likewise, you wouldn't want to put your tier-specific settings in a different project just because that project contains the output (and the app.config).</p>
<p>A simple way around this problem is to create a settings file for your project.  To do so, right click on your project and select "Properties"</p>
<p><a href="http://None"><img class="aligncenter size-full wp-image-46" title="Project Properties" src="http://nextwebdesigns.com/wp-content/uploads/2008/10/setting_shot1.jpg" alt="" width="316" height="538" /></a></p>
<p>Navigate to the "Settings" tab and click the link to create a new settings file</p>
<p><a href="http://None"><img class="aligncenter size-full wp-image-47" title="Create a settings file" src="http://nextwebdesigns.com/wp-content/uploads/2008/10/setting_shot2.jpg" alt="" width="500" height="307" /></a></p>
<p>Add the application specific parameters to your settings file via the designer.  Save and rebuild your project.</p>
<p><a href="http://None"><img class="aligncenter size-full wp-image-48" title="Add your setting string" src="http://nextwebdesigns.com/wp-content/uploads/2008/10/setting_shot3.jpg" alt="" width="500" height="297" /></a></p>
<p>To use your settings, reference them via the following syntax:</p>
<pre class="cpp">Properties.<span style="color: #00eeff;">Settings</span>.<span style="color: #0000ff;">Default</span>.<span style="color: #00eeff;">MySetting</span></pre>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://nextwebdesigns.com/2008/10/17/appconfig-settings-for-a-project-with-no-output/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQL Server Find Text in Any Field</title>
		<link>http://nextwebdesigns.com/2008/10/17/sql-server-find-text-in-any-field/</link>
		<comments>http://nextwebdesigns.com/2008/10/17/sql-server-find-text-in-any-field/#comments</comments>
		<pubDate>Fri, 17 Oct 2008 13:06:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Software Design]]></category>

		<guid isPermaLink="false">http://nextwebdesigns.com/?p=35</guid>
		<description><![CDATA[In working with SQL server 2005, I came across this useful query which will loop through every table and every field in a database searching for specified text.  This can really come in handy when you're debugging someone else's un-documented database and you know the text, but you're not sure where it is stored in [...]]]></description>
			<content:encoded><![CDATA[<p>In working with SQL server 2005, I came across this useful query which will loop through every table and every field in a database searching for specified text.  This can really come in handy when you're debugging someone else's un-documented database and you know the text, but you're not sure where it is stored in the database.  Note that this will store the results of this query in a table called "Results", so if you have a table with that name, you'll want to rename the table below.  Also be sure to change your search criteria...  Enjoy!</p>
<pre class="sql"><span style="color: #993333; font-weight: bold;">DROP</span> <span style="color: #993333; font-weight: bold;">TABLE</span> <span style="color: #808080; font-style: italic;">#Results</span>
<span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> <span style="color: #808080; font-style: italic;">#Results (ColumnName nvarchar(370), ColumnValue nvarchar(3630))</span>
<span style="color: #993333; font-weight: bold;">SET</span> NOCOUNT <span style="color: #993333; font-weight: bold;">ON</span>
&nbsp;
DECLARE @TableName nvarchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">256</span><span style="color: #66cc66;">&#41;</span>, @ColumnName nvarchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">128</span><span style="color: #66cc66;">&#41;</span>, @SearchStr2 nvarchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">110</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #993333; font-weight: bold;">SET</span>  @TableName = <span style="color: #ff0000;">''</span>
<span style="color: #993333; font-weight: bold;">SET</span> @SearchStr2 = QUOTENAME<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'&lt;YOUR_SEARCH_DATA_HERE&gt;'</span>,<span style="color: #ff0000;">''</span><span style="color: #ff0000;">''</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
WHILE @TableName <span style="color: #993333; font-weight: bold;">IS</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span>
BEGIN
  <span style="color: #993333; font-weight: bold;">SET</span> @ColumnName = <span style="color: #ff0000;">''</span>
  <span style="color: #993333; font-weight: bold;">SET</span> @TableName =
  <span style="color: #66cc66;">&#40;</span>
    <span style="color: #993333; font-weight: bold;">SELECT</span> MIN<span style="color: #66cc66;">&#40;</span>QUOTENAME<span style="color: #66cc66;">&#40;</span>TABLE_SCHEMA<span style="color: #66cc66;">&#41;</span> + <span style="color: #ff0000;">'.'</span> + QUOTENAME<span style="color: #66cc66;">&#40;</span>TABLE_NAME<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #993333; font-weight: bold;">FROM</span>   INFORMATION_SCHEMA.<span style="color: #993333; font-weight: bold;">TABLES</span> <span style="color: #993333; font-weight: bold;">WHERE</span> TABLE_TYPE = <span style="color: #ff0000;">'BASE TABLE'</span>
    <span style="color: #993333; font-weight: bold;">AND</span> QUOTENAME<span style="color: #66cc66;">&#40;</span>TABLE_SCHEMA<span style="color: #66cc66;">&#41;</span> + <span style="color: #ff0000;">'.'</span> + QUOTENAME<span style="color: #66cc66;">&#40;</span>TABLE_NAME<span style="color: #66cc66;">&#41;</span> &gt; @TableName
    <span style="color: #993333; font-weight: bold;">AND</span> OBJECTPROPERTY<span style="color: #66cc66;">&#40;</span>
      OBJECT_ID<span style="color: #66cc66;">&#40;</span>
        QUOTENAME<span style="color: #66cc66;">&#40;</span>TABLE_SCHEMA<span style="color: #66cc66;">&#41;</span> + <span style="color: #ff0000;">'.'</span> + QUOTENAME<span style="color: #66cc66;">&#40;</span>TABLE_NAME<span style="color: #66cc66;">&#41;</span>
      <span style="color: #66cc66;">&#41;</span>, <span style="color: #ff0000;">'IsMSShipped'</span>
    <span style="color: #66cc66;">&#41;</span> = <span style="color: #cc66cc;">0</span>
  <span style="color: #66cc66;">&#41;</span>
&nbsp;
  WHILE <span style="color: #66cc66;">&#40;</span>@TableName <span style="color: #993333; font-weight: bold;">IS</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">AND</span> <span style="color: #66cc66;">&#40;</span>@ColumnName <span style="color: #993333; font-weight: bold;">IS</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">&#41;</span>
  BEGIN
    <span style="color: #993333; font-weight: bold;">SET</span> @ColumnName =
    <span style="color: #66cc66;">&#40;</span>
      <span style="color: #993333; font-weight: bold;">SELECT</span> MIN<span style="color: #66cc66;">&#40;</span>QUOTENAME<span style="color: #66cc66;">&#40;</span>COLUMN_NAME<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
      <span style="color: #993333; font-weight: bold;">FROM</span> INFORMATION_SCHEMA.<span style="color: #993333; font-weight: bold;">COLUMNS</span>
      <span style="color: #993333; font-weight: bold;">WHERE</span> TABLE_SCHEMA = PARSENAME<span style="color: #66cc66;">&#40;</span>@TableName, <span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span>
      <span style="color: #993333; font-weight: bold;">AND</span> TABLE_NAME  = PARSENAME<span style="color: #66cc66;">&#40;</span>@TableName, <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span>
      <span style="color: #993333; font-weight: bold;">AND</span> DATA_TYPE <span style="color: #993333; font-weight: bold;">IN</span> <span style="color: #66cc66;">&#40;</span>
        <span style="color: #ff0000;">'char'</span>, <span style="color: #ff0000;">'varchar'</span>, <span style="color: #ff0000;">'nchar'</span>, <span style="color: #ff0000;">'nvarchar'</span>, <span style="color: #ff0000;">'uniqueidentifier'</span>, <span style="color: #ff0000;">'smallint'</span>, <span style="color: #ff0000;">'identity'</span>
      <span style="color: #66cc66;">&#41;</span>
      <span style="color: #993333; font-weight: bold;">AND</span> QUOTENAME<span style="color: #66cc66;">&#40;</span>COLUMN_NAME<span style="color: #66cc66;">&#41;</span> &gt; @ColumnName
    <span style="color: #66cc66;">&#41;</span>
&nbsp;
    <span style="color: #993333; font-weight: bold;">IF</span> @ColumnName <span style="color: #993333; font-weight: bold;">IS</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span>
    BEGIN
    <span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> <span style="color: #808080; font-style: italic;">#Results</span>
    EXEC
    <span style="color: #66cc66;">&#40;</span>
      <span style="color: #ff0000;">'SELECT '</span><span style="color: #ff0000;">''</span> + @TableName + <span style="color: #ff0000;">'.'</span> + @ColumnName + <span style="color: #ff0000;">''</span><span style="color: #ff0000;">', LEFT('</span> + @ColumnName + <span style="color: #ff0000;">', 3630)
      FROM '</span> + @TableName + <span style="color: #ff0000;">' (NOLOCK) '</span> +
      <span style="color: #ff0000;">' WHERE '</span> + @ColumnName + <span style="color: #ff0000;">' LIKE '</span> + @SearchStr2
    <span style="color: #66cc66;">&#41;</span>
    END
  END
END
&nbsp;
<span style="color: #993333; font-weight: bold;">SELECT</span> ColumnName, ColumnValue <span style="color: #993333; font-weight: bold;">FROM</span> <span style="color: #808080; font-style: italic;">#Results</span></pre>
]]></content:encoded>
			<wfw:commentRss>http://nextwebdesigns.com/2008/10/17/sql-server-find-text-in-any-field/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL Blob Insert Error</title>
		<link>http://nextwebdesigns.com/2008/01/04/mysql-blob-insert-error/</link>
		<comments>http://nextwebdesigns.com/2008/01/04/mysql-blob-insert-error/#comments</comments>
		<pubDate>Fri, 04 Jan 2008 21:54:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Software Design]]></category>

		<guid isPermaLink="false">http://nextwebdesigns.com/?p=22</guid>
		<description><![CDATA[When using MySQL to store things such as files, it is best to use a blob field.  If you're using a blob field, but having trouble with inserting some data into it (like a file), you might want to check the MySQL environment varibale max_allowed_packet.  The max_allowed_packet variable can be found in your configuration file [...]]]></description>
			<content:encoded><![CDATA[<p>When using MySQL to store things such as files, it is best to use a blob field.  If you're using a blob field, but having trouble with inserting some data into it (like a file), you might want to check the MySQL environment varibale <strong>max_allowed_packet</strong>.  The <strong>max_allowed_packet</strong> variable can be found in your configuration file (usually /etc/my.cnf), and is usually set to something around 1 MB.  If you try to insert a binary file larger than 1MB, the MySQL insert will fail.  All that's needed, is to change to max_allowed_packet to something larger, then, restart MySQL:</p>
<p><img src="http://nextwebdesigns.com/wp-content/uploads/2008/01/mysql_max_allowed_packet3.jpg" alt="MySQL Max Allowed Packet" /></p>
]]></content:encoded>
			<wfw:commentRss>http://nextwebdesigns.com/2008/01/04/mysql-blob-insert-error/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
