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

with one 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 5 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

Windows 7 free for one year!

with 2 comments

I downloaded and installed the new version of Windows, Windows 7 RC, on May 5th when it was made available to the public. I was pleasantly surprised at their decision to give it away for free…well free for a year anyway.

I guess they are trying to hook people in after the disaster that was Vista. Vista was to XP what Windows ME was to Windows 98, one step forward and four steps back!

I am enjoying Windows 7 RC however! All my hardware is running as should be and the system seems very snappy. I was worried that some of my older (but much loved software) would cause some problems but it hasn’t been the case. Dreamweaver 8 and Photoshop 7 are running well which is a big bonus. I guess we are all suckers for a shiny interface as well and Windows 7 has one, I like the transparent window look.

So if you are thinking of having a go backup your documents and have a go. It’s only free for a year but a year is a long time in tech, we mightn’t even have desktop computers in June 2010!

windows7

Written by Chris

May 31, 2009 at 4:12 pm

Posted in microsoft, operating system

Tagged with

Downloading podcasts to the Blackberry 8820 using your home wifi

with one comment

My original goal was to try and access my podcasts, stored on a network share, on my Blackberry 8820. It turns out accessing network shares isn’t available on the current Blackberry 4.5 operating system but will be in version 5.0. So here’s my solution to make life a little easier in the meantime.

the quick version

  • Setup a web server on one of your home computers
  • Use Juice to keep your podcasts up to date (I’m not an iTunes fan)
  • Make your music library accessible to the web server
  • Configure your Blackberry browser to use wifi
    (I have two browsers, Opera and the Blackberry browser. I have one configured for wifi and the other as part of my data plan)
  • Browse and play/download music and podcasts from your intranet server using it’s ip address from your wifi browser

the not so quick version

I have an old pc running Windows Server 2003 sharing my podcasts and music. I know not many people have a copy of windows server running at home but the following steps could be carried out on any operating system able to run the IIS or Apache web servers. If you aren’t familiar with running a web server your windows pc may already support IIS, if not Xampp is a good starting point. This is a good article for Ubuntu users on setting up a web server.

Once you have setup your webserver and have made sure your music library is visible through your new intranet site you can either simply enable directory browsing of your music folder or use some asp or php code to create a prettier interface. Currently IIS 6 doesn’t allow you to apply style to directory browsing. I use some asp code from ASP101 to style and allow recursive directory browsing of my music library.

Make sure you are in wifi mode on your Blackberry and browse to the ip address of your intranet server hosting your podcasts and music. Simply click on a link to one of your mp3 files and you will be prompted to open it or save it. If you open the file the Blackberry media player will start playing it. I tend to save podcasts as you have more control over fast forward etc.

And that’s it, one less wire to hookup and freedom to roam around your home listening to your podcasts!

blackberry-8820-lg

Written by Chris

May 31, 2009 at 4:11 pm

Posted in blackberry

Tagged with ,