text:
Q: Why doesn't the voltage increase when batteries are connected in parallel? Can you please explain the thing below?
When we add a battery in circuit then, it gives out some electric field that moves through the circuit and gives a force on electrons in conductor to produce current.
When we connect two batteries parallel with each other in a circuit then the electric fields coming out of both batteries moves through the conductor which should give more flux than before. As there is the double number of fields in the same area. But the voltage doesn't double.
What have I done wrong here?
Are there any increasing flux/electric field magnitude when two batteries are connected parallel in a series?
New Edit: I think I have a got three of the very close answers. Let us think about what is going on on the positive terminal and then we will apply the same to the negative terminals just to make it easy to understand.

*

*"Because the batteries were originally designed for V volts. But on adding batteries in parallel makes a large amount of repulsion in positive terminals that is felt by both batteries and reduces the amount of charge on each terminal which also decreases the voltage of each battery. The total charge of both positive terminals is the same as we get when using battery."

*"But there are people also saying that it depends on concentration of charge not amount of charge"

*"The one another explanation was: first assume that E is the electric field released by each battery, that half of electric field(E/2) from one positive terminal moves toward another positive terminal therefore reducing its half strength and the another half field (E/2) moves in the circuit (not toward the positive terminal) to increase the strength by (E/2), therefore making the total electric in through the resistor = E "

A: If a battery is defined as a device that maintains a constant voltage across its ends, then automatically the problem is solved. When connected in series each battery maintains that constant voltage across its ends and hence they add up. But If connected in parallel, they remain the same by definition.
But this is not an answer unless I explain why the voltage across the ends of a battery remain same.
And for that we need to look inside a battery.
Inside a battery are two Chambers : one which loves to lose electrons and another which loves to gain electrons. And the eagerness to lose or gain electrons is dependent on the concentration of reactants inside each chamber. A more precise statement : Energy gained in moving a charge from one chamber to the other ($~$ voltage) is dependent on the concentration.
The Chambers are as shown in fig 1. When we make a circuit, we are connecting these Chambers together. Electron flows through the external circuit under the potential difference.

when connected in parallel
as you can see from figure, nothing has changed. Two parallel connected chambers is equivalent to the each chamber just becoming large. We now have more chemicals in the cell, but concentration is the same.
So the voltage, which we may define as the energy gained in moving a charge from one chamber to the to the other, remains same.

when connected in series
I hope it is clear already... concentration is still the same. each battery maintains its voltage across it. So total voltage it the sum of individual voltages.

A: Think of this in the water analogy. Wires are represented by canals, the height of the water level is the voltage and the flow rate is the current. A battery, by definition, raises the voltage on one of its terminals by a set amount compared to its other terminal. So in the water analogy it's like a pump that keeps the water level on one end 2 meters higher than at the other end. Here 2 meters is just an arbritary number.
If you connect two batteries in parallel at some point you have to create a junction where 3 wires meet. Any two points in a circuit that are connected by a wire without a resistor in between are at the same voltage. So each of the 3 wires connected to the junction are at the same voltage. In the picture below every part of the wire that is touching point $A$ is at the same voltage and similarly any wire directly connected to point $B$ is at the same voltage. The voltage difference between $A$ and $B$ can be seen as the output voltage of the two batteries combined so that's why the voltage doesn't increase when you combine batteries in parallel.

To see why every part of the wire is at the same voltage we can look at the water analogy. Connecting two wires together is like joining two canals together. If the water level in one of the canals was higher than the other before joining then as soon as they are joined water will start rushing to the part with the lower water level. After everything has settled you are left with one big canal with a water level that's the same everywhere. You can have a voltage difference over components like resistors or batteries. Resistors are comparable to dams which let a small amount of water through and which can have different water levels on either side of it.
Remember that this 'settling' which I mentioned happens extremely quickly in electrical circuits. In water circuits you would be able to see the water settle but in electrical circuit this happens almost instantaneously.
So finally you might ask why is voltage so similar to water height? Voltage is the energy (per charge) in a circuit. So if any part of a wire has a higher voltage than its surroundings it will generate an electric field. This electric field will always act in such a way to rearrange the charges in the wire until the voltage is completely uniform. Similarly to how a higher water level means more potential energy for the water.

A: tl;dr Batteries do not create electric fields to move charges. They move charges, which creates electric fields.

a battery [...] gives out some electric field that moves through the circuit and gives a force on electrons in conductor to produce current.

This description is, if not completely wrong, at least misleading. A battery is not a source of electric field, it is a source of electric potential. Imagine a battery with terminals in the shape of a pair of parallel conductive plates with an air gap in between (this is a capacitor): as you move the plates toward each other, the field strength (between the plates) increases, and as you pull them apart, the field strength decreases. There is no upper limit to how strong the field can be (well, until it reaches the breakdown voltage and begins to arc), and no lower limit either -- the strength of the field is not determined by the battery. So the battery itself does not directly create an electric field between its terminals.
Moreover, electric field does not "move through" a circuit; charges do. In a simple DC setup like a battery driving current through a resistor, all electric fields are stable over time -- the charges move through the circuit, but the field itself does not. Saying that electric field moves through a circuit is a bit like saying that gravity moves through a rollercoaster. Moving electric fields do come into play with AC circuits and devices with moving parts, such as electric motors; but even a non-moving electric field causes charges to move through a conductor (this is, after all, essentially the definition of "conductor").
So how does current work? Batteries are a source of electric potential, which is measured in volts. Potential is a kind of pressure and in a typical battery this pressure is caused by chemical reactions inside the battery pumping electrons from one terminal (+) to the opposite one (-). The potential difference between the terminals does create an electric field. In the experiment above where the terminals of the battery are parallel flat plates separated by a distance $d$, you could calculate the field strength between them as simply $E = {V \over d}$. But the field is just a way of observing the potential difference between the terminals: it's not the reason the charges are moving in the first place (which is, again, the chemical reactions happening inside the battery).
Pressure is relative, and electric potential is no different. To be strictly accurate, what a battery provides is an electric potential difference ("voltage") between its two terminals. This is basically a measurement of how strong an electron-pump the battery has inside it. This is why connecting two identical batteries in parallel does not add their voltages: because they both provide the same potential difference between the (+) and (-) terminals, there is essentially no difference between two batteries connected in parallel and two isolated, disconnected batteries. The electric potential between the (+) terminals and (-) terminals is the same, and both batteries "agree" on it, so there is no reason for current to flow between them. (Connecting two mismatched batteries in parallel will cause current to flow, in a direction determined by which battery has higher voltage.)
What connecting two batteries in parallel does do is change how the system behaves when under load. If you connect a load, say a 1kΩ resistor, across the terminals of a single 1.5-volt battery, the current through the resistor will be 1.5 mA, all of which is supplied by the same battery. If you connect the same load across the terminals of two 1.5-volt batteries connected in parallel, the current through the resistor will still be 1.5 mA, but now each battery only has to supply 0.75 mA of current. This means that each individual battery is under less load than before, because the electrochemical pumps inside it only have to move half as many electrons to maintain the same voltage. These batteries may last longer and behave better under a variety of loading conditions. (This assumes ideal conditions and perfectly matched batteries. In real-world scenarios, batteries are never perfectly matched, and so you may need a load-balancing circuit to protect the batteries from each other.)

A: Think of a battery as an escalator (potential gravitational energy and potential electric energy/voltage are analogous here).
If you have two escalators side by side, taking either one will get you to the same height. If you have two escalators in a row, you will have to take them both and therefore get twice as high. The advantage of escalators side by side is that it's less taxing on their engines.
A battery raises the voltage in a wire by a set amount. Two batteries in series will raise the voltage twice as high, two batteries in parallel will make the batteries last twice as long.

Edit: OP has asked for an explanation without an analogy. A battery will raise the voltage of a current by a set amount. This is why we have things called "12 volt batteries" and not "12 newtons/coloumb batteries". If a current is at 0 V when it splits into parallel and goes into two separate batteries, then the electrons in each circuit will go up 12 V, then join back together at exact 12 V. If you have the batteries in series, the electrons will go from 0 to 12 after the first battery, then 12 V to 24 V through the second battery.
You mention E-field flux as being a sticking point for you - but E field flux doesn't define potential. And incidentally, the E field flux through each separate wire in parallel will be identical. The E field flux through the wire in series will be double what one wire would be in parallel.

A: OK, there are a lot of answers here, but they're all long, I don't really like any of them, and the answer is simple, so here's another one...
All by itself in space, a battery will push electrons from its positive terminal to its negative terminal.  This will create a field such that moving an electron along any path from its positive to its negative terminal will take 1.5eV of energy (approx, assuming a 1.5V battery).
If you put two of these batteries next to each other, their fields interact, and some of the electrons on their negative terminals will be forced back inside and some will come back out on their positive terminals.  The electrons redistribute and change their fields to ensure that it still takes 1.5eV of energy to move an electron from a battery's positive terminal to its negative terminal.
If you actually connect these batteries in parallel, the electrons redistribute again, and now it takes 1.5eV of energy to move an electron from anywhere on the common positive wire to anywhere on the common negative wire.

A: Each electron is individually pulled (randomly?) from the lower potential terminal (negative terminal of the anode) of one of the two batteries and works its way through the load device to ultimately return to the higher potential terminal (positive terminal of the cathode) of the same battery.  (The positive and negative signs of the terminals refer to their relative voltages, NOT their charge.)
The electron has to return to the same battery to maintain charge neutrality and current continuity everywhere in the circuit and the battery. Each loop occurs independent of the other battery as the two batteries are in parallel.  Also remember that the definition of a battery is an assembly of materials that maintains a constant voltage difference between the two terminals.
The voltage difference between the terminals of any battery arises from a thermodynamic tug-of-war for electrons between the chemicals of the two electrodes.  The cathode wins the tug of war by pulling electrons from the anode, via wires in the load device.  The voltage difference between the terminals is the work to move one electron from low voltage to high voltage (or one conventional positive charge from high voltage to low voltage).  To maintain charge neutrality there is a form of counter-current salt bridge inside the battery.
You could also consider 2 different sized 1.5 v batteries, such as AAA vs D with the same chemistry.  In a sense, the D cell functions as an array of AAA batteries in parallel.  The D cell battery stores more total energy (mA hr) than the AAA because it contains a greater mass of chemicals at the anode and cathode, and thus it will last longer than the AAA when the same current is drawn from both.  But they are the same voltage.
(If the batteries were connected in series, it would be different because now each electron is being passed through both batteries, so the voltages do add up.
This is what happens inside a 9V battery, which actually contains 6 AAAA 1.5 V batteries in series.)

