Wednesday, April 17, 2013

Auto-generating setters and getters in Perl with Moose

As part of a project for work interfacing with the RDS encoder for the radio station (an Inovonics Model 730) I thought, "wouldn't it be nice to have a Perl object that provides a complete interface to this device?"  The only trouble is that the device takes a lot of different commands, and it would be really tedious to write sub set_foo { ... }; sub get_foo { ... } umpteen million times for every last command / datum the encoder supported, since every set_foo { ... } was going to boil down to:

sub set_foo {
    my ($self, $value) = @_;
    return _set('foo', $value);
}

sub get_foo {
    my $self = shift;
    return _get('foo');
}

Where _set() and _get() took care of the actual business of communicating with the encoder.

Now, I could have done this in Vim with regular expressions - just copy/paste and use the regex to change the appropriate things. Still tedious, though. I also could have done something like this:

sub set_property {
    my ($self, $property, $value) = @_;
    return _set($property, $value);
}

sub get_property {
    my ($self, $property) = @_;
    return _get($property);
}

And that would have worked fine. I could have put some code in there to throw an exception on an invalid property, maybe something to validate the values based on the property name, all that sort of thing. But Moose gives us a nifty trick to avoid having to validate the property name:

    package MooseSketch;
    use Moose;

    my $meta = __PACKAGE__->meta;
    foreach my $prop (qw/foo bar baz bak/) {
        $meta->add_method(qq/set_$prop/, sub { 
                my $self = shift;
                my $value = shift;
                return $self->_set($prop, $value);
            }
        );
        $meta->add_method(qq/get_$prop/, sub { 
                my $self = shift;
                return $self->_get($prop);
            }
        );
    }

This $meta business comes from Class::MOP::Class, which allows us to do introspection and manipulation of Perl 5 objects. So with Class::MOP::Class, I can add or remove methods programatically at runtime, or even create entire classes. Neat, huh?

Hope you find this useful. I know I sure will. Many thanks to the good people over at Stack Overflow who helped me figure this out. My original question: How to auto-generate a bunch of setters/getters tied to a network service in Moose?

Monday, February 11, 2013

Generating a Word document with Perl and Win32::OLE

I'm about to have to throw this particular bit of code away, as I'm not able to get this to work from Scheduled Tasks on Windows 7.  Before I sent it to the bit bucket, however, I thought I'd post it here with the hope that someone will find it useful.



