All posts by Adam Prescott

I'm enthusiastic and passionate about creating intuitive, great-looking software. I strive to find the simplest solutions to complex problems, and I embrace agile principles and test-driven development.

My work laptop has been a free-hard-disk-space disaster for a while now, but I’ve mostly just been ignoring it. I really only use it when traveling, so it’s just not been much of a priority. I’ll empty the recycle bin or clear out my downloads folder to finish the tasks of the day. Not enough? Maybe I’ll run the Windows Disk Cleanup utility to get the temp files and whatnot. Those temporary measures are enough to get me through the day, but it’s really not enough. After hobbling along for probably more than a year, I finally did some real work to solve the problem, and I freed-up close to 100 GB using three tools.

IOBit Uninstaller

A good, simple way to free up big space quickly is to uninstall programs you don’t need, particularly if you’ve got some big ones (cough, cough… World of Warcraft). Occasionally when performing this activity, I’ll run into a program that can’t be uninstalled because its installer is missing or corrupt. I’ve dealt with this in the past by doing a manual uninstall–deleting files and hunting around in the registry. When dealing this this recently, I somehow stumbled onto IOBit Uninstaller. In addition to dealing with the uninstallable, it also let’s you uninstall multiple programs at once. That’s a pretty nice feature when you’re looking to free up some disk space. Just scroll through the list, select all the programs you want to remove, and let IOBit Uninstaller remove them one by one.

WinDirStat

So you’ve taken care of the low-hanging fruit by uninstalling unused applications, but you still don’t have enough free space? It’s time to do a little investigative work to see what’s taking up all that space. I’ve used different tools in the past, but this time I took WinDirStat for a whirl. It did a fine job. I like that it gives you a tree-view with percentages that you can drill into as well as a visualization. In my case, I found 30 GB of files that had been uploaded to a synced OneDrive folder on my hard drive. In the past, I’ve also seen big, unused databases eating up tons of space.

My investigation also revealed that a fairly large amount of space was being taken up by C:\Windows\Installer, which brings me to my third and final tool…

WICleanup

I found WICleanup after doing some research about how to cleanup the Windows\Installer folder. I don’t really know how it works, but it “only deletes the unused files in the installer folder.” Sounds great, right? I tried it, and it seemed to work as advertised. I’m a little skeptical and concerned that I’ll hit problems later when trying to uninstall something, but hey–at least I’ve got IOBit to help me clean it up if I do.

Share this:

Like this:

OneDrive is great for backing up data to the cloud, but one of its limitations is that you are only allowed to specify a single folder. I had an application that I used frequently between two computers, and I needed to manually copy files between the computers any time I changed settings.

After doing a bit of research, I found a great solution utilizing OneDrive and junctions created using mklink. The secret to this approach is to keep the “real” files in your OneDrive folder, and then create the links from the original path.

Here’s a quick example to demonstrate. Let’s assume I have a directory c:\users\adam\foo\settings that I want to sync between computers. I would perform the following steps:

Make a backup of c:\users\adam\foo\settings just in case something goes wrong.

That takes care of one PC so that it will use the files that are now contained in the OneDrive folder, but it’s only half the battle. Now we need to switch over to the other PC and configure it to use the OneDrive files, too. I’ll use a different username in my path to help illustrate that these steps are being performed on computer #2.

Share this:

Like this:

LINQ’s Distinct extension has largely been a disappointment to me. Sure, it’s nice when I’m working with a collection of integers, but more often than not, I’m working with a collection of objects and don’t have an IEqualityComparer<TSource> available to me. I know I could just create one, but I just want to use a lambda like just about everything else I do with LINQ!

To the internet!, right? I learned I could use the following trick to accomplish what I want:

collection
.GroupBy(x => x.key)
.Select(x => x.First());

Works like a charm, but I got tired of dot-GroupBy-dot-Select-ing and adding a comment about what I was doing for future maintainers, and I think it’s a lot better to just chuck it into an extension method.

Ahh, nice! Alternatively, could score this functionality by adding MoreLINQ to your project. On a neat side-note, you can also cherry-pick which MoreLINQ functionality you want by installing individual packages.

Share this:

Like this:

In recent months, I’ve come to be a big fan of Ninject. I’ve used Microsoft’s Unity Container and Object Builder in the past, but most of what I’d done previously just involved exposing dependencies as properties with lazily-loaded default implementations. I really dig Ninject because it’s so lightweight and easy to use, and it integrates really well with mocking frameworks like Rhino Mocks and Moq.

Getting started with Ninject is really easy and accomplished in just a few steps:

Install the NuGet package

Install-Package Ninject

Create a module

Create a kernel

Get objects from the kernel

Let’s look at an example. Assume we have the following interfaces and classes.

And, finally, we use the kernel to request the objects we need. Note that Ninject does the work of figuring out the default implementation of IFoo (Foo) has a single constructor that accepts a dependency, IBar, and that the default implementation of the dependency is Bar.

Like this:

Git’s been a part of my daily business for a little more than a year now, and I ran into what can only be described as a shenanigan shortly after I started. The first feature branch I ever created was named something like Adam/a-feature. I did some work and merged it into master. Yay. Then it was time to work on a new feature, so I created another feature branch. This time, however, I decided that I wanted to use a lowercase “adam” as the branch prefix, something like adam/another-feature. Seems okay enough, right? Not so fast, my friend.

