Tuesday, April 26, 2005

Subversion is a nice open-source replacement for CVS which is the grand daddy of open source version control.  Subversion fixes some of CVS's problems and is a very nice package for the price (free).  I have stopped using Visual Source Safe in favor of Subversion and I believe that Subversion also beats ClearCase in ease of use and maintainability.
 

I have created a quick tutorial for getting SVN up and running.  This should not be a substitute for reading the manual.

SVN New Repository Setup

 1.  Download and install SVN and Tortoise SVN.  Currently at http://subversion.tigris.org/ and http://tortoisesvn.tigris.org/ respectively.

 2.  Decide on a repository layout.

            I prefer this layout format:

                        /
                        /project
                                    
/trunk
                                     /branches
                                     /tags

This layout allows us to have multiple projects in the repository organized by project which is the most convenient organization method by my way of thinking but you may come up with your own as Subversion does not force you to use a certain layout.  A layout can also be changed at a later date unlike CVS.

 3.  Once you have a layout it's time to create a repository.

            a.  Open a command line

            b.  run this command:  C:\>svnadmin create --fs-type fsfs c:\svn

This creates a new repository at c:\svn.  It is in FSFS format as opposed to the default Berkely Database format. 

The FSFS format appears to be a much better choice in almost all situations but you can consult the documentation for more info.

 c. There will be many files and directories inside the repository but you will not and should not edit these directly.

 
4.  Now that we have a repository let's implement that layout format we decided on in step 2.

The easiest way to create a file format is to create a temp directory and set up the structure in that temp directory and then import that into the repository.

         a.  In windows open a command prompt and do the following:

                        (this can be done in windows explorer also)

            C:\>mkdir tmpdir

            C:\>cd tmpdir

            C:\tmpdir>mkdir yourproject

            C:\tmpdir>mkdir yourproject\trunk

            C:\tmpdir>mkdir yourproject\branches

            C:\tmpdir>mkdir yourproject\tags

           
         b.  Now import this structure into our repository:

            C:\tmpdir>svn import . file:///c:/svn --message "initial repository layout"

           (Pay attention to the forward slashes as they are important, svn is not as forgiving as Windows in the forward/back slash department)      

           
         c. Now we can view our repository structure:

C:\>svn list --verbose file:///c:/svn/yourproject

 
5.  Now we will either begin work on a new project or check in an existing project.

 a.  If we have an existing project we can import it using this command: 

            C:\>svn import  c:\pathtoprojectfile file:///c:/svn/yourproject/trunk -m "initial import"

The syntax of the command is svn import pathofprojecttoimport urltorepository -m "message to label this version with"

Notice that we are importing our project into the trunk folder.  This trunk folder is our main line of development. 

 
6.  We want to export a working copy of our project so that we can begin to work on it.

                       Here is the command:

                       C:\>svn checkout urltorepository pathtoworkingproject

                       Notice that this is the opposite of import command. 

