Posts

When Python is Faster Than Julia

Image
Julia's JIT compiler produces code the runs much faster than Python but that compilation also takes time, which can result in Python programs being faster overall.There's a good quote on the Julia language web site: it says that Julia walks like Python but runs like C. Meaning that Julia is as easy to work with as Python - it has an easy syntax that can be learned quickly - but Julia programs run at a speed that rivals compiled languages like C. Python, on the other hand, is an interpreted language that is quite slow.
But for simple scripts like the one I use to generate up-to-date graphs for the Covid-19 pandemic, Python might be a better bet. Compilers v InterpretersCompilation means that the code that you write is converted into machine code, or something close to it, before the program is run. Machine code is the language that the processor in your computer executes directly, consequently compiled programs run fast. C is the archetypal compiled language and it is very fast. T…

Data Visualization with Julia and VSCode

Image
With Julia and the free VSCode IDE, you can make impressive data visualizations with little programming knowledge.All images in this article were created by the author except the Julia language logo, credit: julialang.orgA while ago I wrote about data visualization using Julia and an online environment called JuliaBox. At the time JuliaBox was a free service; unfortunately, it has since been withdrawn. This is a shame as it was a great service.So here is a new version of that article where you use Microsoft’s VSCode IDE (which is not only free but is also unlikely to go away any time soon). You’ll need to install VSCode, the Julia language and then the VSCode extension for Julia. If that sounds complicated, don’t worry, it isn’t.JuliaJulia is a relatively new language for data analysis. It has a high-level syntax and designed to be easy to use and understand. Some have called it the new Python.Unlike Python, though, it is a compiled language, which means that while it is as easy to wr…

3 Great Tools for Creating Julia Programs - VSCode, Juno and Jupyter Notebooks

Image
Visual Studio Code, Juno and Jupyter Notebooks are all great environments for developing Julia code.  

Julia is a young language and so support is not as comprehensive as it is for other more established languages such as Java or Python. However, while there may not be a vast number of development environments available for it, you do have the choice of some good ones. I'm going to introduce you to my favorites; this won't be a comprehensive guide, just a brief overview but, I hope useful.

The choice of editor or IDE is to some extent subjective and so the three environments that I have chosen to talk about here are bound to reflect my own prejudices. 
They are all open source and thus free, and they are: Visual Studio Code from Microsoft, Juno, which is promoted by the Julia language people themselves and is based upon the Atom editor, and finally Jupyter Notebooks.

All of these environments support multiple languages and each requires its own plugin or extension to customize it…

An Automatic Table of Contents Generator in Javascript

Build a Table of Contents in Javascript  Web articles and reports can be made easier to navigate with a table of contents. They can be tedious to create and maintain, so let Javascript take the strain.
Web Articles or Reports Do you write articles for the web, or publish reports there? Then you should enhance them with a stylish table of contents so that your reader can find their way around.

And the good things is that you don't need to do much apart from include some Javascript and CSS in your page along with a single <div> tag. By doing this you'll end up with a table of contents that looks like the one on this page.
How it works All of the sections in your article need to be given a header - you doubtless already do this - and the script that I am going to show you will scan those headers, create anchors in the HTML and build the table in a panel at the top of the page.

First we need to settle on a header that we are going to use for our section headings. Let's…

Rejuvenate your old PC with Lubuntu Linux

Image
Got an old pc or laptop? Give it a new lease of life — install Lubuntu Linux.
Simple is better I've never been a great fan of complicated user interfaces. To be honest, 20 odd years ago, I would have been perfectly happy to stick with Windows 2000 but my son persuaded me to upgrade to XP.
It's been downhill ever since.

But Linux is different - it's simple to use and most of the applications that you would expect to find on a modern PC are available for it.
"Reduce, Reuse, Recycle" - Jack Johnson Also, moving to Linux had never been easier and updating an old PC is good for the environment if you reuse it rather than buy a new one. "Reduce, reuse, recycle" as the Jack Johnson song goes.

So let's look at how to install Lubuntu, a lightweight version of the popular Ubuntu Linux, and see what the benefits are of a lightweight Linux on old hardware.

The first benefit is performance. I converted an old Windows Vista laptop to Lubuntu (Vista was so slow …

COVID-19 Data Tracking with Python and Smartable AI

Image
Building a COVID-19 data tracker in Python with the Smartable AI API






The COVID-19 pandemic is extremely worrying for everyone but are the facts and figures that you see in the media clear? Do you sometimes look at the numbers and the graphs that appear on the TV and the web and think something like, “That’s fine but what about trends?” It’s all very well reporting the scary absolute numbers, and we need to know these things but are things getting better or worse? Just how worried do we need to be?



Sometimes the apocalyptic news reports are less than crystal clear about the progress of the virus. But now you don’t have to rely on third party sources. Now you can create your own graphs and do your own analysis.
There are a number of sources for COVID-19 data — Johns Hopkins University is a great example. But you can create your own data tracking app that and derive your own indicators or concentrate on the data that you are interested in, with the Smartable AI API.
It’s free to use alt…

Creating a Basic Python Web App with Flask

Image
Simple web applications in Python are easily constructed with the Flask micro-framework.Why would you want a web app and not just a web page?

You can make quite sophisticated web pages with just HTML and Javascript but if you want to incorporate data that needs to be stored somewhere, or needs some sort of sophisticated processing, you might be better off building a proper application.

Traditionally, web applications were written in PHP, JSP or ASP. But these days Python is an perfectly good choice for creating web apps.
In this article we are going to make a simple example of a Python web app using Python and Flask. Here's what we'll do:

1. Get the Flask library for Python and learn how to use it.
2. Writea Flask-based program to provide some simple data. 3. Write a web page template to display that data.
You don't need a high level of skill to follow this tutorial but you do need to have a basic knowledge of Python and HTML, and know what a web page and a server is. I als…