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

1. AjaxToolkit

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


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!

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.

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...)

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

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 :)

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/


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 :)

Friday, August 14, 2009

Creating indicies on views

Because runsaturday maintains two user databases - one for yaf and one for dnn - I wanted to create a lookup table from one set of userids to the other.

And the easiest way of doing this automatically was a view with an index.

But to create the index on the view - I had to remember the SchemaBinding trick - see http://www.mssqltips.com/tip.asp?tip=1610 for more information about schema bound views.

Wednesday, August 12, 2009

The Joel Test

I've not really seen this before - but just been sent it within the UK MSDN Flash today - http://geekswithblogs.net/iupdateable/archive/2009/08/05/uk-msdn-flash-poll-how-did-your-software-team-score.aspx - interesting stuff:

The Joel Test

  1. Do you use source control?
  2. Can you make a build in one step?
  3. Do you make daily builds?
  4. Do you have a bug database?
  5. Do you fix bugs before writing new code?
  6. Do you have an up-to-date schedule?
  7. Do you have a spec?
  8. Do programmers have quiet working conditions?
  9. Do you use the best tools money can buy?
  10. Do you have testers?
  11. Do new candidates write code during their interview?
  12. Do you do hallway usability testing?

And once you have answered those questions, share with the rest of us how you scored. 

I think I score a 8 or 9... I'll let you guess which ones I don't do... and which one I half kind of do.

Wednesday, July 29, 2009

"The process cannot access the file because it is being used by another process"

You receive a "The process cannot access the file because it is being used by another process" error message when you try to start a Web site in the Internet Information Services MMC snap-in

From:

http://support.microsoft.com/kb/890015

The solution in my case was:
- stop Skype - it was using port 80....

Monday, June 15, 2009

ModuleLoadException - RSS/News with DNN5

Saw this problem with the RSS/News feed module under DNN5 - using ASP.Net 3.5 SP1.

Eventuallly... after several hours... tracked it down to the file RssModule.ascx which hard codes the System.Web.Extensions version number:

<%@ Register assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" namespace="System.Web.UI" tagprefix="asp" %>

Replaced this with

<%@ Register assembly="System.Web.Extensions" namespace="System.Web.UI" tagprefix="asp" %>

And life was OK again (phew!)

Have reported to DNN for fixing.

 
Error: News Feeds (RSS) is currently unavailable.
DotNetNuke.Services.Exceptions.ModuleLoadException: Could not load file or assembly 'System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. ---> System.Web.HttpParseException: Could not load file or assembly 'System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. ---> System.Web.HttpParseException: Could not load file or assembly 'System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. ---> System.IO.FileNotFoundException: Could not load file or assembly 'System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. File name: 'System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) at System.Reflection.Assembly.Load(String assemblyString) at System.Web.Configuration.CompilationSection.LoadAssembly(String assemblyName, Boolean throwOnFail) at System.Web.UI.TemplateParser.LoadAssembly(String assemblyName, Boolean throwOnFail) at System.Web.UI.TemplateParser.AddAssemblyDependency(String assemblyName, Boolean addDependentAssemblies) at System.Web.UI.MainTagNameToTypeMapper.ProcessTagNamespaceRegistrationCore(TagNamespaceRegisterEntry nsRegisterEntry) at System.Web.UI.MainTagNameToTypeMapper.ProcessTagNamespaceRegistration(TagNamespaceRegisterEntry nsRegisterEntry) at System.Web.UI.BaseTemplateParser.ProcessDirective(String directiveName, IDictionary directive) at System.Web.UI.TemplateControlParser.ProcessDirective(String directiveName, IDictionary directive) at System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding) WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure logging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog]. --- End of inner exception stack trace --- at System.Web.UI.TemplateParser.ProcessException(Exception ex) at System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding) at System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding) --- End of inner exception stack trace --- at System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding) at System.Web.UI.TemplateParser.ParseReader(StreamReader reader, VirtualPath virtualPath) at System.Web.UI.TemplateParser.ParseFile(String physicalPath, VirtualPath virtualPath) at System.Web.UI.TemplateParser.ParseInternal() at System.Web.UI.TemplateParser.Parse() at System.Web.UI.TemplateParser.Parse(ICollection referencedAssemblies, VirtualPath virtualPath) at System.Web.Compilation.BaseTemplateBuildProvider.get_CodeCompilerType() at System.Web.Compilation.BuildProvider.GetCompilerTypeFromBuildProvider(BuildProvider buildProvider) at System.Web.Compilation.BuildProvidersCompiler.ProcessBuildProviders() at System.Web.Compilation.BuildProvidersCompiler.PerformBuild() at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath) at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) at System.Web.Compilation.BuildManager.GetVPathBuildResult(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) at System.Web.UI.TemplateControl.LoadControl(VirtualPath virtualPath) at System.Web.UI.TemplateControl.LoadControl(String virtualPath) at DotNetNuke.UI.ControlUtilites.LoadControl[T](TemplateControl containerControl, String ControlSrc) at DotNetNuke.UI.Modules.ModuleHost.LoadModuleControl() --- End of inner exception stack trace ---

