Moving folder and history between git repos

February 21, 2012
Tags:

Problem : One part of a git-tracked repo has become an independent project in its own right. Moreover, there’s no need for participants in that project to have access to the rest of the repo.

Idea : Move the independent project out into a separate git repo, preserving all the commit history.

Huge props to the following :

  • http://gbayer.com/development/moving-files-from-one-git-repository-to-another-preserving-history/
  • http://st-on-it.blogspot.com/2010/01/how-to-move-folders-between-git.html

Initially : Create a fresh clone of the source repo (this will be removed later : don’t do this on a working copy, just in case everything goes awry):

git clone git@git.EXAMPLE.com:sketchpad.git
cd sketchpad/

Now, let’s filter everything in the directory ‘android-edutiger’ out of this local copy – all the changes from here are what will be moved across (disconnect from the main repo) :

git filter-branch –subdirectory-filter android-edutiger all
git remote rm origin

Now, create a new directory, and move all the relevant files into it :

mkdir android-native
git mv AndroidManifest.xml android-native/
git mv Notes.txt android-native/
git mv pro* android-native/
git mv res android-native/
git mv src android-native/
git commit -a -m "Moved into directory prior to moving repo"

Now go into the new repo ’separated-out’ and pull the stuff over from the local remote (which we’ll temporarily name “SKETCHPAD”) :

cd ..
cd separated-out/
git remote add SKETCHPAD ../sketchpad/
git fetch SKETCHPAD
git branch SKETCHPAD remotes/SKETCHPAD/master
git merge SKETCHPAD

Now the new files should have arrived – disconnect from the local remote “SKETCHPAD”, and clean up:

ls -l android-native/
git remote rm SKETCHPAD
git branch -d  SKETCHPAD
git push origin master
git push
git pull

Get rid of the hacked around ’sketchpad’ (and a real working version will now need to have the same stuff cleaned out too, first-off by issuing a git pull) :

cd ../
rm -rf sketchpad

G2X connecting in developer mode

January 7, 2012
Tags: , , , , ,

On Fedora, I was having issues getting my T-Mobile G2X to connect in developer mode.

For sure, I was setting Settings-Applications-USBdebugging to Checked. And when plugging in the device, the SD card (and/or) internal memory space was showing up on the desktop (and the output in /var/log/messages looked equivalent to that from my working G1) – but no joy with : adb devices.

The Fix : Eventually, after trying everything I could think of, to no avail, I finally toggled Settings-Applications-USBdebugging off-and-on while the phone is connected via USB. Works fine now :

$ adb devices
List of devices attached
emulator-5554 device
0288NN0NN2ffb517 device

In fact, it works rather too well, since I can’t go back to the old non-working situation to check that that was really the fix. The step I took just prior was to cancel the Service for Car Home. But that’s running now, without causing any problems. Very strange.

Please leave a comment if you have more information that can help prove/disprove that this is the right fix.

MythBackend service not starting

November 25, 2011
Tags: , , ,

/var/log/messages complains :

Nov 24 23:52:54 myth systemd[1]: mythbackend.service: control process exited, code=exited status=235
Nov 24 23:52:54 myth systemd[1]: Unit mythbackend.service entered failed state.

Simple solution (not tested whether this survives reboot) :

# touch /var/run/mythbackend.pid; chown mythtv:mythtv /var/run/mythbackend.pid
# systemctl start mythbackend.service
# grep mythbackend

PulseAudio default Sink (output)

November 24, 2011
Tags: , ,

MythTV suddenly stopped audio (yet again : Every upgrade the reason is different). This time, it appears that the order the audio cards are detected has changed, so the default output has changed…

The following is relevant to the process (haven’t tested this through a reboot, yet) :

$ pacmd help
$ pacmd info  | grep -i default
$ pacmd list-sinks
$ pacmd info  | grep -i alsa_output.usb-Burr-Brown_from_TI_USB_Audio_CODEC-00-CODEC.analog-stereo
$ pacmd set-default-sink alsa_output.usb-Burr-Brown_from_TI_USB_Audio_CODEC-00-CODEC.analog-stereo
$ pacmd info  | grep -i alsa_output.usb-Burr-Brown_from_TI_USB_Audio_CODEC-00-CODEC.analog-stereo
$ speaker-test
$ aplay /usr/share/sounds/ekiga/ring.wav