A: Since you seem to be eager for an analogy-free answer, I'll try to give it a stab. I think this question is actually a bit deeper than some of the answers are giving it credit for, and so far I think trentcl answers your question the best: the root cause of your confusion is that you are assuming that batteries act as sources of fixed fields, rather than fixed potentials. But I'll try to go into a bit more detail as to why that is.
Now, your question seems to more or less be the following: say I have a battery, with some wires attached to it, like in the diagram below. In general, there will be some wonky electric field generated between the two leads whose structure is dictated by maxwell's equations. However, since everything about this problem is static, we know that if we integrate the electric field over any path between the leads, we will get the same voltage-- and it's this voltage that can do work if we put some lumped element device like a resistor between the leads.

Now, to the meat of your question. As we all learn, Maxwell's equations are linear-- we can take any solution and add the fields and we'll have another solution. So if we take another battery and attach the leads to the first, we should generate roughly twice the fields between the leads and hence twice the voltage, right? Wrong.

The problem is that you're ignoring the mechanics of the battery. Batteries work via chemical reactions that preferentially move charge in a certain direction, and they only push these charges so hard. When you start linking up batteries in parallel, the fields generated from one battery push back the charges from the other until you end up with an equilibrated system where the potential between the leads is the same as it was for a single battery.
So in fact, how a battery works is affected by presence of electric fields and it turns out you can't just superimpose the fields from two batteries when you connect them in parallel. Maxwell's equations are linear, but when you couple them to matter in a multiple particle system (like that of a battery) they aren't-- a simple example is a single electron will travel in a straight line, whereas if you have two of them initially side by side they will curve towards each other.
Now in reality no one every takes this "force-like" approach of looking at dynamics of batteries-- it's just too complicated and turns out to be pointless anyway. A much better approach is an "energy-like" approach. Each individual chemical reaction inside the battery only produces so much energy, and you can get pretty far by just keeping tabs on this. Since voltage is basically a measure of potential energy, when you do this it's pretty easy to argue that batteries (barring extreme conditions) should act as constant voltage sources, rather than constant electric field sources. But it helps to play around in the muck of a force based approach first to get a more intuitive explanation of what's going on.

A: Internally a battery cell creates a fixed voltage potential between the positive and negative sides. So a 5 V cell would have a five volt difference between the positive and negative end of the cell.
When you put two batteries in series, we generally call the negative end of the first cell 0 by convention. The positive end of the first battery then has +5 V. Since the positive end is attached to the negative end of the second, it too will be at +5 V. Since the positive end of the second is 5 V above the negative end (now at +5 V), it is now at +10 V.
Compare to two batteries in parallel. The negative ends of the batteries are connected, so both are at 0 (again, by convention). For the first battery, we get 5 V above the negative end (0 V) for a total of +5 V at the positive end. For the second battery, we also get 5 V above the negative end (0 V) for a total of +5 V at the positive end.
You might notice that there seems to a contradiction if the batteries are of different voltages, for example 5 V and 8 V. The negative ends touch so are the same at 0 V, but the positive ends touch and are different at 5 V and 8 V. In reality there will be some internal resistance so there will be some increasing potential as you move along the wires connecting the batteries (this charges the 5 V battery by the way). In general though, this resistance is small enough to ignore.

A: Batteries are voltage sources that use chemical reactions to provide an electromotive force — that is, a force applied to electric charges (e.g. electrons) that results in the increase of electric potential energy of those charges. This is what results in an electric potential difference across the battery — that is, electrons at the positive terminal have less electric potential energy than electrons at the negative terminal. The difference in potential energy (measured in joules) per unit of electric charge (measured in coulombs) is called the electric potential difference. It is measured in volts (equivalent to joules per coulomb), hence the equivalent term voltage.
Crucially, when batteries are placed in series, electrons will necessarily move through one battery, acquiring some electric potential energy, and then through the second battery, acquiring more electric potential energy. However, when the batteries are instead placed in parallel, electrons will only move through one of the two batteries — not both — and thus the total amount of electric potential energy acquired by each electron is less. Specifically, in the case of the two batteries having equal voltage, having the batteries in series will result in the electrons each acquiring twice as much electric potential energy as they would if the batteries were in parallel or if only one of the batteries were present.

A: I will try to explain in 1000 words.
Let B = Battery
B+B = 2B,
but it doesn't happen like that with electric potentials. There is more to it. Assume 2 batteries as railguns, with total available energy 2E
and the electron as a bullet. The railgun shoots electrons with velocity V.
But if railguns are connected in series, the velocity of the electron will not be 2V, but instead √2V since energy is doubled. And in series N electrons can be shot, since 2 units of energy is expended to increase the electron velocity.
In the case of railguns connected in parallel, 2N electrons with velocity V can be shot, therefore the amount of electrons is doubled compared to a series, as only 1 unit of energy is expended on an electron by the time the electron leaves the gun.
This constant flow rate of electrons is due to the constant current nature of electro-chemical batteries, since X molar equivalent of cathode and anode must redox to produce electricity, and the rate of reaction remains fairly constant.
Key terms: railgun is nothing but a coil, a long electromagnetic coil-like particle accelerator. Battery is your regular AA battery (example dur@cell). We will not assume power supplies as their nature is different, and we do not connect power supplies in series!

