RATCHET

RATCHET Labs

10/18/2010

Elmah, Error logging module and handler

We have been using the module for the last few years and have really liked it.  It is easy to setup, log, secure all your unhandled/errors .NET  web applications.

You can find get the code from

http://code.google.com/p/elmah/

  • Facebook
  • Twitter
  • Digg
  • Print
  • email

10/18/2010

Global Permission Set Script for All Stored Procedures

Below is a script that I found that makes it very easy to set execute permissions to all all stored procs in a SQL Server 2005/2008 DB.

-- Set Username
DECLARE @U  sysname ; set @U = QUOTENAME('DB_USERNAME_HERE')
-- Set DB
DECLARE @DB  sysname ; set @DB = 'DB_NAME'
-- SET Schema
DECLARE @schema  sysname ; set @schema = 'SCHEMA_NAME'


DECLARE @ID           integer,
@LAST_ID     integer,
@NAME        varchar(1000),
@SQL         varchar(4000)

SET @LAST_ID = 0

WHILE @LAST_ID IS NOT NULL
BEGIN
SELECT @ID = MIN(id)
FROM dbo.sysobjects
WHERE id > @LAST_ID  AND type = 'P' AND category = 0

SET @LAST_ID = @ID

-- We have a record so go get the name
IF @ID IS NOT NULL
BEGIN
SELECT @NAME = name
FROM dbo.sysobjects
WHERE id = @ID

-- Build the DCL to do the GRANT
SET @SQL = 'GRANT EXECUTE ON ' +@DB + '.' + @schema +'.' + @NAME + ' TO ' + @U

PRINT 'setting execute permissions for: '+  @SQL
-- Run the SQL Statement you just generated
EXECUTE(@SQL)

END


END

  • Facebook
  • Twitter
  • Digg
  • Print
  • email

10/18/2010

Flash Fish Games

One of our developers wanted to learn  action script and flash.  He came up with this fish easting game.  Very cool!

Game is very simple, eat fish smaller than you so you can get bigger and eat more fish.

  • Facebook
  • Twitter
  • Digg
  • Print
  • email

10/18/2010

Flash Duck Hunt Game

A Duck Hunt game I wrote in flash over 10 years.

  • Facebook
  • Twitter
  • Digg
  • Print
  • email

10/13/2010

WordPress on Local Windows Enviornment with IIS 7

Not everyone has a UNIX environment available  and ready to go.  I spent some time trying to figure it out.  There is a really simple solution from Microsoft and the manual way is not too bad either.

Installer Package
The easiest way to install the following package from Microsoft. http://www.microsoft.com/web/gallery/WordPress.aspx

This will install, MYSQL, PHP, IIS7 Rewrite module, and  version of the  WordPress files.

Manual Setup

1. Install the following (latest versions of all)
- PHP (select fast CGI option)
- MySQL
- IIS7 Rewrite Module (http://www.iis.net/expand/URLRewrite)
- Word Press (download lates files, unzip in location for website)

2. Configure PHP.ini file
- Set display_errors = On
- Set SMTP =YOUR SMTP SERVER

3. IIS7
- Make sure CGI is enabled
- Add/Replace web.config file to root of web site.  This will handle the routing for permalinks(friendly URLs) with this configuration.

<?xml version=”1.0″ encoding=”UTF-8″?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<clear />
<rule name=”uploads” stopProcessing=”true”>
<match url=”\wp-content\.*” />
<conditions logicalGrouping=”MatchAll” />
</rule>
<rule name=”wordpress” patternSyntax=”Wildcard”>
<match url=”*” />
<conditions logicalGrouping=”MatchAll”>
<add input=”{REQUEST_FILENAME}” matchType=”IsFile” negate=”true” />
<add input=”{REQUEST_FILENAME}” matchType=”IsDirectory” negate=”true” />
</conditions>
<action type=”Rewrite” url=”index.php” />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>

4. MySQL
- Create new DB
- Create username/passwords for DB

5. WordPress
- Rename the wp-config-sample.php file to wp-config.php
- Update db connection info
- Browse to /wp-admin/install.php and follow instructions

  • Facebook
  • Twitter
  • Digg
  • Print
  • email

10/13/2010

SQL Row Count and Table Size Script

Here is a handy little script I found that dumps out all the tables in a SQL DB, their sizes and how many records.  Handy for debugging why your DB has gotten so damn big.

CREATE TABLE #temp (
table_name sysname ,
row_count INT,
reserved_size VARCHAR(50),
data_size VARCHAR(50),
index_size VARCHAR(50),
unused_size VARCHAR(50))
SET NOCOUNT ON
INSERT #temp
EXEC sp_msforeachtable 'sp_spaceused ''?'''
SELECT a.table_name,
a.row_count,
COUNT(*) AS col_count,
a.data_size
FROM #temp a
INNER JOIN information_schema.columns b
ON a.table_name collate database_default
= b.table_name collate database_default
GROUP BY a.table_name, a.row_count, a.data_size
ORDER BY CAST(REPLACE(a.data_size, ' KB', '') AS integer) DESC
DROP TABLE #temp

SQL Row Count and Table Size Script

  • Facebook
  • Twitter
  • Digg
  • Print
  • email

10/12/2010

Developers Developers Developers

Always a good motivator at the start of any development project.  Gets the sweat going!

  • Facebook
  • Twitter
  • Digg
  • Print
  • email