Marco's Corner

Just another Software Developer's musings

OK, so it’s swim season again for the Tracy Tritons. And we are going to host a big meet with 700+ swimmers age 4 to 18 years plus their families.

Our biggest concern is to make sure, everybody has updated information so that the meet can flow smoothly without much waiting for swimmers or volunteers.

So far we have a PA system around the pool. But the big grass area at the high school where we host the meet is like 150++ meters away from the pool. So our speakers will not reach there. Putting extra speakers that far away from the amp without a good way to run cables would need really heavy-duty cables if it would be possible at all.

So the idea was to find a wireless setup which could be placed somewhere in the grass area where there is a power outlet. The problem here is that most commercial systems have a wireless microphone which reaches 25-35 meters. And they are expensive when you need a larger, outdoor rated system :-(

I’m running a Wi-Fi access point at the meets to basically let people check the meet information based on my mmweb code. So the idea was to add a streaming server to that host so that any Wi-Fi client could actually receive the PA stream as well. So we  set up a special client, which would send the stream to a second Amp somewhere in the field. The Wi-Fi client is based on the internet radio setup from MightyOhm. Unfortunately, the newer OpenWRT sources get pretty close to the flash limit of the Asus WL-520GU. So I had to build a very specialized image for my use.

So far, the setup works fine for a distance of two meters in my living room;-) Let’s see how it works over the weekend;-)

As always, have fun playing with stuff.

– Marco

OK, we saw some ‘Too many connections‘ errors related to MySQL in various log files for the netbeans.org infrastructure. The easiest way to fix that, would be to increase the max_connections setting and be done with it.

But that brought a bigger problem back to light. We don’t really have a good understanding of what our MySQL servers are doing:-( So I was looking to improve our monitoring to include MySQL statistics as well.

Some background: We run on OpenSolaris, so a lot of stuff has to be compiled/ported to work in that setup. We use Zabbix as monitoring tool and Puppet as a configuration management tool.

So I found quickly the ‘Heavy MySQL monitoring solution‘ on the Zabbix wiki. But the problem was, we don’t really have PHP installed on our DB hosts. Instead we have Ruby installed on all our hosts because it’s the implementation language for Puppet. So I ended up translating the original PHP script into Ruby.

Here is my first version of the code: mysql_monitor.rb . It also has some changes where the original was somewhat Linux specific. It might change over the next couple of days as I experiment with it on different hosts. But the general setup works already.

Have fun,

– Marco

When I was a kid, there was a joke: “How many [politically in-correct Northern Germans] do you need to change a light bulb? – Five – One stands on the table and four turn the table to screw the bulb out and back in.” One Sunday I played “How many screws do you have to remove to replace a head light bulb on a VW Passat?” The answer is 26. I actually removed both head lights in the end (30 screws) and replaced all the bulbs in the hope that I don’t have to do it that quickly again. But with the nearest VW dealer now something like 25-30 miles away, a quick stop is not so easy any more.

But at least I learned something about cars;-)

Science Olympiad anyone?

1 comment

OK, so we have two kids and they are now grown somewhat and attending the Tracy Learning Center in eight’ and sixth grade. So every March for the last couple of years, there is the big regional Science Olympiad. This year, it was last Saturday, March the 6th.

But the big competition is only the final step. A lot of preparation is done before the big day. The first kickoff meetings with the interested students start normally in early December. Then the preparations kick into high gear with the beginning of the new year.

There are different kinds of events. From learn/test setups, over hands-on labs, to build-at-home and run at the competition tasks. The kids normally choose during the initial meetings, which events they would be interested in. Then they study and prepare primarily for those events. Sometimes, people don’t show up, so a bit wider preparation is probably a good thing.