A: There is so much good theory here already that I'll just add  simple analogy, which is actually decent, because we're still talking about potential, which is only a function of position – not path. As voltage is a function of two points regardless of path (let's assume there are no changing magnetic fields here for simplicity), having another path available changes nothing.
If you're on top of a hill, do you expect stuff to roll down faster and gain more energy just because there's another alternate slope down (that you're not using) in some other direction, which nevertheless ends at the same altitude?

A: Look at two opposite charges at a fixed distance from each other. The electric field around them is expressed as Volt per meter ($\frac{V}{m}$). Or Newton per unit charge ($\frac{N}{C}$), where a unit charge refers to a test charge being put in the field.

So say these charges constitute a battery (though when being rigorous, the total field of a battery is not the same as a dipole, but the outside field is):

The battery poles contain many charges, so the electric field will be much higher than that of two single charges (as depicted in the previous picture). If there are twice as many charges on the poles of the battery the field will become twice as big, as will the voltage (because the field is defined as Volt per meter as well as Newton per unit charge). If the two batteries are placed parallel in the circuit the electric field surrounding the batteries will indeed add up. But the field at the poles will stay the same (except if the poles coincide in which case you have a new battery of higher voltage). The voltage of a battery is the voltage between the poles. This voltage is sent into the wires. So while the surrounding field can increase, the field inside the wires is that of the poles. When you place a loose wire around the batteries, initially the superimposed field of both batteries will be present (which is higher than the field at the poles), after which a contra field is built up by the charges inside the wire which cancels the field of the batteries). If the poles coincide (which is not the case when the batteries are placed parallel) you have a new battery of higher voltage. This is achieved by placing two batteries in series in which case the charges on the poles which you connect to the circuit will be doubled.
In short: while the field surrounding the parallel batteries increases it is the field on the poles that matters. This field is sent into the circuit and not the field at a distance from the poles (which is indeed the sum of the fields of both batteries). The field inside the wires is that of an individual pole, not that of both added. This field will last longer because the parallel batteries contain more electrons than one single battery. That is, the parallel batteries have more capacity and the same voltage. Now you might think that if both poles send the same field into the circuit why will the field in the circuit not be twice that on the poles? This would only be the case though if the plus poles of the parallel batteries coincided as well as the minus poles (and the charges on the poles would stay the same) which means that you would have a new battery of higher voltage.
Likewise, if you place two batteries in series, the field on the poles that are connected to the circuit is the sum of the fields of the two individual batteries. That field is sent into the circuit. There are twice as many charges on the poles connected to the circuit. That is the voltage of the batteries in series is the sum of the individual batteries.


text:
Q: Android Scroll View space in the bottom I want a help for design a screen.. I want to make a details screen, with a picture and a text (scrollabe).. But when i test, the text doesnt fill all the space...Its puts a empty space at the bottom of the text... How can i fill all the layout with the text?
<?xml version="1.0" encoding="utf-8"?>
<android.widget.RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.rs.app.paginas.antena_detalhe">

    <LinearLayout
        android:layout_width="368dp"
        android:layout_height="495dp"
        android:orientation="vertical"
        android:weightSum="1"
        tools:layout_editor_absoluteX="8dp"
        tools:layout_editor_absoluteY="8dp">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="200dp"
            android:layout_weight="0.05"
            android:gravity="center_vertical|center_horizontal"
            android:orientation="horizontal"
            tools:layout_editor_absoluteX="8dp"
            tools:layout_editor_absoluteY="0dp">

            <ImageView
                android:id="@+id/imgAntena"
                android:layout_width="200dp"
                android:layout_height="200dp"
                android:layout_marginTop="10dp"
                android:layout_weight="1"
                app:srcCompat="@mipmap/baloon" />

        </LinearLayout>

        <TextView
            android:id="@+id/txtTitulo"
            android:layout_width="match_parent"
            android:layout_height="30dp"
            android:layout_marginBottom="10dp"
            android:layout_marginTop="10dp"
            android:gravity="center"
            android:text="Nome" />

        <ScrollView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            tools:adjustViewBounds="true"
            android:fillViewport="true"
            >

            <TextView
                android:id="@+id/txtDetalhes"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:paddingLeft="5dp"
                android:paddingRight="5dp"
                android:scrollbars="vertical" />
        </ScrollView>

    </LinearLayout>

</android.widget.RelativeLayout>

and the screen:

A: You should change from:
<?xml version="1.0" encoding="utf-8"?>
<android.widget.RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.rs.app.paginas.antena_detalhe">
    <LinearLayout
            android:layout_width="368dp"
            android:layout_height="495dp"
            android:orientation="vertical"
            android:weightSum="1"
            tools:layout_editor_absoluteX="8dp"
            tools:layout_editor_absoluteY="8dp">

to:
<?xml version="1.0" encoding="utf-8"?>
<android.widget.RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.rs.app.paginas.antena_detalhe">
<LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        android:weightSum="1">

A: In your layout you have defined fixed dimensions for your linear layout which contains your scroll view and other widgets. I would suggest changing your root layout to Linear Layout with maximum width and height :
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:weightSum="1"
tools:layout_editor_absoluteX="8dp"
tools:layout_editor_absoluteY="8dp"
tools:context="com.example.rs.app.paginas.antena_detalhe">

And remove the child linear layout.
Reason you were getting extra space was because of fixed height,which may be not present on phone with lesser height.

A: You need to change to "match_parent" in your first LinearLayout´s height and widht parameters to fill all the screen, cause the parent in this case is your phone' screen, but if you define values in dp as shown in your code (495dp) then it´ll fill just that dimensions, and the screen dimensions change with every phone and his own screen size, that´s why it works in some little screen devices, and with bigger screens probably wont do it, the best solution to make it work with every screen size is changing your code like this:
<?xml version="1.0" encoding="utf-8"?>
<android.widget.RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.rs.app.paginas.antena_detalhe">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        android:weightSum="1"
        tools:layout_editor_absoluteX="8dp"
        tools:layout_editor_absoluteY="8dp">

    ...

Hope it helps,

redpajama_set_name: RedPajamaStackExchange


text:
Q: How do you save replays in Tekken Tag Tournament 2? How do you save replays in TTT2?
PS3 Offline Arcade Mode specifically (not sure if that warrants the ps3 tag).

A: There is no way to simply export the replays. You'll have to record the matches by hooking up a game capture device like Dazzle or a Hauppauge HD PVR and playing back the replays.

A: Replays are automatically stored, and can be saved by accessing them under Profile → Replay Theater → All Replays, selecting them and pressing the Start button.
However, only VS battle replays (online or offline) can be saved, so there is no in-game solution for saving arcade mode replays.
Note: old replays that have not been saved will be deleted automatically (the marquee on the menu item reads: "The oldest entries will be deleted first.").


text:
Q: Extracting the response headers from core-ajax I just want to know if I can extract response headers from the core-ajax polymer element?
Below is the snippet of code I am testing with, I can see the 'detail' object but there is no response header in the 'xhr' object inside detail, only the status and responseText/body etc. The console.log statements are just me trying to figure out where the response header is.
<body>
<template id="main" is="auto-binding">
<paper-input-decorator label="Email" floatinglabel="true" isInvalid="{{invalid}}" error="Not an email">
  <input is="core-input" value="{{email}}"></input>
</paper-input-decorator>
<core-ajax id="ajax"
           auto="true"
           url="http://www.mocky.io/v2/548a185d479e7f5618c59c1b"
           method="POST"
           handleAs="json"
           response="{{response}}"
           body='{"email":"{{email}}"}'
           contentType="application/x-www-form-urlencoded"
           on-core-complete="{{responseHandler}}">
</core-ajax>
</template>
<script>
var main = document.querySelector("#main");
main.email = "raja@naresh"
main.responseHandler = function(event, detail, sender) {
    console.log(event);
    console.log(detail.xhr);
    console.log(sender);
    console.log(main.response);
}
</script>
</body>

Can I extract the response header from core-ajax element, if not how do i go about doing this without jQuery? Any help is greatly appreciated? Thanks.

A: it's doable.
take a look into the following:
<link rel="import" href="../bower_components/polymer/polymer.html" />
<link rel="import" href="../bower_components/core-ajax/core-ajax.html" />
<polymer-element name="x-ajax">
    <template>
        <core-ajax auto url="http://gdata.youtube.com/feeds/api/videos/?alt=json&q=chrome"
                   response="{{resp}}"
                on-core-response="{{handler}}"></core-ajax>
        <textarea value="{{resp}}"></textarea>
    </template>
    <script>
        Polymer({
            handler: function (event, detail, sender) {
                var header = detail.xhr.getResponseHeader('content-type');
            }
        });

    </script>
</polymer-element>

first of all use on-core-response
second - use getResponseHeader method from XmlHttpRequest for getting required header


text:
Q: MVC3, Why does date in JQuery JSON appears like this? /Date(1324512000000)/ I am sending date values from C# application via JSON but instead of a standard date, it appears in this format /Date(1324512000000)/
Can anyone please tell me how to send it from C# in the format it expects? Thanks

A: That's how the JavaScriptSerializer is handling dates:

Date object, represented in JSON as "/Date(number of ticks)/". The
  number of ticks is a positive or negative long value that indicates
  the number of ticks (milliseconds) that have elapsed since midnight 01
  January, 1970 UTC.

You could convert this into a javascript Date like this:
var date = new Date(parseInt(jsonDate.substr(6)));

A: JSON doesn't recognize c#'s datetime object.  You should send it back as a string by calling .toString on your datetime variable in your controller.

A: That's just how dates are expressed in JSON.  See here for how to parse it back into something useful in javascript: How do I format a Microsoft JSON date?


text:
Q: Google Calendar API public holidays Using the Node https://github.com/google/google-api-nodejs-client library I am trying to access public holidays. I have the auth working and have access to the API. When I test the events. list endpoints with API explorer it works, I suspect that the calendar

calendarId :'en.sa#holiday@group.v.calendar.google.com'

exists in my personal calendar but not in the apps calendar.
When I try to get the list of calendars in my node app the list is empty:
calendar.calendarList.list({auth: jwtClient}, calenderGetComplete);

So the events.list doesnt find the calendar.
calendar.events.list({ calendarId :'en.sa#holiday@group.v.calendar.google.com', auth: jwtClient}, calenderGetComplete);

So on a personal calendar, one can add other interesting calendars, like the public holiday one, but seems like you can't do it for the calendar the app is using? Seems like the public calendars don't have 'interesting calendars'?

A: I am not sure how it is you are authenticating Oauth2 or a service account?
There is a difference between calendar lists and calendars.   The calendar list is just that little list on the bottom left-hand side of the google calendar website it has no real purpose (IMO).  If you are using a service account and grant it access to one of your personal (ex: chrisMalherbe at gmail.com) Google calendars it will have access to it but it won't appear in the service accounts calendar. list unless you insert it there manually.   When you add one of these interesting calendars to your personal google calendar page (ex: chrisMalherbe at gmail.com) the website automatically adds it to the calendar. list for you.
It doesn't really need to be there.
As for public calendars, everyone has access and they don't need to be on the calendar list.  They are public you can create a public API key and request data from them.  I am not sure what calendar en.sa is but I would take your API key and dump this in a web browser just to make sure there is data.  If memory serves there are a few with no data, and the data only goes a year ahead I think so if you are looking for holidays in 2020 there won't be any data.
GET https://www.googleapis.com/calendar/v3/calendars/en.sa#holiday@group.v.calendar.google.com/events?key=[APIKey]

Or with an access token if you don't want to use a public API key
GET https://www.googleapis.com/calendar/v3/calendars/en.sa#holiday@group.v.calendar.google.com/events?access_token=[accesstoken]

I am not a node.js expert but I found this node-google-api it might help I have a tutorial on this its mostly explains how public calendars work however it's in C# may or may not be of any help to you.   Public Google Calendars with C#


text:
Q: Python, pulling info from a dict made up of key, values in which the values are 3-tuples I have a MapReduce program that returns the results of the computation as a dict that looks like the following:
{'pods': (54802L, 25417L, 59877L), 'sash': (160573L, 97199L, 178836L), ...}

I am trying to pull the items in this dictionary to make use of the values in the 3-tuples, but I keep receiving an error KeyError: 0 when trying to parse through the errors in the code shown below (specifically on this line key, indicies = results[i])
bloomFilter = [False] * 200000
for i in range(0, len(results)):
    key, indicies = results[i]
    bloomFilter[indicies[1]] = True
    bloomFilter[indicies[2]] = True
    bloomFilter[indicies[3]] = True

What is the proper way to pull the information from the dict so that I can make use of the values in the 3-tuples?
Also, can I use L values as indicies in a array, or do I need to cast them to ints?

A: I would iterate over the results dictionary like so:
for key in results:
    indices = results[key]
    bloomFilter[indices[0]] = True
    bloomFilter[indices[1]] = True
    bloomFilter[indices[2]] = True

Note also that the indices tuple is zero-indexed, meaning you'll need to extract the values starting with zero (not one) like the above code shows.


text:
Q: PartCover with TeamCity I'm trying to setup partcover for .net 4 on x64 machine with TeamCity.
Tests are executed, but coverage report shows 0 coverage.
I'm getting the following message in log:
 No executable code was detected.
The issue could be caused by one of the following:
- Include / exclude patterns are incorrect
- Assemblies are compiled without debugging information
- .pdb files are not available
- Visual Studio code coverage is enabled for MSTest
- .testrunconfig is used for MSTest and Visual Studio code coverage is not disabled (CodeCoverage section with enable="true" is present)

But the include pattern is [*]*.
I'm running TeamCity 6.5.3 if it matters. Has anybody managed to run partcover on that version?

A: 1) PartCover only supports 32 bit processes, so you need to make sure your test runner is also running 32 bit.
2) Make sure you register the PartCover dll using regsvr32 (you can't use per-user registration if using a service account to run team city).

A: In general this messages means TeamCity failed to find any covered line.
This could be caused by assemblies or coverage parameters.
Please feel free to create an issue at http://youtrack.jetbrains.net with partcover report you got from a local test run. Please include version number of partcover too.
TeamCity 6.5.3 must support partcover 4.0.11129


text:
Q: Power Supply Design 240VAC to 12VDC, what value smoothing capacitor do I need? I am designing a power supply for a docking station, however I'm struggling to determine what value capacitor I will need? The transformer I am going to use is:http://uk.farnell.com/carel/tra12un100/transformer-240vac-in-12vac-out/dp/645400
I need a voltage regulator of 12V also and a current of 5A to power 2 separate circuits?
If you need some more information please don't hesitate to ask :)

A: Update: I checked that link and it seems you want to use a 3 VA transformer to make a 60 VA supply !? You'll need a transformer of 75-80 VA.
First of all, a voltage regulator at 5A produces a lot of unnecessary heat.
Sticking to your design, I'll assume the voltage regulator has a drop of maximum 2V accross it. So it must be powered all the time with a minimum voltage of 14V.
So you have that transformer of 12 V RMS AC. After bridge rectifier you get \$12 \cdot \sqrt{2} - 2 \cdot 0.7 = 15.57V_{p-p}\$. This voltage should never drop below 14V. This means a maximum ripple of 15.57-14 = 1.57V. For even better reliability I'll approximate this to 1.5V.
Now the capacitor value is \$C = {I \over {2fV_r}} = {5 \over {2 \cdot 50 \cdot 1.5}} = 0.033 F = 33000 uF\$.
This high value makes your transformer unusable for this design. Now that you know how to calculate this, choose a transformer with higher output voltage so that the filter capacitor will have a smaller value.


text:
Q: Smaller browser default monospace font Let have this:

.courier {
  font-family: 'Courier';
}

.monospace {
  font-family: monospace;
}

Some sample text

Some sample text

Why is the default monospace font smaller? And what is the default size for font-family: monospace;?

A: Different browsers have different base rendering defaults. WebKit and Firefox have chosen to set a smaller base font-size for the 'monospace' font-family.
https://www.brunildo.org/test/monospace_fsize.html
Browser set these defaults to improve content readability when no developer CSS is defined.


text:
Q: Bmon hits segmentation fault I was wanting to check rates on a wonky connection and tried bmon - but it hit a segfault. Removing and reinstalling didnt help. Any thoughts on how to proceed?
This is with a standard install of ubuntu18 on a laptop.

A: Try this: bmon -i netlink:notc
Source: https://github.com/tgraf/bmon/issues/42

A: I have encountered the similar problem. What I have observed is that this started occurring after the latest kernel upgrade. Prior to this I was able to run it without any problems.


text:
Q: SVN via SSH not working on Windows with Tortoise SVN I have SSH access to a FreeBSD machine which has svnadmin (and the rest of the necessary utilities) installed. svn is version 1.7.9 (r1462340). I am on Windows 7 x64, using Tortoise SVN 1.7.7.
I have followed this official guide to help me set up my server and Tortoise SVN, but I'm having trouble setting it up.
I have generated a pair of private/public keys and added them to my server's ~/.ssh/authorized_keys file and to my Putty configuration respectively. I can connect to the remote machine using putty and my private key.
I have also tried configuring Tortoise SVN to do the same thing, and I'm connecting to:
svn+ssh://myBSDusername@it2svn/somerepo

Where it2svn is the name of the working Putty connection profile, and somerepo is a repository in my repository root (~/svnroot/somerepo).
The problem that occurs is that Tortoise SVN requests my key's passphrase and no matter how many times I enter it correctly, the password dialog is closed for 1-2 seconds, after which it prompts me for the passphrase yet again. It doesn't even say that it's wrong, it just keeps asking me for the passphrase over and over.
If I purposely enter the wrong passphrase, I get prompted for it again instantly, without the 1-2 second delay that occurs when entering the right one. The dialog still doesn't say it's wrong even though I'm entering gibberish. This might be a bug on their side, but it still doesn't explain why my correct passphrase isn't being accepted.
Configuration
Here are the contents of the authorized_keys file (with the actual contents of the keys removed):
ssh-dss AAA....FuA== myBSDusername@ems

command="svnserve -t -r ~/svnroot --tunnel-user=svnAuthorDude",no-port-forwarding,no-agent-forwarding,no-X11-forwarding,no-pty ssh-dss AAAA....IFuA== myBSDusername@ems

Important note: the guide said that my "command" line should look like this:
command="svnserve -t -r <ReposRootPath> --tunnel-user=<author>",
     no-port-forwarding,no-agent-forwarding,no-X11-forwarding,
     no-pty ssh-rsa <PublicKey> <Comment>

But the key I generated using ssh-keygen using the same parameters as in the guide starts with ssh-dss instead of ssh-rsa, which is why ssh-rsa is replaced in my own file by dss (apparently because the key is a DSA and not a RSA key).

A: The problem you had was using a passphrase on your key pair and not using pageant.
When TortoiseSVn connects with an SSH tunnel it seems to make multiple separate requests using plink (or TortoisePLink). Each time this happens the SSH key is needed and so needs to be unlocked and so the password request occurs.
If you don't password protect the keypair then there is no need to ask for the password.
If you configure pageant to load the key before you use TortoiseSVN, then plink will get the key, already unlocked and cached, from pageant instead. In this way you can use a password protected key and not need to enter the password repeatedly. You still need to enter it once when adding the key to pageant though.

A: I've regenerated the key pair using PuttyGen, and made it an RSA2 key pair (versus the old DSA keys). I've also skipped protecting my private key with a passphrase, and now everything (magically) works. I don't know exactly what change actually fixed the problem, but I'm hoping this will help some future developer with a similar problem.
Here are the (relevant) contents of my user's ~/.ssh/authorized_keys:
ssh-rsa AAAA...Wc= rsa-key-20130529

command="svnserve -t -r /user/rest/of/path/svnroot --tunnel-user=someuser",no-port-forwarding,no-agent-forwarding,no-X11-forwarding,no-pty ssh-rsa AAAA...Wc= andrei


text:
Q: Anaconda installation not finding packages This one is best shown through what I'm trying to do and what is going on.
In my python file, I want to import seaborn.
It's available to install via conda.
(me_dev)[me@ip-***]$ conda install seaborn
Fetching package metadata: ....
Solving package specifications: ............................
# All requested packages already installed.
# packages in environment at /home/me/miniconda/envs/me_dev:
#
seaborn                   0.7.0                    py27_0

(me_dev)[me@ip-***** ****]$ which python
~/miniconda/bin/python

(me_dev)[me@ip-****]$ which ipython
~/miniconda/bin/ipython

Now if I start iPython and import seaborn:
In [1]: import seaborn
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-085c0287ecb5> in <module>()
----> 1 import seaborn

ImportError: No module named seaborn

Also, pip is not working either. It's not reading packages from pip.
(me_dev)[me@ip-*****]$ pip install jellyfish
Requirement already satisfied (use --upgrade to upgrade): jellyfish in /home/me/miniconda/lib/python2.7/site-packages

Yet:
from jellyfish import jaro_winkler ImportError: No module named jellyfish

Edit:
sys.path looks like so in iPython
['',
 '/home/me/miniconda/bin',
 '/home/me/miniconda/lib/python27.zip',
 '/home/me/miniconda/lib/python2.7',
 '/home/me/miniconda/lib/python2.7/plat-linux2',
 '/home/me/miniconda/lib/python2.7/lib-tk',
 '/home/me/miniconda/lib/python2.7/lib-old',
 '/home/me/miniconda/lib/python2.7/lib-dynload',
 '/home/me/miniconda/lib/python2.7/site-packages/setuptools-19.6.2-py2.7.egg',
 '/home/me/miniconda/lib/python2.7/site-packages',
 '/home/me/miniconda/lib/python2.7/site-packages/cryptography-1.0.2-py2.7-linux-x86_64.egg',
 '/home/me/miniconda/lib/python2.7/site-packages/IPython/extensions',
 '/home/me/.ipython']

Here's my .bashsrc
(me_dev)[me@ip-**** ~]$ cat .bashrc
# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
    . /etc/bashrc
fi

# added by Miniconda 3.16.0 installer
export PATH="/home/me/miniconda/bin:$PATH"

# User specific aliases and functions
source activate me_dev

# added by Miniconda2 3.19.0 installer
export PATH="/home/me/miniconda/bin:$PATH"

A: I think which python (and which ipython) should be pointing at ~/miniconda/envs/me_dev/bin/, not at ~/miniconda/bin/ directory. When you start an python session with those binaries, they can't see your seaborn library, which is probably only installed in the environment site packages.
I'm not sure exactly how you ended up in this state, but I would recommend trying to make a new environment and see if you end up pointed at the correct binaries.
The organization your .bashrc is the problem. You're activating your virtual environment, but then giving the main miniconda bin directory precedence in your $PATH, which has the effect of partially inactivating the virtual environment.


text:
Q: minimization of integral of multi-variable function Let $\alpha \in (0,1) $ be some parameter which we can choose and $Y$ be some random variable (e.g. standard normal distribution), then we can define a function as below (where $v,e < 0$ are two variables):
$S(Y,v,e; \alpha) =  -\frac{1}{\alpha e}\cdot(v-Y) \cdot \mathbf{1}_{(Y \le v)} + \frac{v}{e} - log(-e) - 1 $
If we minimized the expected value with respect to $v$ and $e$, we should get
$$ v=\Phi^{-1}_Y(\alpha)$$
and
$$
e = \frac{1}{\alpha}*\phi_Y( \Phi^{-1}_Y(\alpha) )
$$

A: Let's first get an analytical expression for $E_Y[S]$ with $Y \sim \mathcal{N}(0,1)$:
\begin{align}
E_Y[S] &= -\frac{1}{\sqrt{2 \pi}} \int_{\mathbb{R}} \frac{1}{\alpha e} (v - y) \mathbf{1}_{\{ y \leq v\}} \exp(-\frac{1}{2} y^2)dy + \frac{v}{e} - \log(-e) -1 \\
&= -\frac{1}{\sqrt{2 \pi}} \int_{- \infty}^{v} \frac{1}{\alpha e} (v - y)  \exp(-\frac{1}{2} y^2)dy  + \frac{v}{e} - \log(-e) -1 \\
& = -\frac{v}{\sqrt{2 \pi}} \int_{- \infty}^{v} \frac{1}{\alpha e}\exp(-\frac{1}{2} y^2)dy +\frac{1}{\sqrt{2 \pi}} \int_{- \infty}^{v} \frac{y}{\alpha e}\exp(-\frac{1}{2} y^2)dy + \frac{v}{e} - \log(-e) -1 \\
&= \frac{-v}{ \alpha e} \Phi_Y(v) - \frac{1}{\alpha e \sqrt{2\pi}}\exp(-v^2/2)+ \frac{v}{e} - \log(-e) -1
\end{align}
Now we are set to get your first equation:
\begin{align}
\frac{\delta}{\delta v} E[ S(Y,v,e; \alpha) ] &= -\frac{1}{\alpha e}  \left( \Phi_Y(v) + \frac{v}{\sqrt{2\pi}}\exp(-v^2 / 2) \right) + \frac{v}{\alpha e \sqrt{2 \pi}} \exp(-v^2 / 2)+\frac{1}{e}\\
&= -\frac{1}{\alpha e} \Phi_Y(v) + \frac{1}{e}
\end{align}
By computing $\frac{\delta}{\delta v} E[ S(Y,v,e; \alpha) ] = 0$ we get the result.
For the second equation:
\begin{align}
\frac{\delta}{\delta e} E[ S(Y,v,e; \alpha) ] &=  \frac{v}{\alpha e^2} \Phi_Y(v) + \frac{1}{\alpha e^2 \sqrt{2\pi}}\exp(-v^2/2) - \frac{v}{e^2} - \frac{1}{e}
\end{align}
We write $\frac{\delta}{\delta e} E[ S(Y,v,e; \alpha) ] =0$ to get:
\begin{equation}
e = \frac{v}{\alpha} \Phi_Y(v) + \frac{1}{\alpha}\phi_Y(v) - v
\end{equation}
To conclude, we use the optimun of $v = \Phi_Y^{-1}(\alpha)$ found in the first equation and the fact that $\Phi_Y(\Phi_Y^{-1}(\alpha)) = \alpha$ to get:
\begin{equation}
e = \frac{v}{\alpha} \alpha + \frac{1}{\alpha}\phi_Y(v) - v = \frac{1}{\alpha} \phi_Y(\Phi_Y^{-1}(\alpha))
\end{equation}
It's not exactly what you are asking for, but I think it's right; I cannot find any typo in my procedure. Maybe the $\frac{1}{1-\alpha}$ it's just $\frac{1}{\alpha}$ in your question.


text:
Q: How to determine the propensity score classifier validity? I've got a bit more background in machine learning than statistics. Let's say that I want to analyze causal effects based on propensity scores of the treatment and control group. I know that most often the propensity scores are determined using logistic regression. Can I use another algorithm to better handle this estimation for data I know are not linear, like random forests, boosting or neural nets ?
If I do use a different classifier, how can I measure if they're doing better than logistic regression ? Measuring accuracy doesn't really work.


text:
Q: Make sbt publish use proguard instead of package Using the plugin sbt-proguard, how do I make sbt publish depend on it and use its output jar rather than using the regular "package" and its output? Out-of-the-box if you type "publish" in the sbt shell then proguard is not invoked.
(Note: sbt-proguard is different from xsbt-proguard-plugin)


text:
Q: MySql #1054 error while executing it through phpMyAdmin I am trying to execute this code in phpMyAdmin. But, I'm getting following error
#1054 - Unknown column 'year' in 'field list'
SELECT
  CONCAT('SELECT year2,',
  GROUP_CONCAT(sums),
  ' FROM yourtable GROUP BY year2')
FROM (
SELECT CONCAT('SUM(name=\'', name, '\') AS `', name, '`') sums
FROM yourtable
GROUP BY name
ORDER BY COUNT(*) DESC
) s
INTO @sql;

PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;

Check out fiddle for implementation.
How to fix this?
And any ideas how do I script in PHP?

A: Year is a known object in MYSQL, if you have a column named 'year', try it with a back-tick '`'::
SELECT
  CONCAT('SELECT `year`,',
  GROUP_CONCAT(sums),
  ' FROM yourtable GROUP BY `year`')
FROM (
SELECT CONCAT('SUM(name=\'', name, '\') AS `', name, '`') sums
FROM yourtable
GROUP BY name
ORDER BY COUNT(*) DESC
) s
INTO @sql;

PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;


text:
Q: How do I delete a row in sql using php? So, i have been trying really hard to know how to delete a row in sql. I searched a lot on the internet, but i just cant find the answer. I came here to see if anyone can help me.
also, i'm kinda new to this.
<?php
$conn = mysqli_connect("127.0.0.1", "a26719", "sde3n13n", "aluno_a26719");

$sql = "SELECT Username, Password, UserID FROM utilizadores";
$result = mysqli_query($conn, $sql);

echo "
";
echo "
 Username 	 Password 	 User ID
";
if (mysqli_num_rows($result) > 0)
{
    while($row = mysqli_fetch_assoc($result))
{

    echo "
" . $row["Username"]. "	" . $row["Password"]. "	". $row["UserID"]. "
";

}
}

else
{
    echo "0 results";
}
echo "
";

echo "<form action='elimina.php' method='POST'>";
echo "Username: <input type='text' name='username'>
";
echo "<input type='submit' value='submit'>";
echo "</form>";

$username=$_POST['username'];
$sql="DELETE FROM utilizadores WHERE Username='$username'";

echo "Voltar";
?>

I know the table works, but the last few lines of deleting don't.

A: $result = mysqli_query($conn, $sql);

The above call is what executes it in the first part of your code.
You are not executing the DELETE query. You simply define a string and do nothing with it.


text:
Q: javascript плавное изменение положения элемента с паузами Блок по клику двигается слева направо, без остановки.
Как сделать чтобы, он останавливался на 500ms в положении left=200px и на 400ms в положении left=400px
сам скрипт для наглядности ниже:

$('#but').click(function() {
  $('.ring').animate({
    left: 800,
  });
});
.ring {
  display: block;
  position: relative;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: red;
  left: 25px;
  top: 25px;
}
#but {
  position: relative;
  top: 40px;
}

