Cyprus PIO online presence expanded

Cyprus Mail reports:

GOVERNMENT spokesman Stephanos Stephanou yesterday presented six Press and Information Office (PIO) websites which aim to internationally promote Cyprus and make the task of searching for information a bit less daunting.

The websites are:

  • Press and Information Office website – the main PIO website which is updated daily with all government announcements.
  • PIO Press Releases – a search engine for government announcements archives.  Even though most of the documents I came across are in Greek, I still like the way search results are presented (see screenshot below).
  • Aspects of Cyprus – a large presentation about Cyprus, covering history, culture, politics, economics and more. It includes a few videos and more than 300 photographs.
  • Peri Kyprou – the Greek version of the Aspects of Cyprus.
  • Cyprus Film – a 40+ short films produced by PIO and other government offices.
  • Elections 2011 – a website built specifically for Cyprus parliamentary elections of 2011.  This will probably be obsolete after May 22, but I wouldn’t know for sure as the website is in Greek only.

The Yale Globalist team visits Cyprus

The Yale Globalist is a magazine written, edited, and published by the students of Yale University.  The topics are chosen by the students as well, and often cover politics, economy, culture, science, technology, and more.  Every years, the team does a field trip to a particular country, where they meet with locals and get better understanding of the country and the people.

This year, the team is researching Turkey.  As part of that research, they are also visiting Cyprus.  They are arriving tonight and will spend a week on the island.  They are looking for people to talk to about the Cyprus problem, support and opposition of the unification plans, occupation and the aftermath of the military conflict, religious differences, and more.

If you are interested, have a look at their web site, as well as their Turkey travel blog.  They also have a page on Facebook.  If you have something to say, get in contact with the team and they will arrange for the time to meet with you.  You can email the Editor in Chief Sanjena Sathian directly at sanjena [dot] sathian [at] yale [dot] edu.

Day in brief

Partial string replacement with fixed length in PHP

Today I came across one of those problems that look simple and straight forward at first, but then somehow consume a good part of an hour to solve.  I wanted to replace a part of the string (in the middle), with given character, without changing the length of the string itself.  Once scenario would be a credit card number, where I would want to replace all digits with an ‘x’, leaving only the first digit and the last four as they were.  I tried a number of approaches, including sscanf() and array_splice() ones.  My final version is below.  It might be somewhat longer than I expected, but I like the simplicity of it.

<?php
/**
 * Replace middle of the string with given char, keeping length
 *
 * <code>
 * print padString('1234567890123456', 1, 4, 'x');
 * </code>
 *
 * @param string $string String to process
 * @param integer $start Characters to skip from start
 * @param integer $end Characters to leave at the end
 * @param string $char Character to replace with
 * @return string
 */
function padString($string, $start, $end, $char) {
    $result = '';

    $length = strlen($string) - $start - $end;
    if ($length <= 0) {
        $result = $string;
    }
    else {
        $replacement = sprintf("%'{$char}" . $length . "s", $char);
        $result = substr_replace($string, $replacement, $start, $length);
    }

    return $result;
}
?>

P.S.: Chris posted an alternative solution. Please have a look.

Day in brief