An Alternitive to Recursion

March 25th, 2010

I am sure you are aware of the many drawbacks to using a recursive function.  Recursive functions are resource intensive slow and in many cases unreliable.  I would like to provide a very simple alternative to creating a recursive function in c#.

Consider the following recursive code:

private void main()
{

ScanDir(string “”);

}

private void ScanDir(string theDirectory)
{

//Some type of directory scanning code here that fills xDir with a directory name if the file is a directory

if(xDir != “”){
ScanDir(xDir); //  Here ScanDir calls itself again creating a recursive call
}

}

Now we simple need to use a c# stack to avoid recurssion.  As you can see the the following example, very few lines of code were changed and very few were added.  These simple changes make the program far more efficient.

using System.Collections; // you will need this include to use Stacks
Stack dirStack = new Stack(500); // declare a stack to use later

private void main()
{

ScanDir(“.”);

while (dirStack.Count > 0)
{
ScanDir((string)dirStack.Pop());
}

}

private void ScanDir(string theDirectory)
{

//Some type of directory scanning code here that fills xDir with a directory name if the file is a directory

if(xDir != “”){
dirStack.Push(xDir); // push the directory onto the stack for later scanning
}

}

Robbalman

AT&T Tether Explained

March 25th, 2010

You may have read my other post about tethering a Samsung blackjack II to your windows based laptop PC and been confused.  I have taken a screen shot of the dial up connection screen to show exactly what it should look like.

Samsung and AT&T Tether

Tether Screen

You can see that the Connect using field contains the Samsung driver for the phone and the phone number to dial is *99#.  You don’t have to specify a username or password when connecting.

Robbalman

Priceless Web Developing Tool: Free

March 25th, 2010

I can’t stress the value of the “Web developer toolbar” for firefox.  This plugin takes the pain out of css and gives you direct access to tools that make it much easier to see what is going on with any website you are creating.  The toolbar has so many great features that I won’t take the time to explain them here.

The one I find the most useful is the CSS view style information option.  As you move the mouse around a webpage is creates a red outline and corresponding text to tell you what css is effecting that particular section of the web page.

Robbalman

How To: Write Customer Microsoft RMS Reports

March 24th, 2010

Do you have Microsoft RMS and wish you could write custom SQL report for it?  Well you can and best of all it is easy to do.  All you will need is a free Microsoft application and a little knowlege of SQL.  Download and install Microsoft SQL Server Management Studio Express.  Once you have it open you will be able to connect to your stores database.  Use the object explorer to see what tables are available and start exploring to see how each table relates to the others.

You can create a new query window and test some SQL code like the following that selects the description for all items with a price greater than $10.00:

“select description from item where price > 10″

The possiblities are endless once you have direct access to the data.  This flexibility is the primary reason I chose Microsoft RMS.

Robbalman

Database Happy

March 23rd, 2010

Don’t be database happy, not everything that can be stored in a database should be.  Databases are great for storing some types of data but don’t get crazy.  In some cases a flat file would be a much better solution to storing information then a database.  Computers can generally process files much faster and more efficiently than a database can select that same information.  If you are looking to create a directory structure or a parent child relationship don’t look to a database for answers.  You should strongly consider not using a database wherever possible.

Robbalman

Public Release

March 23rd, 2010

I am pleased to announce that ftpmonitor.com is now publicly available.  FTPmonitor is a service that monitors changes made to your FTP server.  This new cloud based service will send you notifications of what has changed on a daily bases.  No longer do you have to worry about what is being done on your website.  For a free trial and more details visit www.ftpmonitor.com.

Robbalman

Server Maintenance

February 27th, 2010

One bad thing about being a night owl is that sometime I am awake when my hosting company is doing routine server maintenance.  I am happy they are there working for me and keeping everything up and running during business hours.  Luckily this time the server was only down for about 15 minutes.

Robbalman

Friday’s Deadline

February 27th, 2010

My personal projects always take a back seat to customer projects.  A few customer projects came up this week so it pushed by my big release a few weeks.

Robbalman

Working to a Deadline

February 24th, 2010

Without a deadline what’s the hurry.  You have to set a deadline and you have to be under it, even for personal projects.  If you don’t set a deadline why wouldn’t you put it off til tomorrow?

Robbalman

Early to Rise

February 23rd, 2010

I have heard that you wasted the day if you get up after the last time on the clock that has three of the same digits.  5:55 is pretty early especially for me, I am a night owl, I can’t remember the last time I went to bed before 12.  I can see many possible benefits from getting up earlier.  I would get extra time to work on my personal projects before work starts.  I wouldn’t have to stay up so late at night to get time to work on my personal projects.  I could spend more time with my wonderful wife and kids.

Robbalman