Surendra Sharma

Surendra Sharma

Search This Blog

Sunday, February 22, 2015

How to generate Sitemap for your website online

There are situation when you are going to deploy your website on production and client want Sitemap file of website. Sitemap file is used to improve SEO results.

If you are going to create it manually, your require two things
  • If you must know all the pages name of your site
  • Time - as it’s a time taking process to create this file.

But there is good news you can create it online and within a minute. Here are the steps to do it.


- Visit website https://www.xml-sitemaps.com and enter your full website URL and some optional parameters in the form below.

- Press 'Start' button and wait until the site is completely crawled.

- You will be redirected to the generated sitemap details page, including number of pages, broken links list, XML file content and link to a sitemap file.
  Download the sitemap file using that link and put it into the domain root folder of your site.

- Go to your Google Webmaster account and add your sitemap URL.

Put this file into your virtual directory.


In case of Sitecore, put this sitemap.xml under "website" folder.

Please leave your comments or share this tip if it’s useful for you.

Thursday, February 19, 2015

Language suffix 'en' is being added into the URL of Sitecore website

Recently I come across with interesting requirement in Sitecore.

Whenever any new user tries to access any page of website first time, language suffix ‘en’ is adding into the URL. If same user tries to access the same page again then ‘en’ is not including into the URL. Let’s understand it with example.

When the user is on www.abc.com  and clicks to go to the any pages, the URL user is taken to is http://www.abc.com/en/abc , which should be www.abc.com/abc  and when user clicks LMN link, URL is http://www.abc.com/en/LMN , should be www.abc.com/LMN .

This is only occurring the first time the user visits the page. If the user clicks away from one of these pages to a different page and then clicks back to the previous page, the URL's no longer contain the 'en'.

How to fix this?

Open web.config file and locate languageLocation in linkManager section. Its different values are asNeeded, always and never. By default its asNeeded so language siffix added into the URL first time the user visits the page.
If you set Never, you will never get the language suffix in URL.

    <linkManager defaultProvider="sitecore">
      <providers>
        <clear/>
        <add name="sitecore" type="Sitecore.Links.LinkProvider, Sitecore.Kernel" addAspxExtension="false" alwaysIncludeServerUrl="false" encodeNames="true" languageEmbedding="never" languageLocation="filePath" lowercaseUrls="true" shortenUrls="true" useDisplayName="false"/>
      </providers>
    </linkManager>


Please leave your comments or share this tip if it’s useful for you.

Wednesday, February 18, 2015

Google Analytic tracking script

Google analytic is great way to track your website access and view of different pages.

Question is how to implement analytic in your web project?

To work with this you need Google tracking ID. I represented it as “NNNNN”. In project store it either in web.config or database. Below is script that you need to place it before the end of </body> section of webpage.

<script type="text/javascript">

    var _gaq = _gaq || [];
    _gaq.push(['_setAccount', 'NNNNN']);
    _gaq.push(['_trackPageview']);

    (function () {
        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
    })();

</script>


Please leave your comments or share this script if it’s useful for you.

Tuesday, February 17, 2015

How to store WFFM data in SQL Server instead of SQLite database in Sitecore

When you install WFFM package, by default it store data in SQLite database.

Disadvantage with SQLite is that it creates the database on disk and it’s not centralized.
However Sitecore provides a way to store WFFM data in SQL server.

Here are the steps to do it.

·         Restore database in SQL server from “Website\Data\Sitecore_WebForms.bak
·         Change “Sitecore.forms.config” file in “Website\App_Config\Include” where comment SQLLite section and uncomment MS SQL section and put the new connection string for restored database as shown below

    <!-- DLINQ compatible data storage -->
    <!-- MS SQL -->
   
    <formsDataProvider type="Sitecore.Forms.Data.DataProviders.WFMDataProvider,Sitecore.Forms.Core">
      <param desc="connection string">user id=abc;password=xyz;Data Source=your DS;Database=dbname</param>
    </formsDataProvider>
   

    <!-- Oracle -->
    <!--
    <formsDataProvider type="Sitecore.Forms.Data.DataProviders.Oracle.OracleWFMDataProvider,Sitecore.Forms.Oracle">
      <param desc="connection string">user id=(user);password=(password);Data Source=(database)</param>
    </formsDataProvider>
    -->

    <!-- SQLite -->
       <!--
    <formsDataProvider type="Sitecore.Forms.Data.DataProviders.SQLite.SQLiteWFMDataProvider,Sitecore.Forms.Core">
      <param desc="connection string">Data Source=/data/sitecore_webforms.db;version=3;BinaryGUID=true</param>
    </formsDataProvider>-->