Wednesday, June 10, 2009

Problems precompiling site - BC30560: 'ScriptServiceAttribute' is ambiguous

Installed a brand new DNN 5.0.1 installation.

Upgraded web.config to 3.5 Framework version.

Added my own modules.

Tried to precompilte....

But sadly things went wrong... 'ScriptServiceAttribute' is ambiguous

Spent a long time looking inside web.config for the problem.... couldn't see it.

Eventually discovered that something (not sure what - was it in DNN?) had installed an old version of system.web.extensions.dll into my bin directory....

Grrrrrrrrrrrr

(at least next time I'll check there first)

Tuesday, June 09, 2009

Windows 2008 server - connecting to GoGrid storage

Wish I'd blogged this first time - as i'd have found it more quickly then:

First setup the routing:
http://wiki.gogrid.com/wiki/index.php/Cloud_Storage:Configuring_Windows_2008_Servers_to_Access_Cloud_Storage

Then setup the SAMBA link:
http://wiki.gogrid.com/wiki/index.php/Cloud_Storage:SAMBA (see the bottom of this page for Windows instructions)

Wednesday, May 27, 2009

Got the plugin working on Firefox... now Chrome

The plugin worked on Firefox!

But under Chrome it kept crashing....

The problems seem to be down to:
1. A whole load of test and demo code in CPlugin::CPlugin - in plugin.cpp - couldn't be bothered to find out which bit of it caused the crash - it was all just demo code from the sample - so I cut it all out!
2. Problems with the way the sample code used malloc and strdup to allocate memory... these need to be replaced with NPN_MemAlloc for Chrome (and really for Firefox too!)

This page seems to help a bit...
http://code.google.com/p/vacuproj/wiki/SciMozNotes

But really it is hard work to debug!

Monday, May 25, 2009

Starting out on Firefox plugins

I've been working on a new Firefox plugin.

stage one... was to get the code I wanted to working as an ActiveX control inside Internet Explorer.

stage two... was to then start on getting the mozilla code working - this guide for Visual Studio building is a little out of date - but still seemed to basically work:
https://developer.mozilla.org/en/Compiling_The_npruntime_Sample_Plugin_in_Visual_Studio

The main things that didn't work were:
- problems with changes in function names
- problems with int32_t types which seem to have been removed!

Thursday, May 21, 2009

Eeeeek - back in C++ land

Spent a long time today trying to get a project to link :)

Eventually worked it out - but it took some decoding of name mangling - http://www.kegel.com/mangle.html - it eventually became "obvious" that the library I was linking against was built using VC++ 6.0 - before w_char as a type was introduced - so one of my names didn't match one of the mangled names...

I'm really finding it hard to work in C++ after 3 years of mostly C# though!

Monday, May 18, 2009

If you encounter ASP Validators not working in Chrome

This solution http://forums.asp.net/p/1343086/2734523.aspx seemed to work rather well for me:

<script type="text/javascript">
    evt = ""; // Defeat the Chrome bug
</script>