Talking about the new www.personalserver.com features…
Category Archives: Programming
HTML5 Elements and Attributes
Read all about HTML Elements and Attributes!
Wildcard matching with PHP and fnmatch
Today I learned about the fnmatch function in PHP. It supports wildcard matching. Handy!
Get element or tag name with jQuery
To get the element/tag name with jQuery:
$( '.selector' ).get( 0 ).tagName
Undo undo in vim
In vim to undo is ‘u’ and to redo (i.e. undo undo) is ‘Ctrl+R’…
jQuery htmlspecialchars equivalent to encode text as HTML
Found this which said:
$('<div/>').text('This is fun & stuff').html();
CSS height 100% not working
My CSS height value wasn’t being applied. Found this. The problem was that I needed to specify heights for all of the ancestor elements. Bug fixed!
Piping PHP CLI output to less broken
Today I had an interesting problem.
When I ran:
# php test.php | less
The ‘less’ program entered input mode and the up and down arrow (and j, k keys) weren’t working.
Eventually I figured out a solution:
# php test.php < /dev/null | less
The PHP CLI seems to be interfering with the terminal and piping in /dev/null to PHP CLI stdin fixes the problem!
Calculate a median with MySQL
Today I read this article and found this technique for calculating a median value:
SELECT x.val from data x, data y GROUP BY x.val HAVING SUM(SIGN(1-SIGN(y.val-x.val)))/COUNT(*) > .5 LIMIT 1
HTML meta refresh
Today I read What is the Meta Refresh Tag? about the HTML Meta Refresh facility, basically:
<meta http-equiv="refresh" content="0;url=https://www.jj5.net/">