This is a good place to mention that when you have an existing project you want to add to source control you should probably move your original source to another directory then clean out all the unnecessary files, binaries or otherwise, that should not be added to source control, this is anything that can be built or generated.  Once you have cleaned up your files and import the project, you will want to choose the place where you want to work with the project, which might be the same place you imported it from in the first place, so you may want to make a backup of your current working directory because you will need to do a checkout into an empty directory.  Once you have completed the checkout into the empty working directory you can add back any libraries or other binaries (dll's, pictures, etc) that you did not originally add to source control. 

Binaries of any type that will not be changing but need to be saved should probably be archived in some manner, you may choose to add it to your version control system for convenience or simply store these in another directory that will be backed up but not version controlled. 

7.  Now that we've made our changes we need to commit these changes to the repository.

            change path to the directory of your working project

            C:\>cd \pathtoworkingproject

            C:\>svn commit -m "checkin comments"

This completes our command line walk though of SVN.  If you are not a fan of the command line all of this can be done using TortoiseSVN.  I will cover this in another tutorial.

Tuesday, April 26, 2005 4:35:15 PM (Central Standard Time, UTC-06:00)  #    Comments [0]

The Log4j project has become the de facto logging standard in the java community.  Even with the introduction of built in logging in J2SE 1.4, Log4j still remains the premiere logging framework for java.  The built in library java.util.logging provides convenience but lacks the features of the more mature Log4j.  However, not including the extra appenders and formatting that Log4j offers the function of the two libraries are very similar.  In my opinion you are much better off using the Log4j framework from the start and sticking with it.  The extra functionality has been worth it, at least in my experience.

Another advantage of Log4j is that there are versions of Log4X available for almost every major language.  I also use Log4net for my C# development and it is very nice to be able to switch languages but maintain a very familiar framework.  Almost all the configuration and even the method calls and classes remain virtually unchanged.  One caveat is that Log4net is in some kind of purgatory at the Apache foundation waiting for official project status.  I notice most of their releases are labeled as beta but I have not had any issues with it so far.  Your mileage may vary.

When you need logging, Log4X should be your first choice no matter what language you are using. 

Tuesday, April 26, 2005 4:23:19 PM (Central Standard Time, UTC-06:00)  #    Comments [0]
One of the best sites for clean, clean and yes cutting-edge CSS is Stu Nicholls' Cutting Edge CSS.

I've integrated many of his examples into my projects including 3 column layout with DIV's and a nice 3-D tabular effect for menus .

I always try to check this site to see if there any updates because most of Stu's examples make it easier to design standards compliant pages with nice functionality.
Tuesday, April 26, 2005 11:35:56 AM (Central Standard Time, UTC-06:00)  #    Comments [0]
 Wednesday, April 20, 2005
I worked at a company where a majority of error notifications from our batch programs was handled by e-mail.  This turned out to be a pretty good system until the dreaded security patch for Outlook arrived on the scene.  It essentially neutured Outlook as you counld no longer send message from a script (VBA or even Visual Basic) without getting a pop-up box.  Brilliant solution and quite elegant as it fixed the problem immediately and finally (well kind of).  However, those of us who came to rely on Outlook to do certain things, like send our error messages and process communications pulled our hair out and nashed our teeth. 

Recently I have come upon a nice hack to get the functionality of Outlook back.

http://www.dimastr.com/redemption/

This hack will let you use a similar object model to the original one without the security restrictions plus there are some additional properties and methods that the original object model did not have.  Well worth looking at if you want to automate Outlook.


Wednesday, April 20, 2005 2:02:45 PM (Central Standard Time, UTC-06:00)  #    Comments [0]
I have completed the migration of CHT to use a 3 column dynamic layout using DIV's.  I haven't found many examples of this especially with ASP.NET.  I will eventually expand this into a full tutorial.

Advantages of DIVs vs TABLEs
You can find this someplace else but I want to emphasize the reason i switched to div's was for troubleshooting and ease of maintenance not standards compliance (but that's another upside).  I find that I can read through my HTML much more quickly and the div actually provides a semantic meaning to the content versus a bunch of nested garbled tables. 

Traps
The hardest part was making this dynamic.  For instance what happens when you only want a two column layout or a one column layout? 

Implementation
The key is using a panel control (actually 3 of them or more).  The ASP.NET panel control is actually rendered as a div (in most browsers, you may have to use the browser caps hack to get the correct rendering in all browsers but this is pretty easy).  Once you are working with divs then the normal CSS rules apply.  The secret is applying styles dynamically so that the divs can be resized based on whether they contain content or not.  This is actually straight forward.

I promise I will post the sample code soon.
 |  | 
Wednesday, April 20, 2005 11:28:17 AM (Central Standard Time, UTC-06:00)  #    Comments [0]
I'm not sure if this just affects Gateway laptops or if all laptops are subject to this issue.  On a laptop even when the correct mouse drivers are installed you are not able to set all mouse properties.

One of the annoying ones is the "lines to scroll" for each mouse wheel rotation.  It defaults to a very annoying low amount of 1.  This is not very good at all.

To get around this you can use the TweakUI powertoy from Microsoft to change the lines per scroll.  Download the powertoy then open it, go to the Mouse branch then Wheel, make sure Use mouse wheel for scrolling is checked and then choose the Scroll by X lines at a time where X is the number of lines you want to scroll.
Wednesday, April 20, 2005 8:53:23 AM (Central Standard Time, UTC-06:00)  #    Comments [0]
 Tuesday, April 12, 2005
asp.net dev without Visual Studio

I need to research this further.
Tuesday, April 12, 2005 10:52:22 PM (Central Standard Time, UTC-06:00)  #    Comments [0]
I've been thinking recently about a possible maturity index for languages/platforms.  I use Java and C# as my main development languages.  They are very similar in syntax and in function.  If you can do something in one language you can probably do it in the other.  The differences are usally a bit of "syntactic sugar."  The major difference is the maturity of the documentation and of the available "code in the wild" by which I mean demo, samples and full fledged open source libraries.  Java has this in spades.  C# and by association .NET have a lot of this and it is growing each day, however Java has a much bigger head start and a more-open source build-it-yourself mentality. 

