Entries for month: September 2009

Todays' Ad

404 Page not found displayed when try to download .xlsx extention

IIS 2 Comments »

Today I face really strange issue, when I tried to download file with extention .xlsx and browser redirect me on 404 Page not found page. My belief is whenever IIS (webserver) found file is not script file then it will let browser to download the file but in this case it took me to "Page Not Found" page.

I have done googling for this and Solution is really simple. We require to add Mime type 'application/octet-stream' in IIS.

Read more...

<br> tag create seperate row in exported excel

ColdFusion 1 Comment »

Exporting data into excel sheet with HTML <br> tag creates separate row which really cause problem sorting excel column when there are multiple column. After doing lots of googling I found really simple solution which will line break in excel cell in spite of creating separate row.

Add following css definition in header section and it will solve your problem. 

<style>
    br {mso-data-placement:same-cell;}
</style>

Get hierarchical list in SQL Server 2008

SQL 1 Comment »

SQL Server 2005 comes with magical WITH clause which make getting hierarchical (recursive) data very easily (just within one query). Let me explain with example. Suppose I like to get manager hierarchy from employee table. 

Employee Table:

employeeId  empName                                            managerId
----------- -------------------------------------------------- -----------
1           R1                                                 NULL
2           R2                                                 1
3           R3                                                 1
4           R4                                                 2
5           R5                                                 2
6           R6                                                 3
7           R7                                                 2
8           R8                                                 3
9           R9                                                 4

Let's say I want to get hierarchical manager list for employee R9 (Id 9) and just try below query.

WITH Managers(ManagerID, EmployeeID, EmployeeLevel) AS 
(
    SELECT ManagerID, EmployeeID, 0 AS EmployeeLevel
    FROM Employees where employeeId = 9
    UNION ALL
    SELECT e.ManagerID, e.EmployeeID, EmployeeLevel + 1
    FROM Employees e
        INNER JOIN Managers m
        ON e.EmployeeID  = m.ManagerID
)
SELECT ManagerID, EmployeeID, EmployeeLevel
FROM Managers

And here is magical result

ManagerID   EmployeeID  EmployeeLevel
----------- ----------- -------------
4           9           0
2           4           1
1           2           2
NULL        1           3

 With clause provide recursive execution over the table row which gives this magical result. Hope you may like it.

Finding Zip code list within specified miles

SQL 1 Comment »

I was just working around to get list zip code within 25 miles of radius for given address. I have database table for Zip Codes with below columns.

  • "zip" - Store zip code
  • "zip_latitude" - Store latitude
  • "zip_longitude" - Store longitude

I have created MS SQL function which returns sql table object with list of all zip codes within specified radius in which you might interested.

 

Read more...

CFPOP with SSL support

ColdFusion , customtag 1 Comment »

Coldfusion custom tag using CFPOP tag which allow to access pop3 account with and without SSL support.

Read more...

Powered by Mango Blog. Design and Icons by N.Design Studio | Menu Apycom
RSS Feeds