How to Be Unobvious

A user wrote in because they button they were using to show the Desktop was no longer present.  We all had a good laugh when we saw their attached image.

Original Screen Capture
Original Screen Capture

The problem was were all laughing for the wrong reason.

They were not in fact using the close button on a window to show the Desktop as the above may suggest.  No.  They were actually using the Show Desktop button at the far end of the Taskbar.  We should have been laughing at the oddness of the image.

Take a closer look.

The Minimizer
The Minimizer

In reality it is important to understand what the other is saying.  This will ensure that you are laughing for all the right reasons.

Share

Mac Lock Screen Keyboard Shortcut(s)

The following is a method for creating a keyboard shortcut on a Mac such that the shortcut will lock the screen. This method involves using the Mac’s Automator and a bit of shell script. It is also important to set certain settings. We are going to show two different shortcut options. They can be run in parallel if desired. They also may be modified within reason and remain equally effective.

Launch Automator

  • From Automator choose File –> New –> Service which will open a new automation dialog
  • Here you have two (inclusive) options:
    • From the automation dialog select Utilities from the left-hand pane and then Run Shell Script
    • From the automation dialog select Utilities from the left-hand pane and then Start Screen Saver (pictured)
Utilities: Run or Start
Utilities: Run or Start
  • What’s the difference?
    • The shell script puts the system directly into the suspended state.
    • Suspending the system (via script) is slower but requires no additional settings.
    • Launching the screen saver does just that.
    • Launching the screen saver requires certain screen saver settings (below) and is faster.

The Automation (Two Options)

  • This is the line of code for you to copy and paste as below: /System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend
  • Again you will follow either the Run Shell Script path or the Start Screen Saver path:
    • Note the “no input” and the “any application” settings in both drop-downs for both methods below.

Via Shell Script (using Suspend):

  • Call the Run Shell Script something clear: LockViaSuspendShortcut
  • This is the line of code for you to copy and paste as above: /System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend
    • You will see the argument -switchToUserID for CGSession as well. This does not lock the screen. Do not use it.)
  • The Shell Script method (using suspend):
Lock via Script
Lock via Script

Via the Screen Saver:

  • … or Call the Start the Screen Saver something clear: LockViaScreenSaver
  • The Start the Screen Saver method:
Lock via Screen Saver
Lock via Screen Saver

Note:

  • If you need to delete an Automator Workflow, you can locate them in ~/Library/Services/
  • It may be possible to make an automation available to all users (untested) by placing it in /Library/Application Support/Apple/Automator/

Set Up the Keyboard Shortcut(s)

  • Once you have created these automations, you will only need to assign a shortcut for each.
  • Navigate to System Preferences –> Keyboard –> Shortcuts –> Services
  • Since you have used clear names per the above, you will have no difficulty identifying which automation is which.
Shortcuts
Shortcuts
  • The field to the right of the name of the automation holds the key combination.
  • Choose what you’d like and choose wisely.
    • LockViaScreenSaverShortcut is set as ctrl-alt-L
    • LockViaSuspendShortcut is set as shift-super-L
  • The mouse may need to be out of a VM in order for the shortcuts to be captured by the Mac.

Additional Screen Saver Settings

  • Open System Preferences –> Desktop & Screen Saver –> Screen Saver
  • Set “Start after:” as “5 Minutes
  • Open System Preferences –> Security & Privacy –> General
  • Set “Require password” as “5 seconds
    • These fives seconds will give you a small buffer to keep your screen from locking if you are reading an article and it goes blank.
Share

Date and Time on the Windows Command Line

What a mess.  All you want to do is insert a timestamp into a file name so as to make it easily organizable.  That ought to be simple, right?

Wrong!

What a mess.  There are two real issues at the heart of this.  First, Windows is deathly afraid of nine characters:

\ / : * ? ” < > |

To Windows, those are the most frightening things imaginable.  Do you feel the fear?!  None of their file systems (from FAT16 to NTFS) can manage files using those characters.  Don’t get me wrong, some of those characters can be problematic in a file name.  Can be.  But this prohibition really gets in the way.  Think about how time is formatted literally everywhere.  And who doesn’t love the value of the question mark…

The second issue is that the content of the DATE variable is inexplicably the result of the region and not independent of the region.  So, if a user changes the date display according to where they are, if they change it from the default, the output of the DATE variable is different and must be parsed differently.  (The same problem exists with the TIME variable and the 24 hour clock.) . Again, unfathomable why anyone would use this as a starting point.

In short, I can’t offer a definitive line of code for giving a file name an up to the second timestamp.  I can only offer a line that may or may not need to be tweaked for a given user.

This is for the default date and time settings:

%date:~-4,4%%date:~-10,2%%date:~-7,2%_%time:~0,2%%time:~3,2%%time:~6,2%

This allows you to create a command like this:

