LoRz

Sunday, July 27, 2008

 

CodeIgniter and GoDaddy problems



Change
$config['uri_protocol'] = "AUTO";
to
$config['uri_protocol'] = "QUERY_STRING";

and
$config['index_page'] = "index.php";
to
$config['index_page'] = "index.php?";

Saturday, July 26, 2008

 

Free Video and Capture Tool


Jing Project
"The concept of Jing is the always-ready program that instantly captures and shares images and video…from your computer to anywhere."

Thursday, July 24, 2008

 

MAILTO link with Subject, CC, BCC, Body


<a href="mailto:YourName@YourSite.com?cc=someone@YourSite.com&bcc=someoneElse@YourSite.com &subject=Shipping%20Information%20Request&body=Please%20tell%20me%20if%20my%20order%20has%20shipped!">Shipping Request</a>

Each component is separated by the ampersand (&) sign. Only the
first component after the initial email address has a question mark (?)
preceding the ampersand.

 

Compare Date in PHP


Convert the dates to UNIX timestamp and compare the 2 dates.

$exp_date = "2006-01-16";
$todays_date = date("Y-m-d");

$today = strtotime($todays_date);
$expiration_date = strtotime($exp_date);

if ($expiration_date > $today)
$valid = "yes";
else
$valid = "no";

Wednesday, July 23, 2008

 

Check date format yyyy-mm-dd in PHP


Function to check date format

function check_date($strdate)
{
if (preg_match ("/^([0-9]{4})-([0-9]{2})-([0-9]{2})$/", $strdate, $parts))
{
if(checkdate($parts[2],$parts[3],$parts[1]))
return true;
else
return false;
}
else
return false;
}


 

Check date format mm/dd/yyyy in PHP


Function to check date format
    
function check_date($strdate)
{
if ((strlen($strdate) < 10) OR (strlen($strdate) > 10))
{
return FALSE;
}
else
{
if ((substr_count($strdate, "/")) <> 2)
{
return FALSE;
}
else {
$pos = strpos($strdate, "/");
$date = substr($strdate, ($pos+1), ($pos));
$result = ereg("^[0-9]+$", $date, $trashed);
if (!($result))
{
return FALSE;
}
else
{
if (($date <= 0) OR ($date > 31))
{
return FALSE;
}
}

$month = substr($strdate,0, $pos);

if (($month <= 0) OR ($month > 12))
{
return FALSE;
}
else
{
$result=ereg("^[0-9]+$", $month, $trashed);
if (!($result))
{
return FALSE;
}
}

$year = substr($strdate,($pos+4), strlen($strdate));
$result = ereg("^[0-9]+$", $year, $trashed);

if (!($result))
{
return FALSE;
}
else
{
if (($year < 1900) OR ($year > 2200))
{
return FALSE;
}
}
}
}

return TRUE;
}


 

Remove blue underline in a Link


Inline style
<a href="http://www.lorztech.com" style="text-decoration:none">lorz</a>

CSS

a {
text-decoration: none;
}

Wednesday, July 16, 2008

 

Remove blue border in an Image link


Inline style

<a href="http://www.lorztech.com/">
<img src="lorztech.png" style="border-style: none"/>
</a>

CSS

img
{ border-style: none;
}

Old Way

<a href="http://www.lorztech.com/">
<img src="lorztech.png" border="0">
</a>

Tuesday, July 15, 2008

 

Image Gallery using CSS


CSS

.photolistitem
{
position: relative;
display: block;
float: left;
list-style-type: none;
height: 220px;
width: 170px;
padding: 10px;
border: solid 1px khaki;
margin: 12px;
background: steelblue;
text-align: center;
}
Sample HTML code
<ul>
<li class='photolistitem'>
<img src='images/sample.jpg' />
</li>
<li class='photolistitem'>
<img src='images/sample.jpg' />
</li>
<li class='photolistitem'>
<img src='images/sample.jpg' />
</li>
</ul>

Thursday, July 10, 2008

 

Get Previous/Next Record in Database


Sample query

SELECT *, 1 as NextRec
FROM models
INNER JOIN
(
SELECT models.mod_id FROM models INNER JOIN (SELECT mod_id FROM models WHERE mod_id = 1 ) as info ON models.mod_id > info.mod_id ORDER BY models.mod_id LIMIT 1
) as nextrec ON nextrec.mod_id = models.mod_id
UNION ALL
SELECT *, 0 as NextRec
FROM models
INNER JOIN
(
SELECT models.mod_id FROM models INNER JOIN (SELECT mod_id FROM models WHERE mod_id = 1 ) as info ON models.mod_id < info.mod_id ORDER BY models.mod_id DESC LIMIT 1
) as prevrec ON prevrec.mod_id = models.mod_id

Tuesday, July 8, 2008

 

Error Suppresion in PHP


Use the Error Control Operator (@)

Try the following codes.

With Error Control Operator

<?
echo @(1/0);
?>
Without Error Control Operator

<?
echo (1/0);
?>


Monday, July 7, 2008

 

Add Skype Status in Website


http://www.skype.com/share/buttons/advanced.html

Make sure to check/enable "Allow my status to be shown on the web" from Tools - Privacy - Privacy Settings

Sunday, July 6, 2008

 

Add Yahoo Messenger Status in Website


<a href="ymsgr:sendIM?[username]">
<img border="0" src="http://mail.opi.yahoo.com/online?u=[username]&m=g&t=1"/>
</a>

Change [username] to your yahoo id.

You can change the image source with any of the links

 

Retrieve Windows 2000/XP/2003 or Office 2000/XP CD Key


A fee small utility Magical Jelly Bean Keyfinder can retrieve your Windows 95, 98, ME, NT4, 2000, XP, Server 2003, Office 97, and Office XP CD key.
The Magical Jelly Bean Keyfinder is a freeware open source utility that retrieves your Product Key (cd key) used to install Windows from your registry. It allows you to print or save your keys for safekeeping. It works on Windows 95, 98, ME, 2000, XP, Vista, Server 2003, Server 2008, Office XP, Office 2003, and Office 2007 family of products. It also has a community-updated configuration file that retrieves product keys for many other applications. Another feature is the ability to retrieve product keys from unbootable Windows installations.

Wednesday, July 2, 2008

 

Database Models


http://www.databaseanswers.org/data_models/

Archives

June 2008   July 2008   August 2008   September 2008  

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

Subscribe to Posts [Atom]