# Expects arguments as a hashref with the keys:
# # log_date: Date of the log
# # data: an arrayref of arrayrefs.  First line is treated as column headings, following lines are treated as data.
#
# A double horizontal rule will be added between the column headings and the data.
#
# NB: The reason that everything gets its own object (e.g. "my $tables = $doc->Tables; my $table = $tables->Add(...);")
# is not (neccessarily) for "Law of Demeter" reasons, but rather MS recommended practice when
# automating Office applications from Visual Studio (and by extension, OLE): http://support.microsoft.com/kb/317109
# Experimentally, I have noticed instances of the Word executable remaining in memory after program exit;
# refactoring the code in this way is an attempt to deal with that issue.
# 11 Feb 2013 KP
sub _print_with_word {
    my $args = shift;

    if ( ref $args ne q/HASH/ ) {
        croak(
            sprintf q/Usage: %s /,
            ( caller 0 )[$FUNCTION_NAME_POSITION]
        );
    }
    foreach my $required_key (qw/log_date data/) {
        if ( !$args->{$required_key} ) {
            croak(qq/Missing required key '$required_key' in args/);
        }
    }

    my $header = _slurp_file( $CONFIG->{'_'}{'header_file'} );
    my $footer = _slurp_file( $CONFIG->{'_'}{'footer_file'} );

    my @rows = @{ $args->{'data'} };

    my $word   = Win32::OLE->new( 'Word.Application', 'Quit' );
    _debug(q/Created new Word object/);

    my $doc    = $word->Documents->Add();
    _debug(q/Added new document/);

    my $selection = $word->Selection;
    _debug(q/Got Selection instance/);    

    
    my $selection_paragraph_format = $selection->ParagraphFormat;
    _debug(q/Got ParagraphFormat instance for selection/);
    
    $selection_paragraph_format->{'SpaceAfter'} = 0;
    _debug(q/Set paragraph spacing for header/);
    
    $selection->TypeText( { 'Text' => qq/$header\n\n/, } );
    _debug(q/Typing header into selection/);
    
    $selection->BoldRun();
    _debug(q/started bold run/);
    
    $selection_paragraph_format->{'Alignment'} = wdAlignParagraphRight;
    _debug(q/Set date paragraph format to right/);
    
    $selection->TypeText(
        {
            'Text' => Time::Piece->strptime(
                $args->{'log_date'}, q|%m/%d/%Y %H:%M:%S|
              )->strftime(qq/%A %B %d %Y\n\n/)
        }
    );
    _debug(q/Typing date header into selection/);
    
    $selection->BoldRun();
    _debug(q/End bold run/);

    my $range  = $selection->Range;
    _debug(q/Got Range instance from selection/);
    
    my $tables = $doc->Tables;
    _debug(q/Got Tables collection from document/);
    
    my $table  = $tables->Add( $range, scalar @rows, scalar @{ $rows[0] } );
    _debug(q/Added new table to document/);
    
    for my $rownum ( 0 .. $#rows ) {
        my $cols = $rows[$rownum];
        for my $colnum ( 0 .. $#{ $rows[$rownum] } ) {
            my @cellpos    = ( $rownum + 1, $colnum + 1 );
            my $cell       = $table->Cell(@cellpos);
            _debug(qq/Got cell at ($cellpos[0], $cellpos[1]) /);
            
            my $cell_range = $cell->Range;
            _debug(qq/Got Range instance for cell at ($cellpos[0], $cellpos[1])/);
            
            $cell_range->{'Text'} = $cols->[$colnum];
            _debug(qq/Set text of Range for cell at ($cellpos[0], $cellpos[1]) to "$cols->[$colnum]"/);
        }
    }
    my $rows                 = $table->Rows;
    _debug(q/Got Rows collection from table/);
    
    my $first_row            = $rows->First;
    _debug(q/Got first Row object (header row) from Rows collection/);
    
    my $first_row_range      = $rows->First->Range;
    _debug(q/Got Range instance for header row/);
    
    my $first_row_range_font = $first_row_range->Font;
    _debug(q/Got Font instance for header row Range/);
    
    $first_row_range_font->{'Bold'} = 1;
    _debug(q/Set header row Range Font to bold/);
    
    my $first_row_range_paragraph_format = $first_row_range->ParagraphFormat;
    _debug(q/Got ParagraphFormat instance for header row/);
    
    $first_row_range_paragraph_format->{'Alignment'} = wdAlignParagraphCenter;
    _debug(q/Set alignment for table headers to center/);
    
    my $first_row_bottom_border = $first_row->Borders(wdBorderBottom);
    _debug(q/Got Border instance for bottom of header row/);
    
    @{$first_row_bottom_border}{qw/LineStyle LineWidth/} =
      ( wdLineStyleDouble, wdLineWidth100pt );
    _debug(q/Set bottom border of header row to 10 pt double line/);
      
    my $paragraphs            = $doc->Paragraphs;
    _debug(q/Got Paragraphs collection from document/);
    
    my $last_paragraph        = $paragraphs->Last;
    _debug(q/Got last paragraph from document/);
    
    my $last_paragraph_format = $last_paragraph->Format;
    _debug(q/Got Format instance for last paragraph/);
    
    $last_paragraph_format->{'Alignment'}  = wdAlignParagraphLeft;
    _debug(q/Set last paragraph alignment to left/);
    
    $last_paragraph_format->{'SpaceAfter'} = 0;
    _debug(q/Set spacing on last paragraph/);
    
    my $last_paragraph_range = $last_paragraph->Range;
    _debug(q/Got Range instance for last paragraph/);
    
    $last_paragraph_range->InsertAfter( { 'Text' => qq/\n$footer/ } );
    _debug(q/Inserting footer after last paragraph range/);
    
    #$doc->SaveAs( { 'Filename' => Cwd::getcwd . '/test.doc' } );
    
    $doc->PrintOut();
    _debug(q/Printed document/);
    
    $doc->Close( { 'SaveChanges' => wdDoNotSaveChanges } );
    _debug(q/Close document without saving/);
    
    $word->Quit();
    _debug(q/Quit Word/);
    
    return 1;
}

