linein designs

Archive for the ‘php’ Category

10 Nov, 2008

MySQL Full-Text Stopwords Array

Posted by: john In: mysql|php

Below is an easy to use array of the default full-text stopwords in MySQL taken from MySQL.com.

Here’s the follow-up article on how to easily get file sizes nicely formated. Below is a quick function that will display the file size in KB, MB, or GB all easily accessed through a function. function formatbytes($file, $type) { switch($type){ case “KB”: $filesize = filesize($file) * .0009765625; // bytes to KB break; case “MB”: $filesize [...]

Tags:

04 Apr, 2008

Find Time Between Two Dates in PHP

Posted by: john In: php|programing

Below is a quick PHP function that allows you to find the time between two dates. The dates must be in seconds from Unix Epoch. if(!function_exists(timeBetween)) { function timeBetween($start_date,$end_date) { $diff = $end_date-$start_date; $seconds = 0; $hours = 0; $minutes = 0; if($diff % 86400 0) { $rest = ($diff % 86400); $days = ($diff [...]

Tags:

Almost a year ago I wrote a quick article on how you can strip off characters using PHP’s built in function substr. But after reading it again, even I was not clear how it worked so how would it ever help anyone. First, if you only want to pull on character from a string, it’s [...]

You now can look in almost any website or web application where the background colors are alternating. This is a great (and easy) way to improve the user interface for the end users. Here’s a quick explanation of what’s going on in the demo file below: First we set the alternating backgrounds we want to [...]

A friend of mine recently requested a quick image rotator script that was not using Flash, but would use Javascript. Below is a script that will read through a single directory and look for any image file (jpg, gif, or png) and rotate it. Update: new updated version which allows you to show only the [...]

Here’s a quick snip of code to help you easily manage your files by finding out the time the file was created or modified and also the time of the file. $file = ‘image.jpg’; // FILE TIME $filetime = filemtime($file); // displays in Seconds since the Unix Epoch echo date(“M j, Y”, $filetime); // would [...]

Here’s a quick way to strip off characters from a string using PHP’s function substr. <? $var = ’05 Delete’; $var = substr($var,0,2); echo($var); // returns “05″ ?> If you wanted to strip off the characters from the end of a string, just change the “2″ to “-2″ and it will strip off the last [...]

Just another quick way to automate the simple process of creating HTML selects with a function. This small function with also remember which value was selected by checking it against the $_POST value and adding a selected=”SELECTED” to that option. 2 dimentional array: $people_array = array( ’1′ => ‘Bob’, ’2′ => ‘James’, ’3′ => ‘Jessi’, [...]

Being a very big music buff, I love being able to see what my music habits are. I’m currently using the most up-to-date version of Winamp, which does a good job of keep a history of what I listen to, but I wanted this info on the web for the world to see. Fortunatly, Last.fm [...]



  • Seren: Thanks - google did not fail me in finding this snippet (after 2 hours of 'why isn't this working!' before I choose to look for answers. That select
  • zdenis: type your scp command with nohup at the beginning: >nohup scp... enter your password stop temporarily the command with CTRL+z put on b
  • Criz: php script >> How to get the number of hours and minutes of a two set of time like this sample. 1st set of time : 8:00 to 17:00 2nd set of


Please Support Our Friends

Banner
FreshBooks

About

My name is John Veldboom and have been in design and web programing for just over 8 years now. Started off as a hobby in high school but it has developed into a full time job now. I always tell people that if I wasn't doing this at work each day, I would be at home doing it for free. I love it!

Please visit the contact page to drop me a message.