Hence the point of this post.  VB was my first language.  I came in to it at version 6, obviously at the end of its life cycle.  However, VB was in its prime.  You could find books, magazines, samples and examples galor.  Programmers had explored every angle of VB, not only had they put on the rubber glove and explored its orifaces but they had opened it up and shined the light on its entrails.  VB was a mature, highly productive platform, which is something that Java is now and C# is definetaly becoming. 

This is not to put down C#.  On the contrary, when C# has the maturity that Java now enjoys it should be a true work of art.  I think that as the .NET platform enters into version 2 we should see C# hit its sweet spot.  The major thing I see holding it back is the lack of open-source (read FREE) software.  Obviously it is designed and publilshed by Microsoft for the intent of selling MS product.  I see promise in that most popular Java utility libraries (JUnit, JDoc, Log4J) have been ported to .NET.  I would like to see more enterprise applications out there.  An open source appserver and web server would be nice.  Some decent object pooling and threading libraries would help. 

I think these will come, its just a matter of maturity.
Tuesday, April 12, 2005 10:21:23 PM (Central Standard Time, UTC-06:00)  #    Comments [0]
 Friday, April 08, 2005

Pragmatic Labs is pleased to announce its second product offering tentatively code named "Prometheus"

Simply stated; Prometheus is a code generation tool for .NET applications.  However, Prometheus goes a step further then most generation tools.  Most code generation tools are tier specific, meaning that they target one tier of the application.  The most common example of this is the data access layer generator.  Generators of this type usually read a database schema and generate code for CRUD operations on the database

Prometheus is a step beyond the single tier generators.  Prometheus allows an application to be defined in a tier independent schema file using XML.  From this schema Prometheus generates the database creation script, stored procedures, the data access layer, the business logic layer and the user interface.  The reason this works is there are certain common patterns that emerge when building applications.  Harnessing the experience of developers and the distilled knowledge of design patterns, a rather full skeleton of an application can be generated very rapidly. 

 Prometheus allows for code extensibility with either inheritance or region directives.  No matter how good a code generator is there is still a need for manual coding to handle business logic and special case situations.  Prometheus seeks to coexist with manual code and provides a clear separation between generated and manual coding.

 Prometheus is currently scheduled for release in the fall of 2005.

 

Friday, April 08, 2005 8:08:34 AM (Central Standard Time, UTC-06:00)  #    Comments [0]
 Friday, April 01, 2005

I found a way to “bind” objects to a web user control so that you don’t have to do this:

   Address a = new Address(….);

   This.txtLine1.Text = a.Line1;
   This.txtLine2.Text = a.Line2;

          
Instead you can just do this:
       

   UserControl.LoadData(a);

Then in the user control you have this:

   Public void LoadData(Address a) 
   {
      FormBinding.BindObjectToControls(a,this);
   }

You can also retrieve the fields once the user has made changes:
 
   FormBinding.BindControlstoObject(a,this);

 
It uses reflection.  It requires that the controls on the form be named the same as the properties of your object.  This actually makes the system very easy to read since your object properties, database fields, stored procedure variables and controls all have the same names. 
 
Here is the original source.

I’ve used this in two separate projects and it has worked very well.  If you combine it with code generation then you really realize some definite time savings with little (if any) performance penalty.  See the link for the article for more info.


Friday, April 01, 2005 9:01:09 AM (Central Standard Time, UTC-06:00)  #    Comments [0]
 Tuesday, March 29, 2005

In reference to this previous post, which was inspired by a java patterns book, Holub on Patterns: Learning Design Patterns by Looking at Code, I was again looking for the grail. 

Holub uses a builder pattern approach to avoid exposing each private field through a getter and setter.  This approach is interesting but it quickly becomes complicated in the implementation as a series of interfaces and implementations become necessary and this leaves the casual observer wondering if the getter/setter method might be much simpler to understand.

