March 12, 2011 22:46 by ckincincy
I have a habit of bookmarking pages as I feel that I need to go back and review the content.
So, I’m a bit too OCD to have that many random links in my book marks and I’ve had it happen more than once where stuff I bookmarked later disappeared from the web. Let me share them with you… and at the same time give ma point of reference!
PC Usability Hacks
Programming Tips
Fun Tips
Hacks
Tech Links
Political/Opinion
January 29, 2009 03:00 by ckincincy
Ran across this post a while a go, figured I’d share. It is 11 Tips for Visual Studio. Take a moment and go over to Stephen Walther’s site for an explanation of them. I really like number 1 and 4. I already knew 6, 7, and 11.
Tip #1 – You don’t need to select a line to copy or delete it
Tip #2 – You can add a namespace automatically by pressing CTRL-.
Tip #3 – Never create properties by hand
Tip #4 – You can remove and sort unnecessary using statements
Tip #5 – Use CTRL-k+c to comment out code
Tip #6 – You can close all documents except the current one
Tip #7 – You can open a database by double-clicking the database file in App_Data
Tip #8 – You can copy a file or folder into a project by dragging and dropping
Tip #9 – Use CTRL-SPACE to perform statement completion
Tip #10 – Add new items by pressing CTRL-N or CTRL-SHIFT+A
Tip #11 – You don’t need to type file extensions when adding a file
October 5, 2008 16:00 by ckincincy
Last week we upgraded our company from Sybase to SQL Server 2005. All of a sudden one of our web applications started throwing this error:
'.', hexadecimal value 0x00, is an invalid character. Line 1, position 198128.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Xml.XmlException: '.', hexadecimal value 0x00, is an invalid character. Line 1, position 198128.
This was happening when I was calling a .NET web service via an ASPX page. The web service call returned a serialized object:
For understanding, I have a class similar to this:
Model.Customer cust = new Customer();
cust.Id = 1;
cust.Name = "CK IN CINCY";
Now for the code that gave me this error (ie the ASPX code behind):
Model.Customer cust = new Customer();
WebSvc.GetCustomer(1, out cust);
This would blow up.
The web service looked like this:
[WebMethod]
public int GetCustomer(int Id, out Model.Customer cust)
{
// Fill cust object from database
return 1;
}
The problem was the data in the database contained null characters. This is to understood as different than null records. A null record is self explanitory and can be deal with inside the sql with an isnull call. The problem was that the record existed but somehow has a null character. CK IN [NULL CHARACTER] CINCY. In this case, isnull won't solve the problem. So after about five hours of searching I found this post. Which contained this function, which did the trick for me. Hopefully this saves you 5 hours of your time :-).
/// <summary>
/// Removes control characters and other non-UTF-8 characters
/// </summary>
/// <param name="inString">The string to process</param>
/// <returns>A string with no control characters or entities above 0x00FD</returns>
public static string RemoveTroublesomeCharacters(string inString)
{
if (inString == null) return null;
StringBuilder newString = new StringBuilder();
char ch;
for (int i = 0; i < inString.Length; i++)
{
ch = inString[i];
// remove any characters outside the valid UTF-8 range as well as all control characters
// except tabs and new lines
if ((ch < 0x00FD && ch > 0x001F) || ch == '\t' || ch == '\n' || ch == '\r')
{
newString.Append(ch);
}
}
return newString.ToString();
}
January 2, 2008 13:20 by ckincincy
So here I sit at work fighting with some open source solution we use to track issues. The only problem??? The code is ugly.
Makes it nearly impossible to read... so I started looking for a code prettier, as I had used one in the past at a previous employer. But it was for C++ code, not C#. However couldn't even find that one in my brief search. However found a neat little trick in Visual Studio 2005.
Ctrl+X then Ctrl+V
Does most of the work for me on the paste!
So now at least the code is somewhat readable.
October 30, 2007 06:53 by ckincincy
When programming, you sometimes need to make a comment for something to do later. Visual Studio has a cool feature in this regard.
When you type a comment: //TODO: Some comment here.
You can view that list from your IDE.
Just go to View-> Task List.
Now another neat feature here is you can actually have custom ones as well //ADDWEBSVC: Some comment here.
Just go to Tools->Options->Task List and add your option. Works like a charm!
Credit goes here.