Thursday, September 13, 2012

"Wire-to-wire" emulation with Proxy ARP

In my previous post, I stated a goal of mimicing the connectivity provided by the microwave T-1 connecting the studio and TV transmitter at my work.  I'm pleased to say that I've accomplished that... mostly.  There are still a few peculiar kinks to work out.

It all works through the magic of Proxy ARP.  Basically, what Proxy ARP does is allow one machine to answer ARP queries on behalf of another machine, saying, in effect "I'll take that packet; I know how to get to that machine".  The answering machine then forwards the packet on to the appropriate machine.  This differs from packet routing in that it happens in Layer 2 of IP, rather than Layer 3 (routing).

In practice, what you have to do is set up static routes on the host (which is acting in this case as a bridge) doing Proxy ARP for all hosts the bridge is providing the connection for, then turn on IP forwarding in the kernel, and turn on Proxy ARP for the appropriate interfaces.  Since I have an IPsec / L2TP VPN set up, the interfaces are going to be ppp0 for the VPN (since it's L2TP and IPsec, PPP is involved, where with straight IPsec it wouldn't be) and eth0 for the local network. I'm also going to have to do the same thing on the firewall out at the transmitter.

So, first of all, the studio.  This is based on Using Linux as an L2TP/IPsec VPN client by Jacco de Leeuw.

The xl2tpd configuration file at the studio:

; File: /etc/xl2tpd/xl2tpd.conf at STUDIO
[lac Transmitter]
; transmitter public IP obfuscated for security reasons
  lns = X.X.X.10 
  require chap = yes
  refuse pap = yes
  require authentication = yes
  ; Name should be the same as the username in the PPP authentication!
  name = bridge
  ppp debug = yes
  pppoptfile = /etc/ppp/options.l2tpd.client
  length bit = yes

Note that I'm not using the l2tp-secrets file as it really doesn't provide any additional security, as far as I can tell.

The PPP options file at the studio:
# /etc/ppp/options.l2tpd.client at STUDIO

ipcp-accept-local
ipcp-accept-remote
refuse-eap
noccp
noauth
crtscts
mtu 1410
mru 1410
nodefaultroute
debug
lock
connect-delay 5000

PPP authentication is done in /etc/ppp/chap-secrets:

# File: /etc/ppp/chap-secrets
# Secrets for authentication using CHAP
# client        server          secret                  IP addresses
bridge          *               "supersecret"
*               bridge          "supersecret"

To set up the static routes, I have set up two scripts in /etc/ppp/ip-up.d. Scripts in this directory are executed by pppd as ip-up scripts - scripts that are executed when the PPP interface is brought up. These set up static routing and turn on Proxy ARP.

#!/bin/bash

# File: /etc/ppp/ip-up.d/0001routes

PPP_INTERFACE=$1
LOCAL_ADDR=$4
REMOTE_ADDR=$5

# These are all the hosts that should be accessible both via the VPN
HOSTS=(
10.1.1.10
10.1.1.11
10.1.1.12
10.1.1.13
)

for HOST in ${HOSTS[*]}
do
        route add -host $HOST $PPP_INTERFACE
done


#!/bin/bash

# File: /etc/ppp/ip-up.d/0002proxyarp

for INTERFACE in ppp0 eth0 ; do
        /sbin/sysctl -w net.ipv4.conf.${INTERFACE}.proxy_arp=1
done




The ipsec (openswan) configuration file at the studio:


# File: /etc/ipsec.conf
# 
config setup
        protostack=netkey
conn Transmitter
        #
        # ----------------------------------------------------------
        # Use a Preshared Key. Disable Perfect Forward Secrecy.
        # Initiate rekeying.
        # Connection type _must_ be Transport Mode.
        #
        authby=secret
        pfs=no
        rekey=yes
        keyingtries=3
        type=transport
        #
        # ----------------------------------------------------------
        # The local Linux machine that connects as a client.
        #
        # The external network interface is used to connect to the server.
        # If you want to use a different interface or if there is no
        # defaultroute, you can use:   left=your.ip.addr.ess
        left=%defaultroute
        #
        leftprotoport=17/1701
        #
        # ----------------------------------------------------------
        # The remote server.
        #
        # Connect to the server at this IP address. (obfuscated for security)
        right=X.X.X.10
        #
        rightprotoport=17/1701
        # ----------------------------------------------------------
        #
        # Change 'ignore' to 'add' to enable this configuration.
        #
        auto=add
        DPDACTion=restart_by_peer
        dpdtimeout=30
        dpddelay=3

