Karthikeya Boyini has Published 2680 Articles

array_intersect() function in PHP

karthikeya Boyini

karthikeya Boyini

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

39 Views

The array_intersect() function compares array values, and returns the matches. It returns an array containing all of the values in the first array whose values exist in all of the parameters. Syntax array_intersect(arr1, arr2, arr3, arr4, …) Parameters arr1 − Array to compare from. Required. arr2 ... Read More

array_intersect_key() function in PHP

karthikeya Boyini

karthikeya Boyini

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

48 Views

The array_intersect_key() function compares array keys, and returns the matches. It returns an array containing all of the values in the first array whose values exist in all of the parameters. Syntax array_intersect_key(arr1, arr2, arr3, arr4, …) Parameters arr1 − Array to compare from. Required. arr2 ... Read More

Covariance and Contravariance in C#

karthikeya Boyini

karthikeya Boyini

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

133 Views

To deal with classes effectively, use the concept of covariance and contra variance. Let us consider the following as our class. One is a base class for class Two, whereas Two is a base class for Three. class One { } class Two: One { } class Three ... Read More

Python program to reverse bits of a positive integer number?

karthikeya Boyini

karthikeya Boyini

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

1K+ Views

First convert number into binary using bin() function. Then skip the first two character of binary representation because bin() appends 0b as a prefix in a binary representation of the number and reverse the remaining part. From also character and reverse it till second last character from left. Convert a ... Read More

Plotting graph using seaborn in python.

karthikeya Boyini

karthikeya Boyini

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

265 Views

Plotly's Python graphing library makes interactive, publication-quality graphs online. this graph is mainly used when we want to make line plots, scatter plots, area charts, bar charts, error bars, box plots, histograms, heatmaps, subplots, multiple-axes, polar charts, and bubble charts. Seaborn is a library for making statistical graphics in Python. ... Read More

How to compile unsafe code in C#?

karthikeya Boyini

karthikeya Boyini

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

2K+ Views

For compiling unsafe code, you have to specify the /unsafe command-line switch with command-line compiler. For example, to compile a program named one.cs containing unsafe code, from command line, give the command − csc /unsafe one.cs Under Visual Studio IDE, enable use of unsafe code in the ... Read More

array_merge() function in PHP

karthikeya Boyini

karthikeya Boyini

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

143 Views

The array_merge() function merges one or more arrays into one array. It returns an array in which the elements of all arrays passed in parameters are merged. Note − In case of same keys of two or more array elements, the last one overrides the other. Syntax array_merge(arr1, arr2, ... Read More

How can we speed up Python "in" operator?

karthikeya Boyini

karthikeya Boyini

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

246 Views

The python operator performs very badly in a list, O(n), because it traverses the whole list. You can use something like a set or a dict(hashed data structures that have very fast lookups) to get the same result in ~O(1) time!But this also depends on the type of data structure ... Read More

Using client side XSLT transformations in HTML5

karthikeya Boyini

karthikeya Boyini

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

66 Views

Client-side XSLTProcessor API is part of the HTML5 scripting specification, as stated below:When an XSLT transformation program is triggered by a processing instruction and the browser implements a direct-to-DOM transformation, script elements created by the XSLT processor need to be marked "parser-inserted" and run in document oThe XSLTProcessor.transformToDocument() method adds ... Read More

What are the best practices for using if statements in Python?

karthikeya Boyini

karthikeya Boyini

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

398 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

Advertisements