18:40, 10th July 2015
Windows: Ignore errors with XCOPY and ROBOCOPY
When recovering data from damaged drives or performing large-scale directory operations on Windows, both xcopy and robocopy commands can be configured to continue copying despite encountering disk errors. The xcopy command uses flags such as /C to continue through errors, /H and /R to handle hidden and read-only files, /S for recursive copying and /Y to suppress overwrite confirmations. ROBOCOPY, which is available in Vista and Windows 7 or through the XP Resource Kit, offers faster performance and uses the /MIR flag to mirror entire directory structures, though this option can delete files from the destination if they no longer exist at the origin. Setting both retry attempts and wait times to zero with /R:0 and /W:0 ensures the operation proceeds without pausing when encountering problematic files. However, robocopy cannot bypass certain types of errors such as cyclic redundancy checks, and care must be taken when excluding junction points to avoid infinite loops.
18:41, 6th July 2015
You Might Not Need Underscore
The evolution of JavaScript, particularly with the introduction of ES2015 and ES2016 features, has significantly reduced the reliance on utility libraries such as Underscore for common tasks. Many functions previously considered essential for productivity in older versions of the language are now available natively through standard library methods, which are more consistent, easier to maintain and require less context for developers to understand. This shift encourages the use of built-in capabilities, which can simplify code readability and reduce the overhead of managing third-party dependencies. As modern browsers and tools like Babel support these standards, developers can leverage native array and object methods, function bindings and other features that eliminate the need for abstraction layers, fostering more sustainable and transferable coding practices.
07:35, 23rd June 2015
DNF Command Reference
DNF is a package management tool designed to handle software installation, removal and updates on Linux systems. It operates by interacting with repositories, which are sources of software packages. Users can specify packages using various formats, including names, versions and file paths, with support for pattern matching. Commands such as install, remove and repoquery allow users to manage packages, while modular filtering ensures only relevant packages from active module streams are considered. Metadata synchronisation is crucial for ensuring up-to-date repository information, though some commands may use cached data to reduce bandwidth usage. Configuration files and repository settings are stored in specific directories, and users can control package filtering through exclude and modular options. The tool also supports transaction management, enabling users to review and revert changes if necessary.
12:07, 8th May 2015
Linux / Unix ncftp: Upload Directory Tree To Remote FTP Server Recursively
The ncftp client provides an improved FTP experience for Linux and Unix systems, particularly useful when needing to upload entire directory structures to remote servers. Unlike standard FTP clients, ncftp includes enhanced features such as command line editing, command histories and recursive file transfers. Installation is straightforward through package managers like apt-get on Debian and Ubuntu systems or yum on RHEL, CentOS and Fedora distributions. The ncftpput command enables recursive uploads of complete directory trees, with options to specify usernames, passwords, custom ports and verbose output to monitor transfer progress. This utility proves especially valuable when managing remotely hosted sites where FTP remains the only available method for transferring files and subdirectories. The tool is available for FreeBSD, Solaris and most Unix variants, making it a versatile solution for system administrators needing reliable recursive file transfer capabilities.
20:00, 4th May 2015
Online CSS Unminifier
This tool was developed to convert minified CSS into a more readable format by using JavaScript and regular expressions, allowing users to adjust tab width for better formatting. Initially created as a simple online utility, it was later adapted into a standalone Node.js project, making it accessible for local use via npm. The tool gained widespread appreciation for its utility in debugging and reviewing minified stylesheets, though some users noted limitations in handling specific syntax or embedded data. Over time, the developer incorporated feedback to address these issues, and the tool remained a popular resource among developers for its straightforward approach to improving code legibility.
01:55, 5th March 2015
The FINDSTR command is a utility used to search for text patterns within files using regular expressions, offering options to specify search criteria such as case sensitivity, line positions and file locations. It supports parameters like /b for matching patterns at the beginning of a line, /i for case-insensitive searches and /s to include subdirectories, while allowing users to define search terms directly or read them from external files. Examples demonstrate its use in locating specific words, patterns, or lines within files, including the ability to filter results by line numbers, file names, or seek offsets, making it a versatile tool for text analysis in command-line environments.
01:51, 5th March 2015
How to Read the Value of an HTTP Header
Reading HTTP header values requires only a few lines of server-side scripting code, with the implementation varying slightly across different programming languages. In ASP, both VBScript and JScript access headers through the Request.ServerVariables collection, using the format HTTPx where x represents the header name with hyphens replaced by underscores. Java Servlet and JSP environments utilise the getHeader() method of the HttpServletRequest object, passing the header name directly with hyphens intact. Perl stores header values in the %ENV hash, again replacing hyphens with underscores and prefixing with HTTP. PHP follows a similar pattern to ASP and Perl, storing headers in the $_SERVER array with the same naming convention as HTTP_x with underscores replacing hyphens. Each language offers additional pre-defined server environment variables beyond these HTTP headers, though these fall outside the scope of basic header retrieval for user agent and device capability detection purposes.
17:06, 9th December 2014
LIBNAME Statement Syntax :: SAS/ACCESS 9.3 Interface to PC Files: Reference
The LIBNAME statement in SAS can be used to associate a library reference with external data sources such as Microsoft Excel or Access files, enabling interaction with these files as if they were SAS datasets. It requires specifying a library name, an engine name corresponding to the file type and optionally a physical path and filename, though the file extension often suffices to identify the engine. Connection options like PATH, INIT and PROMPT allow customisation of how SAS connects to the data, while specific parameters for Access and Excel files handle security settings, version compatibility and database interactions. The statement also supports clearing or listing library attributes, facilitating dynamic access to external data objects through SAS procedures and data steps.
19:14, 8th November 2014
The SQL LIKE Condition enables pattern matching in queries using wildcards such as %, which matches any string length and _, which matches a single character, with syntax allowing optional escape characters for literal wildcard use. It is commonly used in WHERE clauses for filtering data and is case-insensitive for string comparisons, though care is needed with char data types due to trailing space padding that may affect results. Examples demonstrate its application in selecting records based on partial matches, excluding specific patterns with NOT and escaping special characters for precise searches. Additionally, combining LIKE with functions like UPPER can facilitate case-insensitive searches, ensuring flexibility in querying diverse data formats.
19:59, 31st May 2007
Being a Safari subscriber, I found a pleasant surprise awaiting me in this month's email newsletter: eBooks from SAS Books are now available on Safari. Having a brief look, I found a small but useful selection. Topics like the SQL procedure, the Macro language and Enterprise Guide caught my eye, but there's more than this on offer. It'll be interesting to see where this leads...