Next, the transmitter side.  Again, starting with xl2tpd:



; File: /etc/xl2tpd/xl2tpd.conf

[global]
        ipsec saref = no
        listen-addr = X.X.X.10

[lns default]
        ip range = 10.1.1.100 - 10.1.1.255
        local ip = 10.1.1.1
        assign ip = yes
        require chap = yes
        refuse pap = yes
        require authentication = yes
        name = Transmitter
        ppp debug = no
        pppoptfile = /etc/ppp/options.xl2tpd
        length bit = yes

And now PPP:

# File: /etc/ppp/options.xl2tpd

refuse-mschap-v2
refuse-mschap
ms-dns 8.8.8.8
asyncmap 0
auth
lock
hide-password
local
#debug
name l2tpd
#proxyarp
lcp-echo-interval 30
lcp-echo-failure 4


# File: /etc/ppp/chap-secrets

# Secrets for authentication using CHAP
# client                server                  secret                  IP addresses
user1                   *                       "secret1"               10.1.1.0/24
*                       user1                   "secret1"               10.1.1.0/24
user2                   *                       "secret2"               10.1.1.0/24
*                       user2                   "secret2"               10.1.1.0/24
bridge                  *                       "supersecret"           10.1.1.2
*                       bridge                  "supersecret"           10.1.1.2

Here I want to pause and note something. I have my regular "road warrior" users set up to get any address in 10.1.1.0/24, and in my xl2tpd config, I have that further restricted to addresses in the range of .100 - .255. The "bridge" user is restricted to 10.1.1.2, which is how I allow my "road warriors" and the bridge at the studio to coexist. The appropriate scripts in /etc/ppp/ip-up.d at the transmitter:


#!/bin/bash

# File: /etc/ppp/ip-up.d/0001routes
# The hosts here are made accessible to the transmitter network via the firewall, which is acting as a bridge similar to the one at the studio

PPP_INTERFACE=$1
LOCAL_ADDR=$4
REMOTE_ADDR=$5


# only set up the routes for the VPN bridge
case $REMOTE_ADDR in
10.1.1.2)
        for HOST in     10.1.1.20 \
                        10.1.1.21 \
                        10.1.1.22 \
                        10.1.1.23 ; do
                route add -host $HOST $1
        done
esac



#!/bin/bash
PPP_INTERFACE=$1
LOCAL_ADDR=$4
REMOTE_ADDR=$5

# File: /etc/ppp/ip-up.d/0002proxyarp
# only set up Proxy ARP for the VPN bridge
case $REMOTE_ADDR in
10.1.1.2)
        for INTERFACE in $PPP_INTERFACE eth0 ; do
                /sbin/sysctl -w net.ipv4.conf.${INTERFACE}.proxy_arp=1
        done
esac

And finally the ipsec (openswan) configuration, based on Configure L2TP/IPSec VPN on Ubuntu by Riobard Zhan:

#
# File: /etc/ipsec.conf
#

# Transmitter Firewall Side

config setup
    oe=off
    protostack=netkey
    nat_traversal=yes

conn L2TP-PSK-NAT
    rightsubnet=vhost:%no
    also=L2TP-PSK-noNAT

conn L2TP-PSK-noNAT
    authby=secret
    pfs=no
    auto=add
    keyingtries=3
    rekey=no
    ikelifetime=8h
    keylife=1h
    type=transport
        left=X.X.X.10
    leftprotoport=17/1701
    right=%any
    rightprotoport=17/%any
    dpdaction=restart_by_peer
    dpdtimeout=30
    dpddelay=3

So the way to accomplish this "wire-to-wire" emulation is with two bridges, one for each network to be bridged. If you want to try something like this, I wish you the best of luck, and I hope my experiences help.

Tuesday, August 21, 2012

Setting up an IPsec VPN

Posted here mostly for my own reference, but mayhap this will prove useful for someone else.

The setup: a remote network at the TV transmitter, with Internet access both through a commercial provider and a dedicated, but increasingly unreliable, microwave T-1 link to the studio.