nginx configuration for uwsgi for Flask

November 18, 2011

/etc/nginx/conf.d/site.conf :

server {
 server_name example.com www.example.com;
 root home/example/flask/static;
 
 location ~ ^/(img|js|css)/ {  # |pi||ext|theme
  root                    /home/example/flask/static;
  add_header              Cache-Control public;
  #expires                 30d;
  #access_log              off;
 }

 location / { try_files $uri @yourapplication; }

 location @yourapplication {
    include uwsgi_params;
    uwsgi_pass unix:/tmp/uwsgi_example.sock;
 }
}

This must be married with a uwsgi service started by a script in /etc/init.d/ :

#!/bin/bash

# uwsgi – Use uwsgi to run python and wsgi web apps.
#
# chkconfig: – 85 15
# description: Use uwsgi to run python and wsgi web apps.
# processname: uwsgi

PATH=/opt/uwsgi:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/uwsgi

PYTHONENV=/usr

OWNER=uwsgi

NAME=uwsgi
DESC=uwsgi

test -x $DAEMON || exit 0

# Include uwsgi defaults if available
if [ -f /etc/sysconfig/uwsgi ] ; then
        . /etc/sysconfig/uwsgi
fi

set -e

get_pid() {
    if [ -f /var/run/$NAME.pid ]; then
        echo `cat /var/run/$NAME.pid`
    fi
}  

#DAEMON_OPTS="-s 127.0.0.1:9001 -M 4 -t 30 -A 4 -p 4 -d /var/log/uwsgi.log –pidfile /var/run/$NAME.pid –pythonpath $PYTHONPATH –module $MODULE"

DAEMON_OPTS="-s /tmp/uwsgi_cohortion.sock -M 4 -t 30 -A 4 -p 4 -d /var/log/uwsgi.log –pidfile /var/run/$NAME.pid –pythonpath $PYTHONPATH –module $MODULE –callable $CALLABLE -H $PYTHONENV"

case "$1" in
  start)
        echo -n "Starting $DESC: "
        PID=$(get_pid)
        if [ -z "$PID" ]; then
            [ -f /var/run/$NAME.pid ] && rm -f /var/run/$NAME.pid

            touch /var/run/$NAME.pid                                        
            chown $OWNER /var/run/$NAME.pid
            su$OWNER -pc "$DAEMON $DAEMON_OPTS"
            echo "$NAME."
        fi

        ;;
  stop)
        echo -n "Stopping $DESC: "
        PID=$(get_pid)
        [ ! -z "$PID" ] && kill -s 3 $PID &> /dev/null
        if [ $? -gt 0 ]; then
            echo "was not running"
            exit 1
        else
            echo "$NAME."
            rm -f /var/run/$NAME.pid &> /dev/null
        fi
        ;;
  reload)
        echo "Reloading $NAME"
        PID=$(get_pid)
        [ ! -z "$PID" ] && kill -s 1 $PID &> /dev/null
        if [ $? -gt 0 ]; then
            echo "was not running"
            exit 1
        else
            echo "$NAME."
            rm -f /var/run/$NAME.pid &> /dev/null
        fi
        ;;
  force-reload)
        echo "Reloading $NAME"
        PID=$(get_pid)
        [ ! -z "$PID" ] && kill -s 15 $PID &> /dev/null
        if [ $? -gt 0 ]; then
            echo "was not running"
            exit 1
        else
            echo "$NAME."
            rm -f /var/run/$NAME.pid &> /dev/null
        fi
        ;;
  restart)
        $0 stop
        sleep 2
        $0 start
        ;;
  status)  
        killall -10 $DAEMON
        ;;
      *)  
            N=/etc/init.d/$NAME
            echo "Usage: $N {start|stop|restart|reload|force-reload|status}" >&2
            exit 1
            ;;
esac
exit 0

And this has configuration information in /etc/sysconfig/uwsgi . The following works for (i) a core flask file at /home/example/flask/example.py, and (ii) for a flask module (rather than a single file executable), /etc/sysconfig/uwsgi (for a flask module starting at /home/example/flask/example/__init__.py) :

PYTHONPATH=/home/example/flask
MODULE=example
CALLABLE=app
PYTHONENV=/home/example/env

Note that (under /home/example/env) there’s a python virtualenv created with :

