Compile PoDoFo in Visual Studio 2013 Express [Draft]

This document (post) is a quick-draft containing notes pertaining to my little (WORKING) scripts which makes compiling PoDoFo pretty easy (at least for myself).

Intent on some p/invoking, I noticed quite a few posts/articles/questions questioning or confusing on “how to build podofo in VisualStudio”, so when my little adventure figuring it out worked out nicely, I figured that writing this up and into the public domain couldn’t hurt.

This scope does not go beyond an initial working build of podofo.dll or a static library.
You should at least generally understand writing/building C/C++ apps in VisualStudio to find this useful, as I’m sure if you’re reading this with interest you’re well aware.

If you are friendly with msys2, feel free to ‘check out’—which contains msys2 build-scripts for creating and installing podofo, mupdf and mupdf-qt packages.


That is,

PoDoFo is quite capable a PDF writer, written in CPP (not a renderer). In using it, you are going to want to become familiar with PDF specifications, and perhaps download PoDoFo-browser (QtApp) to get a look under the hood of some gritty PDF files to study.
One of the surprising features that PoDoFo has to offer which other libraries do not is the ability to edit an existing document—however, probably better off sticking to creation of PDF documents. In many cases, attempting to write into (edit) a PDF from the wild will demand recalculation of any existing matrix-transformations in order to predict where drawing/writing is going to take place.

Script Introduction

Designed to save you a little time when it comes to building PoDoFo in VisualStudio 2013 Express using NuGet packages.

Nuget supplies us with cppunit, libjpeg, libopenssl + libcrypto, libpng, libtiff and zlib. libeay32.dll (libcrypto) and ssleay32.dll (openssl).

Most of the work involved in setting up compilation from scratch was in finding the nuget packages and resolving paths to the particular includes and binaries being linked to—preparing variables to inject into our call to cmake.exe. Other than that, there was one minor ‘issue’ which had frustrated me slightly in figuring out how and why the OpenSSL/libCrypto include path wasn’t injected into each project during the cmake (Visual Studio project) generation process—so I ran into compilation errors until patching CMakeLists.txt.

Continue reading

MSYS Helper


Until some better instruction is elaborated, I hope this might lay some tasty bread-crumbs down to help one(s) getting started with MSYS. There are other ways (I do like msys2) and other manuals/tutorials however this would be a quick overview of my favorite, basic setup.

MSYS is a command-line environment that emulates a posix-like GNU/GCC AUTOTOOLS compatible (or ‘like’) system for windows to use MinGW (Minimalist GNU for Windows)—bringing GCC (Gnu Compiler Collection) and AUTOTOOLS (and friends) to Windows.

Following is a quick-start tutorial on getting MSYS up and running with some version of mingw-w64.

  • view/save github-gist version of the Multi-Markdown version of this document here

Continue reading

compile woff2 compress/decompress on Windows

This post (once again) re-presents a comprehensive way to compile Google’s woff2_compress and woff2_decompress tools on Windows using MSYS, CURL (which comes with several MSYS distros), GIT and some version of mingw32-w64.

  • 20150824 — updated
  • May 6 2015 — PATCHING IS NO LONGER REQUIRED on Windows using mingw32-w64. The project(s) compile quite easily now in mingw32-w64-i686 and mingw32-w64-x86_64.
  • April 15 2015 — woff2 sha1:7375be53fc0c7c9c1f1bb62a29d94650fa7448b7 is now supported only for mingw32-w64 (posix) compiler version(s).
  • prior — (oh forget it)

After translating my efforts to DIFF patches (for compiling this project on Windows)—I couldn’t resist attempting to spread my MSYS/MSYS2/MINGW-W64 joy😉

WOFF2 Observed

From Jyrki Alakuijala on stackoverflow: “WOFF 2.0, based on the Brotli compression algorithm and other improvements over WOFF 1.0 giving more than 30 % reduction in file size, is supported in Chrome, Opera, and Firefox (pending in upcoming version 35).” woff, woff2.

WOFF2 Browser Support

WOFF2 Browser Support

WOFF Browser Support

WOFF Browser Support

Lets MAKE this simple

