Sep 22 2010

Nvidia switch screen to HDMI with an hotkey

Tag: Computer World,Gentoo,Howtosjdoe @ 9:43 am

For those  who, like me, are stuck with the nvidia binary drivers on their laptops.

I use external HDMI quite often to connect to external monitors, both in office and at home. The gnome “Monitors” thing fails to detect monitors, so that I needed to clicki-clicki through nvidia-settings to enable/disable the external monitor.

Gnome Monitors with external monitor connected (and in use)

Where is my laptop panel??

Using nvidia-setting works, but requires at least 10-15 mouse clicks to enable the HDMI-attached one and disable the laptop panel. boring.

Disper

Disper is ??a switcher utility for nvidia cards. Works like a charm. I can switch to the laptop screen using disper -S and to the hdmi screen using disper -s. Cool. Keybinds Alt+F8 and CTRL+F8 is what I wanted.

Quick Howto

Download the code from launchpad or from tar

$ bzr branch lp:disper

then use cave to import in unpackaged

$ cd disper
$ make DESTDIR=/tmp/diper-root install
$ sudo chwon -R root:root /tmp/disper-root
$ sudo cave import -l /tmp/disper-root media-video/disper scm -x

At this point check if disper really works for you and how. Write down used commands

To enable keybindings, simply open gconf-editor, and then:

  • go to apps -> metacity ->keybinding_commands
  • Double click on command_1 and enter the command to enable the external monitor (in my case /usr/bin/disper -s)
  • Do the same for command_2 with the command to enable the laptop panel.
  • Go to ??apps -> metacity -> global_keybindings
  • Double click on command_1 and enter <Alt>+F8 (note, the <> are needed for special keys)
  • Double click on command_2 and enter <Ctrl>+F8
  • Done

Jan 31 2010

Oh yeah!

Tag: Computer World,Net Walkingjdoe @ 12:41 pm

That’s the news I was waiting for.

Oh yeah!

http://www.osnews.com/story/22811/Google_Phasing_Out_Support_For_IE6_in_2010


Jan 10 2010

Trying to get windows vista refund from MSI italia

Tag: Computer World,Personal,Software Liberojdoe @ 12:11 pm

Recently my girlfriend bought a MSI x340 laptop. It comes with a pre-installed (and paid) version of Windows Vista Home Premium. At the first boot I’ve refused (resits!) and not agreed with the EULA. So we are now trying to get the refund for the MS tax.

I’ll keep here a log about this story.

First step: contacted ADUC (in italian), and started doing the paperwork. Tomorrow Thursday we’ll ship the letter via mail.

Update: the letter has been sent on Tue 12 Jan 2010

Update: MSI responded, they are about to contact me by phone.

Update: After a quick call, they sent me the “refund process” I’ve to follow. They want me to send back the laptop to them to make the win sticker removed. This is not going to happen. I’ve contacted ADUC about this issue, waiting for them to answer


Oct 25 2009

New ebuilds in the AQuoSA repository

Tag: Computer World,Gentoojdoe @ 11:53 am

There are some updates in the AQuoSA ebuild repository:

* aquosa-qosres and aquosa-qosmgr now have the -scm CVS ebuild

* two new ebuild: sys-kernel/deadline-sources and sys-process/schedtool-deadiline[1]

[1] SCHED_DEADLINE is an implementation of the popular Earliest Deadline First (EDF) scheduling algorithm or the Linux kernel. It is still experimental code, and it is still continuously being improved, but it already is a fully-working solution for supporting typical real-time applications in GNU/Linux environments. [read more]

[UPDATE 27/10/09]:  added two new ebuild for sys-kernel/aquosa-sources-2.6.32_rc5 and sys-apps/aquosa-qosres-1.3.0 (version bumps)

[UPDATE 28/10/09]: added ebuild for the sys-kernel/edfthrottling-sources.  Official description says:

This patchset introduces a group level EDF scheduler extending the
throttling mechanism, in order to make it support generic period
assignments.  With this patch, the runtime and period parameters
can be used to specify arbitrary CPU reservations for RT tasks.

