Saturday, 5 May 2018

MS Office Word - copy text and it puts OLE bookmarks - a handy macro to stop this

Have you recently found that copying something in Microsoft Word causes the copied text to have grey square brackets surround it?

These brackets are showing because the "show bookmarks" option is enabled. Indeed you may want to keep that option enabled, as you have other bookmarks that you want to see while editing.

The new bookmarks are being created with a certain naming format, they are sequentially numbered and are named like "OLE_LINK##". These bookmarks are automatically created by Word.

Here is a macro to automatically delete the bookmarks straight after they're created. It doesn't delete other bookmarks, only the ones that start with "OLE_LINK".

The best place to put this is in the file. To find this, enable the Developer tab in the ribbon, and then click on the Visual Basic button. In there you can find a file called "ThisDocument" inside the "Normal" heading. Inside that file just put the following code and then save it.

Sub EditCopy()
    Application.OnTime Now + TimeValue("00:00:01"), "DeleteOleBookmarks"
End Sub

Sub DeleteOleBookmarks()
    Dim bmIndex As Integer
    Dim bmType As String
    For bmIndex = ActiveDocument.Bookmarks.Count To 1 Step -1
        bmType = UCase(Left(ActiveDocument.Bookmarks(bmIndex).Name, 8))
        If bmType = "OLE_LINK" Then
        End If
    Next bmIndex
End Sub

Tuesday, 1 May 2018

Keep the monitor display brightness the same when the power source is changed to battery/charging

When using a laptop you usually have to adjust the screen's brightness based on the ambient lighting conditions. However, when plugging/unplugging the power supply Windows will change the brightness again. This can be a poor user experience, for example the reason for plugging it in was just to charge it, not to change the brightness.

Here is a PowerShell v3.0+ script and Windows Task Scheduler config file for fixing this issue. The schedule will run at system startup, and just runs the script. The PowerShell script will register a script block to some Windows events. One is the brightness change event, so when the user manually changes the screen brightness it will save that value to a temp file. The other event is when the power supply is changed to battery/charging, it will change the value back from the saved temp file.

Here's the PowerShell script, just copy this into a Notepad and save as "C:\Battery power display brightness.ps1".

Sunday, 1 April 2018

PowerShell modules

Overview of PowerShell Modules

A module in PowerShell is basically a script with exposed members, such as Functions and Variables. It's best for a specific module to serve a singular purpose. There are four kinds of PowerShell module. (As documented in this Microsoft link: click here.)
  • Script Modules -- PSM1 files that usually contain functions, but can contain any valid PowerShell code.
  • Binary Modules -- Compiled DLL files, which can be created in .NET languages like C#, F# or VB.
  • Manifest Modules -- These are Script Modules which contain a manifest.
  • Dynamic Modules -- In memory modules which haven't been persisted to permanent storage.

How To Create A PowerShell Module

At the basic level, a PowerShell module is a text file with a ".psm1" extension. Here's an example:
  • # A private variable.
  • $prefix = 'Some text'

  • Function Get-Prefix
  • {
  •     $prefix
  • }

  • Function Append-Prefix ($suffix)
  • {
  •     $prefix + $suffix
  • }

  • Function HiddenFunc
  • {
  •     # do something...
  • }

  • Export-ModuleMember -Function '*-*'

Here the functions "Get-Prefix" and "Append-Prefix" are exposed, but the variable "$prefix" and function "HiddenFunc" are not exposed.

How To Use A PowerShell Module

A module can be imported into the PowerShell console directly, and also into script files. Importing the module brings all of the functions and variables into that PowerShell session. To do this you can import a module called "C:\foobar.psm1" in the following way:
Import-Module C:\foobar.psm1

Friday, 16 December 2016

Uploader for Vimeo - Privacy Policy

Uploader for Vimeo stores only the paths to videos existing on your device while it has them pending for upload.

It will only upload to No data is uploaded to any other server.

Once upload has completed (or has been removed by the user) it will have all data about the video removed from the app's storage location.

It uses OAuth2 to authenticate the user with

Sunday, 30 October 2016

Why the XBox One Scorpio should be called "XBox X"

Here are some cast-iron reasons why Microsoft should christen their so called "XBox One Scorpio" as the XBox X. Be warned, these are merely the rantings of a crazed lunatic. Here goes:

1. It reinforces the fact that the XBox name was primarily taken from the X in DirectX (the 3D graphics API from Microsoft). Of course the X also has the meaning "this computing box can do X (anything)"!.. Much like the Play in PlayStation means "this entertainment station can Play anything (games, music, videos, apps, etc)".

2. The name when said aloud will sound like XBox Sex... A thing most boys owning the system will be dreaming about while sitting on their bed vigorously pounding their joystick.

3. The value 'x' in algebraic mathematics can be any number. This is good because Microsoft have trouble comprehending the function of numbers (a worrying fact for a computing company). Therefore they can circumvent the problem by saying "put any number here that makes sense to you, because we've given up trying".

Let me explain: The original XBox was the first incarnation of the platform. Version 1.0 if you will, of the hardware. Then the second system came out. Logically this would have been the XBox 2 if intelligence prevailed. However, Microsoft had to compete with Sony's PS3. After many months of computation on Microsoft's most powerful computers they managed to deduce that 2 is less than 3.

