Tuesday, 24 February 2009

Locked files on server

At work we occasionally get the issue of a file being locked when a user wants to get into the file and modify it.

The issue usually affects excel files where an excel session crashes thus causing the system to think that the file is still open. Previously we have had to wait for a server restart to unlock the file or save the file as a copy and continue working on it. Both options were not ideal. So we looked for a better way. As with most things the solution is quite simple.

Here is the procedure used to see all open files on a file server and to close them.

  • Log onto the server where the locked file is stored.
  • Right-click on 'My Computer' and choose 'manage'
  • In 'Computer Management' drill down to System Tools -> Shared Folders -> Open files
  • In the right pane there will be a list of all open files on the server with usernames and type of locking in a table.
  • Right click on the file that you want to close and choose 'close file'. Click 'ok' on the confirmation and the file will disappear from the list.
  • The file is ready to be opened again.

Friday, 20 February 2009

Unwanted emails when Maintenance Plan runs

Since we setup DatabaseMail on our server at work we started to get the following kind of email whenever a maintenance plan ran.

Microsoft(R) Server Maintenance Utility (Unicode) Version 9.0.4035 Report was generated on "server".
Maintenance Plan:
Duration: 00:00:01
Status: Succeeded.
Back Up Database (Transaction Log) (server) Backup Database on Local server connection
Type: Transaction Log
Append existing
Task start: 2009-02-20T08:30:02.
Task end: 2009-02-20T08:30:03.

We had looked at all the notification setting but couldn't find anywhere that told SQL server to send an email when a maintenance plan ran.

Finally with the help of a post we found that this feature can be switch on or off by doing the following

  • Open Management Studio
  • Connect to a database server instance
  • Drill down to Management -> Maintenance Plan
  • Click on the maintenance plan that is causing the issue.
  • Click on the icon next to 'Manage Connections'. If you hover over it should display 'Reporting and Logging'.
  • It will display the window below
  • Make sure the checkbox labelled as 'Send report to an email recipient' is not check to stop the emails being sent.
  • Lastly save the Maintenance Plan.

Hope this helps someone

Tuesday, 17 February 2009

Budget Media Centre Setup - Part 1 - Hardware and Operating System

I recently purchased a Panasonic Plasma TV (Panasonic TH-37PX80B - 37
). The main reason I went for a Panasonic Plasma was because it was supposed to be better than LCD's at displaying Standard Definition (SD) sources. I only have SD sources like Sky and a DVD player so I wanted to be sure that it would look as good or better for SD. The day I got it, Superman Returns was on BBC One. I was amazed at the quality of the film, it was crystal clear to my eyes. Over the weeks I have most got used to the picture quality however once in a while some thing comes on the screen that makes you say WOW.

Any way back to the main focus of the article. So I had a T.V with good connectivity (3 HDMI, VGA) now I wanted to connect a media centre to it so that I could browse my media collection from my living room.

My options were the following:

  • Buy an off the shelf media centre from the likes of HP / Dell etc.
  • Build my own media centre
  • Convert an old computer / laptop to a media centre.

I briefly looked at the first two options of an 'off the shelf system' or a 'self built system'. Unfortunately I couldn't justify the cost of the system as it wouldn't be used that often and it would be faster than my main pc!

Finally when reading LifeHacker I came across an article about uses for an old laptop. Then I had a eureka moment of using an old laptop that had a bust screen as my media centre. The laptop top was fully functional apart from the bust screen and it was a fairly capable machine. (AMD Processor , 512mb, 80Gb Hard drive)

So what operating system should I go for? The options were Vista, Windows XP or Linux (Probably Ubuntu 8.10).

As usual I was abit optomistic and tried Vista on the laptop. The reason was that it has an integrated Media Centre application (Media Center). It installed nicely but 512 Mb was just not enough to be usable. Vistas Media Center is a very nice system but it wasn't responsive enough to be useable. I even tried a 2 Gig ReadyBoost usb drive in order to speed it up but it didn't make as much difference as I hoped.

Next I tried Ubuntu 8.10. It also installed fine and was responsive in operation however the screen display on the T.V. was very dark and the resolution wasn't being picked up correctly. Unfortunatly I had to leave the Ubuntu experiement due to time contrainst but I would like to figure this out for future reference. (If anybody has any ideas then please let me know in the comments).

I finally settled for Win XP. It worked fine on the laptop and was very responsive. It didn't pick up the VGA graphics, on board sound and the ATI Remote Wonder but a quick visit to the Acer site got me all the drivers I needed.

I had an ATI Remote Wonder from a few years ago which I wanted to get working. I got Win XP to find the drivers for it online and found the software for it on ATI (AMD). The software install finished with an error which wasn't good. After abit of googling I found that this was a common error and I needed to add two dlls from here and here to \system32 in order to fix the problem. After adding the dlls and rebooting, the software automatically started and I could use the remote as a mouse. It is abit slow but usable.

