Auto Increment in SugarCRM

Earlier today I posted about creating a DateTime Picker in SugarCRM. A second problem I had was creating an auto increment field. This turned out to be slightly more difficult than the datetime picker. Again you need to edit your vardefs.php but this time you add the following to your field.

'auto_increment' => true,

You then need to manually alter the table structure so the id field is a unique index instead of a primary key then add your new column to the database as an auto_increment field and the tables primary key. I also found that if you try to install the module on another system it will fail because it can’t create the table properly. You can solve that by creating the table then installing the module.

Date/Time Picker in SugarCRM

Recently I needed to add a date/time field to a custom SugarCRM module. Sadly the module builder doesn’t include support this and the documentation is pretty bad. Eventually I managed to solve my problem and the solution is suprisingly simple.

After adding a date field to the form I edited my vardefs.php file. You’ll find the file in custom/modulebuilder/packages/package_name/modules/module_name/. Find the field and change it’s type to datetime.

Next you need to change your views. They’re located in custom/modulebuilder/packages/package_name/modules/module_name/metadata. In my case I wanted to the edit view to show a datepicker plus a time combo. I found the field and added

'type' => 'Datetimecombo'

After that I deployed the package and my module was now saving as a date/time and in the edit view I could set both the date (using a date picker) and time (using drop down lists).

As a developer it’s all too easy to blame a framework for your applications bad performance. Before you do you might like to ask if you’re contributing to the problem. Most developers don’t think about what they’re really doing or how they could improve performance. I’ve seen a lot of code where every request results in at least one database query even though the database rarely changes.

Below are some stats for an application using the Zend Framework:

PHP – 36 requests/second

PHP + APC – 111 requests/second

PHP + APC + Memcache – 2,048 requests/second

By spending around 3 minutes to add code so the pages output is cached I’ve been able to improve performance 56 times without needing to throw out the framework. Of course this is an extreme example but it applies to most CMS, blogs, etc…

API equals dollars

Lately I’ve been looking at a number of SaaS providers covering a range of areas. It amazes me how many of them have no API or only a reporting API. If you’re thinking of building a SaaS start-up then you should be thinking about creating an API that allows your customers to do everything they can with your user interface.

Service providers with this API have an obvious advantage when it comes to migration and integration but they also have a more subtle and more important advantage. When reviewing potential providers I looked at those with an API before those without. Your SaaS may be the best but without this API are potential customers even considering you?

Committing unlawful acts one month, Premier elect the next.

The NSW Government has imploded and is no longer capable of governing this state. It’s time for the Governor of NSW to stand up for the people of NSW. If this is all we have left to run the state then it’s time to sack the government.

WebBlast

It’s that time of year again. Tickets are available now http://www.webblast.com.au/

Where's the data Nathan?

After reading Pia’s post about opening up government data I went back to a post I made the day the NSW Government announced that it was opening up government data. That was the 4th September. We were promised that a trial feed was being tested and a full feed would be opened on 21st Septemer. It’s now 15th October (nearly a month after the feed should have started) and the one government dataset covering NSW comes  from the Commonwealth Government.

Where’s the data Nathan?

Let’s be honest. The Commonwealth Government has started to open access to data. So have other states. The NSW Government has simply extended it’s policy of making grand announcements with no intention of following through. If there really is data available then put it in your data catalogue so we can find it!?!? I guess they’ll re-announce this every 12 months in between announcing yet another rail line that won’t be built.

NSW opens up data

Normally I’m highly critical of the NSW Government but they seem to finally be doing something right. According to Builder AU the NSW Government is now starting to open data to developers. They’re even running a competition for developers and have an entire website dedicate to providing public sector information. Sadly the site doesn’t contain anything yet but at least they seem to heading in the right direction.

Unit tests

I just read a post asking if my unit test take too long. In it the author suggests that 5 minutes is long and asks if anyone has solved this problem. This reminded me of a discussion I had with some developers about 12 months ago about unit testing in which my argument was simply that unit tests need to be comprehensive and not necessarily quick.

There are many projects where the unit tests take several hours to run. This shouldn’t matter during development when you’re probably only interested in a few unit tests as most test tools provide a way to filter the tests that are run. You only need to run the entire test suite prior to committing or during continuous integration.

Having said all of that I can recommend using memory tables if your database supports them. The operations are generally a lot faster as the database doesn’t need to write to disk.

Planet MicroISV

I was a big fan of Planet MicroISV. The site aggregated blogs from a number of MicroISV’s around the world. Unforunately it seemed to disappear in late April this year. Today I found the time to launch a new Planet MicroISV with a new URL (http://planet-microisv.com/). Luckily Google Reader allowed me to recover a number of feeds the old site aggregated.

If you want your blog added (or removed) then send me an email rich@buggy.id.au