Quantcast
Channel: Sitecore basics!
Viewing all 178 articles
Browse latest View live

Exception while handling event Sitecore.Publishing.StartPublishingRemoteEvent

$
0
0

Challenge:

Last week, whenever we tried to publish anything in our local development environment, publishing was being shown as “Queued” and it was never publishing an item. When we had a look at log file, we found following error:

Heartbeat 10:25:07 ERROR Exception while handling event Sitecore.Publishing.StartPublishingRemoteEvent
Exception: System.NullReferenceException
Message: Object reference not set to an instance of an object.
Source: Sitecore.Kernel
at Sitecore.Publishing.PublishOptions.GetPublishingTargets()
at Sitecore.Publishing.PublishOptions..ctor(Database sourceDatabase, Database targetDatabase, PublishMode mode, Language
language, DateTime publishDate)
at Sitecore.Publishing.DistributedPublishingManager.DecodeOptions(DistributedPublishOptions options)
at Sitecore.Publishing.DistributedPublishingManager.GetOptions(DistributedPublishOptions[] options)
at Sitecore.Publishing.DistributedPublishingManager.StartPublishing(StartPublishingRemoteEvent event)
at Sitecore.Publishing.RemotePublishingEventHandler.OnStartPublishing(Object sender, EventArgs args)

You are also facing the same error? And struggling to find a solution! (So, as we did last week!). Then this post is for you only!

Solution:

Rather than sharing solution only, we would like to share full troubleshooting way with you.  So, during such challenges, you will be able to know what to check and what not to check during! :-) (Because, it takes lot of time to learn, what not to do. And once you learn that you can do anything!)

  1. By looking at error message “System.NullReferenceException ……. Sitecore.Publishing.PublishOptions.GetPublishingTargets()” you may quickly say that — Publishing targets items do not exist in Database. But my dear friend, we verified it for you and they do exist!
  2. When we disabled EventQueue then it worked fine! (Sorry, you are new to EventQueue, no worries — read my earlier post on EventQueue basics) So, something with EventQueue for sure and error message also says so!
  3. Tried same with Plain Sitecore (A good step to follow every time!) – and it was working fine with plain Sitecore. So, for sure something with our application only!
  4. Create a simple page, which published item programmatically and also tried to access publishing targets programmatically, the way it does in publish dialog and it worked!

Tried to had a word with our common friend — Google, and the thing which happens very less happened — Google said I don’t know! :-( (And that was the motivation behind writing this blog post!)

Then we thought to discus this challenge with our best friends in Sitecore planet — Sitecore support champs!. But as per Sitecore developer’s best practice, It’s always good to have a look at SDN forum (Where all Sitecore friends — discuss their challenges with each other and help them to get out of it! — It’s a great forum) and it turned to be our indeed friend! (Because, a friend in need is a friend in-deed!)

http://sdn.sitecore.net/Forum/ShowPost.aspx?postid=46582

Above link helped us to find a solution!

“Interesting, I wanted to try the security disabler test in isolation and it fixes the problem, so it seems there is something going on with security after all, the context user is default/Anonymous and looking at permissions… In this instance default/Anonymous has not been granted read access to the sitecore Item.

I’ve tested a few other instances and in those read access has been granted on the sitecore Item for default/Anonymous

I don’t know how that happened, I certainly did not edit permissions on the sitecore Item

Thanks for the suggestion Steve “

Basically the reason for this error is access rights only.

So, we had a look in our Database (Master) and found that rights for default\anonymous was removed for /sitecore item. We assigned it and it worked like a charm!

Happy Publishing! :-)


Filed under: EventQueue, Publishing, Security Tagged: Publishing, Sitecore

Sitecore7 Basics!

$
0
0

Challenge:

Hello my dear readers, your friend is back! So, you must be asking where you’ve been since so long? Oh yes, you got full rights to ask that! Was busy with social functions! (Yeah, I’m from India!) and after that was busy with getting introduced my self with Sitecore7! Oh yes, you heard right Sitecore7! You are eager to know my views on it? My experience? My learnings? Easy easy, will share with you! Because you know you (Yes, you!) are the motivation to keep my-self updated and make things simple for you! (as much as I can!) :-)

So, please fasten your seat belts!  We are going to have a quick ride in Sitecore7 world!

Solution:

First of all must say, great job to Sitecore7 team, the way they’ve created architecture is awesome, apart from that the way they are  releasing it, answering everyone’s questions, doing Google hangout sessions, blogging etc. is just out of this world! And have seen first time developers and engineers getting directly exposed to the world! — That makes true that Developers will rule the world! :-) Must appreciate these gesture from Sitecore guys!

Sitecore7 architecture and releasing way is going to be one more reason to love Sitecore! :)

My learning has been started since, I’ve attended Demo for Sitecore MVPs [Thanks to Pieter and Tim Ward - Product architect of Sitecore7] it was really nicely explained. Then have gone through few documents and oh yes, lot of blogs on Sitecore7 by Sitecore7 Dev Team at the same time, from Sitecore MVPs! (Dan Solvay – You made things a lot simpler for me, and I’m sure for others as well! — Thank you!) and last but not the least John west!

So, you must’ve read a lot about Sitecore7, and most of you must be knowing than what I know! What?, you’ve started working on Sitecore7? you lucky champ! So, why I’m adding one more blog for you to read on same subject?

Really, a good question! I’m going to cover up following basic things via this post:

  1. Last week, had a presentation on Sitecore7 — where covered Basics on Sitecore7 with only one purpose –”Basics things about Sitecore7, This presentation should cover basics of Sitecore7 and will be an appetizer for you to learn and explore Sitecore7 more!” — So, tried to make things easy for you, by making PPT more intuitive! — Yeah, sharing with you in a while!
  2. Lined up few blogs on Sitecore7 new concepts (Again going to touch only basics! — Because I believe that if that is clear, you can do miracles), and before doing that this base was necessary as this is going to be a starters for you and then will start serving the main course! :-) Feels hungry! ? :)

No more waiting, let me serve:

Sitecore7 is like Windows7 — One thing I must like to say. Sitecore7 is like Windows7. I’m talking about myself (might be happened with you as well!) I was happy user of Windows XP, then one of my friend told me that you should go and try Windows7, I had a look at it and thought no man. I’m familiar with XP and this looks totally new to me. So, was afraid to upgrade to Winodws7. But when I got my new laptop and tried Windows7, was amazed!, today I think that today Windows7 is the best OS, I’ve ever used!

Same happened with Sitecore7 as well, initially thought it looks complex! (Happening/Happened with you as well? I believe that it happens due to few reasons — Fear from Change and getting out of comfort zone). But when I started understanding, I started loving it! It’s smooth and promising! I believe that once you get acquainted with it, you will enjoy using it!

Sorry for sharing lot of theory with you, I know we developers, just want action no theory! Here you go!

You can have a quick look at presentation from above, and If you would like to download original PPT, you can get it from here!

Downloaded, had a look at it? Clicked on all links? as it got few hidden slides — which appears on link click only! Eager to know your feedback! Any suggestions? Any comments?

In summary, my views about Sitecore7:

  1. In our solution we don’t use Lucene at all. So, initial learning took bunch of efforts from my side to understand concepts more thoroughly. But once done that things looks awesome!
  2. To manage huge data — Bucket looks nice solution!
  3. Support for Lucene/Solr/ElasticSearch — makes searching huge data easier and scalable!
  4. LINQ API — Use what you want today, and don’t worry you can switch to another thing without touching your code! — Power of Abstraction!
  5. Search UI — makes your life easy, fast and efficient!
  6. Overall, It looks promising!

To learn more Sitecore7 Basics, stay tuned! More is yet to come for you!

Happy Sitecoring! :-)


Filed under: Architecture, Sitecore, Sitecore7 Tagged: Buckets, Sitecore, Sitecore7

How to get valid version of an item using DateTime?

$
0
0

Challenge:

Before couple of weeks back, we wanted to modify a functionality where we wanted a valid version of an Item based on given DateTime (Basically, wanted to modify behavior of Version Selector Page which exists via Preview mode of Page Editor)

While doing that one more question also came in to our mind, During preview mode — when we select any date from Date/Version selector dialog, how Sitecore comes to know that it should give which version numbered item — by analyzing it a bit we found that it has some co-relation with sc_date cookie key. But by looking at code, we were unable to identify it!

So, we tried a lot, and finally decided to discuss our case with Sitecore support guys, and as always they replied us with a proper solution! Sharing with you!

Solution:

To get a valid version of an item use following method:

<item-object>.Publishing.GetValidVersion(<date-time>, false); // second argument, false deals with workflow — which we haven’t enabled

This method returns Item object which represents the suitable version of item.

Just a note: In your DateTime object, seconds also matters for example: If you have Version2 created on 12/07/2013 01:31:20 PM and If you pass — 12/07/2013 01:31:00 PM — It will not give you version2, instead it will give version1. Had a discussion with Sitecore support champs as well on this, and they told that in production environment it will not be the case that versions will be getting created in duration of a seconds. And I believe in a way they are right. But if it is not case for you. You can have a word with them!

How Sitecore resolved item’s version using sc_date? [Sitecore support reply]

In a nutshell, using the same API: by calling GetValidVersion method.
For more details, please refer to the following code in Sitecore (you can check it via Reflector):
Sitecore.Sites.SiteContext.ProcessQueryString()
Sitecore.Caching.ItemCache.GetItem(string key)

Basically, the selected DisplayDate influences the item data (which version) that is being retrieved.
I described an example with ItemCache, so when the item is requested, for example, in preview mode, the DateRange will be verified.
If there is no appropriate version in ItemCache, it will be retrieved from other layers e.g. from database via GetItemCommand class logic from Sitecore.Nexus.
As far as I know, this class has a similar check of date range to return valid version.

Easy stuff right? Just one line, That’s the power of Sitecore!

Happy Sitecoring! :-)

PS : Special thanks to  Artem Fursenko(Sitecore Support) for providing this suggestion and Devashri who did all this investigation and worked on this challenge!


Filed under: Sitecore, Tips and Tricks Tagged: Programma, Tips and Tricks

Sitecore 7 Architecture Diagram

$
0
0

Challenge:

