Small Footprints - Eco Community

Small Footprints | www.smallfootprints.com.au| Ways to minimise your footprint on the earth.
Welcome to Small Footprints - Eco Community Sign in | Join | Help
in Search

Smallfootprints Tech Blog

Tech Info I find useful in my everyday life as a programmer/designer/developer.
  • Fckeditor for Microsoft ASP won't upload large files - Solution in IIS Metabase - AspMaxRequestEntityAllowed

    I came across an interesting problem where a site I created that used the popular wysiwyg html editor 'fckeditor' that was integrated to classic asp on a Microsoft platform, had problems uploading large files.

    The upload facility built in to the editor allows you to upload files such as images, pdfs etc. I had reports that it wasn't uploading pdfs so I did some testing. Evidently trying to upload a file larger than 200kb would result in the page continuing to show that it was uploading whilst the page had clearly stopped loading. The file attempted to upload never appeared in the file list. Hmm.

    A bit of searching found that the problem was due to an IIS setting of the new server the site had moved to. Fckeditor uses an ADODB Stream to perform uploads and therefore is limited by a limitation on ASP upload limits. Components such as ASPUpload shouldn't be affect by this problem. In IIS 6 (Windows 2003 Server) you can increase the maximum upload file size in the IIS Metabase. The Metabase is an XML file that controls many aspects of an IIS installation. The AspMaxEntityAllowed figure has been place at 200kb to prevent DDOS attacks but can be increased.

    Luckily I had control of the IIS settings. If you do too and then perform the following tasks. Otherwise request your web host to perform this for you.

    1. Go to Administrative Tools -> Internet Information Server
    2. Right-click your server name and click properties.
    3. If the box labeled "Allow changes to MetaBase configuration while IIS is running" is not ticked, then tick it and click "OK"
    4. Go to "c:\Windows\System32\Inetsrv\" and open "MetaBase.xml" with notepad.
    5. Find (CTRL+F) the "AspMaxRequestEntityAllowed" - it is the maximum bytes able to be uploaded. Set it to a higher figure for example for 2mb set it to "2097152"
    6. Save the file. If it will not save you might need to restart IIS or possibly even reboot before attempting the change again.

    You should be right to go immediately after saving the file. It will not require an IIS restart. Upload a larger file through fckeditor and it will arrive in your upload directory as the smaller files were.



  • Bulk Deleting - Drop All Stored Procedures,Views,Schemas,Functions and Tables from SQL Server 2005

     

    One of the problems I had when setting up Community Server 2008 was that my attempts to move from a local instance of SQL Server Express 2005 to SQL Server 2005 initially failed. I was left with a half installed instance of CS 2008 and could not remove the database and re-create as it was in a hosted environment.

    A bit of web searching turned up an elegant solution that saved me heaps of time. Hope it works well for you too!

    Simple Table Only Bulk Delete

    If you only want to drop tables from your database, not the whole structure, then the procedure sp_MSforearchtable comes in handy

    exec sp_MSforeachtable "DROP TABLE ? PRINT '? dropped' "

    Bulk Delete Tables along with Stored Procedures / Views / Schemas / Functions

    I found a blog by Patrick Galluci (visit) who took csome original code that deleted only stored procedures and views, and extended it to include schemas and functions. I found Patrick's code was much more successful at removing views and sp's due to the fact that it also removes schemas. Run the following code in a query through Enterprise Manager and then run the stored procedure usp_DropSPFunctionsViews to remove all the unwanted structures.

     create procedure usp_DropSPFunctionsViews
    as
    -- variable to object name
    declare @name  varchar(1000)
    -- variable to hold object type
    declare @xtype varchar(20)
    -- variable to hold sql string
    declare @sqlstring nvarchar(4000)
    declare SPViews_cursor cursor for
    SELECT QUOTENAME(ROUTINE_SCHEMA) + '.' + QUOTENAME(ROUTINE_NAME)
    AS name, ROUTINE_TYPE AS xtype
    FROM
    INFORMATION_SCHEMA.ROUTINES
    UNION
    SELECT QUOTENAME(TABLE_SCHEMA) + '.' + QUOTENAME(TABLE_NAME) AS
    name, 'VIEW' AS xtype
    FROM
    INFORMATION_SCHEMA.VIEWS

    open SPViews_cursor
    fetch next from SPViews_cursor into @name, @xtype
    while @@fetch_status = 0 
    begin
    -- test object type if it is a stored procedure
       if @xtype = 'PROCEDURE'
          begin
            set @sqlstring = 'drop procedure ' + @name
            exec sp_executesql @sqlstring
            set @sqlstring = ' '
          end
    -- test object type if it is a function
       if @xtype = 'FUNCTION'
          begin
            set @sqlstring = 'drop FUNCTION ' + @name
            exec sp_executesql @sqlstring
            set @sqlstring = ' '
          end
    -- test object type if it is a view
       if @xtype = 'VIEW'
          begin
             set @sqlstring = 'drop view ' + @name
             exec sp_executesql @sqlstring
             set @sqlstring = ' '
          end
     -- get next record
        fetch next from SPViews_cursor into @name, @xtype
      end
     close SPViews_cursor
    deallocate SPViews_cursor
    GO

Powered by Community Server (Non-Commercial Edition), by Telligent Systems