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.

The IIS Admin Service service terminated with service-specific error 2148073478

After recovering our servers from a hard drive disk failure, we attempted to start up the IIS Admin Service on Windows Servier 2003 RC2 and got the following error:

The IIS Admin Service service terminated with service-specific error 2148073478

This was caused by having a corrupt IIS 6 Meta Database xml file.

How did we get around this? We managed to restore a backup of the IIS 6 meta database using the IIS  6 Backup/Restore Function.   Worst case is that you cannot restore a previous copy of the XML database file.   If you have a staging environment that has IIS 6 installed, you can WinMerge the IIS Meta database xml files and populate the missing parts of the XML file.   But take note the ACL encrypted strings, these need to be generated by IIS6 and Windows Server otherwise you will get the same error.

References:

http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/43a51d34-7c81-413b-9727-ec9a19d0b428.mspx?mfr=true

Interview Questions Part 1

Over the past month, I have been interviewed by several companies and I thought I would share some of my experiences.   Here are some of the questions I was asked (Technical):

  • What is the difference between a reference type and a value type?
  • What is the difference between a stack and a heap?
  • What is the GAC?
  • Is a String a reference type or value type?
  • Can you inherit a class from two different classes?
  • What is a interface? What is the difference between a interface and a class?

Some other non-technical factors to consider..out of the four companies I saw, all of them use SCRUM.