All posts by JamesIsIn

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

Clementine DB Error (crashes)

I was having some trouble starting Clementine this morning.  This came after I initiated a reboot.  Reboots and further attempts to start Clementine all ended in Clementine crashing.  Something was seriously misaligned.

I started it from the command line (by typing clementine and hitting Enter).  This also resulted in a crash but did give some interesting output in the Terminal.  Near the end I found this information in an error:

CREATE TABLE directories (  path TEXT NOT NULL,  subdirs INTEGER NOT NULL)

A quick search found this article which did have a viable solution.  It is a rather heavy-handed solution and I do not recommend it unless nothing else works.

Instead I modified that solution into one which didn’t delete all of my playlists and configuration changes for Clementine.  First I simply moved the entire Clementine configuration folder (similar to their deletion except I still have the files):

mv ~/.config/Clementine ~/.config/Clementine_old

Starting Clementine in the usual manner now worked.  So the theory was sound.  Now I wanted to see if I could get my database back.  I closed Clementine and ran this command:

mv ~/.config/Clemetine_old/clementine.db ~/.config/Clementine/clementine.db

When I launched Clementine again I had my database back (including all of my playlists).  Next I wanted to see if I could keep my old configuration file so I again closed Clementine and ran this command:

mv ~/.config/Clementine_old/Clementine.conf ~/.config/Clementine_old/Clementine.conf

This also worked.  So it would appear that it was perhaps not file corruption (as the article linked above suggests) but rather something more subtle and complex.  Regardless, at this point I was satisfied with the success of my fix, but my scientific curiosity was wondering about the other files.  Altogether there were six files in the Clementine configuration folder:

Clementine.conf
clementine.db
clementine.db-journal
clementine.db.bak
clementine-scope-backup.db
jamendo.db

(The clementine.db-journal file may not be present on all systems.)

I have no idea what those other four files do (well, except the jamendo.db folder which is presumably the database if one uses Jamendo through Clementine), but I tried moving each one back into the main folder one at a time (restarting Clementine between each one).  None of them had any effect.  This further supports the thought that it was a problem with file corruption.

I’m still not clear what caused the issue, but this is as far as I am willing to investigate at this time.  Hope this helps you.

Share

USB Drives Mount as Read-Only

Today Nautilus decided it just didn’t like my mounted USB devices.  At first it was a brand new 64 GB FAT32 drive, and so I figured I would just reformat it.  This didn’t change anything; Nautilus (the file browser in Ubuntu 14.04) was insisting that I had read-only permissions on the drive and would not allow me to write to it.

Apparently there is a bug (not necessarily in Nautilus because I am told this will work with other file browsers) that is pretty easily fixed.

Open your terminal and run these two commands:

mv ~/.config/nautilus ~/.config/nautilus-bak
sudo killall nautilus

The first one moves the configuration file for Nautilus (modify if you are using a different file browser) to a backup copy.  The second kills (stops, terminates) the running Nautilus session.  You will need to launch a file browser window to get Nautilus (or other) running again, but that should return your USB drives to writable.

Share

Random Spamdom

You know what’s fun?  Spam!

I think this one was from a politician-bot.

In this awesome scheme of things you’ll get an A just for hard work. Where exactly you lost everybody was on the details. You know, they say, the devil is in the details… And that couldn’t be much more true right here. Having said that, let me inform you precisely what did give good results. Your writing is actually rather convincing and that is most likely the reason why I am taking the effort in order to comment. I do not really make it a regular habit of doing that. Second, even though I can see the jumps in reason you come up with, I am definitely not certain of just how you appear to connect the details which inturn produce the final result. For the moment I will, no doubt subscribe to your point however wish in the near future you connect your dots better.

Any horse lovers out there?

If you offer him $10,000 for your horse, he’ll almost certainly probably market it
to you. Other factors, for instance pedigree,
trainer and jockey riding the horse and whether or not the horse
performs well about the turn or on dirt can also be carefully considered
by handicappers of their quest for that win. The one’s which do
win, have reached such short prices, you won’t
ever recover your losses.

Not clear why I would offer someone else money for my horse, but I’m getting pretty excited nonetheless.

Share

Last Gasp of a Dying Breed?

Remember when Sony tapes were relevant?  I had friends, even after the advent of the CD, who would live an die trading tapes.  They would even claim tapes where the only legitimate medium.  I miss those guys.

Oh, wait.  No, I still hang out with them.  One friend in particular still has a massive collection of tapes.  Go figure.

Sony has apparently introduced a new tape technology that makes an impressive expansion in what tapes can hold.  The number 185 TB is being passed around (though it is not clear to me which particular tape is in reference there).

Check it out:

R.I.P. iPod: Sony unveils cassette tape that can hold 64,750,000 songs

Never mind the silly title (iPod = portable digital music player just like Walkman = personal tape player) and the grandiose claims, this is an interesting change in tape storage capacity.  Even if the personal tape player never returns (and why would it?), this will have compelling implications for IT professionals doing backups.

And in case you are wondering why the personal tape players will not return, I offer this gem from them Interwebz:

Ultimate Demotivator
Ultimate Demotivator

Find more here.

Share