Wednesday, December 14, 2011

CDs and DVDs - Why???

As far as the CD and DVD technology, I've felt like I've been in a twilight zone episode for the past 5 years!

Let's face it, CDs were a breakthrough technology in the 80s, brought great features and portability over the existing tape players.  Later DVDs brought more storage and functionality, but I can't understand why this media is still being used commercially today.

Netflix tried to buck the trend and tried to push streaming versus physical DVD rental and the stock plunged, the masses rebuffed. (in this case the business model and content availability were to blame)

I have two little boys that rent DVDs from the library to see the latest Sesame Street video, it is rarely playable since a few tiny scratches render the medium unplayable.  Bring back the 3 1/2 floppy! :)

Solid State sticks are great, but I guess the cost per use ratio isn't as viable as the cheaply produced DVDs...

Any alternatives on the horizon so I can go on in peace?

Friday, November 4, 2011

Beginning a S#arp architecture ASP MVC 3 solution

I've used a lot of blogs in order to piecemeal together a S#arp architecture solution and here are the steps involved.

Why use S#arp architecture?  Well, you could try various architectures, I am currently working a Unity/nHibernate/Fluid NHibernate solution, but it takes so long to set up, whereas S#arp is first of all a great setup, but also very simple to install and setup the project.

1. Download and install T4 Templater (choose Typical install) http://www.codeplex.com/t4toolbox
The templater allows you to have VS templates such as S#arp.

2. Get Templify. It's a great tool to deploy your S#arp architecture solution, it even comes with the S#arp template ready to go.

3. This step is optional.  You can a Visual Studio template editor for more pizzazz.

4. To insure you have the latest S#arp template, might as well install the latest Templify template from here:  http://www.sharparchitecture.net/downloads.htm

5. Using Windows Explorer, create a folder where you want your new MVC project to go.  Right click on the folder and select "Templify Here".  You will be shown the following screen and it will guide you to create your project.  Be patient as it sets it up...



Compile and run your project.  You may have to specify an NHibernate DB login to proceed.  You now have the template compiled and running!  You should see the following and be ready to start coding:

Wednesday, August 10, 2011

Ignoring certain file types on SVN commit

I've been using SVN as my main source control and was annoyed that on every commit I had to uncheck a few files that were created locally and shouldn't be part of the repository.

Files like roo.log and a bunch of *.externalToolBuilder files. How to exclude those every time from the check in process?

Fortunately you can exclude certain file types when you are commiting.

First, you can check what is currently being omitted by typing:

svn propget svn:ignore

You will probably see .project, .setting, etc. svn does exclude some by default, but now type:

svn propedit svn:ignore .

If it complains about not having an editor, simply create an environmental variable to store the following:

SVN_EDITOR=notepad

Now type the propedit command and add whatever additional filters you want!



Sunday, July 31, 2011

Custom Event Logger for .Net 3.5 and .Net 4.0

I needed to write a .Net 3.5 Event logger for a custom lib I am coding for a client. After scouring the internet, there were a lot of antiquated code samples. I even found a lot of modern samples on MSDN, but was surprised to see very poor code (having a .close() not within a using() or finally())

I decided to write a custom Event logger class with the following simple functionality, since the primary use was to report events or errors.
  • Have a write() event that would log a custom error to the event log (found in the System logs)
  • Would write to a text file in the event the Event did not get logged. I found this step necessary since the calling program may not have Event log access due to security.

Here is the Class:

class CustomEventLog
    {
        const string sourceName = "Your custom event name here";
        const string logType = "System";
        const string customTextLog = "c:\\CustomEventLog.log";

        public static void Write(string message, EventLogEntryType type)
        {
            try
            {
                //See if the source exists. 
                if (!(EventLog.SourceExists(sourceName, System.Environment.MachineName)))
                {
                    System.Diagnostics.EventLog.CreateEventSource(new EventSourceCreationData(sourceName, logType));
                }

                using (EventLog ev = new EventLog(logType, System.Environment.MachineName, sourceName))
                {
                    ev.WriteEntry(message, type, 10001);
                    Console.WriteLine(message);
                    ev.Close();
                }
            }
            catch (Exception ex)
            {
                // If all else fails write to disk
                using (StreamWriter sw = new StreamWriter(customTextLog, true))
                {
                    sw.WriteLine(ex.ToString());
                    if (message != null)
                    {
                        sw.WriteLine(message);
                    }
                    sw.Close();
                }
            }
        }
    }

Here is also sample usage:

CustomEventLog.Write("This is an informational comment.", EventLogEntryType.Information);

