Posts

Redis Cache Implementation

PRE-REQUISITES:- 1.)  Install Redis For Local using Below Link:-  https://github.com/microsoftarchive/redis/releases/download/win-3.2.100/Redis-x64-3.2.100.msi 2.) Redis access for a particular port in Local:- i.e, 127.0.0.1:6379 3.) Configure Redis and Start using the service.  CODE:- [Route("api/[controller]")] [ApiController] public class SearchController : ControllerBase {     private readonly ConnectionMultiplexer _redis;     private readonly IConfiguration _configuration;     private readonly EmailSettings _emailSettings;     public SearchController(IConfiguration configuration, IOptions<EmailSettings> emailSettings)     {         _redis = ConnectionMultiplexer.Connect(configuration["RedisDb"]);         _configuration = configuration;         _emailSettings = emailSettings.Value;     }     [HttpPost("get-search-history-by-word")] ...

Audio to Text Detection

  [HttpPost("convertBase64ToText")] public IActionResult ConvertBase64ToText([FromBody] string base64Audio) {     try     {         // Decode Base64 to raw audio data         byte[] audioBytes = Convert.FromBase64String(base64Audio);         string text = "";         if (IsMp3HeaderPresent(audioBytes))         {             byte[] wavData = ConvertMp3ToWav(audioBytes);             text = RecognizeSpeech(wavData);         }         else if (IsWavHeaderPresent(audioBytes))         {             text = RecognizeSpeech(audioBytes);         }         else          {             return BadRequest("File Format is Not Supported"); ...

Grid View Paging

  Grid View paging- Grid view paging is used when we have to read the data in bulk then we divide the complete data records into pages consists 10 records in one page. SqlDataAdapter - It is used for Grid View Paging Data Adapter reads data in group of 10 records unlike DataReader which reads the data line by line. DataSet - DataSet Object is created, it accepts the data in bulk. Fill() - Fill() is used. CODE - protected void display() { //Connection Code string s = ConfigurationManager.AppSettings["db"]; cn = new SqlConnection(s); cn.Open(); //DataSet Object DataSet ds = new DataSet(); string s = "select * from Videodb"; //SqlDataAdapter object SqlDataReader adp = new SqlDataAdapter(); adp.Fill(ds); GridView1.DataSoruce = ds; GridView1.DataBind(); } Source code-   <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"              Height="589px" Width="483px" OnPageIndexChanging="click...

UnEditable TextBox (For Security)

   <asp:TextBox ID="someId" runat="server" oncopy="return false" onpaste="return false" oncut="return false" ondelete="return false" Text="hi"></asp:TextBox> Note:- A textbox will be appeared in the screen on which you can not do any operation wheather  it is to copy the data , cut the data, paste the data and delete the data  - this is used for security purposes.

Sending Image Through Mail in dot net

Method 1: Sending mail by directly giving the link in src:- protected void mail_send(object sender, EventArgs e)     {         connectdb();         string q = "select img from wedding_regdb where userid='" + TextBox1.Text + "'";         cm = new SqlCommand(q, cn);         dr = cm.ExecuteReader();         if (dr.Read())         {                          GridViewRow gr1 = ((Button)sender).NamingContainer as GridViewRow;             Button b2 = (Button)gr1.FindControl("mailbtn");             SmtpClient sm = new SmtpClient("student-cell.com", 25);             sm.Credentials = new System.Net.NetworkCredential("contact@student-cell.com", "password");             sm.DeliveryMethod =...

API for whatsapp

        Response.Redirect("https://api.whatsapp.com/send?phone=+91" + TextBox1.Text + "&text=" + TextBox2.Text);

Final Project

Image
Registration form project   CODING- using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data.SqlClient; using System.Configuration; public partial class RegPage : System.Web.UI.Page {     SqlConnection cn;     SqlCommand cm;     SqlDataReader dr;     FinalClass fc = new FinalClass();     protected void Page_Load(object sender, EventArgs e)     {         if (!IsPostBack)         {             statedisplay();         }     }     protected void connect()     {         string s = ConfigurationManager.AppSettings["Ch_Db"];         cn = new SqlConnection(s);         cn.Open();          }     protected void statedisplay...