Enabling error reporting in cPanel

Posted by & filed under PHP, Programming.

Error reporting is disabled server wide. But for a development project, we need it turned on. Adding a php.ini file with the following directives will get the job done:

This will cause PHP to write out the error to a file in the same directory as the script called error.log. Adjust to your liking…. Read more »

Yii: Returning array data from a ActiveRecord object

Posted by & filed under PHP, Programming.

Two simple ways to convert a ActiveRecord object into a array: Using cHTML::ListDatause CHtml::listData (see www.yiiframework.com/wiki/48/by-example-… )

It will give you array id => city

Using array_map (used this method last time, array_map rocks):

 

Finding failed multipath issues in FreeNAS

Posted by & filed under Linux, Server Admin.

I have two drives, dsa3 and da4 which are showing multipath errors. In order to find the physical drives:

Drive serials can also be obtained via:

 

Chocolatey: Windows Package Management

Posted by & filed under Software, Windows.

Chocolatey is similar to yum or apt-get for linux users, but for windows users. It allows the user to quickly install a variety of packages (apps) from the command line… as of this writing there are 1375 unique packages available. Running Chocolatey is cake… heh heh heh. For example, to install Firefox:

 

Linux — Finding top n large files

Posted by & filed under Linux, Server Admin.

As a followup to my previous note , I am adding an additional one-liner that is extremely helpful.

Obviously, you can adjust the -n param in the head command to return the top 20 for example.

Backing up a cPanel account via the console

Posted by & filed under Server Admin.

Backing up the account – Log-in via SSH as Root user – Run the pkgacct command to package the account into a tar file:

The account backup will be created in the current working directory. Restoring the account – Log-in via SSH as Root user – Run the restorepkg command to restore the cpbackup… Read more »

Migrating MySQL databases from one server to another

Posted by & filed under Server Admin.

Today I needed to begin migrating databases from my live server to the new dedicated database server. The first step is to identify the tables to be moved. Login to the server as per normal

Then list out the tables to find the one(s) we need to move:

For this example, we will… Read more »

Introduction to PID Control

Posted by & filed under Automotive, EFI Tuning.

DTN0003_Introduction_to_PID_Control%5B1%5D What is PID? PID stands for Proportional, Integral, and Derivative and is a type of feedback control system. It compares a measured value (from a sensor, say) against a desired value (the setpoint or aim) and adjusts outputs to reduce the difference (error) between the two. The controller (or ECU in our case) uses… Read more »

Creating large files on windows

Posted by & filed under Server Admin.

I typically use the dd utility in linux to create large files for testing various things. Today I needed to create a large file in a windows machine. One option is to use dd on a linux box to create the file, and then scp the file over to the windows box. This would work,… Read more »

Quickly renaming multiple file extensions with bash

Posted by & filed under Uncategorized.

I needed to quickly rename a bunch of file extensions in a directory. This one liner made quick work of it:

basename, when given a file name and a extension spits out something like this:

Which we then use to append the proper extension (.jpg) in the example and done.

Easiest “check all” ever with jQuery

Posted by & filed under Javascript, Programming, Web Development.

How does it work? This code checks/unchecks all checkboxes within the same fieldset. Simple and semantic. HTML Setup Add checkboxes however you like, just make sure they are within the same fieldset.

And the jQuery to go along with it:

Source: briancray.com/posts/check-all-jquery-jav…