mrkeck Sharing the Love

26May/110

htaccess in WAMPServer

In the htaccess, I have "<IfModule mod_deflate.c>" so I just need to make sure mod_deflate.c is Loaded in the httpd.conf that Apache is using. Once I uncommented all the Loads that I needed my htaccess worked great!

Side note: I am using the htaccess from HTML 5 Broilerplate

Filed under: HTML, PHP, wamp, web No Comments
12May/110

MSSQL Performance

MSSQL 2000
Enterprise Manager=>Tools=>SQL Profiler=>New Trace
Let that run during as many combinations of normal activity so it can get a handle on all the ways you interact with the db. Once you feel you have enough(I usually let it run for an hour), stop it and save as a trace file.

Next open Index Tuning Wizard. Note: Everytime I try to open from SQL Profiler it says it can't connect.
Go to Enterprise Manager=>Tools=>Wizards=>Management=>Index Tuning Wizard
Load the Trace file you just made. Set what settings make sense to you. It will analyze the file and tell you what indexes need to be made. And it will also put them in place for you and tell you how much faster it will be. I did it today and it said it will be 43% faster. I'm pretty stoked!

Tagged as: , , , No Comments
12May/110

SQL Optimization

MSSQL
Ran this query in a table with indexes and 6 million records
select top 50 id from table1 where isBatched is null
Took 13 seconds.

select top 50 id from table1 where isBatched is null order by id desc
Took 0 seconds

All the records that are not batched are at the end of the table so it was able to do soooo much faster.
This appears to work this way on anything where all the results are at the end of the table.

Tagged as: , , No Comments
9May/110

Photoshop .ico plugin

http://www.telegraphics.com.au/sw/

Filed under: Photoshop, web No Comments
6May/110

PDO – COUNT field incorrect: 0

$stmt = $db->prepare("SELECT field FROM table where field=:batchNum and scan_time>CAST(FLOOR( CAST( GETDATE() AS FLOAT ) )AS DATETIME)");
 
$stmt->execute();

I forgot to bind something to :batchNum.

The error means that the number of expected bound variables does not match the number bound

Tagged as: , No Comments
6May/110

MSSQL Date Only from Timestamp

Check it out

CAST(FLOOR( CAST( GETDATE() AS FLOAT ) )AS DATETIME)

Tagged as: No Comments
6May/110

PHP Cool String Functions

$str="86216540";
$str=str_pad($str, 14, "0", STR_PAD_LEFT);  //00000086216540
$str=ltrim($str,"0"); //86216540

I thought trim only did spaces. Glad I was wrong!

Filed under: PHP No Comments
6May/110

SQLSTATE[HY010]: Function sequence error: 0

PHP PDO MSSQL ODBC.

If you have MS SQL datetime field using odbc and try to use parameterized inserts you get a sql sequence error.

I changed the field type to varchar and worked fine.

Bug Report

Tagged as: , , , , No Comments
6May/110

Commenting Trick

echo "Code I want";
/*
echo "some stuff I want to comment out";
//*/
echo "More codey code";

Notice the close of the comment. It has // in front. That is so when you want to uncomment all you need to do is get rid of the opening and the closing will already be commented out. It saves me from "Parse error: syntax error, unexpected '*' " and is quicker to uncomment later. No need to chase down the close.

Filed under: PHP No Comments
6May/110

Boot without keyboard

In BIOS, Main->Halt On->All but keyboard.

Saved me from having a bunch of random keyboards plugged in all over the place.