Logo Background RSS

Most Recent Articles

  • NameValueCollection databinding in asp.net
    By morefioo on November 13th, 2008 | No Comments Comments

      If it’s something I never seems to remember it has to be the different Request.ServerVariables. Recently I was doing some work for a client and needed to get the referer url and compare it to the clients domain name.   (more…)

    Share/Save/Bookmark

  • ASP.NET, MySQL and paging
    By morefioo on November 13th, 2008 | No Comments Comments

    In this article we will create a simple one page ASP.NET web application, implementing paging using the cool MySQL feature LIMIT and SQL_CALC_FOUND_ROWS.

    One of the coolest things about MySQL is some of its non standard features. It might sound like a weird thing to say, but being a web developer I just love the simplicity and performance MySQL gives me when it comes to paging. Cause in the typical web app you need paging.

    (more…)

    Share/Save/Bookmark

  • Get current page name in ASP.NET
    By morefioo on November 13th, 2008 | No Comments Comments

    This function can be used to retrieve the current page:s name, i.e default.aspx, hello.aspx or whatever.

     
    public string GetCurrentPageName()
    {
        string sPath = System.Web.HttpContext.Current.Request.Url.AbsolutePath;
        System.IO.FileInfo oInfo = new System.IO.FileInfo(sPath);
        string sRet = oInfo.Name;
        return sRet;
    }

    By going through System.Web.HttpContext.Current object we are able to have this function in a generic dll or class - and not in each and every page needing to call it.

    Share/Save/Bookmark

  • Hibernate Querying 101 : tips and tricks
    By morefioo on November 11th, 2008 | No Comments Comments

    This article presents a few real-life tips and tricks for Hibernate querying. It is designed to be a ‘from-the-trenches’ account of the methods and best-practices we use and that we have found to work.

    background

    First a little background. We are currently working on a project using a JSTL / Struts / Hibernate / PostgreSQL stack. The application requires many PDF reports. For the PDF (and Excel) report generation, we use JasperReports. Maybe I’ll write another article on JasperReports some other time. But for now, I want to talk about the Hibernate queries.

    The reports tend to be complicated. So are the queries. The database is big enough to be slow if you don’t make your HQL queries slick and efficient. Why don’t we use plain old SQL queries for the reports? Well, if we did that, we’d loose the abstraction level we get with Hibernate, and the queries would be much longer and more complicated. Nevertheless, in practice, you do have to fine-tune each query individally in order to get the best performance, just as you would a plain old SQL query.

    (more…)

    Share/Save/Bookmark

  • Upgrading to ASP.Net 2? Why your website might stop working when you do.
    By morefioo on November 8th, 2008 | No Comments Comments

    Asp.Net version 2 was just recently released by Microsoft and contains a feature rich set of classes that can do just about anything imaginable. However if your thinking about hosting your asp.net 2 site on a shared hosting environment there are a few considerations you should know about before you take the plunge. If you have already upgraded you may be wondering why your site that was working fine in version 1.1 but now has problems working in Asp.Net version 2.

    (more…)

    Share/Save/Bookmark