The goal: mimic the behavior of the microwave T-1 (though not the unreliability, of course) using the commercial provider's service.  Set up a "virtual wire" between the network at the transmitter and the transmitter at the studio.

I've chosen an IPsec VPN to do this, and I've set things up largely as in Ch. 35 of Linux Home Networking. At the present time I've managed to achieve bidirectional communication between hosts (but not the routers/firewalls) on each network, but to do that I had to set up a private test network as shown below.


So as you can see here, I have a couple of virtual machines set up on the 172.16.1.0/24 network, which is accessible only to those VM's.  The IPsec tunnel is established between Router VM and Transmitter Firewall.  Note that I have replaced Transmitter Firewall's public IP address with "X.X.X.10" for security.

With this setup, I can achieve bidrectional communication between both networks.  Host A can reach Client VM, and Client VM can reach Host A.

Here is the relevant ipsec.conf on Router VM:

#
# File: /etc/ipsec.conf
#
# VPN Test Router VM side
config setup
        protostack=netkey
        oe=off
        nat_traversal=yes

# LEFT: Studio
# RIGHT: Transmitter
conn nettonet
  left=192.168.152.188            # Public Internet IP address of the
                                  # LEFT VPN device
  leftsubnet=172.16.1.0/24        # Subnet protected by the LEFT VPN device
  leftrsasigkey=*removed*

  right=X.X.X.10                  # Public Internet IP address of
                                  # the RIGHT VPN device
  rightsubnet=10.1.1.0/24         # Subnet protected by the RIGHT VPN device
  rightrsasigkey=*removed*
  rightnexthop=%defaultroute
  auto=start


Note here that I'm using RSA keys, rather than PSK's.  The key signatures have been removed for security.

The ipsec.conf on Transmitter Firewall is slightly different:


#
# File: /etc/ipsec.conf
#

# Transmitter Firewall Side

config setup
    oe=off
    protostack=netkey
    nat_traversal=yes

# LEFT: Studio
# RIGHT: Transmitter
conn nettonet
  left=10.1.0.2                   # Public Internet IP address of the
                                  # LEFT VPN device
  leftsubnet=172.16.1.0/24        # Subnet protected by the LEFT VPN device
  leftid=192.168.152.188
  leftrsasigkey=*removed*
  right=X.X.X.10                  # Public Internet IP address of
                                  # the RIGHT VPN device
  rightsubnet=10.1.1.0/24         # Subnet protected by the RIGHT VPN device
  rightrsasigkey=*removed*
  auto=start                      # authorizes and starts this connection
                                  # on booting

Here you'll notice that the argument to left= is 10.1.0.2, which is the public (again, these IP's have been obfuscated for security's sake) address of Studio Firewall. This is because Router VM's ultimate path to the Internet is through Studio Firewall via NAT.

Speaking of NAT, I should point out that there is no NAT of any kind being performed (currently) on Router VM or Transmitter Firewall.  Instead, the entire 172.16.1.0/24 network is visible to the 10.1.1.0/24 network at the transmitter, just as any other public network would be.

I'll note that this does not accomplish the stated goal at the beginning of this post: set up a "virtual wire" between the 10.1.1.0/24 network at the studio and the 10.1.1.0/24 network at the transmitter.  It may turn out to be the case that this "virtual wire" is extremely complicated with regard to routing and suchlike (since we would be using the same IP block on both ends) .  What this does give us, however, is a place to work from.

Friday, December 30, 2011

Making a homebrew HDTV antenna

Since I work for a TV station now, and we're web-casting a lot of University sports, it behooves me to get more familiar with sports broadcasting, and one of the ways I'm doing that is to watch sports on TV.  Now, I'm still too cheap to pay for cable TV, I'm on my holiday break, and most importantly I haven't built an antenna since my J-pole, so I figured I ought to build myself a TV antenna. 

I'm basing this antenna on plans I found for a UHF bowtie antenna here.  Now, being the sort of guy I am, I can't just blindly follow the recipe. :)  I need to screw around with it a bit, and see if I can improve on the design based on my own particular situation. 

