Jekyll2024-01-03T10:23:47+00:00/blog//Linux, GTD, and sweet, sweet music …Musings on linux, GTD and life in general ....Pete Phillipspete@philfam.co.ukWhy are my dollar bills rejected in Vietnam/Cambodia ?2024-01-03T00:00:00+00:002024-01-03T00:00:00+00:00/blog/2024/01/dollar-bills-in-vietnam-cambodia<p>On a recent trip to Vietnam and Cambodia (Nov/Dec 2023) we had a few problems
with changing our dollars.</p>
<p>On our first day in Hanoi, we went to pay our guide, and he rejected about 25% of the dollar bills we
attempted to give him, saying they were too old, or that they were marked (one
$50 bill had a red pen mark on it) or too crumpled. As far as we could tell, any
dollars that were well used (so very crumpled), had a stain or mark, or were
old (2003 series notes or older) were rejected. People would finger the bill,
checking it to see how new or smooth it felt. If they were unhappy they handed
it back, shaking their head.</p>
<p>Later that day we went to the bank to change dollars to Vietnamese Dong and they also rejected the same bills our guide rejected.</p>
<p>In some places the shops and restaurants seemed less picky, but it feels like a
lottery. I asked our guide how he determined which ones were acceptable or not and he said ‘experience’ - he is starting to understand which bills
businesses and banks will accept or reject, but he doesn’t really understand
what is going on. He thinks that this ‘pickiness’ with dollars is new since the
pandemic (I’m not convinced - see below). Some of the dollars which were rejected were currency we took out from a UK bank a week before the trip.</p>
<p>In Phnom Penh, one of our party took dollars out from an ATM, and was given a $100 bill by the ATM with a
slight stain on it, which was rejected the next day at the ticket office for
the Killing Fields. Oddly, the same bill was accepted at the genocide museum in
Phnom Penh a few hours later, so there is a lot of inconsistency about this.</p>
<p>If you look around on the internet there are various explanations - possibly
<a href="https://www.quora.com/Why-do-Southeasrt-Asian-countries-such-as-Cambodia-and-Laos-accept-US-dollars-but-require-the-bills-to-be-absolutely-pristine-The-slightest-mark-or-tear-and-they-ll-refuse-to-accept-them-Even-at-immigration-to-pay">this Quora article is most helpful</a>. Among the reasons given are:</p>
<ul>
<li><em>banks don’t want to undertake the task of the exchange of the damaged bank notes;</em></li>
<li><em>in Cambodia and Laos there are no U.S. Federal Reserve branches where banks can exchange damaged U.S. bills for new ones, and they won’t accept a bill they would not hand out to another customer;</em></li>
<li><em>one of the tricks used to pass counterfeit bills is to make them look worn so that the difference in texture cannot be readily felt or seen</em>, so they reject these just in case;</li>
<li><em>Cambodia is in the middle of a de-dollarization campaign, and small US notes are being phased out of circulation;</em></li>
<li><a href="https://www.tripadvisor.com/ShowTopic-g293939-i9162-k4999879-USA_money_in_Cambodia_Vietnam_why_all_the_fuss-Cambodia.html">Trip Advisor post - #8 in this thread</a>: <em>“Despite what others have posted you will quickly find out about notes and their acceptability. “Old” notes as in aged and old series, “small head” notes are those given first to tourists as change as a means of disposing of them as “old” small head series notes are where the majority of forgeries are to be found as many tourists find out on their return home on cashing in of notes gained overseas. As a store of wealth, Khmers merchants and individuals only want New Series, Large Head notes and in best possible condition.”</em></li>
</ul>
<p><strong>It would therefore seem sensible to specifically ask your bank for only new notes when you take dollars out for a trip to Vietnam or Cambodia.</strong></p>Pete Phillipspete@philfam.co.ukOn a recent trip to Vietnam and Cambodia (Nov/Dec 2023) we had a few problems
with changing our dollars.Timeout waiting for PADO packets2020-08-06T00:00:00+01:002020-08-06T00:00:00+01:00/blog/2020/08/Timeout-waiting-for-PADO-packets<p>Last Friday, at 22:50, our broadband dropped out.</p>
<p>We are with Plusnet, with an FTTC connection. I have an Asus RT-AC68U router
running pretty up to date Merlin firmware. Nothing odd about the setup - pretty
vanilla.</p>
<p>I tried the usual - power cycling the router and the BT Openreach modem.
Nothing.</p>
<p>I left it overnight in case there was a fault at BT or Plusnet’s end which was
being worked on, but on Saturday morning no change - we were still without
broadband.</p>
<p>I logged a call with Plusnet and they said that there was a handshake issue -
the authentication was not completing. We checked my authentication details and
they were all correct. The Plusnet guy (very helpful and technically adept)
said that he could see the connection was up between my router, the modem and
through to the ISP, but the connection wasn’t authenticating.</p>
<p>We discussed my router and I noted that I was behind by
one update, so we agreed I would update that (using my 4G tethering).</p>
<p>I did this but it made no difference. However I decided to look at the router
log (should have done this before!) and saw a series of messages:</p>
<div class="highlighter-rouge"><pre class="highlight"><code>Timeout waiting for PADO packets
</code></pre>
</div>
<p>I also tried using a little tp-link nano router, and whilst that didn’t connect
either, the log messages said:</p>
<div class="highlighter-rouge"><pre class="highlight"><code>PPPoE: Manually dialing.
PPPoE: Sending PADI.
PPPoE: Sending PADI.
PPPoE: Sending PADI.
PPPoE: Sending PADI.
Failed to connect to ISP server, maybe WAN port cable is unplugged.
PPPOE: request timeout.
</code></pre>
</div>
<p>(Note that I had changed the ethernet cable as well just in case!)</p>
<p>Consensus on the net seemed to be that “Timeout waiting for PADO packets” is an
ISP issue rather than a router/modem issue. The fact that two different
routers give the same types of error seems to confirm that.</p>
<p>I found some messages on the Plusnet forums where it appeared that the solution
was to reset the connection at the ISP end (or at the BT Openreach end) because
“a previous PPPoE session hasn’t been cleared down properly by the disconnect”.</p>
<p>I discussed these in another call with Plusnet and they said they would run a</p>
<div class="highlighter-rouge"><pre class="highlight"><code>soft cease and reprovide
</code></pre>
</div>
<p>but that made no difference either. Eventually Plusnet said they would need to
get a BT Openreach engineer out.</p>
<p>As it was a bank holiday w/e the engineer didn’t come until Thu AM, but within
30 minutes was pretty certain the problem was at the cabinet in the high
street. She said that she had had a number of similar problems with failures of
the ports/cards in this area recently, and that it sounded like a card failure.
She said she was pretty confident she could fix it by getting the card replaced
(I think by swapping at the cabinet but not certain). 50 minutes later we were
back up and running.</p>
<p>There were not too many posts around dealing with this particular error message
and certainly my issue was due to a hardware failure at the cabinet, so I though this
may be useful for someone else in future.</p>Pete Phillipspete@philfam.co.ukLast Friday, at 22:50, our broadband dropped out.Replacing my Asus Zenbook UX21A battery2019-12-29T00:00:00+00:002019-12-29T00:00:00+00:00/blog/2019/12/Asus-Zenbook-UX21A-replacement-battery<p><em>(This review was originally posted to Amazon as my review of the Green Cell C23-UX21 replacement battery was rejected by Amazon. Possibly because I used the word knackered ?
Anyway, this was the review….. hope someone finds this useful.)</em></p>
<p><img src="/blog/assets/images/Tech/asus-ux21a.jpg" alt="Asus Zenbook UX21A" /></p>
<p>My 6 year old Zenbook’s battery was completely knackered by Spring of 2019 (I
would get less than 5 minutes once it was unplugged from the charger), and so I
bit the bullet and bought a <a href="https://starlabs.systems/pages/star-labtop">Star LabTop MkIII</a> (which I am very happy with
by the way).</p>
<p>However, it did irk me that one of the most beautiful laptops I had ever owned
was sitting in my study gathering dust. A few months back, on a holiday where I was attempting to
edit photos on the go (using a tablet and phone), I wondered if I could
resurrect the battery and take the old laptop with me.</p>
<p>I found an <a href="https://www.ifixit.com/Guide/Asus+Zenbook+UX21e+Battery+Replacement/108478">iFixIt article</a>
which explained how to replace the battery in a UX21E, and
<a href="https://www.notebookcheck.net/Review-Asus-Zenbook-Prime-UX21A-Ultrabook.83574.0.html">another article</a>
which explained that the UX21E and UX21A were identically constructed. On the
basis of that I ordered the <a href="https://greencell.global/en/asus/967-green-cell-laptop-battery-c23-ux21-for-asus-zenbook-ux21-ux21a-ux21e.html">Green Cell C23-UX21 Laptop
Battery</a>.</p>
<p>You will need:</p>
<ul>
<li>iFixit Opening Tools (or cocktail sticks which I used);</li>
<li>Phillips #1 Screwdriver</li>
<li>T4 Torx Screwdriver</li>
</ul>
<p>The iFixIt instructions worked perfectly, and within 30 minutes I had a fully
functioning Zenbook again. I took the opportunity to replace my ageing Ubuntu 18.04
with Linux Mint 19.2 Mate and my sleek laptop is back up and functional, ready
for our next trip abroad.</p>
<p>The Green Cell battery seems to be holding up OK but I haven’t used the laptop
in anger yet. I will update this post once I get some more experience
with it.</p>Pete Phillipspete@philfam.co.uk(This review was originally posted to Amazon as my review of the Green Cell C23-UX21 replacement battery was rejected by Amazon. Possibly because I used the word knackered ?
Anyway, this was the review….. hope someone finds this useful.)Sourdough bread in a breadmaker2018-03-03T00:00:00+00:002019-12-29T08:30:00+00:00/blog/2018/03/sourdough-loaf-in-a-breadmaker<p>I’ve had periods of keeping a sourdough starter going previously, but the
loaves of bread I made were disappointing. The only success I had was making
some sourdough pancakes for breakfast. Part of the problem was that I wasn’t
really taking care of the starter, but also that I use a Panasonic SD 2501
breadmaker to make my doughs and frequently the whole loaf, and frankly I
didn’t really put my heart into the whole sourdough thing. The starter became a
black mulch after a few months and was thrown away.</p>
<p><img src="/blog/assets/images/Cooking/sourdough-loaf.jpg" alt="Sourdough loaf in a Panasonic Breadmaker" /></p>
<p>When Karen did the London Marathon in April 2017, after registering for the
race on the Saturday we had an excellent lunch in a pub in
Greenwich - the <a href="https://www.thegipsymothgreenwich.co.uk">Gypsy Moth</a>.</p>
<p>I had pan fried king prawns and chorizo on toasted sourdough which was
delicious, and made me hanker after sourdough bread again. At the same time I
bought a Roccbox pizza oven, and the facebook group was awash with sourdough
pizza recipes, so I started another culture. My efforts since Summer 2017 on
the sourdough pizza front went well, and so around Xmas time I determined to
try again at making sourdough loaves of bread.</p>
<p>I found a <a href="http://blog.rachelcotterill.com/2014/04/making-sourdough-in-bread-machine.html">terrific
article (now a dead link unfortunately)</a>
by Rachel Cotterill on using a Panasonic Breadmaker and had a go with that. The
first loaf was pretty good, but not risen enough. However, I use a 50% hydration sourdough starter (50%
flour, 50% water) which is easy to maintain but different from Rachel’s, so I tried tweaking her recipe.</p>
<p>After fiddling around, this is what I have ended up with. It has tended to be
very reliable. The following explains what I do when I need a loaf on
Saturday.</p>
<p><strong>Thursday:</strong> The day before I want to make the bread (making it on Friday evening) I will feed the starter in the morning and the evening.</p>
<p><strong>Friday:</strong> The day I will make the bread I feed the starter in the morning, then
at around 18:00. At 20:00, I will make the dough:</p>
<ul>
<li>390g strong white bread flour</li>
<li>170g 50% sourdough starter</li>
<li>6g salt</li>
<li>2tbsp olive oil</li>
<li>1tsp sugar</li>
<li>200g cold water</li>
</ul>
<p>Put everything into the Panasonic breadmaker and then run the dough cycle. On
my Panasonic 2501 this is cycle 22 and takes about 45 minutes.</p>
<p>When the dough cycle completes, set up the French bread cycle (this is all down
to Rachel’s experiments and advice by the way - I take no credit for this)
which on the 2501 machine is cycle 8. This is a 6 hour cycle, but I will use
the timer function on this so that the bread is ready in about 12 hours time
(press the time arrows on the breadmaker to increase 6 hours to 12 hours). Last
thing I do before going to bed is to lightly spray some water around the
breadmaker tin and on top of the dough. I think this reduces the dough
sticking to the sides and giving a misshapen loaf (I could be wrong about that
though!).</p>
<p><strong>Saturday:</strong> 12 hours later on Saturday morning, the breadmaker beeps and a beautiful well-risen sourdough loaf
comes out (see image above). The bread is satisfyingly chewy and flavoursome.</p>
<p>I find that the olive oil gives it a bit more longevity compared to no oil at
all. The bread is great with cheese and meats, and also toasted with savoury
food or with jam/marmalade.</p>
<h2 id="update-oct-2019">UPDATE Oct 2019</h2>
<p>See the post from <a href="https://disqus.com/by/davesternberg/comments/">Dave Sternberg</a> in the comments section
below. His version works really well - so much so that I’ve now changed my own
version to this. So …..</p>
<p><strong>Thursday:</strong> The day before I want to make the bread (making it on Friday evening) I will feed the starter in the morning and the evening.</p>
<p><strong>Friday:</strong> The day I will make the bread I feed the starter in the morning
only (at the moment my starter doesn’t require the 18:00 feed).</p>
<p>Between 18:00-20:00 I will make the dough (Note that there are
two recipes now - one with more starter for a stronger flavour):</p>
<p><em>Version 1</em>:</p>
<ul>
<li>390g strong white bread flour</li>
<li>170g 50% sourdough starter</li>
<li>6g salt</li>
<li>2tbsp olive oil</li>
<li>1tsp sugar</li>
<li>200g cold water</li>
</ul>
<p><em>Version 2 (using more starter for a more pronounced flavour)</em>:</p>
<ul>
<li>365g strong white bread flour</li>
<li>220g 50% sourdough starter</li>
<li>8g salt</li>
<li>2tbsp olive oil</li>
<li>1tsp sugar</li>
<li>175g cold water</li>
</ul>
<p>Put everything into the Panasonic breadmaker and then run the dough cycle. On
my Panasonic 2501 this is cycle 22 and takes about 45 minutes.</p>
<p>Leave the dough for a few hours to rise and then put it onto cycle 22 before
bed, so that it is left overnight after the second cycle completes.</p>
<p>In the morning peek inside to see the bread nicely risen.Then run the Panasonic
Cycle 15 (“Bake only”) for 50 minutes. (Dave uses 45).</p>
<p>Thanks Dave for experimenting and sharing.</p>Pete Phillipspete@philfam.co.ukI’ve had periods of keeping a sourdough starter going previously, but the
loaves of bread I made were disappointing. The only success I had was making
some sourdough pancakes for breakfast. Part of the problem was that I wasn’t
really taking care of the starter, but also that I use a Panasonic SD 2501
breadmaker to make my doughs and frequently the whole loaf, and frankly I
didn’t really put my heart into the whole sourdough thing. The starter became a
black mulch after a few months and was thrown away.Problems with streaming flash on Opera/Linux/Ubuntu - SOLVED2017-12-24T00:00:00+00:002017-12-24T00:00:00+00:00/blog/2017/12/opera-and-streaming-flash<p>I tried to stream the excellent <a href="https://www.porthcawl-lifeboat.co.uk/live-streaming/">Porthcawl RNLI live stream</a> from my ubuntu laptop and
encountered the error message:</p>
<div class="highlighter-rouge"><pre class="highlight"><code>"your browser does not currently recognize any of the video formats available"
</code></pre>
</div>
<p>I found the solution
<a href="https://forums.opera.com/topic/19920/flash-not-working-on-opera-a-summary-on-the-reported-cases/6">here</a>.</p>
<p>This solved it for me (I had to amend the commands slightly to change library
locations):</p>
<ul>
<li>wget https://github.com/iteufel/nwjs-ffmpeg-prebuilt/releases/download/0.20.3/0.20.3-linux-x64.zip</li>
<li>unzip 0.20.3-linux-x64.zip</li>
<li>sudo mv /usr/lib/x86_64-linux-gnu/opera/libffmpeg.so /usr/lib/x86_64-linux-gnu/opera/libffmpeg.so_orig</li>
<li>sudo cp libffmpeg.so /usr/lib/x86_64-linux-gnu/opera/libffmpeg.so</li>
</ul>
<p>Then restart Opera.</p>Pete Phillipspete@philfam.co.ukI tried to stream the excellent Porthcawl RNLI live stream from my ubuntu laptop and
encountered the error message:LibreOffice 5.3.3 and embedded documents2017-05-14T00:00:00+01:002017-05-14T00:00:00+01:00/blog/2017/05/libreoffice-and-embedded-documents<p>As our <a href="https://www.smtl.co.uk/">lab</a> is entirely Ubuntu/Linux (with a
smattering of windows machines for hardware where there is no Linux
alternative), one of my bugbears is going to meetings where the agenda is sent
out as a MS Word file with all of the documents for the meeting embedded in the agenda.</p>
<p>LibreOffice has not been able to open all of the embedded documents reliably in
my experience, which has meant that the only way to access all of the embedded
documents (usually PDF and DOCX files) was to unzip
the Word Agenda file, and then trawl through the debris to work out which file was
which. For example, PDF files would unzip as “word/embeddings/oleObject1.bin”
which meant renaming to include a .pdf suffix. This was a particular problem with PDF files, and as this process doesn’t keep the original names, it was not always
possible to determine which file was related to the appropriate agenda item.</p>
<p>Well this week I saw something on
<a href="http://www.omgubuntu.co.uk/2017/05/libreoffice-5-3-3-released-works-better-microsoft-office-documents">OMGUbuntu</a>
which implied that compatibility with MS office was much improved, so I
downloaded the <a href="https://www.libreoffice.org/download/download/">latest 5.3.3</a>
release.</p>
<p>Whilst the release notes do not mention embedded improvements, it turns out
that some of the documents I received in the last week with embedded PDF files
now work (I’m using Ubuntu 16.04 with LibreOffice 5.3.3) - just double click
on the embedded document and up pops the PDF in evince.</p>
<p>Embedded MS Word files have always been a bit hit or miss for me. There are two
different scenarios I’ve been used to with 5.2.3 and which continue to work
with 5.3.3:</p>
<ul>
<li>Embedded documents which, when I double click, open up in a tiny little
window. The solution to these files is to right click on the attachment
and select “Save Copy as”, then save it.</li>
<li>Other Word type files would usually (not always) open more reliably from a double click.</li>
</ul>
<p>It’s not clear to me what the difference is between these two word formats at the
moment, but at least now there is a way to open all of these formats including
PDF from within libreoffice 5.3.3.</p>Pete Phillipspete@philfam.co.ukAs our lab is entirely Ubuntu/Linux (with a
smattering of windows machines for hardware where there is no Linux
alternative), one of my bugbears is going to meetings where the agenda is sent
out as a MS Word file with all of the documents for the meeting embedded in the agenda.
LibreOffice has not been able to open all of the embedded documents reliably in
my experience, which has meant that the only way to access all of the embedded
documents (usually PDF and DOCX files) was to unzip
the Word Agenda file, and then trawl through the debris to work out which file was
which. For example, PDF files would unzip as “word/embeddings/oleObject1.bin”
which meant renaming to include a .pdf suffix. This was a particular problem with PDF files, and as this process doesn’t keep the original names, it was not always
possible to determine which file was related to the appropriate agenda item.
Well this week I saw something on
OMGUbuntu
which implied that compatibility with MS office was much improved, so I
downloaded the latest 5.3.3
release.
Whilst the release notes do not mention embedded improvements, it turns out
that some of the documents I received in the last week with embedded PDF files
now work (I’m using Ubuntu 16.04 with LibreOffice 5.3.3) - just double click
on the embedded document and up pops the PDF in evince.
Embedded MS Word files have always been a bit hit or miss for me. There are two
different scenarios I’ve been used to with 5.2.3 and which continue to work
with 5.3.3:
Embedded documents which, when I double click, open up in a tiny little
window. The solution to these files is to right click on the attachment
and select “Save Copy as”, then save it.
Other Word type files would usually (not always) open more reliably from a double click.
It’s not clear to me what the difference is between these two word formats at the
moment, but at least now there is a way to open all of these formats including
PDF from within libreoffice 5.3.3.How to switch screens (to external monitor) from USB keyboard.2017-02-01T00:00:00+00:002017-02-01T00:00:00+00:00/blog/2017/02/switching-screens-from-USB-keyboard<p>At work I use a Lenovo X220 and the lenovo docking station, with a Samsung
monitor, and USB mouse & keyboard.</p>
<p>When I dock the laptop I then need to press [Fn] + [F7] until the display comes
up on the external monitor.</p>
<p>My USB keyboard doesn’t have a [Fn] key, but I <a href="http://superuser.com/questions/564057/external-keyboard-does-not-have-fn-i-want-to-switch-screens">found this post</a>
which said [Win] + [P] may help under Windows.</p>
<p>I tried it under Ubuntu (16.04) and it gives the same functionality as pressing the [Fn]+[F7] key.</p>
<p>Saves me having to stretch across to the laptop now.</p>Pete Phillipspete@philfam.co.ukAt work I use a Lenovo X220 and the lenovo docking station, with a Samsung
monitor, and USB mouse & keyboard.
When I dock the laptop I then need to press [Fn] + [F7] until the display comes
up on the external monitor.
My USB keyboard doesn’t have a [Fn] key, but I found this post
which said [Win] + [P] may help under Windows.
I tried it under Ubuntu (16.04) and it gives the same functionality as pressing the [Fn]+[F7] key.
Saves me having to stretch across to the laptop now.Blog posts with rmarkdown on Jekyll with servr and knitr2017-01-09T00:00:00+00:002017-01-09T00:00:00+00:00/blog/2017/01/jekyll-with-knitr<p>So I’m trying to set up my jekyll system to allow me to edit rmarkdown files
and insert them into the jekyll system.</p>
<p><a href="https://yihui.name/knitr-jekyll/2014/09/jekyll-with-knitr.html">This</a> is one
way, but I couldn’t get this to work (too impatient), and in the end I found
<a href="http://www.jonzelner.net/jekyll/knitr/r/2014/07/02/autogen-knitr/">this post</a> with a
neat script which I have edited. My edits are mainly to fix the issue that my
jekyll instance runs in a /blog/ subdirectory, and also to allow rebuilding of
a page by removing the previously generated ../fig/xxx directory from a
previous run of the script. I’m sure that there will be easier ways to
accomplish this (without the hard coding of the /blog) but I’m too much of a
novice with jekyll.</p>
<div class="highlighter-rouge"><pre class="highlight"><code><span class="c1">#!/usr/bin/env Rscript
</span><span class="w">
</span><span class="n">input</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">commandArgs</span><span class="p">(</span><span class="n">trailingOnly</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="kc">TRUE</span><span class="p">)</span><span class="w">
</span><span class="c1">#KnitPost <- function(input, base.url = "/") {
</span><span class="n">KnitPost</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="k">function</span><span class="p">(</span><span class="n">input</span><span class="p">,</span><span class="w"> </span><span class="n">base.url</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s2">"/blog/"</span><span class="p">)</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="n">require</span><span class="p">(</span><span class="n">knitr</span><span class="p">)</span><span class="w">
</span><span class="n">opts_knit</span><span class="o">$</span><span class="n">set</span><span class="p">(</span><span class="n">base.url</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">base.url</span><span class="p">)</span><span class="w">
</span><span class="c1"># fig.path <- paste0("../figs/", sub(".Rmd$", "", basename(input)), "/")
</span><span class="w"> </span><span class="n">fig.path</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">paste0</span><span class="p">(</span><span class="s2">"figs/"</span><span class="p">,</span><span class="w"> </span><span class="n">sub</span><span class="p">(</span><span class="s2">".Rmd$"</span><span class="p">,</span><span class="w"> </span><span class="s2">""</span><span class="p">,</span><span class="w"> </span><span class="n">basename</span><span class="p">(</span><span class="n">input</span><span class="p">)),</span><span class="w"> </span><span class="s2">"/"</span><span class="p">)</span><span class="w">
</span><span class="n">opts_chunk</span><span class="o">$</span><span class="n">set</span><span class="p">(</span><span class="n">fig.path</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">fig.path</span><span class="p">)</span><span class="w">
</span><span class="n">opts_chunk</span><span class="o">$</span><span class="n">set</span><span class="p">(</span><span class="n">fig.cap</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s2">"center"</span><span class="p">)</span><span class="w">
</span><span class="n">render_jekyll</span><span class="p">()</span><span class="w">
</span><span class="n">print</span><span class="p">(</span><span class="n">paste0</span><span class="p">(</span><span class="s2">"../_posts/"</span><span class="p">,</span><span class="w"> </span><span class="n">sub</span><span class="p">(</span><span class="s2">".Rmd$"</span><span class="p">,</span><span class="w"> </span><span class="s2">""</span><span class="p">,</span><span class="w"> </span><span class="n">basename</span><span class="p">(</span><span class="n">input</span><span class="p">)),</span><span class="w"> </span><span class="s2">".mkd"</span><span class="p">))</span><span class="w">
</span><span class="n">knit</span><span class="p">(</span><span class="n">input</span><span class="p">,</span><span class="w"> </span><span class="n">output</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">paste0</span><span class="p">(</span><span class="s2">"../_posts/"</span><span class="p">,</span><span class="w"> </span><span class="n">sub</span><span class="p">(</span><span class="s2">".Rmd$"</span><span class="p">,</span><span class="w"> </span><span class="s2">""</span><span class="p">,</span><span class="w"> </span><span class="n">basename</span><span class="p">(</span><span class="n">input</span><span class="p">)),</span><span class="w"> </span><span class="s2">".mkd"</span><span class="p">),</span><span class="w"> </span><span class="n">envir</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">parent.frame</span><span class="p">())</span><span class="w">
</span><span class="c1"># now move the fig file
# 1 but remove existing directory first
</span><span class="w"> </span><span class="n">rm.command</span><span class="o"><-</span><span class="n">paste0</span><span class="p">(</span><span class="s2">"rm -r "</span><span class="p">,</span><span class="s2">"../figs/"</span><span class="p">,</span><span class="w"> </span><span class="n">sub</span><span class="p">(</span><span class="s2">".Rmd$"</span><span class="p">,</span><span class="w"> </span><span class="s2">""</span><span class="p">,</span><span class="w"> </span><span class="n">basename</span><span class="p">(</span><span class="n">input</span><span class="p">)),</span><span class="w"> </span><span class="s2">"/"</span><span class="p">)</span><span class="w">
</span><span class="c1"># 2 - create a system command to move from the subdir to the parent directory,
</span><span class="w"> </span><span class="n">mv.command</span><span class="o"><-</span><span class="n">paste0</span><span class="p">(</span><span class="s2">"mv "</span><span class="p">,</span><span class="s2">"figs/"</span><span class="p">,</span><span class="w"> </span><span class="n">sub</span><span class="p">(</span><span class="s2">".Rmd$"</span><span class="p">,</span><span class="w"> </span><span class="s2">""</span><span class="p">,</span><span class="w"> </span><span class="n">basename</span><span class="p">(</span><span class="n">input</span><span class="p">)),</span><span class="w"> </span><span class="s2">"/"</span><span class="p">,</span><span class="w"> </span><span class="s2">" ../figs/"</span><span class="p">)</span><span class="w">
</span><span class="c1"># 3 - now run it
</span><span class="w"> </span><span class="n">system</span><span class="p">(</span><span class="n">rm.command</span><span class="p">)</span><span class="w">
</span><span class="n">system</span><span class="p">(</span><span class="n">mv.command</span><span class="p">)</span><span class="w">
</span><span class="p">}</span><span class="w">
</span><span class="n">KnitPost</span><span class="p">(</span><span class="n">input</span><span class="p">)</span><span class="w">
</span></code></pre>
</div>
<p>So let’s try some R…</p>
<figure class="highlight"><pre><code class="language-r" data-lang="r"><span class="n">install.packages</span><span class="p">(</span><span class="nf">c</span><span class="p">(</span><span class="s1">'servr'</span><span class="p">,</span><span class="w"> </span><span class="s1">'knitr'</span><span class="p">),</span><span class="w"> </span><span class="n">repos</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'http://cran.rstudio.com'</span><span class="p">)</span></code></pre></figure>
<h2 id="r-code-chunks">R code chunks</h2>
<p>Following is from <a href="https://yihui.name/knitr-jekyll/2014/09/jekyll-with-knitr.html">here</a></p>
<p>Now we write some R code chunks in this post. For example,</p>
<figure class="highlight"><pre><code class="language-r" data-lang="r"><span class="n">options</span><span class="p">(</span><span class="n">digits</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="m">3</span><span class="p">)</span><span class="w">
</span><span class="n">cat</span><span class="p">(</span><span class="s2">"hello world!"</span><span class="p">)</span></code></pre></figure>
<figure class="highlight"><pre><code class="language-text" data-lang="text">## hello world!</code></pre></figure>
<figure class="highlight"><pre><code class="language-r" data-lang="r"><span class="n">set.seed</span><span class="p">(</span><span class="m">123</span><span class="p">)</span><span class="w">
</span><span class="p">(</span><span class="n">x</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">rnorm</span><span class="p">(</span><span class="m">40</span><span class="p">)</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="m">10</span><span class="p">)</span></code></pre></figure>
<figure class="highlight"><pre><code class="language-text" data-lang="text">## [1] 9.44 9.77 11.56 10.07 10.13 11.72 10.46 8.73 9.31 9.55 11.22
## [12] 10.36 10.40 10.11 9.44 11.79 10.50 8.03 10.70 9.53 8.93 9.78
## [23] 8.97 9.27 9.37 8.31 10.84 10.15 8.86 11.25 10.43 9.70 10.90
## [34] 10.88 10.82 10.69 10.55 9.94 9.69 9.62</code></pre></figure>
<figure class="highlight"><pre><code class="language-r" data-lang="r"><span class="c1"># generate a table
</span><span class="n">knitr</span><span class="o">::</span><span class="n">kable</span><span class="p">(</span><span class="n">head</span><span class="p">(</span><span class="n">mtcars</span><span class="p">))</span></code></pre></figure>
<table>
<thead>
<tr>
<th style="text-align: left"> </th>
<th style="text-align: right">mpg</th>
<th style="text-align: right">cyl</th>
<th style="text-align: right">disp</th>
<th style="text-align: right">hp</th>
<th style="text-align: right">drat</th>
<th style="text-align: right">wt</th>
<th style="text-align: right">qsec</th>
<th style="text-align: right">vs</th>
<th style="text-align: right">am</th>
<th style="text-align: right">gear</th>
<th style="text-align: right">carb</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left">Mazda RX4</td>
<td style="text-align: right">21.0</td>
<td style="text-align: right">6</td>
<td style="text-align: right">160</td>
<td style="text-align: right">110</td>
<td style="text-align: right">3.90</td>
<td style="text-align: right">2.62</td>
<td style="text-align: right">16.5</td>
<td style="text-align: right">0</td>
<td style="text-align: right">1</td>
<td style="text-align: right">4</td>
<td style="text-align: right">4</td>
</tr>
<tr>
<td style="text-align: left">Mazda RX4 Wag</td>
<td style="text-align: right">21.0</td>
<td style="text-align: right">6</td>
<td style="text-align: right">160</td>
<td style="text-align: right">110</td>
<td style="text-align: right">3.90</td>
<td style="text-align: right">2.88</td>
<td style="text-align: right">17.0</td>
<td style="text-align: right">0</td>
<td style="text-align: right">1</td>
<td style="text-align: right">4</td>
<td style="text-align: right">4</td>
</tr>
<tr>
<td style="text-align: left">Datsun 710</td>
<td style="text-align: right">22.8</td>
<td style="text-align: right">4</td>
<td style="text-align: right">108</td>
<td style="text-align: right">93</td>
<td style="text-align: right">3.85</td>
<td style="text-align: right">2.32</td>
<td style="text-align: right">18.6</td>
<td style="text-align: right">1</td>
<td style="text-align: right">1</td>
<td style="text-align: right">4</td>
<td style="text-align: right">1</td>
</tr>
<tr>
<td style="text-align: left">Hornet 4 Drive</td>
<td style="text-align: right">21.4</td>
<td style="text-align: right">6</td>
<td style="text-align: right">258</td>
<td style="text-align: right">110</td>
<td style="text-align: right">3.08</td>
<td style="text-align: right">3.21</td>
<td style="text-align: right">19.4</td>
<td style="text-align: right">1</td>
<td style="text-align: right">0</td>
<td style="text-align: right">3</td>
<td style="text-align: right">1</td>
</tr>
<tr>
<td style="text-align: left">Hornet Sportabout</td>
<td style="text-align: right">18.7</td>
<td style="text-align: right">8</td>
<td style="text-align: right">360</td>
<td style="text-align: right">175</td>
<td style="text-align: right">3.15</td>
<td style="text-align: right">3.44</td>
<td style="text-align: right">17.0</td>
<td style="text-align: right">0</td>
<td style="text-align: right">0</td>
<td style="text-align: right">3</td>
<td style="text-align: right">2</td>
</tr>
<tr>
<td style="text-align: left">Valiant</td>
<td style="text-align: right">18.1</td>
<td style="text-align: right">6</td>
<td style="text-align: right">225</td>
<td style="text-align: right">105</td>
<td style="text-align: right">2.76</td>
<td style="text-align: right">3.46</td>
<td style="text-align: right">20.2</td>
<td style="text-align: right">1</td>
<td style="text-align: right">0</td>
<td style="text-align: right">3</td>
<td style="text-align: right">1</td>
</tr>
</tbody>
</table>
<figure class="highlight"><pre><code class="language-r" data-lang="r"><span class="p">(</span><span class="k">function</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="kc">TRUE</span><span class="p">)</span><span class="w"> </span><span class="m">1</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="m">1</span><span class="w"> </span><span class="c1"># a boring comment
</span><span class="p">})()</span></code></pre></figure>
<figure class="highlight"><pre><code class="language-text" data-lang="text">## [1] 2</code></pre></figure>
<figure class="highlight"><pre><code class="language-r" data-lang="r"><span class="nf">names</span><span class="p">(</span><span class="n">formals</span><span class="p">(</span><span class="n">servr</span><span class="o">::</span><span class="n">jekyll</span><span class="p">))</span><span class="w"> </span><span class="err">#</span><span class="w"> </span><span class="n">arguments</span><span class="w"> </span><span class="n">of</span><span class="w"> </span><span class="n">the</span><span class="w"> </span><span class="n">jekyll</span><span class="p">()</span><span class="w"> </span><span class="k">function</span></code></pre></figure>
<figure class="highlight"><pre><code class="language-text" data-lang="text">## [1] "dir" "input" "output" "script" "serve" "command" "..."</code></pre></figure>
<p>Just to test inline R expressions<sup id="fnref:2"><a href="#fn:2" class="footnote">1</a></sup> in <strong>knitr</strong>, we know the first element in <code class="highlighter-rouge">x</code> (created in the code chunk above) is 9.44. You can certainly draw some graphs as well:</p>
<figure class="highlight"><pre><code class="language-r" data-lang="r"><span class="n">par</span><span class="p">(</span><span class="n">mar</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nf">c</span><span class="p">(</span><span class="m">4</span><span class="p">,</span><span class="w"> </span><span class="m">4</span><span class="p">,</span><span class="w"> </span><span class="m">.1</span><span class="p">,</span><span class="w"> </span><span class="m">.1</span><span class="p">))</span><span class="w">
</span><span class="n">plot</span><span class="p">(</span><span class="n">cars</span><span class="p">,</span><span class="w"> </span><span class="n">pch</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="m">19</span><span class="p">,</span><span class="w"> </span><span class="n">col</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'red'</span><span class="p">)</span><span class="w"> </span><span class="err">#</span><span class="w"> </span><span class="n">a</span><span class="w"> </span><span class="n">scatterplot</span></code></pre></figure>
<p><img src="/blog/figs/2017-01-09-jekyll-with-knitr/cars-1.png" alt="A scatterplot of the cars data" /></p>
<h2 id="other-ways-to-do-this">Other ways to do this</h2>
<p>*
<a href="http://rmarkdown.rstudio.com/rmarkdown_websites.html">http://rmarkdown.rstudio.com/rmarkdown_websites.html</a></p>
<div class="footnotes">
<ol>
<li id="fn:2">
<p>The syntax in R Markdown for inline expressions is <code class="highlighter-rouge">`r code`</code>, where <code class="highlighter-rouge">code</code> is the R expression that you want to evaluate, e.g. <code class="highlighter-rouge">x[1]</code>. <a href="#fnref:2" class="reversefootnote">↩</a></p>
</li>
</ol>
</div>Pete Phillipspete@philfam.co.ukSo I’m trying to set up my jekyll system to allow me to edit rmarkdown files
and insert them into the jekyll system.Aaron and Evan’s Xmas Cards2017-01-01T00:00:00+00:002017-01-01T00:00:00+00:00/blog/2017/01/aaron-evan-cards<p>Had Christmas cards off our Nephews in Portsmouth. I thought they were hand
made but turns out they have been professionally printed with their name and
everything.</p>
<p>Neat.</p>
<p><img src="/blog/assets/images/Family/2016-Evan-Xmas-Card.jpg" alt="Evan's card" /></p>
<p><img src="/blog/assets/images/Family/2016-Aaron-Xmas-Card.jpg" alt="Aaron's card" /></p>Pete Phillipspete@philfam.co.ukHad Christmas cards off our Nephews in Portsmouth. I thought they were hand
made but turns out they have been professionally printed with their name and
everything.
Neat.Welcome to the new jekyll-based blog2017-01-01T00:00:00+00:002017-01-01T00:00:00+00:00/blog/2017/01/new-blog-site<p>This is a new version of the blog on Digital Ocean.</p>
<p>I took the opportunity to move the <a href="http://www.petephillips.me.uk">top level site</a> across at the same time.</p>
<p>It uses Jekyll and the Minimal Mistakes theme.</p>
<p>Enjoy, or at least find something useful.</p>Pete Phillipspete@philfam.co.ukThis is a new version of the blog on Digital Ocean.
I took the opportunity to move the top level site across at the same time.
It uses Jekyll and the Minimal Mistakes theme.
Enjoy, or at least find something useful.