After many years using (and enjoying) Git, I had to start using Subversion again on a daily basis.

Git treats ignores on a regular file (.gitignore, whose rules are applied both to the same folder and to all subfolders), while Subversion treats ignores as an svn:property, which makes it harder to add new filemasks to the ignore list.

Using TortoiseSvn you can just click on the “add to ignore list”, but on command line you don’t have that.

This PowerShell function helps you on that. It will extract the svn:ignore property on any folder, include a new pattern to the list of ignores, and update the property. Enjoy!

function Svn-Add-Ignore
     [string] $folder,
     [string] $filemask

   if (( Test-Path $folder) -eq $False)
       Write-Host "Path $folder not found" -for red
       Exit 1
   $ignores = (svn propget svn:ignore $folder)
      $ignores = ($ignores -join "`n" | Out-String).Trim()   # convert multiple lines to single multiline string
      $ignores = $ignores + "`n" + $filemask
      $ignores = $filemask
   svn propset svn:ignore $ignores $folder

Sample usage:

Svn-Add-Ignore .\ "bin"
Svn-Add-Ignore .\ "obj"
Svn-Add-Ignore .\ ".vs"
Svn-Add-Ignore .\ "*.user"

When I was a kid, most computers here in Brazil were using US QWERTY keyboards, and with some help from this nice teacher (on my MS-DOS 5.0) I taught myself typing on that keyboard layout.

One day, someone who should probably be a strong nationalist (or maybe a lobbyist, or maybe just someone suffering from NIH syndrome) invented the Brazilian Portuguese Keyboard and all retailers and companies started using that new standard. I resisted for many years, and remained buying myself only QWERTY keyboards, until I finally gave up and embraced the Brazilian keyboard, since it was getting harder to buy a QWERTY keyboard in Brazil.

The problem is that although we have created our own power plug standard, our own digital TV standard, our own TV middleware and even our own analog color TV standard in the 70s, we still have communication and interaction with other countries who follow other standards.
(If you don’t know Brazil, I must explain that all those standards are NOT about nationalism, patriotism or about Not-Invented-Here syndrome - it’s all about spending lots of public funds so that our politicians can divert huge amounts of money into their own pockets)

But jokes aside (no, the 3 standards were not a joke), sometimes we use Laptops that were purchased abroad (that don’t have our keyboard layout), and we share servers that are hosted or used by people in other countries. That keyboard mismatch usually happens when you are using some keyboard to control a computer which is also controlled by people with different keyboards.

Windows allows you to set-up multiple languages and multiple keyboards for each language, and you can also toggle keyboards/languages with a hotkey (default alt+shift). The problem is that if you type as fast as Mavis taught me to, probably you should frequently toggle keyboards by mistake as I do.

To solve that, I decided that I would disable the hotkey for toggling keyboards, and more than that, I decided to create a Powershell script that would completely remove one keyboard/language and configure another one.

The script below (just save as .ps1 extension) will toggle (uninstalling and reinstalling the other) between Portuguese Brazil ABNT2 keyboard (10416) and US Qwerty (409), but always keeping English language (409).

# This scripts toggles keyboards between "Keyboard Portuguese Brazil ABNT2" and "US Qwerty"
# based on
# and

$currentLangAndKeyboard = (Get-WinUserLanguageList).InputMethodTips

if ($currentLangAndKeyboard -eq "0409:00000409")
  $langList = New-WinUserLanguageList en-US
  $langList[0].InputMethodTips.Add('0409:00010416') # English (United States) - Keyboard Portuguese Brazil ABNT2
  Set-WinUserLanguageList $langList
  $langList = New-WinUserLanguageList en-US
  $langList[0].InputMethodTips.Add('0409:00000409') # English (United States) - US Qwerty
  Set-WinUserLanguageList $langList

# If you want to have two languages (or keyboards) at same time, just .Add() both, but disable toggle language hotkey -
# $HKCUKeyboardLayoutToggle = 'HKCU:\Keyboard Layout\Toggle\'
# Set-ItemProperty -Path $HKCUKeyboardLayoutToggle -Name 'Language Hotkey' -Value 3
# Set-ItemProperty -Path $HKCUKeyboardLayoutToggle -Name 'Layout Hotkey' -Value 3
# Set-ItemProperty -Path $HKCUKeyboardLayoutToggle -Name 'Hotkey' -Value 3

As I said, I wanted to have only one language at a time to avoid the language hotkey, but later I realized that I could have just disabled that annoying hotkey. If you want to just disable the hotkey, just uncomment the final block in the script, which will add some keys to your registry. And if you want to use a powershell script to configure multiple keyboards (simultaneously), just call InputMethodTips.Add for each language/keyboard you want to add.