Disk space for Windows developers

While I gladly finished my Windows development detour a while ago, it can’t hurt to share some stuff. It always puzzled me how fast gigabytes of disk space disappear through ordinary Windows usage as a developer. So here’s my non-exhaustive list of places to reclaim disk space:

Temp folders

Windows has plenty of them. In fact, each one surpasses the size of my Linux root file system:-) Let’s start simple:

  • C:\Users\$USER\AppData\Local\Temp

Office caches (mostly Lync data and random crap):

  • C:\Users\$USER\AppData\Local\Microsoft\Office\
  • C:\MSOCache

Whatever that is:

  • C:\ProgramData\Package Cache

SQL Server also has an update cache too:

  • C:\Program Files\Microsoft SQL Server\110\Setup Bootstrap

Don’t forget the System Center Configuration Manager Cache. That’s the thing that your sysadmin fills for you :

  • C:\Windows\ccmcache

Windows Installer Cache

This one can grow really fast.

  •  C:\Windows\Installer

However, you shouldn’t touch that manually. Otherwise all hell may break loose. Instead, use the official Windows Installer Cleanup Utility (deprecated but still usefull)or it’s successor Microsoft FixIt.

TFS-Mappings

In case you still rely on Team Foundation Server, regularly check your mapping folders. Build artifacts tend to pile up there even after removing branches, etc.

Resharper Cache

Visual Studio is useless without, so you’re likely using it too. I was unable to configure the cache size but you can safely delete it once in a while:

C:\Users\$USER\AppData\Local\JetBrains\ReSharper\$VERSION\SolutionCaches

.NET Caches

As with all serious software on Windows, the .NET framework has caches too. Depending on which version you care for (choose between 32bit and 64bit) you may exercise your delete keys in subfolders of:

  • C:\Windows\Microsoft.NET\Framework
  • C:\Windows\Microsoft.NET\Framework64

As an example, drop these for .NET-4.5-something:

  • C:\Windows\Microsoft.NET\Framework64\v4.0.30319\SetupCache
  • C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files

The pagefile

Yes, a classic! Windows loves to have a big pagefile because it always tries to get as many dirty pages on disks as possible. So in my case it had a (Windows-managed) size of 17GB. Feels like quite a lot. So depending on personal taste you may want to adjust this here:

pagefile

Suspend to disk

As expected, suspend to disk needs space too. Windows uses a dedicated file, usually around the size of your built in RAM:

  • C:\hiberfil.sys

If Suspend to RAM is good enough for you, you may want to disable it. Open up cmd.exe and issue “powercfg -H off“:

susp

TL;DR

With these rather simple measures, I managed to reclaim around 40GB on a Workstation at work. This can make quite a difference if you’re on a small-ish SSD.

Lync on Mac / Linux

Some of us have to work in a Windows environment at work. Often enough, people use Microsoft Lync to communicate. It is available for other platforms but that doesn’t make it any better. On Mac OS, the most viable instant messenger (IM) option is Adium. It turns out there is a SIPE plugin available for libpurple (the backend for a plethora of IMs including Pidgin). SIPE/SIMPLE is the “Lync protocol”.

Installation

Download and install Adium on your Mac:
Picture1

Then download the SIPE plugin. On a Mac, SourceForge will offer the Adium plugin by default.
Picture2
Once installed, you should get a success message:
Picture3

Account Setup

This step is rather straightforward, add an Office Communicator account:

Picture4

Fill in your mail address as username and your windows login name (including domain):
Picture5

On the Options tab, set the server name to your company’s lync server (i.e. something like lync.office.example.com):
Picture6

That’s it. Confirm the warning about self-signed certificates (A future post will probably deal with the Mac OS cert key chain).

Pidgin on Windows

In case you don’t like the official Lync client on Windows, there’s Pidgin. Download and install it from its homepage. Similarly to Adium, download and install the SIPE / SIMPLE plugin for Pidgin from SourceForge and follow the above guide. BTW. it’s the same on Linux😉

Fixing Steam on Linux OpenGL GLX warning

In some cases, Steam on Linux greets your with an error dialog stating:

OpenGL GLX context is not using direct rendering, which may cause performance problems

This is because Steam ships copies of several system libraries which may interfere with other libraries on your system that it doesn’t replace. This can easily be fixed. Just remove Steams copies and let it use your system’s default libraries. Here’s a simple script to accomplish that:

saschpe@festor:~ cat bin/steam-fix-opengl.sh
#!/bin/sh
rm ~/.steam/ubuntu12_32/steam-runtime/i386/usr/lib/i386-linux-gnu/libstdc++.so.6
rm ~/.steam/ubuntu12_32/steam-runtime/i386/lib/i386-linux-gnu/libgcc_s.so.1
rm ~/.steam/ubuntu12_32/steam-runtime/amd64/lib/x86_64-linux-gnu/libgcc_s.so.1
rm ~/.steam/ubuntu12_32/steam-runtime/amd64/usr/lib/x86_64-linux-gnu/libstdc++.so.6
rm ~/.steam/ubuntu12_32/steam-runtime/i386/usr/lib/i386-linux-gnu/libxcb.so.1

