Subversion for Visual Studio Users

by fwhagen Tue, 14 October 2008

VisualStudioLogo subversion_logo-200x173 There are a few articles online covering SVN and VS, but many are out of date and a bit more complicated than necessary with advances in both products.  For a current install (Oct 2008:  SVN 1.5.2 / VS2005), you only need 3 files:

Subversion is, of course, the Source Control server itself.  The MSI install contains everything needed to run on a Windows server.

TortoiseSVN is a plug-in for Explorer that gives a great deal of control to the source repository using the right-click context menu.  Check-ins, updates, merges, etc. can be done through this interface as well as full repository browsing and maintenance.

AnkhSVN is the most important tool for the .NET developer.  It integrates the controls needed for team development directly in the environment.  Much like the integration offered through VSS, but much better.

Installation of Subversion itself is very easy.  Just run the installer.  I installed into C:\SVN\ instead of the default "Program Files" directory, but I am lazy and hate spaces in filename on the command-line.
NOTE:  The installer only puts the files in place and sets the important environment variables.
Once installed, the following command is used to setup a repository:

svnadmin create "D:\SVN\Repository"
You can create as many repositories as needed, but one for now.  Before we activate the server, two config files need to be edited.  They were created with the repository above.  They are svnserve.conf and passwd in the conf sub-dir of the repository.  Uncomment the following:
~/conf/svnserve.conf
[general]
anon-access = read
auth-access = write
password-db = passwd

~/conf/passwd
[users]
harry = harryssecret
sally = sallyssecret

Now the installation can be tested. Execute the following command in a command window:

svnserve --daemon --root "D:\SVN\Repository"

To create a project, execute:

svn mkdir snv://localhost/newproject

Now would be a good time to install TortoiseSVN if it hasn't been yet.  Connect to the running server from within an explorer window by right-clicking and selecting TortoiseSVN > Repo-Browser.  Enter the name of the server to see the interface using the following URL:  svn://servername/  The project "newproject" should be viewable there.

And now the most difficult part of all:  Installing SVN as a service in windows.  The following command will accomplish this.  Syntax and proper spacing is critical.  (I was having problems until I realized the space after each '=' in the command.)  Here it is:

sc create SVN_CSTeam binpath= "c:\svn\bin\svnserve.exe --service --root D:\SVN\Repository" 
displayname= "Subversion Repository for CSharp.NET Team" depend= iisadmin

And that is why I do not use the default paths.  Spaces have to be delimited with quotes, which have to be escaped, and it just is not worth it.  All on one line of course.  Also note that the name after the "create" parameter can be anything desired and allows for multiple repositories on the same server, along with unique displayname.  I chose to use iisadmin as a depend, not because it necessarily is, but because it is sure to load other depends such as Tcpip and such.

The last step is to load AnkhSVN; a solution I leave to the reader.  It's not hard.  If you are familiar with source control at all, it is pretty obvious.


I'd like to thank the following sites for very useful information in helping me through the installation and the creating of this post:

Keywords: ,

Filed Under: .NET | Programming

Easy Image Tools (and FREE too!)

by fwhagen Thu, 08 May 2008

It amazes me in my travels how many people feel the NEED Photoshop for web development.  And, of course, they only use about 1% of its total capability.  It is true that years ago, it was the only game in town for Image creation and manipulation.  But not for a while now.  There are many free alternatives that suit the web developer much better.

Paint.NET My favorite for most tasks is Paint.NET.  It greatest feature is its price:  absolutely free!  It started life as a college project and was so successful, that it lives on as a great piece of Freeware development.  It is not Open Source, however.  Some of the other features include layering, filters, great image processing tools, alpha transparency, PNG, and many, many more.  All put together in a small, efficient package that is both easy to use and very powerful.  And hundreds of dollars less than Photoshop and lacking the disturbing Adobe trend toward spyware.  And as the name suggests, it is built on C#.NET, so I feel like I am supporting the community I am a part of.

