Monthly Archives: January 2012

My blog to book software

That stupid CBT talk-about-it pain group I got myself involved with in the hospital is a real downer. It’s really pretty negative for me, I don’t like having to think about pain all the time and I just dread the days I’m supposed to go, and have “skipped class” a couple of times because I just dread it so much. I just don’t think it’s healthy. Better to get on with what life you have left, at least if you’re like me and your pain isn’t psychiatric in nature. So I’ve been programming like nuts to try and keep my mind off unpleasant things. On that note…

There are a few commercial services out there that aim to print your blog for you into book form, but because my blog is so large and some of the formatting is problematic, none of them were able to do what I wanted. So, with the aid of Prince to do the final stage of printing (I can’t recommend this tool enough), plus a couple thousand lines of custom XML parsing code by yours truly, I have a tool that does a beautiful job of converting large blogs into book form, with complete formatting. It does the obvious stuff like turn links into footnotes, but it has some sneaky tricks up its sleeve as well like grabbing thumbnails for embedded videos and reformatting a variety of oldschool-HTML tables, which was important for me since a lot of my entries are old and imported from IAM when you had to do that sort of thing from time to time. Oh, and it has fancy comment inclusion ability as well but after a lot of waffling, I decided not to include comments in this printout.

Anyway, I’ll post more in a couple weeks when I get back the 2011 yearbook that I just ordered (about $60 for a hardcover 236 page letter-size full-color book seemed pretty reasonable), but until then let me really quickly post some screengrabs of the production PDF file:

My tool is WordPress specific, as it works with the XML export dumps, and for now, it’s pretty specific to my blog. Might be most helpful for me to share the custom CSS files I wrote, since they actually do a significant percentage of the work — much of the parsing and cleaning of entries could be done by hand on anything but the largest blogs (which unfortunately includes Zentastic, with thousands of entries). I’m happy to share it and/or the source code if someone wants it, but while it could be useful to others developing XML parsers, specifically for print conversion, I doubt it would be easy to make it work on any old blog.

[Comments are disabled on this post because there was something about it that was making it an over-the-top spam-magnet]

ZenCBR – Comic Book Archive Maintenance Utility

ZenCBR is a program that I wrote for maintaining large collections of comic books, with an eye to dealing with some of the issues that come from downloading them online. It’s main functions involve cleaning up the names of the files, finding doubles, making sure the file type is correct, removing references to scanning groups, and so on. It is not a viewer. It is a maintenance utility. I have tested it under 64-bit Windows 7 since that’s what I use, but it should run fine under any version of Windows from Windows 95 onward.

I’ve tested it extensively and it seems bug-free and stable, but please feel free to contact me with bug reports and feature requests. Contacting me via the forum of this post is my preference but you can email me as well if you want. The software has been updated since this entry was initially written so I apologize if screenshots or documentation is out of date. Here is the rough update history:

1.00 Initial Public release
1.01 Added training function to “Sort to Subs” function so that it learns possible names from your existing directory tree
1.02 Convert’s + to space when cleaning filenames, expanded URL encoding issues
1.03 Fixed major bug in renumbering function causing filenames including text like “this of that” to be trashed into “this of 0″ YIKES! Important upgrade!
1.04 Group detector now ignores numbers (which generally means dates)
1.05 Undo files now get written to zencbr-undo.bat (for clean, renumber, and groups)
1.05.1 Bugfix (undo file was only writing the header!), and a silly animation of the title text


**Installation and use**

