Posts

Showing posts from December, 2018

Insert a record and return Auto generated Primary key of the table using Stored procedure?

CREATE PROCEDURE [SampleReturnID] (          @EmployeeName varchar(50),       @id int output ) AS   BEGIN             INSERT INTO  Sample(Name )  VALUES (@EmployeeName )             SET @id=SCOPE_IDENTITY()       RETURN  @id   END

Write a Program for Prime string or Not?

public bool VerifyPrimeString(string str) {     int len = str.Length, n = 0;     for (int i = 0; i < len; i++)     {         n += (int)str[i];     }     if (n <= 1)     {         return false;     }     if (n <= 3)     {         return true;     }       if (n % 2 == 0 || n % 3 == 0)     {         return false;     }       for (int i = 5; i * i <= n; i = i + 6)     {         if (n % i == 0 || n % (i + 2) == 0)         {             return false;         }     }      return true; }   Use case : var result = VerifyPrimeString("Sreenivas");

Angular NgIf Show / hide

@Component({   selector: 'ng-if-simple',   template: `     <button (click)="show = !show">{{show ? 'hide' : 'show'}}</button>     show = {{show}}     <br>     <div *ngIf="show">Text to show</div> ` }) class NgIfSimple {   show: boolean = true; }

Display Top 5 and Last 5 Record from a user Entity using Linq using C#

User  Table: ========= Create Table User ( Id int Identity(1,1) Primary Key, Name Nvarchar(100) null ); insert into User values("Sreenivas")("Sreenivasulu"); IN SQL Server  script: ================ Select Top 5 * from Users order by Name      --   Top 5 Select Top 5 * from Users order by Name desc -- Last 5 In LINQ Query: ============ _Context.Users.OrderBy(a=>a.Name).Take(5);  --   Top 5  _Context.Users.OrderByDecending(a=>a.Name).Take(5); -- Last 5

Write a Program for Palindrome using c#

The below code: public Class PalindromeClass {     Public bool IsPalindrome(string inputValue)     {             int number=0;             int reminder=0;             int summation = 0;             int temp =0;             number = Convert.ToInt32(inputValue);             temp = number;             while (number > 0) {                        reminder = number % 10;                        number = number / 10;                        summation = summation * 10 + reminder;                          ...

Chat bot implementation with LUIS AI

First we need to install  Bot Framework Emulator    Install :::>    https://github.com/Microsoft/BotFramework-Emulator/releases/download/v3.5.37/botframework-emulator-3.5.37-windows-setup.exe 2. Configure LUIS app  https://luis.ai/       Create an Application in Luis         Create Intents        Each intent inside at least, we need to create one Phrase        Create Entities and train Your bot application in LUIS.   upload Luis sample json { "query" : "Upcomming movie" , "topScoringIntent" : { "intent" : "Hero" , "score" : 0.921233 }, "entities" : [ { "entity" : "ReleaseDate" , "type" : "Date" , "startIndex" : 10 , "endIndex" : 13 , "score" : 0.7615982 } ] } Or use this link to configure https://docs.microsoft.com/en-us/azure/cognitive-services/luis/luis-get-started-create-app Next Step: for all Applications : ==========...