Skip to main content

a silhouette of a person's head and shoulders, used as a default avatar

Look who's sponsoring Ruby

Last weekend saw the Ruby Hoedown conference at RedHats Raleigh Headquarter, listing Microsoft as a sponsor. Interesting.

For those of you wondering Why Ruby ?, look at the conference website.
The Ruby language is growing exponentially, partially because it offers more flexibility than other more common languages.
Now add Suns support for Ruby last year, the famous Ruby on Rails web development framework and broad platform support, this language is still HOT.

the avatar of Flavio Castelli

Xesam and bathroom hacking

Yesterday morning I was quite arrived at work when Laura (my gf) called me. Something went wrong in our bathroom and water was everywhere. She closed the main water tap and I took the first train for home (yes, since I’m an outlier I take the train two times per day). Once arrived at home I performed some hacking on the guilty washing machine, checked some pipes and than took the next train for office.

In the end yesterday I spent approximately four hours on the train. During this elapse of time I started the Xesam User Language parser :) During the travels I:

  • refreshed my memories about Flex, Bison and language parsers in general
  • wrote XesamUserLanguage’s BNF grammar
  • wrote Flex scanner
  • started Bison parser

Now, after fixing some build errors, I’ll start writing Bison’s grammar rules. These rules will translate Xesam user language queries into Strigi::Query objects.

I hope it will work (both bathroom and Xesam parser ;) )

the avatar of Flavio Castelli

How to have some fun with Strigi and Xesam queries

Last day just after I hit the “submit” button a doubt came into my mind: “did I say everything ?” Well, the answer is “No!” In fact I forgot to tell you one of the most important things: how to have some fun with Strigi and Xesam! Actually the only way to perform XesamQueryLanguage queries with Strigi is through the strigicmd program.

Strigicmd is a command-line tool shipped with Strigi. It can perform different actions like:

  • create Strigi indexes
  • remove items from index
  • list all files contained into an index
  • retrieve informations associated to an indexed file
  • update the contents of your index
  • query the index
  • perform a query using XesamQueryLanguage

So, if you want to try the new Xesam support you’ve just to use strigicmd with the xesamquery option. The command syntax is: strigicmd xesamquery -t backend -d indexdir [-u xesam_user_language_file] [-q xesam_query_language_file] As you can expect you’ve to save your Xesam query to file and point strigicmd to it.

This is a really small step-by-step guide:

  • Create a new Strigi index (in this case I’ll index all irc logs): strigicmd create -t clucene -d temp/ logs/
  • Create a simple file containing your Xesam query. You can find some example query on Xesam site or inside strigi tarball (complete path: strigi/src/streamanalyzer/xesam/testqueries/). This is a stupid and easy query:

    {% codeblock [query] [lang:xml ] %} Oever jos {% endcodeblock %}

  • Perform the search, just type:

    strigicmd xesamquery -t clucene -d temp/ -q ~/irc_oever.xml

  • Enjoy the search results ;)

Remember that XesamUserLanguage query language isn’t yet supported.

the avatar of Flavio Castelli

Strigi gets XesamQueryLanguage queries support

Since last Thursday Strigi gained XesamQueryLanguage support. This means that now is possible to process queries formulated using this syntax.

But why is this important? If you aren’t able to answer the previous question probably you don’t know what is Xesam. Here’s a short definition taken from the official site: Xesam is an umbrella project with the purpose of providing unified apis and specs for desktop search- and metadata services. Thanks to dbus and Xesam it will be possible to access the informations indexed by Strigi (and all the desktop searching programs supporting these technologies) in a standard and easier way. Isn’t it cool?

Credits

I’ve to say a big “thank you” to Fabrice Colin (author of pinot) because my Xesam code relies upon his work.

Future tasks

My work isn’t yet finished. Xesam defines two kind of queries:

  • Xesam user language queries
  • Xesam query language queries Fabrice’s code for XesamUserLanguage queries uses Spirit library. Since we don’t want to depend against the boost library, I’ll write a new parser for this language.

By now I’m thinking to accomplish this task using flex, but I’m just in a preliminary state. Suggestions are welcome!

P.S. I’m really happy because this is my first post published on PlanetKDE. Hello to everybody!

a silhouette of a person's head and shoulders, used as a default avatar

How to check that RoR is working in Plesk 8.1.1

