• Blog engine changed to Jekyll

    This weekend I wanted to blog about libgit2sharp but I realized that my setup for blogging wasn’t really practical. I used dotclear but by insisting on markdown and refusing the graphical editor it was only an hindrance for me.

    In response I investigated the domain of the simple blogging platforms running only locally and generating html files. The one I ended up using is a ruby tool named Jekyll; the one that is used by GitHub for their GitHub pages.

    What is nice is that using a web-hook on my blog repository the simple fact of pushing a new markdown file or modifying a sass file will re-generate all my blog with the changes.

  • Using CommandBindings in MVVM

    One sad thing in WPF currently is that the CommandBindings used to attach an action to a RoutedCommand don’t support the MVVM pattern : Their properties can’t be easily bound to the DataContext, and they don’t support attaching a command represented by an ICommand.

    One of the solutions have always been to use the command sink that Josh Smith provided in it’s CodePlex article Using RoutedCommands with a ViewModel in WPF. But it’s syntax force multiple changes on the view and also force the model to implements the Execute and CanExecute independently out of an ICommand and don’t begin to support the CanExecuteChanged event.

    My solution was to roll my own classes, that you could find in a Gist on GitHub to use it instead of a CommandBindings block in your UIElement you declare an attached property called Mvvm.CommandBindings and use it with nearly the same syntax :

        <Window x:Class="BlackFox.SampleWindow"
                xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                xmlns:f="clr-namespace:BlackFox"
                >
            <f:Mvvm.CommandBindings>
                <f:MvvmCommandBindingCollection>
                    <f:MvvmCommandBinding
                       Command="f:MyRoutedCommands.SomeRoutedCommand"
                         Target="{Binding MyCommandInViewModel}"
                         CanExecuteChangedSuggestRequery="True" />
                </f:MvvmCommandBindingCollection>
            </f:Mvvm.CommandBindings>
        </Window>
    

    The only differences are that there is a Target (ICommand) property instead of the methods and that you could optionally force a CommandManager.InvalidateRequerySuggested(); when the command’s CanExecuteChanged event is raised.

  • Using svndumpfilter to extract a folder in it's own repository

    What i’ll explain here is how to use the svndumpfilter program to extract a folder of an SVN repository in it’s own repository and make it disappear from the history of the original one.

    What you’ll need

    You will need direct access to the server and to warn all your users that they’ll need to checkout again everything you will move (if you don’t renumber the revisions otherwise all users will need to checkout again any part of the repository they use)

    Knowing what to filter

    You will need to include all the folders you want along with all the folders where something moved, for example if you want /some/dir but it was at some point in the history named /somedir and renamed later you need to include both in the filter.

    The same apply if only some of the files moved from there in this case you need to include each file that moved.

    You’ll end up with a list of files and directories representing all the history of the files that will be extracted.

    Dump the repository

    The first step is to dump the repository as svndumpfilter only act on dumps and not on directories themselves

    svnadmin dump repo > repo.dump
    

    Filter the history and load it in a new repository

    To create a dump that contains only the change in our chosen directories the command is :

    svndumpfilter include --drop-empty-revs --renumber-revs /some/dir /somedir < repo.dump > repo-only-some-dir.dump
    

    The two options --drop-empty-revs and --renumber-revs are what you’ll need in 99% of the cases but anyway you’ll either want both or none :

    • Both will give you a clean new repository with new revisions starting at zero and no empty revisions. It’s clean but if you had anywhere else (in the source code comments, in your issue tracker or in some commit message) something referencing “r3628” it will now be incorrect.
    • None will give you a chance to have the same revision numbers (Only if you don’t need to create new directories otherwise all revision numbers will move, see next paragraph)

    Then you’ll need to create a new repository

    mkdir newrepo
    svnadmin create newrepo
    

    If some of the directories you included had a parent that wasn’t himself included (like our /some/dir directory) you need to create them back

    svn checkout "file:////path/to/newrepo/" newrepocheckout
    mkdir newrepocheckout/some
    svn add newrepocheckout/some
    svn commit newrepocheckout -m "Prepare to load filtered history"
    rm -R newrepocheckout
    

    Then finally load your filtered history :

    svnadmin load newrepo < repo-only-some-dir.dump
    

    Remove the files from the originating repository history

    It’s simplier as you normally won’t have to create any directory, just load the dump in place of the old repo.

    The same choice is offered to you regarding removing the now-empty revs from the history and renumbering the other revisions but in this case it’s more logical to keep the revisions as it will allow for all users that hadn’t checked out the removed directories to continue to work with their checkouts. Otherwise they’ll need a clean new checkout.

    rm -R repo
    svndumpfilter include /some/dir /somedir < repo.dump > repo-without-some-dir.dump
    mkdir repo
    svnadmin create repo
    svnadmin load repo < repo-without-some-dir.dump
    
  • SSL Observatory how to load the db

    The SSL Observatory is a great project from the EFF to gather all SSL certificates available on HTTPS websites and publish them for analysis. For more details see the SSL Observatory website.

    The main problem if you don’t want to analyse it using their pre-configured Amazon EC2 configuration is that the compressed .sql file is around 3 Go compressed using LZMA and 3 To uncompressed so you can’t even un-compress the file and need to pipe directly from 7-Zip to mysql.

    To do it either on windows or linux :

    7z e -so "observatory-dec-2010.sql.lzma" f | mysql -u root --password=toto42sh observatory2
    

    Note: The 7z tools is in the p7zip package on a debian system.

  • Things to do after formating a Sheevaplug

    Once a SheevaPlug is formated with sheevaplug-installer the minimum to do is :

    Set the MAC address

    Connect to the serial console, enter U-Boot and set the MAC address :

    setevn ethaddr 00:50:43:01:D2:94
    saveenv
    reset
    

    Set timezone and hostname

    Login and type :

    # Set the time-zone
    dpkg-reconfigure tzdata
    #Set the host name
    echo plugfox.vbfox.local > /etc/hostname
    /etc/init.d/hostname.sh