In PHP we are provided with an integrated logging system for outputting info, warnings, and errors. This is accomplished by use of the syslog function. This function outputs the specified message at the specified priority level to the default system logger. If you want to have it output the log message to a user defined…
Code Snippets
Code Snipetts: How to use JQuery to submit a form on enter
Often as a User we don’t want to use our mouse or tab to the submit button to submit a form on a Web page, instead we may just want to press the enter key on our keyboard. This functionality can be easily completed by performing a bit of JavaScript, personally I find that utilizing…
Passing Arguments or Variables to a Bash Script from the Command Line
Often when working with Bash scripts we find that we want to add some options to the script by way of arguments or variables. Easily enough Bash command line arguments can be accessed by $1, $2, etc within the script where $1 is the first argument or variable and #2 is the second etc. Example:…
Java Code Snippet: Converting a Float or Decimal to Currency Formatted String
Java provides multiple Text Formatting classes to enable easy conversion of integers, decimals, floats, and etc into Strings. The DecimalFormat class enables the formatting of Floats and Decimals and can be used to easily display percentages and currency amounts. Example: Converting a Float into Dollars formatted String import java.text.DecimalFormat; … float amount = 100453.23f; DecimalFormat…
MailTo Syntax Overview
On today’s websites it is good practice to utilize a contact form instead of a mailto link. However you will find the occasions when you find the need to add a contact reference that does not require a form. In this cases you will find that you may want to set a predefined subject or…
Code Snippets: Calling a Function from a String in Flash AS3
There are often odd cases when in a Flash Application you find that by design you want to call a function but only have the name of the function as a String. This could be caused by various reasons one being that the name is stored in a database as part of some settings. To…
Code Snippets: Utilizing JSTL forEach tag in your Web Pages
JavaServer Pages Standard Tag Library or JSTL for short is a library that contains a set of core functionality including iterations and conditionals. The tag I find myself most often using is the forEach tag to output a collection of data in a consistent format. By use of the optional status object and the if…
Code Snippets: Left and Right Joins in WHERE statment of SQL Query
SQL Queries can often be written in multiple ways to obtain the same end result set. Tables for instance can be joined in the FROM clause or the WHERE clause of a SQL Statement. In the FROM Clause we can utilize LEFT, RIGHT, INNER keywords to denote if both sides of the statement needs to…
Code Snippets: Opening a new window from JavaScript across all browsers
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…
Code Snippets: Java Calendar – How to get the last day of the Month
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…