Pages

Friday 16 July 2010

DISP_E_OVERFLOW

When working with Interop Excel, is better to read values from a given cell by using mySheet.Range("A2").Value2 instead of mySeet.Range("A2").Value. This is because when a cell is not displaying the whole content, for instance "######" the property Value will throw the exception DISP_E_OVERFLOW, but when you are using Value2 you will get the actual value inside the cell rather than the value displayed on the screen.

Thursday 15 July 2010

Setting up Django

I am currently beggining to work with Django, I followed the tutorial but in the second part, when trying to run the admin/ page, I get the error:

name 'admin' is not defined

Later I noticed that the tutorial shows how the file urls.py should look like, and that there three lines uncommented:


from django.contrib import admin
admin.autodiscover()

(r'^admin/', include(admin.site.urls))


I was missing the first two lines.

Friday 9 July 2010

Get Query String Using Javascript

Weeks ago I needed to get queystring parameters using JavaScript. I found a function called querySt(), this function is quite useful but I added an extra line that returns the string "undefined" in the case that the requested parameter does not exists in the querystring. My final code is:

function querySt(ji) {
    hu = window.location.search.substring(1);
    gy = hu.split("&");
    for (i = 0; i < gy.length; i++) {
        ft = gy[i].split("=");
        if (ft[0] == ji) {
            return ft[1];
        }
    }
    return "undefined";
}