Limiting the number of text in textarea using JQuery

example: <textarea id=”id” maxlength=”255″></textarea>

jQuery(‘textarea[maxlength]’).keyup(function() {
var max = parseInt(jQuery(this).attr(‘maxlength’));
if (jQuery(this).val().length > max) {
jQuery(this).val(jQuery(this).val().substr(0, jQuery(this).attr(‘maxlength’)));
}
if (jQuery(this).parent().find(‘.charsRemaining’).length > 0) jQuery(this).parent().find(‘.charsRemaining’).html(‘You have ‘ + (max – jQuery(this).val().length) + ‘ characters remaining’);
else jQuery(this).parent().append(‘<div class=”charsRemaining”>You have ‘ + (max – jQuery(this).val().length) + ‘ characters remaining</div>’);

});

broken ubuntu gutsy sources.list

Attempting to update my repository on our Ubuntu VPS running the gutsy 7.10 version…I noticed that I was getting 404 ERRORs caused by the distribution being moved from its normal place within the mirrors.

deb http://old-releases.ubuntu.com/ubuntu gutsy main restricted universe multiverse

replace all the URL’s with http://old-releases.ubuntu.com

you should now be able to update your packages etc from this URL.

A CMS that integrates into ASP.NET MVC

Here is a open source CMS called N2 that provides a CMS framework to build web applications on using the ASP.NET MVC Model.   Its a very basic CMS, but it provides all the core functionality including Pages, Articles and a .NET Permissions Model (it also has some add ons and allows developers to contribute their own add ons).   They have lots of documentation and useful examples on how to work the CMS with MVC.   Very cool stuff!

References:

http://n2cms.com

Modifying contact component in Joomla issue

The problem I came across when making a modification to the layout in the Joomla contact component was it wasn’t updating on the website.   I even cleared out the cache and it still didn’t work.

It wasn’t until I realized it was because of the template that I was using. Templates can override the layout of Joomla components. These are located under the templates directory structure. Normally they are under template/html/com_contact/contact/default.php (for example, here is the contact component layout).

Should we build software from the ground up?

The Open Source development community has become stronger over the last several years with some successfull products being developed including Joomla, Moodle, Open Office, DotNetNuke etc.   This raises the question of why develop a new software product from the group up? why not just build applications/extensions on top of existing open source frameworks? For example, Joomla has a very large developer community base, very solid arcitecture and a active support community.   Developers could save time by developing extensions that uses the Joomla framework rather than building a new system from stratch.  Of course, it comes down to the client’s requirements and of course a open source framework may not cater for these needs.   But in general terms, if you are ever thinking about building software to do a specific “thing”, consider what open source  (or even proprietary) platforms are available that you could build your application on top of.

Decoupled Code using SubSonic

Subsonic is fantastic when generating a bunch of classes directly from the database structure…but the issue comes when OO/Application Objects clash with relational database structures.   An idea is to use Subsonic to query the data from the database and map the data directly to a application/OO object.

A really good example following the link below is to have a Product class that has a various number of attributes.  When you query data from the database using Subsonic you can do the following:

return Northwind.DB.Select("ProductID", "ProductName", "UnitPrice")
                .From<Northwind.Product>().ExecuteTypedList<Product>();

//where Product is a Application Object.

This attempts to map the data to ProductID, ProductName and UnitPrice attributes in the Product object.

Another example is to create a new application object that inherits from your subsonic generated class.
This is really handy if you want to extend and add custom business logic.

[Serializable]
public class PersonObj : Person //Person is the SubSonic generated class
{
    public void ResetSubscription()
    {
        SubscriptionDate = DateTime.Now; //Call the SubscriptionDate database field
        ExpiryDate = DateTime.Now.AddYears(1);
        Save(); //Commit the changes back to the database
    }
}

return Select()
                .From<Person>().ExecuteSingle<PersonObj>().ResetSubscription(); //Notice the PersonObj on the end

References:

http://subsonicproject.com/2-1-pakala/subsonic-writing-decoupled-testable-code-with-subsonic-2-1/

CodeLab Update

Hi All,

Just to give you an update on what we are doing.   We provide support services and technical expertise to a number of open source products including Moodle and Joomla.   Our clients are education institutes including Aoraki Polytechnic and Pro+Med Medic Training.   We also contract to SPF Multimedia to help develop software products for schools (pre-school, primary, high school and tertiary institutes).

