Saturday, 1 August 2026

OpenAI's Astra Solves More Maths Problems

Astra has solved 10 hard maths problems (published 1 August 2026) following on from its disproof of the Erdös unit distance conjecture (from combinatorial geometry) in May 2026.

A paper of almost 250 pages (inclusive of references) is available from OpenAI's website.

Defensive Perl

Perl is less fashionable than Python these days, but it is a very flexible language which excels in text processing.

Its flexibility allows a myriad of programming styles, however, so having a set of defensive techniques helps.

Here are some top tips:
  • Switch warnings on - use the minus-w command line flag -  #! perl -w
  • Learn and use perlpod - it looks a bit like this at the start of your file  =head1 NAME  myscript =cut
  • Always use strict; at the start of your program (this pragma restricts expressions that are hard to debug)
  • Qualify your variables with type prefixes (similar to "Hungarian" notation) e.g. my $sHeader for strings, my @aCodes for arrays, my %hCodesToDescriptors, and appropriate equivalents for common custom types
Recap on pragmas: A pragma is a module which influences some aspect of the compile time or run time behaviour of Perl, such as strict or warnings. From Perl 5.10 onward - custom pragmata are supported.

Happy Perling!

How Imports Work in Python

The syntax for import is as follows (keywords in quotes):

"import"  module [ "as" identifier ]

There is also a variation to use when testing proposed changes to Python:

"from " "__future__" "import" feature [ "as" identifier ]

The first thing import does is find an load the module. It then initialises the module.



Frozen Frames when Debugging Python

When running pdb, you will notice certain debugging frames as frozen.  This is typically when:
  • code is compiled C-extension code (e.g. importlib, asyncio, threading internals)
  • the debugger cannot step in or modify them
  • they are part of Python's frozen importlib bootstrap
For example, in the following:

<frozen importlib._bootstrap>
<frozen importlib._bootstrap_external>

The modules are embedded in the Python binary.

If you try ll in the Python debugger when compiled code is being processed, you will get the error: *** could not get source code.

Friday, 31 July 2026

Understanding HTTP State Management

HTTP state management is covered in RFC6265.  

Python's request module however refers to its predecessor RFC2965 within the class DefaultCookiePolicy in cookiejar.py. Some programmers say the implementation is quite strict.

One difference in the RFCs is the use of Augmented Backus-Naur form (ABNF) in the latter, not used in the former. ABNF for specifications is formalised in RFC5234 (an Internet standard, proposed to be augmented by RFC7405).

Understanding HTTP Redirects

Introduction

If you want to program an HTTP request module (to make HTTP requests, to download web pages, or other data) there are a number of relevant concepts relating to HTTP that you must understand.

One of these concepts is HTTP redirects. What are they, why do they exist, and what a "reasonable" number of redirects looks like when sending an HTTP request to a server.

What is a redirect - technically speaking?

First the technical part. HTTP redirects occur when a server responds to a client request with the reply 3XX (status code). This is coupled with a location header of the URL it wants the client to load instead.

The browser or other HTTP client (which could be a Python program, for example) then follows the redirect, issuing a new request to the URL in the location header.

Why are they needed?

Examples:
301 Permanent redirect - e.g. for site reorganization, domain migration, SEO link preservation
Also temporary redirects - e.g. for load balancing
HTTP to HTTPS redirect

Redirects can be configure in Apache .htaccess and in nginx.

Pythons requests module allows by default 30 redirects.

PyCharm

PyCharm is an IDE for Python development from JetBrains. Copilot recommends this for large projects.

However to connect to WSL projects you need to have the JetBrains gateway installed.

Know your requirements well to understand if you really need such an overwhelming IDE.