20:31, 24th November 2018
Using WP CLI to run Cron jobs on multisite networks
When running a WordPress multisite network on a self-managed server, disabling the default WordPress Cron system in favour of a server-level Cron job is generally considered good practice. A simple bash script can address the shortcoming of existing approaches, which typically require manual updates whenever a new site is added to the network. The script works by using the WordPress Command Line Interface to retrieve a list of all sites on the multisite network, then loops through each one and runs all due Cron tasks automatically. It can be scheduled to execute on an hourly basis by adding a single line to the server Cron configuration, and the path to the WordPress installation is the only value that needs to be adjusted for it to function correctly. Readers in the comments have also suggested refinements, such as filtering out deleted and archived sites and simplifying the URL retrieval command to remove the need for additional conditional checks.
20:30, 24th November 2018
Properly Setting Up WordPress Cron Jobs
WordPress cron jobs are automated tasks scheduled to run at specified intervals, but unlike traditional Unix cron jobs, they rely on user visits to trigger events, which can lead to delays if traffic is low. To address this, disabling WordPress's default wp-cron system and instead using a Unix-level cron job ensures that tasks execute reliably. This involves defining the event with wp_schedule_event, disabling wp-cron in the wp-config.php file and setting up a cron job via the server's command line or hosting interface to periodically request wp-cron.php, mimicking user activity and ensuring scheduled tasks run on time regardless of site traffic.
21:43, 22nd November 2018
Automatically update your Ubuntu system with cron-apt
Automatically updating an Ubuntu system can be achieved by combining the apt package management system with cron, a task scheduler, to execute regular updates without manual intervention. This involves using commands such as apt-get update and apt-get upgrade, with flags like -y to automate responses and -d to download packages without immediate installation, allowing for later review. The cron-apt package offers a streamlined approach, handling scheduling and providing additional features like email notifications on updates, with configuration details stored in specific system files. This method ensures systems remain secure and up to date by minimising the need for manual checks, while also offering flexibility to monitor and control the update process.
12:04, 17th November 2018
dnstwist is a tool designed to identify potentially malicious domains that may be used for phishing, typo-squatting, or brand impersonation by generating permutations of a given domain name and checking their availability. It employs various fuzzing algorithms, supports Unicode domain names and includes features for detecting phishing websites through fuzzy hashing of web content and perceptual hashing of screenshots. The tool can be installed via package managers, command-line interfaces, or Docker and offers options for exporting results in formats such as CSV or JSON. It is integrated into multiple security platforms and used by organisations for threat intelligence and incident response, providing a method to assess risks associated with domain name variations and potential cyber threats.
13:28, 26th October 2018
The COUNTW function counts the number of words in a character string, with words defined as substrings bounded by specified delimiters or the start/end of the string and the ability to adjust delimiter handling through modifiers. Delimiters can be customised using the chars argument, while modifiers such as M allow counting of zero-length words by treating consecutive or leading/trailing delimiters as word boundaries and Q ignores delimiters within quoted substrings. The function's default delimiters vary between ASCII and EBCDIC environments and it supports null arguments for character inputs. Examples demonstrate how different modifier combinations, such as M and P, influence word counts based on delimiter definitions and string content.
15:19, 4th October 2018
SAS Add-In 8 for Microsoft Office: User’s Guide
The SAS Add-In 8 for Microsoft Office documentation provides a user guide covering new features, an introduction and setup guidance, everyday use and customisation, and working with Excel data, SAS data sources, OLAP data, tasks, reports, programs, documents in SAS folders, results and content management, alongside related task references, a developer’s guide, desktop application information, accessibility details and other resources.
16:12, 20th September 2018
Use an Easy PowerShell Command to Search Files for Information
Windows PowerShell's Select-String command offers a straightforward way to search through multiple files in a folder without the need to write a dedicated script. This works well with plain file formats, but struggles with complex formats like those produced by Microsoft Word, often returning garbled output. By specifying file extensions using wildcard characters in the path parameter, users can target specific file types and avoid those issues. Both the path and pattern parameters accept arrays of strings, meaning several file types and search terms can be queried simultaneously in a single command. For greater control over which files are included in a search, the Get-ChildItem command can be piped into Select-String, allowing for recursive directory searches and more precise filtering by file type. This approach proves particularly useful when analysing log files, where patterns such as "fail", "success" and "pending" can be searched for together to build a clearer picture of recorded events across multiple files.
17:11, 8th September 2018
Using LIBNAME XLSX to read and write Excel files
Introduced in SAS 9.4 Maintenance 2, the XLSX engine allows users to read and write Microsoft Excel files directly as though they were data sets in a library, without relying on Microsoft data APIs, which means it functions on both Windows and Unix systems without concerns over 32-bit versus 64-bit compatibility or the need for a separate PC Files Server process. It does require a licence for SAS/ACCESS to PC Files, though this is included in SAS OnDemand for Academics. Once a library is assigned using the engine, users can browse sheet names, read specific sheets into SAS data sets and control how much data are imported using options such as FIRSTOBS and OBS. The engine can also be used to create and update XLSX files, with each SAS data set written as a separate sheet. However, there are notable limitations to be aware of, including no support for Excel named ranges, no dollar sign decoration around sheet names and a sequential access model that prevents certain in-place data modification techniques.
17:50, 3rd September 2018
New SAS transport format and tools available
SAS introduced an updated transport format, offering enhanced capabilities compared to the older V5 version, including support for longer variable names, extended character lengths, more flexible naming conventions and increased label lengths. This format is managed through macros such as LOC2XPT and XPT2LOC, which facilitate the conversion between SAS datasets and transport files. Despite these advancements, the V5 format remains necessary for regulatory submissions in the biopharmaceutical sector. The new format is compatible with a wide range of operating systems, and users can integrate the associated macros into their SAS environments for streamlined data handling.
17:09, 10th August 2018
Jurassic SAS in the BI/EBI World
Don Henderson's blog explores how SAS Server Pages and PROC STREAM can be used beyond their original purpose in stored processes and web applications, extending their utility to standard batch processing environments such as SAS Display Manager and SAS Enterprise Guide. A central theme across several posts is the development of a reusable tag cloud macro that generates graphical HTML displays of business intelligence data, using the JQuery-based JQCloud widget to render word clouds where the size of each word reflects the magnitude of an analysis variable. The blog traces the evolution of this macro from a straightforward single-cloud implementation to one supporting a BY variable, allowing a separate cloud to be generated for each distinct value of a grouping variable within a single output file. Alongside this, Henderson details a reusable AJAX container framework built on JQuery that enables dynamic, page-refreshing-free interaction with stored process outputs, including drill-down functionality triggered by clicking words in the cloud. Supporting components such as parameterised HTML forms, JSON-generating macros using SCL data access functions and footer pages are described in depth, illustrating how the architecture can be adapted for different datasets and display requirements. The author argues that tag clouds offer a more visually engaging alternative to bar charts and pie charts for representing business intelligence data, and positions the entire framework as a flexible, extensible foundation for web-based reporting in SAS environments.