Archive

Archive for November, 2013

Install free SSL certificate on IIS (startssl, not self-signed)

November 29, 2013 Leave a comment

Create (or reauthenticate) your account

go to https://www.startssl.com/ and authenticate (or sign-up or use the express lane button).
This process involves entering a authentication code send to your e-mail address.
Follow the procedure, everything is pretty straightforward. Don’t forget to backup your certificate which is installed in your browser. If you reinstall your pc, you will need this certificate to gain access to your account.
Do e-mail validations first

The first catch. If you want to create a certificate for another domain.
First do a “email address validation” in the validations wizard for the domain you will be creating a certificate for. If you want to create a certificate for domainxyz.com, then first do an email validation for postmaster, hostmaster or webmaster@domainxyz.com. For the .com TLD you might have other possibilities also.
If you did not validated this e-mail address, you won’t receive any verification codes on this e-mail address.

Create a certificate

If you follow all instructions on the “certificates wizard”. If you let startssl generate your private key, you should have a at least the following files at hand

ssl.key (the encrypted private key)
ssl.crt (the certificate or public key)
The SSL.crt could be used on a windows server, but that would be only the public key. For HTTPS you also need the private key, because you need to decrypt the encrypted data. So you will need to link the private key and the certificate together as we will describe in the next steps.

Decrypt private key

First go to the toolbox and click the “decrypt private key”.

Paste in the content of the ssl.key file, enter your password which you provided in the previous step.

You now have a DECRYPTED private key. Copy this decrypted key.

Create Certificate for IIS

Now go to “Create PKCS#12” in the toolbox. Paste the decrypted key in the first box (private key). And paste the content of the ssl.crt file in the second box. Provide a new password to protect the file you will be creating.

Click continue.

Now download the PFX and use this file to install the certificate on your IIS 7.0/7.5 or higher.

Install the certificate

Open Inetmgr (Internet Information Services – IIS Manager) and open the “server certificates” on server level.

Click the “IMPORT” button and supply the PFX you just created (and uploaded?). You might not have the right file extension, but that is no problem. Just choose *.* as file type, select the file. Finish off with your password, before hitting return.

Redefine bindings of website

If you have only one HTTPS site running Go to your HTTPS site,

click “Bindings”
“Edit” the https (port 443) line
choose the right SSL certificate
hit “OK”,
and click the “Close” button

Bindings when hosting multiple sites

If you have multiple sites running on your website, you might want to set the binding headers for HTTPS. This can be done using the command prompt (as administrator) using these two commands:

C:\Windows\system32>cd \windows\system32\inetsrv
C:\Windows\System32\inetsrv>appcmd set site /site.name:”” /+bindings.[protocol=’https’,bindingInformation=’:443:’]

change the “”, “”, “” to approprate value’s.

Categories: Uncategorized

Email a Crash report from a BlackBerry App

November 13, 2013 Leave a comment

IMG_00000101

Too often, I get a email from a user who downloaded an app saying, “my app crashed, help”, and it’s very hard to diagnose the problem if you can’t re-create the problem on your own device. So, I thought of adding a crash report screen to my BlackBerry Webworks app.

Since I use “Console.log” statements all over my apps when developing the app, then the diagnostic information is already there.

All I needed to do is declare a global variable, and then replace all my console.log’s with log(string), and then have log(string) add to this global variable. Have this visible in a <pre> tag within a page to display a crash report, like shown opposite.

The clever bit, is then to have this send an email:

 

 

 

function email(to, subject, body) {
var message = to + ‘?subject=’ + subject + ‘&body=’ + body;
blackberry.invoke.invoke({
target: ‘sys.pim.uib.email.hybridcomposer’,
action: ‘bb.action.OPEN, bb.action.SENDMAIL’,
type: ‘message/rfc822’,
uri: ‘mailto:’ + message
});
}

Which is taken from the BuiltForBlackBerry Bootstrap on Github.

 

Categories: Uncategorized

Switching language on Windows 8 Store App (WinJS)

November 8, 2013 Leave a comment

ar

Using the Multilingual App Toolkit for Visual Studio is a great way to quickly make your app available across many different languages, and make it much more attractive to foreign users.

But, you do get tempted, as I did, to click every box, and upload every language from Arabic to Zimbabwean, but then, my app got rejected because my screenshots were in English.

Sure you can go into control panel, switch your language, and restart the app, in the simulator, but for 20-30 languages, it takes aaaages… So I came up with a bit of javascript that switches the app language every 3 seconds, so that you get time to take a screenshot of each language.

var iLangPointer = 0;
function CycleLanguages() {
var supportedLangs = [“ar”, “cs-CZ”, “da-DK”, “de”, “el-GR”, “es”, “et-EE”, “fi-FI”, “fr”, “hu-HU”,
“it”, “ja-JP”, “ko-KR”, “lt-LT”, “lv-LV”, “nb-NO”, “nl”, “pl-PL”, “pt”,
“ru-RU”, “sv”, “zh-Hans”];
Windows.Globalization.ApplicationLanguages.primaryLanguageOverride = supportedLangs[iLangPointer];
WinJS.Resources.processAll();
WinJS.Resources.processAll();
iLangPointer++;
if (iLangPointer >= supportedLangs.length) iLangPointer = 0;
}

 

Then, this is called from WinJS.UI.Pages.define {ready: … with

setInterval(CycleLanguages, 3000);

And it saves hours of work!
The App is a free download (for now), you can download it here:

http://apps.microsoft.com/windows/en-gb/app/wine-search/65894548-5b19-47a6-b262-641540e5bb5f

Categories: Uncategorized

Movember ; the time to learn about Mustache.js

November 1, 2013 Leave a comment

Mustache.js is a tempting engine for Javascript, and I thought since it was “Movember”, it was time to learn how to use it.

All Mustache.js does is tidy up spaghetti code that can result from rendering json objects as HTML

i.e. strHtml += “<div …..>” + obj.name + “</div><div …><span …>’ + obj.value ‘</span></td>’;

and all that yuckiness.

So here is a simple Hello World – type example, with an externalised template for extra neatness.

<html>
<head>
<script src=”http://code.jquery.com/jquery-1.10.1.min.js”></script&gt;
<script src=”http://cdnjs.cloudflare.com/ajax/libs/mustache.js/0.7.2/mustache.js”></script&gt;
</head>
<body>
<script language=”javascript”>
var person = {
firstName: “Christophe”,
lastName: “Coenraets”,
blogURL: “http://coenraets.org&#8221;
};
$(init);
function init()
{
var template = $(‘#personTpl’).html();
var html = Mustache.to_html(template, person);
$(‘#sampleArea’).html(html);
}
</script>
<div id=”sampleArea”></div>
<script id=”personTpl” type=”text/template”>
<h1>{{firstName}} {{lastName}}</h1>
<p>Blog URL: <a href=”{{blogURL}}”>{{blogURL}}</a></p>
</script>
</body>
</html>

 

Categories: Uncategorized