I did some scripting so you can pretty much load up MSYS bash, COPY/PASTE and execute one of the following snippets. However lacking prior revisions of this post was misleading garbage ;( is better now😉

be aware: This script is designed to abstract the process of downloading, patching and compiling Google’s woff2 C source-code project(s) to binary executables to copy/pasting the code/snip-it below.

Compile on Windows


  • MSYSmsys+7za+wget+svn+git+mercurial+cvs-rev13.7z.
  • See: MSYS Helper post for instruction on how to ‘mount’ your chosen version of mingw-w64 if you are completely new to and interested in getting started in MSYS.
  • MSYS2 is highly recommended. It absolutely ROCKS, containing a forked version of arch-linux’s package-manager, pacman. Learn to use pacman😉 msys2 appears to use posix threading model once you use pacman to install mingw (and friends).
  • GIT (on your PATH) — MSYS (listed above) has it but I hadn’t tested it (probably works and probably worth calling git --version if you want to skip downloading and installing GIT).
  • mingw-w64-mingw32 — versions >= 4.8.0 seem to work
  • 32 bit: mingw-w64/mingw-builds GCC-4.9.2
  • 64 bit: mingw-w64/mingw-builds GCC-4.9.2

If you’ve got a working, compatible msys+curl+git+mingw32-w64 configuration you can copy paste the following into your bash console.


# download
curl -L -oget-woff2

# execute


OPTION#2: HEAD REVISION (known to be working in msys2 on 20150824)

# download script
curl -L -oget-woff2-head

# run it



How embarassing ;/
My last edit broke down rather quickly. Apparently I was referencing an undefined (renamed) $(variable), so it was checking out the latest revision and not the SHA1/revision specified—oops ;\
Apologies to those whom this may have a/effected. In any case, I hope those of you who encountered this were able to figure it out!






The (OLD) Gist

is dead now😉

Ubuntu-Server + VirtualBox Notes

This is chock full of nuts notes I jotted down to get more familiar with (or ‘refresh’ on) stuff common to MSYS and GNU/Linux dev given how easily I tend to forget a code-driven mentality such as this—I’d gained the habit of maintaining journal entries like this one. Its a work in progress that I haven’t been playing with the past couple weeks, so if you’ve got a question or find any particular matter misleading or shoddy or would like something added, feel free to comment. I’d be glad if anything in here proves insightful or helpful to any of you new to the virtualization+cross-compiling band-wagon.

I basically started maintaining this when I gave up trying to compile things in Windows/MSYS/bash that just aren’t worth wasting time on any more—I used to bang my head on to teach myself GNU-like dev via my Windows-machine. I suppose the primary reason I’d gone with the headless ubuntu-server was to be forced to become intimately familiar with gnu bash via SSH. Actually (mostly), I just got fed up with ruby-on-rails limitations within the context of my windows development environment(s) and I also want to learn more Golang in the spare time that I can find to do that—With a machine like ubuntu-server (via SSH) on virtualbox. I must admit though, the first thing I did was toss my old FFmpeg/MSYS build scripts out the window and use rdp’s ffmpeg-windows-build-helpers script(s) and patches to build a non-free FFmpeg—not to mention learning from that and other scripts like Zeraone’s Mingw32-w64 build script(s). Lately I’ve been building up a development environment to translate some of the things that I’ve been working on (in csharp) over to C/CPP like the old MIDI parser and my little (code/template) generator app with the quick execution of a quick snipit like provided in my last post.

This is a COPY/PASTED Multimarkdown document—hence the erroneous markup throughout this page. The generated PDF was created using pandoc.

You can download a clean PDF version of this page here. *You might have to refresh the page if it doesn’t load the first time or check the attachment page.

SMFVSTUI (prototype) demo

VST-HOST prototype written using NAUDIO and VSTNET a couple years ago. The (IVstHost) implementation was completed in two weeks — only written to test out a MIDI parser I had written prior, as well as benchmark weather or not writing a VST host might be achievable by myself.
–my first attempt of coding streams of data sent to a sound-device.

I was an absolute NEWB at writing threaded processes when I wrote this (it shows); Understanding threads (to the best of one’s ability) is pretty-much one very strong ‘key’ to writing something like this.

FEATURES ( or lack thereof😉 )

the only intended feature is that you can load a MIDI file and play it through a VSTi and effect.

  • 1 VST INSTRUMENT: in the audio chain
  • 1 VST EFFECT: in the audio chain
  • MIDI VISUALIZATION: no editing; only visualization
  • NO TEMPO-CHANGES take effect
  • NO DOCUMENTATION (is just a prototype, you know)


  • Robert Miles – Children (Dream Version) — sequenced for XG by Chris Abbott
  • Pure SYXG50 Demo here — without playback quirks
  •…/children.mid (not the original)
  • My copy of the sequence;
  • don’t remember if I adulterated the file or not. it might have been mixed down to ‘midi format 1’; one midi track (data-stream) – using CWPA a while back.

SOURCE CODE (Windows Vista/7/8 compatible)


If I were to choose the next course of action to take on development of this little project (aside from re-writing or repairing the NAudio implementation, and some other workings…), the needed feature that would resolve many of the little bugs would be writing a sound-export capability.  This would require calculations that are not present, including adequate time tracking—which would enable tempo changes (from MIDI messages) to have an effect as well as navigating to a seek-position.  The primary reason this wasn’t important to me, was in my simple desire to feed MIDI messages (without any external API) from my MIDI parser.

That said, most of the work in implementing MIDI to the IVstHost’s AudioProcess is resolved by a particular time-calculation (or configuration) and SampleClock class.  A lot of the driving force for the project is in gen.snd.common/source/core.  Aside from this, I noticed that there is an obsolete duplicate of TimeConfigurateion.cshere.
—hymmm.   At ‘any rate’—these are the little fragments of knowledge that helped make this possible.

[gist] FirstFloor.ModernUI: SharpDevelop 5 xpt template

  • 20150925
    • note: FirstFloor.ModernUI has been further revised and migraated to Github from CodePlex.
      • At the time I’d written this, the current version of ModernUI.WPF NuGet package is 1.0.6 as the version used in this project-template is 1.0.5. You can safely use this project-template and/or upgrade your nuget-package after (still works). The reason that I didn’t update is simply because I’m happy to use the 1.0.5 version for now.
    • fix: erroneous v4.0;v4.0Client targets: Prior (v4.0;v4.0Client target) version was pointing to a v4.5 assembly causing a crash when launched.
    • fix (v4.0-targets): a problem with the App.ResourceDictionary specific to Framework v4.0 template.
    • clean comment/errata from App.xaml.cs

When creating a FirstFloor.ModernUI application I was using a zipped project as a template and started getting really sick of renaming the namespace in each and every file within the project so I created a XPT (SharpDevelop CSharp Project) template based on the standard WPF Application template.

(edited 20140808 to add net40 support — see FirstFloor.MUI-documentation)

  • direct download: two versions net40, net45 (right-click, save as)
  • copy to your SD-v5.0 or SD-v5.1 directory; on my 64-bit Windows:
    C:\Program Files (x86)\SharpDevelop\5.0\data\templates\project\CSharp or C:\Program Files (x86)\SharpDevelop\5.1\data\templates\project\CSharp
  • Once there, you can find the template upon creation of a Sharp-Develop Project.


This is a modified clone of the default WPF Application XPT template. I doubt I’ll provide a suitable sdaddin plugin providing this template, but if I do, will update this post.

When using this template, you must remember to ‘Restore Nuget packages’ by right-clicking the CSPROJ node, or Assembly References TreeNode (in the created SharpDevelop Project Tree) and selecting that option. The template compiles out of the box, however if you are new to using the FirstFloor.ModernUI framework, you should probably check out their documentation on getting started.

To install, copy the file to your SharpDevelop templates directory.
Once more, —for me this is located:

# SharpDevelop v5.0
C:Program Files (x86)SharpDevelop5.0datatemplatesprojectCSharp
# SharpDevelop v5.1
C:Program Files (x86)SharpDevelop5.1datatemplatesprojectCSharp


Future Revision

The next revision on this theme will include a readme and perhaps a main view to get things started.


There are so many revisions because the GIST kept truncating (only uploaded half the content) when revising!


Some notes on AAC+v2 audio (dump) playback on Windows (Vista/7/8) using NAudio+MediaFoundation (incl. source)

FYI: At the time the original app was written, AAC audio-file playback wasn’t as easily supported in NAudio.

…For those who just want sources:

  • on github here – glance at readme and compile-instructions
  • zip package here — Now the zip package (dumped-aac+v2wave-NAudio- actually includes NAudio sources as well as those missing includes (of 2014/08/15). —Apologies.
  • Point of interest being NAudioMediaFoundationReaderX.cs#L132



  1. Wanted a player that can play un-boxed streams or stream-rips (particularly AACv2).  WinAmp (who provided ShoutCast) worked by configuring *.aac using DirectSound (input plugin options).  As this was more then a year ago, I believe my memory serves me in that the file was locked when open this way.  I have since lost interest in recording syndicated (talk) radio, so now—a need for AACv2 is not really used by some of the streams I currently record as MP3 is used; — hence no longer testing such options.
  2. While playing a file in this thing, the file isn’t locked. This makes it possible to use other software such as FFmpeg to split a large track or some-such (while the stream is still being dumped).
  3. Seek/scroll to time position with a seek-bar. (Git sources have an added feature where you can double-click on the time-label to type in a time to seek to.)

CONCLUSIVE: Aside from injecting channel info, the files need(ed) to be opened in a FileMode which does not lock the file so that the file can be split and played while being dumped.


  • I was particularly bent on finding out whether any pertinent information might be found (META info) such as number of channels, meta-type (EG: “m4a/aac”) and other such data that could identify the stream. I wasn’t really able to find anything in HTTP HEADER info that helped—nor any resource online that could help, so all that can really be done is to be aware of the stream you’re provided.
  • playback of a live or dumped shoutcast streams should take into consideration that there is no META information (sample-rate, number of channels, bits per sample, or generally—the type of data in WaveHeader).
  • Treat AAC+ dumps as 2 channel 16bit data @44,100 samples per second. This applies to just about any 64kbps (and lower kbps) AAC+ ShoutCast stream.playback of a live or dumped shoutcast streams should take into consideration that there is no META information (sample-rate, number of channels, bits per sample, or generally—the type of data in WaveHeader).
  • For AAC, I believe we can probably just check the GUID from MediaFoundation and if its AAC and happens to be a shoutcast stream, we can inject our own WaveFormat settings for WaveOut.  Otherwise, apparently I’d obviously used a combo-box to allow for selecting channel/sample-rate info.

Looks like my last post (journal entry) doesn’t really clarify anything except to myself which is a little embarrassing.  It was a brain-storm effort leading to working playback of AAC+ stream-data from some live ShoutCast radio stream (or particularly, a stream dump).  To  put it in a nut-shell what I realized in my little rant:

Well if you found that last post mis-giving in any sense, I hope this might be of service. I suppose this might be my first subtle attempt at following though on a blog/article/post to spite fishing with some old journal entries😉. I pretty-much use this to play stream dumps, so I can listen to the radio like people might watch tivo.

Added my simple common-sound library to github repo

Anyone is welcome to poke around any of thestuff I’ve got up on github.

Though I might change the name of the particular repository and migrate modules out of it (such as the midi parser, which might allready be a consolidated project somewhere on my HDD) there are a few reasons I’ve been integrating some of this stuff to the public domain.

Next is getting what I’ll probably term “general (common) audio/video” or gen.av.common up on github.

Moved my github acct

A few days ago I did something that I should have done a while back. Certainly, this currently does not effect anyone but myself, though there is some progress…

  • changed my github user-name from ‘tfoxo’ to (to match this site).
  • Migrated all of the ‘system.cor3’ library to separate ‘modules’ which are used as modules now within other project-spaces.
  • The generator-tool has now been migrated to its own github repository here using the respective modular github (cor3) libraries.
  • Generally the way my little github repo-names work is that any cor3 related project which is a library is named with a period such as cor3.core,, cor3.par (parsers), etc. And then any cor3 related project rooted in the library modules is named with a dash: cor3-sandbox, cor3-lib and cor3-gen.
  • and finally, I started using the issue-tracker feature on github for the generator project.

Thats about it for now. It looks like my sound-related stuff is going to end up here soon.


NET40 CSharp — Hierarchical TreeModel to wrap generic “ parameter in a derived class.


  1. ContentWrapper
  2. CONTACT_TYPE structure for SQLite.
  3. ContactTypeItem (ContentWrapper).


Sorry for the lack of a ready-to-go setup for the little demo.

This example (structure implementation) uses a flat data-source including the fields id and pid indicating the item’s hierarchical parent-id or Null root-level.


        [pid]           INTEGER DEFAULT NULL,
        [key]           VARCHAR DEFAULT NULL,
        [description]   VARCHAR DEFAULT NULL,
        [value]         VARCHAR DEFAULT NULL
    /* we're using a KEY as a grouping mechanism in stead of naming the column 'group' */
    /* 1 */ INSERT INTO [CONTACT_TYPES]('pid','key','value') VALUES(NULL, 'clients','Client-Business');
    /* 2 */ INSERT INTO [CONTACT_TYPES]('pid','key','value') VALUES(   1, 'clients','Client');
    /* adding businesses for out-sourcing jobs */
    /* Lenzen IP can go here, for example. */
    /* 3 */ INSERT INTO [CONTACT_TYPES]('pid','key','value') VALUES(NULL, 'employees','Local-Business');
    /* 4 */ INSERT INTO [CONTACT_TYPES]('pid','key','value') VALUES(   3, 'employees','Local-Employee');
    /* 5 */ INSERT INTO [CONTACT_TYPES]('pid','key','value') VALUES(   3, 'employees','Local-Management');
    /* 6 */ INSERT INTO [CONTACT_TYPES]('pid','key','value') VALUES(   3, 'employees','Local-Accounting');

or csharp

            var contacts = new List(new CONTACT_TYPES[]{
                new CONTACT_TYPES(){id=1,key="client",value="Client-Business"},
                new CONTACT_TYPES(){id=2,pid=1,key="client",value="Client"},
                new CONTACT_TYPES(){id=3,key="local",value="Local-Business"},
                new CONTACT_TYPES(){id=4,pid=3,key="local",value="Local-Employee"},
                new CONTACT_TYPES(){id=5,pid=3,key="local",value="Local-Management"},
                new CONTACT_TYPES(){id=6,pid=3,key="local",value="Local-Accounting"}


Continue reading

PeerBlock Update!

In light of my last post (TorBrowser), on the subject of computer privacy… You might also want to check out peer-block.  I haven’t seen updates to it in a while, but apparently there is a Nov 27th 2013 build 677.  From their website…

What PeerBlock Is
“PeerBlock is a type of program known as an “IP Blocker”.  IP-addresses are used to identify a computer whenever it connects to the internet.  PeerBlock monitors each connection your computer tries to make with another one – and each connection other computers try to make with you – and then compares the other computer’s IP address against a list of “known bad” IP addresses to see whether it should let this connection go through or not.”

Tor Project

The Tor Project: About (as found on the jobs page)

About the company
“The Tor Project is a US 501(c)(3) non-profit dedicated to research, development, and education about online anonymity and privacy. The Tor network’s 3000 volunteer relays carry 16 Gbps for upwards of half a million daily users, including ordinary citizens who want protection from identity theft and prying corporations, corporations who want to look at a competitor’s website in private, people around the world whose Internet connections are censored, and even governments and law enforcement. Tor has a staff of 30 paid developers, researchers, and advocates, plus many dozen volunteers who help out on a daily basis. Tor is funded in part by government research and development grants, and in part by individual and corporate donations.”


PdfCat (Concatenate PDF files in CSharp)–no wait…

PDFsharp/Migradoc can prove quite powerful and handy depending on your PDF-related objective.

This code is merely a clone of a demo/sample integrating two simple command-line arguments (using my simple little command utility) allowing you to set a limit on the number of pages copied into the generated document.

PDFsharp does not support all PDF capabilities, therefore when a un-supported feature is encountered, the particular input file is ignored during the concatenation process.  See: // to observe PDF# dropping the ball supporting reading PDF v1.5/Acrobat 6.
The benefits of PDFsharp are in the drawing API (mirroring GDI+ in .NET) and not so much this little feature.
—the particular v1.5 feature which is missing from MigraDoc is one that utilizes (zlib) compression/optimization on document-segments contained within the PDF format.

source: on github

So I wrote this up thinking that it might actually be useful, but in actuality I’ve learned as mentioned above and the script is just about useless unless you or I integrate the mentioned workaround (not likely). At any rate, I’m more interested in SumatraPDF (MuPdf) and it’s embedded library friends when it comes to reading PDF data. Well at least I have two little examples of the “console argument astraction” thing.😉 Can’t say I like PDF# much less.

better open-source solution for producing bitmaps:


asm.js, Emscripten & friends

Its always nice to (re-) discover something for the first time…
Like a tool-chain that can compile c++ sources into pure Javascript.

asm.js spec  §1. Introduction
“This specification defines asm.js, a strict subset of JavaScript that can be used as a low-level, efficient target language for compilers. The asm.js language provides an abstraction similar to the C/C++ virtual machine: a large binary heap with efficient loads and stores, integer and floating-point arithmetic, first-order function definitions, and function pointers.”

Thus far, my favorite demo is speak.js (off Emscripten wiki page), a port of eSpeak.


  • Devon Govett’s BADASS JAVASCRIPT — html
    • 20130403 – “Excellent article clarifying Mozilla’s asm.js project by John Resig” — html
  • 20130317 – Mozilla’s asm.js Specification (Working Draft) — html
  • Alon Zakai/@kripken
  • LLVM Features — html
  • Clang
    • 20130928 – “C++98, C++11, and C++14 Support in Clang” — html


This (draft) was going to contain a list of e-publcation formats such as epub, pdf, cbr, cbz, mobi, html-markup (and friends), markdown (PEG, MMD and friends) – and some e-reader applications.  The idea was to index a variety of e-book file-formats, tool/compilers to generate a variety of e-publication formats, and read them—for the READING page I’m treading on, but the page probably won’t have too many TeX documents  listed on it.  Without any hesitation, TeX was the first e-publication format I can think of and with good reason.

TeX, DVI & METAFONT technology was invented by Donald Knuth–Professor Emeritus of The Art of Computer Programming at Stanford University.

Ever read an article on-line with ``weird quotes like this''---and wonder why the article was published using `these' weird methods of quoting when we have the right symbols on our keyboards?  This little section is the longest (in what may become as series of posts on e-publication formats) because if you intend to take advantage of technology to learn, TeX (and friends) is simply irreplaceable.

TeX is (or at least provides) one of the best as well as longest-standing technological electronic-publishing ‘standards’ (for lack of a better term—systems) to date.  TeX documents remain one of the most widely used systems for writing collegiate research articles, thesis papers and publishing formats (that is–books) and the many document templates and scripts continue to grow in volume to this day.  Applied math students will inevitably find them-selves writing math syntax invented with TeX – as on a related note, there are many research materials and math formulas that one may find on-line solely in TeX (or a variety such as LaTeX) document formats.

The Device Independent file format (DVI) was  and appears to remain the primary output format (similar to PDF);
While over the years, Adobe PDF documents have generally been accepted as the dominant ‘e-book’ or ‘e-publication’ format—newer, extended versions of TeX such as PdfTeX, LaTeX, XeLaTeX (my favorite) and more cover several extended features designed to enhance the process of producing PDF documents.

List of books by Donald Knuth: html

‘Donald Knuth’ Youtube search results
“All Questions Answered” Google Tech Talk featuring Donald Knuth: youtube
“My advice to young people” Donald Knuth: youtube


xrename: batch rename tool

Recently, I’ve run into a scenario where basically I wanted to edit the organization of various files in a directory on my computer.

Abstract: Regular expressions compatible with common operating systems are used to re-interpret file names as names are added to IEnumerable item store.

→In such a way that produces file-names distinctly sorted by the operating system’s default file-“name”-column sorting—such as numbered sequencing.
↔Within the IEnumerable item-store is information about the file including access to the FileInfo structure.
←If the Regex.Replace method produces adequate results, the file is renamed: FileInfo.Move([newFileName]).


Those who know (knew) me might find it surprising that I never downloaded a digital comic-book until recently.  I suppose it was a similar thought that I had when it re-occurred to me that I was using a e-book reader that was capable of reading comic books (SumatraPDF featuring MuPDF as it’s cbr and pdf reader internally).  So I recently downloaded a e-mag and realizing PDF capability generally went to waste.  I thought to myself, Why freaking bother spending all the time packaging it in a PDF if you’re not going to bother to OCR scan the thing?   Why not just throw the files in a zip file and rename the extension?  Granted, I get it.  PDF readers are commonly on every computer these days, but the comic book format is much simpler and better-suited for reading, navigating and distributing a set of images prepared for a reader application.  So I had to download a comic-book to see if anything has changed since I looked into digital formats for comics 10 years ago.  Comic-book hasn’t really changed in a while.

Comic Book file-formats are quite simple.  Its just a zip (cbz), rar (cbr), 7z (cb7) and whatever particular compression that software might handle for this format.  That aside, each file is simply sorted and rendered in something like a PDF viewer where you have control over how to view the pages. When you download and attempt to read a comic-file such as this, you will come across a ‘spread’ that spans two pages commonly fit onto a single image file.  When I came across a spread page, for some reason I was inclined to break the spread into 2 separate pages, in which case I was dealing with the 14th image in a set of 24 where I had to rename all images after the 14th in order for the images to show up in proper order.  Since renaming large numbers of files has been a recurring issue I’ve either ignored from time to time or handled manually, I figured I would write up a quick solution.

Most default or common (simple) sorting algorithms can not typically or properly sort a sequence of strings such as [13, 1, 120] as you might get a result like [1, 120, 13]. The tool simply uses a Regular Expression syntax to find a set of files to rename, and it can rename them in a way that is sortable by most common sorting algorithms where strings look something more like [001, 002, 003] but more like a file name of course [myfile-001.jpg, myfile-002.jpg, myfile-003, ...].

A Sample Task?


Prepare a Comic Book ZIP/RAR/7z/… set of images

3D — SDL, GLUT, GLEW (etc…)

I’ve been working on understanding many of the demos and programs that are available via various sources such as the OpenGL website and some many other sources such as the WikiBooks tutorials, SDL tutorials and so fourth.


logged: 20130220; public/edit 20131105 CONTEXT: MEDIAFOUNDATION-AAC+

This post is a old journal entry, this guy is a re-write with complete source-code to download or to view on github.

Just had to share a few bits of my excitement, albeit not so practical. I just figured I could stream AAC+ Audio when I noticed the MediaFoundation impl used in the demo.

pile of assumption: Loaded a un-boxed shoutcast aac/aacp dump, it had no problem playing, but it was playing at a quarter the speed.  After pondering the matter a little, realized it wasn’t boxed which meant no channel/rate-snifffer to report back channel and rate info, or in other words it was reporting 1ch at 22,050khz/rate, while typical aacp streams use 2ch, 44100 content.  Knowing little to nothing about typical DEC processes (compared to ffmpeg command-line arguments), it occurred to me that ffmpeg with libaacplus seems to like no other rate than 44,100 for it’s encoding.  I also noticed from playing aac+ (dump) files (winamp), that they seem to start off in mono at a lower quality until the decoder figures out what’s going on in the first (or+) chunk.

Attempting to load a standard (mono) mp3 stream in this manner results similarly with in-correct n-channels.

At any rate (pun intended), I figured I’d post a quick hack for those interested in writing a MediaFoundationStreamReader where it

perhaps within NAudio.MediaFoundation.AudioSubtypes…

/// Adaptive Multi-Rate audio.
public static readonly Guid MFAudioFormat_AMR = new Guid("73647561-0000-0010-8000-00aa00389b71");

blatant hack: within a cloned NAudio.Wave.MediaFoundationReader(string,MediaFoundationReaderSettings)

//after//int channels = outputMediaType.ChannelCount;
//int bits = outputMediaType.BitsPerSample;
//int sampleRate = outputMediaType.SampleRate;

// virtual check to see if the file is boxed somehow, or just forcing to amr as follows.
// in other words, if the file isn't boxed (shoutcast: audio/amr; eg: audio/aac)
bool amrflag = false;
if (actualMajorType==NAudio.MediaFoundation.AudioSubtypes.MFAudioFormat_AMR)
if (channels <= 1) channels = 2;
if (channels <= 44100) sampleRate = 44100;
amrflag= true;

So after a bit more pondering, I’ve been thinking about the fact that there MUST be metadata that determines the number of channels in any given shoutcast stream.  I was working on integrating a stream player that was built in flash because it can handle most stream formats given a little work (not done by me, like ffmp3 or what-ever its called), but really I have to do some looking into weather or not the metadata is provided, but the only clue pointing that this might be true is beneath header data from a particular http-response-header that I just don’t feel like writing due to priority, and brain-storming hasn’t hurt too much as of yet.

Looks like that PHP link might be of help.  But no, I think there will be no num-channel data in the metadata.

Distribution of Multiple Tables per View


written: 20130204 1111 CST, posted publicly 20131105, hacked a little, posted…  Though I didn’t finish writing and editing this, I applied a solution to my little generator project.  The answer to the problem I’d found is in iterating through the tables in the view and transforming the content in the table-field’s dictionaries before generating the requested template.  (this is just some residual logging while I was on the task of writing this update into the app)



There was some interesting dialog that popped in to my head that went something as follows:

“NO!  A view should be generated the same way as the table-element!”
“The view should be treated as a table, and be SIMPLE”.

That would pretty-much be the moment that the Dictionaries popped in to my head as I realized that I could transform the content that was all-ready provided to the table and field elements in the generator.

The only trick to this is that I simply haven’t looked at how the dictionary’s are referenced within the template-to-code generator.  But that’s what I’m about to do, and no little blog entry is going to slow (my much needed) progress down.

Continue reading