GeekSpeakr

I saw this article on linuxchix about the new register of women speakers that has been set up by Brenda Wallace of linuxchix. The site is called geekspeakr and although it claims to be “very alpha” they are currently registering female speakers. I don’t have a lot of speaking experience but it looks interesting and I figure it takes all sorts, so I’m registered … are you?

Speaking at GeekUp in Leeds

This week I will be giving a 20:20 talk at the GeekUp event in Leeds, entitled “Enterprise Web Development”. The 20:20 talk format allows talks with 20 slides, with 20 seconds allowed for each slide. Wish me luck :)

If you’re local to Leeds, I’d love to see you there.

SugarCRM Custom Fields

‘Tis the week for code snippets it seems – actually its mostly that I’m working with SugarCRM in anger for the first time and falling into a few traps. Due to the unique way in which this product is funded, there is a lot less community support around than I’d expect for a product this size.

Today I attempted to create custom fields for the first time, which should have been much easier than it was. The first problem was that all the tutorials deal with earlier versions of Sugar and the interface has changed. The second problem was that I kept on getting lots of errors when I tried to create a custom field. The errors were Javascript errors but when I looked in my apache error log there were lots of these:

PHP Warning:  LanguageManager::include(cache/modules/ModuleBuilder/language/en_us.lang.php) [function.LanguageManager-include]: failed to open stream: No such file or directory in .../include/SugarObjects/LanguageManager.php on line 91, referer: ...
index.php?module=ModuleBuilder&action=index&type=studio

On closer inspection I realised the cache directory was empty. I made this writeable by the apache user and everything started working after that.

Custom Field Creation

Here’s a very quick run through on the steps that I followed. From the home screen, go into the admin section and then click on “Studio”. In the left-hand pane, expand the folder for the module you want to add things to and click on “Fields”. At this point you should read the help entries in the right hand screen but for the impatient: Click on “Add Field”, enter the field details and click on “Save”. The field name gets saved with a suffix of “_c” and should appear in the central pane under “custom”. If it doesn’t, see above for my comments about the cache directory.

The new field needs to be added to the layout before you will see it – this seems to fool a lot of people and I must admit I would have missed this myself if I hadn’t read it on the forums. Once you have created your field, go back to the tree view on the left and choose which layouts you’d like to be able to see your field in. Again there is help on the right hand panel but basically you drag the “new row” thing from the left hand column in the central panel to the right hand column in the central panel, and then drop your new field on top of it.

Hope this helps, its taken me quite a while to get to grips with what should be fairly simple. I’ll add a final note to say that the custom fields are available through the SOAP API – just remember their names get suffixed with a “_c”.

PHP5 SOAP Error in non-WSDL Mode

I just came across a really strange error while using PHP5’s excellent SOAP functionality. My SoapClient was operating in non-WSDL mode but when I called function that did not exist I got the error:

Operation 'getFunctions' is not defined in the WSDL for this service

After spending quite a long time trying to get the client to realise it wasn’t supposed to be using a WSDL, I realised I had mistyped the name of the function and what the error message actually meant was “this function does not exist”. Hopefully I’ll remember next time I see the same problem, hopefully by putting it here it might also help someone else too.

Software That Costs Money?

I haven’t paid money for software for a long time. I bought a student license for Microsoft Office in 1999, and I’ve definitely bought a laptop that came with Windows since then, but that’s about it. I’ve given money to organisations that made my software, but I can’t think of another time that I’ve entered a business transaction where I give money in return for a software product. I live in a world of Linux, OpenOffice, with Opera as my web browser and vimfor everything else.

Recently I’ve been reminded that actually people make software that you can’t just dip into, that you have to buy. This is partly because I now work for Ibuildings and we’re Zend Partners – so all of a sudden I have access to lots of Zend products that I haven’t had reason to play with before. I also have a new work laptop that came with Windows Vista, which was less horrifying to use that I’d feared, and nothing like as good as I’d hoped. I’m sure half of the problem is that I really haven’t used windows for a long time, and its quite hard to find your way around unless you’re used to doing things that way.

The very idea of paying for software feels new … it isn’t, of course, but its been so long since I had anything that didn’t come out of my linux package manager, or from sourceforge that it really caught me by surprise. A lot paid-for software is easy to make points against – its proprietary, closed softare, or the same thing could be achieved by free equivalents. Which is true but if you’re not actually going modify the code or use the contributions of a wider community, it probably doesn’t matter. And if you aren’t going to install, set up, and glue together one or more free products, then the paid-for version is probably more up your street. On the whole, there are definitely situations where I can see the point of paying for a better-packaged version, or one that combines one or more functions, or offers support.

