Wednesday, December 02, 2009
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:
http://bucarotechelp.com/computers/windowsts/95021801.asp?x=62&y=6&page=1Let's hope it helps - because recently the hard disk action has been way too slow!
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
http://www.yougetsignal.com/tools/visual-tracert/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';
document.getElementsByTagName('head')[0].appendChild(scriptBlock);
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!
From http://www.samsung-omnia.org/software-development-b47/problem-with-gps-on-my-omnia-ii/msg62649/
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:
http://blog.lotusnotes.be/domino/archive/2007-08-04-javascript-color-functions.htmlI built this:
<div id='outputLifeLine'></div><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] = 255if (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;</script>
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.
I thought this would be fine because several site like http://www.java2s.com/Tutorial/JavaScript/0100__Number-Data-Type/NumberMAXVALUEandNumberMINVALUEdefinetheouterboundsoftheNumbervalueset.htm say things like:
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!
Yikes!
Friday, October 16, 2009
DNN - installing AjaxToolkit ahead of UKNuke RPX authentication
These were the draft steps I wrote about how to install the popup login functionality...
This is still in development... not really ready for primetime yet!
Stuart
You need the AjaxToolkit installed within your DNN bin folder. This can be downloaded fromhttp://www.codeplex.com/AjaxControlToolkit. To install it you may also need to update your System.Web.Extensions.dll to a more recent version (and indeed you may need to update the whole portal to .Net 3.5).
I can't assist you with this part in detail here - but there are quite a few links/instructions out there on Bing/Google!
One thing that helped me was updating web.config to include this "bindingRedirect" section:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
- this taken from a DNN 5.1.4 example portal.
2. Install the new RPX module I just sent you
3. Change your skin
You'll need to add this to the top of your skin:
<%@ Register TagPrefix="uknuke" TagName="Login" Src="~/DesktopModules/AuthenticationServices/UkNuke.RPX/LoginButton.ascx" %>
And you'll need to add this wherever you want the login link to appear:
<uknuke:Login ID="specialLogin" runat="server"></uknuke:Login>
4. That should be it :)
Some difference in DNN 5.1.4 - logging into SQL2005
For some reason my old connection strings - which started "Server=(local);" no longer work in DNN 5.1.4
To fix this, this gave me a clue: http://www.dnncreative.com/Forum/tabid/88/forumid/4/postid/15390/view/topic/Default.aspx
Basically, the connection string now starts "(local);"
Thursday, October 15, 2009
Getting AjaxToolkit to work in an old project
I was trying to update an old DotNetNuke project so it would use the AjaxToolkit.
To do this I had various problems with System.Web.Extensions versioning.
After some pain, I discovered one solution was to add this section to the web.config file :)
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="bin;bin\HttpModules;bin\Providers;bin\Modules;bin\Support;" />
<dependentAssembly>
<assemblyIdentity name="System.Web.Extensions" publicKeyToken="31BF3856AD364E35" culture="neutral"/>
<bindingRedirect oldVersion="1.0.61025.0" newVersion="3.5.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Extensions" publicKeyToken="31BF3856AD364E35" culture="neutral"/>
<bindingRedirect oldVersion="2.0.0.0" newVersion="3.5.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
Tuesday, October 13, 2009
Finding a table name
I knew my table had "comment" in it... so I used this to find out the table name
SELECT name
FROM dbo.sysobjects
WHERE xtype = 'U' AND NAME LIKE '%COMMENT%'
I could also have used xtype:
'V' - views
'S' - system tables
From: http://database.ittoolbox.com/documents/finding-table-names-in-sql-18556 - thanks!
SELECT name
FROM dbo.sysobjects
WHERE xtype = 'U' AND NAME LIKE '%COMMENT%'
I could also have used xtype:
'V' - views
'S' - system tables
From: http://database.ittoolbox.com/documents/finding-table-names-in-sql-18556 - thanks!
Tuesday, October 06, 2009
SagePay processing for nopcommerce - my first codeplex launch
Spent lots of today coding a SagePay payment processor for NopCommerce.
The details of it are on cirrious at: http://www.cirrious.com/Research/NopCommerceSagePay/tabid/62/Default.aspx
And I've launched it as a codeplex project at: http://nopsage.codeplex.com/
Overall I'm quite impressed with the support info available at http://www.sagepay.com/ - and their simulator is very useful for testing.
The details of it are on cirrious at: http://www.cirrious.com/Research/NopCommerceSagePay/tabid/62/Default.aspx
And I've launched it as a codeplex project at: http://nopsage.codeplex.com/
Overall I'm quite impressed with the support info available at http://www.sagepay.com/ - and their simulator is very useful for testing.
Friday, September 25, 2009
Creating an ActiveX object and running it in a browser
I'm such an old fuddy duddy... that I'd never really tried COM wrapping on C# objects.
But today all that changed...
This blog post helped lots:
http://blog.ianchivers.com/wordpress/?p=22
I'll try to actually post the code on this later... it's a nice way of extending a web app in an Intranet environment (it's not for Internet...)
But today all that changed...
This blog post helped lots:
http://blog.ianchivers.com/wordpress/?p=22
I'll try to actually post the code on this later... it's a nice way of extending a web app in an Intranet environment (it's not for Internet...)
Saturday, September 12, 2009
An excellent explanation of the confusion that reigns between ASP.Net 2.0 and 3.x
This is something I've come across more than once now - people complaining their ASP.Net 3.5 applications are running as 2.0 and not being able to set them in IIS...
Here's a superb explanation of what 3.0 and 3.5 added to 2.0 - and how they did it without changing the core runtime
http://www.hanselman.com/blog/HowToSetAnIISApplicationOrAppPoolToUseASPNET35RatherThan20.aspx
Here's a superb explanation of what 3.0 and 3.5 added to 2.0 - and how they did it without changing the core runtime
http://www.hanselman.com/blog/HowToSetAnIISApplicationOrAppPoolToUseASPNET35RatherThan20.aspx
Monday, September 07, 2009
Adding direct SQL editing/browsing access to any website...
I was editing a nopcommerce website that I only had http and ftp access to - no sql access.
So I needed a way to execute some SQL scripts.
To do this I added (to the administration pages) the following
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SQLRunner.aspx.cs" MasterPageFile="~/Administration/main.master" Inherits="NopSolutions.NopCommerce.Web.Administration.SQLRunner" %>
<asp:Content ID="Content1" ContentPlaceHolderID="cph1" runat="server">
SQL:
<br />
<asp:TextBox ID="tbSQL" runat="server" Columns="80" Rows="10" TextMode="MultiLine">
</asp:TextBox>
<br />
<asp:CheckBox ID="cbScript" runat="server" Text="Run as script" />
<asp:Button ID="btnGo" runat="server" Text="Go" OnClick="btnGo_OnClick" />
<br />
<asp:Panel ID="pnlOutput" runat="server" Visible="false">
<asp:GridView ID="grdResults" runat="server"></asp:GridView>
</asp:Panel>
<asp:Label ID="lblResult" runat="server" >
</asp:Label>
</asp:Content>
coupled with this source
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using NopSolutions.NopCommerce.Web;
using NopSolutions.NopCommerce.DataAccess;
using System.Configuration;
using System.Data.SqlClient;
namespace NopSolutions.NopCommerce.Web.Administration
{
public partial class SQLRunner : BaseNopAdministrationPage
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnGo_OnClick(object sender, EventArgs e)
{
try
{
var sqlConnection = NopSqlDataHelper.CreateConnection(ConfigurationManager.ConnectionStrings["NopSqlConnection"].ConnectionString);
var sqlCommand = sqlConnection.GetSqlStringCommand(tbSQL.Text);
if (cbScript.Checked)
{
sqlConnection.ExecuteNonQuery(sqlCommand);
pnlOutput.Visible = false;
}
else
{
var dataSet = sqlConnection.ExecuteDataSet(sqlCommand);
pnlOutput.Visible = true;
grdResults.DataSource = dataSet;
grdResults.DataBind();
}
lblResult.Text = "OK";
}
catch (Exception exc)
{
lblResult.Text = string.Format("Exception seen - {0} - {1}", exc.GetType().Name, exc.Message);
}
}
}
}
Seems to work OK :)
So I needed a way to execute some SQL scripts.
To do this I added (to the administration pages) the following
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SQLRunner.aspx.cs" MasterPageFile="~/Administration/main.master" Inherits="NopSolutions.NopCommerce.Web.Administration.SQLRunner" %>
<asp:Content ID="Content1" ContentPlaceHolderID="cph1" runat="server">
SQL:
<br />
<asp:TextBox ID="tbSQL" runat="server" Columns="80" Rows="10" TextMode="MultiLine">
</asp:TextBox>
<br />
<asp:CheckBox ID="cbScript" runat="server" Text="Run as script" />
<asp:Button ID="btnGo" runat="server" Text="Go" OnClick="btnGo_OnClick" />
<br />
<asp:Panel ID="pnlOutput" runat="server" Visible="false">
<asp:GridView ID="grdResults" runat="server"></asp:GridView>
</asp:Panel>
<asp:Label ID="lblResult" runat="server" >
</asp:Label>
</asp:Content>
coupled with this source
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using NopSolutions.NopCommerce.Web;
using NopSolutions.NopCommerce.DataAccess;
using System.Configuration;
using System.Data.SqlClient;
namespace NopSolutions.NopCommerce.Web.Administration
{
public partial class SQLRunner : BaseNopAdministrationPage
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnGo_OnClick(object sender, EventArgs e)
{
try
{
var sqlConnection = NopSqlDataHelper.CreateConnection(ConfigurationManager.ConnectionStrings["NopSqlConnection"].ConnectionString);
var sqlCommand = sqlConnection.GetSqlStringCommand(tbSQL.Text);
if (cbScript.Checked)
{
sqlConnection.ExecuteNonQuery(sqlCommand);
pnlOutput.Visible = false;
}
else
{
var dataSet = sqlConnection.ExecuteDataSet(sqlCommand);
pnlOutput.Visible = true;
grdResults.DataSource = dataSet;
grdResults.DataBind();
}
lblResult.Text = "OK";
}
catch (Exception exc)
{
lblResult.Text = string.Format("Exception seen - {0} - {1}", exc.GetType().Name, exc.Message);
}
}
}
}
Seems to work OK :)
Some interesting projects on codeplex
Just did a quick troll through the list of some of the more popular projects on codeplex - just to see what was on there.
These are some of the things that caught my eye.
Cosmos - open source operating system for C# - http://www.codeproject.com/KB/system/CosmosIntro.aspx http://www.gocosmos.org/Screenshots/index.EN.aspx
GPS Tracka - http://gpstracka.codeplex.com/ - looks good!
TravelPoint - windows mobile GPS location - http://travelpoint.codeplex.com/
Silverlight Media Player - http://xliteplayer.codeplex.com/
Quick Query Editor - http://q2.codeplex.com/
A bit DNN Help desk module - http://adefhelpdesk.codeplex.com/
Some DNN SKins - http://osdnnskins.codeplex.com/Wiki/View.aspx?title=Cash&referringTitle=Home
BugTracker.Net - http://btnet.codeplex.com/ and http://ifdefined.com/bugtrackernet.html
CSharp Parser - http://csparser.codeplex.com/
Code review - http://teamreview.codeplex.com/
Kigg - interesting site - http://kigg.codeplex.com/ and http://pimpthisblog.com/
CMS stuff - http://www.kooboo.com/docdetail/quick_start - http://kooboo.codeplex.com/
CMS stuff - http://www.jmdcms.com/
CMS - http://mojoportal.codeplex.com/
CRM project - http://crm.codeplex.com/
WikiPlex - http://wikiplex.codeplex.com/
DinnerNow sample app - http://dinnernow.codeplex.com/
Google Map control - http://googlemap.artembg.com/map/CaptureClick.aspx and http://googlemap.codeplex.com/
Geo Framework - http://geoframework.codeplex.com/
Deep Earth - Silverlight mapping - http://deepearth.codeplex.com/
Google maps in winforms - http://greatmaps.codeplex.com/
These are some of the things that caught my eye.
Cosmos - open source operating system for C# - http://www.codeproject.com/KB/system/CosmosIntro.aspx http://www.gocosmos.org/Screenshots/index.EN.aspx
GPS Tracka - http://gpstracka.codeplex.com/ - looks good!
TravelPoint - windows mobile GPS location - http://travelpoint.codeplex.com/
Silverlight Media Player - http://xliteplayer.codeplex.com/
Quick Query Editor - http://q2.codeplex.com/
A bit DNN Help desk module - http://adefhelpdesk.codeplex.com/
Some DNN SKins - http://osdnnskins.codeplex.com/Wiki/View.aspx?title=Cash&referringTitle=Home
BugTracker.Net - http://btnet.codeplex.com/ and http://ifdefined.com/bugtrackernet.html
CSharp Parser - http://csparser.codeplex.com/
Code review - http://teamreview.codeplex.com/
Kigg - interesting site - http://kigg.codeplex.com/ and http://pimpthisblog.com/
CMS stuff - http://www.kooboo.com/docdetail/quick_start - http://kooboo.codeplex.com/
CMS stuff - http://www.jmdcms.com/
CMS - http://mojoportal.codeplex.com/
CRM project - http://crm.codeplex.com/
WikiPlex - http://wikiplex.codeplex.com/
DinnerNow sample app - http://dinnernow.codeplex.com/
Google Map control - http://googlemap.artembg.com/map/CaptureClick.aspx and http://googlemap.codeplex.com/
Geo Framework - http://geoframework.codeplex.com/
Deep Earth - Silverlight mapping - http://deepearth.codeplex.com/
Google maps in winforms - http://greatmaps.codeplex.com/
Thursday, September 03, 2009
ASP.Net AJAX problems - Gray Google Maps
While adding some google map functionality to a custom nopcommerce build I came across some "gray map of death" problems with the gmaps. Basically the maps seemed to be offline - they didn't draw properly and they didn't respond correctly to mouse events (double click or drag).
Searching, I found a few references to these sorts of problems - most of which seemed to be caused by css issues (float:left seemed to be a common cause).
However, eventually this thread showed me the way forwards - http://www.reimers.dk/forums/thread/1251.aspx.
Basically, the initialisation of my AJAX tabs was causing the google map to lose its positional information - so to reset it I needed to call map.checkResize() - which seemed to cure the problem :)
Searching, I found a few references to these sorts of problems - most of which seemed to be caused by css issues (float:left seemed to be a common cause).
However, eventually this thread showed me the way forwards - http://www.reimers.dk/forums/thread/1251.aspx.
Basically, the initialisation of my AJAX tabs was causing the google map to lose its positional information - so to reset it I needed to call map.checkResize() - which seemed to cure the problem :)
Subscribe to:
Posts (Atom)