I had the possibility to upgrade my Plesk instalation from 8.0.1 to 8.1.1 without to pay additional money . In the new release notes they mentioned that Ruby on Rails is supported, so I tried it to see. The upgrade was fine, and now I have RoR installed.

To activate it you have to add fast_cgi support for your site. This option is in the same place like the others options (perl/php/python/cgi support).

To check that RoR is installed and it is working:

1. go into the document root folder for that domain.com:

# cd /srv/www/vhosts/domain.com/httpdocs/

2. create a simple RoR application:

# rails myapp

3. go into application directory:

# cd myapp

4. start WEBrick server on 9999 port:

# ruby script/server -p 9999

If you don’t specify a port, default is 3000 but in my case this port was already used.

For more options use the –help option:

[root@bijoux]# ruby script/server --help
=> Booting WEBrick...
Usage: ruby server [options]

    -p, --port=port                  Runs Rails on the specified port.
                                     Default: 3000
    -b, --binding=ip                 Binds Rails to the specified ip.
                                     Default: 0.0.0.0
    -e, --environment=name           Specifies the environment to run this server under (test/development/production).
                                     Default: development
    -m, --mime-types=filename        Specifies an Apache style mime.types configuration file to be used for mime types
                                     Default: none
    -d, --daemon                     Make Rails run as a Daemon (only works if fork is available -- meaning on *nix).
    -c, --charset=charset            Set default charset for output.
                                     Default: UTF-8

    -h, --help                       Show this help message.

5. check your application in browser:

http://www.domain.com:9999

Now, you can see: Welcome aboard so, it is working.

That’s all, bye!

a silhouette of a person's head and shoulders, used as a default avatar

Enabling Sources on openSUSE 10.2

Disable ZMD before proceeding:

su -c "rczmd stop"
su -c "rpm -e zmd libzypp-zmd-backend sqlite-zmd rug zen-updater"

Now you can use YaST, Zypper or Smart.

Zypper is the new command line tool in the openSUSE package management stack. You can use it just like rug.

To add the relevant sources, issue the following commands:

su
rpm --import http://linux01.gwdg.de/~pbleser/guru-rpm.asc http://packman.unixheads.com/suse/10.2/gpg-pubkey-1abd1afb.asc
zypper -v sa http://ftp.skynet.be/pub/ftp.opensuse.org/opensuse/distribution/10.2/repo/oss/ suse-oss102
zypper -v sa http://ftp.skynet.be/pub/ftp.opensuse.org/opensuse/distribution/10.2/repo/non-oss/ suse-non-oss102
zypper -v sa http://ftp.skynet.be/pub/ftp.suse.com/suse/update/10.2/ update102
zypper -v sa http://ftp.skynet.be/pub/suser-guru/rpm/10.2/ guru102
zypper -v sa http://ftp.skynet.be/pub/packman/suse/10.2/ packman102

The -v option just provides a little extra verbosity; it isn’t required. For other options, see Using Zypper

Smart is a popular meta-package manager contained on the openSUSE CDs and DVD. To add the repositories via Smart, simply:

su
smart channel --add suse-oss102 type=yast2 baseurl=http://ftp.skynet.be/pub/ftp.opensuse.org/opensuse/distribution/10.2/repo/oss/
smart channel --add suse-non-oss102 type=yast2 baseurl=http://ftp.skynet.be/pub/ftp.opensuse.org/opensuse/distribution/10.2/repo/non-oss/
smart channel --add update10.2 type=rpm-md name="update 10.2" baseurl=http://ftp.skynet.be/pub/ftp.suse.com/suse/update/10.2/ 
smart channel --add packman102 type=rpm-md name="Packman 10.2" baseurl=http://ftp.skynet.be/pub/packman/suse/10.2/
smart channel --add guru102 type=yast2 name="Guru 10.2" baseurl=http://ftp.skynet.be/pub/suser-guru/rpm/10.2/
smart update

Note that the sources above all use ftp.skynet.be. More mirrors exist, it’s recommended to use one in your vicinity. See Package_Sources/Mirrors for more information.

a silhouette of a person's head and shoulders, used as a default avatar

How to install Subversion on Plesk 8.1

I will try to explain step by step how I installed Subversion on a Virtual Private Server wich runs Plesk 8.1.1 as control panel and Suse Linux 9.3 as operating system:

First step is to download subversion package, now the latest version is 1.4.4. It is very nice that they offer also a package with dependencies. So, we download:

subversion-1.4.4.tar.gz

subversion-deps-1.4.4.tar.gz

Unpack them:

# tar -zxvf subversion-1.4.4.tar.gz
# tar -zxvf subversion-deps-1.4.4.tar.gz

The second command will include the dependencies in the same directory with main subversion package.

We compile and install the subversion package and dependencies:

# cd subversion-1.4.4
# ./autogen.sh
# ./configure
# make
# cp /etc/apache2/sysconfig.d/loadmodule.conf /etc/apache2/httpd2-prefork.conf
# make install
# cp /etc/apache2/httpd2-prefork.conf /etc/apache2/sysconfig.d/loadmodule.conf

Now, checking the differences between these two files we have:

# diff /etc/apache2/sysconfig.d/loadmodule.conf /etc/apache2/httpd2-prefork.conf
30a31,32

> LoadModule dav_svn_module /usr/lib/apache2/mod_dav_svn.so
> LoadModule authz_svn_module   /usr/lib/apache2/mod_authz_svn.so

so, we can see that already the modules are in the right place.

Edit /etc/ld.so.conf to include /usr/lib and /usr/lib/apache2 and then run:

# /sbin/ldconfig

IMPORTANT: in /etc/apache2/sysconfig.d/loadmodule.conf we need also:

LoadModule dav_module   /usr/lib/apache2-prefork/mod_dav.so

before the previous two lines. dav_module has to appear before dav_svn_module in file. If you don’t have this line before, you will see next message when you try to restart apache server:

Cannot load /usr/lib/apache2/mod_dav_svn.so into server: /usr/lib/apache2/mod_dav_svn.so: undefined symbol: dav_xml_get_cdata

so, my file looks like this (only last three important lines):

[...]
LoadModule dav_module   /usr/lib/apache2-prefork/mod_dav.so
LoadModule dav_svn_module     /usr/lib/apache2/mod_dav_svn.so
LoadModule authz_svn_module   /usr/lib/apache2/mod_authz_svn.so

Edit /etc/sysconfig/apache2 and add: “dav mod_dav_svn mod_authz_svn” to APACHE_MODULES section. My specific section is like this:

APACHE_MODULES="mod_perl access actions alias auth auth_dbm autoindex cgi dir env expires include log_config mime negotiation setenvif ssl   userdir php4 php5 /usr/lib/apache2-prefork/mod_frontpage.so python   suexec rewrite dav mod_dav_svn mod_authz_svn"

Now is time to create our repository and set the correct owner and group for it:

# svnadmin create /home/svn
# chown -R apacheuser:apachegroup /home/svn

If you edit /srv/www/vhosts/domain.com/conf/httpd.include and add at the end something, Plesk will remove your changes.

So, we need to create a new file vhost.conf and to use this file. I will create /srv/www/vhosts/domain.com/conf/vhost.conf and I will put inside:

<Location /svn>
DAV svn
SVNPath /home/svn
</Location>

for a subdomain the file has to be in /srv/www/vhosts/domain.com/subdomains/NAME/conf

Now, you need to tell Plesk to update it’s information. You have to run:

# /usr/local/psa/admin/sbin/websrvmng -u --vhost-name=domain.com

this will configure plesk only for one single domain, in this case domain.com

If you want to configure it for all sites run:

# /usr/local/psa/admin/bin/websrvmng -a

Restart apache web server:

# /usr/sbin/apache2ctl stop
# /usr/sbin/apache2ctl start

Check the repository:

http://domain.com/svn

So, it seems that it is working, we can see:

Revision 0: /
Powered by Subversion version 1.4.4 (r25188).

I hope that also for you. :))

Next step is to restrict the access to our repository to give access only for some users:

DAV svn
SVNPath /home/svn/
AuthType Basic
AuthName “Private Repository”
AuthUserFile /etc/svn_auth_file
Require valid-user

We can add first user which is able to access our repository (use htpasswd2 if you have apache2):

# htpasswd -cm /etc/svn_auth_file firstuser

-m means that we want to use MD5 encryption for passwords

To add the second user (don’t use -c option, it is used only the first time to create svn_auth_file):

