A CSDL Syntax File for Vim

It’s not always that you get to contribute to one of the oldest Open Source software projects, but that’s exactly what happened on March 7, 2013. Bram Moolenaar was kind enough to include my CSDL syntax file to the official Vim source code repository.

Being a long-time Vim user it meant a lot to me and I’d like to thank Bram for letting me add my name to the list of contributors. I really appreciate it.

If you write CSDL, this file will help you do it in a more convenient way. Newly built Vim binaries should start including CSDL support soon, but if don’t want to wait, you can grab the CSDL syntax file from the datasift-vim repository.

CSDL syntax highlighting works automatically for .csdl files, but you can force it in the following way:

  • Press Esc
  • Type :syn on
  • Press Enter
  • Press Esc
  • Type :set syntax=csdl
  • Press Enter

To achieve the same effect In gVim or MacVim, select Syntax -> Show filetypes in menu and then select Syntax -> C -> CSDL.

Quick backups with Fabric and Python

Backups… you know you have to make them, but you would so much rather pay someone else to do it. And you know, what? You can outsource it to someone else and you won’t even have to pay for it. That’s right! Let a Python script do the hard work while you do something far more creative.

If you are using a shared hosting provider like DreamHost you are probably hosting a number of domains on there, because it is cheap, because it is easy, and because it makes sense to test things on an inexpensive server before you commit to a dedicated machine or something even more powerful.

This article is also available on Amazon Kindle. You may consider buying it, if you would like to keep it for your reference.

Quite often, those least expensive server options do not come with backup tools, and even if they do, you might want more control and a local copy, or maybe a remote copy that is done your way. For those times, and for many others, Fabric is the tool to go to. What is Fabric? The official documentation states that:

Fabric is a Python (2.5 or higher) library and command-line tool for streamlining the use of SSH for application deployment or systems administration tasks.

There were a lot of long words in there. We’re naught but humble pirates… What is it then?

From my point of view it is the easiest way to write Python scripts that automate system administration, network administration, and software deployment. Those tasks routinely use ssh, scp, and sudo and are very cumbersome to write in Bash. Writing them in Python results in much cleaner and maintainable code. If you ever tried to put off automating certain tasks because it would be a nightmare to write them in Bash, Fabric will make you very happy indeed.

On the surface it is a pointless replacement for custom shell scripts and makefiles, but when you start using it, you realize that it simplifies just what needs to be simplified and leaves you to do what you want. And that’s what the good tools are supposed to do.

Consider the simple task of making backups of directories on a shared server. If you were to do it by hand, you would use ssh to log into the server, make a note of the directory path (OK, you can skip that step if you already have that information), create a .tar.gz or .zip archive, log out, use the information you gathered to issue an scp command to copy the archive to the local machine.

If you were to write a Bash script to do that for you, you would need to test and re-test things and you’d quickly grow discouraged. Fabric lets you get these tasks done quickly and encourages saving them in a library of recipes known as fabfile (an obvious play of words on the old Unix makefile). It is a Python script that the fab will look for by default in the present working directory. Here’s a example of a Fabric file, a script called fabfile.py that the fab command looks for by default

#!/usr/bin/python2.7
from fabric.api import local
from fabric.api import get
from fabric.api import put
from fabric.api import reboot
from fabric.api import run
from fabric.api import sudo
from fabric.context_managers import cd
import time

def remote_get_archived_dir(da):
    """Make a tar.gz archive of da (a directory under ~/)."""
    o = run("cd ~; tar -zcf ~/%s.tar.gz %s" % (da, da))
    ds = "%s_backup_%s" % (da, time.strftime("%Y%m%d-%H%M%S", time.gmtime()))
    sl = local("mkdir %s" % ds)
    sg = get("~/%s.tar.gz" % (da), ds)

You can use it to backup any directory under ~/ in the present working directory on a local machine using the following command:

$ fab -u username -p password -H hostname remote_get_archived_dir:da

For example, if the directory you wanted to archive and make a local copy of that archive was called force located on a host called luke.example.com, you’d use the following command:

$ fab -u hansolo -p pssst -H luke.example.com remote_get_archived_dir:force

And since each fabfile is a Python script, you can use all of the power of Python in such scripts.

Fabric is not a part of the Python distribution, you need to install it using the following command:

$ pip install fabric

Once you have done that, see for yourself how easy it is to do the stuff you had to do by hand.

PS. If you want to learn Python, have a look at these Python programming books.

Gift Ideas: The Art of Star Wars

Every few months my family has a real problem getting me gifts. No, I’m not one of those guys who have everything, but I do not necessarily desire the things ‘normal’ guys want. That is why I decided to start a series of posts on the subject of gift ideas. These will be things I own or wouldn’t mind receiving as a gift.

Feel free to steal those ideas if you want to make the geek in your life smile. First, the always welcome classic, Star Wars. Now everyone likes the changes George Lucas has recently made to the old Star Wars movies, but everyone will appreciate a book on the subject. And ‘The Art of Star Wars’ must be the best illustrated book series on this subject. These books are not only great gifts for Star Wars fans, programmers, sysadmin, geeks, etc. but they also make great gifts for 2d/3d computer artists and animators.

