Did you know that tabular data doesn’t really exist? Yes it’s true! Recently at work, I was discussing the advantages of semantic markup with a colleague and stumbled upon an interesting conundrum. In the conversation, we agreed that table based design layouts are bad, and that tables should be used for tabular data. I think you’ve probably heard the same elsewhere and would probably agree as well. The sticky point however was that my colleague then proceeded to state that the application he was working on, which used <table> tags to markup the output, was semantically correct because it was a file browser of sorts which was ‘tabular data’. I proceeded to point out it would be more correct to use the proper list tags (ordered <ol> or unordered <ul>) as it was a list of files. Frustrated with my response, he asked: “then what is tabular data?” and suddenly I found myself without a clear and concise answer.
(more…)
My site was down for a short while this morning as another site sharing this server got dugg. Everything seems to be back and happy now as he moved it to another server.
I wanted to use a <blockquote> to indicate a callout within my Markdown articles so I hacked the Markdown Extra _DoBlockQuotes_callback() function to the following:
function _DoBlockQuotes_callback($matches) {
...cut...
//add id and class details...
$id = $class = '';
if(preg_match_all(
'/\{(?:([#.][-_:a-zA-Z0-9 ]+)+)\}/',
$bq,$matches)) {
foreach ($matches[1] as $match) {
if($match[0]=='#') $type = 'id';
else $type = 'class';
${$type} = ' '.$type.'="'.trim($match,'.# ').'"';
}
foreach ($matches[0] as $match) {
$bq = str_replace($match,'',$bq);
}
}
return _HashBlock(
"<blockquote{$id}{$class}>\n$bq\n</blockquote>"
) . "\n\n";
}
this allows me to do
>{.className}{#id}This is the blockquote
and it will generate
<blockquote id="id" class="className">
<p>This is the blockquote</p>
</blockquote>
This way the RSS feed will still show it as a quote but I can make the quote look a little sexier my site.
While my site is still relatively small i though it time to do some housekeeping. I’ve rearranged and recategorized a bunch of posts into more generic and manageable categories. Sorry if a few links break but hey, that’s life. This will hopefully make it easier to find stuff.
I bet, at some point, you’ve come across a broken link or maybe an image that just wasn’t loading properly into your web site. When it comes to linking files, or more specifically, file paths in your web site, everything is relative. But relative to what? The problems associated with relativity become especially apparent when working with dynamically created pages.
(more…)
It seems I’ve come up with a good namespace prefix for my JavaScript objects YAJL or ‘Yet Another JavaScript Library…’. A quick Google Search seems to indicate it’s not a popular prefix, unless I’m sequencing DNA. Cool, YAJL.log seems unique enough. On second thought however, another Google Search would indicate it may not be such a good namespace!
Installed the miniposts plugin. This is just a test to see how it works. It seems I have to get the Markdown module working in a few other locations. Hrmm… Ah ha! 339: $text = Markdown($text);
Ever had a friend with the same first name? I did. Growing up, through elementary school, I had a good friend named Jeff Shaddock. This posed a problem for most of our teachers as the typical “first name, last initial” solution for children with the same name didn’t work. On assignments and tests, I was usually forced to be Jeff Sa. and likewise, my friend Jeff was forced to be Jeff Sh. so people knew which one of use was which.
Similar situations often crop up when dealing with web applications and JavaScript. Since JavaScript doesn’t complain when you declare a function multiple times and it simply uses the last declared version, if you have a few different libraries, each doing their thing, you need to make sure they don’t conflict. If you’re planning on writing a new library, or improving an existing one, you can avoid frustration by keeping two simple things in mind: be unique and don’t share.
(more…)
Fed up with trying to format my posts using the WYSIWYG editor in Wordpress, a friend mentioned that he uses Markdown. Looking into it a bit more I was thrilled and have switched to using it exclusively!. The only problem is that some old posts and HTML hacks have broken a little so bear with me for a little while while I sort out the issues and re-mark some of my older posts.
and ahhh finally! Clean code with no headaches!!
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Test</title>
</head>
<body>
</body>
</html>
Comments Off
While writing Beginning Google Maps Applications, I grew accustomed to using GLog.write() while debugging any JavaScript I was working on. It was a wonderful alternative to alert(). That was great while I was working on map related projects but without the Google Maps API, it wasn’t there. Finally the other day, frustrated the 100th time I accidentally put my browser into an infinite alert loop, I decided to write up a quick logger myself. Afterwards, I realized there were already a bunch on the net but I had fun writing my own and even learned a few DOM tricks. For any of you out there who want to use it, go nutz. I’ve called it JSLog and the primary methods are JSLog.write(); which outputs escaped angle brackets while JSLog.writeHTML() outputs the raw input.

The best part is now when debugging things like Prototype AJAX calls, you can easily log and see all the exceptions!
new Ajax.Request( 'example.php', {
onComplete:function(request){
try {
//do whatever you need to an errors will be logged!
} catch (e) {
if(JSLog) JSLog.write(e);
}
}
});
No more errors floating into dream land!
To use it, just download the source or add
<script type="text/javascript" src=http://jeffreysambells.com/openprojects/JavaScript/JSLog.js"></script>
to the head of your document.