Windows/Open Live Writer Code Plugin

The Windows/Open Live Writer Source Code Plug-in for ‘Syntax Highlighting in WordPress.com hosted blogs’. It inserts the correct ‘Wordpress shortcode’ entry around your code snippet to ensure it is displayed correctly in your WordPress.com blog. Awesome!

Source: Windows/Open Live Writer Code Plugin

Advertisements

Most useful YouTube-DL commands (for audio extraction and conversion, M4A/MP4)

If you are a lover of offline video and audio extraction, you probably know youtube-dl.

Since WEBM gains popularity on YT you have to go new ways, if you are an old-timer like me, who likes to stick with MP4/M4A. But I am not the only one, as the discussions show.

Here are some of my old and new favorites

Audio only / Extracting audio

Extract audio from a YouTube video and convert it to mp3 or m4a (requires ffmpeg installed and in PATH):

youtube-dl URL --extract-audio --audio-format mp3 | m4a

You might want to specific download location:

youtube-dl --output /path/to/your/dir 

But this does not work so well on windows (you often get a wired file name) and in combination with advanced commands. An OUTPUT TEMPLATE can help out.

Extract/convert & download to another location wit that preserves the title of the video:

youtube-dl URL --output "d:\dl\%(title)s.%(ext)s" --extract-audio --audio-format aac

Alternatively, if you don’t want to extract, you could also just download the audio, preferred m4a:

youtube-dl URL -f bestaudio[ext=m4a]/mp4 --output "D:\DL\%(title)s.%(ext)s" 

But: Some audio players do not support DASH audio. For m4a, I had to demux it to make it a ‘regular’ m4a using ffmpeg.

ffmpeg -I input.m4a -vn -c:a copy output.m4a 

(The downside of this method is that you have to do an extra step that makes good use of your drive and CPU.)

Or: Download just mp4 audio and extract/convert it afterwards:

youtube-dl URL -f bestaudio[ext=m4a]/mp4 --extract-audio --audio-format m4a --output "D:\DL\%(title)s.%(ext)s"

(The downside of this method is that you have to download more data).

Best Best video and audio in MP4 & M4A/AAC

youtube-dl URL -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/mp4

This filter will give you the best MP4/AAC audio and MP4 video.
According to my own experience the difference to the best WEBM video is rather small (~5-8%). But your millage may vary.

The best audio is most of the time already AAC/M4A. So, don’t worry about that.

That’s it.

Launch UWP apps via URI Scheme

If you ask how to launch a UWP app from the command line, you have to learn new ways.

The common way to launch a UWP app is

Protocol activation via URI

There are a number of built in URIs to launch the default app for things like mailing, etc.

URI Scheme Launches
bingmaps:, ms-drive-to:, and ms-walk-to: Maps app
http: Default web browser
mailto: Default email app
ms-call: Call app
ms-chat: Messaging app
ms-people: People app
ms-settings: Settings app. You can also jump to specific areas, like ms-settings:privacy-webcam
ms-store: Store app
ms-tonepicker: Ring/Alarm Tone picker
ms-yellowpage: Nearby Numbers mobile app
ms-clock: Alarm/Clock (does not work for me)
ms-actioncenter: Action/Notification Center
ms-cortana Cortana
onenote: Default Onenote app
xbox-tcui: Xbox app
ms-cxh: Microsoft Account Profile
microsoft-edge: Edge Browser
read: Edge Reading View (does not work for me)
bingnews: Bing news app

Launching a modern app from the command line

To start the corresponding default app from the terminal (cmd.exe) precede each URI command with start, like this

  >start microsoft-edge:

You can also right-click on the Start button, choose Run (or press Win+R), enter the URI command (without preceding start), and press Enter.

Run-ms-clock

Apart from command line junkies, protocol activation is most useful in your own handmade apps. Because your app can’t select the app that is launched. If there is no app installed to handle the given URI, you can recommend an app for the user to install. For more info, see Recommend an app.

Protocol activation should also work for most 3rd-party apps. If you know the declared (metro/uwp) app name, you can launch the app like this:

twitter:

wunderlist:

Sad to see that some apps have wired internal names like test_uwp_app123:

To use protocol activation for your own app read: Automate launching Windows 10 UWP apps

Many apps also accept additional URI parameters like mailto:your@email.com?subject=Important message
or bingmaps:?cp=40.726966~-74.006076

Alternatives

If this does not work for a specific app, there are some alternatives:

GUI automation with VBS

Someone on stack overflow suggested here to use a VB-Script to automate the UI. It’s kinda ugly, but maybe still useful.

Set objShell = WScript.CreateObject("WScript.Shell")
objShell.SendKeys "^{ESC}"
WScript.Sleep 1000
objShell.SendKeys WScript.Arguments.Item(0)
WScript.Sleep 1000
objShell.SendKeys "{ENTER}"

