Programming Articles

Page 2535 of 2546

What are repeating character classes used in Python regular expression?

Rajendra Dharmkar
Rajendra Dharmkar
Updated on 30-Jul-2019 593 Views

A character class followed by operators like '?', '*' or '+' are called repeating character classes.If you repeat a character class by using the '?', '*' or '+' operators, you will repeat the entire character class, and not just the character that it matched. The regex '[0-9]+' can match '579' as well as '333'. If you want to repeat the matched character, rather than the class, you will need to use backreferences. '([0- 9])\1+' will match '333' but not “579”. When applied to the string “922226”, it will match '2222' in the middle of this string. If you do not ...

Read More

What's the difference between lists and tuples in Python?

Malhar Lathkar
Malhar Lathkar
Updated on 30-Jul-2019 688 Views

List and Tuple are called as sequence data types of Python. Objects of both types are comma separated collection of items not necessarily of same type. However, main difference between list and tuple is that list object is mutable whereas tuple object is immutable. Immutable object can not be modified once it is created in memory. Hence it is not possible to add, modify or remove item from tuple object. On the other hand these operations can be performed on a list.

Read More

How to concatenate byte array in java?

mkotla
mkotla
Updated on 30-Jul-2019 3K+ Views

You ByteArrayOutputStream to write byte arrays and get the result using its toByteArray() method.import java.io.ByteArrayOutputStream; import java.io.IOException; public class Tester { public static void main(String[] args) throws IOException { byte[] a = { 1,2,3}; byte[] b = { 4,5,6}; ByteArrayOutputStream baos = new ByteArrayOutputStream(); baos.write(a); baos.write(b); byte[] c = baos.toByteArray(); for(int i=0; i< c.length ; i++){ System.out.print(c[i] +" "); } } }Output1 2 3 4 5 6

Read More

What Content-type is required to write Python CGI program?

Rajendra Dharmkar
Rajendra Dharmkar
Updated on 30-Jul-2019 398 Views

If we run simple scripts like hello.py, its output is written on the STDOUT file, i.e., screen. There is one important and extra feature available which is the first line to be printed Content-type:text/html\r\r. This line is sent back to the browser and it specifies the content type to be displayed on the browser screen.We can write advanced CGI programs using Python. This script can interact with any other external system and even exchange information with RDBMS.

Read More

What does 'using namespace std' mean in C++?

Moumita
Moumita
Updated on 30-Jul-2019 12K+ Views

Consider a situation, when we have two persons with the same name, Piyush, in the same class. Whenever we need to differentiate them definitely we would have to use some additional information along with their name, like either the area, if they live in a different area or their mother’s or father’s name, etc.The same situation can arise in your C++ applications. For example, you might be writing some code that has a function called xyz() and there is another library available which is also having same function xyz(). Now the compiler has no way of knowing which version of ...

Read More

How do cookies work in Python CGI Programming?

Rajendra Dharmkar
Rajendra Dharmkar
Updated on 30-Jul-2019 640 Views

Using Cookies in CGIHTTP protocol is a stateless protocol. For a commercial website, it is required to maintain session information among different pages. For example, one user registration ends after completing many pages. How to maintain user's session information across all the web pages?In many situations, using cookies is the most efficient method of remembering and tracking preferences, purchases, commissions, and other information required for better visitor experience or site statistics.How Cookies workYour server sends some data to the visitor's browser in the form of a cookie. The browser may accept the cookie. If it does, it is stored as ...

Read More

Why java is both compiled and interpreted language.

Jai Janardhan
Jai Janardhan
Updated on 30-Jul-2019 907 Views

Yes, a java program is first compiled into bytecode which JRE can understand. ByteCode is then interpreted by the JVM making it as interpreted language.

Read More

C++11 Features Supported by Intel

Priya Pallavi
Priya Pallavi
Updated on 30-Jul-2019 208 Views

The C++11 features supported by Intel are available as an official guide in their docs. You can check these features out on https://software.intel.com/en-us/articles/c0x-features-supported-by-intel-c-compiler.

Read More

What is the difference between __str__ and __repr__ in Python?

Pythonic
Pythonic
Updated on 30-Jul-2019 298 Views

The built-in functions repr() and str() respectively call object.__repr__(self) and object.__str__(self) methods. First function computes official representation of the object, while second returns informal representation of the object. Result of both functions is same for integer object. >>> x = 1 >>> repr(x) '1' >>> str(x) '1' However, it is not the case for string object. >>> x = "Hello" >>> repr(x) "'Hello'" >>> str(x) 'Hello' Return value of repr() of a string object can be evaluated by eval() function and results in valid string object. However, result of str() can not be evaluated. ...

Read More

Regex named groups in Java

George John
George John
Updated on 30-Jul-2019 333 Views

Java Regex Capturing Groups

Read More
Showing 25341–25350 of 25,451 articles
Advertisements