Archive for the 'Techie' Category

h1

Backup Solution

Saturday, July 21st, 2007

I have been taking a lot of pictures over here in Europe and I have also thought about how awful it would be if I had a disk failure and lost all of them, so I decided to come up with a backup solution to make sure this never happened to me. I looked around for an online solution that would run in the background and continually sync my files to web space, but I couldn’t find anything I wanted for the price I wanted (read: free). Also, I have like 48GB of web space on mattfaus.com that I’m not using, so I figured I should utilize it.

So, I used Christopher Evans’ blogpost Backing Up Your Files: A Comprehensive Guide for CG Artists and Users Alike to come up with this command:

rar a -u -msjpg;mp3;zip;rar;xsn;mpg;mpeg -rv10 -v524288k BackupC.rar @CDriveBackupList.lst

a = add files that don’t exist in the archive to the archive
-u = update files in the archive that need updating
-m[list] = copy files with these extensions without compression into the archive (HUGE speed boost)
-rv10 = create 10 recovery volumes - each of the recovery volumes can replace one of the regular volumes
-vXk = Create split volumes at 512MB each
BackupC.rar = name of archive (split comes out like BackupC.part01.rar, BackupC.part02.rar, etc.)
@CDriveBackupList.lst = the list of files and folders to archive (one per line, no quotes necessary)

Rar or WinRar is a great tool that I install on all my machines. It works on loads of compression formats and adds great commands to the right-click context menu in Explorer.

I have 4 physical disks in my machine, 2 of which are RAIDed (striped), for a logical total of 3 disks. The RAID disks are where I run my OS and the other two disks are my storage.

C = 138GB = Operating System
F = 232GB = Storage2
G = 232GB = SATA Storage
Total: 602GB

So, I backup F onto G and G onto F, and C (which is much smaller) onto both F and G. As soon as I get back to the land of fast Internet connections I will upload to my web space. I stored the command string in a .cmd file, of course, but I don’t plan on running it as a scheduled task - I think I’ll just make an outlook reminder to get me to do it on my own. I should also probably run disk defragmenter at that time.

Recovery volumes
I learned about this after I started using USENET to download files and it is a great concept. It provides parity on the files so that if any of the individual archives are corrupted, you can replace it with one of the recovery volumes. I haven’t ever actually had to use it, but I think it’s a good idea to have it. I have loads of disk space so I do 10-20% parity. G backup resulted in 40 archives, so I made 6 recovery volumes on top of this. The recovery volumes are the same size as any of the individual archives.

Running Times
G = 18.4GB = 20 mins archive + 44 mins parity = 1 hour 4 minutes
F = 10.8 GB = 30 mins archive + 37 mins parity = 1 hour 7 minutes

That SATA drive really shows it’s true colors here.

Also, if you’re marvelling at my speeds, I do have a pretty beefy machine:
AMD Athlon 64 X2 Dual Core 5200+
2.61 GHz per core = 5.22 GHz theoretical
4GB RAM

Microsoft Windows Server 2003
Enterprise x64 Edition
Service Pack 2, v.2825

h1

Execute the Default Network Login Credential Dialog box for WinForms

Friday, June 15th, 2007

I had been looking for this for a while, and I finally got the right keywords. What I was trying to do was make sure that a user was logged into a website before my code tried to download something from it. I was setting the CredentialCache to DefaultCredentials, but this doesn’t work unless the user has already logged into the website. So, if you want to pop the default window and get the credentials from the user, here is the link:

http://msdn2.microsoft.com/en-US/library/aa375177.aspx

I’ll edit when I get some sample code working.

h1

2007 Microsfot MVP Global Summit

Tuesday, March 20th, 2007

Well, after spending the week in Seattle for the MVP Global Summit I thought I’d send a quick recap of the week’s activities. Overall, it was a really awesome conference. In both formal and informal settings, I was able to meet with those at Microsoft responsible for the creation of InfoPath and talk about pain points, new features, and anything else that came up.

Tuesday was a keynote by Bill Gates in the morning followed by some awesome demos from a lot of the product teams at Microsoft. Wednesday and Thursday was geared towards the MVP feedback to Microsoft and included several roundtable discussions where both sides could discuss aspects of the product. The first one of these was especially cool because there were more Microsoft reps than MVPs, so it was very focused.

The other sessions were good, but several of them were joint sessions with either the Access or SharePoint MVPs. This joining up wasn’t bad, but I got the feeling that there just wasn’t as much effort put into the InfoPath MVP experience. This should be said with a grain of salt, however, because there were only four of us. Anyway, below are my takeaways from the weekend.

  • A very interesting addition included with .NET 3.0 is called Language Integrated Query, or LINQ. The idea behind LINQ is to make querying data sources, whatever they may be, incredibly easy. To do this you setup a DataContext, which can be XML, SQL, or an IEnumerable object. When this is done a whole bunch of code is automatically generated to represent the data store as objects. Once this is done querying the data becomes much easier, but that’s not all. The crux of LINQ is all of the “extension methods” (more on this later) that are added to the working namespace and can be used to create SQL-like queries (using a bunch of new keywords added with .NET 3.0) to issue queries against the established DataContext. Once the results are found they can be parsed with more LINQ calls to quickly find what you are looking for. There are a lot of really big pros in this, but also some cons. The “extension methods” seem to me like thinly veiled “multiple inheritance” and could lead to lower code readability. Also, anonymous types with the ‘var’ keyword are usually necessary, which definitely reduces readability.
  • Microsoft Developer Roadmap

    

    • Visual Studio Orcas with the latest VSTO promises incredible power to expand current Microsoft Office products. The demo given was the creation of an awesome looking Outlook add-in in 5 minutes. Full ribbon integration and a widely exposed object model make the expandability of Office applications easy and powerful.
    • 

    • For web development, there have been some libraries added to generate AJAX scripts on ASP.NET pages so that operations require fewer postbacks. Can you say Web 2.0?
    • 

    • Friction-free deployment – more advancements on error logging, and APIs to have programs “call home” to download the latest bits.
    • 

    • XAML XAML XAML! A really cool new product with Office 2007 is the Expression editor that presents a Macromedia Flash-looking interface and outputs .xaml files. The power of this is that it completely separates UI design (something that almost all developers dread) from functionality. Once the .xaml files are created then they can be slapped onto a WinForms application to create a beautiful and functional piece of software. You could think of a .xaml file here as being a XSL stylesheet for a WinForm application. I’m interested to see how we could leverage this technology in the SmartSearch desktop and mobile clients.

