02/06/11

Permalink 05:07:10 pm, by admin Email , 95 words, 145 views   English (UK)
Categories: email, Software, Linux

Fix the colour of Lightning's Tasks in Thunderbird

This may not be an issue for Windows users but my Ubuntu Linux install of Lightning for Thunderbird had a little niggle with the font colour of the Tasks (ToDo items). The colour was way too pale and hard to read.

Jason over at www.lousycanuck.ca got me sorted with his detailed post on what to tweak in the Lightning JAR file.

Ubuntu have the issue flagged as a bug (https://bugs.launchpad.net/ubuntu/+source/lightning-extension/+bug/733578) but it's really an up-stream issue for Mozilla (https://bugzilla.mozilla.org/show_bug.cgi?id=367190)

28/09/10

Permalink 09:57:46 am, by admin Email , 127 words, 191 views   English (UK)
Categories: Viruses & Spyware

Microsoft DO NOT phone you

I've been contacted today by a customer who wanted me to help them "fix some errors that Microsoft phoned me about".

It turns out they received a call out of the blue from a guy wanting to log into their computer remotely and fix some problems. They claimed it was because they (Microsoft) were receiving too many error reports from this customer.

You need to know that Microsoft DO NOT phone you - ever.

If you receive a call like this, please hang straight away and certainly do not let them have access to your computer. It's a scam. The idea is that they download trojan software to your computer so they can gain control later, when you are not aware and hopefully steal your bank details.

Permalink 09:45:30 am, by admin Email , 375 words, 339 views   English (UK)
Categories: PHP

P4A 3.6.1+ File Manager

Previous posts here have explained how to add TinyBrowser to the fckeditor implementation of P4A.

With the release of P4A 3.6.1, TinyBrowser no longer works as fckeditor has been updated to ckeditor.

This post shows you how to implement ckeditor's File Manager, ckfinder in P4A 3.6.1+

Firstly, download a copy of <a href="http://ckfinder.com/">ckfinder</a> and extract it to ./p4a-3.6.1/themes/default/widgets/rich_textarea/filemanager/ckeditor.

Next, edit ./p4a-3.6.1/themes/default/widgets/rich_textarea/rich_textarea.php:

Put this at the top of the file.


// Introduced by Fear of Mice to support ckfinder
include_once $_SERVER['DOCUMENT_ROOT'].P4A_THEME_PATH .'/widgets/rich_textarea/filemanager/ckfinder/ckfinder.php';

$mydir = P4A_UPLOADS_DIR. '/' . $this->getUploadSubpath(); //set
$prep = false;
if (substr($mydir, 0, 7) == 'http://' || substr($mydir, 0, 8) == 'https://') {
$prep = TRUE;
}
$mydir = str_replace('https://','',$mydir);
$mydir = str_replace('http://','',$mydir);
$mydir = preg_replace('|(/)+|','/',$mydir);
if($prep === TRUE) {
$mydir = prep_url($mydir);
}

$cookiestr = str_replace($_SERVER['DOCUMENT_ROOT'],'/',$mydir);
setcookie("ckfinderdir", base64_encode($cookiestr), 0, '/');
$mydir=base64_encode($mydir); //encode it

This creates a cookie containing your required path to the upload location.
...then, near the end of the file, replace the "if isUploadEnabled()" code block with:


filebrowserBrowseUrl: '<? php echo P4A_THEME_PATH ? >/widgets/rich_textarea/filemanager/ckfinder/ckfinder.html?',
filebrowserImageBrowseUrl: '<? php echo P4A_THEME_PATH ? >/widgets/rich_textarea/filemanager/ckfinder/ckfinder.html',
filebrowserFlashBrowseUrl: '<? php echo P4A_THEME_PATH ? >/widgets/rich_textarea/ckfinder/filemanager/ckfinder.html',
filebrowserUploadUrl: '<? php echo P4A_THEME_PATH ? >/widgets/rich_textarea/filemanager/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files',
filebrowserImageUploadUrl: '<? php echo P4A_THEME_PATH ? >/widgets/rich_textarea/filemanager/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images',
filebrowserFlashUploadUrl: '<? php echo P4A_THEME_PATH ? >/widgets/rich_textarea/filemanager/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash'

Next, in ./p4a-3.6.1/themes/default/widgets/rich_textarea/filemanager/ckfinder/config.php, retrieve your cookie value and set up ckfinder:

$baseUrl = base64_decode($_COOKIE['ckfinderdir']);

Bar any extra juggling to get ckfinder to work how you want, this should do the job.

11/02/10

Permalink 05:12:29 pm, by admin Email , 372 words, 4049 views   English (UK)
Categories: Hardware, Linux

Installing Ubuntu onto itself

What?

OK. Here's my situation. I have a laptop with a broken CDROM Drive, no floppy and a BIOS which does not support bootable USB. The only way to install was to load the HD with the installer and run from there. So:

  1. Remove the HD load it into a USB HD caddy and mount it on a working system (at this stage it can be either Windows or Linux depending on what Disk Partitioning tools you have - you'll need one that supports EXT3)

  2. Repartition the drive with a big EXT3 partition, a small (2Gb) EXT3 partition and a swap partition (2Gb)

  3. Download or create from an existing CD, an ISO for your distribution - I wanted Ubuntu Desktop 8.10 Intrepid Ibex

  4. Download, install and run UNetBootin

  5. Point UNetBootin to your small EXT3 partition and your ISO and let it do it's thing.

  6. Unmount the drive, install it back to the new machine and boot it

  7. The UNetbootin menu appears, select "Default" and let it boot. For my Distro, it booted into Ubunto Desktop Live mounted at /cdrom which gives you an "Install" icon on the Desktop.

  8. This is the key bit to allow the installer to work, start a Terminal window and run
    sudo umount -l -r -f /dev/sda2
    (where sda2 was the device mounted as cdrom)

  9. Click "install" on the Desktop and run through the prompts. If you didn't umount the device at /cdrom, the partition manager will be disabled so cancel the install and unmount it.

  10. When prompted reboot

  11. The newly installed Distro should now start via Grub. On mine, it didn't. Grub didn't have a menu item for my OS. To fix this, I visited http://users.bigpond.net.au/hermanzone/p15.htm#Second_method_configfile_boot which helped me use the Grub CLI to finally boot then fix the grub installation. One problem was a missing vmlinuz symlink. Rather than trying to fix that, I used the full path to the original file for the Distro's kernel version (Ubuntu 8.10 installs /boot/vmlinuz-2.6.27-7-generic on my system). Once you got grub to boot manually, edit the /boot/grub/menu.lst file and enable updatedefaultentry. Save & exit then run sudo update-grub. Thant should sort you out.

02/02/10

Permalink 12:50:07 pm, by admin Email , 121 words, 10002 views   English (UK)
Categories: Networking & Broadband, Hardware

Home Access Grant scheme - free computer and Internet access for low income families

On 11 January, the government launched the Home Access Grant scheme to provide grants to low income families to buy computer and/or internet packages. Families with children in state-maintained schools in England, in school years three to nine, who are entitled to free school meals or are in receipt of one of a number of qualifying benefits, will be able to apply for the grant. Carers and foster parents for 'looked after children' in school years one to thirteen are also likely to be eligible to apply for the grant. Families can call the Home Access Grant helpline on 0333 200 1004 to get an application form.

More information about the scheme is available on the Home Access website at www.homeaccess.org.uk

22/01/10

Permalink 12:50:15 pm, by admin Email , 493 words, 5586 views   English (UK)
Categories: Networking & Broadband

Understanding Business Broadband

Businesses can benefit considerably from a good broadband connection and because the requirements of most businesses differ to the average home broadband customer, there are a large number of specifically tailored packages which can provide business broadband that is flexible and versatile.

A broadband connection can allow a business to grow in a number of ways. It can facilitate remote working and help to create unified internet access for your business network, making all staff members linked in to the same system and allowing you to create servers that are accessible from any networked PC. It can also help you to promote your business and provide customers and clients with easy access to your services and products. However, with all of the business broadband providers and deals out there, coupled with the various technologies and confusing acronyms, it can be hard to pick a package that is right for your enterprise. If you are looking for solid advice on how to get started, this quick overview will definitely help.

For a basic business broadband package you will probably be looking to ADSL technology. This refers to an asymmetric digital subscriber line, which essentially means that download speeds will be much higher than upload speeds. If most of your traffic is going to be inbound and you are running a small or medium sized enterprise, then ADSL will usually be adequate to your needs. However, if you are going to be providing for a larger organisation, or want to allow interconnected networking between two different sites to form a unified internet hub then SDSL may be more suitable. This is a symmetric rather than asymmetric, which means both the upload and download speeds will be the same. As a result upload speeds will be 4 times faster than with basic ADSL. SDSL usually costs considerably more, but the benefits it offers will be obvious to those with big ambitions.

Business broadband packages will come with a wide variety of extra features to attract business-people looking to save money, including additions like free mobile broadband connectivity, free Wi-Fi access at hotspots around the UK and free technical support. Most ISPs will also include some basic web hosting as part of a standard business broadband bundle. This might be a sensible inclusion if you are looking to set up your first business website and do not want to pay for external hosting by a third party provider. However, if you establish your site on your ISP's hosting package, you will be tied in to that particular ISP for as long as you want to keep that site up and running. It is much more sensible to pick up a third party hosting package, as these can be inexpensive and more flexible than those offered by ISPs. They will also allow you to migrate provider and choose different business broadband deals without having to start your site from scratch with a new ISP and a new hosting package.

10/12/09

Permalink 02:27:05 pm, by admin Email , 171 words, 2883 views   English (US)
Categories: PHP

Button to "Select All" checkboxes in P4A

Given the following which creates a set of checkboxes:

$db =& P4A_DB::singleton();
$clientlist = array();
$items = $db->fetchAll("SELECT * FROM microsites WHERE status=1 ORDER BY sitetitle");
foreach ($items as $item) {
$ci = $item['user'];
$cd = $item['sitetitle'];
$clientlist[] = array('id' => $ci, 'desc' => $cd);
}

$client_array_source =& $this->build("p4a_array_source", "client_array_source");
$client_array_source->load($clientlist)
->setPk("id");


$selectallbutton = $this->build("p4a_button","selectallbutton")
->setLabel('Select All');
$this->intercept($selectallbutton, 'onClick', 'selectall');

$this->build("p4a_field","clients")
->setWidth(300)
->setType("multicheckbox")
->setSource($client_array_source)
->setSourceDescriptionField("desc")
->setSourceValueField("id");

This function will allow the user to click the "select all" button and have their checkboxes populated:

function selectall() {
$array_id = array();
$num_rows = $this->clients->data->getNumRows();
for ($i = 1; $i $#60;= $num_rows; $i++) {
$this->clients->data->row($i);
$array_id[$i] = $this->clients->data->getPkValues();
}
$this->clients->setNewValue($array_id);
$this->clients->load();
}

This works in P4A v3.4.1 but not 3.4.0. I've not tested on later versions.

Permalink 02:13:07 pm, by admin Email , 1138 words, 6748 views   English (US)
Categories: PHP

Basic native P4A File Manager

This code can be used as a P4A mask to provide very basic File Manager functionality outside of the RTE.

class fm extends p4a_base_mask
{
public $rootfolder = null;
public $htmlrootfolder = null;

//yes I know P4A has it's own system for this built around defined constants. Constants that we can't change! so lets do it here on a mask by mask basis.
public $valid_preview_images = array('gif','jpg','ico','png'); //'mp3','mp4','avi','pdf','doc','xls','odt','ods','txt'
public $valid_preview_text = array('txt');

public function __construct() {
parent::__construct();

$site = '/'.P4A::singleton()->user_data['user'];

$this->rootfolder = P4A_UPLOADS_DIR.$site;
$this->htmlrootfolder = P4A_UPLOADS_PATH.$site;

$iconpath = P4A_ROOT_URL.'/icons/default/16';
$this->setTitle('File Manager');

//File Handling
$this->build("P4A_Dir_Source", "fileset")
->setDir($this->rootfolder);

$this->build("P4A_Field", "upload_field")
->setLabel('Upload:')
->setUploadSubpath('')
->label->setWidth(50);
$this->upload_field->setType("file");
$this->intercept($this->upload_field, "afterUpload", "afterUpload");

$this->build("p4a_table",'table')
->setSource($this->fileset);
$this->table->addActionCol ('delete')
->cols->delete->setLabel('<img src="'.P4A_ROOT_URL.'/icons/default/16/actions/edit-delete.png" alt="[D]" title="Delete this file" />');
$this->intercept($this->table->cols->delete, 'afterClick', 'DeleteColClick');
$this->table->addActionCol ('preview')
->cols->preview->setLabel('<img src="'.P4A_ROOT_URL.'/icons/default/16/actions/thumbnail.png" alt="[P]" title="View this file" />');
$this->intercept($this->table->cols->preview, 'afterClick', 'TableRowClick');
$this->table->rows->addAction('afterClick');
$this->intercept($this->table->rows, 'afterClick', 'TableRowClick');

$this->build("P4A_Fieldset","f_table")
->setLabel('Files ['.str_replace($this->rootfolder,'.',$this->fileset->getDir()).']')
->anchorLeft($this->table)
->anchorCenter($this->upload_field);

//Directory Handling
$this->build("P4A_Toolbar","dtb")->setSize(16);
$this->dtb->addButton('new_',$iconpath.'/mimetypes/folder_green.png');
$this->dtb->addButton('home',$iconpath.'/actions/go-home.png');
$this->dtb->addButton('delete',$iconpath.'/actions/edit-delete.png');
$this->intercept($this->dtb->buttons->new_, 'onClick', 'createFolder');
$this->intercept($this->dtb->buttons->home, 'onClick', 'goFolderHome');
$this->intercept($this->dtb->buttons->delete, 'onClick', 'deleteFolder');

$navme = $this->build("P4A_Dir_Navigator","navme")
->setBaseDir($this->rootfolder);
$this->navme->addAction('afterClick');
$this->intercept($this->navme, 'afterClick', 'NavRowClick');

$this->build("P4A_Field", "create_folder_field")
->setWidth(100)
->label->setWidth(30)
->setLabel('New: ');

$this->build("P4A_Fieldset","f_navme")
->setLabel('Directory ['.str_replace($this->rootfolder,'.',$this->navme->getBaseDir()).']')
->setWidth(250)
->anchor($this->create_folder_field)
->anchorleft($this->dtb)
->anchor($this->navme);
//Preview Handling
$this->build("p4a_image","imagepreview")
->setStyleProperty('position','relative') //a bit of elbow room
->setStyleProperty('padding','10px'); //a bit of elbow room

$this->build("p4a_box","textpreview")
->setWidth(500)
->setStyleProperty('padding','10px'); //a bit of elbow room

$this->build("P4A_Button", "close_imagepreview_button")
->setSize(16)
->setLabel('Close Preview',false)
->setIcon($iconpath.'/actions/window-close.png')
->implement("onclick", $this, "closeImagePreview");

$this->build("P4A_Button", "close_textpreview_button")
->setSize(16)
->setLabel('Close Preview',false)
->setIcon($iconpath.'/actions/window-close.png')
->implement("onclick", $this, "closeTextPreview");

$this->build("P4A_Fieldset","f_imagepreview")
->setLabel('')
->setVisible(false)
->anchorRight($this->close_imagepreview_button)
->anchorCenter($this->imagepreview);

$this->build("P4A_Fieldset","f_textpreview")
->setLabel('')
->setVisible(false)
->anchorRight($this->close_textpreview_button)
->anchorCenter($this->textpreview);

//Display
$this->frame->anchor($this->f_navme)
->setWidth(700)
->addCssClass('mr_frame')
->addCssClass('ui-corner-all')
->anchorLeft($this->f_table)
->anchorCenter($this->f_imagepreview)
->anchorCenter($this->f_textpreview);

$this->build("P4A_Quit_Toolbar","toolbar");

$this->display("top",$this->toolbar);

$this->info('File Manager Loaded...');

}

public function closeImagePreview() {
$this->f_imagepreview->setVisible(false);
}
public function closeTextPreview() {
$this->f_textpreview->setVisible(false);
}

public function goFolderHome() {
$d = $this->rootfolder;
$this->f_navme->setLabel('Directory [.]');
$this->fileset->setDir($d)
->reload();
$this->navme->setCurrentSubdir($this->rootfolder);
$this->uploadfield->setUploadSubpath('');
$this->f_table->setLabel('Files [.]');
}

public function NavRowClick($a) {
$v = $this->navme->getCurrentSubdir();
$d = $this->rootfolder;
$this->f_table->setLabel('Files [./'.$v.']');
$this->f_navme->setLabel('Directory [./'.$v.']');
$this->fileset->setDir($d.'/'.$v)
->reload();
$this->uploadfield->setUploadSubpath($d.'/'.$v);
}

public function TableRowClick($o, $a) {
$f = $this->table->data->fields->filename->getValue();
$s = $this->table->data->fields->size->getValue();
$e = trim(end(explode(".", $f)));
if (in_array($e,$this->valid_preview_images)) {
$relativepathfilename = $this->navme->getCurrentSubdir().'/'.$f;
$this->imagepreview->setIcon($this->htmlrootfolder.'/'.$relativepathfilename);
$this->f_textpreview->setVisible(false);
$this->f_imagepreview->setLabel('Preview: '.$f)
->setVisible(true);
} elseif(in_array($e,$this->valid_preview_text)) {
$relativepathfilename = $this->navme->getCurrentSubdir().'/'.$f;
$fileContent = file_get_contents($this->rootfolder.'/'.$relativepathfilename,FILE_TEXT);
$this->textpreview->setValue('<pre>'.$fileContent.'</pre>');
$this->f_imagepreview->setVisible(false);
$this->f_textpreview->setLabel('Preview: '.$f)
->setVisible(true);

} else {
$this->info('Sorry. Preview unavailable for this file');
}
}

public function DeleteColClick($o, $a) {
$this->info('Deleting file...');
$fullpathfilename = $this->fileset->getDir().'/'.$this->table->data->fields->filename->getValue();
unlink($fullpathfilename);
$this->fileset->reload();
$this->info('Done...');
}

public function createFolder() {
$this->info('Creating...');
$v = $this->navme->getCurrentAbsoluteDir();
$folder = $this->create_folder_field->getNewValue();
if ($v == $this->rootfolder.'/') {
$fullnewpath = $v.$folder;
} else {
$fullnewpath = $v.'/'.$folder;
}
mkdir($fullnewpath,0777,true);
$this->create_folder_field->setNewValue(null);
$this->info('Done...');
}

public function afterUpload() {
$tmpname = $this->upload_field->getNewValue(0);
$name = $this->upload_field->getNewValue(6);
$fullpath = $this->fileset->getDir();

rename(P4A_UPLOADS_TMP_DIR . "/$tmpname", "$fullpath/".$name);
$this->upload_field->setNewValue(null);
$this->fileset->reload();
}

public function deleteFolder() {
$this->info('Deleting directory...');
$v = $this->navme->getCurrentAbsoluteDir();
$folder = $this->create_folder_field->getNewValue();
if ($v == $this->rootfolder.'/') {
$this->error('You cannot delete your root directory');
} else {
$fulldelpath = $v.'/'.$folder;
$oneup = realpath($fulldelpath.'/../');
$this->_delete_directory($fulldelpath);
$this->navme->setBaseDir($oneup); //move navme up one
$this->fileset->setDir($oneup) //move filelist up one
->reload();
$this->info('Done...');
}
}

function _delete_directory($dirname) { //remove containing files & directories then remove what I've asked for
if (is_dir($dirname))
$dir_handle = opendir($dirname);
if (!$dir_handle)
return false;
while($file = readdir($dir_handle)) {
if ($file != "." && $file != "..") {
if (!is_dir($dirname."/".$file))
unlink($dirname."/".$file);
else
$this->_delete_directory($dirname.'/'.$file);
}
}
closedir($dir_handle);
rmdir($dirname);
return true;
}

}

You may need to add the necessary icons to the correct location in the

./icons

directory. I used the Open Source Crystal iconset.

This was developed using P4A v3.4.1

I'm sure this can be improved upon, feel free to do so and let me know...

:: Next Page >>

fear of mice

This is the official blog of

We aim to post comments (and possibly solutions) to some of the more interesting IT Support issues we come across in our daily travels around the South Hams of Devon.

| Next >

May 2012
Mon Tue Wed Thu Fri Sat Sun
<< <     
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      

Search

Categories

Misc

XML Feeds

What is RSS?

Who's Online?

  • Guest Users: 0

powered by
b2evolution