Sunday, January 27, 2013

HTTPS and drop in Google Web Master Tools Impressions

Switched site to HTTPS and impressions and visits plummeted

In an attempt to resolve the (No Provided) issue in Google Analytics I have switched our site Kingston Search Engine Optimization [yes I am doing SEO backlinking there :)] to HTTPS and experienced a massive drop in impressions and visits.

Google Analytics reported no change in actual visits so the issue was left alone to hopefully sort itself out; but it didn't. By the way switching to HTTPS will not resolve the missing keywords in GA, if you analyze the browser requests you will notice Google just plainly strips them from the referral header information.

Solution to HTTPS impression drop

This was a mystery for a while until today when I found a solution which is very simple. By default Google Web Master Tools creates and tracks sites under HTTP protocol, and treats HTTPS as different sites entirely, just like it treats www.webdesign.danols.com and webdesign.danols.com as separate sites. Creating a new entry through 'Add a Site' and including the protocol resolves the issue, ex. 'https://webdesign.danols.com'; and luckily Google Web Master Tools will keeps all the history data from before the HTTPS switch.

If this post helps I ask that you do +1 or share it, or even better follow me on twitter @danielsokolows

Thursday, January 10, 2013

Django Template Eclipse Editor Plugin

Aptana Eclipse Django template editor alternative

A solid lightweight alternative to Aptana Django template editor Eclipse plug-in. Definitively worth at a test drive - which is what I am doing now - since I have refrained from installing the Aptana alternative due to it's dependencies.

You can download it here: Django Editor - plug-in for Eclipse. One shortcoming however is that HTML and JS editing is bare bones with no content assist, this is expected thought and can be mitigated by switching to a specialized editor as needed.

Friday, January 4, 2013

Setting up ZOTAC ZBOX nano AD Remote for XBMC

Getting the Windows, Info and Colored buttons to work

The included Zotac remote is Windows MCERemote compatible but the additional buttons (Windows, Info, Colored buttons) will not work out of the box. The XBMC MCERemote add-on will fail with:

 * Warning
 * The ReportMappingTable registry key is not present
 * No Microsoft remote is installed

Good News

But before I begin, if this helps you please do +1 or share it as that helps me.

So take the MCERemote registry files, this, this,0 and this thread and a 3 hours and you get a tweaked Zotac Remote Registry Fix below; it labels all keys I could discover and maps some as follow:

  • The Windows remote key to Win keyboard key (perfect if you are running Windows 8)
  • The Colored Buttons to Ctrl 1 through 4
  • The Info button to 'Ctrl D' - XBMC display info
  • [T] Teletext? key to send 'T' - XBMC toggles subtitlies
  • The '≡' right of 'T' to send 'C' - XBMC display contextual menu

Copy and paste the below into a file on your dekstop named 'zotact.reg' and double click on it and then restart your computer. If you have any issues feel free to contact me and I will try to assist and if you do find this helpful do follow me on twitter: @danielsokolows.

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\HidIr\Remotes\745a17a0-74d3-11d0-b6fe-00a0c90f57df]
"RemoteName"="RC6 based MCE remote for Philips(OVU710001/00 OTS)"
"EnableDebounce"=dword:00000000
"EnableVendorPassThrough"=dword:00000001
"DecoderID"=dword:00000001
"CodeSetID"=dword:00000000
"CodeBitLen"=dword:00000020
"CodeSetNum0"=dword:00000001
"CodeSetNum1"=dword:00000002
"CodeSetNum2"=dword:00000003
"CodeSetNum3"=dword:00000004
"CodeSetNumMask"=dword:00007000
"CodeSetNumShiftBits"=dword:0000000c
"CodeMatchMask"=dword:ffff0f00
"CodeMatchValue"=dword:80340400
"DataMask"=dword:000000ff
"DataShiftBits"=dword:00000000
"ReportLength"=dword:00000003
"ReportDescriptor"=hex:05,0c,09,01,a1,01,85,01,19,00,2a,3c,02,15,00,26,3c,02,\
  95,01,75,10,81,00,c0,06,bc,ff,09,88,a1,01,85,02,19,01,29,ff,15,00,25,01,95,\
  01,75,08,81,00,c0,05,01,09,80,a1,01,85,03,19,01,29,ff,15,01,25,ff,95,01,75,\
  08,81,00,c0,05,01,09,06,a1,01,85,04,05,07,19,e0,29,e8,75,01,95,08,81,02,19,\
  00,29,90,26,ff,00,75,08,95,01,81,00,c0
