<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-5955848005353818036</id><updated>2011-04-22T11:45:53.875+10:00</updated><category term='sdl'/><category term='mingw'/><category term='opengl'/><category term='gdb'/><category term='msys'/><category term='insight'/><title type='text'>moProgram</title><subtitle type='html'>Woggy's ramblings and programming related postings.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://moprogram.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5955848005353818036/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://moprogram.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Woggy</name><uri>http://www.blogger.com/profile/11799293303112331282</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>4</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5955848005353818036.post-6209097923492728179</id><published>2008-03-13T22:50:00.006+11:00</published><updated>2008-03-14T01:00:26.291+11:00</updated><title type='text'>Generating Permutations</title><content type='html'>Chucknthem posted &lt;a href="http://chucknthem.blogspot.com/2008/03/list-all-permutations.html"&gt;this&lt;/a&gt;, some PHP code to generate permutations from a list of objects. It made me realize that I don't actually know how to do that,  so I had a go at it in Python. Recursion makes things alot easier. Without looking at his code, I was pretty surprised to see they were nearly exactly the same, except mine adds them to a list and his prints them out instead, and I use Pythons lists to make it shorter (and probably a bit harder to read =P)&lt;br /&gt;&lt;pre&gt;def permutate(orig,allLists=[],perm=[]):&lt;br /&gt;if len(orig) == 0:&lt;br /&gt;   allLists.append(perm)&lt;br /&gt;else:&lt;br /&gt;   for x in range(len(orig)):&lt;br /&gt;       permutate(orig[:x]+orig[x+1:],allLists,perm[:]+[orig[x]])&lt;/pre&gt;&lt;br /&gt;It can be used in the following way&lt;br /&gt;&lt;pre&gt;&gt;&gt;&gt; perms = []&lt;br /&gt;&gt;&gt;&gt; permutate([1,2,3],perms)&lt;br /&gt;&gt;&gt;&gt; perms&lt;br /&gt;[[1, 2, 3], [1, 3, 2], [2, 1, 3], [2, 3, 1], [3, 1, 2], [3, 2, 1]]&lt;/pre&gt;&lt;br /&gt;There is probably a way to make it return this list without having to send in an external list, but I'm not aware of an easy method to do that with recursion.&lt;br /&gt;&lt;br /&gt;EDIT: Scratch that, here is one such version from &lt;a href="http://www.daniweb.com/code/snippet459.html"&gt;here&lt;/a&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;def permutate(seq):&lt;br /&gt;  """permutate a sequence and return a list of the permutations"""&lt;br /&gt;  if not seq:&lt;br /&gt;      return [seq]  # is an empty sequence&lt;br /&gt;  else:&lt;br /&gt;      temp = []&lt;br /&gt;      for k in range(len(seq)):&lt;br /&gt;          part = seq[:k] + seq[k+1:]&lt;br /&gt;          for m in permutate(part):&lt;br /&gt;              temp.append(seq[k:k+1] + m)&lt;br /&gt;      return temp&lt;/pre&gt;&lt;br /&gt;Wish I could have thought of that.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5955848005353818036-6209097923492728179?l=moprogram.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moprogram.blogspot.com/feeds/6209097923492728179/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5955848005353818036&amp;postID=6209097923492728179' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5955848005353818036/posts/default/6209097923492728179'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5955848005353818036/posts/default/6209097923492728179'/><link rel='alternate' type='text/html' href='http://moprogram.blogspot.com/2008/03/generating-permutations.html' title='Generating Permutations'/><author><name>Woggy</name><uri>http://www.blogger.com/profile/11799293303112331282</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5955848005353818036.post-25223322590778941</id><published>2008-03-13T21:56:00.004+11:00</published><updated>2008-03-13T22:11:33.782+11:00</updated><title type='text'>Uni</title><content type='html'>Because of uni, I haven't been able to catch up on any OpenGL work and I doubt I'll be able to to any serious programming for while yet! I had a bad feeling this semester was going to be difficult and so far, it shaping up to be just that. Thermodynamics is already confusing me. Not being able to do a Week 1 question is a bit scary.&lt;br /&gt;&lt;br /&gt;My OpenGL plan was a cool little 3D version of noughts and crosses, to use as a starting point to start playing around with min-max algorithms (harder than the 2D version, easier than checkers, much much easier than chess). I guess I could implement the game with what OpenGL knowledge I have now (I can now load a world from file, light it, texture it, and move around it),  so hopefully I'll have enough time soon to get started on it. Maybe even this weekend. Getting the interface in shouldn't really be too difficult, I'm assuming the AI work will take the longest to figure out. I should be doing my thermodynamics tutorial work at the moment ...&lt;br /&gt;&lt;br /&gt;I'm doing a pretty cool subject this semester, COMP2121, which is all about microprocessors. We're working with the AVR chip. I messed around with AVR studio today, just some simple commands to move memory and register contents around. It has a built in emulator, which got me thinking - how hard would it be to write one for a simple chip? A worth-wile project would be to write an emulator for Linux, which would be very popular with the UNSW CSE students (for obvious reasons). It got me thinking on how deep of an understanding you'd need of the chip. Being completely unfamiliar with it or with microprocessors and machine language in general, I'll revisit this problem later on. But I'd iamgine it would be much more than mapping instructions to move numbers from arrays representing memory and different registers, though mapping all its instruction to something equivalent would be a good start I suppose.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5955848005353818036-25223322590778941?l=moprogram.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moprogram.blogspot.com/feeds/25223322590778941/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5955848005353818036&amp;postID=25223322590778941' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5955848005353818036/posts/default/25223322590778941'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5955848005353818036/posts/default/25223322590778941'/><link rel='alternate' type='text/html' href='http://moprogram.blogspot.com/2008/03/uni.html' title='Uni'/><author><name>Woggy</name><uri>http://www.blogger.com/profile/11799293303112331282</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5955848005353818036.post-6914386154603042054</id><published>2008-03-07T02:57:00.002+11:00</published><updated>2008-03-07T03:03:05.284+11:00</updated><title type='text'>Music</title><content type='html'>I'm big into music. My tastes range from atmospheric black metal, heavy metal and grindcore, to darkwave, 80s pop, vocal trance and ambient. I frequently run into some amazing songs, but few have 'got me' as much as &lt;a href="http://www.youtube.com/watch?v=s4_4abCWw-w"&gt;this&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;It's a cover of a song by The Knife, a great Swedish pop group.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5955848005353818036-6914386154603042054?l=moprogram.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moprogram.blogspot.com/feeds/6914386154603042054/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5955848005353818036&amp;postID=6914386154603042054' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5955848005353818036/posts/default/6914386154603042054'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5955848005353818036/posts/default/6914386154603042054'/><link rel='alternate' type='text/html' href='http://moprogram.blogspot.com/2008/03/music.html' title='Music'/><author><name>Woggy</name><uri>http://www.blogger.com/profile/11799293303112331282</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5955848005353818036.post-8255836105301901858</id><published>2008-03-02T15:07:00.006+11:00</published><updated>2008-03-02T16:32:35.774+11:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='msys'/><category scheme='http://www.blogger.com/atom/ns#' term='sdl'/><category scheme='http://www.blogger.com/atom/ns#' term='mingw'/><category scheme='http://www.blogger.com/atom/ns#' term='insight'/><category scheme='http://www.blogger.com/atom/ns#' term='gdb'/><category scheme='http://www.blogger.com/atom/ns#' term='opengl'/><title type='text'>Setting up MinGW+MSYS for SDL/OpenGL Development</title><content type='html'>We'll also be setting up Insight for debugging, which is a graphical interface for gdb.&lt;br /&gt;&lt;br /&gt;First thing is you want to download the MinGW automated installer from &lt;a href="http://sourceforge.net/project/showfiles.php?group_id=2435"&gt;here&lt;/a&gt;. Note that this installer won't install gdb or Insight, so grab &lt;a href="http://downloads.sourceforge.net/mingw/insight-6.6-mingw.tar.bz2?modtime=1185625104&amp;amp;big_mirror=1" onclick="window.location='/project/downloading.php?group_id=2435&amp;use_mirror=superb-east&amp;filename=insight-6.6-mingw.tar.bz2&amp;'+Math.floor(Math.random()*100000000); return false;"&gt;insight-6.6-mingw.tar.bz2&lt;/a&gt;. You'll need &lt;a href="http://downloads.sourceforge.net/sevenzip/7z457.exe"&gt;7-zip&lt;/a&gt; to extract that archive, so go ahead and download that too. Run the automated installer, preferably to C:/mingw. As a minimum choose to install the MinGW base tools, g++ and MinGW make. You might have to wait for it to download and install everything. You'll see from the log what files it downloads, which you can keep in mind if you ever decide to do a manual install.&lt;br /&gt;&lt;br /&gt;Next download the MSYS base installer, prefereably the current release (ATTOW this is 1.0.10), and install MSYS. Should be a fairly straight forward affair. For the post install, accept and tell it where you installed mingw (eg. c:/mingw), and it should take care of the rest.&lt;br /&gt;&lt;br /&gt;Open up MSYS (there should be a shortcut on your  desktop) and type cd /mingw; ls. You should be in /mingw and its contents should be on the screen. Good work, now type exit.&lt;br /&gt;&lt;br /&gt;Go into the insight archive you downloaded earlier, and extract whats in insight-mingw/ (ie. the bin,include,lib etc... folders) into C:/mingw. Start MSYS again, and type insight. A window titled 'Source Window' should pop-up. Exit.&lt;br /&gt;&lt;br /&gt;The OpenGL headers and such have already been downloaded and installed for you by the MinGW installer, so now all you need is to setup SDL and SDL_Image. Go to the SDL website and download the latest mingw32 &lt;span&gt;development library&lt;/span&gt;. You might also want the SDL_Image development library, from &lt;a href="http://www.libsdl.org/projects/SDL_image/"&gt;here.&lt;/a&gt; The VC8 version should still work with mingw, so just grab that one. Note that SDL_Image is necessary if you want to load image formats such as PNG and JPEG.&lt;br /&gt;&lt;br /&gt;Now open up the SDL archive you downloaded and extract the bin,include,lib,man and share folders in to C:/mingw. Do the same thing with the lib folder in the SDL_Image archive, but put the include/SDL_Image.h file into C:/mingw/include/SDL/. That should be it.&lt;br /&gt;&lt;br /&gt;Compile your SDL/SDL_Image/OpenGL programs with&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;g++ -g -o programName source.c `sdl-config --cflags --libs` -lSDL_image -lglu32 -lopengl32&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Note that &lt;span style="font-family:courier new;"&gt;-lmingw32 -lSDLmain -lSDL  -mwindows&lt;/span&gt; can replace &lt;span style="font-family:courier new;"&gt;`sdl-config --cflags --libs`. sdl-config&lt;/span&gt; is a script which should have come with your SDL development library, and can be found in C:/mingw/bin.&lt;br /&gt;&lt;br /&gt;You might also need to copy SDL.dll from C:/mingw/bin/ to the same location as your executable for the application to start. If you are also using SDL_Image, the relevant DLL files  can be found in C:/mingw/lib.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5955848005353818036-8255836105301901858?l=moprogram.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moprogram.blogspot.com/feeds/8255836105301901858/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5955848005353818036&amp;postID=8255836105301901858' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5955848005353818036/posts/default/8255836105301901858'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5955848005353818036/posts/default/8255836105301901858'/><link rel='alternate' type='text/html' href='http://moprogram.blogspot.com/2008/03/setting-up-mingwmsys-for-sdlopengl.html' title='Setting up MinGW+MSYS for SDL/OpenGL Development'/><author><name>Woggy</name><uri>http://www.blogger.com/profile/11799293303112331282</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