I hope you liked Sitecore7 Basics post? (You haven’t got a chance to look at it? No worries — You can do it now!), here we had a look at Basics of Sitecore7 and I do remember I promised that will be posting more stuff on Sitecore7, Apologize for delay. But was busy on Website performance stuff (Oh.. Performance ha, that’s great. So, you must’ve blogged something? Yes, I’ve and it’s going on – You can read two posts from here — ASP.NET Website Performance Basics and ASP.NET Website Performance Basics – Part 2) So, haven’t got chance to share Sitecore7 stuff with you. But I believe in “better late than never”! (So, as you?!)

In one of the slide of Sitecore7 Basics PPT, you must’ve seen Architecture diagram. Just wanted to write a post on it. Because If Architecture is clear in mind (And, that too pictorially!) then it would be really easy to get things going! [BTW, Have you seen my earlier Sitecore Architecture Diagram post?]

Solution:

SC7-Architecutre

Courtesy : Sitecore7 Development Team, from their Hangout session – Inside Sitecore 7

Three new components has been added, in Sitecore7. You can see them in left side of above given image:

  1. Content Search – Sitecore LINQ API, this is the new API added by Sitecore 7 Team, This is a bridge between you and your Search provider. For example today you are using Lucene/Solr and developed all your renderings using Sitecore LINQ API and all works fine! Happily Deployed as well! Now, one fine day your company decides to switch your search provider to ElasticSearch. Don’t worry, you can do it without doing any code change. That’s the power of Sitecore LINQ API. Also, it helps you to index your content and that too rapidly! Will share stats in upcoming posts!
  2. Item Buckets — I think you all know everything about Buckets? Not yet? Then would strongly recommend to get your hands on it, It’s a cool feature. Which removes 100 child items limit, And If you’ve heard Sitecore guys saying that “SC7 scales to virtually unlimited content volumes” — Then Item Buckets is a magic behind that! [Basically, using Buckets you can store millions of content items, It gets stored in an unstructured format]
  3. Search Index — It seats with your DB. So, rather than fetching data from DB, you can fetch it from your Index files! — Secret of Speed!

Simple? Indeed!

Just a note : Sitecore.ContentSearch and Sitecore.Buckets has 3200 methods, It means you got 3200 way to fetch/store your data

Links:

https://www.youtube.com/watch?feature=player_detailpage&v=MXuI8TYvT5Y#t=236

Happy Sitecoring! :-)


Filed under: Architecture, Sitecore, Sitecore7 Tagged: Architecture, Buckets, Sitecore7

Two ways to update your Sitecore Basics daily/weekly

$
0
0

Challenge:

Hello my dear readers, how are you? I’m sure you must be doing great!

I’m sure you must be enjoying using — Sitecore MVP RSS Feed

From couple of weeks, was thinking to share daily/weekly Sitecore updates with you! Why?

  • I’m sure you must be reading daily newspaper (Yes, I also do that!) to keep yourself synced with latest on going buzz around the world!  Even though we keep our self updated by news and online updates, we all like to glance through a newspaper once in a day (Especially, in the morning) to update our selves!
  • And same as with weekly magazine, where you subscribe for it with the hope that If you’ve missed something in your busy daily schedule, you can catchup via Weekly magazine!

Now, both of this things has only one purpose. All of us (Yes, Including me) would like to keep our selves synced with the latest happenings and increase our knowledge on what’s going on around us! OR our area of interest! (For example If you are a sports fan, you will invest more time in reading Sports updates rather than other updates.)

What If same way, you can do for Sitecore related updates? Sounds Interesting!? Keep reading…

Solution:

Did some research and found two nice websites (Obviously, with some efforts) we can do this! Oh is it? I’m sure you must have a lot of questions about how it will work and so on.. let’s take them one by one:

How this works? What will be the source of news?

Basically, there are two Sites, Which we will be using:

  1. Paper.lihttp://paper.li/ It helps us to configure our newspaper source from variety of sources like RSS Feed, Twitter, Facebook etc.  (Interested to read more on how paper.li works, click here?) And allows us to configure it for daily/weekly  — Currently it using following sources — Twitter (#Sitecore, @Sitecore,#SCBasicsDaily) Facebook (#Sitecore),RSS Feed (Sitecore/Sitecore MVP RSS Feed)
  2. TinyLetterhttp://tinyletter.com/ It helps us to send newsletter to list of subscribers

Following flow diagram, will explain you how this both websites, will help us to meet our target requirement:

sitecore_basics_daily_weekly_process

As someone said — A Picture is worth a thousand words! and So, right it is!

How Can I subscribe for daily/weekly update?

You can subscribe via following way:

  1. Daily update — You can view it from here — http://paper.li/kiranpatils/1378702752 and If you would like to get notified whenever new daily comes out, Just Subscribe from Subscribe button given in right side of a page!
  2. Weekly Update — You can view it from here – http://tinyletter.com/sitecorebasics  and If you would like to get notified whenever new weekly comes out, Just Enter your email address to subscribe. [Just a note : Promise, We will not Spam and not share with anyone!]

You want your Tweet to be in Sitecore Basics Daily Update?

If your Twit has been tagged with #Sitecore, @Sitecore then it will be in daily update. Also, for your ease we’ve added one more hash tag — #SCBasicsDaily

You Would like to volunteer for Sitecore Basics Weekly update?

As per above process, Daily update is automated. But weekly update needs human intervention because we need to filter out best/must read articles. You would like to help us in doing so? That will be  really great! Just drop us a comment here. We will contact you!

Got suggestion/feedback for us to do things more better? Feel free to drop us a comment.

In summary, we’ve three ways to keep our selves updates with Sitecore updates:

  1. Sitecore RSS Feed
  2. Sitecore Daily News Paper
  3. Sitecore Weekly Update

Happy Sitecoring! :-)


Filed under: Latest, Sitecore, Tips and Tricks Tagged: Sitecore

The type initializer for ‘Sitecore.Diagnostics.LoggerFactory’ threw an exception

$
0
0

Challenge:

My dear readers, How are you? Apologize for being away since so long. Was busy with few things [Yes, Yes, Whenever you find me busy. After that will have loads of learnings to share with you!]. And yes, you must’ve seen my earlier blog post on updating your Sitecore knowledge daily/weekly

Let’s start, Before few weeks back. We were migrating our Websites from .NET 2.0 App Pool to .NET 4.0, And while doing that we faced strange error on only one server, The error looks like following:

[NullReferenceException: Object reference not set to an instance of an object.]
Sitecore.Diagnostics.Log.Error(String message, Exception exception, Type ownerType) +133
Sitecore.Diagnostics.Log.Error(String message, Type ownerType) +45
Sitecore.Configuration.Factory.LoadAutoIncludeFiles(ConfigPatcher patcher, String folder) +680
Sitecore.Configuration.Factory.LoadAutoIncludeFiles(XmlNode element) +63
Sitecore.Configuration.Factory.GetConfiguration() +347
Sitecore.Diagnostics.LoggerFactory..cctor() +67

[TypeInitializationException: The type initializer for 'Sitecore.Diagnostics.LoggerFactory' threw an exception.]
Sitecore.Diagnostics.LoggerFactory.GetLogger(Type type) +17
Sitecore.Diagnostics.Log.Error(String message, Exception exception, Type ownerType) +93
Sitecore.Diagnostics.Log.Error(String message, Type ownerType) +45
   Sitecore.Configuration.Factory.LoadAutoIncludeFiles(ConfigPatcher patcher, String folder) +680
   Sitecore.Configuration.Factory.LoadAutoIncludeFiles(XmlNode element) +63
Sitecore.Configuration.Factory.GetConfiguration() +347
Sitecore.Configuration.Factory.GetConfigNode(String xpath, Boolean assert) +82
Sitecore.Configuration.Factory.GetConfigNode(String xpath) +29
Sitecore.Resources.Media.UploadWatcher.InitializeIgnoreList() +114
Sitecore.Resources.Media.UploadWatcher..cctor() +51

[TypeInitializationException: The type initializer for 'Sitecore.Resources.Media.UploadWatcher' threw an exception.]
Sitecore.Resources.Media.UploadWatcher..ctor() +0

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) +0
System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache) +98
System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache) +241
System.Activator.CreateInstance(Type type, Boolean nonPublic) +69
System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +1136
System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +111
System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture) +23
System.Web.HttpRuntime.CreateNonPublicInstance(Type type, Object[] args) +60
System.Web.HttpApplication.BuildIntegratedModuleCollection(List`1 moduleList) +231
System.Web.HttpApplication.GetModuleCollection(IntPtr appContext) +1365
Microsoft.Web.Infrastructure.DynamicModuleHelper.DynamicModuleReflectionUtil.GetIntegratedModuleCollection(HttpApplication target, IntPtr appContext) +33
Microsoft.Web.Infrastructure.DynamicModuleHelper.CriticalStatics.Init(HttpApplication context) +179
Microsoft.Web.Infrastructure.DynamicModuleHelper.IntegratedDynamicModule.Init(HttpApplication context) +6
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +517
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +194
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +339
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +253

[HttpException (0x80004005): Exception has been thrown by the target of an invocation.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9087676
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +97
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +256

We Investigated lot of time to figure out, Why this error? And this was coming up in start-up of Sitecore only.  What, You are also facing the same error? Searching for a solution? Then you are at the right post, We’ve a solution for you!

Solution:

After Investing 5+ hours, We finally found a solution. Here are the steps which we did:

  1. Did a quick search and found following links:
    1. http://stackoverflow.com/questions/9587257/tracking-nullreferenceexceptions-in-sitecore — Gone through initial post. But was not much helpful
    2. http://techblog.lbigroup.be/2012/08/13/nullreferenceexception-uploadwatcher/ — Was not for me, As it has something to do with SlowCheetah, Whichh we don’t use — Is it for you?
    3. http://maesitus-sitecore.blogspot.in/2011/06/copy-pasting-config-files-under.html — Suggests to play around with App Pool. Tried it. But with no luck :( — Even though you can give a go!
  2. Then we read error closely, and this line [ Sitecore.Configuration.Factory.LoadAutoIncludeFiles(XmlNode element)] gave us an idea to replace all our App_Config/Include folder from WORKING box to Not Working BOX. And it worked! Then we checked what was the issue in old files [Yeah, we backed up before replacing them!] and we found that one Config file was not well-formed!

Simple? Hope this helps!

Good reads!

http://www.sitecore.net/Community/Technical-Blogs/John-West-Sitecore-Blog/Posts/2011/05/All-About-Web-config-Include-Files-with-the-Sitecore-ASPNET-CMS.aspx

http://briancaos.wordpress.com/2010/09/23/sitecore-web-config-include-files-auto-include/

Happy Auto Including! :-)


Filed under: Sitecore, Tips and Tricks Tagged: Tips and Tricks

Error while Installing Package : An attempt was made to move the file pointer before the beginning of the file.

$
0
0

Challenge:

One fine morning, We copied a Package from our CM Environment, To reproduce one scenario in local. When we tried to install that package in local. We got following error:

Exception: System.Reflection.TargetInvocationException
Message: Exception has been thrown by the target of an invocation.
Source: mscorlib
at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Sitecore.Reflection.ReflectionUtil.InvokeMethod(MethodInfo method, Object[] parameters, Object obj)
at Sitecore.Web.UI.HtmlControls.Component.HandleMessage(Message message)
at Sitecore.Shell.Framework.Commands.ClientEventCommand.SendEventMessage()
at Sitecore.Shell.Framework.Commands.ClientEventCommand.Execute(CommandContext context)
at Sitecore.Web.UI.Sheer.ClientPage.RaiseEvent()
at Sitecore.Web.UI.Sheer.ClientPage.OnPreRender(EventArgs e)
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Nested Exception
Exception: System.IO.IOException
Message: An attempt was made to move the file pointer before the beginning of the file.
Source: mscorlib
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.SeekCore(Int64 offset, SeekOrigin origin)
   at System.IO.FileStream.Seek(Int64 offset, SeekOrigin origin)
   at Sitecore.Zip.ZipReader.<get_Entries>d__0.MoveNext()
   at Sitecore.Zip.ZipReader.GetEntry(String entryName)
   at Sitecore.Install.Zip.PackageReader.Populate(ISink`1 sink)
   at Sitecore.Shell.Applications.Install.Dialogs.InstallPackage.InstallPackageForm.LoadPackage()
   at Sitecore.Shell.Applications.Install.Dialogs.InstallPackage.InstallPackageForm.ActivePageChanging(String page, String& newpage)
   at Sitecore.Web.UI.Pages.WizardForm.set_Active(String value)
   at Sitecore.Web.UI.HtmlControls.Button.DoClick(Message message)