# As root :
yum install python-virtualenv

# As user :
cd ~
virtualenv env

Also note that there needs to be a python stub to actually declare the flask ‘app’ :

CASE1 : there’s a python file ‘example.py’ in /home/example/flask/example.py that defines the flask application ‘app’. This file can also define a __main__, so that it can be used as a dev-machine launcher too. The standard flask minimal intro file will work fine : The body of the file defines ‘app’ which will be picked up by uwsgi (for production), or run via the ” if __name__ == ‘__main__’: ” pattern for development.

CASE2 : there’s a python file ‘__init__.py’ in /home/example/flask/example/ that defines the flask application ‘app’. To make this setup function as a dev machine, you’ll also need to create something that runs this setup locally. The simplest seems to be to create ‘run.py’ (in the same directory from which the example module branches off) :

from example import app

HOST = ‘localhost’   # This restricts incoming calls to the local machine
HOST = ‘0.0.0.0′     # This allows incoming calls from outside the machine (Windows will ask for Firewall permission)
PORT = 7891          # Arbitrary port

app.run(host=HOST, port=PORT, debug=True, )

Building uwsgi from src.rpm without Python 3

November 16, 2011

To build uwsgi on Fedora 12 (which has no easy-to-find python3 rpm), run through the rpmbuild process (shown in a previous post in more detail for nginx) and make the following changes :

wget http://kad.fedorapeople.org/packages/uwsgi/uwsgi-0.9.9.2-2.fc15.src.rpm
rpm -ivh uwsgi-0.9.9.2-2.fc15.src.rpm
rpmbuild -bb  ~/rpmbuild/SPECS/uwsgi.spec
yum install python-devel libuuid-devel jansson-devel libyaml-devel ruby-devel python3-devel python-greenlet-devel  lua-devel  ruby
# NB: python3-devel doesn’t exist…

# Need to fix up the fedora configuration file :
joe ~/rpmbuild/SOURCES/fedora.ini
# Take out the reference to python32
[uwsgi]
inherit = default
embedded_plugins = echo, ping, http
#plugins = rack, psgi, python, nagios, fastrouter, admin, python32, ruby19, cache, cgi, rpc, ugreen, greenlet, lua
plugins = rack, psgi, python, nagios, fastrouter, admin, ruby19, cache, cgi, rpc, ugreen, greenlet, lua

# Similarly, edit the spec file (), to take out the installation of the python3 files :
joe ~/rpmbuild/SPECS/uwsgi.spec
# Take out the reference to python32
# %files -n %{name}-plugin-python3
# %{_libdir}/%{name}/python32_plugin.so

# Then, building should work…
rpmbuild -bb  ~/rpmbuild/SPECS/uwsgi.spec

# Now install the relevant uwsgi rpms…
yum –nogpgcheck localinstall /root/rpmbuild/RPMS/i386/uwsgi-plugin-python-0.9.9.2-2.fc12.i386.rpm  /root/rpmbuild/RPMS/i386/uwsgi-plugin-common-0.9.9.2-2.fc12.i386.rpm  /root/rpmbuild/RPMS/i386/uwsgi-0.9.9.2-2.fc12.i386.rpm /root/rpmbuild/RPMS/i386/uwsgi-plugin-admin-0.9.9.2-2.fc12.i386.rpm

# You’ll still need a /etc/init.d/uwsgi file.
# See the configuration file under the ngix / uwsgi / flask post for a sample

Updating nginx (with uwsgi) for Fedora 12 from src.rpm

November 14, 2011

In order to get access to uwsgi (useful for deploying python flask projects, for instance), one needs a version of nginx > 0.8 or so. But Fedora 12 doesn’t have such a modern version : Here’s how to build it from a src.rpm from a more recent Fedora release.

# First, make sure we have the rpm-build tools :
yum install rpm-build

# Download a suitable src.rpm (look at the dependencies :
# nginx doesn’t really care about which version of fedora it’s for
wget ftp://ftp.muug.mb.ca/mirror/fedora/linux/development/rawhide/source/SRPMS/nginx-1.0.5-1.fc16.src.rpm

# This installs the source into ~/rpmbuild/BUILD/nginx-1.0.5/
rpm -ivh nginx-1.0.5-1.fc16.src.rpm

