Social Icons

Pages

Saturday, November 21, 2015

Upload Large Files in ASP.NET - Application Level

1. Modify the maxRequestLength and executionTimeout in the web.config
    <system.web>
      <httpRuntime maxRequestLength="102400" executionTimeout= "3600" />
    </system.web>

The configuration, allowing uploads of files up to 100MB and upload periods up to 1 hour

2. Modify the maxAllowedContentLength setting in the web.config
        <system.webServer>
      <security>
        <requestFiltering>
          <requestLimits maxAllowedContentLength="2147483648" />
        </requestFiltering>
      </security>
    </system.webServer>
References:
http://docs.telerik.com/devtools/aspnet-ajax/controls/upload/uploading-files/uploading-large-files
http://ajaxuploader.com/large-file-upload-iis-asp-net.htm

Saturday, July 4, 2015

Apache POI- Convert Excel column number to letter & Create color using RGB

Recently I had chance generating a complex excel file using Apache POI. I spent a few hours finding formulas.

In this article, I am going to share those formulas.  Hope this will helpful for you.

//Convert excel column number to letter
import org.apache.poi.hssf.util.CellReference
String letter = CellReference.convertNumToColString(ColumnNumber);


// Create color using RGB code
import org.apache.poi.hssf.usermodel.HSSFPalette;
HSSFPalette palette = workbook.getCustomPalette();
palette.setColorAtIndex(new Byte((byte) 10), new Byte((byte) 22), new Byte((byte) 54), new Byte((byte) 92));
//(short index,byte red,byte green, byte blue) - index - the palette index, between 0x8 to 0x40 inclusive
 
HSSFCellStyle worksheetCellStyle = workbook.createCellStyle();

worksheetCellStyle.setFillForegroundColor(palette.getColor(10).getIndex());

Saturday, June 27, 2015

Sunday, March 15, 2015

How to display row values in columns

Here I am going to return a result set that has one record per company and a column that has a listing of employee name for each company separated by semicolons.

Below is the table output which I used to query the data.


MS Sql
Select distinct company,employees from tbl_employee as e OUTER APPLY
(SELECT STUFF(( SELECT ';' + emp.name FROM tbl_employee AS emp
where emp.company=e.company
FOR XML PATH('') ), 1,1,'') AS employees ) AS r
PostgreSQL
 select company, array_to_string(array_agg(name), ',')  from tbl_employee group  by company
Output:

Reference:
http://www.postgresonline.com/journal/archives/191-String-Aggregation-in-PostgreSQL,-SQL-Server,-and-MySQL.html