This was an old proof that was up on my old blog, but since I’m no longer posting to that, I’m reposting it here for posterity. Also, rewriting the equations in LaTeX, now that I have installed a plugin for that.
I present a simple mathematical device to prove that tests improve our understanding of code. It does not really matter if this is code written by the test author himself or is legacy. To do this, some simplification of the situation is necessary.
Continue reading Tests increase our Knowledge of a System: A Probabilistic Proof
(Click the image to see the evolution of the SOM)
The image above was generated off 200 samples of a large data set. Sample vectors were 56-dimensional bit strings. The similarity measure used was the Hamming Distance. Brighter green represents values at a higher Hamming Distance with respect to zero.
The (very dirty) code is up at Github here.
Unrelated: I’ve been watching Leonard Susskind’s lectures on Statistical Mechanics; they’re a tour de force.
I’ve been working on something unusual lately, namely, building a pipeline for encoding video files into formats suitable for HTTP Live Streaming. The actual job of encoding into different formats at different bit rates and resolutions is done using a combination of ffmpeg and x264. To me, the interesting part lies in how we have tried to speed up the process, using the venerable Map-Reduce approach. Before I dive into the details, here’s a quick review of the basic idea of HLS.
Put very simply, adaptive streaming serves video content in multiple qualities, allowing the streaming client choice in selecting which quality to use depending upon the bandwidth constraint on the consumer side. This choice is not a one-time choice, depending upon the encode cut duration, the client can switch to higher or lower resolutions dynamically throughout the entire playback of the video stream.
How is this accomplished?
Continue reading A pipeline for adaptive bitrate video encoding
Stuff I’m reading now specific to filesystems…reading Linux kernel source requires a stout heart if you’ve never done it before. And a bit of a shift in mindset: it’s not all objects anymore 🙂
The Second Extended File System
A Commentary on the Sixth Edition Unix Operating System with source
A guide to writing a simplified file system (Linux 2.4v kernel)
I’ve already talked about the Content Cursor pattern. This post is an extension of that idea to increase the flexibility of layout across sections.
To understand the problem, let us revisit a page from our hypothetical iPad magazine.
Here’s the layout of the page in portrait mode.
…and here is the same page in landscape mode.
The first important thing to notice here is that the two Politics sections have changed in position and/or size. More specifically, the upper Politics section has morphed into a tall rectangle, while the lower one has stretched horizontally.
Continue reading iOS AppDev Patterns: Linked Content Cursors
iOS offers only the most barebones approach to placing content in a view, namely by specifying absolute coordinates. Of course, one can use autoresizing to make sure the positions of these contents are modified proportionally, but the initial positioning of a content block needs specification of the exact x- and y-coordinate of the top left of this ‘box’. This can render the layout inflexible, tedious and brittle. Every small change in position of a block has ripple effects on the position of succeeding blocks.
Content Cursor solves this problem.
Continue reading iOS AppDev Patterns: Content Cursor
In a content-heavy application (a news or a magazine app for example), textual content takes precedence over images in terms of loading/rendering. An acceptable solution is to load/render text and request images from the server/cache in a concurrent fashion. I use the term ‘server’ in a very loose fashion, a more appropriate term is probably ‘content source’, since we can retrieve this information from anything ranging from our own servers to Twitter/RSS feeds.
There are a few considerations when implementing a solution like this:
Load request throttling: You’re likely to have several images spread across pages. It is not prudent to let 50 concurrent requests fire for 50 images. You want to throttle your requests to a reasonable number. A simple example of throttling your request is shown later.
Memory management: You want to gracefully handle the situation in which the loader is able to retrieve the image, but it the frame on which it is supposed to display the image (however it is implemented) has already been deallocated (for whatever reason).
Continue reading iOS AppDev Patterns: Asynchronous Image Loader
I was working through The Artist’s Complete Guide to Facial Expression by Gary Faigin. Pretty thorough book, and the facial landmarks for different expressions are well detailed. Except that I was still having problems inventing expressions. I mean, yeah, expressions can vary a lot, but I think what I was looking for was a system using which one could ‘generate’ expressions on demand, without having to copy from something.
The problem I see with copying is that I’d end up copying the facial characteristics of the subject I’m copying as well, which hardly bodes well for the (imaginary) face I’ve cooked up. And yes, it wouldn’t affect my drawing that much, but I was still unsatisfied with that idea.
This afternoon, an idea struck me: what if I used the same system I use to generate poses to generate expressions? If you really think about it, the face is just a bunch of muscles with fat over them with the layering of skin. If I could figure out the forms at the appropriate resolution, these forms could be blobs which could be displaced/deformed at will to generate expressions. Boundaries of jostling blobs basically become potential creases and wrinkles. Blobs which get squeezed on all sides by other forms bulge out.
The idea seems to be working.
Continue reading Facial Expressions as Volumetric Deformation and Displacements
It’s not easy imagining them. But it can get better with practice. And that’s what I’ve been doing. An excellent accompanying read is Force : Dynamic Life Drawing for Animators. It’s one of those books that’s perfect for kicking you out of a rut, inspiring you to loosen your strokes. It’s worth several rereads; I’ve only skimmed through some parts of it, and they are immediately useful.
Continue reading Inventing poses