Signup/Sign In

Answers

All questions must be answered. Here are the Answers given by this user in the Forum.

The : hover is the part of the selector, not CSS rules.
Inline styles only have rules. the selector is implicit to be the current element.

The selector is an expressive language that describes a set of criteria to match elements in an XML-like document.

However, you can get close, because a style set can technically go almost anywhere:
***


hello

***
4 years ago
HTML 5 has history.pushState() which will modify history entries.
***
function changeurl(url, title) {
var new_url = '/' + url;
window.history.pushState('data', title, new_url);

}
***
4 years ago
The errors occur when JVM fails to load the main class
The reasons can be:
The class has been declared with the wrong package.
Dependencies missing from the CLASSPATH.
The wrong directory is on the CLASSPATH.
The CLASSPATH of the application is incorrectly specified.
4 years ago
To open file *with open('file_sample.txt', 'rb')* is used. *rb* is used to read the file in binary mode. It means the data is read in form of bytes. But the string is used to split byte objects which is wrong.
To solve this add prefix the string with b
**
split_line = tmp.split(b';') # Added the b prefix
**
This converts the string to byte, So type matches.
4 years ago
Unlike other languages like Java and C++ where curly braces are used for representing a block of code, Python uses indentation to represent a block. The above program is not properly indented. So correct the program.
***
import sys
def Factorial(n): # Return factorial
result = 1
for i in range (1,n):
result = result * I
print "factorial is ",result
return result

***
4 years ago
This error occurs when there is a problem in loading jquery files .
The reasons maybe
JQuery plugins are included before the jQuery file. so always include the jquery.js file before jquery plugins.
**



**
The second reason can be the incorrect path used in jQuery. So check the path used in JQuery.
4 years ago
To iterate over JSON structure use
***
var arr = [ {"id":"10", "class": "child-of-9"}, {"id":"11", "class": "child-of-10"}];

for (var i = 0; i < arr.length; i++){
document.write("

array index: " + i);
var obj = arr[i];
for (var key in obj){
var value = obj[key];
document.write("
- " + key + ": " + value);
}
}
***
4 years ago
To break out of the nested loop in Java use a labeled break statement.
***
class LabeledBreak {
public static void main(String[] args) {

// name the loop as first
first:
for( int i = 1; i < 10; i++) {

// name the loop as second
second:
for(int j = 1; j < 5; j ++ ) {
System.out.println("i = " + i + "; j = " +j);


if ( i == 3)
break first;
}
}
}
}

***

In the above example break first is used to terminate the loop and control goes to the line after first loop.
4 years ago
There iterate of dictionary in C# use
***
foreach (KeyValuePair item in myDictionary)
{
MessageBox.Show(item.Key + " " + item.Value);
}
***
We can also use loops as sometime we need to keep track of counter values.
***
for (int count = 0; count < myDictionary.Count; count++)
{
var element = myDictionary.ElementAt(count);
var Key = element.Key;
var Value = element.Value;
MessageBox.Show(Key + " " + Value);
}

***
4 years ago
Big -O notation is an Asymptotic Notation for the worst case or ceiling of growth for a given function. It provides us with an asymptotic upper bound for the growth rate of the runtime of an algorithm.
for example
Worst-case time complexity of linear search is O(n).
4 years ago
One of the ways to vertically align text is by using flexbox.
.center {
display: flex;
justify-content: center;
align-items: center;
height: 200px;
border: 3px solid green;
}

Hello world


4 years ago
To copy input stream to string use Apache commons IOUtils.

StringWriter writer = new StringWriter();
IOUtils.copy(inputStream, writer, encoding);
String theString = writer.toString();
4 years ago