<input type="button" id="but" value="Пуск!">

A: Можно использовать функцию delay

$('#but').click(function() {
  $('.ring').animate({
      left: 200,
    }).delay(500)
    .animate({
      left: 400
    }).delay(400)
    .animate({
      left: 800
    });
});
.ring {
  display: block;
  position: relative;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: red;
  left: 25px;
  top: 25px;
}
#but {
  position: relative;
  top: 40px;
}

<input type="button" id="but" value="Пуск!">


text:
Q: Set emacs -nw as default editor When editing files like sudoers, I want to use emacs instead of nano. So I ran this command
sudo update-alternatives --config editor

And I selected emacs. The only issue is I like emacs in no window mode (the -nw flag) and I've aliased emacs as emacs='emacs -nw' so that I can use no window mode in normal use, but I don't know how to get my default editor to be in no window mode.
In other words, I need to get the command sudo visudo and similar commands that open up editors to open the file with emacs -nw. How can I do this? I'm on Ubuntu 12.04.

A: Create a script that starts emacs with -nw flag, e.g. /usr/local/bin/emacs-nw.
#!/bin/sh

emacs -nw "$@"

Install it with update-alternatives --install.
sudo update-alternatives --install /usr/bin/editor editor /usr/local/bin/emacs-nw 2