"ReportMappingTable"=hex:\
5d,00,00,00,04,08,00,\ ; Green Windows key - modified to send Keyboard Window key. Original: 5d,00,00,00,02,0d,00,
83,00,00,00,01,24,02,\ ; Button '<-' (Back)
cb,00,00,00,04,01,07,\ ; Info '(i)' - modified to send ctrl-D. Original cb,00,00,00,01,09,02,
58,00,00,00,04,00,52,\ 
59,00,00,00,04,00,51,\
5a,00,00,00,04,00,50,\
5b,00,00,00,04,00,4f,\
5c,00,00,00,04,00,28,\
2c,00,00,00,01,b0,00,\ ; Play 
30,00,00,00,01,b1,00,\ ; Pause
31,00,00,00,01,b7,00,\ ; Stop
37,00,00,00,01,b2,00,\ ; Record
28,00,00,00,01,b3,00,\ ; Forward
29,00,00,00,01,b4,00,\ ; Rewind
21,00,00,00,01,b6,00,\ ; Button '|<'
20,00,00,00,01,b5,00,\ ; Button '>|'
10,00,00,00,01,e9,00,\ ; Up Arrow
11,00,00,00,01,ea,00,\ ; Down Arrow
0d,00,00,00,01,e2,00,\ ; Mute
4a,00,00,00,02,2b,00,\
1e,00,00,00,01,9c,00,\ ; Channel '+' Button
1f,00,00,00,01,9d,00,\ ; Channel '-' Button
0c,00,00,00,03,82,00,\
8e,00,00,00,03,83,00,\ ; Red Power '|'
3d,00,00,00,03,82,00,\ ; Red Power 'O'
00,00,00,00,04,00,27,\ ; Button '0'
01,00,00,00,04,00,1e,\ ; Button '1'
02,00,00,00,04,00,1f,\ ; Button '2'
03,00,00,00,04,00,20,\ ; Button '3'
04,00,00,00,04,00,21,\ ; Button '4'
05,00,00,00,04,00,22,\ ; Button '5'
06,00,00,00,04,00,23,\ ; Button '6'
07,00,00,00,04,00,24,\ ; Button '7'
08,00,00,00,04,00,25,\ ; Button '8'
09,00,00,00,04,00,26,\ ; Button '9'
3a,00,00,00,04,00,29,\ ; Button 'CLEAR'
34,00,00,00,04,00,28,\ ; Button 'ENTER'
32,00,00,00,04,02,20,\ ; Button '#'
33,00,00,00,04,02,25,\ ; Button '*'
2f,00,00,00,04,00,17,\ ; Button '[T]' - modified to send 'T' 
6d,00,00,00,04,05,1e,\ ; Red - modified to send 'Ctrl-Alt-1'. Original: 6d,00,00,00,02,5b,00,
6e,00,00,00,04,05,1f,\ ; Green - modified to send 'Ctrl-Alt-2'. Original: 6e,00,00,00,02,5c,00,
6f,00,00,00,04,05,20,\ ; Yellow - modified to send 'Ctrl-Alt-3'. Original: 6f,00,00,00,02,5d,00,
70,00,00,00,04,05,21,\ ; Blue - modified to send 'Ctrl-Alt-4'. Original: 70,00,00,00,02,5e,00,
3e,00,00,00,04,00,06,\ ; Button '=' to the right of [T] modified to send 'C'. Orignal: 3e,00,00,00,01,8d,00,
2e,00,00,00,02,25,00,\
87,00,00,00,02,47,00,\
9b,00,00,00,02,48,00,\
89,00,00,00,02,49,00,\
9c,00,00,00,02,4a,00,\
4f,00,00,00,02,50,00,\
9d,00,00,00,02,3c,00,\
9e,00,00,00,02,3d,00,\
54,00,00,00,02,24,00,\
85,00,00,00,02,4b,00,\
4e,00,00,00,02,4c,00,\
4b,00,00,00,02,4d,00,\
c9,00,00,00,02,51,00,\
42,00,00,00,02,28,00,\
a8,00,00,00,02,32,00,\
a9,00,00,00,02,33,00,\
aa,00,00,00,02,34,00,\
ab,00,00,00,02,35,00,\
ac,00,00,00,02,36,00,\
ad,00,00,00,02,37,00,\
ae,00,00,00,02,38,00,\
af,00,00,00,02,39,00,\
b1,00,00,00,02,3a,00,\
b2,00,00,00,02,80,00,\
94,00,00,00,02,81,00,\
95,00,00,00,02,6f,00,\
84,00,00,00,01,08,02,\
f7,00,00,00,02,27,00,\
0f,00,00,00,02,4f,00,\
78,00,00,00,02,3e,00,\
79,00,00,00,02,3f,00,\
7a,00,00,00,02,40,00,\
8d,00,00,00,02,6a,00,\
8f,00,00,00,02,2c,00,\
50,00,00,00,02,2d,00,\
b3,00,00,00,02,52,00,\
b4,00,00,00,02,53,00,\
b5,00,00,00,02,54,00,\
b6,00,00,00,02,55,00,\
c0,00,00,00,02,56,00,\
c2,00,00,00,02,57,00,\
c1,00,00,00,02,58,00,\
c3,00,00,00,02,59,00,\
40,00,00,00,02,2e,00,\
ef,00,00,00,02,2f,00,\
cd,00,00,00,02,30,00,\
80,00,00,00,02,31,00,\
90,00,00,00,02,44,00,\
f8,00,00,00,02,78,00,\
0e,00,00,00,02,41,00,\
0b,00,00,00,02,42,00

