Search Results: "angel"

11 January 2009

Julian Andres Klode: What have you done this week?


Well, I wrote 2599 lines of documentation. More detailed I wrote 2599 lines of documentation from Thursday to Sunday. In total, the jak branch of python-apt now has a diffstat (compared to debian-sid) of: Changes: 113 files changed, 5845 insertions (+), 2763 deletions(-) Partly responsible is Ben Finney, whose patches I merged. I also closed 7 bugs not relevant anymore in current versions of python-apt. This is the changelog to from debian-sid to jak:
python-apt (0.7.9~exp2) experimental; urgency=low
  * apt/*.py:
    - Almost complete cleanup of the code
    - Remove inconsistent use of tabs and spaces (Closes: #505443)
    - Improved documentation
  * apt/debfile.py:
    - Drop get*() methods, as they are deprecated and were
      never in a stable release
    - Make DscSrcPackage working
  * apt/gtk/widgets.py:
    - Fix the code and document the signals
  * Introduce new documentation build with Sphinx
    - Contains style Guide (Closes: #481562)
    - debian/rules: Build the documentation here
    - setup.py: Remove pydoc building and add new docs.
    - debian/examples: Include examples from documentation
    - debian/python-apt.docs:
      + Change html/ to build/doc/html.
      + Add build/doc/text for the text-only documentation
  * setup.py:
    - Only create build/data when building, not all the time
    - Remove build/mo and build/data on clean -a
  * debian/control:
    - Remove the Conflicts on python2.3-apt, python2.4-apt, as
      they are only needed for oldstable (sarge)
    - Build-Depend on python-sphinx (>= 0.5)
  * aptsources/distinfo.py:
    - Allow @ in mirror urls (Closes: #478171) (LP: #223097)
  * Merge Ben Finney's whitespace changes (Closes: #481563)
  * Merge Ben Finney's do not use has_key() (Closes: #481878 )
  * Do not use deprecated form of raise statement (Closes: #494259)
  * Add support for PkgRecords.SHA256Hash (Closes: #456113)
 -- Julian Andres Klode   Sun, 11 Jan 2009 20:01:59 +0100
This will again close 7 bugs. But the most important part is to actually have the complete documentation (OK, some descriptions are missing, but all classes,functions,methods,attributes,data should be there now). I still need to rearrange parts of the documentation and add some descriptions to some pieces, but all in all I am satisfied with what I have done this week. Take a look at the documentation: http://people.debian.org/~jak/python-apt-doc/apt/, it received documentation for 9 new classes today. I also added an entry to the DeveloperNews page on wiki.debian.org. Posted in Debian

9 January 2009

James Morrison: Grand Canyon for new years

Sarah came up a great idea for us to do over the long, long weekend after New Years. She wanted to go to the Grand Canyon, and hike in it. I, also enjoying hiking trips, went along.

We organized the trip rather late, I think on the 27th of Dec from my parents house (I think my mom enjoys being around for trip planning since it reminds her of the trips she should plan). Given our late planning we could only get a reservation at Phantom Ranch for the night of the 1st. So the trip plan was get back to SF on 30 Dec 2008. Take bart from the airport, sleep/pack (in either order), then drive to Williams, AZ on the 31st. Take a bus the to Grand Canyon on the 1st, hike down to Phantom Ranch, sleep, hike back up to the top, see the Grand Canyon from the top. Take a bus back to Williams and drive somewhere near the Hoover Dam. Sleep. Drive, see the Hoover Dam, get to Las Vegas, and see the Cirque du Soleil show Ka. Sleep. Drive home.

So that was the plan, now for the execution. We got back to SF on time and picked up our bags from the baggage claim without any issue. The next morning we got up and moving. The optimistic hope was that we would be on the road by 8am to Williams, then stop in Fresno for gear and food. It turns out we weren't ready to go until 10, so we got hiking poles and fake crampons at the REI in SF. We also did our grocery shopping in SF. We were on the road to Williams by noon. We shared the driving Sarah took the parts with traffic, I took the 4 and two lane highways. The fortunate part about this is that I drove through the San Joaquin. One the way there, it was basically IFR conditions (I had no instruments), so I was driving through a cloud (some call it fog) and I couldn't see anything that wasn't on the road. It was really pretty but not the best for a road with lots of ups, downs and turns. I felt like a race car driver. The other interesting part (at least while I was driving) was going through the Mojave desert at sundown. I don't think Sarah has any pictures, but it was very pretty.

Finally we arrived in Williams, AZ and got to the Grand Canyon Railway Hotel, at 2345hrs, (for those counting that means we were on the road for 10h 45m). We checked in by 2358hrs on 31 Dec 2008. So we stood by the fire for two minutes, counted down, and kissed for New Years.

In the morning, things went as expected, we backed our bags to hike 10 miles, and put the rest of the stuff in the car. We got in a van that took us to the Grand Canyon. Our driver up to the Grand Canyon was very nice and showed us the sites along the way. We also met two Japanese exchange students on their way to see the Grand Canyon.

On the way was slow since we took a lot of pictures (Sarah has them all since I lots my 1GB SD card before it made its way into my camera). Unfortunatly, Sarah got tired on the way down, and also hurt her ankle. So we stumbled our way to Phantom Ranch around 1600. From the time we got to the ranch until supper at 1830, we laid back and relaxed, we needed it, our feed were sore and Sarah iced her ankle. The food at Phantom Ranch was good, not great, and there was enough of it after being on our feet all day. At end end of the day, we slept, as planned. In the morning we got up for the early breakfast. Again, it was decently, but not great, but there was enough food. Unfortunatly, Sarah was sick (She'd figured out how to deal with her ankle though) (Oh, and she isn't pregnant). So we harrassed the rangers, got some imodium, and started on our way back up the Bright Angel Trail, we took the Bright Angel Trail down and were planning on the South Kaibab trail up but the Bright Angel Trail has places to stop the South kaibab trail doesn't. Again were were planning on an early 630hrs start, but started a little later at 745hrs. We used our poles with gusto on the way back up and made it up by 1345, 6hrs on the way back up, the same time it took us to get down. The rest of the daylight hours was spent taking the village bus around the Grand Canyon village and seeing the sights from the top.

After the Grand Canyon, we drove to Kingman, stayed there, then continued on, saw the Hoover Dam, it is like Itaipu, but less political and taller, then went on to vegas. In Vegas we saw the inside of a couple hotels, I spent $1 on a slot machine, then we say Ka. Ka is an amazing show, I don't think it really suck in until after the show was over all the things the performers pulled off. That said, the stage itself was an engineering marvel that I watched almost as much as the performers.

After Vegas, the drive back was mostly uneventful, the fog in San Joaquin was a little lighter, but still heavy, Mojave is prettier at sunset and it is still good to sleep in my own bed.

8 January 2009

Simon McVittie: Converting Debian packaging from bzr to git

I recently converted most of the Debian packaging for Telepathy and related projects from bzr to git, while changing the repository contents from just the debian/ directory to the whole source tree. Here's the recipe, using the latest one to be converted (pymsn) as an example.

Create a repository
mkdir pymsn
cd pymsn
git init

Mass tarball import
  • download all the tarballs into ../tarballs
  • rename all the tarballs to *.orig.tar.gz:
    rename 's/^pymsn-/pymsn_/' *.tar.gz
    rename 's/\.tar\.gz$/.orig.tar.gz/' *.tar.gz
    
  • use git-import-orig to import them:
    cd ../pymsn
    ls ../tarballs/pymsn_*.orig.tar.gz
    for v in 0.2 0.2.1 0.2.2 0.3.0 0.3.1 0.3.2 0.3.3; do \
    git-import-orig --no-merge --no-dch --pristine-tar \
        -u $v ../tarballs/pymsn_$v.orig.tar.gz; done
    
  • throw away the resulting master branch in favour of using one we convert from bzr later:
    git checkout upstream
    git branch -D master
    

Converting the Debian packaging This has the slight complication that in some (but not all) of the bzr commits, the repository contained only the contents of the debian directory, in the root of the repository. So, I needed to rewrite history, with this script:
#!/bin/sh
# index-filter.sh
if git ls-files -s   grep debian; then
    :
else
    git ls-files -s  
        sed -e "s-\t-&debian/-"  
        GIT_INDEX_FILE=$GIT_INDEX_FILE.new git update-index --index-info &&
    mv $GIT_INDEX_FILE.new $GIT_INDEX_FILE
fi
  • Download unstable and experimental packaging into ../pymsn-experimental and ../pymsn-unstable
  • Use bzr-fast-export and git-fast-import to import the two branches:
    ~/.bazaar/plugins/fastimport/exporters/bzr-fast-export.py \
        ../pymsn-unstable   git fast-import
    git branch -m master debian-lenny
    ~/.bazaar/plugins/fastimport/exporters/bzr-fast-export.py \
        ../pymsn-experimental   git fast-import
    git branch -m master debian
    git branch -D tmp
    
  • Rewrite history so changelog, control etc. are consistently inside a debian directory, with the script shown above:
    git filter-branch --index-filter $(pwd)/../index-filter.sh debian-lenny
    rm -r .git/refs/original
    git filter-branch --index-filter $(pwd)/../index-filter.sh debian
    rm -r .git/refs/original
    
  • Merge the appropriate upstream versions into each branch:
    git checkout debian
    git merge upstream/0.3.3
    vim debian/control        # and change Vcs-Bzr to Vcs-Git
    dch "Move packaging to git"
    debcommit -a
    git checkout debian-lenny
    git merge upstream/0.3.1
    vim debian/control        # and change Vcs-Bzr to Vcs-Git
    dch "Move packaging to git"
    debcommit -a
    
  • Rescue Debian patches and put them on a debian-patches branch, which is rebased with each upstream release. For pymsn, there aren't any patches in the debian branch at the moment:
    git branch debian-patches upstream/0.3.3
    
    but there is one in the debian-lenny branch:
    git branch debian-lenny-patches upstream/0.3.1
    git checkout debian-lenny
    cp debian/patches/00-fix-dns-resolution.diff ..
    git checkout debian-lenny-patches
    patch -p1 < ../00-fix-dns-resolution.diff
    git commit -a
    
  • Make a repository on alioth:
    cd /git/pkg-telepathy
    GIT_DIR=pymsn.git git init --bare --shared
    GIT_DIR=pymsn.git git config hooks.mailinglist ...
    vim pymsn.git/description
    
  • Push to the repository:
    git gc --aggressive
    git remote add origin git+ssh://git.debian.org/git/pkg-telepathy/pymsn.git
    git push --all
    
  • On alioth, do some more setup after the initial push:
    cat > pymsn.git/hooks/post-receive <<EOF
    #!/bin/sh
    exec /usr/local/bin/git-commit-notice
    EOF
    chmod +x pymsn.git/hooks/post-receive
    GIT_DIR=pymsn.git git symbolic-ref HEAD refs/heads/debian
    
  • Mark the old repositories as no longer used:
    cd ../pymsn-unstable
    dch $'This repository is no longer used, instead please use git:\n'\
    "git://git.debian.org/git/pkg-telepathy/pymsn.git" -c changelog
    debcommit -c changelog
    bzr push
    cd ../pymsn-experimental
    dch $'This repository is no longer used, instead please use git:\n'\
    "git://git.debian.org/git/pkg-telepathy/pymsn.git" -c changelog
    debcommit -c changelog
    bzr push
    cd ../pymsn
    

4 January 2009

Julien Blache: pommed v1.25: wireless keyboard, DBus configuration

Two fixes in this release, let s start with the more important one :) The DBus configuration file shipped with pommed now explicitly allows method calls to org.pommed, which is needed with the newer versions of DBus where the default configuration on the system bus has been made more strict to close a security hole. If the pommed clients stopped working for you after a DBus update, replace /etc/dbus-1/system.d/pommed.conf by the dbus-policy.conf file shipped with pommed. Second fix is related to the Apple wireless (Bluetooth) keyboard, which previous versions of pommed would recognize just fine but reject because it exposes a type of events usually indicative of a mouse (and pommed doesn t listen to mouse devices). This is now fixed for this particular keyboard, so pommed will react to the hotkeys on this keyboard too. For the complete list of changes, see the ChangeLog file in the source distribution. Comments at the usual address :)

3 January 2009

John Goerzen: Garmin Nuvi 500

I ve owned two different GPSs in the past: a Garmin GPS III, and the Garmin eMap. Both are based on similar underlying firmware. This week, I did some research on more modern GPS units and decided to buy a Garmin nuvi 500. Here s my review. Overview The Garmin nuvi 500 is one of only two models in the nuvi line that are waterproof. The nuvi 500 and 550 are both designed as hybrid units: useful both in the car and outdoors. The 500 includes street-level maps (they appear to be the same quality as Google) for the entire United States, detailed topographical maps for the entire United States, and a global basemap. It also includes a microSD slot (or is it miniSD - I forget) for additional maps that you can buy anything from marine maps to other countries. It also includes a default POI (points of interest) database containing over 5 million points: restaurants, gas stations, parks, hospitals, you name it. Most contain an address and a phone number in additional to the coordinates. Unlike GPS units that you find built in to some cell phones, this is all stored on flash memory on the unit: no Internet connection required. The nuvi 500 is a portable yellow pages, topographical map, and incredibly detailed street atlas all in one. Car Use The nuvi 500 comes with a car charger and suction cup windshield mount in the box. (It doesn t come with an AC charger, but it can charge over USB.) It also comes with yay a user-replaceable battery. The windshield mount is very sturdy and I am happy to have one that isn t permanent. In the car, the device performs admirably. I have read some other reviewers that have compared its routing to other GPSs and found that the nuvi generally picks the same route as Google, and almost always a better route than other GPSs. If you deviate from the selected route, it automatically re-calculates a new route for you. It will show you the next turn coming up, and has either 3D or flat map displays. There s a one-touch where am I feature. It displays your current coordinates, some sort of street address suitable to read to someone ( 1234 S. Main or I-95 exit 43 type of thing), along with buttons to show you the nearest police stations and hospitals. The unit also features multi-stop routing. You can either tell it where all you re going in a defined order, or tell it all your stops and let it create an optimal route. This feature works, but it your stops are close by (and involve some of the same roads), it may wind up skipping some stops thinking you ve made your first one. The speaker announces upcoming maneuvers, though it doesn t have a synthesizer for street names. It s also supposed to work with Bluetooth headsets, though I haven t tested that feature. I found the map quality to be excellent. It seems to be on par with Google (in fact, I think both use data from Navteq). I was surprised with how many country dirt roads and side roads it knows about and of course, regular city streets are all on there, with one-way indications and the whole lot. In fact, the quality of coverage was so good that I was surprised when it missed roads or got things wrong. Out in rural areas, or small towns, this happens from time to time: it thought that an abandoned railbed was an unnamed road and wanted me to drive on it (it was clearly not drivable), and in some other cases also thought some abandoned roads were still drivable. I don t think this is a device issue though; it s an underlying data issue, and everyone else probably has the same problem. Its arrival time estimates are quite accurate, and its interface is smooth and easy. It has some optional accessories I haven t tried, such as real-time traffic reports from wireless sources, boating mode, etc. Outdoor and Geocaching Mode Our other main use for the device is outdoor hiking and geocaching. It really shines here. It has special support for the GPX files from geocaching.com. The device supports paperless caching . Not only can it put caches on the map, but if you download the GPX file for your caches, you ll also get the full description, hint (behind a separate button, of course), most recent 5 logs, and the like right there on your screen. You can also log your finds on the device, and upload a file from it to geocaching.com later to log them on the site. This is an incredible time saver over my old method: printing out a bunch of maps, downloading waypoints to the eMap, taking notes, then logging things later. I found outdoor mode not quite as refined as the auto mode, however. It kept forgetting that I wanted to use an arrow as my current position indicator (the default hiking boots for walking mode didn t provide an accurate enough direction indication for my tastes). Finally realized that saying don t ask me about the configuration was the key to getting it to remember the configuration. It sometimes took a surprisingly long time to realize we weren t standing still any longer. On the other hand, the quality of the GPS receiver was amazing. It even got a strong signal in my house. And I wasn t even sitting at a window. The topographical maps are a nice addition, and the breadcrumb mode is always helpful when geocaching and hiking, too. My natural way of holding it meant that I accidentally turned it off a few times, because I had a finger holding it right over the power button. But it powers back up and re-obtains the signal quite rapidly. The different modes (automobile, outdoor, bicycle, and scooter) are mainly different collections of settings: 3D map or flat, what indicator to use, to navigate off-road or along roadways, to ignore one-way indications or heed them, etc. PC link The nuvi 500 has a USB port. Plug it into the PC, and you see its internal flash drive, vfat formatted. You can upload and download GPX files there, store photos if you like. Be careful what you mess with though, because its built-in maps and system data are also on that drive. If you have the SD card inserted, that will also be presented to your computer when you plug the device in. Garmin has some Windows software to make it easier to upload/download stuff, but I haven t tried it. Annoyances As you can tell, I really like this GPS, but there are a few things about it that annoy me. The #1 thing that annoys me isn t actually the GPS itself, but Garmin s website. I went to register the device online, but it wouldn t let me because I don t have the Windows-only browser plugin on my Linux machine, and it wanted to talk to the GPS for some reason. I went to send them a support request about that, only to discover after I had typed in the request that their email us form is broken in Firefox on all platforms. Bad show, Garmin. The on-screen keyboard (it s a touch-screen device with only one hard button for power) isn t QWERTY layout; it s alphabetical layout, and it makes me inefficient when entering data. I found myself logging my finds on the unit, but taking notes about them on paper because that was faster. Garmin has a feature listed on their website for a toggle between QWERTY and alphabetical layout, which they apparently offer on only their more expensive GPSs. What? There is no reason to not but that in all your firmware. The device lacks a few features I was used to on my GPS III and eMap. It doesn t support any kind of real-time position indication to the PC; all communications is just accessing stored data on the internal flash drive. I used to think that was a nice feature, but in reality, I haven t used it in years. It also lacks the display of the exact location of each GPS satellite, though the incredible quality of its receiver means that I don t really care any more. (I used to use that information to help figure out which window to put it by if in a car/train or something.) It also lacks the level of configuration that was present in the settings screens on the older units. There s no battery saver mode (sample every 5 seconds when going at a constant velocity instead of every 1) like the older units had. The sun and moon screen likewise is gone, but added is awareness of timezones; the Nuvi 500 can show you the local time at your present position synced up with the GPS satellites. The compass is not the most helpful screen, though after some practice, it is functional. The documentation about it is confusing, but really the thing that was more confusing was this: in walking mode, the arrow that indicates what direction you re walking in updates faster than the arrow that indicates what direction you should be walking in. Once I realized what was going on there, it was easier to use. The compass does tell you what your bearing is, in degrees, but only when you are not seeking a destination. It will not tell you the bearing to the destination, though you can estimate it from the simulated compass face on the display. When seeking a specific point, especially through terrain with obstacles such as trees, it is useful to be able to use a compass for the final approach because a GPS unit can t tell you which direction it s pointed only which direction it s moving, so when you re not moving or moving slowly, it s not helpful. I did some experimentation today with the compass screen, as well as my real compass, and was able to navigate to my destination rather precisely using the combination of them. That said, a more functional compass screen would still be better. Conclusion Overall, I m very happy with the nuvi 500. It s not the same as a top-of-the-line device in either the outdoor or automotive category, but on the other hand, it s cheaper and more convenient than buying two devices with similar features. The geocaching features are excellent, the build quality is excellent as well. The system is stable and performs well. (Some other reviews worried about whether the case is solid enough; it seems quite solid to me.) I wish there were a faster way to toggle between 3D and flat map views, and forgetting about my walking mode icon is annoying, but other than that I have very little to complain about. Garmin s geocaching features (found on this unit and several other in their lineup) is great.

2 January 2009

John Goerzen: Kansas Adventure

Today, Terah and I set out for some geocaching. Jacob s daycare was back in session (he goes twice a week), but we both had the day off. Jacob enjoys geocaching, but he does make it a lot slower. So we dropped him off at day care today, and headed off. We were also scouting out good places for future tent camping along the way. We didn t know exactly where we d manage to go, so I had downloaded over 100 geocaches to my new GPS, prepared for many options! Not long after we found our second cache (in Canton, KS), Terah asked, Did you hear that hissing from the tire? No . We were about 5 miles from town. I happened to have an air tank with me (because of a different tire with a slow leak). I shot some air in it, and we made it to Canton Service just fine. They fixed both tires, and my uncle who was there getting tire work done himself was quite surprised to see us pull in bright and early at about 9:00! After our tire was fixed, we headed northeast. We found some more caches, and drove around the two lakes near Herington, KS. We saw hundreds of geese perched on the icy lake and hiked a bit in the area to find a cache. Then it was on to Council Grove for lunch. I do believe this is the first time we have ever walked into a place that looks like a restaurant and only after we are seated realize that we re in a museum. Council Grove has an amazing historic downtown the most history per capita of any town in the west! the travel information AM station proudly proclaims, with 25 historic sites and a population of 2500. Got a chuckle at that one. We drove by the oldest continuously operating restaurant west of the Mississippi (it was closed), so we turned around and stopped at the Trail Days Bakery and Cafe that we had passed a few blocks back. We walked in the side door, into what looked like a meticulously-restored old house. We were seated at a table, given menus, and the waiter explained, By the way, you re eating in a cafe that s also a museum. Please feel free to look around, and don t miss the basement and upstairs, too! So it turned out that the Trail Days Bakery and Cafe is in the historic Terwilliger House. The house was about to be razed, when Shirley and Ken McClintock heard about it and tried to get some people interested in saving it. When nobody else stepped up, they did they formed a non-profit, and with a lot of hard work from themselves and others, managed to restore it from its state as a run-down gas station to its former beauty. They operate the cafe as a way to raise funds for the preservation of the house and the other historic buildings they have moved to the site to restore. Oh, and Shirley and Ken were our cooks and waiters today! We showed up there at about 1PM, right at the tail end of the lunch rush. Another couple happened to be there at about the same time. They were traveling across Kansas from west to east, specifically avoiding the interstates so they could see the small towns along the way. We got to talking about geocaching and their home town near Colorado. Then we got to talking to Shirley about the music CDs that they had for sale and the history of the place, and the Ken told us all about the Native American pictograph that they had discovered carved into the wood in the house. By the time we left, we had probably been there almost two hours. Oh, by the way, Terah had ham and beans ( just like mom used to make , she said), and I had what can be best described as a sloppy joe made out of bison meat. Both were good, but eating in this beautiful old house was even nicer. Then we drove down the road a bit to the old apothecary. Yes, it s still a drugstore in every sense of the word: you can get your prescriptions filled there, and they also still have the original soda fountain (dating back to 1920 if memory serves), serving up all the stuff you used to find in a drugstore. We chose somewhat boring items, I guess: Terah had a chocolate shake (the made-in-front-of-you-fresh kind), and I had a root beer float. So, what would have been a quick lunch in a different town turned into a few hours in Council Grove thanks to a very helpful leaky tire this morning that threw us off schedule! After that, a few more caches on the way back towards home. We picked up Jacob, and he and I found the last cache of the day which he, of course, loved. Then home. We only found 8 caches, but had a lot of fun.

30 December 2008

David Welton: Adding callbacks to Android Hecl

Since I recently added sensor callback support to Android Hecl, I thought I'd write about the process of doing so. It's really pretty easy. Ideally, it would not be necessary to write and compile any Java code to create callbacks in Hecl - you could do it all inline. However, I don't think this is possible at the current time with Android's bytecode engine, although I could be mistaken. It would be necessary to generate a class, or hang some new methods on an existing class. So, for the time being, we do it the old fashioned way whenever anyone wants a new callback to utilize: The heart of the matter is this class:
public class HeclCallback implements
          android.app.DatePickerDialog.OnDateSetListener,
          android.app.TimePickerDialog.OnTimeSetListener,
          android.hardware.SensorListener,
          android.widget.AdapterView.OnItemClickListener,
          android.widget.AdapterView.OnItemSelectedListener,
          android.widget.CompoundButton.OnCheckedChangeListener,
          android.widget.DatePicker.OnDateChangedListener,
          android.widget.TimePicker.OnTimeChangedListener,
          android.view.View.OnClickListener  
Which as you can see, implements the various Java listener classes. Each of these requires one or more methods to be implemented in order to receive the actual callbacks. Generally, they are done like so:
public void onItemSelected(AdapterView parent, View v, int position, long id)  
try  
    Vector vec = ListThing.get(script.deepcopy());
    vec.add(ObjectThing.create(parent));
    vec.add(ObjectThing.create(v));
    vec.add(IntThing.create(position));
    vec.add(LongThing.create(id));
    interp.eval(ListThing.create(vec));
  catch (HeclException he)  
    Hecl.logStacktrace(he);
    Log.v("hecl onitemselected callback", he.toString());
 
 
Which is pretty simple as well: the objects that are passed in are wrapped up as Hecl Things, and then the command is run. The command to use is set from Hecl like so, when we create a new instance of the HeclCallback class:
set callback [callback -new [list [list SelectDemo]]]
$lview setonitemclicklistener $callback
So, the steps are:
  1. Add an "implements" to HeclCallback.
  2. Define the methods that need defining, copying one of the existing methods.
  3. Recompile
  4. Use the 'callback' command to instantiate a new HeclCallback class with the command of your choice as the handler for callbacks.

David Welton: Adding callbacks to Android Hecl

Since I recently added sensor callback support to Android Hecl, I thought I'd write about the process of doing so. It's really pretty easy. Ideally, it would not be necessary to write and compile any Java code to create callbacks in Hecl - you could do it all inline. However, I don't think this is possible at the current time with Android's bytecode engine, although I could be mistaken. It would be necessary to generate a class, or hang some new methods on an existing class. So, for the time being, we do it the old fashioned way whenever anyone wants a new callback to utilize: The heart of the matter is this class:
public class HeclCallback implements
          android.app.DatePickerDialog.OnDateSetListener,
          android.app.TimePickerDialog.OnTimeSetListener,
          android.hardware.SensorListener,
          android.widget.AdapterView.OnItemClickListener,
          android.widget.AdapterView.OnItemSelectedListener,
          android.widget.CompoundButton.OnCheckedChangeListener,
          android.widget.DatePicker.OnDateChangedListener,
          android.widget.TimePicker.OnTimeChangedListener,
          android.view.View.OnClickListener  
Which as you can see, implements the various Java listener classes. Each of these requires one or more methods to be implemented in order to receive the actual callbacks. Generally, they are done like so:
public void onItemSelected(AdapterView parent, View v, int position, long id)  
try  
    Vector vec = ListThing.get(script.deepcopy());
    vec.add(ObjectThing.create(parent));
    vec.add(ObjectThing.create(v));
    vec.add(IntThing.create(position));
    vec.add(LongThing.create(id));
    interp.eval(ListThing.create(vec));
  catch (HeclException he)  
    Hecl.logStacktrace(he);
    Log.v("hecl onitemselected callback", he.toString());
 
 
Which is pretty simple as well: the objects that are passed in are wrapped up as Hecl Things, and then the command is run. The command to use is set from Hecl like so, when we create a new instance of the HeclCallback class:
set callback [callback -new [list [list SelectDemo]]]
$lview setonitemclicklistener $callback
So, the steps are:
  1. Add an "implements" to HeclCallback.
  2. Define the methods that need defining, copying one of the existing methods.
  3. Recompile
  4. Use the 'callback' command to instantiate a new HeclCallback class with the command of your choice as the handler for callbacks.

29 December 2008

John Goerzen: A Day with Jacob

Old train! Smoke inside. That s what Jacob said today when he saw an old steam locomotive at the old Union Station in Wichita, KS. Never mind that it s been sitting there for decades he s got that concept of smoke coming out of steam engines down, and apparently realizes that for smoke to come out of them, it must start out inside them. But I don t think I ve ever heard anyone talk about a steam engine in a more cute way. Two is a fun age. Today I needed to return a power supply to Circuit City, so Jacob and I made a day of it. He came with me to town (yes, us country folk go to town ). We returned the power supply, then ate lunch at a Mexican place. Jacob would call it a chips and salsa place. Today he drank from a straw for the first time, and loved it so much that I think he got more liquid than food in him over lunch. Oh well. After that, we went to the eye cream (ice cream) store - Cold Stone Creamery. Whenever Jacob hears talk of Wichita, he comments with something like Go ichita. Eat eye cream. Go town. Jacob ate his entire kid-sized chocolate ice cream with sprinkles. He loves sprinkles. While we were eating ice cream, I asked him, After you are done, would you like to see skyscrapers or trains? NO! Eat eye cream! I don t think he quite got the after bit, so I asked him again in the car after we were done eating. His eyes lit up. SEE KYCRAPER!! So we drove to downtown Wichita and saw the skyscrapers. (Yes, I am aware that other cities have much taller buildings. It doesn t matter when you re 2.) We got out of the car and he got to touch a few of them. In fact, the only way I got him back into the car without a meltdown was by pointing out the train crossing above the road on a bridge, and the fact that he d still be able to see it from in the car. That, of course, led to us needing to see trains. I drove him up the ramp to be trackside by the old Wichita Union Station. There weren t any trains going past right then, but he did get to see the locomotives at the Great Plains Transportation Museum through the fence. We started to head home, but he really wanted to see the train again. So we stopped at the park in Newton to see the old ATSF locomotive there. By that point, it was waaaay past naptime and we narrowly averted a fit when I informed him that no, we could not go inside the adjacent grain elevators. So all told, I think Jacob had a fun day with his dad. Now, in case there is any doubt out there about what kind of child Jacob is, I should point out the things he notices in church lately. First off, when we get into the sanctuary, we sit in the back. But first thing he said lately when we walked in was TWO THERMOSTATS! Yes, he saw two thermostats at opposite ends of the room up front, pointed right at them, and was very excited. He also notices the organ speakers ( oran peaker ), big cross , ceiling fans, and now furnace vents . Yes, furnace vents. At the Christmas Eve service, there was a candlelight part. He loved it. Daddy hold fire! A few people nearby smiled. While we sang Silent Night, he really wanted to blow out the candle. When it was time, I said OK Jacob, now you can blow it out. A very excited Fffffffffffffffff followed, and several people nearby were chuckling by then. I also let Jacob put the candle in the box on our way out. He said, I put fire in box. I did it!

28 December 2008

John Goerzen: Real World Haskell update

There s been quite the activity around this book lately. Pat Eyler of On Ruby published an interview with the three of us RWH authors. It apparently got some very positive comments on Reddit. Over on Amazon, the book is continuing its streak of 5-star reviews. When I see a review there titled Finally a Haskell book that I could understand , I am very glad that we took the time to write Real World Haskell. It is great to know that people find it useful. Some of you may know that the book is licensed under a Creative Commons license. This is most certainly not common in the publishing world these days, and O Reilly took a risk by letting us do it. We had tremendous community participation while we were writing it, and O Reilly is quite pleased with the sales so far. I hope that this bodes well for future books released under such a license.

26 December 2008

John Goerzen: ID3 tags

For Christmas, I got Terah a Sandisk Sansa m240 MP3 player off Woot. A very basic and small device, but just what she needs. There s a catch. It appears to only recognize ID3 tags in v1 format. (Some online sources claims it also recognizes v2.3, but not v2.4, but my testing shows it doesn t.) It turns out that very few, if any, modern media management tools support ID3v1. I tried Rhythmbox, Listen, Banshee, Amarok, and several others. Not one of them even had an option for ID3 version. A couple had an option for what to use when encoding from CD if I knew the magic undocumented gstreamer incantation. But they promptly deleted the ID3v1 tag whenever the information for the track was modified. I eventually wound up writing a script for Terah to run that calls eyeD3 to convert the tags to v1. But with all the devices out there that grok v1 only, I am really rather shocked at the lack of software support for it these days.

David Bremner: Prolegomenon to any future tg-buildpackage

So I have been getting used to madduck's workflow for topgit and debian packaging, and one thing that bugged me a bit was all the steps required to to build. I tend to build quite a lot when debugging, so I wrote up a quick and dirty script to I don't claim this is anywhere ready production quality, but maybe it helps someone. Assumptions (that I remember) Here is the actual script:
#!/bin/sh
set -x
if [ x$1 = x-k ]; then
    keep=1
else
    keep=0
fi
WORKROOT=/tmp
WORKDIR= mktemp -d $WORKROOT/tg-debuild-XXXX 
# yes, this could be nicer
SOURCEPKG= dpkg-parsechangelog   grep ^Source:   sed 's/^Source:\s*//' 
UPSTREAM= dpkg-parsechangelog   grep ^Version:   sed -e 's/^Version:\s*//' -e s/-[^-]*// 
ORIG=$WORKDIR/$ SOURCEPKG _$ UPSTREAM .orig.tar.gz
pristine-tar checkout $ORIG
WORKTREE=$WORKDIR/$SOURCEPKG-$UPSTREAM
CDUP= git rev-parse --show-cdup 
GDPATH=$PWD/$CDUP/.git
DEST=$PWD/$CDUP/../build-area
git archive --prefix=$WORKTREE/ --format=tar master   tar xfP -
GIT_DIR=$GDPATH make -C $WORKTREE -f debian/rules tg-export
cd $WORKTREE && GIT_DIR=$GDPATH debuild 
if [ $?==0 -a -d $DEST ]; then
    cp $WORKDIR/*.deb $WORKDIR/*.dsc $WORKDIR/*.diff.gz $WORKDIR/*.changes $DEST
fi
if [ $keep = 0 ]; then
    rm -fr $WORKDIR
fi

24 December 2008

John Goerzen: Server upgraded to Debian lenny

This afternoon, I finally decided to upgrade my main server from Debian etch to lenny. Lenny is still testing, but is nearing release. This server is colocated with Core Networks, and I have no physical or console access to it. (Well, I can request the IP KVM if needed.) It also hadn t been rebooted in over 200 days. The actual upgrade itself was incredibly smooth. For those of you that don t use Debian, you might be interested to know that you can upgrade a running system in-place. A reboot is not even strictly necessary, though you won t get kernel updates without it. There was a bit of config file tweaking for Exim and Apache, a small bit for PHP, and that was it for the entire thing. EXCEPT for the two things that always really bug me: Horde/IMP and Ruby/Rails. Horde has the most annoying upgrade process of any web app I ve used lately. You first go through reading two different upgrade docs. To upgrade imp, you pipe some SQL commands into a PostgreSQL psql process (only they only document the mysql command line). Ditto for horde. But for Turba, the address book, you have to run a PHP program from the command line. Only it doesn t work from any place in your PATH, so you have to divine a location to copy it to, run it from there, hack up the database stuff in it, then remember to delete it. And that concludes the documented upgrade process. Only surprise it s not done. At this point, you ll get weird PHP warnings all over your screen. Then you google them, and find you have to log in to the web app as an administrator, and run three different upgrade procedures from within it, each of which requires you to copy and paste a config file to disk. A far cry from the WordPress single-click upgrade. And this is easier than Horde/IMP upgrades I ve done in the past. The other annoying thing is Ruby on Rails. I run one Rails app, Redmine, and it s always annoying. You ve got to get all sorts of these gems just right. Today they decided they didn t like my new PostgreSQL driver for Ruby, but they weren t exactly obvious about it. Try upgrading the Gems, and surprise AFTER they are upgraded, they say that I need a newer rubygems than s in Debian. Oooookaaayy . restore gems from backup, google some more, find a patch, apply it, hack for awhile, and finally it works. But I have no idea why. So, overall, kudos to all the Debian developers for a smooth upgrade process. I hope I can say that about Horde and Rails in the future. Oh, and by the way, I did reboot the server. It came right up with the new kernel an OS, no problem.

19 December 2008

Michal &#268;iha&#345;: Gammu stable version 1.22.1

It looks like I messed up few things in yesterday Gammu release so here is hot fix version. Changelog is quite small and fixes all regressions found so far: You can download from usual place: http://cihar.com/gammu/, Binary packages will be available soon on all usual places (Debian Unstable, OpenSuse build service, Ubuntu PPA repository).

18 December 2008

Michal &#268;iha&#345;: Gammu stable version 1.22.0

After two and half months of development, new Gammu stable release is out. Since last testing version there are only minor changes in vCard export, but full changelog since 1.21.0 is quite long: You can download from usual place: http://cihar.com/gammu/, Binary packages will be available soon in all usual places (Debian Unstable, OpenSuse build service, Ubuntu PPA repository).

17 December 2008

John Goerzen: More Wiki Annoyances

So today, I discovered that MoinMoin has an all or nothing attachment setting: either everyone with write permission to a page can upload attachments, or uploading attachments is disabled for the entire site. No exceptions. Period. Not only that, but there is no maximum attachment size setting unless the attachment was uploaded embedded in a ZIP file. How s that for irony? Not wanting to have my railroad site turn into a file trading site, I don t really want to let everyone upload attachments. Oh, also MoinMoin doesn t maintain a history of attachments. So if somebody drives by and vandalizes an attachment, you get to . restore the original version from tape. Yay? So I decided I d look back at MediaWiki, which has better attachment controls. I still had my test installation, so I went to use it. I edited the main page. I wanted to read about the markup, so I clicked the Editing help link. Whoops, broken link. It links to Help:Editing on the local wiki. Which MediaWiki does not install for you. I asked about it on #mediawiki. The answer was: copy from mediawiki.org. OK, fine. How? Cut and paste. Yes, that s right. Every time a new version of MediaWiki comes out, you get to cut and paste dozens of pages from mediawiki.org to your wiki, or else you ll have outdated help. Yay? The MediaWiki folks on IRC seem to like it this way. Not everyone wants the same help. Fine, but provide a sane default for those that don t care. Who thought running a wiki would be so hard? Update: since yesterday, I went to moinmo.in and fixed the ThemeMarket page to reflect what versions a MoinMoin theme works with. I m happy to help out with fixing Free Software though I don t really have time to add fundamental features like working syntax help links on this particular project.

16 December 2008

Biella Coleman: If Programming Languages Were Religions and What is Up with Ruby on Rails?

I am sure this is making the rounds but this seems like an appropriate place for this list: If Programming Languages Were Religions. My favorite description:
Lisp would be Zen Buddhism - There is no syntax, there is no centralization of dogma, there are no deities to worship. The entire universe is there at your reach - if only you are enlightened enough to grasp it. Some say that it s not a language at all; others say that it s the only language that makes sense.
Speaking of computer languages and projects and religious holy wars, in the last few weeks I have been totally intrigued by the culture being built by the Ruby on Rails guys. As a researcher of Free and Open Source Software, I, like others, actually tend to see the similarities more than the difference between these two poles (in part because I focus on practice, not on the purist ideologies or two ideologues, you know who I am taking about) but it seems to me -and I could be wrong here but I suspect I am not -that Ruby on Rails is producing a unique Open Source culture, one that really diverges from some of the core principles of Free Software, much more so than other Open Source projects like Apache. The rail guys as I have heard, are Open Source evangelists of a certain stripe, who are quite cultish (you know, it is weird if you don t use github, a Mac, TextMate). What do you think of Ruby on Rails? Are the attacks fair? Are they a bunch of douchebags, as this (very incisive) post argues? Is it where Open Source meets and marries, for better or for worse, the Web 2.0 craze? If I could clone me, this is definitely one line of research, I would love to dive into right now but since I can t, your opinions would be greatly appreciated.

John Goerzen: Wiki Software

I used to run a website for traveling by rail in the United States. I let it falter, and eventually took it down. But I still have the domain, and am working to bring it back as a wiki. The first step in that process was selecting which wiki software to use. I have a few requirements for the site: I m frustrated that there is no wiki out there that does all of these. There are quite a few that do all but one, but which one they omit varies. My two finalists were MoinMoin and MediaWiki. MoinMoin MoinMoin will let you easily define arbitrary categories (by creating a wiki page following a certain name). The search screen automatically presents checkboxes for restricting searches to a particular category. Some reviews have complained about its anti-spam features, but they are all talking about older versions and they seem to have done some work on this lately. MoinMoin has tons of features and is easy to set up and maintain. But here s where it falls down: themes. Over at moinmo.in, there is a theme market for themes. Only most of the themes there haven t been compatible with the current MoinMoin release since about 2005. Most of the rest have one download, then a long discussion page full of mixed bug reports, diffs, and non-diff edit this to make it work comments. Most of these don t state what version of the theme they apply to. Most themes won t work with current browsers and Moin releases without them. UGH. After discussing on #moin, I ll probably go in there and at least organize the ThemeMarket page by release. MediaWiki Then there s MediaWiki. It s got a lot of features, and a lot of complexity. It has no current WYSIWYG feature, though apparently there is work on one. MediaWiki has an amazing category system. It can generate sorted lists of pages in a category, supports subcategories, etc. Surprisingly, though, you can t search in just one category. (Though it might be possible indirectly via some syntax; not sure.) Searching in MediaWiki overall is less capable that in MoinMoin. MediaWiki does offer namespaces, and namespaces are the sole way of searching just one part of a site. They re used well over at, say, uesp.net. But namespaces are heavy-handed. You have to edit config files to define them, and they bring with them other associated namespaces for discussion and whatnot. It s not as easy as creating a category in MoinMoin, and might not scale well to lots of future categories. MediaWiki does appear to have good spam prevention, and support recaptcha. Conclusions I eventually selected MoinMoin and have set up most of my content in it. But now that I am to the point of selecting themes, I m having some second thoughts. I also looked at DokuWiki. Its design makes me nervous. The user list is stored in a single file. You can t search by category. You can search by namespace, but there aren t checkboxes for it in the search screen; you have to know the syntax. WYSIWYG is a plugin. Categories are a plugin. So too many plugins to maintain, and no real features above MoinMoin.

John Goerzen: Administering Dozens of Debian Servers

At work, we have quite a few Debian servers. We have a few physical machines, then a number of virtual machines running under Xen. These servers are split up mainly along task-oriented lines: DNS server, LDAP server, file server, print server, mail server, several web app servers, ERP system, and the like. In the past, we had fewer virtual instances and combined more services into a single OS install. This led to some difficulties, especially with upgrades. If we wanted to upgrade the OS for, say, the file server, we d have to upgrade the web apps and test them along with it at the same time. This was not a terribly sustainable approach, hence the heavier reliance on smaller virtual environments. All these virtual environments have led to their own issues. One of them is getting security patches installed. At present, that s a mainly manual task. In the past, I used cron-apt a bit, but it seemed to be rather fragile. I m wondering what people are using to get security updates onto servers in an automated fashion these days. The other issue is managing the configuration of these things. We have some bits of configuration that are pretty similar between servers the mail system setup, for instance. Most of them are just simple SMTP clients that need to be able to send out cron reports and the like. We had tried using cfengine2 for this, but it didn t work out well. I don t know if it was our approach or not, but we found that hacking cfengine2 after making changes on systems was too time-consuming, and so that task slipped and eventually cfengine2 wasn t doing what it should anymore. And that even with taking advantage of it being able to do things like put the local hostname in the right places. I ve thought a bit about perhaps providing some locally-built packages that establish these config files, or load them up with our defaults. That approach has worked out well for me before, though it also means that pushing out changes isn t a simple hack of a config file somewhere anymore. It seems like a lot of the cfengine2/bcfg tools are designed for environments where servers are more homogenous than ours. bcfg2, in particular, goes down that road; it makes it difficult to be able to log on to a web server, apt-get install a few PHP modules that we need for a random app, and just proceed. Any suggestions?

10 December 2008

John Goerzen: Day To Day Canceled!

Today there is an article in the New York Times about cutbacks at NPR, including one of their best programs, Day To Day. Not a good move move, NPR.

Next.

Previous.