Friday, October 24, 2014 Register   Login

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

RSS Feeds
Blog

Utilities

This is for utilities that make computer easier, and some of them actually pleasant.

Oct
24

I've tried a few textual duration functions that were floating around the Internet. I finally hit on something that is exactly what I want. Here's the T-SQL script to create a scalar function to use in your monitoring and admin scripts:

CREATE FUNCTION [dbo].[GetDuration]
(
    @startTime DATETIME, @endTime DATETIME
)
RETURNS VARCHAR(50)
AS
BEGIN

    DECLARE @duration INT, @hours INT, @minutes INT, @seconds INT, @totalSeconds INT,
    @stringdate VARCHAR(12),@durationText VARCHAR(200),@milliseconds INT

    SET @durationText = ''

    SELECT @stringdate = CONVERT(varchar(12), DATEADD(ms, DATEDIFF(ms, @startTime, @endTime), 0), 114)

    SET @hours = substring(@stringdate,1,2)
    SET @minutes = substring(@stringdate,4,2)
    SET @seconds = substring(@stringdate,7,2)
    SET @milliseconds = substring(@stringdate,10,3)

    IF @hours > 0
    BEGIN
        DECLARE @hourText VARCHAR(12)
       
        IF @hours = 1
        BEGIN 
          SET @hourText = ' hour '
        END
        ELSE
        BEGIN
          SET @hourText = ' hours '
        END
       
        SET @durationText = cast(@hours AS VARCHAR(3)) + @hourText
    END

    IF @minutes > 0
    BEGIN
        DECLARE @minuteText VARCHAR(12)
       
        IF @minutes = 1
        BEGIN 
          SET @minuteText = ' minute '
        END
        ELSE
        BEGIN
          SET @minuteText = ' minutes '
        END
        
        SET @durationText = @durationText + cast(@minutes AS VARCHAR(3)) + @minuteText
    END

    IF @seconds > 0
    BEGIN
        DECLARE @secondText VARCHAR(12)
       
        IF @seconds = 1
        BEGIN 
          SET @secondText = ' second '
        END
        ELSE
        BEGIN
          SET @secondText = ' seconds '
        END
        
        SET @durationText = @durationText + cast(@seconds AS VARCHAR(3)) + @secondText
    END

    IF @milliseconds > 0
    BEGIN
        -- Only show milliseconds if that's the only time unit
        -- that is not zero
        IF len(@durationText) < 3
        BEGIN    
            DECLARE @millsecText VARCHAR(25)
           
            IF @milliseconds = 1
            BEGIN 
              SET @millsecText = ' millisecond'
            END
            ELSE
            BEGIN
              SET @millsecText = ' milliseconds'
            END
            
            SET @durationText = @durationText + cast(@milliseconds AS VARCHAR(3)) + @millsecText
        END
    END   

    RETURN @durationText
   
END

Comment if you use it. :)

posted @ Wednesday, October 24, 2012 12:09 PM by Hector Sosa, Jr

Actions: Tweet This  Share on Facebook  Share on LinkedIn  Emakl  Permalink  del.icio.us
Sep
07

A while back, I created a little utility to edit ASP.NET membership services database. The instructions only talked about DotNetNuke. I've now added instructions on how to use it on regular ASP.NET membership databases.

There previous blog post is DotNetNuke user manager - Winform App. The new app is called MembershipUserManager. I've included, as usual, both the source and binaries. The source is now a Visual Studio 2010 solution. It actually uses .NET 2.0, so older versions of Visual Studio and SharpDevelop can use the source.

The ReadMe.txt file, in the zip files, has instructions on how to setup regular ASP.NET membership and DotNetNuke.

posted @ Friday, September 07, 2012 10:07 AM by Hector Sosa, Jr

Downloads:

Actions: Tweet This  Share on Facebook  Share on LinkedIn  Emakl  Permalink  del.icio.us
Jul
07

I finally got the first working version of DeleteDevCrumbs. I decided to release this without a GUI, because I've found it so useful. The current release contains two (2) files; DeleteDevCrumbsConsole.exe and DeleteDevCrumbs.dll.

Here is the commandline to handle "crumbs" from a typical Visual Studio setup:

