Blog tag cloud bug?

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
8/17/2009 9:35:40 AM
Gravatar
Total Posts 37

Blog tag cloud bug?

Hi,

anybody had a problem with blog tag cloud like below. It happened on my prod server with trunk build that is about 2 weeks old.

Thanks,

Przemek

 

-----------------

2009-08-17 16:31:34,406 ERROR mojoPortal.Web.Global - 81.252.111.30-en-US - /blog.aspx
System.IndexOutOfRangeException: Index was outside the bounds of the array.
at mojoPortal.Web.UI.TagCloudControl.CreateChildControls(IEnumerable dataSource, Boolean dataBinding)
at System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data)
at System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data)
at System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback)
at System.Web.UI.WebControls.DataBoundControl.PerformSelect()
at System.Web.UI.WebControls.BaseDataBoundControl.DataBind()
at mojoPortal.Web.BlogUI.BlogCategories.BindCategories()
at mojoPortal.Web.BlogUI.BlogCategories.Page_Load(Object sender, EventArgs e)
at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

 

---------------------------

8/17/2009 10:08:18 AM
Gravatar
Total Posts 18439

Re: Blog tag cloud bug?

What .sln file did you use?

How did you create your package for deployment? 

8/17/2009 10:14:24 AM
Gravatar
Total Posts 37

Re: Blog tag cloud bug?

So I guided myself with this instructions on deployment: http://www.mojoportal.com/deploymentfromwindows.aspx.

I used mojoportal.sln, renamed it and used PgSQL as my backend. I set the data layer as described in here -> www.mojoportal.com/settingadatalayerreferenceinvisualstudio.aspx   .

 

Przemek

 

8/17/2009 10:17:03 AM
Gravatar
Total Posts 37

Re: Blog tag cloud bug?

You can go to http://lopaciuk.com/blog.aspx and click on any category and you will see what happens and this is what you get in syslog

-------------

2009-08-17 16:50:42,687 ERROR mojoPortal.Web.Global - 81.252.111.30-en-US - /Blog/ViewCategory.aspx?cat=11&mid=3&pageid=1
System.Web.HttpException: DataBinding: 'System.Data.Common.DataRecordInternal' does not contain a property with the name 'Heading'.
at System.Web.UI.DataBinder.GetPropertyValue(Object container, String propName)
at System.Web.UI.DataBinder.Eval(Object container, String[] expressionParts)
at System.Web.UI.DataBinder.Eval(Object container, String expression)
at ASP.blog_viewcategory_aspx.__DataBinding__control3(Object sender, EventArgs e)
at System.Web.UI.Control.OnDataBinding(EventArgs e)
at System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding)
at System.Web.UI.Control.DataBind()
at System.Web.UI.Control.DataBindChildren()
at System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding)
at System.Web.UI.Control.DataBind()
at System.Web.UI.WebControls.Repeater.CreateItem(Int32 itemIndex, ListItemType itemType, Boolean dataBind, Object dataItem)
at System.Web.UI.WebControls.Repeater.CreateControlHierarchy(Boolean useDataSource)
at System.Web.UI.WebControls.Repeater.OnDataBinding(EventArgs e)
at System.Web.UI.WebControls.Repeater.DataBind()
at mojoPortal.Web.BlogUI.BlogCategoryView.Page_Load(Object sender, EventArgs e)
at System.Web.UI.Control.OnLoad(EventArgs e)
at mojoPortal.Web.mojoBasePage.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
-------------------

 

P.

 

8/17/2009 10:28:19 AM
Gravatar
Total Posts 18439

Re: Blog tag cloud bug?

I don't know. Never seen this error before. It looks like it would be a missing column in the data but I checked the pgsql procedure and it seems to return the right fields.

I would get a backup of your production db, restore it on your dev machine and see if you can produce the issue locally. If so then set a break point in /Controls/TagCloudControl in the CreateChildControls method. Step through the code and find where it blows up.

Hope it helps,

Joe

8/17/2009 10:33:19 AM
Gravatar
Total Posts 18439

Re: Blog tag cloud bug?

Ok, its not the tagcloud control. I'm looking into it to see if that field is in the results. Will reply shortly. 

8/17/2009 10:42:34 AM
Gravatar
Total Posts 18439

Re: Blog tag cloud bug?

Hi,

I confirm this as a bug, the stored procedure does not have the Heading column.

I have moved away from using stored procs on pgsql except in rare cases where its needed.

To solve this look in the DBBlog.cs find the GetEntriesByCategory method. Comment out the existing implementation.

Paste this in:

StringBuilder sqlCommand = new StringBuilder();
sqlCommand.Append("SELECT * ");
sqlCommand.Append("FROM mp_blogs ");
sqlCommand.Append("WHERE ");
sqlCommand.Append("moduleid = :moduleid ");
sqlCommand.Append("AND itemid IN (SELECT itemid FROM mp_blogitemcategories WHERE categoryid = :categoryid ) ");
sqlCommand.Append("ORDER BY ");
sqlCommand.Append("startdate DESC ");
sqlCommand.Append(";");

