text:
Q: Operator Norm of a Matrix composed of Standard Basis and Fourier Basis Let $\mathbf{A}_n$ be an $n\times 2n$ matrix (where $n=2^k$) composed of Fourier basis and standard basis; that is,
$$\mathbf{A}_n = \begin{bmatrix}\mathbf{I}_n & \mathbf{F}_n\end{bmatrix}$$
where $\mathbf{I}_n$ is the identity matrix and $\mathbf{F}_n$ is the DFT matrix.
Generally, a DFT matrix $\mathbf{F}_n$ is defined as
$$
\mathbf{F}_n = \frac{1}{\sqrt{n}}
\begin{bmatrix}
\omega^0 & \omega^0 & \omega^0 & \cdots & \omega^0 \\
\omega^0 & \omega^1 & \omega^2 & \cdots & \omega^{n-1} \\
\omega^0 & \omega^2 & \omega^4 & \cdots & \omega^{2(n-1)} \\
\vdots & \vdots & \vdots & \ddots & \vdots \\
\omega^0& \omega^{n-1}& \omega^{2(n-1)}& \cdots & \omega^{(n-1)(n-1)}
\end{bmatrix}
$$
where $\omega = \exp(-2\pi i / n)$ is the primitive $n^\mathrm{th}$ root of unity.
For example, if $n=2^2$, $\mathbf{A}_4$ is the concatenation of $\mathbf{F}_4$ and $\mathbf{I}_4$:
$$
\mathbf{A}_4=
\begin{bmatrix}
1 & 0 & 0 & 0 & 1/2 & 1/2 & 1/2 & 1/2 \\
0 & 1 & 0 & 0 & 1/2 & -i/2 & -1/2 & i/2 \\
0 & 0 & 1 & 0 & 1/2 & -1/2 & 1/2 & -1/2 \\
0 & 0 & 0 & 1 & 1/2 & i/2 & -1/2 & -i/2
\end{bmatrix}
$$
One can easily obtain $\mathbf{F}_4$ by plugging in $\omega = \exp(-2\pi i / 4) = -i$.

I'm interested in computing the operator norm of $\mathbf{A}$ defined as:
$$||\mathbf{A}||_{op} = \max_{||\mathbf{x}||_2 = 1} ||\mathbf{A}\mathbf{x}||_2$$
where $||\mathbf{x}||_2$ is the Euclidean norm of the vector $\mathbf{x}$.
Do we have a closed form of $||\mathbf{A}_n||_{op}$ for any $n$?

A: The singular values of $(I,F)$ are the square roots of the eigenvalues of $(I,F)(I,F)^\ast=I+FF^\ast$. Since the DFT matrix $F$ is unitary, $I+FF^\ast=2I$. Consequently, all singular values and in turn the operator $2$-norm of $(I,F)$ are equal to $\sqrt{2}$, regardless of the size $n$.


text:
Q: Characterization of subgroup dual to Frattini Subgroup Let $G$ be a group and let $\mathcal{L}(G)$ denote the complete lattice of subgroups of $G$. We have that every automorphism of $G$ induces a lattice-automorphism on $\mathcal{L}(G)$. From here we see that every maximal subgroup of $G$ is sent to a maximal subgroup of $G$. Considering the infimum (or intersection) of all the maximal subgroups yields a characteristic subgroup of $G$ which is commonly called the Frattini subgroup. Dually, we can see that every minimal subgroup of $G$ is also sent to a minimal subgroup. Considering the supremum of all the minimal subgroups of $G$ yields another characteristic subgroup of $G$.
I have two questions. First, whether there are any references which consider this specific subgroup, as I haven't been able to find any literature on it.
Second and more pertinent, I was wondering if anyone could find a characterization of this subgroup which reflects the characterization of the Frattini subgroup. That is, the Frattini subgroup can be defined as the subgroup of all non-generators; does there exist a similar property for this other subgroup?
Letting $\Psi(G)$ represent this specific subgroup, I've found that if $A\subseteq G$ is another subset of $G$ such that $\Psi(G)\not\subseteq A$ and $\langle A, \Psi(G)\rangle = G$ then $\langle A\rangle\neq G$. But I'm looking for a characterization in terms of the elements of $\Psi(G)$.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Can't install geopandas in Anaconda environment I am trying to install the geopandas package with Anaconda Prompt, but after I use conda install geopandas an unexpected thing happened:
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: -
Found conflicts! Looking for incompatible packages

After this, it proceeds to search for conflicts, but hours pass without finishing. In the end, I still cannot use geopandas.
I have also tried installing geopandas in a different virtual environment and it works but I do not know how to use the environment in Jupyter Notebooks.
I would like to know, how can install geopandas without a separate environment?
Or, alternatively, how can I use geopandas in Jupyter Notebooks after install it in a separate environment?

A: Install it in a new env, and include ipykernel if you plan to use it in Jupyter:
conda create -n my_env geopandas ipykernel

Note, nb_conda_kernels should be installed install in your base env (i.e. where you launch Jupyter from). This enables Jupyter to automatically recognize other envs that are kernel-ready:
conda install -n base nb_conda_kernels

A: in my case, I installed geos firstly: pip install geos, then conda install geopandas and everything went through.

A: If you want to install geopandas in an EXISTING environment, use conda-forge as follows:
conda install --channel conda-forge geopandas

A: I faced the same problem. As far as I understand, my mistake was to install geopandas or pyproj with pip instead of conda. When trying to fix the issue (uninstalling geopandas, pyproj) I completely crashed my env.
I fixed the issue by completely reinstalling anaconda and creating a new separate conda env with an older version of python (python=3.8 instead of 3.9). Then everything ran smoothly.

A: I had this issue when Jupyter had been installed from the default channel. For me running conda uninstall jupter followed by conda install -c conda-forge geopandas worked.

A: You can install geopandas with pip, however, geopandas requires other dependencies (such as pandas, fiona, shapely, pyproj, rtree). You need to make sure that they are properly installed. After that you should be able to use them in jupyter with a simple import geopandas.


text:
Q: SQL Server Data Format I am working on writing a high-performance data retrieval/storage class for my application that uses a SqlDataReader to retrieve data from a SQL server.
Out of curiosity, I wanted to know what form the data comes in from the SQL server. Characters? Binary? Some other form?
Unfortunately I cannot do any packet sniffing at my office, which is one way I think this answer could be found.
EDIT: The purpose of this question was to determine the format the data is retrieved in from SQL server to allow for as little manipulation as possible before placing it in a data structure.
This question is in relation to a previous question of mine where I found the difference between converting data formats into strings produces a significant impact on performance.

A: The format is documented at Tabular Data Stream Protocol Specification. That being said, the protocol and wire format are largely irrelevant, if you retrieve so much data as to for the speed of transfer to matter you are already deep down the wrong path.
Make sure your data access is optimized, and most importantly your data model is well designed and matches the workload expected (in other words: have covering indexes for the critical queries).
If you retrieve large chunks of data (eg. media files stored in the database) then there are some specific ways to use the SqlCommand class, namely the SequentialAccess behavior flag:

Provides a way for the DataReader to handle rows that contain columns
  with large binary values. Rather than loading the entire row,
  SequentialAccess enables the DataReader to load data as a stream. You
  can then use the GetBytes or GetChars method to specify a byte
  location to start the read operation, and a limited buffer size for
  the data being returned.

For an example of how to use this, see Download and Upload images from SQL Server via ASP.Net MVC.


text:
Q: Multiple UTC date time comparison I have these records in my table:

11/11/2015 04:48:05 pm
  11/11/2015 04:50:58 pm
  11/11/2015 05:07:17 pm
  11/11/2015 05:08:32 pm

When i use my DateTimeUtil::getSystemDateTime(); - todays time
I need to compare the other records with todays time, to find the record which is closest to the current datetime.
I am thinking of using DateTimeUtil::getDifference but i can't make the logic right when there are more then two UTC dateTime.

A: Forget about comparing dates, just sort the records in descending date/time order.
select firstonly custTrans order CreatedDateTime desc;

This will select the record closest to now, provided someone did not turn the clock into the future.

A: I succeeded my logic, by using this, thanks though.
str                lastUser;
utcDateTime        highest = DateTimeUtil::minValue();

ttsBegin;
while select ItemId, CreatedDate, User  from this
    where this.ItemId == _itemId // && this.ProductType == Options::Changed
    {
      //  info(strFmt("CurrentDate: %2", this.ItemId, this.CreatedDate));
    /*    if(this.CreatedDate < loweste)
        {
            loweste = this.CreatedDate;
        } */
         if(this.CreatedDate > highest)
        {
            highest = this.CreatedDate;
            lastUser = this.User;
        }
     //   info(strFmt("lowest is: %1" , loweste));
     //   info(strFmt("highest is: %1 ", highest));
   /*     if(loweste < highest)
        info(strFmt("highest is: %1" , loweste));
     */
    }


text:
Q: Normally ON Switch using N-CH MOSFET and pull-up resistor I am learning about electronics and am having a hard time finding a normally closed (i.e. on) switch using transistors and FETs. Am I violating any rules with the circuit below which is using an enhancement mode N-channel MOSFET with an NPN driver transistor? Can I simply pull up the FET's gate high with R1 to keep the switch on (by default)?

simulate this circuit – Schematic created using CircuitLab

A: Yes, that's perfectly valid (should be a base resistor on the BJT, of course).
Another method you might use could be to use a P-channel MOSFET with a pull-down resistor (just the complement of your circuit). However this does not work if the power is removed from the micro since the protection circuit will drag down the output pin. Your circuit also allows the micro to switch a higher voltage than its supply (for example a 3.3V  output switching a 5V or 12V circuit).
Edit: Added are two additional circuits- one using another NPN transistor which will work with power removed from the micro and using an opto as you suggested. Both are high-side switches and the opto one adds isolation while actually simplifying the circuit.

simulate this circuit – Schematic created using CircuitLab
A third approach is to use a depletion mode MOSFET or a JFET but that's a lot trickier because you have to come up with a negative voltage to turn the transistor off. It does work in the absence of any significant voltage supply though. Another disadvantage is that power devices are unavailable in P-channel type.


text:
Q: Swing change the JSpinner back and fore colors How can I change the background and foreground color of a JSpinner in swing?
is there any simple solution except override the paint() method?
setting the background or foreground color doesn't work, at least for me.
I also tested with all default look and feels, no success.
JDK: 1.7.0.51 Win764

Thanks in advance

A: The JSpinner is a compound component. Simply said: By default, it conains a JFormattedTextField that shows the value, and two buttons for increasing and decreasing the value.
One way to set these colors may thus be to obtain the text field from the spinner, and set its foreground and background color:
Component c = spinner.getEditor().getComponent(0);
c.setForeground(Color.BLUE);
c.setBackground(Color.RED);

but you might have to make this more robust to make sure that it works for all LookAndFeels, and all editors, regardless of how the spinner (and the editor) are constructed internally.

