<?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>Game g = new Game(); &#187; survey</title>
	<atom:link href="http://thomasschweitzer.com/tag/survey/feed/" rel="self" type="application/rss+xml" />
	<link>http://thomasschweitzer.com</link>
	<description>Nerdy thoughts</description>
	<lastBuildDate>Fri, 28 May 2010 09:25:35 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Integrating a survey tool in your web application</title>
		<link>http://thomasschweitzer.com/2009/01/23/integrating-a-survey-tool-in-your-web-application/</link>
		<comments>http://thomasschweitzer.com/2009/01/23/integrating-a-survey-tool-in-your-web-application/#comments</comments>
		<pubDate>Fri, 23 Jan 2009 09:48:18 +0000</pubDate>
		<dc:creator>tom</dc:creator>
				<category><![CDATA[technics]]></category>
		<category><![CDATA[tools]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[hibernate]]></category>
		<category><![CDATA[interceptor]]></category>
		<category><![CDATA[limesurvey]]></category>
		<category><![CDATA[survey]]></category>

		<guid isPermaLink="false">http://thomasschweitzer.com/?p=129</guid>
		<description><![CDATA[Facing the question how to implement a basic survey functionality within a web application, I had several options:

Implementing a new system from scratch
Linking to an external hosted system
Integrating an existing 3rd party survey tool into the web application

The survey features were important, but would not justify a big amount of workload, so implementing a new [...]]]></description>
			<content:encoded><![CDATA[<p>Facing the question how to implement a basic survey functionality within a web application, I had several options:</p>
<ul>
<li>Implementing a new system from scratch</li>
<li>Linking to an external hosted system</li>
<li>Integrating an existing 3rd party survey tool into the web application</li>
</ul>
<p>The survey features were important, but would not justify a big amount of workload, so implementing a new system from scratch (that would give enough flexibilty to support different types of question types and complex ways of analyzing results) was out of the question.</p>
<p>The downside of this decision was that the survey administration will not be integrated into the rest of the administration interface, but we could live with that.</p>
<p>Linking to an external hosted system (like <a href="http://www.surveymonkey.com/">SurveyMonkey</a> or <a href="http://www.surveygizmo.com/">SurveyGizmo</a>) sounded nice, but I needed to be able to control access to the survey via tokens &#8211; so that a single user could answer a certain survey only once by using a token issued to him by me.</p>
<p>Most of the external hosted survey tools have no problem using tokens, but I needed to dynamically generate this token within my web application right before I send the user the invitation to answer the survey, so I needed to be able to insert new tokens <em>at runtime</em> from my application &#8211; and could not figure out how to do that using a hosted system.</p>
<p>By integrating an existing solution, I would be able to have direct access to the (local) database, inserting tokens on the fly.</p>
<p>What I ended up doing was using the open source <a href="http://www.limesurvey.org/">LimeSurvey</a>. It&#8217;s a standard PHP/mySQL application, and seems like the defacto standard solution for surveys on the web.</p>
<p>LimeSurvey can serve all sorts of question types, and &#8211; most importantly &#8211; use tokens to control access to restricted, non-anonymous surveys.</p>
<p>These tokens are stored in DB tables named <strong>tokens_&lt;SURVEYID&gt;</strong> whereas &lt;SURVEYID&gt; is (you guessed it) the numerical ID of the survey.</p>
<p>Now, if you construct the SQL update statement manually, it&#8217;s pretty easy to concat the survey ID into the statement string, but since I was already using <a href="http://www.hibernate.org/">Hibernate</a>, I wanted to refrain from hardcoding SQL in my application.</p>
<p>After some <a href="http://java.dzone.com/articles/hibernate-dynamic-table-routin">research</a>, I implemented a custom Hibernate Interceptor, which allowed me to insert the surveyID into the SQL-string on the fly without any other hassle.</p>
<p>I will write more about how we use and trigger the survey invitations in a later post.</p>



Share this:


	<a rel="nofollow"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fthomasschweitzer.com%2F2009%2F01%2F23%2Fintegrating-a-survey-tool-in-your-web-application%2F&amp;title=Integrating%20a%20survey%20tool%20in%20your%20web%20application&amp;source=Game+g+%3D+new+Game%28%29%3B+Nerdy+thoughts&amp;summary=Facing%20the%20question%20how%20to%20implement%20a%20basic%20survey%20functionality%20within%20a%20web%20application%2C%20I%20had%20several%20options%3A%0D%0A%0D%0A%09Implementing%20a%20new%20system%20from%20scratch%0D%0A%09Linking%20to%20an%20external%20hosted%20system%0D%0A%09Integrating%20an%20existing%203rd%20party%20survey%20tool%20into%20" title="LinkedIn"><img src="http://thomasschweitzer.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fthomasschweitzer.com%2F2009%2F01%2F23%2Fintegrating-a-survey-tool-in-your-web-application%2F&amp;title=Integrating%20a%20survey%20tool%20in%20your%20web%20application&amp;notes=Facing%20the%20question%20how%20to%20implement%20a%20basic%20survey%20functionality%20within%20a%20web%20application%2C%20I%20had%20several%20options%3A%0D%0A%0D%0A%09Implementing%20a%20new%20system%20from%20scratch%0D%0A%09Linking%20to%20an%20external%20hosted%20system%0D%0A%09Integrating%20an%20existing%203rd%20party%20survey%20tool%20into%20" title="del.icio.us"><img src="http://thomasschweitzer.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fthomasschweitzer.com%2F2009%2F01%2F23%2Fintegrating-a-survey-tool-in-your-web-application%2F&amp;title=Integrating%20a%20survey%20tool%20in%20your%20web%20application&amp;bodytext=Facing%20the%20question%20how%20to%20implement%20a%20basic%20survey%20functionality%20within%20a%20web%20application%2C%20I%20had%20several%20options%3A%0D%0A%0D%0A%09Implementing%20a%20new%20system%20from%20scratch%0D%0A%09Linking%20to%20an%20external%20hosted%20system%0D%0A%09Integrating%20an%20existing%203rd%20party%20survey%20tool%20into%20" title="Digg"><img src="http://thomasschweitzer.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fthomasschweitzer.com%2F2009%2F01%2F23%2Fintegrating-a-survey-tool-in-your-web-application%2F&amp;t=Integrating%20a%20survey%20tool%20in%20your%20web%20application" title="Facebook"><img src="http://thomasschweitzer.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fthomasschweitzer.com%2F2009%2F01%2F23%2Fintegrating-a-survey-tool-in-your-web-application%2F&amp;title=Integrating%20a%20survey%20tool%20in%20your%20web%20application&amp;annotation=Facing%20the%20question%20how%20to%20implement%20a%20basic%20survey%20functionality%20within%20a%20web%20application%2C%20I%20had%20several%20options%3A%0D%0A%0D%0A%09Implementing%20a%20new%20system%20from%20scratch%0D%0A%09Linking%20to%20an%20external%20hosted%20system%0D%0A%09Integrating%20an%20existing%203rd%20party%20survey%20tool%20into%20" title="Google Bookmarks"><img src="http://thomasschweitzer.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fthomasschweitzer.com%2F2009%2F01%2F23%2Fintegrating-a-survey-tool-in-your-web-application%2F&amp;title=Integrating%20a%20survey%20tool%20in%20your%20web%20application" title="StumbleUpon"><img src="http://thomasschweitzer.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="" title="TwitThis"><img src="http://thomasschweitzer.com/wp-content/plugins/sociable/images/" title="TwitThis" alt="TwitThis" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://thomasschweitzer.com/2009/01/23/integrating-a-survey-tool-in-your-web-application/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
