Monday, December 30, 2024

creative bundle, content creator resources, marketing tools, affordable stock photos, yoga videos, eBooks

 Elevate your projects with this all-in-one creative bundle! Get 15 GB of HD People Stock Photos, 70 Yoga Videos, 6,000+ MRR & PLR eBooks, and 3100+ Fitness Quotes. Design effortlessly with logo templates, infographics, and quote graphics, or boost marketing with ChatGPT prompts and a 7 Million USA Email List. Everything you need to create, market, and succeed—all in one place!

Get This Entire Bundle for Just $4.99!

https://cavotra.com/

Saturday, February 24, 2024

Decoding Infrastructure as Code: Terraform vs. Bicep - Choosing the Right Path

 In the realm of Infrastructure as Code (IaC), where efficiency, scalability, and maintainability are paramount, the choice of tools can significantly impact the success of your projects. Two prominent contenders in this space are Terraform and Bicep, each offering unique features and approaches. Let's embark on a journey to understand the nuances of Terraform and Bicep and how to make an informed decision based on your project requirements.

1. Terraform - The Pioneering Force:

Strengths:

  • Maturity: Terraform has been a stalwart in the IaC arena for years, garnering widespread community support and extensive documentation.
  • Broad Provider Ecosystem: Terraform supports a vast array of providers, enabling you to manage resources across various cloud platforms and services.
  • HCL (HashiCorp Configuration Language): Its declarative syntax provides a clear representation of infrastructure, making it accessible to both beginners and seasoned professionals.

Considerations:

  • Learning Curve: Terraform's comprehensive feature set may pose a steeper learning curve for newcomers.
  • JSON Syntax: While HCL is generally easy to read and write, some developers prefer JSON, and Terraform configurations can be converted to JSON.

2. Bicep - Microsoft's Answer:

Strengths:

  • Azure Native: Bicep is designed specifically for Azure, providing native integration and a seamless experience for Azure-centric projects.
  • Conciseness: Bicep's syntax is often considered more concise and readable than Terraform's HCL, reducing the amount of code needed for equivalent configurations.
  • Type Safety: Bicep incorporates type safety, offering enhanced validation during development.

Considerations:

  • Limited Ecosystem: As of now, Bicep is tailored for Azure, so it might not be the ideal choice for projects spanning multiple cloud providers.
  • Relative Newcomer: While gaining popularity, Bicep is still a newer entrant compared to Terraform.

Choosing the Right Tool for the Job:

1. Project Scope and Cloud Provider:

  • Terraform: Ideal for multi-cloud or hybrid cloud scenarios.
  • Bicep: Best suited for Azure-focused projects.

2. Team Expertise:

  • Terraform: If your team is already proficient in Terraform, leveraging existing knowledge may be advantageous.
  • Bicep: A compelling choice for teams heavily invested in the Azure ecosystem.

3. Syntax Preference:

  • Terraform: HCL appeals to those comfortable with a declarative syntax.
  • Bicep: A more concise and arguably readable syntax.

4. Community and Support:

  • Terraform: A mature and well-established community with extensive resources.
  • Bicep: Growing community with increasing support from Microsoft.

Conclusion:

In the Terraform vs. Bicep debate, there is no one-size-fits-all answer. The decision hinges on your specific project requirements, team expertise, and long-term strategy. Terraform's versatility makes it a solid choice for diverse cloud landscapes, while Bicep's native integration with Azure positions it as a compelling option for Azure-centric projects.

Ultimately, both Terraform and Bicep contribute to the evolving landscape of IaC, offering developers powerful tools to sculpt and manage infrastructure with code. As you embark on your IaC journey, carefully assess your project's needs and team dynamics to make an informed choice that aligns with your goals.

Sunday, February 21, 2021

Sitecore Cortex Content Tagging

 Sitecore CortexTM Content Tagging offers an easy and accurate way to tag the people, places, products, companies, facts, and events that are mentioned in your content. This increases the value, accessibility, and interoperability of your content. The Sitecore Cortex Content Tagging feature integrates the Sitecore CMS with machine learning (ML) based natural language processing (NLP) engines like Refinitiv Intelligent Tagging Open Calais. This enables Sitecore to send content to an NLP platform. The NLP engine processes the content and returns semantic metadata to Sitecore. Sitecore uses the metadata to tag content with user-defined taxonomy.


Follow the below steps to enable Sitecore Cortex Content Tagging

Step 1: Register a free account with PermID 

