Tuesday, November 17, 2009

"The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel."

If you're working late at night and suddenly you start seeing lots of https issues concerning... "The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel."

Then it might just be because your app is routing its requests via the excellent fiddler2 - in which case SSL will not be trusted :)

Monday, November 16, 2009

Hard disk thrashing on Vista

I've been struggling recently with far too much hard disk thrashing.

So I searched around for help, and I've no idea if their advice helps yet, but this article seemed at least well written:

Let's hope it helps - because recently the hard disk action has been way too slow!

Super easy to use (and free) POP3 email client source code

Really good project!

Super easy to follow walkthrough for creating a custom DNN scheduled task

Super easy to follow walkthrough for creating a custom DNN scheduled task -

Really good stuff

Wednesday, November 11, 2009

Visual Trace Route

Just found this on the web. It wasn't what I was looking for - but it's a cool toy - let's you see some cute tracert maps

Would be fabulous if they could actually use my tracert results rather than their results.

Tuesday, November 10, 2009

JSON and cross site scripting

Been doing quite a lot of JSON work recently.

Have hit the odd occasion where I've needed to get JSON data across domain boundaries.

To do this, the only way seems to be to make use of <script> tags rather than making use of simple (e.g. Jquery) xml/http get's.

Basically what you do is:

1. Define a callback method, e.g.:

function myCallback(data)
// do stuff

2. On the server, instead of returning JSON, return the JSON inside a callback call, e.g.:
myCallback({ "thing": 12 });

3. To make the ajax call, then add a script tag to the document head:
            var scriptBlock = document.createElement('script');
            scriptBlock.src = jsonUrlToCall;
            scriptBlock.type = 'text/javascript';

4. Actually, that's it!

Tuesday, November 03, 2009

Samsung Omnia 2... GPS - the only setttings that work

More about this another day...

But have wasted so much time on trying to get Samsung Omnia II to hook up to GPS today...

Whatever you do, don't change the default settings:

Go to setting --> General Setting --> GPS --> Connection 
GPS program port: com7
GPS hardware port:com9
Baud rate: 4800
Click on done.
Go to XTRA
Enable XTRA Server
Tick "ZWhen connected to PC via ActiveSync
Enable SNTP Server (Only when you have data plan)
Click done.

These settings work!

Some color code to make some javascript HTML colors darker

I needed to quickly produce some new darker colours for an array of html colors.

Using this:

I built this:
    <div id='outputLifeLine'>
    <script type="text/javascript">
        var arr = [[-18, '#00ff00'],
        [-4, '#aaff00'],
... snip...
        [18, '#ff2200']];

        var G = {}, $ = function(a) { return document.getElementById(a) };

        G.color = {
            rgb: function(a) {
                var o = a.toLowerCase();
                return [parseInt(o.slice(0, 2), 16), parseInt(o.slice(2, 4), 16), parseInt(o.slice(4), 16)];
            shade: function(a, b) {
                var v = [], i;
                for (i = 0; i < 3; i++) {
                    v[i] = Math.round(a[i] * b)
                    if (v[i] > 255) v[i] = 255
                    if (v[i] < 0) v[i] = 0
                return v
            hex: function(a) { var f = G.color._hex; return f(a[0]) + f(a[1]) + f(a[2]) },
            _hex: function(a) { return ('0' + a.toString(16)).slice(-2) }

        var txt = '';
        var m = G.color;
        for (var i in arr) {
            var n = m.rgb(arr[i][1].substr(1));
            txt += "[" + arr[i][0] + ",'" + arr[i][1] + "', '#" + m.hex(m.shade(n, 0.6)) + "'],";
            txt += "<br/>"
        var d = document.getElementById("outputLifeLine");
        d.innerHTML = txt;


And then ran it... Nothing special... but thought I'd share it!

Monday, November 02, 2009

The perils of Javascript - Number.MIN_VALUE

Just spent some time debugging a problem....

I had a filter set up in my new player code on runsat - and when the filter was disabled I was setting the filter limits to Number.MIN_VALUE and Number.MAX_VALUE.

When a calculation results in a number greater than Number.MAX_VALUE, it is assigned a value of Number.POSITIVE_INFINITY.

When a calculation results in a number less than Number.MIN_VALUE, it is assigned a value of Number.NEGATIVE_ INFINITY.

However.... this is complete "codswollop" - actually MIN_VALUE is an epsilon value - it's the smallest positive fraction allowed in javascript - so it's not negative - in fact it's almost (but not quite) zero.

Looking around loads of sites contain big info on this!