use java-ffmpeg wrapper, or simply use java runtime to execute ffmpeg?

I’m pretty new to Java, need to write a program that listen to video conversion instructions and convert the video once an new instruction arrives (instructions is stored in Amazon SQS, but it’s irrelevant to my question)

I’m facing a choice, either use Java RunTime to exec ‘ffmpeg’ conversion (like from command line), or I can use a ffmpeg wrapper written inJava

I’d much prefer using Java Runtime to exec ffmpeg directly, and avoid using java-ffmpeg wrapper as I have to learn the library. so my question is are there any benefits using java-ffmpeg wrapper over exec ffmpeg directly using Runtime? I don’t need ffmpeg to play videos, just convert videos

read more

jQuery Set Selected Option Using Next

How can I, using jQuery, set the “next” item of an already selected item as “selected.”

For example, if I have:

<option value="1" >Number 1</option>
<option value="2" selected="selected">Number 2</option>
<option value="3" >Number 3</option>
<option value="4" >Number 4</option>

We can see that “Number 2” is selected, and using jQuery, I’d like to set “Number 3” as selected, and remove the selected “attribute” from “Number 2”. I’m assuming I need to use the next selector, but I’m not quite sure how to implement.

read more

Changing the interval of SetInterval while it’s running

I have written a javascript function that uses setInterval to manipulate a string every tenth of a second for a certain number of iterations.

function timer() {
    var section = document.getElementById('txt').value;
    var len = section.length;
    var rands = new Array();

    for (i=0; i<len; i++) {

    var counter = 0
    var interval = setInterval(function() {
        var letters = section.split('');
        for (j=0; j < len; j++) {
            if (counter < rands[j]) {
                letters[j] = Math.floor(Math.random()*9);
        document.getElementById('txt').value = letters.join('');

        if (counter > rands.max()) {
    }, 100);

read more

Is there an easy, simple, lazy way to test rules against Apache’s mod_rewrite?

I want to test the effects of my RewriteRules without going through all the trouble of setting up a vhost and a RewriteLog and throwing URLs at the browser (or curling them).

But I don’t just wanna test regular expressions. I want my URLs to actually go through Apache’s mod_rewrite stack, and I want to see the response that would come out of it.

Awesome if I could get some trace of which rules acted on the URL, with which order, and what the interim results were. (I guess most of this appears in the rewrite log, but I wanted to avoid that setup)

read more

How to execute the output of a command within the current shell?

I’m well aware of the source (aka .) utility, which will take the contents from a file and execute them within the current shell.

Now, I’m transforming some text into shell commands, and then running them, as follows:

$ ls | sed ... | sh

ls is just a random example, the original text can be anything. sed too, just an example for transforming text. The interesting bit is sh. I pipe whatever I got to sh and it runs it.

read more