Get with the program, Amazon!
Thursday, January 21, 2010
Kindle Isn't Accessible to the Blind
It was brought to my attention today that although some books available on Kindle have voice-to-speach capability, blind people can't really use it because there is no audio for the menus. There was a comment about this fact that books aren't accessible either so why should the Kindle be? This must be the kind of ignorance working at Amazon too. The point of moving from old technology (paper books) to new technology (ebooks) is that the new tech is better. Surely in the 21st century, better means more inclusive and more accessible to everyone. To produce a device as sophisticated as Kindle and to not bother making it accessible is just plain laziness.
Thursday, September 10, 2009
PHP function that produces acronym
I wrote this function because I couldn't find one that produces an acronym from a string of words.
Here's the script:
function acronym($longname) {
$letters=array();
$words=explode(' ', $longname);
foreach($words as $word) {
$word = (substr($word, 0, 1));
array_push($letters, $word);
}
$shortname = strtolower(implode($letters));
return $shortname;
}
// call the script like this:
$_POST['title'] = acronym($_POST['title']);
Wednesday, March 11, 2009
Semantic nl2br()
Here's a little PHP function that I wrote to replace nl2br() when it's actually a paragraph break that's required. It creates more semanic code for textarea fields being displayed from a mysql database. It replaces one \n with <br />but if there are 2 together, they are replaced with </p><p>. You initiate the first paragraph and end the last paragraph when you call the function.
Here's the function:
// define function
function lineBreaks($lines) {
// insert break tags
$lines = nl2br($lines);
// create an array of all the possible multiple break tags
$breaks = array("<br /><br />", "<br />\r\n<br />", "<br />\n<br />", "<br />\r<br />");
$paragraphs = "</p><p>";
// replace multiple break tags with paragraph tags
$lines = str_replace($breaks, $paragraphs, $lines);
return $lines;
}
Here's how you call it:
// $row['details'] is the name of the field. It could be anything.
echo "<p>".lineBreaks($row['details'])."</p>\n";
Here's the function:
// define function
function lineBreaks($lines) {
// insert break tags
$lines = nl2br($lines);
// create an array of all the possible multiple break tags
$breaks = array("<br /><br />", "<br />\r\n<br />", "<br />\n<br />", "<br />\r<br />");
$paragraphs = "</p><p>";
// replace multiple break tags with paragraph tags
$lines = str_replace($breaks, $paragraphs, $lines);
return $lines;
}
Here's how you call it:
// $row['details'] is the name of the field. It could be anything.
echo "<p>".lineBreaks($row['details'])."</p>\n";
Subscribe to:
Comments (Atom)