Technology Tales

Notes drawn from experiences in consumer and enterprise technology

12:45, 16th August 2021

How to Overlay Plots in R - Quick Guide with Example

Overlaying plots in R can be achieved using the lines() and points() functions to combine multiple datasets within a single visualisation. A scatter plot can be created first with the plot() function, followed by the addition of line or scatter plots using lines() or points() with specified parameters such as colour, line type and point symbols.

For example, three line plots can be overlaid by initially plotting one dataset and then sequentially adding others with distinct colours and legends to differentiate them. Similarly, two scatter plots can be combined by plotting one dataset and then using points() to add another with different colours, ensuring clarity through the inclusion of a legend. These techniques allow for the simultaneous comparison of multiple data series, enhancing the ability to analyse relationships and patterns within the data.

10:47, 9th August 2021

Installing Julia on Ubuntu

Installing Julia on Ubuntu can be achieved through multiple methods, with the most straightforward approach involving downloading the latest stable version from the official Julia website, extracting the files, relocating them to a system directory and creating a symbolic link to enable command-line access. An alternative method using the apt-get package manager is less recommended due to potential version discrepancies. Once installed, integrating Julia with Jupyter requires launching the Julia REPL and executing commands to install the IJulia package, which automatically configures the kernel for use within Jupyter Notebook or JupyterLab environments.

17:55, 7th August 2021

Top 5 Tips for RStudio Workbench and Desktop

RStudio Workbench, formerly known as RStudio Server Pro, has introduced several features and updates aimed at enhancing productivity for users working with R. Among the key improvements are the ability to utilise keyboard shortcuts for common tasks such as running code or managing documents, a multi-column layout that allows for simultaneous viewing of multiple files, tools for efficiently locating and tracing functions and variables across projects, multi-cursor editing to streamline code modifications and the capability to quickly access function source code and documentation. These features are designed to support more efficient coding, data analysis and application development, offering users greater flexibility and control over their workflow while working with R and its associated tools.

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.

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