In the next post I will discuss the various types of media centre software that it available.

Wednesday, 11 February 2009

Open Office 3 Tip - Open / Save Dialogs

At work we are looking at Open Office 3 as a replacement for Microsoft Office 2003. We have just started to look at how we can create a customised install for OO3. Things that we will need to change are default file paths, no required registration and no updates by users along with a few other options.

We have found that if you change the default file save and open paths it will only affect OO3 if the open and save dialogs are set to Open Office Dialogs rather than the default operating system dialogs.
The way to change the default dialogs in OO3 is to go to the following path and tick the box that says 'Use OpenOffice dialogs'

Tools>Options>OOo>General>Open/Save dialogs

Once this is set, any settings applied to the path of file locations will apply to Open Office 3.

Please leave a comment if you are currently using OO3 in the enterprise and let me know what you think

Friday, 6 February 2009

Beginning to see how Drupal works

I have been looking at Drupal on and off for about 6 months now and it has always seemed to be abit mysterious in the way it works.
I read alot about it and tried to figure out how it worked but it just wasn't going in. Drupal is the first CMS system that I have looked into in any depth so I thought it would take time to see how the system works.

Finally yesterday it clicked. Now some fundamental concepts have started to sink in.
  • Each module has fuctions in it that are used to create the path to a drupal page and links to the page. (xxx_menu)
  • Each module has a function to create the form (xxx_form).
  • Each module has a function called xxx_form_submit that runs when the form is submitted. It uses a parameter called form_values that is automatically set with the values from the form. For example form_values['textboxname']
This maybe basic information. But it is information that I found hard to find.

Other information that I found useful is:
  • global $user is used to retreive information about a user from anywhere on a site.
  • Two types of menu types that I have used are MENU_LOCAL_TASK and MENU_CALLBACK. MENU_LOCAL_TASK is used to create a tab style link to a page. Like 'View' and 'Edit' tabs at the top of most drupal pages. MENU_CALLBACK is used when displaying a form and has setting for setting up parameters for a form.
  • Remember that most things are arrays.
Below is the module I have created after it 'clicked'. I have much much more to learn about Drupal so this module many not be exactly right but having this basic knowledge has made a big difference to me and a post like this would have helped me when I started to look into Drupal module development. This module will need Ubercart installed in order to work correctly.

The background to this module is that I required users to be able to send an older version of the product to my client after they bought a new version of the product. When they send in the old unit they will receive a rebate from the client.