# Now, do a test build to see what we’re missing
rpmbuild -bb  ~/rpmbuild/SPECS/nginx.spec

# This complains about missing dependencies : Do a copy-paste as necessary
yum install pcre-devel zlib-devel openssl-devel ‘perl(ExtUtils::Embed)’ libxslt-devel GeoIP-devel gd-devel

# Rebuild again (installing more packages if this fails)
rpmbuild -bb  ~/rpmbuild/SPECS/nginx.spec

# Now install nginx from the brand new rpm just created:
rpm -Uvh ~/rpmbuild/RPMS/i386/nginx-1.0.5-1.fc12.i386.rpm

# Attempt a restart :
/etc/init.d/nginx restart

# … some configuration options may have changed – and a new dummy.conf file was added …
cd /etc/nginx/conf.d
mv default.conf default.conf.disable

# All good now…
/etc/init.d/nginx restart

Compiling nginx (with uwsgi) for Fedora 12

October 17, 2011

In order to get access to uwsgi (useful for deploying python flask projects, for instance), one needs a version of nginx > 0.8 or so. But Fedora 12 doesn’t have such a modern version : Here’s how to compile it from source :

Actually, a less hacky approach is to simply back-port (trivially) a src.rpm from Fedora 16 : That’s in a newer post/

Have a look at : http://library.linode.com/web-servers/nginx/python-uwsgi/fedora-13

yum groupinstall "Development Tools"
yum install zlib-devel wget openssl-devel pcre pcre-devel sudo
cd /opt/
wget http://nginx.org/download/nginx-1.0.0.tar.gz
tar -zxvf nginx-1.0.0.tar.gz
cd /opt/nginx-1.0.0/
./configure –prefix=/opt/nginx –user=nginx –group=nginx –with-http_ssl_module
make
make install

useradd -M -r –shell /bin/sh –home-dir /opt/nginx nginx
usermod -a -G lean nginx

But the ./configure reveals the following variables, that need to be fixed up in the initial call :

nginx path prefix: "/opt/nginx"
  nginx binary file: "/opt/nginx/sbin/nginx"
  nginx configuration prefix: "/etc/nginx"
  nginx configuration file: "/etc/nginx/nginx.conf"
  nginx pid file: "/opt/nginx/logs/nginx.pid"
  nginx error log file: "/var/log/nginx/error.log"
  nginx http access log file: "/var/log/nginx/access.log"
  nginx http client request body temporary files: "client_body_temp"
  nginx http proxy temporary files: "proxy_temp"
  nginx http fastcgi temporary files: "fastcgi_temp"
  nginx http uwsgi temporary files: "uwsgi_temp"
  nginx http scgi temporary files: "scgi_temp"
./configure –prefix=/opt/nginx –conf-path=/etc/nginx/nginx.conf –error-log-path=/var/log/nginx/error.log –http-log-path=/var/log/nginx/access.log  –user=nginx –group=nginx –with-http_ssl_module

Then, need to fix nginx and pidfile definitions in /etc/init.d/nginx (take it from packaged version)

#nginx="/usr/sbin/nginx"
nginx="/opt/nginx/sbin/nginx"
prog=$(basename $nginx)

sysconfig="/etc/sysconfig/$prog"
lockfile="/var/lock/subsys/nginx"
#pidfile="/var/run/${prog}.pid"
pidfile="/opt/nginx/logs/${prog}.pid"

Building a Python LibreOffice Extension

October 7, 2011

Here’s a pretty minimal setup for building an extension for LibreOffice in Python.

Working backwards, I’ve called the extension ‘mdda_fns.oxt’. Here’s the makefile, which is in the root of the package development tree :

all:    clean zip install

clean:
        unopkg remove mdda_fns.oxt
        rm mdda_fns.oxt
       
zip:
        zip -r mdda_fns.oxt \
                description.xml \
                META-INF/manifest.xml \
                Addons.xcu \
                src/Interface.py \
                package/img/icon_42×42.png \
                package/desc_en.txt \
                package/license_en-GB.txt

install:
        unopkg add mdda_fns.oxt

