<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/rss2full.xsl" type="text/xsl" media="screen"?><?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/itemcontent.css" type="text/css" media="screen"?><!-- generator="wordpress/2.0.2" --><rss 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:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>AS Workshop</title>
	<link>http://www.arraystudio.com/as-workshop</link>
	<description>Explore possibilities</description>
	<pubDate>Fri, 17 Oct 2008 10:31:20 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.0.2</generator>
	<language>en</language>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/as-workshop" type="application/rss+xml" /><item>
		<title>Strip Generator</title>
		<link>http://feeds.feedburner.com/~r/as-workshop/~3/172870247/strip-generator.html</link>
		<comments>http://www.arraystudio.com/as-workshop/strip-generator.html#comments</comments>
		<pubDate>Sun, 21 Oct 2007 12:35:25 +0000</pubDate>
		<dc:creator>Slobodan Kovacevic</dc:creator>
		
	<category>Resources and Links</category>
		<guid isPermaLink="false">http://www.arraystudio.com/as-workshop/strip-generator.html</guid>
		<description><![CDATA[While working on re-wamp of one of our old projects, I stumbled on one entry describing Strip Generator website. I am amazed with this website. 
It is for creating one-line strips for free, with predefined characters and objects - so easy to use! For all this time I spent working as a Web Designer I [...]]]></description>
			<content:encoded><![CDATA[<p>While working on re-wamp of one of our old projects, I stumbled on one entry describing <a href="http://www.stripgenerator.com/">Strip Generator</a> website. I am amazed with this website. </p>
<p>It is for creating one-line strips for free, with predefined characters and objects - so easy to use! For all this time I spent working as a Web Designer I met so bizzare people and dealt with so many different situations&#8230; and I think this is the best way to present them. These guys made a hell of an effort to make this work and furthermore - this looks fantastic.</p>
<p>Here is what I created in 10 minutes.<br />
<a class="imagelink" href="http://www.arraystudio.com/as-workshop/wp-content/uploads/2007/10/dealing-with-clients.png" title="Dealing with clients"><img id="image115" src="http://www.arraystudio.com/as-workshop/wp-content/uploads/2007/10/dealing-with-clients.thumbnail.png" alt="Dealing with clients" /></a>.</p>
<p>Don&#8217;t mind me saying - but I created <a href="http://kamassy.stripgenerator.com/">my own strip blog</a> as well. <img src='http://www.arraystudio.com/as-workshop/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
Try and enjoy!<!-- ~ --><!-- ~ -->
</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~f/as-workshop?a=HmKZnmA"><img src="http://feeds.feedburner.com/~f/as-workshop?i=HmKZnmA" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/as-workshop?a=OaL2r2A"><img src="http://feeds.feedburner.com/~f/as-workshop?i=OaL2r2A" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/as-workshop?a=YosAvNA"><img src="http://feeds.feedburner.com/~f/as-workshop?i=YosAvNA" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/as-workshop?a=vg7NAEa"><img src="http://feeds.feedburner.com/~f/as-workshop?i=vg7NAEa" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/as-workshop/~4/172870247" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.arraystudio.com/as-workshop/strip-generator.html/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.arraystudio.com/as-workshop/strip-generator.html</feedburner:origLink></item>
		<item>
		<title>Use Rails logger in tests</title>
		<link>http://feeds.feedburner.com/~r/as-workshop/~3/165646947/use-rails-logger-in-tests.html</link>
		<comments>http://www.arraystudio.com/as-workshop/use-rails-logger-in-tests.html#comments</comments>
		<pubDate>Fri, 05 Oct 2007 10:58:03 +0000</pubDate>
		<dc:creator>Slobodan Kovacevic</dc:creator>
		
	<category>Resources and Links</category>
	<category>Ruby &amp; Rails</category>
		<guid isPermaLink="false">http://www.arraystudio.com/as-workshop/use-rails-logger-in-tests.html</guid>
		<description><![CDATA[For some debugging in Rails test we wanted to be able to log data via Rails logger. Unfortunately, as it turns out you cannot directly access logger from tests (which is strange). Since we needed to add information to test.log we used this small piece of code (added to test_helper.rb):
def logger
    RAILS_DEFAULT_LOGGER
end
and [...]]]></description>
			<content:encoded><![CDATA[<p>For some debugging in Rails test we wanted to be able to log data via Rails logger. Unfortunately, as it turns out you cannot directly access logger from tests (which is strange). Since we needed to add information to test.log we used this small piece of code (added to test_helper.rb):</p>
<div class="codesnip-container" >def logger<br />
    RAILS_DEFAULT_LOGGER<br />
end</div>
<p>and just use it in tests like this:</p>
<div class="codesnip-container" >logger.info(&#8217;performing test now&#8217;)</div>
<p>[via <a href="http://www.robbyonrails.com/articles/2006/01/25/rails-logger-and-those-pesky-tests">Robby on Rails</a>]
</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~f/as-workshop?a=g4pFZ6Jt"><img src="http://feeds.feedburner.com/~f/as-workshop?i=g4pFZ6Jt" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/as-workshop?a=sAvkh8oI"><img src="http://feeds.feedburner.com/~f/as-workshop?i=sAvkh8oI" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/as-workshop?a=3fcxVyJF"><img src="http://feeds.feedburner.com/~f/as-workshop?i=3fcxVyJF" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/as-workshop?a=bn8sEppt"><img src="http://feeds.feedburner.com/~f/as-workshop?i=bn8sEppt" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/as-workshop/~4/165646947" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.arraystudio.com/as-workshop/use-rails-logger-in-tests.html/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.arraystudio.com/as-workshop/use-rails-logger-in-tests.html</feedburner:origLink></item>
		<item>
		<title>New Free 1280×800 wallpaper</title>
		<link>http://feeds.feedburner.com/~r/as-workshop/~3/148220770/new-free-1280x800-wallpaper.html</link>
		<comments>http://www.arraystudio.com/as-workshop/new-free-1280x800-wallpaper.html#comments</comments>
		<pubDate>Sat, 25 Aug 2007 22:30:31 +0000</pubDate>
		<dc:creator>Predrag</dc:creator>
		
	<category>1280x800 Wallpapers</category>
		<guid isPermaLink="false">http://www.arraystudio.com/as-workshop/new-free-1280x800-wallpaper.html</guid>
		<description><![CDATA[Finally I&#8217;ve found some creativity inside   With temperatures over 35C I just couldn&#8217;t do it. This one is calm, maybe too green and dark, but it fits with my current mood. I have some brighter variations in mind, so I&#8217;ll keep you notified once I add it.
In order to see the point of [...]]]></description>
			<content:encoded><![CDATA[<p>Finally I&#8217;ve found some creativity inside <img src='http://www.arraystudio.com/as-workshop/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  With temperatures over 35C I just couldn&#8217;t do it. This one is calm, maybe too green and dark, but it fits with my current mood. I have some brighter variations in mind, so I&#8217;ll keep you notified once I add it.</p>
<p>In order to see the point of this wallpaper, turn your laptop upside down <img src='http://www.arraystudio.com/as-workshop/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  If you have a desktop, it&#8217;ll be a bit tricky.</p>
<p>Anyway, here it is and let me know what you think.<br />
<a class="imagelink" href="http://www.arraystudio.com/as-workshop/wp-content/uploads/2007/08/hotshot2.jpg" title="Hot Shot Designer"><img id="image112" src="http://www.arraystudio.com/as-workshop/wp-content/uploads/2007/08/hotshot_thumb.jpg" alt="Hot Shot Designer" /></a></p>
<p>You can find more free <a href="http://www.arraystudio.com/as-workshop/1280x800-widescreen-wallpapers">1280&#215;800 widescreen wallpapers</a> on this <a href="http://www.arraystudio.com/as-workshop/1280x800-widescreen-wallpapers">page</a>.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~f/as-workshop?a=ssawGDQz"><img src="http://feeds.feedburner.com/~f/as-workshop?i=ssawGDQz" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/as-workshop?a=UP1kok9b"><img src="http://feeds.feedburner.com/~f/as-workshop?i=UP1kok9b" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/as-workshop?a=u4Yfwg5X"><img src="http://feeds.feedburner.com/~f/as-workshop?i=u4Yfwg5X" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/as-workshop?a=aZYacE3h"><img src="http://feeds.feedburner.com/~f/as-workshop?i=aZYacE3h" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/as-workshop/~4/148220770" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.arraystudio.com/as-workshop/new-free-1280x800-wallpaper.html/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.arraystudio.com/as-workshop/new-free-1280x800-wallpaper.html</feedburner:origLink></item>
		<item>
		<title>Nested :include ActiveRecord option</title>
		<link>http://feeds.feedburner.com/~r/as-workshop/~3/127273422/nested-include-activerecord-option.html</link>
		<comments>http://www.arraystudio.com/as-workshop/nested-include-activerecord-option.html#comments</comments>
		<pubDate>Sat, 23 Jun 2007 12:21:38 +0000</pubDate>
		<dc:creator>Slobodan Kovacevic</dc:creator>
		
	<category>Programming</category>
	<category>Ruby &amp; Rails</category>
		<guid isPermaLink="false">http://www.arraystudio.com/as-workshop/nested-include-activerecord-option.html</guid>
		<description><![CDATA[While working on a site I had User, Order, OrderItems and Product models and they were related like this:
Order belongs_to User
Order has_many OrderItems
OrderItem belongs_to Product
So, when displaying an order I found myself doing accessing product through order_item, i.e. @order.order_items.product.name.
Although this worked problem was that even though I have told Rails using :include to eager load [...]]]></description>
			<content:encoded><![CDATA[<p>While working on a site I had User, Order, OrderItems and Product models and they were related like this:</p>
<p>Order belongs_to User<br />
Order has_many OrderItems<br />
OrderItem belongs_to Product</p>
<p>So, when displaying an order I found myself doing accessing product through order_item, i.e. @order.order_items.product.name.</p>
<p>Although this worked problem was that even though I have told Rails using :include to eager load order_items it didn&#8217;t load products, so whenever I accessed a product it executed a separate SQL query. In other words, to display order with 10 products it required 11 SQL queries - hardly optimized.</p>
<p>Rails API documentation doesn&#8217;t say anything about eager loading &#8220;second&#8221; level, but after some searching I found that you can do that you can do <a href="http://snippets.dzone.com/posts/show/2089">nested :includes</a>, like this:</p>
<div class="codesnip-container" >Order.find(id, :include => [{:order_items, :product}, :user]</div>
<p>This will eager load User and OrderItems, but it will also eager load Products under each OrderItem. This decreased my number of queries from 11 for 10 product order to only one (big one).</p>
<p>You can read more (for example, it appears that you can nest multiple :includes) about this undocumented feature in <a href="http://snippets.dzone.com/posts/show/2089">&#8216;The beauty of a nested &#8216;:include&#8217; option&#8217;</a>.
</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~f/as-workshop?a=2UwYJZm0"><img src="http://feeds.feedburner.com/~f/as-workshop?i=2UwYJZm0" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/as-workshop?a=PPgxklij"><img src="http://feeds.feedburner.com/~f/as-workshop?i=PPgxklij" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/as-workshop?a=dMYv2gIW"><img src="http://feeds.feedburner.com/~f/as-workshop?i=dMYv2gIW" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/as-workshop?a=nWU3pEMV"><img src="http://feeds.feedburner.com/~f/as-workshop?i=nWU3pEMV" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/as-workshop/~4/127273422" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.arraystudio.com/as-workshop/nested-include-activerecord-option.html/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.arraystudio.com/as-workshop/nested-include-activerecord-option.html</feedburner:origLink></item>
		<item>
		<title>LocalizationSimplified</title>
		<link>http://feeds.feedburner.com/~r/as-workshop/~3/112120335/localizationsimplified.html</link>
		<comments>http://www.arraystudio.com/as-workshop/localizationsimplified.html#comments</comments>
		<pubDate>Thu, 26 Apr 2007 11:29:24 +0000</pubDate>
		<dc:creator>Slobodan Kovacevic</dc:creator>
		
	<category>Ruby &amp; Rails</category>
		<guid isPermaLink="false">http://www.arraystudio.com/as-workshop/localizationsimplified.html</guid>
		<description><![CDATA[Rails is excellent in handling almost everything if you are building a site in English. Unfortunately, when it comes to localization (sites in other languages, UTF-8 support, etc.) Rails is not very well equipped to handle it.
There are localization plugins that make life easier, but most of them are rather complex, hard to use and [...]]]></description>
			<content:encoded><![CDATA[<p>Rails is excellent in handling almost everything if you are building a site in English. Unfortunately, when it comes to localization (sites in other languages, UTF-8 support, etc.) Rails is not very well equipped to handle it.</p>
<p>There are localization plugins that make life easier, but most of them are rather complex, hard to use and have significant overhead (i.e. takes time to setup, learn, etc.). Fortunately, plugin called <a href="http://rubyforge.org/projects/l10n-simplified/">Localization Simplified</a> aims to simplify localization as much as possible:</p>
<blockquote><p>Fast and easy localization of one-language applications. Adds UTF-8 support for Ruby + database. Modifies ActiveRecord errors + html error helpers, Date/Time helpers, locale time formats, to_currency, to_sentence</p></blockquote>
<p>It&#8217;s easy to use mainly because it only overrides existing Rails methods, so you don&#8217;t have to do anything special to use it.</p>
<p><a href="http://rubyforge.org/projects/l10n-simplified/">Localization Simplified</a> is a great plugin which you can download from Ruby Forge.
</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~f/as-workshop?a=xMOGdaHj"><img src="http://feeds.feedburner.com/~f/as-workshop?i=xMOGdaHj" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/as-workshop?a=HqtgFUuE"><img src="http://feeds.feedburner.com/~f/as-workshop?i=HqtgFUuE" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/as-workshop?a=I3Fq8VGB"><img src="http://feeds.feedburner.com/~f/as-workshop?i=I3Fq8VGB" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/as-workshop?a=gVGjrcJe"><img src="http://feeds.feedburner.com/~f/as-workshop?i=gVGjrcJe" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/as-workshop/~4/112120335" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.arraystudio.com/as-workshop/localizationsimplified.html/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.arraystudio.com/as-workshop/localizationsimplified.html</feedburner:origLink></item>
		<item>
		<title>1280×800 Widescreen Wallpapers</title>
		<link>http://feeds.feedburner.com/~r/as-workshop/~3/104455142/1280x800-widescreen-wallpapers.html</link>
		<comments>http://www.arraystudio.com/as-workshop/1280x800-widescreen-wallpapers.html#comments</comments>
		<pubDate>Mon, 26 Mar 2007 11:57:31 +0000</pubDate>
		<dc:creator>Predrag</dc:creator>
		
	<category>Resources and Links</category>
	<category>1280x800 Wallpapers</category>
		<guid isPermaLink="false">http://www.arraystudio.com/as-workshop/1280x800-widescreen-wallpapers.html</guid>
		<description><![CDATA[
In order to keep all our wallpapers in one place, we decided to create a separate page for all of them. So, if you wish to check them out, go to this page, or follow the link below.
Much more to come very soon!
View All 1280&#215;800 Widescreen Wallpapers

]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.arraystudio.com/as-workshop/1280x800-widescreen-wallpapers"><img id="image105" src="http://www.arraystudio.com/as-workshop/wp-content/uploads/2007/03/small_wallpapers.jpg" alt="small_wallpapers.jpg" title="1280x800 Widescreen Wallpapers for free" alt="1280x800 Widescreen Wallpapers for free" /></a></p>
<p>In order to keep all our wallpapers in one place, we decided to create a separate page for all of them. So, if you wish to check them out, go to this <a href="http://www.arraystudio.com/as-workshop/1280x800-widescreen-wallpapers">page</a>, or follow the link below.</p>
<p>Much more to come very soon!</p>
<p><a href="http://www.arraystudio.com/as-workshop/1280x800-widescreen-wallpapers">View All 1280&#215;800 Widescreen Wallpapers</a>
</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~f/as-workshop?a=q8BgtqkA"><img src="http://feeds.feedburner.com/~f/as-workshop?i=q8BgtqkA" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/as-workshop?a=G3P8TYox"><img src="http://feeds.feedburner.com/~f/as-workshop?i=G3P8TYox" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/as-workshop?a=MRY7R5Oj"><img src="http://feeds.feedburner.com/~f/as-workshop?i=MRY7R5Oj" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/as-workshop?a=UUqt34zq"><img src="http://feeds.feedburner.com/~f/as-workshop?i=UUqt34zq" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/as-workshop/~4/104455142" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.arraystudio.com/as-workshop/1280x800-widescreen-wallpapers.html/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.arraystudio.com/as-workshop/1280x800-widescreen-wallpapers.html</feedburner:origLink></item>
		<item>
		<title>Rails Source Code Annotations</title>
		<link>http://feeds.feedburner.com/~r/as-workshop/~3/99259302/rails-source-code-annotations.html</link>
		<comments>http://www.arraystudio.com/as-workshop/rails-source-code-annotations.html#comments</comments>
		<pubDate>Sun, 04 Mar 2007 16:02:55 +0000</pubDate>
		<dc:creator>Slobodan Kovacevic</dc:creator>
		
	<category>Ruby &amp; Rails</category>
		<guid isPermaLink="false">http://www.arraystudio.com/as-workshop/rails-source-code-annotations.html</guid>
		<description><![CDATA[
I&#8217;ve been catching up on my blog reading and I&#8217;ve stumbled upon an article describing a great new feature in Edge Rails that lets you add annotations to your code. You can use TODO, OPTIMIZE and FIXME to mark parts of your code. Then you can use rake notes to list annotations - which is [...]]]></description>
			<content:encoded><![CDATA[<p><img id="image98" src="http://www.arraystudio.com/as-workshop/wp-content/uploads/2007/03/rails-logo-small.jpg" alt="Ruby On Rails" style="float:left;" /><br />
I&#8217;ve been catching up on my blog reading and I&#8217;ve stumbled upon an <a href="http://ryandaigle.com/articles/2007/2/26/what-s-new-in-edge-rails-source-code-annotations">article describing a great new feature in Edge Rails</a> that lets you add annotations to your code. You can use TODO, OPTIMIZE and FIXME to mark parts of your code. Then you can use <strong>rake notes</strong> to list annotations - which is great since you won&#8217;t miss any of the notes you made.</p>
<p>The only problem is that this is still in only in Edge Rails, i.e. it&#8217;s not yet in stable Rails release. But there&#8217;s a really simple way to add source code annotations rake task to non-Edge Rails app:</p>
<pre>svn export http://svn.rubyonrails.org/rails/trunk/railties/lib/tasks/annotations.rake \
 lib/tasks/annotations.rake</pre>
<p>For more information about <a href="http://ryandaigle.com/articles/2007/2/26/what-s-new-in-edge-rails-source-code-annotations">Rails source code annotations see Ryan&#8217;s blog</a>.
</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~f/as-workshop?a=L6ao1Tvk"><img src="http://feeds.feedburner.com/~f/as-workshop?i=L6ao1Tvk" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/as-workshop?a=bmfJO499"><img src="http://feeds.feedburner.com/~f/as-workshop?i=bmfJO499" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/as-workshop?a=nU6ntiYa"><img src="http://feeds.feedburner.com/~f/as-workshop?i=nU6ntiYa" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/as-workshop?a=og1tWH4Z"><img src="http://feeds.feedburner.com/~f/as-workshop?i=og1tWH4Z" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/as-workshop/~4/99259302"/>]]></content:encoded>
			<wfw:commentRss>http://www.arraystudio.com/as-workshop/rails-source-code-annotations.html/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.arraystudio.com/as-workshop/rails-source-code-annotations.html</feedburner:origLink></item>
		<item>
		<title>MySQL insert a new row or update old one</title>
		<link>http://feeds.feedburner.com/~r/as-workshop/~3/91616980/mysql-insert-a-new-row-or-update-old-one.html</link>
		<comments>http://www.arraystudio.com/as-workshop/mysql-insert-a-new-row-or-update-old-one.html#comments</comments>
		<pubDate>Fri, 16 Feb 2007 13:15:34 +0000</pubDate>
		<dc:creator>Slobodan Kovacevic</dc:creator>
		
	<category>Programming</category>
	<category>Resources and Links</category>
		<guid isPermaLink="false">http://www.arraystudio.com/as-workshop/mysql-insert-a-new-row-or-update-old-one.html</guid>
		<description><![CDATA[Today I stumbled upon a newish MySQL feature that can often be very useful. Since MySQL 4.1 there&#8217;s a non-standard feature (i.e. it&#8217;s an extension of SQL standard and won&#8217;t work on other databases) that lets you insert a new row, but if it happens that a row with same primary/unique key already exists it [...]]]></description>
			<content:encoded><![CDATA[<p>Today I stumbled upon a newish MySQL feature that can often be very useful. Since MySQL 4.1 there&#8217;s a non-standard feature (i.e. it&#8217;s an extension of SQL standard and won&#8217;t work on other databases) that lets you insert a new row, but if it happens that a row with same primary/unique key already exists it will just update that row.</p>
<p>Insert query syntax looks like this:</p>
<pre>INSERT INTO table (primarykeycol,col1,col2) VALUES (1,2,3) ON DUPLICATE KEY UPDATE col1=0, col2=col2+1</pre>
<p>If there is already a row with primarykeycol set to 1 this query is equal to:</p>
<pre>UPDATE table SET col1=0, col2=col2+1 WHERE primarykeycol = 1</pre>
<p>Ordinarily to achieve the same result you would have to issue an UPDATE query, then check if there were affected rows and if not issue an INSERT query. This way, you can do everything in one step - first try insert and then update if insert fails.</p>
<p>One situation for which this type of syntax is perfect is when you work with daily counters. For example, you might have a table with PostID, Date and Count columns. Each day you&#8217;d have to check if you already created an entry for that day and if so increase the count column - and this can be easily substituted with one INSERT &#8230; ON DUPLICATE KEY UPDATE query.</p>
<p>Unfortunately there are some caveats. One being that when you have multiple unique indexes it will act as if you had an OR condition in WHERE clause of UPDATE query. This means that multiple rows should be update, but INSERT &#8230; ON DUPLICATE KEY UPDATE will update only one row.</p>
<p>For more information you should read article in MySQL manual: <a href="http://dev.mysql.com/doc/refman/4.1/en/insert-on-duplicate.html">INSERT &#8230; ON DUPLICATE KEY UPDATE Syntax</a>
</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~f/as-workshop?a=Rzk0k5Ze"><img src="http://feeds.feedburner.com/~f/as-workshop?i=Rzk0k5Ze" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/as-workshop?a=Id5umXAS"><img src="http://feeds.feedburner.com/~f/as-workshop?i=Id5umXAS" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/as-workshop?a=pegQ3gkX"><img src="http://feeds.feedburner.com/~f/as-workshop?i=pegQ3gkX" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/as-workshop?a=Heb7GckP"><img src="http://feeds.feedburner.com/~f/as-workshop?i=Heb7GckP" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/as-workshop/~4/91616980"/>]]></content:encoded>
			<wfw:commentRss>http://www.arraystudio.com/as-workshop/mysql-insert-a-new-row-or-update-old-one.html/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.arraystudio.com/as-workshop/mysql-insert-a-new-row-or-update-old-one.html</feedburner:origLink></item>
		<item>
		<title>Free Web based color scheme creator</title>
		<link>http://feeds.feedburner.com/~r/as-workshop/~3/85889408/free-web-based-color-scheme-creator.html</link>
		<comments>http://www.arraystudio.com/as-workshop/free-web-based-color-scheme-creator.html#comments</comments>
		<pubDate>Sat, 03 Feb 2007 13:03:28 +0000</pubDate>
		<dc:creator>Predrag</dc:creator>
		
	<category>Resources and Links</category>
	<category>Web Design</category>
		<guid isPermaLink="false">http://www.arraystudio.com/as-workshop/free-web-based-color-scheme-creator.html</guid>
		<description><![CDATA[I simply enjoy this kind of stuff. Specially if client doesn&#8217;t have any specific color scheme request. This color cycle is easy to use and you can generate great color schemes, if you know where to click.

First, click on the buttons below the cycle and choose from (Mono, Contrast, Triad, Tetrad and Analogic). Then, play [...]]]></description>
			<content:encoded><![CDATA[<p>I simply enjoy this kind of stuff. Specially if client doesn&#8217;t have any specific color scheme request. This color cycle is easy to use and you can generate great color schemes, if you know where to click.</p>
<p><img id="image93" src="http://www.arraystudio.com/as-workshop/wp-content/uploads/2007/02/color_cycle.gif" alt="Color cycle" /></p>
<p>First, click on the buttons below the cycle and choose from (Mono, Contrast, Triad, Tetrad and Analogic). Then, play around with colors and see what you&#8217;ll get.  Use <strong>variations</strong> to set the colors perfectly. There is also a simple preview where you&#8217;ll be able to see how colors fit. I prefer dark and light pastels myself.</p>
<p>Here is the <a href="http://wellstyled.com/tools/colorscheme2/index-en.html">link to Color Scheme Creator</a>. Enjoy.
</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~f/as-workshop?a=dHaHv6IE"><img src="http://feeds.feedburner.com/~f/as-workshop?i=dHaHv6IE" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/as-workshop?a=gkCtLjEy"><img src="http://feeds.feedburner.com/~f/as-workshop?i=gkCtLjEy" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/as-workshop?a=M29LzbAt"><img src="http://feeds.feedburner.com/~f/as-workshop?i=M29LzbAt" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/as-workshop?a=Tyhnaq2w"><img src="http://feeds.feedburner.com/~f/as-workshop?i=Tyhnaq2w" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/as-workshop/~4/85889408"/>]]></content:encoded>
			<wfw:commentRss>http://www.arraystudio.com/as-workshop/free-web-based-color-scheme-creator.html/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.arraystudio.com/as-workshop/free-web-based-color-scheme-creator.html</feedburner:origLink></item>
		<item>
		<title>Niceforms 1.0 - final version</title>
		<link>http://feeds.feedburner.com/~r/as-workshop/~3/84483540/niceforms-10-final-version.html</link>
		<comments>http://www.arraystudio.com/as-workshop/niceforms-10-final-version.html#comments</comments>
		<pubDate>Wed, 31 Jan 2007 15:59:00 +0000</pubDate>
		<dc:creator>Slobodan Kovacevic</dc:creator>
		
	<category>Programming</category>
	<category>Resources and Links</category>
		<guid isPermaLink="false">http://www.arraystudio.com/as-workshop/niceforms-10-final-version.html</guid>
		<description><![CDATA[Over a year ago I wrote about an excellent script called Niceforms and little fix I wrote (see NiceForms with even nicer select). Now a final version has been released - Niceforms 1.0 which solves a lot of problems from previous version.
I still haven&#8217;t had chance to look at the new improvements but it seems [...]]]></description>
			<content:encoded><![CDATA[<p><img id="image91" src="http://www.arraystudio.com/as-workshop/wp-content/uploads/2007/01/niceforms10.png" alt="Niceforms 1.0" style="float:left;" />Over a year ago I wrote about an excellent script called Niceforms and little fix I wrote (see <a href="http://www.arraystudio.com/as-workshop/niceforms-with-even-nicer-select.html">NiceForms with even nicer select</a>). Now a final version has been released - <a href="http://www.badboy.ro/articles/2007-01-30/niceforms/">Niceforms 1.0</a> which solves a lot of problems from previous version.</p>
<p>I still haven&#8217;t had chance to look at the new improvements but it seems that Niceforms now supports keyboard only navigation, scalable buttons, increased browser support, etc.</p>
<p>Unfortunately it still has some of <a href="http://www.arraystudio.com/as-workshop/niceforms-with-even-nicer-select.html">the problems I tried to fix</a> more than a year ago. Granted they tried to fix it, but it still has problems. For example, when you click on a select element if you move over some options and then move out it will immediately close the drop down. On the other hand if you open select element and don&#8217;t move over to any options (i.e. click on down arrow), but you move the mouse away from it - the select will remain open, which can again lead to strange effect where you can have a lot of open drop downs.</p>
<p>Perhaps that can be fixed in future versions - or at least I will try to make a patch for it.</p>
<p>If you want to <a href="http://www.badboy.ro/articles/2007-01-30/niceforms/">get Niceforms 1.0</a> you can from author&#8217;s site.
</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~f/as-workshop?a=6dtKROLr"><img src="http://feeds.feedburner.com/~f/as-workshop?i=6dtKROLr" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/as-workshop?a=WQ9UeyYh"><img src="http://feeds.feedburner.com/~f/as-workshop?i=WQ9UeyYh" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/as-workshop?a=btbANWnd"><img src="http://feeds.feedburner.com/~f/as-workshop?i=btbANWnd" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/as-workshop?a=IVO2Qegq"><img src="http://feeds.feedburner.com/~f/as-workshop?i=IVO2Qegq" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/as-workshop/~4/84483540"/>]]></content:encoded>
			<wfw:commentRss>http://www.arraystudio.com/as-workshop/niceforms-10-final-version.html/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.arraystudio.com/as-workshop/niceforms-10-final-version.html</feedburner:origLink></item>
	</channel>
</rss>
