Archive for January, 2010
Book Review: MySQL Stored Procedure Programming
Posted by: | CommentsI’ve been using MySQL for almost 7 years now without realizing it had stored procedure capabilities. So when I saw MySQL Stored Procedure Programming, by Guy Harrison with Steven Feurerstein, I decided to take the opportunity to advance my skills with MySQL. It’s a pretty good sized book, and it took me a while to get through it because it’s just one of those books you have to keep putting down.
That’s a good thing in my opinion, because it means the material is so interesting that I can’t read for more than a chapter without getting on the computer and trying it out. The first chapter was a tutorial, I thought I knew everything after I had gone through it and it took quite a bit of discipline (as well as a few error messages) for me to get back to the book and go through the topics.
There are three things I especially like about the book.
First was the additional coverage on triggers and transactions. After reading this I feel like I haven’t really used MySQL at all– having never used stored procedures, OR transactions, OR triggers. They were all topics that have been immediately applicable to my projects, because they were needed somewhere I just didn’t realize I could do them.
Second was the discussion of the material in the context of sound software engineering principles. I always enjoy a refresher in those, and when I’m learning a new technology that’s usually when I need it most because I’m ready to hack everything together in my excitement. For example, there’s an entire chapter on “Creating and Maintaining Stored Programs” as well as som optimization material and a discussion of best practices.
Third was their treatment on using stored procedures with specific programming languages. These may some day go out of date, but they had chapters devoted to showing how to use stored procedures from PHP, Java, Perl, Python, and .NET. All of which are relevant 4 years after publishing.
This book was an excellent choice for someone who has database experience, and some stored procedure experience (Oracle). Even if you’re only familiar with the basics of MySQL, you will benefit from this book. And it isn’t at all over the head of anybody with some database programming experience. My only regret is that I didn’t find this book 4 years ago when it came out.
Book Review: Apache Cookbook
Posted by: | CommentsI was expecting to learn a little about Native American cuisine when I ordered Apache Cookbook, 2nd ed., by Ken Coar and Rich Bowen. I was disappointed in that respect, but I still found ample material to digest…
On a more serious note, I enjoyed reading this book and I learn a lot of new information about the Apache web server. I usually enjoy reading code cookbooks because their layout and organization facilitates skipping what you already know and getting onto things you don’t. I would consider myself an intermediate level Apache administrator, and I was able to get through the entire book in a single evening. I made notes on some of the recipes I found most interesting, and that I’m actually going to try implementing. I’ll list some of them here so you can get an idea what kinds of things you might learn if you read this book:
- Recipe 3.19 – Logging activity to a MySQL database
- Recipe 5.16 – Redirecting all- or part- of your server to SSL
- Recipe 5.17 – Turning Directories in to Hostnames
- Recipe 5.22 – Turning URL segments into Query Arguments
- Recipe 6.21 – Protecting files with a wrapper
- Recipe 6.33 – Using permanent redirects to obscure forbidden URLs
- Recipe 10.9 – Load balancing with mod_proxy_balancer
- Recipe 11.2 – Benchmarking Apache with ab
These were the topics that interested me most, but there are quite a few others that I’d like to play around with when I’ve got more time. Intermediate users can definitely skip the first 2 chapters which covers installing Apache on a number of platforms, and enabling certain mods. I highly recommend chapter 5: Aliases, Redirecting and Rewriting, that was one area I am particularly weak in and was able to get a lot of information out of it. Also helpful was Appendix A, which gives a concise refresher on regular expressions for those of you like me, who re-learn regular expressions every time you need one.
Overall I highly recommend this book. It’s not as comprehensive or as in depth as others I’ve browsed, but it is definitely dense with useful information about stuff you either didn’t know you could do with Apache, or weren’t quite sure how to do it.
Running IIS 6.0 and Apache Together
Posted by: | CommentsMy ColdFusion VPS runs IIS 6.0 on Windows Server 2003. I wanted to run Apache 2.2 on this server as well, and bind it to the IP address that IIS 6.0 wasn’t using. I opened the IIS management console to force IIS to listen on a single IP address, but when trying to start Apache I received an “already in use” error. I double checked that IIS was configured to listen on one IP address, and Apache was configured to listen on the other. Then I tried several variations of service startup order, etc, still without success.
Let me explain my requirements clearly: I wanted IIS and Apache to each use port 80 of different IP addresses. Before you leave a comment explaining I could have had them listen on different ports– I know that, but it’s not what I wanted.
My research lead me to this Microsoft knowledgebase article: http://support.microsoft.com/default.aspx?scid=kb;en-us;259349 which referenced IIS 5.0, but I assumed was relevant. The crux of the matter is this: “To enhance performance, IIS 5.0 uses “socket pooling”, in which IIS binds to all IP addresses when it starts.” Yep, you read that correctly. Regardless of the settings you made in the IIS console, it will bind to ALL available IP addresses.
The workaround in the article is as follows:
- Change to the C:\Inetpub\AdminScripts directory.
- Execute the following command:
CSCRIPT ADSUTIL.VBS SET W3SVC/DisableSocketPooling TRUE
Apparently there are some differences between IIS 5 and 6, because this didn’t correct the problem. Fortunately I was able to discover something that worked by browsing around a few other sites.
First, you need to install the Support Tools from the Windows Server 2003 cd. This includes the httpcfg.exe tool, which is what you can use to force IIS to listen only on specific IP addresses. After you have this installed (there is a start menu option that will open up a command prompt in the correct directory) here are the commands to make the fix:
net stop http /y(This stops IIS)httpcfg.exe set iplisten /i 10.0.0.2:80(You must specify the port! Or it will still steal them!)net start w3svc(Restart IIS)- Start up Apache
I wasn’t able to find any documentation explaining why it didn’t work when I didn’t specify the port. I guess IIS needs very specific rules when it comes to getting along with other HTTP servers. I have yet to have this problem with IIS 7.0, mainly because I haven’t tried installing Apache on my Windows 2008 box. When I try it, I’ll keep you posted as to whether this fix still works. Or if it’s required… which I’m sure it is since it’s not a bug, it’s a performance enhancer. I wonder if Microsoft’s STMP service uses a similar “mail enhancement” feature to grab all port 25s?

