Monday, November 7, 2016

PHP: Replace space in front of capitals in a string (Regex)

I have a number of strings which contain words which are bunched together and I need to seperate them up.

For example ThisWasCool - This Was Cool MyHomeIsHere - My Home Is Here

$String = 'TheCambodia';
$Words = preg_replace('/(?<!\ )[A-Z]/', ' $0', $String);
echo $Words;


Output: The Cambodia

Wednesday, October 26, 2016

How to display image from "image selection" field in transformation

You can use following sample code:





<img src="<%# GetDocumentUrl("Image", "") %>" />

Login failed for user 'IIS APPPOOL\DefaultAppPool'

If you don't change, each app pool has it's own identity. In your case, just add a new user to your database SmallBakery with the name IIS APPPOOL\SmallBakery using SQL Management Studio. You find the users list in the "Security/Users" subnode of your database. This should look something like that:




For testing, let the user be member of the db_owner role. If that works, remove this role and just let it be member of db_datareader and db_datawriter.

This way, each app pool (perhaps each website, if they all use their own app pool) only has access to the corresponding database.

If you use Default Web Site so you add "IIS APPPOOL\DefaultAppPool"