This module allows a user to click on an order then pick a product from the order that they want to send to the client. The customer can choose to have the product picked up or send it in themselves. Once they submit the form it will send in information to the client that a unit is going to be sent it.
uid) {

$items[] = array(
'path' => 'user/'. arg(1) .'/returns/'. arg(3),
'title' => t('Order @order_id', array('@order_id' => arg(3))),
'description' => t('View order @order_id.', array('@order_id' => arg(3))),
'callback' => 'drupal_get_form',
'callback arguments' => array('returns_form', arg(3), 'customer'),
'access' => user_access('view all orders') || $user->uid == arg(1),
'type' => MENU_CALLBACK,

$items[] = array(
'path' => 'user/'. arg(1) .'/returns',
'title' => t('Returns'),
'description' => t('View your returns history.'),
'callback' => 'returns_history',
'callback arguments' => array(arg(1)),
'access' => user_access('view all orders') || $user->uid == arg(1),
'type' => MENU_LOCAL_TASK,
return $items;

* Returns the sortable table listing of a customer's orders.
* @param $uid
* The user ID whose orders you wish to list.
function returns_history($uid) {
drupal_set_title(t('Returns history'));

$header = array(
array('data' => t('Date'), 'field' => 'o.created', 'sort' => 'desc'),
array('data' => t('Order #'), 'field' => 'o.order_id'),
array('data' => t('Status'), 'field' => 'os.title'),
array('data' => t('Products'), 'field' => 'products'),
array('data' => t('Total'), 'field' => 'o.order_total')

$result = pager_query("SELECT o.order_id, o.created, os.title, SUM(op.qty) AS products, o.order_total AS total FROM {uc_orders} AS o LEFT JOIN {uc_order_statuses} AS os ON o.order_status = os.order_status_id LEFT JOIN {uc_order_products} AS op ON o.order_id = op.order_id WHERE o.uid = %d AND o.order_status IN ". uc_order_status_list('general', TRUE) ." GROUP BY o.order_id, o.created, os.title, o.order_total". tablesort_sql($header), 20, 0, "SELECT COUNT(*) FROM {uc_orders} WHERE uid = %d AND order_status NOT IN ". uc_order_status_list('specific', TRUE), $uid);

// Build a table based on the customer's orders.
while ($order = db_fetch_object($result)) {
$link = l($order->order_id, 'user/'. $uid .'/returns/'. $order->order_id);
if (user_access('view all orders')) {
$link .= '
'. uc_order_actions($order, TRUE) .'';
$rows[] = array(
array('data' => format_date($order->created, 'custom', variable_get('uc_date_format_default', 'm/d/Y'))),
array('data' => $link, 'nowrap' => 'nowrap'),
array('data' => $order->title),
array('data' => (!is_null($order->products) ? $order->products : 0), 'align' => 'center'),
array('data' => uc_currency_format($order->total, TRUE), 'align' => 'right'),

$output = theme('table', $header, $rows) . theme('pager', null, 20, 0);

return $output;

* Display the order view screen, constructed via hook_order_pane().
function returns_form($order_id, $view = 'view') {

$order = uc_order_load($order_id);
$form = array();

if ($view == 'customer') {
$breadcrumb = drupal_get_breadcrumb();
$breadcrumb[2] = l(t('Returns history'), 'user/'. arg(1) .'/returns');

if ($order === FALSE) {
drupal_set_message(t('Order @order_id does not exist.', array('@order_id' => $order_id)));

$partslist = array();
$result = db_query("SELECT title FROM {uc_order_products} order_id = %d ORDER BY order_product_id", $order_id);
while ($product = db_fetch_object($result)) {
$partslist[$product->title] = $product->title . ' ' . $product->surchargecode;

$form['parts'] = array(
'#type' => 'checkboxes',
'#title' => t('Part numbers'),
'#options' => $partslist,
'#description' => t('Select the old units that you will be sending to us'),

$options = array('0' => t('Please arrange collection for me'), '1' => t('I will send the items myself'));
$form['collection'] = array(
'#type' => 'radios',
'#title' => t('Collection details'),
'#default_value' => 0,
'#options' => $options,
'#description' => t('How would you like to get the old units to us.'),

$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Send'),

return $form;

function returns_form_submit($form_id, $form_values)
global $user;

$from = $user->mail;
$recipient = 'test@test.com';
$subject = t(' Collection Request');
$bodytext = 'Old Unit';

if ($form_values['collection'] == 0)
$bodytext .= "\n\nFor Collection";
$bodytext .= "\n\nCustomer Will Send";

$bodytext .= "\n\nParts";

foreach($form_values['parts'] as $key => $element){
$bodytext .= "\n\n$element";

$body = t($bodytext);

if(drupal_mail('returns-email', $recipient, $subject, $body, $from)){
drupal_set_message(t('Your message has been sent. We will be in touch soon'));
drupal_set_message(t('Your message has NOT been sent.'));



I hope this works. If you find it useful or you have an issue running it then leave a comment. I am currently running this system on Drupal 5 with Ubercart.

Wednesday, 4 February 2009

Anti Virus Firewall killed the File Server

In the past year or two I have noticed the same issues coming up again and again. Each of the issues have been resolved by deactivating or configuring the firewall component of the installed Anti Virus software.
I have noticed it mostly on McAfee and Symantic Anti Virus.
The issues that can be solved by deactivating or configuring your firewall are:
  1. No file share access to computer with firewall on it.
  2. No shared printer access.
  3. Cannot see some or all computers on the network.
  4. Cannot get to email server.
So if you ever have the above problems check the configuration of your firewall and make sure it is correct. Obviously I would recommend that you keep the firewall activated but you can deactivate it just to check that the firewall is the cause of your problems.
This saved me a lot of time. I hope it does the same for you.

Selectively allow user to access fonts in Citrix Environment

We had an issue at work where we had to restrict access to certain fonts. Normally you would only install the fonts on the the PC's of the people who require access. We have a Citrix solution at work so most user log onto a random server. So we installed the fonts onto all the servers. Unfortunately everybody in the organisation had access to the fonts. We only have 5 licences for the fonts so we had to find a way of restricting the fonts to the users.

In the end the way we found to accomplish this was simply to log onto each server and go to the fonts folder (\fonts\) and set permissions on the fonts particular fonts so that the only people who had access to them were the 5 people who were licensed to use them.
Easy when you know how.

01000 ( 8 ) ways you can tell you are a geek

Here is a list of 8 ways that you can tell you are a geek:

  1. You can't get to sleep without hearing computer fans in the background
  2. You can't bear to see computers being thrown away because every computer has a use. (A Pentium 1 133Mhz, 32mb RAM, makes a great router;-)
  3. You dream in 1's and 0's
  4. You mumble "Bad Programming" under your breathe if software crashes
  5. You know why you need to restart computers when they crash.
  6. You garage is an extension of your computer room or is you computer room.
  7. Rather than talking in three letter acronyms, you make a word out of them. For example O.L.E = ouley and A.D.O = aidoo.
  8. You emails look like code. For example (extract of actual email :-)

if going out then
let me know
do nothing

I hope there are other people that can relate to some if not all of
these, else I maybe something other than a geek!