## python – Executes the append, pop, popleft, and appendleft methods on an empty deque

A Deque is a queue with two ends. It can be used to add or remove elements at both ends.

Deques support thread-safe, space-efficient attachments and burst from both sides of the Deque with roughly the same

``````from collections import deque
d = deque()
for _ in range(int(input())):
cmd, *args = input().split()
#getattr(d, cmd)(*args)
getattr(d, command)(*map(int, args))
print(*d)
#(print(x, end=' ') for x in d)
``````

Input (stdin)

``````6
append 1
append 2
append 3
appendleft 4
pop
popleft
``````

out

``````1 2
``````

## Web Development – What is the need for HTTP methods like get, post etc. in the HTTP protocol?

Can not we just implement the HTTP protocol with Request Body and Response Body? For example, the URL contains a request associated with a function that depends on the server-side programming language, e.g. A servlet, and an HTML / Java script response is sent in response. What is really the need for HTTP methods?

## What are best bookmarking methods?

I'm creating a social sharing bookmark and a button that allows users to share a link with optional text.

Which structure is more recommended to use?

these:

http://www.example.com/?share=http://www.example.net&text=hello

or with a folder:

http://www.example.com/share/?url=http://www.example.net&text=hello

(Or a very different one?)

## PHP Soap needs to read WSD and XSD files to load methods

I want to know how to use php to connect to a web service in soap to get hold of methods with getFunctions, or in some way need a file. If no such file exists, the methods are not returned.
As far as I know, I have to send this file sometime from SoapClient.

## Numeric Integration – NIntegrate does not converge, although it tried to use other methods

I have the following Greensche function, which I try to evaluate for several different values ​​on a defined network. The Mesh and Green functions are defined below. The network ranges from -w / 2 to w / 2.

``````n = 100
w = 1*10^-4;
(CapitalDelta) = w/n;
L = 30*10^-7;
p = L/w;

y(i_) := Piecewise({{-(w/2) + (CapitalDelta)/
2 + (i - 1)*(CapitalDelta),
1 <= i <= n - 1}, {w/2 - (CapitalDelta)/2, i >= n}}, 0)
swv = Table(y(i), {i, n});
mesh = Table(Abs(y(1) - y(j)), {j, n});
x(i_) := mesh((i))

Gxx(s_, k_?NumericQ) := NIntegrate((( t^2 ((s)^2 + t^2 + p^2) - p^2 (s)^2)/(
Sqrt((s)^2 + t^2 + p^2) ((s)^2 + t^2)^2) -
t^2/(Sqrt((s)^2 + t^2))^3) Cos(k t)/((Pi) p) , {t,  0, (Infinity)}, Method -> {"GlobalAdaptive", "SymbolicProcessing" -> 0})
``````

s takes the values ​​of x (i). The k parameter is the wavenumber physically and I'm interested in its values ​​down to the order of 10 ^ 5. I've tried to fit the method into Nintegrate, and it does not help much in convergence. Any ideas?

## c # – "An object reference is required for non-static fields, methods, or properties" in this string

I have this code below, but I still get an error message in Visual Studio "Object reference is required for non-static fields, methods, or properties." I'm trying to create a string in a class file that will eventually use a file path specified by the driver to open a .txt file. And help would be very grateful, I'm not exactly sure why I get this error.

``````string stext = string.Split(new string() { "!", ".", "?" }, StringSplitOptions.None).ToList;
``````

## Numerical Methods – IEEE Single Precision Anomaly Example

This was taught to me in a lecture on the IEEE standard for floating-point numbers $$0$$ and $$-0$$ are two different representations for the same number $$0$$, but $$infty$$ and $$– infty$$ are two different numbers. We have also been taught that a positive number is shared $$0$$ returns $$infty$$ while a positive number divided by $$-0$$ returns $$– infty$$,

If we consider the following two predicates in a numerical calculation software such as MATLAB,

$$0 == 0$$ and $$1/0 == 1 / (- 0)$$
The first returns true, while the second returns false.

I was wondering if there are some other scenarios in which we would have the predicates $$a == b$$ and $$1 / a == 1 / b$$ to return the opposite results (one is true while the other is wrong).

## Purpose of unit testing simple methods

You do not have to test with the finest possible grain.

Many current discussions of unit testing are based on a tradition (XP) in which functions are added incrementally, In other words, almost everything starts as a "simple" function, and many of these simple functions become more complex over time.

From this point of view, it makes sense to perform tests for simple functions.

But … we ideally do not test functions, but behaviors. It is not necessarily important to us how a particular behavior is achieved. If we reduce the coupling to the implementation details, these details can be changed more easily.

In other words, if we take a well-tested module and extract a simple method from it, we do not necessarily have to run and do a bunch of new tests for that module – the behavior we're interested in is already covered by this. We have tests for the code calling the new function.

In the case you describe, you actually go the other way (which is fine); After extracting simple functions everywhere, you have the code that is trivial. From a design point of view, this is great – trivial code is really easy to understand.

Hoare wrote code that is "so simple that obviously there are no shortcomings". In a tdd approach, we tend to work on designs that isolate code that is being tested (for example, I / O) in modules that fail too easily, and ensure that the complicated logic exists in easy-to-test components.

That is, choosing between two alternatives based on a Boolean condition is not really expensive to test, so the resulting design usually arrives at a point where the logic works is measured by a "unit test".

But the subject of this test would probably have a larger grain size than a single if condition.

I can only test if I test the current implementation

Let me try a slightly different way of writing: Yes, we are currently testing an implementation. Running the test will observe the behavior of the current implementation and then check if this behavior meets the documented constraint.

We measure the implementation by a restriction of the behavior.

If I run the zoo, maybe we have a test that looks something like this:

``````opening_a_menu_also_selects_that_menu() {
// Arrange?
// Act
selected = isSelected(id)
// Assert
assert selected
}
``````

The test does not care if `OpenMenu` is a single monolithic method, or if it delegates the work to smaller parts. It is absolutely not a "how" as long as the required API is provided and a satisfactory result is achieved.

## typescript – Parameters for methods with Angular 8 services

I want to use a function to animate an image by clicking the bounce () icon. These icons are reflected in an Angular service, where the path of each icon is located. I've managed to create the animation right now, but it affects all the icons, and I want you to individually animate them.

How can I pass a parameter to the function in the HTML document so that only one of the icons is animated instead of all at the same time?

HTML:

``````

``````

TS:

``````export class AboutComponent implements OnInit {

// tslint:disable-next-line:variable-name
private activatedRoute: ActivatedRoute,
private router: Router) {

this.activatedRoute.params.subscribe( params => {
console.log(params);
});
}

currentState = 'normal';

/* Here i call the AboutService */

ngOnInit() {
}

/* this function do that the hobbies icons bounce when the mouse will be over. Then, the currentState var will come back to the original state in 1.5 seconds */

bounce() {

this.currentState = this.currentState === 'normal' ? '*' : 'normal';
setTimeout(() => {
this.currentState = 'normal';
}, 1500);

}

}
``````

## python – Error calling two methods of the same class in & # 39; if-else & # 39; (Too many positional arguments for the class method callpylint (too-many-function-args))

I have the following code:

``````def escolherProximaAcao(self):
``````Too many positional arguments for classmethod callpylint(too-many-function-args)