Sunday, November 29, 2015 Register   Login

This site uses DNS Made Easy. Use it for reliable and professional DNS services.

RSS Feeds

Entries for January 2011

 2439 Views ::  1 Comments RSS comment feed

I got tired of having to hand-copy file paths into the InnoSetup script for PainlessSVN. I'm specifically referring to the Subversion server files. There's something like 278 files, that are in nested folders. I had just finished pasting in all the paths for Subversion 1.6.13, when 1.6.15 was released and I was seriously dreading repeating this whole excersise again.

I needed something that would recurse through both files and folders. It's easy doing one or the other, but not both at the same time (at least for me). I spent about 3 hours last night working on this. The good thing about this code is that I needed something similar for the new DeleteDevCrumbs utility that I'm polishing for release.

As it currently stands, this code will create a list of files from the directory that is passed in through a command-line argument, scan the child directories, and create a text file for you. The file will contain a ready made list that can be pasted right in the [Files] section of an InnoSetup script.

Here's a console app with this code: 

using System.Collections.Generic;
using System.IO;

namespace ScanFilesTest {     class Program     {         private static List<string>  _tree = new List<string>();         static void Main(string[] args)         {             string rootDirectory = args[0];             var rootInfo = new DirectoryInfo(rootDirectory);             if (!rootInfo.Exists)             {                 throw new DirectoryNotFoundException(string.Format("{0} does not exist!", rootInfo.FullName));             }             FileInfo[] files = rootInfo.GetFiles();             if (files.Length > 0)             {                 ScanFolders(files);             }             else             {                 DirectoryInfo[] folders = rootInfo.GetDirectories();                 ScanFolders(folders);             }             TextWriter subversionList = new StreamWriter("D:\\subversionfilelist.txt");             foreach (var file in _tree)             {                 var currInfo = new FileInfo(file);                 string currDir = currInfo.FullName.Replace(rootDirectory, string.Empty);                 subversionList.WriteLine(string.Format("Source: {0}; DestDir: {{pf}}\\Subversion{1}; Components: Subversion", file, currDir));                 subversionList.Flush();             }             subversionList.Close();         }         private static void ScanFolders(FileInfo[] files)         {             foreach (var file in files)             {                 if (file != null && !string.IsNullOrEmpty(file.FullName))                 {                     _tree.Add(file.FullName);                  }             }             if (files.Length > 0)             {                 string root = files[0].DirectoryName;                 var rootInfo = new DirectoryInfo(root);                 DirectoryInfo[] folders = rootInfo.GetDirectories();                 if (folders.Length > 0)                 {                     ScanFolders(folders);                  }              }         }         private static void ScanFolders(IEnumerable<DirectoryInfo> folders)         {             foreach (var folder in folders)             {                 if (folder.GetFiles().Length > 0)                 {                     ScanFolders(folder.GetFiles());                 }                 else                 {                     if (folder.GetDirectories().Length > 0)                     {                         ScanFolders(folder.GetDirectories());                     }                     else                     {                         if (folder != null && !string.IsNullOrEmpty(folder.FullName))                         {                             _tree.Add(folder.FullName);                         }                     }                 }             }         }     } }

posted @ Thursday, January 27, 2011 10:18 AM by Hector Sosa, Jr

Actions: Tweet This  Share on Facebook  Share on LinkedIn  Emakl  Permalink

I just joined the SQLServerCentral group at LinkedIn, and already found a great freebie. Microsoft has a downloadable version of "Introducing Microsoft SQL Server 2008 R2" over at

I realized that I hardly post stuff about databases, which is one of the things that I'm heavily into.

posted @ Monday, January 17, 2011 7:58 PM by Hector Sosa, Jr

Posted in: Databases

Actions: Tweet This  Share on Facebook  Share on LinkedIn  Emakl  Permalink

I've seen other tech companies do a New Year's letter, and I'm trying to adopt this in my workflow. So here's a roadmap that I set for myself for 2011:

TextFileSplitter 3

The MEF support is half-baked, so I want to upgrade everything to .NET 4.0. This version of .NET has a native implementation of MEF, so that I don't have to resort to the downgraded assembly that was created for .NET 3.5.

I also want to flush out the SDK. It needs a lot of love, and I now have the energy to get this done.

PainlessSVN 2.0

I want to see if I can get everything moved to .NET 4.0, as this version of the framework has a LOT of improvements. I'm hampered by .NET 2.0 right now, and I can't do a lot of things that I want. Moving to the latest version of .NET will let me implement some needed functionality without the need to resort to hacks.


This is a new utility that I created to help me with my builds. I found that I have to add a LOT of files, just to get my build script to get the correct files. One of the things that really annoys me is that there's a lot of temporary files from Visual Studio and Subversion in all my projects. On top of that, ReSharper and my other IDE plugins, also add their own temporary files.

This utility will let you delete all of these nuisance files in one go. For example, you could copy the whole project folder to a temporary folder, and tell DeleteDevCrumbs to delete the bin and obj directories. This little gem will go through all the subdirectories and nuke all of these things. It will also take care of the .svn folders, if you tell it to.

I'm in the process of polishing this for general comsumption.

PainlessSVN Backup

This is an application that has been on the back-burner for a long time. This will be similar to SVN Backup Widget. This is in the design stages, so not much has been done yet. I'm planning on using WPF for the GUI. My hope is that I can design it in such a way, that it can be used as a plugin for the new version of PainlessSVN. Not really sure when this will be done.

Anyways, here's to a fruitful 2011!

posted @ Wednesday, January 05, 2011 6:50 PM by Hector Sosa, Jr

Actions: Tweet This  Share on Facebook  Share on LinkedIn  Emakl  Permalink

I have been sort of avoiding the NoSQL document databases for a while. I tend to be need driven, and I just ran into a big speed bump with EAV (Entity-Attribute-Value) data for WheelMUD, my big open source project.

I did some research and found that RavenDB is a native .NET NoSQL engine. I downloaded it and had it going in a few minutes. The first thing that struck me was that there was no desktop UI to manage the documents. I didn't that deter me, so I used the web UI instead. Luckily, RavenDB comes with a built-in web server.

I was interested in the embbeded mode, so I tackled that first. I resorted to moving the database to where the server was, so that I could browse the document store. I had to do this every time I made a change, as I didn't want to bother to code the document database to the server directory. This was a throw-away app in any case.

I got as far as storing documents, and got stuck on creating indices for queriying the stored documents. The indices are just LINQ queries. I'm not sure about the other NoSQL implementations, but RavenDB stores the documents as JSON files.

I created a blog post on WheelMUD's site, with code and technical details.

The biggest tip that I can give people is to leave any relational database experience at the door. It will hinder you when dealing with NoSQL databases/document stores.

posted @ Tuesday, January 04, 2011 10:35 AM by Hector Sosa, Jr

Posted in: .NET Tools

Actions: Tweet This  Share on Facebook  Share on LinkedIn  Emakl  Permalink
Terms Of Use | Privacy Statement | SystemWidgets
Copyright 2002-2014 by SystemWidgets
Google Analytics Alternative