Configure editor to be your new script.
sudo update-alternatives --set editor /usr/local/bin/emacs-nw

A: Add the following to your ~/.bashrc file (or the config file for your shell if it is not Bash).
export EDITOR="emacs -nw"
This should set (and export) an env variable setting your default editor as Emacs in non-graphical mode.

A: I have following setting in my ~/.bashrc
export EDITOR="emacsclient -t -a=\"\""

This will first try to connect emacs daemon server if it is already started, otherwise start daemon server first then connect again.
Similarly, I have following setting in my ~/.gitconfig
[core]
    editor = emacsclient -t -a=\\\"\\\"


text:
Q: Unable to complete the challenge --Create an approval process I am stuck with completing the challenge. I have no approval before but when I enter the name for  'initial submission action'  for a field update its give name error "Error: This Unique Name already exists or has been previously used. Please choose a different name" as shown in the image. I don't know how can I fix it. enter image description here

A: Try changing the "Unique Name" to something more unique - current unique name is already used somewhere in your org.
Examples:

*

*Account_Type_To_Pending_1

*Account_Type_To_Pending_1A

*Account_Type_To_Pending_challenge1


text:
Q: What UML relationship when one object subscribes to events on another object? Object B contains a bunch of public events.
Object A subscribes to these events.
What is the UML relationship between these?
Currently I have a directed association from Object A to Object B. Is that correct? Or should the direction go the other way?

A: Both A and B probably maintain references to one another. A may want to unsubscribe, and B certainly has to be able to notify A of events. Thus, I would model it as a bidirectional relationship. You might even want B to compose all the subscribing instances. Check out the well known Observer Pattern.

A: It depends on what you want to express.
Logically, the subscriber A must know the publisher B, and the other way round, so you have a bidirectional relationship.
Technically, often the subscriptions are not managed by the publisher B but by some dispatcher D. The subscriber A knows the dispatcher D and the other way round. But the publisher B doesn't know A and, depending on the platform offering the broadcasting mechanism, maybe not even the dispatcher D. So, if you have a particular platform in mind, find out which types of objects need instance variables to reference other objects, and model the relationships according to that.

A: There should be a dependency relationship from A to B (a dashed arrow pointing from A to B). Chapter 7.8.4.1 of the UML spec version 2.5 reads:

A Dependency is a Relationship that signifies that a single model Element or a set of model Elements requires other model Elements for their specification or implementation.

In your case, A requires B to exist, but B does not require A to exist. Maybe B requires A to implement a particular interface. In that case, B depends on the interface, but not on A itself.
You propose to have an association from A to B. An association is stronger than a dependency. It means that A has a property of type B (well, the definition is a bit more complex, see chapter 11.5.3.1 of the UML spec). This implies that A depends on B, like a dependency, but a dependency does not require A to have a property of type B.
To summarize:

*

*The arrow should point from A to B, not from B to A (unless your particular implementation of B depends on the existence of a class called A, which is unlikely).

*A dependency is enough, but if you want A to have a property of type B, then you may draw an association (solid line) instead of a dependency (dashed line).


text:
Q: How to read a .csv file using Renjin I have a grails application in which I want to use Renjin to carry out some statistics using R.
The code in my grails app is like this:
    ScriptEngineManager manager = new ScriptEngineManager();
    ScriptEngine engine = manager.getEngineByName("Renjin");
    engine.eval("data <- read.table('/path/to/my/app/R/file.csv', sep=',', na.strings=c('',' ','-','--'))");

When running my code I get the following Exception:

ERROR errors.GrailsExceptionResolver  - IndexOutOfBoundsException occurred when processing request:
.......
Index: 49, Size: 49. Stacktrace follows:
  Message: Index: 49, Size: 49
      Line | Method
  ->>  635 | rangeCheck               in java.util.ArrayList

I realise that java arrays use zero based indexing, whereas R arrays use 1 based indexing, I think the issue is related to this. Is there a way to get around this issue?
Also, the CSV has 49 columns.