Friday, July 15, 2011

Setting up correct Git config parameters on Windows

So when configuring Git to run on Windows, I ran into an annoying thing that took me a bit to figure out.

When you configure Git via bash, specifying the config setting with git config --global yadayadayada was not properly linking to the editors, diff tools, etc. The reason was that the config file could not determine the location of the apps because quotes were either missing, or added to the config file without escape characters.

Here is the .gitconfig file:
[user]
 name = mkadlec
 email = kadlecmark@hotmail.com
[core]
 editor = \"C:/Program Files (x86)/Git/bin/git-core-editor.sh\"
 autocrlf = false
[merge]
 tool = kdiff3
[diff]
 tool = kdiff3
 guitool = kdiff3
[mergetool "kdiff3"]
 keepBackup = false
 trustExitCode = false
 path = \"c:/Program Files (x86)/KDiff3/kdiff3.exe\"
[difftool "kdiff3"]
 path = \"c:/Program Files (x86)/KDiff3/kdiff3.exe\"
 keepBackup = false
 trustExitCode = false
 cmd = \"c:/Program Files (x86)/KDiff3/kdiff3.exe\" \"$LOCAL\" \"$REMOTE\"
See? Look closely, you have to escape all the quotations, and wrap any file locations with quotes if they are not. Once configured, all is good!

Monday, May 2, 2011

Modify TFS for Agile development

TFS is a great tool for Agile development, especially if you are already using it to develop your code!  There are some very good templates out there already.  Scrum for Team System is my favourite, and Microsoft now has their own: Scrum 1.0.  You can modify any of these templates to add fields, change statuses, and modify the flow.

If you are running Visual Studio 2010, here's the quick and dirty on how to modify the templates:
1.  Open Visual Studio Command Console, then go to
     C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE>

2.  Run Command to Export the xml
  witadmin exportwitd /collection:http://tfs_server_name:8080/tfs/collection_name /p:"project_name" /f:"output_xml_file" /n:"Task"​

  This will generate output.xml in the same location.  


  Eg: >witadmin exportwitd /collection:http://vprdtfs2010:8080/tfs/quorumdevprojects /p:"er57q1" /f:"output.xml" /n:"Task"​
  If you want to export the User Story template, simply use "UserStory" instead of "Task".



3. Change the file as necessary.  Remember, the output is simply an XML representation of the template and it is pretty intuitive when you open it up and start digging.  Add states, fields, transitions, etc.



4.  Run Command to Import the xml

  witadmin importwitd /collection:http://tfs_server_name:8080/tfs/collection_name /p:"project_name" /f:"input_xml_file"​


Eg: >witadmin importwitd /collection:http://vprdtfs2010:8080/tfs/quorumdevprojects /p:"er57q1" /f:"output.xml"​

Qwinsta, better than a rap name

If I were to have a 3rd kid I think I would be inclined to name him Qwinsta...

One of the most underrated, secret, powerful commands out there, if you want to see who is logged on to a Server, simply type:

           qwinsta /server:[your server name here]

At the command prompt and voila, all users are listed. Pair that with a Powershell script and you are like Capt. Kirk sitting in his command chair.


I use it a lot to see who is logged in to a Server in case the max connections are exceeded.

Thursday, March 31, 2011

Qdoba versus Chipotle

Ever wonder which restaurant serves the better burrito, Qdoba or Chipotle?

I wondered the same thing for years, when a co-worker of mine though we should apply scientific theory to this important question.  So we did...

The Test: Order the same burrito from each restaurant (with medium sauce, black beans).  One person cuts the burritos in half, sticks a toothpick in the one they know the brand, then the other person will choose to either switch the toothpicks or not (while the other person is not looking).  This ensures that neither person know which is which until it is revealed at the end.

One person remarked prior to the test that Chipotle is better in some meats than others, so we decided to do the test for all meats.

Here are the results:

CHICKEN WINNER: Chipotle 2 - 0
MarkChipotle
JamieChipotle

PORK WINNER: Qdoba 3 - 1
MarkQdoba
JamieChipotle
PadamQdoba
RianQdoba

STEAK WINNER: Chipotle 2 - 0
MarkChipotle
JamieChipotle

SHREDDED BEEF WINNER: Chipotle 2 - 0
MarkChipotle
JamieChipotle

It's over, Chipotle with the overall victory 3-1! It's worth a trip to Qdoba though if you are in the mood for pork (or craving their Queso sauce), otherwise, Chipotle is the place to go.   Also to note, the burritos were priced within 5% of each other, so cost was not a factor in this comparison.