Go to https://permid.org/ and create a free account:





Post clicking on Register it will be re-directed to Thomson Reuters page and register with personal mail id



Once you register, will receive the mail to activate the profile. Once profile gets activated login to https://permid.org/

Step 2: Get API secret key.
Click on “Display my API Token” under APIs tab after logging in

Step 3: The Content Tagging Option
When we login to Sitecore instance, under Home Tab will see Content Tagging Option

Step 4: Verify the initial tag field 
Scroll down to the system defined Tagging section and verify there are no tags:

Step 5: Update/Create a config patch file.
Login to Sitecore Azure App Service, navigate to /App_Config/Sitecore/ContentTagging/Sitecore.ContentTagging.OpenCalais.cofig file.
Update CalaisEndpoint to https://api-eit.refinitiv.com/permid/calais
And update CalaisAccessToken to API Token which has been generated earlier

Step 6: Check the Tagging Tab

After we upload / update the config file “Content Tagging” tab will be enabled.


Step 7: Start Tagging

Post selecting the node, click on the “Tag Item” button and it will start Tagging the content

Step 8: Review Tag field

Once the tagging process is finished, review the tagging field again it will be populated with the tags.










Monday, April 29, 2019

Encrypt/ Decrypt Strings to Base64 in C#

Base64 Encoding represent binary data in as ASCII string format. I have created a small desktop application that will encrypt and Decrypt string.


Code base associated with the application:

    private void button1_Click(object sender, EventArgs e)
        {
            String Result = EncryptBase64(txtEncodeString.Text.Trim().ToString());
            txtEncodeValue.Text = Result;
        }

        public static string EncryptBase64(string value)
        {
            string result = "";

            try
            {
                if (!string.IsNullOrEmpty(value))
                {
                    byte[] bytes = System.Text.UnicodeEncoding.UTF8.GetBytes(value);
                    result = Convert.ToBase64String(bytes);
                }
            }
            catch { }

            return result;
        }

        private void btnDecode_Click(object sender, EventArgs e)
        {
            String Result = DecryptBase64(txtDecodeString.Text.Trim().ToString());
            txtDecodeValue.Text = Result;
        }

        public static string DecryptBase64(string value)
        {
            string result = "";

            try
            {
                byte[] bytes = Convert.FromBase64String(value);

                result = System.Text.Encoding.UTF8.GetString(bytes);
            }
            catch { }

            return result;
        }

Thursday, September 15, 2016

Sitecore best practices guideline

I have got some Sitecore best practices guideline. We can follow those guideline during Sitecore development. Thnaks to our Sitecore gladiator Kapil NakerOshyn.

Template best practices:
1. Group the fields into logical sections based on business sections or data type sections thereby avoiding a huge form, and provide for a compartmentalized form, that can be collapsed as needed.
2. Identify reusable fields when designing templates. Avoid excessive customization; simplify.
3. Use Data templates for normal data entry templates. Use Branch templates when you have a predefined structure of items, sub items to be created. Branch templates have the ability to also create “children” (descendants) of the new item at the same time the parent item is created.
4. Choose names which are understood by business users. Display Name and Field Titles are the important ones that Sitecore uses.
5. Define separate fields for display name, breadcrumb title, and navigation title fields for a page item.
6. Avoid using a lot of RTE fields within the template and keep the templates small.
7. Use icons wherever applicable to facilitate visual differentiation and understood by business user.
8. Place the section of fields that are modified frequently at the top of the data template or place them in order they appear on pages.
9. Always have default values in the form of standard values.
10. Provide proper context sensitive help for the fields, and sections in templates.
11. Make the field names unique between sections, do provide a prefix, suffixes indicating types, for example Title Name, Product Name as field name to avoid conflicts in field names when the templates are inherited by another template.
12. Avoid Circular Inheritance in templates.
13. Avoid modifying templates in Sitecore/Templates/System section
14. Centrally manage the layout settings, initial workflow, Insert Options in template standard values than in individual items.
15. Use Tilda (~) character in source for image fields with caution, as this will allow the user access to the entire media library tree.
16. Use TreelistEx in comparison to Treelist to make the rendering faster.
17. Use Droplink and Grouped Droplink instead of Droplist and Grouped Droplist.
18. Do not use the Internal Link, Layout, Rules, and Template Field Source field types in your data template as they are deprecated data types.
19. Make base template components, which then can be inherited by other templates to provide for foundation templates.
20. Wherever required, have field validations been set. For instance, content cannot be published if the SEO metadata has not been entered and this should be ensured through field validations.
21. Have insert options been defined for data templates to ensure that content taxonomy is maintained in the content tree.
22. All image fields in the data template have their data sources set so as to ensure that images are only uploaded to the right folder.
23. All sub layouts / renderings have content-author friendly screenshots set so as to provide a better page editing experience. However this practice we follow on need basis after evaluation of the need.
24. For some of the common non-visual content fields (like SEO, tagging), ensure there are options for an author to enter content within the Page Editor without having to go back to Content Editor , however this practice we follow on need basis after evaluation of the need.


 Presentation component best practices:
1. Store the layouts inside /Sitecore/Layout/Layouts/, sub layouts inside /Sitecore/Layout/Sub layout. You can create sub-directories within these as needed with added access restrictions.
2. Do not have more than 2 or 3 layouts per device or per site and handle the different structures using placeholders and sub layouts respectively.
3. Assign the layout details in the standard values rather than on items or template definition item.
4. If different items based on a template require different layouts, then create a new template that inherits from the existing template.
5. Use FieldRenderer object to render the fields on presentation
6. Sort the sub layouts containing the placeholders to be before the controls that bind to those placeholders as Sitecore layout engine builds and binds the controls based on this order.
7. Caching options should be configured whenever the controls are used, based on the control definitions.
8. Use sublayouts, renderings, xslt appropriately with below guidelines
a. Global.asax, pipeline processor, or event handler - Logic to be done on application start/end, session start/end, request process cycle, event cycle.
b. Layouts – Page level code ,
c. Xslt - Module level Code with simple little logic, ex: breadcrumb, Sitecore controls – Module level Code with simple logic, where separation of data from presentation is not required.
d. Sub layouts - Module level Code with complex logic
9. Site should be compliant to content authoring using Page editor and not require access login to Desktop interface of Sitecore for content editors.

Content structure best practices:
1. As standard practice, we would recommend not having more than 50 items under any item node. Try to maintain the hierarchy in such a way that it reduces the number of children per node.
2. Make sure the indexes are frequently updated.
3. Identify the different roles and access restrictions for items in order to provide access based on minimal access requirements.
4. Avoid using special characters in Item names.
5. Check for version compatibility when using Sitecore modules.
6. Turn off the visibility of Standard Values on content items, “Entire tree” view for Content Editors in general, which can be toggled as needed by them.
7. Use Clones instead of Proxy items since proxy items are deprecated in Sitecore 6.5.
8. Identify the security related requirements in multisite in one instance environment and design your site structure, media structure that meets the requirements of separation.
9. Maintain only a few versions of each item in the implementation.
10. Separate the content that is to be managed versus the content that is transactional.
11. In case of multisites in one instance, separate the structures as follows and appropriately set the websites in web.config <sites> node.
a. Templates structure: /sitecore/Templates/Global, /sitecore/Templates/Site1, /sitecore/Templates/Site2.
b. Layouts structure: /sitecore/Layout/Layouts/ Global, /sitecore/Layout/Layouts/Site1, / sitecore/Layout/Layouts/Site2.
c. Sites structures: /sitecore/Content/GlobalData, /sitecore/Content/Site1, /sitecore/Content/Site2.
d. Media Library structures: /sitecore/Media Library/Global, /sitecore/Media Library/Site1,


Media asset best practices:
1. Use database as the storage mechanism for media in general instead of file based storage.
2. Use File system in scenarios where the number of assets is large (running into Gigabytes).
3. Organize the media assets in business user friendly way.
4. In a multisite, one instance scenario, make sure you organize the structure in such a way to meet any restriction requirements related to access of different media library folders to different site authors. For example Media library/site1/Images, Media library/site2/Images

Storage locations best practices:
1. Datafolder is responsible for logs, viewstates, diagnostic counters, debug traces and packages—making this location a high-write situation for both the CMS and the web nodes. Ensuring the datafolder is located on a disk that can handle the write requirements aids in performance. You will want to consider this set-up for the tempFolder, as well, which is used as a temporary processing location.
2. Media.CacheFolder, which is used to store media that has been extracted from the database, is most relevant for the published site. Writes to disk are generally infrequent for this folder, making high-speed reading a greater priority

