Technology Tales

Notes drawn from experiences in consumer and enterprise technology

14:19, 20th December 2018

Five reasons to use ODS EXCLUDE to suppress SAS output

When working with SAS procedures, suppressing output temporarily is a common requirement, particularly in simulation and bootstrap analyses. Two approaches exist for doing this: the ODS EXCLUDE statement and the ODS CLOSE statement. The ODS EXCLUDE method is generally preferable because it is straightforward to implement, works regardless of which destinations are open, can be easily reversed and repeated multiple times within a single programme and does not alter or overwrite existing output files. In contrast, the ODS CLOSE approach requires the programmer to know which destinations were previously open before reopening them, risks overwriting existing output files and introduces side effects that become increasingly problematic when the process is repeated. While the older practice of using ODS LISTING CLOSE was once common, it is now considered outdated given that the LISTING destination is no longer the default in most modern SAS environments. For programmers seeking a reliable and low-effort way to temporarily suspend SAS output before resuming it later in a programme, ODS EXCLUDE ALL followed by ODS EXCLUDE NONE represents the cleaner and safer solution.

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

SAS COUNTW Function

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.

  • The content, images, and materials on this website are protected by copyright law and may not be reproduced, distributed, transmitted, displayed, or published in any form without the prior written permission of the copyright holder. All trademarks, logos, and brand names mentioned on this website are the property of their respective owners. Unauthorised use or duplication of these materials may violate copyright, trademark and other applicable laws, and could result in criminal or civil penalties.

  • All comments on this website are moderated and should contribute meaningfully to the discussion. We welcome diverse viewpoints expressed respectfully, but reserve the right to remove any comments containing hate speech, profanity, personal attacks, spam, promotional content or other inappropriate material without notice. Please note that comment moderation may take up to 24 hours, and that repeatedly violating these guidelines may result in being banned from future participation.

  • By submitting a comment, you grant us the right to publish and edit it as needed, whilst retaining your ownership of the content. Your email address will never be published or shared, though it is required for moderation purposes.