Sunday, May 20, 2012

yui-compressor from rhino

I'm using rhino for a build dependency on a project I'm working on. Rhino is building a javascript application for me and part of that process is running yui-compressor - so this post is about calling yui-compressor from Rhino.

I couldn't get loadClass to accept the 'resolve' boolean so I've been reduced to the following to get something working:



 var COMPRESS = new Object();
    COMPRESS['yuicompress'] = ["-jar", JSLIBS+'/bin/yuicompressor-2.4.8pre.jar'];
var YUICOMPRESS_OPTIONS = [
  "--nomunge", //               Minify only, do not obfuscate
  "--preserve-semi", //          Preserve all semicolons
  "--disable-optimizations", //   Disable all micro optimizations
];

     var compressCMD = COMPRESS['yuicompress'];
    if (YUICOMPRESS_OPTIONS.length > 0) {
        if (YUICOMPRESS_OPTIONS.length == 1) {
            compressCMD.push(YUICOMPRESS_OPTIONS);
        }
        else {
            compressCMD.concat(YUICOMPRESS_OPTIONS);
        }
    }
    compressCMD.push([infile]);
    var options = new Array();
    options['args'] = compressCMD;
    options['output'] = "";
    runCommand("java", options);

    //print(options['output']);
    var w = new java.io.FileWriter(outfile);
    try
    {
        w.write(options['output']);
    }
    finally
    {
        w.close();
    }
    return;


Thursday, October 20, 2011

routing real-time audio to the internet

I've been working on a server-side audio tool. My app works well on the desktop - it is written in Java and the audio from SourceDataLine just works. So, I moved the app to a remove server.

Pulseaudio was installed on the remote server, and I thought it should be pretty easy to route the output back over the internet to myself.

In the end it was:

parec -r | oggenc -r -o - - | ./sighttpd -f ./oggout.conf


I called my java code with 'padsp', I'm not sure that is necessary but it probably is. This method avoids using Gstreamer (that should be a good solution if you want to scale: It can plug your audio into icecast/shoutcast.)

SourceDataLine provided the audio stream in my Java app.

NOTE: I spent a whole bunch of time playing with a file output pipe from pulse audio. The excellent support from pulse audio mailing list and irc channel steered me away from that.

Saturday, September 10, 2011

understanding the decision copyright in EU

If you are struggling to understand the sense of the copyright extension granted by the EU, I invite you to exercise the following idea against the decision:


The tradition of dead generations hang like a nightmare in the minds of the living.

In this case, Cliff et al have conjured a spectre that law makers have felt confident cowering to. The instantaneous value of the copyright in question has become crippling to law makers, trapped in the headlights of old intellectual capital. The alternative, to welcome a continuous introduction of content to the chaos of the public domain ecosystem, lost this round.

It doesn't take a great deal of imagination to think that: as Marx provides a compelling critique of modern political economy, Marx may provide a compelling critique of modern political economy.


For the record, IMHO Cliff's music is utterly worthless. And (IMHO) people that enjoy his music are idiots. And that goes for every other artist that has become so alienated from their art that they need lawyers to provide critical appraisal of their (past) actions.

Monday, July 18, 2011

sighttpd ogg only

sighttpd is an excellent light weight streaming tool. Version 1.2 is the current master from git: https://github.com/kfish/sighttpd

One issue I had with this version is that it has a run-time dependency on shcodecs-record. The symptoms of noting having shcodecs-record available on the path is that sighttpd fails with:

execvp() failed: No such file or directory

I didn't need the stuff that shcodecs provides (MPEG-4 and H.264 encoding and decoding on SH-Mobile processor series.) To remove this dependency, a cheap hack was employed: comment out ./src/main.c:165 

// shrecord_run();

Then, recompile. I have a post on making a static sighttpd if you're interested in that.

UPDATE:
The shrecord dependency has been removed in the recent git master, so get that and ignore this.

Sunday, July 10, 2011

static build of sighttpd

sighttpd is a handy lightweight tool for streaming media over the internet. It is a lightweight alternative to icecast/shoutcast.

I need a static build of this tool, so I followed the instructions and added LDFLAGS="-all-static" to the make command. The compete build chain was:

   autoreconf -vif
   ./configure
   make LDFLAGS="-all-static"
   scp ./src/sighttpd richard@myserver:tools/

NOTE: you'll need to have shcodecs-record is in search path.

Sunday, June 26, 2011

one-liner to get useful info on OpenNebula VMs

I've been playing with OpenNebula. I've got a few dozen VMs which are being provided with context dynamically. It would be handy to list all the machines MAC and IP addresses, along with their names. For this purpose, I use the following one-liner:

 for ID in `sqlite3 /var/lib/one/one.db 'select oid from vm_pool where state = 3 order by name;'` ; do onevm show $ID | grep "NAME\|IP\|MAC" | grep -v VIRTUAL | grep -v ' : ' | sed 's/REQUIREMENTS=/  /'; done

 

Tuesday, May 3, 2011

koan error on Scientific Linux 6

I'm doing some virtualisation stuff, using cobbler and koan. On a new install of Scientific Linux 6 (as a proxy for RHEL6) I got the error:


...
  if ret == -1: raise libvirtError ('virConnectGetVersion() failed', conn=self)



it seems that the package: qemu-kvm was not installed. So, to fix:

yum install qemu-kvm