The essential files for anything to work are :

  • description.xml : Contains overall information about the extension : names, descriptions, licensing, help information, upgrading, etc. The filename for this file is FIXED;
  • META-INF/manifest.xml : Contains a file listing of the extension package (which is rolled up into the zip/oxt. Along with each file, the filetype identifies how it will be treated when the system loads it in. The filename for this file is FIXED;
  • Addons.xcu : Contains an XML description of how the extension is wired into the actual LibreOffice GUI : As a menu-item, ToolButton on a Toolbar; etc; Arbitrary filename (listed in ‘manifest.xml’)
  • src/Interface.py : This is a Python file, which I’ve put in the interface code. Arbitrary filename (listed in ‘manifest.xml’);
  • package/ : This directory houses stuff related to the overall package : see ‘description.xml’;

Here is the contents of those files :

description.xml

<?xml version="1.0" encoding="UTF-8"?>
<description xmlns="http://openoffice.org/extensions/description/2006"
xmlns:d="http://openoffice.org/extensions/description/2006"
xmlns:xlink="http://www.w3.org/1999/xlink">
 
  <version value="1.0" />  
 
  <identifier value="com.platformedia.libreoffice.extensions.mdda_fn" />
 
<!–  <platform value="windows_x86,solaris_sparc" />  !–>
  <platform value="all" />
 
  <dependencies>
    <OpenOffice.org-minimal-version value="3.3" d:name="OpenOffice.org 3.3"/>
  </dependencies>
 
  <update-information>
    <src xlink:href="http://extensions.openoffice.org/testarea/desktop/license/update/lic3.update.xml" />
  </update-information>
 
  <registration>
<!–  
   <simple-license accept-by="admin" suppress-on-update="true" >
     <license-text xlink:href="package/license_en-GB.txt" lang="en-GB" />
   </simple-license>
!–>
  </registration>

  <publisher>
<!–  
   <name xlink:href="http://extensions.openoffice.org/testarea/desktop/publisher/publisher_en.html" lang="en">PLATFORMedia :: mdda</name>
!–>
    <name xlink:href="http://platformedia.com/" lang="en">PLATFORMedia</name>
  </publisher>
 
  <release-notes>
    <src xlink:href="http://extensions.openoffice.org/testarea/desktop/publisher/release-notes_en.txt" lang="en" />
  </release-notes>
 
  <display-name>
    <name lang="en">mdda helper extension</name>
  </display-name>
 
  <icon>
    <default xlink:href="package/img/icon_42×42.png" />
    <high-contrast xlink:href="package/img/icon_42×42.png" />
  </icon>
 
  <extension-description>
    <src xlink:href="package/desc_en.txt" lang="en" />
  </extension-description>
 
</description>

META-INF/manifest.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE manifest:manifest PUBLIC "-//OpenOffice.org//DTD Manifest 1.0//EN" "Manifest.dtd">
<manifest:manifest xmlns:manifest="http://openoffice.org/2001/manifest">

  <manifest:file-entry manifest:media-type="application/vnd.sun.star.configuration-data"
                      manifest:full-path="Addons.xcu"/>                    
                       
  <manifest:file-entry manifest:media-type="application/vnd.sun.star.uno-component;type=Python"
                      manifest:full-path="src/Interface.py"/>
 
<!–
 <manifest:file-entry manifest:media-type="application/vnd.sun.star.framework-script"
                      manifest:full-path="package"/>
!–>

</manifest:manifest>

Addons.xcu : Here, I’ve commented out the toolbar and image stuff : I just want to put a top menubar entry.

Also, see the vnd.sun.star.script: entry? That’s what’s required if you want to preprocess this as a script file (of the sort one would put in ~/.libreoffice/3/user/Scripts/python/. But it gets very awkward to address these from the UI elements. Much better to use the service: type, and create the named interface (note how com.platformedia.libreoffice.extensions.mdda_fn.TestButton is defined in the .py file below).

Note that the menu is defined to work for spreadsheets (search for ‘Context’), so that it won’t appear if one is loading up a wordprocessing document.

<?xml version="1.0" encoding="UTF-8"?>
<oor:component-data xmlns:oor="http://openoffice.org/2001/registry"
                   xmlns:xs="http://www.w3.org/2001/XMLSchema" oor:name="Addons"
                   oor:package="org.openoffice.Office">
 
<!– See : http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/WritingUNO/AddOns/Menus !–>

    <node oor:name="AddonUI">
        <node oor:name="OfficeMenuBar">
            <node oor:name="com.platformedia.libreoffice.extensions.mdda_fn" oor:op="replace">
                <prop oor:name="Title" oor:type="xs:string">
                    <value/>
                    <value xml:lang="en-US">~mdda</value>
                </prop>
<!–                
               <prop oor:name="Target" oor:type="xs:string">
                   <value>_self</value>
               </prop>
               <prop oor:name="ImageIdentifier" oor:type="xs:string">
                   <value/>
               </prop>
!–>                
                <node oor:name="Submenu">
                    <node oor:name="m1" oor:op="replace">
                        <prop oor:name="URL" oor:type="xs:string">
<!–                        
<value>vnd.sun.star.script:mdda_fns.oxt|src|Interface.py$Something?language=Python&amp;location=user:uno_packages</value>
!–>                            
<value>service:com.platformedia.libreoffice.extensions.mdda_fn.TestButton?execute</value>
                        </prop>
                        <prop oor:name="Title" oor:type="xs:string">
                            <value/>
                            <value xml:lang="en-US">TestButton</value>
                        </prop>
                        <prop oor:name="Target" oor:type="xs:string">
                            <value>_self</value>
                        </prop>
                        <prop oor:name="Context" oor:type="xs:string">
<!–
                           <value>com.sun.star.text.TextDocument</value>
!–>                            
                            <value>com.sun.star.sheet.SpreadsheetDocument</value>
                        </prop>
                    </node>
                </node>
            </node>
        </node>
   
<!–    
       <node oor:name="OfficeToolBar">
           <node oor:name="name.vojta.openoffice.Wavelet" oor:op="replace">
               <node oor:name="m1" oor:op="replace">
                   <prop oor:name="URL" oor:type="xs:string">
                       <value>service:name.vojta.openoffice.Wavelet?execute</value>
                   </prop>
                   <prop oor:name="ImageIdentifier" oor:type="xs:string">
                       <value/>
                   </prop>
                   <prop oor:name="Title" oor:type="xs:string">
                       <value/>
                       <value xml:lang="en-US">Wavelet</value>
                   </prop>
                   <prop oor:name="Target" oor:type="xs:string">
                       <value>_self</value>
                   </prop>
                   <prop oor:name="Context" oor:type="xs:string">
!- –                    
                      <value>com.sun.star.text.TextDocument</value>
!- –                      
                      <value>com.sun.star.sheet.SpreadsheetDocument</value>
                   </prop>
               </node>
           </node>
       </node>        
!–>                      
<!–    
       <node oor:name="Images">
           <node oor:name="name.vojta.openoffice.Wavelet.image1" oor:op="replace">
               <prop oor:name="URL">
                   <value>service:name.vojta.openoffice.Wavelet?execute</value>
               </prop>
               <node oor:name="UserDefinedImages">
                   <prop oor:name="ImageSmallURL" oor:type="xs:string">
                       <value>%origin%/images/WaveletSmall.bmp</value>
                   </prop>
                   <prop oor:name="ImageBigURL" oor:type="xs:string">
                       <value>%origin%/images/WaveletBig.bmp</value>
                   </prop>
               </node>
           </node>
       </node>
!–>                      
       
    </node>
 </oor:component-data>

src/Interface.py : Also noteworthy is the interface definition code half-way down the script, and also the ‘__main__’ code that allows one to test the extension quickly (in this case, it loads up a test workbook, and presses the button in the python file for inspection). To retest, you’ll need to close up oocalc and relaunch. print comments go to stdout (the command line terminal, usually).

import uno
import unohelper
from com.sun.star.task import XJobExecutor

class TestButton( unohelper.Base, XJobExecutor ):
    def __init__( self, ctx ):
        self.ctx = ctx
 
    def trigger( self, args ):
        desktop = self.ctx.ServiceManager.createInstanceWithContext("com.sun.star.frame.Desktop", self.ctx )
 
        doc = desktop.getCurrentComponent()
        print("Pressed Button!")
       
g_ImplementationHelper = unohelper.ImplementationHelper()
g_ImplementationHelper.addImplementation(
    TestButton,
    "com.platformedia.libreoffice.extensions.mdda_fn.TestButton",
    ("com.sun.star.task.Job",),
)

if __name__ == "__main__":
    import os
 
    # Start OpenOffice.org, listen for connections and open testing document
    #os.system( "/etc/openoffice.org-1.9/program/soffice ‘-accept=socket,host=localhost,port=2002;urp;’ -writer ./WaveletTest.odt &" )
    os.system( "/usr/bin/oocalc ‘-accept=socket,host=localhost,port=2002;urp;’ ./Test-mdda-fns.ods &" )
 
    # Get local context info
    localContext = uno.getComponentContext()
    resolver = localContext.ServiceManager.createInstanceWithContext("com.sun.star.bridge.UnoUrlResolver", localContext )
 
    ctx = None
 
    # Wait until the OO.o starts and connection is established
    while ctx == None:
        try:
            ctx = resolver.resolve("uno:socket,host=localhost,port=2002;urp;StarOffice.ComponentContext" )
        except:
            pass
 
    print("About to do TestButton")
 
    # Trigger our job
    testjob = TestButton( ctx )
    testjob.trigger( () )

    print("Done TestButton")

Notes : Essential packaging info

  • http://user.services.openoffice.org/en/forum/viewtopic.php?f=45&t=43398
  • http://wiki.services.openoffice.org/wiki/UNO_component_packaging#Python_component_testing
  • http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Extensions/Extensions

Hope this helps someone.

MythTV / lircd updates on Fedora : Hauppauge

July 16, 2011

I’ve been maintaining a PVR350 on an old Dell 2.4GHz since forever.

Latest updates (to MythTV 24.1, and licrd 0.9.0.7) have made big changes. But it’s all working again, including a serial IR blaster. The following is just for my easy reference, and anyone else who now finds their Grey Hauppauge remote control is emitting new key-presses (or worse, no longer talking to the system).

To re-set up the whole lircd thing (when the new licrd changes appeared), I followed “Debian Wheezy amd64 Hauppauge PVR 350″ on http://www.mythtv.org/wiki/LIRC#Setting_Up_The_Devinput_Option .

# more /home/myth/mythtv/irw-all-keys-hauppage
0000000080010161 00 KEY_SELECT devinput
0000000080010164 00 KEY_POWER2 devinput

0000000080010179 00 KEY_TV devinput
0000000080010189 00 KEY_VIDEO devinput
0000000080010188 00 KEY_AUDIO devinput
00000000800100d4 00 KEY_CAMERA devinput

000000008001016d 00 KEY_EPG devinput
0000000080010181 00 KEY_RADIO devinput

0000000080010069 00 KEY_LEFT devinput
0000000080010067 00 KEY_UP devinput
0000000080010160 00 KEY_OK devinput
000000008001006a 00 KEY_RIGHT devinput
000000008001006c 00 KEY_DOWN devinput

00000000800100ae 00 KEY_EXIT devinput
000000008001008b 00 KEY_MENU devinput

0000000080010073 00 KEY_VOLUMEUP devinput
0000000080010072 00 KEY_VOLUMEDOWN devinput

000000008001019c 00 KEY_PREVIOUS devinput
0000000080010071 00 KEY_MUTE devinput

0000000080010192 00 KEY_CHANNELUP devinput
0000000080010193 00 KEY_CHANNELDOWN devinput

00000000800100a7 00 KEY_RECORD devinput
0000000080010080 00 KEY_STOP devinput

00000000800100a8 00 KEY_REWIND devinput
00000000800100cf 00 KEY_PLAY devinput
00000000800100d0 00 KEY_FASTFORWARD devinput

00000000800100a5 00 KEY_PREVIOUSSONG devinput
0000000080010077 00 KEY_PAUSE devinput
00000000800100a3 00 KEY_NEXTSONG devinput

0000000080010002 00 KEY_1 devinput
0000000080010003 00 KEY_2 devinput
0000000080010004 00 KEY_3 devinput

0000000080010005 00 KEY_4 devinput
0000000080010006 00 KEY_5 devinput
0000000080010007 00 KEY_6 devinput

0000000080010008 00 KEY_7 devinput
0000000080010009 00 KEY_8 devinput
000000008001000a 00 KEY_9 devinput

0000000080010184 00 KEY_TEXT devinput
000000008001000b 00 KEY_0 devinput
0000000080010172 00 KEY_SUBTITLE devinput

000000008001018e 00 KEY_RED devinput
000000008001018f 00 KEY_GREEN devinput
0000000080010190 00 KEY_YELLOW devinput
0000000080010191 00 KEY_BLUE devinput