Archive

Archive for February, 2012

Using the Charting Control in ASP.NET Webform

February 27, 2012 Leave a comment

The following steps will give you a brief intro on how to use the chart control, from there you can easily extend and provide additional functionalities

The chart control has separate definition sections for data and chart type, with this, it is possible to create multiple chart types using the same data points.

  1. First create a blank asp.net webform
  2. Then using the design view, click on toolbox and search for the chart control under the data section
    image
  3. You will now see the placeholder for the chart appear in your webform
    image
  4. This is the default column chart, you can change the type simply by clicking on the chart and then the arrow that appears
    image
  5. You can link the data source via standard data adapters like SQL, EF, XML etc. But this example will add the data via code.

    Inside the page_load event of the page, add the following code

    //Create 6 data points with x values from 1 to 5
    for (var x = 1; x < 6; x++)
    {
       //set it such that the y value mirrors the x value 
       var y = x; 
       //add the following point to the chart 
       Chart1.Series[0].Points.AddXY(x, y); 
    }

  6. Press F5 to run the website and view your chart
Categories: ASP.NET Tags: ,

HTTP 400 Errors when using WCF

February 15, 2012 Leave a comment

if you encounter the following weird errors

The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://tempuri.org/:ClientPrintResult. The InnerException message was ‘There was an error deserializing the object of type System.String. The maximum string content length quota (8192) has been exceeded while reading XML data. This quota may be increased by changing the MaxStringContentLength property on the XmlDictionaryReaderQuotas object used when creating the XML reader

or

The remote server returned an unexpected response: (400) Bad Request

 

It usually means that you are sending more than 8192 bytes of data to the WCF service. if this is a legitimate case, you will need to update both the server’s web.config and your applications app.config.

 

The examples below are based on custom binding, but you can easily find the equivalent settings for the other bindings as well.

For this example, the maximum data that can be sent is 10MB (10485760). The maximum permissible value is 2147483647 (int.MaxValue = 2GB)

 

For web.config

modify the items in bold and blue, add in the section or properties if they do not exist, else just update the values

<binaryMessageEncoding  maxReadPoolSize="10485760" maxSessionSize="10485760" maxWritePoolSize="10485760">

<readerQuotas maxDepth="32" maxStringContentLength="10485760" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />

</binaryMessageEncoding>

<httpTransport maxReceivedMessageSize="10485760" maxBufferSize="10485760" />

For app.config

modify the items in bold and blue, add in the section or properties if they do not exist, else just update the values

<binaryMessageEncoding>

<readerQuotas maxDepth="32" maxStringContentLength="10485760" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />

</binaryMessageEncoding>

 

<httpTransport maxReceivedMessageSize="10485760" maxBufferSize="10485760"  />

Categories: ASP.NET, IIS, WCF

Upgrading a jailbroken device to the latest and greatest iOS firmware

February 15, 2012 1 comment

 

If you have a jailbroken device, chances are you will find it a headache to upgrade your iOS firmware. Below are the steps which you can take to minimize your headache.

 

Requirements

  1. Jailbroken iOS device
  2. Installous installed and with iTunes sync on
  3. PC with the latest iTunes
  4. new iOS firmware can be jailbroken
    Steps

  1. Connect the iOS device to your PC
  2. Start up iTunes
  3. Right click your device and click on Transfer Purchases
    image
  4. Wait for the purchases to be transferred
  5. Right click your device and click on Back Up
    image
  6. Wait for the backup to complete
  7. Upgrade to the latest iOS version via iTunes (Click on Check for Update or Shift + Click Restore to load a local copy of the ipsw)
  8. Jailbreak the device
  9. Run cydia on the device and install installous
  10. Install any other cydia apps that you need (so that restore will restore the apps location inside springboard properly)
  11. Enable iTunes Sync inside installous
  12. Inside iTunes, click on your device and select the Apps tab
  13. Check Sync Apps
  14. Click ok when prompted
  15. Make sure all the apps are selected then click on Apply
  16. Wait for the apps to be synchronized back to your phone
  17. Right click your device and select Restore from Backup
  18. Select the latest backup which was done before the upgrade and click ok
  19. Wait for iTunes to restore the files and application settings, your phone will reboot once complete

After all this, you should have your phone back in more or less the same order as before. Your springboard icon locations may be slightly off, but that should not be too much of a hassle

Categories: iOS Tags: , , ,