I went to TV Fool's signal locator and put in my address.  It gave me a handy list of all the TV broadcast stations in the area, along with their channel assignments (if you're following along at home, note that you need the actual channel assignment, not the virtual channel.  Sometimes these two things are different).  Next, I consulted Wikipedia for a list of TV channels and associated frequencies.  This told me that all the TV stations in town were in the range of 494 MHz to 698 MHz. 

I think it's safe to assume that the original design is tuned for a broader frequency range than I need.  If I tune the design for my narrower range, maybe I can get another dB or two of gain, which will improve my signal quality.  Also, it's more fun that way. :)

Now for the parts.  I went to the hardware store and bought some deck screws, some washers, and a 2 x 4.  They didn't have any 1 x 3's or 2 x 3's, and I didn't much feel like going somewhere else to see what they had.  I also bought a 75Ω to 300Ω balun, as called for in the design (this design has a 300Ω characteristic impedance).  For the antenna bays, I've got some old wire hangers laying around that need to be put to a good use.  I've also got wire laying around that I can use to interconnect the bays.

In the design, each antenna bay is a pair of 14" wires, folded into a "V" whose ends are 3" apart (so an angle of about 25°).  This is a bowtie antenna, so each side of the bay is a dipole 1/2 wavelength long.  14" gives a wavelength of about 420 MHz, well below the minimum frequency I'm looking for. 

Let me pause a moment to detail how I'm calculating the length of the dipole.  Wavelength (λ) is equal to the speed of light (c) divided by the frequency (f).  So:

λ = c/f

An important thing to note here is that c isn't always c, if you take my meaning.  Generally speaking, if someone mentions c in the context of the speed of light, they mean the speed of light (or other electromagnetic radiation) in a vacuum.  In (e.g.) a metal, however, electromagnetic radiation moves more slowly.  So we introduce a velocity factor, a number that describes just how much slower electromagnetic radiation is going to move in the material than in free space.  If we call the velocity factor v, then we get:

λ = cv/f

This is good.  By introducing the velocity factor into the equation, we can more precisely model how electromagnetic radiation (e.g. radio waves) is going to behave in the wire of the dipole.  But I don't have a velocity factor for steel wire (which is what they make wire hangers out of), so I'm just going to use a value of 1 for v

So, back to the antenna, if I want a minimum frequency of 494 MHz, I want to start with a dipole about 12" long.  I can always trim it down later if I need to.

Now, let's get to building!  To start with, I'm going to cut my wire hangers into 8 12" pieces.  And this is tougher than it sounds.  A pair of dikes (diagonal cutters) won't cut it.  Tin snips won't do it.  A stout pair of side-cutters (or "Kleins", electrician's pliers) might do it, but I don't have a pair of those.  What I'm doing instead is taking a big pair of dikes and gripping the wire where I want it to break, then just wiggling the hanger back and forth until it breaks.  Metal fatigue FTW!
8 12" dipoles


As you can see, some of these aren't exactly straight.  A number of wire hangers came from the dry cleaner, and they only have metal on top - the bottom is just thick paper.  So I straightened those as best I could.  I also sanded the center of each dipole because  I'm going to short all the dipoles along each side together at the center.

Dipoles bent so that the distance between each leg is roughly 3"






Here are the bent dipoles.  I've tried to keep the spacing between the two legs to about 3 inches.









Now comes the fun part: drilling the holes and mounting the dipoles.  I got a cordless drill as an early Christmas present; time to put it through its paces!

As per the plans, I drew a line across the board at 2" from one end, then 3 more lines at 5 1/4" intervals (so marks at 2", 7.25", 12.5", and 17.75").  These lines are where the two dipoles in each antenna bay will be placed.




