YouTube – “Recommended Recent Uploads” – Opting Out

Background

Getting distracted by YouTube lately.

Once every few days I get a notification informing me of a recently uploaded video that might interest me.

 

Opting Out

  1. Follow the notification or visit youtube.com and login and access your channel
  2. Click on the notifications icon 
  3. Scroll through the list of Notifications and choose any notification under the banner  “Recommended Recent Upload“.  On the right side of a notification, you will be presented with an array of three vertical dots.
  4. Click on the three vertical dots and you will be offered two options
    • Hide this notification
    • Turn off all recommendation notifications
  5. Please choose “Turn off all recommendation notifications

 

Crediting

Crediting SmittenedKittened

Link

Image

Textual

Hey Denny, I ended up figuring it out.

When you open your notifications and see the “recommended recent upload” video, if you hover over it, the three dots thingy should be on the right-hand side of the video. Click on the dots, click on “turn off recommended recent uploads” or whatever it says, et voila!!

References

  1. Google
    • Product Forums
      • YouTube
        • How do I stop YT from sending “recommended recent uploads” to my notifications?
          Link

 

SQL Server Express – Scheduling Jobs via Windows Task Scheduler

Background

Needing a lightweight SQL Server to use as a failover, in case of Production outage,  settled on Sql Express, v2017 no doubt.

 

Problem

SQL Server Express is free, but missing SQL Server Agent, and so no built-in scheduler.

There are some tasks that I need to schedule.

Those tasks are backing up the databases, Index Defrag, and incremental data refresh.

Like Dela potholes soon as I make my way to doorsteps.

 

Files

refreshData.cmd

Outline

  1. Logging
    • Make directory log, if not present
    • If log\refreshdata.log file exists remove it
  2. Issue sqlcmd
    • Pass along the following arguments
      • -b
        • If error occurs in SQL, set errorlevel environment variable
      • -d
        • pass along database name; in our case hrdb
      • -e
        • Pass along payload
        • Call Stored Procedure ( exec dbo.usp_RefreshData )
      • -o
        • Output file is log\refreshData.log
  3. If %errorlevel% equal (-equ ) to zero (0), exit batch file
  4. call emailNotificationFailure.cmd errorlevel

Code


if not exist log mkdir log

if exist log\refreshData.log del log\refreshData.log

ECHO Errorlevel [SQLCMD - PRE] :- %ERRORLEVEL%


sqlcmd -b -S (local) -d hrdb -Q"exec [dbo].[usp_RefreshData]" -o log\refreshData.log

ECHO  [SQLCMD - POST] :- %ERRORLEVEL%

if "%errorlevel%" equ "0" exit /b %errorlevel%

REM Email Notification Failure
call emailNotificationFailure.cmd errorlevel

 

emailNotificationFailure.cmd

Outline

  1. Set _domain name
    • Here we set our email provider domain name
  2. Invoke powershell
    • Pass along -file emailNotificationFailure.ps1

Code

set _domain=labdomain.org
powershell.exe -file emailNotificationFailure.ps1 %_domain%

 

emailNotificationFailure.ps1

Code

Set-StrictMode -Version 1

#Get domain name as first argument
$domain=$args[0]

$self="daniel.adeniji"
$computer=$env:computername

$emailFrom = "$computer@$domain"
$emailTo = "$self@$domain"

$subject = "failed to synch data"

$body = "failed to synch data"

$SMTPServer = "smtp.$domain"

$SMTPServerPort = "25"

$fileAttachment="log\refreshData.log"

"emailFrom :- $emailFrom"
"emailTo :- $emailTo"
"SMTPServer :- $SMTPServer"
"SMTPServerPort :- $SMTPServerPort"

$SMTPClient = New-Object Net.Mail.SmtpClient($SmtpServer, $SMTPServerPort)

$objEmailMessage = New-Object System.Net.Mail.MailMessage

$objEmailMessage.From = $emailFrom;
$objEmailMessage.To.Add($emailTo);
$objEmailMessage.Subject = $subject;
$objEmailMessage.Body = $body;

