Using Sublime Text Editor With PHP

Do you have a brand new installation of the Sublime Text editor which you plan on using for PHP (or any other language which identifies special strings, like variable names, with a symbol, like the dollar sign ‘$’)? Don’t forget to change the Preferences > Settings — Default > “word_separators” to remove that dollar sign (or other symbol). Now your copy-paste won’t keep losing your ‘$’.

Posting Code To A Blogger Blog

Added support to this blog for syntax-highlighted code blocks in this blog using SyntaxHighlighter by Alex Gorbatchev.

I wanted to add properly formatted and syntax-highlighted code blocks to this blog, so I looked into what others were doing and what was considered best practice at this time. The best single article I read covering this topic was “How to Post Code To Your Blog and other Religious Arguments” by Scott Hanselman. Visually, my favorite code blocks were those formatted as though they were in Sublime Text (example #1, example #2). However, I could not figure out how to accomplish that without making the underlying material a mess; I suspect there is a tool for Jekyll or similar, which I’m not currently using and cannot easily take advantage of. As such, my choice is instead to use SyntaxHighlighter by Alex Gorbatchev. The SyntaxHighlighter source code is on GitHub and it keeps the underlying code intact inside a single <pre> tag. Also, Alex very kindly offers free public hosting of SyntaxHighlighter, which makes using it on Blogger much simpler (include <script src=””> tag calls instead of copy-pasting the source either into JavaScript widgets or the template itself).

The SyntaxHighlighter installation is as simple as one could hope, though you do need to edit the HTML of your Blogger template directly (Blogger > Template > Edit HTML). Just include the necessary files just before the </head> tag:

<!-- support for SyntaxHighlighter by alexgorbatchev.com -->
<link href='http://alexgorbatchev.com/pub/sh/current/styles/shCore.css' rel='stylesheet' type='text/css'/>
<link href='http://alexgorbatchev.com/pub/sh/current/styles/shThemeDefault.css' rel='stylesheet' type='text/css'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushCss.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJScript.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPhp.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushSql.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushXml.js' type='text/javascript'/>

And then add a couple lines of JavaScript at the end of the template, just before the </body> tag:

<script language='javascript'>
// support for SyntaxHighlighter by alexgorbatchev.com
SyntaxHighlighter.config.bloggerMode = true;
SyntaxHighlighter.all();
</script>

I also was not able to get the AutoLoader to work, so instead I’m explicitly including all of the code brushes I intend on using (out of the many default available brushes).

Using it is similarly straightforward. There is a demo. Used trivially, it is just content in a <pre> tag with a class=”brush: language”, but there are additional options if you care. The one caveat is that all right angle brackets must be HTML escaped (you must replace all “<” with “&lt;” in order to avoid it being interpreted improperly by browsers and other readers) (read the installation page).

Navigation Bar Gadget

Added a navigation bar to this blog, currently hosted on Blogger, as an HTML/JavaScript gadget (widget).

I looked around at how other people were adding navigation to their Blogger blogs and decided that I liked the HTML/CSS/JavaScript gadget method. For this specific navigation bar, I followed:

Although I found that I also had to add some additional CSS to the theme customization in order to undo some of my current theme’s defaults.

.widget li {
margin: 0px;
}

Devil Music 5.5″ x 8.5″ Paperback Edition

The Devil Music 5.5″ x 8.5″ paperback edition is now available through CreateSpace. This took longer than the ebook editions because I did order a proof copy of the book. You can get it [HERE].

The proof copy of the book arrived on April 9th, 2014. I’m glad we got one, because reviewing it did turn up a few errors which were then corrected before this edition was made available for sale. I also had to go back to the ebook vendors and upload revised files for them (those editions).

Although Custom-book-tique did format the book for us and got the project started on CreateSpace, doing so yourself and filling in the information is fairly easy and quite straightforward:

  • Title information is just the title, subtitle, author, contributors, language, publication date, etc.
  • They do ask for an ISBN, which you can get for yourself. If you do get your own ISBN(s), then be careful to use them correctly (e.g. use the same ISBN on CreateSpace as you use on the application for a certificate of registration from the Library of Congress).
  • The interior and cover are both defined as PDF files formatted for publication. This 5.5″ x 8.5″ Devil Music paperback uses a glossy cover.
  • Although you can review the files and approve the proof of the book exclusively online, I’d encourage you to go ahead and get a PROOF copy and thoroughly re-read it to check for both proofreading (e.g. spelling, grammar) and formatting (e.g. uneven margins) problems.
  • You will also need to provide a book description and author biography (you will need several versions of this information meeting various length restrictions; I’ll write more about them in another blog post later).
  • You will need some keywords for your book here and in various other places. Do not include the author’s name or words from the title since those will already be associated with your book.
  • Pricing … yeah, good luck with that. Devil Music’s retail list price at publication/launch was selected to provide the author with a $1.00 USD royalty when sold through “extended distribution”.
  • I’d recommend using Kindle Direct Publishing (KDP) rather than publishing to Kindle through CreateSpace.