| steps: | |
| - task: UseDotNet@2 | |
| displayName: 'Install .NET Core 6.0.x SDK' | |
| inputs: | |
| version: 6.0.x | |
| performMultiLevelLookup: true |
Monday, 31 January 2022
Updating from .NET Core 3.2 to .NET 6.0
Saturday, 22 January 2022
Running ZEUS Analysis Code
Although I built CERNLib a long time ago, apart from running PAW and looking at some old Ntuples I didn't get round to building my old ZEUS analysis code.
Setup the Environment
Code Changes
.EQ. to .EQV.
Using 1 and 0 for True and False
DFLIB
Makefile
.inc Files
How to run the Analysis code
- Steering cards. This contains a list of cuts made to select the events. Different cards would define different cuts and therefore allow me to analyse systematic errors
- File listing input Data .rz ntuples
- File listing input Background .rz ntuples
- File listing input MonteCarlo .rz ntuples
- stc97_n for the steering cards
- fort.45 for the Data file list
- fort.46 for the Background file list
- fort.47 for the MonteCarlo file list
I should make clear at this point that the files I'm running against are not the "raw" ZEUS datafiles. A preliminary job was run against the full set of data on tape to load a cutdown set of data that passed some loose cuts and create an ntuple with the necessary fields for this particular analysis. My ntuples were saved after this first step.
Results
- Run the PAW macro (kumac) files I used after this analysis step and add to GitHub.
- Run against the full data set. I want to see how quickly this runs on current hardware. To run the full 96/97 data set against all steering cards would take about 20 hours!
- Create a GitHub release to include sample .rz files. Hopefully to allow anyone to run this!
- Try and build the 64bit version of CERNLIB so I don't have to run on a 32bit VM.
Wednesday, 12 January 2022
Adding Azure Pipeline status to GitHub README.md
I noticed in some GitHub projects a build status badge in the README.md display. As I have Azure Pipeline builds setup for two of my projects, CSVComparer and SuperMarketPlanner, I thought it would a good idea to add this.
Handily, there is a REST API interface available for the Azure Pipeline build!
The link for the badge is of the form:
https://dev.azure.com/{Organisation}/{Project}/_apis/build/status/{pipelinename}
For CSVComparer that's:
https://dev.azure.com/jonathanscott80/CSVComparer/_apis/build/status/jscott7.CSVComparer
Then I can add a hyperlink to the badge to navigate to the latest build page when clicked. This is of the form:
https://dev.azure.com/{Organisation}/{Project}/_build/latest?definitionId={id}
Again, for CSVComparer that's:
https://dev.azure.com/jonathanscott80/CSVComparer/_build/latest?definitionId=2
The definitionId is the ID of the Pipeline assigned by Azure. You can find this by navigating through to the Pipeline page via https://dev.azure.com/{Organisation}/
(Useful link for the official docs here : Azure Pipelines documentation | Microsoft Docs)
Finally, to put it all together add this to the README.md file:
[](https://dev.azure.com/jonathanscott80/CSVComparer/_build/latest?definitionId=2)
And clicking on the badge takes us here:
Friday, 12 November 2021
Setting up a new Laptop (2021 Edition)
It's been 6 years since I last setup a dual booting laptop. That particular machine is starting to show its age now, particularly with a spinning disk hard-drive.
Before doing anything I created a Recovery USB. Search Recovery Drive on the task bar to open Recovery Media Creator. I followed the instructions to setup a recovery drive on a 32GB USB drive.
The new machine has a 1TB SSD and I wanted to really keep as much as possible for Windows. So, I checked how much space I used on my existing Linux install. The command df . -BG is useful for this. giving space used in GB. It turned out I had only used 75 GB.
I downloaded the Ubuntu 21.10 ISO and used Startup Disk Creator to flash it to an old 4GB USB stick
To free up space for the Linux installation I needed to shrink the Windows disk partition. I used the Windows tool for this. Search for "Create and format hard disk partitions". This opened the Disk Management Tool:
I right-clicked on the main Windows Partition and selected Shrink... I then shrank by 150GB.
Once everything was in place. I inserted the Ubuntu USB and rebooted. For this machine I needed to explicitly tell it to boot from the USB by hitting F12 during startup to be able to change the boot order.
A welcome screen should pop up with options to Try Ubuntu or Install Ubuntu. Select the latter and follow the next screens, selecting language, keyboard and Wi-Fi when asked.
- When you get to Installation Type select "Something else, you can create or resize partitions yourself"
- Create a Swap Partition. Select Logical Partition, beginning of this space and choose a size (I used 4GB) and under Mount point choose Swap
- Create a Root Partition. Select Primary Partition, beginning of this space and let it take the remaining space. Under Mount point choose /
Monday, 16 August 2021
Python Range Bar Plots
I have some data in a json file that contains a list of timings for different tests. Each test has a name, start timestamp and duration in milliseconds. It looks something like this:
Now, I love the Matplotlib Python library. I used it a lot when learning Machine Learning during the 2020 lockdowns. It is an incredibly rich and powerful tool for creating professional data visualizations. So, as I'm new to it I thought I'd see if I could create a Range Bar plot of these data.
In essence I want to show each test as a individual bar, the size of which corresponds to the duration and each bar's left most edge corresponding to the start time.
Here is the script:
Monday, 17 May 2021
.NET Versions and Transport Layer Security (TLS)
This little blog came about from looking into a strange problem where a query to a rest service was failing with :
System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a send.
System.IO.Exception: Unable to read data from the transport connection: An Existing connection was forcibly closed by the remote host
The cause of this is from an inconsistent security protocol being used by the client and server. In this case the server is using TLSv1.2 and the client SSLv3.
You can get or set the SecurityProtocol in code:
I'm running this on .NET framework 4.8. So I should be using the SystemDefault protocol for the OS ( Windows 10) which is TLSv1.2. But when I printed out the output from the SecurityProtocol above I got SSLv3 | TLSv1.1 So what's going on?
Supported Runtime
In my app.config file I had the following startup entry:
Documentation here The versions are checked in order with the first one that matches a version installed on your being taken. If that version is present on your computer that will be used.
So with 4.5.2 the default version of SSL3 TLS1 and TLS 1.1 are used.
There's a few fixes or workarounds for this. First build the code and retarget .NET 4.7.2 or later. Unfortunately this wasn't an option because I didn't own the executable code. This also ruled out explicitly setting the SecurityProtocol in code although this isn't recommended as it makes future changes difficult. You can also edit registry keys (see the link below) to change the default behaviour but I thought this would be too intrusive.
The solution was to add the following to the app.config:
For 4.5.2 this also requires the latest patches and registry keys . In an ideal word you would of course update. But software development rarely works in an ideal world.
Monday, 22 March 2021
Publishing .NETCore Application and running on Linux
Over the last year or so I've been writing a simple tool in .NET Core to compare two CSV files. It can be found in on GitHub here. I won't go into details about the tool in this post but being a .NET Core application I've been able to develop it on Windows and also deploy and run on Linux. This post describes how I published and deployed.
I've been using Visual Studio. When I want to create a new deployment I right-click on the Project and select Publish...
I have setup a profile, called "FolderProfile" (Very imaginative!)
- TargetLocation : Folder name
- Configuration : Release | Any CPU (from my solution)
- Deployment mode : Framework-dependent
- TargetFramework : netcoreapp3.0
- TargetRuntime : Portable
total 68 drwxr-xr-x 2 jonathan jonathan 4096 Mar 12 19:27 . drwxr-xr-x 64 jonathan jonathan 4096 Mar 12 19:35 .. -rwx------ 1 jonathan jonathan 431 Jul 2 2020 CSVComparison.deps.json -rwx------ 1 jonathan jonathan 14336 Jul 2 2020 CSVComparison.dll -rwx------ 1 jonathan jonathan 4860 Jul 2 2020 CSVComparison.pdb -rwx------ 1 jonathan jonathan 154 Jul 2 2020 CSVComparison.runtimeconfig.json
I've previously installed the .NET Core runtime on Ubuntu. As of the time of writing the installed version (dotnet --version) is 3.1.404.
The IMDB/movie_data.csv file is a 50000 row CSV I generated from the
IMDB movie dataset. I had originally set this up for a machine learning exercise but it is also a
good sized dataset to checkout the tool. I made two copies and edited one of the comments
on the candidate file. Then, to run the CSV Comparison, I navigated to the folder containing the binaries and ran with this command-line:
dotnet ./CSVComparison.dll ../IMDB/movie_data2.csv ../IMDB/movie_data2.csv ../IMDB/movie_config.xml ./output
The output:
Reference: ./movie_data.csv Candidate: ./movie_data2.csv Saving results to output/ComparisonResults.csv Finished. Comparison took 10517ms
And the result:
?xml version="1.0" encoding="utf-8"?>
<ComparisonDefinition xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/20
01/XMLSchema">
<Delimiter>,</Delimiter>
<KeyColumns>
<Column>row</Column>
</KeyColumns>
<HeaderRowIndex>0</HeaderRowIndex>
<ToleranceValue>0.1</ToleranceValue>
<IgnoreInvalidRows>false</IgnoreInvalidRows>
<ToleranceType>Relative</ToleranceType>
<ExcludedColumns />
</ComparisonDefinition>
Date run: 22/03/2021 18:40:12
Reference: ./movie_data.csv
Candidate: ./movie_data2.csv
Number of Reference rows: 50001
Number of Candidate rows: 50001
Comparison took 10517ms
Number of breaks 1
Break Type,Key,Column Name,Reference Row, Reference Value, Candidate Row, Candidate Value
ValueMismatch,7230,review,96,"Exceptional movie that handles a theme of



