"When you do the common things in life in an uncommon way, you will command the attention of the world." - George Washington Carver

Sunday, October 16, 2020

Nice Tips

CSS and Javascript Hint Box

Nice Tips are an easy and cool way to show visitors to your webpage additional information or special reference,  which is often displayed with a mouseover or click action, I wanted to create a very lightweight but attractive tooltip for a recent project. This is what I came up with. To see it in action, hold the mouse over the question mark in the line below.

Nice Tips [?]
This is the an example of a Nice Tip
displayed on two lines.


The code is very simple. Here is the HTML part of the tooltip.

<p>Nice Tips <span id="a1" class="tooltipa">[?]</span></p>
<div id="a1t" class="tooltipb">This is the an example of a Nice Tip<br />
displayed on two lines.</div>

Just enclose the trigger (in this case a question mark) in a span with a unique ID and set the class to "tooltipa". I prefer to use a number sequence like a1, a2, a3, etc. Next, enclose the tip in a DIV and append a "t" to the ID used for the trigger. In this case, the ID for the DIV is "a1t". Set this class to "tooltipb".

continue »

delicious digg facebook stumble twitter myspace linkedin technorati reddit google springpad blogger | addthis Share More...
 

Tuesday, July 19, 2021

Modal Popup Editor for Tables

I've recently been working on a complex project that presented the user with a lot of data from an xml data source in table form. One requirement was that the user would have to be able to edit the data in the table. If you Google 'table editor' or 'modal editor' you will get a quite a few examples which are pretty good and can do much of what I wanted to do. However, I didn't exactly like any of them enough, so I decided to create my own. The following example is a relatively simple example. The modal popup editor I am actually using is a bit more complex and allows the user to edit more than one cell at a time. But for our purposes here, a simple example will suffice.

Modal Popup Editor Example

The HTML code for the editor itself is rather simple.

continue »

delicious digg facebook stumble twitter myspace linkedin technorati reddit google springpad blogger | addthis Share More...
 

Sunday, February 27, 2021

Simple SMTP Class for PHP

Easily send email via PHP with advanced features

PHP has a very simple mail function which is used very often for very basic text email messages. However, the standard mail function has only limited standard capabilities.  When it  comes to sending out more complicated emails, or using a more secure server to sent emails, we often fall back to PHPMailer. I use PHPMailer too. But for some requirements it is just too much power and too big. Because my needs fall somewhere in the two, I have created my own KM _Mailer for PHP.

There are a lot of reasons to use your own SMTP transport for sending e-mail messages from a web application. Some of them are:

  • Many shared hosting providers doesn’t allow to use the PHP mail() function for security reasons
  • Your web application is more flexible if you use SMTP
  • Your e-mail function is not limited to the servers port or e-mail configuration anymore
  • SMTP is much more powerful and secure (using SSL or TLS)

Just because I like to do this kind of stuff, I created my own simple, lightweight SMTP class to send email messages. It features:

  • Relaying message delivery to a pre-defined SMTP server.
  • Supports AUTH login using TLS or SSL
  • Send messages a plain text, html or a combination of both
  • Use extended email addresses (ie: MyName <myname@mydomain.com>)
  • Validate that server is connected and logged in
  • Validate that email message has been sent
  • Automatically generates plain text message when sending multipart messages
  • Specify additional headers if needed
  • Send multiple messages without losing the server connection
  • Enable debugging to monitor server response

New version 1.5 offers the ability to include multiple recipients, CC and BCC, and attachments.

Using the class is very simple. See examples below.

continue »

delicious digg facebook stumble twitter myspace linkedin technorati reddit google springpad blogger | addthis Share More...
 

Thursday, December 16, 2020

Read Receipt Macro for Outlook

Know when your email is read

One of the annoying things about email today is not knowing when or if your email has been read. This is particularly annoying when sending a very important message that is somewhat time sensitive. Not everyone responds to the emails sent to them, and with spam filters employed on almost every computer, you just don't know if the message got through.

Most email applications do have a "return-receipt" option, but that requires the receiver of the email to be a participant in the process. Most people, as far as I can figure, turn off this feature. There are services available on the web that will allow you to track your emails. Two such services that come to mind are SpyPig and ReadNotify. SpyPig is a free service, whereas ReadNotify is fee based. I tried SpyPig but couldn't get it to work in my Outlook 2007. So, I decided to create my own.

The process to track your email is relatively simply and not new. Email marketeers have been using this "technology" for years. It simply requires inserting an image, whether visible or invisible, into the message in such a way that the image is not displayed on the recipients computer without first connecting to a server where it can be tracked.

continue »

delicious digg facebook stumble twitter myspace linkedin technorati reddit google springpad blogger | addthis Share More...
 

Tuesday, October 26, 2020

Temporary Links Script in PHP

Creating Links That Expire

I've always been uneasy about creating a download page with permanent  links for my software products. That just makes it too easy for some individuals out there to publish the link to the page and there goes potential revenue. I used to think that my software was not that amazing that someone would actually want to steal it, but was astonished when one day I did a Google search for some titles and found links to various cracks. For the most part, all these titles are now available free from this website.

Probably the best was to protect your software and encourage sales is by using temporary download links. These are links that "expire" after a certain number of clicks or after a certain time period. These links are also known as expirable links. The true path to the downloaded file is always hidden from view so there is no way for the person downloading the file to know exactly where it is stored. Once the link expires, the user is directed to another page advising them that the link is no longer valid.

Temporary Links Demo

