Touch Screen All-In-One Desktop Computers – What’s Available?
Tuesday, 23 February 2010 – | 2 Comments

In the pursuit of refreshing my technology I am looking for a new desktop computer, something space saving – hopefully even touch screen and all-in-one. Perhaps it’s a minimalism phase I might be going through …

Read the full story »
Downloads

Things to download free, from posters and shortcut guides to white-papers and checklists

How To & Tutorials

These handy problem solving tips and advice should save you some time

Industry News

News and commentary from news in the technology industry

Safety & Security

Be safe and secure both online and offline, from securing your computer to safe online surfing.

Software

Explore recommended software applications from around the Internet

Home » Archive by Tags

Articles tagged with: Code

PHP: Defining Constants
Wednesday, 23 April 2008 – | One Comment

To define a constant, use the format:
define(constant_name,constant_value,case_insensitive)
e.g.
define(“MYCONSTANT”,”This is the value of the constant”,false);
print “Constant is ” . constant(“MYCONSTANT”);
?>

PHP: Page Inclusion using GET selection
Friday, 18 April 2008 – | No Comment

Sample code to handle page inclusion based on get values 
// parse the passed value
switch($_GET['page'])
{
  // check for page1
  case(‘page1′):
  include ‘page1.php’;
  break;
  // check for page2
  case(‘page2′):
  include ‘page2.php’;
  break;
  // send other enquiries to …

PHP: Encoding HTML Special Characters
Friday, 18 April 2008 – | One Comment

When working with untrusted information it is always worth running it through the htmlspecialchars function.
This function converts characters that are used by html into safer versions, e.g. ‘<’ becomes $lt;
myString = htmlspecialchars($_GET['fieldname'], ENT_QUOTES);

PHP: Add a number of days to a date
Friday, 11 April 2008 – | One Comment

example code to add a number of days to a date
// add 5 days
$daystoadd=5;
// calculate hours
$hours=$daystoadd * 24;
// get today
$dd=date(d);
$mm=date(m);
$yy=date(y);
// calculate the new date
$newdate=date(“d-m-y”, mktime($hours, 0, 0, $mm, $dd, $yy));
// show the new date
echo “The …

PHP: Format and show an expiration date
Tuesday, 8 April 2008 – | No Comment

A useful routine to calculate and show an expiration date based on a given number of hours
// Hours to expiration
$iHrs = 72;
// Date from database
$dbDate = ‘2008-04-08 16:53:19′;
// obtain current date and time
$iTimeNow = date(“U”);
// …

ASP: Teaser Text
Monday, 7 April 2008 – | No Comment

An early routine written in ASP to cut off a given string after a given number of words:
strText = “This is some example text To prove the Get teaser function”
Response.Write GetTeaser(strText,9)

function GetTeaser(strText,iWords)
  Dim strTaster
  Dim …

Shell Script: Random Number
Saturday, 5 April 2008 – | 2 Comments

To get a random number at a shell script in Unix (I tried this on AIX 5 and it worked) use $RANDOM
echo $RANDOM
26558
echo $RANDOM
16737
echo $RANDOM
11669

J2ME: Splash Screen Timer
Friday, 4 April 2008 – | No Comment

Timer Example
private Timer myTimer;
  myTimer = new Timer();
  // Show Splash Screen
  myTimer.schedule( new waitSplash(), 2000 );
// process the splash screen timer
  private void dismiss()
  {
  myTimer.cancel();
  // change to your form here
  myDisplay.getDisplay(this).setCurrent(yourForm);
  }
// …