text:
Q: Maven 3 plugin: List dependencies of project I am trying to create a maven 3 plugin that should parse every dependency and transitive dependency of the project, and list the artifacts, preferably with a link to the jar file in the local maven repo. I am not having much luck.
I have to treat the dependencies afterwards, to the dependency and tree plugins are not really an option for me. I need to create a custom plugin which can work on the dependency artifacts.
I have tried creating a plugin using the DependencyGraphBuilder with exactly no success:
@Parameter(defaultValue = "${project.build.directory}", property = "outputDir", required = true)
private File outputDirectory;

@Parameter(defaultValue = "${project}", readonly = true, required = true)
private MavenProject project;

@Parameter(defaultValue = "${session}", readonly = true, required = true)
private MavenSession session;

@Component(hint = "maven3")
private DependencyGraphBuilder dependencyGraphBuilder;

@Override
public void execute() throws MojoExecutionException, MojoFailureException {
    File targetDir = outputDirectory;

    if (!targetDir.exists()) {
        targetDir.mkdirs();
    }

    ProjectBuildingRequest buildingRequest = new DefaultProjectBuildingRequest(session.getProjectBuildingRequest());
    buildingRequest.setProject(project);
    try {
        try (PrintWriter writer = new PrintWriter(new File(outputDirectory, "output"))) {
            writer.println("I did shit");
        }

        DependencyNode depenGraphRootNode = dependencyGraphBuilder.buildDependencyGraph(buildingRequest, null);
        CollectingDependencyNodeVisitor visitor = new CollectingDependencyNodeVisitor();
        depenGraphRootNode.accept(visitor);
        List<DependencyNode> children = visitor.getNodes();
        for (DependencyNode node : children) {
            System.out.println(node.getArtifact().getGroupId() + " " + node.getArtifact().getArtifactId());
            try (PrintWriter writer = new PrintWriter(new File(outputDirectory, "output"))) {
                writer.println(node.getArtifact().getGroupId() + " " + node.getArtifact().getArtifactId());
            }
        }
    } catch (Exception ex) {

    }
}

I have gotten a few different exceptions, depending on the depenency versions in my pom, for example

java.lang.NoSuchMethodError: org.apache.maven.artifact.versioning.DefaultArtifactVersion.compareTo(Lorg/apache/maven/artifact/versioning/ArtifactVersion;)I

and

java.lang.NoClassDefFoundError: org/eclipse/aether/RepositorySystemSession

Could someone please provide me with a working dependency setup for making the DependencyGraphBuilder work, or alternatively, a different way of parsing the compiling projects dependencies?


text:
Q: Eternal error java.io.StreamCorruptedException: invalid type code: AC I've searched the forum and tried different approaches and I'm still getting this error. What happens is that it will only read one value in the inputstream and then the program shuts down and I get the error. I don't understand why it won't work.
This is the code:
public void readRecords() {
    Players records;

    try { // input the values from the file
        Object obj = null;
        while (!(obj = (Players) input.readObject()).equals(null)) { //line 60
            records = (Players) obj;
            myArr.add(records);

            System.out.printf("DEBUG: %-10d%-12s\n", records.getScores(), records.getName());
        }
        input.close();
    } // end try
    catch (EOFException endOfFileException) {
        return; // end of file was reached
    } catch (ClassNotFoundException classNotFoundException) {
        System.err.println("Unable to create object.");
    } catch (IOException ioException) {
        System.err.println("Error during reading from file.");
        ioException.printStackTrace();
    }
}

This is the error:
Error during reading from file.
java.io.StreamCorruptedException: invalid type code: AC
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at hangman.FileReadWriter.readRecords(FileReadWriter.java:60)
at hangman.Game.menu(Game.java:127)
at hangman.Game.findLetterAndPrintIt(Game.java:57)
at hangman.Game.displayMenu(Game.java:31)
at hangman.HangmanTets.main(HangmanTets.java:10)

Someone got any ideas?


text:
Q: How do I make my Numpy/Scipy use ATLAS instead of OpenBLAS (on a virtual environment)? My numpy and scipy use OpenBLAS and this is causing multiprocessing problems with scikit-learn. The scikit-learn advanced installation instructions say that ATLAS should be used instead of OpenBLAS. I do not know how to make numpy/scipy use ATLAS instead of OpenBLAS. I tried the instructions as below, but still numpy config says its using OpenBLAS. I also tried this, but numpy, scipy still use OpenBLAS and the code freezes. The update-alternatives command clearly shows atlas selected, so I don't understand why numpy and scipy config still shows OpenBLAS being used. I am working in a Ubuntu "16.04.3 LTS (Xenial Xerus)" environment.
(.env) kai:~/work$ sudo update-alternatives --config libblas.so.3
There are 2 choices for the alternative libblas.so.3 (providing /usr/local/lib/libblas.so.3).

  Selection    Path                                    Priority   Status
------------------------------------------------------------
* 0            /usr/lib/atlas-base/atlas/libblas.so.3   100       auto mode
  1            /usr/lib/atlas-base/atlas/libblas.so.3   100       manual mode
  2            /usr/lib/libblas/libblas.so.3            10        manual mode

Press <enter> to keep the current choice[*], or type selection number: ^C
(.env) kai:~/work$ sudo update-alternatives --config libblas.so
There are 2 choices for the alternative libblas.so (providing /usr/local/lib/libblas.so).

  Selection    Path                                  Priority   Status
------------------------------------------------------------
* 0            /usr/lib/atlas-base/atlas/libblas.so   100       auto mode
  1            /usr/lib/atlas-base/atlas/libblas.so   100       manual mode
  2            /usr/lib/libblas/libblas.so            10        manual mode

>>> import numpy as np
>>> np.__config__.show()
lapack_opt_info:
    libraries = ['openblas']
    library_dirs = ['/usr/local/lib']
    define_macros = [('HAVE_CBLAS', None)]
    language = c
blas_opt_info:
    libraries = ['openblas']
    library_dirs = ['/usr/local/lib']
    define_macros = [('HAVE_CBLAS', None)]
    language = c
openblas_info:
    libraries = ['openblas']
    library_dirs = ['/usr/local/lib']
    define_macros = [('HAVE_CBLAS', None)]
    language = c
openblas_lapack_info:
    libraries = ['openblas']
    library_dirs = ['/usr/local/lib']
    define_macros = [('HAVE_CBLAS', None)]
    language = c
blas_mkl_info:
  NOT AVAILABLE

(.env) kai:~/work$ dpkg -l \*blas\* | grep ^i
ii  libblas-common 3.6.0-2ubuntu2 amd64        Dependency package for all BLAS implementations
ii  libblas-dev    3.6.0-2ubuntu2 amd64        Basic Linear Algebra Subroutines 3, static library
ii  libblas3       3.6.0-2ubuntu2 amd64        Basic Linear Algebra Reference implementations, shared library


text:
Q: SharePoint 2013 / IIS 7.5 Impersonation/Delegation/Double Hop Ok, I have spent about 15 hours trying to resolve this problem and I have finally been resigned to posting here to try to get it resolved.  I know this post is very long but I have done all the normal things that I'm going to be told to try so I want to make sure that it is clear so we don't waste time on that.
I have a Win Server 2008 R2 virtual machine hosted on a ESXi 5.0 server. On this server I have installed SharePoint Foundation 2013 Preview as well as all pre-requsites etc.  I am running everything off this one server (MSSQL, IIS 7.5, SharePoint services) as we will have very limited usage and only have around 30 users.  One thing I desperately needed to add to SharePoint is the ability for users to modify their information in Active Directory (Server 2003) as our AD is barely populated and is outdated.  I've found a perfect WebPart and it works wonderfully for editing users.
The problem comes in when I want to configure the WebPart to allow the user to only edit themselves.  The WebPart (properly) uses this line of code in C#.NET:. to get the currently logged in Identity that was authenticated with Windows Authentication in IIS.  Instead however, this is returning the local user NT AUTHORITY/IUSR.  (I know this is not news to anyone).

System.Security.Principal.WindowsIdentity.GetCurrent().Name;

So I began my research and made sure of the following things.
In my web.config for SharePoint, I have the following:

<authentication mode="Windows" />
<identity impersonate="true" />

In IIS, I have the following Authentication settings for the IIS website which houses my SharePoint installation:
Anonymous Authentication    Disabled
ASP.NET Impersonation       Enabled
Basic Authentication        Disabled    HTTP 401 Challenge
Digest Authentication       Disabled    HTTP 401 Challenge
Forms Authentication        Disabled    HTTP 302 Login/Redirect
Windows Authentication      Enabled     HTTP 401 Challenge

So I know the site is still logging in with the anonymous user even though I have anonymous authentication disabled.  I came across info about the double-hop issue which matches my problems and I came across this link and followed all the directions in this post:
http://blogs.technet.com/b/taraj/archive/2009/01/29/checklist-for-double-hop-issues-iis-and-sql-server.aspx.  After each step, I checked for any change in behavior of the application but never found any.
In summary I did the following:

*

*I set up a domain user account to run the application pool.  For testing, I made this user a member of the Domain Admins group.

*I changed a line in web.config to <add key="aspnet:AllowAnonymousImpersonation" value="false" /> (it was true).  This prevented the the NT AUTHORITY\IUSR user from running the application and instead it ran under the domain account I created to run the app pool.  I could now log in to SharePoint and access my WebPart, however as expected, it presented me with the AD information for the domain user running the App Pool, rather than the domain user who had authenticated.  So I know the WebPart is working and has the necessary permissions etc but System.Security.Principal.WindowsIdentity.GetCurrent().Name; is still returning the user running the app pool ie. impersonation is still not working

*In AD Users and Computers, I granted Trust this computer for delegation to any service for the virtual server this all runs on.

*Since I had no "Delegation" tab for the domain user account running the app pool, I had to register an SPN for the user.  After registering all SPNs I copied from the server's list of SPNs and also a couple http SPNs I found online, and also setting Trust this user for delegation to any service on the user, there was no change in the behavior of the application.

*I made sure the domain user I was logging in with was not protected from delegation

*I went into the local policy editor on the SharePoint server and I made sure the domain user running the app pool was allowed to "Act as part of the operating system" and "Impersonate a client after authentication".

*Other things I tried

*

*Add Negotiate:Kerberos as an authentication provider for Windows Auth on the IIS website

