Archive for the 'writing' Category

Book things

Tuesday, May 12th, 2009

In the spirit of tooting one's own horn....

Top 3

This morning I noticed my OOJS book is #3 in Amazon's JavaScript category, wo-hoo! Then it dropped down but in the evening it's up again. Nice company - OOJS, Doug Crockford's book and David Flanagan's giant Rhino JS book.

Not that I'm obsessed with my Amazon ranking, of course not (yeah, right), but I'm happy when the book sells in the top 25 (first page in the JavaScript bestsellers list). In the good days it's around 10, in exceptionally bad days, drops out of first page. But top 3 - nice!

Nettus.com promo

nettuts
book cover

You can enter to win one of the three free copies of the book over at nettuts.com. Very kind words in the nettuts article and over 500 comments so far! Nettuts is a very cool site, I'd love to be able to contribute an article or two at some point in the future.

Vote for me

award

My publisher, Packt Publishing, has established an "Author of the Year" award. So help me win that weapon baby and vote for me.

 

At the (Java)Ranch this week

Wednesday, August 27th, 2008

JavaRanch Moose There's a book promotion event this week at the JavaRanch's HTML and JavaScript forum, ranchers are asking all kinds of interesting questions about my OOJS book. There will be a free book giveaway at the end of the week, so come in and join the fun.

Yesterday my post count got from 0 to 15 and today I see that there are even more interesting questions, so it will be a busy night. I'm all armed with a big cup of coffee, Pepsi MAX (twice the caffeine, zero callories, contains aspartame which causes cancer and should be outlawed, but let's live on the edge for now), so off I go!

BTW, I noticed today that my book was #17 in the JavaScript category on Amazon, watch out Doug Crockford and Dave Flanagan! :D

 

Today’s mail: a box full of … my book!

Friday, August 8th, 2008

Finally! The wait is over! After people have already managed to read the book, the chef d'oeuvre that is my Object-Oriented Javascript and some have published 5 star reviews on Amazon, the author finally gets his copies. Oh, happy day! 15 copies, yeey. I don't get to keep them all, because 10 are for my reviewers (since 9 of them are either here in LA of in SF bay area, I wanted to give them their copies and my thanks personally) and one, of course, goes to my parents (my parents are so careful with their copies of my books, they put them in protective transparent covers and so on :) )

oojs

oojs

As you probably know, kids often have more fun with the wrapping than the gift itself. My kids are not an exception:

oojs

oojs

 

The JavaScript book is almost there

Wednesday, July 16th, 2008

Whew, after a whole year of writing, preparation, edits, blood, sweat, tears, I finished all the latest edits and reviews for my new book, Beginning Object-Oriented JavaScript. It should be out any day now. I can't be happier!

cover.png

You can pre-order with 10% off from the publisher's site.

 

Editing made easy: 6 words to cut out

Saturday, April 26th, 2008