GIMP If you need more, there is the GIMP project.  Much more complicated, far more powerful, still free, but not nearly as user friendly.  It resembles Photoshop in many ways, including the powerful plug-in model that PS uses.  I use GIMP 2.2 for things I cannot do in Paint.NET, which really isn't very often. 

You know, between the two, I don't at all miss the copy of PS I had at my last job.  Not at all.  Of course, I am not a graphic designer or a heavy Photographer either that needs the power of PS, but I haven't worked with many people who really were either.

One last note.  For those that have been heard to say, "[MS] Paint is good enough.":  Do yourself a favor and get Paint.NET.  MSPaint hasn't been good enough since the '90s.

Keywords: , ,

Filed Under: .NET | Programming | Work

Flash - Web Necessity or Overbearing Evil

by fwhagen Wed, 09 April 2008

Just why do I hate Flash requirements on sites so much?  I mean, every time I see a nice webpage marred by some Flash applet, I cringe and wonder why they decided to make that choice.

It used to be that requiring a user to have Flash installed just to visit your site was an inexcusable arrogance on your part as a web developer.  And then there was the bandwidth requirements for the content; after all, you are developing locally, so who cares that the end-user has to wait?  Well, you should, for starters.  And many times I see Flash, even still, being used as an easy way out or to simply animate a graphic. So historically, there were many, many reasons to never use Flash except for very specific applications.

Today, many of those arguments are not valid.  I believe all browsers have Flash preloaded, and bandwidth concerns are almost negligible anymore.  So why do I still find Flash to be a over-bloated gorilla on an otherwise clean design?  After all, I find the exclusion of PNG support on many browsers today to be inexcusable, but the inclusion of Flash a mere convenience.

Unfortunately, I don't have any clear answers.  To me, Flash doesn't belong on most websites I see today.  Yes, Flash does have it place in many online applications, but not as a graphic element.  And I believe that is the crux of the argument:  it is not a good replacement for some well designed image elements.  I am an old school developer that believes that good, solid, static design will always be superior to flashy, dynamic design in the long run.  Do not mistake that statement as a call to return to HTML as the primary development tool.  I refer to design; not content, which should always be dynamic, save of course for documentary content.  In my opinion, as a former CBT developer and current Intranet developer and BI Programmer, all design should be restricted to good use of CSS, PNG/GIF/JPG, and XHTML.  And there is also the fact that it is a closed standard.  Or actually, not a standard at all.  Flash is owned by Adobe, and is subject to their whims.  I just don't think that belongs in general web design from an end-user perspective, much the same way that I don't think it's right to use PDF as a publishing medium for web documents.

And don't even get me started on the crapware/bloatware/spyware that is a mark of Adobe products lately.  I flatly refuse to use Adobe's PDF reader anymore, but use Foxit Reader instead for any PDF files I might need to read.

Keywords: ,

Filed Under: Programming | Rant

Checking for Database NULL Values in C#

by fwhagen Tue, 09 October 2007

This really should have been more obvious to me, so why did I have to look it up?  If you need to check for NULL in a returned field from SQL (or any other datasource), you should the .Equals method on System.DBNull.Value.  I usually prefer the "==" notation for conditionals, but that's just me.  This is more efficient.  The code follows:

if (!dsSpecQuery.Tables[0].Rows[0]["device_type_end"].Equals(System.DBNull.Value)) 
{
    _EndDate = Convert.ToDateTime(dsSpecQuery.Tables[0].Rows[0]["device_type_end"]);
}

Of course, dsSpecQuery is a DataSet, and the field in question is DateTime out of SQLServer (not that it matters for the conditional).

Keywords: , ,

Filed Under: .NET | Programming | SQL

Proper ASP.NET Database Calls

by fwhagen Mon, 20 August 2007

Last week, I posted an entry about a simple call to an MS-SQL database with a warning that it should only ever be used in a quick and dirty scenario.  By that I mean when it doesn't make sense to integrate or create a Data Access Layer or class to do the heavy lifting for you.

