Month: July 2013

  • Cannot find method (class)(class)getRange(number,number) nor getRange(number,number,number,number)

    Instead of just

      var sheet = SpreadsheetApp.getActiveSpreadsheet();

    do this

      var spread = SpreadsheetApp.getActiveSpreadsheet();
      var sheet = spread.getSheets()[0];

    ’nuff said.

  • How to prevent xscreensaver from starting in Lubuntu (or more precisely, how to kill it right away)

    LXSession has system-wide configuration in /usr/share/lxsession/<Profile name>/ and optional per-user configuration in ~/.config/lxsession/<Profile Name>/. Unfortunately for autostart, according to documentation, “If both files are present, all the entries in both files will be executed.” This means there’s no clean way to prevent autostarting applications defined system-wide from starting per-user; you have to change the system-wide configuration or resort to hacks.

    Here’s one example.

    jani@kingugidora:~$ mkdir -p ~/.config/lxsession/Lubuntu
    jani@kingugidora:~$ mkdir -p ~/bin
    jani@kingugidora:~$ cat > ~/bin/kill-xscreensaver
    #!/bin/sh
    killall xscreensaver
    jani@kingugidora:~$ cat > ~/.config/lxsession/Lubuntu/autostart
    @/home/jani/bin/kill-xscreensaver

    For now the order seems to work, in that the user-defined autostart lines are ran after system-wide ones.

  • avconv: Overlay one video next to another (parallel)

    Dare I say this is somewhat unintuitive?

    $ avconv -y -i input_video_A.mp4 -vf 'movie=input_video_B.mp4[inputB] ; [in]pad=1280:0,[inputB] overlay=640:0[out]' -c:v libx264 output_video.mp4

    This overlays one 640×480 video next to another one of the same size. You can stick a setpts=PTS-STARTPTS in there (between pad=… and [inputB], separated by commas) to have the videos “begin in the same zero timestamp”, but what that means in practice I have yet to figure out.

    Note that this doesn’t do any audio mixing. AFAICT avconv currently in Precise can’t do mixing, but newer versions have the amix filter for it.

    Edit: Once you’ve done mixing elsewhere, you can bring the mix in too:

    $ avconv -y -i input_audio.wav -i input_video_A.mp4 -vf 'movie=input_video_B.mp4[inputB] ; [in]pad=1280:0,[inputB] overlay=640:0[out]' -c:v libx264 -c:a libfaac output_video.mp4

    Scaling goes after overlay:

    overlay=640:0,scale=640:240' -c:v libx264...

    Edit: Something crazier still: place one video below the other and turn the whole thing sideways before scaling down (plus make it phone-compatible by using mpeg4 instead of libx264).

    $ avconv -y -i input_audio.wav -i input_video_A.mp4 -vf 'movie=input_video_B.mp4[inputB] ; [in]pad=0:960,[inputB] overlay=0:480,transpose=2,scale=640:424' -c:v mpeg4 -c:a libfaac output_video.mp4