Categories
Books Writing

Finished the Draft

I finished the book draft today. I don’t remember ever being so tired when I’ve finished a book, previously. Perhaps it’s the cumulative effects of all the words written, code samples created, proofs read, edits made, reviews read with trepidation.

Next week I need to review the errata for the Learning JavaScript book, so those making the language translations can start with clean copy. Then on to the Adding Ajax editing. By the first of March, I’ll be ready for a break. During that time, I might see what I can do incorporate some of the stuff I wrote about into my own sites.

Books, that now makes lots of books:

Powerbuilder 5.0 How-To, July 1996

Special Edition Using PERL 5 for Web Development, October 1996

JavaScript 1.0 How-To, December 1996

Dynamic Web Publishing, December 1997

A couple of chapters for a book on Perl that I can’t remember the name of the book’s title.

Java 1.1 Unleashed, 1997

Maximum Java 1.1, 1997

The Power Guide to Dynamic HTML, January 1998

Developing ASP Components, 1999

Developing ASP Components, 2nd Edition 2001

Essential Blogging, 2002

Unix Power Tools, November, 2002

Practical RDF, 2003

Learning JavaScript 2006

and now…

Adding Ajax, with estimated publication in June, 2007

Categories
Just Shelley

Grilled Cheese

I like my cheese sandwiches grilled, with slices of bread and butter pickles. Or with ham on sour dough.

I spent the day completely tearing apart my bedroom/office, moving tables around so that I have my PC laptop on one side of my TV and my Powerbook on the other. With the DVI to HDMI connection for the Mac, and the VGA connection for my PC, I can watch movies from either machine. I’ve found that the PC does better with the ripped or downloaded movies and TV shows, while the Mac does better playing actual DVDs. Even getting one of the cheapest HD LCD televisions on the market, shows look great on my TV.

Both computers can now also share the three external storage drives, so I don’t have to swap them around.

I have a nice Logitech speaker set hanging on the wall, with a base unit that can shake the apartment. It’s connected to a control where I can flick a switch to go from speaker to headphones, without having to plug or unplug cords. I do believe I have a great setup now.

I also flipped my mattress today, which is a bit much and normally I get my roommate’s help. However, I gave it a shot and I must say that it does my heart good to see how much entertainment I gave Zoe, my cat. As soon as I had it vertical, she was up that like a tree, and absolutely delighted with the experience. I left it balanced against the wall while I moved other things about.

Today was the first day I had seen the instinctive protective behavior that cats exhibit when they’re stuck or hurt. They’ll hide pain or problems because to show either encourages other cats to attack them. Zoe was up on the mattress, sharpening her nails when she got one snagged. I moved towards her to help, but when she saw me approaching, she laid her body down across the stuck paw and gave me a look like she hadn’t a worry in the world. I left her be and she worked her claw loose on her own.

She’s now being treated for arthritis, which she also tries to hide from the roommate, but has let me see (me being Mom). It also looks like we may be faced with the beginning of kidney failure. She is, after all, 14 years old. She’s still my kitten, though.

I also did 6 loads of laundry, being down the last of my unmentionables. My roommate says this is too much sharing, but I say, “Fah, never too much”. I use a lavender scented laundry soap and hang many of the all cotton items up to dry in the kitchen area. Smells wonderful.

The laundry room is two blocks away, down a hill, and I hand carried the loads back and forth. That combined with changing all the furniture, flipping the mattress, and scrubbing my room down has left me barely able to move tonight. I do this every time I finish a book draft or meet a major contract deadline. I just let my mind take a holiday while I exhaust the body.

Now I’m doing what always do after finishing a tough job, post body exhaustion: watching Firefly, reading weblogs, eating juice popsicles.

Categories
Just Shelley

Breaka de web

I finally uploaded chapter 7 for the reviewers, and was it a difficult chapter to do. The topic has to do with breaking the web with Ajax, putting it back together again, and what are known as ‘single-page’ applications.

After thinking on it for days, and looking at some extraordinarily torturous ways of patching together kludgey fixes, I finally realized that either you create pages that do well when scripting is disabled, and then add the bits; or you just accept that the application breaks the web and accept the consequences. Personally, I believe that 99.999% of Ajax applications have no justification for completely breaking the web. But, I’m a stick in the mud.

Tired stick in the mud. All I have left is the remaining portions of the last few chapters and then I’ll be done with the draft. I have a wonderful group of reviewers who will then help me see the many errors of my ways, and I’m looking forward to their efforts. When we’re finished, I’ll list out the folks who are helping, who will also get effusive thanks in the book.

Once the editing is done, my god I’ll be able to turn off my computers. Get out of my chair. I want to hit the trails for three months solid.

Categories
Critters Just Shelley

What were they thinking?

Zoë had to go in for a rather intensive physical today. She’s always been somewhat of a gorger, chomping down her dry food too fast and than…well..you know. Lately it seems to happen more frequently and we thought it was time to check her out, make sure she’s OK.

Zoë’s also moving with more difficulty. When she walks down the stairs in the morning, she hops down, keeping her back legs together.

