Thursday, February 27, 2014

Book Review #25


Damn! Why Didn't I write that?
Marc McCutcheon

This is mostly an inspirational books. There are tips and tricks along the way, but mostly it's the case of "this is how I did it, and how you can do it, too."

That, in itself, is not bad, depending on the execution. How is the execution? Very good, apparently. There's enough outlines in there to list the steps necessary for writing, researching, editing, dealing with publisher and so on. There's not a single checklist, or forms to the steps, but all the steps are there. I suggest that you take a piece of paper and write down the steps to publication yourself. Then hang that paper on the wall, where you can look at it, and do it.

The author does not hold back any secret, save for actual writing samples. However, he does reference enough published books, that you can go to the bookstore and read them for yourself. And the amazing thing is, most of the writings are rather normal. Certainly, there's nothing wrong with them. But there's nothing so brilliant about them either. Mostly, they flow. Like a good presenter would. Nothing earth-shattering. Just gentle words that flow.

And that is why I think I can do it, and so can you. If you are able to explain something clearly, and effortlessly, then you just may have a career as a writer. This book certainly inspired me to try. Highly recommended.

Wednesday, February 26, 2014

Musing Journal #8


On Being a Writer

So many people want to be a writer. Why not? After all, all you have to do is sit in coffee shop everyday for a couple hours writing and you're a writer. But is that a professional writer or a hobbyist?

Stephen King wrote that he maintains 4 pages per day work load. Sometimes it comes easy for him. Other times, not so easy. But he wrote those 4 pages every day.

If you consider that, considering standard submission formatting, each page would count for 250 words, then you understand that professional writers write 1000 words per day. That's every day.

One week, then, equals 7000 words. That's enough for a whole chapter (or two). One chapter per week means 50 chapters per year. Or about 2 books per year. 350,000 words per year or 175,000 words per book.

Of course, that's assuming Dictionary size book. Normal book length is only about 100,000 words give or take. So, if you are a real "professional" book writer, then you should be publishing 3 books per year.

That is what doing 1000 words per day will give you.

Consider that. 1000 words per day. Is that so hard? If you have jobs, and other responsibilities in life, then yes, it's hard. There are people who just cannot do that much work per day. However, there is a difference between a dedicated writer and a hobbyist. A dedicated writer, will write, at the very least, one page per day. And at the end of the year, they will have the next great American novel. Think about it: one page a day. 250 words per page, and you're a writer.

The most important thing is to make a schedule and keep at it. If you're doing it every day, fulfilling the minimum required word count, everyday, then you are a writer. If, on the other hand, you like to just chat, browse the internet, and maybe write something, then I'm afraid, you're not a writer.

Unless you are keeping up schedule, you're not a writer. A true writer will keep up his schedule every day. And to that end, I recommend Nanowrimo for every one who dreams of being a writer.

Nanowrimo basically forces you to write an average 1667 words per day. This, on the month where you are guaranteed to be busy, dealing with holiday activities. Having participated twice, I can tell you that it is not at all easy. Sometimes, I just have to force things out.

The neat thing about it is that at the end of the month, when I fall back to normal workload, my normal workload seems easy in comparison! So, yes, Nanowrimo was painful, but it's a good pain. Growing pains. Once I went through the exercise, my productivity improved. And so, I will keep on participating. I like to improve my productivity. And I am keeping up with my schedule. I am a writer!

Note: I have written 1896 words today, not including blog updates. :)

Tuesday, February 25, 2014

Raspberry Pi Journal #51



Screen Capture



I'm using scrot as my screen capture program. Just real quick, to use scrot with 8 seconds delay:


  1. scrot -cd 8 filename.jpg


and to do screen capture only the window, use


  1. scrot -cud 8 filename.jpg


Then you get a jpeg picture of the filename.

Monday, February 24, 2014

Cooking Journal #27



Bento Box


Yup. My lunchbox! The rice ended up too dry after a while. Perhaps I should have put a moist towel to cover them up? Or maybe I should have put more water while cooking the rice? Oh, well. Next time I do this, it'll be scattered sushi for sure!

Thursday, February 20, 2014

Book Review #24


The Hobbit
J.R.R. Tolkien

"In a hole in the ground there lived a hobbit."