EDIT in response to the comment: Does it work in this case?
import java.awt.Color;
import java.awt.Component;

import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JSpinner;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;

public class SpinnerColors
{
    public static void main(String[] args)
    {
        // Optionally:
        setLookAndFeel();

        SwingUtilities.invokeLater(new Runnable()
        {
            @Override
            public void run()
            {
                createAndShowGUI();
            }
        });
    }

    private static void setLookAndFeel()
    {
        try
        {
            UIManager.setLookAndFeel(
                UIManager.getSystemLookAndFeelClassName());
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
    }

    private static void createAndShowGUI()
    {
        JFrame f = new JFrame();
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        JSpinner spinner = new JSpinner();
        setColors(spinner, Color.BLUE, Color.RED);

        f.getContentPane().add(spinner);
        f.pack();
        f.setLocationRelativeTo(null);
        f.setVisible(true);
    }

    private static void setColors(
        JSpinner spinner, Color foreground, Color background)
    {
        JComponent editor = spinner.getEditor();
        System.out.println("Editor "+editor);
        int n = editor.getComponentCount();
        for (int i=0; i<n; i++)
        {
            Component c = editor.getComponent(i);
            System.out.println("Component "+i+": "+c);
            if (c instanceof JTextField)
            {
                c.setForeground(foreground);
                c.setBackground(background);
            }
        }
    }
}

Note that if you are using the "Nimbus" look and feel, things might be more difficult. Nimbus is known for notoriously ignoring background colors....

EDIT2 in response to the second comment: It is basically possible to access the buttons, but for the default L&Fs, these are specialized buttons (BasicArrowButton) where the paint method is overridden to paint the tiny "up" and "down" arrows. So setting the foreground on these will not have any effect. Instead, you'd have to modify the L&F defaults, which may always be a hassle. So this might or might not have the effect that you want to achieve:
private static void setButtonColors(
    JSpinner spinner, Color foreground, Color background)
{
    int n = spinner.getComponentCount();
    for (int i=0; i<n; i++)
    {
        Component c = spinner.getComponent(i);
        if (c instanceof JButton)
        {
            c.setForeground(foreground); // Has no effect
            c.setBackground(background);
        }
    }
}


text:
Q: Ada: How to define a random constant? I am currently working through John English' "Ada 95: The Craft of Object-Oriented Programming". I am at task 5.1:

Write a program to play a simple guessing game. Define an integer type with a range of values from 1 to 1000 and declare a secret value as a constant of this type, and then give the user ten chances to guess its value.

What I wrote (as a stub) was now
procedure je_5_1 is
  type guess_value is new Integer range 1..1000;
  secret : guess_value;
  package random_guess_value is new Ada.Numerics.Discrete_Random(guess_value);
  Gen : random_guess_value.Generator;
begin
  random_guess_value.Reset(Gen);
  secret := random_guess_value.Random(Gen);
end je_5_1;

Obviously this does not implement the requirement to declare a secret value as a constant. But since I have to call Reset(Gen) before I can assign a randomly generated value to secret, I cannot define the variable secret as a constant before begin.
Is it still possible to define secret as a random constant?

A: Use a "declare" to open new scope. For example:
with Ada.Text_IO; use Ada.Text_IO;

procedure Example is

   package Integer_Text_IO is new Integer_IO (Integer);
   use Integer_Text_IO;

   A : Integer;

begin

   Get(A);

   declare
      C : constant Integer := A;
   begin
      Put(C);
   end;

end Example;

I think that what the text says is that you should choose the secret value when you write your code and insert it "hard coded" into the source.

A: The exercise later suggests that you "Modify the program so that the value to be guessed is chosen at random each time the program is run." This requires that the Generator be initialized before the secret value is established. One approach is to encapsulate the secret value in an Abstract State Machine, illustrated here. In the example below, an instance of the Generator is Reset and used to initialize Secret in a sequence of statements that is executed when the package is elaborated, as discussed here and illustrated here.
package Game_Model is
   subtype Guess_Value is Integer range 1 .. 1000;
   function Check(value : Guess_Value) return Boolean;
end Game_Model;

package body Game_Model is
   package Guess_Generator is new Ada.Numerics.Discrete_Random(Guess_Value);
   G: Guess_Generator.Generator;
   Secret : Guess_Value;