I wrote this PHP script for use on this website. The process is relatively simple, requiring the use of PHP and MYSQL. All parameters for the temporary link is kept in a MYSQL table. This is where we track how the link will expire, the current status of the link and the true download path. A unique id is created for each link or record. Instead of being directed to the download file itself. the user is provided with a link to the PHP script with the unique id. When the user clicks the link, the id is checked and if it matches and is still valid, the user is provided the desired file and the status is updated in the database.

continue »

delicious digg facebook stumble twitter myspace linkedin technorati reddit google springpad blogger | addthis Share More...
 

Monday, April 26, 2021

My Own Syntax Highlighter

Let me start of by saying that there are a lot of great syntax highlighters out there. Certainly we don't need another one. That being said, I did create one, but not for any other reason than I wanted to see what was involved. It is not a complete highlighter in that not all scripting languages are covered. Basically, I just covered the languages I use most often, which are HTML, PHP, CSS, JAVASCRIPT, DELPHI and XML. You can try out a demo of the highlighter by clicking on the link below.

Syntax Highlighter Demo

The the following code in this blog was generated by this syntax highlighter.

I started off working on the HTML and decided to go the old C++ route and parse the script one character at a time. This worked out quite well as it was easy to identify the tags, tag name and attributes without having to iterate through a list of all the HTML tags and attributes. Also, this works well for XML as well where there aren't any standard tag names.

continue »

delicious digg facebook stumble twitter myspace linkedin technorati reddit google springpad blogger | addthis Share More...
 

Tuesday, April 6, 2021

PHP Log Script

When doing any kind of programming, including programming in PHP, it is almost essential to create a log file of background processes just to know what is going on. Besides being of help to your users, this is a great way to track bugs in your programming  as well (not that we ever write imperfect code!). I recently needed to track some simple procedures and created a fairly simple class to implement a log of what was going on in a separate thread on the server. I've included the code for the log class here for your use if you find it useful at all.

Using the class is simple. Just put the class file in your includes directory, reference it in your script, and create a new log object. Then write to the script whenever you need to keep track of something.

<?php
include('../include/classes/logfile.php');

$log = new Logging();
$log->log_message("Log file started");
...
?>

By default, the log will be written to the current directory using the file name of logfile_(current date).log. This is easily changed by overriding the default values as decribed below.

continue »

delicious digg facebook stumble twitter myspace linkedin technorati reddit google springpad blogger | addthis Share More...
 

Saturday, March 20, 2021

Date Picker

A Javascript Calendar and Date Picker Solution

Have you ever needed to create a form that allowed the user to select a date from either a series of combo boxes for month, day and year, or by using a calendar date picker. User a date picker is relatively easy, and I've chosen to use the Date-Picker Widget V5 available from the frequency decoder website. The problem comes with wanting the combo box for the days of the month to accurately represent the selected month, whether the user selects the month using the combo box or the date picker. Also, the days of the month need to be correct for the month of February if it is a leap year or not. The script below will accomplish both using three combo boxes for the day, month and year coupled with the Date-Picker Widget V5.

 



Check out the DEMO here.

The trick is to get the combo boxes working in sync with the calendar date-picker. Here's how...

continue »

delicious digg facebook stumble twitter myspace linkedin technorati reddit google springpad blogger | addthis Share More...
 

Wednesday, February 17, 2021

AJAX Style File Upload

Easily Upload Files Without Refressing The Page

Ever wanted to upload files using AJAX without reloading the page? There are a number of sites that describe how this can be achieved. For the most part, the effect is achieved using iframes and javascript. This tutorial will go through the process of creating a file upload AJAX form and a PHP script which will return a status of 'success' or 'error', as well as, a few other details about the upload. To simplify the whole process, I found that using jQuery and the jQuery Form Plugin is the easiest and best solution for getting this done quickly.

Try the DEMO for this tutorial.

This exurb from the jQuery website provides a good starting point and overview of what we want to achieve.

The jQuery Form Plugin allows you to easily and unobtrusively upgrade HTML forms to use AJAX. The main methods, ajaxForm and ajaxSubmit, gather information from the form element to determine how to manage the submit process. Both of these methods support numerous options which allows you to have full control over how the data is submitted. Submitting a form with AJAX doesn’t get any easier than this!



 

Basically, we are going to create a form that lets us gather some basic information and select a file for upload. If any of the fields are left blank, we will receive an error message. If the file is not an image file, we will also receive an error message. If everything goes right, the file is uploaded and the file name, ext are returned. While uploading, the screen will display a message box advising that a file is being uploaded and we should wait.

So, let's get right to it.

continue »

delicious digg facebook stumble twitter myspace linkedin technorati reddit google springpad blogger | addthis Share More...
 

Wednesday, February 10, 2021

PHP File Upload

Easy File Upload Funtion for PHP

Recently, I needed to create a script to upload and parse a file using ajax. As is well known, you cannot upload files using javascript or ajax. However, there are ways to make it appear to be done using ajax. Anyway, in the course of trying to find something I could use effectively, I came across a small script that manages the upload part. For the most part it did everything I wanted, but found there could be some improvements. The original script was written by Binny V A and found on this website: http://www.bin-co.com/php/scripts/upload_function/

Here I am just going to present this function. Soon I will present a full ajaxform script to upload files using this upload function.

Uploading a file is usually not just a one-line function. There are a number of elements that need to be checked and verified before a file can be successfully uploaded. I have made a number of improvements to the original function. Some deprecated code has been updated. Some functions that did not work have been updated. If the upload destination folder does not exist, it will now be created. You can now choose to overwrite an existing file with the same name or create a unique name for the file (appends a numerical to the file name).

continue »

delicious digg facebook stumble twitter myspace linkedin technorati reddit google springpad blogger | addthis Share More...
12 next » 
copyright © 2004 to the present day | web design by KidMoses
privacy | terms | login | contact