Reading that sentence does not in anyway prepare me for the wonderful world that J.R.R. Tolkien sets up for his story. And yet, that magnificent world, is far more present and impressive in his Lord of the Ring trilogy. The Hobbit is a prequel of sort of that one magnificent trilogy. In fact, there are two movies that I consider must see for nerds: Star Wars and Lord of the Ring trilogies. The Hobbit is part of that world, but there's no magic in it.

For sure there are dwarves, elves, and goblins. Of course, Gandalf the Wizard makes an appearance. Is that not magic? Yes, but not of the right kind. Let me explain. The magic here can be considered special effects. Something to dazzle the readers. However, in Lord of the Ring trilogies, the magic are more of "advance science" where it is used in daily life.

In terms of adventure, this one is full of it, more troubles than you can shake a stick at. In terms of heroic deeds, there's a plenty. In terms of story telling, this ranks very high, indeed. But true magic is lacking, and that is a pity. I think that the best parts are in the beginning of the story, where Bilbo Baggins and Gollum duels in riddles. The rest must follow, and though there are heroic deeds, that is more of a story-telling adventure, rather than character development.

Plenty of cleverness abound, and in no way this is a bad book. In fact, it is an excellent book. It's just that compared to the other masterpieces, that this one can be seen as anything less than perfect. Recommended.

Wednesday, February 19, 2014

Musing Journal #7


The Tale of Two Bikes

So, I currently have two bikes. Which one I like better? Well, I like them both equally. It's just too bad that the older bike is falling apart.

The first bike costs me $10. I know that's the price because that's the sticker I have on the bike. It's a Tourney 920se 10 speed road bike. Or hybrid bike, as it has straight bar instead of drop bar. It certainly has road tires.

When I take that bike around Aurora Reservoir pathways, I have to built stamina and the first few times around it, I have had to stop at various points around the path. I did finally managed to loop the reservoir without stopping. It took about half hour to do, or about 16 mph average speed.

With my second bike, Schwinn Frontier MTB 21 speed. I didn't have to stop. I can climb the hills just fine by dropping down to the lowest gear. My legs do get exercised rather severely, and near the end I wasn't so much pedaling as kicking my way up the hill. But I didn't have to worry about raising my stamina up. The bike has enough gears to handle moderate hills.

So, is my second bike better? Come to think of it, I felt like my mountain bike is slower than my road bike. This is confirmed on flat road. Assuming the road is flat, I think that I'd enjoy my road bike more, even old and heavy as it is. On hills, though, I need my gears, and the mountain bike handles that well enough.

So, I like them equally well for different reason. Come to think of it, maybe a hybrid is better. Since the mountain bike has better gear and the road bike has better tires, how about if I put on a road tire on my mountain bike? Hmmmm.

Tuesday, February 18, 2014

Raspberry Pi Journal #50


Tape Archive Compression



There's a built-in program to provide back up, or archive. It's called TAR or Tape ARchive. You can read more about it in the man pages. I'm interested at this point, in the execution time. As you know, tar does not provide compression by default. You can activate the compression feature by including option -z. There is no question that it works. The question is, how fast is it?


  1. time tar -c VID0000*.AVI >vid.tar
  2. real 0m1.903s
  3. user 0m0.040s
  4. sys 0m1.590s



  1. time tar -cz VID0000*.AVI >vid.tgz
  2. real 1m8.890s
  3. user 1m4.000s
  4. sys 0m2.890s


As you can see, the original operation is just a couple seconds long. The compressed option, however, took over 1 minute long. That's an enormous difference! Let's do a pipe with gzip command.


  1. time tar -c VID0000*.AVI | gzip - >vid.tar.gz
  2. real 1m19.526s
  3. user 1m9.580s
  4. sys 0m3.320s


The process takes even longer to process. So, let's see if we can improve it so that the time it takes will be between uncompressed and the original compressed.


  1. time tar -c VID0000*.AVI | ssh pi@remotepi gzip - >video.tgz
  2. pi@cloudypi's password: enter password
  3. real 12m54.990s
  4. user 0m16.460s
  5. sys 0m9.620s


So, there's a trick to it. I'm using the pipe command to send the data to a remote pi on the network. Then the remote pi compresses the data and then send it back to my local pi. As you can see, the time went through the roof. Obviously, the network bandwidth is the bottleneck. After all, my CPU utilization rate is near zero. Which is nice since I can watch anime while it's compressing. But that's besides the point since I can use the "nice" command to put it into the background.

