<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><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: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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Perused</title>
	
	<link>http://blog.jeroenpelgrims.be</link>
	<description>What I learned and discovered</description>
	<lastBuildDate>Mon, 09 Apr 2012 13:00:46 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/perused" /><feedburner:info uri="perused" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Sightseeing in Antwerp</title>
		<link>http://feedproxy.google.com/~r/perused/~3/rOLk4YjfbVU/</link>
		<comments>http://blog.jeroenpelgrims.be/2012/04/sightseeing-in-antwerp/#comments</comments>
		<pubDate>Mon, 09 Apr 2012 13:00:46 +0000</pubDate>
		<dc:creator>Jeroen</dc:creator>
				<category><![CDATA[Couchsurfing]]></category>
		<category><![CDATA[Travel]]></category>

		<guid isPermaLink="false">http://blog.jeroenpelgrims.be/?p=663</guid>
		<description><![CDATA[Somewhere in the first week of January (when I begun writing this post) was the first time that I hosted a fellow CouchSurfer. Jacob comes from Alabama, USA and is currently studying in Birmingham, UK. During the Christmas holidays he wanted to visit mainland Europe a bit, and I offered to host him in Antwerp. [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-675" title="Antwerpen-schild" src="http://blog.jeroenpelgrims.be/wp-content/uploads/2012/01/Antwerpen-schild.png" alt="Shield of Antwerp" width="200" height="219" />Somewhere in the first week of January (when I begun writing this post) was the first time that I hosted a fellow CouchSurfer. Jacob comes from Alabama, USA and is currently studying in Birmingham, UK. During the Christmas holidays he wanted to visit mainland Europe a bit, and I offered to host him in Antwerp.</p>
<p>Of course, people don&#8217;t come over to just sit/sleep on your couch, they want to see things!<br />
That&#8217;s why I made a list of interesting things to see and do in the center of Antwerp. You&#8217;ll find the things on that list below with some added explanation and history for each item.<br />
It might also come in handy when an other CouchSurfer comes over.</p>
<p>This is just a list of places and explanations, not a path you can follow.<br />
Also, all prices listed here are the ones at the time of writing for adults without any sort of discount.<br />
Antwerp has special discounts for many of it&#8217;s museums if your age is either &lt;26 or &gt;65 or you&#8217;re in a group. (-26 is often € 1 entrance)</p>
<p>All the locations mentioned below are pinned on a map <a href="http://g.co/maps/kds2r">which you can find here</a>.</p>
<h2><span id="more-663"></span></h2>
<h2>Map</h2>
<p><iframe frameborder="0" height="350" marginheight="0" marginwidth="0" scrolling="no" src="http://maps.google.com/maps/ms?msa=0&amp;msid=215567463814401305140.0004bd3250fc709ec0f20&amp;ie=UTF8&amp;ll=51.205244,4.416204&amp;spn=0.046294,0.044245&amp;t=m&amp;output=embed" width="100%"></iframe><br />
<small>View <a style="color: #0000ff; text-align: left;" href="http://maps.google.com/maps/ms?msa=0&amp;msid=215567463814401305140.0004bd3250fc709ec0f20&amp;ie=UTF8&amp;ll=51.205244,4.416204&amp;spn=0.046294,0.044245&amp;t=m&amp;source=embed">Sightseeing in Antwerp</a> in a larger map</small></p>
<h2>Museums</h2>
<h3><a href="http://www.mas.be/">&#8216;t MAS</a> (Het Museum aan de Stroom)</h3>
<p><a href="http://blog.jeroenpelgrims.be/wp-content/uploads/2012/01/Vooruitmas.jpg" rel="lightbox"><img class="alignright" title="MAS" src="http://blog.jeroenpelgrims.be/wp-content/uploads/2012/01/Vooruitmas-150x150.jpg" alt="" width="90" height="90" /></a>Our newest museum. It&#8217;s a modern looking building which consists of a big staircase wrapped around a central column. The stairs are free to ascend and lead to the roof of &#8216;t MAS where you&#8217;ll have a good (but windy) view over the city. At every floor you&#8217;ll have the opportunity to enter the large central column which houses the museum&#8217;s collections. However, to be able to enter these rooms you&#8217;ll need an entrance pass which you can but at the ground level.</p>
<p>The museum houses a permanent and a temporary collection. The price to be able to enter both collections is <a href="http://www.mas.be/MAS-NL/Publicatiekanalen/Stad/Musea/Musea-MAS/MAS-NL/Startpagina-MAS-NL/Startpagina-MAS-Hoofdnavigatie/Startpagina-MAS-Hoofdnavigatie-Bezoeken/Tickets.html">€ 10</a>.<br />
Address:<em> Hanzestedenplaats 1</em></p>
<h3><a href="http://www.provant.be/vrije_tijd/cultuur/musea/diamantmuseum/">Diamond museum</a></h3>
<p><a href="http://blog.jeroenpelgrims.be/wp-content/uploads/2012/03/Diamond-museum-outside.jpg" rel="lightbox"><img class="alignright  wp-image-815" title="Diamantmuseum" src="http://blog.jeroenpelgrims.be/wp-content/uploads/2012/03/Diamond-museum-outside-150x150.jpg" alt="" width="90" height="90" /></a>Antwerp is sometimes called the diamond capital of the world. You&#8217;ll quickly notice this when you take a walk in the area around the central station. The area around the station is filled with jewelery shops, one right next to the other.<br />
On one of the sides of the Astridplein in front of the station is the diamond museum. The museum describes the life of a diamond from the fresh mined rough glass rock to the cut jewel.</p>
<p>Entrance cost: <a href="http://www.provant.be/vrije_tijd/cultuur/musea/diamantmuseum/tarieven/">€ 6</a><br />
Address: <em>Koningin Astridplein 19</em></p>
<h3><a href="http://www.middelheimmuseum.be/eCache/MAE/30/01/049.html">Middelheim Sculpture Museum</a></h3>
<p>This museum, which lies outside the city limits and is partly an open-air museum, has a collection of modern and contemporary sculptures.<br />
In total there are 480 sculptures, 280 medals and 600 sketches and prints.<br />
A big part of the sculptures are spread out over a park of 25 hectares (62 acres) in size.</p>
<p>Entrance cost: Free<br />
Address: <em>Middelheimlaan 61</em></p>
<h3><a href="http://www.dekathedraal.be/en/">Onze-Lieve-Vrouwekathedraal</a></h3>
<p><a href="http://blog.jeroenpelgrims.be/wp-content/uploads/2012/01/onze-lieve-vrouwekathedraal.jpg" rel="lightbox"><img class="alignright" title="Onze Lieve Vrouwekathedraal" src="http://blog.jeroenpelgrims.be/wp-content/uploads/2012/01/onze-lieve-vrouwekathedraal-150x150.jpg" alt="" width="90" height="90" /></a>Without a doubt the most impressive and well known building in Antwerp. It&#8217;s the largest Gothic church in the Low Countries, built between 1352 and 1521.<br />
Beside the abundance of sculpted artwork on the exterior of the building you can also find various works of art by famous artists, one of which Rubens, inside.</p>
<p>A lot of tourists come to visit Antwerp because of the story &#8220;A Dog of Flanders&#8221; . In the square in front of a cathedral, de Handschoenmarkt, is a plaque dedicated to it.<br />
Also on de Handschoenmarkt is &#8220;Het Putje Van Quinten Massijs&#8221;, a well built in 1490.</p>
<p>Entrance cost:  <a href="http://www.dekathedraal.be/en/bezoek.htm">€ 5</a>.<br />
Address:<em> Groenplaats 21</em></p>
<h3><a href="http://www.antwerpen.be/eCache/ABE/3/653.html">Plantijn-Moretus Museum</a></h3>
<p><a href="http://blog.jeroenpelgrims.be/wp-content/uploads/2012/01/357c2125e45a1e876501eed459fd_grande.jpg" rel="lightbox"><img class="alignright" title="Plantijn-Moretus museum interieur" src="http://blog.jeroenpelgrims.be/wp-content/uploads/2012/01/357c2125e45a1e876501eed459fd_grande-150x150.jpg" alt="" width="90" height="90" /></a>Museum of the Plantin and Moretus print shop. At it&#8217;s time (one of?) the biggest print shop of mainland Europe. Had 16 active printing presses at all times, for comparison, the largest print shop in France at that time had 4 presses.<br />
The museum contains the oldest printing presses on the earth (around 1600).</p>
<p>Entrance cost: € 8<br />
Address:<em> Vrijdagmarkt 22-23</em></p>
<h3><a href="http://www.rockoxhuis.be/">Rockoxhuis</a></h3>
<p>Like the Rubenshuis, the Rockoxhuis is an excellent way to get an image of how the nobility lived around the end of the 16th, beginning of the 17th century here in Antwerp.<br />
Nicolaas Rockox had various roles in Antwerp. He was elected councilor 7 times and mayor of external affairs for 8 times.<br />
The house contains lots of paintings and authentic furniture.</p>
<p>Entrance is <a href="http://www.rockoxhuis.be/en/information">€ 2,5</a>.<br />
<a href="http://www.rockoxhuis.be/en/information">Address</a></p>
<h3><a href="http://www.rubenshuis.be/">Rubenshuis</a></h3>
<p><a href="http://blog.jeroenpelgrims.be/wp-content/uploads/2012/01/ZelfportretRubens2NNNN.jpg" rel="lightbox"><img class="alignright" title="Zelfportret Rubens" src="http://blog.jeroenpelgrims.be/wp-content/uploads/2012/01/ZelfportretRubens2NNNN-150x150.jpg" alt="" width="90" height="90" /></a>Peter Paul Rubens, a Flemish painter known world wide had his home and atelier right here in the center of Antwerp. Of course a big part of the things to see in the house are paintings he made himself or paintings he acquired of other painters but even if you&#8217;re not a paintings fan it could still be an interesting visit. The house gives you a good view of how the nobility lived in the 16th-17th century, especially the inner court of the house is astonishing.</p>
<p>Entrance is <a href="http://www.rubenshuis.be/eCache/MCE/30/05/191.bWFpbj0zMDA1MTcw.html">€ 8</a>.<br />
Address: <em>Wapper 9</em></p>
<h3><a href="http://www.antwerpen.be/eCache/ABE/38/991.Y29udGV4dD04MDM0MDQ4.html">Vleeshuis</a></h3>
<p><a href="http://blog.jeroenpelgrims.be/wp-content/uploads/2012/01/04_J-M-Ruyten_Vleeshuis_Christies2003.jpg" rel="lightbox"><img class="alignright" title="Vleeshuis" src="http://blog.jeroenpelgrims.be/wp-content/uploads/2012/01/04_J-M-Ruyten_Vleeshuis_Christies2003-150x150.jpg" alt="" width="90" height="90" /></a>In the middle ages a lot of professions had guild houses, het Vleeshuis (the meat house) was one of them. In this case it was the guild house of the butchers.<br />
The building was constructed 50 years after &#8216;t Steen in 1250 to sell slaughtered animals. Currently the building is used as a museum containing 600 years of  history about music and dance.</p>
<p>Entrance costs € 5.<br />
Address: <em>Vleeshouwersstraat 38</em></p>
<h2>Buildings &amp; Places to see</h2>
<h3>&#8216;t Steen</h3>
<p><a href="http://blog.jeroenpelgrims.be/wp-content/uploads/2012/01/0_Het_Steen_-_Antwerpen_1.jpg" rel="lightbox"><img class="alignright" title="'t Steen" src="http://blog.jeroenpelgrims.be/wp-content/uploads/2012/01/0_Het_Steen_-_Antwerpen_1-150x150.jpg" alt="" width="90" height="90" /></a>Het Steen was constructed at the beginning of the 13th century, between 1200 and 1225. This makes it the oldest building in the city.<br />
Unfortunately part of the building was deconstructed in the 19th century when de Schelde was widened to expand the harbor of Antwerp. Currently only the front of the stronghold is still standing.</p>
<p>For a very long time the building was used as a prison (1307-1827). From 1952 the building was used as a maritime history museum which later moved to the newer MAS museum.</p>
<p>At the beginning of the walkway to the castle there is a statue called &#8220;de Lange Wapper&#8221;. The statue depicts a giant from Antwerp folklore.<br />
De Lange Wapper can shapeshift and he uses this ability to trick people. A much used trick of his is to follow drunks home, constantly growing while following. Eventually when the drunk arrives home de Lange Wapper is so tall that he can peek through the top level windows of the drunk&#8217;s house.</p>
<p>Address: <em>Suikerrui 7</em></p>
<h3><a href="http://www.bourlaschouwburg.be/">Bourla Schouwburg</a></h3>
<p><a href="http://blog.jeroenpelgrims.be/wp-content/uploads/2012/03/Antwerp_Bourla_Theatre.jpg" rel="lightbox"><img class="alignright  wp-image-812" title="Bourla Schouwburg" src="http://blog.jeroenpelgrims.be/wp-content/uploads/2012/03/Antwerp_Bourla_Theatre-150x150.jpg" alt="" width="90" height="90" /></a>A theater with an impressive front built in 1834. It is still used as a theater by 2 theater groups.<br />
Every Sunday and national holiday an extensive brunch buffet is hosted in the Schouwburg.</p>
<p>Address: <em>Komedieplaats 18</em></p>
<h3>Centraal Station</h3>
<p><a href="http://blog.jeroenpelgrims.be/wp-content/uploads/2012/01/antwerp.jpg" rel="lightbox"><img class="alignright" title="Centraal station antwerpen" src="http://blog.jeroenpelgrims.be/wp-content/uploads/2012/01/antwerp-150x150.jpg" alt="" width="90" height="90" /></a>This station, a key stop between the Paris and Amsterdam, is considered one of the most beautiful train stations of the world.<br />
Interesting parts of the building to view are the front of the building, the entrance hall and the glass dome over the top level of rails.</p>
<p>If the NMBS/B-Rail is not on strike you might be able to ride the train somewhere too.</p>
<p>Address: <em>Koningin Astridplein 27 </em></p>
<h3>Hendrik Conscience Plein &amp; <a href="http://www.carolusborromeus.com/">Carolus Borromeus kerk</a></h3>
<p><a href="http://blog.jeroenpelgrims.be/wp-content/uploads/2012/02/p103192-Antwerp-Sint-Carolus_Borromeuskerk.jpg" rel="lightbox"><img class="alignright" title="Carolus Borromeuskerk" src="http://blog.jeroenpelgrims.be/wp-content/uploads/2012/02/p103192-Antwerp-Sint-Carolus_Borromeuskerk-150x150.jpg" alt="" width="90" height="90" /></a><a href="http://blog.jeroenpelgrims.be/wp-content/uploads/2012/03/2357718640_8f8de69fe0.jpg" rel="lightbox"><img class="alignright" title="Carolus Borromeuskerk Interieur" src="http://blog.jeroenpelgrims.be/wp-content/uploads/2012/03/2357718640_8f8de69fe0-150x150.jpg" alt="" width="90" height="90" /></a>On the square in front of the Carolus Borromeus kerk you&#8217;ll find a statue of the Flemish writer Hendrik Conscience, after whom the square was named when the statue was installed in 1880.<br />
The interior of the church exists of marble, wood sculptures and paintings.</p>
<p>Address: <em>Hendrik Conscienceplein 6-12</em></p>
<h3>Koninklijk Museum voor Schone Kunsten (Royal Museum of Fine Arts)</h3>
<p>Unfortunately the museum is closed for renovatuion until 2017.<br />
But it does organize expositions in other places in and around Antwerp.<br />
Where it hosts these you can see on <a href="http://www.kmska.be/en/bezoek/KMSKADichtbij/index.html?_language=en">it&#8217;s website</a>.</p>
<h3>Groenplaats</h3>
<p>South of the cathedral is the Groenplaats. It&#8217;s surrounded by a few protected buildings, among which the building that currently houses the Hilton hotel.</p>
<h3>Grote Markt</h3>
<p><a href="http://blog.jeroenpelgrims.be/wp-content/uploads/2012/01/450px-antwerpen-brabo.jpg" rel="lightbox"><img class="alignright" title="Brabo en Antigoon" src="http://blog.jeroenpelgrims.be/wp-content/uploads/2012/01/450px-antwerpen-brabo-150x150.jpg" alt="" width="90" height="90" /></a>Like pretty much any larger European city Antwerp also has a Grote markt/Grand Place. It&#8217;s situated North West of the Cathedral. On de Grote Markt you will find Antwerp city hall, the statue of Brabo en Antigoon and surrounding the square, guild houses.</p>
<p>The statue is based on an old city legend.<br />
There is a giant, Druon Antigoon, who demands toll of the people who want to cross de Schelde. If they couldn&#8217;t pay the toll he would cut of their hand. He was eventually slain by Silvius Brabo, spuuosedly the nephew of the roman emporor Julius Caesar. He gave him some of his own medicine and cut off his hand.<br />
The statue depicts Silvius throwing away Antigoon&#8217;s severed hand.<br />
According to another myth this is also where Antwerp has it&#8217;s name from. Hand werpen (Hand throwing) =&gt; Handwerpen =&gt; Antwerpen.</p>
<p>Each of the houses along the square belonged to a guild. Some of the houses have statues on the top of their roof which is in some way connected to the guild to which the house belonged.</p>
<h3>Meir</h3>
<p><a href="http://blog.jeroenpelgrims.be/wp-content/uploads/2012/01/Untitled-4.jpg" rel="lightbox"><img class="alignright" title="De Meir" src="http://blog.jeroenpelgrims.be/wp-content/uploads/2012/01/Untitled-4-150x150.jpg" alt="" width="90" height="90" /></a>De Meir is the largest shopping street of Antwerp and possibly of entire Belgium (She&#8217;s competing for the title with the Nieuwstraat in Brussels). Even if you&#8217;re not interested in shopping you should still walk it&#8217;s distance to take a look at the decorated buildings that surround it.<br />
It also connects the old city center with the Rooseveltplaats (which is close to the central station) so you can easily go from one to another if you don&#8217;t mind a walk.</p>
<h3>Stadsfeestzaal (City festivities hall)</h3>
<p>At present this big hall with it&#8217;s decorated ceiling is being used as the central space of a shopping center.</p>
<p>Address: <em>Hopland 31</em>, <em>Meir 78</em></p>
<h3>Vlaaikensgang</h3>
<p><a href="http://blog.jeroenpelgrims.be/wp-content/uploads/2012/02/p-038081896.jpg" rel="lightbox"><img class="alignright" title="Vlaaikensgang" src="http://blog.jeroenpelgrims.be/wp-content/uploads/2012/02/p-038081896-150x150.jpg" alt="Vlaaikensgang" width="90" height="90" /></a>De Vlaaikensgang is an alley which runs behind the backsides of some old medieval houses.<br />
At about halfway in the Pelgrimsstraat you will find a gate leading to this alley. Look closely! It&#8217;s not very obvious.<br />
Inside the Vlaaikensgang there are a few pittoresque spots.</p>
<p>Entrance point:  <em>Oude Koornmarkt 16</em></p>
<h3>Voetgangerstunnel (Sint-Annatunnel)</h3>
<p><a href="http://blog.jeroenpelgrims.be/wp-content/uploads/2012/02/Voetgangerstunnel.jpg" rel="lightbox"><img class="alignright" title="Voetgangerstunnel" src="http://blog.jeroenpelgrims.be/wp-content/uploads/2012/02/Voetgangerstunnel-150x150.jpg" alt="" width="90" height="90" /></a>Antwerp is largely situated on the east bank (right side) of de Schelde. Across de Schelde the area is known as de Linkeroever.<br />
Boths sides are connected by a pedestrian tunnel which dates back from 1933. Is it still widely used today.<br />
The tunnel itself could be an interesting look because of it&#8217;s old wooden escalators and tiled interior.<br />
Even if that can&#8217;t pique your interest, you have a nice view of the other side, especially at night when the city is lighted.</p>
<p>Address: <em>Sint-Jansvliet</em></p>
<h3><a href="http://www.zooantwerpen.be/">Zoo van Antwerpen</a></h3>
<p>Maybe not very special when compared to other zoos, but there are some older buildings inside which might be interesting to see.<br />
Pretty much anyone who has gone to school around Antwerp has visited the zoo multiple times on a school trip.</p>
<p>Entrance: €22<br />
Address: <em>Koningin Astridplein 26</em></p>
<h3>Zurenborg</h3>
<p><a href="http://blog.jeroenpelgrims.be/wp-content/uploads/2012/01/Zurenborg_Cogels-Osylei_n°6-12_4.jpg" rel="lightbox"><img class="alignright" title="Zurenborg Cogels-Osylei n°6-12" src="http://blog.jeroenpelgrims.be/wp-content/uploads/2012/01/Zurenborg_Cogels-Osylei_n°6-12_4-150x150.jpg" alt="" width="90" height="90" /></a>This Neighborhood is situated around de Dageraadplaats, a square with lots of cozy cafes and restaurants surrounding it. A bit further, after passing the Railroads is the Cogels-Osylei which has a lot of old beautiful mansions.</p>
<h2>Food &amp; Drink (Delicacies)</h2>
<h3><a href="http://www.desiredelille.be">Désiré de Lille</a></h3>
<p><a href="http://blog.jeroenpelgrims.be/wp-content/uploads/2012/01/lacquemantsfoireliege.jpg" rel="lightbox"><img class="alignright" title="Lacquemants" src="http://blog.jeroenpelgrims.be/wp-content/uploads/2012/01/lacquemantsfoireliege-150x147.jpg" alt="" width="90" height="88" /></a>Belgian Waffles are a worldwide known sweet snack but they are nothing compared to the other unhealthy goodnesses we have here. Most of them can be bought at stands on a so called Kermis or Foor (Carnival).<br />
Unfortunately they travel around so it can be hard to know if there&#8217;s one close when you&#8217;re visiting Antwerp. Désiré de Lille is a snack restaurant / take out shop which has these snacks available all year round.<br />
The original founder of the restaurant is also the inventor of the Lacquemant, a flat waffle with a syrup in it of which the recipe is a secret.</p>
<p>I highly recommend trying out the Laquemants and the Smoutebollen.<br />
Address: <em>Schrijnwerkersstraat 14</em></p>
<h3>Het Elfde gebod</h3>
<p>This cafe is right next to the cathedral. It&#8217;s walls are completely decorated with statues of various sizes. It&#8217;s not necessarily a must-see, but it&#8217;s more of a unique thing you won&#8217;t quickly find somewhere else.</p>
<p>Address: <em>Torfbrug 10</em></p>
<h3>De Pelgrom</h3>
<p><a href="http://blog.jeroenpelgrims.be/wp-content/uploads/2012/02/5198402.5d3fdfdb.560.jpg" rel="lightbox"><img class="alignright" title="De Pelgrom" src="http://blog.jeroenpelgrims.be/wp-content/uploads/2012/02/5198402.5d3fdfdb.560-150x150.jpg" alt="" width="90" height="90" /></a>This was an old storage space for valuable goods which has now been transformed to a cozy cafe.<br />
Supposedly on weekends there is also a guide available at the entrance of the cafe who will guide you (for €3) through the house above the cellar which is decorated authentically.</p>
<p>Address:<em> Pelgrimstraat 15</em><a href="http://www.rockoxhuis.be/"><br />
</a></p>
<h3>De Vagant</h3>
<p>Jenever is the Dutch and Flemish vodka. We have them in all kinds of flavours and strengths.<br />
The ideal spot to try them is de Vagant, which offers more than 150 varieties of them.</p>
<p>Address: <em>Reyndersstraat 25</em>.</p>
<h3>Other delicacies</h3>
<p>I&#8217;m sure you&#8217;ve heard of our chocolate and beer, which are all widely available in Antwerp.<br />
But have  you tried our fries? Take this recommendation and go to a frituur once. Order a &#8220;puntzak&#8221; with (Belgian) mayonnaise. Yes, mayonnaise. If you&#8217;re from the US/Australia/..(?) I can assure you, our mayonnaise is a different sauce entirely. There is a good frituur cart near &#8216;t Steen.<br />
From then on, start calling them Belgian fries instead of French fries please.</p>
<h2>Events</h2>
<h3>Vrijdagmarkt</h3>
<p>De Vrijdagmarkt, literally translated Friday market, is as the name says a market that is hosted every Friday (Vrijdag in Dutch) from 9:00-13:00 on the square called &#8230; Vrijdagmarkt.<br />
On this market second hand goods ranging from clothing to furniture get sold. Often these goods are confiscated goods of people who defaulted on their bills.<br />
Therefore there will most likely be an auctioneer yelling for bids. Below a video of the market in action.</p>
<p><iframe frameborder="0" height="360" src="http://www.youtube.com/embed/narkLQVETU4" width="480"></iframe></p>
<h2>Other suggestions found on <a href="http://www.reddit.com/r/belgium/comments/q6s9w/im_staying_in_antwerp_until_next_sunday_any_tips/">the internet</a></h2>
<p><a href="http://www.kassa4.be/en/story">Kassa 4</a>: A student bar on de Ossemarkt.</p>
<p><a href="http://jazzmuze.be/">Cafe de Muze</a>: A jazzy bar on the Melkmarkt.</p>
<p><a href="http://www.caffenation.be/">Caffénation</a>: A coffee shop which offers all sorts of coffees created by all sorts of brewing methods.</p>
<p><a href="http://www.amadeusspareribrestaurant.be/N/antwerpen/info.html">Amadeus</a>: A restaurant which offers an all you can eat menu for spare ribs.</p>
<p><a href="http://www.waagstuk.be/">&#8216;t Waagstuk</a>: Similar to De Vagant mentioned above, except  it&#8217;s variety is in beer. It offers a few hundred kinds of beer.</p>
<p><a href="http://www.dekoninck.be/en/breweryvisit">De Koninck brewery</a>: A well known brewery in Antwerp, they offer a tour through the brewery.</p>
<h2>Public transportation</h2>
<p>Of course you&#8217;ll want to get around at an acceptable pace.<br />
In the city center I recommend going by foot since everything is so close together anyway and otherwise you might miss out on the city life itself.</p>
<p>For longer distances (city to city) you can take the train, which is operated by <a href="http://www.b-rail.be/main/N/">B-rail</a> (formerly NMBS).<br />
For inside Antwerp itself you&#8217;re best off using the buses and trams(/metro), which are run by <a href="http://www.delijn.be/">De Lijn</a>.</p>
<div class="al2fb_likers"><a href="http://www.facebook.com/profile.php?id=737762074" rel="nofollow">Jacob Greider</a>, <a href="http://www.facebook.com/profile.php?id=645699720" rel="nofollow">Veerle Van Nieuwenhove</a> <span class="al2fb_liked">liked this post</span></div>
<p><a href="http://feedads.g.doubleclick.net/~a/6ZkRezgyugb9aHfxBpXkXGGtyjE/0/da"><img src="http://feedads.g.doubleclick.net/~a/6ZkRezgyugb9aHfxBpXkXGGtyjE/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/6ZkRezgyugb9aHfxBpXkXGGtyjE/1/da"><img src="http://feedads.g.doubleclick.net/~a/6ZkRezgyugb9aHfxBpXkXGGtyjE/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/perused/~4/rOLk4YjfbVU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.jeroenpelgrims.be/2012/04/sightseeing-in-antwerp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.jeroenpelgrims.be/2012/04/sightseeing-in-antwerp/</feedburner:origLink></item>
		<item>
		<title>Samsung Galaxy SII battery/USB problems</title>
		<link>http://feedproxy.google.com/~r/perused/~3/WfLEfd-x89o/</link>
		<comments>http://blog.jeroenpelgrims.be/2012/02/samsung-galaxy-sii-batteryusb-problems/#comments</comments>
		<pubDate>Wed, 29 Feb 2012 18:39:29 +0000</pubDate>
		<dc:creator>Jeroen</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.jeroenpelgrims.be/?p=746</guid>
		<description><![CDATA[  Problem description I recently had some nasty trouble with my Galaxy SII. The problem I was having was that after working normally the phone would suddenly act like I was pulling out and putting in the usb cable constantly. The battery would indicate being charged, discharged and then charged again (etc.). After shutting the [...]]]></description>
			<content:encoded><![CDATA[<h2>  Problem description</h2>
<h2><img class="alignleft" title="Samsung Galaxy SII" src="http://www.pak-sms.com/wp-content/uploads/2011/09/samsung-galaxy-sii.jpg" alt="" width="115" height="148" /></h2>
<p>I recently had some nasty trouble with my Galaxy SII.<br />
The problem I was having was that after working normally the phone would suddenly act like I was pulling out and putting in the usb cable constantly.<br />
The battery would indicate being charged, discharged and then charged again (etc.).<br />
After shutting the phone down and trying to reboot it I would get an image showing the big battery image you get when charging the phone while it&#8217;s off.<br />
A few seconds later it would also display an exclamation mark and a thermometer.</p>
<p>I tried letting the battery &#8220;cool&#8221; to no avail (It didn&#8217;t feel exceptionally warm to the touch anyway)<br />
Switching to a different battery did seem to fix the problem, at least for a short while. A day later I was having the exact same symptoms. Time for some more Googling I thought.</p>
<p><span id="more-746"></span></p>
<h2>Solution</h2>
<p>Eventually I found <a href="http://androidforums.com/samsung-galaxy-s2-international/377331-spurious-battery-temperature-warning.html">this topic</a> on Android Forums. The solution to my page was found on <a href="http://androidforums.com/samsung-galaxy-s2-international/377331-spurious-battery-temperature-warning-2.html#post3386729">page 2</a>.<br />
Apparently even a small amount of dirt in the micro usb port can cause these problems.<br />
It&#8217;s easily cleaned with a toothpick. To get in the thin space away from the battery you can split a toothpick with scissors.<br />
You can dip the tip of the toothpick in rubbing alcohol  to get even the last bits of dirt.</p>
<p>If even this doesn&#8217;t work and you&#8217;re sure it&#8217;s the usb port (water damage maybe) the port itself is quite easily and cheaply (€15) replaced.<br />
In the same topic<a href="http://androidforums.com/samsung-galaxy-s2-international/377331-spurious-battery-temperature-warning-2.html#post3934910"> someone did this</a> and posted <a href="http://blog.jeroenpelgrims.be/wp-content/uploads/2012/02/galaxyS2-module.jpg">an image</a> of the port&#8217;s package showing all the product info.<br />
Also posted was a video showing how to disassemble and reassemble the phone.</p>
<p><iframe frameborder="0" height="360" src="http://www.youtube.com/embed/QKztg1ra4-0" width="480"></iframe></p>

<p><a href="http://feedads.g.doubleclick.net/~a/B-akCLac8rrpliZ5-UD46plz9bc/0/da"><img src="http://feedads.g.doubleclick.net/~a/B-akCLac8rrpliZ5-UD46plz9bc/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/B-akCLac8rrpliZ5-UD46plz9bc/1/da"><img src="http://feedads.g.doubleclick.net/~a/B-akCLac8rrpliZ5-UD46plz9bc/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/perused/~4/WfLEfd-x89o" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.jeroenpelgrims.be/2012/02/samsung-galaxy-sii-batteryusb-problems/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://blog.jeroenpelgrims.be/2012/02/samsung-galaxy-sii-batteryusb-problems/</feedburner:origLink></item>
		<item>
		<title>Updated SoundSwitch</title>
		<link>http://feedproxy.google.com/~r/perused/~3/HJGmDjO7pOY/</link>
		<comments>http://blog.jeroenpelgrims.be/2011/06/updated-soundswitch/#comments</comments>
		<pubDate>Thu, 23 Jun 2011 19:39:59 +0000</pubDate>
		<dc:creator>Jeroen</dc:creator>
				<category><![CDATA[.NET]]></category>

		<guid isPermaLink="false">http://blog.jeroenpelgrims.be/?p=643</guid>
		<description><![CDATA[I updated my SoundSwitch Application. You can install it by going here. The purpose of SoundSwitch is to be able to easily switch between  2 or more Audio output devices. For example, I have a wireless headset and my regular speakers. Both are detected as a separate audio card in the sound panel. The only [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.jeroenpelgrims.be/wp-content/uploads/2011/06/arrow_switch.png"><img class="alignleft size-full wp-image-645" title="arrow_switch" src="http://blog.jeroenpelgrims.be/wp-content/uploads/2011/06/arrow_switch.png" alt="" width="32" height="32" /></a></p>
<p>I updated my <a href="http://soundswitch.codeplex.com/">SoundSwitch</a> Application.<br />
You can install it by going <a href="http://soundswitch.codeplex.com/releases/">here</a>.</p>
<p>The purpose of SoundSwitch is to be able to easily switch between  2 or more Audio output devices.<br />
For example, I have a wireless headset and my regular speakers.<br />
Both are detected as a separate audio card in the sound panel.<br />
The only way to switch between them is to open the playback devices panel and select one of them and choose to put it as default device.</p>
<p>That&#8217;s such a hassle!<br />
With SoundSwitch you just press Ctrl+Alt+F11 and it toggles between the cards you selected.</p>
<p>Todos:</p>
<ol>
<li>Let the application start up when the user logs in. (currently you have to start it yourself)</li>
<li> Allow users to set their own shortcut (instead of  Ctrl+Alt+F11)</li>
<li>Make the configuration easier. (Won&#8217;t be possible I&#8217;m afraid though)</li>
</ol>
<p><span style="color: #ff0000;"><strong>UPDATE:<br />
</strong></span>Changed the hosting to CodePlex, apparently you can host ClickOnce applications there!</p>

<p><a href="http://feedads.g.doubleclick.net/~a/q5gt4rrKFHYLZDUDdAMagmXYfsg/0/da"><img src="http://feedads.g.doubleclick.net/~a/q5gt4rrKFHYLZDUDdAMagmXYfsg/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/q5gt4rrKFHYLZDUDdAMagmXYfsg/1/da"><img src="http://feedads.g.doubleclick.net/~a/q5gt4rrKFHYLZDUDdAMagmXYfsg/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/perused/~4/HJGmDjO7pOY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.jeroenpelgrims.be/2011/06/updated-soundswitch/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.jeroenpelgrims.be/2011/06/updated-soundswitch/</feedburner:origLink></item>
		<item>
		<title>jQuery scroll to element plugin</title>
		<link>http://feedproxy.google.com/~r/perused/~3/Z3X49fwwoIg/</link>
		<comments>http://blog.jeroenpelgrims.be/2011/06/jquery-scroll-to-element-plugin/#comments</comments>
		<pubDate>Tue, 14 Jun 2011 02:13:53 +0000</pubDate>
		<dc:creator>Jeroen</dc:creator>
				<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://blog.jeroenpelgrims.be/?p=637</guid>
		<description><![CDATA[$.fn.scrollTo = function&#40;duration&#41;&#123; if&#40;duration == null&#41;&#123; duration = 1000; &#125; &#160; var offset = $&#40;this&#41;.offset&#40;&#41;.top - $&#40;window&#41;.height&#40;&#41;/2 + $&#40;this&#41;.height&#40;&#41;; $&#40;'html,body'&#41;.animate&#40;&#123; scrollTop: offset &#125;, duration&#41;; &#125; This small plugin will scroll to a selected element when calling .scrollTo() on it. It has an optional parameter which specifies the duration of the scroll. For example, if i [...]]]></description>
			<content:encoded><![CDATA[
<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$.<span style="color: #660066;">fn</span>.<span style="color: #660066;">scrollTo</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>duration<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>duration <span style="color: #339933;">==</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        duration <span style="color: #339933;">=</span> <span style="color: #CC0000;">1000</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #003366; font-weight: bold;">var</span> offset <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">offset</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">top</span> <span style="color: #339933;">-</span> $<span style="color: #009900;">&#40;</span>window<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">height</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">/</span><span style="color: #CC0000;">2</span> <span style="color: #339933;">+</span> $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">height</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'html,body'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">animate</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
       scrollTop<span style="color: #339933;">:</span> offset
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> duration<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>This small plugin will scroll to a selected element when calling .scrollTo() on it.<br />
It has an optional parameter which specifies the duration of the scroll.</p>
<p>For example, if i would have a div with the id &#8220;#mydiv&#8221; I would let the screen scroll to it using this code:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#mydiv'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">scrollTo</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">//Or, if you want the animation to be slower</span>
$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#mydiv'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">scrollTo</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">2000</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>The top of the selected element will be displayed at 50% of the screen unless the scrollbar is too short, then the element will be lower on the screen.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/chsMAR8aEoN5anzMGeJobQQluis/0/da"><img src="http://feedads.g.doubleclick.net/~a/chsMAR8aEoN5anzMGeJobQQluis/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/chsMAR8aEoN5anzMGeJobQQluis/1/da"><img src="http://feedads.g.doubleclick.net/~a/chsMAR8aEoN5anzMGeJobQQluis/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/perused/~4/Z3X49fwwoIg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.jeroenpelgrims.be/2011/06/jquery-scroll-to-element-plugin/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://blog.jeroenpelgrims.be/2011/06/jquery-scroll-to-element-plugin/</feedburner:origLink></item>
		<item>
		<title>Fridgemon – Keeping track of what’s in your fridge</title>
		<link>http://feedproxy.google.com/~r/perused/~3/x8yglUHrO_M/</link>
		<comments>http://blog.jeroenpelgrims.be/2011/04/fridgemon-keeping-track-of-whats-in-your-fridge/#comments</comments>
		<pubDate>Thu, 21 Apr 2011 22:10:51 +0000</pubDate>
		<dc:creator>Jeroen</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.jeroenpelgrims.be/?p=626</guid>
		<description><![CDATA[On weekdays I live by myself in Brussels to be closer to the University. Of course, I have to do my own shopping and buy food supplies myself. I also have to keep track of what&#8217;s in my fridge and what&#8217;s expiring when. I suck at that. However, I&#8217;m good with computers. And computers are [...]]]></description>
			<content:encoded><![CDATA[<p>On weekdays I live by myself in Brussels to be closer to the University.<br />
Of course, I have to do my own shopping and buy food supplies myself.</p>
<p>I also have to keep track of what&#8217;s in my fridge and what&#8217;s expiring when.<br />
I suck at that.<br />
However, I&#8217;m good with computers. And computers are good at keeping track of stuff.<br />
So I created a small tool to do just that, <a href="http://fridgemon.appspot.com/">Fridgemon</a>.</p>
<p>I know it&#8217;s butt-ugly but it does it&#8217;s job.</p>
<div class="al2fb_likers"><a href="http://www.facebook.com/profile.php?id=653823971" rel="nofollow">Simon VdW</a> <span class="al2fb_liked">liked this post</span></div>
<p><a href="http://feedads.g.doubleclick.net/~a/llDsWIVVXMBX9f_ORNu4iI-FLWA/0/da"><img src="http://feedads.g.doubleclick.net/~a/llDsWIVVXMBX9f_ORNu4iI-FLWA/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/llDsWIVVXMBX9f_ORNu4iI-FLWA/1/da"><img src="http://feedads.g.doubleclick.net/~a/llDsWIVVXMBX9f_ORNu4iI-FLWA/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/perused/~4/x8yglUHrO_M" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.jeroenpelgrims.be/2011/04/fridgemon-keeping-track-of-whats-in-your-fridge/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.jeroenpelgrims.be/2011/04/fridgemon-keeping-track-of-whats-in-your-fridge/</feedburner:origLink></item>
		<item>
		<title>Learning Norwegian – Some resources</title>
		<link>http://feedproxy.google.com/~r/perused/~3/0uRigatl9p8/</link>
		<comments>http://blog.jeroenpelgrims.be/2011/04/learning-norwegian-some-resources/#comments</comments>
		<pubDate>Mon, 18 Apr 2011 21:03:28 +0000</pubDate>
		<dc:creator>Jeroen</dc:creator>
				<category><![CDATA[Norwegian]]></category>

		<guid isPermaLink="false">http://blog.jeroenpelgrims.be/?p=517</guid>
		<description><![CDATA[With only 5 million speakers it&#8217;s not very easy to find resources on learning Norwegian compared to other languages. Listed below is a compilation of the resources I found while looking for learning materials. Norwegian is the first language I&#8217;m consciously learning on my own, not in a school environment. (I say consciously because I [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-medium wp-image-601" title="Norway Flag" src="http://blog.jeroenpelgrims.be/wp-content/uploads/2011/04/Norway_Grunge_Flag_by_think0-e1302983016655-300x187.jpg" alt="" width="130" height="81" />With only 5 million speakers it&#8217;s not very easy to find resources on learning Norwegian compared to other languages. Listed below is a compilation of the resources I found while looking for learning materials. Norwegian is the first language I&#8217;m consciously learning on my own, not in a school environment. (I say consciously because I learned English by watching a load of movies and series, I didn&#8217;t really have to make an effort then) I&#8217;m currently a complete beginner in Norwegian with only 25/30 Pimsleur lessons done and some extra vocabulary with Anki.</p>
<p>&nbsp;</p>
<p><span id="more-517"></span></p>
<h2>Textbooks</h2>
<p>Full fledged learning tools containing a textbook explaining grammar and spelling rules, audio tapes for pronunciation and often also workbooks to apply the acquired knowledge.</p>
<h4><a href="http://www.amazon.com/gp/product/0743566300/ref=as_li_ss_tl?ie=UTF8&amp;tag=perused-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0743566300">Pimsleur Norwegian</a></h4>
<p>30 audio lessons of 30 minutes each. I started learning with this. After each lesson of Pimsleur&#8217;s completed I could clearly notice that I had learned something. The rate at which I learned stuff using Pimsleur is very high. Unfortunately Pimsleur Norwegian has only 1 level of lessons, compared to 2 or 3 levels for larger languages like French or Chinese. If I had to suggest a starting point to learning Norwegian, this would be it. <a href="http://www.pimsleur.com/Learn-Norwegian">Pimsleur Norwegian website </a></p>
<h4><a href="http://www.amazon.com/gp/product/8211001233/ref=as_li_ss_tl?ie=UTF8&amp;tag=perused-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=8211001233">Ny I Norge</a> &amp; <a href="http://www.amazon.com/gp/product/8211000121/ref=as_li_qf_sp_asin_tl?ie=UTF8&amp;tag=perused-20&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=8211000121">Bo I Norge</a></h4>
<p>Ny I Norge contains a textbook, audio readings of the conversations in the textbook, a workbook and listening comprehension exercises. Bo I Norge is a textbook for more advanced learners (after Ny I Norge). This will be the second resource I&#8217;ll be using, after Pimsleur.</p>
<h4><a href="http://www.amazon.com/gp/product/0415110114/ref=as_li_qf_sp_asin_tl?ie=UTF8&amp;tag=perused-20&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=0415110114">Colloquial Norwegian</a></h4>
<p>Similar to Ny I Norge, consists of a textbook with exercises and audio readings. I do have the impression that the learning curve of the book is higher.</p>
<h4><a href="http://www.cappelendammundervisning.no/undervisning/project-detail.action?id=7030">På vei</a>, <a href="http://www.cappelendammundervisning.no/undervisning/project-detail.action?id=1962">Stein På Stein</a>, <a href="http://www.cappelendammundervisning.no/undervisning/project-detail.action?id=7045">Her på berget</a></h4>
<p>All three books consist of a textbook, a workbook and audio files. They consist of three levels of which På vei is the 1st, Stein På Stein the second and finally Her på berget the third. Each of the books have free exercises online. (<a href="http://pavei.cappelen.no/">På vei</a>, <a href="http://steinpastein.cappelendamm.no/">Stein På Stein</a>, <a href="http://herpaberget.cappelendamm.no/">Her på berget</a>)</p>
<h4>Praktisk Norsk <a href="http://www.cappelendammundervisning.no/undervisning/product-detail.action?id=128624">I</a> &amp; <a href="http://www.cappelendammundervisning.no/undervisning/product-detail.action?id=128559">II</a></h4>
<p>From the same series as På vei etc. Also has free exercises online <a href="http://praktisknorsk1.cappelendamm.no/">here</a> and <a href="http://praktisknorsk2.cappelendamm.no/">here</a>.</p>
<h4><a href="http://www.amazon.com/gp/product/0340887575/ref=as_li_qf_sp_asin_tl?ie=UTF8&amp;tag=perused-20&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=0340887575">Teach Yourself Norwegian</a></h4>
<p>A book with conversations both in English and in Norwegian. Seems to rely heavily of cross referencing the dialogues in both languages. Also contains audio recordings for the conversations.</p>
<h4><a href="http://norwords.com/textbook/index.html">Sett i gang I &amp; II</a></h4>
<p>A textbook, workbook and audio files. The audio files are freely downloadable <a href="http://norwords.com/guides/index.html">here</a> and <a href="http://norwords.com/guides2/index.html">here</a>.</p>
<h4><a title="My Little Norway" href="http://mylittlenorway.com/learn-norwegian/">My Little Norway</a></h4>
<p>A blog about 2 people in Norway, one native speaker and one who&#8217;s learning Norwegian. They also have a bunch of lessons on the blog for learning Norwegian.</p>
<h4>Assimil (for German or French speakers)</h4>
<p><a href="http://www.amazon.com/gp/product/3896252100/ref=as_li_qf_sp_asin_tl?ie=UTF8&amp;tag=perused-20&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=3896252100">Norwegisch ohne Mühe</a> (For German speakers) | <a href="http://www.assimil.com/descriptionProduitDetail.do?paramIdProduit=1441&amp;paramIdMethode=1441">Assimil site</a> <a href="http://www.amazon.com/gp/product/0320068196/ref=as_li_qf_sp_asin_tl?ie=UTF8&amp;tag=perused-20&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=0320068196">Le Norvegien sans Peine</a>(For French speakers)</p>
<h2>Television</h2>
<h4><a href="http://www.nrk.no/nett-tv/">NRK</a></h4>
<p>NRK is the Norwegian national broadcaster. A lot of the programs are visible freely (Click A-Å on the top and choose a starting letter of a program). For example, <a href="http://www.nrk.no/nett-tv/klipp/729601/">the news</a>is something that is updated daily.</p>
<h4><a href="http://video.nrkbeta.no/torrents/">NRK Torrents </a></h4>
<p>NRK also offers some HD torrents of their programs. These don&#8217;t get updated very often I&#8217;ve noticed.</p>
<h4><a href="http://www.tv3play.no/program">TV3</a></h4>
<p>TV3 broadcasts more foreign (to Norway) programs which are more limited by drm. But those are most likely not the programs you want to watch anyways cause they are in different languages :) Watch out, they also have some Swedish programs.</p>
<h4><a href="http://webtv.tvnorge.no/">TVNorge</a> (NOT FREE)</h4>
<h4><a href="http://www.tv2.no/play/">TV2</a> (SEMI-FREE)</h4>
<p>Only short clips of programs are free, full programs require a subscription.</p>
<h2>Radio</h2>
<ul>
<li><a href="http://www.radionorge.com/">Radio Norge</a></li>
<li><a href="http://www.nrk.no/p1/">NRK P1</a> &#8211; Click the small red round button with the play icon to the right</li>
<li><a href="http://www.nrk.no/p2/">NRK P2</a> &#8211; Click the small red round button with the play icon to the right</li>
<li><a href="http://p3.no/">NRK Petre</a> (P3)</li>
<li><a href="http://www.nrk.no/alltid_nyheter/">NRK Alltid nyheter</a> (always news) &#8211; Click &#8220;Nettradio&#8221; in the left bar.</li>
<li><a href="http://www.nrk.no/klassisk/">NRK Klassisk</a></li>
<li><a href="http://www.p4.no/">P4 Radio Hele Norge</a> &#8211; Click &#8220;lytt nå&#8221;</li>
<li><a href="http://www.nrk.no/radio/">All NRK Radio channels</a></li>
<li><a href="http://www.radiolist.net/norway">A huge list of other norwegian radio channels</a></li>
</ul>
<h2>Extra resources</h2>
<h4><a href="http://ankisrs.net/">Anki flashcards</a></h4>
<p>Anki is a program to exercise flashcards using <a href="http://en.wikipedia.org/wiki/Spaced_repetition">spaced repetition</a>. I use this to exercise vocabulary. The great thing about Anki is that you can also add audio files to your flashcards, so you can train pronunciation and spelling in one go. I don&#8217;t like having to record every word manually, so I made <a href="http://bulktts.appspot.com/">this site</a> to automatically generate sound files for words you type in. <a href="http://en.wiktionary.org/wiki/Wiktionary:Frequency_lists/Norwegian">Here</a> is a list of the 1000 most used Norwegian words to get you started. Be sure to use Bokm<a href="http://en.wikipedia.org/wiki/Bokmaal_and_Nynorsk#Bokm.C3.A5l_and_Nynorsk">å</a>l (see below).</p>
<h4>News in &#8220;Simple Norwegian&#8221;</h4>
<p><a href="http://www.klartale.no/">Klar Tale</a>is a news website written in simple Norwegian. If you use their website together with a browser plugin which can translate (unknown) words you select then this is another good way of learning.</p>
<h4>Lessons on Youtube</h4>
<p><a href="http://www.youtube.com/user/Crienexzy">Crienexzy</a>on Youtube has a bunch of videos on Norwegian pronunciation. She&#8217;s also a fine example of Scandinavian beauty.</p>
<h4>Films</h4>
<p>A great way to passively (but slowly) learn is by watching movies and series. Some Norwegian films I liked were:</p>
<ul>
<li><a href="http://www.imdb.com/title/tt1255956/">Vegas</a></li>
<li><a href="http://www.imdb.com/title/tt1740707/">Trolljegeren</a></li>
<li><a href="http://www.imdb.com/title/tt1278340/">Død snø</a></li>
<li>Fritt Vilt <a href="http://www.imdb.com/title/tt0808276/">I</a>, <a href="http://www.imdb.com/title/tt1188990/">II</a>, <a href="http://www.imdb.com/title/tt1464535/">III</a></li>
</ul>
<p>A big list of Norwegian films can be found <a href="http://www.imdb.com/search/title?languages=no|1&amp;title_type=feature&amp;sort=moviemeter,asc">on IMDB</a>.</p>
<h4><a href="http://www.livemocha.com/">Livemocha</a></h4>
<p>Livemocha uses the same teaching style as Rosetta Stone. I&#8217;m not particularly fond of this way of learning, I learned a bunch more by just a few lessons of Pimsleur. However, it&#8217;s a great way to find native speaking partners.</p>
<h4><a title="Interpals" href="http://interpals.net">Interpals</a></h4>
<p>A site aimed at bringing penpals together. Has quite a large user base.</p>
<h4>Linguistic tools &amp; sound files of Norwegian dialects</h4>
<p><a href="http://www.ling.hf.ntnu.no/">This site</a> contains <a href="http://www.ling.hf.ntnu.no/forskning/norsource/service.html">a tool</a> to break down sentence structure and some <a href="http://www.ling.hf.ntnu.no/nos_files/mp3/">sound files</a> of texts in various Norwegian dialects. I think it should be accessible  through <a href="http://www.ling.hf.ntnu.no/nos_ny/">this site</a> as well, but that one seems to have some database problems atm. Books about norwegian dialects can be found <a href="http://www.bokkilden.no/SamboWeb/emneliste.do?emnekode=8.1.8.2">here</a>.</p>
<h4>Free music</h4>
<p>Gatas Parlament is a Norwegian rap group and they offer their music for free on <a href="http://www.gatasp.no/diskografi/">their website</a>.</p>
<h4>More info</h4>
<p><a href="http://norwegianlanguage.info/index.html">This site</a>has a bunch of links to Norwegian related things.</p>
<h2>Bokmål &amp; Nynorsk</h2>
<p>Norwegian has 2 written forms, <a href="http://en.wikipedia.org/wiki/Bokmaal_and_Nynorsk#Bokm.C3.A5l_and_Nynorsk">Bokmål and Nynorsk</a>. Unlike what Nynorsk&#8217;s (new-Norwegian) name seems to suggest it is actually older than Bokmål. The grand majority of (newly) written material is in Bokmål, so you&#8217;ll have the most use of learning Bokmål. As far as I know, all textbooks listed above use Bokmål.</p>
<h2>Get started</h2>
<p>I found a <a href="http://thepiratebay.org/torrent/6327675">torrent</a> which contains a lot of the resources mentioned above. Credit where credit is due: a lot of the resources mentioned here came from <a href="http://www.reddit.com/r/Norway/comments/gfh4v/id_love_to_learn_the_basics_of_norwegian_where/c1n70ok">this post</a> on reddit. <span style="color: #ff0000;"><strong>Update</strong></span> Found <a href="http://www.stolaf.edu/depts/norwegian/grammar/index.html">a site</a> with good explanations on grammar rules. And <a title="Verbix conjugations" href="http://www.verbix.com/languages/norwegian.shtml">a site</a> which will show you ALL conjugations of a given verb! Super useful.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/KqH5xVyVQXgo-fjPHAYQlZSQ9Rs/0/da"><img src="http://feedads.g.doubleclick.net/~a/KqH5xVyVQXgo-fjPHAYQlZSQ9Rs/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/KqH5xVyVQXgo-fjPHAYQlZSQ9Rs/1/da"><img src="http://feedads.g.doubleclick.net/~a/KqH5xVyVQXgo-fjPHAYQlZSQ9Rs/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/perused/~4/0uRigatl9p8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.jeroenpelgrims.be/2011/04/learning-norwegian-some-resources/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://blog.jeroenpelgrims.be/2011/04/learning-norwegian-some-resources/</feedburner:origLink></item>
		<item>
		<title>Bulktts – Text to speech using Google Translate</title>
		<link>http://feedproxy.google.com/~r/perused/~3/VMNR9xbYmMo/</link>
		<comments>http://blog.jeroenpelgrims.be/2011/03/bulktts-text-to-speech-using-google-translate/#comments</comments>
		<pubDate>Tue, 08 Mar 2011 02:47:47 +0000</pubDate>
		<dc:creator>Jeroen</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.jeroenpelgrims.be/?p=506</guid>
		<description><![CDATA[The project I was talking about in the previous post was this one, bulktts. With Google Translate you can only listen to the sound of the text you typed in, but you can&#8217;t download it. I found a url which with the right parameters lets you download the mp3 file generated by Google Translate, but [...]]]></description>
			<content:encoded><![CDATA[<p>The project I was talking about in the previous post was this one, <a href="http://bulktts.appspot.com">bulktts</a>.<br />
With Google Translate you can only listen to the sound of the text you typed in, but you can&#8217;t download it.<br />
I found a url which with the right parameters lets you download the mp3 file generated by Google Translate, but if you need a bunch of words converted to speech this is a a tedious job of changing the url, save as.. etc.</p>
<p>Bulktts allows you to choose a language, paste your list of words in and download a zip file with the mp3&#8242;s.</p>
<p><del>There are still some bugs though, at the moment words with special characters won&#8217;t product the correct sound.<br />
</del>Update: Sound bug fixed. Only the filenames for special character words in zip files are still not correct.</p>
<div style="font-size: 12px; color: #cccccc; background-color: #0000ff; font-family: &quot;Trebuchet MS&quot;, &quot;Helvetica&quot;, sans-serif; line-height: 100%; opacity: 1; border-top-left-radius: 7px; border-top-right-radius: 7px; border-bottom-right-radius: 7px; border-bottom-left-radius: 7px; text-align: left; position: fixed; max-width: 400px; z-index: 2147480064; top: 97px; left: 560px; display: none; padding: 4px; border: 1px none #000000;">but<br />
<strong>conjunction</strong> <em>but, yet, however, still</em></div>
<div style="display: none; position: fixed; max-height: 27px; width: 450px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 2px; border-left-width: 2px; border-top-left-radius: 0px; border-top-right-radius: 0px; border-bottom-right-radius: 0px; border-bottom-left-radius: 5px; background-color: #ffffff; overflow-x: auto; overflow-y: auto; min-height: 200px; z-index: 2147479936; text-align: center; color: #000000; right: 0px; top: 0px; border-color: #808080; border-style: dashed; padding: 3px;"><textarea style="height: 80px; width: 444px; padding: 2px; border: 1px solid rgba(7, 0, 0, 0);"></textarea>&nbsp;</p>
<select>
<option value="af">Afrikaans</option>
<option value="sq">Albanian</option>
<option value="ar">Arabic</option>
<option value="hy">Armenian</option>
<option value="az">Azerbaijani</option>
<option value="eu">Basque</option>
<option value="be">Belarusian</option>
<option value="bg">Bulgarian</option>
<option value="ca">Catalan</option>
<option value="zh-CN">Chinese (Simplified)</option>
<option value="zh-TW">Chinese (Traditional)</option>
<option value="hr">Croatian</option>
<option value="cs">Czech</option>
<option value="da">Danish</option>
<option selected="selected" value="auto">Detect language</option>
<option value="nl">Dutch</option>
<option value="en">English</option>
<option value="et">Estonian</option>
<option value="tl">Filipino</option>
<option value="fi">Finnish</option>
<option value="fr">French</option>
<option value="gl">Galician</option>
<option value="ka">Georgian</option>
<option value="de">German</option>
<option value="el">Greek</option>
<option value="ht">Haitian Creole</option>
<option value="iw">Hebrew</option>
<option value="hi">Hindi</option>
<option value="hu">Hungarian</option>
<option value="is">Icelandic</option>
<option value="id">Indonesian</option>
<option value="ga">Irish</option>
<option value="it">Italian</option>
<option value="ja">Japanese</option>
<option value="ko">Korean</option>
<option value="la">Latin</option>
<option value="lv">Latvian</option>
<option value="lt">Lithuanian</option>
<option value="mk">Macedonian</option>
<option value="ms">Malay</option>
<option value="mt">Maltese</option>
<option value="no">Norwegian</option>
<option value="fa">Persian</option>
<option value="pl">Polish</option>
<option value="pt">Portuguese</option>
<option value="ro">Romanian</option>
<option value="ru">Russian</option>
<option value="sr">Serbian</option>
<option value="sk">Slovak</option>
<option value="sl">Slovenian</option>
<option value="es">Spanish</option>
<option value="sw">Swahili</option>
<option value="sv">Swedish</option>
<option value="th">Thai</option>
<option value="tr">Turkish</option>
<option value="uk">Ukrainian</option>
<option value="ur">Urdu</option>
<option value="vi">Vietnamese</option>
<option value="cy">Welsh</option>
<option value="yi">Yiddish</option>
</select>
<p><span style="font-weight: bold; cursor: pointer; color: #d3d3d3;">⇄</span></p>
<select>
<option value="af">Afrikaans</option>
<option value="sq">Albanian</option>
<option value="ar">Arabic</option>
<option value="hy">Armenian</option>
<option value="az">Azerbaijani</option>
<option value="eu">Basque</option>
<option value="be">Belarusian</option>
<option value="bg">Bulgarian</option>
<option value="ca">Catalan</option>
<option value="zh-CN">Chinese (Simplified)</option>
<option value="zh-TW">Chinese (Traditional)</option>
<option value="hr">Croatian</option>
<option value="cs">Czech</option>
<option value="da">Danish</option>
<option value="nl">Dutch</option>
<option selected="selected" value="en">English</option>
<option value="et">Estonian</option>
<option value="tl">Filipino</option>
<option value="fi">Finnish</option>
<option value="fr">French</option>
<option value="gl">Galician</option>
<option value="ka">Georgian</option>
<option value="de">German</option>
<option value="el">Greek</option>
<option value="ht">Haitian Creole</option>
<option value="iw">Hebrew</option>
<option value="hi">Hindi</option>
<option value="hu">Hungarian</option>
<option value="is">Icelandic</option>
<option value="id">Indonesian</option>
<option value="ga">Irish</option>
<option value="it">Italian</option>
<option value="ja">Japanese</option>
<option value="ko">Korean</option>
<option value="la">Latin</option>
<option value="lv">Latvian</option>
<option value="lt">Lithuanian</option>
<option value="mk">Macedonian</option>
<option value="ms">Malay</option>
<option value="mt">Maltese</option>
<option value="no">Norwegian</option>
<option value="fa">Persian</option>
<option value="pl">Polish</option>
<option value="pt">Portuguese</option>
<option value="ro">Romanian</option>
<option value="ru">Russian</option>
<option value="sr">Serbian</option>
<option value="sk">Slovak</option>
<option value="sl">Slovenian</option>
<option value="es">Spanish</option>
<option value="sw">Swahili</option>
<option value="sv">Swedish</option>
<option value="th">Thai</option>
<option value="tr">Turkish</option>
<option value="uk">Ukrainian</option>
<option value="ur">Urdu</option>
<option value="vi">Vietnamese</option>
<option value="cy">Welsh</option>
<option value="yi">Yiddish</option>
</select>
<div style="text-align: left; background-color: #ebeff9;">English (auto-detected) » English</div>
</div>
<div style="display: none; position: fixed; max-height: 126px; width: 450px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 2px; border-left-width: 2px; border-top-left-radius: 0px; border-top-right-radius: 0px; border-bottom-right-radius: 0px; border-bottom-left-radius: 5px; background-color: #ffffff; overflow-x: auto; overflow-y: auto; min-height: 200px; z-index: 2147479936; text-align: center; color: #000000; right: 0px; top: 0px; border-color: #808080; border-style: dashed; padding: 3px;"><textarea style="height: 80px; width: 444px; padding: 2px; border: 1px solid rgba(7, 0, 0, 0);"></textarea>&nbsp;</p>
<select>
<option value="af">Afrikaans</option>
<option value="sq">Albanian</option>
<option value="ar">Arabic</option>
<option value="hy">Armenian</option>
<option value="az">Azerbaijani</option>
<option value="eu">Basque</option>
<option value="be">Belarusian</option>
<option value="bg">Bulgarian</option>
<option value="ca">Catalan</option>
<option value="zh-CN">Chinese (Simplified)</option>
<option value="zh-TW">Chinese (Traditional)</option>
<option value="hr">Croatian</option>
<option value="cs">Czech</option>
<option value="da">Danish</option>
<option selected="selected" value="auto">Detect language</option>
<option value="nl">Dutch</option>
<option value="en">English</option>
<option value="et">Estonian</option>
<option value="tl">Filipino</option>
<option value="fi">Finnish</option>
<option value="fr">French</option>
<option value="gl">Galician</option>
<option value="ka">Georgian</option>
<option value="de">German</option>
<option value="el">Greek</option>
<option value="ht">Haitian Creole</option>
<option value="iw">Hebrew</option>
<option value="hi">Hindi</option>
<option value="hu">Hungarian</option>
<option value="is">Icelandic</option>
<option value="id">Indonesian</option>
<option value="ga">Irish</option>
<option value="it">Italian</option>
<option value="ja">Japanese</option>
<option value="ko">Korean</option>
<option value="la">Latin</option>
<option value="lv">Latvian</option>
<option value="lt">Lithuanian</option>
<option value="mk">Macedonian</option>
<option value="ms">Malay</option>
<option value="mt">Maltese</option>
<option value="no">Norwegian</option>
<option value="fa">Persian</option>
<option value="pl">Polish</option>
<option value="pt">Portuguese</option>
<option value="ro">Romanian</option>
<option value="ru">Russian</option>
<option value="sr">Serbian</option>
<option value="sk">Slovak</option>
<option value="sl">Slovenian</option>
<option value="es">Spanish</option>
<option value="sw">Swahili</option>
<option value="sv">Swedish</option>
<option value="th">Thai</option>
<option value="tr">Turkish</option>
<option value="uk">Ukrainian</option>
<option value="ur">Urdu</option>
<option value="vi">Vietnamese</option>
<option value="cy">Welsh</option>
<option value="yi">Yiddish</option>
</select>
<p><span style="font-weight: bold; cursor: pointer; color: #d3d3d3;">⇄</span></p>
<select>
<option value="af">Afrikaans</option>
<option value="sq">Albanian</option>
<option value="ar">Arabic</option>
<option value="hy">Armenian</option>
<option value="az">Azerbaijani</option>
<option value="eu">Basque</option>
<option value="be">Belarusian</option>
<option value="bg">Bulgarian</option>
<option value="ca">Catalan</option>
<option value="zh-CN">Chinese (Simplified)</option>
<option value="zh-TW">Chinese (Traditional)</option>
<option value="hr">Croatian</option>
<option value="cs">Czech</option>
<option value="da">Danish</option>
<option value="nl">Dutch</option>
<option selected="selected" value="en">English</option>
<option value="et">Estonian</option>
<option value="tl">Filipino</option>
<option value="fi">Finnish</option>
<option value="fr">French</option>
<option value="gl">Galician</option>
<option value="ka">Georgian</option>
<option value="de">German</option>
<option value="el">Greek</option>
<option value="ht">Haitian Creole</option>
<option value="iw">Hebrew</option>
<option value="hi">Hindi</option>
<option value="hu">Hungarian</option>
<option value="is">Icelandic</option>
<option value="id">Indonesian</option>
<option value="ga">Irish</option>
<option value="it">Italian</option>
<option value="ja">Japanese</option>
<option value="ko">Korean</option>
<option value="la">Latin</option>
<option value="lv">Latvian</option>
<option value="lt">Lithuanian</option>
<option value="mk">Macedonian</option>
<option value="ms">Malay</option>
<option value="mt">Maltese</option>
<option value="no">Norwegian</option>
<option value="fa">Persian</option>
<option value="pl">Polish</option>
<option value="pt">Portuguese</option>
<option value="ro">Romanian</option>
<option value="ru">Russian</option>
<option value="sr">Serbian</option>
<option value="sk">Slovak</option>
<option value="sl">Slovenian</option>
<option value="es">Spanish</option>
<option value="sw">Swahili</option>
<option value="sv">Swedish</option>
<option value="th">Thai</option>
<option value="tr">Turkish</option>
<option value="uk">Ukrainian</option>
<option value="ur">Urdu</option>
<option value="vi">Vietnamese</option>
<option value="cy">Welsh</option>
<option value="yi">Yiddish</option>
</select>
<div style="text-align: left; background-color: #ebeff9;">English (auto-detected) » English</div>
</div>
<div style="display: none; position: fixed; max-height: 161px; width: 450px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 2px; border-left-width: 2px; border-top-left-radius: 0px; border-top-right-radius: 0px; border-bottom-right-radius: 0px; border-bottom-left-radius: 5px; background-color: #ffffff; overflow-x: auto; overflow-y: auto; min-height: 200px; z-index: 2147479936; text-align: center; color: #000000; right: 0px; top: 0px; border-color: #808080; border-style: dashed; padding: 3px;"><textarea style="height: 80px; width: 444px; padding: 2px; border: 1px solid rgba(7, 0, 0, 0);"></textarea>&nbsp;</p>
<select>
<option value="af">Afrikaans</option>
<option value="sq">Albanian</option>
<option value="ar">Arabic</option>
<option value="hy">Armenian</option>
<option value="az">Azerbaijani</option>
<option value="eu">Basque</option>
<option value="be">Belarusian</option>
<option value="bg">Bulgarian</option>
<option value="ca">Catalan</option>
<option value="zh-CN">Chinese (Simplified)</option>
<option value="zh-TW">Chinese (Traditional)</option>
<option value="hr">Croatian</option>
<option value="cs">Czech</option>
<option value="da">Danish</option>
<option selected="selected" value="auto">Detect language</option>
<option value="nl">Dutch</option>
<option value="en">English</option>
<option value="et">Estonian</option>
<option value="tl">Filipino</option>
<option value="fi">Finnish</option>
<option value="fr">French</option>
<option value="gl">Galician</option>
<option value="ka">Georgian</option>
<option value="de">German</option>
<option value="el">Greek</option>
<option value="ht">Haitian Creole</option>
<option value="iw">Hebrew</option>
<option value="hi">Hindi</option>
<option value="hu">Hungarian</option>
<option value="is">Icelandic</option>
<option value="id">Indonesian</option>
<option value="ga">Irish</option>
<option value="it">Italian</option>
<option value="ja">Japanese</option>
<option value="ko">Korean</option>
<option value="la">Latin</option>
<option value="lv">Latvian</option>
<option value="lt">Lithuanian</option>
<option value="mk">Macedonian</option>
<option value="ms">Malay</option>
<option value="mt">Maltese</option>
<option value="no">Norwegian</option>
<option value="fa">Persian</option>
<option value="pl">Polish</option>
<option value="pt">Portuguese</option>
<option value="ro">Romanian</option>
<option value="ru">Russian</option>
<option value="sr">Serbian</option>
<option value="sk">Slovak</option>
<option value="sl">Slovenian</option>
<option value="es">Spanish</option>
<option value="sw">Swahili</option>
<option value="sv">Swedish</option>
<option value="th">Thai</option>
<option value="tr">Turkish</option>
<option value="uk">Ukrainian</option>
<option value="ur">Urdu</option>
<option value="vi">Vietnamese</option>
<option value="cy">Welsh</option>
<option value="yi">Yiddish</option>
</select>
<p><span style="font-weight: bold; cursor: pointer; color: #d3d3d3;">⇄</span></p>
<select>
<option value="af">Afrikaans</option>
<option value="sq">Albanian</option>
<option value="ar">Arabic</option>
<option value="hy">Armenian</option>
<option value="az">Azerbaijani</option>
<option value="eu">Basque</option>
<option value="be">Belarusian</option>
<option value="bg">Bulgarian</option>
<option value="ca">Catalan</option>
<option value="zh-CN">Chinese (Simplified)</option>
<option value="zh-TW">Chinese (Traditional)</option>
<option value="hr">Croatian</option>
<option value="cs">Czech</option>
<option value="da">Danish</option>
<option value="nl">Dutch</option>
<option selected="selected" value="en">English</option>
<option value="et">Estonian</option>
<option value="tl">Filipino</option>
<option value="fi">Finnish</option>
<option value="fr">French</option>
<option value="gl">Galician</option>
<option value="ka">Georgian</option>
<option value="de">German</option>
<option value="el">Greek</option>
<option value="ht">Haitian Creole</option>
<option value="iw">Hebrew</option>
<option value="hi">Hindi</option>
<option value="hu">Hungarian</option>
<option value="is">Icelandic</option>
<option value="id">Indonesian</option>
<option value="ga">Irish</option>
<option value="it">Italian</option>
<option value="ja">Japanese</option>
<option value="ko">Korean</option>
<option value="la">Latin</option>
<option value="lv">Latvian</option>
<option value="lt">Lithuanian</option>
<option value="mk">Macedonian</option>
<option value="ms">Malay</option>
<option value="mt">Maltese</option>
<option value="no">Norwegian</option>
<option value="fa">Persian</option>
<option value="pl">Polish</option>
<option value="pt">Portuguese</option>
<option value="ro">Romanian</option>
<option value="ru">Russian</option>
<option value="sr">Serbian</option>
<option value="sk">Slovak</option>
<option value="sl">Slovenian</option>
<option value="es">Spanish</option>
<option value="sw">Swahili</option>
<option value="sv">Swedish</option>
<option value="th">Thai</option>
<option value="tr">Turkish</option>
<option value="uk">Ukrainian</option>
<option value="ur">Urdu</option>
<option value="vi">Vietnamese</option>
<option value="cy">Welsh</option>
<option value="yi">Yiddish</option>
</select>
<div style="text-align: left; background-color: #ebeff9;">English (auto-detected) » English</div>
</div>
<div style="display: none; position: fixed; max-height: 161px; width: 450px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 2px; border-left-width: 2px; border-top-left-radius: 0px; border-top-right-radius: 0px; border-bottom-right-radius: 0px; border-bottom-left-radius: 5px; background-color: #ffffff; overflow-x: auto; overflow-y: auto; min-height: 200px; z-index: 2147479936; text-align: center; color: #000000; right: 0px; top: 0px; border-color: #808080; border-style: dashed; padding: 3px;"><textarea style="height: 80px; width: 444px; padding: 2px; border: 1px solid rgba(7, 0, 0, 0);"></textarea></p>
<select>
<option value="af">Afrikaans</option>
<option value="sq">Albanian</option>
<option value="ar">Arabic</option>
<option value="hy">Armenian</option>
<option value="az">Azerbaijani</option>
<option value="eu">Basque</option>
<option value="be">Belarusian</option>
<option value="bg">Bulgarian</option>
<option value="ca">Catalan</option>
<option value="zh-CN">Chinese (Simplified)</option>
<option value="zh-TW">Chinese (Traditional)</option>
<option value="hr">Croatian</option>
<option value="cs">Czech</option>
<option value="da">Danish</option>
<option selected="selected" value="auto">Detect language</option>
<option value="nl">Dutch</option>
<option value="en">English</option>
<option value="et">Estonian</option>
<option value="tl">Filipino</option>
<option value="fi">Finnish</option>
<option value="fr">French</option>
<option value="gl">Galician</option>
<option value="ka">Georgian</option>
<option value="de">German</option>
<option value="el">Greek</option>
<option value="ht">Haitian Creole</option>
<option value="iw">Hebrew</option>
<option value="hi">Hindi</option>
<option value="hu">Hungarian</option>
<option value="is">Icelandic</option>
<option value="id">Indonesian</option>
<option value="ga">Irish</option>
<option value="it">Italian</option>
<option value="ja">Japanese</option>
<option value="ko">Korean</option>
<option value="la">Latin</option>
<option value="lv">Latvian</option>
<option value="lt">Lithuanian</option>
<option value="mk">Macedonian</option>
<option value="ms">Malay</option>
<option value="mt">Maltese</option>
<option value="no">Norwegian</option>
<option value="fa">Persian</option>
<option value="pl">Polish</option>
<option value="pt">Portuguese</option>
<option value="ro">Romanian</option>
<option value="ru">Russian</option>
<option value="sr">Serbian</option>
<option value="sk">Slovak</option>
<option value="sl">Slovenian</option>
<option value="es">Spanish</option>
<option value="sw">Swahili</option>
<option value="sv">Swedish</option>
<option value="th">Thai</option>
<option value="tr">Turkish</option>
<option value="uk">Ukrainian</option>
<option value="ur">Urdu</option>
<option value="vi">Vietnamese</option>
<option value="cy">Welsh</option>
<option value="yi">Yiddish</option>
</select>
<p><span style="font-weight: bold; cursor: pointer; color: #d3d3d3;">⇄</span></p>
<select>
<option value="af">Afrikaans</option>
<option value="sq">Albanian</option>
<option value="ar">Arabic</option>
<option value="hy">Armenian</option>
<option value="az">Azerbaijani</option>
<option value="eu">Basque</option>
<option value="be">Belarusian</option>
<option value="bg">Bulgarian</option>
<option value="ca">Catalan</option>
<option value="zh-CN">Chinese (Simplified)</option>
<option value="zh-TW">Chinese (Traditional)</option>
<option value="hr">Croatian</option>
<option value="cs">Czech</option>
<option value="da">Danish</option>
<option value="nl">Dutch</option>
<option selected="selected" value="en">English</option>
<option value="et">Estonian</option>
<option value="tl">Filipino</option>
<option value="fi">Finnish</option>
<option value="fr">French</option>
<option value="gl">Galician</option>
<option value="ka">Georgian</option>
<option value="de">German</option>
<option value="el">Greek</option>
<option value="ht">Haitian Creole</option>
<option value="iw">Hebrew</option>
<option value="hi">Hindi</option>
<option value="hu">Hungarian</option>
<option value="is">Icelandic</option>
<option value="id">Indonesian</option>
<option value="ga">Irish</option>
<option value="it">Italian</option>
<option value="ja">Japanese</option>
<option value="ko">Korean</option>
<option value="la">Latin</option>
<option value="lv">Latvian</option>
<option value="lt">Lithuanian</option>
<option value="mk">Macedonian</option>
<option value="ms">Malay</option>
<option value="mt">Maltese</option>
<option value="no">Norwegian</option>
<option value="fa">Persian</option>
<option value="pl">Polish</option>
<option value="pt">Portuguese</option>
<option value="ro">Romanian</option>
<option value="ru">Russian</option>
<option value="sr">Serbian</option>
<option value="sk">Slovak</option>
<option value="sl">Slovenian</option>
<option value="es">Spanish</option>
<option value="sw">Swahili</option>
<option value="sv">Swedish</option>
<option value="th">Thai</option>
<option value="tr">Turkish</option>
<option value="uk">Ukrainian</option>
<option value="ur">Urdu</option>
<option value="vi">Vietnamese</option>
<option value="cy">Welsh</option>
<option value="yi">Yiddish</option>
</select>
<div style="text-align: left; background-color: #ebeff9;">English (auto-detected) » English</div>
</div>
<div style="display: none; position: fixed; max-height: 111px; width: 450px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 2px; border-left-width: 2px; border-top-left-radius: 0px; border-top-right-radius: 0px; border-bottom-right-radius: 0px; border-bottom-left-radius: 5px; background-color: #ffffff; overflow-x: auto; overflow-y: auto; min-height: 200px; z-index: 2147479936; text-align: center; color: #000000; right: 0px; top: 0px; border-color: #808080; border-style: dashed; padding: 3px;"><textarea style="height: 80px; width: 444px; padding: 2px; border: 1px solid rgba(7, 0, 0, 0);"></textarea><br />
<select>
<option value="af">Afrikaans</option>
<option value="sq">Albanian</option>
<option value="ar">Arabic</option>
<option value="hy">Armenian</option>
<option value="az">Azerbaijani</option>
<option value="eu">Basque</option>
<option value="be">Belarusian</option>
<option value="bg">Bulgarian</option>
<option value="ca">Catalan</option>
<option value="zh-CN">Chinese (Simplified)</option>
<option value="zh-TW">Chinese (Traditional)</option>
<option value="hr">Croatian</option>
<option value="cs">Czech</option>
<option value="da">Danish</option>
<option selected="selected" value="auto">Detect language</option>
<option value="nl">Dutch</option>
<option value="en">English</option>
<option value="et">Estonian</option>
<option value="tl">Filipino</option>
<option value="fi">Finnish</option>
<option value="fr">French</option>
<option value="gl">Galician</option>
<option value="ka">Georgian</option>
<option value="de">German</option>
<option value="el">Greek</option>
<option value="ht">Haitian Creole</option>
<option value="iw">Hebrew</option>
<option value="hi">Hindi</option>
<option value="hu">Hungarian</option>
<option value="is">Icelandic</option>
<option value="id">Indonesian</option>
<option value="ga">Irish</option>
<option value="it">Italian</option>
<option value="ja">Japanese</option>
<option value="ko">Korean</option>
<option value="la">Latin</option>
<option value="lv">Latvian</option>
<option value="lt">Lithuanian</option>
<option value="mk">Macedonian</option>
<option value="ms">Malay</option>
<option value="mt">Maltese</option>
<option value="no">Norwegian</option>
<option value="fa">Persian</option>
<option value="pl">Polish</option>
<option value="pt">Portuguese</option>
<option value="ro">Romanian</option>
<option value="ru">Russian</option>
<option value="sr">Serbian</option>
<option value="sk">Slovak</option>
<option value="sl">Slovenian</option>
<option value="es">Spanish</option>
<option value="sw">Swahili</option>
<option value="sv">Swedish</option>
<option value="th">Thai</option>
<option value="tr">Turkish</option>
<option value="uk">Ukrainian</option>
<option value="ur">Urdu</option>
<option value="vi">Vietnamese</option>
<option value="cy">Welsh</option>
<option value="yi">Yiddish</option>
</select>
<p><span style="font-weight: bold; cursor: pointer; color: #d3d3d3;">⇄</span><br />
<select>
<option value="af">Afrikaans</option>
<option value="sq">Albanian</option>
<option value="ar">Arabic</option>
<option value="hy">Armenian</option>
<option value="az">Azerbaijani</option>
<option value="eu">Basque</option>
<option value="be">Belarusian</option>
<option value="bg">Bulgarian</option>
<option value="ca">Catalan</option>
<option value="zh-CN">Chinese (Simplified)</option>
<option value="zh-TW">Chinese (Traditional)</option>
<option value="hr">Croatian</option>
<option value="cs">Czech</option>
<option value="da">Danish</option>
<option value="nl">Dutch</option>
<option selected="selected" value="en">English</option>
<option value="et">Estonian</option>
<option value="tl">Filipino</option>
<option value="fi">Finnish</option>
<option value="fr">French</option>
<option value="gl">Galician</option>
<option value="ka">Georgian</option>
<option value="de">German</option>
<option value="el">Greek</option>
<option value="ht">Haitian Creole</option>
<option value="iw">Hebrew</option>
<option value="hi">Hindi</option>
<option value="hu">Hungarian</option>
<option value="is">Icelandic</option>
<option value="id">Indonesian</option>
<option value="ga">Irish</option>
<option value="it">Italian</option>
<option value="ja">Japanese</option>
<option value="ko">Korean</option>
<option value="la">Latin</option>
<option value="lv">Latvian</option>
<option value="lt">Lithuanian</option>
<option value="mk">Macedonian</option>
<option value="ms">Malay</option>
<option value="mt">Maltese</option>
<option value="no">Norwegian</option>
<option value="fa">Persian</option>
<option value="pl">Polish</option>
<option value="pt">Portuguese</option>
<option value="ro">Romanian</option>
<option value="ru">Russian</option>
<option value="sr">Serbian</option>
<option value="sk">Slovak</option>
<option value="sl">Slovenian</option>
<option value="es">Spanish</option>
<option value="sw">Swahili</option>
<option value="sv">Swedish</option>
<option value="th">Thai</option>
<option value="tr">Turkish</option>
<option value="uk">Ukrainian</option>
<option value="ur">Urdu</option>
<option value="vi">Vietnamese</option>
<option value="cy">Welsh</option>
<option value="yi">Yiddish</option>
</select>
<div style="text-align: left; background-color: #ebeff9;">English (auto-detected) » English</div>
<div style="width: 444px; max-width: 444px; min-height: 80px; background-color: #ffffff; text-align: justify; padding: 2px; border: 1px solid #808080;"></div>
</div>

<p><a href="http://feedads.g.doubleclick.net/~a/QMg1Sa0H9ZAMzTN0EVxm5Rdp5-I/0/da"><img src="http://feedads.g.doubleclick.net/~a/QMg1Sa0H9ZAMzTN0EVxm5Rdp5-I/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/QMg1Sa0H9ZAMzTN0EVxm5Rdp5-I/1/da"><img src="http://feedads.g.doubleclick.net/~a/QMg1Sa0H9ZAMzTN0EVxm5Rdp5-I/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/perused/~4/VMNR9xbYmMo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.jeroenpelgrims.be/2011/03/bulktts-text-to-speech-using-google-translate/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.jeroenpelgrims.be/2011/03/bulktts-text-to-speech-using-google-translate/</feedburner:origLink></item>
		<item>
		<title>Python in-memory zip file</title>
		<link>http://feedproxy.google.com/~r/perused/~3/45pers_wfZ8/</link>
		<comments>http://blog.jeroenpelgrims.be/2011/03/python-in-memory-zip-file/#comments</comments>
		<pubDate>Sun, 06 Mar 2011 11:16:28 +0000</pubDate>
		<dc:creator>Jeroen</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://blog.jeroenpelgrims.be/?p=500</guid>
		<description><![CDATA[I needed this for something where I wanted to send the visitor of a website a bunch of files he selected at once. An easy way to do this would be to add the files to a zip file and then send that zip file to the user. Unfortunately Python doesn&#8217;t have an in-memory zip [...]]]></description>
			<content:encoded><![CDATA[<p>I needed this for something where I wanted to send the visitor of a website a bunch of files he selected at once.<br />
An easy way to do this would be to add the files to a zip file and then send that zip file to the user.<br />
Unfortunately Python doesn&#8217;t have an in-memory zip file library, you can only interact with zip files on disk.</p>
<p>After a bit of googling around I came to this <a href="http://stackoverflow.com/questions/3610221/how-to-create-an-in-memory-zip-file-with-directories-without-touching-the-disk/3616796#3616796">StackOverflow answer</a>.<br />
That worked like a charm, and here is my more reusable version:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
</pre></td><td class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">from</span> <span style="color: #dc143c;">zipfile</span> <span style="color: #ff7700;font-weight:bold;">import</span> ZipFile
<span style="color: #ff7700;font-weight:bold;">from</span> <span style="color: #dc143c;">StringIO</span> <span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">StringIO</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">class</span> InMemoryZipFile<span style="color: black;">&#40;</span><span style="color: #008000;">object</span><span style="color: black;">&#41;</span>:
	<span style="color: #ff7700;font-weight:bold;">def</span> <span style="color: #0000cd;">__init__</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span><span style="color: black;">&#41;</span>:
		<span style="color: #008000;">self</span>.<span style="color: black;">inMemoryOutputFile</span> = <span style="color: #dc143c;">StringIO</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
	<span style="color: #ff7700;font-weight:bold;">def</span> write<span style="color: black;">&#40;</span><span style="color: #008000;">self</span>, inzipfilename, data<span style="color: black;">&#41;</span>:
		<span style="color: #008000;">zip</span> = ZipFile<span style="color: black;">&#40;</span><span style="color: #008000;">self</span>.<span style="color: black;">inMemoryOutputFile</span>, <span style="color: #483d8b;">'a'</span><span style="color: black;">&#41;</span>
		<span style="color: #008000;">zip</span>.<span style="color: black;">writestr</span><span style="color: black;">&#40;</span>inzipfilename, data<span style="color: black;">&#41;</span>
		<span style="color: #008000;">zip</span>.<span style="color: black;">close</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
	<span style="color: #ff7700;font-weight:bold;">def</span> read<span style="color: black;">&#40;</span><span style="color: #008000;">self</span><span style="color: black;">&#41;</span>:
		<span style="color: #008000;">self</span>.<span style="color: black;">inMemoryOutputFile</span>.<span style="color: black;">seek</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#41;</span>
		<span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #008000;">self</span>.<span style="color: black;">inMemoryOutputFile</span>.<span style="color: black;">getvalue</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
	<span style="color: #ff7700;font-weight:bold;">def</span> writetofile<span style="color: black;">&#40;</span><span style="color: #008000;">self</span>, filename<span style="color: black;">&#41;</span>:
		<span style="color: #008000;">open</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'out.zip'</span>, <span style="color: #483d8b;">'wb'</span><span style="color: black;">&#41;</span>.<span style="color: black;">write</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span>.<span style="color: black;">read</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span></pre></td></tr></table></div>

<p>Save as &#8220;inmemoryzip.py&#8221; and import it as &#8220;inmemoryzip&#8221;.<br />
This is quite limited compared to the standard ZipFile class, but this gets the job done for what I needed it.</p>
<div style="display: none; position: fixed; max-height: 517px; width: 450px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 2px; border-left-width: 2px; border-top-left-radius: 0px; border-top-right-radius: 0px; border-bottom-right-radius: 0px; border-bottom-left-radius: 5px; background-color: #ffffff; overflow-x: auto; overflow-y: auto; min-height: 200px; z-index: 2147479936; text-align: center; color: #000000; right: 0px; top: 0px; border-color: #808080; border-style: dashed; padding: 3px;"><textarea style="height: 80px; width: 444px; padding: 2px; border: 1px solid rgba(7, 0, 0, 0);"></textarea><br />
<select>
<option value="af">Afrikaans</option>
<option value="sq">Albanian</option>
<option value="ar">Arabic</option>
<option value="hy">Armenian</option>
<option value="az">Azerbaijani</option>
<option value="eu">Basque</option>
<option value="be">Belarusian</option>
<option value="bg">Bulgarian</option>
<option value="ca">Catalan</option>
<option value="zh-CN">Chinese (Simplified)</option>
<option value="zh-TW">Chinese (Traditional)</option>
<option value="hr">Croatian</option>
<option value="cs">Czech</option>
<option value="da">Danish</option>
<option selected="selected" value="auto">Detect language</option>
<option value="nl">Dutch</option>
<option value="en">English</option>
<option value="et">Estonian</option>
<option value="tl">Filipino</option>
<option value="fi">Finnish</option>
<option value="fr">French</option>
<option value="gl">Galician</option>
<option value="ka">Georgian</option>
<option value="de">German</option>
<option value="el">Greek</option>
<option value="ht">Haitian Creole</option>
<option value="iw">Hebrew</option>
<option value="hi">Hindi</option>
<option value="hu">Hungarian</option>
<option value="is">Icelandic</option>
<option value="id">Indonesian</option>
<option value="ga">Irish</option>
<option value="it">Italian</option>
<option value="ja">Japanese</option>
<option value="ko">Korean</option>
<option value="la">Latin</option>
<option value="lv">Latvian</option>
<option value="lt">Lithuanian</option>
<option value="mk">Macedonian</option>
<option value="ms">Malay</option>
<option value="mt">Maltese</option>
<option value="no">Norwegian</option>
<option value="fa">Persian</option>
<option value="pl">Polish</option>
<option value="pt">Portuguese</option>
<option value="ro">Romanian</option>
<option value="ru">Russian</option>
<option value="sr">Serbian</option>
<option value="sk">Slovak</option>
<option value="sl">Slovenian</option>
<option value="es">Spanish</option>
<option value="sw">Swahili</option>
<option value="sv">Swedish</option>
<option value="th">Thai</option>
<option value="tr">Turkish</option>
<option value="uk">Ukrainian</option>
<option value="ur">Urdu</option>
<option value="vi">Vietnamese</option>
<option value="cy">Welsh</option>
<option value="yi">Yiddish</option>
</select>
<p><span style="font-weight: bold; cursor: pointer; color: #d3d3d3;">⇄</span><br />
<select>
<option value="af">Afrikaans</option>
<option value="sq">Albanian</option>
<option value="ar">Arabic</option>
<option value="hy">Armenian</option>
<option value="az">Azerbaijani</option>
<option value="eu">Basque</option>
<option value="be">Belarusian</option>
<option value="bg">Bulgarian</option>
<option value="ca">Catalan</option>
<option value="zh-CN">Chinese (Simplified)</option>
<option value="zh-TW">Chinese (Traditional)</option>
<option value="hr">Croatian</option>
<option value="cs">Czech</option>
<option value="da">Danish</option>
<option value="nl">Dutch</option>
<option selected="selected" value="en">English</option>
<option value="et">Estonian</option>
<option value="tl">Filipino</option>
<option value="fi">Finnish</option>
<option value="fr">French</option>
<option value="gl">Galician</option>
<option value="ka">Georgian</option>
<option value="de">German</option>
<option value="el">Greek</option>
<option value="ht">Haitian Creole</option>
<option value="iw">Hebrew</option>
<option value="hi">Hindi</option>
<option value="hu">Hungarian</option>
<option value="is">Icelandic</option>
<option value="id">Indonesian</option>
<option value="ga">Irish</option>
<option value="it">Italian</option>
<option value="ja">Japanese</option>
<option value="ko">Korean</option>
<option value="la">Latin</option>
<option value="lv">Latvian</option>
<option value="lt">Lithuanian</option>
<option value="mk">Macedonian</option>
<option value="ms">Malay</option>
<option value="mt">Maltese</option>
<option value="no">Norwegian</option>
<option value="fa">Persian</option>
<option value="pl">Polish</option>
<option value="pt">Portuguese</option>
<option value="ro">Romanian</option>
<option value="ru">Russian</option>
<option value="sr">Serbian</option>
<option value="sk">Slovak</option>
<option value="sl">Slovenian</option>
<option value="es">Spanish</option>
<option value="sw">Swahili</option>
<option value="sv">Swedish</option>
<option value="th">Thai</option>
<option value="tr">Turkish</option>
<option value="uk">Ukrainian</option>
<option value="ur">Urdu</option>
<option value="vi">Vietnamese</option>
<option value="cy">Welsh</option>
<option value="yi">Yiddish</option>
</select>
<div style="text-align: left; background-color: #ebeff9;">English (auto-detected) » English</div>
<div style="width: 444px; max-width: 444px; min-height: 80px; background-color: #ffffff; text-align: justify; padding: 2px; border: 1px solid #808080;"></div>
</div>

<p><a href="http://feedads.g.doubleclick.net/~a/WF3VwBkFqpNnMv0xjF5cWjUm6VM/0/da"><img src="http://feedads.g.doubleclick.net/~a/WF3VwBkFqpNnMv0xjF5cWjUm6VM/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/WF3VwBkFqpNnMv0xjF5cWjUm6VM/1/da"><img src="http://feedads.g.doubleclick.net/~a/WF3VwBkFqpNnMv0xjF5cWjUm6VM/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/perused/~4/45pers_wfZ8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.jeroenpelgrims.be/2011/03/python-in-memory-zip-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.jeroenpelgrims.be/2011/03/python-in-memory-zip-file/</feedburner:origLink></item>
		<item>
		<title>Solving 8 Queens problem on an 8×8 board with a Genetic Algorithm.</title>
		<link>http://feedproxy.google.com/~r/perused/~3/Pxdt5HjayJY/</link>
		<comments>http://blog.jeroenpelgrims.be/2011/01/solving-8-queens-problem-on-an-8x8-board-with-a-genetic-algorithm/#comments</comments>
		<pubDate>Thu, 20 Jan 2011 00:55:12 +0000</pubDate>
		<dc:creator>Jeroen</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[School]]></category>

		<guid isPermaLink="false">http://blog.jeroenpelgrims.be/?p=470</guid>
		<description><![CDATA[I have an Artificial Intelligence course and one type of search algorithm handled is Genetic Algorithms. Very interesting because it uses the principle of evolution to find a solution to a problem. You start with a population of begin states and each state has a &#8216;fitness&#8217; which indicates how close it is to a solution. [...]]]></description>
			<content:encoded><![CDATA[<p>I have an Artificial Intelligence course and one type of search algorithm handled is Genetic Algorithms.<br />
Very interesting because it uses the principle of evolution to find a solution to a problem.</p>
<p>You start with a population of begin states and each state has a &#8216;fitness&#8217; which indicates how close it is to a solution.<br />
Based on that fitness you will crossjoin or mate 2 states. Higher fitness = higher chance of mating.</p>
<p>I implemented the example given in my AI course&#8217;s slides in python.<br />
The example is trying to find a solution to solve an <a href="http://en.wikipedia.org/wiki/N-queens">n-queens problem</a>, in this case 8 queens on an 8&#215;8 chessboard.<br />
Briefly explained: you need to place 8 queens on a chessboard so that none of the queens can attack eachother.<br />
(A queen can move like a Bishop and a Tower, horizontally and diagonally)</p>
<p><span id="more-470"></span></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
</pre></td><td class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">from</span> <span style="color: #dc143c;">__future__</span> <span style="color: #ff7700;font-weight:bold;">import</span> division
<span style="color: #ff7700;font-weight:bold;">from</span> <span style="color: #dc143c;">random</span> <span style="color: #ff7700;font-weight:bold;">import</span> Random, <span style="color: #dc143c;">random</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">class</span> State<span style="color: black;">&#40;</span><span style="color: #008000;">object</span><span style="color: black;">&#41;</span>:
	MUTATION_RATE = <span style="color: #ff4500;">0.03</span>
	<span style="color: #ff7700;font-weight:bold;">def</span> <span style="color: #0000cd;">__init__</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span>, parents=<span style="color: #008000;">None</span><span style="color: black;">&#41;</span>:
		r = Random<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
		<span style="color: #008000;">self</span>._fitness = <span style="color: #008000;">None</span>
		<span style="color: #008000;">self</span>._probability = <span style="color: #008000;">None</span>
		<span style="color: #ff7700;font-weight:bold;">if</span> parents==<span style="color: #008000;">None</span>:
			<span style="color: #008000;">self</span>.<span style="color: black;">state</span> = <span style="color: black;">&#91;</span>r.<span style="color: black;">randint</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">1</span>,<span style="color: #ff4500;">8</span><span style="color: black;">&#41;</span> <span style="color: #ff7700;font-weight:bold;">for</span> y <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">range</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">8</span><span style="color: black;">&#41;</span><span style="color: black;">&#93;</span>
		<span style="color: #ff7700;font-weight:bold;">else</span>:
			parent1 = parents<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span>
			parent2 = parents<span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span>
			<span style="color: #008000;">self</span>.<span style="color: black;">state</span> = <span style="color: #008000;">self</span>.<span style="color: black;">crossover</span><span style="color: black;">&#40;</span>parent1, parent2<span style="color: black;">&#41;</span>
			<span style="color: #008000;">self</span>.<span style="color: black;">mutate</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
	<span style="color: #ff7700;font-weight:bold;">def</span> fitness<span style="color: black;">&#40;</span><span style="color: #008000;">self</span><span style="color: black;">&#41;</span>:
		<span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #ff7700;font-weight:bold;">not</span> <span style="color: #008000;">self</span>._fitness:
			state = <span style="color: #008000;">self</span>.<span style="color: black;">state</span>
			horizontal_collisions = <span style="color: #008000;">sum</span><span style="color: black;">&#40;</span><span style="color: black;">&#91;</span>state.<span style="color: black;">count</span><span style="color: black;">&#40;</span>col<span style="color: black;">&#41;</span>-<span style="color: #ff4500;">1</span> <span style="color: #ff7700;font-weight:bold;">for</span> col <span style="color: #ff7700;font-weight:bold;">in</span> state<span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>/<span style="color: #ff4500;">2</span>
&nbsp;
			diagonal_collisions = <span style="color: #ff4500;">0</span>
			<span style="color: #ff7700;font-weight:bold;">for</span> i, col <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">enumerate</span><span style="color: black;">&#40;</span>state<span style="color: black;">&#41;</span>:
				<span style="color: #ff7700;font-weight:bold;">for</span> j, diagonal <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">enumerate</span><span style="color: black;">&#40;</span>state<span style="color: black;">&#41;</span>:
					mod = <span style="color: #008000;">abs</span><span style="color: black;">&#40;</span>i-j<span style="color: black;">&#41;</span>
					<span style="color: #ff7700;font-weight:bold;">if</span> mod <span style="color: #66cc66;">&gt;</span> <span style="color: #ff4500;">0</span>: <span style="color: #808080; font-style: italic;">#we don't want to count the current queen in a collision with herself</span>
						<span style="color: #ff7700;font-weight:bold;">if</span> diagonal + mod == col <span style="color: #ff7700;font-weight:bold;">or</span> diagonal - mod == col:
							diagonal_collisions += <span style="color: #ff4500;">1</span>
			diagonal_collisions /= <span style="color: #ff4500;">2</span> <span style="color: #808080; font-style: italic;">#we were counting the diagonal collisions double</span>
			<span style="color: #008000;">self</span>._fitness = <span style="color: #008000;">int</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">28</span> - <span style="color: black;">&#40;</span>horizontal_collisions + diagonal_collisions<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
		<span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #008000;">self</span>._fitness
&nbsp;
	<span style="color: #ff7700;font-weight:bold;">def</span> probability<span style="color: black;">&#40;</span><span style="color: #008000;">self</span>, population<span style="color: black;">&#41;</span>:
		<span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #ff7700;font-weight:bold;">not</span> <span style="color: #008000;">self</span>._probability:
			<span style="color: #008000;">self</span>._probability = <span style="color: #008000;">self</span>.<span style="color: black;">fitness</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span> / <span style="color: #008000;">sum</span><span style="color: black;">&#40;</span><span style="color: black;">&#91;</span>x.<span style="color: black;">fitness</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span> <span style="color: #ff7700;font-weight:bold;">for</span> x <span style="color: #ff7700;font-weight:bold;">in</span> population<span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>
		<span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #008000;">self</span>._probability
&nbsp;
	<span style="color: #ff7700;font-weight:bold;">def</span> crossover<span style="color: black;">&#40;</span><span style="color: #008000;">self</span>, parent1, parent2<span style="color: black;">&#41;</span>:
		r = Random<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
		crossover_index = r.<span style="color: black;">randint</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">0</span>,<span style="color: #ff4500;">8</span><span style="color: black;">&#41;</span>
		left = parent1.<span style="color: black;">state</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span>:crossover_index<span style="color: black;">&#93;</span>
		right = parent2.<span style="color: black;">state</span><span style="color: black;">&#91;</span>crossover_index:<span style="color: #ff4500;">8</span><span style="color: black;">&#93;</span>
		left.<span style="color: black;">extend</span><span style="color: black;">&#40;</span>right<span style="color: black;">&#41;</span>
		<span style="color: #ff7700;font-weight:bold;">return</span> left
&nbsp;
	<span style="color: #ff7700;font-weight:bold;">def</span> mutate<span style="color: black;">&#40;</span><span style="color: #008000;">self</span><span style="color: black;">&#41;</span>:
		r = Random<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
		<span style="color: #ff7700;font-weight:bold;">for</span> i <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">range</span><span style="color: black;">&#40;</span><span style="color: #008000;">len</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span>.<span style="color: black;">state</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>:
			<span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #dc143c;">random</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span> <span style="color: #66cc66;">&lt;</span> State.<span style="color: black;">MUTATION_RATE</span>:
				<span style="color: #008000;">self</span>.<span style="color: black;">state</span><span style="color: black;">&#91;</span>i<span style="color: black;">&#93;</span> = r.<span style="color: black;">randint</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">1</span>,<span style="color: #ff4500;">8</span><span style="color: black;">&#41;</span>
&nbsp;
	<span style="color: #ff7700;font-weight:bold;">def</span> <span style="color: #0000cd;">__str__</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span><span style="color: black;">&#41;</span>:
		r = <span style="color: #483d8b;">''</span>
		r += <span style="color: #483d8b;">'   '</span>
		<span style="color: #ff7700;font-weight:bold;">for</span> i <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">range</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">8</span><span style="color: black;">&#41;</span>:
			r += <span style="color: #483d8b;">'%d '</span> <span style="color: #66cc66;">%</span> <span style="color: black;">&#40;</span>i+<span style="color: #ff4500;">1</span><span style="color: black;">&#41;</span>
		r += <span style="color: #483d8b;">'<span style="color: #000099; font-weight: bold;">\n</span>  '</span> + <span style="color: #483d8b;">'--'</span><span style="color: #66cc66;">*</span><span style="color: #ff4500;">8</span> + <span style="color: #483d8b;">'<span style="color: #000099; font-weight: bold;">\n</span>'</span>
&nbsp;
		<span style="color: #ff7700;font-weight:bold;">for</span> i <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">range</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">8</span>,<span style="color: #ff4500;">0</span>,-<span style="color: #ff4500;">1</span><span style="color: black;">&#41;</span>:
			r += <span style="color: #483d8b;">'%d|'</span> <span style="color: #66cc66;">%</span> i
			<span style="color: #ff7700;font-weight:bold;">for</span> j, queen <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">enumerate</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span>.<span style="color: black;">state</span><span style="color: black;">&#41;</span>:
				<span style="color: #ff7700;font-weight:bold;">if</span> queen == i:
					r += <span style="color: #483d8b;">' O'</span>
				<span style="color: #ff7700;font-weight:bold;">else</span>:
					r += <span style="color: #483d8b;">'  '</span>
			r += <span style="color: #483d8b;">'|<span style="color: #000099; font-weight: bold;">\n</span>'</span>
		r += <span style="color: #483d8b;">'  '</span> + <span style="color: #483d8b;">'--'</span><span style="color: #66cc66;">*</span><span style="color: #ff4500;">8</span> + <span style="color: #483d8b;">'<span style="color: #000099; font-weight: bold;">\n</span>'</span>
		<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #008000;">self</span>.<span style="color: black;">fitness</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
		<span style="color: #ff7700;font-weight:bold;">return</span> r
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> pickRandomByProbability<span style="color: black;">&#40;</span>populationByProbability<span style="color: black;">&#41;</span>:
	i = <span style="color: #ff4500;">0</span>
	selectedState = <span style="color: #008000;">None</span>
	<span style="color: #ff7700;font-weight:bold;">while</span> selectedState == <span style="color: #008000;">None</span>:
		current = populationByProbability<span style="color: black;">&#91;</span>i<span style="color: black;">&#93;</span>
		<span style="color: #ff7700;font-weight:bold;">if</span> current<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span> <span style="color: #66cc66;">&lt;</span>= <span style="color: #dc143c;">random</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
 			<span style="color: #ff7700;font-weight:bold;">return</span> current<span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span>
 		<span style="color: #ff7700;font-weight:bold;">if</span> i+<span style="color: #ff4500;">1</span> <span style="color: #66cc66;">&gt;</span>= <span style="color: #008000;">len</span><span style="color: black;">&#40;</span>populationByProbability<span style="color: black;">&#41;</span>:
			i = <span style="color: #ff4500;">0</span>
		<span style="color: #ff7700;font-weight:bold;">else</span>:
			i += <span style="color: #ff4500;">1</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> generateNextPopulation<span style="color: black;">&#40;</span>population, n<span style="color: black;">&#41;</span>:
	newPopulation = <span style="color: black;">&#91;</span><span style="color: black;">&#93;</span>
	<span style="color: #ff7700;font-weight:bold;">while</span> <span style="color: #008000;">len</span><span style="color: black;">&#40;</span>newPopulation<span style="color: black;">&#41;</span> <span style="color: #66cc66;">&lt;</span> n:
 		populationByProbability = <span style="color: black;">&#91;</span><span style="color: black;">&#40;</span>x.<span style="color: black;">probability</span><span style="color: black;">&#40;</span>population<span style="color: black;">&#41;</span>, x<span style="color: black;">&#41;</span> <span style="color: #ff7700;font-weight:bold;">for</span> x <span style="color: #ff7700;font-weight:bold;">in</span> population<span style="color: black;">&#93;</span>
 		parent1 = pickRandomByProbability<span style="color: black;">&#40;</span>populationByProbability<span style="color: black;">&#41;</span>
 		populationByProbability = <span style="color: black;">&#91;</span>x <span style="color: #ff7700;font-weight:bold;">for</span> x <span style="color: #ff7700;font-weight:bold;">in</span> populationByProbability <span style="color: #ff7700;font-weight:bold;">if</span> x<span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span> <span style="color: #66cc66;">!</span>= parent1<span style="color: black;">&#93;</span>
 		parent2 = pickRandomByProbability<span style="color: black;">&#40;</span>populationByProbability<span style="color: black;">&#41;</span>
 		newPopulation.<span style="color: black;">append</span><span style="color: black;">&#40;</span>State<span style="color: black;">&#40;</span><span style="color: black;">&#40;</span>parent1, parent2<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
 	<span style="color: #ff7700;font-weight:bold;">return</span> newPopulation
&nbsp;
<span style="color: #ff7700;font-weight:bold;">if</span> __name__ == <span style="color: #483d8b;">'__main__'</span>:
 	populationSize = <span style="color: #ff4500;">100</span>
 	generation = <span style="color: #ff4500;">1</span>
 	population = <span style="color: black;">&#91;</span>State<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span> <span style="color: #ff7700;font-weight:bold;">for</span> x <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">range</span><span style="color: black;">&#40;</span>populationSize<span style="color: black;">&#41;</span><span style="color: black;">&#93;</span>
 	<span style="color: #ff7700;font-weight:bold;">while</span> <span style="color: #ff7700;font-weight:bold;">not</span> <span style="color: #ff4500;">28</span> <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: black;">&#91;</span>x.<span style="color: black;">fitness</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span> <span style="color: #ff7700;font-weight:bold;">for</span> x <span style="color: #ff7700;font-weight:bold;">in</span> population<span style="color: black;">&#93;</span>:
 		<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;generation %d<span style="color: #000099; font-weight: bold;">\t</span>Max fitness: %d&quot;</span> <span style="color: #66cc66;">%</span> <span style="color: black;">&#40;</span>generation, <span style="color: #008000;">max</span><span style="color: black;">&#40;</span><span style="color: black;">&#91;</span>x.<span style="color: black;">fitness</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span> <span style="color: #ff7700;font-weight:bold;">for</span> x <span style="color: #ff7700;font-weight:bold;">in</span> population<span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
 		population = generateNextPopulation<span style="color: black;">&#40;</span>population, populationSize<span style="color: black;">&#41;</span>
 		generation += <span style="color: #ff4500;">1</span>
 	<span style="color: #ff7700;font-weight:bold;">for</span> x <span style="color: #ff7700;font-weight:bold;">in</span> population:
 		<span style="color: #ff7700;font-weight:bold;">if</span> x.<span style="color: black;">fitness</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span> <span style="color: #66cc66;">&gt;</span>= <span style="color: #ff4500;">28</span>:
			<span style="color: #ff7700;font-weight:bold;">print</span> x</pre></td></tr></table></div>

<h3>State</h3>
<p>The State class keeps track of a state. In this case that is a list of 8 integers ranging from 1 to 8.<br />
Each integer represents the position of a queen in a column (which row).<br />
Since queens can attack vertically each queen has to be in a different column by default.</p>
<h3>Fitness</h3>
<p>A collision is two queens who are able to attack each other. This means they are in the same diagonal, the same row or the same column.<br />
The maximum amount of collisions that can occur is 28. The fitness function is a higher-is-better function, so we calculate it by substracting the amount of collisions that occur in the current state from 28.<br />
A solution would have 0 collisions and thus a fitness of 28.</p>
<h3>Probability of mating</h3>
<p>When we generate the next population of states we will need to have something on which we can base which 2 states can &#8216;mate&#8217;.<br />
We want only the best states (the one closest to a solution) to mate, so the best heuristic to define the chance of a state being allowed to mate is it&#8217;s fitness.</p>
<h3>Crossover (mating), mutation</h3>
<p>When we crossover 2 states we choose a point in the states where we will &#8216;chop&#8217; them in 2 parts.<br />
We will for example take the left 3 columns of the 1st parent and the 5 last of the second parent.<br />
The child state is then the combination of these columns.<br />
We don&#8217;t want to stay stuck in the same state pool because what if the initially randomly generated population has no queen in row 3?<br />
We would never be able to get a solution because a solution requires a queen in each row.<br />
No matter how many times we crossover 2 states, we will never get a state in row 3.<br />
Therefore we need to include a random mutation when crossing over 2 parents.<br />
Each column in the child state has a specific percentage chance of changing it&#8217;s value to a random number from 1 to 8.</p>
<h3>Conclusion</h3>
<p>I&#8217;ve noticed that this doesn&#8217;t find a solution as fast as I initially expected. It can quickly take over a few (ten)thousand generations before a solution is found.<br />
I haven&#8217;t noticed any noticeable speed increase in finding a solution when taking a population of 100, 1000 or 10000. (Didn&#8217;t do any benchmarks, just a few runs per population size)<br />
Maybe a solution would be found more quickly if the percentage chance of mating weren&#8217;t on a linear scale but an exponential one.<br />
I&#8217;m not sure if i&#8217;m expressing this correctly but what I mean is that the chance of mating for bad fitnesses and good ones is currently too close. Good ones should be picked way easier than bad ones. Now the chance differs only by a few percent or even a few tenths of a percent depending on the size of the population.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/5RYmh2KSyitP1-8pdDPrnJTJyhs/0/da"><img src="http://feedads.g.doubleclick.net/~a/5RYmh2KSyitP1-8pdDPrnJTJyhs/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/5RYmh2KSyitP1-8pdDPrnJTJyhs/1/da"><img src="http://feedads.g.doubleclick.net/~a/5RYmh2KSyitP1-8pdDPrnJTJyhs/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/perused/~4/Pxdt5HjayJY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.jeroenpelgrims.be/2011/01/solving-8-queens-problem-on-an-8x8-board-with-a-genetic-algorithm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.jeroenpelgrims.be/2011/01/solving-8-queens-problem-on-an-8x8-board-with-a-genetic-algorithm/</feedburner:origLink></item>
		<item>
		<title>Django on Google App Engine – 2</title>
		<link>http://feedproxy.google.com/~r/perused/~3/1Wu_4itBJL8/</link>
		<comments>http://blog.jeroenpelgrims.be/2011/01/django-on-google-app-engine-2/#comments</comments>
		<pubDate>Sun, 09 Jan 2011 18:58:25 +0000</pubDate>
		<dc:creator>Jeroen</dc:creator>
				<category><![CDATA[Django]]></category>
		<category><![CDATA[Google App Engine]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://blog.jeroenpelgrims.be/?p=451</guid>
		<description><![CDATA[The previous post was about the basics of setting up an application using Django on Google App Engine. This one will continue on that as we follow the Django Tutorial for building a poll application, but with some modifications so it will run on GAE. Setting some settings First of all, set your application id [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://blog.jeroenpelgrims.be/2011/01/django-on-google-app-engine-1/">previous post</a> was about the basics of setting up an application using Django on Google App Engine.<br />
This one will continue on that as we follow the <a href="http://docs.djangoproject.com/en/1.2/intro/tutorial01/">Django Tutorial</a> for building a poll application, but with some modifications so it will run on GAE.</p>
<p><span id="more-451"></span></p>
<h3>Setting some settings</h3>
<p>First of all, set your application id to whatever you called your application in the GAE dashboard.<br />
Open up app.yaml in the root folder and change what&#8217;s behind &#8220;application: &#8220;.<br />
This isn&#8217;t a requirement to be able to develop for GAE, but if you want to deploy your app this will need to be set.</p>
<p>Open up settings.py. If you want to use sessions in your application you&#8217;ll need to uncomment &#8220;django.contrib.sessions.middleware.SessionMiddleware&#8221; in MIDDLEWARE_CLASSES near the end of the file.</p>
<p>If you&#8217;re planning on using GAE&#8217;s memcache you&#8217;ll need to add the following lines to MIDDLEWARE_CLASSES:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #483d8b;">'django.middleware.cache.UpdateCacheMiddleware'</span>,
<span style="color: #483d8b;">'django.middleware.common.CommonMiddleware'</span>,
<span style="color: #483d8b;">'django.middleware.cache.FetchFromCacheMiddleware'</span>,</pre></div></div>

<p>And you&#8217;ll need to set these variables as well:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">CACHE_BACKEND = <span style="color: #483d8b;">'memcached://?timeout=0'</span>
CACHE_MIDDLEWARE_SECONDS = <span style="color: #ff4500;">0</span></pre></div></div>

<p>CACHE_MIDDLEWARE_SECONDS sets the default caching time in seconds for each page. Since I don&#8217;t want every page to be cached by default I&#8217;ve set this value to 0.<br />
Note that the setting of the cache info is different in Django 1.3. (I&#8217;m using 1.2.4 here)</p>
<p>Then at the bottom in INSTALLED_APPS add a line with the name of the app we&#8217;ll be creating.<br />
In the tutorial they&#8217;re using the name &#8220;polls&#8221;, so that&#8217;s what i&#8217;ll call it as well.</p>
<p><a href="http://blog.jeroenpelgrims.be/wp-content/uploads/2011/01/settings.txt">This</a> is how my settings file looks now.<br />
And that&#8217;s all the settings that we need to set. The database (Google&#8217;s BigTable) settings have already been taken care of by the helper.</p>
<h3>Creating the application and creating models</h3>
<p>Open a command prompt and cd to where manage.py is situated. (in the root folder of the project)<br />
Type &#8220;python manage.py startapp polls&#8221;. or replace polls by whatever name you set in INSTALLED_APPS.</p>
<p>The models we&#8217;ll be creating won&#8217;t extend from the standard Django base model but instead will use the base class provided by the helper. This is an edited version of the Django base model class that is compatible with the GAE datastore.</p>
<p>models.py:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">from</span> appengine_django.<span style="color: black;">models</span> <span style="color: #ff7700;font-weight:bold;">import</span> BaseModel
<span style="color: #ff7700;font-weight:bold;">from</span> google.<span style="color: black;">appengine</span>.<span style="color: black;">ext</span> <span style="color: #ff7700;font-weight:bold;">import</span> db
&nbsp;
<span style="color: #ff7700;font-weight:bold;">class</span> Poll<span style="color: black;">&#40;</span>BaseModel<span style="color: black;">&#41;</span>:
    question = db.<span style="color: black;">StringProperty</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
    pubDate = db.<span style="color: black;">DateTimeProperty</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">class</span> Choice<span style="color: black;">&#40;</span>BaseModel<span style="color: black;">&#41;</span>:
    pollId = db.<span style="color: black;">IntegerProperty</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
    choice = db.<span style="color: black;">StringProperty</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
    votes = db.<span style="color: black;">IntegerProperty</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></pre></td></tr></table></div>

<p>Notice that there are no foreign keys, this is because GAE is a non-relational data store. Foreign keys don&#8217;t exist.</p>
<h3>Views and templates</h3>
<p>We&#8217;ll need 3 pages:</p>
<ol>
<li>Create  a poll</li>
<li>List existing polls</li>
<li>View a specific poll and be able to vote on one of it&#8217;s choices</li>
</ol>
<p>My urls.py file is as follows:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">from</span> django.<span style="color: black;">conf</span>.<span style="color: black;">urls</span>.<span style="color: black;">defaults</span> <span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #66cc66;">*</span>
&nbsp;
urlpatterns = patterns<span style="color: black;">&#40;</span><span style="color: #483d8b;">''</span>,
	<span style="color: black;">&#40;</span>r<span style="color: #483d8b;">'^$'</span>, r<span style="color: #483d8b;">'polls.views.list'</span><span style="color: black;">&#41;</span>,
	<span style="color: black;">&#40;</span>r<span style="color: #483d8b;">'^create$'</span>, r<span style="color: #483d8b;">'polls.views.create'</span><span style="color: black;">&#41;</span>,
	<span style="color: black;">&#40;</span>r<span style="color: #483d8b;">'^view/(<span style="color: #000099; font-weight: bold;">\d</span>+)$'</span>, r<span style="color: #483d8b;">'polls.views.view'</span><span style="color: black;">&#41;</span>,
<span style="color: black;">&#41;</span></pre></td></tr></table></div>

<h4>The views:</h4>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
</pre></td><td class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">from</span> django.<span style="color: black;">shortcuts</span> <span style="color: #ff7700;font-weight:bold;">import</span> render_to_response
<span style="color: #ff7700;font-weight:bold;">from</span> django.<span style="color: black;">http</span> <span style="color: #ff7700;font-weight:bold;">import</span> HttpResponse, HttpResponseRedirect
<span style="color: #ff7700;font-weight:bold;">from</span> polls.<span style="color: black;">models</span> <span style="color: #ff7700;font-weight:bold;">import</span> Poll, Choice
<span style="color: #ff7700;font-weight:bold;">from</span> <span style="color: #dc143c;">datetime</span> <span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">datetime</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> create<span style="color: black;">&#40;</span>request<span style="color: black;">&#41;</span>:
	<span style="color: #ff7700;font-weight:bold;">if</span> request.<span style="color: black;">POST</span>:
		question = request.<span style="color: black;">POST</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;question&quot;</span><span style="color: black;">&#93;</span>
		c1 = request.<span style="color: black;">POST</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;choice1&quot;</span><span style="color: black;">&#93;</span>
		c2 = request.<span style="color: black;">POST</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;choice2&quot;</span><span style="color: black;">&#93;</span>
		c3 = request.<span style="color: black;">POST</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;choice3&quot;</span><span style="color: black;">&#93;</span>
&nbsp;
		poll = Poll<span style="color: black;">&#40;</span>question=question, pubDate=<span style="color: #dc143c;">datetime</span>.<span style="color: black;">now</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
		poll.<span style="color: black;">save</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
		choice1 = Choice<span style="color: black;">&#40;</span>pollId=poll.<span style="color: black;">key</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>.<span style="color: #008000;">id</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>, choice=c1, votes=<span style="color: #ff4500;">0</span><span style="color: black;">&#41;</span>
		choice2 = Choice<span style="color: black;">&#40;</span>pollId=poll.<span style="color: black;">key</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>.<span style="color: #008000;">id</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>, choice=c2, votes=<span style="color: #ff4500;">0</span><span style="color: black;">&#41;</span>
		choice3 = Choice<span style="color: black;">&#40;</span>pollId=poll.<span style="color: black;">key</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>.<span style="color: #008000;">id</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>, choice=c3, votes=<span style="color: #ff4500;">0</span><span style="color: black;">&#41;</span>
		choice1.<span style="color: black;">save</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
		choice2.<span style="color: black;">save</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
		choice3.<span style="color: black;">save</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
		<span style="color: #ff7700;font-weight:bold;">return</span> HttpResponseRedirect<span style="color: black;">&#40;</span><span style="color: #483d8b;">'/'</span><span style="color: black;">&#41;</span>
	<span style="color: #ff7700;font-weight:bold;">else</span>:
		<span style="color: #ff7700;font-weight:bold;">return</span> render_to_response<span style="color: black;">&#40;</span><span style="color: #483d8b;">'create.html'</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> <span style="color: #008000;">list</span><span style="color: black;">&#40;</span>request<span style="color: black;">&#41;</span>:
	polls = Poll.<span style="color: black;">objects</span>.<span style="color: #008000;">all</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
	<span style="color: #ff7700;font-weight:bold;">return</span> render_to_response<span style="color: black;">&#40;</span><span style="color: #483d8b;">'list.html'</span>, <span style="color: black;">&#123;</span><span style="color: #483d8b;">'polls'</span>:polls<span style="color: black;">&#125;</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> view<span style="color: black;">&#40;</span>request, <span style="color: #008000;">id</span><span style="color: black;">&#41;</span>:
	<span style="color: #ff7700;font-weight:bold;">if</span> request.<span style="color: black;">POST</span>:
		choiceId = <span style="color: #008000;">int</span><span style="color: black;">&#40;</span>request.<span style="color: black;">POST</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;voteChoice&quot;</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>
		choice = Choice.<span style="color: black;">get_by_id</span><span style="color: black;">&#40;</span>choiceId<span style="color: black;">&#41;</span>
		choice.<span style="color: black;">votes</span> += <span style="color: #ff4500;">1</span>
		choice.<span style="color: black;">save</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
	<span style="color: #008000;">id</span> = <span style="color: #008000;">int</span><span style="color: black;">&#40;</span><span style="color: #008000;">id</span><span style="color: black;">&#41;</span>
	poll = Poll.<span style="color: black;">get_by_id</span><span style="color: black;">&#40;</span><span style="color: #008000;">id</span><span style="color: black;">&#41;</span>
	choices = Choice.<span style="color: black;">objects</span>.<span style="color: #008000;">all</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>.<span style="color: #008000;">filter</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'pollId ='</span>, <span style="color: #008000;">id</span><span style="color: black;">&#41;</span>
	<span style="color: #ff7700;font-weight:bold;">return</span> render_to_response<span style="color: black;">&#40;</span><span style="color: #483d8b;">'view.html'</span>, <span style="color: black;">&#123;</span><span style="color: #483d8b;">'poll'</span>:poll, <span style="color: #483d8b;">'choices'</span>:choices<span style="color: black;">&#125;</span><span style="color: black;">&#41;</span></pre></td></tr></table></div>

<h4>The templates:</h4>
<p>list.html</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&lt;ul&gt;
 {% for poll in polls %}
 &lt;li&gt;
 &lt;a href=&quot;/view/{{poll.key.id}}&quot;&gt;{{poll.question}}&lt;/a&gt; - {{poll.pubDate}}
 &lt;/li&gt;
 {% endfor %}
&lt;/ul&gt;
&lt;a href=&quot;/create&quot;&gt;Create new poll&lt;/a&gt;</pre></td></tr></table></div>

<p>view.html</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
</pre></td><td class="code"><pre class="html4" style="font-family:monospace;">&lt;h1&gt;{{poll.question}}&lt;/h1&gt;
&nbsp;
&lt;form action=&quot;/view/{{poll.key.id}}&quot; method=&quot;post&quot;&gt;
 &lt;ul&gt;
 {% for choice in choices %}
 &lt;li&gt;
 &lt;input name=&quot;voteChoice&quot; type=&quot;radio&quot; value=&quot;{{choice.key.id}}&quot;&gt;
 {{choice.choice}} ({{choice.votes}} votes)
 &lt;/li&gt;
 {% endfor %}
 &lt;/ul&gt;
 &lt;input type=&quot;submit&quot; value=&quot;Vote&quot; /&gt;
&lt;/form&gt;</pre></td></tr></table></div>

<p>create.html</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&lt;h1&gt;Create poll&lt;/h1&gt;
&nbsp;
&lt;form action=&quot;/create&quot; method=&quot;post&quot;&gt;
 Question: &lt;input type=&quot;text&quot; name=&quot;question&quot; /&gt;&lt;br&gt;
&nbsp;
 Choice 1: &lt;input type=&quot;text&quot; name=&quot;choice1&quot; /&gt;&lt;br&gt;
 Choice 2: &lt;input type=&quot;text&quot; name=&quot;choice2&quot; /&gt;&lt;br&gt;
 Choice 3: &lt;input type=&quot;text&quot; name=&quot;choice3&quot; /&gt;&lt;br&gt;
&nbsp;
 &lt;input type=&quot;submit&quot; value=&quot;Create&quot; /&gt;
&lt;/form&gt;</pre></td></tr></table></div>

<p>I think everything is quite clear when you look it over.<br />
There are a few differences with regular Django code, for example the <a href="http://stackoverflow.com/questions/2920236/django-get-query-not-working/2921685#2921685">filter line</a>.</p>
<p>A zip file with the files of the project can be found <a href="http://blog.jeroenpelgrims.be/wp-content/uploads/2011/01/appengine_helper_for_django.zip">here</a>.</p>
<p><strong>Update</strong>:  You might also be interested in checking out <a href="http://www.allbuttonspressed.com/projects/djangoappengine">Django-nonrel</a> which is a different way of running Django on GAE. It seems to be more flexible at first glance than the helper but I can&#8217;t say for sure since I haven&#8217;t used it yet.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/d5bPu_tE_oCiWOtRaBs7HSpRrCw/0/da"><img src="http://feedads.g.doubleclick.net/~a/d5bPu_tE_oCiWOtRaBs7HSpRrCw/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/d5bPu_tE_oCiWOtRaBs7HSpRrCw/1/da"><img src="http://feedads.g.doubleclick.net/~a/d5bPu_tE_oCiWOtRaBs7HSpRrCw/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/perused/~4/1Wu_4itBJL8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.jeroenpelgrims.be/2011/01/django-on-google-app-engine-2/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://blog.jeroenpelgrims.be/2011/01/django-on-google-app-engine-2/</feedburner:origLink></item>
	</channel>
</rss><!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced

Served from: blog.jeroenpelgrims.be @ 2012-05-08 05:30:46 -->