move file.txt %date:~-4,4%%date:~-10,2%%date:~-7,2%_%time:~0,2%%time:~3,2%%time:~6,2%_file.txt

This slices up the DATE and TIME variables (using ~ and then some basic coordinates) to give a result (with an underscore between the date and the time).  If the user is employing a different date (or time) format you’ll have to play around with the coordinates to grab the correct chunk.  Best of luck.

Go get ’em, tigers!

Share

Rotate Android Videos in Ubuntu

It seems that if I don’t have my phone angled just so, it will invisibly rotate my video.  The rotation at the beginning of the film is what is used throughout, so if you think you have it horizontal and it turns out your first frame was vertical the entire film is then vertical.  And you won’t realize this until you attempt playback.

There are probably a million and one ways to fix the video rotation.  Unfortunately none of those are built into the phone.  I downloaded the video onto my laptop (running Ubuntu 16.04).

Most of the advice I found was to use a program called Avidemux.  I have used it in the past to change audio or video codices or move a video into a different container/wrapper (to mkv for example), and I have found it useful enough.  However, it would appear that Avidemux is no longer present in the usual Ubuntu repositories as both apt and the Ubuntu Software Center did not find it.

I poked around and found a pretty simple command line rotation solution using ffmpeg here.  I tried the version of the command in the response, but encountered an error:

[aac @ 0x6cf380] The encoder ‘aac’ is experimental but experimental codecs are not enabled, add ‘-strict -2’ if you want to use it.

Since my phone uses aac (apparently) I needed to add the -strict -2 in order to enable an experimental encoder.  So metal!

ffmpeg -i Desktop/VID_20161008_144216.mp4 -vf “transpose=2” -strict -2 Desktop/VID_20161008_144216_rotatecc.mp4

It worked great.  The response offers some other rotation options, but of course the man page for ffmpeg is extensive.

Share

Notes from Possible cifs-utils Bug

Here follow my testing notes concerning a problem which has arisen in the way file shares are being accessed from various Ubuntu client machines.  I am listing behaviors for both the “Connect to Server” function (via Nautilus) and those involving the mount command (especially via the fstab file).

Files and folders used to be accessible and they now are not.  These notes will help determine the exact cutoff point for the failures, though sussing out those points could be exacerbated if there are multiple causes for the errors.

The test scenario is as follows.  There is an Ubuntu server (which happens to be running 10.04 though this is not critical at present).  This Ubuntu server has multiple shares.  Various files and folders within these shares contain (at least) two known effected characters:  the colon (:) and the question mark (?).

When those locations are mounted by mount (whether via fstab or no) using a 12.04 client machine the files and the folders which contain either (or both) of those characters in their respective paths are accessible as would be expected for any such file share.

(It is of interest to note that for this particular Samba configuration, the server is not using “mangled names” (mangled names = no).  Enabling mangled names would eliminate the characters in question and thus make testing irrelevant.)

Below you will find testing results for Nautilus and mount (for each character tested) as well as version information for cifs-utils (used by mount).

(I have tested Nautilus to help eliminate server issues as a concern, but as you will see there appears to be an issue with Nautilus as well.  For my purposes, I am testing with an eye toward fixing the problem with mount and fstab.  Perhaps after I have managed that I will look again at the Nautilus problem.)

Finally, I am not a developer.  I will be doing all the testing I am able and I will file the appropriate bug reports.  I would also work with developers to perform any testing as might prove useful.

From /etc/fstab:

//server/share    /media/share        cifs    guest,iocharset=utf8 0 0

Ubuntu 12.04

  • Connect to Server (Nautilus)
    • ? folders and files function as expected
    • : folders show “- -“, throw error when opened; files play
  • mount fstab
    • ? folders and files function as expected
    • : folders and files function as expected
  • apt-cache policy cifs-utils:
    • Installed: 2:5.1-1ubuntu2
      Candidate: 2:5.1-1ubuntu2
      Version table: 2:5.1-1ubuntu2 0
      2:5.1-1ubuntu1 0

Ubuntu 14.04.5

  • Connect to Server (Nautilus)
    • ? folders and files function as expected
    • : folders show “- -“, throw error when opened; files play
  • mount fstab
    • ? folders show “0 items”, throw error when opened; files error
    • : folders show “0 items”, throw error when opened; files error
  • apt-cache policy cifs-utils:
    • Installed: 2:6.0-1ubuntu2
      Candidate: 2:6.0-1ubuntu2
      Version table: 2:6.0-1ubuntu2

Ubuntu 14.10

** 14.10 is out of service and thus I cannot download cifs-utils.

  • Connect to Server (Nautilus)
    • ? folders and files function as expected
    • : folders show “- -“, throw error when opened; files play
  • mount fstab
    • ?
    • :
  • apt-cache policy cifs-utils:
    • Installed:
      Candidate:
      Version table:

