Monday, May 4, 2009

System.Data.DataSetExtensions Config Error in Visual Studio 2008

Below error is shown when we build application developed in VS 2008

ASP.NET runtime error: Could not load file or assembly ‘System.Data.DataSetExtensions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089′ or one of its dependencies. The system cannot find the file specified



The above error is caused when we already have VS 2005 and installing VS 2008 causes this error.

What happened in this case is VS 2008 is still pointing to Version 2.0.
So to solve this
  1. Right click the application in Solution Explorer
  2. Select Property Page
  3. References Item
  4. Select Version 2.0 DLL and select Remove button.
  5. Now building this application will close this issue


Happy Coding........ :)


Thanks,
Kash [Surya Prakash]

Friday, May 1, 2009

Smarty variable modifier to split a string

/*
* Name: split_list_third
* Purpose: Split string at specified pattern and return third half
* Example: {$var|split_list_second:"@"} *
* @version 1.0
* @param string
* @param string
* @return string
*/
function smarty_modifier_split_list_third($string,$pattern)
{
list($part1,$part2,$part3) = split("$pattern",$string);
return $part3;
}
?>

Example:
In php lets assign a string variable
$smarty->assign('phone', '91,040,23451231');
?>

In the Template
{$phone|split_list_third:","}

This will output:
23451231

Above modifier can also be modified to Split a string at specified pattern and return second half

Thanks,
Indrani