[UPDATE 28/10/09]: added ebuild for sys-libs/libcgroup to work with cgroups when using deadline-sources or edfthrottling-sources


Oct 18 2009

Gentoo Backuppc (plus some other goodies) ebuild repository

Tag: Gentoojdoe @ 8:18 pm

While crawling bugs.gentoo.org today to find backuppc updated ebuilds (those in portage are rather old, 2.1.2 while last released version is 3.1.0) I’ve found a post of Lenno Nagel saying he has written an updated ebuild.
So I contacted him by mail (really a nice guy :) ), he gave me the repository subversion url and then I’ve tested his ebuilds.

Which work very well. The positive is that now I have a fully functional web interface, which was not with the old 2.1.2-r1 version.
The repository can be fetched with

svn co https://eudemon.infovorgud.ee/svn/utils/portage/

    Portage configuration:



# cd /usr/local/portage/
# svn co https://eudemon.infovorgud.ee/svn/utils/portage/ utils-overlay
# echo 'app-backup/backuppc ~*' >> /etc/portage/package.keywords

And added this line to /etc/make.conf:
PORTDIR_OVERLAY=”/usr/local/portage/utils-overlay”

    Paludis configuration


create a new file in /etc/paludis/repositories/ named utils-overlay.conf with the following content:

location = ${ROOT}/var/paludis/repositories/utils
sync = svn+https://eudemon.infovorgud.ee/svn/utils/portage/
master_repository = gentoo
format = ebuild
write_cache = /var/cache/paludis/metadata
names_cache = /var/cache/paludis/names

(change you paths as needed)

The sync the first time using
paludis --sync x-utils-overlay
then:
# echo 'app-backup/backuppc *' >> /etc/paludis/keywords.conf

Thanks again Lenno for your ebuilds :)


Oct 12 2009

Evolution: no components

Tag: Computer World,Gentoo,Software Liberojdoe @ 2:41 pm

If you are using gentoo, and after an evolution recompile/upgrade you end up with a situation like this

evolution fail

recompile evolution again, removing -Wl,-z,now from you LDFLAGS.


Sep 24 2009

Ebuild Repository for the AQuoSA project

I’ve been recently working, as part of my thesis, with the AQuoSA architecture.

Since I’m a gentoo user and no ebuild did exist (at least, I did not find them), I’ve created an ebuild repository.

To use it you need bzr installed, and yes, it’s *really* a good thing if you read the AQuoSA doc before installing any of these ebuilds.

$ bzr co http://bzr.cnglab.net/aquosa-repo

as of now included ebuilds are:

sys-kernel/aquosa-sources : full linux sources with generic scheduler patch
sys-apps/aquosa-qosres    : qres program and aquosa headers, plus the qresmod linux module and aquosa init script
sys-apps/aquosa-qosmgr    : qmgr program
www-apache/mod_reserve    : apache2 module to provide QoS thought the AQuoSA infrastructure
media-sound/jack-audio-connection-kit : as of now it's unrelated to AQuoSA, but it's a WIP ebuild for jack2 svn
                                        with support for the pipelining branch. This ebuild is based on the proaudio
                                        repository ebuild.

Please report back to me every problem you will (yes, you will :) ) encounter using these ebuilds.

Instructions for paludis:

create a aquosa.conf file in the /etc/paludis/repositories/ directory with the following content

location = ${ROOT}/var/paludis/repositories/aquosa
sync = bzr+http://bzr.cnglab.net/aquosa-repo
master_repository = gentoo
format = ebuild
write_cache = /var/cache/paludis/metadata
names_cache = /var/cache/paludis/names

obviously change the location path to match your system settings.

then do the first-time sync of the repository:

$ paludis --sync x-aquosa

Instructions for portage:

sorry, I don’t use portage since I switched to paludis, If someone wants to contribute install instructions for portage he/she is welcome.

location = ${ROOT}/var/paludis/repositories/aquosa
sync =
master_repository = gentoo
format = ebuild
write_cache = /var/cache/paludis/metadata
names_cache = /var/cache/paludis/names

Apr 17 2009

