Joomla fatal error: Allowed memory size of 8388608 bytes exhausted? – Problem Solved!

March 2nd, 2010

fatal error: Allowed memory size of 8388608 bytes exhausted?

Ran into this? chances are your memory limit is set to only 8MB, which is rather low for most of the scripts. Lucky you I discovered a quick fix and save you from the frustration trying to fix this :)

Ok, let me share what I found.

Open your configuration.php file located at the Joomla root folder, and insert this tiny little script just after the PHP open tag.

For example

<?php
ini_set('memory_limit','12M'); //recommended is 32MB, so they say but ill will put 12M for this example
//rest of the script follows...

save your configuration.php file and reload your page. Works like a wonder :) , Yes?

UPDATE: BTW for some reason when you installed Joomla and admin page is somewhat lost and scattered, This little code can fix it. I think you know the reason…ok chow

Im selling Fortigate 60b for only 15,000 pesos call or text 09237040600

February 25th, 2010

fortigate 60b

Hello everyone, Im selling a Fortigate 60b for only 15,000.00 pesos only, slightly used, 5mos old, used only for two months.

Fortigate 60b is a firewall and security solution within your reach, now with more reason to have one Im selling it for 15,000.00 only.

For more information please call or text me 0923 7040600 or call 3211440 Manila

Look for Regin

Covert amount to US dollar via PHP and Yahoo Finance Rates

February 23rd, 2010

PHP function to Auto automatically convert and display dollar equivalent of your peso value.

Rates via Yahoo Finance, easy to use function, for everybody…

Read on…

CONST YAHOO_URL = 'http://finance.yahoo.com/d/quotes.csv?e=.csv&amp;f=sl1d1t1&amp;s=%s%s=X';
function yahoo_convert($a,$from,$to){
   $fo = @fopen(sprintf(self::YAHOO_URL,$from,$to), 'r');
   if ($fo){
      $response = fgets($fo, 4096);
	fclose($fo);
	array = explode(',',$response);
	if(strval($array[1]) &gt; 0) {
	   return strval($a)*strval($array[1]);
	}
   }
   return false;
}

To use

<?php
echo yahoo_convert(1,USD,PHP);
?>

For questions / help send me a message of just comment for help instructions…

Validating email via regular expression

February 23rd, 2010

You have an online form.

You want to validate every field,  especially email input fields.

You do not want just check if its has a value of not, but also if its in the right format (e.g. email@email.com).

If you answered yes to all of these then the function below if perfect for you.

Check it out…

function validate_email($email){
     if(!eregi("^([[:alnum:]]|_|\.|-)+@([[:alnum:]]|\.|-)+(\.)([a-z]{2,4})$", $email)){
	  return $error=1;
     }
}

Fell free to abuse…

Formatting output of datetime MySQL value

February 22nd, 2010

I wanted to give a new output for those ugly looking datetime values in MySQL, which we get by using NOW() function in INSERT.

Why? because it pretty darn ugly, unpresentable and robot like.

Ok ok, maybe that’s description overkill for datetime, but how would you like this “2010-02-14 11:12:58″ to look like this “February 14, 2010″.

Pretty readable that the later huh.

Ok enough blah blah, here is my function, feel free to abuse it. :)

function Format_Date($date){
	$mos=array('01'=>January,'02'=>February,'03'=>March, '04'=>April, '05'=>May, '06'=>June, '07'=>July, '08'=>August, '09'=>September, '10'=>October, '11'=>Novermber, '12'=>December);
	$d = explode(" ",$date);
	$n = explode("-",$d[0]);
	return $mos[$n[1]].' '.$n[2].', '.$n[0].' '.$d[1];
}

To use this function:

$query=mysql_query("SELECT datetime FROM table"); //2010-02-14 12:11:03
while($row=mysql_fetch_assoc($query)){
echo Format_Date($row[datetime]);//February 14, 2010
}

Easy right? fell free to post your customizatios :)