Archive for April 12th, 2005

More, Baby

April 12th, 2005 by daryl

No, this isn’t about a cliche pop song. Just documenting the latest news in babyland. Last week, Lennie started saying “bah bah” when looking at pictures of babies (including herself) and at herself in the mirror. She’s definitely attaching the word to babies. Her system’s not foolproof, however. As with Duh-dn-duh (kitty cat), she for a while attached the word to other things as well because she was being validated for saying it. That seems to have leveled off now, and she’s pretty consistent with the usage.

Sunday night, we stopped at Hardee’s while we were out, and she did something close to the “more” sign as we were feeding her little bits of food. To do the sign, you clump the fingers of each hand together and have the fingertips of each hand kiss the fingertips of the other. Her rendition of it is more like pointing into one cupped fist with the other hand, but it’s close enough. At first, she wasn’t very consistent about doing it, but she’s done it more and more since then, and she did it reliably enough tonight at dinner that I’m convinced she knows what she’s doing. She’ll stick a pea in her mouth and do the sign. We’ll put another pea on her tray, she’ll stick it in her mouth, and she’ll do the sign again.

Also, she’s got a soft (as in foam and cloth) block with a duck on one side that quacks when you squeeze it. When she was very young, I’d pretty frequently imitate the tone and rhythm of the sort of nasal, grating quack sound. I’m pretty good at it. I still do it from time to time when we go to look at the ducky shower curtain rings in the guest bathroom, and it often gets a laugh out of her. So today, I squeezed the duck block, and when it was done quacking, she did a pretty darned decent immitation of it, matching the number of quacks (eight) and possibly even trying to match the rhythm and intonation a little (though that could have been coincidence or wishful thinking on my part). At any rate, it’s a pretty cool accomplishment as far as I’m concerned.

Not to be limited to the performing arts, Lennie also tried her hand at the visual arts today. Mleeka gave her a crayon, sat down on the floor with her and showed her what to do with the crayon, and she went to town, trying very deliberately to apply the crayon to the paper. Of course, she would have done the same with a block or a stuffed animal or her own finger if prompted, but it’s fun to think there’s something more to it.

Firefox Extension Build Script Redux

April 12th, 2005 by daryl

A few weeks ago, I posted about a shell script I had written to help automate the building of an extension for Firefox. Building an extension’s not a hard process, but it can be a pain to do over and over because it involves zipping some files and putting them into a directory, then zipping that directory and another file into another archive. It’s just kind of a pain. This week, I’ve been hit with a need to generate different versions of my extension for different platforms in order to accommodate styling differences among the platforms. (Macs have nice rounded text inputs for some of their widgets, for example.) I could find no way to do a simple sniff to determine what CSS file to use for a given XUL document within an extension, so I figured I’d need to generate separate packages for each platform, complete with specialized style sheets. So I was looking at having to generate packages for each platform. Even with my nifty little build script, that was going to be kind of a pain and was going to necessitate keeping three copies of my code and making updates in three places. What a pain.

To get around this, I wrote a new script this morning that builds packages from a base directory and incorporates changes per platform. So I make core changes to one code base and make changes to platform-specific code only within the given platform’s directories. When I run the build script, for each platform specified in the script, it copies the base files into a temp directory, then copies platform-specific files in on top of them. Then it builds and exports the package to an export directory specified within the script. It should make this whole process substantially less painful. The script appears below.

#!/bin/sh
##############################################################
#                                                            #
# Multi-platform Firefox extension build script.             #
#                                                            #
#    Author:    Daryl L. L. Houston                          #
#               http://daryl.learnhouston.com                #
#   Version:    1.0                                          #
# Rev. Date:    Tue Apr 12 11:01:51 EDT 2005                 #
#                                                            #
#     Usage:    Current directory should contain directories #
#               "base" and platform-specific directories.    #
#               Base directory contains install.rdf and      #
#               files common to all platforms. For example:  #
#                                                            #
#                  + contents/                               #
#                    + r2/                                   #
#                      - contents.rdf                        #
#                      - overlay.xul                         #
#                      - overlay.js                          #
#                  + skin/                                   #
#                    + r2/                                   #
#                      - r2.css                              #
#                  + locale/                                 #
#                    + en_US/                                #
#                      + r2/                                 #
#                        - overlay.dtd                       #
#                  - install.rdf                             #
#                                                            #
#              Platform-specific directories contain files   #
#              in addition to or different from base files.  #
#              So if the Mac package needs a different       #
#              stylesheet, you create the skin hierarchy     #
#              under a directory named (eg) "mac" and put    #
#              the Mac stylesheet in there. It will be       #
#              dropped into the Mac package in place of the  #
#              base package's style sheet.                   #
#                                                            #
#              Packages are named (eg) "extname_mac.xpi"     #
#              where the "extension" variable below is       #
#              set to "extname" and are placed in the        #
#              directory specified in "export_path" below.   #
#                                                            #
##############################################################

#Set these variables.

#Final export directory.
export_path='/home/houston/code/extensions/xpi'

#Package name. This should match chrome:name from contents.rdf
extension='r2'

#Platform directories. Will be used to create final xpi names.
#Corresponding directories must also exist.
dirs=(mac windows linux)

#No need to edit below this line.

for idx in $(seq 0 $((${#dirs[@]} - 1)))
do
	#Need to make a temporary build work space
	mkdir temp

	echo ' '
	echo '===== '${dirs[$idx]} '===='

	#Remove old xpi files.
	oldxpi=$export_path'/'$extension'_'${dirs[$idx]}'.xpi'
	if [ -e $oldxpi ]
	then
		echo '+ Removing ' $oldxpi
		rm $oldxpi
	fi

	#Copy common files into build directory
	echo '+ Copying files into ' ${dirs[$idx]} ' temp build directory'
	cp -Rf base/* temp/

	#Now copy (and force) files from the current platform build directory
	#into temp directory. This adds new files and overwrites base files.
	cp -Rf ${dirs[$idx]}/* temp/

	#Make chrome directory
	if [ -d temp/chrome ]
	then
		rm -rf temp/chrome
	fi
	mkdir temp/chrome

	#Now go into temp directory and zip up the files copied there, name the zip
	#with a .jar extension, and move into the chrome directory.
	cd temp
	echo '+ Creating jar for '${dirs[$idx]}
	file=$extension.jar
	zip -r $file content skin locale
	mv $file chrome/

	#Create the xpi by zipping install.rdf and chrome
	#and giving the file a .xpi extension.
	echo '+ Creating package for '${dirs[$idx]}
	file=$extension'_'${dirs[$idx]}'.xpi'
	zip -r $file install.rdf chrome/

	#Move the newly generated extension to the export directory
	echo '+ Moving xpi file to output directory for '${dirs[$idx]}
	mv $file $export_path

	#Go up a directory and remove temp directory in anticipation
	#of iteration for next platform. Lather, rinse, repeat
	cd ..
	rm -rf temp

done