Samual Sam has Published 2663 Articles

How to find a matching substring using regular expression in C#?

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:23

1K+ Views

Our string is − string str = " My make "; Use the following regular expression to find the substring “make” @"\bmake\b" Here is the complete code − Example Live Demo using System; using System.Text.RegularExpressions; namespace RegExApplication { public class ... Read More

Database Operations in C#

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:23

1K+ Views

The most common databases used in C# are Microsoft SQL Server and Oracle. The following is done to work with databases. Connect Set the Database Name, Optional Parameters and Credentials. The username and password is needed to set a connection to the database. The connection string would look somewhat like ... Read More

SequenceMatcher in Python for Longest Common Substring.

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:23

730 Views

Given two strings, our task is to print the longest common sub-string. We will solve problem in python using SequenceMatcher.find_longest_match () method. Class difflib.SequenceMatcher is a flexible class for comparing pairs of sequences of any type, so long as the sequence elements are hashable. find_longest_match(a, x, b, y) Find ... Read More

array_flip() function in PHP

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:23

81 Views

The array_flip() function exchanges all keys with their associated values in an array. It returns flipped array on success, else NULL on failure. Syntax array_flip(arr) Parameters arr − Specify the array of key/value pairs to be flipped. Return The array_flip() function returns flipped array on success, ... Read More

Cohesion in C#

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:23

1K+ Views

Cohesion in C# shows the relationship within modules. It shows the functional strength of the modules. The greater the cohesion, the better will be the program design. It is the dependency between the modules internal elements like methods and internal modules. High cohesion will allow you to reuse classes and ... Read More

array_intersect_assoc() function in PHP

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:23

32 Views

The array_intersect_assoc() function compares array values, and returns the matches. Syntax array_intersect_assoc(arr1, arr2, arr3, arr4, …) Parameters arr1 − Array to compare from. Required. arr2 − Array to compare against. Required. arr3 − You can add more arrays to compare. Optional. arr4 − You can add ... Read More

Python program to check if binary representation is palindrome?

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:23

590 Views

Here we use different python inbuilt function. First we use bin() for converting number into it’s binary for, then reverse the binary form of string and compare with originals, if match then palindrome otherwise not. Example Input: 5 Output: palindrome Explanation Binary representation of 5 is 101 Reverse ... Read More

Python program to Display Hostname and IP address?

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:23

1K+ Views

Python provides gethostname(), gethostbyname() two function. gethostname() retrives the standard host name for the local machine. gethostbyname() retrives host information corresponding to a host name from a host database. Socket. gethostname() Socket. gethostbyname() Algorithm Step 1: use module socket. Step 2: use gethostname() retrives the standard host ... Read More

How to optimize nested if...elif...else in Python?

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:22

1K+ Views

Here are some of the steps that you can follow to optimize a nested if...elif...else.1. Ensure that the path that'll be taken most is near the top. This ensures that not multiple conditions are needed to be checked on the most executed path.2. Similarly, sort the paths by most use ... Read More

CSS media types

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:22

128 Views

The following are the media types in CSS:S.noValue & Description1.AllSuitable for all devices.2.AuralIntended for speech synthesizers.3.BrailleIntended for braille tactile feedback devices.4.EmbossedIntended for paged braille printers.5.HandheldIntended for handheld devices (typically small screen, monochrome, limited bandwidth).6.PrintIntended for paged, opaque material and for documents viewed on screen in print preview mode. Please consult ... Read More

Advertisements