It Is Known Series

25. May 2011

I mostly use my website blog as a reference more then anything else. I’m still learning and new to blogging and I feel I still have a long way to go. It’s tough for me to find good new content to blog about. So in a new twist I think I’m going to start a string of series that explain intermediate and advanced topics about C# and other various technologies that I use in my career.

I hope that I can provide myself and others with some good blogging. Here is a rough estimate of the series I have planned for subsequent blogs. Interlaced with anything I feel might be important to blog about in-between.

IIK Series I

  • Software Construction
  • Object Orientated Programming
  • Events
  • C# Flow Control Suggestions
  • Exceptions oh my!
  • With and Without Generics
  • Multithreading and Thread Synchronization
  • Assemblies and Versioning
  • Algorthims
  • CLR

 

IIK Series II

  • Intro to WCF
  • Advanced WCF
  • WCF RESTful Services Project
  • WCF and Azure
  • WCF Best Practices

 

IIK Series III

  • Windows 7 Mobile Development Adventures (Coming soon..)

 

Architecture, Azure, C# Development, TechArticle

Wcf Tracing

11. November 2010

I was having some issues with Wcf in my input message being SOAP 12 and my Wcf Service accepting SOAP 11, so after I created my custom binding using HttpsTransport. I was still getting a few problems and decided to enable tracing by adding this code to my web.config.

<system.diagnostics>
    <trace autoflush="true" />
    <sources>
      <source name="System.ServiceModel"
              switchValue="Information, ActivityTracing"
              propagateActivity="true">
        <listeners>
          <add name="traceListener"
              type="System.Diagnostics.XmlWriterTraceListener"
              initializeData= "c:\logs\Traces.svclog" />
        </listeners>
      </source>
    </sources>
  </system.diagnostics>
 

Then I just browse to my .svclog open it up and I an view it in the MS Trace Viewer. Pretty easy, thanks Microsoft.

TechArticle

Using SQLCMD to execute multiple SQL Scripts in folder

9. November 2010

Thanks to Dave Jones for teaching me this who learned this from Sean Heaton. Maybe they will have blogs one day.


 

My company utilizes a midnight installer process that rebuilds a database every night for a {QA, Prod} environment. But sometimes we the developers need to rebuild our databases from these scripts. Previously I would open up the query window. Assemble all the scripts from each file into one file. Copy and paste all the sql scripts details into the query window and execute. Bleh, slow and I hated it. But now if I need to execute a bunch of sql scripts I can do so in a batch file.


 

  1. First I want to open up a “run as” admin command prompt.
  2. Start –> “Search Program and Files”, type in “cmd” this should auto focus on cmd.exe found.

    cmdFind
  3. Then hit “ctrl” + “shift” + “enter” and it will open up a command prompt in administration mode. You can tell because the command prompt will say “Administrator.

    admincmdprompt
  4. Normally I just opened up sql query and copy and pasted the single scripts that run the create database and constraints/foreign key scripts. But now I need to add all the stored procedures. In our company we keep a static database of that product with all of our stored procedures to keep them all in once location. With one table “About” for versioning the set of stored procedures/functions etc. So I will browse to my current TFS workspace location.  In my case: “cd C:\srs_source\Team\Product\Main\Databases\ProductCode\Database\Programmability\Stored Procedures”.
  5. Now I use the command line “dir /b > myFile.cmd” (dir /b list directory with the format I want) and the greater than sign “>” (writes the command output to a file, instead of the command prompt window). http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/redirection.mspx?mfr=true
  6. Open up “myFile.cmd” in Notepad or I use Notepad++
  7. Remove the “myFile.cmd” from the list
  8. Place cursor on first line and hit “ctrl” + “h” for Replace window prompt.
  9. In Find what type: “\r\n
  10. In Replace with: type: “\r\nsqlcmd –E –n –i” (Update) I now use something like “\r\nsqlcmd -d <databaseName> –E –i” i.e. “\r\nsqlcmd -d Mpi_Data –E –i
  11.   Hit the button “Replace All
  12.   This will replace everything but the first line. At the bottom you will have a empty command “sqlcmd –E –n –I”  just copy this to the first line and you are set to run your batch command.

    sqlReplaceAll
  13.   We are always certain all our sql scripts have the “USE [ProductCode]” for each of our “CREATE PROCEDURES”at the top of each .sql so from this point we can just run it on the command line “myFile.cmd” and it will add these stored procedures to the correct database.

TechArticle

Add existing folder into Visual Studio (The easy way)

5. March 2010

Ack!

Have you ever selected your folder and said "Exclude from Project" and then if you wanted to add that folder back into your solution, you couldn't. Using "Add existing item" would show you the file dialog and when you select your folder it drills down into that folder. GRR!.

 

 

Well there is a better way: 

In your solution explorer window if you select the icon "Show all Files" 

and then "Right click" your hidden folder and select "Include in Project"

Be certain the folder is in the correct file location within your folder structure to see it.

TechArticle

Hello World

20. June 2009

Hi!,

I really like developing software. A close friend of mine created a technical blog and I followed suit. Our justification for such is to retain the little bit of knowledge we gleam over the years and write about them. Either by giving back to the community or writing something we could reference ourselves as a center for knowledge. A very very long time ago, I dabbled in BASIC. I used to read the "choose your own adventure" book and then I played a game on my dad's computer named Zork. I wanted to create my own adventures and did so. It was pretty easy to use goto statements all over my code, it was pretty fun too. 

When I learned BASIC could do color, I more or less quit that project. I would have rather played my NES then deal with the math. Give me a break, I think I was eleven or twelve at the time. 

In high school I took a PASCAL class or maybe it was Turbo Pascal. I can't remember. When I graduated High School I joined the military as a grunt, so not much need for programming in that world. I came home in 2000 and was a Project Manager at Apple and it was there that I decided that I wanted my career to be in programming. 

I retrained and left the world of Job.Talk = Project Manager to be Programmer. I left the University of Utah to a much faster paced private college named Neumont and I don't regret my decision. Although it was very expensive, I graduated a few years earlier then I would have and I've done exceptionally well for myself and my family. 

Even when you are finished with school there are so many things that continue to keep my interest in the programming world. Every day you pretty much learn something you never knew before. That's what I'm making this blog about. Everything I've learned and more. 

So how did you get into software development? If I write a article you like or don't like, take the time to tell me what you think. I would like to write good quality articles that are helpful to the entry level programmer to the principle ones. 

Thanks for reading. 

 

TechArticle