Since I’m more the hands-on type;-), I got to help with two `build-at-home’ events.

With our son, we tried to build a Battery Buggy. There the task was to build a battery-powered car to run fast and close to a point, defined at the competition. So the car should go strait, fast, and have a way to define a distance. No big electronic allowed turning the run, so it needed to be some kind of switch. The idea was to use a nut on a long threaded axle to trigger a micro switch. I tried to use a a little LeJOS program to help with the adjustments. But in the end, the overall setup did have too much variance to really land in the ranks. The NetBeans project for my little program is here: BatteryBuggy.zip

With our daughter and another girl, we built some very light rubber-band powered airplanes for the Wright Stuff competition. So the airplane needs to be heavier than 7 grams (the weight of two dimes and one penny), have a rubber-band motor not heavier than 1.5 grams and there are a couple of other size limits. The goal is for the airplane to stay in the air for as long as possible. The airplanes flew very well before (at our gym) and after the competition;-( The only problem was, the first rubber-band during the competition snapped and bend the little axle for the propeller. So the propeller did not turn that good any more until we realized that and replaced it. But the two runs were over by that time:-( Not happy with the final outcome, but we showed that the planes can fly longer than two and a half minutes;-)

Overall, the preparations and the Saturday was fun for me and I think also for all the kids involved. Something which had only very little to do with software;-)

Have fun,

– Marco

I wanted to try Ucarp, the userland daemon to use the CARP protocol, to manage a virtual address for automatic failover between two MySQL hosts.

The only problem was, I wanted to do that with Solaris shared-IP zones. They don’t really have complete (promiscuous mode) access to their IP interfaces. The interfaces are rather virtual interfaces for the global zone which are forwarded to a particular zone. So that means, ucarp has to run on the global zone as well. But how would it know which zone/interface to manage?

So I modified the ucarp sources a bit to run a little /usr/sbin/zoneadm -z <zonename> list -p before sending the `I’m alive package’. Afterwards I was thinking about making this a bit more generic to simply allow the user to provide a special check-script to ucarp, which would influence the alive state. But that’s not done yet.

So ucarp would only send it’s broadcasts when the physical interface is up AND the zone in question is alive. The configuration of the additional virtual interface for the zone is easily done with the default arguments. Just add the <zonename> as an extra parameter for the up-/down- scripts.

The if-up.sh script I use:

#!/bin/bash
# <interface name> <virtual address> <optional extra parameter>

if [ $# -gt 2 ]
then
  z_zone="zone"
fi

interface=$1
vaddr=$2
shift 2

/usr/sbin/ifconfig $interface addif $vaddr netmask + broadcast + up

if [ ! -z "$z_zone" ]
then
  # we need the virtual interface!!
  vinterface=`/usr/sbin/ifconfig -a | \
    awk '$1 !~ /^(ether|inet|lo|zone)/ { interface=$1; } $1 == "inet" && $2 == "'$vaddr'" { print substr(interface, 0, length(interface) - 1); exit; }'`

  if [ ! -z "$vinterface" ]
  then
    fgrep -s ':' <<<$vinterface

    if [ $? -eq 0 ]
    then
      /usr/sbin/ifconfig $vinterface $z_zone "$@"
    fi
  fi
fi

And the if-down.sh as well;-)

#!/bin/bash
# <interface name> <virtual address> <optional extra parameter>

interface=$1
vaddr=$2
shift 2

# we need the virtual interface!!
vinterface=`/usr/sbin/ifconfig -a | awk '$1 !~ /^(ether|inet|lo|zone)/ { interface=$1; } $1 == "inet" && $2 == "'$vaddr'" { print substr(interface, 0, length(interface) - 1); exit; }'`

if [ ! -z "$vinterface" ]
then
  fgrep -s ':' <<<$vinterface
  if [ $? -eq 0 ]
  then
    /usr/sbin/ifconfig $vinterface down unplumb
  fi
fi

I played with that and it seems to work as expected. My little patch for the curious ones is hier;-)

Have fun;-)

– Marco

A new Home

No comments

Hello, I decided to move my blog from blogs.sun.com to my own hosting setup.

All the posts below are migrated. I looked at them and tried to fix all the images and links. But there might still be some dangling ends. But most of the stuff is rather old anyhow.

I hope I’ll find some more time to become a bit more active here again.

Until later;-)

I’m involved with the “Engineers without Borders” for allmost a year now. We are currently building an annex chapter of the San Francisco – Professional Chapter. A lot of nice, long names. What it really means is, that a group of Sun people work together to help. The rest is just organizational/logistical.

We are trying to build a wireless internet link to the CREA – Panama reseach station. They collect a lot of meteorological data which needs to go to researchers and on the other hand, an internet connection will also help in the education of villagers in more sustainable methods of agriculture.

I was there in early September for a feasibility trip. It looks like we can build an long range WiFi link to the ‘more urban’ :-) areas where DSL would be available.

So far, so good. But since that is a complete volunteer effort on our part, we have to raise the money we need.  We were selected to represent EWB at a globalgiving.com 2008 Project Challenge. See the little image for a link. If we can raise enough money until November 21st, there are even prices;-)

Thanks for your support.

Have fun out there;-)

– Marco

I did not post here for a long time. One of the reasons was, that I was not really able to say too much about what we were trying to build. But now “Project Kenai” has made it to the public beta. So I can say that I was working on it for the last 18 or so month;-)

