LoRz

Wednesday, August 27, 2008

 

MP3 Audio Player for Websites


A tutorial for embedding mp3 audio player in websites using Audio Player Wordpress plugin from 1pixelout.

Tuesday, August 26, 2008

 

Install multiple versions of IE


http://tredosoft.com/Multiple_IE

Multiple IE installer

 

Calculating Relative Time in PHP


class calculateTime
{
public static function createTimeString($timeStamp, $format="long", $dateFormat="n/j/Y")
{
// Take the current time and create the difference
$timeDifference = time() - $timeStamp;

// Check the length of time passed since seconds
switch($timeDifference)
{
// Date is less than an hour old
case $timeDifference <= 3600:
$minutes = floor($timeDifference / 60);
$seconds = $timeDifference - ($minutes * 60);

// Choose correct pluralizations
if($minutes == 1)
{
$minuteString = "minute";
}
else
{
$minuteString = "minutes";
}

if($seconds == 1)
{
$secondString = "second";
}
else
{
$secondString = "seconds";
}

switch($format)
{
case "short":
return $minutes . "m " . $seconds . "s ago";
break;

default:
return $minutes . " " . $minuteString . " " . $seconds . " " . $secondString . " ago";
break;
}
break;

// Date is less than a day old
case $timeDifference <= 86400:
$hours = floor($timeDifference / 60 / 60);
$minutes = floor(($timeDifference - ($hours * 60 * 60)) / 60);

// Choose correct pluralizations
if($hours == 1)
{
$hourString = "hour";
}
else
{
$hourString = "hours";
}

if($minutes == 1)
{
$minuteString = "minute";
}
else
{
$minuteString = "minutes";
}

switch($format)
{
case "short":
return $hours . "h " . $minutes . "m ago";
break;

default:
return $hours . " " . $hourString . " " . $minutes . " " . $minuteString . " ago";
break;
}
break;

// Date is less than a week old.
case $timeDifference <= 604800:
$days = floor($timeDifference / 86400);
$hours = floor(($timeDifference - ($days * 86400)) / 60 / 60);

// Choose correct pluralizations
if($days == 1)
{
$dayString = "day";
}
else
{
$dayString = "days";
}

if($hours == 1)
{
$hourString = "hour";
}
else
{
$hourString = "hours";
}

switch($format)
{
case "short":
return $days . "d " . $hours . "h ago";
break;

default:
return $days . " " . $dayString . " " . $hours . " " . $hourString . " ago";
break;
}
break;

// Older than one week. Just return the absolute date.
default:
return date($dateFormat, $timeStamp);
break;
}
}
}

?>

from http://blog.sacklun.ch/?p=9

 

Get Filename in PHP


$filename = preg_replace('/(.+)\..*$/', '$1', $file);

Thursday, August 14, 2008

 

Custom JavaScript Dialog Boxes


JavaScript dialog box library which offers four model dialog styles: alerts, warnings, prompts and success.

Demo
Download

 

PHP Podcast


P3 (php|architect's PHP Podcast) is a bi-weekly radio-style program full of news, punditry and plenty of rambling.

 

Ratproxy


Google has released its free Ratproxy security tool to those wanting to
test the security of their Web-based apps, including for cross-site scripting
attacks.

Ratproxy is a semi-automated, largely passive web application security audit tool. It is meant to complement active crawlers and manual proxies more commonly used for this task, and is optimized specifically for an accurate and sensitive detection, and automatic annotation, of potential problems and security-relevant design patterns based on the observation of existing, user-initiated traffic in complex web 2.0 environments.

Tuesday, August 5, 2008

 

Add PHP related extension in Notepad++


  1. Settings - Style Configurator
  2. Select PHP from the Language list
  3. Look for the User ext: textbox
  4. Enter the extension
  5. Save & Close

Saturday, August 2, 2008

 

PHP functions equivalent to Javascript functions


PHP to Javascript Project which aims to decrease the gap between developing for PHP & Javascript.

 

Enabling eAccelerator in XAMPP


Files to edited to enable eAccelerator.
  1. apache/bin/php.ini
  2. php/bin/php.ini
  3. php/bin/php5.ini

Uncomment the lines below [eAccelerator].

Check if eAccelerator by running php -v in the command line.
You should see this line

Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
with eAccelerator v0.9.5.2, Copyright (c) 2004-2006 eAccelerator, by eAccelerator

Check also using phpinfo(); and look for the line eAccelerator which should be enabled.

Archives

June 2008   July 2008   August 2008   September 2008  

This page is powered by Blogger. Isn't yours?

Subscribe to Posts [Atom]