SQL Studio Management Expand Databases Slow

by Joe Payne 14. April 2014 10:53

So on my development PC, I’ve noticed that it takes 2-3 minutes for the Databases node to expand in my SQL Server Studio Management 11.0.2100.60

I don’t remember exactly when it started.   But it’s been several months I think.  It was just too easy to ignore since I could alt-tab and do something else while it worked through the delay.

Today I decided to research it and determined it’s because some databases have auto_close turned on.   This causes the SQL server to have to start up the database before it can render it in the Databases node.    This creates the significant delay when you have several databases configured for auto_close.

A quick way to fix all of them at once time AND set recovery mode = simple (anything more is useless in my dev environment), use this query:

USE MASTER
declare
    @isql varchar(2000),
    @dbname varchar(64)
    
    declare c1 cursor for select name from master..sysdatabases where name not in ('master','model','msdb','tempdb')
    open c1
    fetch next from c1 into @dbname
    While @@fetch_status <> -1
        begin
        select @isql = 'ALTER DATABASE @dbname SET AUTO_CLOSE OFF'
        select @isql = replace(@isql,'@dbname',@dbname)
        print @isql
        exec(@isql)
        select @isql = 'ALTER DATABASE @dbname SET RECOVERY SIMPLE'
        select @isql = replace(@isql,'@dbname',@dbname)
        print @isql
        exec(@isql)
        select @isql='USE @dbname checkpoint'
        select @isql = replace(@isql,'@dbname',@dbname)
        print @isql
        exec(@isql)
        
        fetch next from c1 into @dbname
        end
    close c1
    deallocate c1

Tags: ,

Personal | Tech Support

Wordpress file upload size HTTP 404 error greater than 1mb IIS 7.5

by Joe Payne 3. October 2013 10:52

A default install of Server 2008 with IIS 7.5 will force Request Filtering to 1000000 bytes.   That’s 1mb.

So a non asp.net website (i.e. PHP only) will always be limited to 1mb upload size.

This assumes you’ve already updated your PHP.ini with the appropriate size limits as widely documented on the internet.

To fix this, click on your website in IIS Manager.  In the IIS section of the website, double-click Request Filtering.

Now, on the right side click Edit Feature Settings.   There you will find the default limit of 1mb (in bytes), change it to something larger.   Restart the site.

Tags: , , , ,

How to find the Postback URL for an ASP.Net page

by Joe Payne 29. February 2012 21:24

Some things are far more simple than you expect.  And far less documented than they should be.

All I want to know is what URL will the page post back to when a submit is fired.  It’s a simple thing.  It shouldn’t take me 45 minutes to find it in Google.  Well it did.

Finally, I found my answer.

Open the page source for the page in question. Find the <form> tag.

<form name="aspnetForm" method="post" action="/Checkout/Payment.aspx" onsubmit="javascript:return WebForm_OnSubmit();" id="aspnetForm">

The action attribute contains the URL where the form data will be posted to when you click on the button in the web page.

Tags: , ,

AC7 Articles | Personal

AbleCommerce how to handle sorting of GridView control

by Joe Payne 18. January 2012 23:25

Introduction

This article talks about manually handling the sorting routine of a GridView control.   When using an object class as the Datasource for a GridView control in AbleCommerce, the GridView control will not automatically manage sorting.  This only works when using a SQL-based DataSourceObject.

So you’re left with creating your own method to handle the Sorting event on the GridView control.  Not so tough, there’s plenty of programming code examples in Google.   What’s harder to find is an example that actually retains the previous sort order for each column.

Enter:  e.SortDirection.  It’s exposed in the Sorting event, but you need a way to store the previous sort order for each column so the routine knows which way to flip it (Ascending or Descending).  If you don’t handle it, clicking a column always results in an Ascending sort order.

Here’s a good piece of code that makes nice use of Viewstate:

protected void ProductsGrid_Sorting(object sender, GridViewSortEventArgs e)
{
    if (e.SortExpression == (string)ViewState["SortColumn"])
    {
        // We are resorting the same column, so flip the sort direction
        e.SortDirection =
            ((SortDirection)ViewState["SortColumnDirection"] == SortDirection.Ascending) ?
            SortDirection.Descending : SortDirection.Ascending;
    }
    // Apply the sort
    BindProductsGrid(e.SortExpression, ConvertSortDirection(e.SortDirection));
    ViewState["SortColumn"] = e.SortExpression;
    ViewState["SortColumnDirection"] = e.SortDirection;
 
}

Tags: , ,

AC7 Articles

AbleCommerce 7 how to sort a collection of products

by Joe Payne 18. January 2012 23:16

Introduction

Often times you find yourself working with collections of products while programming in AbleCommerce 7.  But, now you need to sort those products on a specific field and you’re not sure how.

Well it’s incredibly easy if you use the AbleCommerce object class ProductCollection.  The ProductCollection class has a convenient sort method that works on any field.

Remember that the example variable _ResultProducts is a ProductCollection object.  This technique does not work when using List<Product>

// sort the results
CommerceBuilder.Common.GenericComparer _MyComparer = new GenericComparer("Price", GenericComparer.SortDirection.ASC);
_ResultProducts.Sort(_MyComparer);

 

If you haven’t noticed yet, AbleCommerce search methods don’t always use ProductCollection as the return object.  Sometimes it’s a List<Product>.  If you need to sort a List<Product>, just copy the items to a ProductCollection object using a foreach() loop like this:

List<Product> _OldProducts = new List<Product>();
ProductCollection _SortableProducts = new ProductCollection();
// POPULATE YOUR _OldProducts //
...
// Now copy the products to a sortable collection
foreach (Product _Product in _OldProducts)
{
    _SortableProducts.Add(_Product);
}
 
// sort the results
CommerceBuilder.Common.GenericComparer _MyComparer = new GenericComparer("Price", GenericComparer.SortDirection.ASC);
_ResultProducts.Sort(_MyComparer);

Tags: ,

AC7 Articles

Month List