We run JRuby inside Glassfish and that’s why I was interested in GF again. We have all kinds of servers running and we would like to consolidate all of the log information for easier handling. Most of the native Unix daemons don’t have a problem with that, they can all log their information via syslogd. Glassfish claims to be able to do that as well. But I would currently say, it’s more a claim than reality in the official builds:-(

We tried to let GF log via syslogd and found very quickly two problems:

  • You can kill GF (the running JVM) with the right kind of log messages:-( Off course, it took us only days  to hit that  problem , figuring  out the reason was a little bit harder. But I did it and filed issue 6291 but not to much moved on it:-(
  • If you want the access logs also via syslogd, you’re out of luck:-( That is hard-coded to to go to files.

But GF is OpenSource, right? I had already looked at the code to find the reason for the 6291 bug. Could I change it so that it would do what I wanted? It turns out that it was not too hard to get a first version working;-)

It’s probably not perfect and you can clearly see the steps I took but the two little patches below will:

  • Fix the bug, very important;-)
  • Allow to change the syslog facility to values other than LOG_DAEMON via an environment variable called GF_LOG_FACILITY. (Up to that point, I staid within the native code;-)
  • Allow for the access logs to be written to the syslogd as well. To do that, I check for a magic ‘::’ at the beginning of the ‘accesslog’ property of the ‘virtual-server’ elements in the domain.xml. That property is supposed to be a directory where GF would create the access log files. I thought, not too many directories would start with ‘::’ ;-)

My first tests were successful. Now we have to decide if we want to use a patched version of GF.

The two patches are against the modules appserv-core and appserv-native.

For appserv-core, I followed the normal build instructions from the wiki and used the TSJSAS91_FCS_BRANCH tag. (I did a complete build but I don’t think that would be needed) I then transplanted the two interesting class files into a copy (appserv-rt.jar) of our official GF version for testing.

I did not get the appserv-native module via the normal CVS/maven checkout. But since I found the problematic file before with the Fisheye in the SVN tree, I was able to check that module out via SVN. The v3 build instructions help to find the right SVN tree, but we are still interested in v2 here;-) It’s native code, so if somebody wants to try that, you will need the Sun C compilers etc.

After building and replacing the libutilforsyslog.so, everything seem to be working as expected and I can enjoy my logs via the normal syslogd setup;-) Below are both, the normal server log and the access log directed to LOG_LOCAL6:

Oct 10 21:22:58 kenaidev13 SJSAS81_server.log: [ID 702911 local6.info] [#|2008-10-10T21:22:58.934-0700|INFO| \
sun-appserver9.1|javax.enterprise.system.container.web|_ThreadID=17;_ThreadName=httpSSLWorkerThread-8080-0;| \
PWC1412: WebModule[] ServletContext.log():
Oct 10 21:22:58 kenaidev13 Processing HomeController#index (for 127.0.0.1 at 2008-10-10 21:22:58) [GET]
Oct 10 21:22:58 kenaidev13   Session ID: 376348f6751afdd3c1220777a0ee15ca
Oct 10 21:22:58 kenaidev13   Parameters: {"controller"=>"home", "action"=>"index"}
Oct 10 21:22:58 kenaidev13 Rendering template within layouts/kenai.com
Oct 10 21:22:58 kenaidev13 Rendering home/index
Oct 10 21:22:58 kenaidev13 Completed in 0.34706 (2 reqs/sec) | Rendering: 0.30226 (87%) | DB: 0.00000 (0%) | 200 OK [http://localhost/]
Oct 10 21:22:58 kenaidev13 |#]
Oct 10 21:22:58 kenaidev13 [9374]: [ID 702911 local6.info] "127.0.0.1" "NULL-AUTH-USER" "10/Oct/2008:21:22:58 -0800" \
"GET / HTTP/1.0" 200 14058

If you made it all the way here, those are the two little patches:  appserv-core.patch & appserv-native.patch.  They are in no way official  or fully tested. But they show that somebody can quickly add functionality if needed;-)

Have fun & I hope I’ll write more often again;-)
– Marco

OK, this article is not really new any more. It took almost a year until I came across it. But it’s always interesting to see what your old school is doing. Especially when a (German) national paper is praising it very much. Here is a link to the "Die Welt" article titled "Germany’s Smartest Pupils".

I checked a little more into it and I even found out that three of my former teachers are still there.

– Marco

Maybe you have heared about it. There is the One Laptop Per Child (OLPC) initiative out there. Now it’s your chance to get one of the first models. For a limited time (today until Noveber 26.) you can pay $ 399 and get one of those nice pieces. But more importantly one additional laptop is sent to a child in need.

Two nice pieces of adverticement for this action:

G1G1

I only have to convince my family that I need another work computer;-)

OK, a little update. I did not buy the g1g1. Instead I decided that I did not need another computer, so I donated the money for one and the Sun Foundation should match that shortly.(12/27/2007)