Friday, August 29, 2008

Unable to connect to the remote server

The underlying connection was closed: Unable to connect to the remote server.

Check, double-check and triple-check the URI for the web service.

Then DNS/hosts/lmhosts


Thursday, August 28, 2008

string to bool

bool bvalue = (svalue == "1" ? true : false);

Friday, August 22, 2008

txt2Hex hex2Txt

/ / JK - for psuedo-encrytping the user entered password to hex
public static string txt2Hex(string arg)
{
string retval = "";
try
{
foreach (char c in arg)
{
int tmp = c;
retval += String.Format("{0:x2}",
(uint)System.Convert.ToUInt32(tmp.ToString()));
}
}
catch (Exception ex)
{
LogUtil.logMeLogic ( "Error : txt2Hex : |" + arg + "| : " + ex.ToString(),
false )
return "-1";
}
return retval;
}

// JK - for decyrpting the psuedo-encrytped the user entered password from hex
public static string hex2Txt(string arg)
{
string retval = "";
try
{
if (arg.Length % 2 != 0)
{
throw new Exception();
}
while (arg.Length > 0)
{
retval += System.Convert.ToChar(System.Convert.ToUInt32(arg.Substring(0,
2), 16)).ToString();
arg = arg.Substring(2, arg.Length - 2);
}
}
catch (Exception ex)
{
LogUtil.logMeLogic ( "Error : txt2Hex : |" + arg + "| : " + ex.ToString(),
false )
return "-1";
}
return retval;
}
}

// Partial source: http://www.testingreflections.com/node/view/5635

Tuesday, August 5, 2008

That damn SELECT INTO syntax

SELECT * INTO fubert FROM foo WHERE 1 = 2