<?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>Structure in the flow &#187; Clusterify</title>
	<atom:link href="http://www.fsavard.com/flow/tag/clusterify/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.fsavard.com/flow</link>
	<description>Programming, personal knowledge management. Topics unstable.</description>
	<lastBuildDate>Sat, 10 Dec 2011 20:38:44 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Simple Javascript memory game</title>
		<link>http://www.fsavard.com/flow/2010/02/simple-javascript-memory-game/</link>
		<comments>http://www.fsavard.com/flow/2010/02/simple-javascript-memory-game/#comments</comments>
		<pubDate>Sat, 20 Feb 2010 18:24:53 +0000</pubDate>
		<dc:creator>Francois</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Clusterify]]></category>
		<category><![CDATA[pkm]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.fsavard.com/flow/?p=582</guid>
		<description><![CDATA[Here&#8217;s a little memory game I just finished, using jQuery. It&#8217;s very bare bones, and I might add features to it, but it works, doesn&#8217;t have a bunch of ads floating around (like most do on the Web), and the board size can be changed (up to 60 total cards for the moment). For the [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a <a href="http://fsavard.com/code/pairsgame/">little memory game</a> I just finished, using jQuery. It&#8217;s very bare bones, and I might add features to it, but it works, doesn&#8217;t have a bunch of ads floating around (like most do on the Web), and the board size can be changed (up to 60 total cards for the moment).</p>
<p>For the context: when we launched <a href="http://clusterify.com/projects/">Clusterify</a>, one of the early projects I proposed was a <a href="http://clusterify.com/projects/list/fsavard/3/">simple &#8220;matching pairs&#8221; game</a>. Some almost-complete code I wrote up has been sitting on my computer ever since, just needing a few last fixes, and the addition of actual pictures. So I did those last fixes, adapted stock photos for it, and now <a href="http://fsavard.com/code/pairsgame/">here&#8217;s the game</a>.</p>
<h3>Changelog</h3>
<ul>
<li><strong>2010.02.22:</strong> as per a commenter&#8217;s (Jebadiah&#8217;s) suggestion, added a score and a timer. Also, images are now shuffled so the last ones (cats and birds) show up in the smaller grid.</li>
</ul>
 <img src="http://www.fsavard.com/flow/wp-content/plugins/feed-statistics.php?view=1&post_id=582" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.fsavard.com/flow/2010/02/simple-javascript-memory-game/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Altering a Django project to migrate from a simple ManyToMany relation to one with extra information</title>
		<link>http://www.fsavard.com/flow/2009/02/altering-a-django-project-to-migrate-from-a-simple-manytomany-relation-to-one-with-extra-information/</link>
		<comments>http://www.fsavard.com/flow/2009/02/altering-a-django-project-to-migrate-from-a-simple-manytomany-relation-to-one-with-extra-information/#comments</comments>
		<pubDate>Thu, 26 Feb 2009 17:00:21 +0000</pubDate>
		<dc:creator>Francois</dc:creator>
				<category><![CDATA[Clusterify]]></category>
		<category><![CDATA[Django]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.fsavard.com/blog/?p=40</guid>
		<description><![CDATA[There are still quite a few features which could be useful on Clusterify. One I thought could help in structuring projects is the concept of Roles: a way to let users joining a project specify which role they want to take in it. Now, most common tasks are made amazingly easy with Django. Changing models, [...]]]></description>
			<content:encoded><![CDATA[<p>There are still quite a few features which could be useful on Clusterify. One I thought could help in structuring projects is the <strong>concept of Roles</strong>: a way to let users joining a project specify which role they want to take in it.</p>
<p>Now, most common tasks are made amazingly easy with Django. <strong>Changing models</strong>, while probably common, <a href="http://code.djangoproject.com/wiki/SchemaEvolution">seems very <strong>tricky to automate right</strong></a>, though (and anyway would you trust the automation logic to make the right changes?). Yet there&#8217;s <a href="http://code.google.com/p/dmigrations/">dmigrations</a> which I need to try one day.</p>
<p>Back to the original problem: Roles. <strong>Formerly we had a ManyToManyField </strong>in the Project model linked to the User model for users joining a project. In the background, Django creates a table to hold the relationship named after the field (projects_project_joined_users).</p>
<p>The way to add <strong>extra information to a relationship</strong>, in the Django ORM, is with the <a href="http://docs.djangoproject.com/en/dev/topics/db/models/#intermediary-manytomany"><strong>&#8220;through&#8221; argument to the ManyToManyField</strong></a>, which lets you specify a model which will hold the relationship. In this case, we&#8217;d get:</p>
<pre>class Membership(models.Model):
    user = models.ForeignKey(User)
    project = models.ForeignKey(Project)
    role = models.CharField(max_length=120)
    approved = models.BooleanField(default=False)</pre>
<p>and in Project we now add the field:</p>
<pre>    members = models.ManyToManyField(User, through='Membership')</pre>
<p>This would create a table named projects_membership. It still doesn&#8217;t hold any data, though. Now I see <strong>two ways of making this change</strong> in the DB:</p>
<ul>
<li>Renaming or copying the old table holding the relationship, and ALTERing it until it looks like that new one.</li>
<li>Creating the new table (by looking at the output of <strong>sqlall</strong>) and filling it by copying over the data with a mapping of fields.</li>
</ul>
<p>I chose the later, which seemed more straightforward (and anyway I have other manual copying operations to perform). There&#8217;s an <strong>easy way to copy over the data, the <a href="http://dev.mysql.com/doc/refman/5.0/en/insert-select.html">INSERT &#8230; SELECT syntax</a></strong> in SQL. The old table was named projects_project_joined_users, so the syntax becomes:</p>
<pre>INSERT INTO projects_membership (user_id, project_id, role, approved)
    SELECT projects_project_joined_users.user_id, projects_project_joined_users.project_id, '', 1
    FROM projects_project_joined_users;</pre>
<p>Running this copied over the old data, and now the code may be updated. Note that I had <strong>first created the new table by checking the output of &#8220;sqlall&#8221;</strong> and running the relevant statements (CREATE TABLE, ALTERs for foreign key constraints, and index creation).</p>
<p>It&#8217;s now more complicated to handle the relationship this way, though, <strong>as one can&#8217;t use add() or remove() as before</strong>. Take a look<a href="http://docs.djangoproject.com/en/dev/topics/db/models/#intermediary-manytomany"> at the doc</a> for more info on this.</p>
 <img src="http://www.fsavard.com/flow/wp-content/plugins/feed-statistics.php?view=1&post_id=40" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.fsavard.com/flow/2009/02/altering-a-django-project-to-migrate-from-a-simple-manytomany-relation-to-one-with-extra-information/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Clusterify project: word cloud bookmarklet</title>
		<link>http://www.fsavard.com/flow/2009/02/clusterify-project-word-cloud-bookmarklet/</link>
		<comments>http://www.fsavard.com/flow/2009/02/clusterify-project-word-cloud-bookmarklet/#comments</comments>
		<pubDate>Tue, 24 Feb 2009 01:27:29 +0000</pubDate>
		<dc:creator>Francois</dc:creator>
				<category><![CDATA[Clusterify]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.fsavard.com/blog/?p=33</guid>
		<description><![CDATA[This is a separate post, but it&#8217;s another quick project I suggested, among the first batch I wrote as I brainstormed to get a little bit of content to get Clusterify going: a bookmarklet script to display a word cloud based on all the text in a page. The utility might be limited, but it [...]]]></description>
			<content:encoded><![CDATA[<p>This is a separate post, but it&#8217;s another quick project I suggested, among the first batch I wrote as I brainstormed to get a little bit of content to get Clusterify going: a <a href="http://clusterify.com/projects/list/fsavard/6/">bookmarklet script to display a word cloud based on all the text in a page</a>. The utility might be limited, but it was fun to code. Here&#8217;s <a href="http://fsavard.com/code/wordcloud.js">the source</a> (bookmarklet code is given in a comment) and here&#8217;s a screenshot of what it looks like:</p>
<p style="text-align: center;"><img class="alignnone size-full wp-image-34" src="http://www.fsavard.com/flow/wp-content/uploads/2009/02/wordcloud_tn.png" alt="" width="500" height="229" /></p>
 <img src="http://www.fsavard.com/flow/wp-content/plugins/feed-statistics.php?view=1&post_id=33" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.fsavard.com/flow/2009/02/clusterify-project-word-cloud-bookmarklet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Clusterify project: Delicious tags userscript</title>
		<link>http://www.fsavard.com/flow/2009/02/clusterify-project-delicious-tags-userscript/</link>
		<comments>http://www.fsavard.com/flow/2009/02/clusterify-project-delicious-tags-userscript/#comments</comments>
		<pubDate>Tue, 24 Feb 2009 01:21:18 +0000</pubDate>
		<dc:creator>Francois</dc:creator>
				<category><![CDATA[Clusterify]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.fsavard.com/blog/?p=31</guid>
		<description><![CDATA[I&#8217;m doing a few Clusterify projects, to test the site and concept at the same time. A very quick project suggested by member psytek concerned adding popular/recommended tags automatically on Delicious with a Greasemonkey script. Turns out it took me around 10 lines of code, gave me a good excuse to finally learn about XPath, [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m doing a few Clusterify projects, to test the site and concept at the same time. A very quick <a href="http://clusterify.com/projects/list/psytek/17/">project suggested by member psytek</a> concerned adding popular/recommended tags automatically on Delicious with a Greasemonkey script. Turns out it took me around 10 lines of code, gave me a good excuse to finally learn about XPath, and it&#8217;s quite useful. <a href="http://userscripts.org/scripts/show/42818">Here&#8217;s the script</a> over at Userscripts.</p>
 <img src="http://www.fsavard.com/flow/wp-content/plugins/feed-statistics.php?view=1&post_id=31" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.fsavard.com/flow/2009/02/clusterify-project-delicious-tags-userscript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Just launched Clusterify.com &#8212; small project meetups site for programmers</title>
		<link>http://www.fsavard.com/flow/2009/02/just-launched-clusterifycom-small-project-meetups-site-for-programmers/</link>
		<comments>http://www.fsavard.com/flow/2009/02/just-launched-clusterifycom-small-project-meetups-site-for-programmers/#comments</comments>
		<pubDate>Wed, 18 Feb 2009 17:37:31 +0000</pubDate>
		<dc:creator>Francois</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Clusterify]]></category>
		<category><![CDATA[me]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.fsavard.com/blog/?p=28</guid>
		<description><![CDATA[Here&#8217;s the project I&#8217;ve been working on for the past 3 weeks with another programmer named Aneesh: Clusterify.com . It&#8217;s a site on which you send project proposals, usually very short in time demand (2 hours is suggested), and through them you meet other programmers. I can&#8217;t spend too much time writing a two-volume novel [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s the project I&#8217;ve been working on for the past 3 weeks with another programmer named Aneesh: <a href="http://www.clusterify.com">Clusterify.com</a> .</p>
<p>It&#8217;s a site on which you send project proposals, usually very short in time demand (2 hours is suggested), and through them you meet other programmers.</p>
<p>I can&#8217;t spend too much time writing a two-volume novel about it for the moment, as the launch is still ongoing, but here&#8217;s the <a href="http://news.ycombinator.com/item?id=485813">launch thread on Hacker News</a>.</p>
 <img src="http://www.fsavard.com/flow/wp-content/plugins/feed-statistics.php?view=1&post_id=28" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.fsavard.com/flow/2009/02/just-launched-clusterifycom-small-project-meetups-site-for-programmers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

