Friday, May 30, 2008

Free Internet Radio

I'm really unimpressed with Yahoo's Launchast. Their motto is "music that listens to you" but the ratings have no effect on what is actually played. How do I know? Because songs that I rate "Never Play Again" come up consistently. In fact I have noticed a looping playlist which means that a "Can't Get Enough" rating on an Album has no effect on what is played either.

As soon as I decided to pay for the commercial free version, a friend came over and introduced me to Pandora. Their motto: "It's a new kind of radio - stations that polay only music you like"

http://www.pandora.com/

Are they any better at playing more of a variety and respecting your ratings? I don't know yet, but it's free and it was created from the Music Genome Project. "Free" never lasts long, so get it while you can.

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

Thursday, May 1, 2008

Strangest Lyrics in Very Popular Songs

There are a few popular songs that I really like, but the lyrics are really odd and controversial.

The top of the list is

"Mmmm Mmmm Mmmm Mmm" by Test Crash Dummies

Once there was This Kid Who
got Into An Accident And Couldn't Come To School
but When He Finally Came Back
his Hair Had Turned From Black Into Bright White
he Said That It Was From When
the Cars Had Smashed So Hard

mmmm Mmmm Mmmm Mmmm, Mmmm Mmmm Mmmm Mmmmmmmm Mmmm Mmmm Mmmm, Mmmm Mmmm Mmmm Mmmm

then There Was This Girl Who
wouldn't Go To Change With The Girls In The Change Room
but When They Finally Made Her
they Saw Birthmarks All Over Her Body
she Couldn't Quite Explain It
they'd Always Just Been There

mmmm Mmmm Mmmm Mmmm, Mmmm Mmmm Mmmm Mmmmmmmm Mmmm Mmmm Mmmm, Mmmm Mmmm Mmmm Mmmm

both Girl And Boy Were Glad
one Kid Had It Worse Than That
'cause Then There Was A Boy Whose
parents Made Him Come Right Home Directly After School
and When They Went To Their Church
they Shook And Lurched All Over The Church Floor
he Couldn't Quite Explain It
they'd Always Just Gone There

Next up...Boyz-N-The-Hood by Dynamite Hack
It's not the lyrics that are really strange, it's the cool suburban white boy melody that throws the lyrics into a spin...

Woke up quick at about noon
Just thought that I had to be in Compton soon
I gotta get drunk before the day begins
Before my mother starts bitchin' about my friends
About to go and damn near went blind
Young niggaz on the pad throwin' up gang signs
I went in the house to get the clip
With my Mac10 on the side of my hip
I bailed outside and I pointed my weapon
Just as I thought, the fools kept steppin
I jumped in the fo' hit the juice on my ride
I got front and back side to side
Then I let the alpine play

I was pumpin' new shit by NWA
It was "Gangster Gangster" at the top of the list
Then I played my own shit, it went somethin' like this:

Cruisin' down the street in my 6-fo'
Jockin' the bitches, slappin' the ho's
I went to the park to get the scoop
Knuckle-heads out there cold shootin' some hoop
A car pulls up, who can it be?
The fresh El Camino rollin Kilo G
He rolls down the window and he starts to say
It's all about makin' that G.T.A.
...

In at #1...Wrong Way by Sublime
A very catchy and popular song about having sex with a minor in a foreign country...

Annie's 12 years old
In two more she'll be a whore,
Nobody ever told her
It's the wrong way.

Don't be afraid
with the quickness you'll get laid
For your family get paid
It's the wrong way.

I gave her all that I had to give,
I'm gonna make it hard to live.
Salty tears running down her chin
And it ruins up her make up I never wanted

A cigarette,
Pressed between her lips
While I'm staring at her tits,
It's the wrong way.

Strong if I can,
But I am only a man,
So I take her to the can,
It's the wrong way.

The only family that she's ever had
Is her 7 horny brothersAnd her drunk-ass dad.
He needed money
So he put her on the street,
Everything was going fine until the day that she met me.

Annie are you sad?
Wanna shoot your dad
I'll do anything I can
The wrong way.

We talked all night and
Tried to make it right,
Believe me shit was tight,
It was the wrong way.

Don't run away if you wanna stay,
Cause I ain't here to make ya', oh no
It's up to you what you really wanna do
Spend some time in America, dub-style
...


For the icing on the cake, there's Lightning Crashes by Live.

lightning crashes, a new mother cries
her placenta falls to the floor

You have to love it when an lyricist glorifies child birth!

Check This Out!

More Links to Good Information