Live Desktop Streaming via DLNA on GNU/Linux

TWiT and the Ubuntu terminal on a TV set via DLNA

Many modern TVs (and set-top boxes, gaming consoles, etc.) support DLNA streaming. Suppose you have a PC that stores all your music, downloaded podcasts, video podcasts, photos, and so on. You can run some DLNA media server software on your PC and stream your entire media collection to your TV over your home network. No more carrying around USB sticks, it’s all in your home cloud.

On GNU/Linux, I am using MediaTomb as my DLNA server. It’s nothing fancy (it’s a file server, after all), and it just works.

Okay, this takes care of media files stored on your PC. But can we do more? Is it possible to stream a live capture of your desktop to the TV?

Let’s say you’re watching a Flash video in your browser, and there’s no way to download the video file. Or, you’re watching a live event being streamed via Flash or whatever. It would be kinda cool to be able to stream that to your TV via DLNA. And it’s possible—not trivial, mind you, but I’ve seen it working at least once…

. . . → Read More

Tutorial: Scaling Processing for Android Apps to Different Screens

In my previous article, I gave an introduction to the built-in features of the Android platform for supporting screens of various sizes and densities. In this article, I am going to expand on this and show you actual code for achieving screen-independence in an app. My example will be a Processing app (as that’s my own primary use case), but the ideas should apply equally well to any game or graphics-centric app.

"Chimpzilla Attacks!" mockup (no, I'm not serious)

Let’s use the game “Chimpzilla Attacks!” as an example. I made up this game specifically for the purpose of this tutorial—and already spent way too much time on the mockup. I have no idea what the game mechanics are, but judging from the cheesy graphics, it’s got to be some kind of “Punch The Monkey” knock-off. Anyway, back to the tutorial…

. . . → Read More

Migrating from PmWiki to MoinMoin

When gNewSense GNU/Linux migrated their web site from PmWiki to MoinMoin, I volunteered to write a script to get the job done. These were the requirements:

  • Convert ~1500 pages with attachments without losing any data or formatting
  • Migrate 4 years worth of revision history (>10000 edits)
  • Import ~2500 user accounts

The versions that we used on the gNewSense web site were PmWiki 2.1.27 and MoinMoin 1.7.3 (also tested with 1.9.3).

The gNewSense web site after the migration to MoinMoin

I modified the PmWiki engine so that it produces intermediate markup instead of HTML. The intermediate markup is then converted to MoinMoin markup by a Python script.

I decided against writing my own PmWiki parser based on one of the existing scripts listed on the MoinMoin web site. These scripts were written for older PmWiki versions, and getting them to understand all the details of PmWiki markup the way PmWiki does would have been quite a challenge in any case.

By having PmWiki produce intermediate markup, I leave the hard work to PmWiki itself, while still retaining the semantic information that might not be available in the HTML anymore (for example, a Table of Contents might look like any ordered list in HTML; on the markup level, it’s something entirely different).

. . . → Read More

Building SWIG Python Extensions on GNU/Linux

Originally published: May 27, 2005

Table of Contents

  1. Abstract
  2. Building Manually on the Command Line
  3. Adding SWIG to Autoconf
  4. Adding SWIG to Automake
  5. An Example Project

Abstract

In the article Python Extensions In C++ Using SWIG, I describe how to extend Python with C++ code. That article also contains instructions for building SWIG extension DLLs on Windows. This article contains instructions for using GNU Automake and Autoconf to build SWIG extensions as shared objects on GNU/Linux.

. . . → Read More

Introduction To New-Style Classes In Python

Orignally published: May 8, 2005

Table of Contents

  1. Why New-Style Classes?
  2. Properties
  3. Static Methods
  4. Class Methods
  5. Descriptors
  6. Attribute Slots
  7. The Constructor __new__
  8. Cooperative Super Call
  9. Conclusion
  10. References

Why New-Style Classes?

New-style classes are part of an effort to unify built-in types and user-defined classes in the Python programming language. New-style classes have been around since Python 2.2 (not that new anymore), so it’s definitely time to take advantage of the new possibilities.

. . . → Read More

Python Extensions In C++ Using SWIG

Originally published: Oct 8, 2003 (Last update: August 15, 2007)

Table of Contents

  1. Abstract
  2. Introduction
  3. The Python/C API
  4. SWIG Basics
    1. A Quick Example
  5. Building Extensions on GNU/Linux
  6. Building Extensions on Windows
    1. Setting Up The Environment
    2. Enabling Syntax-Highlighting For .i Files
    3. Setting Up The DLL Project
    4. SWIG As A Custom Build Step
    5. Troubleshooting
  7. A Case Study: “pymfg”
    1. Namespaces And Other Reasons Why Your Classes Aren’t Wrapped
    2. Hiding The Unwanted And Faking The Non-Existent
    3. Someone Has Done All The Work – Using STL Classes
    4. The Problem With Pointers To Pointers
  8. Conclusion

Abstract

This article walks you through the process of writing a Python extension module in C++. To simplify the task, we are going to use SWIG to produce the “glue code” between Python and C++. The article presents the following concepts:

  • Converting between C++ and Python data types
  • Setting up an extension module project that uses SWIG
  • Using SWIG interface definition files
  • Exporting functions and classes
  • Exporting STL containers

. . . → Read More

My Buzz