FreeSWITCH Call Audio Stuttering Issues

Reduce VOIP audio stuttering by increasing deamon priority

On occassion our FreeSWITCH Linode VPS stutter which I believe is because the server overall gets a little busy with everything else that is installed. One noticeable way tp reduce or almost eliminate this is to run the FreeSWITCH VOIP daemon in real time priority. But before I begin please do +1 or share if it helps you as it helps me.

On Ubuntu/Debian chaning FreeSWITCH priority is easily accomplished by modifying the `/etc/init.d/freeswitch` start-up script and adding the `rc` real time execute options to the `DAEMON_ARGS` argument – but if you want set the priority even higher scroll to bottom of post.

An example of a FreeSWITCH init.d script can be found on the FreeSWITCH Wiki page which - I think is more complete then the sample included in the source files.

#!/bin/bash
### BEGIN INIT INFO
# Provides:          freeswitch
# Required-Start:    $local_fs $remote_fs $network
# Required-Stop:     $local_fs $remote_fs $network
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Description:       FreeSWITCH debian init script.
# Author: Matthew Williams
#
### END INIT INFO
# Do NOT "set -e"

# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin
DESC="Freeswitch"
NAME=freeswitch
DAEMON=/usr/local/freeswitch/bin/$NAME
DAEMON_ARGS="-nc -np" # -rp is for real-time priority, -np for normal system priority
PIDFILE=/usr/local/freeswitch/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME

FS_USER=freeswitch
FS_GROUP=daemon

# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0

# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME

# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh

# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions

#
# Function that sets ulimit values for the daemon
#
do_setlimits() {
        ulimit -c unlimited
        ulimit -d unlimited
        ulimit -f unlimited
        ulimit -i unlimited
        ulimit -n 999999
        ulimit -q unlimited
        ulimit -u unlimited
        ulimit -v unlimited
        ulimit -x unlimited
        ulimit -s 240
        ulimit -l unlimited
        return 0
}