Same for you? Don’t worry, We know why it happens. Eager to know why? Keep reading..

Solution:

We tried to install the same package in Plain Sitecore, And the behavior was same. Then we looked at package’s size, Which is 3 GB, It made us to think for a while. We did a quick search. But nothing came up. Then finally, we thought to raise a Support Case. And as always they have a solution and reason for it!

We have registered the bug regarding the big packages and will inform you when it’s fixed. The maximum size of the package should not be greater than 2047 Mb (1.9 Gb). This value is restricted by maximum value of the System.Int32 type that used in the Sitecore.IO.Stream.Read() method.

Basically, The Max. Size of Package should not be 1.9 GB! (Which is a MaxValue of Int32 — 2,147,483,647 == 2 GB) So, while creating package make sure you do it in chunks!

Happy Packaging! :-)


Filed under: Sitecore, Tips and Tricks Tagged: Tips and Tricks

Sitecore Link Database Basics

$
0
0

Challenge:

We are facing one challenge with link database, The behavior is as following:

  1. At times our content authors reported that, few renderings stopped working. After doing investigation we found that they have deleted Items — which they have assigned to a page in fields. But when they recycled/delete item — they didn’t get any broken link pop up and they confidently deleted items.  But due to such behavior, they can’t say confidently whether there is any broken link [Whether current page is linked somewhere or not] and that decreased reliability of recycle/delete functionality.
  2. It decreases reliability of recycle/delete functionality, and takes the lot of human hours to find out, whether this page got any references or not
  3. No, at this point of time, we don’t have steps to reproduce this issue. We faced this issue for one section [bunch of items] on our CM Environment. To reproduce this scenario, what we did is created package from CM Environment and installed it in our local environment. And here it was working fine. Means links were perfect! [As far as I can think of a reason behind this is -- When we install package -- SC must be rebuilding link database]

You are also facing similar challenge?

We raised this issue with Sitecore support guys, And as always they have been helpful for us to dig more in this issue. We’ve not been able to find the solution yet. But during discussion we understood Links Database Basics and found few behaviors, Which has not been documented anywhere. And I believe It will be a good to know for you as well!

In summary, This post will cover following topics:

  1. Basics of Sitecore Links Database — How it works?
  2. Few tips and tricks related to links database.

So, here we go!

Solution:

This is what we checked during this whole ticket:

  1. Checked CustomFields configuration :When Sitecore updates links for the item, it’s expecting that field type is derived from Sitecore.Data.Fields.CustomField.
    Sitecore searches field type by name in the /App_Config/FieldTypes.config and try to cast this type to CustomField and use some methods from this class (links update logic). I would suggest the following solution for your issue:
    1. Add the following field type to FieldTypes.config:
    <fieldType name=”SiteSubtree” type=”Sitecore.Data.Fields.MultilistField,Sitecore.Kernel” />
    2. Rebuild Links database (it’s important!)
    This approach is working properly on my side. Please not that all your overriden SiteSubtree methods will be used in this  case, not the MultilistField ones.

    We verified it, And it was already as per standards in our case.

  2. Do Rebuild link database — Unfortunately this is also not an option for us, because our DB size is huge and rebuild link DB will take the lot of time, which will need an outage.
  3. So, If you can’t rebuild entire link database now, You can suggest you to use the following code to rebuild only necessary items which can be affected by this problem (where mentioned fields is used): Globals.LinkDatabase.UpdateReferences(item)
  4. We checked all above options. And nothing was fitting in our need. So, as per basics concept, We stepped back and asked SC Support guys “How Links Database works?“, and they explained it very nicely:
    1. Generally, links in Link Database are updated using Sitecore.Links.ItemEventHandler class. There are 3 events that are
      handled by Sitecore.Links.ItemEventHandler: item:deleted (OnItemDeleted method), item:saved (OnItemSaved method), item:versionRemoved (OnVersionRemoved method)
    2. When you delete an item, Broken Links validation is running before the item is deleted, it allows you to decide what you
      will do with broken links. This validation is run as a processor in the <uiDeleteItems> pipeline, please see the processor
      definition in your web.config: <processor mode=”on” type=”Sitecore.Shell.Framework.Pipelines.DeleteItems,Sitecore.Kernel” method=”CheckLinks” />
  5. Following are the few scenarios In which case such issue can occur:
    1. Using of the custom code that stop the link database from updating: Sitecore.Links.LinkDisabler(){….}
    2. Synchronizing of Link Database on your scaling environment has not been configured properly. You can read about this in the following article: http://sdn.sitecore.net/upload/sitecore6/64/scaling_guide_sc63-64-a4.pdf (Chapter 3.6.1)
    3. Following custom code can disable invoking of events : using (new Sitecore.Data.Events.EventDisabler()){…..}
    4. item.Editing.EndEdit(true, true) method. A new link won’t be added to the LinkDatabase if the corresponding multilist field (for example) will be updated in the ‘silent’ mode. And therefore the ‘Broken link’ dialog won’t work for this link.

We are still working on to find the root cause of this issue (Because of our Multisite environment) . But now, We know where to look at? And we know exactly what all are the possible options for such behavior. And I’m sure you will also find this information useful while troubleshooting such challenge.

I’m sure one day, We will find root cause and will share it with you for sure! And we expect same from you! :)

Happy Linking! :-)

PS : Special thanks to  Alexey Zhukov and Yuriy Yurkovsky(Sitecore Support) for providing this suggestion and Devashri who did all this investigation and worked on this challenge!


Filed under: Links, Sitecore, Tips and Tricks Tagged: Links, LinksDB, Tips and Tricks

Secure your page using Sitecore Login

$
0
0

Challenge:

Have you ever noticed? When you access Sitecore Admin Pages (If you are new to Sitecore Admin Pages, and not aware about it. I would strongly recommend you this post, these tools are real life savior : http://firebreaksice.com/sitecore-admin-pages-explained/) it asks your for Sitecore Login, as shown below (Just a note : as far as I can recall, this validation started after 6.X version only! Happy to be corrected! For earlier versions you need to block them using different methods OR even though it exists, would strongly recommend you to use this post – http://sitecoreblog.alexshyba.com/2010/10/securing-sitecore-admin.html)

Sitecore-Admin-Login

Now, let’s say you are developing one page, And you need to make sure that it gets accessed by Authenticated users only. How to do that? You are also wondering to do the same? Eager to know? Then this post is for you only!

Solution:

As always, Had a word with my best friend – Google [What? Yours as well? Now, We've a common friend! :) ] and it suggested following post:

http://learnsitecore.cmsuniverse.net/en/Blog/SecurePage-in-sitecore-apps.aspx

This of course may be a security issue and you should ensure you require your users to login to the shell site, before they can run the application. Sitecore enables you to do this quite easy as you can just make your page inherit from Sitecore.Shell.Web.UI.SecurePage. If you do this, Sitecore will automatically redirect the user to the login page of the current site, if they are not all ready logged in. Easy-peasy-lemon-squeezy!

I gave a try it in my development box, and it worked! I was presented with a Sitecore Login Page.

public partial class SCBasicsSecurePage : Sitecore.Shell.Web.UI.SecurePage
{
 //Secure Code
}

What, you also tried and it works? Till this point of time, Everything looks easy and straight forward?

But, here is a twist [Life is not as easy as it seems to be! :) ], After login it was redirecting me to “dbbrowser.aspx” and NOT “SCBasicsSecurePage.aspx”? Which is what I expected it to be! And so as you?! Correct?

Then stepped back, and checked Sitecore’s Cache.aspx page’s behavior and was amazed to see, It works the way you and I expected, means after login it redirects to requested page in our case it’s Cache.aspx. Just noticed one difference, In earlier case URL was not containing any returnurl key. But in Sitecore’s admin page cache it was! It gave me hint!

And then it was time to talk to another best friend, Reflector [Oh, Yours as well, See we've second common friend! :) ] and it revealed the truth! Sitecore Admin pages inherits them self from Sitecore.sitecore.admin.AdminPage and NOT Sitecore.Shell.Web.UI.SecurePage. And AdminPage has been coded to handle returnurl logic! Where it redirects on Original URL after login!

So, here are the quick steps for you:

1. Inherit your page from Sitecore.sitecore.admin.AdminPage:

public partial class SCBasicsSecurePage : Sitecore.sitecore.admin.AdminPage
{
 //Secure Code
}

2. Override OnInit method of a page:

protected override void OnInit(EventArgs e)
{
base.CheckSecurity(true); //Required!
base.OnInit(e);
}

3. That’s it! Enjoy!

Happy Sitecoring! :-)


Filed under: Programming, Sitecore, Tips and Tricks Tagged: Admin, Sitecore, Tips and Tricks

Package History User Guide

$
0
0

Challenge:

One fine morning, was exploring Core Database and while doing so, found a hidden gem, Package Installation History at /sitecore/system/Packages/Installation history. It lists all installed packages, Which means that whenever you install any package in your Sitecore environment. It will register the details here.

Then was able to map this with my old question, “Can we find out Which Sitecore Package got installed? On Which Date? Who sent the package? Who Installed it?” Do you remember “Programs and features” list in windows? You have same questions? Then this module is for you!

Solution:

Main Features

  • List of all Installed Packages
  • Answers following questions:
    • Who created package?
    • Who Installed it?
    • When it got installed?
  • You can do search, pagination, and sorting!

How to Download and Install?

  • If you would like to do it manually you can download zip package from MarketPlace [http://marketplace.sitecore.net/en/Modules/PackageHistory.aspx]
  • It contains one folder named as “packageshistory” which contains .aspx page with name as PackageHistory.aspx.
  • You can copy this folder and paste it in your Webroot\Sitecore\admin folder. [Just a note : you can deploy it on any directory you wish to. But better to put under admin folder as it is secure folder, and as this page is using Single file model. It won't restart/recycle your application.].
  • Access your page using  http:///sitecore/admin/packageshistory/packagehistory.aspx
  • Would like to download source code? You can download via GITHUB Page — http://klpatil.github.io/PackageHistory/
  • That’s it! Enjoy! :-)

Just a note : PackageHistory page has been coded using CodeFile model for ease of development and deployment. So, In case, If you would like to do any change directly after deployment, feel free to do it!

OR

You can download Sitecore Package from MarketPlace. Which will do everything for you!

Screen shots

  • This is how it looks like! Quite simple! — You can do searching/sorting/paging!

Sitecore Package History

How it works?

This tool provides lists package details on following logic:

  1. Lists all items from Core Database, under “/sitecore/system/Packages/Installation history” which has template type as “/sitecore/templates/System/Packages/Package registration”
  2. For Search, Sorting and Pagination DataTables.NET Jquery plugin has been used — http://www.datatables.net/
  3. For UI Bootstrap has been used — http://getbootstrap.com/

I would like to hear from you

Found any bug? Got suggestion/feedback/comment, please do share via GitHub Page.

Happy Package Installation Exploring! :-)


Filed under: Shared Source Module, Sitecore Tagged: marketplace, package history

Template item {ID} not found for item /PATH/PATH

$
0
0

Challenge:

Before couple of weeks back, on our Publishing Instance (PI) we faced a strange issue. Whenever anyone published anything from our CM server via PI Server it was publishing item. But the tokens were as is for example $name. So, the live functionality stopped working.

After checking PI Logs we found following errors:

Template item {24C19083-4E4B-4F18-B4D8-4685B6B74CF3} not found for item /sitecore/content/Home/Test

We saw above error message for the first time. So, as you? After, that we tried to find any exceptions from log file. We found following. But they were after our schedule application pool recycle.

ManagedPoolThread #96 05:07:46 ERROR Failed to load item data
Exception: System.Exception
Message: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
Source: Sitecore.Kernel
   at Sitecore.Data.DataProviders.Sql.DataProviderCommand.ExecuteReader()
   at Sitecore.Data.DataProviders.Sql.SqlDataApi.CreateReader(String sql, Object[] parameters)
   at Sitecore.Data.SqlServer.SqlServerDataProvider.LoadItemDefinitions(String condition, Object[] parameters, SafeDictionary`2 prefetchData)

Nested Exception

Exception: System.Data.DataException
Message: Error executing SQL command: SELECT [ItemId], [Order], [Version], [Language], [Name], [Value], [FieldId], [MasterID], [ParentID]
                     FROM (
                        SELECT [Id] as [ItemId], 0 as [Order], 0 as [Version], ” as [Language], [Name], ” as [Value], [TemplateID] as [FieldId], [MasterID], [ParentID]
                        FROM [Items]

                        UNION ALL                         
                        SELECT [ParentId] as [ItemId], 1 as [Order], 0 as [Version], ” as [Language], NULL as [Name], ”, NULL, NULL, [Id]
                        FROM [Items]

                        UNION ALL
                        SELECT [ItemId], 2 as [Order], 0 AS [Version], ” as [Language], NULL as [Name], [Value], [FieldId], NULL, NULL
                        FROM [SharedFields]

                        UNION ALL
                        SELECT [ItemId], 2 as [Order], 0 AS [Version],       [Language], NULL as [Name], [Value], [FieldId], NULL, NULL
                        FROM [UnversionedFields]

                        UNION ALL
                        SELECT [ItemId], 2 as [Order],      [Version],       [Language], NULL as [Name], [Value], [FieldId], NULL, NULL
                        FROM [VersionedFields]
                     ) as temp  WHERE [ItemId] IN (SELECT [ID] FROM [Items] WITH (nolock)  WHERE [ID] = @itemId)
                     ORDER BY [ItemId], [Order] ASC, [Language] DESC, [Version] DESC

Nested Exception

Exception: System.Data.SqlClient.SqlException
Message: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
Source: .Net SqlClient Data Provider
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
   at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
   at System.Data.SqlClient.SqlDataReader.get_MetaData()
   at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
   at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
   at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
   at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader()
   at Sitecore.Data.DataProviders.Sql.DataProviderCommand.ExecuteReader()

ManagedPoolThread #96 05:07:47 ERROR Failed to sort items
Exception: System.Exception
Message: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
Source: Sitecore.Kernel
   at Sitecore.Data.DataProviders.Sql.DataProviderCommand.ExecuteReader()
   at Sitecore.Data.DataProviders.Sql.SqlDataApi.CreateReader(String sql, Object[] parameters)
   at Sitecore.Data.SqlServer.SqlServerDataProvider.LoadItemDefinitions(String condition, Object[] parameters, SafeDictionary`2 prefetchData)
   at Sitecore.Data.DataProviders.Sql.SqlDataProvider.PrefetchItems(String itemCondition, String fieldCondition, String childCondition, Object[] parameters)
   at Sitecore.Data.DataProviders.Sql.SqlDataProvider.PrefetchItem(ID itemId)
   at Sitecore.Data.DataProviders.Sql.SqlDataProvider.GetPrefetchData(ID itemId)
   at Sitecore.Data.DataProviders.Sql.SqlDataProvider.GetItemDefinition(ID itemId, CallContext context)
   at Sitecore.Data.DataProviders.DataProvider.GetItemDefinition(ID itemID, CallContext context, DataProviderCollection providers)
   at Sitecore.Data.DataSource.GetItemInformation(ID itemID)
   at Sitecore.Data.DataSource.GetItemDefinition(ID itemID)
   at Sitecore.Data.Engines.TemplateEngine.AddSection(ItemDefinition item, Builder template)
   at Sitecore.Data.Engines.TemplateEngine.BuildTemplate(ItemDefinition itemDefinition)
   at Sitecore.Data.Engines.TemplateEngine.AddItemBasedTemplates(TemplateDictionary result)
   at Sitecore.Data.Engines.TemplateEngine.InternalGetTemplates()
   at Sitecore.Data.Engines.TemplateEngine.GetTemplate(ID templateId)
   at Sitecore.Data.Managers.TemplateProvider.GetTemplateField(ID fieldId, Item item)
   at Sitecore.Data.Fields.Field.GetTemplateField()
   at Sitecore.Data.Fields.Field.GetSourceItem()
   at Sitecore.Data.Fields.Field.GetInheritedValue()
   at Sitecore.Data.Fields.Field.GetValue(Boolean allowStandardValue, Boolean allowDefaultValue)
   at Sitecore.Data.Comparers.ComparerFactory.GetComparer(Item item)
   at Sitecore.Data.Managers.ItemProvider.Sort(ItemList items, Item owner)

Nested Exception

Exception: System.Data.DataException
Message: Error executing SQL command: SELECT [ItemId], [Order], [Version], [Language], [Name], [Value], [FieldId], [MasterID], [ParentID]
                     FROM (
                        SELECT [Id] as [ItemId], 0 as [Order], 0 as [Version], ” as [Language], [Name], ” as [Value], [TemplateID] as [FieldId], [MasterID], [ParentID]
                        FROM [Items]

                        UNION ALL                         
                        SELECT [ParentId] as [ItemId], 1 as [Order], 0 as [Version], ” as [Language], NULL as [Name], ”, NULL, NULL, [Id]
                        FROM [Items]

                        UNION ALL
                        SELECT [ItemId], 2 as [Order], 0 AS [Version], ” as [Language], NULL as [Name], [Value], [FieldId], NULL, NULL
                        FROM [SharedFields]

                        UNION ALL
                        SELECT [ItemId], 2 as [Order], 0 AS [Version],       [Language], NULL as [Name], [Value], [FieldId], NULL, NULL
                        FROM [UnversionedFields]

                        UNION ALL
                        SELECT [ItemId], 2 as [Order],      [Version],       [Language], NULL as [Name], [Value], [FieldId], NULL, NULL
                        FROM [VersionedFields]
                     ) as temp  WHERE [ItemId] IN (SELECT [ID] FROM [Items] WITH (nolock)  WHERE [ID] = @itemId)
                     ORDER BY [ItemId], [Order] ASC, [Language] DESC, [Version] DESC

Nested Exception

Exception: System.Data.SqlClient.SqlException
Message: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
Source: .Net SqlClient Data Provider
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
   at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
   at System.Data.SqlClient.SqlDataReader.get_MetaData()
   at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
   at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
   at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
   at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader()
   at Sitecore.Data.DataProviders.Sql.DataProviderCommand.ExecuteReader()

Totally new exception stacktrace. And we were not sure why they were in the logs? But by looking at StackTrace one thing we were sure, It is something to do with pref-etch cache building. And it had some co-relation with our issue. Which we fixed! Eager to know How? Would like to know the root cause? Would like to know the permanent solution? Easy, Easy we are going to share with you. Just keep reading!

Solution:

It was live issue, and to resolve it we tried following things:

  1. Cleared — items cache, data cache, SQL prefetch cache, and lot of cache for Master/web database etc – No luck yet :( [To clear partial cache, We used Caching Manager -- http://marketplace.sitecore.net/en/Modules/Caching_Manager.aspx and our in-house tool. Also, this looked promising. But haven't tried it during our investigation -- http://marketplace.sitecore.net/en/Modules/Sitecore_Cache_Admin.aspx]
  2. Cleared full Cache — Using Cache.aspx — But no luck again :(
  3. We restarted our PI Application — App Pool Recycle and it worked! :-)

So, after application pool recycle, Everything started working as it should be! All happy! But not we, and not you as well — Correct?. Because to fix any issue and make sure it doesn’t pops up again you should always try to understand root cause. And then try to find a permanent fix for it. Matches with your thinking? See, we got same thinking! :-)

And guess what we did? Yes, you are right. We raised a Sitecore support case with our config files and log files. At the first instance they replied as follows:

Please try to increase the <setting name=”DefaultSQLTimeout” value=”00:05:00″ /> setting.

Then we checked our configuration settings, and we replied as below:

On our PI Server timeout is 50 Minutes.

<setting name=”DefaultSQLTimeout” value=”00:50:00″/>
<setting name=”DataProviderTimeout” value=”00:50:00″/>

And as we discussed earlier, It doesn’t seems to be a caching issue. Because we cleared full cache already and it didn’t work. And we think that Sitecore is storing Template information somewhere else and not in Caching layers.

And here comes the Sitecore reply, With as always through investigation and explanation:

I’ve investigated the scenario you provided me with and found that indeed SQL exception during templates initialization may break some part of Sitecore items until you recycle the AppPool. I’ve already registered this as a bug for current version of CMS and will inform you when it’s fixed.

Please note that Sitecore is affected by this issue only if exception is thrown during the templates initialization, which happens during the first request to the database items. The possibility of such event is low, but the issue still may happen.

Unfortunately, I don’t see easy ways how to fix the issue, so I cannot provide you with code based workaround. If the issue happened on your solution, you may call the database.Engines.TemplateEngine.Reset() method for each database object (it shouldn’t throw the NRE. If the exception is thrown, please check which property is null and let me know) to reload templates.

The templates subsystem uses its own internal caches in order to increase the performance and more effectively manage entities lifetime. That caches are managed by the TemplateEngine (which belongs to the database) and doesn’t interact with Sitecore Cache subsystem (I mean the Sitecore.Caching.CacheManager class and related ones).
Given that cache clearing doesn’t lead to the templates invalidation. We should explicitly call the database.Engines.TemplateEngine.Reset() method to reset the storage and initiate its entire reloading.

Basically, It has been reported as a BUG and it’s fix is not easy. But as an alternative way you can explicitly Invalidate templates by calling — database.Engines.TemplateEngine.Reset() method!

To be honest, We haven’t seen this error again. And haven’t tried this workaround. But Sitecore support guys reproduced the issue and tried this approach and it works! It worked for you and helped you to fix the live issue? If so, please share your experience with us!

In summary,

  1. Always understand root cause of any issue
  2. Try to understand the challenge and share your findings with Sitecore support guys as much as you can
  3. And Sitecore support guys rock, as always!
  4. Sitecore template has its own internal caches in order to increase the performance and more effectively mange entities lifetime. That cache are managed by the TemplateEngine!

Happy Sitecoring! :-)


Filed under: Publishing, Sitecore, Tips and Tricks Tagged: Performance, Publishing, Sitecore Bugs

Do you really need MediaRequestSessionModule? If no, then disable it for better performance!

$
0
0

Challenge:

Before few months back, We were working on performance challenges of our CM Server. And while investigating that we noticed that New Relic (If you are new to New Relic, then just for your information – it is an Application Performance Management Tool and it is your best friend while working on performance challenges) was showing spike in “MediaRequestSessionModule”

To be honest, We were not sure what this module does and is it really required or not?

Oh yes, we raised a support case and that discussion helped us to understand more about this module. Which we think is a worth share with you as well!

Here we go!

Solution:

First we tried to dig in to this issue. But after some point of time. We raised a Sitecore support case. And thanks to Paul Kravchenko for helping us to diagnose such issue.

Here’s a reply:

The  Sitecore.Resources.Media.MediaRequestSessionModule.ContextPostMapRequestHandler() method is just a handler for the standard ASP.NET HttpApplication.PostMapRequestHandler event, please read about it in the following article:
http://msdn.microsoft.com/en-us/library/system.web.httpapplication.postmaprequesthandler.aspx

The “Sitecore.Resources.Media.MediaRequestSessionModule” module was introduced in Sitecore CMS 6.3.0 rev. 100716, please refer to number 328238 in CMS release notes:
http://sdn.sitecore.net/Products/Sitecore%20V5/Sitecore%20CMS%206/ReleaseNotes/ChangeLog.aspx
To ensure that session state is still loaded for media requests when the media item has OMS tracking information, a new Sitecore.Resources.Media.MediaRequestSessionModule has been added to the web.config. (328238)

The matter is that the Sitecore.Resources.Media.MediaRequestSessionModule.ContextPostMapRequestHandler() method parses media request and gets corresponding item from database. This may be the reason of such high time consumption. Actually if you do not use SItecore Analytics you can safely comment out this module.

In summary, Sitecore.Resources.Media.MediaRequestSessionModule module parsed media request and gets corresponding item from database. Which has been introduced in Sitecore CMS 6.3.0 rev. 100716. To ensure that session state is still loaded for media requests when the media item has OMS tracking information. Now, If you do not use Sitecore Analytics you can safely comment out this module!

Just a note : We don’t have any stats which says with/without MediaRequestSessionModule how much % performance gain we get. But when you are working on highly scalable website, On which low response time is expected. You always try to save each drop. And as you know little drop makes a mighty ocean! As we don’t use OMS. So, it makes sense for us to disable it. As Steve jobs taught us let’s be free from clutter, as much as we can!

Happy Sitecoring! :-)


