Tuesday, September 22, 2009

use Getopt::Long;

This mornings very short moment of enlightenment was related to the use of Getopt::Long.

I had been messing with passing command line arguments to my server deployment script and had completely failed to get the --verbose flag to work the way I expected.

So I read the perldoc on it and found that I had been going about this the wrong way altogether.

I had this;

my $VERBOSE = 0;
GetOptions( "config=s" => \$config_file,
"verbose=i" => \$VERBOSE,
"modules" => \$INSTALL_MODULES );

print "DEBUG: message" if $VERBOSE;

Then on the command line I had to specify --verbose 1 or --verbose=1, which really wasn't what I had in mind. So this morning the mist on the man page cleared and it all clicked.

If you use "verbose!" => \$VERBOSE, then you can use --noverbose to unset the flag if you have previously set it in your code above. I'm not sure why I moved to using "verbose=i" => \$VERBOSE, but "verbose" => \$VERBOSE was not working as expected.

Anyhow, I was talking to Andy about putting "!" character after the command line flag name and now --verbose sets the variable $VERBOSE and it behaves as I previously expected.

Tuesday, September 15, 2009

HF Lunchbox 1 lives again

This morning I dropped in to see Barry VK5ZBQ. We had talked about catching up to sort out one of the two Codan 6924 HF radios that I purchased at an AHARS members meeting auction.

So this morning was "the day". I had a minor ordeal to get there, including losing my bus ticket, missing the bus, then catching a lift after the car would not start. I arrived about 9am and was undoing the case screws to get down to business shortly afterwards.

Barry has a manual for the Codan 6924 Mark 1, so we looked up various sections that I was curious about. Barry set the rig up on the test bench, powered it up, connected it to the signal generator, selected the frequency for channel 1 and we heard the dual tone from the speaker on the front panel. Win number 1. Then we set about transmitting from the rig. The power meter on the signal generator shows out going power when hitting the antenna test position on the mode selector. So out with the multimeter, leading to the detection of a broken microphone lead.

The chassis can be separated by removing some screws and nuts, so you need tiny fingers or a little tool to hold the nut so you don't loose it. So Barry opted to replace the microphone lead with something a little more robust than the original lintz wire type. Apparently you can't solder it very well. So the new lead went in. Took a little while as its quite a fiddley job. We reassembled the chassis and microphone and connected up the output to the oscilliscope. Fired up the HF rig, tuned to channel 1 and tested it. Win 2. We have a nice upper side band trace on the scope and after a bit of fiddling with the HF radio antenna and dummy loads, we hear the transmitted voice from the HF rig.

At this point I'm very happy, as the radio works properly and we work out that it puts out 8-11 watts PEP. The antenna tuner varies the output power a lot. Need to sit down with it and work out how exactly the tuner works, it has a loverly wound toroid with wiper for continuously variable inductor. Now I'm ready to attack the idea of a VCO in stead of a fixed crystal oscillator.

We break for a cup of tea and Barry explains to me how the upper side band (USB) and lower side band (LSB) filters work in the 6924 and what I'll need if I change the oscillator to a 80 or 40 meter band. Apparently there were kits for this, but I've found no documentation. So I will draw everything up and go back to Barry and run it by him. I think I'll work out what crystals I need and populate the remaining empty crystal oscillator board first to get the hang of it first =)

Now that the weather is warming up, I can spend more time in the radio shed/shack. I've put together a dipole for 40 meters along with a 4:1 balun and suitable cable. Should be fun.


Sunday, September 06, 2009

Thoughts on servers and network services

This is a post that I sent to the Melbourne Wireless mail list. Thought it might be useful for others so I am reproducing it here;

Hi Victor,

Victor wrote:
> > Thanks everyone for the replies so far. At this stage will be sticking with a Intel Atom 330.

I run a dual core atom here, low on power, not particularly fast,but thats the balance you are after if you are going atom I suppose. Always spend as much as you can on RAM! 2GB+

> > When it comes to an OS for the server, I know a little bit (read NOT a
> > lot) about linux, enough to get me through things... Should I look at
> > setting up CentOS on this or is that possibly a bit too "much" for a
> > relative "youngin" into the world of Linux per se.

The only way to learn is to do. Don't let various folks opinions put you off =) There is plenty to learn and lots of different paths to take ;) If you're new to Linux/UNIX then maybe you can head along to your local LUG, Linux User Group. I'm assuming that you are in/around Melbourne so have alook at; http://www.linux.org.au/foss_in_australia/LUGS/VIC

> > I read somewhere that CentOS isn't for the light-hearted?