Save this to a vbs script, let’s say metrorunner.vbs and run in command line:

>metrorunner.vbs store

Create a Desktop Shortcut

Another option is navigating to the (Modern) App Folder and create a regular Shortcut on your Desktop, as described here.

Win+R: shell:AppsFolder

Then, pick the app you want, right-click, select create a shortcut, and you will be asked if you would like to create one the Desktop.

Not bad. I have to admit I like that special folder for reference purpose, since is gives you an overview of all your installed apps.

That’s all for now.

What makes your SSD last longer – Sleep, Hybrid Sleep, Hibernate, or Shut Down?

ssd_x_ray

The change in storage technology that arrived with Solid-State-Drives (SSD) requires to rethink some computer usage habits, e.g. the daily reboot.

SSDs are in many ways superior to traditional Hard-Disk-Drives (HDD): performance, stability, noise-level, form-factor, efficiency, etc.
The only thing to worry about SSDs is their longevity. While SSDs in general are more durable than HDDs, their life-time is limited by a fixed number of write-accesses. Writing processes happens all the time when you use your computer. Reading does also some wear down, but much less than writing. However, some tasks, like duplicating big files, are more “expensive” in this regard. This also applies to the question whether you should send your computer into Sleep-Mode, Hibernate or Shut-Down when you go off.

Sleep, Hibernate, or Shut Down?

Let me give you a short overview of the options we have at hand.

Sleep barely writes anything and you’re instantly back to where you left off. If you work on a laptop and your battery is going low, Windows saves all your work and turns off your machine. This state is called Hybrid Sleep. The memory of the system is still active in the RAM, but also written to the disk – this is what Hibernate does: a lot of writes (at least your whole used memory). Afterwards the system and your previous work is restored from disk – which could take a while. A Shutdown writes a bit and requires you to fully Reboot your computer (which causes much reads). With a superfast SSD and Windows 10 all these options won’t take very long. The question that remains is: Which causes lesser wear down for your SSD?

The Answer: It depends – on you and your computer

First, we must distinguish here between desktops and laptops.

If you use a laptop and constantly on the run, I would advise to go with the default Hybrid Sleep. A laptop cannot be upgraded and maintained like a desktop computer. In my experience the piece that dies first in a laptop is the battery or the GPU or – if you have an old-timer – the HDD. But not the SSD. So, for convince and peace of mind, I would go with the default Hybrid Sleep.

If you have desktop computer, well, it also depends: Do you use your PC all the time or just frequently?

I you are a heavy user, I recommend to stay away from Hibernate and Hybrid Sleep, just use the Sleep-Mode. Since desktops normally have a larger amount of memory, writing all of its contents to the disk will cause much wear. And if you live in an area where power failures are an unfamiliar thing, you do not have to rely on hybrid sleep (but anyway, always save your work, before you went off.) To disable hibernation, simply open your command prompt as Administrator, type powercfg.exe /hibernate off, and press Enter or us this Microsoft quick fix. No more hibernating!

If you use your computer only frequently, a regular Shut Down should be fine.

That’s all folks.

If you have any comments, suggestions or additions: Put them down in the box below.

PS: If you want o measure how much data is written while you do work / sleep or reboot give SSDLife (record Data written before and after sleep / shutdown) or SsdReady a shot.

Route program audio to different output devices on Windows

Back in the old days of Windows XP applications stuck with the given audio source at startup time. Newer Windows versions are more intelligent inform apps to adjust if the selected standard output device was changed. While is is in general a good thing, it prevents you from playing different audio on different output devices. Granted, this is a somewhat rare demand, but there are at least two legit scenarios for this. While the second is harder to achieve, the first is easy to accomplish.

1. you want to play audio on a speaker and listen to a different audio source on your headphones

If you want to play music on a speaker and listen to a different audio on your headphones, your favorite media player most probably can help out.
In most media player programs you can select the preferred audio output device. Normally the output is set to the default output. But if you select a specific device instead, the player is not affected if the default output device changes.

  • In Windows Media Player you can set the default device in Organize->Options->Devices->Speakers->Properties. A restart of WMP is required.
  • In VLC got to Preferences->All settings->Audio->Output modules->WaveOut->Select Audio Device.

    image

  • Other players like mplayer or foobar2000 can do the same…

2. You want to record the audio of an application isolated from other sounds

To route the output of one app to another you need extra software called Virtual Audio Cable – it does exactly that, but it’s not free. There is a trial to play with it, if you like to purchase you can get it for $25 + more for support.

Extra tip:

If you just want record the Windows system audio (let’s say, you listen to streaming audio and want to record it) without the need to reroute the output I would suggest to use Audacity. You can either activate the Stereo Mix Device to achieve this, as described here, or change the input source to WASAPI, as described here (prefer the second option).