Thursday, January 15, 2015

fglrx (AMD proprietary driver) on Debian Wheezy on Athlon 5350 with AM1H-ITX

The open source radeon driver works fine, but if for some reason you want to install the proprietary driver the Wheezy default will not recognize the integrated graphics AMD Radeon HD 8400. Fortunately the version in wheezy-backports does.

Add this line to /etc/apt/sources.list:

deb http://ftp.debian.org/debian wheezy-backports main contrib non-free


then

apt-get update

apt-get install -t wheezy-backports fglrx-driver fglrx-control

aticonfig --initial

reboot

Yes, the reboot is required, the open source radeon driver needs to be blacklisted and the package fglrx-driver apparently does that for you.

Friday, January 9, 2015

convert .msg files from Outlook to a format readable on linux with a text editor

How to convert .msg files from Outlook to a format readable on linux with a text editor:

from http://www.matijs.net/software/msgconv/

cpanm Email::Outlook::Message

or

cpan -i Email::Outlook::Message

or on Debian and derivatives such as Ubuntu:

apt-get install libemail-outlook-message-perl

then

msgconv my_unreadable_binary_file.msg
less my_unreadable_binary_file.eml

Wednesday, December 31, 2014

dwarf fortress on Debian x64 Wheezy

got these errors at start

./libs/Dwarf_Fortress: error while loading shared libraries: libSDL-1.2.so.0: cannot open shared object file: No such file or directory

./libs/Dwarf_Fortress: error while loading shared libraries: libgtk-x11-2.0.so.0: cannot open shared object file: No such file or directory

./libs/Dwarf_Fortress: error while loading shared libraries: libSDL_image-1.2.so.0: cannot open shared object file: No such file or directory

./libs/Dwarf_Fortress: error while loading shared libraries: libSDL_ttf-2.0.so.0: cannot open shared object file: No such file or directory

solved by adding i386 architecture and installing a couple of packages
dpkg --add-architecture i386
apt-get install libsdl1.2debian:i386 libgtk2.0-0:i386 libsdl-image1.2:i386 libsdl-ttf2.0-0:i386

this does not fix the OpenAL sound issue, but I disable the sound anyway

Thursday, December 18, 2014

Thursday, August 28, 2014

profiling Catalyst applications with Devel::NYTProf

While attempting to profile a Catalyst application with Devel::NYTProf, I kept getting errors when processing the nytprof.out file because the file was not closed properly.

The solution from http://fkumro.blogspot.ro/2011/11/using-nytprof-with-catalyst.html did not work, kept getting "panic at nytprofcalls line 191" messages.

What worked was starting with

perl -d:NYTProf scripts/myapp_server.pl

adding a

sub stop :Path {
    exit(0);
}

in the Root.pm and loading that in  the browser to stop the server.

Thursday, September 26, 2013

starman workers use too much memory and do not release it to the operating system in time

if your large data is a string, this might help http://www.perlmonks.org/?node_id=661900

if not, you can redefine the Net::Server::PreForkSimple's "done" method to mark the worker as "done" as soon as the request is finished: adjust

$memory_soft_cap 

to your liking and stick this in your psgi file


package Net::Server::PreForkSimple;
use strict;
use warnings;
use BSD::Resource;
no warnings 'redefine';
my $memory_soft_cap = 148680;
sub done {
    my $self = shift;
    my $prop = $self->{'server'};
    $prop->{'done'} = shift if @_;
    return 1 if $prop->{'done'};
    return 1 if $prop->{'requests'} >= $prop->{'max_requests'};
    return 1 if $prop->{'SigHUPed'};
    if (! kill 0, $prop->{'ppid'}) {
        $self->log(3, "Parent process gone away. Shutting down");
        return 1;
    } 
# above this is the original code 
# from Net::Server::PreForkSimple::done 
 my $rus = getrusage();
    if ( $rus->{maxrss} >= $memory_soft_cap ) {
        $self->log(3, "Maximum memory exceeded, this child will not serve more requests");
        return 1 ;
    }

    return 0;
# end customization

}

This is useful if only a few requests need a lot of memory and the workers are not recycled soon enough; if all the requests use large amounts of memory this is not the best solution, it will make starman to spawn a new worker for each request.

Thursday, May 9, 2013

install dependencies

to install dependencies for a module you got from github, in Makefile.PL add to this section
    PREREQ_PM => {
        'Moose' => 2,
        'Mason' => 2.20,
        'Plack' => 1,
    }
then
cpanm --installdeps .