My Review of Accessible EPUB 3
Good content about a new standard
Pros: Accurate, Concise
Cons: "however"
Best Uses: Novice, Student
Describe Yourself: Software Engineer
I reviewed Accessible EPUB 3 as part of the O'Reilly Blogger program. This book is actually an excerpt from the upcoming EPUB 3 Best Practices.
The content of this excerpt is undeniably rich. The first 25 pages or so may be 'review' material if you're already pretty familiar with HTML5. If so, skim these pages for the EPUB-specific additions.
Knowing very little about the changes in EPUB 3, I was very intrigued by the audio and video capabilities that mirror those of HTML5. I would have liked to see more discussion about the support of these elements in readers on the market. There were a few places where the author warned about new features not being fully available in many readers, but the lack of statistics made me wonder if this is merely speculation or if any readers currently support the new features.
I thought the Text-to-Speech section was very informative. The concept of having a lexicon as a pronunciation index coupled with inline SSML will make EPUB 3 very usable on readers. I sometimes turn on a screen reader just to see how elements are read aloud, laughing at mispronounced words or phrases. If authors and publishers put in the effort to add these features of EPUB 3, text-to-speech engines will make only a fraction of the pronunciation mistakes.
I would have given this excerpt five stars, but the language was occasionally difficult to read. For instance, the author really enjoys ending sentences with "however" as if it is a filler word. After encountering this a few times, I ended up reading over sentences (sometimes spanning 2-3 lines of a paragraph) and replacing the ending "however" with synonyms to see if it made sense. Mostly, it didn't. I think this really detracted from the overall content, because I found myself retracing so much text to understand how the disjointed conjunctive adverb made sense that the content ended up feeling choppy.
Since the end result is still in production, I would imagine this text has already gone through a few rounds of editing.
(legalese)
git push: fatal: unable to read SHA1
Today, I was faced with an interesting error in a git repository. I am backing up a lot of old projects from during and after college into a private git repo. In doing so, I moved some folders around which disconnected a couple of binary files. After pushing, I received an error: unable to read [SHA1].
The fixes, in short:
$ git fsck $ git log --raw --all --full-history | grep SHA1-HERE $ git hash-object -w OBJECT-PATH-HERE $ git push
Here is the error and a walk-through of coming up with the fixes above:
jim at schubert in /media/16GB/projects/school on master $ git push Password: Counting objects: 1945, done. error: unable to find 2978ec4d75abb8c6bab225d8adfbd2bef064338a error: unable to unpack bddbd13afd698e5ba7d572c9270e52bcac862661 header error: inflateEnd: failed Delta compression using up to 2 threads. Compressing objects: 100% (1854/1854), done. fatal: unable to read 2978ec4d75abb8c6bab225d8adfbd2bef064338a fatal: The remote end hung up unexpectedly fatal: The remote end hung up unexpectedly fatal: write error: Bad file descriptor
After running git fsck, I found that I had two missing blobs:
jim at schubert in /media/16GB/projects/school on master* $ git fsck dangling tree dbe9172996edbb7df517b0305c38891d78b72f66 dangling tree fbf7d8336b5f2347da23eb8a3938de5ab18f783c missing blob 2978ec4d75abb8c6bab225d8adfbd2bef064338a missing blob bddbd13afd698e5ba7d572c9270e52bcac862661
To fix this, I had to get the filenames of these blobs and write them back into the repository:
jim at schubert in /media/16GB/projects/school on master* $ git log --raw --all --full-history | grep bddbd13 :000000 100644 0000000... bddbd13... A INFO 465/Project2/UseCase/Diagrams/Leader - Time & Mileage.vsd jim at schubert in /media/16GB/projects/school on master* $ git log --raw --all --full-history | grep 2978ec4 :000000 100644 0000000... 2978ec4... A INFO 465/Project2/Prototype/WebPrototype/WebPrototype/bin/WebPrototype.dll
Writing these files back into the repository, the push was successful. To write these back, do the following:
jim at schubert in /media/16GB/projects/school on master $ git hash-object -w INFO\ 465/Project2/UseCase/Diagrams/Leader\ -\ Time\ \&\ Mileage.vsd bddbd13afd698e5ba7d572c9270e52bcac862661 jim at schubert in /media/16GB/projects/school on master $ git hash-object -w INFO\ 465/Project2/Prototype/WebPrototype/WebPrototype/bin/WebPrototype.dll 2978ec4d75abb8c6bab225d8adfbd2bef064338a
My Review of Learning Perl, 5th Edition
Great intro to Perl
Pros: Helpful examples, Easy to understand, Concise, Well-written, Accurate
Best Uses: Novice, Student
Describe Yourself: Software Engineer
I picked up this book on a whim to learn Perl. I was extremely impressed, especially by the three chapters on Regular Expressions.
If you have used Perl, this book may be fairly basic. There are whole chapters on Scalars, Arrays, Hashes, etc. I have a lot of experience in a lot of languages and technologies, and I can tell you this book is well-written and well-organized to ease you into the Perl mindset.
First of all, most languages are like mathematics. 1+1=2 is a rule. If that rule didn't work, math wouldn't work. Similarly, 'int x = 1;' in C-style languages will always point the variable 'x' to the memory location storing the value of '1'. Rules are rules. However, Perl is contextual. When you do one thing in Perl, you may have a different result depending on the context of the code. For example (extremely-generalized example), hashes can be considered an array of values in which every even index is the key and every odd index is the value. So, an array of ["first", "1st", "second", "2nd" ] could easily become a hash with the keys and values related as expected. Weird? Yes. Basic, not really. I think that can be a very difficult concept for a lot of people... too meta.
The book does a great job of easing a lot of the Perl concepts onto the reader. Interestingly, the part of the book I found the most useful are the three Regular Expressions chapters. I have recommended this book to students in the past solely for the three Regular Expressions chapters. They are clearly and concisely written in a way that presents the Perl syntax very well.
If you're familiar with Perl already, this book probably isn't for you. You would probably be better off with the Intermediate Perl book also available by O'Reilly. Even after reading both books and working a bit with the Catalyst framework, I found myself coming back to the last chapter of this book to fully understand eval blocks.
(legalese)
My Review of CLR via C#, 3rd Edition
One of the best C# books available.
Pros: Helpful examples, Accurate, Concise, Easy to understand, Well-written
Best Uses: Expert, Intermediate, Student
Describe Yourself: Software Engineer
It has been a while since I read this book. I never reviewed it because I didn't realize Microsoft Press was sold on the O'Reilly site.
I can not tell you how many times I have been asked an interview question which I answered quickly and concisely thanks to this book. It covers a lot of material. When I say "a lot", I don't mean the average amount of material in a book this length, I mean the average amount of material in a book that is three times the size of this book. Seriously, it goes over some topics that other books don't touch on: like why strings are interned the way they are, string comparison optimizations, globalization gotchas, assembly structure, and a lot more.
I recommended this book to a friend a few days ago. I would gladly recommend it to anyone who is a professional .NET developer or a student using .NET technologies. It thoroughly discusses the how, why, and when the CLR performs the way it does.
A note for beginners: I think this book is geared more toward intermediate-to-advanced developers. If you find some of the content too difficult, skim it and come back to it later. You won't be let down.
(legalese)
My Review of Node for Front-End Developers
Or... Prototyping with Node.js
Pros: Well-written, Easy to understand, Concise, Accurate, Helpful examples
Cons: Too short
Best Uses: Student, Novice
Describe Yourself: Software Engineer
I've reviewed "Node for Front-End Developers" for the O'Reilly blogger program. Because I've been contributing to an open-source Node.js ebook, I was very excited to read this book. I must warn you-- this book is less about Node.js than it is about prototyping web applications using modules available in Node.js. If you begin reading this from that perspective and you have little knowledge of Node.js in general, you will gain a lot from reading this. If, however, you have experience with Node.js and have used frameworks such as Express and Connect, there is not much more covered in these 58 pages.
Garann Means has written this book in a great way. She doesn't start off explaining the Express framework like most introductions to Node.js would have done. Instead, she shows how to create a minimal http server, add templating and middleware, and then discusses Express and separating concerns into an MVC or MVC-like pattern.
There are a few times where I think the terminology could be misleading. For example, at the beginning she talks about 'scaffolding'. Scaffolding in general implies code generation and the only bit of true scaffolding discussed in the book occurs on one line in one of the last few chapters when the Express framework generates an empty application. I would have liked to see some true 'scaffolding' examples, either with code specific to the book or with third-party modules. Aside from one or two other terminology issues (which is probably just me being picky), the content is spot-on.
Garann does talk about asynchronous operations a little, but this is a huge area of concern for front-end and back-end developers when migrating to Node.js because the asynchronous and event-driven nature of common tasks (files, database) can often increase the complexity of a simple task. Had she expanded on the asynchronous nature of Node.js more, I would have given this book five stars. She does offer a caveat in the Postscript that this book doesn't cover all there is to know about Node.js, and she's right. Before or after reading this, you should read the introduction in the Node.js documentation and the Express framework's documentation.
In conclusion, this is an excellent introduction to prototyping web applications using Node.js. I would recommend this book to people who are familiar with JavaScript programming and want to being prototyping without the need to learn additional languages and frameworks like Ruby on Rails, Catalyst, ASP.NET MVC, etc.
(legalese)
My Review of McCullough and Berglund on Mastering Advanced Git
Great demonstration of advanced Git
Pros: Accurate, Easy to understand, Concise, Helpful examples
Best Uses: Novice, Student, Expert, Intermediate
Describe Yourself: Sys Admin, Maker, Developer, Educator, Designer
At just under 4 hours long, this video course packs in a lot of content. Each video is about 30 minutes long, so I didn't have to watch it all in one sitting.
The structure of the demonstration is extremely useful because Tim and Matthew ask and answer questions conversationally while showing a split-view Git workspace. I think the hardest thing for some people to grasp in general about git is what 'distributed' means. Although the presenters are working from the same machine, the setup is done in a way to demonstrate this distributed nature.
I've been using git for a while, but I have learned a lot from these videos. I've only somewhat dug into the files inside the .git directory on my own because I was afraid to 'ruin' my repository. This course does a great job of alleviating a lot of those concerns by explaining the organizational structure of the .git contents.
If you're like me, you'll probably add quite a few of the concepts you learn from these videos to your repositories immediately after each video.
(legalese)
Mastering Node: Addons and FunctionTemplate (uuid.node)
Last night, I pushed an addition to my fork of Mastering Node. I decided to add a bit to the Addons chapter. The first example in this chapter only shows how to add a function to a natively-compiled module (i.e. an addon). This example shows you how to start a module which can be used in the following way:
var Uuid = require('./uuid.node').Uuid;
var uuid = new Uuid();
var myId = uuid.generate();
The project files referenced in the following text can be downloaded from the repo: jimschubert/masteringnode
FunctionTemplate
In v8, a FunctionTemplate is used to create the equivalent to:
var template = function() { }
The function at this point is an object and not an instance of the function.
As an example, we will use the linux package uuid to generate a uuid. We will define the header for this addon as:
words.pl: slogan word generator
About a year ago, I was really into playing this game online where you were given a single sentence and you had to use the letters in that sentence to make up as many words as possible. The longer the word, the higher the points.
Creating a script may be considered cheating if you're in it for money. If you're in it for fun, script away. That's what I always say.
Here's the gist of it:
#!/usr/bin/env perl
# words.pl: Find all possible slogan words from a single sentence.
use strict; $|++;
@ARGV == 2 or die "usage: $0 input_file output_file 'sentence'\n";
my ($infile, $outfile, $sentence) = @ARGV;
$sentence = $sentence || 'how much wood could a woodchuck chuck';
open INPUT, "< $infile" or die $!;
open OUTPUT, "> $outfile" or die $!;
my $stdout = select STDOUT;
$| = 1;
select $stdout;
my %sentence_letters;
my $stmp = $sentence;
$sentence_letters{$&}++ while($stmp =~ s/[a-z]//);
print "Using the sentence '$sentence'\n";
print "Found the following letters:\n";
print "\t$_ - ". $sentence_letters{$_} ."\n" foreach(sort(keys %sentence_letters));
print "Processing $infile for slogan words\n";
my $count = 0;
my @indicators = qw{\ / | .};
LINE: while(<INPUT>) {
my $word = $_;
my $tmp = $word;
next LINE if($word =~ /['\&\d]/);
my %word_letters;
$word_letters{$&}++ while($tmp =~ s/[a-z]//);
foreach(keys %word_letters) {
next LINE if ($word_letters{$_} > $sentence_letters{$_});
}
print OUTPUT $word;
my $word_len = length($word);
open WORD_LEN_OUTPUT, ">> $outfile.$word_len";
print WORD_LEN_OUTPUT $word;
print $indicators[++$count % 4], "\r";
}
print "\nDone.\nView $outfile.* for words\n";
When I wrote this, I had only recently started using Perl. Please go easy on me if it's poorly written.
The script takes an input file, an output file format (e.g. words.txt will be words.txt.20 for words of 20 characters), and an optional sentence to parse.
It gets a set of letters in the sentence, then runs through the list of words to see if the word can be made from any combination of letters.
For instance, if your 'sentence' is "baby cakes", the script will create a hash of those letters and their counts. Conceptually, this looks like:
// hash is an array hash['a'] = 2 hash['b'] = 2 hash['c'] = 1 hash['e'] = 1 hash['k'] = 1 hash['s'] = 1 hash['y'] = 1
If, while walking line-by-line through your list of words, the script sees 'abracadabra', the loop will return false because (conceptually):
word['a'] = 5 word['a'] <= hash['a'] == false
The script also employs some interesting stdout manipulation. This allows the script to output "spinner text" and update the current line when the terminating character is a line-feed.
To run the script in a linux-based environment, you may do:
mkdir ~/projects && cd ~/projects git clone git://gist.github.com/1733871.git gist-1733871 cd gist-gist-1733871 perl words.pl /usr/share/dict/words generated.txt 'Good goly, Miss Molly'
You should see output similar to:
jim at schubert in ~/projects/gist-1733871 on master* $ tree . . ├── generated.txt ├── generated.txt.1 ├── generated.txt.2 ├── generated.txt.3 ├── generated.txt.4 ├── generated.txt.5 ├── generated.txt.6 ├── generated.txt.7 ├── generated.txt.8 └── words.pl 0 directories, 10 files
If you look at generated.txt.7, you will probably see something similar to:
Hollis Osgood glossy goodly idylls igloos solids
My Review of Android Open Conference 2011: Complete Video Compilation
Hours of Android enjoyment
Pros: Helpful examples, Easy to understand, Accurate, Concise
Best Uses: Intermediate, Student, Expert
Describe Yourself: Developer
There are a lot of videos here. If you're only planning to write apps for the market, you'll most likely not be interested in the Embedded Android talk or Scala as a Java replacement. If you don't work on iOS and never plan to, you can probably scan through Nick Farina's talk (sorry, Nick). I found many of the videos worthwhile, whether they related to actual app development or the business of apps.
I also really enjoyed the keynotes. Tim O'Reilly's talk is probably my favorite because I've been saying the same things about many of Tim's comparisons since I bought my first DROID a couple of years ago.
Even if you're familiar with Android development, you should definitely watch the videos by Ken Jones. He shows the start of a Twitter client. Although he didn't get very far in the actual coding, he will point you to the finished code. One aspect I loved about his talks is that he discusses a lot of best practices. Many tutorials you find online either don't discuss best practices or don't incorporate them.
Be sure to watch the Arduino videos. I hadn't heard about Arduino before this video and I was very impressed. In fact, I watched the keynote video twice.
Honestly, there are some videos here that I'm not that interested in. That doesn't detract from the overall usefulness of this video collection. If you're 25% of the way through a video and it hasn't hooked you yet, move onto the next because there is a plethora of information.
(legalese)
dotfiles backup using GitHub
I was recently looking for a solution to backup my configuration files (bash, vim, etc) using GitHub. After some looking around, I've compiled a pretty nice project for myself.
First, this script checks dependencies. My dependencies are git, ruby, vim, tree, rake, gem, bundle, and trash. You could check out the code and add any number of dependencies here. Rubygems and bundler are required because the script later installs all gems listed in Gemfile.
Next, the script copies ~/.bashrc to ~/.bashrc.local. This allows you to keep your current bash configuration as a 'local-only' config that doesn't get copied or committed to github.
The script, as I copied most of bootstrap.sh and the rakefile from @gf3, expects the repository to be cloned to ~/.dotfiles. From there, it calls rake.
Rake looks at every file in ~/.dotfiles and copies the corresponding file relatively from ~/ to, essentially, ~/dotfiles-backup/`date`. I recommend first running the backup to make sure your files are properly backed up.
rake backup
The script then calls 'bundle install' to install all gems. It then copies all files from ~/.dotfiles to replace those relative files that were previously backed up from ~/.
The post-install displays a message to remind you to edit .gitconfig and .hgrc.
Because I've done some copying and compiling, these are relative close to the three projects in the README for right now.
Here is an excerpt from the README:
Bash
$ tree ~/.bash
/home/jim/.bash
├── aliases
├── completions
├── completion_scripts
│ └── git_completion
├── config
├── functions
├── paths
└── prompt
The above files are loaded by .bashrc. The files are pretty self-explanatory, other than prompt which colorizes the bash prompt with tweaks for git.
Cool Aliases
- cd : pushd
- bd : popd
- cd.. | .. : back one directory
- cd... | ... : back two directories
- ^ up to five directories
- rm : trash
- undopush
- ip
- GET | HEAD | POST | PUT | DELETE | TRACE | OPTIONS
Config
- sets editor to vim
- sets English/UTF-8
- sets manpager
- sets commands to ignore in history
- sets noclobber (e.g. prevents
cat > IMPORTANT_FILEmistakes ) - sets nocaseglob (e.g.
ls ~/.B*will list contents of~/.bash)
Functions
The two functions, md and c may not seem like much, but they simplify some commands. For example:
$ md projects; git clone git@github.com:jimschubert/dotfiles.git && cd dotfiles
In the above line, md will create the projects directory and cd into it.
c stands for 'code' and works like this:
jim at computer in ~
$ pwd
/home/jim
jim at computer in ~
$ c dotfiles
~/projects/dotfiles ~
jim at computer in ~/projects/dotfiles on master
$
You can change it to whatever shortcut and issue reload, which is also an alias from this setup.
Screenshot
Notice the color scheme and github branch notifications created by ~/.bash/prompt.