$objAttachment  =$null
if (Test-Path $fileAttachment -PathType Leaf)
{

	"File Attachment ( $fileAttachment ) Added "

	$objAttachment = new-object Net.Mail.Attachment($fileAttachment)

	$objEmailMessage.Attachments.Add($objAttachment)
	
}	
else
{

	"File Attachment ( $fileAttachment ) :- Skipped"

}

$SMTPClient.Send($objEmailMessage);

if ($objAttachment )
{

	$objAttachment.Dispose()
	
}	

 

Task Scheduler – Management

Task Scheduler – Management – Add task

General

Triggers

 

Actions

Actions – Edit Action

Denzel Washington

 

Videos

  1. Put God First – Denzel Washington Motivational & Inspiring Commencement Speech
    In delivering the commencement speech at Dillard University, Academy Award-winning actor Denzel Washington told the college graduates to put God first in everything they do, adding that everything he has accomplished in this life was due to the grace of God.
    Channel :- Above Inspiration
    Published On :- 2017-Oct-26th
    Link
  2. Garth Brooks gushes over latest Denzel Washington movie
    The two-time Oscar winner discusses his role in the new film “‘Roman J. Israel, Esq.” and talks with Garth Brooks about the powerful message it conveys.
    Channel :- Good Morning America
    Published On :- 2017-Oct-20th
    Link

 

Indepth

Put God First – Denzel Washington Motivational & Inspiring Commencement Speech

  1. Put God first
    • Put God first
    • Put God first in everything you do
    • Everything
      • Everything you see in me
      • Everything you think you love in me
      • Everything you think I have accomplished
      • Everything you think I have
        • And, if I have a few things
      • I have, because I have because of the grace of God
    • 40 years ago today
      • March 27th, 1975
      • Just this past March, I was flunking out of college with a 1.7 ( out of 4.0 GPA )
      • I hope none of you can relate
    • Word of Prophecy
      • I was sitting in my mother’s beauty parlor
      • And, there was a lady under the dryer and every time she looked up, I looked up, and she was looking at me
      • And, finally she said, I have a prophecy for you
      • She said give me a pencil, I have a prophecy
        • Boy you are gonna travel the world and speak to millions of people
        • Mind you, I was dropping out of college
        • I was thinking of joining the Army, I did not know what I was gonna do, and she is telling me I am going to speak to millions of people
        • And, I have travelled the world, and spoken to millions of people
      • But, the most important thing
        • is what she told me, what she taught me, has stayed with me since
        • I have being protected, I have been directed, I have been corrected
        • I have kept God in my life and it has kept me humble
        • I did not always stick with him, but he stuck with me
        • So stick with him in everything you do
        • If you think you want to do what I have done, then do what I have done
  2.  Fail Big
    • Dreams without goals are just dreams
      • Have dreams, but have goals
      • Without goals they fume disappointments
    • In order to accomplish goals, you must apply discipline and consistency
    • Working really hard is what successful people do
    • In this text, tweet, tweek filled world, you have to pay more attention
      • Just because you are doing a lot more, does not mean you are getting more done
      • Don’t continue movement with progress
  3. You will never see a UHAUL behind a Hearse
    • I don’t care how much money you make, you can’t take it with you
    • I don’t care how much you have, it is what you do with what you have
    • We all have different talents
    • The most selfish you can do in this world is help someone else
      • Why is it selfish
        • Because of the gratification
        • The goodness that comes to you
        • The good feeling that I get from helping others
        • It is the Joy
        • That is where the joy it is
        • That is where the success is
  4. Finally,  I pray that you place your slippers right under the mattress
    • So that when you wake up in the morning you have to get on your knees to reach them
    • While you are down there, you stay thank you
    • Thank You
      • Thank you for Grace
      • Thank you for Mercy
      • Thank you for Understanding
      • Thank you for Wisdom
      • Thank you for Parents
      • Thank you for Humility
      • Thank you for Prosperity
    • True desire in your Heart is God’s calling that it is already yours
      • Anything you want good, you can have
      • Claim it
      • Reach back and pull someone else up
      • Don’t inspire to make a living, aspire to make a difference

Garth Brooks gushes over latest Denzel Washington movie

  1. Garth Brooks
    • The conversation me and my wife had after watching the movie
      • We think we understand each other
      • I do not understand what goes on in your life, just like you do not understand what goes in mine
      • But, we make all of our arguments based on the fact that we think we do
      • But, it is the tolerance that he speaks of, that forgiveness
      • That second to think, before you strike back is everything
    • The thing we are going to use from now on…
      • Drowning in the Shallow End
    • Love everything you do

 