web2py behind apache with mod_wsgi part II: mod_rewrite rules

Tag: Computer World,Howtos,Software Liberojdoe @ 2:48 pm

Ok, in the previous post I’ve shown a way to run web2py behind apache  using mod_wsgi.

The main “problem” still to be addressed is: URIs. Assume you have 3 website which implies (in the common case) 3 web2py application,

  1. www.primo.it with the we2bpy app called primo
  2. www.secondo.it , appname is secondo
  3. www.terzo.it, appname is terzo.

(ok, maybe I lack of fantasy … )

Now we ended up having a vhost with

ServerName web2py.localhost

so all of our 3 applications are at

web2py.localhost/primo/default/index, web2py.localhost/secondo/default/index, web2py.localhost/terzo/default/index. It should work, but it’s not what we want.

The simplest thing here is to add

ServerAlias www.primo.it www.secondo.it www.terzo.it

to the vhost conf file. This works, but has a couple of disadvantages:

  1. application name is still in the url (i.e. www.primo.it/primo/default/index)
  2. secondo and terzo are available from primo’s url and vice-versa (www.primo.it/secondo/default/index shows secondo application)

Here enters mod_rewrite. Leave the ServerAlias in place, as they are needed.

Disclaimer I’m **NOT** a mod_rewrite guru -as you’ll see-, and I really think that there are better ways to accomplish this task: suggestions are welcome ^^

Starting with www.primo.it, add this at the beginning of the vhost file, just after the DocumentRoot directive:

RewriteEngine On

RewriteCond %{HTTP_HOST} =www.primo.it [NC,OR]
RewriteCond %{HTTP_HOST} =primo.it [NC]
RewriteRule /primo/(.*) /$1 [N]

RewriteCond %{HTTP_HOST} =www.primo.it [NC,OR]
RewriteCond %{HTTP_HOST} =primo.it [NC]
RewriteRule ^/(.*) /primo/$1 [PT,L]

The first “block” is needed to fix “links” in web2py applications, so that if you are using URL() function it continues to work. The problem it addresses is that we don’t want application name in URLs buth URL() keeps adding it. So we remove it;  the [N] flag after  the first RewriteRule means “restart from the beginning after applying” (the downside is that this is an external redirect :( )

The second “block” is needed to do the actual work: it transparently add the app name to the request, but the url in user browser remains without. So one user accessing www.primo.it/default/index arrives to wsgi as if he/she was calling www.primo.it/primo/default/index (and the user still have www.primo.it/default/index) in his/her location bar. The [L] flags means “last” (i.e. stop processing rewrites) and [PT] means “jump directly to the next alias handler”, which is the WSGIScriptAlias defined in previous posts.

Repeat this two blocks (RewriteEngine On is needed only the first time) for every application you have (you can do includes in separate files if you wish)  and you end up having

  • www.primo.it that redirect to www.primo.it/default/index.
  • www.primo.it/secondo/default/index still working
  • web2py.localhost/primo/default/index still working
  • https (i.e. management) only on web2py.localhost. If you want https support for primo.it you should add the rewrite rules event to the https section, (or -better- include two times the same file)

Hope this helps… and if you have better options or ideas write a comment :)

Last thing about the RewriteCond: yes, I already know that it can be done with a regex instead of using the =www.primo.it AND rewriting the condition without www. but I like this way far more as it’s simpler and much more understandable.


Feb 26 2009

Configure web2py to run behind apache with WSGI (mod_wsgi)

Tag: Computer World,Howtosjdoe @ 1:17 pm

Web2py

Install web2py

First, what you need is to install web2py. This could be as simple as download/unzip (in this case do it yourself), but I think a better option is to make revision control system do the “update job” for us :)

Since I’m a bazaar user and web2py has a branch on launchpad let’s use it.  The branch is a development branch, so check the log to see a revision which is marked as release. At the time of writing revision 555 is marked as release 1.56.4 in the logs:

555.  By Massimo Di Pierro <email address hidden> on 2009-02-23
                1.56.4

So cd in the directory where you wish to store you web2py applications and get the code (remember the revision we checked above)

