MySQL Case sensitive and Case insensitive search with Match and Like

This post teaches you how to set your MySQL search queries to be Case sensitive or case insensitive.

It's all in the database collation. MySQL by default search case insensitive. In phpMyAdmin or or Putty change the Collation of your fields. Collations that are binary search case-sensitive. Collations that end with _ci like latin1_swedish_ci are case insensitive (ci is an acrynm for case insensitive.

To change your Collations quickly run this code in a loop:

ALTER TABLE tablename CONVERT TO CHARACTER SET latin1 COLLATE latin1_swedish_ci;

Subaru WRX Cobb Accessport V2 Review - 2004 Subaru WRX

Cobb AccessportCobb AccessportCobb Accessport
So I understand this may deviate from the usual geekdom found here but we’re car nerds too and well this applies. I drive a 2004 Subaru WRX. It comes with a turbo’ed 4 cylinder boxer engine with 227 HP and 217 TQ at the crank. So I purchased a Cobb Accessport for my 2 liter engine. http://cobbtuning.com/products/?id=3264 This is an ECU map loader and reprogrammer. On a stock WRX it promises 30HP and 43TQ on a 2004 WRX. This is a huge difference and while you get more power most people have reported smoother acceleration and actual better gas mileage under normal use. The device isn’t cheap at $695 but the build quality and service that comes along with it are excellent.

Using the Accessport is unbelievably simple. There are two green plugs under the driver’s side dash that you need to connect to enable “Test Mode”, then using the supplied jumper connect one more plug. The accessport plugs into the OBDII port on the car and then fires up. The accessport automatically backs up your current ECU configuration and then allows flashing of a new map. It comes preloaded with a few maps and then there are many more on Cobb’s site that are available, and can be loaded via USB.

The list of features for this device is crazy, not only can it load maps and flash the ECU, it has maps for high gas mileage, valet mode (i.e. no power) , theft mode (where the car won’t start) , Performance calculations for 0-60 and ¼ mile times, live data including --- boost, RPM, Coolant Temp, Intake Air Temp, MAF sensor, Ignition Timing, MPH, and many more I’m probably forgetting. Another great feature is the ability to view and clear CEL codes for the car. This saves a trip to the dealership/AutoZone and also is indispensable when modding a car, just to see if you screwed up.

I flashed the Stage 1 map for 93 octane and the entire process took under 10 minutes. Immediately when I started it up it idled really rough so I let it run for 15 minutes or so and it seemed to even out. There was a definite performance difference and I could tell this was well worth the money. After a few days of driving it continued to improve and the car runs better, shifts cleaner under heavy acceleration, and accelerates faster. I’ll check back in after a week or so because it is supposed to continue to improve and relearn the fuel curves as I drive.

Pics-
Accessport
Accessport In box
Accessport In box 2
Accessport - Wiring This picture shows the underside of the drivers side dash. The bright green connector you see on the right is the connector that needs to be plugged in to enter "Test Mode" and the black connector you see right next to it is the one that needs to be jumped in order to flash the ECU.

Accessport - OBDII This is the Cobb connector plugged into the OBDII port, you can see the mini-usb plug on the bottom for connecting to the unit.

Accessport - Flashing This shows the Accessport all plugged in to the OBDII port using the connector in the last pic. You can see the change map screen to choose what gets flashed to the unit.

Accessport - Live Data Here you can see the live data view. Leaving the Accessport plugged in while driving allows you to monitor a wide variety of stats through the ECU. Here you can se the Air/Fuel ratio as I'm sitting idling.

How to remove the file extension: Stripping the String, PHP substr() function

Striping the file extension is valuable on many levels. If i could have a nickel for every time I need to strip the file extension I'd have close to 3 bucks. One method to achieve stripped extensions is the PHP substr(), which takes in the String, Starting point, Ending point. To start from the end of the string use negative values. i.e. substr("my chicken", 0, -2) would make it "my chick", perfect

<?php

$my_file = "foobar.jpg";
$my_file= substr($my_file, 0 , -4);
echo $my_file;

?>

Result: foobar

Note: Spaces count, so count them!

Display Wordpress Post Number on Single Page with post ID

