<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.3.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Comments on: LispCast Episode 4</title>
	<link>http://www.lispcast.com/wordpress/2007/11/lispcast-episode-4/</link>
	<description></description>
	<pubDate>Thu, 04 Dec 2008 03:54:29 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.1</generator>
		<item>
		<title>By: admin</title>
		<link>http://www.lispcast.com/wordpress/2007/11/lispcast-episode-4/#comment-529</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Fri, 14 Dec 2007 19:32:36 +0000</pubDate>
		<guid>http://www.lispcast.com/wordpress/2007/11/lispcast-episode-4/#comment-529</guid>
		<description>@rohan  Thanks for the encouragement.  I'm planning on making a video showing me package everything up.  It will probably be the last LispCast in the Reddit Clone series.

@William  Good work.</description>
		<content:encoded><![CDATA[<p>@rohan  Thanks for the encouragement.  I&#8217;m planning on making a video showing me package everything up.  It will probably be the last LispCast in the Reddit Clone series.</p>
<p>@William  Good work.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: LispCast Episode 5 &#124; LispCast</title>
		<link>http://www.lispcast.com/wordpress/2007/11/lispcast-episode-4/#comment-528</link>
		<dc:creator>LispCast Episode 5 &#124; LispCast</dc:creator>
		<pubDate>Mon, 10 Dec 2007 07:48:10 +0000</pubDate>
		<guid>http://www.lispcast.com/wordpress/2007/11/lispcast-episode-4/#comment-528</guid>
		<description>[...] Plus, I revised the acceptance tests behind the scenes to use the new database backend. The tests should work for the code from last episode. [...]</description>
		<content:encoded><![CDATA[<p>[&#8230;] Plus, I revised the acceptance tests behind the scenes to use the new database backend. The tests should work for the code from last episode. [&#8230;]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: William Roe</title>
		<link>http://www.lispcast.com/wordpress/2007/11/lispcast-episode-4/#comment-527</link>
		<dc:creator>William Roe</dc:creator>
		<pubDate>Wed, 05 Dec 2007 23:56:58 +0000</pubDate>
		<guid>http://www.lispcast.com/wordpress/2007/11/lispcast-episode-4/#comment-527</guid>
		<description>Great tutorial.
Now. Anyone whom, like me, has tried to go through it all with Postgres rather than MySQL might come up against the problem I did - the "serial" data type and getting the latest ID when inserting a record won't work in the same way. The problem is that CLSQL complains that you try to insert a record with NULL in the id field when it's got a not-null constraint. I can't find any way to make CLSQL *not* include the id field when creating the record, but the code that works is as follows:

(defun add-link (link)
  (with-db (db)
    (clsql:with-transaction (:database db)
      (when (null (id link))
    (setf (slot-value link 'id)
          (first
           (first
        (clsql:query "SELECT NEXTVAL('link_id_seq');")))))
      (clsql:update-records-from-instance link :database db))))

In other words - grab the next ID first, then insert the record.</description>
		<content:encoded><![CDATA[<p>Great tutorial.<br />
Now. Anyone whom, like me, has tried to go through it all with Postgres rather than MySQL might come up against the problem I did - the &#8220;serial&#8221; data type and getting the latest ID when inserting a record won&#8217;t work in the same way. The problem is that CLSQL complains that you try to insert a record with NULL in the id field when it&#8217;s got a not-null constraint. I can&#8217;t find any way to make CLSQL *not* include the id field when creating the record, but the code that works is as follows:</p>
<p>(defun add-link (link)<br />
  (with-db (db)<br />
    (clsql:with-transaction (:database db)<br />
      (when (null (id link))<br />
    (setf (slot-value link &#8216;id)<br />
          (first<br />
           (first<br />
        (clsql:query &#8220;SELECT NEXTVAL(&#8217;link_id_seq&#8217;);&#8221;)))))<br />
      (clsql:update-records-from-instance link :database db))))</p>
<p>In other words - grab the next ID first, then insert the record.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: rohan</title>
		<link>http://www.lispcast.com/wordpress/2007/11/lispcast-episode-4/#comment-526</link>
		<dc:creator>rohan</dc:creator>
		<pubDate>Wed, 05 Dec 2007 06:33:05 +0000</pubDate>
		<guid>http://www.lispcast.com/wordpress/2007/11/lispcast-episode-4/#comment-526</guid>
		<description>Fabulous web casts, thank you.

Nice and practical, and easy to follow.  For me at least you are
achieving your goal of making lisp very approachable.  I do have a
suggestion, selfishly motivated, and that is packaging things up and
asdf-ing them.

Name spacing is important (unless you live in php world, in which case
it is still important, but there is little you can do about it, been
there, done that, cried the tears), and cl has a great facility for
handling this, but it is not very user friendly, and is almost
definitely a source of frustration for newbies to lisp.

Add to that, asdf possibly giving additional errors... It is such a
convenient facility, and allows you to have a neat package at the end
that handles everything, so you can let others use it.

Anyway, it is a thought, and thanks again for all the fabulous work.

Rohan</description>
		<content:encoded><![CDATA[<p>Fabulous web casts, thank you.</p>
<p>Nice and practical, and easy to follow.  For me at least you are<br />
achieving your goal of making lisp very approachable.  I do have a<br />
suggestion, selfishly motivated, and that is packaging things up and<br />
asdf-ing them.</p>
<p>Name spacing is important (unless you live in php world, in which case<br />
it is still important, but there is little you can do about it, been<br />
there, done that, cried the tears), and cl has a great facility for<br />
handling this, but it is not very user friendly, and is almost<br />
definitely a source of frustration for newbies to lisp.</p>
<p>Add to that, asdf possibly giving additional errors&#8230; It is such a<br />
convenient facility, and allows you to have a neat package at the end<br />
that handles everything, so you can let others use it.</p>
<p>Anyway, it is a thought, and thanks again for all the fabulous work.</p>
<p>Rohan</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andreas Wagner</title>
		<link>http://www.lispcast.com/wordpress/2007/11/lispcast-episode-4/#comment-525</link>
		<dc:creator>Andreas Wagner</dc:creator>
		<pubDate>Sun, 02 Dec 2007 00:29:35 +0000</pubDate>
		<guid>http://www.lispcast.com/wordpress/2007/11/lispcast-episode-4/#comment-525</guid>
		<description>Great job!

It would be great if this was on iTunes though.</description>
		<content:encoded><![CDATA[<p>Great job!</p>
<p>It would be great if this was on iTunes though.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: brad</title>
		<link>http://www.lispcast.com/wordpress/2007/11/lispcast-episode-4/#comment-524</link>
		<dc:creator>brad</dc:creator>
		<pubDate>Mon, 19 Nov 2007 06:45:54 +0000</pubDate>
		<guid>http://www.lispcast.com/wordpress/2007/11/lispcast-episode-4/#comment-524</guid>
		<description>Bravo, keep up the good work!</description>
		<content:encoded><![CDATA[<p>Bravo, keep up the good work!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: admin</title>
		<link>http://www.lispcast.com/wordpress/2007/11/lispcast-episode-4/#comment-523</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Tue, 13 Nov 2007 04:21:24 +0000</pubDate>
		<guid>http://www.lispcast.com/wordpress/2007/11/lispcast-episode-4/#comment-523</guid>
		<description>Ha!  Good eye!  You caught me!  As I was adding sound to my video, I realized that I had forgotten to add the transaction around saving a new link and fetching the id.  There should be a CLSQL:WITH-TRANSACTION around the whole thing.

About the use of MAX(ID): I did find that feature in the documentation, but it didn't work as described.  Nothing I tried worked better than MAX(ID), so I just stuck with it.

Thanks for the comments!</description>
		<content:encoded><![CDATA[<p>Ha!  Good eye!  You caught me!  As I was adding sound to my video, I realized that I had forgotten to add the transaction around saving a new link and fetching the id.  There should be a CLSQL:WITH-TRANSACTION around the whole thing.</p>
<p>About the use of MAX(ID): I did find that feature in the documentation, but it didn&#8217;t work as described.  Nothing I tried worked better than MAX(ID), so I just stuck with it.</p>
<p>Thanks for the comments!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joost Diepenmaat</title>
		<link>http://www.lispcast.com/wordpress/2007/11/lispcast-episode-4/#comment-522</link>
		<dc:creator>Joost Diepenmaat</dc:creator>
		<pubDate>Mon, 12 Nov 2007 23:20:12 +0000</pubDate>
		<guid>http://www.lispcast.com/wordpress/2007/11/lispcast-episode-4/#comment-522</guid>
		<description>I'm not sure if you added a transaction in the right place to fix this, but when adding a link, doing an INSERT and then getting the MAX(id) creates a race condition.

Also, MySQL has it a specific feature where you can get the latest inserted ID for your specific database handle, so you won't need to use transactions or get MAX(id), but I haven't checked out clsql to see if that's supported.

Cheers,
Joost.</description>
		<content:encoded><![CDATA[<p>I&#8217;m not sure if you added a transaction in the right place to fix this, but when adding a link, doing an INSERT and then getting the MAX(id) creates a race condition.</p>
<p>Also, MySQL has it a specific feature where you can get the latest inserted ID for your specific database handle, so you won&#8217;t need to use transactions or get MAX(id), but I haven&#8217;t checked out clsql to see if that&#8217;s supported.</p>
<p>Cheers,<br />
Joost.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Seth</title>
		<link>http://www.lispcast.com/wordpress/2007/11/lispcast-episode-4/#comment-521</link>
		<dc:creator>Seth</dc:creator>
		<pubDate>Mon, 12 Nov 2007 20:10:14 +0000</pubDate>
		<guid>http://www.lispcast.com/wordpress/2007/11/lispcast-episode-4/#comment-521</guid>
		<description>Another awesome tutorial.  Thanks for everything, especially the command logging.</description>
		<content:encoded><![CDATA[<p>Another awesome tutorial.  Thanks for everything, especially the command logging.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: admin</title>
		<link>http://www.lispcast.com/wordpress/2007/11/lispcast-episode-4/#comment-520</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Mon, 12 Nov 2007 16:09:30 +0000</pubDate>
		<guid>http://www.lispcast.com/wordpress/2007/11/lispcast-episode-4/#comment-520</guid>
		<description>Yes.  I remember that part.  It is a double click.</description>
		<content:encoded><![CDATA[<p>Yes.  I remember that part.  It is a double click.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