SQL Server – Analysis Services – Error – “A connection could not be made to the data source”

Errors

Message
Process ALL Dimensions:Error: The following system error occurred: The user name or password is incorrect.
Process ALL Dimensions:Error: Errors in the high-level relational engine. A connection could not be made to the data source with the DataSourceID of ‘HRDB’, Name of ‘HRDB’.

TroubleShooting

SQL Server Profiler

Checked via SQL Server Profiler, but nothing came up.

 

Integration Services Catalog

The errors tabulated above came up.

Images

Object Explorer – Integration Services Catalogs

Reports – Standard Reports – All Executions

 

SQL Server Analysis Services

Data Source Properties

Diagnosis

  1. For Data Source Properties, our “Security Settings – Impersonation Information” is set to “Impersonation Account“.
  2. The setting means a specific account is designated
  3. We reviewed the account and changed it from the cube’s developer to an Active Directory Service Account

Images

Original
Data Source Properties

Data Source Properties – Impersonation Information

 

Revised
Data Source Properties

Data Source Properties – Impersonation Information

 

Log Shipping – Status Tracking

Background

Reviewing Log Shipping on one of our setups and wanted a generic script that will allow quick review of where things are.

Code

Here is where things are:

Primary

SQL


use [master]
go

if schema_id('logShipping') is null
begin

    exec('create schema [logShipping] authorization [dbo]')

end
go