   function Check(Value : Guess_Value) return Boolean is
   begin
      return Value = Secret;
   end;

begin
   Guess_Generator.Reset(G);
   Secret := Guess_Generator.Random(G);
end Game_Model;

Given a guessed Value, you can Check it as required in your program.
Value : Game_Model.Guess_Value;
…
Ada.Text_IO.Put_Line(Boolean'Image(Game_Model.Check(Value)));

A: You might create another procedure inside the declaration part of the main procedure that would return the random number.
procedure je_5_1 is
  type guess_value is new Integer range 1..1000;

  function get_random return guess_value
  is
     package random_guess_value is new Ada.Numerics.Discrete_Random(guess_value);
     Gen : random_guess_value.Generator;
  begin
     random_guess_value.Reset(Gen);
     return random_guess_value.Random(Gen);
  end get_random;

  secret : constant guess_value := get_random;
begin
   --do your 10 chance loop
end je_5_1;


text:
Q: How to print project related comments in Laravel 5.2? I need to print my comments table comments related to each project in my Laravel application. I am using domPDF for my PDF class. This is my PDF print controller:
class pdfController extends Controller
{
    public function getPDFFF($id){
        $comments = Comment::project($id)->get(); //line 14
        $pdf = PDF::loadView('pdf.out',['comments'=>$comments]);
        return $pdf->stream('comment.pdf');
    }
    //
}

This is my comments table structure:
id  comments  project_id
 1    asc        1
 2    fgt        5
 3    gft        2

But with this controller I get the following error message:

ErrorException in pdfController.php line 14: Non-static method App\Comment::project() should not be called statically, assuming $this from incompatible context

How can I fix this problem?

A: Just use project_id from comments table to get comments for some project:
$comments = Comment::where('project_id',$id)->get();


text:
Q: Interpreting a (function of) probability distribution as a random variable? Consider, for example, Wikipedia's definition of the entropy of of a discrete random variable $X$:

$$H(X) = \mathbb{E}[I(X)] = \mathbb{E}[-ln(P(X))]$$ Here $\mathbb{E}$
  is the expected value operator, and $I$ is the information content of
  $X$. $I(X)$ is itself a random variable.

Since $I(X)$ is a function of $P(X)$, the PMF $P(X)$ itself is considered to be a random variable that takes on the value $P(x)$ in the event $X=x$. Is my interpretation correct?
A bit of a background: I see this kind of thing a lot in statistics problems dealing with KL divergence (e.g. in EM or variational inference where we often deal with $\mathbb{E}_{q(z)}[logp(z|\theta)]$), and I've always treated the expected value operator like a "macro" where I substitute $\mathbb{E}_{q(z)}[\cdot]$ with $\sum_z \cdot q(z)$ or $\int \cdot q(z) dz$ provided that the argument is some function of some random variable. I'm not sure if this treatment is correct, considering the formal definition of the "expected value operator".

A: Yes, the PMF/PDF is a function $P(\cdot)$ that takes in some $x$ and gives you a real umber. In these quantities that you mention, we plug in the random variable itself as the argument, so $P(X)$ is random.
Yes your interpretation of expectation is fine. Note that these quantities are just special cases of functions of random variables. For a random variable $X$ I am sure you understand what $f(X)$ and $\mathbb{E}[f(X)]$ denote. Here we are just thinking of special cases of $f$, such as a PMF/PDF like $P(\cdot)$ or a log likelihood $\log p(\cdot \mid \theta)$


text:
Q: How can we give mouse click functionality along with mouseover functionality? How can we add mouse click event when already we have mouseover event my requirement are like this way:
Example: - http://wheaton.advisorproducts.com/investment-advisory
Requirement -

*

*MouseOver functionality is working in correct order.

*I want to add click event along with mouseover event together -
When user click on any of the images part which is given in both top funnel and bottom rounded circle - then their related text or content will be visible untill user click on any other section and also along with this click event mouseover functionality will work in the same way.
Means - When ever user move mouse over the image section their related text will be visible but if user click any of the section then their related text will be visible every time until user click on any other part or section or move mouse over other section.
Below are the js which i have created for only mouseover functionality - now i want both mouseover and click event together.
var IdAry=['slide1', 'slide2','slide3','slide4','slide5','slide8','slide9','slide12','slide13','slide14','slide15','slide16'];
window.onload=function() {
 for (var zxc0=0;zxc0<IdAry.length;zxc0++){
  var el=document.getElementById(IdAry[zxc0]);
  if (el){
   el.onmouseover=function() {
     changeText(this,'hide','show')
    }
   el.onmouseout=function() {
     changeText(this,'show','hide');
    }
  }
 }
}
function changeText(obj,cl1,cl2) {
   obj.getElementsByTagName('SPAN')[0].className=cl1;
   obj.getElementsByTagName('SPAN')[1].className=cl2;
}

Below is the HTML part:

                Each client is provided with quarterly aggregated account statements detailing investment performance across individual accounts. Periodic client meetings provide opportunities to receive more detailed performance attribution.

                How funds are invested across broad asset classes is the primary determinant of long term returns and determines the overall risk profile of your portfolio. We therefore take great care in recommending an asset allocation that incorporates the financial goals and risk tolerance of each client.

                We continuously monitor our managers to ensure that each strategy is performing as expected.

                The asset allocation decision is implemented with money managers vetted by WWP for their experience, skill and expertise in their respective investment strategies, including tactical ETF managers, growing dividend equity managers or fixed-income managers.

A: You can do it in different ways, first you could leave the mouseover behavior to css, as I can see, it's just a text area displaying.
div {display:none;}
div:hover, div:active {display:block;}

Then if you want the same behavior for different events, i'd advise to use jquery that helps declaring multi events with the on and bind methods.
 $.bind('click, hover', function(){
     //do stuff
 })

There is the on method aswell :
 $.on('click, hover', function(){
     //do stuff
 })

A: Top Graph:
Letting jQuery handle the hover events instead of using the :hover css pseudo is the only way to do this, as jQuery cannot manipulate the :hover state, while css cannot provide a toggle. Instead, use attributes and attribute selectors. Both available to manipulate through css and jQuery
CSS:
.TopGraph a[attr-active="one"]
{
    float:left;
    width:240px;
    height:104px;
    position:absolute;
    left:0;
    top:35px;
    -webkit-border-radius: 20px 100px 100px 20px;
    -moz-border-radius: 20px 100px 100px 20px;
    border-radius: 20px 100px 100px 20px;
    background:url('../images/one-hover.jpg') 0 0 no-repeat;
    behavior: url('css/PIE.htc');
}

.TopGraph a[attr-active="two"]
{
    float:left;
    width:250px;
    height:180px;
    position:absolute;
    left:250px;
    top:51px;
    -webkit-border-radius: 100px 20px 20px 500px;
    -moz-border-radius: 100px 20px 20px 500px;
    border-radius: 100px 20px 20px 500px;
    background:url('../images/two-hover.jpg') 0 0 no-repeat;
    behavior: url('css/PIE.htc');
}

.TopGraph a[attr-active="three"]
{
    float:left;
    width:221px;
    height:103px;
    position:absolute;
    left:84px;
    top:155px;
    -webkit-border-radius: 20px 100px 100px 20px;
    -moz-border-radius: 20px 100px 100px 20px;
    border-radius: 20px 100px 100px 20px;
    background:url('../images/three-hover.jpg') 0 0 no-repeat;
    behavior: url('css/PIE.htc');
}

JS:
$(document).ready(function() {
    $('.TopGraph').find('a').each(function() {
        $(this).attr('attr-active', '');
        $(this).attr('attr-clicked', '');
        $(this).click(function(event) {
            event.preventDefault();
            var isAnyActive_dsanjj325kj4 = false;
            if ($(this).attr('attr-clicked') == "true") {
                isAnyActive_dsanjj325kj4 = true;
            }
            $('.TopGraph').find('a').each(function() {
                $(this).attr('attr-active', '');
                $(this).attr('attr-clicked', '');
            });
            if (isAnyActive_dsanjj325kj4 == false) {
                $(this).attr('attr-clicked', 'true');
                $(this).attr('attr-active', $(this).attr('class'));
            }
        });
        $(this).hover(function() {
            if ($(this).attr('attr-clicked') == '') {

                var isAnyActive_dsanjj325kj4 = '';
                $('.TopGraph').find('a').each(function() {
                    $(this).attr('attr-active', '');
                });
            }
            $(this).attr('attr-active', $(this).attr('class'));
        }, function() {
            $('.TopGraph').find('a').each(function() {
                $(this).attr('attr-active', '');
                if ($(this).attr('attr-clicked') == 'true') {
                    $(this).attr('attr-active', $(this).attr('class'));
                }
            });
        });
    });
});

Bottom Graph [original answer]:
By attaching a attribute to the element to detect if it has been clicked, then resetting that attribute to all elements if another element is interacted with, this effect is possible:
$(document).ready(function() {
    $('[id^="slide"]').each(function() {
        $(this).attr('attr-active', 'false');
        $(this).attr('attr-clicked', 'false');
        $(this).click(function(event) {
            event.preventDefault();
            var preExist_ksnfk4n534nj5345 = false;
            if ($(this).attr('attr-clicked') == 'true') {
                preExist_ksnfk4n534nj5345 = true;
            }
            $('[id^="slide"]').each(function() {
                $(this).attr('attr-active', 'false');
                $(this).attr('attr-clicked', 'false');
                changeText($(this), 'show', 'hide');
            });
            if (preExist_ksnfk4n534nj5345 == true) {
                $(this).attr('attr-clicked', 'false');
                changeText($(this), 'hide', 'show');
            } else {
                $(this).attr('attr-active', 'true');
                $(this).attr('attr-clicked', 'true');
                changeText($(this), 'hide', 'show');
            }
        });
        $(this).hover(function() {
            var isAnyActive_san9h39423ht = false;
            $('[id^="slide"]').each(function() {
                $(this).attr('attr-active', 'false');
                changeText($(this), 'show', 'hide');
            });
            changeText($(this), 'hide', 'show');
        }, function() {
            if ($(this).attr('attr-active') == 'false') {
                changeText($(this), 'show', 'hide');
            }
            $('[id^="slide"]').each(function() {
                if ($(this).attr('attr-clicked') == 'true') {
                    changeText($(this), 'hide', 'show');
                }
            });
        });
    });
});

function changeText(obj, cl1, cl2) {
    obj.children('span').eq(0).attr('class', cl1);
    obj.children('span').eq(1).attr('class', cl2);
}

A: You could add
el.onclick= function(){
//code
}

as seen here

A: This should not be a problem, just make two functions that are showing and hiding text and called them from both events.
I.E.
el.onmouseover = function(){
showFunction();
};
el.onclick = function(){
showFunction();
}
function showFunction(){
changeText(this,'hide','show');
}

Also you should consider using jquery as it is much eiser and cleaner to select elements and catch events. Also consider using css class instead of list of id-s, cause just it is much cleaner.
Also if you use css class i.e. class="slide" you can call closing of previous text much eiser:
el.onclick = function(){
$(".slide").hide(); // hides all text elements.
showFunction();
}


text:
Q: Apache on Solaris 11: connection from localhost works, remote host's connection gets reset by peer I have configured an apache2 server on Solaris 11, which seems to work well since it shows the correct behaviour when I access it on localhost. However, any remote connection is reset by peer. I already disabled the ipfilter firewall to no avail. A telnet connection from a remote host on port 80 works fine, though:
$ telnet myserver.com 80
Trying xxx.xxx.xxx.xxx...
Connected to myserver.com.
Escape character is '^]'.
GET /

It works!
Connection closed by foreign host.

With curl I run into this "connection reset by peer" error:
$ curl http://myserver.com
curl: (56) Recv failure: Connection reset by peer

I'm totally out of ideas where to look for a fix... Any hint is highly appreciated! The configuration of the server's operating system is an "out-of-the-box" installation, as is the Apache installation (although I use the apache from openCSW, but this didn't make a difference). Is there any security context which filters http connections from remote hosts where I could have a look at? Thanks for helping!

A: Can you check the apache configuration file to see if it is listening on the "localhost" ? Check the Listen or BindAddress directives. Also try to see if http://ip_address works.


text:
Q: Excel If Function Error I'm trying to create a function that test different values in 3 columns in order for correctness.
Explanation of the intended code:
If the first character of column A is an x, the number in column C is 20, and column G value is equal to column U then it is correct and prints yes. If the first character in column a isn't an x and column C is equal to 20 and column H is equal to column U then it is correct and prints yes. For all else if the values in column G are equal to those in column U then the function prints yes otherwise it prints no.
The specific error is invalid name error.
This is what I see when I go to see calculation:
IF(FALSE,#N/A,IF(TRUE,#NAME?,IF(G3=U3,yes,no)))

Here is the function ,but I can not find how to fix the error.
=IF(AND(RIGHT(A3,1)="x",C3="20", G3=U3),"yes",IF(AND(NOT(RIGHT(A3,1)="x"),C3="20",H3=U3),yes,IF(G3=U3,yes,no)))

I went to see calculation, and the error is located where the first yes is, but I don't know what the issue is.

A: The issue was with the way yes is typed into the formula. It requires "" because it is text.
I figured it out after I evaluated the function with the calculation steps button. Then I saw where the error was occurring based on the evaluation and manipulated the function.


text:
Q: Return search results from only 2 document libraries How to configure search to return results from only two document libraries in a subsite? Whenever I type a keyword in that subsite's search box, it should always return results from the 2 document libraries created in that subsite.

A: Add (site:UrlOfLibrary1 OR site:UrlOfLibrary2) as additional query terms

A: In SharePoint Central Admin, you can create a Scope that can be applied to particular search facilities.  A scope can include/exclude URls that you define so for example, you could create a scope that only includes the URL for your two document libraries and apply it to your search box. Note, you should only include the URL to the library such as http://siteCollection/subSite/library/ and not a URL that includes view information such as http://siteCollection/subSite/library/AllDocuments.aspx.
You can configure a scope under General Application Settings > Search > Farm Search Administration > Search Service > Scopes.   Create the scope with a name you like, then add some rules.  In your case, you would want to create a Folder rule specifying your library name and set the behaviour to Include.  You have to repeat this per library.
Once you have created the rules, run a full crawl and apply the scope to your search box using the scopes name.
For more information see this Microsoft article or this blog post.


text:
Q: Openmpi setting btl flags --mca btl tcp vs --mca btl_tcp_if_include eth1 I am looking the documentation of how to set btl flags to use network specific protocol and specific connection.
I am seeing the btl selection general documentation documentation, but a bit confused.
What I understand (please correct me if I am wrong) If I want to use tcp protocol I need to specify --mca btl tcp. And if I want to use ethernet1 as connection device then I need to specify --mca btl_tcp_if_include eth1.
So if I want to use both of these setting I will set both ?
 --mca btl tcp --mca btl_tcp_if_include eth1 or just setting --mca btl_tcp_if_include eth1 will be okay?

A: Here is what you need to do
mpirun --mca pml ob1 --mca btl tcp,self --mca btl_tcp_if_include eth1 ...

A few comments :

*

*to be on the safe side, you should force the use of pml/ob1 component (otherwise you might end up using richer interfaces such as UCX of OFI)

*pml/ob1 uses the best btl components for point to point communication

*you must always include the btl/self component

*in your case, you want to force the use of btl/tcp

*and you need to tell btl/tcp to use the eth1 interface. setting this parameter does not force the use of the btl/tcp component, that is why you have to manually request it


text:
Q: Search multidimensional array using regular expressions in PHP and return keys This issue is related to following issue:
Search multidimensional array in PHP and return keys
I have following array I would like to search for strings using e.g. regular expressions:
[390] => Array
(
    [0] => hammer
    [1] => Properties
    [2] => tools, hammer, properties
    [3] =>
    [4] => done
    [png] => Array
        (
            [0] => hammer_16x.png
            [1] => hammer_32x.png
        )

    [eps] => Array
        (
            [0] => hammer_16x.eps
            [1] => hammer_32x.eps
        )

    [ico] => Array
        (
            [0] => hammer.ico
        )

)

I would like to especially search these values:
 [0] => hammer
 [1] => Properties
 [2] => tools, hammer, properties
 [3] =>
 [4] => done

e.g. the user shall have the possibility to find this array key when searching for "ham", "tools", "amm" etc.
I tried to adapt the solution posted in the post above but did not manage it. I've also found a solution using array_map, but this did not enable me to explicitly search in a specific attribute (e.g. I would like to further on limit a search to the first index in the array, here [0] => hammer):
$result= array_map('unserialize', preg_filter('/'.$searchterm.'/', '$0', array_map('serialize', $array)));

Your ideas are welcome :)
Thanks!

A: You may use this recursive function of preg_grep:
function preg_grep_recursive( $pattern, $input, $flags = 0, &$output = array() )
{
    foreach($input as $key => $val) {
        if(is_array($val)) {
            preg_grep_recursive($pattern, $val, $flags, $output);
        } else {
            $output[] = $val;
        }
    }

    return preg_grep($pattern, $output, $flags);
}

A: Try the following solution. It doesn't use regular expressions, it use plain string search instead. However it allows some flexibility as you want.
function filter($array, $filter_elem) {
    return array_filter($array, function ($v) use($filter_elem) {
        return
            count(array_udiff_assoc($filter_elem, $v, function ($a, $b) {
                if (!is_string($a) || !is_string($b)) return $a == $b? 0 : 1;
                return stripos($b, $a) !== false || stripos($a, $b) !== false? 0 : 1;
            })) == 0;
    });
}

$array = array(
    '390' => array(
        '0' => 'hammer',
        '1' => 'Properties',
        '2' => 'tools, hammer, properties',
        '3' => false,
        '4' => 'done',
        'png' => array(
            '0' => 'hammer_16x.png',
            '1' => 'hammer_32x.png',
        ),
        'eps' => array(
            '0' => 'hammer_16x.eps',
            '1' => 'hammer_32x.eps',
        ),
        'ico' => array(
            '0' => 'hammer.ico',
        ),
    ),
);

$filter_elem = array(
    '1' => 'prop',
    '2' => 'hammer',
    '3' => false,
    '4' => 'done',
);

print_r(filter($array, $filter_elem));


text:
Q: find input with name attribute is not working - jquery I need to find the child input with name="test".
find("input[name='test']") doesnot work however if I use class instead of name it works, why?
Thanks in advance.
Html:

    <input type="text" class="test" name="test[]" required="">

Jquery:
$("#test-click").on('click', function() {

    let parentDiv = $(this).closest(".test-div");

    let testInput = parentDiv.find("input.test").val();
    console.log(testInput);   //it works

    let testInput1 = parentDiv.find("input[name='test']").val();
    console.log(testInput1);   //gives undefined
}


text:
Q: How to run .apk file After successfull installation of it? I have built an android project by eclipse
After I successfully installed my .apk file by command promot and   success word was getted
I copied it  into a mobile in order  to run it but I getted the error
error in parsing package
Can someone help me thankfully.
My installation way is as follow
C:\Program  Files\Android\android-sdk\platform-tools>adb -s emulator-5554 install -r
 path myfile.apk
71 KB/s (533069 bytes in 7.262s)
        pkg: /data/local/tmp/myfile.apk
Success

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.elhadi.azkarElmuslim"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="17"
        android:targetSdkVersion="17" />

    <application
        android:allowBackup="true"

        android:label="أذكار "
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.elhadi.azkar.Main"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

         <activity android:name=".Activity1"></activity>
         <activity android:name=".Activity2"></activity>
         <activity android:name=".Activity3"></activity>
         <activity android:name=".Activity4"></activity>
         <activity android:name=".Activity5"></activity>
         <activity android:name=".Activity6"></activity>
         <activity android:name=".Activity7"></activity>
         <activity android:name=".Activity9"></activity>
         <activity android:name=".Activity10"></activity>
         <activity android:name=".Activity11"></activity>
         <activity android:name=".Activity12"></activity>
         <activity android:name=".Activity13"></activity>
         <activity android:name=".Activity14"></activity>
         <activity android:name=".Activity15"></activity>
         <activity android:name=".Activity16"></activity>
         <activity android:name=".Activity17"></activity>
         <activity android:name=".Activity18"></activity>
         <activity android:name=".Activity19"></activity>
         <activity android:name=".Activity20"></activity>
         <activity android:name=".Activity21"></activity>
         <activity android:name=".Activity22"></activity>
         <activity android:name=".Activity23"></activity>
         <activity android:name=".Activity24"></activity>
         <activity android:name=".Activity25"></activity>
         <activity android:name=".Activity26"></activity>
         <activity android:name=".Activity27"></activity>
           <activity android:name=".Activity30"></activity>
             <activity android:name=".Activity31"></activity>
             <activity android:name=".Activity32"></activity>
               <activity android:name=".Activity33"></activity>
                 <activity android:name=".Activity34"></activity>
                   <activity android:name=".Activity35"></activity>
                     <activity android:name=".Activity36"></activity>
                 <activity android:name=".Activity37"></activity>
                   <activity android:name=".Activity38"></activity>

                       <activity android:name=".Activity39"></activity>
                         <activity android:name=".Activity40"></activity>
                           <activity android:name=".Activity41"></activity>
                             <activity android:name=".Activity42"></activity>
                               <activity android:name=".Activity43"></activity>
                                 <activity android:name=".Activity44"></activity>
                                   <activity android:name=".Activity45"></activity>
                    <activity android:name=".Activity46"></activity>
                      <activity android:name=".Activity47"></activity>
                        <activity android:name=".Activity48"></activity>
                          <activity android:name=".Activity49"></activity>
                            <activity android:name=".Activity50"></activity>
                              <activity android:name=".Activity51"></activity>
                                <activity android:name=".Activity52"></activity>
                                  <activity android:name=".Activity53"></activity>
                                  <activity android:name=".Activity54"></activity>
                                  <activity android:name=".Activity55"></activity>
                                  <activity android:name=".Activity56"></activity>
                                  <activity android:name=".Activity102"></activity>
                                  <activity android:name=".Activity103"></activity>
                                  <activity android:name=".Activity104"></activity>
                                  <activity android:name=".Activity105"></activity>
                                  <activity android:name=".Activity106"></activity>
                                  <activity android:name=".Activity107"></activity>
                                  <activity android:name=".Activity108"></activity>
                                  <activity android:name=".Activity109"></activity>
                                  <activity android:name=".Activity110"></activity>
                                   <activity android:name=".Activity111"></activity>
                                  <activity android:name=".Activity112"></activity>
                                  <activity android:name=".Activity113"></activity>
                                  <activity android:name=".Activity114"></activity>
                                  <activity android:name=".Activity115"></activity>
                                  <activity android:name=".Activity116"></activity>
                                  <activity android:name=".Activity117"></activity>

                                   <activity android:name=".Activity118"></activity>
                                   <activity android:name=".Activity119"></activity>
                                   <activity android:name=".Activity120"></activity>
                                   <activity android:name=".Activity121"></activity>
                                   <activity android:name=".Activity122"></activity>
                                   <activity android:name=".Activity123"></activity>
                                   <activity android:name=".Activity124"></activity>
                                   <activity android:name=".Activity125"></activity>
                                    <activity android:name=".Activity126"></activity>
    </application>

</manifest>

A: Well.. May be this will be reason. Please add this to support in your version. For eg: You might
written in android 4 and runs in below version in your device.So use this in manifest.
uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="16"
In this targetSdkVersion is what you are choosing the maximum android version to support. And
in your project, you have used 17. Try to use minsdkVersion to 8 that support from android 2.2
to above version.

A: You just Check Your Emulator You will find the a app icon (the  icon of application you installed )just click on it it will run the application


text:
Q: Perl: basic perl regex parsing for word@word I get an input to my script (from another script) in this format
xyz@abc
I have this matching condition in my script
 if ($test =~ /.* by (\w+)\@(\w).*/) { print $1; }

This one does not have a match for some reason.
I tried this one command line:
option 1:
perl -e 'my $aa = "abcd@abcd" ; if ($kk =~ /(\w+)\@(\w+)/) {print "\n  $1 \n $2 \n";}

option 2:
perl -e 'my $aa = q[abcd@abcd] ; if ($kk =~ /(\w+)@(\w+)/) {print "\n  $1 \n $2 \n";}

option 2 prints but not option 1. Could someone pls explain the reasoning.

A: There are two problems in the command line:
You assign variable $aa but do pattern matching on variable $kk.
The second is that @abcd is being interpreted as a variable in the string delimited by "...". The variable @abcd is not defined, so it interpolates to an empty string, and in effect you have $aa = "abcd".
You can see the problem with @ when you type this:
perl -e 'my $aa = "abcd@abcd"; print "$aa\n"'

You have to mask the @. So try this instead:
perl -e 'my $aa = "abcd\@abcd"; if ($aa =~ /(\w+)@(\w+)/ ) {print "\n $1 \n $2 \n";}'


text:
Q: Can I call solr through thrift API? Solution:
 solr version: 5.40
 thrift : 0.9.3
How can I call solr request through thrift api?
(1)is exist api?
(2)or implement service above solr ?

A: I don't know much about thrift. Looks like it could directly use the solrj-Examples. Otherwise you could use solr as a restfull Service via http (nur REST Service, because only POST and GET are used and you could use GET to change data).


text:
Q: Dynamically Obfuscate HTML I was wondering if there was any way to dynamically obfuscate html on a live server but not offline, so soon as my website was visited the source would be obfuscated rather than in plain text.

A: Since the client (browser) will have to parse it into a sensible DOM tree, this is pretty much fruitless. These days it's a lot more common to inspect a site using Firebug/Webkit Inspector, which provides a nicely formatted, navigable tree. Most people won't even notice that the HTML is "obfuscated", much less be stopped by it.
Executable code can be obfuscated by minimizing variable names and such without changing the result. HTML is the result though, if you change anything about it, the result will change. So "obfuscation" would mostly be limited to creative use of spacing anyway.

A: The real question you should ask yourself is "why do I need to obfuscate HTML?". If you're hiding sensitive information, then you should be either encrypting that data, or never presenting it to the client.
Most sensitive information or transactions should take place on the server, and the client only receives a token, or encrypted information, or a unique transaction identifier that can be passed back and forth.

A: Let me put it this way: There's no way to dynamically obfuscate the HTML on your site such that any reasonably competent person couldn't get it anyway.

*

*You could use JavaScript to attempt to obfuscate it, but you'd have to do it in a way that didn't actually affect the DOM.

*You could generate the contents of the page itself with JavaScript, but that is likely to damage accessibility, and once again the DOM will have to be in a condition the browser can use.

*You could insert massive amounts of whitespace into the source, but that is easily overcome as well.

All this, and you make it harder and more annoying to manage your site. Minification has its purpose, but obfuscation here is lose-lose.

A: Your could search for and remove all tabs, newlines, extra spaces, and comments

A: If you are using php, IonCube has a plugin. it can be found here: http://www.ioncube.com/html_encoder.php it turns your html page into minified javascript.


text: Q: How to handle tagging and releasing of grails app using jenkins freestyle job I have a grails app and want to release it using jenkins freestyle job. I was able to build the war file. Not able to create a tag and release the app.


text:
Q: Use UI elements from static function I am building a qt application in which i am have to access ui elements. but i am getting error as

invalid use of member 'foo::ui' in static member function

The code is big so cant add here.
Declaration of ui
private:
Ui::foo *ui;

Initialization in Constructor
foo::foo(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::foo)
{
    ui->setupUi(this);
}

Accessing in static function where it is giving error.
ui->fp->setText("Some Text");

Static function declaration.
static I eventCallback(PVOID i_pv_context,
        T_xyz i_i_command,
        PVOID i_pv_param);

main code
  int main(int argc, char *argv[])
  {
    QApplication a(argc, argv);
    BarrierInterfaceModule w;
    w.show();
    return a.exec();
  }

I have looked on Internet but did not get solution. please let me know if there is a way around.let me know if you need any more info Thanks in advance

A: I'm aware of two possible solutions:

*

*Use a singleton class for foo. This method only works if you need only one instantiation of foo, which is probably the case because it is a QMainWindow. Now, you can set the text as follows: getInstance()->ui->fp->setText("Some Text");

*Often callback function are able to pass a pointer to user supplied data, but this depends on the library you are using.


text:
Q: using inflater and deflater to compressmore than one time I am using inflater and deflater to compress and uncompress bytes later
I was compressing bytes and it was working so good, but I had problem that the bytes still have a little big size.
So I thought in compressing it twice times, but I am getting error
date formation exception.
and this is my code to compress and uncompress:
    public static byte[] compress(byte[] data) {
    Deflater deflater = new Deflater();
    deflater.setInput(data);
    ByteArrayOutputStream outputStream = new ByteArrayOutputStream(data.length);
    deflater.finish();
    byte[] buffer = new byte[1024];
    while (!deflater.finished()) {
        int count = deflater.deflate(buffer); // returns the generated code... index
        outputStream.write(buffer, 0, count);
    }
    try {
        outputStream.close();
    } catch (IOException e) {
        e.printStackTrace();
    }
    byte[] output = outputStream.toByteArray();
    //LOG.debug("Original: " + data.length / 1024 + " Kb");
    //  LOG.debug("Compressed: " + output.length / 1024 + " Kb");
      System.out.println("original" + data.length/1024 +"kb");
    System.out.println("compressed" + output.length +"b");
    return output;
}
public static byte[] decompress(byte[] data) throws IOException {
    Inflater inflater = new Inflater();
    inflater.setInput(data);
    ByteArrayOutputStream outputStream = new ByteArrayOutputStream(data.length);
    byte[] buffer = new byte[1024];
    while (!inflater.finished()) {
        int count = 0;
        try {
            count = inflater.inflate(buffer);
        } catch (DataFormatException e) {
            e.printStackTrace();
        }
        outputStream.write(buffer, 0, count);
    }
    outputStream.close();
    byte[] output = outputStream.toByteArray();
    System.out.println("original revived" + data.length/1024 +"kb");
    System.out.println("uncompressed" + output.length/1024 +"kb");
    return output;
}

and i compress like this:
byte data[] =  compress(byteArrayOutputStream1.toByteArray());
            byte data_2[] =compress(data);//////double compress

and I uncompress this way:
byte[] us =decompress(s);
byte[] us2 =decompress(us);


text:
Q: JModelica and Concurrent Futures I am using JModelica to optimize a model using IPOPT in the background.
I would like to run many optimizations in parallel. At the moment I am doing
this using the multiprocessing module.
Right now, the code is as follows. It performs a parameter sweep over the
variables T and So and writes the results to output files named for these
parameters. The output files also contain a list of the parameters used in the
model along with the run results.
#!/usr/local/jmodelica/bin/jm_python.sh
import itertools
import multiprocessing
import numpy as np
import time
import sys
import signal
import traceback
import StringIO
import random
import cPickle as pickle

def PrintResToFile(filename,result):
  def StripMX(x):
    return str(x).replace('MX(','').replace(')','')

  varstr = '#Variable Name={name: <10}, Unit={unit: <7}, Val={val: <10}, Col={col:< 5}, Comment="{comment}"\n'

  with open(filename,'w') as fout:
    #Print all variables at the top of the file, along with relevant information
    #about them.
    for var in result.model.getAllVariables():
      if not result.is_variable(var.getName()):
        val = result.initial(var.getName())
        col = -1
      else:
        val = "Varies"
        col = result.get_column(var.getName())

      unit = StripMX(var.getUnit())
      if not unit:
        unit = "X"

      fout.write(varstr.format(
        name    = var.getName(),
        unit    = unit,
        val     = val,
        col     = col,
        comment = StripMX(var.getAttribute('comment'))
      ))

    #Ensure that time variable is printed
    fout.write(varstr.format(
      name    = 'time',
      unit    = 's',
      val     = 'Varies',
      col     = 0,
      comment = 'None'
    ))

    #The data matrix contains only time-varying variables. So fetch all of
    #these, couple them in tuples with their column number, sort by column
    #number, and then extract the name of the variable again. This results in a
    #list of variable names which are guaranteed to be in the same order as the
    #data matrix.
    vkeys_in_order = [(result.get_column(x),x) for x in result.keys() if result.is_variable(x)]
    vkeys_in_order = map(lambda x: x[1], sorted(vkeys_in_order))

    for vk in vkeys_in_order:
      fout.write("{0:>13},".format(vk))
    fout.write("\n")

    sio = StringIO.StringIO()
    np.savetxt(sio, result.data_matrix, delimiter=',', fmt='%13.5f')
    fout.write(sio.getvalue())

def RunModel(params):
  T  = params[0]
  So = params[1]

  try:
    import pyjmi
    signal.signal(signal.SIGINT, signal.SIG_IGN)

    #For testing what happens if an error occurs
    # import random
    # if random.randint(0,100)<50:
      # raise "Test Exception"

    op = pyjmi.transfer_optimization_problem("ModelClass", "model.mop")
    op.set('a',        0.20)
    op.set('b',        1.00)
    op.set('f',        0.05)
    op.set('h',        0.05)
    op.set('S0',         So)
    op.set('finalTime',   T)

    # Set options, see: http://www.jmodelica.org/api-docs/usersguide/1.13.0/ch07s06.html
    opt_opts                                   = op.optimize_options()
    opt_opts['n_e']                            = 40
    opt_opts['IPOPT_options']['tol']           = 1e-10
    opt_opts['IPOPT_options']['output_file']   = '/z/err_'+str(T)+'_'+str(So)+'_info.dat'
    opt_opts['IPOPT_options']['linear_solver'] = 'ma27' #See: http://www.coin-or.org/Ipopt/documentation/node50.html

    res = op.optimize(options=opt_opts)

    result_file_name = 'out_'+str(T)+'_'+str(So)+'.dat'
    PrintResToFile(result_file_name, res)

    return (True,(T,So))
  except:
    ex_type, ex, tb = sys.exc_info()
    return (False,(T,So),traceback.extract_tb(tb))

try:
  fstatus = open('status','w')
except:
  print("Could not open status file!")
  sys.exit(-1)

T       = map(float,[10,20,30,40,50,60,70,80,90,100,110,120,130,140])
So      = np.arange(0.1,30.1,0.1)
tspairs = list(itertools.product(T,So))
random.shuffle(tspairs)

pool  = multiprocessing.Pool()
mapit = pool.imap_unordered(RunModel,tspairs)
pool.close()

completed = 0

while True:
  try:
    res = mapit.next(timeout=2)
    pickle.dump(res,fstatus)
    fstatus.flush()
    completed += 1
    print(res)
    print "{0: >4} of {1: >4} ({2: >4} left)".format(completed,len(tspairs),len(tspairs)-completed)
  except KeyboardInterrupt:
    pool.terminate()
    pool.join()
    sys.exit(0)
  except multiprocessing.TimeoutError:
    print "{0: >4} of {1: >4} ({2: >4} left)".format(completed,len(tspairs),len(tspairs)-completed)
  except StopIteration:
    break

Using the model:
optimization ModelClass(objective=-S(finalTime), startTime=0, finalTime=100)
  parameter Real S0 = 2;
  parameter Real F0 = 0;

  parameter Real a = 0.2;
  parameter Real b = 1;
  parameter Real f = 0.05;
  parameter Real h = 0.05;

  output Real F(start=F0, fixed=true, min=0, max=100, unit="kg");
  output Real S(start=S0, fixed=true, min=0, max=100, unit="kg");

  input Real u(min=0, max=1);
equation
  der(F) = u*(a*F+b);
  der(S) = f*F/(1+h*F)-u*(a*F+b);
end ModelClass;

Is this safe?

A: No, it is not safe. op.optimize() will store the optimization results with a file name derived from the model name, and then load the results to return the data, so when you try to run several optimizations at once you will get a race condition. To circumvent this, you can provide distinct result file names in opt_opts['result_file_name'].

A: No. It does not seem to be safe as of 02015-11-09.
The code above names output files according to the input parameters. The output files also contain the input parameters used to run the model.
With 4 cores two situations arise:

*

*Occasionally the error Inconsistent number of lines in the result data. is raised in the file /usr/local/jmodelica/Python/pyjmi/common/io.py.

*Output files show one set of parameters internally but are named for a different set of parameters, which indicates disagreement between the parameters the script thinks it is processing and the parameters that are actually being processed.

With 24 cores:

*

*The error The result does not seem to be of a supported format. is repeatedly raised by /usr/local/jmodelica/Python/pyjmi/common/io.py.

Together, this information suggests that intermediate files are being used by JModelica, but that there is overlap in the names of the intermediate files resulting in errors in the best case and incorrect results in the worst case.
One might hypothesize that this is the result of bad random number generation in a tempfile function somewhere, but a bug relating to that was resolved on 02011-11-25. Perhaps the PRNGs are being seeded based on a system clock or a constant and therefore progress in sync?
However, this does not seem to be the case since the following does not produce collisions:
#!/usr/bin/env python
import time
import tempfile
import os
import collections

from multiprocessing import Pool

def f(x):
  tf = tempfile.NamedTemporaryFile(delete=False)
  print(tf.name)
  return tf.name

p      = Pool(24)
ret    = p.map(f, range(2000))
counts = collections.Counter(ret)
print(counts)


text:
Q: Different verb foms in "not only … but also" As far as I know, words following both parts of this conjunction (not only and but also) should belong to the same parts of speech. For example, if a verb follows "not only" , then a verb should also follow "but also" .

1- The car not only is economical but also feels good to
  drive.

After I have seen this sentence, I am wondering that do I have to use same verb form in both parts of this conjuction. For example: If I use a verb in past simple form after "not only", does that mean do I have to use another verb in past simple after "but also" ?

2- She not only sued him, but also wants money from him.
3- He not only has won the last Eisner, but he is also working for
  another.

Are these examples grammatically wrong?

A: It depends on the construction of the sentence.
For instance:

1. The car is not only economical but also good to drive.

In this version, no verb follows the but. This is possible because the verb is precedes not only. By parallel construction and elision, it applies to both parts of the sentence:

1. The car is not only economical but also is good to drive.

You don't need to provide the second instance of is since it's implicitly understood to be there.
However, if you don't actually want to imply is good, but actually want to say that it feels good, then you would still need to provide the second verb.

In your second sentence, there is no way of not providing a second verb because the following, although grammatical, would make no sense:

? 2. She sued not only him but also sued his money.

So, if you move not only in front of the first verb, and the second verb you want to use is the same as the first verb, then you don't need to repeat it; otherwise, you do need a second verb.
Further note that you do not need also. It can be omitted in all of your sentences. The only part of the construction that's necessary is not only . . . but.


text:
Q: Обработка нескольких форм на странице одним скриптом AJAX без jQuery Скрипт отлично обрабатывает одну из форм на странице, пробовал разные варианты чтобы обработать две и более форм, не смог, подскажите решение. привожу оригинал скрипта

if (document.forms.form1 && window.FormData) {
  var form = document.forms.form1;

 var message = new Object();
 message.loading = 'Отправляем...';
 message.success = 'Мы свяжемся с вами в ближайшее время ';
 message.failure = 'Что-то пошло не так ';
 var statusMessage = document.createElement('div');
 statusMessage.className = 'status';

 // форму скроем после отправки
    // var inputform = document.querySelector('.custom-form');
    // var formbutton = document.querySelector('button[type="submit"]');

 // Настройка AJAX запроса
 var request = new XMLHttpRequest();
 request.open('POST', 'assets/hello.php', true);
 request.setRequestHeader('accept', 'application/json');

 // Добавляем обработчик на событие `submit`
 form.addEventListener('submit', function(event) {
  event.preventDefault();
  form.appendChild(statusMessage);

  // Это простой способ подготавливить данные для отправки (все браузеры и IE > 9)
  var formData = new FormData(form);

  // Отправляем данные
  request.send(formData);

  // Функция для наблюдения изменения состояния request.readyState обновления statusMessage соответственно
  request.onreadystatechange = function () {
   // <4 =  ожидаем ответ от сервера
   if (request.readyState < 4)
    statusMessage.innerHTML = message.loading;
   // 4 = Ответ от сервера полностью загружен
   else if (request.readyState === 4) {
    // 200 - 299 = успешная отправка данных!
    if (request.status == 200 && request.status < 300) {
     statusMessage.innerHTML = message.success;
     // скрываем форму и отправляем событие в метрику
     inputform.style.display = 'none';
     yaCounter53696953.reachGoal('formsubmit');
    }
    else
                    statusMessage.innerHTML = message.failure;
                    // formbutton.disabled = true;
     //form.insertAdjacentHTML('beforeend', message.failure);
   }
  }
 });
}
<form name="form1" action="" method="POST">
  <input name="name" type="text">
  <button type="submit">Форма 1</button>
</form>
<form name="form2" action="" method="POST">
  <input name="name" type="text">
  <button type="submit">Форма 2</button>
</form>

A: document.querySelectorAll("form").forEach(item => {
  item.addEventListener('submit', function(event) {
    var form = this;
    event.preventDefault();
    ...

A: Вам необходимо вынести сначала основные параметры отдельно, а для ворм ввести цикл.
У Вас в примере есть параметры inputform и yaCounter53696953, которые неизвестно откуда получены, а в остальном так:

    var form = document.getElementsByTagName('form');
    var message = new Object();
    message.loading = 'Отправляем...';
    message.success = 'Мы свяжемся с вами в ближайшее время ';
    message.failure = 'Что-то пошло не так ';
    var statusMessage = document.createElement('div');
    statusMessage.className = 'status';

    for (let i=0;i<form.length;i++){
        form[i].addEventListener('submit', function(event) {
            event.preventDefault();
            form[i].appendChild(statusMessage);

            // Это простой способ подготавливить данные для отправки (все браузеры и IE > 9)
            var formData = new FormData(form[i]);

            // Настройка AJAX запроса
            var request = new XMLHttpRequest();
            request.open('POST', 'assets/hello.php', true);
            request.setRequestHeader('accept', 'application/json');
            // Отправляем данные
            request.send(formData);

            // Функция для наблюдения изменения состояния request.readyState обновления statusMessage соответственно
            request.onreadystatechange = function () {
                if (request.readyState < 4)
                    statusMessage.innerHTML = message.loading;
                else if (request.readyState === 4) {
                    if (request.status == 200 && request.status < 300) {
                        statusMessage.innerHTML = message.success;
                        inputform.style.display = 'none';
                        yaCounter53696953.reachGoal('formsubmit');
                    }
                    else
                        statusMessage.innerHTML = message.failure;
                }
            }
        });
    }
<form name="form1" action="" method="POST">
    <input name="name" type="text">
    <button type="submit">Форма 1</button>
</form>
<form name="form2" action="" method="POST">
    <input name="name" type="text">
    <button type="submit">Форма 2</button>
</form>

A: Вот еще одно решение от моего друга :)

// обработчик всех форм
function formSubmitHandler(event) {
    event.preventDefault();
    var form = event.target;

    var message = new Object();
    message.loading = 'Отправляем...';
    message.success = 'Мы свяжемся с вами в ближайшее время ';
    message.failure = 'Что-то пошло не так ';

    var statusMessage = document.createElement('div');
    statusMessage.className = 'status';

    // форму скроем после отправки
    // var inputform = document.querySelector('.custom-form');
    // var formbutton = document.querySelector('button[type="submit"]');

    // Настройка AJAX запроса
    var request = new XMLHttpRequest();
    request.open('POST', 'assets/hello.php', true);
    request.setRequestHeader('accept', 'application/json');

    // Добавляем обработчик на событие `submit`
    // form.addEventListener('submit', function(event) {
    event.preventDefault();
    form.appendChild(statusMessage);

    // Это простой способ подготавливить данные для отправки (все браузеры и IE > 9)
    var formData = new FormData(form);

    // Отправляем данные
    request.send(formData);

    // Функция для наблюдения изменения состояния request.readyState обновления statusMessageс
    request.onreadystatechange = function () {
        // <4 =  ожидаем ответ от сервера
        if (request.readyState < 4)
            statusMessage.innerHTML = message.loading;
        // 4 = Ответ от сервера полностью загружен
        else if (request.readyState === 4) {
            // 200 - 299 = успешная отправка данных!
            if (request.status == 200 && request.status < 300) {
                statusMessage.innerHTML = message.success;
                // скрываем форму и отправляем событие в метрику
                inputform.style.display = 'none';
                yaCounter53696953.reachGoal('formsubmit');
            }
            else
                statusMessage.innerHTML = message.failure;
                // formbutton.disabled = true;
                //form.insertAdjacentHTML('beforeend', message.failure);
        }
    }
}

// Получаем список форм ...
var forms = document.querySelectorAll('form.has-agreement');

for (var i = 0; i < forms.length; i++) {
    console.log(forms[i]);
    var form = forms[i];
    form.addEventListener('submit', formSubmitHandler);
}
<form name="form1" class="has-agreement" action="" method="POST">
  <input id="agree1" class="agree" type="checkbox">Принять соглашение 1
  <button type="submit">Записаться на курс 1</button>
</form>

<form name="form2" class="has-agreement" action="" method="POST">
  <input id="agree2" class="agree" type="checkbox">Принять соглашение 2
  <button type="submit">Записаться на курс 2</button>
</form>


text:
Q: Pathname.writable? vs Pathname.writable_real? from Ruby on Mac OS X I am encountering permission problems in Homebrew and this has led me to this apparently strange observation with Ruby's Pathname.writable? and Pathname.writable_real?.
Machine One
On this machine I have no permission problem. Dir /usr/local is writable by members of the admin group:
$ ls -ld /usr/local/
drwxrwxr-x  18 root  admin  612 25 Jun 09:24 /usr/local/

I am in the admin group:
$ whoami
martin
$ dscl . -read /Groups/admin GroupMembership
GroupMembership: root martin

And Ruby reports that as well no matter if I use writable? or writable_real?:
$ irb
>> require "Pathname"
=> true
>> Pathname('/usr/local').writable?
=> true
>> Pathname('/usr/local').writable_real?
=> true

Machine Two
On this machine, however, I have the problem that even though /usr/local is writable by members of the admin group:
$ ls -ld /usr/local/
drwxrwxr-x  18 root  admin  612 24 Jun 23:12 /usr/local/

and I am in the admin group:
$ whoami
mgd
$ dscl . -read /Groups/admin GroupMembership
GroupMembership: root mgd sgd

Ruby's Pathname.writable? reports that /usr/local is not writable:
$ irb
>> require "Pathname"
=> true
>> Pathname('/usr/local').writable?
=> false
>> Pathname('/usr/local').writable_real?
=> true

Why?
Can anybody explain the difference?
According to the documentation the difference between the two functions are:

*

*writable?: Is the path writable by the effective user id of the calling process?

*writable_real?: Is the path writable by the real user id of the calling process?

I still don't understand why Pathname.writable? behaves differently under (apparently) equal conditions.


text:
Q: "Me" or "I" in one-word answers I've just read a couple of questions concerning the proper usage of the pronouns "I" and "me" in sentences like:

John and I went fishing

It seems clear and obvious to me, that when the pronoun is the subject of the sentence, we should use the subject pronoun.
My question concerns a different context, though. I'm curious as to which pronoun is correct when used in a short, one-word answer? So, when we hear a question like "Who wants to go fishing tomorrow?", should the answer be:

Me!

or

I!

My intuition tells me it should be the former, but I don't really know why.
Is there any underlying rule in English, that dictates which pronoun - subject or object - should be used in the above-mentioned context?

A: When a sentence fragment is devoid of verbals (modals or [aux] verbs), subject case marking is avoided (even when the fragment fills in the subject of a question).


text:
Q: React component single instance I have a counter component created by this npm package.
import * as React from 'react';
import { Theme, createStyles, withStyles, WithStyles } from '@material-ui/core';
import withRoot from '../../../withRoot';
import Countdown, { CountdownRenderProps } from 'react-countdown-now/dist';

const styles = (theme: Theme) =>
  createStyles
  ({});

interface IProps
{}

interface IState
{
    seconds: number;
}

class Counter extends React.Component<IProps & WithStyles<typeof styles>, IState>
{
    constructor(props: IProps & WithStyles<typeof styles>)
    {
        super(props);

        this.state =
        {
            seconds: 60000
        }
    }

    // Random component
    Completionist = () => Time is up!;

    // Renderer callback with condition
    renderer = (props: CountdownRenderProps): JSX.Element =>
    {
        if (props.completed)
        {
            // Render a completed statep
            return this.Completionist();
        }
        else
        {
            // Render a countdown
            return {props.minutes}:{props.seconds};
        }
    }

    render()
    {
        const css = this.props.classes;
        const seconds = this.state.seconds;

        const Body = () =>
            <Countdown date={Date.now() + seconds} renderer={ this.renderer } />

        return Body();
    }
}

export default withRoot(withStyles(styles)(Counter));

What I need in my project is this counter in 4 different pages, that follows each other, with the remained time on the new page.
My idea was to create a singleton, but I failed.
Any help!
thnx

A: There's two ways to do this. You can move the state higher up to the root element and pass it it down using props to your counter elements. The problem with this approach is that the logic for incrementing the state will then need to be in the root element to, otherwise it will get incremented more depending on how many Counters you have on screen.
React isn't really meant to be a full application framework, it's really just for rendering HTML. If you want to manage application state properly you should be using something like Redux, which interacts very nicely with React and gives you lots of flexibility. More here: https://redux.js.org/introduction/getting-started


text:
Q: How to serialize a class that may only have unique instances I have a class that can only have unique instances as below. This makes reference equality sufficient to equate objects.
While serialization is simple, deserialization is a bit tricky as one cannot assign to this as i have done below. How do i deserialize objects if still want to maintain only unique instances of the class?
public sealed class MyClass :
    ISerializable,
    IXmlSerializable
{
    private static readonly Dictionary<string, MyClass> Cache;

    static MyClass() { /* build cache, use private constructor */ }

    private MyClass(string name)
    {
        this.Name = name;
    }

    public string Name { get; }

    public static MyClass Parse(string from)
        => Cache[from];

    public void GetObjectData(SerializationInfo info, StreamingContext context)
        => throw new NotImplementedException();

    public XmlSchema GetSchema() => null;

    public void ReadXml(XmlReader reader)
    {
        reader.ReadStartElement();
        this = Parse(reader.ReadContentAsString());
        reader.ReadEndElement();
    }

    public MyClass(SerializationInfo info, StreamingContext context)
        => this = Parse(info.GetString(nameof(this.Name)));

    public void WriteXml(XmlWriter writer)
        => throw new NotImplementedException();
}

A: Generally speaking, the way to deal with this issue is, during object graph serialization, to replace the singleton(s) using a serialization surrogate mechanism, wherein the singleton is replaced with a Data Transfer Object (DTO) that contains nothing other than an identifier for the singleton.  Then, later, as the graph is being deserialized, the DTO is initially deserialized, then replaced with the corresponding singleton via a lookup.
For instance, if your MyClass looks as follows:
public sealed class MyClass
{
    private static readonly Dictionary<string, MyClass> Cache;

    static MyClass()
    {
        Cache = new Dictionary<string, MyClass>()
        {
            { "one", new MyClass("one") { OtherRuntimeData = "other runtime data 1" } },
            { "two", new MyClass("two") { OtherRuntimeData = "other runtime data 2" } },
        };
    }

    // XmlSerializer required parameterless constructor.
    private MyClass() => throw new NotImplementedException();

    private MyClass(string name) => this.Name = name;

    public string Name { get; }

    public string OtherRuntimeData { get; set; }

    public static MyClass Parse(string from) => Cache[from];

    public static IEnumerable<MyClass> Instances => Cache.Values;
}

Then a DTO containing only the Name would look like:
public sealed class MyClassDTO
{
    public string Name { get; set; }

    public static implicit operator MyClassDTO(MyClass obj) => obj == null ? null : new MyClassDTO { Name = obj.Name };

    public static implicit operator MyClass(MyClassDTO dto) => dto == null ? null : MyClass.Parse(dto.Name);
}

Notice the implicit operator for converting between the DTO and the original?  That will make it easier to inject the surrogate into the serialization graph.
Unfortunately, however, there is no standard way to implement injection of a serialization surrogate DTO in all of the commonly used .Net serializers.  Each has its own separate mechanism (or no mechanism at all).  To break them down:

*

*The data contract serializers support replacement with a surrogate via the IDataContractSurrogate interface, as shown e.g. in this answer to DataContractJsonSerializer - share an object instance for the whole graph? or this answer to How to serialize / deserialize immutable list type in c#.

*The data contract serializers also support the IObjectReference interface as shown in this answer to C# DataContract Serialization, how to deserialize to already existing instance.

*But unfortunately XmlSerializer has no convenient support for injection of DTOs via a surrogate mechanism.  The closest one can come is the trick from this answer to Most elegant XML serialization of Color structure, which involves setting the XmlElementAttribute.Type to the DTO type for every property that refers to your singleton type, for instance as follows:
public class RootObject
{
    // Technique taken from https://stackoverflow.com/questions/3280362/most-elegant-xml-serialization-of-color-structure
    [XmlElement(Type=typeof(MyClassDTO))]
    public MyClass MyClass { get; set; }
}

Sample .Net fiddle showing this in action here: https://dotnetfiddle.net/R07NiW.   Note this only works because of the implicit operator between the singleton and its DTO that we defined previously.

*When serializing via Json.NET, the singleton can be replaced with its DTO inside a custom JsonConverter.

*protobuf.net supports replacement with surrogates via RuntimeTypeModel.Default.Add(typeof(OriginalType), false) .SetSurrogate(typeof(SurrogateType)) as shown in Can I serialize arbitrary types with protobuf-net?, No serializer defined for type: System.Windows.Media.Media3D.Point3D, or the article Protobuf-net: the unofficial manual.

*Finally, if you are using BinaryFormatter (which I do not recommend for reasons explained here), use of the SurrogateSelector mechanism, which resembles the data contract surrogate replacement mechanism, is supported as is shown in Customized Serialization.
SerializationInfo.SetType() combined with IObjectReference is also supported, as is shown in this documentation example.


text:
Q: Turning a string of numbers list into a list of integers tuple I'm trying to turn a list of numbers into a integer tuple:
Input: ['1 0', '2 3']
Output:(1,0),(2,3)
What I've tried:
_input=['1 0', '2 3']
tuple=()
for i in _input:
    for j in i:
        j.replace(' ','')
    tuple.append(i)
print(_input)


text:
Q: plane calculation in point cloud with lm() in R I have some 3D points and I want to have the better plane which minimize the distance between the plane and the point cloud. I used lm() to extract the 3 values I need.
x<-sample(1:100, 100)
y<-sample(1:100, 100)
z<-sample(1:100, 100)
plot3d(x, y, z, type = "s", col = "red", size = 1)
my.lm <- #I tried different combination of lm: lm(x ~ y + z)/lm(y ~ x + z)/lm(z ~ y + x)
#lm fct     Intercept   1st after ~   2nd after ~
#lm(x~y+z) 43.45653      0.17151     -0.03203
#lm(y~x+z) 40.66175      0.17159      0.02322
#lm(z~x+y) 50.95859     -0.03298      0.02390
planes3d(-1, 0.17151, -0.03203, 43.45653, alpha=0.5) #function use a b c and d of the ax+by+cz+d=0 equation
planes3d(0.17159, -1, 0.02322, 40.66175, alpha=0.5)
planes3d(-0.03298, 0.02390, -1, 50.95859, alpha=0.5)

I thought that the 3 planes extracted from the 3 lm() would be the same but they are very different. So I think that the reference axis chosen in the lm() function define the priority of research.
So how can I have the better plane which fit with my point cloud and that independantly (I don't want to affect the output when I choose which axis I put before the ~)
Where am I wrong? How can it be independant?
When I apply my algorithm with lm(x~y+z) I see that the plane is sometimes orthogonal compared to what I expected.

A: I think that your code is correct, but maybe the question that you are trying to solve is not clear in the sense of the output that you expect.
In the example of a cloud of homogeneously distributed unlabelled 3D points, there is no unique way to perform a dichotomy, separating the points with a unique, "ideal" surface. You can do this for the individual Cartesian components of the set of points though, and this is what your code achieves.
The first plane, shown in red color in the panel on the left in the figure below, separates the points in a linearly optimal way by a plane that only considers the x-coordinate of the points as a function of their position, leading to a function of the type x=f(y,z).
The second plane (green, on the right) is the result of a linear fit of the y-component of the points, y=g(x,z); and the third (shown in blue, in the middle) is a linear fit of the z-component of the points in the set z=h(x,y).
The three planes are certainly different, because they represent fits to different values. Hence, I don't think that there is anything wrong with your code and with your result.

Unlike the case described here, it is often possible to define meaningful (hyper-)planes separating different types of points, (like points with a certain value, e.g., temperature; or points with different attributes like "yellow" and "purple" points). It then depends on the distribution of these points in space whether they are linearly separable or not. In the latter case there are often solutions, too, but they are more complicated. For more information on such cases you may want to read about Support Vector Machines (SVM). Several R packages provide algorithms for SVMs such as, e.g., e1071 or the popular caret library.


text:
Q: Google play console API issues I am trying to upload a bundle (.aab) to put out a new update of an app.
I am able to bundle and sign properly, but when I try and upload the .aab I get this error
Your app currently targets API level 27 and must target at least API level 29 to ensure it is built on the latest APIs optimized for security and performance. Change your app's target API level to at least 29. Learn More
You need to use a different version code for your APK or Android App Bundle because you already have one with version code 1.

My gradle.build is targetting API 29 and the version code is 9. I'm not sure what's going on here.
android {
    compileSdkVersion 29
    buildToolsVersion rootProject.ext.buildToolsVersion

    defaultConfig {
        applicationId "com.organization.myApplication
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion 29
        versionCode 9
        versionName "9"
    }
...
}

One solution I have come across is to update app/build.gradle to target SDK 29 then sync project with gradle files. However, it tells me that this is not a gradle based project. From what I understand it is. I imported the project with gradle, there is a gradle wrapper and I have build.gradle and settings.gradle both in the top of the android folder. The build.gradle at the top level is a configuration buildscript, where as the build.gradle that targets SDK 29 is in the android/app folder.

A: Check one more time your sdk manager and targetSdkVersion. Error say that you have target api level 27, but it must be 29) and Bundle version code must be unique all time when you publish your app to google play)

A: I tagged it but should have mentioned this was a react-native project.
It seemed to work after redownloading and reimporting the project a bunch of times and getting lucky that android studio recognized Gradle. Under project structure, there was no choice for android gradle plugin or gradle version until it was recognized as a gradle project. Once it recognized the project as a gradle project then I could bundle the app from android studio rather than the command line. This seemed to work for google.
Also good to note that if you are making a react-native project, you'll need to open the android folder in android studio rather than the project's main folder. I didn't realize this at first and don't remember seeing and docs or anyone mentioning it before (probably missed it).


text:
Q: Maps between direct limits and functoriality of $f^{-1}:Shv(Y) \rightarrow Shv(X)$ and $f_{*}:Shv(X) \rightarrow Shv(Y)$ My question rises from exercise 1.18 in chapter 2 of Hartshorne. Given a continuous function $f:X \rightarrow Y$, one has to show there is a natural bijection between $\mathrm{Hom}_X(f^{-1}\mathcal{G},\mathcal{F})$ and $\mathrm{Hom}_Y(\mathcal{G},f_*\mathcal{F})$, where $\mathcal{G}$ is a sheaf over $Y$ and $\mathcal{F}$ a sheaf over $X$.
So far I have shown that we have natural maps $f^{-1}f_* \mathcal{F} \rightarrow \mathcal{F}$ and $G \rightarrow f_* f^{-1} G$. I am not completely sure what is meant about naturality. My guess is that given a diagram $\require{AMScd}$
\begin{CD}
f^{-1}\mathcal{G}_1 @>{}>> \mathcal{F}_1\\
@VVV @VVV \\
f^{-1}\mathcal{G}_2 @>{}>> \mathcal{F}_2
\end{CD}
one should get a diagram
\begin{CD}
\mathcal{G}_1 @>{}>> f_*\mathcal{F}_1\\
@VVV @VVV \\
\mathcal{G}_2 @>{}>> f_*\mathcal{F}_2
\end{CD}
and analogously interchanging the roles of $f^{-1}$ and $f_*$. A first question is "am I right?". If so, now applying $f_*$ to the first diagram and using the natural maps mentioned above, I would have a diagram
\begin{CD}
\mathcal{G}_1 @>{}>> f_* f^{-1} \mathcal{G}_1 @>>> \ f_*\mathcal{F}_1\\
& @VVV @VVV \\
\mathcal{G}_2 @>{}>> f_* f^{-1} \mathcal{G}_2 @>>> f_*\mathcal{F}_2
\end{CD}
and I would have to build the first arrow. By simplicity, instead of the sheaves given by $f^{-1}$, I argue using the presheaves whose associated sheaf is the inverse image. Then given $U$ open in $Y$, I want a map $\mathcal{G}_1 (U) \rightarrow \mathcal{G}_2(U)$, given one between
\begin{equation}
\lim_{f(f^{-1}(U)) \subset V} \mathcal{G}_1(V) \rightarrow \lim_{f(f^{-1}(U)) \subset V} \mathcal{G}_2(V)
\end{equation}
Now, in general a map between direct limits does not come from a map between the direct systems, right? Hence I was wondering how to build the map I want. In know that $U$ is in the set where I do the direct limit, and then my guess was:
given a section in $\mathcal{G}_1(U)$, I send it to its class $\overline{s}$ in the direct limit. Then, for this precise section (not for the whole homomorphism), the map between the direct limits is given by assigning a section $t \in \mathcal{G}_2(V)$, with $f(f^{-1}(U))\subset V \subset U$.
Now my idea was: I cannot ask for $V$ to be $U$, but if I manage to do something like this around each point $P \in U$ (i.e. I take $s_{|U_P}$ with $P \in U_P \subset U$ with the property that if I do the procedure described for $U$, I find a $V_P$ with $P \in V_P$), then I can glue the sections each point give me, since they come from the map of direct limits restricted to smaller sets.
Now I have two doubts: I know that the sections I pick for points $P$ and $Q$ agree eventually in come intersection,  since both have to describe the image of $\overline{s}_{|V_p \cap V_Q}$, but I don't know anything about $V_P \cap V_Q$. Also, I am not sure that for any point $P$ I can pick the $V_P$ I want.
Are my ideas in teh right direction or am I completely lost? Also, am I in trouble defining the images I want since I am not usinge the sheaves $f^{-1}\mathcal{G}_i$ but the presheaves defining them?

A: You should look at Iversen's "Cohomology of Sheaves" here, from page 96, and especially page 98, where it is shown that the direct image functor is left adjoint to the inverse image functor, which is exactly what you want.


text:
Q: jquery add html from another html file doesn't work I'm quite new to jquery and I looked up the .load() here:
http://api.jquery.com/load/
and tried one of their examples, however when I tried it locally I don't get it to work
HTML file
<!doctype html>

  <meta charset="utf-8">
  <title>Test</title>

Projects:

load.html

one

two

three

four

not quite sure what I've done wrong, so any help would be great!

A: The URL you are loading is not a valid URL.
The space character needs to be encoded.
I think you probably added more chars than you should.
Try to write just:
$( "#new-projects" ).load( "laf15/resources/load.html" );

if the URL is correct your script is going to work.
By writing this URL you are loading the file "load.html" inside the folder "resources" that is contained in the "laf15" folder.
So the file you wrote needs to be in the folder that contains "laf15" folder.
Your folder tree should look like this:
    -mainfolder
        -yourfile.html
        -laf15
            -resources
                -load.html


text:
Q: error using c#mail.dll I'm trying to read through a gmail account to get gps data that is being sent there ( in the text of a email) from an moble phone (my phone)
using (Pop3Client cl = new Pop3Client())
            {
                cl.UserName = "crash893";
                cl.Password = "password";
                cl.ServerName = "pop.gmail.com";
                cl.AuthenticateMode = Pop3AuthenticateMode.Pop;
                cl.Ssl = true;
                cl.Authenticate();
                ///Get first mail of my mailbox
                Pop3Message mg = cl.GetMessage(1);  <<<<<<<<<< ERROR
                String MyText = mg.BodyText;
                ///If the message have one attachment
                Pop3Content ct = mg.Contents[0];
                ///you can save it to local disk
                ct.DecodeData("c:\\test.txt");
            }

but I get a exception on the "get first mail of mailbox message
"Higuchi.Net.Pop3.Pop3ConnectException: Pop3 connection is closed
at Higuchi.Net.Pop3.Pop3Client.SendCommand(String inCommand)
at Higuchi.Net.Pop3.Pop3Client.Execute(String inCommand, Boolean inIsMultiLine)
at Higuchi.Net.Pop3.Pop3Client.Execute(Pop3Command inCommand)
at Higuchi.Net.Pop3.Pop3Client.GetMessage(Int64 inMailIndex)"}

Ideally what i would like to do is open this read all the new unread emails in this account for a certain subject line then read the data in the body and mark them as read
does anyone know why its erroring out
does anyone have any experince with c#mail that hey could point me in the right direction for reading and makring emails as read etc

A: It is not possible to mark emails as read using the POP protocol.
Try using IMAP.

A: cl.Port = 995;

A:         using (Pop3Client cl = new Pop3Client())
        {
            cl.UserName = "ewgsdssw";
            cl.Password = "sdgwsegw";
            cl.ServerName = "pop.gmail.com";
            cl.AuthenticateMode = Pop3AuthenticateMode.Pop;
            cl.Port = 995;
            cl.Ssl = true;
            cl.Authenticate();
            ///Get first mail of my mailbox
            ///
            int total = Convert.ToInt16(cl.GetTotalMessageCount());

            while (total >= 1)
            {
                Pop3Message mg = cl.GetMessage(total);
                if (mg.Subject == "I am Here")
                {

                    // http://maps.google.com/maps?q=38.89552,-77.43265
                    //(+/- 76 metres.)

                    string location = mg.BodyText;
                    location = location.Replace("http://maps.google.com/maps?q=","~");
                    location = location.Replace("metres.)\r\n\r\n","~");

                    location = location.Split('~')[1];

                    location = location.Replace("(+/- ", ",");
                    location = location.Replace("\r\n", "");

                    string[] data = location.Split(',');
                    string lat = data[0];
                    string lon = data[1];
                    string res = data[2];
                    DateTime time = mg.Date;

                    textBox1.AppendText(string.Format("Lat: {0} LON: {1} Res: {2} TIME: {3}\r\n",lat,lon,res,time.ToString()));

                }

                total--;
            }

        }

A: I do not have experience with C#Mail, and this answer may not help, but I've experienced weirdness in the past while trying to write email send/receive related code.
Turned out the antivirus software we were running at work had a whitelist of allowed .EXE's that could make in/outbound POP3 or SMTP connections.  Any chance this is your problem?


text:
Q: How to clear v-autocomplete (multiple) search input after selecting the checkbox in the drop-down list? I have multiple v-autocomplete component from Vuetify. Currently, for example if enter in search input "Cali" and check "California" value, "Cali" value still exist in search input. I need to clear entered value. For current, search value cleared when closing dropdown list, but I need clear it when I select checkbox.
<v-autocomplete
        v-model="select"
        :loading="loading"
        :items="items"
        :search-input.sync="search"
        cache-items
        class="mx-3"
        flat
        hide-no-data
        hide-details
        label="What state are you from?"
        solo-inverted
        multiple
      ></v-autocomplete>

new Vue({
  el: '#app',
  data () {
    return {
      loading: false,
      items: [],
      search: null,
      select: null,
      states: [
        'Alabama',
        'Alaska',
        'American Samoa',
        'Arizona',
        'Arkansas',
        'California',
        'Colorado',
        'Connecticut',
        'Delaware',
        'District of Columbia',
        'Federated States of Micronesia',
        'Florida',
        'Georgia',
        'Guam',
        'Hawaii',
        'Idaho',
        'Illinois',
        'Indiana',
        'Iowa',
        'Kansas',
        'Kentucky',
        'Louisiana',
        'Maine',
        'Marshall Islands',
        'Maryland',
        'Massachusetts',
        'Michigan',
        'Minnesota',
        'Mississippi',
        'Missouri',
        'Montana',
        'Nebraska',
        'Nevada',
        'New Hampshire',
        'New Jersey',
        'New Mexico',
        'New York',
        'North Carolina',
        'North Dakota',
        'Northern Mariana Islands',
        'Ohio',
        'Oklahoma',
        'Oregon',
        'Palau',
        'Pennsylvania',
        'Puerto Rico',
        'Rhode Island',
        'South Carolina',
        'South Dakota',
        'Tennessee',
        'Texas',
        'Utah',
        'Vermont',
        'Virgin Island',
        'Virginia',
        'Washington',
        'West Virginia',
        'Wisconsin',
        'Wyoming'
      ]
    }
  },
  watch: {
    search (val) {

      val && val !== this.select && this.querySelections(val)
    }
  },
  methods: {
    querySelections (v) {

      this.loading = true
      // Simulated ajax query
      setTimeout(() => {
        this.items = this.states.filter(e => {
          return (e || '').toLowerCase().indexOf((v || '').toLowerCase()) > -1
        })
        this.loading = false
      }, 500)
    }
  }
})

I want to clear value in search input after selecting value in dropdown list.
Here is codepen example - https://codepen.io/anon/pen/ZZMKeL

A: Add watcher for select value and reset search-input:
watch: {
  select() {
    this.search = ''
  }

Or react on one of the events:
<v-autocomplete @input="search = ''"
 or
<v-autocomplete @change="search = ''"

Watch select because of v-model value (<v-autocomplete v-model="select"), and change
this.search because of search-input.sync value (:search-input.sync="search").


text:
Q: supporting internationalization for NSString's I have a bunch of the following line of code:
[NSString stringWithFormat:@"%@ and %@", subject.title, secondsubject.title];

 [NSString stringWithFormat:@"%@ and %d others", subject.title, [newsfeeditem count] - 1];

and a lot more in the app. Basically I am building a news feed style like facebook where it has string constants. blah liked blah. Where/how should I do these string constants so it's easy to do for internationalization? Should I have a file just for storing string constants?

A: See the String Resources section of the Resource Programming Guide. The key section for this particular problem is "Formatting String Resources."
You'd have something like:
[NSString stringWithFormat:NSLocalizedString(@"%1$@ and %2$@", @"two nouns combined by 'and'"),
                           subject.title, secondsubject.title];

The %1$@ is the location of the first substitution. This lets you rearrange the text. Then you would have string resource files like:
English:
/* two nouns combined by 'and' */
"%1$@ and %2$@" = "%1$@ and %2$@";

Spanish:
/* two nouns combined by 'and' */
"%1$@ and %2$@" = "%1$@ y %2$@";

You need to be very thoughtful about these kinds of combinations. First, you can never build up a sentence out of parts of sentences in a translatable way. You're almost always need to translate the entire message in one go. What I mean is that you can't have one string that says @"I'm going to delete" and another string that says @"%@ and %@" and glue them together. The word order is too variable between languages.
Similarly, complex lists of things can cause all kinds of headaches due to various agreement rules. Some languages have special plural rules, gender agreements, and similar issues. As much as possible, keep your messages simple, short, and static.
But the above tools are very useful for solving the problem you're discussing. See the docs for more details.