sudo cp -rp /home/* /mnt
Booting Raspberry Pi from external HD.
I just added a page with instructions on how to boot up a Raspberry Pi from an external hard drive. You can see the page here.
Javascript – Getting number of days in a month
//Month is 1 based
function daysInMonth(month,year) {
return new Date(year, month, 0).getDate();
}
//July
daysInMonth(7,2009); //31
//February
daysInMonth(2,2009); //28
daysInMonth(2,2008); //29
502 Bad Gateway on Raspberry Pi Running OpenMediaVault
This error occurs after doing an update of php5-pam. In order to fix this if this happens, do the following:
Log in via ssh as root and try:
wget http://omv-extras.org/debian/pool/main/p/php5-pam/php5-pam_1.0.3-2_armhf.deb
dpkg -i php5-pam_1.0.3-2_armhf.deb
reboot
Limiting input tag to numbers without using html 5 type=”number”
The reason for this post is due to the fact that not all major browsers support HTML input types yet.
This example limits the input to numbers.
<input onkeypress=’return event.charCode >= 48 && event.charCode<=57′>
This example limits the input to numbers, but, decimal works.
<input onkeypress=’return (event.charCode >= 48 && event.charCode<=57) || event.charCode==46′ >
Adminer
I have been doing MySQL database administration and applications for a long time now and I can’t believe that I’ve never heard of Adminer before.
Adminer is a PHP database manager. As near as I can tell, it contains all of the same functionality of phpMyAdmin, but, seems to be quicker.
I recently came across this and have been using it exclusively ever since. Prior to this, I have always just used phpMyAdmin.
If you have not yet tried to use this single page database manager, I strongly recommend giving it a try.
Checking WordPress User Capabilities
Recently I spent some time trying to determine user capabilities while developing some plugins. I figured I’d put what I learned here for future reference.
In order to check a current user’s capabilities (i.e. are they an admin?) use the function;
current_user_can( capability )
An example would be:
if (current_user_can(‘manage_options’)) {
// User is an administrator.
/* Do something */
}
If you want to check a particular user, use the function;
user_can(id, capability).
This works exactly like the previous example, however, it takes an ID as a paramter.
An example would be:
if (user_can($id, ‘manage_options’)){
// User is an administrator
/* Do something
}
For a complete list of roles and capabilities, please reference this site.
Database Plugin for MySQL
I am working on a new plugin for WordPress which is intended to give you capabilities similar to those in phpMyEdit. I have been waiting for a while for someone to design a table editor for MySQL that plugs in to WordPress. Turns out, that someone is going to be me.
As soon as I have something tangible, I will post it so that others can play with it.
Disable Get Windows 10 Update notification from system tray
Essentially just uninstall and disable Update KB3035583. There is more information and helpful tips on this site:
Uncheck/check check box using jQuery
In order to uncheck a checkbox using jQuery use the .prop() function.
jQuery('tag').prop('checked', false);
In order to check a checkbox, set to true.
jQuery('tag').prop('checked', true);