<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: bikashgosai</title>
    <description>The latest articles on DEV Community by bikashgosai (@bikashgosai).</description>
    <link>https://dev.to/bikashgosai</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F194147%2F80beeeb6-34f1-4b8f-9ac8-ca19f972400e.jpg</url>
      <title>DEV Community: bikashgosai</title>
      <link>https://dev.to/bikashgosai</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/bikashgosai"/>
    <language>en</language>
    <item>
      <title>Update bulk data in second table's one column based upon first table's another column's data which has multiple condition MSSQL</title>
      <dc:creator>bikashgosai</dc:creator>
      <pubDate>Tue, 04 Apr 2023 09:54:19 +0000</pubDate>
      <link>https://dev.to/bikashgosai/update-bulk-data-in-second-tables-one-column-based-upon-first-tables-another-columns-data-which-has-multiple-condition-mssql-3d9n</link>
      <guid>https://dev.to/bikashgosai/update-bulk-data-in-second-tables-one-column-based-upon-first-tables-another-columns-data-which-has-multiple-condition-mssql-3d9n</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;UPDATE table2
SET column2 = 
  CASE 
    WHEN table1.column1 = 'condition 1' THEN 'new value 1'
    WHEN table1.column1 = 'condition 2' THEN 'new value 2'
    WHEN table1.column1 = 'condition 3' THEN 'new value 3'
    ELSE table2.column2
  END
