# 2012 was an amazing year, here’s a summary!

## Posted by Filip Ekberg on January 8 2013 1 Comment

Saying that a lot happened in 2012 is probably an understatement. At least both on this blog and in my personal life, a bunch of amazing things have happened. I really hope that your previous year was good and let’s hope for an even better 2013. To start this year off I want to summarize all the great posts that were shared on this blog in 2012.

Personally the two biggest achievements of last year was me getting engaged to my lovely Sofie and publishing my book C# Smorgasbord. As you might have seen already this year has already started very good as I have been awarded Microsoft MVP in Visual C#!

Let me know what you found most interesting on this blog from the collection of posts below! Here is the 2012 summary!

Architecture

Tips & Tricks

Screencasts

Software & Tool information

Windows 8, Windows RT, WinRT and Surface

C# Smorgasbord and Self-publishing

Other

I hope you found this collection of posts useful and that you’ve learnt a lot in 2012! Enjoy 2013 and let me know what you think of the posts! Before we take part for this time, I want to share with you an image that describes the feeling I got when I held the first printed copy of C# Smorgasbord:

# Self-publishing a book – Part 3 – Using a good typesetting system

## Posted by Filip Ekberg on September 23 2012 8 Comments

This is the third part of the blog series “Self-publishing a book” if you haven’t already check out Part 1 & Part 2.

Word was acting up, I spent too much time trying to work around it and less time on the content — this was not going to work. I decided to drop Word. But for what and how would it make anything easier when all CreateSpace supplied was a Word template?

### Stepping out of the comfort zone

Before I actually dropped Word completely I had gotten a lot of feedback from friends on IRC; Most of them recommended me to check out LaTeX. At this point I really had a very little knowledge about what LaTeX was and how to use it. Wikipedia describes LaTeX like this:

LaTeX is a document markup language and document preparation system for the TeX typesetting program. The term LaTeX refers only to the language in which documents are written, not to the editor used to write those documents. In order to create a document in LaTeX, a .tex file must be created using some form of text editor.

Being a geek by heart, I immediately got interested in trying this out. It sounded pretty much like I could code my own programming book. Which would be very cool. Comparing it to something else, LaTeX is pretty much like HTML and CSS. This makes it perfect for writing something both where you have and not have a known layout when you start writing.

Since I didn’t know anything about LaTeX I needed a crash course and somewhere to get a little bit of inspiration/help. Fortunate for me, I found a LaTeX channel on IRC, #latex on freenode. As mentioned in the Wikipedia quote above, LaTeX is actually just a language used for the typesetting system TeX. This explains why the other place where I got a lot of feedback is called tex.stackexchange.com. Both of these (plus google of course) has been very helpful!

Getting a crash course in LaTeX wouldn’t be enough, I still needed my book to conform with the CreateSpace guidelines. I hadn’t decided the trim size(page size) of the book yet. I was thinking about going for 7″ x 10″ but then I created a poll on this blog which later changed my mind. It actually turned out that the size I had in mind was the one you guys wanted the least.

So before I could completely step from Word to LaTeX, I had to know if there was some information about LaTeX + CreateSpace. I googled and stumbled upon a forum post on the very good CreateSpace community forum. This post mentioned a CreateSpace package for LaTeX. Best of all, this was open source and available on github!

Now I knew that I could use LaTeX to create my CreateSpace work, I knew that I wanted to step away from Word but I didn’t yet know how to write anything in LaTeX or what tools to use.

### LaTeX Crash Course

Since I didn’t really know anything about how to write LaTeX markup, I searched for a free tools that could help me; I found a program called TeXnicCenter. However, just downloading and installing TeXnicCenter is not enough, you also need to install the “compiler”. According to TeXnicCenter, I could get something called Tex Live for this. Tex Live has binaries for both Windows, Unix and GNU/Linux.

When I had both Tex Live and TeXnicCenter installed, I just had to learn how to write LaTeX code and what kind of “stuff” it produced for me. If you install TeXnicCenter and open it up, this is the first thing you will see:

