Windows 7/8/10 Install Error (0x80300024)

When installing windows on a multidrive/boot system you can sometimes get this rather cryptic error message. It relates to how Windows setup sees your Drive partitions. There are two was to solve it;

1) Disconnect all drives from your PC except the one you are installing Windows on.
2) Enter your BIOS and set the hard drive you are installing Windows on to be the top-priority drive.

Either of those should fix the error message.

Cakephp Tips – Sort Data With the Pagnator Component

If you wanted to sort a Model by a certain field in this case take the field “created” which is a date. We can simply tell cakePHP to pagnate entries by the order they were created by the following example.

	public function index() {
		
		// we prepare our query, the cakephp way!
		$this->paginate = array(
			'limit' => 20,
			'order' => array('created' => 'desc')
		);
		
		
		$this->Link->recursive = 0;		
		$this->set('links', $this->Paginator->paginate());
	}

More Examples can be found here;
https://www.codeofaninja.com/2013/07/pagination-in-cakephp.html

Cakephp 2.0 Tip# 14 File Uploads

cake-logo

Firstly you need to install the Plugin;
https://github.com/josegonzalez/cakephp-upload

In the Model of the object you want to allow uploads to(eg User,Product) add;

Model

public $actsAs = array(
        'Upload.Upload' => array(
            'picture'
        )
);

View:

In the View Form of this action add;

<div class="users form">

<?php echo $this->Form->create('User', array('type' => 'file')); ?>
	<fieldset>
		<legend><?php echo __('Add User'); ?></legend>
	<?php				
		echo $this->Form->input('picture',array('type' => 'file','accept'=>'image/*'));			
	?>
	</fieldset>
<?php echo $this->Form->end(__('Submit')); ?>
</div>

CakePhp 2 Tip #11- Force SSL Connection

cake-logo

In your app Controller add;

class AppController extends AppController {

    public $components = array('Security');

    public function beforeFilter() {
        if (isset($this->params['admin'])) {
            $this->Security->blackHoleCallback = 'forceSSL';
            $this->Security->requireSecure();
        }
    }

    public function forceSSL() {
        return $this->redirect('https://' . env('SERVER_NAME') . $this->here);
    }
}

More info:
http://book.cakephp.org/2.0/en/core-libraries/components/security-component.html