Holub's assertion is that accessors are used mostly for visual designer created UI's.  This may be true to a large extent but the alternative seems pretty convoluted.  Holub also argues that accessors are very procedural which may also be true and that object oriented progroms become procedural at the margins where they must communicate with procedural systems like UI and database access.  However, in the OO middle the program should be objects which consist of an almost service stack like service object which provides methods in which to accomplish tasks (isn't this procedural?).

Conclusion:  I have headed the warning of not to go crazy with accessors and mutators but the alternatives don't have a good smell. 

Tuesday, March 29, 2005 10:45:24 PM (Central Standard Time, UTC-06:00)  #    Comments [0]
 Monday, March 28, 2005
An article on OO design and CASE tools versus CRC cards and hand drawn diagrams.

I would have to agree that many times the tool causes such a disconnect from the model that it is more trouble then it is worth.  There is some fundamental mind-body link that causes the mind to be stimulated by drawing and writing. 

This is why the CRC cards, a white board and a digital camera are essentials for the SDK.
Monday, March 28, 2005 4:53:30 PM (Central Standard Time, UTC-06:00)  #    Comments [0]
I am in the process of putting together my own SDK (Software Development Kit).  No this is not a 50 Meg download from my site but rather a portable software development toolbox that I can take on the road.
fLogViewer
Category Name URL
Text Editor

Crimson Editor

PSPad

Notepad++

Metapad

http://www.crimsoneditor.com/

www.pspad.com/

http://notepad-plus.sourceforge.net/uk/site.htm

http://www.liquidninja.com/metapad/

Source Control Subversion http://subversion.tigris.org/
Source Control Subversion Windows Shell Extension http://tortoisesvn.tigris.org/
Web Browser Firefox http://www.mozilla.org/products/firefox/
Design CRC Cards http://c2.com/cgi/wiki?CrcCard
Code Generation Code Smith http://www.ericjsmith.net/codesmith/
Archiving 7-Zip http://www.7-zip.org/
Various Excel http://office.microsoft.com/en-us/default.aspx
ftp/sftp FileZilla http://filezilla.sourceforge.net/
html/xml formatting HTML Tidy http://tidy.sourceforge.net/
Clipboard Manager CLCL http://www.nakka.com/soft/clcl/index_eng.html
Shortcut Manager

Winkey

QLiner Hotkeys

PC World

http://www.qliner.com/hotkeys/

Log File Viewer fLogViewer fLogViewer
Desktop Search Copernic http://www.copernic.com/en/products/desktop-search/
Monday, March 28, 2005 3:55:44 PM (Central Standard Time, UTC-06:00)  #    Comments [0]
 Sunday, March 27, 2005

Referring to a previous post, I have been looking at the ways a business object can be represented or accessed through various tiers.  Of the ways this may be done is using the builder pattern. 

The builder pattern leaves the the representation of an object open-ended meaning that an object can have many different representations.  However, we do not need to know all of the representation at the time of construction.  Additional representations of the object can be added later. 

I have seen this pattern used extensively in java and I am actively searching for examples in C#.  Java seems to be a very pattern rich language and often strikes me as an academic language.  More on this in another post.

Sunday, March 27, 2005 8:02:43 PM (Central Standard Time, UTC-06:00)  #    Comments [0]
 Thursday, March 24, 2005

Should the code in an object span multiple tiers?  For example, should the object encapsulate the data persistence, the business logic and user interface layers?

Or should there be multiple objects to represent the object in each tier?

 

Thursday, March 24, 2005 4:37:04 PM (Central Standard Time, UTC-06:00)  #    Comments [0]
From Holub on Patterns:

The prime directive of OO systems is as follows:

    Never ask an object for information that you need to do something; rather, ask the object that has the information to do         the work for     you.

Ken Arnold says, "Ask for help, not for information."

  • Objects are defined by "contract." They don't violate their contract.

  • All data is private. Period. (This rule applies to all implementation details, not just the data.)

  • It must be possible to make any change to the way an object is implemented, no matter how significant that change, by modifying the single class that defines that object.

  • "Get" and "set" functions are evil when used blindly (when they're just elaborate ways to make the data public). I've a lot more to say on this issue later in the "Getters and Setters Are Evil" section.


 

Thursday, March 24, 2005 2:24:25 PM (Central Standard Time, UTC-06:00)  #    Comments [0]
 Wednesday, March 23, 2005
Welcome to the newly created blog section of Pragmatic Labs.  This is mostly for the journal of Pragmatic Labs chief engineer; Chris Weber.  This is my thought workspace, a place to list links, research and follow up items.
Wednesday, March 23, 2005 10:19:22 PM (Central Standard Time, UTC-06:00)  #    Comments [0]