April 22, 2008 by pierre
String indexes
While s[i] will return the char at index i in the string s on FF and Safari, you need to use s.charAt(i) so that it works also in IE7.
Null vs. Undefined
It seems obvious but I made the mistake: unassigned variable and objects properties begin with a special value of undefined which is different from null.
Tags: javascript IE7 | Comments (0)
April 11, 2008 by pierre
~ $ history|awk '{a[$2]++} END{for(i in a){printf "%5d\t%s\n",a[i],i}}'|sort -rn|head
107 ls
103 cd
89 vim
39 python
26 cat
18 open
17 ssh
13 o
11 rm
10 log
via Bill de hÓra
Comments (1)
April 3, 2008 by pierre
Jérôme did a nice use of the pilcrow sign in the Disclosures programme, we were discussing this with him and Martine a few days ago before going to the opening of the exhibition.

Being an amateur unicode explorer I was familiar with the wikipedia entry on sir U+00B6. Recently Jonathan Hoefler wrote an article* that very nicely updated what I knew about it. One of the thing I did not know was that it came from a “c” and not a “p”, this prompted us to the word “caragraphs”, the new official terms in lingonest for those block of text that sometime cannot afford white lines to separate them.

* being a perverse automator, I particularly like Jonathan Hoefler “8 fundamental questions that inform the space of the pilcrow” and the corresponding 768 possible outcomes at the end of the entry.
Tags: design, disclosures, pilcrow, typography | Comments (0)
April 1, 2008 by jerome
Today, during one of the soft redesign of Assembling I found myself in need to know whether an attachment was an image or not; the wordpress documentation did not give me any clue about how to do this - so I started to create myself the function I needed: get_the_attachment_type
It sits in my theme functions.php - and might be of any use to someone else:
<?php
function get_the_attachment_type($id = 0) {
$id = (int) $id;
$_post = & get_post($id);
$mime = $_post->post_mime_type;
return $mime;
}
?>
I use the function in the attachment.php file in the following manner:
<?php switch (get_the_attachment_type($post->ID)) {
case "image/jpeg":
case "image/gif":
case "image/png":
break;
default:?>
<p><b>Download</b>:
<?php } ?>
<?php echo $attachment_link; ?> <?php the_content(); ?>
This will then output a bold Download prompt in front of the file’s name in case, the attachment file is not an image (pdf, zip, etc.); if the attachment is an image, then nothing will be displayed.
Tags: attachment, file type, mime, postmeta, theme, wordpress | Comments (1)