I was creating these branches in Bitbucket and syncing them locally with SourceTree. My new branch, adam/another-feature came down as expected, and I was able to do my work. Something weird would happen when I pushed my changes to the remote branch, though. SourceTree would report success, but it would indicate that I still had changes that needed to be pushed. Adding to my confusion, I could see that there were now two branches in Bitbucket: adam/another-feature and Adam/another-feature! What gives?

Well, it turns out this is due the the case-insensitivity of Windows. Branches are stored as files within the .git directory, and creating a new branch will create a file in the .git/refs/heads directory. So when I created my first branch, Adam/some-feature, it created the folder .git/refs/heads/Adam. Then, when I created my second branch, adam/another-feature, Git found and used the existing folder, .git/refs/heads/Adam, and used that.

Long story short, if you wish to change your capitalization scheme for branch prefixes in Git for Windows after you’ve already used a prefix with a different scheme, head on over to .git/refs/heads and make the change there!

Share this:

Like this:

When it comes to Git, SourceTree is definitely my tool of choice. However, I was surprised to find that there doesn’t appear to be any sort of built-in commit tracking to see which branches do and don’t contain a commit, similar to changeset tracking in Visual Studio. Now, that said, it’s pretty easy to do with Git, there’s just nothing that I could find baked into the SourceTree UI (Am I wrong? Let me know!).

So, if I need to do this, I click the Terminal button in SourceTree and run one of the following commands:

Share this:

Like this:

Sometimes, for whatever reason, I get a project that’s refusing to build because of missing references. But these missing references shouldn’t be missing because they’re Nuget packages!

Luckily, there’s a handy little command you can run from the Nuget Packager Manage Console. It’s one of those not-so-frequenly-used pieces of information that I need to lookup every time I need to use it… Perfect for a short blog post!

Restore packages for the entire solution:

Update-Package -Reinstall

Restore packages for a single project:

Update-Package -Reinstall -ProjectName

Share this:

Like this:

There are lots of reasons why you might need to run an application as administrator. Visual Studio, for example, needs admin privileges to do things like run a project using IIS or launch the Azure Compute Emulator. If you use these tools daily, manually running as Administrator gets tiresome. The straightforward way to automate this is to check the “Run as Administrator” checkbox on a shortcut, but that checkbox doesn’t get used if you’re opening files directly.

Luckily, there’s a not-so-obvious way to perma-enable running as administrator for an executable.

Navigate to the file in Explorer

Right-click the program and choose Troubleshoot Compatibility

A dialog will display that says it’s detecting issues

When prompted, select the option to Troubleshoot program

Check the box next to The program requires additional permissions

The next screen tells you that the UAC setting “Run as administrator” has been applied; click Test the program… to launch the application to verify

You can verify that the application is running as administrator because “(Administrator)” will be added to the title bar

The troubleshooter will ask you to verify that the problem was fixed; select Yes, save these settings for this program

Finally, you’ll be displayed a summary indicating that the “problem” has been fixed, and you can close the troubleshooter

And–voila!–your application will now launch as administrator regardless of how its started, whether it be through a shortcut to the .exe or by double-clicking a file for which it’s the default program.

Share this:

Like this:

The last few times I’ve tried to use Skype from my phone, I’ve had a problem where the person I’m calling says I sound like a chipmunk and they can’t understand anything I say. The first time it happened, I didn’t really think anything of it. I just figured there was something messed up with Skype and/or my phone that would work itself out after some time. But then it happened again a few weeks later, so I figured I should do some troubleshooting.

I tried uninstalling and reinstalling Skype, but no dice–the problem persisted. Then I did what I probably should’ve done first: googled “android skype chipmunk.” The first hit was an AT&T forum with a bunch of people describing my situation. Essentially, “I have a Galaxy S4 and peeps can’t understand me because I’m chipmunk’d.”

Think I figured it out – I had enabled ‘OK Google’ from any screen – turning it back off solved the issue.

Gah, for real? I headed over to the Google app and disabled the option to listen for “Ok Google” from any screen. Sure enough, problem solved. This is a disappointing resolution because I really like saying “Ok Google” to initiate and execute voice searches from anywhere, but apparently I have to choose between having that and having to manually turn it off when I use Skype.

After scouring forums for a while longer, I did find a Hangouts thread where some Google folks acknowledged that they were looking into the issue but no word on finding a cause or timeline for a fix. Other posters on the forum cited problems with LG phones. This coupled with the fact that it’s an issue with video chatting in Skype and Hangouts indicate that this is not a Samsung or Skype problem.

So, okay Google… Fix this!

Share this:

Like this:

Posts navigation

Hi, I’m Adam. This is my blog.

I started this blog as a personal searchable repository of things I've learned and figured out. It evolved into a mechanism to facilitate personal growth, and now it's turned into a bit of a hobby. I enjoy writing about software development, my professional life, and related topics.

I love to hear from readers, so please feel encouraged to leave comments on anything you read here.

Follow Blog

Enter your email address to follow this blog and receive notifications of new posts by email.