Archive
Under the Crypt: My first Mac OSX game !
Just this morning, we finally had our app “Under the crypt” accepted by Apple. It’s available for $0.99 cents and is available for Mountain Lion (64 Bit) or higher. It was designed with Xamarin – a .NET based cross platform app development system, – it is a port of a Phonegap app, that was previously available for Blackberry and Android on the Amazon app store. Thanks goes to to @veubeke, @UlrikeErdmann, and Tyber Zann for programming support!
Download here; https://itunes.apple.com/us/app/under-the-crypt/id1013484922?ls=1&mt=12
Send email via #Amazon SES via PHP using #PHPMailer
<?php
require_once(‘scripts/phpmailer/PHPMailerAutoload.php’);
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPDebug = 0;
$mail->SMTPAuth = true;
$mail->SMTPSecure = “tls”;
$mail->Host = “email-smtp.eu-west-1.amazonaws.com”;
$mail->Port = 587;
$mail->Username = “xxxx”;
$mail->Password = “xxxx”;
$mail->CharSet = ‘windows-1250’;
$mail->SetFrom (‘info@domain.com’, ‘info@domain.com’);
$mail->Subject = “Subject line “;
$mail->ContentType = ‘text/plain’;
$mail->IsHTML(false);
$mail->Body = “this is the body”;
$mail->AddAddress (‘someone@gmail.com’, ‘Someone’);
if(!$mail->Send())
{
$error_message = “Mailer Error: ” . $mail->ErrorInfo;
} else
{
$error_message = “Successfully sent!”;
}
echo $error_message;
?>
Get details of a WebException in C=
If a HTTP call fails with a HTTP 500 error, and throws a WebException, you know something’s gone wrong, but sometimes the response from the server can explain more about what screwed up. I found myself writing this code over and over again, so here’s a single method that handles it;
private static string GetExceptionDetails(WebException exception)
{
string strResult = “”;
if (exception.Response != null)
{
var responseStream = exception.Response.GetResponseStream();
if (responseStream != null)
{
using (var reader = new StreamReader(responseStream))
{
strResult = reader.ReadToEnd();
}
}
}
return strResult;
}
Hope this helps solve your web related problems!
Print an Image using #Xamarin.mac
Printing an image using Xamarin turned out to be much easier than I thought, I loaded the image from a URL into an NSImageCell using;
string strUrl = “http;// Some Url with an image“; // ?
NSUrl url = new NSUrl (strUrl);
this.imgCell.Image = new NSImage (url);
Then to print it, I used the command;
partial void printButton (Foundation.NSObject sender) {
NSPrintOperation p = NSPrintOperation.FromView(this.imgCell.ControlView);
p.RunOperation();
}
Really surprised how easy that turned out to be!
Email Proxy on #Azure #Webservice
Here’s a generic way to use a webservice to send email, and it’s been tested with Amazon SES. Proxying email like this saves exposing your own IP address to recipients, to avoid problems with your ISP, or main hosting provider.
Here’s the code;
using System.Net.Mail;
using System.Text;
using System.Threading;
using System.Web.Services;/// <summary>
/// Summary description for EmailProxy
/// </summary>
[WebService(Namespace = “http://emailProxy.org/”)]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
// [System.Web.Script.Services.ScriptService]
public class EmailProxy : WebService {[WebMethod]
public void SendEmail(string smtpHost, string username, string password, int port, string to, string from, string subject, string body) {var client = new SmtpClient
{
Port = port,
Host = smtpHost,
EnableSsl = true,
Timeout = 10000,
DeliveryMethod = SmtpDeliveryMethod.Network,
UseDefaultCredentials = false,
Credentials = new System.Net.NetworkCredential(
username,
password)
};
var mm = new MailMessage(from, to, subject, body)
{
BodyEncoding = UTF8Encoding.UTF8,
IsBodyHtml = true,
DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure
};
client.Send(mm);
Thread.Sleep(1000);
}}
#Android #AppMarketing tip: Listing your app in China
Google play is virtually non-existent in china due to censorship rules, and Google’s exit from that market. Therefore to get downloads from china, you need to list your app on Chinese app stores. Most of which have an English version that you can navigate through. Here is a list of the top app stores in China – ordered by importance.
Myapp (Tencent)
Baidu Mobile Assistant
MIUI app store (Xiaomi)
HiMarket
Huawei App Store
Wandoujia
Anzhi Market
Google Play
Vivo
Access Tripadvisor API in PHP
<?php
$url = “http://api.tripadvisor.com/api/partner/2.0/map/42.33141,-71.099396/attractions?key=xxxx”;
$json = HttpGet($url);
$djson = json_decode($json, true);
$htmlOut = “<ul>”;
foreach($djson[“data”] as $poi)
{
$htmlOut = $htmlOut . ‘<li><a href=”‘ . $poi[“web_url”] . ‘”>’ . $poi[“name”] . ‘</a> – ‘ . $poi[“address_obj”][“address_string”] . ‘</li>’;
}
$htmlOut = $htmlOut . ‘</ul>’;echo $htmlOut;
function HttpGet($url) {
$ch = curl_init($url );
//return the transfer as a string
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT,’Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13′);
curl_setopt($ch, CURLOPT_REFERER, ‘http://www.google.com/’);
// $output contains the output string
$output = curl_exec($ch);
// close curl resource to free up system resources
curl_close($ch);
return $output;
}
?>