Arnab Chakraborty

Arnab Chakraborty

29 Articles Published

Articles by Arnab Chakraborty

Page 2 of 3

How to disable/enable an input box with jQuery?

Arnab Chakraborty
Arnab Chakraborty
Updated on 13-Mar-2026 18K+ Views

We can easily disable input boxes (textbox, textarea) using the disabled attribute. When an input element is disabled, users cannot interact with it, and it won't be included in form submissions. Using attr() and removeAttr() Methods To disable an input element − $('elementname').attr('disabled', 'disabled'); To enable a disabled element, we need to remove the "disabled" attribute from the element − $('elementname').removeAttr('disabled'); Using prop() Method (Recommended) jQuery also provides the prop() method which is recommended for boolean attributes like disabled − // To disable $('elementname').prop('disabled', true); // ...

Read More

How can I get the ID of an DOM element using jQuery?

Arnab Chakraborty
Arnab Chakraborty
Updated on 13-Mar-2026 782 Views

In jQuery, the attr() method is used to get the id attribute of the first matching element. This method allows you to retrieve any attribute value from a DOM element. Syntax The basic syntax to get an element's ID using jQuery is − $(selector).attr("id") Where selector is the jQuery selector that identifies the element whose ID you want to retrieve. Example Here's a complete example that demonstrates how to get the ID of a DOM element when a button is clicked − Getting DOM ...

Read More

How to match a line not containing a word in Java Regex

Arnab Chakraborty
Arnab Chakraborty
Updated on 11-Mar-2026 529 Views

Exampleimport java.util.regex.Matcher; import java.util.regex.Pattern; public class NoRegTest {    public static void main(String[] args) {       String s="^fun";       Pattern pattern = Pattern.compile(s);       Matcher matcher = pattern.matcher("Java is fun");       if(!matcher.find()) {          System.out.println("not found");       }    } }Outputnot found

Read More

Java regex to exclude a specific String constant

Arnab Chakraborty
Arnab Chakraborty
Updated on 29-Sep-2024 2K+ Views

In this program, we will use a regular expression to check if a given string does not contain the substring "kk" using Java. The regular expression ^((?!kk).)*$ is designed to match strings that do not include the "kk" pattern anywhere in the string. The program will evaluate a sample string and print whether or not it contains "kk". Problem Statement Write a program in Java for checking whether a given string contains the substring "kk." If the string does not contain "kk" the program will return true otherwise it will return false. Input String s = "tutorials" Output true ...

Read More

How to process a simple form data using Python CGI script?

Arnab Chakraborty
Arnab Chakraborty
Updated on 09-Sep-2023 4K+ Views

Suppose there is an HTML file as below − FirstName: LastName: After submitting this form it should go to a Python page named "getData.py", where you should fetch the data from this HTML page and show. then below is the code for Python CGI. #!C:\Python27\python.exe # Import modules for CGI handling import cgi, cgitb # Create instance of FieldStorage form = cgi.FieldStorage() # Get data from fields first_name = form.getvalue('first_name') last_name  = form.getvalue('last_name') print("Content-type:text/html") print print("") print("") print("Hello - Second CGI Program") print("") print("") print(" ...

Read More

How to test if a Java String contains a case insensitive regex pattern

Arnab Chakraborty
Arnab Chakraborty
Updated on 24-Jun-2020 467 Views

the syntax? i:x makes the string search case-insensitive. for egpublic class RegCaseSense {    public static void main(String[] args) {       String stringSearch = "HI we are at java class.";       // this won't work because the pattern is in upper-case       System.out.println("Try this 1: " + stringSearch.matches(".*CLASS.*"));         // the magic (?i:X) syntax makes this search case-insensitive, so it returns true       System.out.println("Try this 2: " + stringSearch.matches("(?i:.*CLASS.*)"));    } }

Read More

Can someone help me fix this Python Program?

Arnab Chakraborty
Arnab Chakraborty
Updated on 24-Jun-2020 156 Views

The first problem u are getting in the bold portion is due to non-indent block, put one indentation there.second problem is name variable is not definedfollowing is the corrected one -print ("Come-on in. Need help with any bags?") bag=input ('(1) Yes please  (2) Nah, thanks   (3) Ill get em later  TYPE THE NUMBER ONLY') if bag == ('1'): print ("Ok, ill be right there!") if bag == ('2'): print ("Okee, see ya inside. Heh, how rude of me? I'm Daniel by the way, ya?") name="Daniel" print (name + ": Um, Names " + name) print ("Dan: K, nice too ...

Read More

How to use enums in Python classes?

Arnab Chakraborty
Arnab Chakraborty
Updated on 23-Jun-2020 320 Views

There is a module name "enum" in python with the hep of which enum is used in python.#import enum import enum # use enum in class class Car(enum.Enum):    suzuki = 1    Hyundai = 2    Dezire = 3 print ("All the enum values are : ") for c in (Car):    print(c)

Read More

Match all occurrences of a regex in Java

Arnab Chakraborty
Arnab Chakraborty
Updated on 23-Jun-2020 319 Views

public class RegexOccur {    public static void main(String args[]) {       String str = "java is fun so learn java";       String findStr = "java";       int lastIndex = 0;       int count = 0;       while(lastIndex != -1) {          lastIndex = str.indexOf(findStr,lastIndex);          if(lastIndex != -1) {             count ++;             lastIndex += findStr.length();          }       }       System.out.println(count);    } }Output2

Read More

How to send the result of Python CGI script to the browser?

Arnab Chakraborty
Arnab Chakraborty
Updated on 22-Jun-2020 343 Views

# Get data from fields from HTML page first_name = form.getvalue('first_name') last_name  = form.getvalue('last_name') send data to Browser print("Content-type:text/html") print print("") print("") print("Hello - Second CGI Program") print("") print("") print(" Hello %s %s " % (first_name, last_name)) print("") print("")

Read More
Showing 11–20 of 29 articles
Advertisements