My children's Jewish history teacher, Rabbi Yonason Goldson has been teaching at Block Yeshiva High School for many years and presents Jewish history with a mix of traditional and scholarly sources, always from a Torah-true perspective and always looking at the broad sweep of history and the Jews' role in it. He has now published his notes (which I have always found fascinating) in book form, as Dawn to Destiny: Exploring Jewish History and its Hidden Wisdom. I'm looking forward to reading it.

From the publisher's summary:

A comprehensive overview of Jewish History from Creation through the redaction of the Talmud, illuminating the intricacies and complexities of Torah tradition and philosophy according to the sages and classical commentaries, spanning the length and breadth of Jewish experience to resolve many of history’s most perplexing episodes, offering profound insights and showing their relevance to life in the modern world. An invaluable resource for scholars and laymen. A priceless tool for education and outreach.
How did the sin of Adam transform mankind and the world? How were the prophecies of Noah fulfilled through the rise of the Greek Empire? How did the builders of the Tower of Babel believe they could wage war against G-d? Why did there have to be three patriarchs? What was King David's crime regarding his involvement with BasSheva? Why did some Jews oppose the construction of the Second Temple? How can we trust the transmission of Torah if our scholars engaged in such fierce disagreements? These and many other questions are answered in this unique volume.

A simple walkthrough to use the Engauge Digitizer to pull values off a "printed" graph

There's a far more complete manual that comes with the download, but these are the steps I used to generate the data for the webservices graphs. It assumes you've got a black and white image of the graph, with continuous lines for the data and orthogonal gridlines, and linear axes.

Continue reading ‘Engauge Digitizer Tutorial’ »

I wanted to add Down Syndrome growth charts to the bililite.com webservices, but as far as I can tell, the charts are available only as images in the AAP's guidelines (and the original paper; subscription only). The often-cited growthcharts.com has charts, and Greg Richards was generous enough to share his data with me. However, some of the data are from a different study, and he got his data from the original charts the old-fashioned way: with pencil, ruler, and a blown-up copy of the paper. Nothing wrong with that; that's how I got my numbers for the bilirubin chart, but I wanted all my charts to match the AAP's.

So how to get the numbers off the graph? I emailed the lead author of the original paper, but haven't gotten any answer. I can pull the graphs as gif's from the PDF of the paper (thanks to OpenOffice.org and Sun's PDF importer; Adobe's reader seems to get more limited with each upgrade). I was afraid I would have to digitize the graph by hand; I read the cool article on Sudoku recognition and figured I could learn about Hough transforms to get the graph, and 2-D Fourier transforms to remove the gridlines, then blob detection to find the lines. Turning pixels into measurements would be the trivial last step. Sounds like fun, if I had an infinite amount of free time.

Luckily, I found Engauge Digitizer. With almost no time reading the manual, I had it removing gridlines, digitizing the curves on the graph, and exporting values at x-values that I selected into CSV files. It was close to easy. Not quite automated, but with only 4 graphs to digitize, I was done in half an hour. Highly recommended. With my remaining free time, I'll write a quick tutorial so I don't forget what I did.

I wanted the webservices to be as RESTful as possible, so they should use the Accept: header rather than file name extensions to determine the type. Continue reading ‘Parsing the HTTP Accept: header’ »

I've been spending my project time learning how to manipulate images in PHP to let me create custom growth charts and the like, with a RESTful interface that would allow them to be used as the source of <img> elements. I like the way things turned out; they are available at bililite.com/webservices/. It includes height,weight, head circumference, peak expiratory flow (for managing asthma), blood pressure and bilirubin levels. While it took a fair amount of trial-and-error to get things to work, I don't think there's much that's innovative enough programming-wise to write a tutorial.

I want to get it to parse the Accept: header, so users can leave out the file extensions, but it looks like browsers don't implement that correctly, so I'll have to keep using extensions as well.

I still need to learn more about caching and effectively using eTags and all the headers that go with it. It always makes my brain hurt.

Eternal vigilance is the price of liberty. Last month, the Young Israel site was hacked and destroyed. A little talking with my ISP's tech support reminded me that I had an old version of WordPress on the site, in a folder called "wordpress," and that it contained a vulnerability that make the vandalism possible.

When I moved this blog, I kept it updated, so I don't think it is vulnerable, but I completely forgot to remove the old one. I just changed the links to refer to the new one. Stupid! And now I've paid the price.

Well, we got just about everything restored from backups (missing some old announcements that I don't think anyone will miss), and I think I've removed any vulnerable code. I also am now the proud owner of some cool-looking hacking software that was installed on the site that I want to try to take apart and experiment with. Just more tuition paid to the school of hard knocks.

Finding the width of a column in a table in OpenOffice.org writer is a bit of a black art, because the widths aren't stored anywhere, just the relative widths in arbitrary units. And if cells have been combined, then the object model has no concept of "columns" and there is no way to find the widths of cells. But, based on the table tutorial, I've written this function:

function colwidth (table, index) ' index is 0-based
	' need the table to be oriented (http://api.openoffice.org/servlets/ReadMsg?list=dev&msgNo=12552) 
	table.horiOrient = com.sun.star.text.HoriOrientation.LEFT_AND_WIDTH
	' tricks from http://wiki.services.openoffice.org/wiki/API/Samples/Java/Writer/TextTable
	dim n
	n = table.columns.count
	if index >= n then
		colwidth = 0
	elseif n = 1 then ' single column table
		colwidth = table.width
	else
		dim ratio as double
		ratio = table.width / table.tableColumnRelativeSum
		dim pos
		pos = table.tableColumnSeparators
		if index = 0 then
			colwidth = pos(0).position * ratio
		elseif index = n-1 then ' last column
			colwidth = (table.tableColumnRelativeSum - pos (ubound(pos)).position) * ratio
		else
			colwidth = (pos(index).position - pos(index-1).position) * ratio
		end if
	end if
end function

OOo controls have a Struct FontDescriptor that contains all the information about the text (font name, point size, etc.) so one would hope that to make an editbox have the same font as the containing text range, all you would have to do is

textField.fontDescriptor = textRange.fontDescriptor

but no such luck. FontDescriptors apply to everything but actual text; text has all those properties as part of the CharacterProperties service, so each property has to be accessed separately:

fontDescriptor = textField.fontDescriptor
fontDescriptor.name = textRange.CharFontName
fontDescriptor.height = textRange.CharHeight
' etc.
textField.fontDescriptor = fontDescriptor

Note that you can't do textField.fontDescriptor.name = textRange.CharFontName, because Structs are always copied. Even if it makes no sense.textField.fontDescriptor.name creates a temporary copy of textField.fontDescriptor and modifies its name, leaving the original textField.fontDescriptor untouched

Today was the last day of a 3-month locum stint and they had a lunch for me. Ham and cheese subs.

And someone who knew what kosher meant brought in Cheezits (my main vice). But it's sukkot, so I couldn't eat those in the office either.

Continue reading ‘Preventing Irony Deficiency’ »
There's a great tutorial on exporting from OpenOffice.org Writer to PDF, but as far as I can tell it's orphaned on the openoffice.org website; there's no link from the tutorials page. It documents all the properties of the export filter and goes through the process in great detail. Hopefully the link from this blog will help keep it from staying orphaned.