# htpasswd -m /etc/svn_auth_file seconduser

Bye!

a silhouette of a person's head and shoulders, used as a default avatar

How to Install Drupal on your server

You can obtain the latest Drupal release archive from here. The files are in .tar.gz format and can be extracted using most compression tools. On a typical Unix command line, use:

    # wget http://drupal.org/files/projects/drupal-x.x.tar.gz

    # tar -zxvf drupal-x.x.tar.gz

This will create a new directory drupal-x.x/ containing all Drupal files and directories. Move the contents of that directory into a directory within your web server's document root or your public HTML directory:

    # mv drupal-x.x/* drupal-x.x/.htaccess /srv/www/htdocs/drupal

Next step is to create a database using PHPMyAdmin or mysql command line. If you chose to use command line, additional information about privileges, and instructions to create a database using the command line are available in INSTALL.mysql.txt (for MySQL) or INSTALL.pgsql.txt (for PostgreSQL).

To run the install script point your browser to the your website (i.e. http://www.domain.com/drupal). You will be presented with the "Database Configuration" page, where you have to fill the information from the previous step (database name, database user, password)

If you receive in apache log file, next message:

    [Sun Jul 29 11:49:32 2007] [alert] [client 127.0.0.2] /srv/www/htdocs/drupal/.htaccess: order not allowed here

then you have to include next lines in your apache.conf:

    <Directory /srv/www/htdocs/drupal/>
    Options +Includes +FollowSymlinks -Indexes
    AllowOverride All
    Order allow,deny
    Allow from all
    <Files ~ "^\.ht">
    Deny from all
    </Files>
    </Directory>

now, point your browser to: http:/domain.com/drupal/ and fill the information regarding database. Create you initial accout, which is admin user, and configure your website.

a silhouette of a person's head and shoulders, used as a default avatar

How to reset MySQL root password

To reset a root password that you forgot (using paths on our system):

    [root@host root]#killall mysqld
    [root@host root]#/usr/libexec/mysqld -Sg --user=root &

You may have better luck with:

    mysqld --skip-grant-tables --user=root

Go back into MySQL with the client:

    [root@host root]# mysql
    Welcome to the MySQL monitor.  Commands end with ; or g.
    Your MySQL connection id is 1 to server version: 3.23.41
    Type 'help;' or 'h' for help. Type 'c' to clear the buffer.

    mysql> USE mysql
    Reading table information for completion of table and column names
    You can turn off this feature to get a quicker startup with -A
    Database changed

    mysql> UPDATE user
    -> SET password=password("newpassword")
    -> WHERE user="root";
    Query OK, 2 rows affected (0.04 sec)
    Rows matched: 2  Changed: 2  Warnings: 0

    mysql> flush privileges;
    Query OK, 0 rows affected (0.01 sec)

    mysql> exit;

    [root@host root]#killall mysqld

Start MySQL the normal way for your system, and all is good. For Red Hat this is:

    /etc/init.d/mysqld start

Bye!

a silhouette of a person's head and shoulders, used as a default avatar

How to use vhost.conf in Plesk

Maybe you need to do some specific configurations for a domain or subdomain and you tried to do directly in httpd.include file. You saw that it works for the momment but plesk will delete again your specific configurations from this file. So, in this case the answer is vhost.conf file. This file will be placed inside your domain’s conf directory, usually found at /var/www/vhosts/domain.com/conf. Create a file called vhost.conf in whatever editor you prefer. I use vim.

You can now put in any Apache configuration options like you would into httpd.include. In my case I wanted to do only one thing, to have subversion repository accesible over web, without any kind of access restriction.
Here is my vhost.conf file:

    DAV svn
    SVNPath /home/svn

Now, you need to tell Plesk to update it’s information.
You have to run:

    # /usr/local/psa/admin/sbin/websrvmng -u --vhost-name=domain.com

this will configure plesk only for one single domain, in this case domain.com
If you want to configure it for all sites run:

    # /usr/local/psa/admin/bin/websrvmng -a

After this command if you look to httpd.include file, will see that your httpd.include will have an include line for your vhost.conf, something like this:

    Include /srv/www/vhosts/domain.com/conf/vhost.conf

There is also a vhost.conf file for subdomain in their DocumentRoot directory, if you want to do some specific things for subdomain.

That's all, bye!