Posts Tagged ‘projects’

First Netvibes Plugin

January 1st, 2009

Just finished my first Netvibes plugin.  Hopefully it’ll be the first of many to come as I’ve now got the hang of the Universal Widget API (UWA) now.

My first widget is mainly for UK users who take a lot of flights.  Its a Lastminute.com flight checker widget so you can find the latest pricing info for a given date.

You can view it and install it here.

lastminute_logo_368x701

How the UWA Widgets Work

They’re dead simple in principle.  So simple a widget is nothing more than a specifically formatted HTML document.  You have to make sure you’ve got a few things in there like a UTF-8 encoding attribute at the top and a few other bits but the skeleton document helps a lot.  Other than that you can use Javascript and style it with CSS all like a regular HTML document.  More about UWA.

Forms

This was a serious pain in the arse.  The form documentation for Netvibes is rubbish and the forum had little of use – although I was helped by Xavier and managed to get round my problem.
Basically in Netvibes – don’t use a form.  Or at least don’t submit a form in the traditional sense.  It won’t work, and even if you manage to get it working it’ll die on Mac.  You need to emulate the behviour of the form by packaging the variables up and executing the widget.openURL() function.  Thats for GET forms.  POST forms will need to use the Ajax API Netvibes includes.

Packaging Up Your Form to Get

Someone else may find this useful…

var formElements = document.lmfForm.elements;
var qString = '?';
for (el in formElements) {
  if(formElements[el].name != undefined && formElements[el].value != undefined){
    qString += formElements[el].name + '=' + formElements[el].value + '&';
  }
}
widget.openURL('http://www.example.com/script.php' + qString);

Top 10 Project Killers

November 3rd, 2008

1. Excessive Promises – Often made without developer input or consultation. Promises of insane levels of functionality will only seek to burden the project with unnecessary tasks.  Example:

  • Sales: You want a Titanium Rocket Car with your project???
  • Customer: Errm…well no…erm…
  • Sales: You can have it!!!

…later…

  • Sales: We need a Titanium Rocket Car!!
  • Programmer: WTF?!?!

2. Change – Or should I say: Refusing to accept that change is inevitable and having fixed requirements with no flexibility is unnatural.

3. Lack of Communication – Lack of client involvement and poor communication is working blind.  Ever hear of Chinese whispers?

4. Inexperience – from the team leaders, programmers and management.  In fact anywhere in the line can cause problems.

5. Lack of Planning – Often a curse of developers who just want to get on with the job.  Planning is by far the most important aspect of a new project and also the most often neglected.

6. Lack of Priority – Concentrating too much on ‘parts’ and losing site of the bigger picture.

7. Relying on a Due-Date – See Parkinsons Law (work will expand to fill the time allowed).

8. Hardware and poor hardware management.

9. Ignorant Managerial Interference – I did have a great Dilbert comic for this but I lost it. :(

10. Insufficient Resources – Whether that be staff, time, facilities or raw materials.

Can anyone think of anymore?

Using the Asterisk Manager PHP API

July 19th, 2008

Well it’s been a while since the PHP Asterisk Manager API was released and I’ve yet to produce a clear and definitive example of its use.  So here goes.

Prerequisites

Your Asterisk server must be set up correctly before this API can ’speak’ to the server.

  • First you’ll need to ensure the Manager interface is active and you’ve set the correct permissions (If you’d like this explaining please leave a comment).
  • Secondly make sure you are setup with the ability for two endpoints to call each other.  This won’t work if you have one phone on the server.

Install

Firstly you’ll need to get hold of the library and there’s two routes to take.  You can either install via PEAR or simply checkout the source from the Google Project:

svn checkout http://asterisk-php-api.googlecode.com/svn/trunk/ asterisk-php-api

Originating a Call

Once you’ve got it all ready you need to start your new file thats going to make use of it.  In this example I’m creating a simple dialler called: “call.php” which will take two GET variables, with one being the callee and one the caller.

 '192.168.1.5',
  'port' => '5038',
  'auto_connect' => true
);

//Initialise
$am = new Net_AsteriskManager($params);

//Login to the Asterisk Manager interface
$am->login('user', 'pass');

//Originate Call is one of the commands available and it causes a call to be made and connected between two endpoints.
$am->originateCall($number, $from, $context, $cid, 1, 30000);
?>

By looking at the comments above you should see how this works and the steps required. If not then leave any comments and I’ll build on the above. It’s sometimes difficult to know what people already know so apologies if this is too simple or complex. :)

Later on I’ll show how to work with queues – adding, removing, listing, etc.