Tuesday, May 29, 2012
Setup free web hosting and free web domain
We create great designs and great works but how do we display it online? Well, we could use online and easy to use blogging tools like blogger and wordpress, but sometimes we just don't like the domain name to contain .blogspot.com, or .wordpress.com. So here's the trick, you could purchase a domain name or just use free stuff like http://www.co.cc.
Wednesday, April 25, 2012
Makeup in Photoshop
Not everybody is gifted to have a beautiful picture perfect face that we most certainly want. Good thing there is Adobe Photoshop, a simple editting tool that we can use to enhance the picture that was taken. In this tutorial, we will be enhancing the face of Scarlett Johansson. Read on to find out how.
Tuesday, March 13, 2012
Remove SVN, Add SVN in Linux
There are times we just want to copy the source files and add it to SVN. The problem is, if we copy the whole folder, we also copy the SVN link. You could remove the ".svn" one by one, but then again, that would be REALLY tedious.
Saturday, March 10, 2012
Connect WAMP 2 server to PosgreSQL Database
For those who want to connect to PosgreSQL using WAMP as your server, just follow the procedure and you'll be ready to start!
Labels:
Apache,
configuration,
others,
php,
postgres,
Wamp Server
Tuesday, March 6, 2012
WAMP Server 2 HTTPS SSL Configuration
What I want to achieve is to send email from my localhost host to my gmail account. But since Gmail uses SSL encryption, I figured that I need to enable SSL of my WAMP server.
Labels:
Apache,
HTTPS,
openSSL,
SSL,
SSL Configuration,
wamp,
Wamp 2,
Wamp Server
Thursday, January 19, 2012
MySQL: MyISAM vs InnoDB
I was pondering what is the difference of MyISAM and InnoDB? They are both types of database in MySQL. For MySQL v5.4 and lower, the default is MyISAM; For MySQL v5.5 and higher, the default is InnoDB. What is their difference? How will I know what to choose? Choosing the right type is crucial in database designing.
Friday, December 16, 2011
Dynamic database connection in CakePhp
I encountered this scenario at work wherein I have the same logic, same structure but using different brands. The problem is their database name and connection is different. Below is the solution I found:
Step 1: Create your database connection in database.php
Step 2: Add this function to app_model.php
Step 3: Add this function to app_controller.php
Step 4: Add this to your model
After doing this, you'd be able to change your database connection as needed.
Step 1: Create your database connection in database.php
var $brandXConfig = array( 'driver' => 'postgres', 'persistent' => false, 'host' => 'localhost', 'login' => 'root', 'password' => '', 'database' => 'brand_x', 'prefix' => '', //'encoding' => 'utf8', ); var $brandYConfig = array( 'driver' => 'postgres', 'persistent' => false, 'host' => 'localhost', 'login' => 'root', 'password' => '', 'database' => 'brand_y', 'prefix' => '', //'encoding' => 'utf8', );
Step 2: Add this function to app_model.php
Class AppModel extends Model
{
function changeDataSource($newSource) {
parent::setDataSource($newSource);
parent::__construct();
}
}
Step 3: Add this function to app_controller.php
Class AppController extends Controller
{
function changeDbSource($database = 'default') {
$db = ConnectionManager::getInstance();
$connected = $db->getDataSource($database);
if($connected->isConnected())
return true;
return false;
}
}
Step 4: Add this to your model
function changeMyDb($brand)
{
if($brand == 'brandX') {
$this->changeDataSource('brandXConfig');
}
else if($brand == 'brandY') {
$this->changeDataSource('brandYConfig');
}
}
After doing this, you'd be able to change your database connection as needed.
Subscribe to:
Posts (Atom)