Chris Matchett

A blog to remind me how to fix stuff and other tech thoughts…

[warn] NameVirtualHost *:80 has no VirtualHosts

leave a comment »

Here’s some help if you are trying to run multiple sites of one ip address using Apache2 and are getting the following error;

[warn] NameVirtualHost *:80 has no VirtualHosts

I followed a tutorial on howto setup name based virtual hosts and this is where the problem started. The ‘NameVirtualHosts *:80′ directive may already be getting picked up in /etc/apache2/ports.conf so you don’t need to add it. Getting the <virtualhost *:80></virtualhost> right is enough in your sites-available, that should be all you have to do. Too many NameVirtualHosts directives is what was causing this error for me.

apache_logo_medium

Written by Chris

November 5, 2009 at 12:16 am

Posted in Uncategorized

Windows 7 Ultimate, 64-bit

leave a comment »

After attending the launch of Windows 7 in Belfast all the attendees were given a copy of Windows 7 Ultimate, 32-bit and 64-bit versions. I must say I am very impressed! I hated Vista and saw myself staying with XP for some time. Of course I may have done if it wasn’t for the free upgrade.

Notable features of Windows 7 are support for virtual machines and full system image backups. Add-ons I am also currently getting use of is the new Microsoft Security Essentials And Windows Live Movie Maker and Live Writer. Actually I am writing this wordpress article on Windows Live Writer.

Written by Chris

October 17, 2009 at 9:07 pm

Posted in Uncategorized

Drupal 6 – Remove numbers from pager output

with 3 comments

Having made many attempts at trying to the remove the pager numbers through a template.php file I found the easiest solution was to add the following to my custom theme style.css.

.pager-item{
display: none!Important;
}
.pager-current{
display: none!Important;
}

It means the fix will remain even if Drupal needs updated.

drupal-logo

Written by Chris

September 19, 2009 at 7:21 pm

Posted in drupal

Tagged with

Display Php Multidimensional array

with 2 comments

foreach($output as $var =>$value )
{
echo “$var\n”;
foreach( $value as $innervalue )
{
echo “$innervalue\n”;
}

}

}

Written by Chris

July 25, 2009 at 1:22 pm

Posted in PHP

Tagged with

Embed twitter in webpage with links

leave a comment »

My education board decided to block twitter so I got a hold of some code for our school website to allow students to see our school’s tweets.

The code is standard pear-twitter stuff, the cleverness is converting the twitter text url string to a real url.

    <?php
    // include class
    require_once(‘Services/Twitter.php’);
   
    try {
      // initialize service object
      $service = new Services_Twitter(‘user’, ‘password’);
     
      // get status updates posted by logged-in user and friends
      $response = $service->statuses->friends_timeline(); 
      if (count($response->status) > 0) {
        echo ‘<h2>Recent status updates</h2>’;
        foreach ($response->status as $status) {
            echo ‘<div><img src=”‘ . $status->user->profile_image_url . ‘” />’;
            $a=preg_replace(“/(http:\/\/|www|[a-zA-Z0-9-]+\.|[a-zA-Z0-9\.-]+@)(([a-zA-Z0-9-][a-zA-Z0-9-]+\.)+[a-zA-Z0-9-\.\/\_\?\%\#\&\=\;\~\!\(\)]+)/”,”<a
href=\”\\1\\2\”>\\1\\2</a>”,$status->text);

   echo $a . ‘<br/>’;
            echo ‘By: <em>’ . $status->user->screen_name . ‘</em> on ‘ . $status->created_at . ‘</div>’;
        }
      }
     
      // get recent posts on public timeline
    //  $response = $service->statuses->public_timeline(); 
    //  if (count($response->status) > 0) {
    //    echo ‘<h2>Recent public timeline updates</h2>’;
    //    foreach ($response->status as $status) {           
    //        echo ‘<div><img src=”‘ . $status->user->profile_image_url . ‘” />’;
    //        echo $status->text . ‘<br/>’;
    //        echo ‘By: <em>’ . $status->user->screen_name . ‘</em> on ‘ . $status->created_at . ‘</div>’;
    //    }
    //  }
           
      // perform logout
      $service->account->end_session();
    } catch (Exception $e) {
      die(‘ERROR: ‘ . $e->getMessage());
    }
    ?>

Written by Chris

June 17, 2009 at 8:15 pm

Posted in Uncategorized