Monthly Archives: September 2011

Extract contents from .html file

Quick-and-easy way to extract body from a html file:

cat myfile.html | tr -d '\n' | grep -o -E '<\s*body[^>]*>(.*?)<\s*/\s*body\s*\>'
  • cat – print file contents
  • tr – remove newlines
  • grep (and a regular expr) – get the content

You could use redirect (“>”) to send output to a file (instead of standard output):

cat myfile.html | tr -d '\n' | grep -o -E '<\s*body[^>]*>(.*?)<\s*/\s*body\s*\>' > output.html

Me @ loscoman “amelie” (video)

We shot this video some months ago, this is the first single from the “amelie” album.
Nice to be part of this, great job loscoman!!

The video cannot be shown at the moment. Please try again later.

VisualVM – monitor local and remote Java applications

Visualvm is able to measure application performance (profiler) and monitor system resources.
It’s really a nice tool if you need to monitor your tomcat and get some informations about threads, memory usage, cpu load, loaded classes, etc.

http://visualvm.java.net/

I’d say this application is fundamental to watch over your tomcat …

the healing

And a piece of the pictures bitten right out of the middle
I’m alone and thinner I feel
Is this a prayer?
Anaesthetise me just til you return
I feel the loss like a squandered opportunity to whisper
You’re all I ever needed.

Shapes fall into place
For once in your life you make
A clean breakaway.

And did you know that everything you touch is blessed and all the richer
For your love a better being
And if I display just a fraction of the soul you showed in this world
Then I know I’ll see you again

Love so much to give
And too few to share it with
Wastes you away.

The dream it comes again and again
You’re here
It’s you
I pull you close and
Hold you tight
Into the sky you go
You go
And I can’t change it
I can’t change it.

EasyInstall – Python.h: No such file or directory

Using easyinstall on a fresh ubuntu 11 installation (with python 2.7) you get the following:
fatal error: Python.h: No such file or directory

Well, you just have to install the python2.7-dev package:

$ sudo apt-get install python2.7-dev

Firefox: disable spell checker

Are those red lines bothering you?
Ok, type “about:config” in the address bar and then search for “spell“.
You should find a row with “layout.spellcheck“, set the value to “0” (zero).
Done!

Sync Google+ to Twitter

Easy way to post to twitter from your google+ account:
http://gplus.sagg.im/

SQLAlchemy (python ORM) & Zope

SQLAlchemy is a Python SQL toolkit and Object Relational Mapper (ORM) that gives application developers the full power and flexibility of SQL.

What am I talking about? I’m talking of a python library that helps you “convert” your database rows into python objects.
Zope is python-based, hence it’s easy to install and use this library with a standard Zope/Plone app.

These packages help you integrate SQLAlchemy in a Zope/Plone application:

  • z3c.saconfig: Minimal SQLAlchemy ORM session configuration for Zope
  • zope.sqlalchemy: Minimal Zope/SQLAlchemy transaction integration
  • SQLAlchemy: Python SQL toolkit and Object Relational Mapper

The package z3c.saconfig is based on zope.sqlalchemy and zope.sqlalchemy is based on SQLAlchemy.
Therefore, you can add the z3c.saconfig egg to your buildout to automatically download all the packages.
You can also use EasyInstall to install these packages, anyway I’d suggest using the buildout to keep things separated.