Please leave your comments or share this tip if it’s useful for you.

Monday, February 16, 2015

Metadata file 'HedgehogDevelopment.CodeGeneration.Extensions.dll' could not be found

If you are getting HedgehogDevelopment.CodeGeneration.Extensions.dll error in TDS Sitecore project then put HedgehogDevelopment.CodeGeneration.Extensions.dll into C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\PublicAssemblies folder for Visual Studio 2012.

Please leave your comments or share this tip if it’s useful for you.

Saturday, February 14, 2015

How to make URL in lower case in Sitecore

Sometimes client requirement is to make all letters lower case of their website URL. It’s a good practice as all search engine provide better result with lower case URL.

How to do it in Sitecore with .NET?

Sitecore is smartly provide this facility by changing just one entry in web.config file. If you want make URL in lower case then keep lowercaseUrls="true" from <linkManager defaultProvider="sitecore"> section in web.config file as highlighted below


    <linkManager defaultProvider="sitecore">
      <providers>
        <clear/>
        <add name="sitecore" type="Sitecore.Links.LinkProvider, Sitecore.Kernel" addAspxExtension="false" alwaysIncludeServerUrl="false" encodeNames="true" languageEmbedding="asNeeded" languageLocation="filePath" lowercaseUrls="true" shortenUrls="true" useDisplayName="false"/>
      </providers>
    </linkManager>


Woooowww. No programming required J


Please leave your comments or share this tip if it’s useful for you.

Friday, February 13, 2015

Could not load file or assembly 'System.Data.SQLite, Version=1.0.89.0, Culture=neutral, PublicKeyToken=abcdefghijkl or one of its dependencies

If you are getting Sitecore WFFM error "Could not load file or assembly 'System.Data.SQLite, Version=1.0.89.0, Culture=neutral, PublicKeyToken=abcdefghijkl or one of its dependencies. The system cannot find the file specified."

Then check existence of "System.Data.SQLite.dll" in "Website\bin" folder.
If it’s missing then paste in "Website\bin" folder.

Please leave your comments or share this tip if it’s useful for you.

Thursday, February 12, 2015

How to check your new or modification PAN request status online

I personally feel that most of the life related work should done online. Why to visit difference government and private offices, why to meet them personally, why to call them. For a common man it’s always a difficult to go to government office and do their tasks. Government people are always showing that they are busy even they don’t have no work. Common man is always frustrated with government offices and their babus. So I always prefer to do it online.

So here I am sharing my personal experience to do changes in PAN card and how to track the request online.

If you had applied for PAN card changes like name, DOB, signature, photo etc. then you can submit your request at Karvy. You have to fill a form and attached old PAN card copy, ID proof, address proof. Submit this form along with 105 Rs. In return they will provide a receipt which has acknowledgement number. From that acknowledgement track your request status from below link


Either enter Acknowledgement number or your personal detail. Click on SUBMIT button as shown in below image and you can get the status which should be either in process or completed.




Please leave your comments or share this tip if it’s useful for you.

Tuesday, February 10, 2015

Tip for how to check your Aadhaar- Gas linkage Status

To get subsidy on LPG gas cylinder. You need to link your Aadhar Card number with gas agency and bank.

If you had applied your Aadhar card linkage request at Bharat Gas and Bank then you can check the status at below link


Enter your Aadhar card or cell number and click on Proceed button. Check the status on the status screen as shown below




Please leave your comments or share this tip if it’s useful for you.

Tip for how and where to check status of any modification request of Aadhar Card

If you have applied for any information update request in Aadhar card like Name, mobile number, address, date of birth, email then you can check update status at below link


You have to enter your Aadhar number and URN and on click of Get Status button you can check the status.



