Lot’s to watch! FreedomBox talks.
Category Archives: Programming
Eben Moglen and Bdale Garbee on the FreedomBox
Watched this presentation today: FreedomBox 1.0.
Also, there’s more information about the FreedomBox.
PHP filter_input_array
On my TODO list is reading about the PHP filter_input_array.
PHP http_build_query
Using http_build_query now that I know about it! Handy!
jQuery Validation Plugin
Using the jQuery Validation Plugin to validate my web forms… handy!
Preserving whitespace in jQuery .val()
Found this article today which had a method for preserving white space in jQuery’s .val() function.
$.valHooks.textarea = {
get: function( elem ) {
return elem.value.replace( /\r?\n/g, "\r\n" );
}};
Escaping SQL values in PHP without using mysql_real_escape_string
Found this article which has a handy ‘escape’ function:
// replace any non-ascii character with its hex code.
function escape($value) {
$return = '';
for($i = 0; $i < strlen($value); ++$i) {
$char = $value[$i];
$ord = ord($char);
if($char !== "'" && $char !== "\"" && $char !== '\\' && $ord >= 32 && $ord <= 126)
$return .= $char;
else
$return .= '\\x' . dechex($ord);
}
return $return;
}
Single Sign On: integrating Postfix/Kerberos/LDAP
Some reading to do concerning integrating Postfix/Kerberos with LDAP:
http://www.postfix.org/LDAP_README.html
http://www.boobah.info/howto/postfix-ldap.html
http://web.mit.edu/kerberos/krb5-devel/doc/admin/conf_ldap.html
Execute Multiple MySQL Queries from One String in PHP
Found this article today, Execute Multiple MySQL Queries from One String in PHP. It’s a work around for processing MySQL batch queries separated by semicolons.
Using grep (not sed) to grab IP addresses from Apache web logs
Today I ran the following command to see how many people accessed the ProgClub wiki over the previous 5 hours:
jj5@charity:/var/log/apache2$ grep "GET /wiki/" access.log |
grep "13/Jul/2013:0" | grep -Eo '^([0-9]{1,3}\.){3}[0-9]{1,3}' | sort | uniq | wc