Friday, May 17, 2024

What's the difference between a left join and an inner join?

 Inner Join

  • Definition: An inner join is like finding friends who are on both your guest list and your friend's guest list. You only invite the people who are on both lists.
  • Example: Imagine you and your friend are throwing a party together. You each have a guest list. An inner join would mean you only invite the guests who appear on both your list and your friend's list. If a person is not on both lists, they don’t get invited.

Left Join

  • Definition: A left join is like inviting everyone on your guest list and including the ones from your friend's list who are also on yours. If someone is on your list but not on your friend’s list, they still get invited, but you note that your friend didn’t have them on their list.
  • Example: Now, imagine you still have the same two guest lists. A left join would mean you invite everyone on your list, and if they are also on your friend’s list, that’s great. But if someone is only on your list and not on your friend's list, you still invite them. For people only on your friend's list and not yours, they don't get invited.

Summary

  • Inner Join: Only invite guests who are on both lists.
  • Left Join: Invite everyone on your list, and if they are also on your friend’s list, note that too. But still invite them even if they are not on your friend's list.

What's the difference between viewstate and sessionstate?

 ViewState

  • Definition: ViewState is like a note you keep for a short period, specifically for a single webpage visit. It remembers things temporarily while you're on that page.
  • Example: Imagine you're filling out a form online, like your address details. As you type, the information is saved on the same page, so if you accidentally click a button that doesn't reload the page, you won't lose what you've already entered. However, if you go to a different page or close the browser, this information is lost.

SessionState

  • Definition: SessionState is like a temporary storage locker at a theme park that you can use throughout your entire visit. It keeps track of your stuff while you're there.
  • Example: Suppose you log into an online store and add items to your shopping cart. You browse different pages of the site, and your cart keeps the items until you leave the site or log out. Even if you navigate through multiple pages, the site remembers your cart items because it's stored in the session.

Summary

  • ViewState: Remembers information only while you're on the same webpage. Think of it like a sticky note for that specific page.
  • SessionState: Remembers information for your entire visit to the website. Think of it like a storage locker that you can use until you leave the theme park (or website).

What's the difference between protected and internal? What about "protected internal"?

 Protected

  • Definition: Think of protected as a family secret. Only you and your children know about it.
  • Example: Imagine you have a special recipe that you share only with your children. They can use it, but no one outside your family can.

Internal

  • Definition: Consider internal like company confidential information. Everyone in the company can see it, but no one outside the company can.
  • Example: Suppose you have an internal company document that all employees can read, but it is not shared with people outside the company.

Protected Internal

  • Definition: This is a combination of both concepts. It's like having a secret that you share with your family and anyone who works at the family business.
  • Example: You have a special recipe (protected) that you share with your children and also with any employees (internal) in your family-run restaurant.

Summary

  • Protected: Shared only within the family (you and your children).
  • Internal: Shared within the company (any employee).
  • Protected Internal: Shared with both family members and company employees.

Thursday, May 9, 2024

Process with an Id of #### is not running" in Visual Studio 2013 or etc

 The error message “Process with an Id of #### is not running” in Visual Studio can be quite frustrating, but there are several steps you can take to resolve it. Here are some solutions you can try:

  1. Delete the Hidden .vs Folder:

    • Close Visual Studio.
    • Navigate to the folder where your solution files are stored and delete the hidden .vs folder.
    • Restart Visual Studio.
    • Hit F5, and IIS Express should load as normal, allowing you to debug.
    • Note that this problem seems to be caused by moving a project between workstations, environments, or different versions of Visual Studio. The .vs folder may contain environment-specific information
  2. Edit the Project File:

    • Open Visual Studio as an administrator.
    • Right-click your project and select “Unload Project.”
    • Again, right-click your project and choose “Edit PROJECT_NAME.csproj.”
    • Find the following code and delete it:
      XML
      <DevelopmentServerPort>63366</DevelopmentServerPort>
      <DevelopmentServerVPath>/</DevelopmentServerVPath>
      <IISUrl>http://localhost:63366/</IISUrl>
      
    • Save and close the .csproj file.
    • Right-click your project and reload it1.
  3. Restart IIS Express:

    • Stop the application.
    • Make sure no other ASP.NET or Web API applications are running. If they are, stop them as well.
    • Open the Run dialog by pressing Windows Key + R.
    • Type iisreset in the textbox and press OK.
    • A command prompt window might open and perform some background processing. .
  4. Additional Solutions:

    • Delete the IIS folder with the following command:
      rmdir /s /q "%userprofile%\Documents\IISExpress"
      
    • Delete the .vsConfig folder in your Visual Studio instance.
    • Relaunch Visual Studio as an Administrator so that the necessary files can be rebuilt.

Tuesday, May 7, 2024

kill datebase session id

Use master

SELECT session_id, login_name, host_name, program_name

FROM sys.dm_exec_sessions

WHERE database_id = DB_ID('yourdatabasename');


KILL seesion Id(SSID);

Thursday, May 2, 2024

Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property.

 public ActionResult GetDocumentCompData(string docId)

         {

             SessionValues sessionValues = new GetSessionValues();

             try

             {

                 ResponseModel response = ApiCalls.Get(GetApiUrls.GetDocumentInfo + "?documentId=" + docId);


                 if (response != null && response.Data != null)

                 {

                     DocumentsModel retval = JsonConvert.DeserializeObject<DocumentsModel>(response.Data.ToString());

                     retval.FileName = Path.GetFileName(retval.FileLocation);


                     // Serialize the DocumentsModel object to JSON and stream it directly to the response

                     var serializer = JsonSerializer.CreateDefault();

                     Response.BufferOutput = false; // Disable buffering to stream content

                     Response.ContentType = "application/json";


                     using (var streamWriter = new StreamWriter(Response.OutputStream))

                     using (var jsonWriter = new JsonTextWriter(streamWriter))

                     {

                         serializer.Serialize(jsonWriter, new { Data = retval, Message = response.Message, Status = response.Status });

                     }


                     // Ensure the response is complete

                     Response.Flush();

                     return new EmptyResult(); // Return an EmptyResult to indicate that the action has completed

                 }

             }

             catch (Exception e)

             {

                 bool rethrow = CommonException.HandleException(e, Enums_Constants.ControllerPolicy);

                 if (rethrow)

                     throw;

             }

             return Json("", JsonRequestBehavior.AllowGet);

         }