The advantages of creating classes to do the data calls behind the scenes are many, not the least of which is easier development in the long run.  Take a look at the following code:

    Query qEmplQuery = new Query(); 
    qEmplQuery.ConnectionSettings = ConfigurationManager.ConnectionStrings["EmployeeDB"]; 
    qEmplQuery.StoredProcedure = "DW.PKG_HRPORTAL.PRC_EmployeeInfo"; 
    qEmplQuery.AddParameter("P_EmployeeNumber", szEmplNum); 
    qEmplQuery.MinutesCached = 12 * 60; 
    DataSet dsEmplQuery = qEmplQuery.RetrieveDataSet("P_EmployeeInfo");

Much easier than even the "simple" call I posted earlier, isn't it.  The beauty of this is that it is also an Oracle call (database agnostic:  the same call for Oracle or MS-SQL makes for easier and standardized development) and is cached for 12 hours.  We also have a coding standard that only parameterized Stored Procedures are used for any kind of data access. 

But the most important advantage is that the Query class contains all of the complex coding needed to make this as efficient and "correct" as you know how and never have to think about it again.  This is basic abstraction and Object Oriented Programming fundamentals.  I have used Enterprise Library factories for my calls in Query because of the desire for its good caching and efficient data and network layer calls, but you can use whatever you want. 

In my next series of posts, I will present details of the Query class in order to help build your own.

Keywords: , ,

Filed Under: .NET | DataBase | Programming

Simple ASP.NET Database Query

by fwhagen Wed, 08 August 2007

Below is the most simple database query for C# to populate a GridView object:

int nItemID = 1; try { using (SqlConnection oSQLConn =
new SqlConnection(ConfigurationManager.ConnectionStrings["UserInfo"].ConnectionString)) { oSQLConn.Open(); using (SqlCommand oSQLCmd = new SqlCommand()) { oSQLCmd.Connection = oSQLConn; oSQLCmd.CommandText = "SELECT DisplayName, EMail FROM Users WHERE UserID = @PARAM_ItemID"; oSQLCmd.Parameters.AddWithValue("@PARAM_ItemID", nItemID); SqlDataReader oSQLReader = oSQLCmd.ExecuteReader(); GridView1.DataSource = oSQLReader; GridView1.DataBind(); } } } catch (Exception ex) { Label_ErrorMsg.Text = ex.Message; }

There are actually many reasons to never use this, including performance, caching, safe SQL, code reuse, standards, proper exception handling, etc, etc.  But sometimes you need a quick and dirty, non-production, piece of code for testing and/or development.  This is it.

Keywords: , ,

Filed Under: .NET | Programming | SQL

WebComic RSS Feeds

by fwhagen Wed, 08 August 2007

Almost everything I read regularly online now is through an RSS feed.  The few things I don't get through RSS are either not suited to RSS or don't come in a feed, but are too important to me to skip.  I use SharpReader to collect and browse all of these feeds.  It is not a perfect reader but does what I want it to do better than anything else I can find (for free).

I have always enjoyed comic strips and much prefer them on the web than any other format.  I have been reading Dilbert online since the old days when Scott Adams posted them himself on Usenet.  But not all comics online are available in an RSS feed.  And none of them were a few years ago (before RSS, of course).  I have tried over the years to script or code different ways of collecting strips with some success, into webpages or browsable collections, but something was always lacking.

Today I use a app I created to collect the img tags from the hosted sites and put them into RSS feeds for each strip.  It works for me.  The only problem is the RSS library for .NET that I used doesn't clear the old entries correctly, so the XML file get big over time.  Not huge, just big.  Now I can load my feed into SharpReader and have all of the feed-y goodness such as tracking which entries I've read, notification of new ones, and locking or saving the ones I want to save.  I have about a dozen strips now, including the fabulous XKCD all RSSed up.  If you'd like to use some, let me know and I will email you the link.  I will not post it here as I don't want them abused. 

Oh, the other problem:  I'm always looking for more webcomics.  Most that I like I just stumbled on, so I always take recommendations.  And yes, I will feed up a strip, even if I don't like it, for someone else.  Just the way I am, service-oriented.

Update [10 Aug 2007]:  Ha ha!  When I went to XKCD.com today, I noticed that he's put up an ATOM feed himself.  So I can remove that one from my collection list. 

