My flexcal plugin exposes a few useful methods, which I have not documented elsewhere. They are called, like all jQuery UI widget methods, by creating the widget: cal = $('input.date').flexcal() then invoking the method: cal.flexcal('setDate', '10/25/2011').

Continue reading ‘The flexcal API and an inline flexcal’ »

Update: I no longer (2012-08-05) use Chili, so this bug isn't relevant

Update: I haven't figured it out, but I did get a workaround. The bug is that any unmatched end of text leads to deleted characters in the middle of the text, so I added a line $.chili.recipes[recipeName]._main.endoftext = {_match: /$/}; to the downloadRecipe method, and now the bug doesn't show up.

I'm running Firefox 7.0.1 and I'm coming across a very strange bug in my syntax highlighter, chili. It doesn't show up with any other browser (and I can't try older Firefox versions, with the auto-updating). I'm still working out the details, but it's erasing all the code from a string to 2 characters from the end. Thus:
$('foo').show();

becomes

$('foo').show();
If you don't see a problem, great. If you do, switch to a different browser. Or figure out what's going on and let me know. Continue reading ‘Weird bug with chili and Firefox’ »
For those following flexcal, my jQuery UI date picker, I've just released version 1.3. It fixes a bug in the setDate routine that would cause it to fail if called before the calendar was shown, and added date filtering. See the original post (now updated) for details.

For the bililite webservices, I kept all the data in what I would call "standard" American medical units, centimeters for height, kilograms for weight, mmHg for blood pressure, mg/dl for bilirubin. But lots of doctors use pounds and inches, and it would be nice to allow those as well. I could have separate data entry forms for different units, but I decided it would be easier and more useful to allow units on the numbers. I could allow fractions as well (which some of my medical assistants still insist on recording; 21 5/8 instead of 21.625. My EMR blows a gasket with that, but my program would do better). And then, I could allow mixed units, like a weight of "6 pounds 5 1/2 ounces".

I didn't find anything exactly right on the web, but symcbean on stackoverflow had a clever idea for evaluating fractions: turn "2 1/2" into "2+1/2" then use eval.

Continue reading ‘Fractions and Units in PHP’ »
For those following this, I corrected some typos (חשון spelled wrong; numbers should not use the סופית form) in the Hebrew calendar. flexcal now stands at version 1.2

After playing with creating PDFs with PHP using fPDF for a while, and trying to get everything to work consistently, I discovered tcpdf, which is a fork of fpdf that includes everything that anyone has ever added to the original. And I mean everything; this thing is huge! I printed out the source to see how it differed from the original, and it ran more than 500 pages. Good thing they're so generous to me at work.

Most of the size is due to the SVG and HTML formatting, which I don't need, but the biggest advantage is that Unicode font subsetting works. Mostly.

tfpdf, the Unicode-enabled version that comes with fpdf, supports Unicode fonts but they don't show up on the iPhone. Apple's PDF viewer is somehow different from Adobe's and reads the fonts differently. tcpdf does a better job (displays in Adobe Reader but generates an error for the HumaneJenson font): the Droid fonts work on the iPhone, though the DejaVu fonts do not. Try those last links on the iPhone; the built-in Helvetica fonts show up but DejaVu does not. Try refreshing the test page multiple times; it randomly selects fonts to display each time. Some fonts generate errors in Adobe Reader but display, some don't display at all and some don't display on the iPhone. It all seems very random, but at least I have a set of open-source true type fonts that I can include.

It also does most of the things I need: PNG graphics with transparency, form fields like text boxes (I played with that one for weeks with tfpdf, but it never worked the way I wanted it to), rotating text. The API is clunky and poorly documented and I definitely like my routines better, but this is done and someone else maintains it. A huge advantage. I can write my own interface routines to be more elegant if I want.

Continue reading ‘Don’t Reinvent the Wheel, PDF Style’ »
XKCD has published the new reference standard for all flame wars: XKCD Connoisseur

I get lots of comment spam, either obvious ads for dubious products or boilerplate praise in almost understandable Engfish ("This is the most coherent soliloquy on this germane topic in the recent memory") with links to the ads. But I'd never seen comment spam that went out of its way to insult me:

The subsequent time I learn a blog, I hope that it doesnt disappoint me as much as this one. I imply, I know it was my choice to read, however I truly thought youd have one thing attention-grabbing to say. All I hear is a bunch of whining about one thing that you would repair in the event you werent too busy searching for attention.[links to some construction contractor removed]

I guess they know how humble I am and that I'd take criticism more seriously than praise.

But it's still painful to read something negative and have to take the time to parse it and realize it doesn't say anything at all, so I hope it doesn't become a trend. Thank goodness for Akismet!

I'm trying to test textpopup but (at least with jQuery 1.6.1 in Firefox), $.get with a local file fetches an XML document, not the text, unless I explicitly use the dataType parameter to set it to 'html'. Which I have now done. A small change, but it took me an hour to track it down.

Plus, a small bug fix that was bothering me: clicking outside the textbox hides it but that was failing if I clicked in another textbox trigger. That is now fixed; I had been too aggressive with stopPropagation.

I definitely like my iPod Touch better than my old Windows Mobile 6 phone, and I had hoped that the time zone/daylight savings misery I had on Windows would be behind me. No such luck. When I went to New York for Pesach this year, I dutifully changed the time zone (Settings->General->Date & Time->Time Zone) to New York, then changed it back to St. Louis on my return. The iPod, trying to be helpful, moved all my appointments forward an hour, even though it had not moved them backward when I went east. Now everything was an hour off!

I briefly pulled my hair out, then Googled Binged "ipod calendar 1 hour off" and it turns out there are two settings for the time zone: the one under General->Date & Time for the iPod's clock and Settings->Mail, Contacts, Calendars->Time Zone Support->Time Zone for the time to display for events. Setting both to "St. Louis" fixed the problem.

This makes no sense to me; how often would anyone want to see appointments in something other than their local time? And why would it show up only after my return trip? But at least the problem was quickly solved.

And on an almost completely unrelated note, Bing doesn't lend itself to being used a verb the way Google does. Binged sounds like I drowned my computer problems in a fifth of Scotch. Bing'd? Bing-ed? BingisnotGoogled?