When you write something: a book, an article, an email... cut out needless words. The copy after editing should be shorter. Writing is not speaking, it must be tighter. (And, if you find an email is getting longer, just phone the person, he'll never read the email anyway)

I've read somewhere Mark Twain was saying that "very" should always be cut out. I started paying attention to my use of "very" and found that a sentence only wins after I un-very it.

Today I came across this article listing 5 more words to cut out. So here's the list of no-no words, should make any editing process much easier:

  • very
  • really
  • just
  • quite
  • perhaps/maybe
  • that

Check the comments too, there was an interesting insight about words we use to "temper" our speech which we should probably omit when writing, words such as "slightly", "a bit", "somewhat".

And here's another excellent piece on editing I just found:

there is no good writing, only good re-writing

 

A collection of writing tips

Saturday, April 19th, 2008

A collection of writing tips here, includes advise from Stephen King, Paul Graham, Scott Adams and others.

In the end, if you want to write well I believe it all boils down to:

  1. write - daily
  2. edit - cut out needless words
  3. read - everything you can lay your hands on

It's so simple and yet we keep looking for the "secret". Same with dieting: all boils down to a/don't eat junk and optionally b/exercise. But we keep looking for the shortcut, the miracle diet that will allow us to "take it off and keep it off" while lying on couch on front of the TV.

 

replace selected text (Firefox)

Thursday, March 6th, 2008

A quick function to replace the selected text (in Firefox). Accepts:

  • string to replace the selection, or
  • callback function that takes the selected text and returns a string to replace the selection
function replaceSelection(t) {
  if (typeof t === 'function') {
    t = t(window.getSelection().toString());
  }
  var range = window.getSelection().getRangeAt(0);
  range.deleteContents();
  range.insertNode(document.createTextNode(t));
}

Usage:

1. Replace selected text with "dude"
replaceSelection('dude');
2. Uppercase the selected text
replaceSelection(function(s){return s.toUpperCase()});
3. Lowercase the selected text
replaceSelection(function(s){return s.toLowerCase()});

Luckily I'm so close (and yet so far) to finishing this book, otherwise I won't be able to help myself but create a whole toolbar of bookmarklets for "power" Google doc users...

 

There will be junk

Monday, February 18th, 2008

Tip #1 for writing better code - edit. With this book I write, I find I'm spending more time editing than writing. The first draft is usually bad. The first draft "works" in the sense that it covers the material, but not necessarily in the best possible way.

Same thing with writing code, it's one thing to have the code working and it's a separate thing to have the code easy to understand, efficient, maintainable, expandable. When you're working on a problem, sometimes you just try different things. One of them works. It's your job not to stop there but to edit this first draft. Don't commit first drafts.

There will be junk. It's up to you to make sure that junk doesn't find its way to the final product, only because "it works". It may work now, but how about tomorrow. Is your code fit for print?

 

Google docs bookmaklet to format code

Sunday, January 27th, 2008

Something has been annoying me for some time as I write this book in Google Docs: I want to be able to format text as code (Courier New) only using the keyboard. So I came up with this bookmarklet. It's one of those "works for me" so if it doesn't work for you feel free to modify and post here your version.

Code

Basically I attach an event (FF way, so won't work in IE) that listens to the keyboard combination ALT+x and then calls the appropriate editor command:

javascript:(
function(){
  window.frames[1].document.addEventListener(
    'keypress',
    function(e){
      if (e.altKey && e.charCode === 120){
        EditorCommand('fontname', 'Courier New');
        return false;
      }
    },
    false);
}
)()

Download

Right-click, bookmark:

Alt+X

 

Zlatina = 4

Saturday, January 26th, 2008

So close to being finished with 5 chapters and 1 appendix of the new book (hey, that's 50%+) and just after the n-th edit of chapter 3, I thought I might share this picture I have on my desk. It's an self-portrait of my 4yrs old daughter Zlatina, in front of a window. Once this book is out of the way, she's so getting her own blog :)

zlati-sun-sky.png

 

How to write computer books

Thursday, December 13th, 2007

book.png David Barnes, who works for my publisher Packt Publishing, has started a blog: "How to write computer books". Great stuff in there. If you write or intend to write a book, a blog or anything technical, it's a great addition to your RSS reader.

Inspired by this quote from Mark Twain, yesterday I went through the draft of chapter 3 of my new book and searched for all instances of the word "very". Then deleted most of them. Probably should've deleted 'em all, but I couldn't help myself. It's tough. Very.

Anyway, especially since "creating passionate users" is no longer updated, David's new blog is good news.

On a similar note, here are the slides from a presentation called "Writing engaging tutorials" by my fellow Yahoo, Christian Heilmann.

 

On Raymond Chandler’s writing

Friday, October 26th, 2007

I've never been into crime fiction. I mean I've read The Hound of the Baskervilles, but that's about it. I like Douglas Adams, Terry Pratchett, looove Kurt Vonnegut, enjoyed On the Road, Catch-22... So it came as a surprise even to me when I started reading Raymond Chandler and actually enjoying it. The thing is I love to learn about the places I visit - culture, people, history, geography. Living and curious about LA now, I came across an article saying that Chandler wrote quite a few things about LA and California that stuck around. Anyway, I picked up a volume, read The Long Goodbye and loved it.

Just read an article about Chandler's writing process. Since I just started working on my new book, I found the article pretty interesting. The "normal" editing process I think is: you write a draft, you review it and scratch some parts, maybe replacing them with others, adding, removing. Chandler did the opposite - he underlined only the words that will stay in the next draft, everything else is to be rewritten or simply gone. This way he could tighten his sentences if not cut them in half. I like that a lot. Short is good, short is often clearer. It's so easy to be verbose, hoping this will clarify whatever you want to say. But often it isn't. I believe Mark Twain said something like "I would have written you a shorter letter, but I don't have the time"

That makes me think - it's so bad that most computer books today don't aim for brevity, but for volume instead. I've heard authors saying that their publishers love to ship big ass books on the market, because supposedly readers want big books. If it's big, there must be good stuff in there. Luckily my publisher is not like this, of course :) Although they would probably also agree that the overhead of publishing a 100 pages book is pretty much the same as a 1000 pages book. A tiny book still needs to go through the same process as the big one. So why not ship a bigger volume that will look more impressive. Imagine the dialog:

- Honey, how do you want to decorate this room?
- Hmm, I'd love to have a shelf of Java books right there, about four feet long. Yes, and right below it, gimme some design patterns and some .NET, half and half. Fabulous!