Technology Tales

Notes drawn from experiences in consumer and enterprise technology

14:12, 4th August 2021

GitHub - sassoftware/saspy: A Python interface module to the SAS System. It works with Linux, Windows, and mainframe SAS. It supports the sas_kernel project (a Jupyter Notebook kernel for SAS) or can be used on its own.

This package facilitates integration between Python and SAS, enabling users to execute SAS code from Python environments and retrieve results as data frames, HTML documents, or text. It supports connections to various SAS deployments, including local and remote Linux, Windows and mainframe systems, as well as cloud-based Viya platforms and operates within notebooks, IDEs, or batch scripts. The software is open-source, licensed under Apache 2.0 and includes documentation, example use cases and guidelines for contributions, with a focus on community-driven enhancements and compatibility with recent versions of Python and SAS.

14:10, 4th August 2021

SAS OnDemand for Academics: Working with Python, including Jupyter Notebook

To connect to SAS OnDemand for Academics using Python, specific software requirements must be met, including Java 1.8.0_162 or higher, Python 3.3 or higher and SASPy 3.3.4 or higher. Users are instructed to create two configuration files: sascfg_personal.py, which defines server connection details based on the user's home region and _authinfo, which stores login credentials.

These files are saved in designated locations and referenced during the connection process. Once configured, a Python session can be initiated to establish a link with the SAS servers, though compatibility issues may arise if an outdated Java version is used. Additional resources are available for troubleshooting and further guidance on integration and usage.

14:09, 4th August 2021

SAS OnDemand for Academics

SAS OnDemand for Academics offers cloud-based access to statistical analysis, data mining and forecasting tools, enabling independent learners, students and instructors to use SAS software free of charge. Users register through a dedicated application, upload data and access SAS Studio for learning or teaching purposes, with specific guidance provided for each role. The service relies on remote servers to process tasks, which may occasionally require maintenance during non-traditional hours, with updates posted on a status page. Additional resources include tutorials, e-courses, books, community forums and training programs to support users in developing skills with SAS technology, alongside FAQs and documentation tailored to different user categories.

14:01, 4th August 2021

Authentication to SAS Viya: a couple of approaches

Connecting an external application to SAS Viya via its REST APIs requires authentication through OAuth 2.0, and there are three main grant types available depending on the use case. The authorisation code grant is considered the most secure option and is best suited to web applications, while the client credentials grant operates without a specific user context and is scoped to the authorities registered to the client. The password grant, though supported, is not recommended for production environments due to security concerns.

Regardless of grant type, the process begins with a SAS administrator generating a bearer token and using it to register a client ID and secret. From SAS Viya 2023.1 onwards, this no longer requires a Consul token, as members of the SAS Administrators group can generate the necessary access token directly. Once the client is registered and an authorisation code obtained, an access token and refresh token are issued and used to authenticate subsequent API calls. Access tokens expire after ten hours by default, but can be renewed using the refresh token, which itself expires after thirty days. Both values are configurable within SAS environment settings. The password and client credentials grant types follow a similar registration process but bypass the browser-based authorisation code step, making them more suitable for automated or trusted environments.

09:02, 4th August 2021

JuMP | JuMP is a modelling language and supporting packages for mathematical optimisation in Julia.

JuMP is a modelling language and collection of packages designed to simplify the formulation and solution of various optimisation problems, such as linear, integer and nonlinear programs, with applications spanning industries like energy, transportation and education. It is utilised in real-world scenarios including inventory routing, power grid planning and academic research, while also serving as a teaching tool at universities globally. Resources for learning and implementing JuMP include guides, community forums and third-party materials such as books on operations research. The project benefits from support by NumFOCUS, a nonprofit organisation that facilitates its sustainability through donations, which help fund events and development initiatives.

09:02, 4th August 2021

The SAS/ACCESS Developer's Corner: SUBCHAR-acteristics

When querying database management system data through SAS/ACCESS LIBNAME engines, character encoding differences between systems can cause transcoding errors that prevent data from being read into SAS correctly. The SUBCHAR= option, also known by its alias SUBSTITUTION_CHAR, was introduced to help address this by allowing users to configure how the SAS/ACCESS engine handles such errors within the engine itself, though it does not resolve issues originating in the underlying database client.

The option accepts four values, namely QUESTIONMARK, SPACE, SUB and UESC, each of which determines what character is substituted in place of any character that cannot be represented in the current SAS session encoding. When the option is active, a warning is recorded in the SAS log to signal that substitution has occurred, and users can enable the sastrace facility to obtain more detailed information about which columns and rows contain problematic characters.

The UESC value is particularly useful as it replaces incompatible characters with their Unicode escape sequences, making it possible to identify exactly what could not be translated. As of the time of writing, the option is supported across a range of platforms including Amazon Redshift, PostgreSQL, Microsoft SQL Server, Spark and several others.

18:00, 27th July 2021

Linux append text to end of file

On Linux and Unix-like systems, the >> operator can be used in the command line to append content to the end of a file, creating the file if it does not already exist. This works with commands such as echo, date and ls, where the output is redirected and added to a specified file rather than overwriting it.

Both standard output and standard error can be appended simultaneously using the &>> syntax, or by combining >> with 2>&1. When elevated privileges are required, the tee command with the -a flag or sudo with the sh -c or bash -c options can be used to achieve the same result. Further detail on redirection behaviour can be found in the manual pages for bash, zsh and ksh.

17:59, 27th July 2021

Linux Add User To Group Using Command-Line

On Linux, users can belong to two types of groups: a primary group, which is applied at login and governs ownership of files and processes, and secondary groups, which allow access to shared resources and can be used to fine-tune system security. The useradd command is used to create new users and assign them to groups during account creation, while the usermod command is used to modify existing user accounts, including group membership.

To add a user to a supplementary group without removing them from their current groups, the usermod command should be used with both the -a and -G flags, for example usermod -a -G groupname username. New groups can be created using the groupadd command and removed using the groupdel command.

User and group information is stored across several system files, including /etc/passwd, /etc/shadow and /etc/group, though these should not be edited by hand. Group membership for a given user can be verified using either the id or groups command, and all groups on the system can be viewed by reading /etc/group or using the getent command.

14:12, 26th July 2021

These OpenCV-Python tutorials offer a structured guide to using the OpenCV library for computer vision tasks, covering essential topics such as setting up the environment, handling graphical user interface elements, performing core image manipulations and applying advanced techniques in image processing, feature detection, video analysis, camera calibration, machine learning, computational photography and object detection. Additional sections explore the development of Python bindings and provide practical examples to support learning and implementation of vision-related algorithms.

19:07, 24th July 2021

How to Exclude Files and Directories with Rsync

The rsync command-line utility offers flexible options for controlling which files and directories are included or excluded during a synchronisation operation. Using the --exclude flag, users can skip specific files or directories by passing their relative paths, while multiple exclusions can be handled either through repeated --exclude flags, shell brace expansion or by listing items in a separate file referenced with --exclude-from. Glob patterns allow exclusions based on file type or naming structure, and combining --include and --exclude rules enables transfers limited to only matching files.

Before committing to a full transfer, running rsync with the --dry-run and --verbose flags allows users to preview what will and will not be copied without making any actual changes. The --cvs-exclude option provides a convenient shorthand for automatically skipping common temporary and build-related files during project directory syncs, though explicit rules are still recommended for modern version control directories such as those used by Git or Subversion. For more advanced scenarios, the --filter option extends beyond simple exclusion rules by supporting additional modifiers and merge-file functionality, following the same first-match logic as the standard include and exclude options.

  • 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.