Please leave your comments or share this tip if it’s useful for you.

Friday, February 6, 2015

Empty strings are not allowed. Parameter name: fieldname

If you are getting “Empty strings are not allowed. Parameter name: fieldname” error in Sitecore then to fix it, do the Publish. Please note that only publish item will not work here. Either publish the site in smart way or do the full site publish.


Please leave your comments or share this tip if it’s useful for you.

Wednesday, February 4, 2015

How to update your Android mobile with new OS version Lollipop

The first thing is that your mobile should itself ask for system update. If not then you can also check it from Settings-> About Phone -> System Updates

The new #Lollipop setup is 378 MB in size.

First download and install the setup.

After installation, Lollipop optimizing all the apps, upgrading contact database according to new updates.

One thing to remember here is that you cannot make any call for next 15 min during this installation process or better word is you cannot do anything with your cell during installation for next 15 min.

Don't worry about installation of new OS. It will keep your all the apps and settings as it is.
After installation, I suggest just restart your mobile.

I notice lots of improvements in terms of UI, animation, phone contact screen, settings, performance etc.

So oo ahead and do the installation and become the part of new android world.

Please leave your comments or share this tip if it’s useful for you.

Tuesday, February 3, 2015

Script for LuckyOrange tracking code

Like Google Analytic, there are other analytic support available on web. One of them is #LuckyOrange

To work with this you need Site ID. I represented it in sample code as “NNNNN”. Below is script that you need to place it between <head> </head> section of webpage. The code is asynchronous and will not block your page from loading.

<script type='text/javascript'>
    window.__wtw_lucky_site_id = 'NNNNN';

    (function () {
        var wa = document.createElement('script'); wa.type = 'text/javascript'; wa.async = true;
        wa.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://cdn') + '.luckyorange.com/w.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(wa, s);
    })();

</script>


Please leave your comments or share this code if it’s useful for you.

Monday, February 2, 2015

How to attach or execute batch file with Visual Studio Build process

There are some scenario in project development when one need to execute some EXE or batch file after successful Visual Studio build process.

Question is how to do that?

Here is a way

Create sample batch file and save it. Note down the complete batch file path suppose it’s “D:\ShareForAll\My Batch File.bat”. Follow below steps to attach it to Visual Studio.

·         Now open Visual Studio project.
·         Right click project in solution explorer and select Properties
·         Click on Build Events
·         Enter commands in Post-build event command line as in below image
o    You can enter any DOS command here.
o    To execute Batch file, write call “<filepath.bat>”





Please leave your comments or share this tip if it’s useful for you.

Sunday, February 1, 2015

How to download outlook calendar file from ASP.Net website

Sometime we need to show schedule of some events on website and allow user to download the calendar for outlook which user can save in their local computer or allow them to directly open it in outlook.

The trick here is same to write the code for downloading any file from response, only thing to remember is the calendar content and content type “text/calendar”.

Here is the code

        protected void Button2_Click(object sender, EventArgs e)
        {
            System.Text.StringBuilder sbICSFile = new System.Text.StringBuilder();
            DateTime dtNow = DateTime.Now;

            sbICSFile.AppendLine("BEGIN:VCALENDAR");
            sbICSFile.AppendLine("VERSION:2.0");
            sbICSFile.AppendLine("PRODID:-//ICSTestCS/");

            sbICSFile.AppendLine("BEGIN:VEVENT");
            sbICSFile.AppendLine("DTSTART:20120515T110000Z");
            sbICSFile.AppendLine("DTEND:20120515T113000Z");
            sbICSFile.AppendLine("UID:1");
            sbICSFile.AppendLine("DESCRIPTION:Test Desc");
            sbICSFile.AppendLine("SUMMARY:calander");
            sbICSFile.AppendLine("END:VEVENT");
            sbICSFile.AppendLine("END:VCALENDAR");

            Response.ContentType = "text/calendar";
            Response.AddHeader("content-disposition", "attachment; filename=CalendarEvent1.ics");
            Response.Write(sbICSFile);
            Response.Flush();
            Response.End();
        }

  
Please leave your comments or share this code if it’s useful for you.