Ubuntu 15.04

  • Connect to Server (Nautilus)
    • ? folders and files function as expected
    • : folders show “- -“, throw error when opened; files play
  • mount fstab
    • ? folders show “0 items”, open but empty; files play
    • : folders show “0 items”, open but empty; files play
  • apt-cache policy cifs-utils:
    • Installed: 2:6.0-1ubuntu2
      Candidate: 2:6.0-1ubuntu2
      Version table: 2:6.0-1ubuntu2 0

Ubuntu 15.10

  • Connect to Server (Nautilus)
    • ? folders and files function as expected
    • : folders show “- -“, throw error when opened; files play
  • mount fstab
    • ? folders show “0 items”, throw error when opened; files error
    • : folders show “0 items”, throw error when opened; files error
  • apt-cache policy cifs-utils:
    • Installed: 2:6.4-1ubuntu1
      Candidate: 2:6.4-1ubuntu1
      Version table: 2:6.4-1ubuntu1 0

Ubuntu 16.04.1

  • Connect to Server (Nautilus)
    • ? folders and files function as expected
    • : folders show “- -“, throw error when opened; files play
  • mount fstab
    • ? folders show “0 items”, throw error when opened; files error
    • : folders show “0 items”, throw error when opened; files error
  • apt-cache policy cifs-utils:
    • Installed: 2:6.4-1ubuntu1
      Candidate: 2:6.4-1ubuntu1
      Version table: 2:6.4-1ubuntu1 500

Ubuntu 16.10

  • Connect to Server (Nautilus)
    • ? folders function as expected; files do not show at all
    • : folders show “- -“, throw error when opened; files error
  • mount fstab
    • ? folders show “0 items”, throw error when opened; files error
    • : folders show “0 items”, empty folder icon when opened; files error
  • apt-cache policy cifs-utils:
    • Installed: 2:6.5-2ubuntu1
      Candidate: 2:6.5-2ubuntu1
      Version table: 2:6.5-2ubuntu1 500

And that is that.  We shall see where this takes me.  Thanks for reading.

Share

Date Display in Ubuntu

Don’t like the normal date display in Ubuntu?  It can be slightly modified using the usual methods, but if you want full customization you can do so with a tool called the dconf Editor.  It’s a part of the dconf-tools package:

sudo apt install dconf-tools

Once you have it installed you can then run the dconf Editor.  To create your own custom display for the time and date, dig down to this location:

Com –> Canonical –> Indicator –> Datetime

Change the time-format to “custom” and enter your desired pattern.  I used this:

%a %d %b %H:%M

or

| %a %d %b %Y | %H:%M |

or

| %Y-%m-%d %a | %H:%M |

Feel free to experiment with other variables.  This first configuration gives me day date month 24-hour:time.

Have fun with that.

Share

Import into Automatic Pool in VMware Horizon

Importantly there are two kinds of pools in Horizon: automatic and manual.  Automatic pools are pointed to a specific template and spawn new machines based on that template, and manual pools will accept the importation of, really, any viable virtual machine.

But what if you find that you need to move a machine from one location into an automatic pool.  There is no intended functionality for doing this.  However, we are humans and we are clever.

I will lay out for you the procedures I used.  We have a domain and our machines are all domain joined.  You may want to make adjustments for your specific situation, but the essentials here should guide you nicely.

Before you begin, let your user know that there machine will be unavailable for half an hour to an hour and that you will want them to test access once you have made the changes.

  1. Remove the entitlement for that user from the machine and the pool.
  2. Remove the machine from the domain and shut it down.
  3. Delete the machine object from Active Directory.
  4. Use the Clone to Template function in vSphere to clone the machine to a safe template location.
  5. (You may at this point delete the original VM.)
  6. In Horizon, point the destination pool at your newly cloned template.
  7. Add a new machine to the automatic pool from the template you just cloned.
  8. Point the destination pool back to its preferred template.
  9. (You may at this point delete the cloned intermediary template.)
  10. Power on the newly added virtual machine and add back to the domain.
  11. (Move it to the correct OU in AD.)
  12. Entitle the user for the destination pool and newly cloned machine.

It’s a bit of a hassle but it has worked dozens of times for me.

Have fun!

Share

Store Blocked in Win10 after Upgrade

I updated many (near 50) virtual Win10 machines to the latest release build.  Took about two hours per machine.  At least some of those machines no longer were able to access the Store.

The Store Is Blocked
The Store Is Blocked

I love reading “Check with your IT or system administrator” because that’s me.

Google has a lot of results for 0x80070EC, but including Win10 and Store helped me track down a Registry key location.  Since we have no Group Policy in place concerning the Store, I went ahead and remove the restriction.  You can find the key in question at HKEY_LOCAL_MACHINE –> SOFTWARE –> Policies –> Microsoft –> WindowsStore and it’s called RemoveWindowsStore.

Edit the Registry
Edit the Registry

You want to change that 1 to a 0.

Edit Dword
Edit Dword

No reboot required.  Go Store all you want.

Share