Sunday, January 31, 2010

Just in case I need to use PHPMailer again...

The important line was $mail->SMTPAuth = true.

Thanks to:
http://www.fasthostinghelp.com/send-mail-using-phpmailer-t98.html

$mail = new PHPMailer(); 

$mail->IsSMTP(); // send via SMTP 
$mail->Host "mail.domain name"// SMTP servers 
$mail->SMTPAuth true// turn on SMTP authentication 
$mail->Username "Domain Email account"// SMTP username 
$mail->Password "password of an email account"// SMTP password 

$mail->From "From email account – from above mentioned domain"
$mail->FromName "From Name here"
$mail->AddAddress("To Email account here ","Display name"); 
$mail->AddReplyTo("Reply to email account here ","Details"); 

$mail->WordWrap 50// set word wrap 

$mail->IsHTML(true); // send as HTML 

$mail->Subject "Subject Line of the email"
$mail->Body "Body part of the message – email details</b>"
$mail->AltBody "Alternate part of the body"

if(!
$mail->Send()) 

echo 
"Message did not sent <p>"
echo 
"Mailer Error: " $mail->ErrorInfo
exit; 


echo 
"Message has been sent"

?>

Thursday, January 28, 2010

Writing a DNN skin - need to get parent tab name

John Mitchell to the answer:

http://www.snapsis.com/DotNetNuke/Support/tabid/560/aff/12/aft/5003/afv/topic/Default.aspx

Have you ever wanted to get at more than just <%= SkinPath %>in your skin?

Maybe you want to display the name of the currently Active Page?

<%=PortalSettings.ActiveTab.TabName %>

Or maybe you want to display the name of the Active Page's Root level Parent?

<%=PortalSettings.ActiveTab.BreadCrumbs(0).TabName%>

If you want the currently Active Page's immediate Parent Tab Name try this:

<%=PortalSettings.ActiveTab.BreadCrumbs(PortalSettings.ActiveTab.Level - 1).TabName %>

Thursday, January 21, 2010

When Visual Studio 2008 keeps crashing

It's happened to me before and it's so annoying

Visual Studio just crashes and crashes and crashes - and it's not so easy to work out what to do...

First try the log file:
http://blogs.msdn.com/saraford/archive/2008/11/27/did-you-know-there-s-a-way-to-have-visual-studio-log-its-activity-for-troubleshooting-366.aspx

Then try the reset commands... basically type /? on the command line and you get options like /resetskippkgs and /resetaddin and /resetsettings

I'll try anything - I just want to get on with work!

Friday, January 15, 2010

MonoTouch - if you can't see any Provisioning Profiles

If MonoDevelop can't see any Provisioning Profiles, but XCode can, then maybe just maybe:

Distribution identity is not shown in MonoDevelop project signing options

MonoDevelop 2.2 has a bug that causes it not to detect distribution certificates that contain a comma. Apreview build of MonoDevelop 2.2.1 is currently available that fixes this issue.



This worked for me!

Wednesday, January 13, 2010

UITabBarController (kind of) inside a Modal child view

I've been playing quite a bit with MonoTouch - love it

It won't be a long term solution I feel (I *think* Silverlight is coming to the iPhone soon!) but it is a good solution for me right now.

One of the problems I've had is trying to get a UITabBarController to work in a child View - basically I just can't work out how to do this in Interface Builder.

To work around it I tried this code instead - using a UITabBar and custom linking code rather than using the "full" UITabBarController.

public override void ViewDidLoad ()
{
base.ViewDidLoad ();
childOne.Text = "one";
childTwo.Text = "two";
mainView.AddSubview(childOne.View);
mainView.AddSubview(childTwo.View);
mainView.BringSubviewToFront(childOne.View);
tabbar.SelectedItem = tabitemOne;
tabbar.Delegate = new MyUITabBarDelegate(this);
}


class MyUITabBarDelegate : UITabBarDelegate
{
TabViewController tvc;
public MyUITabBarDelegate (TabViewController _tvc)
{
tvc = _tvc;
}
public override void ItemSelected (UITabBar tabbar, UITabBarItem item)
{
if (item.Tag == 0)
{
tvc.mainView.BringSubviewToFront(tvc.childOne.View);
//while (tvc.mainView.Subviews.Count() > 0)
// tvc.mainView.Subviews[0].RemoveFromSuperview();
//tvc.mainView.AddSubview(tvc.childOne.View);
}
else
{
tvc.mainView.BringSubviewToFront(tvc.childTwo.View);
//while (tvc.mainView.Subviews.Count() > 0)
// tvc.mainView.Subviews[0].RemoveFromSuperview();
//tvc.mainView.AddSubview(tvc.childTwo.View);
}
}
}



Some initial MonTouch links

Doing MonoTouch stuff - and really quite enjoying myself!

I'd better make it pay though....


The monotouch forums are very useful - lots of code snippets around!

Monotouch.info is a good place to look for links

If you want to write games using Cocos, then check out:

This is a super tutorial

Craig Dunn's blog contains some very helpful posts:

Another blog/tutorial

Not monotouch, but useful for that real deployment stage,,,

StackOverflow is always a good place:
e.g. look at this level of info for writing a file - http://stackoverflow.com/questions/1829954/write-to-a-file-in-monotouch

Not monotouch, but for testing apps, this looks interesting:

Monday, January 11, 2010

A really good guide to url rewrite rules

Coupling an indecipherable language (regex) with a few flags to achieve lots of unexpected effects...

http://articles.sitepoint.com/article/guide-url-rewriting

Mainly posting this here as I keep hitting snags with my Wordpress MU installation on IIS

Tuesday, January 05, 2010

Setting up wordpress MU to work with authenticated SMTP Mail Server


I really don't like having sendmail running on a webserver, but some features of WordPressjust don't work if it can't send email (user registration, for example). Still, WordPress offers support to send email through external SMTP servers instead if a local mailer.

In /wp-includes/pluggable.php around line 377, change

 	$phpmailer->isMail();

to

 	$phpmailer->isSMTP();

Then, in /wp-includes/class-phpmailer.php around line 155, set your SMTP host:

     var $Host        = "my.smtphost.com";

You may also need to set a username and password, and tell WP to attempt authentication. You'll see those in the lines below the hostname variable.

     var $SMTPAuth     = true;     var $Username     = "username";     var $Password     = "password";

On the other hand, you could do this via a plugin, perhaps even Callum McDonald's WP MailSMTP.


For my redfoxhosting hosted SMTP server, the settings were:
true
password

Easy (but took 4 go's to get right!)