Pingdom’s HTTP Custom Monitoring

Posted November 4th, 2010 in Database, Hosting, Internet, Linux, Operating Systems, PHP, Programming, Technology by Louie Miranda

Pingdom is a great company that focuses on your server’s health and I’ve been using them.

Then I found this excellent PHP script that Jon Stacey wrote on his blog.

pingdom-core.php

This is my core services check. It makes sure that web services and MySQL are operational. Simply configure the script with the username and password of a MySQL database. If the script cannot make a connection to the database server, then a ‘MYSQL DOWN’ status will be returned to Pingdom. Of course, if the script doesn’t respond at all, then the web service is down and Pingdom will report a down status.

pingdom-server.php

This script is intended to be an early warning system. It will raise the alarm if something looks out of the ordinary so that I can be prepared for a possible service failure. The following server vitals are checked: swap usage, hard drive usage, and cpu usage. If any one of these goes beyond the preset thresholds, a down status will be returned to Pingdom.

You might be thinking that checks like these could be done with a monitoring script on the server without using Pingdom at all, and there is merit to that argument. However, if you run out of memory and your system comes crashing to a halt, that probably means that services like email, which you would have used to alert yourself to the problem, would no longer be working. By performing these checks remotely, you can sleep a little easier. Plus, Pingdom will generate nifty looking graphs, and I like graphs.

pingdom.php –Added on 12/4/2009–

This script is a combination of pingdom-core.php and pingdom-server.php if you’re using the free acount

You can check his website for all the updates at http://jonsview.com/how-i-use-pingdoms-http-custom-feature.

CakePHP Fulltext Search with Pagination

Posted October 28th, 2010 in CakePHP, Database, MySQL, PHP, Programming by Louie Miranda

This is a working code that I was able to implement for my e-commerce application that uses cakephp full text search with pagination.

<?php
$this->paginate['Publication']['conditions'] = "MATCH(Publication.Code, Publication.Name, Publication.Language) AGAINST ('".$input."' IN BOOLEAN MODE)";
$this->paginate['Publication']['fields'] = "*, MATCH(Publication.Code, Publication.Name, Publication.Language) AGAINST ('".$input."' IN BOOLEAN MODE) AS score";
$this->paginate['Publication']['order'] = "score DESC";
$results = $this->paginate('Publication');
?>

Please make sure that you are using MyISAM on MySQL to fully implement this and you where able to set the full-text capability of the table.

I tried CakePHP Search Plugin

Posted October 28th, 2010 in CakePHP, Database, MySQL, PHP, Programming, Projects by Louie Miranda

So, I tried CakePHP Search Plugin on my current project that I am creating for an e-commerce website.

The search plugin is an easy way to include search into your application. Using this plugin you will able to have paginable search in any controller. Plugin support simple methods to search inside models using strict and non-strict comparing, but also allows you to implement any complex type of searching.

I’ve search my products table and id use the following types parameter.

  • like, This type of search used when you need to search using ‘LIKE’ sql keyword.
  • value, This type of search very usefull when you need exact compare. So if you have select box in your view as a filter than you definetely should use value type.

Overall, it is a great plugin. Although, it did not fit my current requirements for now. :( .  But, I will definitely use it in my future projects.

Have a look here: http://cakedc.com/downloads/view/cakephp_search_plugin

The Oracle Dream

Posted February 9th, 2009 in Database by Louie Miranda

I been thingking… hmmm… Maybe it’s time for me to learn Oracle and be a Oracle DBA five years from now, or maybe sooner! :)

I am now trying Sphinx

Posted December 5th, 2008 in Database, MySQL, PHP, Programming, Projects by Louie Miranda

Sphinx is a free open-source SQL full-text search engine. I am currently trying it on some of my projects. Hopefully, this will speed-up my MySQL full-text search.

http://www.sphinxsearch.com/features.html

Brinkster Problems

Posted August 26th, 2008 in Database, Personal by Louie Miranda

For the past three (3) straight weeks, our hosting provider for MAZDAtech is always experiencing database problem on their mysql6 server. And for those past weeks, I been trying to recover and recover the database.

Data Lost *&$@!~%^^*&&^$$*(89^%%%^

Posted May 10th, 2005 in Database, Hardware, MySQL, Programming by Louie Miranda

OH MY GO****, &^%%$$#!@$&amp;*(&*^, I just accidentally deleted my JobTracker Database. FU***** thats two weeks of work, and all along I knew I had included it on my daily SQL backup.

I figured when I checked my script. It was not there. :/

However, my life was saved when I remembered that I use to send a daily report every afternoon via Email. But, it will really take time to write all those stuffs again.

Im going to find a way.. :(

MySQL, Insert Select

Posted May 8th, 2005 in MySQL, PHP, Programming by Louie Miranda

I been working with a PHP function on how I can duplicate an entry on sql. My first approach was to use the while() function, but what it does was loop the entire process.

I posted at phpugph.com and ask them what they think, and they suggested the INSERT – SELECT of MySQL.

1
2
3
mysql> INSERT INTO jt_entry (uid,entry_requested_by,entry_status,entry_category,entry_title,entry_description)
select uid, entry_requested_by, entry_status, entry_category, entry_title, entry_description from jt_entry
where entry_id=3limit 1;

Query OK, 1 row affected (0.00 sec)
Records: 1 Duplicates: 0 Warnings: 0

Thanks!