Batch convert a folder of images from png to jpg

I had a bunch of png images in several subfolders which I wanted to convert into jpg.

I used the command line tool ImageMagick for Windows, which is free and can be downloaded here:
Download @ ImageMagick

This command will convert all images in the folder and its subfolders from png to jpg with quality 65. The converted files will get the same filename but with jpg extension:

for /R %f in (*.png) do ( convert -quality 65 "%f" "%~npf.jpg" )

convert is the ImageMagick command running, for /R is used for looping recursively.

Use this command when done to remove all the source png files:

del *.png /s

This will delete all png files in this folder and all subfolders.

How do I wrap a selection with an HTML tag in Visual Studio? – Stack Overflow

A very usable keyboard shortcut when working with html in Visual Studio.

Visual Studio 2015 comes with a new shortcut, Shift+Alt+W wraps the current selection with a div. This shortcut leaves the text “div” selected, making it seamlessly changeable to any desired tag. This coupled with the automatic end tag replacement makes for a quick solution. UPDATE This shortcut is available in Visual Studio 2017 as well, but you must have the “ASP.NET and Web Development” workload installed. Example Shift+Alt+W > p > Enter

Source: How do I wrap a selection with an HTML tag in Visual Studio? – Stack Overflow

Where do I find the Azure Website Deployment password

If you are using azure deployment profiles for Visual Studio you can find the deployment password here:

Login to portal, select the web app service, click the link “Get publish profile” to download. Open the xml file and find the password in element publishProfile attribute userPWD.

Source: Where do I get my actual Azure Website Deployment password? – Stack Overflow

Copying files larger than 2 GB over RDP

Symptoms

When you try to copy a file larger than 2 GB over a Remote Desktop Services or a Terminal Services session through Clipboard redirection (copy and paste) by using RDP client 6.0 or a later version, the file isn’t copied. And you don’t receive an error message.

Cause

It’s a known issue. Copying files larger than 2 GB by using this method isn’t supported.

Resolution

To resolve this issue, use one of the following methods:

  • Use Drive Redirection through Remote Desktop Services or a Terminal Services session if you want to transfer files larger than 2 GB.
  • Use command-line alternatives to copy files larger than 2 GB over a Remote Desktop Services or Terminal Services session. For example, use the following command:
    Console:

    xcopy \\tsclient\c\myfiles\LargeFile d:\temp  

Source: Copying files larger than 2 GB over a Remote Desktop Services or Terminal Services session by using Clipboard Redirection (copy and paste) fails silently

How to solve Selenium error Element is not clickable at point (x, y) Other element would receive the click

The error message looks like this:

System.InvalidOperationException : unknown error: Element <... (html) ...> is not clickable at point (x, y). Other element would receive the click: <...(html)...>

Stack trace
at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.Remote.RemoteWebElement.Click()

Solution:
The clickable element is not ready, it might not be visible or clickable.
Sometimes the element is covered by another html element. (hide the covering element first).

Steps:
1. Wait for element to be visible
2. Wait for element to be clickable
3. Click with javascript

If this still this doesn’t work insert an implicit wait between step 1 and 2. (Thread.Sleep() in c#)

C# driver code to solve problems:
Wait for element to be visible and clickable (ElementToBeClickable = element is visible AND enabled.)

        public IWebElement WaitUntilElementIsClickable(By findElementsBy)
        {
            var wait = new WebDriverWait(driver, timeoutForElementShouldBeVisibleInSeconds);

            try
            {
                var element = wait.Until(ExpectedConditions.ElementToBeClickable(findElementsBy));
                return element;
            }
            catch (Exception exception)
            {
                string message = exception.Message + " at findElementsBy " + findElementsBy.ToString();
                Exception customException = new Exception(message, exception);
                throw customException;
            }
        }        public IWebElement WaitUntilElementIsClickable(By findElementsBy)
        {
            var wait = new WebDriverWait(driver, timeoutForElementShouldBeVisibleInSeconds);

            try
            {
                var element = wait.Until(ExpectedConditions.ElementToBeClickable(findElementsBy));
                return element;
            }
            catch (Exception exception)
            {
                string message = exception.Message + " at findElementsBy " + findElementsBy.ToString();
                Exception customException = new Exception(message, exception);
                throw customException;
            }
        }

Click with javascript:

        public void ClickOnElement(string cssElementSelector)
        {
            string js = $"document.querySelector(\"{cssElementSelector}\").click()";
            ExecuteJavascript(js);
        }
		
		        public string ExecuteJavascript(string script)
        {
            return ExecuteJavascript<string>(script);
        }

        /// <summary>
        /// Executes JavaScript in the context of the currently selected frame or window.
        /// </summary>
        /// <typeparam name="T">The converted return type</typeparam>
        /// <param name="script">The JavaScript code to execute.</param>
        /// <param name="args">The arguments to the script.</param>
        /// <returns></returns>
        public T ExecuteJavascript<T>(string script, object[] args = null)
        {
            IJavaScriptExecutor javaScriptExecutor = uiTests.Driver as IJavaScriptExecutor;
            object result = null;

            var wait = new WebDriverWait(uiTests.Driver, timeout: TimeSpan.FromMinutes(3));
            wait.Until(ExpectedConditions.ElementIsVisible(By.TagName("body")));

            result = javaScriptExecutor.ExecuteScript(script, args);
            T typedResult = (T) result;
            return typedResult;
        }

 

Read and understand code faster with programming ligatures in Fira Code font | Making Visual Studio perfect

I was recently on a conference and spotted this nice code font:
Fira Code
which makes use of “ligatures” that takes common programming characters and make them more readable.

Such as >= ++ != and presents them in a more condensed and more readable way.

Read more here:
Read and understand code faster with programming ligatures in Fira Code font | Making Visual Studio perfect

To use in Visual Studio 2017, download from:
https://github.com/tonsky/FiraCode/releases/download/1.204/FiraCode_1.204.zip

Unzip ttf folder select all fonts, right click menu and install.
Open/Restart VS2017 -> Options -> Environment -> Fonts and colors -> Select “Fira Code” as font.

Fira Code on github:
https://github.com/tonsky/FiraCode

Scott Hanselman on Monospaced Programming Fonts with Ligatures:
https://www.hanselman.com/blog/MonospacedProgrammingFontsWithLigatures.aspx

Interesting read about agile and lean development

Interesting blogpost called:
Making sense of MVP (Minimum Viable Product) – and why I prefer Earliest Testable/Usable/Lovable

There are examples of development of the early Spotify  app as well:

Source: Crisp’s Blog » Making sense of MVP (Minimum Viable Product) – and why I prefer Earliest Testable/Usable/Lovable