Archive for the ‘Uncategorized’ Category

FF3.1b2, Safari 4b, and html 5 canvas, continued

Wednesday, March 4th, 2009

The previous post described improved support for the HTML 5 canvas. It turns out the latest betas of both Firefox and Safari also support the canvas toDataURL method.

An obvious use for this method is to let users easily copy and paste rendered depictions into other applications.

    function saveToBitmap() {
        var canv = $('#canv');
        var img = $('img#bitmap');
        img.attr('src', canv[0].toDataURL());
    };
toDataURL_result.png

Migration

Monday, June 16th, 2008

I’m moving the moribund dmoonc site to a new web hosting provider, WebFaction. As part of the migration I’ve copied from my Bottled Text blog all posts (and comments) relevant to software development.

Now to start rebuilding the website proper…

Firefox 2.0 and display:inline-block

Wednesday, November 8th, 2006

If you want to use <span> markup to define CSS-styled buttons with background gradients, and if you want to control the heights of those buttons, and if you are using Firefox 2.0, you have to jump through some non-standard hoops.

Firefox 2.0 doesn’t support display:inline-block. If you have the Web Developer extension installed, it will report “Error in parsing value for property ‘display’. Declaration dropped.” And instead of getting a button with the right height for your background image, you’ll get something silly looking, like this:



(I know, the colors look silly too. But that’s not important right now.)

Yahoo! search turned up some background information, and a workaround for those who want to make links (<a href=”…”>) look like buttons:

NCZOnline – Pain with inline-block

Basically, you need to do this in your CSS:


.BtnClass {
display: inline-block; /* Firefox 2.0 ignores this */
display: -moz-inline-stack; /* Firefox picks this up */
}


The comments say that this bug has been logged in Bugzilla, and there’s hope it will be fixed in Firefox 3.0.

Works for me with Firefox 2.0 and Safari 2.0.4, both on Mac OS X 10.4.8. Almost:



I’d like the span’s text to be centered vertically on a background image.

Here’s the cleanest solution so far. Suppose the background image is 24 pixels high and the font size is 14 pixels. Then, doing the vertical centering manually, the y offset is (24 – 14)/2 = 5px. So pad the top of the span by 5 pixels, and set its height to the total height minus the padding.


.BtnClass {
...
background-image: url(some_image.png); /* 24 pixels high */
font-size: 14px;
height: 19px;
padding-top: 5px;
}


In other words, add vertical padding to push the text down from the top of the span, then subtract that padding from the overall span height; apparently the final height of the span is height + padding-top + padding-bottom.

This works reasonably well for both Firefox and Safari.

Fevers Help the Immune System

Sunday, November 5th, 2006

(Pardon the “duh” headline.)

Helpful fevers come in from the cold – health – 05 November 2006 – New Scientist

I found this article interesting mainly because I like to let my fevers run — “bake out the infection”. Works for me, but then I’ve never had a really high, convulsion-inducing fever.

Anyway, interesting tidbits from the article:

It has been found that fevers help the body’s immune system identify an infection and raise an army of white blood cells (lymphocytes) against it.

…[Researchers] artificially created a fever-like state in a group of mice… This had the effect of doubling the number of lymphocytes visiting lymph nodes…

Lymphocytes arriving at the nodes are screened for “killer efficiency” using fragments of potentially infectious material. Lymphocytes that respond to the fragments are found, are then selectively multiplied, and then swarm into the bloodstream to seek out and destroy the invader.

Apparently the extra heat of a fever activates high endothelial venule cells (“gatekeeper” cells, as the article calls them) in lymph nodes. They produce extra surface proteins that capture passing lymphocytes and draw them into the lymph nodes.

Evans says that although it fell out of fashion with the development of modern medicine, the idea of treating disease with heat has a long history: “Hippocrates used to heat patients with cancer,” she says. And a century ago the physician William Coley discovered a cocktail of bacteria, dubbed “Coley’s toxins”, which appeared to combat cancer by producing a fever.

Why quarantine is preferred?

Tuesday, October 31st, 2006

New strain of H5N1 bird flu emerges in China

