Wednesday, August 31, 2011

home webcam motion stuff

install motion to poll for activity and create movies

etch archive

updated debian system sources.list to work with old etch.  Need to get a local repository clone next.

index here:

sources.list example:

# deb cdrom:[Debian GNU/Linux 4.0 r6 _Etch_ - Official amd64 DVD Binary-1 20081219-16:30]/ etch contrib main

# deb cdrom:[Debian GNU/Linux 4.0 r6 _Etch_ - Official amd64 DVD Binary-1 20081219-16:30]/ etch contrib main

# regular updates for etch
deb etch main contrib non-free
deb-src etch main contrib non-free

# security updates for etch
#deb etch/updates main contrib non-free
#deb-src etch/updates main contrib non-free

# multimedia       Christian Marillat (was:
#deb etch main
#deb-src etch main

# unofficial
#deb etch main contrib non-free restricted
#deb-src etch main contrib non-free restricted

Thursday, August 18, 2011

sscanf example

from microsoft of all places:

/* The following sample illustrates the use of brackets and the
   caret (^) with sscanf().
   Compile options needed: none

#include <math.h>
#include <stdio.h>
#include <stdlib.h>

char *tokenstring = "first,25.5,second,15";
int result, i;
double fp;
char o[10], f[10], s[10], t[10];

void main()
   result = sscanf(tokenstring, "%[^','],%[^','],%[^','],%s", o, s, t, f);
   fp = atof(s);
   i  = atoi(f);
   printf("%s\n %lf\n %s\n %d\n", o, fp, t, i);

Wednesday, August 10, 2011

slickedit tabs vs. space

slickedit tabs
Document->Tabs                            set tab stops here
Document->Intent with tabs          turn on or off to suit style

   Languages>All Languages>Indent
       Syntax Indent (set)
       Tabs (set)

Monday, August 1, 2011

setting vncserver to start at ubuntu boot (5901 session)

full original article:

update to correct update-rc hint:

To set it up, follow these steps:
  1. First, install the TightVNC server. This VNC server has excellent compatibility with clients, and provides reasonable compression for slow networks. It can be installed with Synaptic, or with sudo aptitude install tightvncserver.
  2. Set up the VNC server for the user you wish to log in as. When you run "vncserver" for the first time, it will ask you to set a password. VNC authentication is not the strongest encryption available, so be sure to firewall your server from all but trusted machines. Better yet, deny direct access to VNC and only allow SSH tunnelled or VPN connections. To launch programs or a session when your VNC session starts, modify ~/.vnc/xstartup. Here is my copy of xstartup: it runs an icewm session, Azureus, and K3B. For Gnome, try running "gnome-session", and for KDE, try "startkde".
    #!/bin/sh xrdb $HOME/.Xresources
    xsetroot -solid black
    /opt/azureus/azureus &
    k3b &
    icewm-session &
  3. Copy the following into /etc/init.d/vncserver. The easiest way to do it is to copy it to your clipboard, run sudo -i && cat > /etc/init.d/vncserve && exit in a terminal, paste it in, and type CTRL-D. Be sure to change the USER variable to whatever user you want the VNC server to run under.
    #!/bin/sh -e
    # Provides:          vncserver
    # Required-Start:    networking
    # Default-Start:     3 4 5
    # Default-Stop:      0 6
    # The Username:Group that will run VNC
    export USER="mythtv"
    # The display that VNC will use
    # Color depth (between 8 and 32)
    # The Desktop geometry to use.
    # The name that the VNC Desktop will have.
    OPTIONS="-name ${NAME} -depth ${DEPTH} -geometry ${GEOMETRY} :${DISPLAY}"
    . /lib/lsb/init-functions
    case "$1" in
    log_action_begin_msg "Starting vncserver for user '${USER}' on localhost:${DISPLAY}"
    su ${USER} -c "/usr/bin/vncserver ${OPTIONS}"
    log_action_begin_msg "Stoping vncserver for user '${USER}' on localhost:${DISPLAY}"
    su ${USER} -c "/usr/bin/vncserver -kill :${DISPLAY}"
    $0 stop
    $0 start
    exit 0
  4. Make the script executable with sudo chmod +x /etc/init.d/vncserver.
  5. Then, run sudo update-rc.d vncserver defaults. This adds the appropriate symlinks to the vncserver script so that it is sent the start and stop commands at the appropriate time. Update: jpb writes that you may need to use sudo update-rc.d vncserver default 99 instead if the job is running too early in the boot process.
  6. To start the server without rebooting, run sudo /etc/init.d/vncserver start
  7. Finally, connect to your server with a VNC client on port 590X, where X is the value of "DISPLAY" in the vncserver script. On OS X, I like to use Chicken of the VNC. On Windows and Linux, the TightVNC client works nicely.
Of course, this script should work as expected on any Debian-based distribution. If you have problems with performance, try lowering the screen resolution. 800x600 is much faster than 1024x768 over slow connections.