<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>The Beth Project</title>
	<atom:link href="http://bethmcmillan.com/blog/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://bethmcmillan.com/blog</link>
	<description>Updated entirely at random when I have done something interesting</description>
	<lastBuildDate>Fri, 11 May 2012 16:05:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.4</generator>
		<item>
		<title>Running FLAME models at the Linux command line</title>
		<link>http://bethmcmillan.com/blog/?p=550</link>
		<comments>http://bethmcmillan.com/blog/?p=550#comments</comments>
		<pubDate>Fri, 11 May 2012 15:38:03 +0000</pubDate>
		<dc:creator>Beth</dc:creator>
				<category><![CDATA[Geeking]]></category>
		<category><![CDATA[Science]]></category>
		<category><![CDATA[agent-based modelling]]></category>
		<category><![CDATA[bacteria]]></category>
		<category><![CDATA[bacteriophage]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[FLAME]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[linux command line]]></category>
		<category><![CDATA[modelling]]></category>
		<category><![CDATA[phage]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://bethmcmillan.com/blog/?p=550</guid>
		<description><![CDATA[Last week, I modified a FLAME model to make it 3D and added some other features (with help from my John). This animation is of the model running, with me wiggling it around a bit to show the 3D-ness, and then leaving it be. There are explosions! I think it&#8217;s pretty cool. It represents a [...]]]></description>
			<content:encoded><![CDATA[<p>Last week, I modified a FLAME model to make it 3D and added some other features (with help from my <a href="http://indy.im/gnuday">John</a>). This animation is of the model running, with me wiggling it around a bit to show the 3D-ness, and then leaving it be. There are explosions!</p>
<p><img src="http://bethmcmillan.com/blog/images/bacteriophage-3.gif" alt="3D FLAME model of bacteria-phage interactions" /></p>
<p>I think it&#8217;s pretty cool. It represents a community of bacteria being attacked by viruses. These viruses &#8211; known as &#8220;bacteriophages&#8221; &#8211; could be really useful for treating infections, because they can kill bacteria which are resistant to traditional antibiotics. </p>
<p>In order to work out what dosage to use, and when to apply it, we need to know more about how bacteria and viruses interact with each other. This is difficult to study in real life, since viruses are so tiny &#8211; but by using computer models, we can make better approximations of how they behave.</p>
<p>The animation shows three types of bacteria, represented by green, blue and pink spheres. The orange dots are viruses. When a bacterium is infected by one of the viruses, it bursts, releasing lots of new viruses. Each virus and bacterium is an &#8220;agent&#8221; inside the model, and they each follow a particular set of rules, and carry pieces of information. I was using a piece of software called &#8220;<a href="http://www.flame.ac.uk/">FLAME</a>&#8221; for this.</p>
<p>FLAME uses C and XML to make rules for the agents in a model. I found the documentation a bit obtuse, so I thought I&#8217;d make a blog post about exactly what I did, in case it was useful to anyone.</p>
<p>Initially, you need to install a set of programs &#8211; gcc, xparser, libmboard, and the FLAME visualiser. <a href="http://www.flame.ac.uk/docs/install.html">The installation instructions on the website</a> are quite straight-forward, so I&#8217;ll start my tutorial by talking about running a model. </p>
<p><strong>Running a model in FLAME using the Linux command line</strong></p>
<p>You can download my model code from <a href="http://bethmcmillan.com/geek/FLAME/bacteriophage-3d.tar.gz">here</a>. It contains 4 files.</p>
<ul>
<li><strong>0.xml</strong> describes the starting state of all the agents in the model</li>
<li><strong>phageAndBacteriaV6.c</strong> contains all of the functions that the agents use</li>
<li><strong>phageAndBacteriaV6.xml</strong> describes all the agents, and the messages they send each other</li>
<li><strong>visual-rules.xml</strong> dictates how the model will be visualised</li>
</ul>
<p>You start by using the xparser program on the xml file. I saved all my files in /home/beth/models/ so that is the location that I will use in my command line work &#8211; you should substitute it for your working folder. So: open up a terminal. Next, navigate to the directory where you have installed xparser and run</p>
<p><code>./xparser /home/beth/models/phageAndBacteriaV6.xml</code></p>
<p>This will create a load of files in home/beth/models. Navigate to /home/beth/models and run</p>
<p><code> make</code></p>
<p>This creates the model programs, most importantly one called <strong>main</strong>. You can then run the model, giving the number of iterations you want (in this case, <strong>100</strong>) and the location of the 0.xml file (in this case, <strong>./0.xml</strong>)</p>
<p><code>./main 100 ./0.xml</code></p>
<p>This creates a load of xml files, numbered 1 to 100. Each one contains information about every single agent in the model at a particular time step. Now, these don&#8217;t look very exciting in themselves, but this is where the flame visualiser comes in.</p>
<p>Navigate to where you&#8217;ve installed the visualiser and run</p>
<p><code>./flame_visualiser</code></p>
<p>A window should pop up. Go to &#8220;File&#8221; > &#8220;Open&#8221; and find <strong>visual-rules.xml</strong>. If you click on &#8220;Open Visual Window&#8221;, you should now see lots of lovely spheres. It&#8217;s a fairly straight-forward program to use &#8211; you can drag the picture around, start and stop the animation, go back and forward through the iterations, and zoom. If you have a tiny screen, you can grab and move the window by holding down Alt when you click &#038; drag.</p>
<p>I made my animation by opening &#8220;Image Settings&#8221; and then setting the iteration to 0 and clicking &#8220;Start Animation.&#8221; This saves a series of numbered images. You can rotate the picture while you&#8217;re recording if you fancy. Then I opened up <a href="http://www.gimp.org/">The GIMP</a>, clicked &#8220;File&#8221; > &#8220;Open As Layers&#8221; and selected all 100 images. Then I saved the image as a .gif, selecting &#8220;Save As Animation&#8221;. </p>
<p>So that&#8217;s how to run an existing model, and make a pretty picture. In my next post, I&#8217;ll talk about how to edit one.</p>
]]></content:encoded>
			<wfw:commentRss>http://bethmcmillan.com/blog/?feed=rss2&#038;p=550</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Recently I&#8217;ve been&#8230;</title>
		<link>http://bethmcmillan.com/blog/?p=527</link>
		<comments>http://bethmcmillan.com/blog/?p=527#comments</comments>
		<pubDate>Sun, 29 Apr 2012 20:56:39 +0000</pubDate>
		<dc:creator>Beth</dc:creator>
				<category><![CDATA[Cooking]]></category>
		<category><![CDATA[Geeking]]></category>

		<guid isPermaLink="false">http://bethmcmillan.com/blog/?p=527</guid>
		<description><![CDATA[&#8230; to the cinema. I feel like I&#8217;ve been anticipating the new Joss Whedon film, the Cabin in the Woods, for a million years. I finally watched it today, and was not at all disappointed. It was hilarious, clever and full of unexpected twists and turns. It has a few familiar faces from his previous [...]]]></description>
			<content:encoded><![CDATA[<p><strong>&#8230; to the cinema</strong>. I feel like I&#8217;ve been anticipating the new Joss Whedon film, <a href="http://discoverthecabininthewoods.com/">the Cabin in the Woods</a>, for a million years. I finally watched it today, and was not at all disappointed. It was hilarious, clever and full of unexpected twists and turns. It has a few familiar faces from his previous projects, most notably Fran Kranz (Topher from Dollhouse) as the quipping, pop culture-referencing stoner Marty, and my old favourite Amy Acker (Fred from Angel) makes an appearance as a serious-faced chemist. Not that they&#8217;re typecast at all. There are also echoes of the Rossum corporation, and the Initiative. I don&#8217;t want to give away the plot, but the film is a fantastic deconstruction of the horror genre, that asks some deeper questions about why society needs to see people being pulled to shreds by monsters in our movies &#8211; in between lots of people being pulled to shreds by monsters. </p>
<p><a href="http://www.thehungergames.co.uk/">The Hunger Games</a> and <a href="http://adangerousmethod-themovie.com/">A Dangerous Method</a> are also definitely worth a watch, for cool sci fi and angry Freud, respectively.</p>
<p><strong>&#8230;watching food programs</strong>. Hugh Fearnley-Whittingstall&#8217;s <a href="http://www.channel4.com/programmes/river-cottage">River Cottage Veg</a> is showing again on More4 on Sundays at the moment. I love all the River Cottage series anyway, since I&#8217;m a huge foodie, but as a vegetarian, watching a food show where I can cook everything on the menu is a particular treat. I have the cookbook that goes with the series as well, and I&#8217;ve really enjoyed cooking and eating the recipes I&#8217;ve tried, especially the <a href="http://theenglishkitchen.blogspot.co.uk/2011/11/macaroni-peas.html">macaroni peas</a> and the <a href="http://www.guardian.co.uk/lifeandstyle/2011/aug/26/vegetable-recipes-fearnley-whittingstall">spicy carrot and chickpea pita pocket</a>. </p>
<p>The <a href="http://www.channel4.com/programmes/the-fabulous-baker-brothers">Fabulous Baker Brothers</a> is another food-focussed show I&#8217;ve been enjoying, as well as my old favourite, <a href="http://www.channel4.com/programmes/jamies-30-minute-meals">Jamie&#8217;s 30 Minute Meals</a>. Edit: I forgot <a href="http://www.channel4.com/programmes/how-to-cook-like-heston">How to Cook Like Heston</a>! How could I? It&#8217;s wonderful and mad. </p>
<p><strong>&#8230;using <a href="http://pyx.sourceforge.net/">PyX</a> to make graphs.</strong> It&#8217;s a really useful Python module that makes both graphs and pictures. You put in your data and out comes a PDF or a postscript file. It&#8217;s super easy to change colours, line styles and axes &#8211; and because it&#8217;s Python, it fits in well with the simulation that I&#8217;m making in the same language. I found the documentation and examples on the website really useful and easy to understand. </p>
<p><strong>&#8230;reading some Red Dwarf books. </strong><em>Red Dwarf: Infinity Welcomes Careful Drivers </em>and <em>Better than Life</em> are two old favourites of mine. While the TV series was a bit hit-and-miss in places, the books are very funny and very polished &#8211; they employ the same kind of anarchic, surreal comedy as Douglas Adams, with more curry and fewer dressing gowns. </p>
<p><strong>&#8230;doing some other things.</strong> Apart from all of that, I&#8217;ve mostly been huddling inside in the warm and dry while torrential rain thunders outside, revising for my upcoming exams, and turning up at my partner, John&#8217;s, house to demand food (successfully: I am working my way through a slice of freshly-based soda bread as we speak). Stay dry, folks. </p>
]]></content:encoded>
			<wfw:commentRss>http://bethmcmillan.com/blog/?feed=rss2&#038;p=527</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>I can&#8217;t wait for strawberries to be in season. No really, I can&#8217;t.</title>
		<link>http://bethmcmillan.com/blog/?p=485</link>
		<comments>http://bethmcmillan.com/blog/?p=485#comments</comments>
		<pubDate>Wed, 04 Apr 2012 21:11:24 +0000</pubDate>
		<dc:creator>Beth</dc:creator>
				<category><![CDATA[Cooking]]></category>
		<category><![CDATA[compote]]></category>
		<category><![CDATA[croissants]]></category>
		<category><![CDATA[jam]]></category>
		<category><![CDATA[lemon juice]]></category>
		<category><![CDATA[preserves]]></category>
		<category><![CDATA[recipe]]></category>
		<category><![CDATA[seasonal food]]></category>
		<category><![CDATA[strawberries]]></category>
		<category><![CDATA[sugar]]></category>
		<category><![CDATA[summer food]]></category>
		<category><![CDATA[yum]]></category>

		<guid isPermaLink="false">http://bethmcmillan.com/blog/?p=485</guid>
		<description><![CDATA[Every year, pre-season strawberries pull me in with their lovely red flesh and wonderful smell, and then when I inevitably buy and eat them, they taste like vinegar and sadness. It seems like sacrilege to waste them, though, so until I learn self-control, I&#8217;ll be making a lot of compotes. This is the one I [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://bethmcmillan.com/blog/images/Strawberries.jpg" alt="" /><br />
Every year, pre-season strawberries pull me in with their lovely red flesh and wonderful smell, and then when I inevitably buy and eat them, they taste like vinegar and sadness.  It seems like sacrilege to waste them, though, so until I learn self-control, I&#8217;ll be making a lot of compotes. This is the one I made today. It pretty much tasted like very fancy, slightly warm jam.</p>
<p><strong>Strawberry compote for the terminally impatient</strong><br />
Serves 2 or 3</p>
<p><u>Ingredients:</u><br />
5 or 6 rubbish strawberries<br />
Zest of 0.25 lemon<br />
Juice of 0.25 lemon (optional, because they&#8217;re probably sour enough already)<br />
1 tbsp sugar<br />
0.25 tsp vanilla essence</p>
<p><u>Directions:</u><br />
Slice the strawberries.<br />
Put all the ingredients in a saucepan over a low heat and cook until the strawberries are soft &#8211; around 5 minutes<br />
Mash with a fork<br />
Serve with anything you like. I went for a croissant and a spoonful of double cream because apparently my resolution this year is to become fat like a house.</p>
]]></content:encoded>
			<wfw:commentRss>http://bethmcmillan.com/blog/?feed=rss2&#038;p=485</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>The anaconda rubik&#8217;s cube, and other stories.</title>
		<link>http://bethmcmillan.com/blog/?p=480</link>
		<comments>http://bethmcmillan.com/blog/?p=480#comments</comments>
		<pubDate>Mon, 05 Mar 2012 13:57:25 +0000</pubDate>
		<dc:creator>Beth</dc:creator>
				<category><![CDATA[Geeking]]></category>
		<category><![CDATA[Science]]></category>
		<category><![CDATA[actin]]></category>
		<category><![CDATA[agent-based modelling]]></category>
		<category><![CDATA[anaconda]]></category>
		<category><![CDATA[BitFixIt Cafe]]></category>
		<category><![CDATA[business planning]]></category>
		<category><![CDATA[choral music]]></category>
		<category><![CDATA[Couch to 5K]]></category>
		<category><![CDATA[exercise response]]></category>
		<category><![CDATA[FreeDOS]]></category>
		<category><![CDATA[Gorecki]]></category>
		<category><![CDATA[Kodaly]]></category>
		<category><![CDATA[orchestral music]]></category>
		<category><![CDATA[Oxford]]></category>
		<category><![CDATA[PhD]]></category>
		<category><![CDATA[Poulenc]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Race for Life]]></category>
		<category><![CDATA[rubik's cube]]></category>
		<category><![CDATA[systems biology]]></category>
		<category><![CDATA[USB]]></category>
		<category><![CDATA[wind orchestra]]></category>
		<category><![CDATA[Windows XP]]></category>

		<guid isPermaLink="false">http://bethmcmillan.com/blog/?p=480</guid>
		<description><![CDATA[I haven&#8217;t made any cool crafts or programs to show off on my blog in a while, so I thought I&#8217;d make a post about things that I&#8217;m up to, and things that are coming up this year. In short: Oxford, science, business plans, science, running, science and rubik&#8217;s cubes. Read on if this intrigues [...]]]></description>
			<content:encoded><![CDATA[<p><img class="aligncenter" src="http://bethmcmillan.com/blog/images/anaconda-bastard-rubiks-cube.jpg" alt="Anaconda bastard rubik's cube" /></p>
<p>I haven&#8217;t made any cool crafts or programs to show off on my blog in a while, so I thought I&#8217;d make a post about things that I&#8217;m up to, and things that are coming up this year. In short: Oxford, science, business plans, science, running, science and rubik&#8217;s cubes. Read on if this intrigues you.</p>
<p><span id="more-480"></span></p>
<p><strong>PhD plans</strong></p>
<p>In October this year &#8211; provided that I pass my Master&#8217;s degree &#8211; I&#8217;ll be starting on a PhD programme at the <a href="http://www.sysbiodtc.ox.ac.uk/">Systems Biology Doctoral Training Centre</a> in Oxford, as a member of <a href="http://www.some.ox.ac.uk/">Somerville College</a>. The first year of the programme is a series of taught modules, covering every aspect of systems biology, from statistical data analysis to biophysics to pharmacology. I&#8217;ll then do two short (12-week) lab projects before beginning the PhD proper, three years of research with a group at the university. I don&#8217;t have to choose what any of these projects will be yet, which gives me some much-needed time to decide on my career path.</p>
<p>I&#8217;ve wanted to do this PhD programme ever since I found out it existed this summer, so on being invited to an interview in December, naturally I screamed like a little girl. The interview consisted of a conversation with two of the course&#8217;s professors, who asked me some questions about biology (such as, &#8220;how do we know that X-ray crystal structures are accurate?&#8221; and &#8220;what is a gene?&#8221;), asked me about my motivation for joining the course and career plans, then gave me a differential equation to solve. Somehow, despite making a very basic maths error during my calculations and forgetting how to draw graphs, I had an email a few weeks later offering me an EPSRC-funded place! </p>
<p>I&#8217;m so excited, and I can&#8217;t wait to start. Of course I&#8217;m going to miss Sheffield, and I&#8217;ll probably be trekking back up here all the time when I leave, but I love Oxford, and it&#8217;ll be great to move closer to my family and friends down south. Also, there is an amazing falafel stall near the science area that I&#8217;m very keen to get back to.</p>
<p><strong>Concerts</strong></p>
<p>I have a few concerts coming up, which I highly recommend attending. The Sheffield University Wind Orchestra (SUWO) will be joining forces with our counterparts from Manchester in a concert on Sunday 25th March. We&#8217;ve been sounding spectacular in rehearsals and we&#8217;re playing some really fun pieces this semester, including some by <a href="http://petemeechan.com/">Peter Meechan</a> and our very own occasional conductor George Morton. As a non-music student, I&#8217;m really proud to play the flute in a university ensemble that performs to such a high standard. We&#8217;re also going on tour this June to Maastricht in Holland, which should be super exciting! There&#8217;s even more information on <a href="http://www.wind-orchestra.group.shef.ac.uk/">the newly-revamped SUWO website</a>.</p>
<p>Also in March, the Sheffield University Chamber Choir have a concert on Tuesday 20th. We&#8217;re singing some Kodaly, some Poulenc and some Gorecki, as well as a great modern piece by one of the music students. I&#8217;ve recently switched back to singing alto after being a soprano for several years, and I&#8217;m really enjoying the challenge! <a href="https://www.facebook.com/events/382214041805377/">More information</a>.</p>
<p><strong>Course work: computer modelling</strong></p>
<p>For my lab project this year I&#8217;m going to be making a computer model of the forces generated by a structural protein (actin) when a brewer&#8217;s yeast cell takes in objects from its environment by engulfing them. This process is known as endocytosis, and it&#8217;s used by yeast to recycle proteins from the cell surface, and to take in nutrients. Currently I&#8217;m writing a review of the scientific literature about the topic, and comparing models that other scientists have made. I&#8217;m itching to get programming, though, so I have been doing bits and pieces of the model when I can.</p>
<p>For one of my other modules I&#8217;m working as part of a group to come up with an agent-based model of bacterial colony growth and competition, using a proprietary (non-free) program called <a href="http://en.wikipedia.org/wiki/MATLAB">Matlab</a>. This is going to be a very modelling-heavy semester for me! We&#8217;re still in the planning stages at the moment, but when we are finished we should be able to create some great visualisations of the data. Working with students from engineering and computer science backgrounds is a new experience for me, but I love having the chance to see how they program.</p>
<p><strong>Course work: products and businesses</strong></p>
<p>Some of my other group projects are a little more speculative. In one module we&#8217;re going to design a bionanomaterial for use in healthcare, and in another we&#8217;re creating a business plan and financial forecasts for an imaginary biotechnology company. The idea my group has started developing for our company is to perform personalised genome analysis for people to look for genes involved in weight gain and exercise response, and create tailored diet and exercise plans accordingly. It was inspired by last week&#8217;s <a href="http://www.bbc.co.uk/news/health-17177251">Horizon</a> episode about exercise response.</p>
<p>Alongside that, I&#8217;m coming up with a different company idea for the university Enterprise Zone&#8217;s business planning competition. I thought I might as well take advantage of the enterprise-focussed resources and workshops available here in Sheffield while I can. I have no immediate plans to start a business, but the skills I learn might come in handy later on in my career.</p>
<p><strong>Miscellaneous</strong></p>
<p>This July, I&#8217;m going to be running the Cancer Research Race for Life 5K in Sheffield. I&#8217;m hoping that I can run or jog the whole way without any walking breaks, but I&#8217;ll have to see how my training goes! I&#8217;ve been working on <a href="http://www.nhs.uk/livewell/c25k/Pages/couch-to-5k.aspx">Couch to 5K</a> since the summer, but at my speed it&#8217;s been more like Couch to 2K so far! If you would consider <a href="http://www.raceforlifesponsorme.org/bethmcmillan">sponsoring me</a>, I would be very grateful indeed.</p>
<p>At the Bitfixit Caf&eacute; this weekend, I tried (and failed) to install Windows XP on a laptop from a USB stick using FreeDOS. More on this if I ever succeed.</p>
<p>The picture at the top of this post is of a toy I picked up in a charity shop a while ago. It&#8217;s a rubik&#8217;s cube, with an anaconda puzzle on the squares. Now, I don&#8217;t know what sadist came up with this particular puzzle but I&#8217;m fairly sure it&#8217;s practically impossible to solve. So I&#8217;m writing a python program to find a solution by going through every configuration until one works. After that I think it should be easy enough to solve using standard rubik&#8217;s cube algorithms. We&#8217;ll see.</p>
]]></content:encoded>
			<wfw:commentRss>http://bethmcmillan.com/blog/?feed=rss2&#038;p=480</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adventures in bookmarklet land</title>
		<link>http://bethmcmillan.com/blog/?p=449</link>
		<comments>http://bethmcmillan.com/blog/?p=449#comments</comments>
		<pubDate>Sat, 14 Jan 2012 01:20:20 +0000</pubDate>
		<dc:creator>Beth</dc:creator>
				<category><![CDATA[Geeking]]></category>
		<category><![CDATA[bookmarklet]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[font]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[Project Gutenberg]]></category>
		<category><![CDATA[reading]]></category>

		<guid isPermaLink="false">http://bethmcmillan.com/blog/?p=449</guid>
		<description><![CDATA[Do you use bookmarklets? They&#8217;re little bits of javascript that you save as bookmarks, that do something to the page you&#8217;re on when you click on them. Today I made a bookmarklet to change the formatting on any Project Gutenberg HTML book. To see it in action, drag this link to your bookmarks bar: Format [...]]]></description>
			<content:encoded><![CDATA[<p>Do you use bookmarklets? They&#8217;re little bits of javascript that you save as bookmarks, that do something to the page you&#8217;re on when you click on them. Today I made a bookmarklet to change the formatting on any Project Gutenberg HTML book.</p>
<p>To see it in action, drag this link to your bookmarks bar: <a href="javascript:var%20r=document.getElementsByTagName('style')[0];var%20s=r.innerHTML;var%20q='body{margin-right:21px;margin-left:21px;font-family:verdana,arial,helvetica,sans-serif;font-size:13px;text-align:left;}p{text-indent:0px}';(function(){r.innerHTML=s+q;})();">Format Gutenberg</a> &#8211; then go to any Project Gutenberg book as an HTML page &#8211; try <a href="http://www.gutenberg.org/files/3608/3608-h/3608-h.htm">this one</a> to begin with &#8211; then scroll down to the main text and click on your bookmarklet.</p>
<p><strong>A bit of background: </strong></p>
<p>I read and wrote a lot of fanfiction as a teenager, and (I suppose largely out of nostalgia) have some particular preferences about text formatting. Nowadays, I find 13px Verdana on a white background, with minimal margins and no indenting, to be the easiest to concentrate on. People talk a lot about how it&#8217;s difficult to read from a computer screen (hence the rise of e-ink) but personally I suspect it&#8217;s easier for me to read fiction when it&#8217;s just another tab on my browser. <a href="http://www.gutenberg.org/">Project Gutenberg</a> is a massive online library of out-of-copyright literature.</p>
<p>I&#8217;m moving house this weekend, my exams start this Wednesday and in general, I&#8217;m pretty stressed out. I&#8217;m having a quiet evening watching comedy with <a href="http://twitter.com/sprawld">my brother Pete</a> and, as usual when I&#8217;m under pressure, obsessively coding. I&#8217;ve always thought bookmarklets were pretty cool (if fairly mysterious), so I had a look at some source code and had a go at working it out (I&#8217;m sure there are lots of tutorials on the internet, but I was looking for a puzzle).</p>
<p><strong>My general strategy and some code:</strong> <span id="more-449"></span></p>
<p>Essentially, the style I wanted could be achieved by applying the following CSS to the page:</p>
<p style="text-align: left;"><code>body{margin-right:21px;<br />
margin-left:21px;<br />
font-family:verdana,arial,helvetica,sans-serif;<br />
font-size:13px;<br />
text-align:left;}<br />
p{text-indent:0px}<br />
</code></p>
<p>Now, all the CSS on the Project Gutenberg HTML pages is inline, so what I needed to do was find the pair of &lt;style&gt; tags and append my code to their contents. Enter some javascript.</p>
<p style="text-align: left;"><code>var r=document.getElementsByTagName('style')[0];</code></p>
<p>This finds the first style tag pair (number 0). I can access its contents using the &#8220;innerHTML&#8221; property, but I can&#8217;t change it without erasing it*. So I must copy it over into a variable to keep it.</p>
<p style="text-align: left;"><code>var s=r.innerHTML;</code></p>
<p>I created another variable called &#8220;q&#8221; with my CSS inside it, and now we are done with all this tedious variable business and can get on to the real action: replacing the original CSS inside the &lt;style&gt; tags with itself <em>plus</em> my addendum. This is placed inside a function (which is rather elegantly named nothing whatsoever), which is then executed by a simple pair of brackets.</p>
<p style="text-align: left;"><code>(function()<br />
{r.innerHTML=s+q;})<br />
();</code></p>
<p>So, in its entirety, we have:</p>
<p style="text-align: left;"><code>javascript:<br />
var r=document.getElementsByTagName('style')[0];<br />
var s=r.innerHTML; var q='body{margin-right:21px; margin-left:21px; font-family:verdana,arial,helvetica,sans-serif;<br />
font-size:13px; text-align:left;} p{text-indent:0px}';<br />
(function()<br />
{r.innerHTML=s+q;})<br />
();</code></p>
<p>However, we can&#8217;t have spaces inside a bookmark &#8211; so the unnecessary spaces are removed, and the necessary spaces (after the word &#8220;var&#8221;) are replaced with &#8220;%20&#8243;, which means essentially the same thing to your browser. This was my first stumbling block when trying to decipher other people&#8217;s code: it&#8217;s so difficult to read without spaces!</p>
<p style="text-align: left; width: 450px; overflow-x: scroll; white-space:nowrap;"> javascript:var%20r=document.getElementsByTagName(&#8216;style&#8217;)[0];var%20s=r.innerHTML;var%20q=&#8217;body{margin-right:21px;margin-left:21px;font-family:verdana,arial,helvetica,sans-serif;font-size:13px;text-align:left;}p{text-indent:0px}&#8217;;(function(){r.innerHTML=s+q;})();</p>
<p>And there we go. A brief evening of minor obsession, and now I can read proper literature while I pretend it&#8217;s fanfiction.</p>
<p>*<small>Incidentally I know precious little Javascript, but the <a href="http://www.w3schools.com/htmldom/default.asp">W3Schools website</a> was very helpful.</small></p>
]]></content:encoded>
			<wfw:commentRss>http://bethmcmillan.com/blog/?feed=rss2&#038;p=449</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>A Very Knitted Christmas</title>
		<link>http://bethmcmillan.com/blog/?p=421</link>
		<comments>http://bethmcmillan.com/blog/?p=421#comments</comments>
		<pubDate>Sun, 18 Dec 2011 20:54:20 +0000</pubDate>
		<dc:creator>Beth</dc:creator>
				<category><![CDATA[Drawing]]></category>
		<category><![CDATA[Knitting]]></category>

		<guid isPermaLink="false">http://bethmcmillan.com/blog/?p=421</guid>
		<description><![CDATA[Over the course of the last couple of weeks, I&#8217;ve spent a lot of time on trains. Apart from reading, naturally I have also been knitting. These little Christmas stockings are from my own pattern. I&#8217;ve been knitting them for a couple of years, and I seem to change the pattern each time I make [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><img class="aligncenter" title="Tiny knitted stocking" src="http://bethmcmillan.com/blog/images/tinystocking.png" alt="" width="400" /></p>
<p style="text-align: left;">Over the course of the last couple of weeks, I&#8217;ve spent a lot of time on trains. Apart from reading, naturally I have also been knitting. These little Christmas stockings are from my own pattern. I&#8217;ve been knitting them for a couple of years, and I seem to change the pattern each time I make them. The pattern below requires stocking stitch and short rows, using two straight needles. I have been working on one version in the round, but it still needs a bit of tweaking.</p>
<p style="text-align: center;"><img class="aligncenter" title="Knitted chain decoration" src="http://bethmcmillan.com/blog/images/xmaschain.png" alt="" width="400" /></p>
<p style="text-align: left;">The knitted &#8220;paper&#8221; chain is a nice, easy thing to knit in front of the TV. My amazing friend <a title="Unravelled" href="http://unravelcat.wordpress.com/">Astrid</a> showed me how to make them when I last visited her (in between feeding me lots and lots of food, introducing me to lovely people and beating me at Lego Rock Band). Essentially you cast on 30 stitches, knit four (or six, if you fancy) rows in garter stitch, bind off, and sew the ends together.</p>
<p style="text-align: left;">Apart from knitting, I&#8217;ve been reading <em>In Defense of Food: An Eater&#8217;s Manifesto</em>, which I have reviewed briefly <a title="Haiku Review" href="http://bethmcmillan.com/blog/?page_id=33">here</a>, writing some cool programs, making <a title="Nigella's involtini recipe" href="http://clivias.blogspot.com/2008/01/nigellas-involtini.html">aubergine involtini</a> (thanks, Nigella!), getting into Oxford for a PhD in Systems Biology next year, and doodling polar bears. I know, right? Polar bears are awesome. Now I will leave you only with my extremely classy electronic Christmas card.</p>
<p style="text-align: center;"><img class="aligncenter" title="Happy Holidays!" src="http://bethmcmillan.com/blog/images/santano.gif" alt="" width="250" height="400" /></p>
<p><span id="more-421"></span></p>
<p>If for some reason you need a higher resolution picture of a blood-soaked polar bear, <a href="http://bethmcmillan.com/blog/images/polarbears.png">here is one</a>. I won&#8217;t judge you.</p>
<p><strong>Tiny Stockings</strong></p>
<p>I used Double Knitting weight yarn and 2.5mm needles.</p>
<p><span style="text-decoration: underline;">Abbreviations: </span><br />
CC: contrasting colour<br />
MC: main colour<br />
sl p-wise: slip stitches across the needles as if to purl<br />
wrap and turn: wrap the yarn around one stitch and turn the work. There&#8217;s a great video tutorial on <a href="http://www.knittinghelp.com/video/play/short-rows">Knitting Help</a>.</p>
<p><span style="text-decoration: underline;">Pattern:<br />
</span>Cast on 16 stitches in CC<br />
Row 1 &#8211; 11: stocking stitch in MC<br />
Row 12: K4 in CC, wrap and turn<br />
Row 13: P in CC to end<br />
Row 14: K3 in CC, wrap and turn<br />
Row 15: P in CC to end<br />
Row 16: K2 in CC, wrap and turn<br />
Row 17: P in CC to end<br />
Row 18: K4 in CC, K8 in MC, sl4 p-wise<br />
Row 19: P4 in CC, wrap and turn<br />
Row 20: K in CC to end<br />
Row 21: P3 in CC, wrap and turn<br />
Row 22: K in CC to end<br />
Row 23: P2 in CC, wrap and turn<br />
Row 24: K in CC to end<br />
Row 25-30: stocking stitch in MC<br />
Row 31: P all stitches in CC<br />
Row 32: K2tog to end in CC (8 stitches remain)<br />
Row 33: P all stitches in CC<br />
Row 34: K2tog to end in CC (4 stitches remain)<br />
Row 35: P2tog to end in CC (2 stitches remain)<br />
Row 36: K2tog in CC, bind off.</p>
<p>Seam up the back of the stocking using waste yarn.</p>
]]></content:encoded>
			<wfw:commentRss>http://bethmcmillan.com/blog/?feed=rss2&#038;p=421</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lately I&#8217;ve been&#8230;</title>
		<link>http://bethmcmillan.com/blog/?p=398</link>
		<comments>http://bethmcmillan.com/blog/?p=398#comments</comments>
		<pubDate>Sun, 04 Dec 2011 22:09:38 +0000</pubDate>
		<dc:creator>Beth</dc:creator>
				<category><![CDATA[Cooking]]></category>
		<category><![CDATA[Geeking]]></category>
		<category><![CDATA[Knitting]]></category>

		<guid isPermaLink="false">http://bethmcmillan.com/blog/?p=398</guid>
		<description><![CDATA[&#8230;reading The Tao of Pooh and the Te of Piglet by Benjamin Hoff. I thought it might be a pretty interesting read &#8211; what better way to learn about a religion than through irreverent Winnie the Pooh quotes? Well, I&#8217;ve been enjoying the quotes immensely, but so far the book itself hasn&#8217;t impressed me in the [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft" style="margin: 5px;" src="http://t0.gstatic.com/images?q=tbn:ANd9GcRHZupjlZdtZJ6fWG9NJGp4kp2Q1MBdzC6ZdI8YM4CpNLFjQIbpXg" alt="Front cover of The Tao of Pooh and the Te of Piglet" width="150" height="240" align="left" /><strong>&#8230;reading </strong><em>The Tao of Pooh and the Te of Piglet </em>by Benjamin Hoff. I thought it might be a pretty interesting read &#8211; what better way to learn about a religion than through irreverent <em>Winnie the Pooh</em> quotes? Well, I&#8217;ve been enjoying the quotes immensely, but so far the book itself hasn&#8217;t impressed me in the slightest. It&#8217;s full of snide remarks about &#8220;dessicated scientists&#8221; and basically makes the point that you can&#8217;t understand the natural world unless you <em>completely avoid studying it in depth</em>. The idea that further knowledge about a thing makes it less beautiful is truly abhorrent to me as a scientist&#8230; and as a human being.</p>
<p><strong>&#8230;not so much reading as flipping through</strong> <em>Cooking For Geeks</em> by Jeff Potter &#8211; which, in contrast, is a wonderful book that completely demystifies all of the processes that we use in the kitchen.</p>
<p><strong>&#8230;listening to</strong> podcasts of Marcus du Sautoy&#8217;s Radio 4 series, <a title="Mathematical history podcast series" href="http://www.bbc.co.uk/podcasts/series/maths">A Brief History of Mathematics</a>. He very approachably describes the key ideas in the history of maths, and the people who came up with them (or discovered them, I suppose, depending on your viewpoint). They&#8217;ve come in handy while I&#8217;ve been&#8230;</p>
<p><strong>&#8230;running</strong> the <a title="Gradual running program from the NHS" href="http://www.nhs.uk/livewell/c25k/Pages/couch-to-5k.aspx">Couch to 5k Program</a> for the last three months or so. I&#8217;m only at the end of Week 7 of the schedule (I&#8217;ve had to repeat a lot of days!) but I&#8217;ve ran further and longer than I ever have before, and I feel great!</p>
<p><strong>&#8230;programming</strong> some bioinformatics applications in Python. One which converts an amino acid&#8217;s pKa to the fraction which will be protonated at a range of pHs (<a href="http://bethmcmillan.com/geek/python/pkatofprot.py">source code</a>), one which uses a whole protein sequence to find the pH at which it will have zero charge (<a href="http://bethmcmillan.com/geek/python/sequencetopi.py">source code</a>) and, most recently, taking biological data from several databases and collating them into linked HTML pages (<a href="http://bethmcmillan.com/geek/python/task2program.py">source code</a> and <a href="http://bethmcmillan.com/geek/python/task2module.py">essential module</a>). The programming lessons section of my degree has been fantastic, I&#8217;m quite sad that it&#8217;s nearly over.</p>
<p><strong>&#8230;knitting </strong>Christmas decorations for my house and <strong>making</strong> some homemade Christmas presents. But let&#8217;s not spoil the surprise <img src='http://bethmcmillan.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://bethmcmillan.com/blog/?feed=rss2&#038;p=398</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Awk! Awk! Awk!</title>
		<link>http://bethmcmillan.com/blog/?p=381</link>
		<comments>http://bethmcmillan.com/blog/?p=381#comments</comments>
		<pubDate>Sat, 15 Oct 2011 10:00:00 +0000</pubDate>
		<dc:creator>Beth</dc:creator>
				<category><![CDATA[Geeking]]></category>
		<category><![CDATA[awk]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[regex]]></category>
		<category><![CDATA[regular expressions]]></category>
		<category><![CDATA[text manipulation]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://bethmcmillan.com/blog/?p=381</guid>
		<description><![CDATA[This week in between lots of Python and maths and things, I have been learning about awk. Awk is a programming language for doing stuff to text files that consist of columns of data. You can use awk at the command line. awk &#8216;&#60;condition&#62; {&#60;command&#62;}&#8217; ./&#60;filename&#62; will execute &#60;command&#62; on lines in the file called &#60;filename&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>This week in between lots of Python and maths and things, I have been learning about awk. Awk is a programming language for doing stuff to text files that consist of columns of data. You can use awk at the command line.</p>
<p>awk &#8216;&lt;condition&gt; {&lt;command&gt;}&#8217; ./&lt;filename&gt;</p>
<p>will execute &lt;command&gt; on lines in the file called &lt;filename&gt; that meet &lt;condition&gt;. So if you want to print out all the lines that contain the word &#8220;banana&#8221;, you would type</p>
<p>awk &#8216;/banana/ {print $0}&#8217; ./&lt;filename&gt;</p>
<p>Enclosing &#8220;banana&#8221; in / asks awk to search for it. Awk uses dollar symbols to refer to columns. $1 is the first column, $2 the second, and so on. $0 refers to the entire line.</p>
<p>awk &#8216;$1 == &#8220;10&#8243;{print $2}&#8217; ./&lt;filename&gt;</p>
<p>will print out the second column of all the lines on which the first column says &#8220;10&#8243;</p>
]]></content:encoded>
			<wfw:commentRss>http://bethmcmillan.com/blog/?feed=rss2&#038;p=381</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My first ever C program!</title>
		<link>http://bethmcmillan.com/blog/?p=356</link>
		<comments>http://bethmcmillan.com/blog/?p=356#comments</comments>
		<pubDate>Mon, 05 Sep 2011 15:07:13 +0000</pubDate>
		<dc:creator>Beth</dc:creator>
				<category><![CDATA[Geeking]]></category>
		<category><![CDATA[arrays]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[Erastothenes]]></category>
		<category><![CDATA[K&R]]></category>
		<category><![CDATA[Kernighan and Ritchie]]></category>
		<category><![CDATA[math]]></category>
		<category><![CDATA[maths]]></category>
		<category><![CDATA[prime numbers]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[Sieve of Erastothenes]]></category>

		<guid isPermaLink="false">http://bethmcmillan.com/blog/?p=356</guid>
		<description><![CDATA[Well, the first one that wasn&#8217;t an exercise from Kernighan and Ritchie, anyway. I have made an implementation of the Sieve of Erastothenes, which is a way of finding prime numbers. (Wikipedia has a good explanation, and an animation!) I am rather proud of myself. The source code is here and the executable is here. [...]]]></description>
			<content:encoded><![CDATA[<p>Well, the first one that wasn&#8217;t an exercise from Kernighan and Ritchie, anyway. I have made an implementation of the Sieve of Erastothenes, which is a way of finding prime numbers. (<a href="http://en.wikipedia.org/wiki/Sieve_of_Erastothenes">Wikipedia</a> has a good explanation, and an animation!)</p>
<p>I am rather proud of myself. The source code is <a href="http://bethmcmillan.com/geek/c/sieve.c">here</a> and the executable is <a href="http://bethmcmillan.com/geek/c/sieve">here</a>. If you run it at the command line, type in a number and then press enter, it will tell you all the prime numbers that are smaller than your number.</p>
<p>My next post will be more about hearts, unless I write any cool programs before then.</p>
]]></content:encoded>
			<wfw:commentRss>http://bethmcmillan.com/blog/?feed=rss2&#038;p=356</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How does your heart beat?</title>
		<link>http://bethmcmillan.com/blog/?p=302</link>
		<comments>http://bethmcmillan.com/blog/?p=302#comments</comments>
		<pubDate>Wed, 31 Aug 2011 11:38:46 +0000</pubDate>
		<dc:creator>Beth</dc:creator>
				<category><![CDATA[Science]]></category>
		<category><![CDATA[Alexander Quinn]]></category>
		<category><![CDATA[anatomy]]></category>
		<category><![CDATA[biochemistry]]></category>
		<category><![CDATA[biology]]></category>
		<category><![CDATA[cardiac electrophysiology]]></category>
		<category><![CDATA[cardiac science]]></category>
		<category><![CDATA[Denis Noble]]></category>
		<category><![CDATA[electrophysiology]]></category>
		<category><![CDATA[heart]]></category>
		<category><![CDATA[heartbeat]]></category>
		<category><![CDATA[ion channels]]></category>
		<category><![CDATA[modelling]]></category>
		<category><![CDATA[Peter Kohl]]></category>
		<category><![CDATA[physiology]]></category>
		<category><![CDATA[systems biology]]></category>

		<guid isPermaLink="false">http://bethmcmillan.com/blog/?p=302</guid>
		<description><![CDATA[This is a post about some things I learned this summer while I was interning in the mechano-electric feedback lab at the University of Oxford, working with computer models of hearts. A heart removed from the body can be kept beating on its own for up to five hours, if you keep it in a [...]]]></description>
			<content:encoded><![CDATA[<p>This is a post about some things I learned this summer while I was interning in the mechano-electric feedback lab at the University of Oxford, working with computer models of hearts.</p>
<p>A heart removed from the body can be kept beating on its own for up to five hours, if you keep it in a fluid that contains the right dissolved ions and gases. The speed of your heartbeat can be increased or decreased by the nervous system, but creation of the beat is intrinsic to the heart itself.</p>
<p>Heartbeat starts as a rhythmic electrical impulse in a cluster of specialised cells. It&#8217;s then conducted through the heart, causing the muscle cells to contract at specific times.</p>
<p><strong>The chambers and vessels of the heart</strong><br />
<img src="http://bethmcmillan.com/geek/heart-talk/Heart_labelled_large.png" alt="Labelled diagram of the heart" /><br />
<small>Image from <a href="http://en.wikipedia.org/wiki/Portal:Human_Body/Cardiovascular_System">Wikipedia</a></small></p>
<p>Each beat of the heart progresses through several stages in sequence. First, when the heart is completely relaxed, the atria are at a lower pressure than the pulmonary vein and the superior vena cava. This pressure difference causes blood to flow into the atria. Then as the atria fill and the pressure inside increases, the mitral and tricuspid valves open, allowing blood to start flowing into the ventricles. Then the muscular walls of the atria contract, forcing more blood into the ventricles. </p>
<p>As the pressure inside the ventricles increases, the mitral and tricuspid valves close &#8211; isolating the ventricles from the atria &#8211; and the aortic and pulmonary valves open. The ventricles then contract, forcing blood out of the heart. The blood from the right side of the heart goes via the pulmonary artery to the lungs, and the blood from the left side of the heart goes to the rest of the body through the aorta.</p>
<p><strong>Animation of conduction through the heart</strong><br />
<img src="http://bethmcmillan.com/geek/heart-talk/3colors.gif" alt="Animation of electrical conduction through the heart" /><br />
<small>Adapted from Wikipedia</small></p>
<p>The sinoatrial (SA) node is where the electrical signal is created. The impulse is then conducted through the working cells of both atria, inducing them to contract. The signal then passes slowly through the atrioventricular (AV) node, down through the bundle of His and the right and left bundle branches, then up across the purkinje network, and finally through the working ventricle cells. The ventricles then contract from the bottom upwards, and then the heart relaxes until the next beat.</p>
<p>The speed and route that the impulse takes to pass through the heart are very important for proper functioning of the heart. This, and the creation of the beat, are emergent properties of the voltage-gated ion channel systems in heart cell membranes. </p>
<p><small>Reference: <em>Human Physiology &#8211; From Cells to Systems </em>by Lauralee Sherwood (5th Ed) ISBN 0534395015, p.303-330</small></p>
]]></content:encoded>
			<wfw:commentRss>http://bethmcmillan.com/blog/?feed=rss2&#038;p=302</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