The vet tried to listen to her heart and thought she heard a murmur. To check for sure, she got an EKG, which is kind of cute (if not inexpensive). The worst of it, though, was getting a blood sample.

Zoë is the sweetest cat in the world, but she hates vets. One we had would examine her without assistance until the day when Zoë actually scratched the stainless steel of the examining table. The doctor jumped back, held his arms up, exclaiming, “Whoa!”

Now she gets a vet, two assistants, and being wrapped in The Blanket. Well, and today she got a muzzle for the first time, too. It’s good to know Zoë still has her teeth.

I’m not happy with the vet right now, and it wasn’t necessarily because of the muzzle. They shaved Zoë’s neck to get a blood sample, but she fought so much they decided to get the sample from her leg. A shaved neck and three shaved legs, they got their sample. Since the legs were still bleeding what did they do? They put gauze over the puncture wounds, and wrapped each leg with adhesive medical tape.

Do you know how hard it is to get tape out of a cat’s fur? Especially when it hurts the cat? My roommate and I finally succeeded, but not before our little girl was further traumatized. I think it’s time to find another vet.

Zoë is now on arthritis medication; one of the first real signs of her advancing age. According to the charts, she’s equal to a 75 year old human but she still plays On the Back of the Chair monster, chases the bird toy around the top of the bed, plays keep-away.

Categories
JavaScript Writing

Learning JavaScript errata

Recovered from the Wayback Machine.

If wishes were horses, book authors would have a herd. All too often you see the ‘oops’ and such only after the book is in print. In my case, I’ve worked with JavaScript for so long (since the very beginning) I brought along a couple of bad habits that made it into the book.

One new errata that is going in for the book is the following:

Several examples in the book use document.write, but with an XHTML doctype. The document.write or document.writeln functions do not work with XHTML when the page is served with the application/xhtml+XML MIME type. The examples in the book work with the most common browsers because the examples have an .htm extension. These pages are served up with an HTML MIME type, regardless
of which DOCTYPE was used, therefore the use of document.write or innerHTML does not fail. When the page is loaded with an XHTML MIME Type, though, the examples will fail.

The examples will work in the most common browsers, and to ensure they continue to do so, you can change the DOCTYPE to an HTML one, though you’ll need to modify automatic closings such as that on the meta tag (remove the ending ‘/’) if you want them to validate.

The author is apologetic for not explaining this in Chapter 1. The alternative is to use the DOM to create new page elements and append to the document, but since this wasn’t covered until later in the book, document.write was used instead.

Typically, you’ll want to use the DOM, just because this ensures the examples work fully with XHTML, as well as HTML. To see this demonstrated more fully, the author is working on modified examples using DOM calls and ensuring the examples work as XHTML. As soon as these are finished, they will be posted and a note added to this errata page.

In this, the DOCTYPE is XHTML but the page is served up as HTML. As Anne Van Kesteren succinctly puts it it doesn’t matter what DOCTYPE you use if the page is served up as text/html. And yes, I am using document.write and innerHTML, bad me.

I don’t necessarily share in the universal condemnation of document.write or innerHTML, especially when you’re learning. I have 98 examples in the book, and a simple document.write sure saves on book space rather than having to use the DOM to get document, and use create element and create text node and append and yada yada. What I should have done, though, is create a library and make my own version of ‘write’ that is XHTML friendly, and used this. Note, though, that in the book I don’t cover the DOM until chapter 11, so the only alternatives I had were document.write or an alert, and the latter doesn’t work if you’re using focus and blur events.

However, in pages where I used document.write, I should have used an HTML DOCTYPE, and also made mention of document.write and its incompatibility with XHTML. I should also have covered this in more detail in chapter 1. I should have also covered quirks mode in more detail in chapter 1.

As for innerHTML, now that one is open for debate. There’s bunches of Ajax developers who will only give up their innerHTML if you pry if from their cold, dead browser. BUT, it’s also not XHTML friendly, though it is the handiest darn thing (and again, one could create a library alternative).

The reason why these are a problem is they both allow us to add XHTML formatted data directly to the document, but without going through the XHTML validation process. When one serves valid XHTML, one doesn’t want one’s page developer putting crufty XML or HTML into one’s perfectly lovely XML formatted document. Gives one heartburn, causes one to tear hair out, does odd things to one’s browser and so on.

For now, I asked O’Reilly to put in this errata. Next, I’m going through all of the examples and updating them to be more forward looking and using the DOM, only. These will be provided as secondary downloads, because comparing the two–the original example and the modified–is a learning experience in itself.

The use of document.write and innerHTML is incidental to most examples. I only used such to print some result out or demonstrate some other feature of JavaScript. Still, if I’m going to stress best practices, I blew it with both of these. All I can say is I think it is a good book regardless, these errors aren’t that common or that essential, and mea culpa. Twenty lashes with Firebug.

Here’s a discussion on the problem and code workaround. Note that both Google Maps and Google’s adSense use document.write, so I’m in good company–the use of these really are ubiquitous, but NOT a best practice, so no excuse for me.