Often when working on multiple projects and in various frameworks I find that the <em> and <i> tags in addition to <strong> and <bold> are used interchangeably.  After much confusion I finally went and looked up why both of these tags exists. As it turns out the <i> and <b> tags were created to denote a span of text that should be italicized or bolded respectively. While the <em> and <strong> tag were created to place emphasis on the text.

Before CSS the browser (User Agent) was responsible for how <em> and <strong> tags where rendered and it was not always guaranteed that <em> would be italic which is why <i> existed, the same goes for <strong> and <b>.

In today’s browsers it is common that both <em> and <i> as well as <strong> and <b> get rendered the same way in a browser unless a Cascading Style Sheet (CSS) exists for the Web Page that overrides the default styling. To be consistent in your own projects it is good practice to use <em> and <strong> as it can be utilized more effectively by Voice Synthesizer applications used by the visually impaired.

, , , ,

Much to every developers pain we often find that JavaScript that is functional in one browser is not functional in other browsers.  Recently the update to Safari 3 requrired that the window open command to not contain the url. As it would fail to open a window if it did, the simple fix was to create a new window with no url and set the url after creating the window. However as other brothers do not require this we can set up a two step process in that we try to open the window normally and if it fails then we open one with no url defined.

function create_popup( url, win_title, win_options )
{
  var popWin = window.open( url, win_title, win_options );
  if( !popWin ) {
    popWin = window.open('', win_title, win_options);
    popWin.location.href = url;
  }
}
popWin
, ,

The Java Calendar class provides many helpful methods for modifying Date objects. Here you will find a short code snippet for obtaining the last day of the month. To utilize the code please don’t forget to import the java.util.Calendar class or which ever Calendar you utilize. How the snippet works is it utilizes the getActualMaximum function which returns the max value for a field based on the current settings of the Calendar.

Calendar cal = Calendar.getInstance();
cal.set( Calendar.MONTH, 11 );
cal.set( Calendar.DATE, cal.getActualMaximum(Calendar.DAY_OF_MONTH) );
, ,

The standard approach to submit a form is through the use of the submit button. However we may find that we may want to utilize an image, text link or other elements to submit a form. In these cases we can utilize JavaScript to submit the form for us through the use of the JavaScript form object.

When your html page contains a form then a form object is created in your document that can be accessed by its name.  The form object contains both the submit and reset functions. To access the form object we use the notation document.FORM_NAME.

Examples

HTML Form

<form name='mailForm' method="POST">
   // form contents
</form>

JavaScript Form Submit

<a href="javascript: document.mailForm.submit()">Send mail</a>

JavaScript Form Reset

<a href="javascript:  document.mailForm.reset()">Clear</a>

Javascript Method

<SCRIPT language="JavaScript">
  function sendEmail ()
  {
     document.mailForm.submit();
  }
</SCRIPT>
 
<a href="javascript: sendEmail()">Send mail</a>
, ,

Subversion (SVN) is a popular version control system used by developers. Often a developer will find that they have folders or files within their project that they do not want to have saved and versioned. To accomplish this svn provides the ignore property which can be set to tell what not to include.

How to ignore or exclue files of a particular type

Ignoring files of a particular type is accomplished by setting the ignore property to a pattern for a particular url path. Lets assume in our projects we have a log directory and we want to ignore all files of type .log. This would be accomplished by the following command.

svn propset svn:ignore "*.log" log

How to ignore a directory

To exclude a whole directory we would utilize the same format but instead we would use the * pattern as it matches every file. So lets say we have a build folder in our path lets exclude it by the following command.

svn propset svn:ignore "*" build/

Resources

, ,