We also do custom software development for Pro+Med where they have a dynamic driven C# ASP.NET website running on our own XTS Web Engine.   This will soon be changed to use the ASP.NET MVC framework.

We are also part of the Timaru Kyokushin Karate club where we manage their http://www.timarukyokushin.co.nz website.

On the side, I’m work full-time for Verb Ltd as a Lead Developer/Project Manager.

Considerations for implementing a Content Management System into your organisation

The abbreviation CMS is becoming very popular among organisations and the open source community. There is a huge range of CMS’s available through open source initiatives and in the commercial sector that have a range of different features and modules.

If you are considering implementing a CMS into your organisation, consider these three key areas in your decision making processes.

Technology

  • Research - Research the different types of CMS’s available and their features. http://www.cmsmatrix.org/ is a good source for comparing different CMS’s.
  • Track Record - Look at the success and failure case studies of different CMS’s. Although a particular CMS may have all the features, it might be the worst CMS to implement.
  • Strategy - Look at other businesses / competitors in your industry to see what they use as a CMS. You can use this research as a competitive advantage to get ahead of your competitors.
  • Migration - Migrating your existing system / content into a new CMS can be a huge project and can put strain on the cost and labour to migrate existing data. Some CMS’s will allow bulk importing of existing data or another approach is to research into writing scripts to automate the migration process.
  • Cost - Costing is a major factor. Consider open source products, commercial products, support agreements, internal and external consultant’s costs. Initially you may think that open source products are great as they are free, but support and maintenance can be a huge cost in the long term.
  • System Quality - Performance, Stability, Extensibility, Security are just some of the words that IT managers, developers and architects worry about when implementing a new system.

Organisational

  • A scale of balance - You can find the best CMS’s will all the bells and whistles, but there is no point designing and implementing a CMS without knowing the problems and requirements of your organisation. Some examples are features overlapping with existing systems, too many features that won’t be used or not enough features that fit the requirements.
  • Quality/Standard - Quality is a key area in content management. There is quality in terms of how well the software is written and how it performs, but also measuring quality in terms of the information. This becomes an organisational process of insuring the quality of the content in the CMS is sound.
  • Risks - Identifying the risks is standard practice including risks of implementation, quality, having the right technical team, the right consultants and advice, the approval and support of management, and the support of staff through your organisation.

People

  • Training - Depending on the number of staff involved in the implementation, these people will need to be trained on using, administering and/or even developing modules within the CMS. A lot of commercial CMS businesses will offer training as part of their package, but a lot of the community open source based CMS’s have no formal training available. Consider the time involved in training users is a critical factor for system buy-in and to have the on-going support of your users.
  • Change – Implementing new systems affects users if they like it or not. Having the right change processes in-place and the support of staff helps have a smooth transition. Consider a CMS that will help your change processes run smoothly including training and user-friendliness.

Having the answers to these considerations will help you identify the best CMS for your organisation. You have to be careful when making the decision as there are so many variations of CMS’s available in today’s market.
Good luck!

References

7 Challenges of implementing Content Management Systems (http://www.istart.co.nz/index/HM20/PC0/PV21905/EX210195/AR210332)

CMS Compare Matrix (http://www.cmsmatrix.org/ )

Document to PDF Driver

I came across this open source project called PDFCreator. This application acts as a virtual print driver that can be installed onto a local machine or installed in “server mode” to run on a network.

You can view the project here at http://sourceforge.net/projects/pdfcreator/

It also comes with a COM wrapper that initializes the printer and sends documents to it for processing (just like a normal print driver, but this driver converts the document to PDF and you can specify an output directory for the converted file).

Consider this product if you have a similar problem:

  • Our users want to be able to covert word documents into a PDF format so we can email these documents to external customers.
  • We don’t want to get individual licences on each client machine just to convert documents to PDF!

Solution

  • Install PDFCreator onto a server as a network printer.
  • Configure PDFCreator to your organisations requirements, for example, you can create scripts to email the user who sent the document the output PDF file, or maybe put the output PDF file into a shared folder for collection.
  • Install the printer on each client machine so they can choose the PDF printer from their print options when printing a document (e.g. from MS Word, Excel, Notepad, Outlook, or practically any application)

Advantages

  • No Cost
  • Easy to setup
  • Customisable to requirements

Disadvantages

  • Limited Support
  • The conversion is great for simple documents, but highly complex documents might not covert well

References
http://sourceforge.net/projects/pdfcreator/