NpgsqlParameter[] arParams = new NpgsqlParameter[2];

arParams[0] = new NpgsqlParameter("moduleid", NpgsqlTypes.NpgsqlDbType.Integer);
arParams[0].Direction = ParameterDirection.Input;
arParams[0].Value = moduleId;

arParams[1] = new NpgsqlParameter("categoryid", NpgsqlTypes.NpgsqlDbType.Integer);
arParams[1].Direction = ParameterDirection.Input;
arParams[1].Value = categoryId;

return NpgsqlHelper.ExecuteReader(
GetConnectionString(),
CommandType.Text,
sqlCommand.ToString(),
arParams); 

rebuild and redeploy the mojoPortal.Features.Data.dll

I have made the same change here to fix this for the next release.

Thanks,

Joe

8/17/2009 10:44:25 AM
Gravatar
Total Posts 37

Re: Blog tag cloud bug?

Thank you Joe :)

 

Przemek

8/18/2009 3:21:11 AM
Gravatar
Total Posts 37

Re: Blog tag cloud bug?

I'm affraid Joe that there is still problem with tag cloud. When I switch on the "Use Tag Cloud For Categories?" in blog I get an error and the page with blog can't be displayed at all.

System log for that:

 

---------------------

2009-08-17 21:55:17,218 ERROR mojoPortal.Web.Global - 86.209.154.169-pl-PL - /blog.aspx
System.IndexOutOfRangeException: Index was outside the bounds of the array.
at mojoPortal.Web.UI.TagCloudControl.CreateChildControls(IEnumerable dataSource, Boolean dataBinding)
at System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data)
at System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data)
at System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback)
at System.Web.UI.WebControls.DataBoundControl.PerformSelect()
at System.Web.UI.WebControls.BaseDataBoundControl.DataBind()
at mojoPortal.Web.BlogUI.BlogCategories.BindCategories()
at mojoPortal.Web.BlogUI.BlogCategories.Page_Load(Object sender, EventArgs e)
at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

--------------

 

Przemek

8/18/2009 5:45:43 AM
Gravatar
Total Posts 18439

Re: Blog tag cloud bug?

I don't know. I can't produce this problem here using pgsql, just tried it. I add a blog make a post with a new category and then changed to use the tag cloud and it works.

The sql statement has the needed fields but the error sounds like it does not.

I recommend get a backup of your db and step through it locally and see if you can find the cause. 

Best,

Joe

8/18/2009 5:48:20 AM
Gravatar
Total Posts 37

Re: Blog tag cloud bug?

I will do that today and will post my results here.

 

Przemek

8/29/2009 5:26:27 AM
Gravatar
Total Posts 37

Re: Blog tag cloud bug?

So I was able to debug it. Sorry I did it so late but didn't have much time recently.

The problem seems that the itemWeight value is 10 and there are only 0 to 8 cssClasses so the expression  cssClasses[itemWeight - 1] is really cssClasses[9] so it doeasn't exist. :-/   

The exception details are below:

 -----------------------

System.IndexOutOfRangeException was unhandled by user code

Message="Index was outside the bounds of the array."

Source="mojoPortal.Web"

StackTrace:

at mojoPortal.Web.UI.TagCloudControl.CreateChildControls(IEnumerable dataSource, Boolean dataBinding) in C:\work\mojoPortal\Web\Controls\TagCloudControl.cs:line 326

at System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data)

at System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data)

at System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback)

at System.Web.UI.WebControls.DataBoundControl.PerformSelect()

at System.Web.UI.WebControls.BaseDataBoundControl.DataBind()

at mojoPortal.Web.BlogUI.BlogCategories.BindCategories()

at mojoPortal.Web.BlogUI.BlogCategories.Page_Load(Object sender, EventArgs e)

at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)

at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)

at System.Web.UI.Control.OnLoad(EventArgs e)

at System.Web.UI.Control.LoadRecursive()

at System.Web.UI.Control.LoadRecursive()

at System.Web.UI.Control.LoadRecursive()

at System.Web.UI.Control.LoadRecursive()

at System.Web.UI.Control.LoadRecursive()

at System.Web.UI.Control.LoadRecursive()

at System.Web.UI.Control.LoadRecursive()

at System.Web.UI.Control.LoadRecursive()

at System.Web.UI.Control.LoadRecursive()

at System.Web.UI.Control.LoadRecursive()

at System.Web.UI.Control.LoadRecursive()

at System.Web.UI.Control.LoadRecursive()

at System.Web.UI.Control.LoadRecursive()

at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

InnerException:

 -------------------

 

Best regards,

Przemek

8/29/2009 11:53:28 AM
Gravatar
Total Posts 18439

Re: Blog tag cloud bug?

Hi Przemek,

Thanks for debugging this. It should now be fixed in the new release and I will have it in svn trunk by tonight.

Best,

Joe

You must sign in to post in the forums. This thread is closed to new posts.