glasses-logo

<dominikgorecki> Web development on the Microsoft Stack <dominikgorecki>

Some Geeky Resolutions

It’s another new year. I enjoy this day because it feels like a blank slate to begin new habits, and drop old ones. We even make lists–resolutions. And so here is my list of computer-related resolutions.

1. Learn Linux Well

Modern Linux distros make it very easy to use. The fist time I installed Linux, it already had a GUI interface (KDE, GNOME, and XWindows) but the installation process was still console based, and any customization needed to be done manually in the terminal; as well, most applications needed to be compiled (I don’t remember any RPMs). I ran LILO, played with the distro a bit (Fedora, I believe) and dropped it. I regret that now. Linux is becoming ever more important as a desktop OS, while still holding on to its supremacy as a web server. For this reason, I want to learn the ins and outs of the kernel and terminal usage (not so much any X-Windows GUI).

2. Learn VIM

This of course, goes hand in hand with (1). I already started to learn this amazing text-editor in 2012, and I love it. It’s quick, powerful, and entirely customizable.

3. Learn Basics of C++

I want to have a working knowledge of C++ by the end of 2013. I have a basic grasp on the language’s syntax, but I want to become more familiar with its OOP capabilities, and have the ability to quickly adapt to any API.

4. Expand on my C# and ASP.NET Expertise

To break from the GNU theme, I also want to build on my C# and ASP.NET expertise. Mainly I want to learn more about MVC and multithreading in C#. I still think that Microsoft has a huge role in the web of the future, especially with enterprise systems. I want to be part of it. No one can convince me that there’s anything better for enterprise web applications (for the developer at least) than Microsoft. We’re spoiled rotten by the support, easily the best IDE, and awesome frameworks with built in capabilities.

5.  Become a Web UX Specialist

In addition to expanding my knowledge of java\html5\css3, I want to learn more of the theory behind UX, its implications, and its the best possible implementations. The user interface—and in turn the user’s experience–is such an important part of any application (web or otherwise) because it’s how we communicate with the application. Linux may have been a faster, more stable and cheaper alternative to WIndows and Macs, but they lost the UX war. It is only after distributions became easy to install, configure, and use through an excellent GUI, did Linux gain a larger market share in the desktop world. User interfaces are always important—even if they are not graphical. An application like VIM may be entirely devoid of a graphical UI, but it still has a UI: the commands (and how they are implemented) is extremely important.  It is one of the things that makes it a great application. The placement of every key is considered when the command line controls were programmed.

To summarize, it may seem like there’s a real dichotomy between (1,2,3) and (4,5), but I see these skills as complimentary. Having a greater knowledge and experience of lower level programming will give me a better understanding (and appreciation) of the abstraction layer I’m so very used to. And while 4 and 5 will probably contribute most to my career (since I’m already employed as an ASP.NET web app developer), knowing a whole other world can only expand my horizons.

Powershell Mirror Directories

A Custom Back-up Solution for external drives

powerShellIconRecently I re-installed windows and re-initiated my development environment. However, when it came to finding a back-up solution for data files (that is, no-system user-files) I was not satisfied with my options: Windows back-up does not support non-windows drives and external hard-drives, and the free-software out there isn’t what I’m looking for. Perhaps there’s a good software option out there, but I didn’t find what I was looking for.

I want my back-up tool to do the following:

  • Back-up the specified directories when I want it to
  • Be efficient. I.e. work quickly
  • Be aware of back-up location. I.e. external hard-drives where the drive-letter might change.
  • Little-to no overhead and extra bes

The closest thing I came to, is a PowerShell script by Mathew Painter. His excellent article and script can be found here.

Mathew’s script is excellent: it checks to ensure that the drive-letter of the external drive did not change, if it did change, it updates the back-up destination (if it still exists), and with robocopy it runs very efficiently and quickly. However, the solution lacked the first pre-requisite as it only backed-up a whole drive. For me, this is unnecessary as I’m only concerned with 2 folders on my D: drive so I endeavored to re-fashion his script.

Essentially the script mirrors a directory of your choosing into a directory of your choosing. Sounds simple, right? It is, but it’s not.

  • You could just drag and drop your files, but that’s something you cannot automate. Plus it’s not as fast as robocopy and it doesn’t truly mirror the files. I.e. directories and files that were deleted in the source location will not be deleted in the destination (back-up) location.
  • You could just use robocopy with the appropriate arguments, but then what if the letters of the external hard-drives change (when re-plugging them in a different order).

Running the Script

Here’s how this script works. When you run it for a first time, it will ask you the input details:

  1. Source Drive letter. E.g. If you are copying something for the C:\ drive, type in “C”. NOTE, do not type anything in but the letter (Not “C:” or “C:\”.
  2. Source path. E.g. If you are copying “C:\Users\username\Documents”, type in, “Users\dardawk\Documents”. Note that you need to drop the drive letter, collon and backslash.
  3. Destination letter: E.g. “F:\” would be “F”
  4. Destination path: A pre-existing path where your directory will be mirrored to. So if you have a “F:\backup” folder, you should type in, “backup” here.

An example of backing up D:\testMirror to J:\backup-mirror\testMirror:

PS-Screen01

And that’s it.

The script will generate a mirror-directories.xml file that will be used to automate the process so that the next time you run the script, no user input will be necessary (except to click continue). As well, robocopy will generate a report for you that will be saved in the source directory.

MORE…

Since I customized this script so that it works on directories, it may be necessary to have multiple copies of the script (with multiple set-up xml files). I added in this feature so that if you have multiple copies of the script with different names in the same directory (let’s say backup1.ps1, backup2.ps1, backup3.ps1, …) the script will create the following setup set-up xml files after running the first time: backup1.xml, backup2.xml, backup3.xml.

Simple as that.

After you run the backup for the first time, you can set-up run it regularly through Windows Scheduler.

Download

A warning: This script is provided as-is, and it’s recommended that only power-users utilize it. Personally, I would never run a powerShell script which code I didn’t read through at least once.

People who should not download this script:

  • If you don’t know what a PowerShell is
  • If you don’t know how to enable unblock a PowerShell script that’s downloaded from the internet (For this reason, I did not illustrate how to do this in this post)
  • If you don’t know how to change the PowerShell execution policy. (For this reason, I did not illustrate how to do this in this post)

Having said that, here is the download link:

Download Link

Reference Links

Open Menu Button

Menu