Then there’s the aspect that commercial software comes with salesmen and things – there’s a lot to be said on both sides! I’m not sure I’ll be putting my hand in my own pocket for software any time soon, but working with new products is interesting and I find I really would recommend some of them to others. I’d love to hear others’ feelings on this topic as well!

ZendCon Call For Papers

The ZendCon Call For Papers is now open. This conference is one of the biggest of the year but unfortunately is only held in the US. This year I am planning to submit talks for consideration for the first time … wish me luck :)

PHP on Ubuntu Gutsy Gibbon with PDO and PDO_mysql

A (very) quick tutorial on setting up mysql PDO libraries for PHP on ubuntu Gutsy Gibbon.

This version of PHP is the default one that comes with this version, 5.2.3. Check you have installed the php5-common package from aptitude as this includes the pdo.so file. If you check phpinfo you should see that PDO is listed as a module although you don’t have any drivers.

Then you should do:

sudo aptitude install php5-mysql

Restart apache and check its error log in case there are any problems. Then simply refresh your phpinfo page and pdo_mysql should be listed.

For earlier versions of ubuntu/kubuntu have a look at this excellent tutorial from theatons, I followed this but its slightly out of date now which is why I’ve posted an update. Most of the rest of the tutorial is still correct though.

Ubuntu/Kubuntu and mod_rewrite

I just spent a couple of days, on and off, fiddling with my apache setup on a kubuntu box. I had a site with some very weird and scary rewrite rules which I needed to do some development work with and I just could not get the site to work!

The solution was very simple and I found the answer in this post about ubuntu and apache. Basically, AllowOverride is set to None for both / and /var/www/ by default on ubuntu, which is nice and secure but it caught me out on this occasion. Change the settings to AllowOverride All and create a symlink in mods-enabled to mods-available/rewrite.conf and restart apache – everything should then start playing nicely.

Geshi and Serendipity for Code Snippets

I write on technical subjects on this site on a fairly regular basis, and nothing annoys me more than blog software which “eats” long lines of code or renders it in a difficult-to-read way. Happily Serendipity (or s9y for short) has a plugin for geshi.

About GeSHi

I thought “geshi” was a word but I just looked it up to link to it and it turns out its actually GeSHi (Generic Syntax Hilighter) which is a very humane way of pronouncing the thing. It is a very popular way to render source code on the web and was originally intended for phpBB. Geshi is great, it has lots of pre-made syntax highlighting rules so the odds are that it can probably already render whatever language you are coding in very nicely, however if it doesn’t then that’s fine too – it is an open standard and you can jump in and write your own.

Using GeSHi

Back to this blog, I added the “Markup: Geshi” plugin from SPARTACUS (the serendipity plugin repository) and added it as an event plugin. I had a lot of problems getting it working – putting it first in the list of event plugins eventually did the trick for me. You use geshi by adding geshi tags around the code you want to show, for example:


phpinfo();
phpinfo();

Styling GeSHi

Another problem I had initially was with the default resulting fonts, however these are easy enough to change and I now have colours I chose myself (illustrated in my posts about a SOAP server and PHP compilation) which is really quite easy to do. The plugin has files with all the language highlight in them and if you scroll down and look at the “color” entries towards the end of these, it is possible to just replace the red/green/blue defaults with colours that fit in with your look and feel (pink in my case, obviously!). For me the syntax files are in serendipity/plugins/serendipity_event_geshi/geshi – this is also a good place to look to see what languages you have that are supported.

I commonly use:

  • php
  • bash
  • xml
  • sql

A useful tip for styling is that the code block is placed into a div with a class named the same as the “lang” attribute – so for example I’ve got some of them resized by adding an entry to my overall css file.

Hope this helps someone, I remember having problems finding much info about using geshi in this way when I first added the plugin. If anyone is having problems feel free to post comments, I have this working on my serendipity installation so I am happy to try to help out.

Adding Markup to Comments in Serendipity

I switched over to serendipity as my blog platform about 6 months ago and although I haven’t been blown away by it, its a better tool for this job than textpattern was. I liked textpattern a lot but serendipity is better for what I need. There were a few things that I really missed when I moved across to serendipity – and the biggest one was textile as a markup. Its available in serendipity as a plugin, and I’d recommend it to everyone, but after I had imported my existing content from textpattern to serendipity I found that turning on the markup plugin did strange things to existing content so I turned it off.

Another thing I’ve been missing is the ability to add markup in comments, such as images. Well, its back! I’ve turned on textile for comments on this site, there is a link under the comments box to a page that shows you the syntax, so feel free to add richer content to this site from now on :)