Thursday 2 February 2012

asp:Panel not showing, ignoring Visible=true

In trying to add a Panel around an asp:Login control today so that I could add a DefaultButton I lost my login form completely!


<asp:Panel ID="pan_login" runat="server" DefaultButton="btn_login">
 
<asp:Login ID="LoginMain" runat="server" VisibleWhenLoggedIn="true" OnLoginError="LoginMain_LoginError" onauthenticate="LoginMain_Authenticate">

Nothing displayed at all!

Baffled, I eventually compared it to another site we had it working on and the solution was annoying to say the least... I had missed the reference to the Login control in my DefaultButton . Should have been DefaultButton="LoginMain$btn_login".


<asp:Panel ID="pan_login" runat="server" DefaultButton="LoginMain$btn_login">
 
<asp:Login ID="LoginMain" runat="server" VisibleWhenLoggedIn="true" OnLoginError="LoginMain_LoginError" onauthenticate="LoginMain_Authenticate">

Aaaaargh! ;-)

Debugging Memory dump or Minidump files

I had the following error message after a blue screen of death:

The computer has rebooted from a bugcheck.  The bugcheck was: 0x000000be (0x9d316e13, 0x28500121, 0x8078ac64, 0x0000000a). A dump was saved in: C:\Windows\MEMORY.DMP. Report Id: 013112-80044-01.

I found a great article on how to debug this:

http://forums.majorgeeks.com/showthread.php?t=35246

Tuesday 31 January 2012

Convert Website to Web Application in VS2008

I had some major speed issues with building a VS2008 solution today. The solution was originally started as a website rather than an application and the main hang up was with the "Validating Web Site" part of the build, it was taking several minutes.

So I decided to try and convert the whole thing to an Application and found the following article, follow the workaround steps.

http://gurustop.net/blog/2008/08/03/converting-vs-2008-website-to-web-application/

One other thing I had to do was to rename the new project after I had deleted the old one. I managed to change the name of the folder it was in, the project, assembly name and default namespace without issue.

The problem I was expecting was that TortoiseSVN would get it's knickers in a twist over the changing of folder names etc but actually after I had renamed my new folder to the same name as the original Subversion just saw that as a change to the folder rather than a new one and everything from mine and two other developer's machines committed/updated fine.

Phew! Glad we don't have to that everyday but amazingly went off without a hitch!

Wednesday 25 January 2012

Get to the top of a Twitter feed trick


Just a quick trick on Twitter for you. 

"S40" was trending this morning because of Nokia selling 1.5 billion S40 phones but if you click on it to view all the tweets then, because of his retweets, you get this bloke talking about a guy and his Volvo S40 coming up top even though his tweet was 13 hours ago!


Tuesday 20 December 2011

Lost templates and document types in Umbraco Settings tree

Today we came across an issue where the Umbraco Templates tree in Settings was not being populated and when we tried to edit a Document Type we got the following error:

Object reference not set to an instance of an object.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:


Line 49:         public string MasterPageFile
Line 50:         {
Line 51:             get { return IOHelper.MapPath( SystemDirectories.Masterpages  
+ "/" + Alias.Replace(" ", "") + ".master") ; }
Line 52:         }
Line 53: 

Source File: C:\Projects\288Group\WestminsterCollection\Shared\Umbraco\cms\businesslogic\template\Template.cs    Line: 51

Stack Trace:


[NullReferenceException: Object reference not set to an instance of an object.]
   umbraco.cms.businesslogic.template.Template.get_MasterPageFile() in C:\Projects
\288Group\WestminsterCollection\Shared\Umbraco\cms\businesslogic\template\Template.cs:51
   umbraco.cms.businesslogic.template.Template.getMasterPageContent() in C:\Projects\
288Group\WestminsterCollection\Shared\Umbraco\cms\businesslogic\template\Template.cs:153
   umbraco.cms.businesslogic.template.Template.setupNode() in C:\Projects\288Group\