Oh, well. Some things just aren't worth it.

Monday, February 17, 2014

Cooking Journal #26


Peasant Bread



So, after the dehydrator experiment failure, I decided to do another experimentation. This time, I bought myself a bread maker. The first two experiments were, to put it mildly, total disasters. The first one was obviusly lacking water. The second one, too much.

The third experiment was successful. I bought a bread machine recipe book and in the introduction, it mentioned how unlike hand made bread, bread cooking machine demands accuracy in ingredient measurements. Well, now I know!

I picked the simplest recipe in that book, and that's peasant's bread. 1 part water. 3 parts flour. 2 spoons sugar. 1 spoon salt (I use leftover ramen salt packet!) and 1 packet of yeast. I notice a bit of dryness when mixing dough, so I added 2 spoonful of water at a time, until I judge that the dough is fine. I think it ended up a little more moist that I anticipated, but that's okay.

The end result is terrific! Once I started into the eating the bread, I couldn't stop! As you can see from the picture, I ate the bread in one go! Well done!

Thursday, February 13, 2014

Book Review #23


Modernist Cuisine at Home todo
Nathan Myhrvold et al

If you have ever seen the book Modernist Cuisine in the book store, then you know that the package isn't shaped like a book, but more like a big block of wood. And just as heavy. If the $450 purchase price does not scare you, you will find that it is the best, most comprehensive cooking book anywhere in the world. However, the problem is that the equipment list is so long, that most people would have no use for it. This version of the book (for at Home), I bought at 50% off during a new year sale.

And it is wonderful. The equipment list is also long, and the fact is, there are recipes in there that I will never ever cook. But that's not the aim of the book. The purpose of the book is to understand how the food cooks, and that's why there are illustrations on how the food cooking process happen inside the pot. By the way, these illustrations aren't handdrawn. They're photos. That's right. You can actually see how the food cooks inside the pot because they cut the pot in half! That's no mean feat when they're illustrating on cooking sous vide!

A lot of the cooking process can be summarized as cook low and slow. This holds true, especially for sous vide (under vacuum). However, the result is worth it. Unfortunately, precision is essential, so be prepared to invest in more hardware that is used only in cooking. It's not until after reading this book, that I'm persuaded to buy kitchen timer and thermometer, for example. Also, some of the hardware is industrial looking. Do you know they use a special sprayer for omellete? Sigh.

Anyway, the title may be "for home", and in most part, that's true. However, it's still too much for me. Is the book worth the purchase price? Production quality is top-notch, easily the best I've seen. Considering that I got it for 50% off, the answer is "Absolutely!". If you have to pay full price, then I can understand your reluctance. The best thing you can do is read it. Even if you're not a cooking afficiando, this book may just turn you into one. It did for me. :)

Wednesday, February 12, 2014

Musing Journal #6


Price of Electric Bike

So, I noticed that Walmart is selling a cheap electric bike. It's about $600. Amazon also sells some, and it's slightly cheaper, but about the same price. However, I also notice that the electric bike conversion kit is priced about $400 something. The question is, if you take an electric bike, and subtract the cost of the conversion, will you arrive at the price of the bike?

I think not. Assembling the bikes does cost money, but adding a few more parts at the factory isn't going to cost the same as aftermarket additions. So, you probably are going to get a better bike for the price.

And yet, I wonder if that's a wise decision. First of all, in a cheap bike, heaviness isn't a problem. Whatever energy drain that the bike has, is counteracted by the electric power. Even the smallest pedal assist level will be enough to counter the drag. So, about the only concern is to have a bike that is strong enough to last a long time.

As I wandered around REI store, however, I found a sample electric bike. I picked it up and noticed that the whole bike with battery weights less than my current bike with no cargo! Huh, I didn't think that was possible. I also noticed that the price tag on the bike is $1700! At that price level, I'm probably getting $1000 bike, which would be really sweet indeed. But I don't need $1000 bike. I'm perfectly happy with my current heavy mountain bike. With electric motor? Who cares about the weight.

So, figure $400 bike plus $400 conversion kit. That's about $800, and that's my current limit for an electric bike. Anything above $1000, and I'd rather get a scooter.

Tuesday, February 11, 2014

Raspberry Pi Journal #49



SD Card Formatting



