2012-09-08

Convert DOS Lines Into One Comma-Separated Line

Note to myself: Convert multiple DOS lines into one comma-separated line using this GnuWin command: tr -s "\r\n" ,. DOS lines use two control characters \r\n to mark the end of a line. The -s option replaces multiple original characters with only one replacement character.

2012-08-25

Resize HFM Running Tasks for Smaller Screens

The list of running tasks in HFM is often too wide to be viewed without scrolling the Internet Explorer (MSIE) window horizontally (unless you have a really big monitor). On a notebook, the Description column is often rendered under the right edge of the browser window. My workaround is to use a custom CSS to break the text in cells into separate lines so that the output is formatted to fit the window's width.

  1. Create a CSS file called Personal.css.
  2. Add this line to the file: td.line { white-space: normal !important; }.
  3. Open MSIE.
  4. In MSIE:
    1. Select menu item Tools, Internet Options.
    2. Press the Accessibility button.
    3. Tick the User style sheet checkbox and add the path to your CSS file in the Style sheet text field.

Using !important allows your custom CSS to override the HFM CSS definition, and white-space: normal allows the browser to break text in table cells at white spaces, instead of keeping the text in one line (HFM had white-space: nowrap).

2012-07-21

On Writing Scheduled Tasks for Windows AT Command

Less painful ways to write scheduled tasks for the Windows at command.

  • Use absolute paths to reference files or folder because at starts in a default folder, not the folder you are currently using.
  • Use caret (^) to escape the redirection characters so that you can combine the output (stdout) and error (stderr) streams to a file.

Here's an example that combines those tips: at 12:00 C:\Temp\Test.cmd ^> C:\Temp\Test.log 2^>^&1.

It is also be useful to dump the at command's environment variables so that you can check if the variables are set correctly (e.g. PATH): at 12:00 cmd /c set ^> D:\Temp\Env.txt.

2013/12/10: With Task Scheduler, you don't need to use the caret to escape the cmd metacharacters, i.e. Program = cmd and Arguments = /c C:\Temp\Test.cmd > C:\Temp\Test.log 2>&1.

2012-07-07

Excel Data Validation Drop Down Control Not Visible

A user found a strange problem in an Excel workbook: the data validation drop down control did not appear for any data validation cells in a specific worksheet (they appear in other worksheets). I tried the possible solutions but they did not work.

The solution came when I tried to resave the workbook as an Excel 97-2003 XLS file and the Excel compatibility checker reported some formulas were unavailable (in this case, SUMIFS) for earlier versions of Excel. After saving the workbook as an XLSX file to avoid this error, the data validation drop down control reappeared in the worksheet. It looks like opening an XLS file using Excel 2007 in compatibility mode may cause unexpected problems like this.