Filed under: Architecture, Performance, Publishing, Security, Sitecore Tagged: Caching, Performance

Your SitecoreBasics Wins Sitecore MVP 2014 Award

$
0
0

I’m sure you will be very pleased to know that, your very own SitecoreBasics blog author has been announced as Sitecore MVP for 2014. Continuously second year! (Maintaining success takes more efforts than achieving it) Cordially thanks to you! (Yes, you!) for inspiring me by your comments, visits, and reads on SitecoreBasics blog! Also, thanks to Sitecore development team who developed such a nice environment to work on, Sitecore support team members who are always there to answer our questions in tough time and sharing their technical expertise with us! Thank you Sitecore!

MVP 2014 -Technology_large

After getting listed in Sitecore MVP 2013 list, the feeling was awesome and thought to push my self more to share more in 2014 and target to achieve Sitecore MVP Award 2014. It really feels great to be a part of such an elite group!

You are new to the Sitecore World/Would like to know more about Sitecore MVP Award and have following questions?:

  • What’s the Sitecore MVP award all about?
  • What’s the process?
  • How to get nominated?
  • What’s the selection process?
  • What are the benefits?

I had same questions and have already written detailed post on it. I would suggest you to give it a read here

So, a question might come to your mind. What all you’ve contributed in 2014. And it is really a good question.  Here it is:

  1. Blog: Writing regular posts on my Sitecore blog at : http://sitecorebasics.wordpress.com/ [It got 107 Posts, 31 Categories, 53 Tags, 79,405 Page Views, Average 100 Visits per day, 203 Comments, 31 Categories, 53 Tags].
  2. Forums: Active at SDN forums: http://sdn.sitecore.net/forum//user/Profile.aspx?UserID=6906 [Total 431 Posts, Post Rank 1, Top 10 Posts]
  3. Shared source modules/Sitecore Marketplace: Contributed three modules:
    1. Package Historyhttp://marketplace.sitecore.net/en/Modules/PackageHistory.aspx
  4. Other activities : Started new initiatives to share Daily and Weekly Sitecore updates with Sitecore enthusiasts (More on these initiatives has been posted here — http://sitecorebasics.wordpress.com/2013/09/16/two-ways-to-update-your-sitecore-basics-dailyweekly/):
    1. Sitecore Daily Paper : http://paper.li/kiranpatils/1378702752 — Daily update on Sitecore, Generating paper using following sources — Twitter (#Sitecore, @Sitecore,#SCBasicsDaily) Facebook (#Sitecore),RSS Feed (Sitecore/Sitecore MVP RSS Feed)
    2. Sitecore Weekly Newsletter : http://tinyletter.com/sitecorebasics  — Weekly newsletter on Sitecorebasics combined from same source as paper.li. But shortlisted must read an article gets delivered to reader’s e-mail box. Currently it has 43 subscribers till this point of time!
  5. Whitepapers and Documents : Here are few of them
    1. http://sitecorebasics.wordpress.com/2013/02/06/transfer-tool-media-transfer-bug/Comic blog post!
    2. Blog post on Sitecore7 Basicshttp://sitecorebasics.wordpress.com/2013/06/18/sitecore7-basics/ and PPT which explains Sitecore7 Basics http://www.scribd.com/doc/148368817/Sitecore7-Basics  [Total Views 154, Total Embed Views  1126 views]
    3. http://sitecorebasics.wordpress.com/2013/04/04/sitecore-mvps-blog-feed-and-twitter-list-along-with-a-combined-rss-feed-from-sitecore-mvps-blog-feeds/  Created Sitecore MVPs combined Yahoo Feedhttp://pipes.yahoo.com/pipes/pipe.run?_id=a4854adf0c2c2518e526facaac8ab8c2&_render=rss  at the same time created Sitecore MVP’s Blog, RSS Feed and Twitter handle’s list https://docs.google.com/spreadsheet/pub?key=0AuSZJtbDBPCQdFZKaUIxZkhxZlFndk11c1NUZU84YkE&output=html
    4. Guide on Sitecore Troubleshooting Path — This guide will help you to troubleshoot Sitecore challenges which you may face. e.g. CM/CD/PI is slow, CM/CD/PI is crashed, CM/CD/PI is slow etc. : http://sitecorebasics.wordpress.com/2013/03/27/sitecore-troubleshooting-path/  [Total Views 177, Total Embed Views  1947 views]
    5. http://sitecorebasics.wordpress.com/2013/02/13/basics-of-sitecore-mvp-award/ – Written an article which explains the whole process to achieve Sitecore MVP award.

As we all know, nothing big can be achieved by a single person. There are a lot of others involved to make things happen. And same holds true in my case as well. This award would have been impossible without lot of people’s support and wishes! Would like to cordially thanks to each one of them!

Hope to see you in next year’s Sitecore MVP list! (Eager to know how to be Sitecore MVP, give this post a read here. It explains the Basics of Sitecore MVP Award). Still have questions? Feel free to drop me a line! Will be happy to help you to be a Sitecore MVP 2015! :-) (Because God helps them, who helps others!)

