<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Carlos Fernandez Sanz on Medium]]></title>
        <description><![CDATA[Stories by Carlos Fernandez Sanz on Medium]]></description>
        <link>https://medium.com/@carlosfernandezsanz?source=rss-5ef5954afb57------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Stories by Carlos Fernandez Sanz on Medium</title>
            <link>https://medium.com/@carlosfernandezsanz?source=rss-5ef5954afb57------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 02:37:32 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@carlosfernandezsanz/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[A weekend with Claude on a personal side project]]></title>
            <link>https://medium.com/@carlosfernandezsanz/a-weekend-with-claude-on-a-personal-side-project-3ebfefd33bd1?source=rss-5ef5954afb57------2</link>
            <guid isPermaLink="false">https://medium.com/p/3ebfefd33bd1</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[vibe-coding]]></category>
            <category><![CDATA[claude-code]]></category>
            <category><![CDATA[debugging]]></category>
            <category><![CDATA[coding]]></category>
            <dc:creator><![CDATA[Carlos Fernandez Sanz]]></dc:creator>
            <pubDate>Fri, 19 Dec 2025 09:42:24 GMT</pubDate>
            <atom:updated>2025-12-19T09:42:49.755Z</atom:updated>
            <content:encoded><![CDATA[<p>After several weeks of Claude Code becoming my most important tool, by far, at Meta, I decided to try it on a personal project over a weekend to see how it changes my flow, my productivity, and how much it costs to actually use it without paying attention to quotas, i.e. paying whatever it costs, like we do at Meta.</p><h3>BACKGROUND</h3><p>A bit of background on the project: A long time ago, around 2009, I started a small niche project called<a href="https://github.com/CCExtractor/ccextractor"> CCExtractor</a>, a tool to extract the closed captions from US TV broadcasts to subtitle files (.srt). Back then it was all network TV and the way to watch American TV outside the US was either to wait a long time until some local TV station happened to buy the rights and air whatever show you wanted to watch, or, well, pirate it. The pirated version didn’t come with subtitles of any kind, so you had to wait a few more days for some hero to actually _type_ the subtitles and manually create the subtitles.</p><p>My goal was to make it possible for whoever was making those recordings in the US to process them with a tool that generated those subtitle files automatically, with the hopes that someone actually used it and was generous enough to share them.</p><p>The tool itself is very niche; not a lot of direct users; however, its output was used by millions, downloading subtitles from very popular subtitle websites. Subtitles were then available minutes after the video was uploaded to the usual places.</p><p>Anyone who has worked with video files knows that it’s an extremely complicated ecosystem; there’s many container formats (MPEG transport streams, program streams, MP4, Matroska), different subtitles (CEA-608 for analog American TV, then CEA-708 for Digital American TV, teletext for Analog European TV, DVB for Digital European TV, and other countries have their own variants). And of course, with many protocols and specifications come various implementations and interpretations of those standards.</p><p>My small program was very targeted: American TV. And it worked very well for my intended usage. However it did gain some traction within the TV industry (on top of the mentioned “hobbyist” world) and I got a few contracts to add support for the rest of the subtitle/video standards ecosystem. And I was overflowed by the strangest of recordings from many places that my program couldn’t at all support.</p><p>Some of them have lived as open GitHub issues for literally over 10 years.</p><p>The oldest one, a<a href="https://github.com/CCExtractor/ccextractor/issues/224"> Chinese recording</a> from 2015. I could never personally tackle it. I don’t speak Chinese and I don’t understand the signs to begin with, for this specific sample there was no monetary reward. Consequently, it has been sitting there for over a decade, waiting for a hero that never came.</p><h3>Claude</h3><p>So late Friday, I decided to give the issue to Claude. I pretty much gave it a link to the issue and a checkout of master. By the way, I hadn’t touched CCExtractor myself in several years, but there’s a certain community around it, and I wasn’t familiar with a lot of the current code.</p><p>I already knew that Claude is really good at understanding code bases quickly; I see it at Meta every day.</p><p>What I didn’t know is the vast knowledge it has around everything else needed to solve the problem. Some things it knows about:</p><ul><li>MPEG specifications. Yes, they are public, but as most standards of this level they’re thick documents in which every detail matters a lot, and you need to know them inside out. Took Claude seconds to start talking about PTS, DTS (those are different timestamps, one for presentation and one for decoding), PMT / PAT (tables that link packets to streams and streams to programs), etc. Not only it understood the concepts, it knew about the typical gotchas.</li><li>Subtitle specifications. All of them, apparently.</li><li>Popular libraries for image manipulation — Leptonica, to rotate, scale and do other operations.</li><li>OCR libraries, tesseract.</li></ul><p>Chinese, as other languages, is transmitted on TV as bitmaps, not UTF-8 or anything else for which you could just get a text presentation. That means that if you want it on a text file, you need to somehow OCR it yourself. And there’s colors there, different sizes, etc. That means that on top of getting the bitmap from the video stream, you need to do whatever transformation is needed to provide the best possible image to the OCR library. And try to find a good combination that works well for every TV standard that uses bitmaps for subtitles!</p><p>Claude wowed me several times; one of them was when it decided to just look at the bitmap itself; it just exported the image to PNG, somehow OCR’ed it by itself (not using my code!) and it was able to compare the existing output to the ground truth. And then from there, experiment on its own different variants of transformations and OCR settings until it<a href="https://github.com/CCExtractor/ccextractor/pull/1826"> got it perfect</a>.</p><p>Another one was its mastery of debuggers — It compiled CCExtractor with debug symbols by itself, analyzed the stack trace, figured out the problem and just fixed whatever it was. I wish I had kept all the sessions. Some were master classes in how to efficiently troubleshoot low level problems.</p><p>I also learned about several tools I didn’t know existed for different kinds of analysis. It made me install around 10 new Debian packages.</p><p>In the process, it fixed I don’t know how many C errors; turns out I wasn’t as good as I thought writing safe C. Or the rest of the people working on CCExtractor in the past 15 years.</p><p>After that success story, I was addicted and had Claude do:</p><ul><li>Complete audit of the code, submitting PRs to fix every problem with memory leaks, potential buffer overruns, out of bounds access (this is very common when dealing with streams and bitmaps, the input is not always compliant).</li><li>Analyze each pending pull request, testing it and providing an assessment, merging the ones that were correct and sending feedback and requesting changes to the ones that weren’t.</li><li>Fix known timing issues (where the subtitles weren’t perfectly in sync), in a few video samples.</li><li>Tackle another 5 open issues that were more or less picked at random.</li></ul><p>All in all, work that would have taken months -if ever tackled, and I wasn’t going to do it myself-, took a weekend.</p><p>I didn’t write a single line of code, but I did have to steer Claude in the right direction several times, and of course context is a thing so I had to plan very carefully so each problem was split in small stages that we could resume easily after a /clear.</p><h3>The cost</h3><p>I had the Pro plan of Claude; that’s $20 per month, which comes with a quota per month, per week, per day and per 5 hours period, or something silly like that. Good for very casual use but I wasn’t going to work 10–15 minutes each 5 hours; so I added funds to the wallet, and set it to unlimited usage. Most of the time I would see “Now using extended usage” on the bottom right.</p><p>On top of the monthly subscription, I paid $370 over the weekend.</p><h3>Final thoughts</h3><p>If a client had contracted me to do all of this, the cost would have been maybe 30x and it wouldn’t have taken one weekend.</p><p>We’re clearly in a new era in which coding or debugging are no longer bottlenecks; for now planning is, and domain knowledge — but not at the bit level. And good ideas. I personally have a list of projects I wanted to do when I had time; of course it’s an ever growing list. It feels like with Claude, I could actually run out!</p><p>We’ll need to learn how to organize and prioritize work, keep track of all the ideas, prototypes, and code that we’ve never seen except in cursory reviews.</p><p>Our users are also changing; often the user of whatever we work on is not going to be a human, it’s going to be AI. As I go over the plans for H1 2026, I keep thinking if I’m looking at it all wrong, trying to make life easier for developers that have fingers. Engineers that manually use git, repo, that get personally paged if there’s a problem.</p><p>I of course also worry about how many of us will be needed soon; diff reviews are getting better and better. Claude writes great code. We no longer make fun of DevMate [this is Meta’s fantastic VSCode integration with the AI backend] and its hallucinations.</p><p>At the same time, work is much more exciting and fun (at least to me). I don’t know how long it will last — I hope a lot, because this new world feels like the beginning of commercial internet. The Wild West. Opportunities for all.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3ebfefd33bd1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Flutter project for Google Summer of Code 2022: A TaskWarrior mobile app]]></title>
            <link>https://medium.com/@carlosfernandezsanz/flutter-project-for-google-summer-of-code-2022-a-taskwarrior-mobile-app-274a860683ce?source=rss-5ef5954afb57------2</link>
            <guid isPermaLink="false">https://medium.com/p/274a860683ce</guid>
            <category><![CDATA[google-summer-of-code]]></category>
            <category><![CDATA[flutter]]></category>
            <dc:creator><![CDATA[Carlos Fernandez Sanz]]></dc:creator>
            <pubDate>Wed, 05 Jan 2022 08:12:59 GMT</pubDate>
            <atom:updated>2022-01-05T08:12:59.583Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://taskwarrior.org/">TaskWarrior</a> is a very nice command-line tool (yes, in 2022 — and I love it!) to manage task list.</p><p>It lets you keep your to-do locally but there’s also server support so you can sync between different computers, you can build scripts around it (since it’s command line based), it has a powerful filtering system, and more.</p><p>The one thing that it’s missing is a really good mobile app (there’s something, but it’s not really great, and it seems unmaintained).</p><p>So let’s fix that and leverage flutter to build a great interface for everybody.</p><p>How would a great TaskWarrior mobile app look like? Well, since it’s mobile, most likely the phone is not the primary or only device in which we will be using TaskWarrior, so <a href="https://taskwarrior.org/docs/taskserver/why.html">TaskServer</a> support is essential. You don’t need to roll out your own (unless you want to). I use <a href="https://freecinc.com/">this one</a> (which is free).</p><p>On top of that, we’d expect to be able to</p><ul><li>Add/edit/delete new tasks (of course) — Check the “<a href="https://taskwarrior.org/docs/best-practices.html">best practices</a>” for what a task needs to have.</li><li>Mark as started / completed / etc</li><li>List existing tasks with <a href="https://taskwarrior.org/docs/filter.html">filters</a></li><li>Move tasks between projects</li><li><a href="https://taskwarrior.org/docs/report.html">Reports</a></li></ul><p>Because each person has his/her own workflow whoever tackles this project should be familiar with TaskWarrior before actually starting to work on it. It takes just a few minutes to install and configure, and a couple of days to actually love it if you use it :-)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=274a860683ce" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CCExtractor project for 2022: Writing a subtitle quality quantification tool]]></title>
            <link>https://medium.com/@carlosfernandezsanz/ccextractor-project-for-2022-writing-a-subtitle-quality-quantification-tool-4d6345e3640b?source=rss-5ef5954afb57------2</link>
            <guid isPermaLink="false">https://medium.com/p/4d6345e3640b</guid>
            <category><![CDATA[subtitles]]></category>
            <category><![CDATA[closed-captioning]]></category>
            <category><![CDATA[closed-captions]]></category>
            <dc:creator><![CDATA[Carlos Fernandez Sanz]]></dc:creator>
            <pubDate>Thu, 04 Nov 2021 18:46:31 GMT</pubDate>
            <atom:updated>2021-11-04T18:46:31.058Z</atom:updated>
            <content:encoded><![CDATA[<p>Following an interesting conversation I had with someone from Netflix, I’ve been thinking for a bit about one specific project that’s really interesting to me (interested in subtitles and accessibility as I am): A subtitle quality quantification tool.</p><p>While for video quality there’s <a href="https://github.com/Netflix/vmaf">VMAF</a>, <a href="https://en.wikipedia.org/wiki/Peak_signal-to-noise_ratio">PSNR</a> and more, audio has <a href="https://en.wikipedia.org/wiki/Perceptual_Evaluation_of_Audio_Quality">PEAQ</a>, there’s nothing that I know of that does the same thing for subtitles. In fact, how would such a tool look like? What does it take into consideration, how do you make all of it automatic…?</p><p>A few things are more or less clear; in fact the fan scene and different sites even have some rules that you have to follow:</p><ul><li>Max number of characters per line</li><li>Characters per second</li><li>Number or lines in screen</li><li>Minimum amount of time a subtitle frame is visible</li></ul><p>That’s mostly very low hanging fruit. What else can we do? I can think of many things, but these are the ones that I would say instantly break a good subtitle experience if they are not correct:</p><ul><li>Positioning. Subtitles should never be on top of anything important. For example, subtitles over rolling text (this happens all the time with news) is a no go.</li><li>Good selection of foreground and background colors relative to what they are appearing on top of.</li><li>Sync with audio, of course. There’s really no excuse anymore. A specific offender is Last Week Tonight with John Oliver which is taped and uses the same subtitles as live news (that don’t have a decent workflow).</li><li>Coloring between different speakers. Yes, a tricky one. Not so easy to do, at least automatically, but there’s been some work by our friends at Red Hen.</li><li>Multiple language support. All languages are important. If users are watching, say, a French movie with English subtitles on and there’s a short part in English, it needs to be subtitled too! And we’re while at it — the language of each sentence should be annotated as well (which would allow for very interesting cases).</li><li>Music lyrics. When possible, music needs to be subtitled. It sets the mood! For a deaf person just the name of the song is not going to be enough.</li><li>Integration between burned-in and closed captions. A good example is The Americans. When they talk in Russian there’s burned-in subtitles in English. Why this assumption?</li><li>No missing words. A serious offender is Netflix. YouTube, too. Seriously, don’t do that. If the characters curse, they curse. Don’t remove that. Don’t change the rating of content.</li><li>Translation quality. This is a tough one for which I don’t have a good way to come with an objective score. I’m definitely interested in ideas.</li><li>Correct representation of the native charset. In Europe, DVB allows bitmaps, which gives some flexibility (at a price). Other systems are more limited.</li><li>Usage of case rules.</li></ul><p>So what’s the plan here? My idea is to work on this on the context of Google Summer of Code 2022, which today seems far away but it’s really just around the corner when you consider all the preparation it takes.</p><p>Interested students, get in touch.</p><p>Notes:</p><ul><li>Since it’s a new project, we’re flexible with the language, but because we need it to be fast and we’ll need to decode video and audio I’d expect integration with FFmpeg or GStreamer will be necessary. This already points to C/C++ or Rust.</li><li>I intend to be one of the mentors.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4d6345e3640b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Generating videos of algorithms implementations with Python]]></title>
            <link>https://medium.com/@carlosfernandezsanz/generating-videos-of-algorithms-implementations-with-python-3422c4dd04f0?source=rss-5ef5954afb57------2</link>
            <guid isPermaLink="false">https://medium.com/p/3422c4dd04f0</guid>
            <category><![CDATA[google-code-in]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[programming-languages]]></category>
            <category><![CDATA[algorithms]]></category>
            <dc:creator><![CDATA[Carlos Fernandez Sanz]]></dc:creator>
            <pubDate>Fri, 24 Jan 2020 14:20:27 GMT</pubDate>
            <atom:updated>2020-01-29T17:52:37.422Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>The problem</strong></h3><p>Last year I spent many hours refreshing my algorithms — it’s been a while since I studied the fundamentals and you absolutely need them fresh for job interviews in Silicon Valley, and also for the fun of competitive programming.</p><p>There are many websites in which you can learn, practice and compete. Possibly the one that everyone uses, exclusively or not is <a href="https://leetcode.com/">leetcode</a>, which runs a weekly competition that is full of rock stars that deliver brilliant solutions. And you get to see the solutions from the best of best!</p><p>For the easy questions the solution is usually easy to understand. For the hard ones, it might seem like black magic, and following the code requires spending time with a debugger, running the code many times, with different samples, until the logic “sinks in”. And this can become tedious.</p><p>So I had the idea of writing a program that could execute Python code line by line, document the change in variable values, maybe even the relationship between variables (such as i is a pointer in arr), and create a video in mp4 and/or gif that can be saved, uploaded, or embedded anywhere.</p><p>That idea has been on my ever growing backlog of pet projects for months.</p><p>And now there’s several alternative implementations. How?</p><h3><strong>The implementations</strong></h3><p>One of the things I always find time to do every year, however busy I might be, is participate in the fantastic <a href="https://codein.withgoogle.com/">Google Code-In</a> — it’s a program that Google sponsors that helps high-schoolers from around the world get started with programming in general, and more specifically, open source.</p><p>Many of the students are indeed starting out, but there’s also a bunch of kids that are already far, at least relatively speaking, in the learning curve. And they have the motivation and stamina to prove it!</p><p>We (that means <a href="https://ccextractor.org/">my organization</a>’s team, but that’s for a different post) came up with a number of ideas for the students to work on. One of them is this “algorithm video creator”. While the final goal was clear, we had to split it in several “bite sized” tasks that individually wouldn’t take more than one evening or so. Also a requirement is that they are reasonably approachable by the students, even if as you would expect each task was a bit harder than the one before it in the series.</p><p>In total, this series had 12 different tasks. 22 students completed the first task in the series, and only one made it to the 12th. However, the program was considered “usable and actually useful” from task 7, which was completed by six students.</p><p>Five of the projects have been integrated into <a href="https://github.com/CCExtractor">our organization’s GitHub</a>. Of course the students retain whatever rights exist and they are the administrators of each of their respective projects. Because the programs are actually very useful, at least for the use case that we had in mind, we expect them to actually grow as open source projects. We will see which implementation becomes more successful, or maybe they will merge at some point.</p><p>Here are the projects, in no special order, of course with the official sample video for each of them. All of them are hosted in GitHub.</p><p><a href="https://github.com/CCExtractor/vardbg"><strong>vardbg by kdrag0n</strong></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qLSL98VFcX5Jf4ESIeE2Xg.gif" /><figcaption>vardbg</figcaption></figure><p><a href="https://github.com/CCExtractor/TDebugger"><strong>TDebugger, by Techno-Disaster</strong></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*nP5Q7BuYZh5AgJ3r.gif" /><figcaption>TDebugger</figcaption></figure><p><a href="https://github.com/CCExtractor/PyBud"><strong>PyBud, by Tantan4321</strong></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*b2p5a0RuGb3ASe68.gif" /><figcaption>PyBud</figcaption></figure><p><a href="https://github.com/CCExtractor/cimico"><strong>Cimico, by knightron0</strong></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/0*ucpElz8GLzNLJZds.gif" /><figcaption>Cimico</figcaption></figure><p><a href="https://github.com/CCExtractor/AZTinyDebug"><strong>TinyDebug by mfarberbrodsky</strong></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*gOyVN-ZOkkPTQ-hW.gif" /><figcaption>TinyDebug</figcaption></figure><h3><strong>The task descriptions</strong></h3><p>As mentioned, all these projects were completed during the course of Google Code-In, which ran from Dec 2, 2019 to Jan 23, 2020.</p><p>For those interested, here’s the descriptions for each of the tasks:</p><p><strong>Task 1</strong></p><p>One of the (many) cool things about Python is that it can debug itself! Yes, you can write a Python program that debugs a Python program.</p><p>You can read about this here:</p><p><a href="https://www.freecodecamp.org/news/hacking-together-a-simple-graphical-python-debugger-efe7e6b1f9a8/">https://www.freecodecamp.org/news/hacking-together-a-simple-graphical-python-debugger-efe7e6b1f9a8/</a></p><p><a href="https://docs.python.org/3/library/inspect.html">https://docs.python.org/3/library/inspect.html</a></p><p><a href="https://python-hunter.readthedocs.io/en/latest/cookbook.html">https://python-hunter.readthedocs.io/en/latest/cookbook.html</a></p><p>Your job is to write a python program that runs a python function and for each line that is executed writes to the console what variables have changed and from what values to what values. For example</p><p>Line 13: ‘x’ changed from 2 to 3</p><p>You don’t need to add breakpoints or anything fancy. For now, it’s just about understanding the program flow.</p><p><strong>Task 2</strong></p><p>We have had a few good submissions to the previous Python debugger task.</p><p>They work well, but they have a problem: When just part of a variable is changed, they report the whole variable as having changed. Let’s extend this a bit and make it smarter by adding this constraint:</p><p>For arrays, lists, etc, when there’s a change, you need to report which element(s) have changed.</p><p><strong>Task 3</strong></p><p>Extend your debugger so that after completing it lists:</p><ul><li>All the variables, their type, and where they were instantiated (function name, line number)</li><li>For each variable, the range of values (if it’s a number), list of values (if it’s for example a string, or something in which a range doesn’t make a lot of sense), and where (in code) it took each value.</li></ul><p><strong>Task 4</strong></p><p>While the program is running: Add the following functionality to your debugger:</p><ul><li>Print the number of times each line has been executed so far</li><li>Print the time spent in each line, both average and aggregated so far</li></ul><p>After the program ends, write a report that includes</p><p>a) All created variables and where, as well as the ranges and type, and the initial and final value.</p><p>b) Total program execution time.</p><p>c) The number of times each line has been executed</p><p><strong>Task 5</strong></p><p>Extend your debugger to add this functionality:</p><ul><li>If a program name is passed as a argument (path to a .py file) load that file and, by default, debug its main function. If that’s not possible, default to a different one.</li><li>Allow passing a different starting function name.</li><li>Write the output to a .text file. A suggestion here is that the .text file contains a json string per line, but you could use a different format. That json file needs to contain the same info you are currently printing to console, plus a “step” number (which is just incrementing starting at 1) and a timestamp for each step.</li><li>If instead of a program name the argument passed is a .json file, then read that json file (which was of course generated by your own program) and write its output to screen, in human readable form.</li></ul><p>As you can see, what we are doing here is separate the work in two phases: Analysis and reporting. The reporting should just need the json file, but not the source code of the program being debugged.</p><p><strong>Task 6</strong></p><p>Let’s create a test suite for your program. This test suite will execute a number of well known algorithms. From the output of the program and without access to the source code, a reader (human) should be able to tell what the algorithm is doing.</p><p>For example, if the algorithm is a quick sort, then by following the output of your program and how the variable change as it runs, it should be obvious to tell that it’s sorting the input.</p><p>You don’t need to implement the algorithms yourself — it’s fine to use existing code since what you are writing is the debugger.</p><p>Create a test suite that generates the output for these well know problems:</p><p>Sorting: <a href="https://www.tutorialspoint.com/python_data_structure/python_sorting_algorithms.htm">https://www.tutorialspoint.com/python_data_structure/python_sorting_algorithms.htm</a> (all algorithms there)</p><p>Binary search</p><p>Depth first search</p><p>Breadth first search</p><p>Knapsack problem</p><p><strong>Task 7</strong></p><p>On the last task we were able to generate a .json file that describes the program flow — the steps, and what happens at each step.</p><p>We’re going to use this .json file (and the source code) to generate a video file that shows the program as it runs.</p><p>This is your job:</p><ul><li>Add a option -video to your debugger that takes the source code of the program being debugger, the .json file from the program execution and generates a video file that shows the program flow.</li></ul><p>The video must contain two parts: To the left, display the source code, with the line just executed in a different color. Also display the number of times that line has been executed and the time spent on it so far.</p><p>To the right, the variables: Display in the different color the last modified variable as well as the current and previous values.</p><p>For the video generation itself you can use any library. You may need to use two libraries actually, one to compose each frame (this would be a graphics library that gives you a canvas and lets you add text to it) and another for the video, for example a .mp4 library. But it’s really up to you to come up with a good solution.</p><p>As always, upload to github and send us a link to the repo.</p><p><strong>Task 8</strong></p><p>We left chapter 7 after creating a video. We’re going to improve it by make videos a bit more customizable by the end user. We thought about different ways to do it and we are leaning towards some kind of style sheet (not as in CSS, but similar concept). We suggest yaml but you can come up with something different or better if you think of something. When creating the video, IF that file exists (otherwise just do default) apply it to the output. That file should the user specify:</p><ul><li>Running speed</li><li>Font to use</li><li>Font size</li><li>Intro text, which if present would be displayed for a few (configurable) seconds before starting to run the program. For example, maybe the user wants to write “Quicksort implementation for CS exam, by Joe Developer”.</li><li>By default, write in small letters in each frame (when the program is running), maybe on the bottom right, “Generated with $program_name”. But allow the user to disable this since probably it will become annoying after a while. For now, we want to have this so there’s a few videos around and make the program a bit popular.</li></ul><p><strong>Task 9</strong></p><p>Add the following features to your program:</p><ul><li>Allow passing of arguments to the program to be debugged, for example if I have a program called “fibonacci.py” that prints to screen the fibonacci series up to a passed number, then I should be able to pass that number via your debugger.</li><li>Work well with source code that doesn’t fit on the screen, which implies that may need to add scrolling (smooth, if you can), which is not supereasy to do if you want to do it well.</li><li>In the video, have an area for the actual output of the program — if the program uses print(), its output should also appear on the video. After all, in a regular debugger, you expect to see the output of the program being debugged.</li><li>Allow exporting to animated gif — this will make the video easy to embbed.</li><li>Allow selecting output resolution.</li></ul><p><strong>Task 10</strong></p><p>Add (in the style sheet file, or whatever you are calling it) a way to specify different ways to display specific variables. For example, given this simple example:</p><p>my_list = [1, 3, 5, 7, 9] for i in range (len (my_list)): print my_list[i]</p><p>Clearly i is a pointer into my_list, yet there is no way to tell that from the source code. Come up with a good way to describe that relationship in the style sheet (also: come up with a better name for it) and a way to graphically display it in the video.</p><p>A possible idea is to allow pointer variables to be graphically below the element in the array they are pointing to.</p><p>Also, add an option to mute specific variables (don’t display them at all).</p><p>Following tasks will ask you to add more ways to represent variables in ways that are useful for well known data structures. Keep that in mind when coming up with your architecture!</p><p><strong>Task 11</strong></p><p>Write a README.md with instructions. Make sure it contains (of course) sample videos. Make sure it mentions GCI 2019 and CCExtractor. Even if this is not a coding task and you’ll probably find it boring, take it seriously — good documentation and an attractive introduction to it can make or break the popularity of software!</p><p><strong>Task 12</strong></p><p>We’re going to add support to a few super typical data structures — as well as we can (this is not really easy). Let’s see how far we can get.</p><ul><li>Binary trees: <a href="https://www.tutorialspoint.com/python_data_structure/python_binary_tree.htm">https://www.tutorialspoint.com/python_data_structure/python_binary_tree.htm</a></li></ul><p>As you can see, they are quite simple — basically they have a left node, a right node, and a value, for each for the nodes. Typically you always keep a reference to the root node so you can traverse the tree.</p><p>Your job is to allow your system to draw the tree either from the root node or from the node a variable currently contains.</p><h3><strong>After GCI</strong></h3><p>Sadly, GCI is over — so now it’s time for these amazing small programs to take off on their own.</p><p>We are really proud of the students that chose to participate with us and take on this series of tasks. Two of them will win a trip to California to visit Google. They really deserve it for the effort and the passion they demonstrated during these six weeks.</p><p>We can’t wait to see what they do next.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3422c4dd04f0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Real time commercial detection on TV]]></title>
            <link>https://medium.com/@carlosfernandezsanz/real-time-commercial-detection-on-tv-db1f9ff4e746?source=rss-5ef5954afb57------2</link>
            <guid isPermaLink="false">https://medium.com/p/db1f9ff4e746</guid>
            <category><![CDATA[video-processing]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[ffmpeg]]></category>
            <dc:creator><![CDATA[Carlos Fernandez Sanz]]></dc:creator>
            <pubDate>Mon, 13 May 2019 16:39:41 GMT</pubDate>
            <atom:updated>2019-05-13T16:39:41.772Z</atom:updated>
            <content:encoded><![CDATA[<p>One of the many cool projects that I got to work at <a href="https://www.tvguide.co.uk/">yo.tv</a> was a real time commercial detection system. Not the detection of when a commercial block starts or ends, but the specific commercial on the air.</p><p>This is useful for a number of things, from accountability (say, you’re the company paying for the commercials and you want to make sure they air), to counter-advertising (for example, when your competitor’s commercial is on the air do something).</p><p>Yo.tv’s super popular (in the UK) <a href="https://itunes.apple.com/gb/app/tvguide.co.uk-tv-guide/id317212648?mt=8&amp;at=10lNru">mobile</a> <a href="https://play.google.com/store/apps/details?id=com.acrossair.tvguideuk&amp;hl=en_GB">apps</a> let you watch TV on your devices, all integrated in the TV guide, which is really convenient when you’re on the go. Of course you can also watch TV using each channel independent app, but when you’re just surfing being able to switch to almost any channel is a lot better than jumping from app to app.</p><p>A great thing about users watching TV in your app is that when there’s commercials breaks in the content you can interact with the users without interrupting what they were watching — after all, those interruptions are totally counterproductive and just makes you user hate you, your app, and anything you are trying to advertise to them.</p><p>Note that our apps don’t piggyback on anyone’s streams or infrastructure. Instead, we have our own setup that takes the actual content from TV (using physical TV tuners), encodes the streams and sends them to the cloud for the devices to consume. This means that the content goes through our infrastructure a couple seconds before reaching the end user. A fantastic opportunity to do things with them, for example enrich the commercials by giving the users an extra discount if they interact with the app while the commercial is running.</p><p>The physical architecture looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/929/1*6inb37ragXmBnbNhOBLM2g.png" /></figure><p>The on-prem servers, which are off-the-shelf <a href="https://www.intel.com/content/www/us/en/products/boards-kits/nuc/mini-pcs.html">intel NUCs</a> running Linux, receive the streams and get them ready for the next stage. They also analyze them to detect which commercials are being aired. How is this done? We do it in two ways: With audio finger printing and with subtitles analysis.</p><p>One of the, to me, most impressive applications of all time is <a href="https://www.shazam.com/">Shazam</a>, which seemed magical at the time. Shazam released a <a href="https://www.ee.columbia.edu/~dpwe/papers/Wang03-shazam.pdf">white paper</a> explaining their algorithm (a really generous contribution to computer science, by the way) and a number of implementations appeared. One of them was <a href="https://github.com/worldveil/dejavu">Will Drevo’s Deja Vu</a>, which does all the heavy lifting for the identification itself.</p><p>On top of that, <a href="http://www.redhenlab.org/">Red Hen Lab</a> (a consortium of universities running a big data laboratory) and <a href="https://ccextractor.org/">CCExtractor Development</a> <a href="http://vasanthkalingeri.github.io/CommercialDetection/">forked Deja Vu to add commercial detection</a> and we took that as starting point. However, this project works on files, and what we had is a stream (or well, one stream for each TV channel) that runs 24x7, not a prerecorded file. So this is one of the parts we had to add ourselves.</p><p>Internally, the process for each stream looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/721/1*wddGkB2r7jojLEYtsT7RSQ.png" /></figure><p>Almost everything is open source (the few things that aren’t are just utility scripts that are too specific for our setup and have no value to anyone else), and in fact we’ve contributed patches to all of them.</p><p><a href="https://github.com/sleinen/samplicator">Samplicator</a> is a simple but really useful and robust program that takes a UDP stream and generates a number of copies. This makes it really easy to process the same input to do several things simultaneously, such as get subtitles from it (which we do, with CCExtractor), audio and/or video (with FFmpeg) and so on. In fact we run several instances of both CCExtractor and FFmpeg, which is much much simpler (and reliable) than minimizing the number of instances of each at the expense of added complexity in, for example, FFmpeg’s filter graph.</p><h3><strong>The audio based pipeline</strong></h3><p>One of FFmpeg’s instances takes one of samplicator’s stream copies, and down converts the audio to mono and less bit rate, and passes it to Deja Vu. The video is discarded.</p><p>We extended Deja Vu to accept live input (the identification algorithm is the same) takes FFmpeg’s audio and find matches in our commercial database. When there’s a match it runs a script on our alert system.</p><p>Finally the alert system does some reporting stuff and notifies the client apps. For this we used <a href="https://pusher.com/">Pusher</a>. They provide an easy to use API that has served us well.</p><p>The fingerprinting itself is so fast and accurate that in general the apps get the notification of the commercial before the first frame starts displaying on the device. This has a great “wow factor”. Plus it gives us the most possible time to act during the commercial.</p><p>The commercial database that Deja Vu uses to match the audio from the live stream with the commercials we are interested on is maintained with a couple of simple support scripts and FFmpeg. FFmpeg can process any media file you throw at it, so we accept anything our customers sends us. Some times it’s a youtube link, some times it’s a .mp4, some times it’s something else. Since we’re only interested in the audio we export it to a mono .wav file:</p><pre>ffmpeg -i “$input_file” -ab 160k -ac 1 -ar 44100 -vn “${output_prefix}.wav”</pre><p>Then the .wav file is copied to a directory that contains all the .wav files and fingerprint it. Deja vu is clever enough to skip all preprocessed files so this is not as horrible as you might think.</p><pre>#!/usr/bin/python<br>from dejavu import Dejavu<br><br>config = {<br>	&quot;database&quot;: {<br>[database connection stuff]<br>     }<br>}<br>djv = Dejavu(config)<br>djv.fingerprint_directory(&quot;audio_clips&quot;, [&quot;.wav&quot;], 3)</pre><h3>The subtitle based pipeline</h3><p>You might be wondering why we also have a subtitle based pipeline, since audio fingerprinting works perfectly for commercials detection. The reason is that by using subtitles we’re able to do lots of heuristics — for example, we can record a short clip of each mention of something (such as a company name) on TV, generate sentiments reports, and even look for unauthorized use of clips in which the audio is replaced.</p><p>The subtitle pipeline also starts by processing one of the copies samplicator produces of the original stream from the TV tuner. In this case it’s CCExtractor doing all the work — it can handle everything that comes with subtitles from Europe (teletext or DVB), North America (CEA-608 and CEA-708) and many more. So if it’s subtitled, CCExtractor will provide an accurate transcript.</p><p>CCExtractor’s output is just a text transcript with time stamps. Processing it is trivial — you can just tail it and use regular expression parser to look for whatever you need, or archive all of it, etc. We do look for words and expressions on the transcript, do real time translation and more.</p><p>Our transcript database management system looks like this, if you’re curious:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NXVc8joD7YBYy_B4r2b-Hw.png" /></figure><p>Since we run the best TV guide there is we can easily use that data to index all the transcripts along all the program information.</p><h3><strong>Software</strong></h3><ul><li><a href="https://ffmpeg.org/">FFmpeg</a></li><li><a href="https://ccextractor.org/">CCExtractor</a></li><li><a href="https://github.com/sleinen/samplicator">Samplicator</a></li><li><a href="https://github.com/cfsmp3/CommercialDetection">Our modified Deja Vu</a> (warning: Not pleasant to the eye, quick hack)</li></ul><p>A number of support scripts, a monitoring system, billing, etc. This is not being released — just too specific to us.</p><h3><strong>Hardware</strong></h3><ul><li>TV Tuners: <a href="https://www.silicondust.com/">HDHomeRun from SiliconDust</a></li><li>Servers: <a href="https://www.amazon.com/NUC6CAYH-Quad-Core-Bluetooth-Support-Professional/dp/B07C837CDM/ref=sr_1_14?keywords=intel+nuc&amp;qid=1557528437&amp;s=gateway&amp;sr=8-14">Intel NUC</a></li></ul><h3><strong>Some numbers</strong></h3><p>Number of servers: 3 in UK, 7 in the US.</p><p>Number of channels: 12 in UK, 40 in the US.</p><p>Tuners: 7 in the UK (dual tuners, so one device for each two channels, plus one spare), 13 in the US (triple tuner).</p><p>Processed programs in 2018: Around 300,000</p><p>If you have an interest on TV, video processing, subtitles or interesting problems in general, feel free to reach out to me on <a href="https://www.linkedin.com/in/carlossubs/">linked-in</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=db1f9ff4e746" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Preparing for the  Google Cloud Architect certification exam]]></title>
            <link>https://medium.com/@carlosfernandezsanz/preparing-for-the-google-cloud-architect-certification-exam-f1b0cf87933b?source=rss-5ef5954afb57------2</link>
            <guid isPermaLink="false">https://medium.com/p/f1b0cf87933b</guid>
            <category><![CDATA[cloud-architecture]]></category>
            <category><![CDATA[certification-exam]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[certification-courses]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <dc:creator><![CDATA[Carlos Fernandez Sanz]]></dc:creator>
            <pubDate>Wed, 01 May 2019 15:47:11 GMT</pubDate>
            <atom:updated>2019-05-01T15:47:11.002Z</atom:updated>
            <content:encoded><![CDATA[<h3>Preparing for the Google Cloud Architect certification exam</h3><p>It’s done — and it’s really not so painful, but it does take some preparation. I’ve read in a lot of places that you are supposed to learn about GCP “on the job” and just use the certification exam to make knowledge official, but I don’t think that’s true — not by a long shot. Preparing for the exam will make you better at your job, and not preparing for the exam at all because you have a lot of on the job experience is just a recipe for failure.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/329/1*4NxhJEn8h16CK77S2158GA.png" /></figure><p>My background: I’m a software engineer that likes to play with a lot of toys, cloud platforms (plural) being some of those. I don’t consider myself an expert on cloud platforms — but I do have a high bar for expert level on anything. I do however know the different products that AWS and Google have on their platforms, even if I have just actually used a few of each. I strongly believe that once you know what products exists and what they do (and what they don’t) it’s not so important to know a lot of specifics. Those change after all, so you’ll never have a final picture of any platform.</p><p>In order to prepare for the exam, on top of my pre-existing knowledge of GCP and some of their products (such as Firebase, which itself doesn’t appear much in the exam, but it connects to other products and that experience proved to be really useful), I have:</p><ul><li>Completed the Coursera <a href="https://www.coursera.org/learn/preparing-cloud-professional-cloud-architect-exam">course</a> on preparation for the exam. Note that this course is starting to feel outdated.</li><li>Completed some, but not all, <a href="https://google.qwiklabs.com/home?qlcampaign=3e-next19-612">qwiklabs</a>.</li><li>Complete the <a href="https://app.pluralsight.com/library/courses/gcp-fundamentals/table-of-contents">Pluralsight</a> course on “Google Cloud Platform Fundamentals: Core Infrastructure”.</li><li>Read a few <a href="https://medium.com/@yesdeepakverma/how-i-cleared-all-3-google-cloud-certifications-in-3-weeks-f5591aa22572">articles</a> <a href="https://medium.com/@sathishvj/on-passing-all-google-cloud-certifications-54b2cc1e428c">about</a> <a href="https://medium.com/@sathishvj/notes-from-my-google-cloud-professional-cloud-architect-exam-bbc4299ac30">the</a> <a href="https://medium.com/@blasetta/google-cloud-certifications-study-and-pass-any-of-the-3-exams-f2b310364ebc">same</a> <a href="https://medium.com/@earlg3/google-cloud-architect-exam-study-materials-5ab327b62bc8">topic</a> <a href="https://medium.com/@bowtieadvice/gcp-certified-passing-the-gcp-professional-cloud-architect-exam-478596b2c8c4">from</a> people that took the exam before I did.</li><li>Attended a preparation bootcamp during CloudNext. About this: Save the money. It’s almost the same material as the Coursera course and you won’t even be able to ask questions that aren’t answered in the slides.</li><li>Completed the free test exam.</li><li>Collected as many exam questions as I could and prepared a flashcard deck (link at the end of this article) with over 200 questions and answers.</li></ul><p>About the exam questions to prepare my flashcard deck, some of the sources I used were sketchy, to say the least. Some come with an answer that is wrong. Some times, so wrong it seems like Google leaked those as a way to filter out cheaters and/or idiots.</p><p>Anyway, I got all those sketchy questions, the ones from Coursera, the ones from Pluralsight, and most importantly and useful a lot that I prepared myself with questions about everything that was required to understand the actual exam questions and I didn’t already know myself. For as many as I could I went over the documentation to actually validate the answers and get an understanding of why they were correct.</p><p>Some advice for those considering taking the exam</p><ul><li>Plain memorization is not going to work. Some of the questions I had do appear in the exam, but there seem to be some variations that change the answer. Also, some answers are going to be outdated really quickly, for example those that mention storage, RAM, cores and so on.</li><li>Many questions can be answered by reading the question and possible answers a few times. Some of the answers just say the opposite of the question, for example “A requirement is that the system never runs out of space and that the CPU usage is kept below 75%” and two of the answers are “a) Double the storage and replace the CPU” and “b) Set an alert if storage usage reaches 75%…”. You get the idea. Just read the question thoroughly and reject any answer that doesn’t meet the requirements exactly.</li></ul><p>The exam experience itself, for those curious: I took it in San Francisco, in the exam center in New Montgomery Street. They have other things going on there, by the way. Don’t expect a quiet place, it’s not.</p><p>They ask for an ID and give you a locker to leave your things, such as your phone. Then it’s straight to the exam computer.</p><p>It took me around 80 minutes (out of a maximum of 120).</p><p>Of the 50 questions, I first answered around 35 for which I had a certain confidence of having the correct answer. I tagged 5 or 6 questions for review. I probably spent 30 minutes on this first pass.</p><p>After that first pass I went over the unanswered questions, taking all the time needed to actually understand the question. A few of the questions that I thought I would just have to guess were much clearer on a second read. I answered all remaining questions but 3.</p><p>The 3rd pass was just about those 3 questions. I’d say I had a 50% chance in each, but since they don’t give you the correct answers at any time and I don’t remember the exact questions there’s no way for me to confirm.</p><p>Finally, I read all the questions again in case I had made an obvious mistake but promised myself not so second guess answers that weren’t clearly incorrect.</p><p>After clicking the “Submit exam” and confirming that I was really sure, etc, and a wait of a few seconds, the results come. No congratulations or anything fancy, or a big font, nothing. A bit anti-climactic I’d say.</p><p>By the way, no multiple answer questions — it was just one answer for each. This has definitely changed from past exams.</p><p>And since you’ve read all the way here, now the goodies: My flashcards. If you read this soon-ish they’re probably useful, as long as you use them as directed (meaning: don’t trust the answers, they can be wrong — instead, use the questions as a starting point for your own research on each topic). For this I use the fantastic <a href="https://apps.ankiweb.net/">Anki</a> Flashcard program, which you can use on the web, your desktop and your mobile, and it syncs between all of them.</p><p>Just go to my <a href="https://github.com/cfsmp3/GoogleCloudCertificationPreparation">GitHub repo</a>, download my deck, and import it in your <a href="https://apps.ankiweb.net/">Anki</a> reader. It’s a bit dirty at this time (I’m releasing it as I have it, it could use some clean up), but I will maintain it a bit from any feedback I get. Also, I will add questions about new products as Google releases them, so I can keep myself up to date.</p><p>If you have an interest on GCP, Cloud, or interesting problems in general, feel free to reach out to me on <a href="https://www.linkedin.com/in/carlossubs/">linked-in</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f1b0cf87933b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>