Posts

  • Ansible Truth Table

    Everything in an Ansible playbook is first YAML, then it's Ansible.

  • Convert between JSON and JSON Lines Using jq

    With jq, we can easily convert between JSON and JSON lines.

  • Forward Multiple Remote SMB Servers on Windows

  • Inconsistent Behaviors among cp, rsync, and Others

    Inconsistent behaviors for coping directory among cp, rsync, aws s3 cp, aws s3 sync, az storage copy and gsutil cp are sometimes confusing. Here is a list of their behaviors and examples for you to better understand them.

  • Chrome OS Devices Support

    Here are links for Chrome OS devices support on AUE, Android Apps and Linux Apps.

  • Ansible Tips

    Some useful Ansible tips for quick reference.

  • OpenSSL Commands for Certificate Management

    The following are commands for dealing with SSL/TLS certificates using openssl I found useful. Categorized in X509 Certificate, Certificate Private Key or PKCS #8, PFX or PKCS #12, and CSR.

  • Fix Boot Stuck Caused by X11 Configuration or GPU Driver

    If you are running Linux on a dedicated disk, and boot it sometimes from bare metal, and other times from VMware or Virutal Box. You may have experienced boot stuck which may be caused by X11 config or display driver.

  • Azure Monitor Log Query with Full Time Range

    Query for Azure Monitor Log is by default set with a Last 24 hours time range, and we may also choose from a dropdown Last hour, Last 7 days, …, or use a datetime picker for a range. However, it's not easy to query without a time range restriction in UI.

  • Proxy localhost and loopback addresses in Chrome

    Since Chrome 72, requests to localhost (127.0.0.1) or link-local IP do not go through a proxy by default.

  • Notes on PowerShell Compress-Archive

    Compress-Archive is a PowerShell cmdlet to create an archive, or zipped file, from specified files and folders. Supported since PowerShell 5.0.

  • Convert OVA to VHD for Azure VM

    OVA (Open Virutal Appliance) is a file format used by VMware for distributing virtual appliance in a single file. If we want to migrate a VM packaged in OVA format to Azure, we'll need to convert it to the VHD (Virtual Hard Disk) format first which is supported by Azure.

  • AzCopy Gotchas

    Be careful that AzCopy may not behave as you have expected…

  • Azure Storage Explorer Always Lists Storage Account Keys for Each Storage Account

    If you are using Microsoft Azure Storage Explorer, be careful if you have audit concerns because every listed storage account will have its storage account keys listed on every startup and search operations.

  • Checklist for Restore of Azure Database for MySQL Server

  • Make VMware Workstation on Linux Use Whole Disk without sudo privilege

    With VMware Workstation, we can select a physical disk for use in a virtual machine.

  • Escape from InstallShield Offline Activation

    If you're stuck in InstallShield offline activation, and want to revert to online activation, simply remove the value HKEY_CURRENT_USER\Software\InstallShield\xx.0\OfflineTransactionPending from registry.

  • InstallScript Traps and Pitfalls

    InstallScript is the language to create installations for InstallShield. And …

  • Argv and Command Line Parsing on Linux and Windows

    Processes on Linux and Windows are created differently, and arguments to process are passed differently as well.

  • InstallShield InstallScript Project Remote Debugging

  • How UAC Affects Admin Shares, PsExec and More

    User Account Control (UAC) is a new security component since Windows Vista and Windows Server 2008. It helps prevent potentially harmful programs from making changes to computer by notifying user before administrative rights are acquired by programs or user actions.

  • Differences of Rules Between .gitignore and .dockerignore

    Git, Docker and many other programs can have an ignore file to exclude files from being considered by them. For Git, it's .gitignore, and it's .dockerignore for Docker.

  • The IP Listen List

    IP Listen List is the list of IP addresses that Windows HTTP Server API binds. By default, the HTTP Server API binds to all IP addresses (INADDR_ANY/0.0.0.0 or INADDR6_ANY/::). The HTTP Server API is used by applications such as IIS.

  • Redirect HTTP Traffic to HTTPS for IIS via ISAPI Filters

    There are many ways to redirect HTTP traffic to HTTPS in IIS, and using ISAPI Filter is one of them. It has the advantage of being programmable, though it's considered a legacy technology nowadays. Use it if you feel appropriate.

  • Setup Dual Public IP for AWS EC2

    Setting up dual public IP for AWS EC2 is easy. It's just several clicks in AWS Web Console and a config file inside EC2 away.

  • Configure IIS for Debugging

    IIS has some options to control whether detailed or custom error messages are shown when error occurs.

  • NET USE and SUBST are effective per user

    NET USE and SUBST are two commands for mapping a drive letter to a network or local path.

  • Silence Backone.NestedModel on new Operation

    Backbone.NestedModel is a plugin to make Backbone.js keep track of nested attributes. It checks nested changes on .set() method call, which is also called internally when constructing Backbone.NestedModel or Backbone.Model.

  • 0xC00CEF03, <assemblyBinding> and IIS 8 or 10

    If you've ever come across Exception from HRESULT: 0xC00CEF03 when making configuration changes in IIS Manager (inetmgr.exe) or via appcmd.exe for IIS 8, 8.5, or 10, please check whether there is an <asm:assemblyBinding> section in your web.config.

  • Using perfect-scrollbar With Select2

    To use perfect-scrollbar with Select2, we can hook on select2:open and select2:closing events, and style Select2 options container with position: relative.

  • Per Environment Configuration for s3_website

    s3_website deploys website to S3. It supports config selection via --config-dir CLI option, so you can have multiple s3_website.yml config files located in their own folders.

  • Debugging Dust.js

    If you're using Dust.js and finds something seems wrong with your templates, use the following techniques to debug your templates.

  • Comparison of Dust.js and JavaScript Syntax

    Dust.js is a JavaScript templating engine, though there are some differences of the syntax between Dust.js and JavaScript.

  • Computed height of table cell in IE

    The computed height of table cell is not consistent between IE/Edge and other browsers.

  • forEach in JavaScript and Libraries

    Library Method Applies To Method Signarture Callback Signature this arg Return value To exit early
    JavaScript Array.prototype.forEach Array (callback, [thisArg]) (value, index, array) thisArg undefined throw exception
    Underscore _.each
    _.forEach
    Array
    Object
    (list, iteratee, [context]) (element, index, list)
    (value, key, list)
    context list throw exception
    Lodash _.each
    _.forEach
    Array
    Object
    (collection, [iteratee=_.identity]) (value, index, collection)
    (value, key, collection)
    use _.bind in v4,
    thisArg in v3
    collection return false
    jQuery jQuery.each Array
    Object
    (array, callback)
    (object, callback)
    (indexInArray, value)
    (propertyName, valueOfProperty)
    value
    valueOfProperty
    array
    object
    return false
  • JavaScript Traps and Pitfalls: Three Normalizations of <textarea> Element's Value

    The textarea element represents a multiline plain text edit control for the element's raw value.

  • Developing and Debugging ISAPI Filters

    ISAPI Filters are introduced in IIS 6, and not recommended any more since IIS 7. However, there might exists legacy code which needs to be maintained. So here is the guide to develop, troubleshoot and debug ISAPI Filters.

  • C# Traps and Pitfalls: TimeSpan.Days and .TotalDays

    TimeSpan.Days returns an int representing whole days (positive or negative), while TimeSpan.TotalDays returns a double representing whole and fractional days (positive or negative).

  • Jira Tips and Tricks: Add a Search Engine for Issues for Chrome

    If you need to browse or search issues on Jira frequently and are using Chrome or Chromium browser, you may add a search engine for your project issues.

  • DOM Traps and Pitfalls: Window.event

    Window.event is a proprietary Microsoft Internet Explorer property which is only available while a DOM event handler is being called. Its value is the Event object currently being handled. (info from MDN)

  • JavaScript Traps and Pitfalls: String.prototype.replace()

    The replace() method of String returns a new string with some or all matches of a pattern replaced by a replacement. The pattern can be a string or a RegExp, and the replacement can be a string or a function to be called for each match. (info from MDN)

  • The Liquid Template Language

    The Liquid template language is an open-source template language created by Shopify and written in Ruby.

  • Source Maps are Requested without Referer Header

    A source map is a file that maps from the transformed source to the original source, enabling the browser to reconstruct the original source and present the reconstructed original in the debugger.

  • Forward and Backslashes in URLs

    A Uniform Resource Locator (URL), colloquially termed a web address, is a reference to a web resource that specifies its location on a computer network and a mechanism for retrieving it. A URL is a specific type of Uniform Resource Identifier (URI).

  • PowerShell Version, Edition and Architecture Checks

    PowerShell is a shell scripting environment developed by Microsoft with more than 10 years of history. It comes with two editions: one named as Windows PowerShell which is built on top of .NET Framework, and the other named PowerShell Core, built on .NET Core. As the .NET Framework is Windows-only, the Windows PowerShell is only available on Windows as well, while PowerShell Core is cross-platform thanks to the cross-platform nature of .NET Core.

  • Get Current Date/Time in Oracle Database

    In Oracle Database, there are some functions which can be used to get datetime, differing in the return datatype and the time zone used. Here is a comparison table of them.

  • The Build Events in Visual Studio

    Build events in Visual Studio are ones that get triggered before a build starts or after a build finishes.

  • The Table Cell `white-space: normal` on Explicit `width: auto` Quirk on IE/Edge

    If an HTML document has no associated doctype (e.g. <!DOCTYPE html>), it's in quirks mode.

  • Prevent Tooltip over Truncated Text in Safari

    Normally, a tooltip is made available to the user when an HTML element has a title attribute. However, on Safari, even if an element has no title attribute, it may get an associated tooltip when the element contains truncated text.

  • The spellcheck Attribute

    User agents can support the checking of spelling and grammar of editable text, either in form controls (such as the value of textarea elements), or in elements in an editing host (e.g. using contenteditable). – HTML Standard

  • Setting Up a Helix (Perforce) Proxy

    P4P, the Helix Proxy, or the Perforce Proxy as its original name, improves Helix (Perforce) performance in WAN topographies by mediating between Helix (Perforce) clients and servers to cache frequently transmitted file revisions.

  • Path in Different Languages

    Most programming languages have built-in support for manipulating path. For example, Node.js has path module, C# has Path class. But the semantics of them are not necessary the same, sometimes causing confusion for programmers used to one certain programming language.

  • Oracle.DataAccess.Client.OracleException with an Empty Message

    When using Oracle.DataAccess.dll (Oracle Data Provider for .NET, Unmanaged Driver), calling Oracle.DataAccess.Client.OracleConnection.Open() method, you may encounter an Oracle.DataAccess.Client.OracleException if you misconfigured your environment.

  • Counting Files and Folders in a Directory

    With command line utilities or GUI file explorer, we can count files and folders in a directory on Linux or Windows.

  • Protect Folders/Files from Deletion

    If you want to protect a folder or a file from accidental deletion, which means you have the permission required to delete it, but just want to avoid accidental operation, you may use chattr on Linux, or icacls on Windows.

  • How to Check Installed Windows Hotfixes

    Windows gets updated from time to time. To check what hotfixes have been installed, we have following methods.

  • Links to InstallShield Downloads and Documentation

  • Visual C++ Redistributable Packages and Related Registry Entries

    Here are Visual C++ Redistributable Packages and their related registry entries I've collected.

  • Download Dependency Walker (depends.exe)

    Dependency Walker is a free utility that scans any 32-bit or 64-bit Windows module (exe, dll, ocx, sys, etc.) and builds a hierarchical tree diagram of all dependent modules.

  • Samsung App Power Monitor and Android Accessibility Services

    For Samsung devices like Galaxy S7 with Android 7.0 OS, a function called App power monitor is offered, which extends battery life by putting background apps to sleep.

  • Relative URIs in Web Development

    When doing web development, we use relative URIs from time to time so that modular components can be created and the site can be more easily deployed. However, using relative URIs in HTML, CSS and JavaScript has different rules in different scenarios.

  • Show Tooltip Only When Text Overflows

    title is an attribute to represent advisory information related to the element it belongs to, typically presented as a tooltip. Sometimes we also use the title attribute to show omitted text when it's not suitable to wrap text and it overflows the container.

  • A Tip for Using npm Package del

    npm package del allows one to delete files and folders with JavaScript. When using the glob pattern **, it matches all children and the parent itself.

  • AWS S3 Permission Settings in IAM

    To access resources stored in AWS S3 when using an IAM user, we need to define a policy containing required permissions for the user.

  • word-wrap in IE/Edge and Other Browsers

    Lines break at normal word break points (e.g. whitespaces between words, specified in CSS as word-wrap: normal;, the default), and if you'd like lines break even if there are no acceptable break points (e.g. a line with a single very long word), you may use word-wrap: break-word; to force it.

  • File Not Found Errors in cmd.exe

    When writing batch scripts or dealing with cmd.exe, we may run into file not found errors from time to time. In cmd.exe, some different errors may be reported when a file/directory/drive cannot be found.

  • JavaScript OS Platform Detection

    The operating system platform on which JavaScript runs can be detected in both Node.js and browser environments.

  • Backslash in Shell/Bash

    In shell, there is certain characters with special meanings, and escaping/quoting mechanisms to remove such special meanings as well. With the combination of special characters and escaping/quoting mechanisms, the final result is sometimes unclear. Here is my attempt to clear the confusion around the using of backslash (\) character in shell.

  • The Download Attribute

    The download attribute is an attribute on <a> elements introduced in HTML5, which instructs browsers to download a URL instead of navigating to it.

  • Gulp 4.0 Upgrade Guide

    Gulp is a streaming build system, and 4.0 is the next major release of Gulp. Here is an upgrade guide for your reference.

  • Tips for "Linux on Windows" (Windows Subsystem for Linux, WSL, WSL2)

    Windows 10 adds an optional feature called Windows Subsystem for Linux (WSL) since build 14316 which allows you to run Linux distro on Windows. And since build 18917 you can run with WSL2 which increases file system performance and adds full system call compatibility.

  • Disable Windows Error Reporting

    Windows Error Reporting (WER) is a feature of Windows, which enables users to notify Microsoft of application problems and sometimes (if not at no time) to get a solution back.

  • Draw Sharp Scaled Images on Canvas

    To draw images on canvas, we can use the Canvas 2D API drawImage(); sometimes we draw the original image, while at other times we draw scaled images. However, if upscaled images are drawn without some configuration on the canvas context, it may get blurry.

  • BOM in iconv

    iconv is a command line utility to do character set conversion, or we can say it converts text from one encoding to another. As to the encoding, Unicode encoding such as UTF-8, UTF-16 and UTF-32 have the concept of Byte Order Mark (BOM).

  • The Global Object in Various JavaScript Environments

    Each JavaScript environment has its own global object (aka. root object, global namespace object). The global object can be accessed using this operator in the global scope, or by referring to its name directly. In order to write code working for multiple environments, we usually need to detect the global object for use in code.

  • Visual Studio and the BOM

    New files created in Visual Studio (and Windows Notepad and many other Windows programs) are encoded in UTF-8-BOM, where the BOM is EF BB BF in hex, which is the encoding of the code point U+FEFF in UTF-8.

  • Working With Pseudo-classes in JavaScript

    Elements on a webpage can have several states, such as :active, :focus, :hover and :visited. From time to time, we may want to know what's the currently focused element or currently hovered elements. To accomplish that, we may refer to several web APIs. But beware that behaviors of these pseudo-classes vary greatly from browsers to browsers.

  • Freeing Up Disk Space in C Drive

    When Windows is running low on disk space on system drive, it starts to complain:

  • Developing with HTTPS

    When debugging and developing web applications to be deployed with https, we may encounter many https and SSL/TLS specific problems. Here are some resources and references I've found useful in the process.

  • Setting Timeout for SignalR for Easier Debugging

    When debugging web applications utilizing SignalR, we sometimes need to step-through front-end JavaScript code. And when the stepping is in progress, no network requests initiated from other js code are going to be sent, including ping requests for keeping SignalR connection alive. Then we get a dead SignalR connection after stepping-through js code if no proper reconnection logic is implemented.

  • Git P4 on Windows

    Enjoy the Git workflow while working with Perforce!

  • List of Images (AMI) for AWS EC2

    A list of Linux releases (free of charge for software) built for Amazon Web Services (AWS) Elastic Compute Cloud (EC2) Amazon Machine Images (AMIs).

  • Web Development Resources

    To work as a web developer, we meet with new technologies every day, and need to deal with different browsers on different platforms, each of which has different characteristics and behaviors. Fortunately, we have many libraries, tools and websites to ease our life.

  • Customize and Backup Settings for Windows Console

    Ever want to change the font size and font face of your Command Prompt (cmd.exe) for a clearer display? And want to backup those settings so that they can be easily restored on reinstalling Windows?

  • Default Gems Bundled with Ruby

    Ruby comes with some gems bundled (default gems), they are not supposed to be uninstalled, and if you do uninstall them, an error is given:

  • ubuntu releases and apt sources

    Ubuntu has more than 20 major releases. Sometimes we need to work with old and end-of-life ones. Here is some useful info on ubuntu releases.

  • Using git on opkg powered systems

    To use git on opkg powered systems is simple, opkg install git gives you a copy of git. However, if you are going to use git with SSH URL, or use commands like git submodule, you might get into problems…

  • Detect a ssh session

    Sometimes I'd like to determine whether current session is a ssh one, so that I can do different things accordingly.

  • Add an "Updated" field to Jekyll posts

    Jekyll is the tool I've been using to build my blog. It uses date variable to set the date of a post. This is a predefined variable, but can also be overridden in the front matter of posts.

  • Linux Package Index

    A list of official package index/search pages for various linux distributions and embedded devices.

  • Linux Default Packages

    From time to time, I was wondering what packages are available by default on this and that system, so that I could write scripts which might depend on those packages with the confidence that they are always present.

  • Visual Studio Remote Debugger Notes and Downloads

    Update: Microsoft has come up with a new search interface for easier download of various products. For latest builds of Visual Studio (2010, 2012, 2013, 2015, 2017) Remote Tools/Debugger, use this search query (login required).

  • Line-based text processing in bash

    Recently, I've been writing a script to parse the output of ping, and set the round-trip time as the title of terminal emulator, so that I can easily know if my host is up, and how the connection latency is.

  • Detect browser language in JavaScript

    To detect a user's preferred language, we may refer to several properties on navigator. Some are supported only in latest browsers, while some are proprietary and IE only.

  • Default operator in JavaScript, and real life examples

    JavaScript has an operator called the default operator. Never heard of this? Basically, it's just the Logical OR operator, ||. It's a boolean operator, short-circuited, and evaluate to the last evaluated term. With this short-circuit effect and evaluation rule, we can make use of it to give variables and object properties default values, even to provide behavior when no truthy value is available. Thus called the default operator.

subscribe via RSS