Rare, hard to find editions are also available, but may be on the expensive side:

And, if there are any gaps in the movie collection, a DVD or BlueRay disc won’t go amiss:

Vim: Which Line Am I On? Which Column Am I In?

Vim is a powerful beast of a text editor, but you would know that from its’ spartan screen. Sometimes it’s a good thing, but sometimes you need to know where you are. Fear not the answers are here.

Which Line Am I On?

The following Vim lesson is an excerpt from “Vim and Vi Tips.” You can get in PDF in a couple of minutes!

If you ever need to know the current line number, try these commands:

  • Display the line number:
    type :#, :num, :.=, or press Ctrl+G.
  • Display the number of lines in the current file:
    type :=
  • Display the line number and the total number of lines:
    press Ctrl+g.
  • Display the number of the next line that matches a regular expression:
    type :/regex/=

The search will start on the line with the cursor and continue towards the end of the current file.

How-To:

  1. Open exercise file: vi line-number.txt
  2. Type 4G to move the cursor to line 4.
  3. Type :num
  4. Press Enter/Return.

If you would like to display line numbers without having to check them using the commands described in this section, you need to set the number option:

How-To:

  1. Press Esc to switch to command mode.
  2. Type :set number
  3. Press Enter/Return.

If you want to reclaim the space taken by the line numbers, you need to set the nonumber option:

How-To:

  1. Press Esc to switch to command mode.
  2. Type :set nonumber
  3. Press Enter/Return.
  • You must switch vim to command mode to use the commands described in this section.

Which Column Am I In?

If you would like to display a continously updated location of the text cursor, the line number and the column number, you need to set the ruler option:

How-To:

  1. Press Esc to switch to command mode.
  2. Type :set ruler
  3. Press Enter/Return.

The location of the cursor will be displayed in the right half of the bottom of the vim screen.

Did you enjoy this short Vim lesson? There are plenty more practical Vim tips in Vim and Vi Tips! You can get in PDF in a couple of minutes!

Buy Now

