Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

Aug 192010
 

Downgrade the format of a Subversion working copy

Answer:

Sometimes, when you upgraded the local subversion working copy, but others use an older client to access it, error likes "This client is too old to work with working copy..." will appear.

To fix this, you can consider downgrade the format of the subversion working copy.

E.g. Downgrade to 1.4

# change-svn-wc-format.py /path/to/working/copy 1.4

The useful python script can be downloaded here: http://svn.apache.org/repos/asf/subversion/trunk/tools/client-side/change-svn-wc-format.py

Aug 162010
 

A simple array in Perl

Answer:

Array is a list like data structure in Perl. It allows you to access to the elements inside the array sequentially.

Example:

use strict;
use warnings;

my @a = (1, 2, 3);

print $a[2]; # print '3', since Perl array is zero-indexed
Aug 152010
 

Multi-line string in Ruby

Answer:

To declare a multi-line string in Ruby, it is as easy as the following.

sql = "
        SELECT *
            FROM `user` AS u
            JOIN `company` AS c
                ON u.cid = c.id
             WHERE u.id = 8
"

puts sql
Aug 122010
 

Cross platform newline in PHP

Answer:

In PHP, if you want to print out a newline character, you can use the "\n" character

<?php

    echo "Hello World\n";

But the \n" character only work in Linux/UNIX, to make it work for both Windows, Mac and Linux/UNIX platforms, you can use a special constant PHP_EOL.

<?php

    echo "Hello World" . PHP_EOL;
Aug 092010
 

Update the Channel List using PHP/PEAR

Answer:

PEAR is a framework and distribution system for reusable PHP components. To update the channel list, what you need to do is type the following command.

# sudo pear channel-update pear.php.net