tag:blogger.com,1999:blog-56209729901492378732024-02-20T16:46:28.655+00:00Brooks' Random MusingsAnonymoushttp://www.blogger.com/profile/16899320910026266930noreply@blogger.comBlogger26125tag:blogger.com,1999:blog-5620972990149237873.post-54133029667171761332010-04-19T13:39:00.000+01:002010-04-19T13:39:22.585+01:00On Science and Religion<h2>On Science and Religion</h2><p>Bringing god[1] into a conversation totally misses the point of Science. </p><p>Science is a system of acquiring knowledge based on scientific method, and to the organized body of knowledge gained through such research. In other words it is the act of testing theories and gaining information from those tests. A theory proposes an explanation for an event, that's all it is. This theory may or many not be useful; a useful theory is logically consistent[2] and can be used as a tool for prediction.</p><p>If I throw a ball and I notice how it move through the air I may propose the following theories:</p><ul><li>God moved the ball, it was his will.</li>
<li>All objects always travel in a parabola</li>
<li>Thrown balls move in a parabola</li>
<li>All objects move according to Newtons law of gravity</li>
</ul><p>It doesn't matter which one is <em>correct</em>, they all explain the action; hence they are all valid theories (at this point). Now if we were to do further testing we might see that bullets travel pretty much straight, helium balloons and magnets don't really follow any of the above rules. From here we can refine the theory. None of the ideas are completely thrown out; we know that for that ball, in one experiment, all those theories could be true. As we perform millions of experiments on thousands of things our confidence in the theory goes up. </p><p>The second theory proposed above can be dismissed as it is not consistent with a lot of experiments. In the same way we should dismiss saying that it was god's will; yes it is logically consistent but it provide no ability for prediction. Stating that something is gods will is useless as a theory and it is for that reason that it should be dismissed. </p><p>What we are left with is an understanding of the world that we know might be wrong, but there is overwhelming reason to believe it. Yes, Newtons law of gravity doesn't work in certain conditions, that means we have to study those conditions and find a theory that does fit. But, in the mean time it makes sense to say that Newtons law of gravity is true.</p><p>The same applies to Maths, it doesn't matter if Complex Numbers <em>exist</em>, they are useful. They are the easiest consistent way to work certain things out. </p><p>Following the same line of reasoning, Evolution is the easiest consistent way to explain the fossil records with the added bonus of all the extra understanding that accepting Evolution brings. </p><p>You can also apply the same line of thinking to "that just how the world is". That doesn't help us understand anything and should be discarded. </p><p>So should the theory of God's will be taught in schools? No, it serves such little value as a theory that it is irrelevant. Unless we can use this knowledge as a prediction tool or practically then it has no purpose. </p><p>[1] By god I mean any creator(s) or supernatural being(s).<br />
[2] By logically consistent I mean that it doesn't contradict any other generally accepted theories. </p><hr /><p>From here the logical question to ask is 'what is the evidence for the age of the earth, and what alternative theories have been proposed?'. You might come across carbon dating, plate tectonics, and the big bang theory. When you have each bit of evidence you can evaluate it. Remember to keep in mind that if a theory is accepted by the science community that many people have devoted their lives to working out the best theories to explain that phenomena. </p><p>From here the logical question to ask is 'what is the evidence of evolution?'. Well a quick google search gave me the following website: <a href="http://evolution.berkeley.edu/evolibrary/article/0_0_0/lines_01">evolution.berkeley</a> and <a href="http://en.wikipedia.org/wiki/Evidence_of_evolution">wikipedia</a>, I suggest you check them out.</p><hr />Anonymoushttp://www.blogger.com/profile/16899320910026266930noreply@blogger.comtag:blogger.com,1999:blog-5620972990149237873.post-82889115774844655182010-02-09T10:12:00.000+00:002010-02-09T10:12:20.186+00:00More Schooling<h1>Problems</h1><h2>General knowledge of the world is important</h2>Firstly a quiz: How many kings can you name. What about wars. Tell me about the Tudors, the industrial revolution, the capital cities of Italy, Germany, Poland. What is the basic plot in a book you had to read at school. If you felt knowledgeable about all of them then I'm impressed (was that knowledge you gained at school or after); I would imagine most children wont be able to tell you much.<br />
<br />
Next, when did you last find it useful to know this sort of stuff. If you knew no Geography, History, English literature, Biology, or Art History would you be able to cope. I certainly could, I do cope. <br />
<br />
The other side to the coin is that these subjects will be taught but not in the same way. The teacher might set a task for every child to pick a part of history and say how daily life was different from now. Each child has the choice to pick an era they are interested in so that they are more engaged in the subject. They will come out with a memory of a few specific topics that they studied in detail. <br />
<br />
If you combine that with the idea that after every project each child had to present it to the others then they all get taught a wide variety of topics.<br />
<h2>It wouldn't work; the teachers aren't good enough</h2>True, I don't think that you could re-train all the teachers to this method. It could still work with an independent school where the teachers know what they are getting into and want the changes.<br />
<h2>It will produce an unbalanced curriculum</h2>Most normal subjects will be covered by projects; all depending on the interests of that particular student. The idea is to encourage children to want to learn and by letting them have more decisions you let them choose what they find interesting.<br />
<h2>Where is art, music, drama; anything that brings creativity</h2>Two points:<br />
1. Creativity will be taught.<br />
2. art, music and drama are bad at teaching creativity to the uninterested student.<br />
<br />
Creativity is a very important skill and like any other skill it can be practiced. Edward DeBono has done a lot of work on how to teach creativity and this is how it should be done.<br />
<h2>How would the child get to University without A-levels (or equivalent)</h2>This is a problem. I guess that they would have to take time to do whatever the prerequisites are.<br />
<h2>What about problem students</h2>Hopefully there would be less. A more engaged student and a more interested student is less of a problem. There will always be persistent troublemakers but if they are given the choice of say sitting in a room with nothing to do and doing a project they enjoy many will be cooperative. <br />
<br />
<h2>It will cost too much to implement</h2>Possibly, I haven't done the sums. The cost it mainly for the changeover not because it is inherently more expensive.<br />
<h2>There is no evidence for it</h2>True, but if you agree that most of what is taught in school is pointless or quickly forgotten then it's not going to be a step backwards. It's worth trying in one school.<br />
<h1>Extensions</h1><h2>Group teaching</h2>Have the children sat in mixed ability groups. Try to get it so that each group is as good as the others. Then encourage the students to teach each other.<br />
<h2>Be the best, be the worst</h2>If any child stands out in a subject then let them have an extra class in it. That extra class should be made up of only the best (or worst). That way every child has a chance to mentor and be mentored by their peers.<br />
<h2>Career finding</h2>When 16 to 18 (A-level age) the focus should be moved onto longer projects with the aim of finding a type of career that each child likes. This could involve placements at a builders, artist, local business. Or presentations by University lecturers, social workers, business men, etc.Anonymoushttp://www.blogger.com/profile/16899320910026266930noreply@blogger.comtag:blogger.com,1999:blog-5620972990149237873.post-11378240073566176262010-02-03T16:00:00.000+00:002010-02-03T16:00:10.067+00:00SchoolingI think most of what is taught to children is pointless.<br />
<br />
That said, I think that the fact that they are taught is very important; it teaches them how to learn. Here are the things that I consider vital:<br />
<ol><li>Learning (Teaching, Memory)</li>
<li>Communication (English Language, Presentations)</li>
<li>Research (Scientific Method)</li>
</ol><div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">That is it, if they come out knowing nothing else these things should be excellent in all pupils. The main aim of education up to 18 years old should be to teach people to learn and think for themselves. They should be able to:</div><ul><li>Critically analyse a newspaper article then teach peers (Check sources. Fact check. Hi-light misleading passages. Decide if the author is biased).</li>
<li>Perform a literature review on a topic then teach peers.</li>
<li>Conduct a scientific valid study and then teach peers.</li>
<li>(Teach peers using a mix of verbal presentations, written literature and one-to-one tuition)</li>
</ul><div>The next things are much easier learn at a young age:</div></div><ol><li>Sport, Nutrition & Health</li>
<li>Maths</li>
<li>Foreign Languages</li>
<li>Using a Computer</li>
</ol>These should be taught. In fact I think that most of these things can be brought in to every bit of schooling if done correctly. If that is done then we should have a lot of time to focus on fitness and maths.<br />
<br />
Here is a few that I have considered as non-vital: art, textiles, history, science, geography, drama, religious education, music, design tech (workshop), business studies, finance.<br />
<br />
<div><br />
</div>Anonymoushttp://www.blogger.com/profile/16899320910026266930noreply@blogger.comtag:blogger.com,1999:blog-5620972990149237873.post-91575533644904824602010-02-02T14:04:00.000+00:002010-02-02T14:04:41.530+00:00emacs rocksI had a boring text editing task. I'm using a text file that refers to components by a number and after writing it I realised that I need those component numbers to be incrementing. <br />
<br />
I had:<br />
<br />
<pre>Bus.con = [
101 138 1 0 2 1;
102 138 1 0 2 1;
...
124 138 1 0 2 1;
201 138 1 0 2 1;
202 138 1 0 2 1;
...
];
Shunt.con = [
106 100 138 60 0 -1 1;
206 100 138 60 0 -1 1;
306 100 138 60 0 -1 1;
];</pre><br />
I wanted:<br />
<br />
<pre>Bus.con = [
1 138 1 0 2 1;
2 138 1 0 2 1;
...
24 138 1 0 2 1;
25 138 1 0 2 1;
26 138 1 0 2 1;
...
];
Shunt.con = [
6 100 138 60 0 -1 1;
30 100 138 60 0 -1 1;
54 100 138 60 0 -1 1;
];</pre><br />
One problem is that the component number might be the same as a parameter (which I don't want to change). Two tools here:<br />
<br />
<ol><li><a href="http://www.emacswiki.org/emacs/ReBuilder">re-builder</a> - interactively build a regular expression. </li>
<li><a href="http://www.emacswiki.org/emacs/ReplaceRegexp">(query)-replace-regex</a>p - replace a regexp with another </li>
<li><a href="http://steve-yegge.blogspot.com/2006/06/shiny-and-new-emacs-22.html">elisp in regexps</a> - do anything with a regexp</li>
</ol><div>This led to the following three replacements:</div>replace " 1\([0-2][0-9]\) " with " \1 "<div>replace " 2\([0-2][0-9]\) " with " \,(+ 24 string-to-int \1)) "</div>replace " 3\([0-2][0-9]\) " with " \,(+ 48 string-to-int \1)) "<br />
<div>by doing it as a query I made sure I was only replacing the correct stuff. </div><div><br />
</div><div>I even had time to write this blog post. </div><div><br />
</div>Anonymoushttp://www.blogger.com/profile/16899320910026266930noreply@blogger.comtag:blogger.com,1999:blog-5620972990149237873.post-74351064388384388482009-12-30T19:34:00.000+00:002009-12-30T19:34:21.571+00:00Conciousness<div>In terms of evolution the fittest is the one that replicates copies that are also fit. This can be counter-intuitive; being stronger is better as you can win more fights, but you will have a higher energy use so it is a disadvantage when food is scarce. check out stick insects or slice cell anaemia for some intersting facts about evolution.<br />
<br />
As organisms evolved so did the creatures that preyed on them. This causes a genetic arms race, a battle against resources and power. This is predator/prey evolution and it seems to have the effect of focusing and pushing a specialisation to it's limit.<br />
<br />
</div><div><div>Here is the crux of conciousness. When nerves appeared on the scene they were a paradigm shift. They can quickly react to something, they can change what they react to, they learn. At the start one can imagine the immense reactive nature of an organism with these nerves. They associate a certain type of thing with sometihng else and you have the ability to avoid predators.<br />
<br />
It's useful to be psychic. Nerves can store information and match patterns very well. If they were joined together just right we could see prediction, e.g. ___ happened last time so it probably will again.<br />
<br />
We develop a mental model of the physical world as we see it. Physics became a known concept. If a rock is thrown we know where it will land, this doesn't require thinking as such, just a plain input/output, reacting on it is the same old reactive part of the brain, wired up to these new parts.<br />
<br />
As altruism develops we need a new model for dealing with these objects that don't obey our model of basic physics, animals. The way to do that is to have a model of what another animal is likely to do. It's then plugged in to the same old brain as before. We have a model of physics and of animals brains.<br />
<br />
The thing is we are one of those animals. All we have is a few input processing modules, some reactive modules, and a couple of prediction modules. With that we can think about animals. It's still all input-memory-output based, there is no thinking or reasoning. We have no idea why we are doing anything, it's just the way we are wired.<br />
<br />
The strange things is if we decide to reason about ourselves we can start to guess why we did something. The actual reason was the inputs and memory were such that it had to be. But it might be better to say that because red things cause pain we become aggressive when we see red.<br />
<br />
This mental model of ourself allows real thought, a thought process. Because we can think "there is another person who is doing XXX therefore he will do ..." we can do "what if I did XXX, what would happen then".<br />
<ul><li>brains react</li>
<li>brains predict (mental model of physics)</li>
<li>brains predict other brains (mental model of a brain)</li>
<li>brains can think about them-self</li>
<li>we become self-aware</li>
</ul><div>If we accept this model of conciousness then we can draw some interesting points. One, the reason we acted like we did in most situations is that we didn't think (in the higher brain, self-aware sense) we acted. Only on reflection after the even can we guess why we did something. So when someone says for instance, why did you punch him, you can respond with:</div><div><br />
</div><div style="text-align: center;"><i>"it was the only thing I could of done. I didn't think and couldn't </i></div><div style="text-align: center;"><i>given the time frame. Looking back it was probably because he was </i></div><div style="text-align: center;"><i>threatening me. If the situation came up again I would have acted </i></div><div style="text-align: center;"><i>differently <span class="Apple-style-span" style="font-style: normal;"><i>but that <span class="Apple-style-span" style="font-style: normal;"><i>is only because I now have had time to think </i></span></i></span></i></div><div style="text-align: center;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i>about how to deal with it."</i></span></i></span></i></div><div style="text-align: left;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><br />
</span></i></span></i></span></i></div><div style="text-align: left;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;">Not that I think this should change laws to reflect this. </span></i></span></i></span></i></div><div style="text-align: left;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><br />
</span></i></span></i></span></i></div><div style="text-align: left;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;">Secondly, we have a whole new paradigm of research for artificial intelligence. Can we make a creature self aware by applying these rules. It's far from an easy task, but at least with this we know where to look.</span></i></span></i></span></i></div><div style="text-align: left;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><br />
</span></i></span></i></span></i></div><div style="text-align: left;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;">It also tell us a lot about other creatures. How self-aware is a dog? Well, how much do you think it understand of why other dogs are acting like they do. It probably doesn't have the level of reflection to understand. Judging from my dogs anyway. </span></i></span></i></span></i></div><div style="text-align: left;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><br />
</span></i></span></i></span></i></div><div style="text-align: auto;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;">Now, there is a further complication brought about by disorder<span style="font-family: sans-serif; font-size: small;"><span class="Apple-style-span" style="font-size: 13px; line-height: 19px;"> ca</span><span style="font-family: 'Times New Roman';">lled autism. Autistic children can have a poor mental model of other brains, yet they can reason about why they did something. unfortunately I'm not an expert on <i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><span style="font-family: sans-serif; font-size: small;"><span style="font-family: 'Times New Roman';">Autistic Spectrum Disorders but think it would be a great area of study "does the level of <a href="http://en.wikipedia.org/wiki/Mind-blindness">Mind-blindness</a> or <a href="http://en.wikipedia.org/wiki/Alexithymia">Alexithymia</a> correlate with a lack of reasoning about one's self". It could be explained with the fact that human reasoning has become massively important and as we are such social and communicative creatures we have a need for a separate "reasoning about one's self" part of the brain. If we are to accept this then to test the previous theory would require looking back in our genetic history to see how their level of self reasoning correlates with mind-blindness. </span></span></span></i></span></i></span></i></span></span></span></i></span></i></span></i></div></div></div>Anonymoushttp://www.blogger.com/profile/16899320910026266930noreply@blogger.com0tag:blogger.com,1999:blog-5620972990149237873.post-54356168313894433762009-12-30T15:49:00.003+00:002009-12-30T16:20:09.138+00:00PC Cleanup<div><br /></div><div>I was given the task of installing a networked printer to my parents computer. While I was there I decided to give it a bit of a spring clean. First off was a visit to <a href="http://www.update.microsoft.com/">http://www.update.microsoft.com/</a> to make sure everything was in order. The off to two great websites aimed to help just this problem:</div><div><ol><li><a href="http://pcdecrapifier.com/">http://pcdecrapifier.com/</a> - First it delete all the bundles crap that comes with new PC's. Second you select all programs that you want to uninstall. It does it much quicker that doing it by hand. </li><li><a href="http://ninite.com/">http://ninite.com/</a> - you mark the common programs you want and it downloads and install the latest version, decide on sensible defaults and make sure it doesn't add any crud (like toolbars).</li></ol><div>Here is the list of some of the software I like having on my PC: </div><div><ul><li>Chrome - best browser available</li><li>VLC - play music and videos</li><li>CutePDF & Foxit Reader - view, edit and create pdf files</li><li>WinRar - view, edit and create compressed files</li><li>Microsoft Security Essentials - remove malware, viri and spamware</li><li>Flash, Java, .Net, silverlight - something will need them later</li><li><a href="http://www.virtualbox.org/">http://www.virtualbox.org/</a> - have a virtual computer running inside yours. I use it to run linux while on windows. </li><li><a href="http://www.gnu.org/software/emacs/">http://www.gnu.org/software/emacs/</a> - emacs is crazy, it is basically a text editor and shell built around a programming language. If you can make it text based chances are you can do it in emacs. It is also trivial to automate anything. (warning it has a steep leaning curve)</li></ul><div>As a little aside if you want more programs check out <a href="http://www.opensourcewindows.org/">http://www.opensourcewindows.org/</a> it has some fantastic links there.</div><div><br /></div><div>Since I was worried that the computer was infected I ran it with CCleaner, Spybot, Microsoft Security Essentials, and Revo. Finally the tool I like to use is called HyjackThis! it simply tells you all the extra things that are set to run (on startup, with the browser, etc.) then when then change you either ignore or ban. It doesn't stop the most hardened malware but it might at lest tell you something is up and you can deal with it. </div><div><br /></div><div>On to the printer, the official install was 300MB and included all sorts of crap. Just the stuff I had previously removed. I used Winzip to extract the program and inside was just the drivers. Now I can use the standard Add Printer dialogue in the control panel.</div></div><div><br /></div></div>Anonymoushttp://www.blogger.com/profile/16899320910026266930noreply@blogger.com0tag:blogger.com,1999:blog-5620972990149237873.post-49225743570822996012009-12-29T18:48:00.002+00:002009-12-29T19:13:23.565+00:00Stone Age Diet - Review<p>I was looking into trying a new diet, I'm trying this for two reasons: one, to cooking more interesting meals; and two, as a personal challenge. I'm not aiming for weight loss.</p><h2>Background</h2><p>The diet I am looking at is the "Stone Age Diet" (A.K.A. "anti-allergy diet"), it removes many modern foods such as dairy, gluten, refined sugar, caffeine, yeast, chemical additives, preservatives, artificial colours, flavourings and sweeteners. You go back to the basics: lean meat, fish, fruit, veg, herbs. This means that you have to remove all processed foods, hence it should improve my cooking skill. Unfortuanly there is no single definition of a stone age diet, some exclude cereals, legumes, or eggs. Personally I think nuts, seeds and eggs are great so they will be allowed. By my reckoning, it should be possible to keep the calorie intake the same as my previous diet (up to 5000kcal/day during my peak training), to do this I will allow rice, I know it is quite heavily processed and modified for human consumption. </p><h2>Possible Benefits</h2><p><a href="http://www.nhs.uk/Livewell/Allergies/Pages/Foodallergy.aspx">http://www.nhs.uk/Livewell/Allergies/Pages/Foodallergy.aspx</a></p><p>Many things that people have a food allergy/intolerance to are banned hence there is anecdotal stories of many improvements. This would require you to actually have an allergy/intolerance to something that you stop eating and that you keep the diet up for an extended period. </p><p><a href="http://www.nhs.uk/news/2008/07July/Pages/Whichdiet.aspx">http://www.nhs.uk/news/2008/07July/Pages/Whichdiet.aspx</a><br /><a href="http://www.nhs.uk/news/2008/09September/Pages/Weightlossplansappeartowork.aspx">http://www.nhs.uk/news/2008/09September/Pages/Weightlossplansappeartowork.aspx</a><br /><a href="http://en.wikipedia.org/wiki/Medical_research_related_to_low-carbohydrate_diets">http://en.wikipedia.org/wiki/Medical_research_related_to_low-carbohydrate_diets</a></p><p>It also bans a lot of high carbohydrate (and high GI/GL) foods which could aid a low-carb weight-loss diet. However, there seems to be little consensus on the benefits of a low-carb weight-loss diet (such as Atkins).</p><h2>Research</h2><p>To start off I did some research (as I always do). I think it is an interesting hypothesis "does the recent additions to the human diet cause problems". I have seen many newspaper articles and TV shows praising the benefits, here are a select few:</p><ol><li><a href="http://www.telegraph.co.uk/news/uknews/1938069/Eat-like-a-caveman-for-a-healthy-heart.html">The Telegraph</a></li><li><a href="http://www.independent.co.uk/life-style/health-and-families/health-news/the-stone-age-diet-why-i-eat-like-a-caveman-461514.html">Independent</a></li><li><a href="http://www.dailymail.co.uk/health/article-564859/Caveman-diet-lowers-risk-heart-disease-new-research-shows.html">Daily Mail</a></li><li><a href="http://www.youtube.com/watch?v=w-r0qys89io">Richard & Judy</a></li><li><a href="http://women.timesonline.co.uk/tol/life_and_style/women/diet_and_fitness/article4523487.ece">Times</a></li></ol><p>Ok, so the media sings the praises; off to find out if there is any better evidence; first stop Wikipedia. After a few hours of following the links on wikipedia and google I finally found three pages I love, but first a bit more background reading:</p><ul><li><a href="http://www.drmyhill.co.uk/article.cfm?id=257">http://www.drmyhill.co.uk/article.cfm?id=257</a></li><li><a href="http://www.lowcarb.ca/atkins-diet-and-low-carb-plans/stone-age-diet-mackarness.html">http://www.lowcarb.ca/atkins-diet-and-low-carb-plans/stone-age-diet-mackarness.html</a></li><li><a href="http://www.allaboutyou.com/diet-wellbeing/anti-allergy-diet-meal-plan/v1">http://www.allaboutyou.com/diet-wellbeing/anti-allergy-diet-meal-plan/v1</a></li></ul><p>Here we go, my top 3 links:</p><ol><li><a href="http://pcwww.liv.ac.uk/~gowlett/gowlettcjne_13_03_02.pdf">What Actually was the Stone Age Diet?</a>: This tells you that there was no single stone age diet, and talks about the kind of things available to people in the paleolithic. Good to stop people becoming to anal about what should properly be allowed in the diet. </li><br /><li><a href="http://www.specialdietsareeasy.com/index.htm">Special Diets are Easy</a>: This is a lovely example of why I love the internet, a cookbook devoted to food that are allowed in this diet. Haven't bought it yet and wouldn't trust any of it's science but I just love how the internet brings communities of niece interest together. </li><br /><li><a href="http://www.nhs.uk/news/2008/05May/Pages/Cavemanfaddiet.aspx">NHS - Cave Man Fad Diet</a>: Here is the only bit of science I have found, it is a review of the diet and in particular the one piece of research done on it. The pertinent quote is <code>There are several limitations to this study which mean that readers should not draw too many conclusions from it.</code> <a href="http://www.nature.com/ejcn/journal/v62/n5/abs/1602790a.html">http://www.nature.com/ejcn/journal/v62/n5/abs/1602790a.html</a> here is that study.</li></ol><h2>Summary</h2><p>Basically, there is no such single thing as the stone age diet. Yet, there has been one piece of proper research and that was a small uncontrolled observational study hence we cannot draw findings from it. Many people swear by the diet, though this is the personal opinion of a few vocal non-experts.</p><p>That said: it make sense that there is a benefit of removing many likely sources of allergy/intolerance. If a significant individual benefit was found then food could be gradually added back and other things removed. I have none of the common symptoms so this is not an issue for me. The advantage of reducing high GI/GL foods again make logical sense. see <a href="http://en.wikipedia.org/wiki/Glycemic_index">Wikipedia:Glycemic_index</a> for further information.</p><p><br /></p><hr /><h3>Ketosis & Weight-Loss</h3><p>Here is a little aside on ketosis weight loss. I don't think I know enough to pass judgement but both points seemed relevant (assuming they are talking about the same thing).</p><p><a href="http://www.drmyhill.co.uk/article.cfm?id=257">http://www.drmyhill.co.uk/article.cfm?id=257</a></p><blockquote><p>As a general principle I don't like my CFS patients dieting because cutting calories makes you tired, cold and depressed and you can do without those things! However, if you are extremely strict with CHO, the body switches into a state of ketosis... if there is [no carbohydrate] then ketones are excreted in the breath and in the urine - one literally pees out calories. This is very good for morale when every time you pee you lose calories and weight!</p></blockquote><p><a href="http://www.nhs.uk/Conditions/Ketosis/Pages/Introduction.aspx">http://www.nhs.uk/Conditions/Ketosis/Pages/Introduction.aspx</a></p><blockquote><p>Ketosis is potentially a very serious condition that occurs when there are raised levels of chemicals, called ketones, in the blood... Ketosis is often caused by a diet that is very low in carbohydrate. Ketones are toxic (poisonous), acidic chemicals such as: acetone, acetoacetate, and beta-hydroxybutyrate.</p></blockquote>Anonymoushttp://www.blogger.com/profile/16899320910026266930noreply@blogger.com0tag:blogger.com,1999:blog-5620972990149237873.post-89218714410396826512009-12-17T13:57:00.004+00:002009-12-17T14:52:48.810+00:00Types of Knowledge<div><br /></div><div>There are three ways to <i>know</i> something:</div><div><ol><li>Experiment</li><li>Theory</li><li>Opinion</li></ol><div>Each is an order of magnitude better than the next. That said in each class you have a range of believability. You shouldn't trust the opinion of certain people; you shouldn't believe theory that doesn't make sense; and you should only believe a well carried out experiment. All other information is derived from these three things. </div><div><br /></div><div>The way research should work is that someone (an expert in the area) forms an opinion based upon other work he has seen. He then performs further research to see if any work has been done in this area. This body of previous work is collated to produce a theory something on the lines of "because of these things that we know (from repeated experiment) it makes sense that ___ is true".</div><div><br /></div><div>Once you have the theory you can move on to the experiment. This should be repeatable in both senses of the word. One, the method should be written so that it can be copied (and ideally should be submitted for peer review <i>before</i> any tests are done). Two, the experiment should give the same results when done again. This should be written up. The results should not be interpreted here. All you know is that when you follow the <b>Experiment Plan</b> you get ___. </div><div><br /></div><div>From here you have a new piece of evidence to update your theory; this is the conclusion. It should follow the form "I think the reason we got ___ from the experiment is because". This should be treated as any other piece of theory. </div><div><br /></div><div>Once this is done other researchers should step in. If you want to expand the work, keep everything the same apart from the one area you want to look at. This will greatly enhance the reputation of the previous work by showing the repeatability. It will also make people trust your work.</div><div><br /></div><div>If you disagree you can probably say "I think the reason you were seeing these results was actually ___", you then copy the experiment other than the thing that you think was the problem. You shouldn't disagree with the findings you can disagree with the interpretation. </div><div><br /></div><div>I would consider this basic knowledge, yet I see many pseudoscience and alternative medicine break these rules all the time. You don't need a Ph.D. to produce good scientific findings. In fact, even if all other rules were broken I could still see this method working. </div><div><br /></div><div>1. Bob thinks that better lighting will make people more productive. He thinks this because at his last job they had better lights and people worked faster. </div><div><br /></div><div>2. Bob does some research (he can't find much) but some of it seems to agree. He writes up his literature review and experiment plan and sends it to all his employees. Bob intends to turn up the lights every other week for a month and log productivity.</div><div><br /></div><div>3. Bob sees much better productivity when the lights are higher, especially in the first week. He sends the results (raw data) to everyone.</div><div><br /></div><div>4. Jane thinks that people were only working faster because they were being tested. People were trying harder when the lights were higher to be helpful. (new theory from same data). She proposes the they turn down the lights instead of up. Sends and email saying what the new test is. </div><div><br /></div><div>5. Peoples productivity went up. This new piece of evidence convinces both Bob and Jane that people work harder when they are tested. </div><div><br /></div><div>6. They both start reading up on how to eliminate bias in experiments. Think up a much better experiment and implement it. </div><div><br /></div><div>The initially flawed experiment was fixed on the next iteration because someone disagreed with it and worked to show why. If Jane had instead tested something else or tested in a different way she wouldn't helped nearly as much.</div><div><br /></div><div>I see research like a forest, where each new experiment is a new tree. If you instead build of others work (especially if you disagree) you add a new branch and the tree gets bigger and stronger. To me psychology is a shrub-land with everyone starting their own trees rather than building on each others work. </div><div><br /></div><div><i>The only way we can reach the stars is by standing on the shoulders of giants</i></div><div><br /></div><div>The science we are taught in school tell us to write the following sections. I hope that now you can see why. I also hope that you can see the point in separating this work out so that people see every step before the next. </div><div><ol><li>Opinion (Introduction)</li><li>Literature Review (Background)</li><li>Theory (Hypothesis)</li><li>Experiment Plan (Method)</li><li>Raw Data (Results)</li><li>Theory/Opinion (Conclusion)</li></ol></div><div><br /></div><div><br /></div><div><br /></div><div><br /></div></div>Anonymoushttp://www.blogger.com/profile/16899320910026266930noreply@blogger.com0tag:blogger.com,1999:blog-5620972990149237873.post-61600854147376661292009-11-04T15:22:00.001+00:002009-11-04T15:25:01.712+00:00Setting up a simple GitHub repoGlobal setup:<br /><br /> sudo apt-get install git-core<br /> git config --global user.name "James"<br /> git config --global user.email kerspoon@gmail.com<br /><br />Next steps:<br /><br /> mkdir laos<br /> cd laos<br /> git init<br /> touch README<br /> git add README<br /> git commit -m 'first commit'<br /> git remote add origin git@github.com:kerspoon/laos.git<br /> git push origin masterAnonymoushttp://www.blogger.com/profile/16899320910026266930noreply@blogger.com0tag:blogger.com,1999:blog-5620972990149237873.post-78522297437026222352009-07-10T17:20:00.000+01:002009-07-10T17:20:14.354+01:00To Steve YeggeBelow is a good chunk of an e-mail I sent to <a href="http://steve-yegge.blogspot.com/">Steve Yegge</a>. It was basically a summary of what programming related things I have been doing and where he thought it was enough to get a job. <br /><br /><hr /><br /><br /><br />First a short list of some of the things I am now doing related to that aim (I'm sure you will recognize some of these from your posts):<br /><br />+ I subscribe to a number of programming blogs<br />+ I use emacs (though I'm still not happy with my configuration)<br />+ I started learning to touch type (in Colemak)<br />+ I'm programming in lots of languages<br />+ I'm trying to optimize the way I work<br />+ I read a bit of wikipedia, stackoverflow, ted.com most days<br />+ I've started Project Euler challenges in python<br />+ I have written a minimal Scheme interpreter in C++ & Digital Mars D<br />+ I have written very simple scripts in BASH/grep/find/cat/sed<br />+ I use Linux (in the lab), Windows (at home) and Mac OS (at work)<br />+ I have read SICP, GEB, Design Patterns, The Pragmatic Programmer<br /><br />About me (if you're actually interested)<br />========<br /><br />I am a UK PhD student currently studying Electrical Power Systems, which involves a lot of work on artificial intelligence. Before that I did a BEng in Electrical Engineering involving writing a Genetic Algorithm to optimize settings on a controller for a virtual mag-lev train. I wrote the GA, the integration algorithm, the simulator and the GUI in C++.<br /><br />Started programming in Macromedia Director Lingo, moved on to VB/VBA in school, taught myself HTML, CSS and a little bit of PHP so I could design a couple of websites. Took an online course in Game Programming that taught me C++ & DirectX/Win32 API. At University I had courses on Unix & C, Java, Matlab, and PIC programming in assembly. I would only really say I am comfortable writing C++ and python, I can read and understand the others, not sure why but I really dislike Java. I haven't been taught much computer science but I think my math is good.<br /><br />My Aims<br />========<br /><br />+ Learn a pure functional language<br />+ Learn a bit of Forth<br />+ Learn a more of Python<br />+ Read a book on:<br /> - Compliers<br /> - Algorithms<br /> - Regular Expressions<br /> - Mathematics for Programmers<br />+ Read the following:<br /> - Programming Language Pragmatics by Michael L. Scott<br /> - Hacker's Delight by Henry S. Warren<br /> - Refactoring by Martin Fowler<br />+ Improve my scheme interpreter by:<br /> - Implementing macros<br /> - Implementing call/cc (then hopefully understand it better)<br /> - Re-writing in python<br />+ Learn how to use threads<br /><br />The Questions<br />========<br /><br />1. I'm struggling to learn a different keyboard layout, do you think it's really worth it?<br /><br />2. As I haven't done a CS degree is there any thing I really need to know that I haven't covered?<br /><br />3. Out of my aims which do you think are more important, are there any pointless ones, or ones you would like to add?<br /><br />4. Do you think that if I achieved my aims I would be good enough to be hired?<br /><br />5. Is there resources other than Project Euler that will give me tasks to make me learn a language better.<br /><br />6. How important is doing the exercises in the book I read? How many do you do when you read a new book?<br /><br />My emacs Annoyance<br />========<br /><br />I found emacs to be like my iPhone; amazing yet annoying. When I got my iPhone I was amazed at all the new things I could do and how easy most tasks were, shortly after that I was annoyed that they hadn't done more, it's not complete.<br /><br />emacs has the potential to be just about the best application ever made but for me the default settings suck. It took days to be able to use (which isn't a problem) but weeks in and I'm still struggling to get things like auto-completion working how I want it to. It's as if you have to live in emacs and hack everything together yourself. Still, I cant go back to any other editor now, emacs is just too good. But I will remain frustrated that all those things that I want to do and I know are possible are going to elude me, unless I take the time to get it working myself.<br /><br />It's like the difference between Firefox and Opera. Firefox gives you a pretty basic web browser with the magic ability to add to it. Opera gives you an advanced web browser out of the box without the ability to add to it. I used to use Opera because the addons for Firefox don't work well with each other and it would take a long time to get it working how I wanted. It's the same with emacs, but there is no equivalent (maybe TextMate).<br /><br /><br />Before this get too long I will end it, thanks for reading up to this point.<br /><br />James BrooksAnonymoushttp://www.blogger.com/profile/16899320910026266930noreply@blogger.com0tag:blogger.com,1999:blog-5620972990149237873.post-28292859899259346762009-07-02T13:37:00.004+01:002009-07-02T13:45:21.624+01:00changing screen resolution in ubuntu 9.04I have an EEE-PC 1000HE running Ubuntu 9.04, and a BENQ 21" FP202W monitor. I would like to be able to have a dual screen set-up with both screens at max resolution. <br /><br />Looks like the new Ubuntu doesn't use /etc/X11/xorg.conf as the old versions did. In the old versions you could specify everything you wanted in xorg.conf and then would see the changes in the graphical program (System->Preferences->Display). My xorg is almost empty if I change the part that says Virtual to 2048 2048 I can have my larger resolutions, it does slow my PC down and I don't think it supports anything above 2048 but that's all I has to do. <br /><br />Easy, (after hours of searching forums)Anonymoushttp://www.blogger.com/profile/16899320910026266930noreply@blogger.com0tag:blogger.com,1999:blog-5620972990149237873.post-51222993334787509352009-06-29T10:52:00.006+01:002009-06-29T11:10:35.085+01:00Mocking Python FilesJust a quick note on testing python; I needed to test a method the reads in from a file. To do that I could either created a <a href="http://docs.python.org/library/tempfile.html">temp file</a> or use <a href="http://docs.python.org/library/stringio.html">stringio</a>. Stringio is easier and quicker so I used that, here's how:<br /><br /><pre class="prettyprint"><br />def mockfile(text):<br /> return StringIO.StringIO(text)<br /><br />class Tester1(unittest.TestCase):<br /> def setUp(self):<br /> self.filehandle = mockfile("""<br /> gen , G1 , 101 , 450 , 50 , U20""")<br /> self.components = read(self.filehandle)<br /><br /> def tearDown(self):<br /> self.filehandle.close()<br /> self.filehandle = None<br /> self.components = None<br /><br /> def test_name(self):<br /> self.assertEqual(set(self.components.keys()), <br /> set("G1"))<br /><br /><br />class Tester2(unittest.TestCase):<br /> def test_a(self):<br /> components = read(mockfile(""))<br /> self.assertEqual(len(components),0)<br /></pre><br /><br />Hopefully I this is the first in a series of posts on practical <a href="en.wikipedia.org/wiki/Test-driven_development">TDD</a>. Watch this spaceAnonymoushttp://www.blogger.com/profile/16899320910026266930noreply@blogger.com0tag:blogger.com,1999:blog-5620972990149237873.post-25978369095815500232009-06-23T11:10:00.005+01:002009-11-04T15:35:11.605+00:00Test Driven Development (pros and cons)I am a fan of TDD (Test Driven Development), for those who don't know TDD here is the places to read about it:<br /><br /><a href="http://www.amazon.co.uk/Test-Driven-Development-Addison-Wesley-Signature/dp/0321146530/">Test Driven Development by Kent Beck</a><br /><br /><a href="http://butunclebob.com/ArticleS.UncleBob.TheThreeRulesOfTdd">The Three Rules Of TDD by UncleBob</a><br /><ol><li>You are not allowed to write any production code unless it is to make a failing unit test pass.</li><li>You are not allowed to write any more of a unit test than is sufficient to fail; and compilation failures are failures.</li><li>You are not allowed to write any more production code than is sufficient to pass the one failing unit test.<br /></li></ol><a href="http://www.nilkanth.com/2007/06/08/three-monkeys-of-test-driven-development/">Three Monkeys of Test-Driven Development by Ashutosh Nilkanth</a><br /><br /><a href="http://wellington.pm.org/archive/200606/tdd/images/tdd_cycle.jpg"><img style="width: 250px; height: 300px;" src="http://wellington.pm.org/archive/200606/tdd/images/tdd_cycle.jpg" alt="" border="0" /></a><br /><br />You basically make sure everything works before doing anything else; and you only do one thing at a time. It has the great advantage that you can change whatever you want in your code and you can be sure it is as good as before. This allows you to aggressively refactor. Being able to refactor without fear of breaking something should leave you code easier to maintain and easier to add new features. This will hopefully overcome the time it has taken to write all those tests in the first place.<br /><br />A few things make TDD more difficult:<br /><ul><li>Randomness (Non-Deterministic Methods)<br /></li><li>User Interfaces</li><li>External Code (including Databases)</li></ul>It is for this reason that I find it difficult to use TDD for all my coding. Now those who support it say that you can mock up facade classes for the external code including random number generation meaning you can test only the bits you want.<br /><br />My other problem it it seems to break my flow of thinking. I want to type out a load of different ways of doing things and see which one I like better.<br /><br /><hr /><br />I think TDD has it's place but there is a need to do another kind of programming. <span style="font-weight: bold;">Exploratory programming</span>; one where you do not know what you want to end up with. You just chuck out a load of code and see how it runs. This is great if you have a nice fast development cycle, i.e. interpreted high level language. I would say that it get exponentially more complicated to do exploratory programming as the total number of lines of code increases. This gives a natural limit to the kind of things that can be accomplished with this technique. I believe it is best suited for tracers and prototypes (see The Pragmatic Programmer). In this case you quickly see the shape of a small part of your program and begin to see what things (modules, classes) you need in the full version. Once you have got a section of code working you can write it properly (with TDD) meaning you live by the rules of TDD and throw one away (Mythical Man Month).Anonymoushttp://www.blogger.com/profile/16899320910026266930noreply@blogger.com0tag:blogger.com,1999:blog-5620972990149237873.post-21280331387242867782009-06-16T22:14:00.002+01:002009-06-16T22:18:49.335+01:00Various Musings on Time TravelHere is a old (from about 2003) e-mail I write. Enjoy; It would be good to hear some comments on it. My opinions have changed a bit now but I stand by some of it.<br /><br /><hr /><br />Hello,<br /><br />I have just read your webpage ‘<a href="http://ingles.homeunix.net/rants/timetravel.html">Various Musings on Time Travel</a>’ (admittedly only once – I feel something like that should be read a few times). I thought that your analogy of a flip book for a 4th dimension was perfect: I could now explain 4 dimensions to a young teenager. I’m very surprised that you didn’t carry it on for the rest of the discussion; especially on a multi-verse. As with any good article, most of the questions I had were answered or at least mentioned, and I’m left with more questions than I started with.<br /><br />DETERMINISM<br />I have only one negative comment on your article, which is of determinism, you didn’t seem to look into the consequence very much. Starting with a definition: I believe that the laws of nature are so strictly defined, that given all information about one point in time, and enough processing power, we could work out everything about the next instance in time. I also believe that to do such a thing is impossible [1]. Thus we have the situation as follows: you have free-will: no one can predict what you will do, you fully believe that you can make any choice, AND that of determinism [2]. Randomness is caused by everything we don’t take into account when doing an experiment; hence there are still ‘random’ events.<br /><br />SINGLE TIME LINE<br />In a world with only one timeline and assuming that we can go back in time – this will cause us to realise that we don’t have free will. We cannot kill our father as we didn’t: we can only do what has already happened. Hence, you cannot change the past. The reason that we haven’t seen any of these changes (seen any time travellers) is that we haven built anything to receive the energy/mass (signal/traveller). No paradoxes, but then again no free will and no where near as much ‘fun’ as a multi-verse.<br /><br />I didn’t think that you covered the idea of physically not being able to make the decision. Not some strange co-incidence not letting it happen.<br /><br />The stuff above I have thought through before, the stuff below has quite a lot more assumptions and flaws.<br /><br />MULTI VERSE<br />Let’s describe a multi-verse: we have another dimension. We have the, infinite sized axes: x, y, and z of the 3d drawing on the page of the flipchart. We have all the infinite number of flipchart pages representing time. And we have an infinite number of these flipcharts that represent every universe in the multi-verse. A five dimensional space; infinite in all directions.<br /><br />Movement through the first 3 dimensions is by transferral of energy, the 4th is mostly automatic (time travel changes this). Movement through the 5th, well lets look at one possibility that you didn’t discuss.<br /><br />We could move when ever something happens. For instance, a coin lands on heads, hence, we are in the universe where the coin landed on heads. By changing stuff we are simply moving to the flipchart where that happens (in the same way that we automatically move to a new instance in time). We are moving through the 5th dimension.<br /><br />Determinism almost becomes a moot point in a multi-verse with time travel. We can predict what will happen in the universe that we are in, but we can move between universes so there is not a lot of point.<br /><br />When we time travel to another universe we can change things; we can add and remove matter; kill the ‘version’ of our grandfather; whatever we want. But we are simply in the universe where that happened.<br /><br />THOUGHT EXPIRIMENT<br />Thought experiment time. We have a time-mahcine that can freely move about in both the 4th and 5th dimension. Let’s only look at 2 universes, A and B. We will look at them from 3 points of reference: from Bob’s, from A’s, and from B’s. Each point of reference will be from the chronological order of the one perceiving it.<br /><br />Bob<br />Bob is in A in 2050; he time travels so that he is in A in 2000. He kills his mother called Janet; hence he is in B in 2000. The act of killing brought about the change.<br /><br />A<br />Bob’s mother, Janet, gives birth to him in A in 2020. He time-travels out of this universe.<br /><br />B<br />The Bob from A arrives in 2000, kills Janet, who is not his mother. Hence Janet does not give birth.<br /><br />From here Bob can travel to A where his mother is alive or to B where the person he thinks is his mother never gave birth.<br /><br />LOTTERY NUMBERS<br />It’s the same with telling yourself winning lottery numbers. The fact that information has travelled back in time will cause the movement to a new universe. The likelihood is that the movement of information will cause different numbers on the lottery machine so it it’s not a lot better than guessing. The more chaotic a system the less accurately the information from time travel.<br /><br />In essence you are using one universe to compute an approximation of the other one. The universe is almost the same (bar the information that travelled back) and you know what happened in the future of the very similar one.<br /><br />VIOLATE LAWS OF NATURE<br />If there are an infinite number of dimensions, which cover everything happening, surely we can move to ones where the laws of nature don’t apply. The only reason we haven’t is that we cannot produce a situation where we violate them. If we produced them then we would be in such a place.<br /><br />You are only able to think if you are alive. By thinking, you are in a universe where you are not dead. Hence, you will only be able to think in the universes where you didn’t die and hence you will think that you are living forever. There will be some universes where you don’t die and that’s the only ones where you will perceive. Do something that will definitely kill you according to the current laws of physics. Does this mean that you will move to a universe which ignores the laws of physics? Shoot yourself in the head to find out.<br /><br />MOVEMENT DIFFICULTIES<br />Note that we might not be able to move through the 5th dimension very easily. It might take beings as long as it took them to create a time machine to create a 5th dimension machine, it may not be possible at all. If that is true then we have the case where we can kill our mother and live in a world where we no one gave birth to us. It’s not a paradox if you say that the other universe exists but we can’t get to it. The laws of conservation only apply to closed systems, we cannot observe all the other universes and hence we may gain matter and energy from other universes.<br /><br />CONCLUSION<br />Note that the only difference between a universe and a multi-verse is the ability to move in the 5th dimension: something that can only be proved by time travel. I have removed most of the paradoxes you have described but only by defining things or assuming things. I haven’t discovered anything.<br /><br />My head is buzzing; every time I write about this stuff I come up with so many counter arguments to my thoughts that I find it hard to express anything of value. I hope you like my musings.<br /><br />[1] My reasoning is that. We cannot build a computer fast enough to perfectly emulate (NOT estimate) itself and do other some stuff. Inside the universe (or even multi-verse) we cannot predict everything that will happen without dedicating the entire universe to working it out.<br /><br />[2] I know that it is a leap-of-faith, but please, just follow the line of thinking.Anonymoushttp://www.blogger.com/profile/16899320910026266930noreply@blogger.com0tag:blogger.com,1999:blog-5620972990149237873.post-14063307480400586602009-06-16T21:40:00.004+01:002009-12-17T14:59:08.512+00:00Running a country<i>I don't think this this would work on a large scale, but at the community/village level I see no problem.</i><br /><br />I think the country should be run by teams of interested experts. If you have to make a law for cars you need to decide who is the main interested parties and find a representative group from each. These are mediated by a non-voting person. The decisions are made when 75% of people agree, it should be about reaching a consensus. To aid this process people need to know how to change their mind. Our ideas belong to us and become deeply personal; this blocks change.<br /><br />As an addition to this the entire process should be public. Transcripts and doccuments available.<br /><br />Laws should be temporary by default. They revert without action. Laws should be guidelines given with examples.<div><br /></div><div>A friend once told me that he hopes the Liberal Democrats never have a good idea. His reasoning is that they don't have a realistic chance of being elected so wont be able to implement it, yet the two partied that do get elected can't use it either, they would be copying. Hence if the Liberal Democrats have a good idea it cannot happen. </div><div><br /></div><div>To change we would need to see a massive shift in teaching. People need to know how to work together towards an idea. Too many meetings are about convincing people that your idea is better than theirs. Edward de Bono has written extensively on this.<br /><br /></div>Anonymoushttp://www.blogger.com/profile/16899320910026266930noreply@blogger.com0tag:blogger.com,1999:blog-5620972990149237873.post-14787608614906289602009-06-16T21:30:00.005+01:002009-06-23T10:20:17.691+01:00In praise of the internetI do not think that a democracy is the best political structure, I think it's the least easy to corrupt. Twitter et. al. has done a wonderful job of making news creation public and non-professional. It's difficult to moderate or to stop and once people accept it as the norm it will continue to change things for the better.<br /><br />People have more power to reach the world now. The web managed, by bringing everyone onto one place, to form groups; which is a good thing in this case. You might expect everyone to become homogenised by the internet, we all have access to the same global media. But what happened is far greater; you can find groups of people with the same interests as you.<br /><br />Someone who wants to discuss, for no other reason than that it interests them, the details of making a better shoe, voting system, teaching method. You find people with a love of almost everything.<br /><br />Three things I looked up recently:<br /><ol><li>The speed of gravity (wave propagation)</li><li>New ways to tie shoelaces</li><li>Backpacking without carrying much<br /></li></ol>Not only did I find these things (and more) but there was more than one website that told me more than I wanted to know about each.Anonymoushttp://www.blogger.com/profile/16899320910026266930noreply@blogger.com0tag:blogger.com,1999:blog-5620972990149237873.post-29550096861995387582009-06-11T13:10:00.003+01:002009-06-11T13:17:11.246+01:00Genetic Algorithms in PythonFollowing on from before here is some resources for programming GA in python. The top one looks like the easiest to understand and hence is my preferred one.<br /><ul><li><a href="http://code.activestate.com/recipes/199121/">http://code.activestate.com/recipes/199121/</a></li><li><a href="http://www.alextreme.org/projects/python_ai/">http://www.alextreme.org/projects/python_ai/</a></li><li><a href="http://pygp.sourceforge.net/">http://pygp.sourceforge.net/</a></li><li><a href="http://www.freenet.org.nz/python/pygene/">http://www.freenet.org.nz/python/pygene/</a></li></ul>As a side-note here is a list of neural network resources in Python:<br /><a href="http://www.answermysearches.com/four-free-neural-network-libraries-for-python/195/">http://www.answermysearches.com/four-free-neural-network-libraries-for-python/195/</a><br /><br />I'm thinking or reviving one of my old projects; to recreate critters from aijunkie. I have quite a few ideas I would like to add to them once it's up and running.Anonymoushttp://www.blogger.com/profile/16899320910026266930noreply@blogger.com0tag:blogger.com,1999:blog-5620972990149237873.post-41020314083208839552009-06-10T11:11:00.003+01:002009-06-10T11:43:22.631+01:00Genetic Algorithms and Traveling SalesmanMy friend is doing some work with Genetic Algorithms. He's trying to optimize a kind of traveling salesman problem. Here is the problem:<br /><br />You have N sources and M destinations, it takes a specific cost to transport goods between the two. Each has a max and min capacity and you have to make sure all of the source gets to a destination in the least possible cost. (in reality there is a lot more to it but that's enough for me to explain what I want to)<br /><br />He has coded it as a list of integers. The index into that list is the source and the value is the destination.<br /><pre>---------------------------------------<br />Source | 1 | 2 | 3 | 4 | ... | N |<br />---------------------------------------<br />Destination | 3 | 2 | 9 | 9 | ... | 6 |<br />---------------------------------------</pre>From the about you can see that all goods from both source 3 and 4 go to destination 9.<br /><br />It wasn't working as well as the client wanted so we worked through some modifications.<br /><br />1. Change the crossover method. He was using single point crossover, I thought this would cause sections of solutions to remain fixed for too long. i.e. you would be limited to having the same beginning sections of genome as one of the randomly selected initial individuals. I suggested occasionally he selects a random genes (here being one integer in the list) from the parents. This way they still get about 50% from each parent but which ones that get are random (rather than from the beginning or from the end).<br /><br />2. Change the mutation method. He was mutating by changing a random source to a random number. As he pointed out, this is likely to cause infeasible solutions. Instead we decided that swapping two sources might be a better method. I think this will help particularly in later epochs (generations). Note that you still need the old mutation to bring back removed destinations.<br /><br />I did also suggest hill climbing the best solutions at the end of the GA. But as there are no continuous variables I'm don't think this would work.<br /><br />It might also have been an idea to group good partial solutions which his current encoding method doesn't exploit to it's potential. For example, it might be that all good solutions have the same source/destinations links as each other for a sources 2,6,17,29. It would be nice if the GA could allow these to be close together on the genome so that they stay as a unit. We could partition the GA by selecting chunks of sources and solve each separately, then use the best 10 from each partition to make a new combined solution with improved starting points.<br /><br />One interesting part that he has already used was to penalize the solutions that don't transport all the goods or transport too much. He does this by an exponential so that solutions that heavily break the rules ave very heavily punished. I did suggest that it might be a good idea to change the punishment factor with the number of generations such that you allow the rules to be bent at the start but not at the end.<br /><br />We shall have to see how it works.Anonymoushttp://www.blogger.com/profile/16899320910026266930noreply@blogger.com0tag:blogger.com,1999:blog-5620972990149237873.post-90721751074676880602009-06-09T11:36:00.003+01:002009-06-09T12:07:18.874+01:00Evolved Virtual CreaturesA brief summary of <a href="http://www.karlsims.com/evolved-virtual-creatures.html">Evolved Virtual Creatures</a> by Karl Sims.<br /><br />Creatures are made and evolved to perform simple tasks. These include jumping, swimming or following. "the optimization determines the creatures morphologies as well as their control systems" i.e. they have both a physical and mental representation in DNA. <br /><br />Physically they are made of cuboid blocks of varying dimensions with joints connecting them. Each block can have sensors or effectors. The effectors are simply a force applied to a specific joint causing motion. The sensors include the angle of a joint, photo-detectors or contact sensors. <br /><br />This physical structure is stored as a directed graph. E.g. if the body node was connected to itself 10 times it would make a snake like creature. Each node of the graph has its own brain so that body parts can learn to have their own controls. In addition to that there is the centralized control which can link any of the parts to any other. <br /><br /><hr><br /><br />I would love to see a distributed computing version of this program. You could imagine each computer as a segregated island (galapagos island) where different species can develop. By downloading new creatures from other computers you can see how they cope in this new habitat. <br /><br />To make it more interesting as an end user it would be good to be able to direct the evolution. Give the control to treat them like pets: providing training grounds, change food scarcity, introduce or remove predators.<br /><br />If that gained interest as a free version then the paid one could be the genetics lab where you can make your own creatures. Additional sensors and effectors could be added (and sold) and the spread through the population (both intro and inter island/computer) would be a wonderful piece of research.<br /><br />Blocks of brains could be made that perform certain tasks and introduced in the way that new sensors and effectors are added. To reduced computational load thinking (i.e. computation) could use up energy.Anonymoushttp://www.blogger.com/profile/16899320910026266930noreply@blogger.com0tag:blogger.com,1999:blog-5620972990149237873.post-74997064210116420782009-06-09T10:09:00.002+01:002009-06-09T12:08:18.333+01:00hackers and libertariansJust a quick post to this: <a href="http://dfranke.us/cfod.html"><br />Code Free or Die(): Why Hackers Are so Often Libertarians</a> by Daniel Franke. His idea is that because libertarians do not want to be controlled by anyone or anything we learn how to take control. If you own a computer that means learning to hack it.Anonymoushttp://www.blogger.com/profile/16899320910026266930noreply@blogger.com0tag:blogger.com,1999:blog-5620972990149237873.post-75222550311976021482009-06-08T18:57:00.005+01:002009-12-17T15:06:01.897+00:00EvolutionEvolution is an accidental consequence of our universe. If you have an object that can produce slightly modified copies of itself, you have evolution. The strange part is the modifications can be random changes.<br /><br />It happens with stories, people make up a story but each time it is told it gets changed. It might be changed because people forget parts, or they think a different version is better. The story evolves to become what people want to hear.<br /><br />It's important to note that it is not just the story that affects how good it will be but the environment around it: the people who hear it and the people who pass it on. People like different things.<br /><br />It also happens with life; In fact we have evolved a fantastic method for evolving. This method is called genetic evolution. We are coded, like blue-prints, into a chemical called DNA. This allows us to replicate in an imperfect way (organisms are rarely exact clones). Mostly these changes do nothing, sometimes they are problematic, very occasionally they are beneficial. Anything that gets a benefit will be able to reproduce (copy) more times, meaning they will cover a higher percent of the population.<br /><br />Sexual reproduction is another improvement in evolution. It's as if we combined two good stories or two good car blue-prints to make another.<br /><br />As we continue to rush through the landscape of evolution history on earth we can see that certain events that seem to be detrimental can be beneficial. Fluke events can shape an entire lineage. Things don't have a plan. We are not forced to follow our genes. <div><br /></div>Anonymoushttp://www.blogger.com/profile/16899320910026266930noreply@blogger.com0tag:blogger.com,1999:blog-5620972990149237873.post-88169848962273023042009-06-05T16:28:00.002+01:002009-06-05T16:35:59.327+01:00Python Date and TimeSame project, different problem. This time the problem is dates and times. Specifically converting between them. These two small functions do just that. <br /><br /><pre class="prettyprint"># parse_date :: Date -> String<br /># e.g. parse_date("2001-12-31")<br />def parse_date(date):<br /> return datetime.date(*strptime(date, "%Y-%m-%d")[0:3])<br /><br /># str_date :: String -> Date<br />def str_date(date):<br /> return date.strftime("%Y-%m-%d")</pre><br /><ul><li><a href="http://docs.python.org/3.0/library/datetime.html#strftime-behavior">http://docs.python.org/3.0/library/datetime.html#strftime-behavior</a></li><li><a href="http://docs.python.org/library/time.html">http://docs.python.org/library/time.html</a><br /></li><li><a href="http://pleac.sourceforge.net/pleac_python/datesandtimes.html">http://pleac.sourceforge.net/pleac_python/datesandtimes.html</a></li><li><a href="http://www.google.co.uk/search?hl=en&q=site%3Adocs.python.org+strptime&btnG=Search&meta=">google search</a><br /></li><br /></ul>P.S. Pleac is a wonderful site, it aims to have a load of common code for a variety of languages, good to get practical tips as well as learn a new language.Anonymoushttp://www.blogger.com/profile/16899320910026266930noreply@blogger.com0tag:blogger.com,1999:blog-5620972990149237873.post-85348839570778816792009-06-05T15:56:00.002+01:002009-06-05T15:59:20.443+01:00Combining Python DictionariesI had a small task where I had to take two existing dict and combine them by adding together the values of any elements that already exist. Here's how I did it.<br /><br /><pre class=prettyprint><br /><br />def dict_combine(dict1, dict2, combiner):<br /> """takes two dictionaries and combines them<br /> such that the value is the result of:<br /> result[a] = combiner(dict1[a],dict2[a])"""<br /> result = {}<br /> dict1_keys = set(dict1.keys())<br /> dict2_keys = set(dict2.keys())<br /><br /> # keys uniuqe to dict1 are included unchanged<br /> for x in dict1_keys - dict2_keys:<br /> result[x] = dict1[x]<br /><br /> # keys uniuqe to dict2 are included unchanged<br /> for x in dict2_keys - dict1_keys:<br /> result[x] = dict2[x]<br /><br /> # keys in both dictionaries get combined then included<br /> for x in dict1_keys & dict2_keys:<br /> result[x] = combiner(dict1[x],dict2[x])<br /><br /> return result<br /><br />def test_dict_combine():<br /> dict1 = dict(a=1, b=2, c=3)<br /> def adder(a,b):<br /> return a + b <br /> assert dict_combine(dict1,dict1,adder) == dict(a=2, b=4, c=6)<br />test_dict_combine()<br /></pre>Anonymoushttp://www.blogger.com/profile/16899320910026266930noreply@blogger.com0tag:blogger.com,1999:blog-5620972990149237873.post-22110967187211462772009-06-05T15:47:00.001+01:002009-06-05T15:55:28.265+01:00Testing Python CodeJust a quick test that parsing python works...<br /><br /><pre class=prettyprint><br />#!/usr/bin/python<br /><br />from time import strptime, strftime<br />from datetime import date<br />import datepyth<br />from datepyth import Money, RepeatEntry, FractionalEntry, SingleEntry<br />from datepyth import weekly, monthly, yearly<br />from decimal import Decimal<br /><br /># parse_lines :: [Entry] -> (String)<br />def parse_lines (getline):<br /> database = []<br /> for line in getline:<br /> if len(line.strip()) != 0:<br /> database.append(parse(line))<br /> return database<br /><br /></pre>Anonymoushttp://www.blogger.com/profile/16899320910026266930noreply@blogger.com0tag:blogger.com,1999:blog-5620972990149237873.post-15133320016302749332009-06-05T15:25:00.003+01:002009-06-05T15:46:09.091+01:00Pretty Print Source Code in BloggerFirst job get nice looking code. Modify your template by going to: Layout->Edit Template. Find the bit between the end of 'head' and start of 'body'. this is what you need to change. follow the instructions as of the first link below. <br /><br />Here is the links I used to find it out. <br /><ul><br /><li><a href="http://lukabloga.blogspot.com/2008/10/to-test-new-highlighting.html">http://lukabloga.blogspot.com/2008/10/to-test-new-highlighting.html</a></li><br /><li><a href="http://urenjoy.blogspot.com/2008/10/publish-source-code-in-blogger.html">http://urenjoy.blogspot.com/2008/10/publish-source-code-in-blogger.html</a></li><br /><li><a href="http://sunday-lab.blogspot.com/2007/10/source-code-high-light-in-blogger.html">http://sunday-lab.blogspot.com/2007/10/source-code-high-light-in-blogger.html</a></li><br /><li><a href="http://code.google.com/p/google-code-prettify/">http://code.google.com/p/google-code-prettify/</a></li><br /></ul>Anonymoushttp://www.blogger.com/profile/16899320910026266930noreply@blogger.com0