if object_id('[logShipping].[if_StatusPrimary]') is null
begin

    exec('CREATE FUNCTION [logShipping].[if_StatusPrimary] 
            ()
            RETURNS TABLE   
            AS
            RETURN 
            (
                -- Add the SELECT statement with parameter references here
                SELECT [shell] = 0
            )
        ')
end
go


ALTER FUNCTION [logShipping].[if_StatusPrimary] 
()
RETURNS TABLE   
AS
RETURN 
(

    select 
             [sqlInstancePrimary]
              = tblLSMP.[primary_server]
    
            , [databasePrimary]
                = tblLSMP.[primary_database]

            /*
                Process - Backup - Begin
            */
            , [backupDate]
                = tblLSMP.[last_backup_date]

            , [backupDateUTC]
                = tblLSMP.[last_backup_date_utc]

            , [timeSinceLastbackupInMinutes]
                =
                    datediff
                    (
                          minute
                        , tblLSMP.[last_backup_date]
                        , getdate()
                    )


            , [lastbackupFile]
                = tblLSMP.[last_backup_file]

            , [lastbackupFileTS]
                = msdb.[dbo].[agent_datetime]
                    (
                        substring
                        (

                            substring
                            (
                              tblLSMP.[last_backup_file]
                            , charindex( '_2', tblLSMP.[last_backup_file]) + 1
                            , charindex( '.', tblLSMP.[last_backup_file])
                               - charindex( '_2', tblLSMP.[last_backup_file])
                               - 1
                            )
                            , 1
                            , 8
                        )

                        , substring
                        (

                            substring
                            (
                              tblLSMP.[last_backup_file]
                            , charindex( '_2', tblLSMP.[last_backup_file]) + 1
                            , charindex( '.', tblLSMP.[last_backup_file])
                               - charindex( '_2', tblLSMP.[last_backup_file])
                               - 1
                            )
                            , 9
                            , 6
                        )

                    )



            , [lastbackupFileTSLocale]
                = dateadd
                    (
                          minute
                        , datediff
                            (
                                  minute
                                , tblLSMP.[last_backup_date]
                                , tblLSMP.[last_backup_date_utc]
                            ) * -1
                        , msdb.[dbo].[agent_datetime]
                        (
                            substring
                            (

                                substring
                                (
                                  tblLSMP.[last_backup_file]
                                , charindex( '_2', tblLSMP.[last_backup_file]) + 1
                                , charindex( '.', tblLSMP.[last_backup_file])
                                   - charindex( '_2', tblLSMP.[last_backup_file])
                                   - 1
                                )
                                , 1
                                , 8
                            )

                            , substring
                            (

                                substring
                                (
                                  tblLSMP.[last_backup_file]
                                , charindex( '_2', tblLSMP.[last_backup_file]) + 1
                                , charindex( '.', tblLSMP.[last_backup_file])
                                   - charindex( '_2', tblLSMP.[last_backup_file])
                                   - 1
                                )
                                , 9
                                , 6
                            )

                        )
        
                )

            /*
                Process - Backup - End
            */



    from   [msdb]..[log_shipping_monitor_primary] tblLSMP

)
go

Invoke


select *
from   [master].[logShipping].[if_StatusPrimary]()

Output

Secondary

SQL


use [master]
go

if schema_id('logShipping') is null
begin

    exec('create schema [logShipping] authorization [dbo]')

end
go

if object_id('[logShipping].[IF_LogShippingMetric]') is not null
begin

    drop function [logShipping].[IF_LogShippingMetric]

end
go


if object_id('[logShipping].[if_StatusSecondary]') is null
begin

    exec('CREATE FUNCTION [logShipping].[if_StatusSecondary] 
            ()
            RETURNS TABLE   
            AS
            RETURN 
            (
                -- Add the SELECT statement with parameter references here
                SELECT [shell] = 0
            )
        ')
end
go


ALTER FUNCTION [logShipping].[if_StatusSecondary] 
()
RETURNS TABLE   
AS
RETURN 
(

    select 
             [sqlInstancePrimary]
              = tblLSMS.[primary_server]
        
            , [sqlInstanceSecondary]
                = tblLSMS.[secondary_server]
        
            , [databasePrimary]
                = tblLSMS.[primary_database]

            /*
                Process - Copy - Begin
            */
            , [copyDate]
                = tblLSMS.[last_copied_date]

            , [copyDateUTC]
                = tblLSMS.[last_copied_date_utc]

            , [timeSinceLastCopiedInMinutes]
                =
                    datediff
                    (
                          minute
                        , tblLSMS.last_copied_date
                        , getdate()
                    )


            , [lastCopiedFile]
                = tblLSMS.[last_copied_file]

            , [lastCopiedFileTS]
                = msdb.[dbo].[agent_datetime]
                    (
                        substring
                        (

                            substring
                            (
                              tblLSMS.[last_copied_file]
                            , charindex( '_2', tblLSMS.[last_copied_file]) + 1
                            , charindex( '.', tblLSMS.[last_copied_file])
                               - charindex( '_2', tblLSMS.[last_copied_file])
                               - 1
                            )
                            , 1
                            , 8
                        )

                        , substring
                        (

                            substring
                            (
                              tblLSMS.[last_copied_file]
                            , charindex( '_2', tblLSMS.[last_copied_file]) + 1
                            , charindex( '.', tblLSMS.[last_copied_file])
                               - charindex( '_2', tblLSMS.[last_copied_file])
                               - 1
                            )
                            , 9
                            , 6
                        )

                    )

           , [lastCopiedFileTSLocale]
                = dateadd
                    (
                          minute
                        , datediff
                            (
                                  minute
                                , getdate()
                                , getutcdate()
                            ) * -1
                        , msdb.[dbo].[agent_datetime]
                        (
                            substring
                            (

                                substring
                                (
                                  tblLSMS.[last_copied_file]
                                , charindex( '_2', tblLSMS.[last_copied_file]) + 1
                                , charindex( '.', tblLSMS.[last_copied_file])
                                   - charindex( '_2', tblLSMS.[last_copied_file])
                                   - 1
                                )
                                , 1
                                , 8
                            )

                            , substring
                            (

                                substring
                                (
                                  tblLSMS.[last_copied_file]
                                , charindex( '_2', tblLSMS.[last_copied_file]) + 1
                                , charindex( '.', tblLSMS.[last_copied_file])
                                   - charindex( '_2', tblLSMS.[last_copied_file])
                                   - 1
                                )
                                , 9
                                , 6
                            )

                        )
        
                )

            /*
                Process - Copy - End
            */


            /*
                Process - Restoration - Begin
            */

            , [restoreDate]
                = tblLSMS.last_restored_date 

            , [timeSinceLastRestoreInMinutes]
                =
                    datediff
                    (
                          minute
                        , tblLSMS.last_restored_date
                        , getdate()
                    )

            , [lastRestoredFile]
                = tblLSMS.[last_restored_file]

            , [lastRestoredFileTS]
                = msdb.[dbo].[agent_datetime]
                    (
                        substring
                        (

                            substring
                            (
                              tblLSMS.[last_restored_file]
                            , charindex( '_2', tblLSMS.[last_restored_file]) + 1
                            , charindex( '.', tblLSMS.[last_restored_file])
                               - charindex( '_2', tblLSMS.[last_restored_file])
                               - 1
                            )
                            , 1
                            , 8
                        )

                        , substring
                        (

                            substring
                            (
                              tblLSMS.[last_restored_file]
                            , charindex( '_2', tblLSMS.[last_restored_file]) + 1
                            , charindex( '.', tblLSMS.[last_restored_file])
                               - charindex( '_2', tblLSMS.[last_restored_file])
                               - 1
                            )
                            , 9
                            , 6
                        )

                    )

            , [lastRestoredFileTSLocale]
                = dateadd
                    (
                          minute
                        , datediff
                            (
                                  minute
                                , getdate()
                                , getutcdate()
                            ) * -1
                        , msdb.[dbo].[agent_datetime]
                        (
                            substring
                            (

                                substring
                                (
                                  tblLSMS.[last_restored_file]
                                , charindex( '_2', tblLSMS.[last_restored_file]) + 1
                                , charindex( '.', tblLSMS.[last_restored_file])
                                   - charindex( '_2', tblLSMS.[last_restored_file])
                                   - 1
                                )
                                , 1
                                , 8
                            )

                            , substring
                            (

                                substring
                                (
                                  tblLSMS.[last_restored_file]
                                , charindex( '_2', tblLSMS.[last_restored_file]) + 1
                                , charindex( '.', tblLSMS.[last_restored_file])
                                   - charindex( '_2', tblLSMS.[last_restored_file])
                                   - 1
                                )
                                , 9
                                , 6
                            )

                        )
        
                )

            /*
                Process - Restoration - End
            */

    from   [msdb]..log_shipping_monitor_secondary tblLSMS

)
go

Invoke


select *
from   [master].[logShipping].[if_StatusSecondary]()

Output

 

Version Control

GitHub

  1. DanielAdeniji/SQLServerLogShippingStatus
    Link

 

References

  1. Docs / SQL / Relational databases / System tables
    • log_shipping_monitor_primary
      • log_shipping_monitor_primary (Transact-SQL)
        Link
    • log_shipping_monitor_secondary (Transact-SQL)
      • log_shipping_monitor_secondary (Transact-SQL)
        Link

Search for documents that contain specific contents – Using grepWin

Background

After so many years using Windows I will like to say I get how to find documents that contain specific contents.

But, in all honesty, I occasionally still stumble with the Window Explorer Interface.

 

Habits

Habits are easy to form, and bad ones are hard to break.

But, may be if I start trying out other tools, I will eventually find one, where I don’t dither as often.

 

grepWin

The first tool that I found via Googling is grepWin and so let us try it out.

 

Download

I do not have permission to install software on my work laptop and so I need a portable, no install, option.

Downloaded Portable version from here.

 

Use

Launch

To use just right click on the file an run as an Administrator.

 

Search

Details

In the Screenshot below, we are doing the following:

    1. Search In :-
      • Targeted Folder is C:\Personal\dadeniji\blog
    2. Search Type :-
      1. Options :- Regex or Text Search
      2. Choice :- Easy as Sunday morning, Text Search
    3. Search For :-
      • Proxy
        • Search for files that have the word Proxy in them
    4. Options :-
      • Search case-sensitive
        • No – Skip burden of sensitivity searches
    5. Limit Search :-
      • Include System items
        • No – Skip system files
      • Include Subfolders
          • Yes, we we want a deep search and not just the current targeted folder

    • Include Binary files
      • No – Skip Binary files
      • Binary files are compiled application code
      • Often files with extension exe, com
    • File name match
      • *.sql
        • I am a lowly DBA and so I would likely have offered up *.sql as the file extension

Image

search_20171122_0719PM

 

Query Results