There's quite a bit of discussion on how to format the SD card. The easy way to do it is to just gparted program. It's point and click easy. However, what if you want to do it automatically? Use *sfdisk* program.

Once you prepped the SD card using gparted, use the sfdisk program to dump the info out to a file. This is what I did in order to get 4 GB file data.


  • sudo sfdisk -d /dev/sda > SD4GFAT32.sdmap
  • cat SD4GFAT32.sdmap 
  • # partition table of /dev/sda
  • unit: sectors

  • /dev/sda1 : start=    16384, size=  7684096, Id= b
  • /dev/sda2 : start=        0, size=        0, Id= 0
  • /dev/sda3 : start=        0, size=        0, Id= 0
  • /dev/sda4 : start=        0, size=        0, Id= 0




So that's the file, and its content. Now, if you redid the whole partition using gparted to something like this:


  • sudo sfdisk -d /dev/sda 
  • Warning: extended partition does not start at a cylinder boundary.
  • DOS and Linux will interpret the contents differently.
  • # partition table of /dev/sda
  • unit: sectors

  • /dev/sda1 : start=     2048, size=  4319232, Id= b
  • /dev/sda2 : start=  4352000, size=  3356672, Id= 5
  • /dev/sda3 : start=        0, size=        0, Id= 0
  • /dev/sda4 : start=        0, size=        0, Id= 0



You can use sfdisk to restore it to its former partition, thus reformatting the SD card.


  • sudo sfdisk /dev/sda < SD4GFAT32.sdmap 
  • Checking that no-one is using this disk right now ...
  • OK

  • Disk /dev/sda: 1020 cylinders, 122 heads, 62 sectors/track
  • Warning: extended partition does not start at a cylinder boundary.
  • DOS and Linux will interpret the contents differently.
  • Old situation:
  • Units = cylinders of 3872768 bytes, blocks of 1024 bytes, counting from 0

  •    Device Boot Start     End   #cyls    #blocks   Id  System
  • /dev/sda1          0+    571-    572-   2159616    b  W95 FAT32
  • /dev/sda2        575+   1019-    444-   1678336    5  Extended
  • /dev/sda3          0       -       0          0    0  Empty
  • /dev/sda4          0       -       0          0    0  Empty
  • New situation:
  • Warning: The partition table looks like it was made
  •   for C/H/S=*/6/18 (instead of 1020/122/62).
  • For this listing I'll assume that geometry.
  • Units = sectors of 512 bytes, counting from 0

  •    Device Boot    Start       End   #sectors  Id  System
  • /dev/sda1         16384   7700479    7684096   b  W95 FAT32
  • start: (c,h,s) expected (151,4,5) found (2,20,17)
  • end: (c,h,s) expected (1023,5,18) found (1018,5,18)
  • /dev/sda2             0         -          0   0  Empty
  • /dev/sda3             0         -          0   0  Empty
  • /dev/sda4             0         -          0   0  Empty
  • Warning: partition 1 does not start at a cylinder boundary
  • Warning: partition 1 does not end at a cylinder boundary
  • Warning: no primary partition is marked bootable (active)
  • This does not matter for LILO, but the DOS MBR will not boot this disk.
  • Successfully wrote the new partition table

  • Re-reading the partition table ...

  • If you created or changed a DOS partition, /dev/foo7, say, then use dd(1)
  • to zero the first 512 bytes:  dd if=/dev/zero of=/dev/foo7 bs=512 count=1
  • (See fdisk(8).)




Just to make sure, here's the command again.


  • sudo sfdisk -d /dev/sda 
  • # partition table of /dev/sda
  • unit: sectors

  • /dev/sda1 : start=    16384, size=  7684096, Id= b
  • /dev/sda2 : start=        0, size=        0, Id= 0
  • /dev/sda3 : start=        0, size=        0, Id= 0
  • /dev/sda4 : start=        0, size=        0, Id= 0


One more thing. If you want to reformat the partition to FAT32 filesystem, you can do this:


  1. sudo mkfs -t vfat /dev/sda1


Yes, you need to format each partition separately, and that means you can have different file system per partition. Also, vfat stands for FAT32, although you can specify it explicitly, or use something else entirely.


Monday, February 10, 2014

Cooking Journal #25


Dried Kale Chips