Centos is geared to be a server OS. It has a few quirks and its configuration like RHEL, is a little different to other Linux distros. I have used RedHat RHEL3,4&5 a lot and Centos mirrors them in functionality, etc My only complaints revolve around; packages in the Perl and web areas are well behind the times and they still use RPM with broken meta package dependencies! If you stick to the default repositories you'll be fine, but the packages are limited. Have a look at EPEL if you need more packages/software...

Generally speaking RHEL is solid enough and stable enough to do most server tasks well. So if Centos lives up to its name of being RHEL with out the irritating license bits then its all good experience on the Resume too...

> > Other possible options is FreeBSD, Debian 4 or Ubuntu 8.x

I have run all the above at work and at home for various uses.

If you really don't have much UNIX/Linux experience then perhaps Ubuntu will give you the least troubles installing and getting around.

Ubuntu is primarily focused at the desktop. The server version has a number of buggy things that are tied to the design decisions around init/startup script and network interface management. Fine desktop. I would recommend it to anyone starting out in Linux. Then you can grow from there...

I run a number of Debian server at home. Solid, stable, but some packages are old. This may not matter in the beginning. Networking is rock solid, more packages that you can poke a stick at. Seriously lots.

FreeBSD I have not been keeping up to date with over the last four years... There was a lot of development in the desktop arena that wasn't interesting, as I primarily used it for servers. Its solid, networking was solid and fast. It was death by compile your own packages. Hopefully this has changed. They have been moving fast, hopefully the ports tree is uptodate. Was the main reason I dropped FreeBSD. Still have NetBSD boxes here for old school non-intel hardware, Alpha, Sun, VAX, etc.

Also, not on your list, but worth a mention is OpenSolaris. I installed it on my laptop. Was pretty happy with it, except no support for my WiFi.

Another thought, to get you going; virtualise! I know it was mentioned else where in this mail thread, though I'd add to it.

I have recommended to folks in our local LUG, put Ubuntu on your machine, install VirtualBox and install the other OSes in virtual machines. More doco; https://help.ubuntu.com/community/VirtualBox

Yes VirtualBox is targeted at Desktop installs with the guest OS in a window, but it gives you a feel for the guest OS with out much investment into building another real machine. You can shut it down and boot it up, tinker with it later. Some videos; http://video.google.com.au/videosearch?q=ubuntu+virtualbox

If you get real serious about virtualisation, perhaps the simplest remote managed VM server is the Oracle Xen based stack. I saw a demo of it at LCA2009 in Hobart. I was quite impressed. Managed through a web browser. Not through some heavily licensed Windows sever like VMWare =P You can play with all the iSCSI stuff and file system mirroring etc, lotsa fun =) Doco on Oravle VM; http://wiki.oracle.com/page/Oracle+VM

VMs are only good if you *really* need separation of different server apps from each other, IMHO. There is a lot of overhead in running VMs, on machines that don't have the virtualisation instructions. I don't run VMs on servers at home any more. The only reason I would is if I have to tinker with different OSes for debugging. Another reason would be snapshot file system backups. I do have a few VMs on my laptop to demo, test code, or compile code...

I'd recommend figuring out what "network services" you want to run and run them on their own interface on the server. Have a look at the 'ip' command. You can run more than on IP address on each physical ethernet interface (NIC). Then you can make the application/service listen on that IP and then tighten up your firewall rules with 'iptables'.

Doco on iptables etc; https://help.ubuntu.com/community/IptablesHowTo
More info here; http://netfilter.org/documentation/

Then once you've played with all that, theres the amazing arena of routing =)

Old school protocols;
- OSPF; http://en.wikipedia.org/wiki/Open_Shortest_Path_First
- BGP; http://en.wikipedia.org/wiki/BGP

New protocols;
- OLSR; http://en.wikipedia.org/wiki/Optimized_Link_State_Routing_Protocol
- B.A.T.M.A.N.; http://en.wikipedia.org/wiki/B.A.T.M.A.N.

- quagga OSPF&BGP routing software; http://www.quagga.net/
- olsrd routing software; http://www.olsr.org/
- batman routing software; http://www.open-mesh.org/

Thought this talk might be interesting; David Rowe presented at Linux.Conf.AU in Hobart this year on the MeshPotato about the village telco model, using B.A.T.M.A.N. as the routing protocol;
talk notes; http://lca2009.linux.org.au/programme/schedule/view_talk/46?day=all
talk slides; http://lca2009.linux.org.au/slides/46.odp
talk video; http://mirror.linux.org.au/linux.conf.au/2009/Friday/46.ogg

Anyhow, have fun with it =)


-- http://vk5fnet.blogspot.com/
Melbwireless mailing list