How Amazon did everything wrong (but I still got to #1)

I have been thinking what I should write about in this post for the last couple of weeks or so. I have always liked the convenience, the reliability, and speed of operation of Amazon. They are an amazing company. When they came out with their Kindle devices, I got the Keyboard Kindle as soon as I could and I was not disappointed.

When Amazon had opened their Kindle Direct Publishing platform to the publishers without the US presence, I was among the first to enable my books for publishing there. I accepted their strange pricing model for ebooks that effectively forces the publishers to price their books at no more than $9.99 if they want 70% of the cover price and I didn’t even mind the DRM as long as the books got on the readers’ devices in under a minute. I knew that ebooks were the future so I accepted the limitations. That and the fact that Amazon knows how to sell.

But I do have a problem with their the current model of co-operation where authors and publishers are treated like they have nothing to say and should just shut up and take it like a man. And that it precisely how Amazon treats them, despite the official friendly message.

What Amazon would like you to think

If you watched the recent Kindle Keynote on September 6, 2012 you had a chance to see the example of a successful self-published author who uses KDP to bypass the traditional gatekeepers of the publishing industry, the agents and the publishers. Great. More power to authors, I say. More power to Theresa Ragan who was used as the example of how good the Kindle Direct Publishing platform is for the authors. (She apparently has sold over 300,000 copies of her books on the Kindle platform).

While I followed the keynote, I was trying to figure out what to do about the real Kindle publishing experience I was going through. When it works, the Kindle Direct Publishing platform is a nice experience with not too steep a learning curve, but when you have questions or when things go wrong, you will be either ignored, get a canned response, or you will be taught an expensive lesson in lost sales. Which I got.

Early signs of future trouble

I got the first taste of what Amazon thinks of self-publishers back in November 2010, when I tried to publish an ebook in Polish, a language not officially supported by Amazon Kindle. It got rejected, which surprised me, because I had easily found other books in the same language available from the Kindle store, so I asked the KDP support staff for an explanation. Their canned response stated that I would receive a reply in 2-3 days.

The reasons for not supporting certain languages by Amazon Kindle have never been clear to me. It makes not sense to support Swahili but not Polish. Both are spoken by roughly the same number of people. At least that’s what Wikipedia says.

They have yet to answer that question.

That didn’t upset me too much. The book was an experiment in publishing a blog archive, so not much work went into it anyway. I left it on my computer and let Amazon sell my other books for me. They were never great sellers by the publishing world’s standards, because computer books are never great sellers anyway. Also, the size of the Kindle audience was far smaller in 2012 than it is today.

And then, in August 2012 I decided to update one of my best-selling books, Vim and Vi Tips: Essential Vim and Vi Editor Skills, 2nd ed. and do a KDP Select promo for it. I thought it would be a good idea to use KDP Select to check if people were still interested in the subject and in my book before I sat down and wrote the third edition.

Amazon gives Kindle publishers a promotional tool called KDP Select. You have to accept certain restrictions (more restrictions!), but you get a chance to promote your book on the Kindle platform. The only promo price you can set is $0.00 and you can do that for at most 5 days within any 90-day period. The difference between setting the price of your book to $0.00 and doing a FREE promo is the description on the book page that says something like “You save $29.99!”

I defined a two-day promotion for August 17-18, 2012 and went to bed. I expected around 1,000 downloads as was the case with my other books. Anything above that would be very nice indeed.

Day one (August 17, 2012)

The promotion started slowly with a few dozen downloads and it looked like the book would reach that 1,000 copies goal. I did the usual things: tweeted the link, shared it on Google+ and Facebook. After a couple of hours, sometime during lunchtime I logged into my KDP account and noticed something strange. The number of downloads had already exceeded a few hundred copies. It was Friday morning in New York. A few minutes later I reloaded the stats and saw another couple of hundred copies added to the count. That was unusual. I poured myself a cup of coffee and kept refreshing the stats for a while. Things looked very good. I kept coming back every half an hour or so. The news about the promotion was spreading fast among the developer community and soon got on the front page of Hacker News. Then it went crazy.

The book was downloaded by 10,000 Amazon users within the first 6 hours of the promotion. That’s approximately one copy every 2 seconds.

To put things into perspective, the second most successful KDP Select promotion I have done so far put one of my other books into the hands of approximately 1,000 users. 10x in six hours was a very good result indeed.

The book roared up the charts. Within 6 hours it reached the following record places:

#2 in Kindle Store > Kindle eBooks > Nonfiction > Computers & Internet > Operating Systems > Unix

#4 in Books > Computer & Technology > Operating Systems > Unix

#92 in Books > Computer & Technology > Software

For a while, the book was doing better than Emily Bronte’s Wuthering Heights. You could say I was beating the British on their own turf, at least for a few hours. It was all good fun while it lasted, but it wasn’t all just a flash in the pan. To this day, if you search for a Vim book on the Kindle store, my book is #1. Mission accomplished.

Day two (August 18, 2012)

In the end, the book was downloaded by over 24,000 Amazon customers, some of whom wrote to tell me that the promotion was the reason they opened accounts with Amazon. It looked like a win for all: the readers, Amazon, and myself. I doubled the number of readers to over 50,000 in just 48 hours.

Let’s repeat this. 24,000+ Amazon users had downloaded my book in 48 hours. That’s an average of 500 copies per hour.

When I shared this news on TWiSTLIST someone wrote that’s only because people love free stuff. No. That wasn’t the only reason. A computer book does not get downloaded by 24,000+ in two days just because it is free. But whatever the reason, the promo was success.

Did I say, ‘Success’? Not so fast…

Encouraged by the success of my promotion, I decided to publish the third edition as quickly as possible. I never expected what Amazon had in store for me.

Dear valued customer, please kindly prove that you are not a camel

When a promo goes this well, you want to follow up as quickly as possible, right? I certainly did. But then Amazon had served me their first nasty surprise.

Here’s an excerpt from the email I got from the KDP support team on August 20, 2012 after I submitted the third edition of Vim and Vi Tips for publication:

Hello,

Thanks for using Amazon KDP! We look forward to bringing your books to
the Kindle store. Copyright is important to us – we want to make sure
that no author or other copyright holder has their books claimed and
sold by anyone else. For your book(s), we just need a few additional
items:

During the first week after the promotion the third edition of my book got witheld from publishing. Twice. You see, Amazon only wanted to make really sure that I owned the rights to my own book. I was asked to prove that once, then my book got withheld again and I had to prove it all again. Nice.

It took me over a week to deal with those issues. That’s one week of lost sales.

Now, 24,000+ copies in two days (Friday and Saturday) plus a bunch of new customers may not be siginificant for Amazon and I wasn’t expecting the red carpet treatment, but those stumbling blocks came out of nowhere and surprised me in a very non-pleasant and costly way.

Your update is not welcome

Once the third edition was published, I wanted to let all those 24,000+ readers know that there is a new edition and, should they choose to do it, they can buy it.

But how do you let over 24,000+ readers know there is an update available? Amazon does not give publishers access to the customers’ email addresses so you cannot get in touch with them directly. Also, you cannot put a link inside a Kindle book to another item on the Kindle store or on the internet. They are all disabled. And even when you do publish an update to your book, amazon may not make it available to those who have the previous version.

You have to upload an updated binary and ask the KDP staff to send an email to the people who purchased your book letting them know about the update. I followed the procedures and, foolishly, I thought it would be all that was needed.

Here’s an excerpt from the boilerplate response I got from the KDP support team:

August 30, 2012

Hello Jacek,

We received your request to provide updated content to customers who purchased your book. Thanks for providing specific details about the changes made. We’ll perform a review of the changes to determine the most appropriate way to describe the updates to your customers. This review will be complete within four weeks, and the possible results of our review listed below.

1. If the changes made to your content are considered critical, we’ll send an email to all customers who own the book to notify them of the update and improvements made. These customers be able to choose to opt in to receive the update through the Manage Your Kindle page on Amazon.com. www.amazon.com/gp/digital/fiona/manage

2. If the changes made to your content are considered minor, we won’t be able to notify all customers by email, but we will activate their ability to update the content through the Manage Your Kindle page on Amazon.com.

3. If the changes made to your content have caused unexpected critical issues with the book content, we’ll temporarily remove your book from sale. We’ll notify you of the issues found so you can fix them. Once the improvements are made, just let us know and we’ll then email customers as in case 1.

Once our review is complete, we’ll email you to share the results and action taken.

Thanks for using Amazon KDP.

That’s right. They give themselves up to four weeks to make their mind up. And they can do pretty much anything they want with that update and you have zero say in this.

Still, I thought that was reasonable. What I didn’t take into account was how broken the Amazon Kindle Direct Publishing platform is, how poor is the Amazon Kindle team’s communication with the publishers, and how vile are the Kindle trolls.

When you post an update to your Kindle book and let Amazon know about it you are asked to provide samples of the changes you made and write a convincing email explaining why the KDP team should notify their customers about it. It’s all discretionary and there are are three official outcomes outlined in the email I quoted above. Read it carefully, it is a broken system that the publishers have nothing to say about.

I thought my request to notify the customers about the update was justified, as I not only gave people a free update to the next edition, but I also fixed the formatting errors spotted by a couple of readers. It’s not like only small publishers make such errors. Formatting issues were the reason for an update to the biography of Steve Jobs and recently J.K. Rowling’s new book had similar problems. I thought I had a good case and, however long it would take to review it, I could count on positive outcome.

You can’t have that book

The update went live on September 1, 2012 and I thought all was fine. Silly me. Without telling me about it, Amazon made my book unavailable for purchase on the same day and posted the following message on the book’s page:

Amazon lied.

Nobody was in touch with me, nobody notified me, nobody could point out the critical issue that Amazon claimed the readers have discovered, and nobody was “working with me.” I caught this only because I was checking the books’ page every couple of hours, not because Amazon bothered to notify me.

Alarmed, I send an email to the KDP support team and got the standard canned response that they appreciate it and will get back to me in 2-3 days.

It was Friday, but I though that since the issue was critical, and they claimed to be “working with me” I would get someone to quickly reply to me. Nothing happened for 24 hours. I then decided to use the social media to bring this issue to someone’s attention. As this was an emergency, I tried to reach them via Twitter, Facebook page, the KDP support forums, and Hacker News. Finally, on Saturday, September 1, 2012, I recieved this email:

Hello Jacek,

I’m very sorry for any frustration this issue has caused. We’ll need a little time to look into your title’s buyability issue.

We will contact you with more information by the end of the day on Wednesday, September 05, 2012.

Thanks for your patience.

I patiently waited and this is what I got in my inbox on September 5, 2012:

Hello Jacek,

I wanted to send you a quick e-mail to let you know that we are still researching your concern. It usually takes 1-2 business days for this sort of research, but in this case it’s taking a little longer. I’m very sorry about this delay.

We’ll be in touch shortly with an answer for you. Thanks for your patience.

At this point I lost two weeks of sales.

How did you like your free book, then?

Despite blocking the update that fixed the issues with formatting and blocking sales of the updated book, Amazon sent two emails asking people to review the book. The book received a number of negative reviews for “typesetting issues” (fixed in the updated) and “outdated content” (fixed in the update). These things were minor, but you should never argue about them. Just fix them. The few negative reviews took a star off the overall rating of the book. I wasn’t surprised, the people were upset and I had no way of communicating with them while Amazon blamed me and made me look bad in the eyes of the current and the potential customers.

The Italian job

After another week of lost sales, this little gem arrvied in my inbox on September 10, 2012:

Gentile editore,

desideriamo informarti che abbiamo riscontrato dei problemi con il tuo libro. Al fine di evitare che altri lettori riportino gli stessi errori, abbiamo temporaneamente annullato la pubblicazione del tuo libro.

That’s right. I got a short email from Amazon.it. In Italian.

Why?

Thanks to Google Translate I was able to understand that someone in Italy had spotted a problem with the update and reported “duplicated content” which I had problem finding, because Amazon does not keep the history of book updates and does not tell the publishers, which version of your book the customer is complaining about. From my point of view, there were no typographical errors.

And then it dawned on me. As Amazon began serving the update, someone in Italy got upset about the image I had placed in several places inside the book. The image looked like this:

It was a Kindle version of the shareware “nag screen”, but I tried to make it polite and non-intrusive. You still got the full thing, no content was obstructed, but apparently some people in Italy got offended. And why shouldn’t they? They got a full update to the book they got for free and there was a message inside that if they like the book, they might buy it. No obligation. So they complained to Amazon, instead of me (the email address can be found inside the book) and Amazon pulled the book from sale.

The emails in Italian were the last emails I had received from Amazon. I removed the image that had offended the good people of Italy from the latest update.

Curiously, there are plenty of books that the readers complain about in the Amazon reviews and even when they point out glaring typographic errors, those books are never subject to the same kind of treatment like mine was.

Amazon Kindle has become a strange place where a piece of porn for housewives sells just fine despite many damning reviews, but a technical book will get pulled immediately for weeks without proper explanation. I guess housewives and guys looking for relief are too busy with their privates to discover the way to troll the system. I guess I’m in the wrong business.

What is more interesting, the real error that I discovered myself (one section was displayed in the wrong order) went unnoticed…

I can take criticism, I am open to discussion and suggestions how the book could be improved. But we won’t have a proper conversation as long as Amazon sits between me and you.

What Amazon needs to change

No system is perfect. The Amazon Kindle team have built an impressive system for publishing, purchasing, delivery, and reading ebooks. Kindle is the ‘iTunes for eBooks.’ They got many things right, but they do need to improve their relations with publishers, regardless of the publisher’s size.

  1. Stop lying that they are “working the the publishers,” when they are not.
  2. Stop asking the readers for reviews when they block the sales due to issues reported by the readers.
  3. Add version information to error reports.
  4. Start communicating with the publishers.

What about the update?

The third edition of Vim and Vi Tips is now available in PDF format. It looks great, much better that the Kindle version. You can click to buy it below and have it on your computer within minutes:

Buy Now

Thank you for your support!

How I built a recording studio for the price of two Barbie dolls

Kids today are growing up in the world saturated with advanced technology, but we do not realize how natural it all feels to them until we observe them using those tools.

My daughter (age 6) has been asking me for a “tiny radio” for while. Like any parent I wanted to make her happy and over the last six months we’ve seen dozens of radios, large and small, including the cheeky Philips FM radio alarm clock with interchangeable facia (pink and blue, of course), but none of them was the right kind.

This article is also available on Amazon Kindle. You may consider buying it, if you would like to keep it for your reference.

I quickly realized she wanted something she thought was called “tiny radio,” but it wasn’t actually a radio at all. We both grew a little frustrated with this issue, I didn’t know what she meant and she was getting upset with me for not being able to read her mind. You know what I mean if you have kids.

A couple of weeks ago she entered my room as I was practicing a presentation and saw my old Sony voice recorder. She smiled as soon as she saw it, “That’s the tiny radio I want, Daddy.” Oh, so that’s what she wanted. “OK, darling, what kind of voice recorder do you want?” I asked her happy as if I had found Higgs boson in my shirt pocket. “It has to be better than my pink mic.”

Of course! The pink mic!

Unlike the ugly doll it came in the box with, the microphone was an example of great toy design: a hard, scratch-resistant plastic case housing an electret microphone, a tiny loudspeaker, an IC with a tiny bit of flash memory, and two buttons. The mic can play a selection of annoying “baby disco songs,” but it also records voice, which she used to pull all kinds of pranks on us and our guests.

The pink mic had served her well, but she became frustrated with the poor quality and the short recording time. So she wanted to have her own pocket recording studio, just like the one her daddy used to have. (I used to be a podcaster a few years back and now she wanted to have a recording rig of her own.)

I love my daughter to bits and money is usually no object when it comes to toys (within reason), but I also know that a complex audio rig is just too much for a six year old’s attention span. I wanted to give her something she can use on her own, not something I would need to be there to operate. (Being one of “Skype dads” I cannot be there every time she needs my help.)

Luckily, the technological advances that happened over the last five years in voice recording hardware came to my rescue. When I started recording my podcasts in 2004/2005 the digital voice recorders available on the market were either very expensive pro rigs or really crappy “digital business dictation voice recorders” whose designers had tried to squeeze maximum recording times at the expense of quality. And being aimed at business users, almost all of them used the WMA file format. Not much use if you have a Mac.

The popularity of the MP3 file format and the falling prices of Flash memory and the AD/DA ICs that can encode/decode WAVE/PCM and MP3 formats have made it possible to design and manufacture inexpensive digital voice recorders that can record and play high quality audio.

When I realized that the specs of the cheap voice recorders available today exceed the specs of what was available back in 2004 choosing the right recorder for my daughter had become much easier. All she needed was an MP3 recorder that can save files in a 64kbps/22kHz, has a large display, a reasonable amount of memory, a mic socket, and a headphone socket. Having sorted that out, the last thing to take care of was choosing the right color of the recorder. I chose the white Philips Digital Voice Tracer LFH0615. (The exact model is not that important, any Philips Digital Voice Tracer should do just fine.)

When the big day came and my daughter could finally open the boxes she was speechless. She knew she had asked us for “things for grown-ups,” and she did not expect to actually get them. When she saw the voice recorder, the microphone, and the headphones she just stood there for a while in complete silence. When she was finally able to speak again, her first words were, “now need a web page.” That’s when it was my turn to go speechless. I could not believe my ears and didn’t know what to say.

After I was able to speak again, I gave her a short lesson on how to use the microphone, the voice recorder, and the headphones. By the end of the day she has recorded 64 tracks (songs, her own stories, sound experiments, etc.) The dolls and the plush toys are now of no interest to her as she explores the new possibilities this simple rig gave her.

As a chance benefit gone is her slight lisping she was supposed to see a doctor about.

The key to the success and a great way to avoid frustration was making the right equipment choices. I bought the Philips voice recorder not just because it had the right specs, but also because it had big buttons. The microphone is the Sony FV220 dynamic cardioid karaoke mic. It’s a dynamic microphone in a plastic case, which makes it light enough to be safe for kids, you do not want to use pro stage or studio mics that can crush kids’ feet or become deadly projectiles when the mood turn foul. It also looks like a pro stage mic, which is important for small kids that want the “grown up” toys.

One problem with the Sony mic is its handling noise, which I solved with a desk mic stand. That’s right, I gave my daughter a desk mic stand with a heavy base. When the arm is raised all the way up it is just the right height for a six years old girl and it is not as easily toppled over as the typical stage tripod stand. I taught her not to touch the mic when she is recording and that and a little practice took care of the handling noise.

The last part of the setup, the Sennheiser HD 202 II Pro headphones took care of high-quality sound playback, impossible to achieve with a tiny loudspeaker built into the Philips voice recorder.

Before going to bed my daughter told me that she doesn’t want to have her own web page, but she wants to be on YouTube, because “that’s where the real stars are…” For a six years old kid, she is pretty savvy about the places she can find her audience.

I am a bit shocked, to tell you the truth. The kids are not afraid of the new technologies, they simply accept them as if they were always there. When I was her age the most advanced piece of technology I owned was a reel-to-reel audio tape recorder. Compared to my childhood friends running around with boy scout knives and runny noses I was living in the future, but that is nothing next to what the kids today have access to. What’s more, all these tools are really inexpensive. The total cost of my daughter’s voice recording setup was less than two installments of the “Mattel parent tax” aka. an obligatory purchase of the latest Barbie DVD, the Barbie doll itself and a pink doll house repeated three times a year. The educational and creative potential of our little “recording studio” greatly exceeded the cost of the setup.

Wow!

PS. I am not a doctor. If your child has problems like the ones I describe in this post, you should probably ask a real doctor for advice. Remember, I am just a guy writing a blog and I am taking care of my own child, not yours.

This article was originally published on AntyWeb.pl.

Having :Sex with Vim (i.e. browsing the filesystem using Vim)

Vim is a huge subject. I wrote a short intro book on that subject, but some of you though it was too short and asked me to write more. Which I did. And here’s one section that will make you smile while you learn a practical Vim trick!

The following Vim lesson is an excerpt from “Vim and Vi Tips.” You can get in PDF in a couple of minutes!

Browsing the Filesystem Inside Vim

You can browse the local filesystem from within vim in two ways: using the text mode browser or the Open and Save As file dialogs. The latter option is only available in the versions of vim that run as stand-alone GUI applications.

Browsing in text mode can be done in three different layouts: standard, vertical, and tabbed.

Each layout presents the list of files in the current working directory. The thin horizontal line indicates the current choice of the file/directory.

The horizontal view is handy if you are working with long file or directory names. You enable it with the :Sex command:

How-To:

  1. Press Esc to switch to command mode.
  2. Type :Sex
  3. Press Enter/Return.

To navigate the filesystem, use the following commands:

  • Move Up — press k.
  • Move Down — press j.
  • Move to a Subdirectory — select the subdirectory and press Enter/Return.
  • Move to a Parent Directory — select the .. directory and press Enter/Return.
  • Open a File — select the file you want to open and press Enter/Return.

Because vim treats the list of the files in a directory as if it was a file, all cursor movement commands can be used.

Did you enjoy this short Vim lesson? There are plenty more practical Vim tips in Vim and Vi Tips! You can get in PDF in a couple of minutes!

Buy Now

It’s not easy to take your customers’ money when you are a European startup

There is a school of thought among VCs, angels, and founders that startups should try to make money as early as possible, not necessarily because they should learn to bootstrap (then it is a requirement), but in order to learn how to sell, how to listen to the clients, and to show the investors that they understand their market and the basic principles of business.

This is not a bad way of thinking about building an internet business, but it not easy to do if you are in Europe and you have a non-standard idea for taking your customers’ money.

This article is also available on Amazon Kindle. You may consider buying it, if you would like to keep it for your reference.

Putting aside the treacherous mazes of the VAT, I would say that the biggest problem when selling to consumers and businesses in Europe is the dearth of the payment systems available on the old continent and their lack of flexibility for accepting new business models.

There is PayPal, Moneybookers, Google Wallet, and a few card payment processors, but that is about it. Not much choice there.

There is a reason why services like drop.io, mailchimp.com, or kickstarter.com did not appear in Europe before they appeared in the USA—they would not be able to use the payment processing options offered by Amazon (Amazon Payments, Amazon DevPay, Amazon Flexible Payments System, Amazon Simple Pay), that allows them to implement their business models (this is especially true for Kickstarter that needs to collect payment for a deferred transaction).

Balanced? Stripe? Square? Dwolla? Forget it. If you’re a non-US startup you cannot join the club.

There is a lot of talk about government support for entrepreneurs in Europe, but one simple thing that the European startups need is a wider selection of payment processing solutions. The fickle PayPal is not good enough.

Update: Sept 26, 2012 @ 6:00am GMT

A developer from Braintree Payments reached out to me on Reddit and said they recently added support for the developers in Canada and the EU.

Update: Sep 29, 2012 @ 6:46am GMT

Tiago Pinto suggests possible solutions on Twitter. Thank you, Tiago!

Update: Oct 1, 2012 @ 7:21pm GMT

Dr. Alvaro Feito Boirac suggests possible solutions on Twitter. Thank you, Dr. Boirac!

Why Amazon.com associates can’t make money even when Amazon does

Amazon gets well-deserved praise for their customer support. Most of the time. Like any giant, it sometimes gets things wrong, but it tries really hard to create the right buying experience. I have been buying books and other stuff from them since 1999 and I have never had a problem as an ordinary customer.

However, things are not so rosy if you are an affiliate, an author, a developer, or a publisher. But, as you will see, it is not necessarily Amazon’s fault.

This article is also available on Amazon Kindle. You may consider buying it, if you would like to keep it for your reference.

Let’s discuss the affiliate program first. When it launched it was one of the first large scale affiliate programs on the internet that actually let people make money off their websites.

When all Amazon sold were books, the earning were nothing to write home about, but when they added more products (electronics, clothing, photographic equipment, etc.) some enterprising bloggers started making good money with it thanks to the rapidly growing number of broadband users.

But no matter how hard they tried, they couldn’t (and still can’t) capture commissions on all sales they help Amazon make, because the Associates program is compartmentalized in ways that make it impossible for affiliates to make money even when Amazon does.

When some clicks on an affiliate link like this one, they are sent to the Amazon.com website operated by Amazon in the US and that click is registered by the Amazon.com Associates US program. The affiliate makes money when the product the visitor wants to buy is available on the Amazon.com site and can be sold and shipped to the buyer. When those conditions are not met, the following things can happen:

  • The visitor leaves and Amazon.com makes no sale. The affiliate gets nothing.
  • The visitor decides to browse for other products and buys them. Amazon.com makes the sale, the affiliate get a cut.
  • The visitor goes to another Amazon site (Amazon.co.uk, for example) where the linked product is available for sale to the visitor and buys the linked product. Amazon makes money, the affiliate doesn’t.

The last case shows how much the virtual world can still be controlled by geography, politics, and local laws. Amazon operates in a number of countries locally, which means that Amazon.co.uk and Amazon.com are separate entities and they run their own separate accounting departments as well as their own affiliate programs.

Although you can register with those separate Amazon affiliate programs quite easily, it is up to you to create the right links that point to the local sites. This is not such a big deal. Amazon has the tools to help you do that. What is problematic is serving the right links to the right visitor.

As I learned recently, even though I own the rights to my Vim book and I enabled it for sale worldwide, you have to order it from the right Amazon site even when I run a free promotion and give it away for free.

This seems to be an easy problem to solve, just point the visitors to a redirection script that will look at their IP address and redirect them to the Amazon site that they ought to be using, right?

Not quite.

While it might help some visitors, it will make things more confusing for others. You see, when Amazon.com does not have a local subsidiary, they sell some products via their Amazon.com US site (e.g. Kindle books sold to the customers in Eastern Europe are sold via the Amazon.com US site) and other via their local sites (e.g. if you want to buy electronics in Easter Europe you will most likely use the Amazon.co.uk UK site, as Amazon.com will not ship outside the US).

While you can write a redirection script that is smart enough to handle affiliate links for Kindle books using the IP address of the visitor it will point them to the wrong site when they travel. For example, Amazon.co.uk customers visiting Poland would be redirected to the Amazon.com site while they are in Poland and would either get confused or they would need to type “amazon.co.uk” into the URL field and search for the right book. In either case, the affiliate is going to loose the commission. But also think how inconvenient that is for the visitor who wants to buy a Kindle guide to Cracow, for example.

You could publish a choice of links or you could do what John Gruber does and let your visitors choose which Amazon site they want to use. Still, it only solves some of the problems. As someone living in Poland, I shop for Kindle books on Amazon.com US site, but I buy my electronics on Amazon.co.uk site. (And I have a good laugh when the products shipped to me appear to be boxed for the Italian market, but that’s globalization at work.)

The moral here is that you must accept the fact that you are not going to get commission on all sales that you help Amazon make, and you have to think where the visitors to your site come from. If you publish content that is very local, e.g. a fashion blog in Italian, it make sense to join the Italian Amazon Associates program and publish links to the Amazon.it site using your Italian associate IDs.

Things get tricky when you are located in the UK and publish content in English for a worldwide audience. In that case, you should use Google Analytics to watch where your visitors are located and link wisely. For example, if you blog about the new iPhone 5 and your audience is mostly EU-based, it is a waste of time to link to iPhone 5 on the Amazon.com site. A much better solution is to link to iPhone 5 on Amazon.co.uk as they can be shipped to the EU and elsewhere. In such case you should link to Amazon.co.uk site using your UK associate IDs.

Choosing the right affiliate program and linking to the right Amazon site is only one part of the problem. Another is getting paid. Even though it is easy to join separate Amazon.com Associates programs for Canada, China, France, Germany, Italy, Japan, Spain, United Kingdom, and United States, each account is separate. The affiliate links, IDs, cookies and other information necessary to track affiliate traffic and income are not shared, which means you might have made a thousand dollars in one month, but you will get nothing if that money is spread over a number of separate accounts and none of them have crossed the payout threshold. This is not going to be a problem if you have a popular site, but it will be a problem when you are starting out and experimenting, so be patient.

PS. If you want to buy a domain and use it as a permanent link that others will use but you can control what it points to, get it from Hover. They have the simplest and fastest way to buy, manage, and redirect domains.

This year, Amazon has better ideas than Apple

Even though Google brags about hundreds of millions of active Android devices, it is not them who can rule the imagination and the purses of the masses embracing mobile devices. For a while, the exclusive license to tell people what to think and what to admire was held by Apple, but the monopoly is over as of last week. It’s Amazon who Apple will have to compete with, not Google, Samsung, or Microsoft.

So yes, Apple did prove once again that they rule the smartphone market, but only because they originally set the bar so high that no Android smartphone manufacturer can reach it. It’s just too high.

This article is also available on Amazon Kindle. You may consider buying it, if you would like to keep it for your reference.

But that is not necessarily good news for Apple or their clients. The Sep 12, 2012 conference was a boring event. We did not get to see anything new beyond small tweaks and upgrades. There is nothing revolutionary about iPhone 5, iPod Touch, or iPod Nano. What is more, I firmly believe that whoever designed the new Nano or the color iPod Touch cases would be chased out of Cupertino by the late Steve Jobs before they would have a chance to finish their internal presentation. The new Nano is simply ugly and I have a feeling people will not want to be seen with one. But these are my personal opinions and I will most likely be proven wrong in the near future.

What is much more worrisome is the Apple’s lack of ideas about their future. Adding Siri to iPod Touch is a logical step forward, as is adding LTE to the iPhone, or designing the new headphones, or adding the noise cancellation feature to the iPhone. But all iOS devices have a problem with antiquated media player software and book readers. Here, Apple looses to Amazon whose team is finally starting to show some great ideas.

Setting aside the specs war, the pricing, and the stability of the software, Amazon has better ideas on how to enrich the reading and viewing experience. I am specifically thinking of the X-Ray and Whispersync technologies.

For books, X-Ray is a combination of text and metadata search, which lets us check for other books by the same author, for example. We can purchase them directly from the Kindle, which is good news for us, for Amazon, and for the publisher (and maybe even for the author).

This is not the only type of information we can search for using X-Ray, but Amazon is already showing us how it might use that technology to sell us more stuff. Suppose you are reading a book about France and want to learn more about that country, X-Ray could show you guidebooks, maps, clothes, language courses, and maybe even travel offers? Bit by bit, Amazon could potentially make hundreds of dollars from one initial book sale.

X-Ray for Movies lets us pause the movie, display the list of the actors in the paused scene, check which other movies they played in. X-Ray nicely enhances the curious reader’s or viewer’s knowledge while giving Amazon opportunity to make money on the emotionally-guided decisions we make in the heat of the moment. Do you like some actor’s performance? Display X-Ray for Movies, check his other movies and buy all of them. Do you like the soundtrack? The novel the film is based on? The director’s biography? It all can be sold and delivered to you in under 60 seconds.

Jeff Bezos has pitched his tent in the same spot that Apple occupies in the emotionally-driven sharing market (iPhone + Instagram + Facebook/Twitter), but Jeff Bezos makes money every time we want to read, listen to, or watch something while Apple only makes money when they sell you a new iPhone. In the long term, Apple is worse off than Amazon. In a way, Apple reminds me of Sony at the height of their analogue era when they had little clue about monetizing the digital revolution.

The third leg of the Kindle empire, Whispersync for Voice gives us ability to listed to the ebook we are reading in the audiobook format instead of the standard robot voice of the text-to-speech translator. Amazon can do it, because they own Audible, an audiobook publisher. This means we can now listen to a professional voice actor reading our book on the way home, pause it when we get there, and continue reading the book in bed, right from the place we stopped listening to the audiobook. In the morning, we can continue listening to the audiobook from the place we stopped reading the ebook.

Apple does not offer such solutions in such a simple format and it doesn’t look like they know how to do it. Google and Microsoft are behind Amazon, too, at least as far as these new ways to monetize metadata are concerned.

I was hoping to see some kind of breakthrough today, but I didn’t see any. True, Apple did upgrade many components, but none of those could be called revolutionary. Maybe next year? It seems to me that Apple has no idea what it should do next and for now they just want to surf the Steve tide. But Steve is gone and you can already see the coming problems in the way pro Mac users are being neglected and in letting the ugly new Nano see the light of day.

Amazon has better ideas today. That’s what should keep Apple execs awake at night, not some cheap iPhone knock-offs.