I think we should change all the live sites' web.config with debug="false". It's both insecure and inefficient to leave debug="true" on a live site based on these two articles:
http://weblogs.asp.net/scottgu/archive/2006/04/11/442448.aspx
http://networking.itbusinessnet.com/articles/viewarticle.jsp?id=135133
If we remember to do that every time we publish a site, we might be able to use that info to tell if it's from test site or live site.
Thursday, February 21, 2008
Ignore settings in TortoiseSVN
Thursday, February 14, 2008
sqlbulkcopy
I have just used sqlbulkcopy for the third or so time. This is a handy thing built into 2.0 that you should be familiar with. In the past I have used it in my code to copy a row into an "archive" table before deleting it from the initial table. Today I used it to copy data to a database housed at another school. I had a copy of their schema. I built a view of our data, such that the view held just what needed to go into their table. Here is my sample code:
A couple things to note. I copied code from the last time I did this. Reading my comment I'm not sure I actually needed to map out the columns, because from my view to the destination the schemas matched up. Last time I did this however, there were a few more columns in the destination table, hence my comment about the not matching up. Second, I got this error early on: SqlBulkCopy: the locale id '0' of the source column ' ' and the locale id '1033' of the destination column '' do not match. This was because the ID column in my table was an int and in theirs was varchar. I therefore modified my view for that and one other column so that the data types matched using CAST(field as varchar) AS field.
string sql = "SELECT * FROM sourceView";
using (SqlConnection conn = new SqlConnection(dsn))//source dsn
using (SqlCommand cmd = new SqlCommand(sql, conn))
using (SqlBulkCopy copy = new SqlBulkCopy(dsn2))//destination & source dsn are the same
{
conn.Open();
SqlDataReader rdr = cmd.ExecuteReader();
copy.DestinationTableName = "destinationTable";
//have to map the columns because the tables are not an exact match
copy.ColumnMappings.Add("fieldname", "samefieldButSlightlyDifferentName");
copy.ColumnMappings.Add("fieldname2", "samefieldButSlightlyDifferentName2");
copy.WriteToServer(rdr);
conn.Close();
}
A couple things to note. I copied code from the last time I did this. Reading my comment I'm not sure I actually needed to map out the columns, because from my view to the destination the schemas matched up. Last time I did this however, there were a few more columns in the destination table, hence my comment about the not matching up. Second, I got this error early on: SqlBulkCopy: the locale id '0' of the source column '
Wednesday, February 13, 2008
firesizer
Guys,
I've tried out and like a new extension for Firefox. It's the third of its kind that I have tried & so far I like it the best. It's just a window resizer, but this one integrates into the status bar so no menu interaction is needed to access it, and it keeps your current size available for you in the status as well. Nice! Here is a link: https://addons.mozilla.org/en-US/firefox/addon/5792
Tuesday, January 29, 2008
Javascript Object Visibility
Hey all,
I am trying to do some error checking in my javascript code and I have ran across an issue with the visibility of an object.
I am hiding an object on the page using document.getElementById('objectname').style.display = 'none';
When I go to see if it exists using the code below (the object IS not visible on the screen at the time), nothing happens
if(document.getElementById('objectname').style.visibility == 'hidden')
{
alert('message');
}
I have also used with no avail:
if(document.getElementById('objectname').style.display == 'none')
{
alert('message');
}
Any ideas?
I am trying to do some error checking in my javascript code and I have ran across an issue with the visibility of an object.
I am hiding an object on the page using document.getElementById('objectname').style.display = 'none';
When I go to see if it exists using the code below (the object IS not visible on the screen at the time), nothing happens
if(document.getElementById('objectname').style.visibility == 'hidden')
{
alert('message');
}
I have also used with no avail:
if(document.getElementById('objectname').style.display == 'none')
{
alert('message');
}
Any ideas?
browser for debugging in Visual Studio
Anyone know if you can set the specific browser for VS to use when it runs the debugger? I can't remember but I thought I had set it to IR even though my default browser is Firefox.
Friday, January 11, 2008
Max Length for Text Boxes
I know a while back that we had mentioned putting MaxLength values on all text boxes to prevent OverFlow Exceptions.
I would like to get opinions on certain Text Box values and what we could use as a MaxLength in these cases:
Common Dollar Figures: since these include a decimal sometimes they may require a larger MaxLength Correct? What do we think a typical MaxLength would be in this situation?
Integer Amounts: Since a MaxLength of 9 here and a MaxLength of 9 in a Currency field are different, this could cause for Overflow Errors. 999999999 (Overflow) is much larger than 999999.99 (No OverFlow) (MaxLength 9 TextBox example)
Percentage amounts? Im thinking 4 MaxLength but what do you all think?
Obviously in certain situations:
Question directed at Sidney Crosby: "How much money did you sign your contract for?" Would be at the programmer's discretion.
Thanks for reading!
Bills Fan Dave
I would like to get opinions on certain Text Box values and what we could use as a MaxLength in these cases:
Common Dollar Figures: since these include a decimal sometimes they may require a larger MaxLength Correct? What do we think a typical MaxLength would be in this situation?
Integer Amounts: Since a MaxLength of 9 here and a MaxLength of 9 in a Currency field are different, this could cause for Overflow Errors. 999999999 (Overflow) is much larger than 999999.99 (No OverFlow) (MaxLength 9 TextBox example)
Percentage amounts? Im thinking 4 MaxLength but what do you all think?
Obviously in certain situations:
Question directed at Sidney Crosby: "How much money did you sign your contract for?" Would be at the programmer's discretion.
Thanks for reading!
Bills Fan Dave
Subscribe to:
Posts (Atom)
