Saturday, August 24, 2019

Google Platform Library Authentication

You must include the Google Platform Library on your web pages that integrate Google Sign-In.
<script src="https://apis.google.com/js/platform.js" async defer></script>

Monday, July 10, 2017

Archiving Media Files


I have always been in the habit of copying my dvds electronically and storing them online (and to a server that I use for backups in my garage) so that I would have a backup in case of loss or damage. However since the advent of services like Plex, I now can view those copied dvds on a smart tv or other enabled device. Unfortunately the software I use (Magic DVD Ripper) creates a folder with the dvd name, then the media file in that folder is simply named "title1.mp4" (or what ever title it was on the disk it was copied from). So I wanted to automate the creation of a media library that could be used with services like Plex.
Some design considerations
1) As I mentioned, the file names are generic but the folder name does contain the movie name.
So I need the file to be renamed same as the folder name and moved to the root, then the folder with the movie name can be deleted.

2) I want the movies to be organized by genre so I can choose a certain type of movie. This also makes for less files in a folder.
So I am using a Web API by IMDB where I can pull movie information including genre so that I can sort the movies accordingly. It will also have the release date so if the release date is within a certain time frame, it will go into a folder called "New Releases, regardless of the genre. (In the future I will also take advantage of a link that is supplied for the movie poster which I can use for the icons).


So here is the root folder. The folders contain the movie files named "title1.mp4".
There is also a movie already in the root.
And here is what it should look like after the process runs.

 
Here is a link to the solution 
(Yes I understand there isn't a lot of error handling, but I was in a hurry :) )

Thursday, June 23, 2016

Azure!... god bless you!!!

Although I have some experience with Microsoft Azure, I do sometimes have difficulty articulating what is is and what is does. I think one of the best explanations I've heard come from Bob Tabor of Microsoft. He explains that "Microsoft Azure allows you to perform virtually any compute or data storage operation by provisioning and scaling the necessary resources on demand and a pay-as-you-go basis". Sounds simple, don't it? 

So I present the cloud computing stack.

Infrastructure as a Service (IaaS). With IaaS you manage everything that runs within the OS, and your cloud provider handles the rest: the physical management of the servers, taking care of storage and the network, virtualization, backup power, etc

Platform as a Service (PaaS) With the OS, the middleware and the runtime are now also managed by the cloud provider, so you can focus mainly on how to build your application and where to put the data. 

Software as a Service (SaaS). This is where you simply want to use some software without having to worry about anything else. 

You can also mix and match the different levels of service, depending on how much control you want to maintain. So to explain this I once again reference an explanation from someone much smarter than me (but not as good looking), Scott Hanselman. The different levels of "control" can be compared to the differences between  owning a home, renting a room (or a home) or renting a hotel room.



So what would be the advantages of employing such a solution?


Thursday, June 2, 2016

Back It Up Mister !!!

 I have a number of computers throughout my house (embarrassed to say how many) and all important files need to be copied to my main server which uploads it to the internet for archiving. This can be quite tedious doing this manually especially when you may have multiple copies of a file on different computers as well as the possibility that an existing copy may already be on the backup server or even on the archive server (internet). So I have been using xcopy which has been working fine but I have the use Task Manager to kick off the process (.bat file). Enter RoboCopy which has many of the same switches (parameters) that xcopy has but it can be scheduled, unlike xcopy which needs another process to kick it off. It also copies more file properties than xcopy. Also has logging options.
Usage:
robocopy <Source> <Destination> [<File>[ ...]] [<Options>]

<Source> Specifies the path to the source directory.
<Destination> Specifies the path to the destination directory.
<File> Specifies the file or files to be copied. You can use wildcard characters (* or ?)
<Options> Specifies options to be used with the robocopy command.

Some of the important switches (options):
/S :: copy Subdirectories, but not empty ones.
/E :: copy subdirectories, including Empty ones.
/MOV :: MOVe files (delete from source after copying).
/MOVE :: MOVE files AND dirs (delete from source after copying).
/xo Excludes older files (to exclude files that are older than those they're being copied over)

Scheduling
/rh:hhmm-hhmm Specifies run times when new copies may be started.

Logging
/log:<LogFile> Writes the status output to the log file (overwrites the existing log file).
/log+:<LogFile> Writes the status output to the log file (appends the output to the existing log file).
/l Specifies that files are to be listed only (and not copied, deleted, or time stamped).

A complete list can be found at
https://technet.microsoft.com/en-us/library/cc733145(v=ws.11).aspx
or
http://burpee.smccme.edu/studenthowtos/robocopy.htm


FileSystemWatcher Class DRAFT!!! NOT COMPLETE!!!

Occasionally you may have a folder (network, local, ftp, etc) where you want to be alerted when a file is received or changed so that you may act on it (processes it, email it, archive it). This can ba done with the FileSystemWatcher Class. It "Listens to the file system change notifications and raises event when directory or a file in a directory is changed ". It works on directories or sub-directories on a local, drive, network drive or remote computer. To watch for changes in all files, set the Filter property to an empty string ("") or use wildcards ("*.*"). To watch a specific file, set the Filter property to the file name. For example, to watch for changes in the file MyDoc.txt, set the Filter property to "MyDoc.txt". You can also watch for changes in a certain type of file. For example, to watch for changes in text files, set the Filter property to "*.txt".

See example below: Notice the timestamp on the file "TestFile.txt" in the folder "C:\TestFolder" below.


Nothing to do with C # (I said "MOSTLY")

If you are a true geek like I am, you will enjoy this book. Mnay years ago, Andy Hertzfeld created a blog at www.folklore.org and chronicled his experiences on the development of the Macintosh (yuk). He invited other member of the team to do likewise and some of those stories are compiled in this book "Revolution in The Valley: The Insanely Great Story of How the Mac Was Made" (with a forward by Steve Wozniak). It gets a bit technical at times for the average observer, but as has been said by Kings and Queens, I am not the average observer :)