Next, I made two perpendicular marks on each line, 1" apart.  I like things to be even, so I centered the marks, placing them 1.25" from each edge (a 2 x 4 is actually 3.5" wide).  I then drilled pilot holes at each mark for the deck screws.
Here you can see the board with the deck screws already part of the way in.  This makes it easier to place the elements and the connection wire.  I also have two small steel washers on each screw.  The lower holds the dipole element to the board.  The upper will pinch the connection wire between it and the lower washer, providing electrical connectivity.

Next, I added the connection wires between each element. I used insulated wire, and I only stripped those parts of the wire that were going to be in electrical contact with an antenna element.  I've also stripped a place in the center of the antenna to connect the balun.


Here you can see the deck screws where the balun will connect.  Like the other screws, these have washers on them to improve the electrical connection between the wire and the balun.
And this is the antenna with the balun attached.  This is a usable antenna right now, but it's omnidirectional.  Adding a reflector, as recommended in the original plans, will increase the gain of the antenna, but you might want to try this antenna as-is and see how well it works for you. 



I mounted the antenna, sans reflector, in my basement and attached it to my TV.  I'm able to pull in all the stations that TV Fool says are available in my area, including the two analog low-power stations.  But none of those transmitters are more than 30 miles from me, and I don't have any channels from further away.  Once I get the antenna mounted outside, and the reflector attached, I'll report back.







Saturday, April 23, 2011

"What news from Plymouth?"

Well, so far as I am aware, Plymouth continues to be in Massachusetts. If this situation should change, I hope one of you, Dear Readers, will be so good as to tell me.

News in my neck of the woods has nothing to do with Plymouth at all. However, if you're stuck on Plymouth, I suggest this brief riveting look at the court of Elizabeth I (Plymouth was an English colony during her reign).

Now, the news of your humble polymath-in-the-making. To begin with, Dear Reader, you might be wondering why the promised posts from NAB never materialized. This is because I did not go to NAB, and I will not be going to the Radio Ink Convergence Conference either. In fact, I have been disqualified altogether from the Technology Apprenticeship Program, and that's because I got a job at KTBG and KMOS, the public broadcasting service of the University of Central Missouri. I'm an engineer! This is a very exciting time for me - so much to learn! Interning at KCUR taught me a bit about radio (though here we have to worry about a thing called "short-spacing" which means we have to have a cardioid antenna pattern - more on that as I learn about it) but I know nothing (yet) about TV.

One of the things I'll be doing at KTBG/KMOS is applying my IT experience and knowledge to our setup in broadcasting. So there will be some software development for various projects in between my regular engineering duties. For example, a short-term project I have is to take the output from KTBG's automation system and feed it into our new Inovonics RDS encoder. The encoder isn't installed yet - maybe John (the chief engineer for KMOS/KTBG) will let me do that too. If this encoder is anything like the unit at KCUR (also an Inovonics) I don't foresee a lot of difficulty; Inovonics uses RS-232 to feed data to the encoder, and the command syntax should be documented in the manual. So it's just a matter of parsing out the data from the automation system and presenting it in the proper format to the RDS encoder. No sweat.

This past Thursday, I made a presentation to the local SBE chapter on IP security. You can view it here, and maybe I'll make a blog post that elaborates on these points a little more.

Today, at the Ararat Hambash, I took the test to upgrade my amateur radio operator's license from General to Extra (I had previously upgraded from Technician to General at the end of March) and passed! This means I now have authorization to operate on all bands and modes available to the Amateur Radio Service (certain bands and modes are reserved for operators with a given license class). Of course, I still don't have any equipment, but that will come in time.

Friday, March 18, 2011

I'm going to the NAB show!

I recently heard about the NAB's Technology Apprenticeship Program. Basically, this is a program for people starting out in broadcast engineering, or people with skills in other technical disciplines - "IT, digital technologies, ... or other related areas", as the website puts it - to get some hands-on experience in the field. Since that's the line of work I'm trying to get into, I applied, and I was accepted! So here's how my next few months are going to go:

April 9 - 14: I'll be flying out to Las Vegas (on NAB's dime, no less) to the NAB show. There are going to be several activities geared specifically for the apprenticeship program participants, (you know what? I'm going to say "apprentices" from now on. "apprenticeship program participants" is a mouthful) and we apprentices will be meeting with leaders in broadcast technology.

May 18 - 19: I'll be flying out to Silicon Valley for the http://www.radioink.com/ Convergence Conference.

June - July: I complete a two month paid internship at a TV or radio station. No idea what station yet.

Finally, in August, I go to DC for a week to work with NAB's Science and Technology Department to develop a presentation to be delivered via webcast at the end of my visit. If I'm permitted, I'll publish a link or something here.

I'm very excited about all of this. Not only is this going to be a really interesting and unique experience, but this is going to be a great start to my broadcast engineering career.

So stay tuned, Dear Reader, for more thrilling tales of broadcast engineering! ;)