You can also download it here.

Windows Command Line and Copy-Paste

Using Copy-Paste in the Windows Command Line isn’t straightforward by default. To paste anything, you have to right-click to open up the context dialog and click insert (or “Einfügen” in German J):

However, the Command Line does have some semi-hidden settings which can simplify things. You have to right-click the cmd.exe window title and enter Properties (“Eigenschaften” in my case):

In the Options tab, you should tick the Quick-Edit-Mode checkbox and press Ok. You can of course adjust the other options to your liking:

From now on, whenever you’ve got something in the copy buffer, a simple right-click pastes the content into the Command Line Window. Neato.

Visual Studio C# Block Outlining

The C# editor in Visual Studio supports collapsing/expanding namespaces, classes and methods (aka the outlining feature).  Unlike the C++ editor, it doesn’t allow to collapse blocks (everything with braces, such as if/else, using, switch, etc.). However, you can retrofit this feature with the C# Outline 2013 extension.

Installation

Navigate to Tools -> Extensions and Updates -> Ctrl + E -> Type “outline” -> Install extension and restart.

Result

After restarting, blocks are outlined and you can collapse / expand them:

Outlined blocks!

It also adds some new shortcuts:

New shortcuts

 

Git with Synology DiskStation

When developing private software projects, you not always want to push it to Github right away if you’ve got the hopes to make some bits of money out of it, right? But just keeping your Git repository on your local disk isn’t the best choice either. If you happen to have a server at home, you should use that to backup your repository. Of course you should do that the Git way, i.e., set up a bare repository and use that as your origin remote to push to.

That’s particularly easy if you own a Synology DiskStation. Not too long ago, an official Git Server installation package was made available:

DSM "Git Server" package description

Enable SSH and user grant access rights

After installation, you get access to a simple GUI where you can allow local users to access Git over SSH:

Git config

Tick the checkbox for your user and press Apply. To make this work, you also need to enable SSH access to your DiskStation. For that, head into the Control Panel, navigate to Terminal & SNMP and tick the Enable SSH Service checkbox. For setting up a bare Git repository, you have to log in over SSH (assuming diskstation is a proper hostname):

$ ssh root@diskstation

Windows users can use PuTTY.

Remote Git repository setup on the DiskStation

This is how to set up my_repo for user sascha on /volume1 (Diskstation default, don’t worry):

$ mkdir -p /volume1/git/my_repo
$ chown -R sascha. /volume1/git/my_repo
$ cd /volume1/git/my_repo
$ git init --bare

Then you can log out from your DiskStation again. On your local machine, you can either directly clone this newly created repository:

$ git clone ssh://sascha@diskstation:/volume1/git/my_repo

Or add it as a remote to your already existing git repository and push your master branch to it:

$ git remote add origin ssh://sascha@diskstation:/volume1/git/my_repo
$ git push --set-upstream origin master

That’s it.

BitTorrent Sync on openSUSE

Recently, I discovered BitTorrent Sync, which seems to satisfy most of my file syncing demands. It’s encrypted client-side, cross-platform and works behind NATs and firewalls. While it is currently still proprietary (who cares, really), it is available for many devices. Besides the usual Windows / Mac binaries, you can find it on Android’s Play Store. Most interestingly, they provide ARM binaries. If you are a happy Synology NAS user, you can add the SynoCommunity package repository directly. That’s been the elevator pitch, check the community forums for more details.

Installation

First of all, you need to add Packman’s Essentials repository to install the btsync package. This is necessary due to the licensing terms of BitTorrent Sync, which don’t allow redistribution. Thus the btsync package will run a script (during installation) that downloads the btsync binary from BitTorrent servers (very much like the flash plugin installer on openSUSE). Either way, you’ll end up with btsync on your disk. For openSUSE Factory, the steps are (as root):

$ zypper ar http://packman.inode.at/suse/Factory/Essentials
$ zypper refresh
$ zypper install btsync

On recent openSUSE releases, systemd allows to start daemons as non-root users. Running btsync under your user rather than root avoids messing up file ownership and allows several people on the same machine to have their own distinct btsync configuration. So for the user saschpe (replace with your username), the commands are (as root):

$ systemctl start btsync@saschpe
$ systemctl enable btsync@saschpe

Configuration

To allow parallel usage for multiple users, the btsync daemon listens on port 8888 + $YOUR_USER_ID per default. So if your user’s UID (check /etc/passwd) is 1000, you can find btsync’s web interface at http://localhost:9888. This is how looks like:

btsync-web

The credentials can be found at $HOME/.btsync/sync.conf. The interesting part is the auto-generated password (which you could change), the username will match your Unix user account. However, you may also want to change the listen address to something different. So this is the config section you want to adjust:


...
"webui" :
{
"listen" : "0.0.0.0:9888",
"login" : "saschpe",
"password" : "supersecretpasswordhere"
}
...

Usage

Sharing folders and further setup can be done directly from the web interface, no need to mess with the config file again. Have fun.