Catch ldap_bind(): Unable to bind to server: Invalid credentials
I used the tip from this page: http://bytes.com/topic/php/answers/600903-ldap_bind-warning-instead-false
“You can get around this if you supress warning and error messages by putting a @ in front of the function name:
$ldapbind = @ldap_bind($ldapconn, $ldaprdn, $ldappass);”
Yii Google Chart Extension
Here’s YiiWheel’s google chart wrapper extension: https://github.com/2amigos/yiiwheels/blob/master/widgets/google/WhVisualizationChart.php
I downloaded just the WhVisualizationChart file and put this in my view:
$this->widget('ext.WhVisualizationChart', array(
'visualization' => 'PieChart',
'data' => $chartDataProvider,
'options' => array(
'pieHole'=> '0.5',
'backgroundColor'=>array('fill'=>'transparent'),
),
'htmlOptions'=>array('style'=>'width:100%; height:375px'),
));
and this in my controller:
public function actionIndex()
{
$chartDataProvider = array(
array('Task', 'Hours per Day'),
array('Work', 11),
array('Eat', 2),
array('Commute', 2),
array('Watch TV', 2),
array('Sleep', 7)
);
$this->render('index', array('chartDataProvider'=>$chartDataProvider));
}
Examples on how to use it are at the bottom of this page: http://yiiwheels.2amigos.us/site/charts#visualizationchart
Render View From Another Controller In Yii
http://developwithguru.com/how-to-renderpartial-a-file-in-another-controllers-view-folder-for-yii/
<?php $this->renderPartial('//library/_book', array('books'=>$books))?>
Use double slashes before the controller.
Easier Monitoring Than Nagios
It was not easy at all to get Nagios to monitor mysql. This only took a minute.
CSqlDataProvider Using Special Data Attribute - Yii
Just posted this on the Yii forum after I found out that using the special data attribute in a column requires a syntax like 'value'=>'$data["issueCount"]' when you’re using CSqlDataProvider:
Trick For Running Python Scripts On Reboot - Ubuntu
http://www.raspberrypi-spy.co.uk/2013/07/running-a-python-script-at-boot-using-cron/
Here’s what it looks like in crontab:
@reboot python /home/pi/MyScript.py &
Enabling SSL On Apache
This is a quick overview of the process of adding an SSL certificate to apache (for next time…):
Generate your private key and CSR with:
openssl req -new -newkey rsa:2048 -nodes -keyout yourdomain.key -out yourdomain.csr- Request your certificate
- Save requested certificate onto server in a .crt file
- Download the intermediary/root cert from http://www.symantec.com/page.jsp?id=roots
- Make your site file in
/etc/apache2/sites-enabled/look like this:
<VirtualHost *:443>
SSLEngine On
SSLCertificateFile /home/youruser/yourdomain.crt
SSLCertificateKeyFile /home/youruser/yourdomain.key
SSLCACertificateFile /var/www/verisign.crt
ServerName www.yourdomain.com
DocumentRoot /var/www/yourdomain
An explanation of each of those certificates:
SSLCertificateFile- This is the certificate you received after your request.SSLCertificateKeyFile- This is the private key you generated in step 1.SSLCACertificateFile- This is the intermediary cert you downloaded from verisign.
TbEditableColumn Inside of A TbRelationalColumn's GridView - Yii's YiiBooster Extension
https://github.com/clevertech/YiiBooster/issues/703
Just posted an issue on github with instructions for how to get TbEditableColumn working inside of one of YiiBooster’s subgrids.
Yii quickdlgs Without UrlManager Enabled
EQuickDlgs::iframeButton(
array(
'controllerRoute' => 'controller/create',
'dialogTitle' => 'Create New Record',
'dialogWidth' => 800,
'dialogHeight' => 600,
'openButtonText' => 'Add Record',
'closeButtonText' => 'Close',
//'openButtonHtmlOptions' => array(...),
)
);
With the code above, I was getting the following error:
The system is unable to find the requested action “create?qdsClass=EFrameJuiDlg”.
I had to change line 79 in EFrameJuiDlg.php inside the quickdlgs extension from:
$url .= '?' . http_build_query($this->urlParams);
to:
$url .= '&' . http_build_query($this->urlParams);