If you remember that dehydrator I got a while back, it was not successful. Well, it was, but too high maintenance for me. Here is the commercial version of the kale chips. The thing that may be surprising is how expensive this thing is. Definitely not your everyday consumption. Okay for occasional snack, though.

Another thing that I find objectionable is that there is too much salt. Okay, so I prefer things "pure" without any spices added, but this is clearly too much!

I find it very surprising at the weight. These are almost weightless! The chips crumbles very easily, so I'm guessing that they really evaporated the water completely!

You may want to try these out, but too salty for me! I much prefer the homemade one. Maybe one of these days, I'll try it using regular oven.

Thursday, February 6, 2014

Book Review #22


Book #22 Programming Linux Games
John R. Hall

Programming Linux Games is an old, old book. In fact, it's obsolete. The reason is that SDL has evolved toward a better set, and some of the functions are deprecated. In addition, it uses plain old C language, that although a great language to use, it has been superceeded by C++, and Java, among other languages. Still, there's enough similarities between this book and current SDL that it's a great introduction to the process of SDL programming.

One of my most frustrating endeavor is finding the proper answer to my question regarding any graphic library: "How do you draw a point on screen?"

That one very simple question is frequently unanswered in great many graphical programming book. I know that's silly, but there you go. This book answers the question right away: Using surface.

"Each SDL_Surface structure contains a pixels member. This is a void * to the raw image, and we can write to it directly if we know the type of pixel that the surface is set up for."

And upon those two sentences, I bought the whole book!

It's a good book, marred only by the fact that it's so old, it's obsolete. However, reading this book followed by reading SDL man pages is infinitely preferable to just going straight on without guidance. The explanations are solid, and adapting the code to newer system is not a problem.

FYI, the ever popular PyGame extension for Python uses SDL for the base. SDL is a good graphic library to learn, especially if you're really interested in harnessing the speed and efficiency of C language.

For those of you still stuck with C programming, give this book a read. You just may like what you see.

Wednesday, February 5, 2014

Musing Journal #5


Electric Bike Cost

If you have been following my posts, you know that I have been smitten by electric bikes. No wonder. They are clean, light, simple, and really a good transportation mode all around. The fact that I have bike path from the house really does seal the deal. There is only one problem: The cost.

Now, I can go buy myself a cute little red scooter for about $2000. A used one can be had for $1000. So, I really don't want to spend more money than $1000 for an electric bike. A scooter can get you places bikes can, faster and safer. Of course, there is the cost of ownership. Scooters costs more to insure and maintain. But let's face it, with 100 mpg effective expense, it just doesn't cost all that much.

But how about electric bikes? You can always pedal. Yes, that's true. But with regular bike, that's free. How about the cost of an electric bike? There have been a lot of calculations thrown about that says an electric bike gets an equivalent of 1000 mpg! Some people, in fact, attached the battery charging unit to solar cells. That's probably about 1 million mpg. How can a scooter beat that?

I'm not interested in calculating pedal power into the equation. So, first, I'm taking the range of motor only. Then I take the cost of purchasing replacement battery. Finally, I take the amount of recharging the batteries can take before losing capacity. So, the true mpg cost of an electric bike is Price of batteries / (mile per charge * number of charge). That gives you dollar per mile. A simple price check will give you dollars per gallon. That will give you mile per gallon figure.

In my calculation, I get about 80 mpg for electric bikes. So, that's slightly less than that of a scooter. I consider, cost wise, scooters and electric bikes are the same. Perhaps I will change my mind later, once the battery technology has improved much and gasoline cost more that it is now. However, that's some time in the future and for now, I will not buy an electric bike that costs more than $1000. I'd rather have a scooter!

Tuesday, February 4, 2014

Raspberry Pi Journal #48


SD Back up time


How long does it take to back up 16 Gig SD card, anyway? Using my PNY SD 16 Gig, this is the time that it takes to fully back up the card using noob clone.

  • real 113m8.210s
  • user 2m21.400s
  • sys 24m42.570s

Or about 140 minutes. That's pretty fast.


Monday, February 3, 2014

Cooking Journal #24


Scrambled Egg


Nothing special, really. I got a jar of mushroom. 3 eggs. Drop mushroom in a pan. Cook until warm. Break eggs in a bowl. Stir. Drop in pan. Cover. Cook until done.

About the only thing I don't like is that I have to clean that extra bowl. Lazy, eh? But little things do add up!