Posts

Showing posts from June, 2013

CodeIgniter: Call multiple queries from a MySQL stored procedure

If you are using CodeIgniter and wondering how are you going to execute such queries multiplied in greater than 1 times. So let say you have this MySQL stored procedure, DELIMITER // DROP PROCEDURE IF EXISTS multiples;// CREATE PROCEDURE multiples( param1 INT, param2 INT ) BEGIN SELECT * FROM table_a where key=param1; SELECT * FROM table_b where key=param2; END; // Now, your main goal is to grab the result set that the selection from table_a and table_b will be fetched. MySQL has the ability to fetch multiple queries in a stored procedure  (or see http://dev.mysql.com/doc/refman/5.7/en/c-api-multiple-queries.html). Now in CodeIgniter, I'll just have a simple snippet here, public   function  getMultipleQuery ( )   {              $k   =   0 ;              $arr_results_sets   =   array ( ) ;              /* execute multi query */              if   ( mysqli_multi_query ( $this -> db -> conn_id ,   'CALL multiples(1, 1)' ) )   {        

CodeIgniter: Using Data Abstraction Layer (DAL)

Image
I just wanted to show how we do using a DAL to separate database queries from application layer business logic.

Applications That Help You Distressed From Work and Help Productivity

I was just realizing that I might have been just too much of work or too much of doing leisure time and keeps my energy drain doing it in front of my computer. Anyhow, I wanna share this some applications that might be helpful (by the way, I'm using Mac OS X so these apps are for Mac OS X mostly). https://itunes.apple.com/us/app/time-out-free/id402592703?mt=12 http://iamfutureproof.com/tools/awareness/ http://tech.inhelsinki.nl/antirsi/ This tool also can give you room and comfortability when reading some articles that has lots of ads or stuff that can take out our attention. http://www.readability.com/

Understanding how a recursion really works (recursion from the ground up)

Image
If you're into programming and really have problem on such algorithm that you wanted to implement, however requires a recursive call (or can be an iterative call --but we'll discuss on recursion for this topic). Take note on recursion that they are, using much more memory than using iteration because it copies or clones the elements in the function that tries to recurse. So it makes new copies of: the code local variables with its initial variables paramaters it's more expensive as it retains clones into the memory which I am pertaining the variables, params, code in the stack it's usually slower due to overhead in maintaining the stack Each copy of the code includes a marker indicating the current position. When a recursive call is made, the marker in the old copy of the code is just after the call; the marker in the "cloned" copy is at the beginning of the method. When the method returns, that clone goes away, but the previous ones are still t