November 26, 2008

Transactions Made Simple with Windows Communication Foundation

he ACME Toothpick Company has a problem: their applications do not communicate. The toothpick making process is causing big headaches for the purchasing and sales departments. The problem stems from the way toothpicks are manufactured. First, a log is selected from inventory and fed into the toothpick maker. Approximately three

Upload Large Files

By default, ASP.NET doesn’t allow you to upload files bigger than 4MB to the server. You can fix this by overriding the default value of 4MB in the web.config file. &lthttpRuntime executionTimeout=”420″ maxRequestLength=”40960″ /&gt You need to specify the maxRequestLength attribute value in kilobytes, not bytes or megabytes.

Controlling Checkboxes in MFC

Here’s how to check, uncheck, enable, and disable a checkbox in MFC: CButton* pBtn = (CButton*) GetDlgItem(IDC_SETUP_AM); pBtn-&gtSetCheck(0);// uncheck it CButton* pBtn = (CButton*) GetDlgItem(IDC_SETUP_AM); pBtn->SetCheck(1);// check it CButton* pBtn = (CButton*) GetDlgItem(IDC_SETUP_AM); pBtn->EnableWindow(0);// disable it CButton* pBtn = (CButton*) GetDlgItem(IDC_SETUP_AM); pBtn->EnableWindow(1);// enable it

Authenticate to a Proxy Server

To provide a user’s password to a proxy server, use the following code: URLConnection URLcon=null;URLcon = url.openConnection();byte[] x=”name:password”.getBytes();//coding in Base64String s = new sun.misc.BASE64Encoder().encode(x); URLcon.setRequestProperty( “Proxy-Authorization”,s);