#
# Function that starts the daemon/service
#
do_start()
{
 # Set user to run as
        if [ $FS_USER ] ; then
   DAEMON_ARGS="`echo $DAEMON_ARGS` -u $FS_USER"
        fi
 # Set group to run as
        if [ $FS_GROUP ] ; then
          DAEMON_ARGS="`echo $DAEMON_ARGS` -g $FS_GROUP"
        fi

        # Return
        #   0 if daemon has been started
        #   1 if daemon was already running
        #   2 if daemon could not be started
        start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null -- \
                || return 1
        do_setlimits
        start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
                $DAEMON_ARGS \
                || return 2
        # Add code here, if necessary, that waits for the process to be ready
        # to handle requests from services started subsequently which depend
        # on this one.  As a last resort, sleep for some time.
}

#
# Function that stops the daemon/service
#
do_stop()
{
        # Return
        #   0 if daemon has been stopped
        #   1 if daemon was already stopped
        #   2 if daemon could not be stopped
        #   other if a failure occurred
        start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
        RETVAL="$?"
        [ "$RETVAL" = 2 ] && return 2
        # Wait for children to finish too if this is a daemon that forks
        # and if the daemon is only ever run from this initscript.
        # If the above conditions are not satisfied then add some other code
        # that waits for the process to drop all resources that could be
        # needed by services started subsequently.  A last resort is to
        # sleep for some time.
        start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
        [ "$?" = 2 ] && return 2
        # Many daemons don't delete their pidfiles when they exit.
        rm -f $PIDFILE
        return "$RETVAL"
}

#
# Function that sends a SIGHUP to the daemon/service
#
do_reload() {
        #
        # If the daemon can reload its configuration without
        # restarting (for example, when it is sent a SIGHUP),
        # then implement that here.
        #
        start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
        return 0
}

case "$1" in
  start)
        [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
        do_start
        case "$?" in
                0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
                2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
        esac
        ;;
  stop)
        [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
        do_stop
        case "$?" in
                0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
                2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
        esac
        ;;
  #reload|force-reload)
        #
        # If do_reload() is not implemented then leave this commented out
        # and leave 'force-reload' as an alias for 'restart'.
        #
        #log_daemon_msg "Reloading $DESC" "$NAME"
        #do_reload
        #log_end_msg $?
        #;;
  restart|force-reload)
        #
        # If the "reload" option is implemented then remove the
        # 'force-reload' alias
        #
        log_daemon_msg "Restarting $DESC" "$NAME"
        do_stop
        case "$?" in
          0|1)
                do_start
                case "$?" in
                        0) log_end_msg 0 ;;
                        1) log_end_msg 1 ;; # Old process is still running
                        *) log_end_msg 1 ;; # Failed to start
                esac
                ;;
          *)
                # Failed to stop
                log_end_msg 1
                ;;
        esac
        ;;
  *)
        #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
        echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
        exit 3
        ;;
esac

Setting the deamon priority even higher

To set the priority even higher you used to be able to pass the system default priority `np` option to FreeSWITCH executable and then the desired nice level directly to the `start-stop-deamon` but as of Jan 2013 '-np' option defaults to priority 19.

Use the below work around which changes the priority after freeswitch starts up.

#!/bin/bash
### BEGIN INIT INFO
...
DAEMON_ARGS="-nc -rp" # -rp is for real-time priority, -np for normal system priority, -lp for low priority
...
        sstart-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null -- \
                || return 1
        do_setlimits
        start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
                $DAEMON_ARGS \
                || return 2
        ...
        # increase priority further, using -20 is not recommended
        sleep 15 # wait for all children to start
        renice -n -19 -u freeswitch

Use UDP Transport instead of TCP

The last tweak that might help is using UDP. This transport protocol has less overhead as for one it does not require packet acknowledgement. Check your client and confirm the UDP is selected; speaking of VOIP clients I recommend open source Linphone - a multi line and multi OS (Android, Windows, Linux, etc) client; the latest snapshot builds work the best in my experience.


FreeSWITCH Command Line Options

For a list of all available FreeSWITCH command options see this Command Line wiki page.