DOWNLOAD: https://zentastic.me/blog/wp-content/uploads/2012/01/zencbr-1-051.rar
ARCHIVE AND EXE FILE SIZE: 53,991 bytes and 150,528 bytes (it's quite tiny!)
VERSION AND COMPILE TIME: 1.0.5.1 03/06/2012

To install the program, just download the zip file and uncompress it somewhere. It could be on your desktop, or “C:\zencbr\”, or anywhere else. It doesn’t really matter. The two text files should be placed in the same directory as the main executable, and when you run the program it will create one more file that it uses to remember your working directory between sessions.

ZenCBR is a command line tool that should in theory be run from the directory you’re processing comics in. That is, ZenCBR should be stored in its own directory (for example C:\ZenCBR\zencbr.exe) but when you run it, you should be in your comics directory. For example, you might change directory — “cd \comics\new” — and then run the program — “c:\zencbr\zencbr”. Alternately, if you’re not a command-line person, you can run the program simply by clicking its icon, and you can change the directory you’re working in by pressing “N” to navigate elsewhere. It will remember this for next time and start in that same directory.

Because it runs in text mode, it may seem threatening at first, but it’s really very very easy to use. The best way to teach yourself is to make a backup copy of some of your comic files and experiment on them to see how the program works. Once you’ve tried it a couple times it should be quite self explanatory. Feel free to ask questions here as well, or by email, although you’re more likely to get a quick answer here, and you can bet that if you are wondering it someone else is too.


**Commands**

Note that unless otherwise noted, all of these commands are executed on files in the current directory as well as all subdirectories in the current directory (and recursively inside them as well). So you can run this on your entire collection at once if you’d like. All the commands generate verbose output and tell you what they are doing, and ask for input when required, and terminate and explain why when they hit error conditions.

D – Find Doubles

You may find that you have multiple copies of comics. For example “comic 1.cbr” and “comic 01.cbr” and “comic 1 (scanned by joe).cbr” might all have the same content. This function attempts to find such doubles. When it finds a set of files that it thinks are duplicates it gives you a list of them, along with their filesize (perhaps you’d like to choose the higest quality version). You can either select the one to keep (the others are deleted) or skip and keep them all.

C – Clean Names

This function attempts to “pretty up” the names of files and directories. For starters, it converts all underscores to spaces. It also attempts to fix a wide range of minor typographical issues to improve readability, including removing double spaces and trailing spaces, hash characters, standardizing brackets and correcting their spacing, fixing lost apostrophes, and correcting spacing around “x of y” numerical phrases.

T – Fix CBR/Z type

A CBR type file is essentially just a standard archive (RAR, ZIP, etc.) that has been renamed to identify it as a comic book archive, which contains a bunch of image files (usually JPGs) of the individual pages of the comic book. The third letter in the extension specifies the type of archive used. For example, CBR means it’s actually a renamed RAR file, and CBZ means it’s actually a renamed ZIP file. There are other formats sometimes supported but they are extremely rare and are basically never used for distribution. That said, you would be amazed how many times I have seen a CBR file that is actually a ZIP, or a CBZ that is actually a RAR. Many viewer programs don’t care, but some will crash when faced with this or erroneously tell you that the file is corrupted. This command goes through your files and makes sure that the extension matches the actual archive file type. If it doesn’t, the file is renamed.

G – Remove groups

Often downloaded files will contain the name of the group that did the scanning. If you’re choosing to download files that have been scanned by others rather than repeating the work and scanning your own comics (since of course you would never download anything you don’t own), you will be left with files that say stuff like “(Minutemen-DCP)” at the end. This function removes the scanning group names. While ZenCBR does come with some training already done, you will need to train the program. When it comes across a term or name that it doesn’t know, it will ask you whether it is a group or if it should be ignored. If you tell it that it’s a group name, it will remove it, and will also remove it any time it sees it in the future. If you tell it to ignore it, it will leave it in place and do the same in the future. If you’re unsure, you can skip it “for today”, meaning that it will ignore it for the rest of this session, but if you run it again, you’ll be reasked. There is an option to run this command in “quick mode”, which skips all questions — if it doesn’t know a term, it just ignores it. Only known groups are processed. Be careful because there is no “undo” on this command. If you make a mistake, you can break out and edit the dictionary files. Their location is displayed when you start the program. They are plain text files that can be edited in notepad or similar programs.

Note: You can download a pre-trained file here based on a scan of files on the internet, use at your own risk: zencbr-training-1.rar (archive size is 15,810 bytes and should be uncompressed into the same directory as the application). This will save you some time, but you may want to train your own application.

R – Renumber

This command attempts to clean up the numbering schemes so they match. For example, if you have “comic issue 1.cbr” and “comic issue 02.cbr”, they may sort incorrectly because of the different number format. This program would rename the first file “comic issue 01.cbr” so they are consistent. The length of the number (with 0-padding) is determined by finding the longest one in use, and also by checking the “of #” phrase if there is one. For example “comic 3 of 100″ would be renamed “comic 003 of 100″ because ZenCBR knows that eventually it will need three digits. The “of” phrase however gets shortened so there is no 0-padding since it’s not needed there.

S – Sort to Subs

This special command, which not everyone will find use for, is the only one that is not recursive. This command is used when you have a large collection of files in a single directory that are of different series (ie. a bunch of Batman, some Superman, whatever). The program does its best to guess the name of the comic series, creates a directory, and moves all the relevant files into that new directory. Please note that it’s not perfect, so you will definitely need to go through and correct some of the directory names, but it will still save you lots of time.

Finally, to quit, just press either Q or escape from the main menu. You can also press CTRL+BREAK or close the window at any time.


**Open-Source**

This program was written in PowerBasic Console Compile Version 6.0 which you can purchase at PowerBasic.com and is highly recommended, as are their other compilers. You can download the source code and icon file at this link: https://zentastic.me/blog/wp-content/uploads/2012/01/zencbr-1-000-source.rar (archive size 20,679 bytes). That’s the source code for the first release. Here is an updated source code release for version 1.05: https://zentastic.me/blog/wp-content/uploads/2012/01/zencbr-1-051-source.rar (archive size 23,459 bytes).

Finally, please note that this is freeware by me, Shannon Larratt, and is provided with no warranty or guarantees of any kind. Use at your own risk.

Krocodile thoughts

Thanks a lot Dreamhost for a day of downtime. Greaaaaaat service. I can’t imagine how many customers they lost today. If anyone wants to suggest a cheap and easy and painfree host for my WordPress blogs, I’m listening. Anyway, I recently got the following email which introduced me to yet another grotesque corner of the net:

Subject: curious if you've heard about krokodil

and if you havent please dont look it up while eating, not sure why but when i heard about this i wondered if you had also

I actually hadn’t heard of it until this email so curiosity made me bite. There’s an article in The Independent called Krokodil: The drug that eats junkies and of course the Desomorphine Wikipedia entry has an introduction, but basically Krokodil is an inexpensive street drug that approximates the chemical structure of heroin by processing over-the-counter Codeine pills with iodine and red phosphorus. Unfortunately no effort is made to purify the drug, so you’re not only getting desomorphine (which isn’t inherently dangerous) but also highly corrosive toxins. These toxins eat away at the drug user’s flesh until it’s dead and gangrenous and literally falling off their body. It’s more horrible than you can possibly imagine, and users have an average lifespan of just a couple years after starting.

The pictures of people doing krokodil make those “Faces of Meth” websites look like a friendly beauty product. They are truly horrific. There is a big over-the-top disgusting photo gallery on Buzzfeed, but there was one awful photo from that page that struck me. Click the image to see it uncensored, or follow that previous link for lots more grossness.

There’s one thing though that really struck me in that photo. The tissue around the exposed bone at the hand end, and around most of its length, actually appears to be healed, as impossible as my gut tells me that is. Not that it looks by any means healthy, and the elbow end of the bone looks positively rotted, but it really goes to show how single-minded I am when my first thought was running through all the body modification possibilities — the idea that it is possible to strip and expose a bone, have it come up and out of the flesh, and actually survive and heal like that is wild. Could you do this with collar bones for example? I found some medical and veterinary and dental references with a quick search but I think it’s complicated because I’m not sure what medical terms to use that will save me from a zillion false positives.

It reminds me of an old story that I remember from about 1995 when (I think) someone I worked with at Stainless Studios (I can’t remember who) told me about someone that came in or someone they knew of — and I can’t tell you this isn’t an urban legend, who had been in some sort of an accident that left him with exposed bone on his scalp. I suppose there are animals that you could argue have exposed bone, so perhaps it’s possible, and these krokodil photos make me think even more that it’s possible. Anyway, the punch line of the story was that this individual had an image placed on the bone through some process akin to scrimshaw. Might be a good thing for someone to include in a steampunk graphic novel or something.

PS. And as a side note, the fact that people are willing to destroy themselves with Krokodil really shows you how much addicts are victimized by their condition… how desperate opiate addiction can make a person both to get back to that place where they felt good, and to get away from soul-crushing withdrawal. It really sucks that the system is far too often set up around a “punishment” mentality rather than a “treatment” mentality.

Continuing my snarking about Ami James on NY Ink

I went in with Saira today for her tattoo appointment with Shane Faulkner, where she got a bunch of Hindi script done in nice light grey-wash letters because she has some really subtle flowers that Shane did years ago in the same area that they didn’t want to overpower. So I spent the afternoon around tattoo talent, and an artist who while they earned their wings in the early 90s, has kept learning since then and has never been afraid to push past traditional tattooing — I think for example I can give him some of the credit for the popularity of all heavy white tattooing as he was one of the first artists to publish quality work of this type. Why was he willing to try something like that when no one else was doing it? Because he knows that tattooing is perhaps limited only by the medium, not by the portfolio of the artists that came before him. I’m happy to say that these days, most good artists understand that and there’s a lot of talent to be found. But then, when I got home, I turned on the TV and watched this week’s dumb television offering…

Ami James of the reality tattoo show NY Ink makes a big deal about wanting to run the best shop in the world with the best artists available, and positions himself as the king of that hill. He constantly belittles and abuses his apprentice — if it’s not all acting for the cameras, he’s a complete asshole to his “friend” — and goes on and on about how incompetent the apprentice is and how much he has to learn before he can call himself a tattoo artist. Problem is Ami James isn’t much of a tattoo artist himself. Sure, he can lay in solid flat color and draw a line that isn’t too shaky, but every single tattooist should be able to do that. Seems to me that Ami James got to the point where he could do the basics and then decided that there was nothing more to learn. Let me give you an example from the most recent show.

A woman came in with a painting that her grandmother had done wanting it put on her skin. She told Ami that what was important to her was that it look “like a painting” and “not like a tattoo”. The only thing she wanted changed was to have a New York skyline added. So what does Ami do? He changes the design in order to make it look “not like a painting” and “like a tattoo”. It’s as if he heard the exact opposite. The color is typical flat shading/blending and most obviously and most glaringly, he gives it the trademark of cheap tattoos everywhere — a heavy black outline.

Just think how great that could have looked if, for starters, the cloud was done in white ink with no outline. Not that it didn’t stop the dumb-ass client from exclaiming, “it’s exactly what I wanted!” Maybe people get the tattoo they deserve, not the tattoo they asked for.

But come on, Ami!!! Can you seriously not do a tattoo that doesn’t have a black outline around the color? Did you learn to tattoo from colouring books? Are you seriously not able to lay in textured color so it looks like paint? These are basic skills. I know that the painting the client brought in isn’t particularly well done either, but come on, this tattoo is crap. Kat Von D must be so happy not to be on the same show as you any more. Why must you make me yell at my television, and then further embarrass myself by writing about it on the Internet? Gawd, I hope one of their producers reads this and hires me to teach Ami how to tattoo. They don’t even have to put me in the credits. I’ll even pay for my ticket down to NYC just to cut down on my irritation level from future shows.

God, the guy couldn’t be more mundane and boring. A good tattoo artist is always learning, always pushing themselves, always improving as an artist — I know that if I was a tattoo artist that landed a TV show, you can bet that I’d be taking every spare moment taking classes — and just practicing new things — to make sure that I don’t look like a fool. In the episode he had the gall to insult his apprentice about not being good at watercolor, and then went and showcased his own small-minded view of what tattooing can be. It’s embarrassing. As I’ve said before, if I want a something that looks like flash from 1995, Ami will surely be able to do a superb job. But if I want anything that can stand up alongside the caliber of art that should be expected these days, forget it. I wouldn’t care if it weren’t for the fact that he continually brags about his status as a tattoo sensei and egotistically looks down on everyone around him. <Insert aggravated primal scream here>

“Uncle Shannon paint me dog?”

My friend Saira’s year and a half old daughter has always had a painting with a cat in it that I did, and recently asked if I could paint her one with a dog in it as well (their family’s beagle, Milo, unfortunately died before she was born so I can only assume she has seen his ghost). Does this count as a commissioned piece then? She is also quite scared of me on account of the beard, so I am hoping that this little painting is a suitable peace offering. Sketched it last night and painted it just now over a couple hours of watching documentaries in the background. It’s done on a roughly 8″x6″ piece of gesso’d plywood (I told you it was little) using acrylic model paints.

You can click to zoom in, not that it’s particularly detailed…