I'm a nerd and proud of it!
Avatar

Alan Barber

Vcard Download vCard   what is this?
Rss_icon

Recent Activity


Filter by:
All
  • C# Mutex for running single instance of a program

    Here is some sample code that can be used in a c# application to make sure that only one instance of the program can run at a time.  In order to do this you will use a Mutex (Mutual Exclusion) which is a type of system wide lock. In laymens terms a Mutex is like a claim to ownership of a idea. You’re telling the world that no one else can have that idea as long as you are holding claim to it. As so as you don’t need it you can let go of the ownership and then someone else can claim ownership.

    Sample Code:


    class OneAtATimePlease {
    // Use a name unique to the application (eg include your company URL)
    static Mutex mutex = new Mutex (false, "oreilly.com OneAtATimeDemo");

    static void Main() {
    // Wait 5 seconds if contended – in case another instance
    // of the program is in the process of shutting down.
    if (!mutex.WaitOne (TimeSpan.FromSeconds (5), false)) {
    Console.WriteLine ("Another instance of the app is running. Bye!");
    return;
    }
          try {
    Console.WriteLine ("Running - press Enter to exit");
    Console.ReadLine();
    }
    finally {
    mutex.ReleaseMutex();
    }
      }
    }


    A good feature of Mutex is that if the application terminates without ReleaseMutex first being called, the CLR will release the Mutex automatically.

    As you can see it’s pretty simple code. You create a Mutex object. However, until you call the WaitOne function you do not actually make your claim to ownership of the mutex. So remember to do that!

    * Disclaimer: This code and content are taken from multithreading in C# by Joseph Albahari. I do not claim any ownership or rights to this content. I am merely copying for my own future reference and to share the knowledge.

    3 months on
    AlanBarber.Org
  • Ann Arbor Day of .Net 2010 Registration Open

    The Ann Arbor Day of .Net 2010 registration is now open.

    There will be a small nominal fee of $10.00 this year to help cover expenses. Lets be honest her folks, for the great amount of information you be getting and the amazing opportunities to network with other professionals it’s worth the small fee.

    It will be held Saturday, May 1st, 2010 in Ann Arbor, MI at Washtenaw Community College again.

    Hurry up and go get registered before it’s too late!

    5 months on
    AlanBarber.Org
  • Setting PreLogin Banner on SSH Server

    If you are running your own server I’m sure you’ve thought about setting your own login banner for SSH connections. This can be handy to post any important information such as service notices or a legal warning before a user logs in. You can see a sample login banner below in this screen shot.

    SSH PreLogin Banner

    This is extremely easy to setup

    Step 1: Login in as root and navigate to “/etc/ssh”.

    Step 2: create a file named “sshd-banner” using your editor of choice.

    Step 3: create your banner content and save the file.

    Step 4: open “sshd_config” for editing.

    Step 5: Add the following line to your config file “Banner /etc/ssh/sshd-banner” and save.

    Step 6: Restart the sshd server. On a linux server this would be “/etc/init.d/sshd restart”

    Feel free to log back into your server to test.

    5 months on
    AlanBarber.Org
  • Kalamazoo X Conference Registration & Announcement

    Mark your calendar folks Kalamazoo X has been announced for April 10th, 2010 and registration is now open at http://KalamazooX.eventbrite.com

    What is the X Conference?

    The Kalamazoo X Conference is a one-day software development conference hosted in beautiful Southwest Michigan. While there are many great technical conferences in the region, their focus tends toward new technologies and programming languages. The Kalamazoo X Conference intends to uniquely complement those conferences by enabling attendees to boost their process, design, and communication skills in the following areas:

    •Human interaction, including social, personal, and career development.
    •Interface and graphic design
    •Development processes and best practices
    •Requirements analysis, architecture, design, and modeling

    I attended this event last year and it was great. It’s run as a single track rapid fire series of talks that focuses on the so called “soft skills”, all that non-technical junk you need to know to do your job!

    Please check it out and attend if you can. It will be well worth it.

    5 months on
    AlanBarber.Org
  • Cleveland GiveCamp 2010

    The Cleveland GiveCamp 2010 has been announced and is currently looking for charities and volunteers!

    About GiveCamp

    GiveCamp is a weekend-long event where software developers, designers, and database administrators donate their time to create custom software for non-profit organizations. This custom software could be a new website for the nonprofit organization, a small data-collection application to keep track of members, or a application for the Red Cross that automatically emails a blood donor three months after they’ve donated blood to remind them that they are now eligible to donate again. The only limitation is that the project should be scoped to be able to be completed in a weekend.

    The Cleveland event will be held July 16th - 18th, 2010 at LeanDog located at 1151 North Marginal Road Cleveland, OH 44114.

    So please check out the Cleveland GiveCamp 2010 and sign up to help if you can!

    6 months on
    AlanBarber.Org
  • Pragmatic Thinking and Learning

    Pragmatic Thinking and Learning by Andy Hunt

    Pragmatic Thinking and Learning by Andy Hunt

    This is another book from Andy Hunt and the Pragmatic series. I can’t emphasize enough how great these books are.

    Where as in Pragmatic Programming they discussed patterns and practices to improve your developer skills this book takes a step back and is looks at how your brain works. It’s a very interesting concept and one I suggest developers think more about.

    The book as the title implies covered two areas:

    The first part goes over the thought process and after reading this book I gained so much insight into how my brain is wired. Andy does a great job of explain how a brain processes thoughts and stores memories in terms of metaphors of computers and technology.

    The second part covered the many techniques for learning and helps walk you though examples of the pros and cons of each method. Again this was very insightful as I have never really thought much about how I learn and what processes are best for me.

    Thanks to this book I now have a few different options for learning that I plan to try to find the one that works best for me to retain and use knowledge.

    Go pick up a copy and sit down. It was such a fascinating book and I ended up reading it from cover to cover in only a few days. Once you get into it, if you are anything like me you will be so enthralled you won’t be able to put it down.

    6 months on
    AlanBarber.Org
  • Backing Up Windows Shares & Settings

    If you ever have a need to save a windows servers file shares & settings here’s how to do that. This is handy if you happen to be transitioning to a new file server and you have a lot of shares that need to be transferred. You could always do it by hand but this way will save you a lot of time!

    Open up your registry on the server and navigate to:

    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Shares]

    Right click on the Shares folder and choose export

    You will now have a .reg file that you can copy and install on the new server and have all the file shares and security settings ready to go.

    One note to remember is this only works if you setup the file shares identically on the new server. You have to keep the drive letters and folders matching the old server.

    6 months on
    AlanBarber.Org
  • The Pragmatic Programmer: From Journeyman to Master

    The Pragmatic Programmer: From Journeyman to Master by Andrew Hunt, David Thomas

    The Pragmatic Programmer: From Journeyman to Master by Andrew Hunt, David Thomas

    This is one of my new top developer books. Far be it for me to tell you want to read or not read but I feel this is a must read requirment for any developer.

    The topics that are covered range from dealing with “code rot”, software that is outdated and breaking, to the importance of testing.

    The beauty of this book is that it isn’t your standard technology book. You won’t read this and learn a new language, framework or tool. In the book they cover so many important topics that are about being a better developer in general. Many of these issues are ones that people never think about yet if they did could improve the quality of their software and the happiness of their clients.

    I plan to share this book with all my coworkers and I hope once you read it you will do the same.

    6 months on
    AlanBarber.Org
  • The Enterprise and Scrum

    The Enterprise and Scrum by Ken Schwaber

    The Enterprise and Scrum by Ken Schwaber

    On of my coworkers won this as a prize at the IndyTechFest. We were all very intrigued by the Kanban talk that was given there and so I wanted to learn more about using lean development techniques in business. I found that this book helped me understand more about scrum and how it can improve my development capabilities.

    It’s a pretty quick read that you can do in a few nights at home but well worth it to learn more about lean.

    6 months on
    AlanBarber.Org
  • Inside Microsoft SQL Server 2005: The Storage Engine

    Inside Microsoft SQL Server 2005: The Storage Engine by Kalen Delaney

    Inside Microsoft SQL Server 2005: The Storage Engine by Kalen Delaney

    I read this book to gain some deep knowledge about how SQL Server 2005 works on the inside. My goal was to better understand how to install, configure and manage a SQL Server 2005 database. I learned a lot about tables and indexes and log files and how all if it works together and can be tweaked for better performance.

    This is a must read for anyone that spends a lot of their day working with SQL Server 2005!

    6 months on
    AlanBarber.Org
  • The 2010 Heartland District Technology Conference Schedule

    Yet another technology conference season is upon us!

    There a many great events being planned and some are already announced.

    Here is a short list of events and links to their websites. Save this link, as I hear of new events I’ll make sure to update this blog post to add them.  Just a reminder that most of these events are in the “Heartland District” as defined by Microsoft which includes Michigan, Ohio, Kentucky and Tennessee. Don’t mistake me, this isn’t just a list of Microsoft events. Any technology event in the area that I hear about I will list. If you know of any drop me a line and I’ll get it added!

    February 2010

    NO EVENTS

    March 2010

    Lansing Give Camp - Lansing, MI - March 26th - 28th, 2010 (Free)

    April 2010

    NO EVENTS

    May 2010

    IndyTechFest - Indianapolis, IN - May 22nd, 2010 (Free)

    June 2010

    CodeStock - Knoxville, TN - June 25th - 26th, 2010 ($25.00)

    July 2010

    NO EVENTS

    August 2010

    DevLink - Nashville, TN - August 5th - 7th, 2010 ($100.00)

    September 2010

    NO EVENTS

    October 2010

    NO EVENTS

    November 2010

    NO EVENTS

    I can’t stress enough how much fun these events are. Not only can you learn a lot of things but you get a chance to hang out and socialize with some of the top developers in the area. I encourage all developers to try to attend at least one local event. You will not regret it!

    7 months on
    AlanBarber.Org
Next page