Thursday, September 25, 2008

DataSet / DataTable Primary Key and using DataRow.Find

It's quick and easy to find items in a DataTable through setting the primary key. This method can be used to easily populate a CheckBoxList

DataSet ds = //populate dataset
if(ds != null && ds.Tables.Count > 0)
{
  GroupCBL.DataSource = ds;
  GroupCBL.DataTextField="textField";
  GroupCBL.DataBind();

  DataColumn[] dc = new DataColumn[1];
  dc[0] = ds.Tables[0].Columns["key"];
  ds.Tables[0].PrimaryKey = dc;

  foreach(ListItem item in GroupCBL.Items)
  {
    DataRow row = ds.Tables[0].Rows.Find(item.Value);
    item.Selected = Convert.ToBoolean(row["selected"]);
  }
}

Friday, September 12, 2008

Restart a remote machine.

Having problems with the remote machine you are using? Don't want to leave home to head to the office for a restart? Simple cmd can take care of it.

C:\Documents and Settings\unplug1.6>shutdown -m \\Hum -r -y

shutdown is the command you're looking for, "-r" is to specify a restart instead of total shutdown. "-m \\Hum" specifies the remote computer you are trying to restart. Below are a few other arguments.

No args Display this message (same as -?)
-i Display GUI interface, must be the first option
-l Log off (cannot be used with -m option)
-s Shutdown the computer
-r Shutdown and restart the computer
-a Abort a system shutdown
-m \\computername Remote computer to shutdown/restart/abort
-t xx Set timeout for shutdown to xx seconds
-c "comment" Shutdown comment (maximum of 127 characters)
-f Forces running applications to close without warning
-d [u][p]:xx:yy The reason code for the shutdown


Usage:
shutdown [-i | -l | -s | -r | -a] [-f] [-m \\computername] [-t xx] [-c "comment"] [-d up:xx:yy]

Monday, September 8, 2008

Refreshing the project failed. Unable to retrieve folder information from the server.

I've been working with Visual Studios 2003 and have had the error "Refreshing the project failed. Unable to retrieve folder information from the server." pop up as I'm loading the project. I normally ignore it and go about my business. I finally tired of seeing the pop up and hit the interweb for answers.
To correct the problem simply delete the "VSWebCache" from the "\Documents and Settings\[Username]" directory.