This looks pretty much like any word processor from early 2000.

Just as with HTML, you need to define where your document starts, where it ends and if you have something in the preamble (header section). Here’s an example of how to define a document and just have some text in it:

\documentclass{book}
\begin{document}
Hello there!
\end{document
}

If we build(compile) and run this, we will see that we got no errors and that 1 page was produced. You run it by clicking the “Build & View current file” button or pressing Ctrl+Shift+F5:

As you might have noticed, it says “LaTeX => PDF” just left of the build icon. This means that when we build the file, we will actually have a PDF created for us! This PDF will be styled as we’ve said, in this case it will use the default styling of a book.

LaTeX allows us to produce much more than just books, we can create articles, papers and much more. This can be decided my changing the document class. In the above example I used the document class book.

This seemed very easy and there was a lot of good information around the net that I could benefit from since TeX wasn’t something new. My next concern was the document structure, code samples, chapters, sections and much more. I soon found out that all of these was pretty easy to achieve; at least when using the standard layout it came with.

I decided that I wanted to split my document up into seperate files, 1 file per chapter to keep the master document clean and each chapter as clean as possible. Luckily for me, this was probably the easiest thing to solve.

All I had to do was create a new file, I named each file ChapterX.tex and just included it into the master file like this:

\documentclass{book}
\begin{document}
\input{Chapter1.tex}
\end{document
}

When installing TeX Live, I also got a lot of very nice packages that I could include that provided additional functionality. One of the most used packages that I found was listings. This package allowed me to embed code samples into the text with a lot of nice options to it.

The following code sample produced a very nice looking output:

\documentclass{book}
\usepackage{listings}
\usepackage{color}
\lstset{language=C,keywordstyle=\color{blue}}
\begin{document}

\begin{lstlisting
}
int x = 10;
if(x % 20){

}
\end{lstlisting}
\end{document
}

There were of course a lot of things not yet in place, the final design for the book was not done; since there was no content to style yet. Lots of packages and lots of tweaks was waiting along the way.

### Actually writing the content

I was very happy with what LaTeX allowed me to do, I felt comfortable with the way that I could change layout as I went on. One of the most important things during the time that I wrote this book was to share early and share often. A good example of this is the initial draft; if I had not shown this until everything was done, the book would not have turned out as good as it did.

Moving to LaTeX was a very good move and I have never regretted it. It took a couple of days to get used to everything but once everything was in place the focus was a lot more on the content than on the buzz around it. It also felt a lot better writing everything from scratch when doing it like this.

I still had a lot of work to do, but I at least had a typesetting system that I was feeling comfortable with and I shared as much screenshots and snippets as possible to make content looking as good as possible. There are a couple of math equations in the first chapter of the book, in the first draft this equation was just plain text; but after sharing almost 15 different versions of the same equation (style wise), it turned out as it did. Again, if I hadn’t asked the potential readers and those people that have worked with typesetting before, it would never have turned out as it did!

Now I just needed to write the content. As I wrote Chapter 1, I started to think about how I could ensure quality of the overall book and where to go from now. I knew that I wanted to write high quality content where each sentence had been revised many, many times.

The focus so far had been to find a way to comfortably write the content; I now had to find a way to make the content as good as possible. Possibly with the help of the community, but where do I get such help and how do I organize all the feedback?

# Self-publishing a book – Part 2 – Back at Square One

## Posted by Filip Ekberg on September 2 2012 7 Comments

This is the second part of the blog series “Self-publishing a book” if you haven’t already check out Part 1.

I was back to square one, with only my raw material. But the hope was not gone, I now had a goal; I am going to publish a book — but how?

### What now?

At this time, the snow fell over Sweden and Christmas and New Years was just around the corner. I decided to just do some googling and researching over the holidays while I recharged my batteries. After all I needed all the power that I could get in order to achieve something like this. When New Years passed, I had found a great resource for information and a great print-on-demand service.

