A piggy bank of commands, fixes, succinct reviews, some mini articles and technical opinions from a (mostly) Perl developer.

Make Data::Printer only display internal data, not methods

use Data::Printer { class => { show_methods => 'none', parents => 0, linear_isa => 0 } };

(source)

Ubuntu graphics drivers decided to break

HP EliteBook 8460p

Apparently I have an ATI Radeon graphics card, I only know this because Ubuntu 13.04 failed to use it to display X11 after an update one day. I could get to a command prompt but X11 would not start.

After much research, I concluded that I had to run this to get it working again:

sudo apt-get install fglrx fglrx-amdcccle

But after that my second monitor didn't work, and also whenever I disconnect the laptop from the docking station, the screen shows a mess of wiggly lines and I have to reboot.

(source, source, source)

UPDATE: Someone suggested using the built-in Intel Core i7 Pro graphics card instead, one way is to disable the ATI driver in the BIOS, another is to disable via modprobe blacklist, apparently there are easy instructions on the Ubuntu wiki.

When I tried this, the functionality was even worse: No multiple monitors.

sudo: no tty present and no askpass program specified

How to run sudo on a remote machine:

ssh user@domain.com 'sudo echo "foobar"'

Error:
    sudo: no tty present and no askpass program specified

Solution:

 ssh -t user@domain.com 'sudo echo "foobar"'

(source)

Best Android calendar notifications

Options:
  • Google calendar (built in) - notification icon only stays visible for duration of "event", so not suitable for reminding you to do something, if you don't check your phone at the right time, you won't see anything. Notifications are only visible if you pull down the notification drawer.
  • isoTimer - notification stays there, but app has a slightly weird UI and is slow.
  • Touch Calendar - ?

Catalyst controller basics

Create a controller module:

    myapp_create.pl Controller Foo

created "......../lib/Controller/Foo.pm"
created "......../t/controller_Foo.t"

Inside Foo.pm:

sub index :Path :Args(0) {
    my ( $self, $c ) = @_;
    $c->response->body('Matched XXXX::Controller::Foo in Foo.');
}

sub root :Chained('/') :PathPrefix :CaptureArgs(0) {
    # common stuff for this controller
}
                        
sub bar :Chained('root') :PathPart('bar') :Args(0) {
    my ( $self, $c ) = @_;
    # something
}

How to set network proxy from command line in Ubuntu

You might need to do this if your network settings dialog box crashes as I've seen on Ubuntu 13.10:

gsettings set org.gnome.system.proxy autoconfig-url http://myserver/myconfig.pac
gsettings set org.gnome.system.proxy mode auto

This is how I found out the settings:

$ for key in $(gsettings list-keys org.gnome.system.proxy); do echo $key = $(gsettings get org.gnome.system.proxy $key); done

autoconfig-url = 'http://myserver/myconfig.pac'
ignore-hosts = ['localhost', '127.0.0.0/8']
mode = 'auto'
use-same-proxy = false

It doesn't have to be a .pac file, ours is .dat.

(source)