Yvan Rodrigues' problogue

(like a blog, but with less effort)

Disconnected ramblings about software development, iOS, FreeBSD, anti-social networking, kittens, drosophilidae, small business, Android, web services, finches, Windows, electrical engineering, XML, rental cars, rye, or ... FIVE dollars??!... something something beer.

How freebsd-update broke my jails

I usually perform a binary update of my jails using

#freebsd-update fetch install #freebsd-update -d /usr/jails/basejail fetch install

This has worked for years. After doing it yesterday I was unable to login to any of my jails and pretty much everything broke. For example logging in using ssh gave logged the error: /bin/sh permission denied

After spending the day on it I have discovered that the upgrade process changed permissions on /usr/jails/basejail to 700. Changing it to 755 fixed everything.

When your iPhone has hiccups…

Introduction

My softball team thought it would be fun to play intro music for each person as they went up to bat, like some major-league teams. I welded together a portable sound system complete with pneumatic wheels, second-hand shelf speakers, an AGM battery, and a 40W head unit.

I recently purchased a refurbished iPhone 3GS from an online retailer. I needed one for testing an application that I've been hired to build. Since I had the iPhone anyway, I figured the touch interface would work well for our team's sound box.

The Problem

The first problem, I learned, is that the iPhone cannot play a single song, then stop. It always continues on to the next song unless it is the only song in a playlist. Luckily I wasn't the only person who found this extremely stupid, and before reaching for my compiler I checked the App Store and found Benjamin Pung's One track Mind app.

The next problem was that when I plugged in the cord from the headphone jack of the iPhone to the Line In jack of the head unit, there was an annoying beat, beat, beat sound.

For the benefit of those searching, it could also sound like: click, click click; thump, thump, thump; pop, pop, pop; beat, beat beat.

I considered loose connections, impediance mismatch, and EM interference, but I was able to rule those out. Oddly, rebooting the device would make it work normally until I fiddled with the jack (I still haven't figured this out).

It is noteworthy that this symptom is not present when listening with headphones (this is where, I believe, impediance plays a role).

The Solution

Many internet searches informed me that this was a very common problem without a solution.

I notice that pushing the plug into the jack forcefully and holding made the noise stop. I also noticed that when I did so, there was just a little end-play; maybe 0.2mm. I had a hunch.

I grabbed a toothpick and went digging. I scraped the tip of the toothpick against the bottom of the jack repeatedly, and was able to pull out several small pieces of what I'll call lint – probably a mixture of dust, fibres and oil.

I plugged it in to the stereo and ta da! No more noises. No more end-play.

Moral

Once again, the simplest solution (though not necessarily the most obvious one) usually is the correct one.

I'm posting this tip because many people have this problem, and most keywords like click, beat, and pop result in pages of results completely unrelated information (thanks Dr. Dre).

jQueryMobile: Keeping the header and footer in nested listviews

When I used a nested listview for the first time, I was a bit surprised to find that it created new a new header dynamically instead of just keeping the header and footer of the parent. For my current project this is really important, so I searched around and found many people with the same expectation.

I've modified $.mobile.listview._createSubPages to support this functionality by setting data-dynamic to true or false on the  

        . Ideally this could be implemented as an event or callback so that the coder could override the

    _createSubPage

      behaviour.
    Tags: 

    If Fiddler was portable… wait, it is!

    Fiddler, the HTTP debugging proxy is an excellent tool. I use it almost every day for AJAX development, server debugging, and examining almost anything else that flys through tcp/80 on which I need to keep an eye.

    I'm a huge fan of portable apps. In fact, the fifty or so portable apps that I use regularly follow me from computer-to-computer thanks to Dropbox. I was just thinking how great it would be if Fiddler was portable. I checked the download page but was disappointed to see a portable version wasn't offered. Then I wondered…

    I downloaded Fiddler4 and used 7-Zip to open Fiddler4BetaSetup.exe. I wasn't surprised that I could open it; after all, many installers are self-extracting .exe's. What did surpise me is that when I unzipped the whole lot to its own directory, it ran perfectly. I haven't testing it thoroughly to see if anything is broken, but it did the job and I'll certainly be adding it to my portable toolkit.

    Tags: 

    How to enable password changing on remote host in roundcube on FreeBSD

    Roundcube

    Roundcube comes with a password change module, through it's disabled by default. Configuring it to change passwords on another server's passwd database is another matter. The instructions only cover using chpasswd on a Linux server to update the local password database.

    On the mail server:

    • adduser roundcube, set a shell and create a home directory.
    • visudo, adding roundcube ALL = NOPASSWD: /usr/sbin/pw

    On the web server:

    • chpass www, assigning a shell to allow logins.
    • su www, impersonate www.
    • ssh-keygen -t rsa, create an RSA private/public key pair.
    • scp /home/www/.ssh/id_rsa.pub roundcube@<em>remotehost</em>/~/.ssh/authorized_keys, copying the public key to the mail server to allow passwordless logins.

    The chpasswd driver (/www/roundcube/plugins/password/drivers/chpasswd.php will require modification.

    function password_save($currpass, $newpass) { 
        $cmd = rcmail::get_instance()-&gt;config-&gt;get('password_chpasswd_cmd'); 
        $username = $_SESSION['username']; 
        $handle = popen($cmd, "w"); 
     
        fwrite($handle, "$newpass
    "); 
        if (pclose($handle) == 0) { return PASSWORD_SUCCESS; }     
        else { 
            raise_error(array( 'code' =&gt; 600, 'type' =&gt; 'php', 'file' =&gt; __FILE__, 'line' =&gt; __LINE__, 'message' =&gt; "Password plugin: Unable to execute $cmd" ), true, false); 
        } 
        return PASSWORD_ERROR; 
    }

    And so will this line in /www/roundcube/plugins/password/config.inc.php

    // chpasswd Driver options 
    // --------------------- 
    // Command to use 
    $rcmail_config['password_chpasswd_cmd'] = "ssh roundcube@mailhost sudo pw usermod -n {$_SESSION['username']} -h 0 2&gt; /dev/null";

    Pages

    Simple Copyright Policy: If you want to reproduce anything on this site, get my permission first.