First, the obvious: Make sure the parent table has a unique key for validation when trying to create a foreign key.

Having said that, “Cant’ create table” is a poorly phrased response for situations in which “the obvious” rules have not been followed. If you’re still confused, re-read the first paragraph more carefully. Failing that… you may want to get someone else to resolve this error. Seriously.

 
  1. I like to have the ISO on hand, so I downloaded it last night.
  2. I mounted the ISO and added the mount point to /etc/apt/sources.list:
    deb file:///mnt/ubuntu-10.10-dvd maverick main restricted
  3. I edited /etc/update-manager/release-upgrades to include Prompt=normal
  4. I ran do-release-upgrade
Technically it’s still running, but I’m being optimistic. :-)
 
I did not find the output from man builtins all that useful in learning how to use getopts. Fortunately, the Bash Hackers Wiki clicked right away.
getopts_demo() {
local loop=0 OPTERR=0 optstring=":ab:c:de:"

  echo "# processing getopts ${optstring} on '${@}'"

  while getopts ${optstring} OPT; do
    msg=""
    case ${OPT} in
      \?    )
        msg="failure -${OPTARG} is invalid"; OPTERR=$[${OPTERR}+1];;
      :     )
        msg="failure -${OPTARG} requires a value." OPTERR=$[${OPTERR}+1];;
      a|d   ) msg="success -${OPT} -> ${OPT}flag=1";;
      b|c|e ) msg="success -${OPT}=${OPTARG}";;
    esac
    loop=$[${loop}+1]
    cat << EOF
  # loop=${loop}
    OPTIND=${OPTIND:-} OPT=${OPT}
    OPTARG=${OPTARG:-''} OPTERR=${OPTERR:-}
    msg=${msg}
EOF
  done
  return ${OPTERR}
}

set -o nounset
getopts_demo -a -b world -e -f -g -c
echo "# ?=${?}"
The code above defines and calls a function named getopts_demo. Here’s the output:
# processing getopts :ab:c:de: on '-a -b world -e -f -g -c'
  # loop=1
    OPTIND=2 OPT=a
    OPTARG='' OPTERR=0
    msg=success -a -> aflag=1
  # loop=2
    OPTIND=4 OPT=b
    OPTARG=world OPTERR=0
    msg=success -b=world
  # loop=3
    OPTIND=6 OPT=e
    OPTARG=-f OPTERR=0
    msg=success -e=-f
  # loop=4
    OPTIND=7 OPT=?
    OPTARG=g OPTERR=1
    msg=failure -g is invalid
  # loop=5
    OPTIND=8 OPT=:
    OPTARG=c OPTERR=2
    msg=failure -c requires a value.
# ?=2
Make sure to note that loop 3 has an error that goes undetected. It makes no sense that -e=-f. Let me know if you have any questions.
 
I watched the iPad video on YouTube today. This 2″ x 3″ screen feels even smaller now.
I suspect we’ll get one eventually, instead of a netbook. Especially after my wife gets wind of them.
 
Here’s a quick example that can keep you from tracking which order to use when passing arguments.
evaluate_arguments() {
  local i=1 k='' v='' is_named=0
  while [[ ${i} -le ${#} ]]; do
    k=$(eval echo $`echo ${i}`)
    [[ "${k:0:2}" = "--" ]] && k="${k:2}"
    is_named=0
    case "${k}" in
      "foo" | "bar" | "zee" ) is_named=1 ;;
    esac
    if [[ ${is_named} -eq 1 ]]; then
      i=$[${i}+1]
      eval "${k}=$(eval echo $`echo ${i}`)"
    else
      eval "others=\"${others}${k} \""
    fi
    i=$[${i}+1]
  done
  [[ "${others}" != "" ]] \
    && others="${others:0:$[${#others}-1]}" \
    || others='UNSET'
  return 0
}
Basic setup:
set -a nounset
export foo='UNSET' bar='UNSET' zee='UNSET' others=''
Call it:
evaluate_arguments --foo 1 --bar x one two
Examine the results:
cat << EOF
# output: foo='${foo}' bar='${bar}' zee='${zee}' others='${others}'
EOF
# output: foo='1' bar='x' zee='UNSET' others='one two'
 

CrossLoop is offering their unlimited Annual MySupport Plan for $179.99.

I’ve wondered now and then about how much such a thing might be worth.

 

I’m about to watch District 9 and noticed the VLC icon has an amusing twist.

- image source

 

I’ve been using CrossLoop to remotely install the free version of LogMeIn for a while now. CrossLoop would not be necessary except that one of the restrictions in LogMeIn’s free version is that the installer is crippled.

So, I like the idea of LogMeIn’s new Express offering. It may take me closer to one-stop shopping.

via Download Squad, Lifehacker

– update: You might save some time by having your remote users download the express client directly.

 

I’m finally ready to begin. Welcome!

© 2011 mcstafford.com Suffusion theme by Sayontan Sinha