Reading and writing files with Python
How to read and write files in Python from a PHP coder’s perspective
How to read and write files in Python from a PHP coder’s perspective
Like PHP, Python provides built-in support for encoding and decoding JSON data. We cover the fundamentals in this article.
PHP offers isset() to test for the existence of variables and elements. A look at some equivalent tools that Python provides.
Learn how to use Python’s type() and isinstance() functions, the Pythonic counterparts to PHP’s gettype() and instanceof.
A look at Python’s random module – how it differs from PHP’s rand() and what it adds.
PHP supports multiline strings with the heredoc text syntax. We take a look at a commonly used Python equivalent.
Most programs of any complexity must change their behaviour according to circumstances. Conditional statements are among the principle tools for the job.
Accepting and processing raw materials, rendering back useful products, functions are the magic machines at the heart of your programs.
At the core of coding is the ability to change data and behaviour. For that you need to define variables and assign data to them.
You have to start with “Hello, World”, and that means printing it. We begin the project by digging in to Python’s print function.
Conditional statements are at the core of decision-making in coding but they can go rogue. Here’s how to tame them.
If you need to shift a project between Symfony and Slim it can be useful to convert Request and Response objects between implementations. Here’s how.
Get up and running with Slim, a super-clean and extensible PHP micro-framework.
What is a dependency injection container? How and why to use PHP-DI to create objects and pass them to your components.
PHPUnit: Get testing fast. Why you should test. How you’re probably testing already.
How to build useful and flexible command line scripts with PHP and why you should.
Check that your PHP variables and array elements are set or apply default values using some super-clean and compact techniques
The Jobtensor PHP Tutorial site is cleanly designed, has decent coverage of language features, and allows users to code right on the site.
PHP Objects Patterns, and Practice diary week #5: A monster chapter with over a hundred code examples proves a challenge.
PHP Objects Patterns, and Practice diary week #4: A chapter submitted! Using Github for book writing/editing. More new features.
PHP Objects Patterns, and Practice diary week #3: Writing begins in earnest. I face a tighter schedule than expected. I begin to encounter new features.
This lovely PHP 8 feature cuts down boilerplate in class definitions by at least half, making your code more readable and less prone to errors.
PHP Objects Patterns, and Practice edition 6 - revision diary. Week #2: Diverted by the promise of Markdown and writing many lovely tools.
A diary for work on the new edition of PHP Objects Patterns, and Practice. Week #1: Firing up vagrant, fixing my tests, finagaling dependencies, building PHP...
How to use PHPUnit mock objects to create a virtual laboratory for testing components. Set up stub objects to return values via simple method calls.
Is your code trying to do too much? Dramatically improve the design of your system by focusing each component on a single responsibility.
If you’re a WordPress self-hoster and you’re anything like me, you’re constantly tweaking, moving posts from staging systems to live, and then exporting co...
The ArrayAccess interface lets you manage a PHP object like an array. Set, get, delete and test values using array syntax - with Callbacky - a working exampl...
Continuing the Foundations series - create a PHP directory list class using the elegant DirectoryIterator. Create reusable and extensible code to mine subdir...
A fatal PHP error can leave you with an empty screen. Here’s how to find and manage error information in your system to get your code back on track.
A complete PHP Twitter API authorisation flow using the lovely Silex micro-framework and Guzzle 6 - from the user’s first click to a proof of concept query.
Perhaps not the snappiest title for a blog post, but it does sum up what I’m hoping to do with this one. When I started work on Pressmonkey – our lovely Wo...
I’m delighted to announce (a little behind the fact if I’m honest) that the 5th Edition of PHP Object Patterns and Practice is now available – and with a lov...
Three days, three overrides! I started two days ago with the bluntest of blunt instruments – switching out a whole template. I narrowed things yesterday wi...
Yesterday I migrated an entire database from one WordPress installation to another, a process somewhat complicated by the fact that the source WordPress en...
Here’s one approach that addresses the current lack of a native PHP enum class. An Enum type allows you to define and enforce a limited set of values, and...
If you’re a WordPress self-hoster and you’re anything like me, you’re constantly tweaking, moving posts from staging systems to live, and then exporting co...
Here’s why you should consider deploying WordPress with Vagrant for development and testing – and how to do it! I throw in some Composer for WordPress and ...
Perhaps not the snappiest title for a blog post, but it does sum up what I’m hoping to do with this one. When I started work on Pressmonkey – our lovely Wo...
I am writing this having eaten far too much (the time of writing being Christmas day and this being the final ‘window’ in an advent series of twenty-five for...
And so the end of this advent series draws near — twenty-five posts in twenty-five days. Also the end of the year looms too, but the less said about 2016 the...
Now that I have two sites that mirror one another with VersionPress (gistaging – the origin and gidev – the clone) it’s time I tried out this plugin’s abilit...
Running late with this blog – partly due to external factors, partly because I have disappeared down in interesting but intricate VersionPress-related rabbit...
Client work largely ate the day today leaving little time for the site reboot or for this blog. Nevertheless, I have been chucking bits of content at WordP...
Today I began my evaluation of the VersionPress plugin Setup is not without its wrinkles, but then it’s alpha software and covers some quite complicated grou...
Just a check-in today. I have been roughing out content and playing with layouts – some issues with getting Bootstrap plugins to play nice with Twenty Sevent...
Three days, three overrides! I started two days ago with the bluntest of blunt instruments – switching out a whole template. I narrowed things yesterday wi...
Yesterday, I used a fairly crude mechanism for overriding a single line in a template. I added my own version of the file to my child theme – thereby clobb...
So after my day of doodling yesterday, I’m back today with a little bit of code, and some discussion of overriding parent themes. I intend to use the mult...
Playing with themes today and wondering what should go where. photo credit: karen horton Germany postage stamp: fifteen via photopin (license)
Yesterday I migrated an entire database from one WordPress installation to another, a process somewhat complicated by the fact that the source WordPress en...
In yesterday’s post, I toured a few options for WordPress migration. I still like the look of VersionPress because the full clobber of most solutions out t...
More a report than an article today. I am beginning to think about working with some real content at last. To that end, I have been experimenting with vari...
If you’re managing a WordPress site primarily through the browser, there’s a good chance you don’t ever have to think about permissions once your initial s...
After yesterday’s post, I received some correspondence (AKA tweets) from @tomcoady. He pointed me to the WordPress codex documentation on child themes whic...
Hello from Brussels. The Christmas market is in full swing here and I am stuffed with tartiflette and waffle – with beer to come I hope. Amidst the bustle,...
Today my team and I launched a new iteration of a client’s product. Always something of a white-knuckle ride. Available time for diving into anything but t...
I left you yesterday with an exciting cliffhanger. Then I applied my thinking to the theme choices out there. The plan was to sift through the options, wei...
Today, things begin to get a bit more real. It’s time to choose a theme. Or at least to kick off the process. This stage is always problematic for me – par...
Day Five already. And Monday too. If you’re reading along, well done. Let’s take a breath. OK. Today I’m going to add my project to a git repository. This...
Today I’m going to work from an inert file structure (the composer install process we covered yesterday) to a running WordPress site. I have complicated ma...
So far I have decided I need a new version of this site (day 1) and worked out roughly how I’d like to structure my components (day 2). I still haven’t wor...
For today’s window, I’m going to organise my directories. This is one of those deceptive choices that seems trivial at first blush, but can bite you hard lat...
So this week I finally delivered the proof corrections for edition five of PHP Objects Patterns and Practice and inevitably my thoughts turned to blogging ...
I love WordPress. It’s a truly slick application, and I find myself using it increasingly for mediumweight projects. Like many coders, I’d really rather be p...
If you’re a WordPress self-hoster and you’re anything like me, you’re constantly tweaking, moving posts from staging systems to live, and then exporting co...
I am writing this having eaten far too much (the time of writing being Christmas day and this being the final ‘window’ in an advent series of twenty-five for...
And so the end of this advent series draws near — twenty-five posts in twenty-five days. Also the end of the year looms too, but the less said about 2016 the...
Now that I have two sites that mirror one another with VersionPress (gistaging – the origin and gidev – the clone) it’s time I tried out this plugin’s abilit...
Running late with this blog – partly due to external factors, partly because I have disappeared down in interesting but intricate VersionPress-related rabbit...
Client work largely ate the day today leaving little time for the site reboot or for this blog. Nevertheless, I have been chucking bits of content at WordP...
Today I began my evaluation of the VersionPress plugin Setup is not without its wrinkles, but then it’s alpha software and covers some quite complicated grou...
Just a check-in today. I have been roughing out content and playing with layouts – some issues with getting Bootstrap plugins to play nice with Twenty Sevent...
Three days, three overrides! I started two days ago with the bluntest of blunt instruments – switching out a whole template. I narrowed things yesterday wi...
Yesterday, I used a fairly crude mechanism for overriding a single line in a template. I added my own version of the file to my child theme – thereby clobb...
So after my day of doodling yesterday, I’m back today with a little bit of code, and some discussion of overriding parent themes. I intend to use the mult...
Playing with themes today and wondering what should go where. photo credit: karen horton Germany postage stamp: fifteen via photopin (license)
Yesterday I migrated an entire database from one WordPress installation to another, a process somewhat complicated by the fact that the source WordPress en...
In yesterday’s post, I toured a few options for WordPress migration. I still like the look of VersionPress because the full clobber of most solutions out t...
More a report than an article today. I am beginning to think about working with some real content at last. To that end, I have been experimenting with vari...
If you’re managing a WordPress site primarily through the browser, there’s a good chance you don’t ever have to think about permissions once your initial s...
After yesterday’s post, I received some correspondence (AKA tweets) from @tomcoady. He pointed me to the WordPress codex documentation on child themes whic...
Hello from Brussels. The Christmas market is in full swing here and I am stuffed with tartiflette and waffle – with beer to come I hope. Amidst the bustle,...
Today my team and I launched a new iteration of a client’s product. Always something of a white-knuckle ride. Available time for diving into anything but t...
I left you yesterday with an exciting cliffhanger. Then I applied my thinking to the theme choices out there. The plan was to sift through the options, wei...
Today, things begin to get a bit more real. It’s time to choose a theme. Or at least to kick off the process. This stage is always problematic for me – par...
Day Five already. And Monday too. If you’re reading along, well done. Let’s take a breath. OK. Today I’m going to add my project to a git repository. This...
Today I’m going to work from an inert file structure (the composer install process we covered yesterday) to a running WordPress site. I have complicated ma...
So far I have decided I need a new version of this site (day 1) and worked out roughly how I’d like to structure my components (day 2). I still haven’t wor...
For today’s window, I’m going to organise my directories. This is one of those deceptive choices that seems trivial at first blush, but can bite you hard lat...
So this week I finally delivered the proof corrections for edition five of PHP Objects Patterns and Practice and inevitably my thoughts turned to blogging ...
How to read and write files in Python from a PHP coder’s perspective
Like PHP, Python provides built-in support for encoding and decoding JSON data. We cover the fundamentals in this article.
PHP offers isset() to test for the existence of variables and elements. A look at some equivalent tools that Python provides.
Learn how to use Python’s type() and isinstance() functions, the Pythonic counterparts to PHP’s gettype() and instanceof.
A look at Python’s random module – how it differs from PHP’s rand() and what it adds.
PHP supports multiline strings with the heredoc text syntax. We take a look at a commonly used Python equivalent.
Most programs of any complexity must change their behaviour according to circumstances. Conditional statements are among the principle tools for the job.
Accepting and processing raw materials, rendering back useful products, functions are the magic machines at the heart of your programs.
At the core of coding is the ability to change data and behaviour. For that you need to define variables and assign data to them.
You have to start with “Hello, World”, and that means printing it. We begin the project by digging in to Python’s print function.
Languages are not tribes. Diversify to improve your skills and earning power.
How to read and write files in Python from a PHP coder’s perspective
Like PHP, Python provides built-in support for encoding and decoding JSON data. We cover the fundamentals in this article.
PHP offers isset() to test for the existence of variables and elements. A look at some equivalent tools that Python provides.
Learn how to use Python’s type() and isinstance() functions, the Pythonic counterparts to PHP’s gettype() and instanceof.
It’s nice to be nice. But even if you’re a meanie deep down inside, being good to your team is strategically the way to go.
A look at Python’s random module – how it differs from PHP’s rand() and what it adds.
PHP supports multiline strings with the heredoc text syntax. We take a look at a commonly used Python equivalent.
Most programs of any complexity must change their behaviour according to circumstances. Conditional statements are among the principle tools for the job.
Accepting and processing raw materials, rendering back useful products, functions are the magic machines at the heart of your programs.
At the core of coding is the ability to change data and behaviour. For that you need to define variables and assign data to them.
You have to start with “Hello, World”, and that means printing it. We begin the project by digging in to Python’s print function.
Here’s why you should consider deploying WordPress with Vagrant for development and testing – and how to do it! I throw in some Composer for WordPress and ...
Scary and free? Well the scary part is mine. The free bit is for you. That is if you are a WordPress kind of person and you like to tweet. Pressmonkey is a...
Client work largely ate the day today leaving little time for the site reboot or for this blog. Nevertheless, I have been chucking bits of content at WordP...
So after my day of doodling yesterday, I’m back today with a little bit of code, and some discussion of overriding parent themes. I intend to use the mult...
In yesterday’s post, I toured a few options for WordPress migration. I still like the look of VersionPress because the full clobber of most solutions out t...
For today’s window, I’m going to organise my directories. This is one of those deceptive choices that seems trivial at first blush, but can bite you hard lat...
I love WordPress. It’s a truly slick application, and I find myself using it increasingly for mediumweight projects. Like many coders, I’d really rather be p...
PHP Objects Patterns, and Practice diary week #5: A monster chapter with over a hundred code examples proves a challenge.
PHP Objects Patterns, and Practice diary week #4: A chapter submitted! Using Github for book writing/editing. More new features.
PHP Objects Patterns, and Practice diary week #3: Writing begins in earnest. I face a tighter schedule than expected. I begin to encounter new features.
This lovely PHP 8 feature cuts down boilerplate in class definitions by at least half, making your code more readable and less prone to errors.
PHP Objects Patterns, and Practice edition 6 - revision diary. Week #2: Diverted by the promise of Markdown and writing many lovely tools.
A diary for work on the new edition of PHP Objects Patterns, and Practice. Week #1: Firing up vagrant, fixing my tests, finagaling dependencies, building PHP...
I’m delighted to announce (a little behind the fact if I’m honest) that the 5th Edition of PHP Object Patterns and Practice is now available – and with a lov...
A sneak peek at the new cover design for Python for PHP Programmers, including some hat-oriented versions.
Get the latest updates from Hidden Hat HQ, including new articles and book projects.
Where is the beauty in beautiful code? Can code be art or even poetry? Let’s kick that around a little.
How is the Hidden Hat project doing after two weeks? What is the plan to build traffic?
Why is this site named for a Hidden Hat? The answer takes in code debugging and a beloved 1970s TV character.
In the first Hidden Hat diary entry, I introduce the site and the mission. Then I call for help.
A sneak peek at the new cover design for Python for PHP Programmers, including some hat-oriented versions.
Get the latest updates from Hidden Hat HQ, including new articles and book projects.
Where is the beauty in beautiful code? Can code be art or even poetry? Let’s kick that around a little.
How is the Hidden Hat project doing after two weeks? What is the plan to build traffic?
Why is this site named for a Hidden Hat? The answer takes in code debugging and a beloved 1970s TV character.
In the first Hidden Hat diary entry, I introduce the site and the mission. Then I call for help.
A talk about Shelley, a PHP-based command line AI chat client. Access GPT from your console!
Chat has arrived in the OpenAI API. Here’s how to invoke it from PHP.
Use PHP and the Medium API to cross-post Markdown articles that include local images.
Connect to the OpenAI GPT models from your PHP projects..
Use the Unsplash API with PHP to resize, download and save images and to generate attribution text.
Chat has arrived in the OpenAI API. Here’s how to invoke it from PHP.
Use PHP and the Medium API to cross-post Markdown articles that include local images.
Connect to the OpenAI GPT models from your PHP projects..
Use the Unsplash API with PHP to resize, download and save images and to generate attribution text.
Conditional statements are at the core of decision-making in coding but they can go rogue. Here’s how to tame them.
PHPUnit: Get testing fast. Why you should test. How you’re probably testing already.
The Jobtensor PHP Tutorial site is cleanly designed, has decent coverage of language features, and allows users to code right on the site.
A talk about Shelley, a PHP-based command line AI chat client. Access GPT from your console!
Chat has arrived in the OpenAI API. Here’s how to invoke it from PHP.
Connect to the OpenAI GPT models from your PHP projects..
The thing about blogs is that they show you up. Leave it a while and there’s that previous post sitting around to tell the world just how long it’s been sinc...
Coders and writers are a sedentary bunch by and large. Because I’m both, I probably get a double dose of sitting around. Apparently sitting is the new smokin...
This lovely PHP 8 feature cuts down boilerplate in class definitions by at least half, making your code more readable and less prone to errors.
The ArrayAccess interface lets you manage a PHP object like an array. Set, get, delete and test values using array syntax - with Callbacky - a working exampl...
How to use PHPUnit mock objects to create a virtual laboratory for testing components. Set up stub objects to return values via simple method calls.
Setting up SSH keys on a Linux server can be a chore. An overview of key files, how to generate and to install on Github. Plus troubleshooting advice!
UPDATED. We wrote a PHP API client for OpenAI’s Assistants API… by accident. Maintain state! Build smart knowledge bases! Integrate third party tools!
Check that your PHP variables and array elements are set or apply default values using some super-clean and compact techniques
This is the inevitable test post for this soft-launched iteration of Matt Zandstra’s getinstance() site. It’s all a bit bare bones round here at the moment ...
So this week I finally delivered the proof corrections for edition five of PHP Objects Patterns and Practice and inevitably my thoughts turned to blogging ...
Yesterday, I used a fairly crude mechanism for overriding a single line in a template. I added my own version of the file to my child theme – thereby clobb...
Scary and free? Well the scary part is mine. The free bit is for you. That is if you are a WordPress kind of person and you like to tweet. Pressmonkey is a...
Perhaps not the snappiest title for a blog post, but it does sum up what I’m hoping to do with this one. When I started work on Pressmonkey – our lovely Wo...
The ArrayAccess interface lets you manage a PHP object like an array. Set, get, delete and test values using array syntax - with Callbacky - a working exampl...
The ArrayAccess interface lets you manage a PHP object like an array. Set, get, delete and test values using array syntax - with Callbacky - a working exampl...
Even if you code on a Mac or Windows computer, you will need these essential Linux skills if you want to call yourself a Web developer.
How to use PHPUnit mock objects to create a virtual laboratory for testing components. Set up stub objects to return values via simple method calls.
How to use PHPUnit mock objects to create a virtual laboratory for testing components. Set up stub objects to return values via simple method calls.
This lovely PHP 8 feature cuts down boilerplate in class definitions by at least half, making your code more readable and less prone to errors.
How to build useful and flexible command line scripts with PHP and why you should.
Languages are not tribes. Diversify to improve your skills and earning power.
UPDATED. We wrote a PHP API client for OpenAI’s Assistants API… by accident. Maintain state! Build smart knowledge bases! Integrate third party tools!