<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Programming on Constantin Orasan&#39;s website</title>
    <link>https://dinel.org.uk/categories/programming/</link>
    <description>Recent content in Programming on Constantin Orasan&#39;s website</description>
    <generator>Hugo</generator>
    <language>en</language>
    <copyright>© 2026 CONSTANTIN ORASAN&lt;br&gt;Build:20260405</copyright>
    <lastBuildDate>Sun, 24 Sep 2023 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://dinel.org.uk/categories/programming/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Get the petrol prices from ASDA</title>
      <link>https://dinel.org.uk/2023/09/24/Get-the-petrol-prices-from-ASDA/</link>
      <pubDate>Sun, 24 Sep 2023 00:00:00 +0000</pubDate>
      <guid>https://dinel.org.uk/2023/09/24/Get-the-petrol-prices-from-ASDA/</guid>
      <description>&lt;p&gt;This year, &lt;a href=&#34;https://www.bbc.co.uk/news/business-66214934&#34; target=&#34;_blank&#34;&gt;the UK government encouraged supermarkets to display their fuel prices&lt;/a&gt;. The scheme is voluntary, and so far only ASDA has started displaying prices on its website. Since fuel prices vary from place to place, you must visit each supermarket&amp;rsquo;s website to find the best prices near you. To make this process easier, I wrote the following Python script:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#080;font-style:italic&#34;&gt;# import the necessary modules&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;import&lt;/span&gt; &lt;span style=&#34;color:#00f;font-weight:bold&#34;&gt;requests&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;from&lt;/span&gt; &lt;span style=&#34;color:#00f;font-weight:bold&#34;&gt;bs4&lt;/span&gt; &lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;import&lt;/span&gt; BeautifulSoup&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#080;font-style:italic&#34;&gt;# specify the stores from which to retrieve the prices. &lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#080;font-style:italic&#34;&gt;# For each store there is tuple (&amp;#34;Name&amp;#34;, &amp;#34;URL&amp;#34;)&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;urls &lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt; [&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        (&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;Sheerwater&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;https://storelocator.asda.com/south-east/woking/forsyth-road-sheerwater&amp;#34;&lt;/span&gt;),&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        (&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;Staines&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;https://storelocator.asda.com/south-east/staines/chertsey-lane-egham-hythe&amp;#34;&lt;/span&gt;),&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        (&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;Fareham&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;https://storelocator.asda.com/south-east/fareham/speedfields-park-newgate-lane&amp;#34;&lt;/span&gt;),&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;       ]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#080;font-style:italic&#34;&gt;# retrieve the prices for each place&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;for&lt;/span&gt; place, page_url &lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;in&lt;/span&gt; urls:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    page &lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt; BeautifulSoup(requests&lt;span style=&#34;color:#666&#34;&gt;.&lt;/span&gt;get(page_url)&lt;span style=&#34;color:#666&#34;&gt;.&lt;/span&gt;text, &lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;html.parser&amp;#34;&lt;/span&gt;)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    postcode &lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt; page&lt;span style=&#34;color:#666&#34;&gt;.&lt;/span&gt;find(&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;span&amp;#34;&lt;/span&gt;, {&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;class&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;c-address-postal-code&amp;#34;&lt;/span&gt;})&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    petrol_prices &lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt; page&lt;span style=&#34;color:#666&#34;&gt;.&lt;/span&gt;find_all(&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;div&amp;#34;&lt;/span&gt;, {&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;class&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;Service-fuelCategory&amp;#34;&lt;/span&gt;})&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a2f&#34;&gt;print&lt;/span&gt;(&lt;span style=&#34;color:#b44&#34;&gt;f&lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#b68;font-weight:bold&#34;&gt;{&lt;/span&gt;place&lt;span style=&#34;color:#b68;font-weight:bold&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt; (Postcode: &lt;/span&gt;&lt;span style=&#34;color:#b68;font-weight:bold&#34;&gt;{&lt;/span&gt;postcode&lt;span style=&#34;color:#666&#34;&gt;.&lt;/span&gt;text&lt;span style=&#34;color:#b68;font-weight:bold&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;)&amp;#34;&lt;/span&gt;)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;for&lt;/span&gt; petrol_price &lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;in&lt;/span&gt; petrol_prices:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        divs_petrol_price &lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt; petrol_price&lt;span style=&#34;color:#666&#34;&gt;.&lt;/span&gt;find_all(&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;div&amp;#34;&lt;/span&gt;)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#a2f&#34;&gt;print&lt;/span&gt;(&lt;span style=&#34;color:#b44&#34;&gt;f&lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\t&lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b68;font-weight:bold&#34;&gt;{&lt;/span&gt;divs_petrol_price[&lt;span style=&#34;color:#666&#34;&gt;0&lt;/span&gt;]&lt;span style=&#34;color:#666&#34;&gt;.&lt;/span&gt;text&lt;span style=&#34;color:#b68;font-weight:bold&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b68;font-weight:bold&#34;&gt;{&lt;/span&gt;divs_petrol_price[&lt;span style=&#34;color:#666&#34;&gt;1&lt;/span&gt;]&lt;span style=&#34;color:#666&#34;&gt;.&lt;/span&gt;text&lt;span style=&#34;color:#b68;font-weight:bold&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;&lt;/span&gt;)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a2f&#34;&gt;print&lt;/span&gt;()&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Below is the output of the script on 24 Sept 2023:&lt;/p&gt;</description>
    </item>
    <item>
      <title>How to add abstracts to your bibliography</title>
      <link>https://dinel.org.uk/2021/03/23/How-to-add-abstracts-to-your-bibliography/</link>
      <pubDate>Tue, 23 Mar 2021 00:00:00 +0000</pubDate>
      <guid>https://dinel.org.uk/2021/03/23/How-to-add-abstracts-to-your-bibliography/</guid>
      <description>&lt;h1 id=&#34;how-to-add-abstracts-to-your-bibliography&#34;&gt;How to add abstracts to your bibliography&lt;/h1&gt;&#xA;&lt;p&gt;I am a big fan of the &lt;a href=&#34;https://wordpress.org/plugins/mendeleyplugin/&#34;&gt;WP Mendeley&lt;/a&gt; and I have been using it for quite a long time. I use Mendeley to maintain my bibliography anyway, so having an automatic way to display various sets of publications in WordPress is a bonus. One of the features that I missed is the option to display the abstract of papers. This is not available out of the box, but it’s not too difficult to achieve. Here are the steps that I had to take in order to allow visitors to display the abstracts of my papers.&lt;/p&gt;</description>
    </item>
    <item>
      <title>How to add definition lists to WordPress</title>
      <link>https://dinel.org.uk/2018/08/23/How-to-add-definition-lists-to-WordPress/</link>
      <pubDate>Thu, 23 Aug 2018 00:00:00 +0000</pubDate>
      <guid>https://dinel.org.uk/2018/08/23/How-to-add-definition-lists-to-WordPress/</guid>
      <description>&lt;style&gt;&#xA;&#x9;p.def-list strong {&#xA;&#x9;display: inline-block;&#xA;&#x9;float: left;&#xA;&#x9;margin-left: -7em;&#xA;}&#xA;&#xA;p.def-list{&#xA;&#x9;display: inline-block;&#xA;&#x9;float: right;&#xA;&#x9;padding-left: 7em;&#xA;}&#xA;&lt;/style&gt;&#xA;&lt;p&gt;The other day I wanted to format the text in a post in WordPress using a definition list-like structure. Basically I wanted something like this:&lt;/p&gt;&#xA;&lt;p class=&#34;def-list&#34;&gt;&lt;strong&gt;May 2018&lt;/strong&gt; Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.&lt;/p&gt;</description>
    </item>
    <item>
      <title>What happens if you set the position of an invisible div</title>
      <link>https://dinel.org.uk/2018/03/14/What-happens-if-you-set-the-position-of-an-invisible-div/</link>
      <pubDate>Wed, 14 Mar 2018 00:00:00 +0000</pubDate>
      <guid>https://dinel.org.uk/2018/03/14/What-happens-if-you-set-the-position-of-an-invisible-div/</guid>
      <description>&lt;p&gt;The other day I wanted to allow users of the &lt;a href=&#34;https://dinel.org.uk/research/projects/metadiscourse-annotator/&#34;&gt;metadiscourse annotator&lt;/a&gt; to quickly locate in text the marker they tag.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
