Wednesday, May 21, 2008

Tortise SVN Optimization and Tweaks

TortiseSVN settings are not the best by default. To get to the settings, right click on a folder and: TortiseSVN / Settings

General:
If you have not started using Tortise, I would recommend checking the box that says "Use '_svn" instead of ".svn" directories. DO NOT CHECK THIS IF YOU ALREADY HAVE FOLDERS USING SVN.
http://lisazhou.wordpress.com/2008/03/09/can-not-open-visual-studio-net-2003-project-once-added-to-svn-problem-resolved/
If it causes problems in VS 2003, it may cause problems with other applications as well.

Icon Overlays:
I noticed that there was a process in Task Manager called "TSVNCache.exe" which is taking up 60k of memory and running at 1-2% every other second causing I/O on the hard drive. My laptop has been running slow, so I was searching to increase speed. I found out that by default, TortiseSVN is set to Overlay all of C:\ and any other Fixed drives.

1. Check Fixed Drives, but exclude them in "Excluded paths:"
C:\*
D:\*

2. Include the paths to the root folders which are using Subversion:
D:\MyApps\*

3. Open up Task Manager and right-click on the TSVNCache.exe process. Choose "Set Priority / Low".

It's amazing how my hard drive has stopped thrashing!

Mailing Address Validation

If you would like to ensure that your customer entered in a correct mailing address, there are a number of options:

UPS OnLine Tools
http://www.ups.com/content/us/en/bussol/offering/technology/automated_shipping/online_tools.html
Sign up and use UPS Address Validation Tool -Ensures that customer-entered shipping addresses are correct at the time of order processing (XML)

FedEx Address Checker
http://www.fedex.com/avs/us_english/?link=4

US Postal Service Address Validation
http://www.eggheadcafe.com/articles/20060430.asp

Sunday, May 18, 2008

Email Validation C#

There are three levels of validating an email address:
  1. Syntax Validation: Does it have an @ sign and at least one full stop, are the left and right hand sides of the @ valid, searching the internet will give you all the things an email address must have.
    http://www.cambiaresearch.com/c4/bf974b23-484b-41c3-b331-0bd8121d5177/Parsing-Email-Addresses-with-Regular-Expressions.aspx
  2. Resolve the Domain: You will need to do a DNS MX lookup, there is a nice C# dll on the internet should be easy to find.
    http://aspalliance.com/744_CodeSnip_Resolving_Domain_Names__and_IP_Addresses
  3. Use a Socket: Actually go through the process of sending an email and then stop just before issuing the .quit command.
    http://www.eggheadcafe.com/articles/20030316.asp

Thursday, May 15, 2008

Convert ArrayList of Objects to DataTable

using System;using System.Collections;
using System.Data;using System.Reflection;
using System.Collections.Generic;
using System.Text;

public static class Util
{
public static DataTable ConvertArrayListToDataTable(ArrayList arrayList)
{
DataTable dt = new DataTable();

if (arrayList.Count != 0)
{
dt = ConvertObjectToDataTableSchema(arrayList[0]);
FillData(arrayList, dt);
}

return dt;
}

public static DataTable ConvertObjectToDataTableSchema(Object o)
{
DataTable dt = new DataTable();
PropertyInfo[] properties = o.GetType().GetProperties();

foreach (PropertyInfo property in properties)
{
DataColumn dc = new DataColumn(property.Name);
dc.DataType = property.PropertyType; dt.Columns.Add(dc);
}
return dt;
}

private static void FillData(ArrayList arrayList, DataTable dt)
{
foreach (Object o in arrayList)
{
DataRow dr = dt.NewRow();
PropertyInfo[] properties = o.GetType().GetProperties();

foreach (PropertyInfo property in properties)
{
dr[property.Name] = property.GetValue(o, null);
}
dt.Rows.Add(dr);
}
}
}

Tuesday, May 13, 2008

Visual Studio ASP.NET Formatting Setting Tip

Tools / Options...

I'm always having to type in quotations for parameter values. Check this box to have Visual Studio do it for you...



If I format a control how I want and then paste another value in, Visual Studio re-formats the control and destroys my work! Uncheck the Format HTML on Paste checkbox...


Telerik Open Window and
Close From Opened Window

OPEN WINDOW
<script type="text/javascript"> //<
![CDATA[
function OpenWindow(name)
{
var mgr = GetRadWindowManager();
}
//]]> </script>

<button id="btnDeleteCustomer">Open with radopen</button> <radW:RadWindowManager ID="RadWindowManager1" runat="server"> <Windows>
<radW:RadWindow
ID="DeleteCustomer"
NavigateUrl = "DeleteBusiness.aspx"
Skin="Default"
VisibleOnPageLoad = "false"
OpenerElementId = "btnDeleteCustomer"
OffsetElementID = "offsetElement"
Top = "115"
Left = "30"
Width = "700px"
Height = "600px"
runat="server"
/>
</Windows>
</radW:RadWindowManager>


CLOSE FROM OPENED WINDOW
<script type="text/javascript">
function GetRadWindow()
{
var oWindow = null;
if (window.radWindow) oWindow = window.radWindow;
else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;

return oWindow;
}

function CloseWindow()
{
var oWindow = GetRadWindow();
oWindow.Close();
}
</script>

Monday, May 12, 2008

Telerik Rad Window Alert

ASP.NET
<%@ Register TagPrefix="rad" Namespace="Telerik.WebControls" Assembly="RadWindow.Net2" %>

<rad:RadWindowManager ID="RadWindowManager1" runat="server" Left="" NavigateUrl="" Skin="Office2007" SkinsPath="~/RadControls/Window/Skins" Title="" Top="">
</rad:RadWindowManager>


C#

protected void btnSave_Click(object sender, EventArgs e)
{
string strWindowTitle = "Saved";
string strAlert = "Settings have been Saved.";
string strWidth = "330";
string strHeight = "200";

string alert = "<script language='javascript'>" + "radalert('" + strAlert + "', " + strWidth + ", " + strHeight + ", '" + strWindowTitle + "');" + "</script>";

Page.RegisterStartupScript("AlertScript", alert);
}

Sunday, May 11, 2008

Telerik.WebControls.GridInsertionObject



In attempting to use the edit form of the Telerik Grid Control, there is an error when there are no records in the table when using an ArrayList of Objects. Since no Objects are in the array list, the RadGrid cannot determine the column headings or the fields for editing. A way around this is to create a DataTable with the proper headings for the fields which need to be entered.


ArrayList units = unitsBusinessLogic.GetAll();

if (units.Count == 0)
{
DataTable dt = new DataTable();
DataColumn dc = new DataColumn("Name", System.Type.GetType("System.String"));
dt.Columns.Add(dc);
dc = new DataColumn("AccessCode", System.Type.GetType("System.String"));
dt.Columns.Add(dc);
RadGrid1.DataSource = dt;
}
else
{
RadGrid1.DataSource = units;
}

Monday, May 5, 2008

Microsoft Error Message - Move or Copy


How do you answer this question? Do you want to move or copy files from this zone? Two choices...Yes or No

Check This Out!

More Links to Good Information