Wish you luck! Still then Keep reading, Keep learning, Keep sharing! (Because Knowledge shared with others is not CUT-PASTE, It is always COPY-PASTE)

Happy Coding! :-)

Reference

  1. http://www.sitecore.net/Community/Best-Practice-Blogs/Pieter-Brinkman/Posts/2014/01/Sitecore-MVP-2014.aspx
  2. http://www.sitecore.net/Company/News/Press-releases/2014/01/2014-Sitecore-MVP.aspx

Filed under: Milestones, Sitecore Tagged: Milestone, Milestones, Sitecore

Package History V2 User Guide

$
0
0

Challenge:

Howdy, Folks? Have you ever had following questions/suggestions?

  • How nice it would be, If you can uninstall, Installed Sitecore Module/Package just by a click?
  • Is there any way to uninstall Sitecore Package automatically?

If you’ve ever came across  these questions and gave a quick search. Few of the following links might have appeared before you:

It means till this point of time. There is no any way using which you can uninstall Sitecore Package automatically. Yes, Manual way exists! But one of our teacher taught us “Whatever you can do manually, You can do it automatically!”. So, If you are looking for a way to uninstall Sitecore package/module just by a click (Do you remember “Uninstall” feature in windows?) then this module is for you!

Solution:

To make an idea a reality. I started exploring Sitecore Package and interestingly found that “package.zip” file for each module’s zip contains “project” file which is XML file and resides under installer folder. That file is the Core of this whole module!

After that rather than creating new module. I thought why NOT integrate it with my another module — Package History which is already live on MarketPlace. Have you tried it? Excerpt from module description “It will list all packages installed in your Sitecore Instance. It will also help you to answer questions related to packages installation like Who created package?, Who Installed it?, When it got installed?”

So, Integrating it in Package History sounded a good idea. As it will be a launch pad for Uninstall Package Module. So, this is how Package History V2 came in to this world!

Main Features

  • You can uninstall your installed package/module (Using original Package file)
  • Install/Try as many modules you would like to from Sitecore MarketPlace OR from another Sitecore enthusiast!
  • View package details in a tabular format

How to Download and Install?

  • If you would like to do it manually you can download zip package from MarketPlace [http://marketplace.sitecore.net/en/Modules/PackageHistory.aspx -- PackageHistory_Version_2.0.0.0.zip]
  • It contains one folder named as “packageshistory” which contains .aspx page with name as PackageHistory.aspx.
  • You can copy this folder and paste it in your Webroot\Sitecore\admin folder. [Just a note : you can deploy it on any directory you wish to. But better to put under admin folder as it is secure folder, and as this page is using Single file model. It won't restart/recycle your application.].
  • Access your page using  http://[HOSTNAME]/sitecore/admin/packageshistory/packagehistory.aspx
  • And click on “Uninstall (BETA)” Button from here
  • Which in turn calls “UninstallPackage.aspx” page
  • Would like to download source code? You can download via GITHUB Page – http://klpatil.github.io/PackageHistory/
  • That’s it! Enjoy! :-)

Just a note : PackageHistory module has been coded using CodeFile model for ease of development and deployment. So, In case, If you would like to do any change directly after deployment, feel free to do it!

OR

You can download Sitecore Package from MarketPlace. Which will do everything for you!

Screen shots

  • This is how it looks like! (For a larger view, please click on the image)

Uninstall-Package-Final-Take-2

How it works?

This tool provides lists package details on following logic:

  1. Basically, Once you click on “Uninstall (BETA)” button it calls “UninstallPackage.aspx”
  2. Here you need to provide your PackageName, Using which you installed selected package. (In case, if your package doesn’t exist at Packages folder. Please do upload it manually). Don’t worry it does all validations! So, try it and learn it!
  3. After that when you click on “View Details” we extract package information and display it in a TABLE
  4. You can verify your ITEMS and FILES.
  5. When you are ready, and you click on “Uninstall” we iterate through all TABLE rows and fetch each item from respective database and RECYCLE it. (So, in case if something goes wrong, you can restore it back!)
  6. Please note, This tool will not delete files, due to ASP.NET recycle issue for sensitive files (Highlighted in RED). You’ve to delete them manually

Good to know/Caveats:

  1. Launched this module in BETA stage. Because uninstall package is sensitive stuff. And I’ve tested it from my end as much as I can. But no one is perfect in this world and same holds true for me! So, If you are going to use it on your production server. I would suggest you to take your database backup first!
  2. As stated earlier, Everything goes in to RecycleBin. So, In case if something goes wrong. Try to use this remedy!
  3. We are not touching any files at all, in this version due to ASP.NET automatic recycle behavior for sensitive files — Good read – http://kiranpatils.wordpress.com/2010/05/25/goo-to-know-on-asp-net-application-restarts/
  4. Haven’t done anything special for item versions
  5. If your original package has overwritten some item/files during installation. Then this functionality will not try to get its last version. But it will recycle it!
  6. Needless to say, Everything gets logged in to Sitecore log files (AUDIT entries for uninstall operation. So, you can check from log file that who uninstalled your module?)

I would like to hear from you

Found any bug? Got suggestion/feedback/comment, please do share via GitHub Page.

Happy Package Uninstalling! :-)


Filed under: Shared Source Module, Sitecore, Tools Tagged: marketplace, uninstall package

Adding a language specific file to the Sitecore Media Library programmatically

$
0
0

Challenge:

Before few weeks back, was working on a task where we needed to add media file programmatically and that too language specific.

You may ask why we need to do so. Really a good question, Here’s the answer for the same: Let’s say for an example you have a product, and each product will have a USER Guide and user guide may exist in each language. So, rather than creating different media item for each language specific user guide, we wanted to have only one media item and language specific different file.

Solution:

Adding media file programmatically is pretty much straight forward task with Sitecore API, and following are the best resources on the web which helps us to do so:

But to add language specific media item programmatically, We haven’t found anything already written on the web. After that we did a bit of a research and invested good amount of time to make it happen. And thought to share with you with the hope that you no need to invest same time again.

To make it happen tried following approach first while creating file programmatically:

// Do not make a versioned template
options.Versioned = true;
// Language added
options.Language = language; // Language Instance gets passed to us

To test it, we iterate the loop twice, Where in first Iteration we create media item in en language and in second iteration we create media item in another language. Let’s say es-ES. But the later iteration overrides the first version. We also tried with options.KeepExisting = true; But with no luck :-(

Good to read : http://learningsitecorecms.blogspot.in/2013/09/sitecore-media-item-created-in-multiple.html

Then did a quick search on Google and SDN. But unfortunately couldn’t find anything which instructs us to do so. But at the same time found this nice article [Login Required] : http://sdn.sitecore.net/snippets/item%20handling/media%20library/updating%20image%20file%20on%20a%20media%20library%20item%20programmatically.aspx 

And changed code like this:


MediaItem mediaItem = (MediaItem)database.GetItem(options.Destination, <strong>language</strong>);

if (mediaItem == null)
{
// Now create the file in Sitecore. Using Static options
mediaItem = Sitecore.Resources.Media.MediaManager.Creator.CreateFromStream(memoryStream, fileName, options);
}
else
{

Sitecore.Resources.Media.Media media = MediaManager.GetMedia(mediaItem);
media.SetStream(memoryStream, ".pdf"); // Hard coded for simplicity
}

Here we are checking that if Media Item already exist then add language specific media version. And it worked!

Full Code:


/// <summary>
/// This method will be used to add file in
/// Sitecore Media Library folder
/// </summary>
/// <param name="fileName">Full Name of file</param>
/// <param name="sitecorePath">Sitecore Path</param>
///mediaItemName">Name of media item
/// <returns>Newly created media item</returns>
public static Item AddFile(string fileName, string sitecorePath, string mediaItemName, Stream responseStream, Database database, Sitecore.Globalization.Language language)
{
// Create the options
Sitecore.Resources.Media.MediaCreatorOptions options = new Sitecore.Resources.Media.MediaCreatorOptions();
// Store the file in the database, not as a file
options.FileBased = false;
// Remove file extension from item name
options.IncludeExtensionInItemName = false;
// Overwrite any existing file with the same name
//options.KeepExisting = false;
// Do not make a versioned template
// Set it as per your need - if you are going to use same method
// Make it parametrized
options.Versioned = true;

// Language added
options.Language = language;

// set the path
options.Destination = sitecorePath + "/" + mediaItemName;

// Set the database
options.Database = database;

// Now create the file
//Sitecore.Resources.Media.MediaCreator creator = new Sitecore.Resources.Media.MediaCreator();
//MediaItem mediaItem = creator.CreateFromFile(fileName, options);

// Read the file from stream:
MemoryStream memoryStream = new MemoryStream();

/* This approach throws an error  "This stream does not support seek operations."
* While using Response Stream. So, following approach works with FileStream as well
as HttpWebResponseStream
memoryStream.SetLength(fileStream.Length);
fileStream.Read(memoryStream.GetBuffer(), 0, (int)fileStream.Length);
memoryStream.Flush();
*/
byte[] buffer = new byte[2048];

int bytesRead = 0;
do
{
bytesRead = responseStream.Read(buffer, 0, buffer.Length);
memoryStream.Write(buffer, 0, bytesRead);

} while (bytesRead != 0);

responseStream.Close();
memoryStream.Flush();

/*
*
Added SetStream Code as there is no such way using which Sitecore's API
will create language specific version directly, It used to overwrite
* the last upload operation. Which means at one time only one language
* version was getting uploaded
*/

MediaItem mediaItem = (MediaItem)database.GetItem(options.Destination, language);

if (mediaItem == null)
{
// Now create the file in Sitecore. Using Static options
mediaItem = Sitecore.Resources.Media.MediaManager.Creator.CreateFromStream(memoryStream, fileName, options);
}
else
{
// Attach Version specific media item
Sitecore.Resources.Media.Media media = MediaManager.GetMedia(mediaItem);
media.SetStream(memoryStream, Path.GetExtension(fileName));

}

memoryStream.Dispose();

return mediaItem;
}

Just a note: We confirmed this approach with Sitecore support and they are fine with it!

Happy Language Specific Media Creation! :-)