Security best practices:
25. Create the roles in Sitecore Domain instead of specific domain.
26. Prevent .config, .xml, .xslt,files from being served by web server
27. Make sure /data, /indexes folders are not accessible to anonymous users and are outside of the website directory context.
28. Turn off anonymous access to / App_Config, /Sitecore/admin, / Sitecore/debug, /Sitecore/shell/ Web Service.
29. Deny Execute scripts Permissions and disable upload folder on the Delivery Server. On the Authoring Server, enable upload folder if the content authors use it to upload files.
30. Provide the minimal set of roles to user accounts for performing their duties.


Caching best practices:
1. Combined size of all the caches should not exceed available memory.
2. Use Sitecore Debugger, Firebug, /Sitecore/ admin/stats.aspx, and /Sitecore/admin/cache.aspx to measure the performance of the sites.
3. During cache monitoring, if the Delta value keeps changing consistently with the size of the cache being more than 80% of the max size limit for that cache, then consider increasing the max size for that cache by 50%.
4. Tweak Pre-fetch cache appropriately by caching key items deemed to be required for the site.
5. Sitecore provides recommended values for Data cache, Items cache to be around 150MB on Delivery Servers.
6. In case of usage of custom caching solution being used in your application, use the publish:begin or publish:end events of Sitecore to handle eviction strategies, based on updates to Sitecore item that is cached.
7. Building a site with a higher number of small renderings and sublayouts gives greater flexibility to control the caching of HTML

Development best practices:
1. Set up continuous integration environment process flow for the project in order to have scripted compilation and coding style checks ,run through set of unit tests, merge\replace different environment specific config tokens, and deploy to respective DEV, QA and PROD environments.
2. Content Editing should be done on the master database(CM), and then pushed to web database(CD).
3. Site context should be considered when programmatically creating links in a multisite or multi device scenario.
4. Identify the controls that can be cached and appropriately assign the values for caching the markups.
5. Log debug, error statements to log file, or to Sitecore log file, to be able to check these logs for errors.
6. Use GUID’s instead of Sitecore paths where possible. If paths, then consider the differences between Fast query results versus normal query results.
7. Encapsulate the Content types or templates using one of object mapper modules available at shared source, to be able to address as Product.Name instead of productItem. Fields[“Name”] all over the code.
8. Use Sitecore Rocks plug-in in Visual studio for development.
9. Place the item in editing mode before it is edited programmatically.
10. Separate the configurations of Sitecore from the custom configurations being added as part of the solution.
11. Hide all files in Solution Explorer, especially before debugging.
12. Minimize long statements that use the ternary operator.
13. Remove the extension for the page URL and for the media items.
14. Creating new hooks or pipeline additions in Sitecore is a common means to extend functionality; however, before deciding on this approach, be sure understand when this new code fires. If  unsure, create a simple stub and have it log out, or trace it through debugger
15. Use of automated tools to test .NET code.Tools like the Red Gate suite of products for profiling our .NET code and locating potential problem points
16. Use of .NET profilers to find .NET issues
17. Set the copy local property to false when reference an assembly in the /bin directory of the solution, or Visual Studio compilation may delete assemblies.
18. When accessing Sitecore.Data.Items.Item.Children, Sitecore invokes a database query. This doesn’t matter in a foreach loop, but should put Children in a Sitecore.Collections.ChildList before iterating with a for loop.
19. Stress-test  code with realistic volumes of data and users—make the test scenario as close as you can to the reality of your eventual implementation environment.


Monday, September 12, 2016

Error in sitecore mvc routing: An illegal route has been detected: '{controller}/{action}/{id}'

If you are working with Sitecore with MVC and you face the below issue then you can resolve the below issue by commenting the below lines from RouteConfig.cs file(screenshot) and publish.

Issue:
The following fatal error have been detected:
1: An illegal route has been detected: '{controller}/{action}/{id}'. If you wish to keep this route, please remove it from the Mvc.IllegalRoutes setting.


Resolution:


Sunday, September 11, 2016

Version conflict with System.Web.Mvc

Few days back while compiling our project we are getting the below error.We spend a long time to resolve the issue and finally got the solution..


Assembly 'System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
 uses 'System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
 which has a higher version than referenced assembly 'System.Web.WebPages, Version=2.0.0.0,
 Culture=neutral, PublicKeyToken=31bf3856ad364e35'      
  c:\inetpub\wwwroot\WebsiteSiteCM\Website\bin\System.Web.Mvc.dll website.Retail.Web

You may also try to reinstall Microsoft.AspNet.WebPages nuget packages using this command in the package manager console
> Update-Package reinstall Microsoft.AspNet.WebPages