I felt that CreateSpace would be the answer to all my questions and that it would indeed be very straight forward from here. I decided to create an account and contact their support with a lot of questions. Before I went any further, I wanted information about distribution and how everything worked.

Remember that I didn’t have anything written yet, as for my content; I was still at square one. However, it was not only the print-on-demand services that I was researching, but also how to do proper type-setting.

When registering with CreateSpace, everything is very straight forward. You get to add new titles very easily, select trim size, type of paper, color or no color and so on. The overview of a published project looks like this:

There are a lot of very interesting things in the image above, we’re going to look at some of them in more depth later on. But for now, let us focus on all the questions that I had and why I decided that CreateSpace is what I want to use.

### Why CreateSpace?

First off all, their community is outstanding. There are so many good authors, proofers, designers, typesetters and so forth on it. Secondly, CreateSpace is a part of the Amazon group of companies. This means that a title that you publish on CreateSpace, is automatically available on Amazon (US/EU). As you might recall, this was one of the issues that I had with the Swedish print-on-demand company Vulkan.

If a great community and great possibility to get your book out there was enough you also get a lot of good help from their tools if you are new to publishing. To top this off, you can do what is called “Member orders” which means that you can place an order on your own book very cheap.

CreateSpace supplies what is called a “Buying Copies Calculator”. For instance, if you want to buy 1 copy of your book that is in Black & White and has 500 pages. The price per book will be $6.85 and the Shipping (to Sweden) would be$14.38 that means a total of $21.23. This might seem like a lot, but if you were to order 100 copies instead, the price per book would be constant at$6.85, but the shipping wouldn’t increase that much. Depending on where you live, there will also be a matter of value-added-tax and customs.

Here’s an example of the calculator:

As you might figure out, the margins aren’t super good, but they are a lot better than the royalty percentage that you would get from a publisher. If you are thinking that the margins are in fact very good, you’re neglecting marketing or any other things around your book that might have cost money during the time.

One last reason as to why I really enjoy CreateSpace: I ordered 5 copies to proof/review it took them 3 days to handle my order, make the books and ship them from USA to Sweden and deliver them to my door. That is pretty amazing.

### Print-on-demand it is!

I still had a lot of questions that needed answers so I started sending questions to their customer support and got a lot of Very verbose answers in return. In short, this is what I asked them:

• If I want to print my book elsewhere and sell that, is that OK?

CreateSpace answer: Yes, but you cannot use the same ISBN if the ISBN is generated by CreateSpace.

• I want to sell my book in book stores in other countries that USA, what do I need to do?

CreateSpace answer: You can use the expanded distribution to get a deal with “Barnes & Noble” in USA, but if you want to go outside that you need to order member copies and supply the store yourself.

• You are witholding 30% of my money for “tax reasons”, my country has a tax treaty with the US, what do I need to do?

CreateSpace answer: File a valid W-8BEN form

Now I had a lot of useful information, even if a lot of this information didn’t become clear until I actually pressed the “publish” button on the book.

### Time to start writing?

I had a lot of information about where I wanted to publish the book and how to do it. But I still didn’t have a clue on how to typeset the book. There was still a lot of work to do and a lot of questions unanswered.

I downloaded a word template from CreateSpace that used a trim size (book size) that would yet to be changed and I started aligning things as I wanted, writing a stub for the first chapter. Then something happened, I wanted to be able to easily change the layout of elements; because I knew early that this was going to be something that grew over time.

Word was acting up, I spent too much time trying to work around it and less time on the content — this was not going to work. I decided to drop Word. But for what and how would it make anything easier when all CreateSpace supplied was a Word template?

# Self-publishing a book – Part 1 – Where it all began

## Posted by Filip Ekberg on August 27 2012 11 Comments

### What’s this blog series going to be about?

It might not have been clear to everyone that my book C# Smorgasbord was self-published. In short self-publish means that I did not have a publisher that backed me up when writing this book.

