Theme Graphic
Theme Graphic

LaniSoft Corner

Programming with a view to maintenance. Code quality and common mistakes
Posted on Friday, October 16, 2009 at 12:25 PM

How Database Design Helps or Hinders Interoperability and Maintainability of an Application

An often overlooked aspect of application development is how to design the database so that it facilitates maintaining the application. This can be especially crucial when an application offers users the ability to customize it or it is to be used in conjunction with third-party applications. Applications today frequently have to interop with third-party applications. One of the reasons for the success of the Windows platform was OLE and DDE which allowed different applications to share common data between them. So, how can we design the back end database, so that third-party applications can interop with our application? How can the way we design the data tables affect the maintainability of our application?...
Comments: 0 Tags: C, C#, C++, SQL, Visual Basic, Database Design

Posted on Friday, September 18, 2009 at 1:54 PM

Part 3 Addendum to Reverse Words in a String Algorithm (C++)

This addendum just provides the C++ alternative to the reverse words in a string algorithm. When I first started working on the algorithm I used C++ to code it, so I am providing how I did it in C++. For an explanation of the code here see the Second part which uses C to implement the algorithm. Basically, the only difference between this code and the C code is that this code uses string instead of char*.

The header file:
  1. /*
  2. reverse.h by Alex A'Neals (LaniSoft) August 26, 2009
  3. Reverses the words in a string
  4. */
  5. #ifndef ALX_REVERSE_STRING
  6. #define ALX_REVERSE_STRING
  7. // include files
  8. #include <iostream>
  9. #include <string>
  10. using std::string;
  11. // function prototypes
  12. // Reverse algorithm functions
  13. string& ReverseWordsInPlace(string& buffer);
  14. string& ReverseWord(string &word, int startIdx, int endIdx);...

Posted on Thursday, September 10, 2009 at 3:23 PM

Part 2 of How to Reverse the Words in a String (using C)

In the first part I showed how to reverse the words in a string with a simple Perl script. Perl is an excellent language for string manipulation; however, the original question was how could I write the algorithm using C# or C++. Take the following simple string:
A stitch in time saves nine
One way to reverse the words would be to take parse the string into individual words. These words could be stored in individual strings or they could be pushed onto a stack. For example (using _ to indicate the pointer position in the string for each operation and using {} to indicate stack elements with as {top...bottom}):

Before parsing:         _A stitch in time saves nine         stack = {}
1st Read:                      A_stitch in time saves nine        stack={A}
2nd Read:                     A stitch_in time saves nine        stack={stitch A}...
Comments: 1 Tags: C algorithm

Posted on Wednesday, September 09, 2009 at 2:12 PM

Solving Reverse Words in a String Algorithm Part I

This is the first in a two part series that talks about how to solve a commonly asked algorithm. Recently, I received a job proposal that listed this simple algorithm as one of the problems to be solved to qualify for the job. The problem to be solved is to reverse the words in a string (phrase entered by the user) and display the new string. The keyword being “words” and not letters or characters. In other words if the original string is

Birds of a feather flock together

the output should be

together flock feather a of Birds

and not

rehtegot kcolf rehteaf a fo sdriB.

One solution to the problem is the following Perl script:

#! /usr/bin/perl
print "Please enter a string of text: \n";
if(defined(my $inbuf = <STDIN>))
{
  {print reverse split /(\s)/, $inbuf};
  print "\n";
}
I am only beginning to use Perl, so I am sure there are more elegant ways of doing this. Basically, the key driver for the algorithm is...
Comments: 0 Tags: Perl algorithm C C++

Posted on Tuesday, August 18, 2009 at 2:17 PM

SELECT * = Maintenance Coder's nightmare

While working as a maintenance coder, I was handed a bug report that went something like this. After the last release we received this error message:

"SQL Error 205 - All queries combined using a UNION, INTERSECT or EXCEPT operator must have an equal number of expressions in their target lists."

The problem with the error message received was that the function being invoked by the program resided in module A; however, the changes made to the program were made in module B. What made the problem even more baffling was that module B's functionality had no direct relation to module A. In fact, module A contained functionality that was exclusive to one segment of the company and module B was exclusive to another group. The only group that had access to functionality in both modules was the admin group and this error was being reported by a non-admin member...
Comments: 0 Tags: SQL, Maintenance code

 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.