Filed under: Development, programmatically, Programming, Sitecore, Tips and Tricks Tagged: API, Media Item, Tips and Tricks

Cannot access a disposed object. Object name: ‘LuceneSearchContext’.

$
0
0

Challenge:

Yes, I am enjoying working on latest Search API, So, as you?! But while working on it faced following challenge:

System.ObjectDisposedException: Cannot access a disposed object. Object name: ‘LuceneSearchContext’. at Sitecore.ContentSearch.LuceneProvider.LuceneSearchContext.get_Searcher() at Sitecore.ContentSearch.LuceneProvider.LinqToLuceneIndex`1.ExecuteQueryAgainstLucene(LuceneQuery query) at Sitecore.ContentSearch.LuceneProvider.LinqToLuceneIndex`1.FindElements[TElement](LuceneQuery query) at Sitecore.ContentSearch.Linq.Parsing.GenericQueryable`2.GetEnumerator() at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext() at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source)

So, as you? Don’t worry it’s good to face challenge(s), Remember :

A challenge only becomes an obstacle when you bow to it. -Ray Davis

So, If you are facing this error, Or working with Search API and would like to sharpen your weapons to kill this error, whenever it appears before you then my dear soldier this post is for you!

Solution:

Before we come to solution, let’s see how we faced this error.We believe that

To fix any error, you should know how to reproduce it!

So, let’s see How I met this error! :-)

Following method helps us to find an item(s) from bucket using StartSearchLocation (If you are new to StartSearchLocation then I would must recommend you to read this blog :  http://www.sitecore.net/Community/Technical-Blogs/Sitecore-7-Development-Team/Posts/2013/10/Using-the-new-Sitecore-7-Field-Types.aspx) :

private IEnumerable FindItemFromBucket(string importValue,
StringComparison stringComparisonType, string startSearchLocation,
string filterByFieldName)
{
IEnumerable<Item> items = null;

ISearchIndex searchIndex = ContentSearchManager.Indexes.FirstOrDefault(x => x.Name == "sitecore_master_index");

using (var context = searchIndex.CreateSearchContext())
{

items = LinqHelper.CreateQuery(context,
UIFilterHelpers.ParseDatasourceString(startSearchLocation)).Select(x => x.GetItem())
.AsEnumerable()
.Where(x => x.Language == Sitecore.Context.Language)
.Where(resultItem => resultItem[filterByFieldName].Equals(importValue,
stringComparisonType));

return items;
}

}

The method looks easy, Correct? But

Life is not as easy as it seems to be!

And when we call this method using following way:

string StartSearchLocation = "StartSearchLocation={4346502C-1315-4647-82C4-7B38301A7493}&TemplateFilter={4AB443DE-4444-4A2A-ACE4-E53635E05324}|{C068356E-192F-4D5A-ADA6-8F7250A24A3E}|_path:{4346502C-1315-4647-82C4-7B38301A7493}";
IEnumerable foundItems = null;
foundItems = FindItemFromBucket("VALUE", StringComparison.InvariantCultureIgnoreCase, StartSearchLocation, "MYFIELD");

//if you find one then store the id
if (foundItems.Any())
{
gvResults.DataSource = foundItems;
gvResults.DataBind();

}

When we ran it, we faced above given error. Then we asked to our common friend – Google! And yes you said right — It never disappoints us!

http://stackoverflow.com/questions/21827441/sitecore-7-search-cannot-access-a-disposed-object
“It seems that SearchResults<T> holds reference to SearchHit and the LuceneSearchProvider doesn’t hold a reader open. The new version of Lucene automatically closes the reader. I think you might be returning the wrong type. You should probably do like this:”

Basically, While returning results from your method rather than returning SearchResults<T> type of object. Better to return List. Tried it and it worked! So, here’s the final method:

private IEnumerable FindItemFromBucket(string importValue,
StringComparison stringComparisonType, string startSearchLocation,
string filterByFieldName)
{
IEnumerable<Item> items = null;

ISearchIndex searchIndex = ContentSearchManager.Indexes.FirstOrDefault(x => x.Name == "sitecore_master_index");

using (var context = searchIndex.CreateSearchContext())
{

items = LinqHelper.CreateQuery(context,
UIFilterHelpers.ParseDatasourceString(startSearchLocation)).Select(x => x.GetItem())
.AsEnumerable()
.Where(x => x.Language == Sitecore.Context.Language)
.Where(resultItem => resultItem[filterByFieldName].Equals(importValue,
stringComparisonType));

return items.ToList();

}

}

That’s it!

Happy Sitecore Searching! :-)

Good reads:

http://patrickdelancy.com/2013/09/filtering-sitecore-7-multilist-search-treelist-search/#.UyiPLIX3NtY

http://www.nonlinearcreations.com/Digital/how-we-think/articles/2014/03/4-patterns-Sitecore-component-development.aspx

PS : Special thanks to my colleagues Dan and Marcia who helped me to understand Search API basics, and helping me wherever I got stuck!


Filed under: programmatically, Programming, Search API, Sitecore, Sitecore7, Tips and Tricks Tagged: Bucket, Sitecore Search API

Sitecore Usergroup India (SUGIN) – To quench your Sitecore thirst!

$
0
0

Purpose : SUGIN is a group of people for whom Sitecore technology is a passion. It is a group of like-minded people who come together to share their Sitecore knowledge. The process of knowledge sharing can happen either online or offline.

So, if you are a novice, or an intermediate or an advanced Sitecore developer, transitioning or already working on Sitecore technology, SUGIN is the place to be to quench your Sitecore thirst!

Just a note : We follow one formula to understand anything from basics and that formula is “W-W-H” it stands for What-Why-How. You take anything in life and apply this formula, it will work! (It works at-least for us! we hope it will work for you as well!)

What is SUGIN?

SUGIN is association of people with following qualities:

  1. Passionate about Sitecore
  2. Happy to share their learning
  3. Happy to learn from others learning
  4. And above all, believes in talking to humans! Real meaning of being social!
  5. Believe in helping each other, and don’t feel shy in asking for a help

Good read : A nice short inspirational story about sharing the knowledge — A Tale of Two Seas — http://prakashiyer.blogspot.in/2010/01/tale-of-two-seas.html

Why SUGIN?

Recently, we’ve been observing that the Sitecore community has spread over the globe, and lot of people across the globe are sharing their Sitecore passion day in and day out via blogs, videos, forums and mainly User groups. Personally, we wanted to be part of UG Events, And few of them happen online — Hedgehog team is doing great job via their Sitecore Virtual user group initiative http://sitecoreug.org/

And few of them happen offline, Where It won’t be possible to go :( and the online one happens in the midnight of India. So, have to miss it. But thanks to the Hedgehog team for uploading all the related materials for us – Thank you so much!

Happened with you as well? And then we thought why not have a User group at India level, where we share knowledge with each other. (Just a note: If you would like to attend events or would like to be volunteer or participate, you are most welcome! SUGIN doesn’t mean it is only for Indians, It is Global. But timings and everything will be as per Indian member’s convenience)

SUGIN will be acting as a bridge between Sitecore Beginners and Sitecore Experts!

How SUGIN will work?

So, you must be thinking it’s a good idea, But how we will meet and share the knowledge? Because each one of us live in different regions (East/West/South/North). Agree! As someone nicely said – A will will find a way! We’ve a solution for this. We will do it online using AnyMeeting

Initially, we are thinking to have a Monthly meeting of 1/2/3 Hours on Friday/Saturday/Sunday/<ANYDAY> where we will cover following things, again these are just initial thoughts, we can formalize it, Yes, we are agile!:

  1. Anyone of us will present on Sitecore Topic of his/her interest (Would you like to present? What a noble thought! See Survey link given below)
  2. Post presentation we will have Q&A about sessions
  3. And at last, We will have internal Q&A session, where you can share your learning about Sitecore in the last month. OR if you are facing any issue and not getting any clue to fix it. It might be possible that someone in a group might already know how to do it. These kind of things we will discuss. OR If nothing Just a Chit Chat! :)

Sounds exciting?! It is! But as you can see about session timings and session days — We’ve provided lot of options and it’s not clear. It has a reason. We would like to know from you that which time suits you the best! (Yes, we are one of the largest democratic country in the world, And General Elections are near!)

Please fill out this Survey form — http://goo.gl/yra7No [In case if goo.gl is blocked for you then use this link -- https://docs.google.com/spreadsheet/viewform?formkey=dGlCNHJxcWN2ZjFDck5iRm9rWjBjNHc6MA#gid=]. Once we’ve enough responses [roughly ~20]. Then we will analyze, summarize based on their responses about timing, day etc. And we will keep you posted via Email/Twitter. So, please keep an eye on them

Keep in touch:

  1. Twitter Handle : https://twitter.com/sitecoreugindia
  2. E-mail address: sitecoreugindia@gmail.com

Would you like to be part of SUGIN team as a volunteer? please do tick accordingly in form And If you got any nice idea/suggestion — Feel free to drop us a line!

Till then, Happy Sitecoring! :-)


Filed under: User Group Tagged: SUGIN, UG

Sitecore CMS Version History

$
0
0

Challenge:

You might have seen that my blog post frequency has been decreased a bit. It is because of two reasons:

  1. Busy a lot with lot of projects (But as they say Every cloud has a silver lining. This too has, currently exploring lot of new things, and yes once done that share it with you! :-) So, keep visiting have lot of blog posts already lined up only for you!)
  2. Started sharing my basics on another blog here — http://blog.horizontalintegration.com/category/authors/kiran-patil/ – It is blog of our company where we craft on Sitecore, and we’ve lot of other Sitecorians who do post lot of nice stuff here. So, keep visiting this blog as well!

Let’s get back to the main point, Before few weeks back, Was talking to one of my friend and we were discussing about different versions of Sitecore. In which version what functionality got added. I was able to recall few of them. But not all of them. And at that point of time this picture came in to my mind : http://en.wikipedia.org/wiki/File:DotNet.svg and thought, How good it will be if we have the same diagram for our beloved Sitecore CMS? Eureka!

So, If you are looking for following answers:

  1. Sitecore version history
  2. Which version got launched when?
  3. Which functionality got released in which version?

Then this post is for you!

Solution:

Before starting to work on thought to give it a quick web search and as expected John West has already written blog post on it:

http://www.sitecore.net/Community/Technical-Blogs/John-West-Sitecore-Blog/Posts/2011/05/Sitecore-ASPNET-CMS-Version-History.aspx

Then thought to inherit from his blog post, and create a pictorial version of it. As you know : “A picture is worth a thousand words”

SC7.0-SC7.2

Sitecore 7.0 to Sitecore 7.2

Liked it? Then say thanks to following people:

  1. John Westhttp://www.sitecore.net/Community/Technical-Blogs/John-West-Sitecore-Blog/Posts/2011/05/Sitecore-ASPNET-CMS-Version-History.aspx
  2. Kim Hornung : https://www.blogger.com/feeds/36416442/posts/default

Happy Sitecoring! :-)


Filed under: Sitecore, Tips and Tricks Tagged: Sitecore, Tips and Tricks, Version History

Your SitecoreBasics blog reached 1,00,000 hits – Thank you!

$
0
0

A big Thanks to all my readers/visitors! I would like to share the joy of celebrating a great milestone with you all. The blog hits 1,00,000 views! It’s absolutely encouraging that over 1,00,000 people have visited this blog and few of them might got solution for their problem, for which they might struggled  a bit with strict deadlines.

Today, When I look back [At times you should take a step back and look back, You will learn a lot!] when I started blogging during March 2011, I was learning Sitecore [And till date I'm learning!] and while doing so thought why not share my learnings with you! So, it will be beneficial for everyone! As most of you agree that, in this era starting a blog is easy [Few clicks and your blog is ready!]. But in the same era, It is not easy to keep it updated, you’ve lot of other distractions to lose the momentum. But thanks to God for pouring focus in me and to you(my readers) for motivating me, Because of you this happened.

2-Lac-Summary

Thanks to each and every visitor for contributing in to this count. so, all credit goes to you! — Thank you again!

2-Lac-Months-And-Years

Memories of my earlier milestones are still in my mind’s cache — quick links for you!:

Here’s the Stats summary which would like to share with you:

Quick Facts

  • Total Posts : 115
  • Total Comments : 222
  • Total Categories : 33
  • Total Tags : 61
  • Average Visits per Day : 124

Thanks to all who inspired and appreciated my work – Yes I am saying thanks to you – My friends,readers and daily visitors! This wouldn’t have been possible without you!

Thanks again! Keep Sharing, Because Sharing is Caring!

And finally, will leave you with a nice story, which tells us importance of sharing knowledge, A Tale of Two Seas [Which Sea you would like to be?]— http://prakashiyer.blogspot.in/2010/01/tale-of-two-seas.html

Happy Reading! Happy Sitecoring! :-)


Filed under: Sitecore Tagged: Milestone, Milestones

Sitecore 7.2 Upgrade Learnings

$
0
0

Challenge:

Howdy my dear readers, I am back. Yes, after so long time. But I was learning and exploring new things for you! And please fasten your seat now. As I got a lot of Basics to share with you! So, here we go..

Last week we were working on upgrading from Sitecore.NET 7.0. (rev. 130810) to Sitecore.NET 7.2 (rev. 140228) [You are also going to upgrade to same version? What a co-incidence?]

BTW, Sitecore released 7.2 Update-2 (rev. 140526) on Friday, May 30, 2014 only. So, if you are in planning phase, good to have a look at it here : http://sitecorekh.blogspot.in/2014/05/sitecore-releases-72-update-2-rev-140526.html

After deploying these changes we found following error which took lot of our time. [Roughly 4 hours]

Max-Clause-Count-v2

 

Message: maxClauseCount is set to 1024
Source: Lucene.Net
Lucene.Net.Search.BooleanQuery.Add(BooleanClause clause)
Lucene.Net.Search.MultiTermQuery.ScoringBooleanQueryRewrite.Rewrite(IndexReader reader, MultiTermQuery query)
Sitecore.ContentSearch.Linq.Lucene.Queries.SpanWildcardQuery.Rewrite(IndexReader reader)
Lucene.Net.Search.Spans.SpanFirstQuery.Rewrite(IndexReader reader)
Lucene.Net.Search.BooleanQuery.Rewrite(IndexReader reader)
Lucene.Net.Search.BooleanQuery.Rewrite(IndexReader reader)
Lucene.Net.Search.IndexSearcher.Rewrite(Query original)

You are also facing same error? Or you would like to be pro-active? Then this post is for you!

Solution:

Just a note : Before we move to solution of this challenge, I would suggest you to check this post — http://maxslabyak.com/sitecore/3-new-sitecore-v7-2-bugs-need-know-go-live/

To resolve this error, we did following steps:

  • We found that — Sitecore.ContentSearch.Lucene.DefaultIndexConfiguration.config file has following setting (We Increased it from 1024 to 2048, then bit higher and then finally 65536. But it didn’t work):
<!--  MAX <span class="hiddenSpellError" pre="MAX " data-mce-bogus="1">LUCENE</span> QUERY CLAUSE COUNT-->
            Boolean Max Clause Count. Increasing this value increases memory consumption. Only increase it if you need to run very large queries.
            This setting allows you to increase or decrease the clause count for Lucene depending upon how big you think the queries could grow.

            Default value: 1024
      -->
     
  • Then we contacted our common friend — Google and gave us following two links:

http://www.newguid.net/sitecore/2012/sitecore-lucene-max-clause-count/

http://sitec0re.wordpress.com/2014/03/18/lucene-maxclausecount-error-after-upgrading-to-sitecore-7-2-rev-140228/

  • First one, says about pipeline, and second one asks us to do changeinSearchProvider. But we haven’t implemented our search provider — Then we merged both of this solution and derived our solution and here’s the simplified version of it:
    • Create a New Pipeline in your Pipelines projects [Basically, We create layer for each this kind of functionality]. Technically, Create a .cs file — Let’s say AdjustLuceneSettings.cs. And add following code within it:
using Lucene.Net.Search;
using Sitecore.Pipelines;

namespace SitecoreBasics.Pipelines.Search
{    
    public class AdjustLuceneSettings
    {
        ///
        /// Processor to set the lucene max query clause count
        ///
        ///
        public void Process(PipelineArgs args)
        {
            int maxClauseCount = 1024;
            int.TryParse(Sitecore.Configuration.Settings.GetSetting("ContentSearch.LuceneQueryClauseCount", "1024"), out maxClauseCount);
            BooleanQuery.MaxClauseCount = maxClauseCount;            
        }       

    }

}
    • Now, this project will need reference of “Lucene.Net.dll” — Please do add it
    • So, Pipeline is ready. Now we need to Hook it in  to Sitecore. To do that, add AdjustLuceneSettings.Config under your App_Config/Include folder, and add following configuration within it:
xmlns:patch="http://www.sitecore.net/xmlconfig/">
 
   
     
       
     
   
  

    • Yes, we are near — Now, you can set ContentSearch.LuceneQueryClauseCount to any number you want.
    • That’s it!

So, your application is working fine — right? Happy?! I know you will be. But an engineer within you is shouting and asking following questions:

  1. Why we get maxClauseCount error?
  2. Why ContentSearch.LuceneQueryClauseCount s not working?

We appreciate your questions, and luckily, we’ve answers for both of your questions:

The reason for maxClauseCount is as below:

Recently I ran into a familiar lucene exception within my sitecore solution. Its lucene’s TooManyClauses exception. In fact the exception occures when there are more than 1024 where clauses in your query. That seems a lot but by using a wildcard query for example lucene is translating your wildcard query into a lot of where clauses after analyzing it. Of-course the first step is to take a good look at your query and if possible try to rewrite

Source : http://www.newguid.net/sitecore/2012/sitecore-lucene-max-clause-count/

Answer for guys like me who believe in Basics:

http://dalelane.co.uk/blog/?p=2081

To borrow the example from the Lucene FAQ, in some situations Lucene expands your search query before running it.

If you have an index with:

     car
     cars
     cat
     catalogue
     caterpillar
     delta
     doctor
     dogs
     dominos

And you search for: ca*
It will essentially be expanded to “car OR cars OR cat OR catalogue OR caterpillar” (removing the wildcard).

And if you search for: *
It will be expanded to: “car OR cars OR cat OR catalogue OR caterpillar OR delta OR doctor OR dogs OR dominos“.
A query with nine clauses.

As the index grows, the number of clauses in these wildcard queries increases. If it increases to the point where search queries end up with more than the default 1024 clauses in them, then searches start throwing TooManyClauses exceptions.

And for second question– Why ContentSearch.LuceneQueryClauseCount is not working?

We raised a support case to our second common friends — Sitecore Support and they accepted it as a BUG:

I have managed to replicate this. Unfortunately the “ContentSearch.LuceneQueryClauseCount” setting is not used. We have registered this as a bug for the current version of CMS. We will notify you of any updates. Thank you for reporting the problem.

I hope I’ve answered all your questions. If you have more questions — Just shout! You’ve your set of learning after upgrading? And you would like to share. What a noble thought! Do it right now! Because Sharing is Caring! :-)

Good reads:

Unable to create document builder – crawling exception after upgrading to SC 7.2 : http://sitecoreblog.marklowe.ch/2014/05/unable-to-create-document-builder/

Happy Upgrading! :-)

PS : Special thanks to Lilia Silvestrova (Sitecore Support) for providing this suggestion Bhavesh and Marcia who worked on this challenge!


Filed under: Sitecore, Sitecore Bugs, Tips and Tricks, Upgrade Tagged: Sitecore Bugs, Upgrade
Viewing all 178 articles
Browse latest View live