$ cd /var/www/
$ bzr branch -r 555 lp:~mdipierro/web2py/devel web2py

Next time you want to upgrade web2py to the next release simply check the new revision and pull your changes.

$ cd /var/www/web2py/
$ bzr pull -r XYZ

Configure web2py

You need to chown the directory so that the webserver user can write *.pyc files.
You can override the user in the configuration, so you basically have to choices:

  • The user running apache (apache on gentoo, www-data on ubuntu)
  • Use your user (useful only for development, not suitable in production)

Since here we are talking about production, let’s take the first option

$ groupadd web2py
$ chown -R apache:web2py /var/www/web2py
$ chmod -R g+w /var/www/web2py

The web2py group is optional, of course.
Now start web2py “normally” so that it create required files. Insert a password for the admin page, and remember it. Stop web2py by hitting CTRL+C

$ python web2py
...
...
CTRL+C

Now, it should be present two files in the web2py directory:

  • options_std.py
  • parameters_8000.py

Edit options_std.py and ensure that the line

password = '<recycle>'

is present (it really should)
Create some symlinks:

ln -s options_std.py options.py
ln -s parameters_8000.py parameters_80.py
ln -s parameters_8000.py parameters_443.py

Ok, we’re done with web2py configuration, let’s concentrate on apache and mod_wsgi.

Apache

Installation

Apache install it’s not covered here. Apache and apache ssl is assumed to work before following these istructions

Install required modules

Install mod_wsgi and enable it
On Ubuntu:

$ sudo apt-get install libapache2-mod-wsgi
$ sudo a2enmod wsgi

On Gentoo:

sudo paludis -i www-apache/mod_wsgi
sudo vim /etc/conf.d/apache2
--> add -D WSGI to APACHE2_OPTS variable

Configure vhost

Web2py with wsgi require that you run it in it’s own vhost.
For this to work you have to use a different domain from “localhost”
A dirty hack is to add a new domain name for localhost in /etc/hosts and use it for web2py
open /etc/hosts and add an alias for 127.0.0.1. Obviously on production system you should not have this problem
and you can use a “real” domain name

127.0.0.1 ... ... web2py.localhost

“… …” is not really there in the file, it’s just a placeholder for things already written on that row.

Next, create a new vhost file:

Ubuntu

vim /etc/apache2/sites-available/web2py

Gentoo

vim /etc/apache2/vhost.d/web2py.conf

Vhost file

In the editor, write the following in this file
** CHECK ALL PATHS, SPECIALLY FOR CERTIFICATES **
sample_vhost.conf

OK, almost done. On ubuntu enable the vhost

sudo a2ensite web2py

next, (on ubuntu) add

NameVirtualHost *:443

after the line

<IfModule mod_ssl.c>

in file /etc/apache2/sites-enabled/default-ssl

then restart apache (do not reload, need restart)
sudo /etc/init.d/apache2 restart

go to http://web2py.localhost/ and you should see the welcome page.
https://web2py.localhost/ should work too.

Next article will introduce a bit of mod_rewrite work to manage default application on a per-domain base.


Dec 04 2008

E finalmente…. python 3.0!

Tag: Computer World,Net Walking,Software Liberojdoe @ 1:28 pm

Habemus python 3000

http://www.python.org/download/releases/3.0/

Molte le novità più o meno succose:

  • Finalmente una print a modo
  • Carine le modifiche sull’ordine degli operatori di comparazione
  • unicode, Unicode, UniCode, UNICODE!
  • PEP 3101
  • I cambiamenti sulle eccezioni, tipo l’uso di as invece delle virgola quando si usca except
  • except MyException as myvar: contro except MyException, myvar: e lo stesso quando si usa raise.

E, ovviamente uno zilione di cambiamenti che potete vedere qua: http://docs.python.org/dev/3.0/whatsnew/3.0.html.


Ora si tratterà di rendere compatibili tutti gli script che ho.. uh… aspetta.. non c’è _quasi nulla_ che mi interessa che continui a esistere in py3..
quindi … vorrà dire che sarà il focus per i nuovi script


Next Page »