Amazingly they got the equation correct, although it was only understood by the computers. Getting the executives to also understand it did end up producing this interesting anecdote. The smartest minds at Microsoft figured out that they could substitute the numbers 2 and 3 with the monetary values of $2 and $3. A good thing, because that's the kind of value Microsoft can understand. Therefore they could finally "do the math" and consider the number 2 as inferior.

The fact that their platform was only on its second incarnation, when their rivals had somehow mystically arrived at the third place, had them worried to the very core of their xbones! They had to compete. They had to cleverly sneak a bigger number into the name of their second console.

They initially thought of the name "XBox 3D", but their cool/rich young sons pointed out that it was a pretty lame name. But then as the sons rolled dreamily away on their skateboards, the realisation dawned on the executives. Wheels are cool!.. and when wheels revolve around and back to their starting position it is called one revolution! Therefore they should name the console XBox One! At which point their sons rolled back and reminded them that One is still less than Three, so maybe they should use the name XBox 360 as this is how many degrees a wheel turns.

Thusly the greatest console name ever devised was born! And it was good. And the executives new it was good and nurtured and loved the name so. And the years rolled by, and the name was as the ether of space and time bears eternity. Around and around spun the love of this new born videolamb. And everyone knew so. And everyone said "let the 360 be whole like the quadrants of a pie", and they said "let the quadrants not be of red like a ring of death, but be blue and pure like the majesty of multiplayer gaming". And so it was.

Until the next incarnation. For the 360 era was in the midday sun. Warm and relaxing. But then the hour of next-gen was looming. Lost in the troubles of deciding what "features" to shove down people's throats, Microsoft lost sight of what machine they were trying to make. Kinect eye toy camera feature, cloud gaming feature (for which we still have no idea), digital rights management feature, inter/inyer-face features and other (cr)app features. Sitting pretty at the top of the console war they had no need to compete with this so-called number 4 console of Sony's. They forgot to make a system more powerful than their rival. They were too cocksure to even consider the name XBox 6.283 (radians).

Indeed this new system will be the ultimate. The only system people will ever need. A console that will never be superceded. The one games machine a player will ever need ever again. The XBox One. Yes! It was perfect. Impeccable. It took the meaning of X and rotated it on its head. Now the machine that could do "X" was the One machine that ever will.

Not for one second were the executives aware that the name might confuse people. That maybe there were those who thought of the first XBox, the 360's predecessor, as being known in retrospect as the XBox 1.

Now however the One is being superceded. The Scorpio is on the horizon (possibly with an updated Forza). It's time to drop the One. It's time to leave the numbers behind. It's time for XBox X!!!

4. The name XBox One Scorpio is too long. In fact appending anything to the end of XBox One will basically be too long.

5. No more "X-Bone".

6. They need to move away from the current XBox One (XB1). Although Microsoft (M$) have said all XB1 games will run on XBox One Scorpio (XBS), this has implied that all new games that come out after the XBS has arrived will continue to be compatible with XB1. However, this is a fallacy. They only mean that the XBS will be compatible with XB1 games. In reality the XB1 will not be 100% compatible with XBS games. However, games for the original XBox (XBO) are playable on modern systems through emulation, and XBox 360 (XB2) games can be played on XB1. Additionally future versions such as XBox 4 (XB3) would be able to play games from XB1, XB2, XBS, XBO according to M$ oracles. But it could be expected that the final version of the system, XBox Play (PSX) will not have any actual games for the system but be backwards compatible with XBS, XB$ and XB3 directly, with upscaled quality for XB2 and XBO using the XBR scaling routines with XDR color bandwidth and XSD storage formats using XSL transforms and the M$ executives using XLS spreadsheets for all their XXX.

In a couple of years most games will only work correctly on the XBS. Sure, they might still run on the old XB1 but the frame rate will be something like 12 frames per second, and some features will be completely unavailable.

M$ removed Kinect gesture controls in the vain attempt to "unlock" more of the XB1's power. Clearly this failed. The XB1 will be phased out as a lame goose. This is the only way M$ will gain ground upon the gaming juggernaut that is the PS4. With XBox X slightly outperforming the new PS4 Pro, once again XBox will take the crown it has always paraded, of being the most powerful home games console of them all.

Sunday, 24 May 2015

Murdered: Soul Suspect - Mouth Bags and other books

I've been playing the quite remarkable game "Murdered: Soul Suspect" and came across these books in the apartment where Ronan (the main character) has his last fight. You have to get very close to be able to see them. They have rather strange titles.

On another note, I like the room you find these in. The girl that hid in there was kinda spiritual and it shows, by the crazy drawings on the floor, the dream catcher hanging from the ceiling, and paraphernalia she adorns her clothing with!

And what the heck is that stuck to the side of the fridge, a strange picture of (what I guess is) a face with a green eye. Weird.

Thursday, 21 May 2015

Uploader for Vimeo - Android

Uploader for Vimeo is an Android app for automatically uploading videos you've taken to the website.