WestminsterCollection\Shared\Umbraco\cms\businesslogic\template\Template.cs:141
   umbraco.cms.businesslogic.CMSNode..ctor(Guid uniqueID) in C:\Projects\288Group\
WestminsterCollection\Shared\Umbraco\cms\businesslogic\CMSNode.cs:341
   umbraco.cms.businesslogic.template.Template..ctor(Guid id) in C:\Projects\288Group
\WestminsterCollection\Shared\Umbraco\cms\businesslogic\template\Template.cs:63
   umbraco.cms.businesslogic.template.Template.GetAllAsList() in C:\Projects\288Group
\WestminsterCollection\Shared\Umbraco\cms\businesslogic\template\Template.cs:365
   umbraco.settings.EditContentTypeNew.bindTemplates() in C:\Projects\288Group\
WestminsterCollection\Shared\Umbraco\presentation\umbraco\settings\
EditNodeTypeNew.aspx.cs:56
   umbraco.settings.EditContentTypeNew.Page_Load(Object sender, EventArgs e) 
in C:\Projects\288Group\WestminsterCollection\Shared\Umbraco\presentation\umbraco
\settings\EditNodeTypeNew.aspx.cs:35
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
   System.Web.UI.Control.OnLoad(EventArgs e) +99
   umbraco.BasePages.BasePage.OnLoad(EventArgs e) in C:\Projects\288Group
\WestminsterCollection\Shared\Umbraco\businesslogic\BasePages\BasePage.cs:325
   System.Web.UI.Control.LoadRecursive() +50
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint
, Boolean includeStagesAfterAsyncPoint) +627


After doing some digging around we found the answer was that one of the cmsTemplate records was missing from the database.

select * 
from UmbracoNode n 
left join cmsTemplate t on t.nodeid = n.id
where n.nodeObjectType = '6FBDE604-4178-42CE-A10B-8A2600A2F07D'

The fix is to either create a new record for this (we were able to do this because the error was on our development site and we copied the live record back) or to remove the umbracoNode record. Either wat you then fix this broken relationship and fixes the problem.

As usual the Umbraco site is invaluable!

http://forum.umbraco.org/yaf_postst8368_Losing-templates-from-tree.aspx

I have no idea how this record was removed but it is possible that it happened during our weekly live to dev copy of the database or something crashed during a delete of that template.

Thursday 15 December 2011

Umbraco "Object moved to here"

The mains thread for this can be found at:

http://our.umbraco.org/forum/ourumb-dev-forum/bugs/8107-Object-moved-to-here-error-on-sign-in-or-out-using-membership-package

Basically an issue with the homepage in an Umbraco website, when logged in you get a "Object moved to here" header with a link to self. One answer is to check your hostnames in the content section, one of mine had a trailing forward slash (/). Once I removed  that it worked again.

Strange one...

Tuesday 13 December 2011

UPDATE OPENQUERY

We run lots of integration stuff between COBOL and SQLServer and we are starting to update records in COBOL which means we need a speedy way to do update statements using either OPENQUERY or the four part path to the linked server.

So, I can update a record using the four part path no problem but it's not the quickest...

UPDATE SITWEBDEV.SITWEBDEV..T_Changes_Webout
SET field = value
where etc.

Then I tried it with OPENQUERY...


UPDATE OPENQUERY([SITWEBDEV] , '
select Process
from T_Changes_Webout
where Id < 14
') 
SET Process = 0

... and I got the following error:


OLE DB provider "MSDASQL" for linked server "SITWEBDEV" returned message "Key column information is insufficient or incorrect. Too many rows were affected by update.".
Msg 7343, Level 16, State 4, Line 1
The OLE DB provider "MSDASQL" for linked server "SITWEBDEV" could not UPDATE table "[MSDASQL]". 


The solutions was that the main key of the table was not included in the inner select statement. Once I added this it ran and was much quicker too.



update OPENQUERY([SITWEBDEV] , '
select Id, Process
from T_Changes_Webout
where Id < 14
') 
set Process = 0

Hat tip for the solution to:

http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SQL-Server-2005/Q_25603503.html