Tuesday, January 26, 2010

Throttling the Internet

This is very useful for seeing how a user will experience your site or web application.
Found out you can do this in Fiddler (http://www.fiddler2.com/fiddler2/).

To enable this you
  1. Click 'Rules'
  2. Click 'Performance'
  3. Enable 'Simulate Modem speeds'


What this does will download a KB of data and add a delay of 150ms by default. This downloads 10KB of every 1.5 seconds.

You can adjust this. If you want 100KB downloaded every second you need to change this delay setting to 10ms.

To adjust this:
  1. Click 'Rules'
  2. Click 'Customize Rules'

This will allow you to adjust the settings. NOTE: You can change all of fiddler's settings in the that opens, so save a backup of this. Click "Save As", close and reopen.

Find "if (m_SimulateModem)" in this file. The first occurrence will be for the upload delay, the second for the download delay. Changing the second to 'oSession["response-trickle-delay"] = "10"; '. This will deliver approximate speed of 100KB/sec.

Thought this would help.

Monday, January 25, 2010

Error 1001. The specified service has been marked for deletion.

Here's an FYI on deleting a windows service. If you have problems completely removing the service.

And get the error:

Error 1001. The specified service has been marked for deletion.

Make sure you don't the services MMC open.

After I closed the services MMC the service was deleted and I could continue installing again.

Wednesday, January 6, 2010

Updateing TextBox from separete thread

I created a little web form app to send messages to a port. This was threaded and I wanted to update the UI with messages. So I had to use this:


Call :
UpdateSendTextBox(pmsData);

Code:
public void UpdateSendTextBox(string value)
{
if (InvokeRequired)
{
this.Invoke(new Action(UpdateSendTextBox), new object[] { value });
return; // important to return in a recursive call.
}
if(!sendingTextBox.IsDisposed) // will not update if application is closing
sendingTextBox.Text = value;
}

It will recursively call the UpdateSendTextBox with a new ui thread to update. That's it.

Life is good.