XLS Transforms of XML Pages Can Be Run in Powershell

I discovered that powershell can run xml transforms, like ones to make HTML pages from XML files.  Below is a sample:

# PowerShell doesn’t always set the current directory path
[IO.Directory]::SetCurrentDirectory((Convert-Path (Get-Location -PSProvider Filesystem)))

# set the offset value
$utcOffset = read-host -Prompt “Please input UTC offset as a number -5 (for EST) -4 (EDT) -8 (PST) -7 (PDT)”
Write-Output “Going to process BXF*.xml in this directory with $utcOffset offset”

# false to document mode, true to allow c# scripts
$xlstSettings = New-Object System.Xml.Xsl.XsltSettings($false,$true)

$myXslCompiledTransform = New-Object System.Xml.Xsl.XslCompiledTransform
# The Resolver is dummy argument not used
$myXslCompiledTransform.Load(“PS_BXFAsRunToHtml.xsl”,$xlstSettings,(New-Object System.Xml.XmlUrlResolver))

# set up list to pass variables to the XSLT and using it for utcOffset
$xlstArgumentList = New-Object System.Xml.Xsl.XsltArgumentList
$xlstArgumentList.AddParam(“utcOffset”,””,$utcOffset)

# Getting all the BXF files in the current directory
#
$currentDir = (Convert-Path (Get-Location -PSProvider Filesystem))
Get-ChildItem $currentDir -Filter BXF*.xml |
Foreach-Object {
$baseFileName = $_.BaseName
$inputFile = $_.Name
Write-Output “Found $inputFile”
$outputFile = “$baseFileName.html”
# write out content
Write-Output “Creating $outputFile”

# Edit the create value to set your output file
$xmlWriter = [System.Xml.XmlWriter]::Create($outputFile)
# Edit the first function parameter to set the BXF file
$myXslCompiledTransform.Transform($inputFile,$xlstArgumentList,$xmlWriter)
# This shows the output in the browser
[Diagnostics.Process]::Start($outputFile)
$xmlwriter.Flush()

$xmlWriter.Close()
}

A Few Mac OS X Tips

jellyAppleFormatting EXFat Disks
When formatting a disk in EXfat with the Mac, I found that format is only compatible with windows if you use the “Master Boot Record” setting.

Fonts Needed for Word Compatibility with Pages
Calibri font and Cambria are downloaded as a mac install from this web site: http://www.rmtweb.co.uk/calibri-and-cambria-fonts-for-mac

Adding Keyboard Shortcuts for Sub Menu Items
Later versions you can use “->” phrase to enter sub menu items.  An example is “File->Export To->PDF…” for pages to have short for create PDF. The older versions of the operating system used just the “-“ hyphen character.

Adding Keyboard Shortcuts for  Apple Symbol Menu Items
This can still be used on application by application basis. Just consider it as root menu item, example “Location->Automatic”.

Creating Image Preview Icons for .FLV and Other Files
Alternatively, if you have Homebrew installed, you can install using Homebrew Cask:
brew cask install qlvideo
More information on the following web page:
https://github.com/Marginal/QLVideo

Writing to NTFS Disk
Install NTFS-3G from Homebrew by opening a Terminal and entering the following command.
brew install homebrew/fuse/ntfs-3g
More information on the following web page:
https://github.com/osxfuse/osxfuse/wiki/NTFS-3G

Windows 10 NTFS Problems with External SSD

Drive Corruption ErrorI don’t know the cause of NTFS corruption of my external SSD, in my new “Windows 10” 2-in-1 PC.  Other comment posts seem to link the issue to the file system and the “Fast Startup” power option.  (This change to the PC shutdown, is basically just is old hibernate mode used x menu optionsall the time.)  I find this interconnection hard to believe, to an external non-bootup drive.

The fix I found for this was running “chkdsk /f e:” from the new “Command Prompt (Admin)” command found after hitting the Windows Key and x at the same time.

Counting Stars (One Republic Song)

I boucountingght, yes, bought music from the iTunes music store on my phone.  Apple is making owning music very difficult for people who don’t want Apple’s streaming site. (I got in to Pandora first, and don’t want to try this new offering.)  Most of my playlists are automatic, an example: play the all music I rated as 5 stars.  I spent several minutes trying to find where the new iOS where to set the stars; when the new heart per song is clearly visible.

Giving up that day and trying web searches today, I found the stars can be seen by clicking song title in “Now Playing” mode.  iPhone used to be intuitive, but now you need to be shown tricks to use desired features.

Thunderbolt Ethernet Connector Requires New Location

ThunderboltMy MacBookPro doesn’t have wired Ethernet connects, and transferring gigabit files via WiFi takes forever.

So I purchased an Ethernet adapter to the Thunderbolt connector.

With El Capitan (or earlier MacOS software update) required that you needed to create a new location and re-add the Thunderbolt device. So I looked in the the settings and found in the /Library/Preferences/SystemConfiguration/ folder the NetworkInterfaces.plist settings for older Thuderbolt adaptors listed these (obviously external devices) in Dictionary item of “IOBuiltin” to “YES”. Sometimes software developers just have to fix the settings at the expense of ease of use.

Problems with Mac OSX Formatted Portable Drives

ListOfNewFoldersI haven’t totally traced down the problems, but I have had two OSX portable USB drives stop wanted to mount.  I had formatted both drives as Mac OS Extended (Journaled).

They just stopped wanting to mount and OSX’s Disk Utility wouldn’t repair the disks to a state where they would mount.

I didn’t loose data because I purchased Stellar Volume Optimizer, which also fixes disks.  I got the data off the disks, reformatted the disk as simple Mac Drives (the default in Disk Utility) and put it back.  When the program fixed the drive it found extra folders used in formatting.

I suspect a bug in 10.9.4 and using Journalling on USB drives, but couldn’t find any comments on the web.

AI in Television Lacking Common Sense

AI-angleYears ago I saw a television program on Artificial Intelligence, which still effects my thinking today.  “The Machine that Changed the World: The Thinking Machine”, program had a final segment on Cyc Corp, where they were saving common sense rules to a computer. If you follow this link click on last segment, 1990s program.

This television season with at least 2 1/2 programs dealing with computer learning and the fear associated with mankind giving up the top knowledge  keeper job on this planet; I keep referring to problems in this video of CYC reconciling its database.  The TV programs are “Person of Interest”, “Almost Human” and “Intelligence” with Intelligence being a stupid remake of the Terminal Man.

These programs skip the common sense problem at jump to AI learning compassion, caring, or greed and ambition.  Did they see how alien an intelligence trapped in a machine would seem to us?  Or us and our world to that intelligence?