FROM table2 
JOIN table1 ON table2.some_column = table1.some_column
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>Remove Invalid File uploaded to input type=file in JavaScript</title>
      <dc:creator>bikashgosai</dc:creator>
      <pubDate>Mon, 19 Dec 2022 05:50:30 +0000</pubDate>
      <link>https://dev.to/bikashgosai/remove-invalid-file-uploaded-to-input-typefile-in-javascript-2jn9</link>
      <guid>https://dev.to/bikashgosai/remove-invalid-file-uploaded-to-input-typefile-in-javascript-2jn9</guid>
      <description>&lt;p&gt;Here input parameter is the html element, span is label for filenames.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var readURL = function (input, span) {
    var text = "";
    let fileName = "";
    let isValid = false;
    var files = $(input)[0].files;
    var fileArray = Array.from(files);

    for (var i in files) {
        if ($(files)[i] &amp;amp;&amp;amp; typeof $(files)[i]['name'] != "undefined") {

            fileName = $(files)[i].name;
            isValid = checkFileValidation(fileName);

            response.fileName.push(fileName);
            response.valid.push(isValid);

            if (isValid) {
                text += " " + $(files)[i]['name'];
            }
            else {
                fileArray.splice(i, 1);
            }
        }
    }
    $(input)[0].files = new FileListItems(fileArray);

    if (text == "") {
        text = "Upload";
    }
    $('#' + span).text(text);
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var validFileExtensions = "^.*\.(pdf|jpg|jpeg|gif|png|bmp|doc|docx|ppsx|ppt|pptx|xls|xlsx|7z|zip|rar|csv|txt|rtf|m4a|mp3|mpeg|avi|mpeg4|real|wav|swf|wma|msg)$"
var checkFileValidation = function (fileOrFileName) {
    //Check whether the file is valid file.
    var regex = new RegExp(validFileExtensions);
    if (regex.test(fileOrFileName.toLowerCase())) {
        return true;
    } else {
        return false;
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>react</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Regex that starts with letter, contains 1 uppercase/lowercase letter, one number and no special characters &amp; min 8 characters</title>
      <dc:creator>bikashgosai</dc:creator>
      <pubDate>Wed, 23 Mar 2022 10:38:15 +0000</pubDate>
      <link>https://dev.to/bikashgosai/regex-that-starts-with-letter-contains-1-uppercaselowercase-letter-one-number-and-no-special-characters-min-8-characters-3n35</link>
      <guid>https://dev.to/bikashgosai/regex-that-starts-with-letter-contains-1-uppercaselowercase-letter-one-number-and-no-special-characters-min-8-characters-3n35</guid>
      <description>&lt;p&gt;You need to put the lookaheads after &lt;code&gt;^&lt;/code&gt; and put &lt;code&gt;[a-zA-Z]&lt;/code&gt; right after them and quantify the rest with &lt;code&gt;{8,}&lt;/code&gt;:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;^(?=.*?[a-z])(?=.*?[A-Z])(?=.*?[0-9])[a-zA-Z][a-zA-Z0-9]{8,}$&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Regex that starts with letter, contains 1 uppercase/lowercase letter, one number and special characters &amp;amp; min 8 characters&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;^(?=.*[0-9])(?=.*[!@#$%^&amp;amp;*])[0-9a-zA-Z!@#$%^&amp;amp;*0-9]{8,}$
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;See the regex demo.&lt;br&gt;
&lt;a href="https://regex101.com/r/fGk1AC/1"&gt;https://regex101.com/r/fGk1AC/1&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;&amp;gt; Pattern details:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;^&lt;/code&gt; - start of a string&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;(?=.*?[a-z])&lt;/code&gt; - at least 1 lowercase ASCII letter&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;(?=.*?[A-Z])&lt;/code&gt; - at least 1 uppercase ASCII letter&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;(?=.*?[0-9])&lt;/code&gt; - at least 1 ASCII digit
5.&lt;code&gt;[a-zA-Z]&lt;/code&gt; - an ASCII letter&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;[a-zA-Z0-9]{7,}&lt;/code&gt; - 7 or more ASCII letters or digits (\w also allows _)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;$&lt;/code&gt; - end of string.&lt;/li&gt;
&lt;/ol&gt;

</description>
    </item>
    <item>
      <title>Get Id of recently added record in Linq.</title>
      <dc:creator>bikashgosai</dc:creator>
      <pubDate>Thu, 13 Jan 2022 05:14:22 +0000</pubDate>
      <link>https://dev.to/bikashgosai/get-id-of-recently-added-record-in-linq-3i5o</link>
      <guid>https://dev.to/bikashgosai/get-id-of-recently-added-record-in-linq-3i5o</guid>
      <description>&lt;p&gt;After you commit your object into the db the object receives a value in its ID field.&lt;br&gt;
So:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;myObject.Field1 = "value";

// Db is the datacontext
db.MyObjects.InsertOnSubmit(myObject);
db.SubmitChanges();
//in case of Repository pattern
db.InsertorUpdate(myObject);
db.commit();

// You can retrieve the id from the object
int id = myObject.ID;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>csharp</category>
      <category>beginners</category>
      <category>programming</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>jQuery Validation [Number]</title>
      <dc:creator>bikashgosai</dc:creator>
      <pubDate>Thu, 23 Dec 2021 11:18:38 +0000</pubDate>
      <link>https://dev.to/bikashgosai/jquery-validation-number-2e09</link>
      <guid>https://dev.to/bikashgosai/jquery-validation-number-2e09</guid>
      <description>&lt;p&gt;&lt;strong&gt;Here is simple jQuery validation.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;HTML code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;form id="formId" method="post"&amp;gt;
&amp;lt;div class="body"&amp;gt;
&amp;lt;input class="form-control text-right" type="number" name="fieldName" min="0" max="1000" /&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;div class="footer"&amp;gt;
&amp;lt;button type="button" onclick="clearValidation()" class="btn btn-sm" &amp;gt;Cancel&amp;lt;/button&amp;gt;
&amp;lt;button id="btnSubmit" type="button or submit" class="btn btn-sm"&amp;gt;Submit&amp;lt;/button&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;/form&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Put this code on document ready.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$("#formId").validate({
        rules: {
            fieldName: {
                required: true,
                number: true,
                min: 1
            }
        },
        messages: {
            fieldName: {
//Custom messages
                required: "Required",
                min: "Value must be greater than 0"
            }
        }
    });
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Check if fields are valid according to rules defined above:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var form = $("#formId");
    if (form.valid()) {
        //do something...
    }
else
{
return;
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is code for removing validation on form.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
function clearValidation() {
    var form = $("#formId").validate();
    form.resetForm();
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>javascript</category>
      <category>validation</category>
      <category>beginners</category>
      <category>programming</category>
    </item>
    <item>
      <title>How to get current time zone in JavaScript</title>
      <dc:creator>bikashgosai</dc:creator>
      <pubDate>Tue, 07 Dec 2021 07:07:57 +0000</pubDate>
      <link>https://dev.to/bikashgosai/how-to-get-current-time-zone-in-javascript-p62</link>
      <guid>https://dev.to/bikashgosai/how-to-get-current-time-zone-in-javascript-p62</guid>
      <description>&lt;p&gt;To get the current browser's time zone, you can use the &lt;code&gt;getTimezoneOffset()&lt;/code&gt; method from the JavaScript Date object.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;getTimezoneOffset()&lt;/code&gt; returns the time difference, in minutes, between UTC time and local time. The returned value is positive if the local time zone is behind UTC and negative if the local time zone is ahead of UTC.&lt;/p&gt;

&lt;p&gt;For example, if your time zone is UTC+5:45, the &lt;code&gt;getTimezoneOffset()&lt;/code&gt; method will return -345 minutes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
const date = new Date();
const offset = date.getTimezoneOffset();
console.log(offset);    // -345
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;getTimezoneOffset()&lt;/code&gt; works in all modern browsers, Internet Explorer 5 and higher.&lt;/p&gt;

</description>
      <category>javascript</category>
    </item>
    <item>
      <title>Select the first value of DropDown List using jQuery.</title>
      <dc:creator>bikashgosai</dc:creator>
      <pubDate>Mon, 06 Dec 2021 06:26:38 +0000</pubDate>
      <link>https://dev.to/bikashgosai/select-the-first-value-of-dropdown-list-using-jquery-25fo</link>
      <guid>https://dev.to/bikashgosai/select-the-first-value-of-dropdown-list-using-jquery-25fo</guid>
      <description>&lt;p&gt;&lt;strong&gt;There are mostly 3 ways:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;$("#target").val("thevalue");&lt;/code&gt;&lt;br&gt;
&lt;em&gt;Just make sure the value in the options tags matches the value in the val method.&lt;/em&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;$("#target").val($("#target option:first").val());&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;$("#target").prop("selectedIndex", 0);&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>javascript</category>
      <category>jquery</category>
    </item>
    <item>
      <title>Reflection</title>
      <dc:creator>bikashgosai</dc:creator>
      <pubDate>Thu, 08 Apr 2021 14:52:40 +0000</pubDate>
      <link>https://dev.to/bikashgosai/reflection-1fj7</link>
      <guid>https://dev.to/bikashgosai/reflection-1fj7</guid>
      <description>&lt;p&gt;Reflection objects are used for obtaining type information at runtime. The classes that give access to the metadata of a running program are in the &lt;code&gt;System.Reflection&lt;/code&gt; namespace.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;System.Reflection&lt;/code&gt; namespace contains classes that allow you to obtain information about the application and to dynamically add types, values, and objects to the application.&lt;/p&gt;

&lt;p&gt;Applications of Reflection&lt;br&gt;
Reflection has the following applications −&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;It allows view attribute information at runtime.&lt;br&gt;
It allows examining various types in an assembly and instantiate these types.&lt;br&gt;
It allows late binding to methods and properties&lt;br&gt;
It allows creating new types at runtime and then performs some tasks using those types.&lt;br&gt;
&lt;/p&gt;


&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// C# program to illustrate
// the use of Reflection
using System;
using System.Reflection;

namespace Reflection_Metadata {

// Define a class Student
class Student {

    // Properties definition
    public int RollNo
    {
        get;
        set;
    }

    public string Name
    {
        get;
        set;
    }

    // No Argument Constructor
    public Student()
    {
        RollNo = 0;
        Name = string.Empty;
    }

    // Parameterised Constructor
    public Student(int rno, string n)
    {
        RollNo = rno;
        Name = n;
    }

    // Method to Display Student Data
    public void displayData()
    {
        Console.WriteLine("Roll Number : {0}", RollNo);
        Console.WriteLine("Name : {0}", Name);
    }
}

class Reflect {

    // Main Method
    static void Main(string[] args)
    {
        // Declare Instance of class Assembly
        // Call the GetExecutingAssembly method
        // to load the current assembly
        Assembly executing = Assembly.GetExecutingAssembly();

        // Array to store types of the assembly
        Type[] types = executing.GetTypes();
        foreach(var item in types)
        {
            // Display each type
            Console.WriteLine("Class : {0}", item.Name);

            // Array to store methods
            MethodInfo[] methods = item.GetMethods();
            foreach(var method in methods)
            {
                // Display each method
                Console.WriteLine("--&amp;gt; Method : {0}", method.Name);

                // Array to store parameters
                ParameterInfo[] parameters = method.GetParameters();
                foreach(var arg in parameters)
                {
                    // Display each parameter
                    Console.WriteLine("----&amp;gt; Parameter : {0} Type : {1}",
                                            arg.Name, arg.ParameterType);
                }
            }
        }
    }
}
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Class : Student&lt;br&gt;
--&amp;gt; Method : get_RollNo&lt;br&gt;
--&amp;gt; Method : set_RollNo&lt;br&gt;
----&amp;gt; Parameter : value  Type : &lt;code&gt;System.Int32&lt;/code&gt;&lt;br&gt;
--&amp;gt; Method : get_Name&lt;br&gt;
--&amp;gt; Method : set_Name&lt;br&gt;
----&amp;gt; Parameter : value  Type : &lt;code&gt;System.String&lt;/code&gt;&lt;br&gt;
--&amp;gt; Method : displayData&lt;br&gt;
--&amp;gt; Method : ToString&lt;br&gt;
--&amp;gt; Method : Equals&lt;br&gt;
----&amp;gt; Parameter : obj  Type : &lt;code&gt;System.Object&lt;/code&gt;&lt;br&gt;
--&amp;gt; Method : GetHashCode&lt;br&gt;
--&amp;gt; Method : GetType&lt;/p&gt;

&lt;p&gt;Class : Program&lt;br&gt;
--&amp;gt; Method : ToString&lt;br&gt;
--&amp;gt; Method : Equals&lt;br&gt;
----&amp;gt; Parameter : obj  Type : &lt;code&gt;System.Object&lt;/code&gt;&lt;br&gt;
--&amp;gt; Method : GetHashCode&lt;br&gt;
--&amp;gt; Method : GetType&lt;/p&gt;

</description>
      <category>csharp</category>
      <category>dotnet</category>
    </item>
    <item>
      <title>Search Text in stored procedure in SQL Server</title>
      <dc:creator>bikashgosai</dc:creator>
      <pubDate>Wed, 27 May 2020 11:36:06 +0000</pubDate>
      <link>https://dev.to/bikashgosai/search-text-in-stored-procedure-in-sql-server-1po7</link>
      <guid>https://dev.to/bikashgosai/search-text-in-stored-procedure-in-sql-server-1po7</guid>
      <description>&lt;p&gt;SELECT DISTINCT&lt;br&gt;
       o.name AS Object_Name,&lt;br&gt;
       o.type_desc&lt;br&gt;
  FROM sys.sql_modules m&lt;br&gt;
       INNER JOIN&lt;br&gt;
       sys.objects o&lt;br&gt;
         ON m.object_id = o.object_id&lt;br&gt;
 WHERE m.definition Like '%[ABD]%' ESCAPE '\'&lt;/p&gt;

&lt;p&gt;===============================================================================&lt;br&gt;
Escape the square brackets:&lt;br&gt;
...&lt;br&gt;
WHERE m.definition Like '%[ABD]%' ESCAPE '\'&lt;/p&gt;

&lt;p&gt;Then the square brackets will be treated as a string literals not as wild cards.&lt;/p&gt;

</description>
      <category>sql</category>
    </item>
    <item>
      <title>MS-SQL, LIST FROM TABLE WHOSE VALUE IS REPEATED MORE THAN ONCE.</title>
      <dc:creator>bikashgosai</dc:creator>
      <pubDate>Wed, 31 Jul 2019 09:24:43 +0000</pubDate>
      <link>https://dev.to/bikashgosai/ms-sql-list-from-table-whose-value-is-repeated-more-than-once-4g7d</link>
      <guid>https://dev.to/bikashgosai/ms-sql-list-from-table-whose-value-is-repeated-more-than-once-4g7d</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT 
NAME, EMAIL, COUNT(*) 
FROM 
USERS 
GROUP BY
 NAME, EMAIL
HAVING COUNT(*) &amp;gt; 1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>mssql</category>
      <category>sql</category>
    </item>
  </channel>
</rss>