*Confirmed presence of these two lines in SharePoint web.config:
Below are my SPN records on the DC:
setspn -l SPserver
Registered ServicePrincipalNames for CN=SPserver,CN=Computers,DC=DOMAIN,DC=local:
    MSSQLSvc/SPserver.DOMAIN.local:appPoolUser
    WSMAN/SPserver
    WSMAN/SPserver.DOMAIN.local
    TERMSRV/SPserver
    TERMSRV/SPserver.DOMAIN.local
    RestrictedKrbHost/SPserver
    HOST/SPserver
    RestrictedKrbHost/SPserver.DOMAIN.local
    HOST/SPserver.DOMAIN.local

setspn -l appPoolUser
Registered ServicePrincipalNames for CN=appPoolUser,OU=Utility,OU=Users,OU=Company Name,DC=DOMAIN,DC=local:
    http/subdomain.domain.com
    http/SPserver.DOMAIN.local
    RestrictedKrbHost/appPoolUser.DOMAIN.local
    RestrictedKrbHost/appPoolUser
    MSSQLSvc/appPoolUser.DOMAIN.local:appPoolUser
    HOST/appPoolUser
    HOST/appPoolUser.DOMAIN.local

I restarted the server and IIS several time throughout this process as well.  Still when I log in, my Web Part identifies me as the user running the application pool.  I know there are work around like using a Classic mode app pool but that is deprecated. There are other ways to get the correct name in .NET as well but I don't want to have to change the Web Part and more importantly, this is the correct way to do it and I should be able to get it working.  I don't want to have to continuously work around it.
If anyone has any more ideas of what might be causing the problem, I would LOVE to hear them.

A: Not sure if you're having issue still, the following post might help.
Double Hop Impersonation, Protocol Transitioning and Constrained Delegation in ASP.NET 4


text:
Q: How to speed up aggregation query including date string comparisons in array without using $unwind? I have a collection which contains documents with nested arrays. There are 1 million documents with thousands of objects in subfield array. Documents are quite large, but for purpose of explaining consider the following two documents:
[
  {
    "id": "myid",
    "field": {
      "total": 1,
      "subfield": [
        {
          "somefield": "1000",
          "time": "2020-08-06T08:33:57.977+0530",
          "val": [
            {
              "x": "someval",
              "a": "val1",
              "b": "val2"
            }
          ]
        },
        {
          "somefield": "2000",
          "time": "2020-05-08T04:13:27.977+0530",
          "val": [
            {
              "x": "someval2",
              "a": "val1",
              "b": "val2"
            }
          ]
        }
      ]
    }
  },
  {
    "id": "myid2",
    "field": {
      "total": 1,
      "subfield": [
        {
          "somefield": "1001",
          "time": "2020-07-31T10:15:50.184+0530",
          "val": [
            {
              "x": "someval2",
              "a": "val1",
              "b": "val2"
            },
            {
              "x": "someval2",
              "a": "val1",
              "b": "val2"
            }
          ]
        }
      ]
    }
  }
]

Use case:
I need to project only the id of documents with time date(grouped by date) greater than a value and field. subfield.val.b or field. subfield.val.a with a particular value.
I have the query to achieve my use case using $unwind,$toDate,$dateToString  operators.
But the use of $unwind for large arrays causes the overall set to use a lot of memory and slows things down. It takes more than 15 minutes now.(I have not added any indexes because even if I create indexes for created, when I run explain for aggregation, the winning query does not use the provided index)
My current query:
db.collection.aggregate([
  {
    $unwind: {
      path: "$field.subfield",

    }
  },
  {
    $unwind: {
      path: "$field.subfield.val",

    }
  },
  {
    $addFields: {
      created_at: {
        $toDate: "$field.subfield.time"
      }
    }
  },
  {
    $match: {
      $and: [
        {
          $expr: {
            $gt: [
              {
                "$dateToString": {
                  "date": "$created_at",
                  "format": "%Y-%m-%d"
                }
              },
              "2020-04-28"
            ]
          }
        },
        {
          $or: [
            {
              "field.subfield.val.a": {
                "$eq": "val1"
              }
            },
            {
              "field.subfield.val.b": {
                "$eq": "val1"
              }
            }
          ]
        }
      ]
    }
  },
  {
    $group: {
      _id: "$id"
    }
  }
])

Query in MongoDB Playground
I need to limit the execution time of the query to less than 30 seconds. I hope the process can be made faster if done without $unwind.

My MongoDB Server version is 4.0.3

What are the other possible optimisations that can be done?
Thanks!

A: Did you try the $elemMatch? It works really similar to the js function Array.some()
More info under https://docs.mongodb.com/manual/reference/operator/query/elemMatch/

{
    $match:{
      histories:{
        $elemMatch:{
          created_at:{
            $gt:'2020-04-28'
          }
        }
      }
    }
  }

A: Possible optimisations that can be done:

*

*Since $unwind slows down the query, $filter can be used to get matching results from nested array.

*Date string comparisons are heavy, So its better to store the dates as MongoDB date object and do all the comparisons with date type itself instead of date string type.

db.collection.aggregate([
  {
    "$project": {
      "obj1": {
        "$filter": {
          "input": "$field.subfield",
          "as": "el",
          "cond": {
            "$and": [
              {
                "$gt": [
                  "$$el.time",
                  new Date("2020-04-29")
                ]
              }
            ]
          }
        }
      },
      id: 1,

    }
  },
  {
    $match: {
      $or: [
        {
          "obj1.val.a": {
            "$eq": "val1"
          }
        },
        {
          "obj1.val.b": {
            "$eq": "val1"
          }
        }
      ]
    }
  },
  {
    $project: {
      id: 1,
      _id: 0
    }
  }
])

Playground Example


text:
Q: "The remote certificate is invalid according to the validation procedure" occuring from time to time The C# service is using RestSharp to fetch some data from the given url. The remote site uses ssl.  The task is recurring on every 5 minutes and doing fine.
However, on every few hours the service is getting:

System.Net.WebException: The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel. ---> System.Security.Authentication.AuthenticationException: The remote certificate is invalid according to the validation procedure.

I saw that some people are suggesting avoiding the certificate validation, but I don't think it's a good idea.
Does anyone have the idea what could be the cause of this strange behaviour?


text:
Q: Bottom views of the xml layout are not showing up This is my register layout. The views which are below password i.e spinners,buttons are not showing up in my phone but its showing up in the emulator...My emualtor is based on nexus 7 whereas my phone is samsung grand..I m wondering what is happening there..Is something wrong in my code.
please help
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical"
    android:background="@drawable/gradient"
     >
 <ImageView
       android:id="@+id/imageView1"
       android:layout_width="fill_parent"
       android:layout_height="wrap_content"
       android:layout_alignParentLeft="true"
       android:layout_alignParentTop="true"
       android:adjustViewBounds="true"
       android:scaleType="fitXY"
       android:src="@drawable/topimg" />
<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:background="#000750"
    android:padding="20dp"
    android:layout_marginRight="20dp"
    android:layout_marginTop="50dp"
    android:layout_marginLeft="20dp"
    >
    <TextView
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:textColor="#fff"
            android:id="@+id/register_error"
            android:textSize="15dp"
            android:layout_marginBottom="10dp"
            android:layout_marginLeft="20dp"
            />

    <EditText
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:gravity="left"
    android:textSize="15dp"
    android:textColor="#000"
    android:layout_marginTop="5dp"
    android:layout_marginLeft="20dp"
    android:layout_marginRight="20dp"
    android:layout_marginBottom="20dp"
    android:id="@+id/fname"
    android:background="#FFF"
    android:hint="@string/name"
     ></EditText>

    <EditText
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:gravity="left"
    android:textSize="15dp"
   android:textColor="#000"
    android:layout_marginTop="5dp"
    android:layout_marginLeft="20dp"
    android:layout_marginRight="20dp"
    android:layout_marginBottom="20dp"
    android:id="@+id/lname"
    android:background="#FFF"
    android:hint="@string/lname"
     ></EditText>
    <EditText
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:gravity="left"
    android:textSize="15dp"
   android:textColor="#000"
    android:layout_marginTop="5dp"
    android:layout_marginLeft="20dp"
    android:layout_marginRight="20dp"
    android:layout_marginBottom="20dp"
    android:id="@+id/uname"
    android:background="#FFF"
    android:hint="@string/username"
     ></EditText>
    <EditText
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:gravity="left"
    android:textSize="15dp"
   android:textColor="#000"
    android:layout_marginTop="5dp"
    android:layout_marginLeft="20dp"
    android:layout_marginRight="20dp"
    android:layout_marginBottom="20dp"
    android:id="@+id/email"
    android:background="#FFF"
    android:hint="@string/semail"
     ></EditText>

    <EditText
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:gravity="left"
    android:textSize="15dp"
   android:textColor="#000"
    android:layout_marginTop="5dp"
    android:layout_marginLeft="20dp"
    android:layout_marginRight="20dp"
    android:layout_marginBottom="20dp"
    android:id="@+id/pword"
    android:background="#FFF"
    android:hint="@string/password"
    android:password="true"
     ></EditText>
        <Spinner
        android:id="@+id/spinner1"
        android:spinnerMode="dialog"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Select"
        android:entries="@array/level_arrays"
        android:prompt="@string/level_prompt"
        android:layout_marginTop="5dp"
        android:layout_marginLeft="20dp"
        android:layout_marginRight="20dp"
        android:layout_marginBottom="20dp"
        android:background="#FFF"
     />
        <Spinner
        android:id="@+id/spinner2"
        android:spinnerMode="dialog"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:entries="@array/class_arrays"
        android:prompt="@string/class_prompt"
        android:layout_marginTop="5dp"
        android:layout_marginLeft="20dp"
        android:layout_marginRight="20dp"
        android:layout_marginBottom="20dp"
        android:background="#FFF"
        />

    <Button
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:gravity="center"
    android:textSize="20dp"
    android:textColor="#FFF"
    android:layout_marginTop="20dp"
    android:layout_marginLeft="20dp"
    android:layout_marginRight="20dp"
    android:text="Enroll"
    android:id="@+id/register"
    android:background="#589700"
     ></Button>
    <Button
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:gravity="center"
    android:textSize="20dp"
    android:textColor="#FFF"
    android:layout_marginTop="20dp"
    android:layout_marginLeft="20dp"
    android:layout_marginRight="20dp"
    android:text="Back To Login"
    android:id="@+id/bktologin"
    android:background="#589700"
     ></Button>

    </LinearLayout>