Keywords:

Filed Under: Programming

Lack of Programming Posts

by fwhagen Sat, 04 August 2007
I really haven't posted many code-related posts lately.  There are a few reasons for that:  Primarily, I have been working on SharePoint 2007 branding.  Sheesh!  Once I figure out the guts of that, I will post what I learned.  I have also been maintaining VB.NET code, which I am not at all interested in posting about.  The goal here is to post useful or interesting information for myself and others.  What I have been doing in VB.NET 1.1 is neither.  And I have been taking a business C++ class for my major, and boy it's close to worthless.  So a bit of a code break.

Keywords: ,

Filed Under: Blog | Programming

Developer Chic

by fwhagen Fri, 20 July 2007

A colleague and I were discussing desktop systems, and agreed in confusion about the seemingly typical cost-cutting measure of giving developers underpowered systems to work on.  This got me thinking:

First of all, with todays prices, how expensive would it be to really outfit a developer with a truely powerful rig?  You don't need tons of storage or a fancy 3D gaming card or high-end sound (unless, of course, that is your line of business) so you should be able to get a really powerful machine for under $2000.  It shouldn't be hard to do an ROI for that, just in productivity gains.

Second, it would make your true developers, the propeller-heads that love this stuff, very happy.  That is also a great productivity gain.  After all, a happy coder is a working coder, not one that is standing around bitching.

Finally, I always felt it a truism that it is worse to have a better system at home for development than at work.  This is more an intangible.  After all, you can't constantly be polling people about their personal systems; not to mention, most of us have more than one.  I have 4 functioning and a few not.  I personally will feel more compelled to work on the better system; for management's sake it ought to be on my desk at work.  

So, you management types:  we developers love the hardware, we want to play with it, we want to use it, we want to possess it.  It's a cheap win to give us toys to play with.  We will want to exercise them.  It's in your best interest.

Keywords: ,

Filed Under: Programming | Work

Interviewing Programmers

by fwhagen Fri, 01 June 2007

I have hired a few people in my time.  Not many, and I'm not an expert, but I have learned a few things.  In my experience, the best programmers exhibit obvious enthusiasm in 3 specific areas. 

The first is their hardware.  Truly great programmers take great pride in their setup, although not in the same ways.  If you can get the gleam in the eye when off-handedly talking about the latest CPU, the home network, or custom case, or skinned interface, you have found proof that they really are into what they do.  For me, it's my computer.  I have never bought a computer.  My dad purchased my first PC in 1991, and I have upgraded it ever since.  My x386 is now a P4 and soon to be a Core2Duo.  Of course, I love my home network I've been fiddling with since 1998 and I can't use a stock XP installation for more than a few minutes before I have it all modified up.

The second area I borrow from Jeff Atwood of Coding Horror.  Yes, again.  The interviewee should have a favorite piece of code that they have created.  Not usually an entire application, but a class, algorithm or routine that they are especially pleased with.  Don't blame them if they can't put their finger on a single one, I have a hard time there too.  Either my frequent implementations of Linked Lists, the automated Secure File transfer / Content Management solution, auto-validation in C# from custom attribute assignment, or my comic strip collector... It's especially important to me that they have some personal code they love too, not just professional.

The last area I think is important is probably the most controversial:  gaming.  Find out what kind of games they play, it may say a great deal about the kind of coder they are.  FPS gamers tend to be very direct, task oriented, focused coders.  RTS guys are more big picture, and turn-based strategy players even more so and very methodical.  If you find a Civ Addict, hire him now!  MMO gamers are probably good at maintenance or grind programming.  And the ones that love them all will not be exceptional in any one area, but will be very versatile.  That's where I lean, though I LOVE Civ; so much so that I can't leave it on my PC for long before it becomes a problem.

These generalizations are just that.  Not to be taken too seriously, but they have never let me down.  I have found that I cannot even consider someone who doesn't exibit much in any of the categories, or prefers XBox gaming, or doesn't own a PC (!). 

There are always exception, these are just my observations.

Keywords: ,

Filed Under: Programming | Work

TextBox

RecentPosts