…those vaccine-induced antibodies do not recognise the Fujian virus, although they do attack the virus strains that Fujian has now replaced.
This means the Fujian strain has a selective advantage in vaccinated birds. “This novel variant may have become dominant because it was not as easily affected as other strains by the current avian vaccine,” says Guan. That may also be why H5N1 infection in Chinese poultry has surged, rather than decreased, despite increased poultry vaccination.

Worryingly, the antibodies being used to develop human vaccines for H5N1 … do not recognise the Fujian strain. This means the current experimental pandemic vaccine would not work against any pandemic virus that emerged equipped with Fujian surface proteins.

In the face of mutating pathogens it’s easy to see why monitoring and quarantine are favored weapons against epidemics.

Firefox Vs. Acrobat

Monday, October 30th, 2006

Firefox Vs. Acrobat – macosx.com

I just switched to Firefox 2.0 as my default browser under Mac OS X. When a friend emailed a link to a PDF document, I clicked it as usual.

Out of the box Firefox, unlike Safari, cannot view PDFs inline. That’s okay, I really just want it to open it in Preview.

Alas, that’s not an option. Firefox gives me the choice of saving to disk or of opening with Adobe Acrobat.

Gah.

I searched through the files in my Firefox profile directory. There were no direct references to Acrobat.

According to macosx.com the fault lies outside of Firefox. The thread suggests using Finder Info to make Preview.app the default viewer for all PDF documents. The suggestion did not work for one of the thread participants, and it doesn’t work for me, either. Preview.app is already set as my default for all PDF documents.

A find|grep through ~/Library/Preferences turned up one promising hit:
./com.apple.internetconfig.plist

Unfortunately that’s a binary property list file and even property list editor can’t display its content in a human-intelligible way.

Solution

I closed Firefox, moved ~/Library/Preferences/com.apple.internetconfig.plist out of the way, and followed my friend’s link again. This time Firefox let me choose between saving to disk and opening with Preview.app.

Interestingly, Firefox did not create a new copy of the plist file for me.

Better Solution

A less radical solution also works: when Firefox asks how you want to handle the PDF, tell it to save to disk. Also select the checkbox labeled “Do this automatically for files of this type from now on.”

After downloading, open Firefox Preferences, switch to the Content pane, and click the “Manage…” button at bottom right.

The list should now contain an entry for PDF. Select it, edit, and change to open with a different application than the default.

Google Earth tour of Karaganda

Wednesday, October 18th, 2006

We’ve posted lots of blog entries and photos of places we visited on our trip to Karaganda. Wouldn’t it be cool if you could take a virtual tour of the town and see where the pictures were taken?

Okay, probably not, unless you’re a geek like Bobi and me. In which case you probably have Google Earth installed on your computer. In which case, here’s a KMZ file to guide you around the town. Have fun!

Kazakhstan Trip.kmz (2006/10/18)

[2007/12/17 The file has moved -- Mitch]

Industrial Design

Wednesday, October 11th, 2006

The Department of Style – TiVo Series3

Bobi has a Samsung VCR/DVD player, now several years old. She likes to watch TV with the lights off. So we sometimes have trouble changing channels, on account of we’re holding the remote backwards. Which is why the above blog entry caught my eye.

I like the new remote. It has more texture on it, so it is easier to find the buttons without looking[...] There is asymmetry in the textures, which solves the problem with the old remote where you can pick the thing up backwards and rewind instead of commercial skip.

Thoughtful design is so impressive.

OmniGraffle 4 and Subversion

Sunday, October 8th, 2006

Subversion doesn’t like OmniGraffle documents: “invalid control character … in path”.

Fortunately many others have already encountered this problem and published a workaround. Here’s a nice summary.

I use OmniGraffle, not OmniGraffle Pro. The workaround looks good from here.

Posting to iWeb from NetNewsWire

Saturday, January 28th, 2006
http://web.mac.com/mitch.chapman/iWeb/Dot-Mitch/Blogum/3226B4C3-15F7-4570-8ABB-8CA2E58438C4.html



I’ve been fiddling around with iLife ’06 this week. Since NetNewsWire is my favorite RSS reader I wondered how hard it would be to make it use iWeb as its Weblog Editor.

I’m an AppleScript newbie, so for me the answer was “pretty hard”. But the solution was straightforward once I found it.