deletedevcrumbsconsole root=C:\Projects crumbfolderlist=bin,obj crumbextensionlist=suo,user

You can just double-click on DeleteCrumbsConsole.exe to see its usage:

I created this to solve the vexing issue of removing extra crap that IDEs create with the source code. I use this for code releases, and continuous integration. The two main programs that I use this with are FinalBuilder and CCNet.

Please let me know if you use it for other things, and other programs. I'm very curious to see how this gets used. Leave a comment here or email me at hector AT systemwidgets DOT com.

posted @ Thursday, July 07, 2011 12:11 PM by Hector Sosa, Jr

Downloads:

Actions: Tweet This  Share on Facebook  Share on LinkedIn  Emakl  Permalink  del.icio.us
Jan
27
 1884 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  del.icio.us
Jan
05

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.

DeleteDevCrumbs

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  del.icio.us
Jan
19

I released Text File Splitter 2 about a week ago. Had to fix a couple things right away, so the version number is 2.0.2 at the moment.

I was finally able to add the autoupdate feature. This feature can be used in two ways:

1) Through the menu

You will see some action on the right hand side of the form like this:

2) Running the wyUpdate.exe program manually

You will see this dialog right after you run wyUpdate.exe:

The best thing about the auto update is that you have the ability to update the program even if it is not working.

I'm in the process of fleshing out the Software Development Kit (SDK) for Text File Splitter.

posted @ Tuesday, January 19, 2010 12:33 AM by Hector Sosa, Jr

Actions: Tweet This  Share on Facebook  Share on LinkedIn  Emakl  Permalink  del.icio.us
Jan
05

I just wanted to show everybody what I was working on tonight. I got the console program working with all the splitting strategies. That was a lot of fun. Since I was in a roll, I went ahead and implemented the feature where the GUI will give you the commandline for the current settings.

Here is the GUI all setup:

Now click on the "Get CommandLine" button and you get this:

I also started filling out the SDK. All in all, I had a very fun night coding this. It really helped me forget (at least for a few hours) the blown engine in our Dodge Durango.

Cheers!

posted @ Tuesday, January 05, 2010 1:46 AM by Hector Sosa, Jr

Actions: Tweet This  Share on Facebook  Share on LinkedIn  Emakl  Permalink  del.icio.us
Jan
03

The GUI is now done. I'm working on the command line console. I'm working really hard in keeping the same command-line swtiches that were used in version 1.5.1. Since there is no GUI in the console, I'm including the finished GUI screenshot:

After I get this released, I will add functionality to have the GUI to create a command-line for the user.

posted @ Sunday, January 03, 2010 8:54 PM by Hector Sosa, Jr

Actions: Tweet This  Share on Facebook  Share on LinkedIn  Emakl  Permalink  del.icio.us
Nov
17

I'm an IT guy at heart. I came up through the operations side of Information Services, mostly because my degree is in Managment Information Systems (MIS). As an operations guy, I'm always on the lookout for utilities that will make my life at my desk easier.

Well, I came across one utility that literally left me dumb-founded, total mind screeching to a halt stuff. NirSoft has created a viewer for BSOD mini-dumps. Holy Freaking Cow Cheez Whiz! I wish I would have know about this one years ago, when BSOD happened several times a day.

I actually had a BSOD on my day job's workstation yesterday. I'm going to be playing with this baby tomorrow!

posted @ Tuesday, November 17, 2009 8:45 PM by Hector Sosa, Jr

Posted in: Utilities

Actions: Tweet This  Share on Facebook  Share on LinkedIn  Emakl  Permalink  del.icio.us
Nov
17

I really needed to have taskbars across both of my monitors, especially since these things are huge (28"). I checked Scott Hanselman's utility list and tried UltraMon and DisplayFusion. Both left me wanting. I was browsing through the SuperUser questions, when I found that somebody had asked about multiple taskbars on Windows 7.

The utility mentioned over there is Actual Multiple Monitors. This one has Aero Peek, and will let you have a start button on both taskbars. Shweet! It's not free, but it does what I wanted. I will be sending them money ASAP.

posted @ Tuesday, November 17, 2009 8:27 PM by Hector Sosa, Jr

Posted in: Utilities

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