Click below to see:
All Microsoft MVPs
My MVP Profile Page

h1

Base64 Regular Expression

Wednesday, February 14th, 2007

Here’s another thing I thought should have been easily accesible from a simple Google Search, but alas. This regular expression was created in C# .NET 2.0 to extract Base64 text from an InfoPath XML file so that my indexing algorithm wouldn’t waste its time on it. It will recognize Base64 strings 20 characters or greater (this is necessary, otherwise it will match good ‘ole english words as Base64). Simply change the 20 to a lower or higher number if you need to.

Oh yeah, here’s a cool link on working with Regular Expressions in .NET.

The Regular Expression
[0-9a-zA-Z\+/=]{20,}

The Code Snippet
string rawString = "";

FileInfo fInfo = new FileInfo("../../TextFile1.txt");
using (StreamReader sReader = new StreamReader(fInfo.Open(FileMode.Open)))
rawString = sReader.ReadToEnd();

Regex regExBase64 = new Regex(@"[0-9a-zA-Z\+/=]{20,}");
rawString = regExBase64.Replace( rawString, "" );

h1

Windows Command Batch Scripting - Create a date string of format YYYYMMDD

Thursday, December 28th, 2006

Below is the code to do this. I was frustrated at not being able to find a quick answer on this so hopefully this will help someone.

set today=%DATE:~10,4%%DATE:~4,2%%DATE:~7,2%

REF: http://www.ss64.com/ntsyntax/varsubstring.html

h1

Revert, Undo, or Roll Back a Changeset in Visual Studio Team Foundation Source Control

Tuesday, August 1st, 2006

This another one of those posts that hopefully Google will rank high up for a query that I was trying this afternoon. It has to do with Source Control using Visual Studio’s team foundation system. I had made a check-in to fix some stuff and then made another check-in to fix some other stuff, but then found out that the first check-in needed to be reverted. There’s no obvious way to do this, and judging from this thread, it was punted as a feature until version 2 is released. Anyway, I found this HowTo online that worked for me (although I was happy I only had to revert a small number of files, because you have to go in and manually process each file), and hopefully it will help somebody else out there. If you happen upon this and you’re still having trouble, feel free to e-mail me for details. Now, without further ado, the link:

HowTo: Revert, Undo, or Roll Back a Changeset in Visual Studio Team Foundation Source Control

h1

FireFox: Cycle Search Engines Keyboard Shortcut

Tuesday, July 18th, 2006

Today, by pure accident, I discovered that the built-in search box in the top-right corner of the application window cycles through the collection of search engines when Ctrl+Up or Ctrl+Down.

This was cool for me becuase before I learned this I was selecting with the mouse, and that was getting annoying. Now I can do everything from the keyboard:

  • Ctrl+T (new tab)
  • Tab (move to search box)
  • Type search phrase
  • Ctrl+Up or Ctrl+Down to select search engine
  • Enter (launch search)

The search engines I use the most are Google, of course, and Dictionary.com. Dictionary.com also has a pretty awesome Thesaurus, and I try to use it when I want to sound sophisticated (read: when writing formal papers).

h1

Regular Expression Library

Friday, July 14th, 2006

Hey, I’ve got another link for all the developer’s out there. Today, I was trying to figure out a regular expression to determine if a string was a valid GUID or not, and I figured, “Ya know, I’m sure there have been tons of people to do this before me: Google it!”. After a little bit of searching I found this website that has regular expressions for almost anything you can thing of such as dates, times, addresses, social security numbers, etc. etc.

RegEx Library

h1

Transact-SQL Concatenate String with Null

Thursday, July 13th, 2006

Today I was altering a computed column of one of the tables in our SQL 2005 database, but was hitting the problem that concatenating a string with a null value produces a null value. My table had a FirstName and a LastName column and I was trying to make a FullName column with a computed value of (FirstName + LastName). The problem I was hitting was that when the LastName column was null the whole equation was returning null, but I, of course, wanted an empty string. The key to solving the problem is using Transact-SQL’s IsNull() function which returns a predefined value if the first parameter is null.

Wrong:
SELECT ('Test String' + NULL)
----------------------------------------------------------
NULL

Right:
SELECT ( 'Test String' + ISNULL(NULL, '') )
----------------------------------------------------------
Test String

Hopefully if someone is Googling around looking for an answer to this problem (like I was a little bit ago) they will find this and it will make their day.

h1

Cingular 8125

Monday, July 10th, 2006

Well, I got a pocket PC phone from work to develop mobile applications and to celebrate I thought I would make a post from it! So, here I am typing this from my phone!