You can see it work throughout this wordpress blog, to the right you see DCE Article 94. Notice you can select the number as text. The number is pulled from the post on every single page by placing this line of code in your wordpress single.php template page.

<?php the_ID(); ?>

Note: When using this line of code be sure it is between these two lines of code in your single.php page

<?php if (have_posts()) : while (have_posts()) : the_post(); ?>

<?php endwhile; else: ?>

I place the code in its own div with a background image to create the illusion of unity. I use margins to move the number to the right spot of the image. My CSS and Code looks like this.

<style>
#page_number_id_spawn { float:left; text-align:right; margin-top:240px; width:135px; color:#900; font-size:30px; font-family:Georgia, 'Times New Roman', Times, serif;}</style>

<div id="page_number_id_spawn"><?php the_ID(); ?></div>

Spammers causing inaccurate Bounce/Exit Rates in Google Analytics - Ban Ip Ranges

My letter to Google:

I've recently been revamping my site, from studying the analytics i'm getting a high bounce rate because a great deal of my visitors spend 0.00 time on the site with 100% bounce and exit. These visitors are usually from outside the US. I run wordpress as my CMS, I know there is spam problem from people wanting to post comments with advertisements. I have blacklist set up to prevent this the posting, but they still are registering as hits. How can i prevent the spammers from effecting my Analytics data?

The solution:

Create a filter for excluding IP addresses from your data. You can create filters that block a large number of IP addresses that you receive spam data from. You have also mentioned that these visits are mostly from outside US. For this, you may consider creating filters to exclude data from a geographic region.

The filter to exclude all data from an IP address works to exclude clicks from certain sources. You can enter a single IP address, or a range of
addresses.

To create a custom Filter

Prevent inaccrate Analytics data by blocking spammers1. Log in to Google Analytics.
2. Click 'Filter Manager.'
3. Click 'Add Filter.'
4. Enter a 'Filter Name.'
5. Under 'Filter Type' choose 'Custom Filter.'
6. Click 'Exclude' and within 'Filter Field' choose 'Visitor Geographical
Region.'
7. Enter the appropriate filter pattern.
8. Apply this filter to the appropriate 'Website Profiles.'
9. Click 'Finish.'

You can figure out what IPs to block by check your map overlay in Analytics. Display the full list of countries, pick out the countries with 00:00:00 time on your site, and block that countries IP range.

My offenders this month are: Turkey, Russia, Greece, Ireland (which makes justsherlock sad), Mexico, Switzerland, Portugal, Brazil, Singapore (not a country), New Zealand, Bulgaria, Vietnam, Spain, Czech Republic, and it goes on.

Since these aren't justherlock's myspace girlfriends we can block them. Lets start with my girlfriends in Turkey, then Russia.

Here is a link to all the IPs to ban: IP Ranges for TR [Turkey]
Below is an example of the code produced when using a range of IPs from that list and this Google tool: IP Ban Tool

^217\.195\.(1(9[2-9])|2(0[0-7]))\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))$

For Russia the list gets larger: IP Ranges for RU [Russian Federation]

From writing this article and seeing the work, it doesn't seem worth its weight in labor, so you welcome to do it (post your results). I ended up just banning my own IP so I do not skew the numbers. What I'm considering doing is taking these IP country lists and Banning them through my .htaccess file. USSR you win.... for now!

HTML POST PHP Array Debbugging code that tests passing variables

Great PHP code that displays how the arrays break down when passing from HTML forms to $_POST variables.

echo "<pre>";
print_r ($_POST);
print_r ($_FILES);
echo "</pre>";

This helps when juggling multiple files or big database entries.

New Design for DCE: SEO, Legibility, 1024 Screen Design

Please note, the site will look funky between Saturday Feb 23rd 6pm Eastern - Sunday Feb 24th 6pm. During this time we will keep the content legible, but the navigation system maybe be shaky. Please comment to help out!

Changes are going to revolve around overall legibility and typography, smarter advertisements, more contrasting color scheme, usability, 1024 screen design, and a big SEO package.

With the last DCE 0.9 design we averaged 900-1000 hits on a 30 days rotation. In the next 30 Days I will post the numbers back on this Page.