</LinearLayout>

A: Problem is the height of your inner linear layout is more than the screen size. To solve this problem, you can add a extra scroll view and put this linear layout to the scroll view.


text:
Q: Select only unique values from a column in codeigniter i have a table like this
name|subjects|location
......................
BUET|CSE|Dhaka
BUET|EEE|Dhaka
RUET|CE |Rajshahi
RU  |CE |Rajshahi

here all the rows are distinct.And if I use
 $this->db->select('*') and $this->db->distinct()

it would select  all the rows of BUET but i only want like this
name|subjects|location
......................
BUET|CSE|Dhaka
RUET|CE |Rajshahi
RU  |CE |Rajshahi

That means only the first column must be distinct and select all the columns as usual.And it would work if i use $this->db->select('name') and $this->db->distinct(). Then what would be about the other columns??
As my original table has many columns so I want to use $this->db->select('*'). I think  $this->db->distinct() does not take any column as parameter. It differentiate result based on select. How can I do this?

A: $this->db->select('*');
        $this->db->group_by('column_name');
        $this->db->from('tbl_name');
        $query = $this->db->get();
        return $query->result();

try this

A: You should use group_by in place of distinct.
because distinct will return unique rows. but to have unique column by row you should do group by.
Hope this helps.

A: Try like this
$this->db->select('DISTINCT `name`'); //You may use $this->db->distinct('name');
$this->db->select('*');

Select the distinct values by names.And your SELECT spelt wrong,may be its a typing mistake.And you can also use GROUP BY like
$this->db->select('*');
$this->db->group_by('name');

A: $this->db->select('column names');
$this->db->distinct();
$query = $this->db->get('table name');
$query->result();

A:    $this->db->select('job,id');
   $this->db->group_by('job');
   $query= $this->db->get('technicals')->result_array();
   if(!empty($query)){
       return $query;
   }else{
       return false;
   }


text:
Q: How to call ListView SelectionChanged method? I have the following method that is called when ListView item selection is changed:
private void SlideTransitionsList_SelectionChanged(object sender, SelectionChangedEventArgs e)
{

.........
}

I would like to call this method from some other method. How would I do that?

A: That is an event handler. It's fired on UI actions. Calling it directly isn't a great idea. Put a method inside it, and then you can call that method if you need to from other places.
private void SlideTransitionsList_SelectionChanged(object sender,     SelectionChangedEventArgs e)
{
    DoSomeStuffOnSelectionChanged();
}

public void DoSomeStuffOnSelectionChanged()
{
    // enter code here
}

A: Extract all code from SlideTransitionsList_SelectionChanged handler to other method and call it.
private void SlideTransitionsList_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
    DoSmth();
}
...
private void OtherMethod()
{
    DoSmth();
}

A: If the paramters of sender and e are not used, simply call the method directly from any other method.
SlideTransitionsList_SelectionChanged(null, null);

Note that you are not firing off an event by calling this method; this is just the event's callback method and can be used by any other method.

The advice given in the other answers are just as correct, but are simply syntatic suger for coding paradigms and can be used as preference or styles are dictated.


text:
Q: Adding a conditional number of elements to a Scroll View in Android Studio Suppose within a scroll view I want to have n rows, where n is a number determined by how many items were selected using check boxes on a different screen.  I restricted the maximum height the scroll view can take up on the screen by putting it inside a linear layout.  Normally you could just add elements by doing something like the following:
<LinearLayout>
   <Scroll View>
        <TextView>
        <TextView>
         ...
    </ScrollView>
</LinearLayout>

but since the number of TextView objects is dependent on how many check boxes were selected on the previous screen, how could I make sure that I add the appropriate number of textView objects within the scrollView?

A: Best way is to use RecyclerView. If you still want to use ScrollView then create a layout for each row or each item. Add that layout to ScrollView from your Java class programmatically number of times you want.
LinearLayout scrollLayout = ......
scrollLayout.removeAllViews();
for(int i = 0; i<totoalSelected; i++){
   View view = LayoutInflater.from(context).nflate(R.layout.my_layout,null,false);
   // initialize view with data if needed
   scrollLayout.addView(view);
}


text:
Q: Flask 400 error handler not triggered for bad HTTP request syntax I have a flask app that receives bad requests from another software. I would like to manually handle these requests as I can then still call the relevant functions. A sample bad request looks like this GET GET / HTTP/1.1 with the additional GET in front
Hence, I tried to add a custom error handler as shown in the documentation. However, I am unable to make it work and the default error handler is used instead. This is my code:
from flask import Flask
app = Flask(__name__)

@app.route('/')
def hello_world():
    return 'Hello, World!'

@app.errorhandler(400)
def handle_bad_request(e):
    print('Custom handler active')
    return 'bad request!', 400

if __name__ == '__main__':
    app.run()'

I used Packetsender to send similar bad requests, and Flask receives them and uses the default error handler as I can see in my console:
127.0.0.1 - - [18/Jan/2021 17:49:28] code 400, message Bad request syntax ('GET GET / HTTP/1.1')
127.0.0.1 - - [18/Jan/2021 17:49:28] "GET GET / HTTP/1.1" HTTPStatus.BAD_REQUEST

So, why is my custom error handler not used? Is this somehow related to the ridiculously incorrect syntax of the requests? Any feedback would be helpful

A: Error handlers are for unhandled errors in the application code. Sending a bad HTTP request causes an error at the HTTP server layer (the Werkzeug development server in your case, or an HTTP server like Nginx in production). There is no way for Flask or any other WSGI application to handle the errors you're seeing, as the request is invalid, so it doesn't make it to the application layer.


text:
Q: How to use different assets if local or live When building locally I want to use an unminified version of my JS. On the live site, I want to use the compiled and uglified version.
In my theme, what's the best way to output the correct one?

A: WordPress has constants that can be defined in the wp-config.php. Have a read here
Something like this might help
//setup the production names for the files
$js_file = 'scripts.min.js';
$css_file = 'styles-compressed.css';

//check for WP_DEBUG constant status
if( defined( 'WP_DEBUG' ) && WP_DEBUG ) {

    //check for SCRIPT_DEBUG constant status
    if( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) {
        $js_file = 'scripts.js';
        $css_file = 'styles-development.css';
    }
}

//load the files
wp_enqueue_script( 'plugin_scripts', $basepath . '/js/' . $js_file  );
wp_enqueue_style( 'plugin_styles', $basepath . '/css/' . $css_file  );


text:
Q: "Sorry Ubuntu * has experienced an internal error" /usr/bin/compiz I installed 13.04 as a virtual machine using VirtualBox from Oracle. When it was done doing the install, it says that it needs a reboot. After the reboot, I got this message:

Sorry Ubuntu 13.04 has experienced an internal error /usr/bin/compiz

I'm not sure what it means and how to resolve it.

A: It just means there's been a problem with compiz, which is the window manager on Ubuntu. If you don't experience any problems, then it has corrected itself. However, you can file bugs if you want to tell developers what happened so that they can fix it.
If your desktop is working properly, you don't have to worry about it. But you'll probably want to install Virtual Box Guest Additions, which will provide drivers for your graphics and other things.

A: I had the same problem.
I solved it by selecting into VirtualBox properties "Activate 2D acceleration". After that the desktop is working.


text:
Q: Select Audio device on iPhone Is there a way to let the user select which device they use for audio output?
In the docs I have found that you can select which route to use by setting kAudioSessionProperty_OverrideAudioRoute to either:

*

*kAudioSessionOverrideAudioRoute_None, or

*kAudioSessionOverrideAudioRoute_Speaker

However I would like to let the user to use their Bluetooth headset to hear the audio.
If you look in Apple's own 'Voice memos' app, in the playback menu there is a button in the top left which lets you choose which audio device to use. When a Bluetooth headset is attached, pressing the button brings up a menu which makes it possible to select between:

*

*Bluetooth headset

*iPhone

*Speaker

Is there a way to achieve this functionality using standard Apple APIs in my own app?

A: In 3.1 there are two protocols that support outputting audio to bluetooth devices and the use depends on the accessory. The first is A2DP which is used with accessores that support recieving stereo music, and the other is hands free for all handfree accesories.
To activate the first option, you need to use the MPVolumeView class which has a volume slider and a audio device selection button, when this view is added to any of the views in the app, it provides a way for the user to set the volume and select a BT device if connected ( this is the only way I found)
On the other hand, the second option can be activated using the call
 UInt32 bt = TRUE;
 result = AudioSessionSetProperty(kAudioSessionProperty_OverrideCategoryEnableBluetoothInput , sizeof(UInt32), &bt);

The appliction must initialize the audio session and use the corect catagory ( it must support recoding for this to work). After the EnableBluetoothInput  is set all Input and output audio will be routed through the handsfree device ( if connected of course :) )

A: The easiest way is to add a MPVolume control (link to documentation) to your user interface and set showsVolumeSlider = NO and  showsRouteButton = YES.
User will have a route button to route the audio to a device of their choice.

A: It works with CoreAudio: Can the iPhone 3.0 SDK provide full access to Bluetooth devices (headsets)?


text:
Q: What is the difference between scipy.integrate.odeint and scipy.integrate.ode? I have read the docs for these here, but it just states that odeint is "an integrator with a simpler interface based on lsoda from ODEPACK"
What is the actual difference? Under what circumstances is using one more appropriate than the other?

A: If you can solve your problem with odeint, I would recommend that.  It is simply a function that integrates an ode using lsoda.
If you want a lot more options, ode is a class with many methods and solvers:

*

*scipy.integrate.ode

*

*scipy.integrate.ode.integrate

*scipy.integrate.ode.set_f_params

*scipy.integrate.ode.set_initial_value

*scipy.integrate.ode.set_integrator

*scipy.integrate.ode.set_jac_params

*scipy.integrate.ode.set_solout

*scipy.integrate.ode.successful

A: I was wondering about the same question, and I found later that there is an other API available in scipy.integrate. The method is clearly explained in the documentation.
It could interest people comparing odeint (odeintw for complex) and ode (complex_ode for complex).
It is called scipy.integrate.solve_ivp, available from scipy v1.0.0 :
https://scipy.github.io/devdocs/generated/scipy.integrate.solve_ivp.html#scipy.integrate.solve_ivp
In this solver, LSODA cant handle complex but BDF is faster in my case.