Friday, October 29, 2010

mySQL 5.5 RC - 1500% Faster on Windows

If you are running mySQL in windows then this is good news to you! I received an email from Oracle regarding the release of mySQL 5.5 RC which they are stating that it runs 1500% faster now on windows. They stated the following performance gains:

  • 1561% Performance Gains over MySQL 5.1 for Read/Write Operations
  • 538% Performance Gains over MySQL 5.1 for Read Only Operations

To learn more about mySQL 5.5 on windows, click here to get the "Guide to mySQL on Microsoft Windows" and click here to download the 5.5 Release Candidate.

Thursday, October 28, 2010

Get the old iTunes Back

This is a little tip I read this month from my MacWorld subscription that I thought would be great to share. Basically iTunes 10 adds many new features with one of them being a little controversial and that is the 3 little buttons we use to minimize, maximize and close. Unlike all other windows in our beloved OS X which show them horizontally, they decided to go vertical for this version. But if that is driving you crazy there is a solution!!!
Open up Terminal (Applications>Utilities>Terminal.app) and type the following to go back to the old way.
When you restart iTunes you will see the buttons once again appear horizontal and you actually get a little more space on the top bar (which is handy if you tend to move iTUnes around a lot as it gives you more pixels to grab).
If you feel like you've become accustomed to the new way and want to go back, it is easy. Just type the following in Terminal and restart iTunes.

Tuesday, October 26, 2010

Extra white space when executing a UDF in an input field

Well basically I have a UDF defined in my ApplicationHelper.cfm in my ColdBox app that formats phone numbers to a requested format. What use to drive me crazy is that when I ran it inside an input field like so:

I would get the following:

It appears that this happens because I did not have my output attribute set on my cffunction which defaults to true. Once I set it to false I no longer received that annoying extra white space.

Before

After

Which Output the following ...

Re-sort an existing Query without QoQ in ColdFusion

As I was looking today for a way to resort an existing query in my application, I though of the following options I had.

  1. Do a new call to SQL
  2. Create a QoQ and resort

Even though both options would work, I was unhappy with them. #1 because it is an additional call to the DB and #2 because I did not want to break out of my cfscript block. So I did a little googling and came up with the following post:

http://stackoverflow.com/questions/1166680/how-do-i-sort-a-query-object-in-coldfusion-7

Check out the 2nd post. Basically you can apply the underlying Java sort function to your query Object and it will sort it for you, Like so;

As per the original author of this hint:

The findColumn() call is needed to get the index of the sort column, because sort() is working with the column indexes and not with the column names. The second parameter specifies the sort order: TRUE = ascending, FALSE = descending.

  • Advantages: one-line call, faster than QoQ
  • Disadvantage: sort restricted to one column

There are much more hidden features of the underlying Java class. See the following links for more information:

Update 10.27.2010

I just wanted to add for all my ColdBox Friends or Newbies, remember we have a handy plugin available for us that does this and a bit more...

http://wiki.coldbox.org/wiki/Plugins:QueryHelper.cfm

Friday, October 22, 2010

Retrieving the Original URL in ColdFusion when doing URL Rewrites (IIS7 and Apache 2)

As I have stated before, I have begun to play with PHP and there is a server variable which I love that I was trying to get similar in ColdFusion and that is the following variable:

Basically that variable outputs the original URL before the rewrite. So if I requested the following URL:

http://mysite/this-is-a-test/something.html

Which rewrote to
http://mysite/index.cfm?{my query string that I build}

It would output /this-is-a-test/something.html

Which I thought it was fantastic! Now in ColdFusion, doing a simple CGI dump you do not get any variable with that value, but the servers have little secrets which I would like to share.

If you are using IIS7 you can use either:

  • HTTP_X_ORIGINAL_URL
    this server variable contains the original URL in decoded format;
  • UNENCODED_URL
    this server variable contains the original URL exactly as it was requested by a Web client, with all original encoding preserved.

Click here to read more @ IIS 7 Docs

Both of this can be accessed thru the cgi scope, even though they do not appear when you do a dump.

If you are using Apache 2 (which is what I have on my mac) you can use:

  • REDIRECT_URL

Click here to read more @ Apache 2 Docs

Thursday, October 21, 2010

An Easy Bash Shell Script to Start and Stop ColdFusion, mySQL and Apache

Well I normally do my development on my mac with code on a mounted Volume from a windows server, which is where my CF or PHP servers are running. From time to time though, I develop directly on my mac and since I don't keep my CF, Apache and mySQL running by default, I created 2 simple scripts I thought I would share with everyone here.

I called my 2 scripts cfstart.sh and cfstop.sh, when creating these files make sure to either do it on pico, vi or an editor that lets you save in unix style line breaks not windows(dos) style. Also, once you save them make sure to run chmod +x on the files to mark them as executable.

cfstart.sh

cfstop.sh

Once you are done you simply run them by typing the following in a terminal window on the folder where the files are located:
./cfstart.sh

Before it executes, it will ask for your password and this is because I added the sudo call which allows the applications to start under root, which is what you want.

Wednesday, October 20, 2010

Back to Mac Event

Today another wonderful Mac event occurred with a couple of cool new things coming in the near future and even available today.

To start FaceTime for Mac!
How cool is this? Today it is available as a beta download. You need a couple of things to try it out - a mac and either an iPhone 4 or a new iPod touch.

Find out more here:
http://www.apple.com/mac/facetime/

How about the Mac App Store!
Again, I think this is great and if all my mac app vendors get their apps up there it will make it easier for me to keep my apps up to date. I love it!

Find out more here:
http://www.apple.com/mac/app-store/

A Lion is heading our way!
Well the rumors where correct, the next OS X release will be called Lion.

Find out more here:
http://www.apple.com/macosx/lion/

Even though it is great to read and find out more with the links I provided, I recommend watching the event video, available at:
Back to Mac event

Some other updates include updates to the MacBook Air.

Thursday, October 14, 2010

WordPress Redirects not working on Firefox and IIS installations

Basically I was getting this problem on wordpress 3.0.1 on IIS7 installs. On any other browser a redirect would work perfect except firefox. Which redirects you may ask? Well for instance,

  1. going to /wp-admin/ landed on a white page rather than redirecting to wp-login.php
  2. from the login it would just freeze on a white page after hitting the log-in button

So what did I do? I traced the function call and saw that it ends in /wp-includes/pluggable.php on line 874 function qp_redirect and within this function there is the following lines of code

As you can see the $is_IIS if, this is what basically runs when the install is on IIS. and that particular header() call is not responding with firefox so I added another rule to the if statement to only run if it is on IIS and is nto firefox as follows:

Tested and it works without a problem. Hope this helps anyone cause it was driving me NUTS!

Tuesday, October 12, 2010

Weird Characters in my PHP Template ()

Well this is a quick note for anyone that may be having this little particular issue. Basically, for the past day I've been working on a PHP/mySQL/IIS7.5 on Windows Server 2008 R2 install. Which has been a little bit of a challenge and I will blog some of my findings soon.

Basically, I was making an edit to files on the server using notepad++ and it appears it was saving the file as UTF-8, which is what I presumed was correct but after reading the following entry I changed it to UTF-8 without BOM and it went away.

This is Byte Order Mark of the Unicode Standard and in PHP files they appear as literal text on the page. So just remove the BOM when you save and presto! Gone!

Original Post where I was schooled:
http://forum.joomla.org/viewtopic.php?t=275353

PHP and MySQL Web Development (4th Edition)

Learning PHP, MySQL, and JavaScript: A Step-By-Step Guide to Creating Dynamic Websites (Animal Guide)