But if I don’t have a publisher how do I get my book printed? How did I get the book up on Amazon? How do I market my book?

Those are some of the questions that I receive on a daily basis. I’ve had in mind to write this blog series even before those questions arise. So I am going to try to answer as many questions as you might have, I don’t know how many blog posts there will be. Those that have followed this blog before knows that I tend to like lengthy posts, but this time I will try to do more posts that are a bit “shorter”. Because covering all of this in one post will just be too lengthy, I’ve joked about it and said that I can probably write a book about writing a book (bookception!).

If you have any questions just give me a comment, tweet or e-mail, I will try to answer all questions.

### Where did the idea come from?

It all began long before I decided to make a book. During 2011, I blogged a lot, had a lot of in-house presentations for co-workers, did screencasts and spent a lot of time on StackOverflow.

So here I was, with all these great raw materials that I didn’t know what to do with. I felt that I wanted to reach out to the people that didn’t attend my presentations, that didn’t read everything in my blog and that didn’t even know about my work in the first place. This started to grow on me, in late November 2011 I started doing some research on how to convert a blog to a book. My initial thought was just to copy and paste everything from my blog into a (what I thought at the time) nice Word template.

This resulted in something looking like this:

At this time, I didn’t have any experience at all with publishing, authoring, type-setting or anything at all like that. Once I had copy and pasted everything from my blog, I had a Word document with about 120 pages.

I showed this to a couple of other developers and got comments like:

This is the worst type-setting I’ve ever seen

This got me thinking, if the first reactions are not even constructive, something must be wrong. I had an idea that I liked, I wanted to take a vast variety of different, interesting and new/old concepts/technologies.

So what now?

### Doing it right

I am not the kind of person to give up and once I put my mind into something, I want to make it as good as possible. I decided to contact a bunch of publishers, just to see if they liked my idea. Never ever had I contacted a publisher before so I had no idea on what they expected from me.

My e-mail to the publishers contained an introduction to myself, a Little bit about my ideas and a link to the 120 page PDF with horrible type-setting. It didn’t take long before all the publishers that I contacted responded to my inquiry. Some of them had a more personal touch than others, some of them just felt auto-generated. Basically they (all) asked me to write a proper proposal and attached a quite robust PDF on how to do so. The proposal should be a chapter from the book with about 20 pages. It shouldn’t be the first nor the last chapter, but a chapter somewhere in the middle of the book.

Another thing that they asked was about the name of the project. Instantly when I got that question, I thought to myself:

What is a good Word for “a vast variety” that also is connected to me being Swedish?

Smörgåsbord!

Since the programming language in this book was about C# I instantly gave it the name “A C# Smorgasbord” (why “A” was removed is a later story!).

What about the proposal? Let’s go back to that for a second. None of the “chapters” in the PDF that I sent to the publishers contained 20 pages, I didn’t have a 20 page proposal. This gave me an idea of what a publisher expects. If the publisher expects 100%, the reader expects 500% quality.

With that in my hands, I now had a goal.

### What kind of goal did I have before me?

You might think now that the goal was to create 20 pages and send a proper proposal to each publisher. On the contrary, I knew that there was a lot of work to do to meet everyones expectations so I wanted to focus on making something that the end-users liked, instead of something that was according to a guideline from a publisher.

I “threw” away the PDF that I had created, never to be looked at again (not entirely true, I just took a screenshot of it). I still had a lot of raw material and what I didn’t get into my first in-proper proposal was my presentations and screencasts, this is something that I wanted to cover as well.

Before I gave the idea up completely on the PDF, I did some research on “print-on-demand”. I found a company in Sweden called “vulkan“, I even created an account and had a dialog with them about how everything worked. There was a lot of problems with them though, one being the integration possibility with foreign stores (Amazon etc.). It was also a pretty expensive process, compared to what I later found.

I was back to square one, with only my raw material. But the hope was not gone, I now had a goal; I am going to publish a book — but how?