Code And Run

Author: Alex

  • 12km progressivo, circa

    Anche un’uscita nel caldo torrido. Prima metà dell’allenamento tranquilla, in compagnia; seconda metà molto pesante con alcune pause per rifiatare nonostante abbia rallentato i ritmi

    Pace: 4:44min/km

    Elevation: 51mt

    Distance: 11.50km

    Duration: 54:28

    image

  • 6×1000 ☀🔥➡🏃☠

    Secondo giorno di allenamento, dormito poco, caldo pesante, ripetute in falsopiano per sfruttare l’ombra. Dovevano essere 8, son diventate 6; dovevano essere a 4:00min/km son state a 10s/km in più. Viste le premesse, è andata bene 😉

    Pace: 5:21min/km

    Elevation: 46mt

    Distance: 8.67km

    Duration: 46:25

    image

  • Progressivo con pause rinfrescanti ☠️

    Prima uscita in preparazione per l’Engadiner Sommerlauf, gara di 25km su sentiero bianco pianeggiante che si tiene a St. Moritz.

    Temperatura bollente, ho dovuto fare qualche pausa all’ombra perché era davvero dura tenere un buon ritmo. 10km di progressivo portati a casa.

    Pace: 4:26min/km

    Elevation: 44mt

    Distance: 10.01km

    Duration: 44:20

    image

  • Giro monte di Caslano

    Pace: 4:37min/km

    Elevation: 73mt

    Distance: 17.57km

    Duration: 1:21:05

    image

  • Cinnamon screenshot applet default folder

    I’ve switched some weeks ago to Linux Mint and Cinnamon from Xfce and in these days I’m a kind of exploring the new desktop.

    I’m used to take screenshot for work, totake some notes and so I installed the Cinnamon screenshot applet.

    image

    After some day using it I was a bit bored by the screenshots saved in Pictures folder by default so I traied to change this behaviur.

    Looking into the applet js file i discover that the applet is based on gnome-screenshot and so I find an easy solution to my problem.

    You can edit the with dconf-editor the configuration string

    org.gnome.screenshot.auto-save-directory

    ad set you favorite screenshot folder!

  • Calling JS class methods from Silverlight application

    I’m working on a project in which we have to call some JS method of the containing page from a Silverlight application.

    It seems to be really straight forward like:

    HtmlPage.Window.Invoke("GlobalJsMethod",param1,param2);
    
    HtmlPage.Window.Invoke("GlobalJsMethod",param1,param2);
    

    But this works only for global methods and not for JS class methods.

    In fact this will not work:

    You can make a global wrapper for every class methods but you can also do something like this:

    private ScriptObject _jsObject = HtmlPage.Window.Eval("JsClassInstance") as ScriptObject;
    private void UserControl_Loaded(object sender, RoutedEventArgs e)
            {
                    _jsObject.Invoke("JsMethod",param1,param2);
            }
    
    private ScriptObject _jsObject = HtmlPage.Window.Eval("JsClassInstance") as ScriptObject;
    private void UserControl_Loaded(object sender, RoutedEventArgs e)
            {
                    _jsObject.Invoke("JsMethod",param1,param2);
            }
    

    that is far more elegant.

    This is only a quick tip. Maybe I’ll write a more detailed post an JS-Silverlight interaction in the future.

  • Xfce loses theme settings

    image

    Today I started my xfce desktop and it looks like …“different”. No theme loaded, default icons, no background. I tried to change theme from Xfce Settings but nothing, it doesn’t work.

    My .session-errors reveals a

    After a bit o googling it seems to be an aged bug of xfce when used on multiple monitor configuration.

    The solution, or better, the workaround is to delete the file:

    Now you can log out and log in again in your themed Xfce 🙂

  • Silverlight: detecting design mode

    Just a quick tip useful when you have to do something special for Silverlight designer to work correctly.

    bool _inInDesignMode = DesignerProperties.IsInDesignTool;
    
  • Opml to Html converter

    Yesterday I discovered that wordpress does not have a blogroll feature any more so I looked around to find a way to show my feedly subscription list in my blog.

    I didn’t find anything interesting so decided to implement a simple javascipt class to convert the opml file exported from feedly to an html page so that I could easily create a wordpress page or widget.

    The script is really very simple, it takes the ompl, deserialize it and create a corresponding HTML string using from a basic template defined in the JS itself. It can be certainly improved (for example adding some css class to the template for graphical customization) but, for now, it just work for my needs.

    In this version you can customize the export style editing the first lines of the JS:

    this.export_template = '<html><title>Opml export</title><body>{INNERHTML}</body></html>';
    
    this.html_template = '<h1>{OPMLTITLE}</h1>n<ul>{ITEMS}</ul>';
    
    this.rss_template = '<li>[<a href="{XMLURL}">RSS</a>] <a href="{HTMLURL}">{TITLE}</a></li>n';
    
    this.folder_template_start = '<li>{TITLE}n<ul>n';
    
    this.folder_template_end = '</ul></li>n';
    
    this.export_template = '<html><title>Opml export</title><body>{INNERHTML}</body></html>';
    
    this.html_template = '<h1>{OPMLTITLE}</h1>n<ul>{ITEMS}</ul>';
    
    this.rss_template = '<li>[<a href="{XMLURL}">RSS</a>] <a href="{HTMLURL}">{TITLE}</a></li>n';
    
    this.folder_template_start = '<li>{TITLE}n<ul>n';
    
    this.folder_template_end = '</ul></li>n';
    

    These variables describe the export format:

    • export_template is the template for the export html page;
    • html_template is the template for the page content;
    • rss_template is the template for each RSS line;
    • folder_template_start is the template for the opening tag of RSS folder line;
    • folder_template_end is the template for the closing tag of RSS folder line.

    You can find it on ghitub, under my script repository: opml.js and opml.html.

    I hope it can be useful.

  • vmware crash on startup after curl update

    After today update of debian Sid VMWare keep crashing on startup without any interesting log.

    . The crash it’s caused by the curl update that changed the lib interface.

    There are two ways of solving this: downgrade Curl (i.e. using snapshot debian) or applying a patch that force vmware to use its own libcurl instead of the system one.

    Thewe are the 2 patches, one for vmware and one for vmplayer:

    --- /usr/bin/vmware-original 2013-02-09 18:22:36.194459631 +0100
    +++ /usr/bin/vmware 2013-02-09 18:22:45.234459997 +0100
    @@ -93,6 +93,7 @@
    
    if "$BINDIR"/vmware-modconfig --appname="VMware Workstation" --icon="vmware-workstation" &&
    /sbin/modinfo vmmon; then
    + export LD_LIBRARY_PATH=/usr/lib/vmware/lib/libcurl.so.4
    exec "$libdir"/bin/"vmware" "$@"
    fi
    
    --- /usr/bin/vmware-original 2013-02-09 18:22:36.194459631 +0100
    +++ /usr/bin/vmware 2013-02-09 18:22:45.234459997 +0100
    @@ -93,6 +93,7 @@
    
    if "$BINDIR"/vmware-modconfig --appname="VMware Workstation" --icon="vmware-workstation" &&
    /sbin/modinfo vmmon; then
    + export LD_LIBRARY_PATH=/usr/lib/vmware/lib/libcurl.so.4
    exec "$libdir"/bin/"vmware" "$@"
    fi
    
    --- /usr/bin/vmplayer-original 2013-01-30 22:06:11.253190017 +0100
    +++ /usr/bin/vmplayer 2013-02-09 20:38:33.488125792 +0100
    @@ -93,6 +93,7 @@
    
    if "$BINDIR"/vmware-modconfig --appname="VMware Player" --icon="vmware-player" &&
    /sbin/modinfo vmmon; then
    + export LD_LIBRARY_PATH=/usr/lib/vmware/lib/libcurl.so.4
    exec "$libdir"/bin/"vmplayer" "$@"
    fi
    

    I decided to apply the patches so that I can update the whole system.

    --- /usr/bin/vmplayer-original 2013-01-30 22:06:11.253190017 +0100
    +++ /usr/bin/vmplayer 2013-02-09 20:38:33.488125792 +0100
    @@ -93,6 +93,7 @@
    
    if "$BINDIR"/vmware-modconfig --appname="VMware Player" --icon="vmware-player" &&
    /sbin/modinfo vmmon; then
    + export LD_LIBRARY_PATH=/usr/lib/vmware/lib/libcurl.so.4
    exec "$libdir"/bin/"vmplayer" "$@"
    fi
    
  • My new wallpaper

    Here is my new desktop wallpaper (and current blog header), one of the best shot I’ve taken during my MTB trips.

    image

    Wallpaper Crocione!

    It was taken here on Cuvignone pass and, on the background, you can see (from left to right): lake Varese, lake Monate and lake Maggiore.

    I think it’s worth a visit!