text:
Q: Flink watermark generation
*

*this is a modified version from word count example from the official site
2.event time and listen to a port

    env.setStreamTimeCharacteristic(TimeCharacteristic.EventTime)
    //listening to the port
    val text = env.socketTextStream("localhost", 9999)
      .assignAscendingTimestamps(item => {
        val line = item.split(" ")
        //simply print timestamp
        println(line.apply(1))
        line.apply(1).toLong*1000 - 3000
      })

*do the transformation below

    // the process here
    text.map { each_input =>
    {
      val line = each_input.split(" ")
      (line.apply(0),1,line.apply(1))
    }}
        .process(new SimpleProcessFunc)
        .print()

*actually logic from process function not big change

    val mark = context.timerService().currentWatermark()
    val timestamp = context.timestamp()
    //print some infomation
    println(sdf.format(mark) + "===> watermark ===>" + mark)
    println(sdf.format(timestamp) + "===> timestamp in context ===> " + timestamp)
    collector.collect(i)

*i use cmd to send data over the socket,but from the ide console,
it seems weird that how the watermark generated,seems no logic behind

    1585977022
    03/12/292269055 00:47:04===> watermark ===>-9223372036854775808
    04/04/2020 13:10:19===> timestamp in context ===> 1585977019000
    2> (epoch,1,1585977022)
    1585977034
    04/04/2020 13:10:18===> watermark ===>1585977018999
    04/04/2020 13:10:31===> timestamp in context ===> 1585977031000
    3> (montanin,1,1585977034)
    1585977053
    04/04/2020 13:10:30===> watermark ===>1585977030999
    04/04/2020 13:10:50===> timestamp in context ===> 1585977050000
    4> (song,1,1585977053)

A: Here's the logic behind the watermark values:
The initial watermark has the value Long.MIN_VALUE, that's -9223372036854775808.
It just so happens that watermarks trail behind the stream element whose timestamp was used as the basis for creating the watermark. And watermarks make a statement about the completeness of the stream up through a certain point in time. So the stream element at time 1585977019000 precedes a watermark for time 1585977018999 (since there could still be another stream element for time 1585977019000 after the watermark, it would be wrong for that watermark to have a timestamp of 1585977019000).
The ascending timestamp watermark generator is a kind of periodic watermark generator, which by default will produce a new watermark every 200 msec -- but only if the watermark has advanced.
When you access the current watermark in a single input ProcessFunction, you are getting the most recent watermark received by that instance. During the processElement() method, that watermark will not yet reflect whatever the watermark generator learned when it processed the event now being passed to processElement() -- that watermark update will happen later, after the 200 msec timer goes off.
For more about watermarks, you also see the page on watermarks from the flink training.


text:
Q: How does the fusion assembly loader decide which DLL version to load Keeping things simple, assume are no DLLs in the local folder, or configuration files involved, or publisher policies, or custom resolution.  The only place referenced DLLs are is in the GAC.
How does fusion decide which version of the DLLs in the GAC to go for (all other things equal), what is the order of priority?
For example if in my project, I have referenced a DLL of version 10.5.0.0.  Would it pick the DLL of version 10.5.0.0 or 10.5.1.0.  Alternatively if I only had version 10.4.0.0 in the GAC, would it work or throw an error?  Do these rules change depending on if it's the major/minor/build/revision part that changes?
How does this differ if the project reference "Specific Version" is set to True or False?
And how does this differ if the reference is a DLL reference or project reference?
I'm guessing there's a MSDN website somewhere stating how this works, but I can't seem to find it.  I am not looking to override the behaviour, I just want to know what the default behaviour is.

A: It is documented on MSDN in How the Runtime Locates Assemblies. In particular the GAC is only searched if the assembly is loaded using a strong name. There may still be publisher policies in place that "redirects" to another assembly but there are no automatic rules in place.
In my opinion the GAC is only something that should be used by Microsoft for the .NET Framework and you can remove a lot of pain by distributing your application or library without using the GAC (except for the .NET Framework of course).
Referencing a specific version of an assembly is a build time property and it does not affect the run time behavior. However, when an assembly reference is compiled into an executable the version is stored in the executable and at run time that specific version is loaded (after assembly redirect rules have been applied).
So to sum it up: In order for .NET to load another version of the assembly requested there has to be an assembly redirect in place. Your application can provide redirects in the app.config file and the GAC can have publisher policies.

redpajama_set_name: RedPajamaStackExchange


text:
Q: sorting a file by column, possible values are number, Inf, -Inf, NA I have a tab-separated ASCII file.
One of the columns contains numbers which always have a decimal point (like 0.311225363556077).
However, in this column entries might also be any one of these strings:
Inf
-Inf
NA

I would like to sort the lines of this file, by the value in that column. How can I do that?
I was thinking about using (GNU) sort, but I can't figure out if it recognizes Inf and -Inf properly.
The sort order should be: from top to bottom: Inf, numbers in order, -Inf, NA
This is on Debian.

A: Assume that the corresponding column is 2.
cat input |sort -k2 -g -r


text:
Q: How to convert SimpleTransformers' ONNX model to keras I am currently trying to convert the onnx model using onnx2keras. However, I am facing the error below:
AttributeError                            Traceback (most recent call last)
<ipython-input-10-8e8800d4ffef> in <module>()
      6
      7 onnx_model = onnx.load('onnx_model.onnx')
----> 8 k_model = onnx_to_keras(onnx_model,['input_ids'])
      9
     10 tf.keras.models.save_model(k_model,'kerasModel.h5',overwrite=True,include_optimizer=True)

/usr/local/lib/python3.7/dist-packages/onnx2keras/converter.py in onnx_to_keras(onnx_model, input_names, input_shapes, name_policy, verbose, change_ordering)
    168                     layers[node_input] = weights[node_input]
    169                 else:
--> 170                     raise AttributeError('Current node is not in weights / model inputs / layers.')
    171         else:
    172             logger.debug('... found all, continue')

AttributeError: Current node is not in weights / model inputs / layers.

Here is my code:
import onnx2keras
from onnx2keras import onnx_to_keras
import keras
import onnx
import tensorflow as tf

onnx_model = onnx.load('onnx_model.onnx')
k_model = onnx_to_keras(onnx_model,['input_ids'])

tf.keras.models.save_model(k_model,'kerasModel.h5',overwrite=True,include_optimizer=True)

I have also found the nodes from onnx model using below code:
input_all = [node.name for node in onnx_model.graph.input]
print(input_all)

This is the output of 'input_all' = ['input_ids', 'attention_mask', 'token_type_ids']
Can someone provide a solution for my problem. Thank you


text:
Q: Left invariance of differential form on the circle This is a problem that came up in L. Tu's book An Introduction to Manifolds.
17.3 (Pullback of a 1-form on $S^1$)
Multiplication in $S^1$ viewed as a subset of the complex plane is given by
$$(\cos t+i\sin t)(x+iy)=(x\cos t-y\sin t)+i(x\sin t + y\cos t)$$
Hence if $g=(\cos t,\sin t)\in S^1\subset \mathbb{R}^2$ then left multiplication is given by
$$l_g(x,y)=(x\cos t-y\sin t,x\sin t + y\cos t)$$
Let $\omega=-ydx+xdy$ be a 1-form. Prove
$$l^\ast_g\omega=\omega$$
I did the following computation
$$l^\ast_g\omega=l^\ast_g(-ydx+xdy)=-(l^\ast_g y)(dl^\ast_gx)+(l^\ast_gx)(dl^\ast_gy)$$
which one gets by the linearity, distributivity and commutativity (with $d$) of the pullback $l^\ast_g$.
Since for a function $l^\ast_g f = f \circ l_g$ we can replace the above and apply the differential to obtain the following
$$l^\ast_g\omega = dt + \omega$$
As you can see there is a $dt$ term which I don't know how to get rid of or if it even is supposed to be there. My exact calculation is as follows
\begin{align}
l^\ast_g\omega
&= -(y\circ l_g)d(x\circ l_g)+(x\circ l_g)d(y\circ l_g)\\
&=-(x\sin t + y\cos t)d(x\cos t-y\sin t)+(x\cos t-y\sin t)d(x\sin t + y\cos t)\\
&=-(\cdots)(-x\sin t dt +\cos t dt dx -y\cos t dt -\sin t dy)\\
&\qquad \qquad+(\cdots)(x\cos t dt +\sin t dx -y\sin t dt+\cos t dy)\\
&=x^2dt-ydx+y^2dt+xdy\\
&=\omega + dt
\end{align}
Since $x^2+y^2=1$ on the circle. Any help would be appreciated.

A: No $dt$ — you are doing the pullback by one fixed group element at a time, so $t$ is fixed.


text:
Q: Applet MouseMotionListener and Itemlistener conflict? I want to use applet to draw multiple lines with checkboxes to select the color of lines. Here is my code:
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
import java.util.Vector;

public class PaintApplet extends Applet implements MouseMotionListener,ItemListener{
    public void init() {

        setLayout(new GridLayout(1, 0));
        CheckboxGroup colorType = new CheckboxGroup();
        red = new Checkbox("red", colorType, false);
        red.addItemListener(this);
        green = new Checkbox("green", colorType, false);
        green.addItemListener(this);
        blue = new Checkbox("blue", colorType, true);
        blue.addItemListener(this);

        //setLayout(new GridLayout(0, 1));

        Panel p = new Panel();
        add(p);
        p.add(red);
        p.add(green);
        p.add(blue);

        addMouseMotionListener(this);
    }

    public void itemStateChanged(ItemEvent e) {
        if (e.getSource() == red)
           System.out.println("red");
        else if (e.getSource()==green)
            System.out.println("green");
        else if (e.getSource()==blue)
            System.out.println("blue");
    }

    public void mouseDragged(MouseEvent e) {
        draw=true;
       // X=new Vector<Integer>();
       // Y=new Vector<Integer>();
        X.add(e.getX());
        Y.add(e.getY());
        System.out.println("mouse is being dragged at location (" + e.getX() + ", " + e.getY() + ")");
        DrawX.add(X.get(lastSize));
        DrawY.add(Y.get(lastSize));
        DrawX.add(X.get(X.size()-1));
        DrawY.add(Y.get(Y.size()-1));
        repaint();
        lastSize=X.size();
        //System.out.println(lastSize);
    }

    public void mouseMoved(MouseEvent e) {
        //System.out.println("mouse is being moved at location (" + e.getX() + ", " + e.getY() + ")");
    }

    public void paint(Graphics g) {
        for(int i=0;i<X.size()-1;i=i+2)
        {
                initX=DrawX.get(i);
                initY=DrawY.get(i);
                finalX=DrawX.get(i+1);
                finalY=DrawY.get(i+1);
                //g.drawLine(0, 0, 100, 100);
                if(draw)
        g.drawLine(initX, initY, finalX, finalY);
        g.setColor(Color.blue);
           //System.out.println(initX);
           //System.out.println(finalY);
        }
           super.paint(g);
           //repaint();

    }

    int lastSize=0;
    int initX,initY;
    int finalX,finalY;
    Vector<Integer> X=new Vector<Integer>();
    Vector<Integer> Y=new Vector<Integer>();
    boolean draw=false;
    Vector<Integer> DrawX=new Vector<Integer>();
    Vector<Integer> DrawY=new Vector<Integer>();
    Checkbox red,green,blue;
}

However, the problem with the code is that, when the checkbox is correctly shown, the lines can not drawn when dragging the mouse, but when removing the checkbox, the line drawing function is working. Is there any problem when I implement MouseMotionListener and ItemListener?

A: You can try putting the two listener inside two separeted threads.
Here is how to set up a thread
With this methods the two listeners work separatly and at the same time, so they don't block each other.


text:
Q: IMAP losing e-mails on sync I have two instances of Outlook 2013 (separate machines) connecting to IMAP mailbox.
Steps to reproduce are:

*

*Delete one message from instance 1

*In a few hours start instance 2 and delete different message.

*Go back to instance 1 and realize that totally different messages disappeared + those deleted in step 1 & 2.

Any suggestions?

A: The workaround I've found is a bit odd.
Basically set up my Hotmail account to download my e-mail and then Outlook 2013 would use EAS to download my e-mail from m.hotmail.com
The only downside is that I've got up to 30min. delay when receiving e-mails as that's the current limitation of Hotmail service for downloading external account e-mails.


text:
Q: Using a local HTML file in jsoup I've been trying to parse a html file that is stored locally on  my C: drive but I keep getting the same error
java.io.FileNotFoundException: C:\MyStuff\MyHTMLFile.html (The system cannot find the file specified)
This is my code.
Document doc = Jsoup.parse(new File("C:\\MyStuff\\MyHTMLFile.html"), "UTF-8");
I've tried different variations of back and forward slashes but nothing seems to work?

A: Seems as though the file was corrupt or something? I copied the contents into a new file and its working okay now.


text:
Q: Passing textbox text as a stored procedure parameter for output in a gridview I have two textboxes and two gridviews.
The textboxes are populated with coordinates from javascript variables which change according to which cell is clicked on in the first gridview. This works ok:
    <asp:TextBox ID="tbGrade" runat="server" CssClass="hideOnprint" AutoPostBack="True"></asp:TextBox>
    <asp:TextBox ID="tbKS2" runat="server" CssClass="hideOnprint" AutoPostBack="True"></asp:TextBox>

I would like to pass the two text values to a stored procedure once the textboxes are populated by the gridview cell click ie once they change.
This stored procedure will then output results to the second gridview.  The stored procedure works correctly when I test it with dummy values, but the two textbox parameters won't populate from the textboxes and therefore the second gridview is not displaying.
So the input is working ok and the output is working ok, but connecting the two together is eluding me.
Here is the asp for the gridview and parameters. The dropdown text parameters work ok:
    <asp:GridView ID="gvProgressCohorts" runat="server" AutoGenerateColumns="False" DataSourceID="dsProgressCohorts">
        <Columns>
            <asp:BoundField DataField="Column1" HeaderText="Column1" ReadOnly="True" SortExpression="Column1" />
        </Columns>
    </asp:GridView>
    <asp:SqlDataSource ID="dsProgressCohorts" runat="server" ConnectionString="<%$ ConnectionStrings:MaltingsConnectionString %>" SelectCommand="spProgressCohorts" SelectCommandType="StoredProcedure">
        <SelectParameters>
            <asp:ControlParameter ControlID="DdlYear" Name="StuYear" PropertyName="SelectedValue" Type="String" />
            <asp:ControlParameter ControlID="ddlDataCollection" Name="DataCollection" PropertyName="SelectedValue" Type="String" />
            <asp:ControlParameter ControlID="DdlSubject" Name="SubjectName" PropertyName="SelectedValue" Type="String" />
            <asp:ControlParameter ControlID="DdlTeachingGroup" Name="TeachingGroup" PropertyName="SelectedValue" Type="String" />
            <asp:ControlParameter ControlID="ddlSubgroup" Name="Subgroup" PropertyName="SelectedValue" Type="String" />
            <asp:ControlParameter ControlID="tbGrade" DefaultValue="" Name="Result" PropertyName="Text" Type="String" />
            <asp:ControlParameter ControlID="tbKS2" DefaultValue="" Name="KS2" PropertyName="Text" Type="String" />
        </SelectParameters>
    </asp:SqlDataSource>

EDIT:
As it stands the second gridview is updating correctly, but only when I make a selection from one of my dropdown controls. What I need to happen is when the values in the textboxes are updated the second grid refreshes based on the selection made on the page.
EDIT:
I've added a textchange event to one of my textboxes which updates the second gridview when I manually change the value in the textbox and then focus away from the textbox. I just need to know how to achieve this when the value in the textbox changes automatically when clicking the first gridview.

A: I added the following to the javascript used to populate the textboxes when the initial gridview is clicked. This triggers the textbox text changed ie when the textbox is populated automatically the text focus is trigger server side without manual intervention as if the text had been selected and text entered and the textbox had then lost focus:
__doPostBack(document.getElementById("<%=tbKS2.ClientID%>").name, '')


text:
Q: Set subform multi-select field using Dlookup I have a table that has multiple booths assigned to a process and a Yes/NO field for the primary booth for that process.
Process | Booth | Primary
Buff1 | 8 | No
Buff1 | 5 | Yes
etc.
I am trying to automate a form to select the primary booth on a multiselect field when the process gets selected using Dlookup.
This is the code I am using:
Me.Booth.Value = DLookup("Booth", "BoothSource", "BoothSource.Process = '" & Me.Process & "' AND BoothSource.Primary = True")

The Booth field is a multi-select field. And I get error 3032 Cannot perform this operation when I try to test. Please help.
Multi-Select Example

A: Multi-select fields and combo boxes are very hard to work with.
The .Value property of a multi-valued combo box is apparently a variant array, and writeable. You can set the .Value property equal to an array containing your value, instead of just your value.
Note that this bypasses many checks, such as the Limit to list property, even if value edits to the list are disallowed. You should check your inputs manually, since this might cause errors. Avoid including anything other than a string in your array (numbers, dates), since these will not trigger an error, but insert anything from Null to some item on your list to pseudorandom unicode characters.
Dim varValue As Variant
varValue = DLookup("Booth", "BoothSource", "BoothSource.Process = '" & Me.Process & "' AND BoothSource.Primary = True")
Me.Booth.Value = Array(CStr(varValue))

Note that I strongly advice against using multi select fields, so you can avoid this mess.


text:
Q: Does git merge account for commit timestamps? Here is graph for 2 branches master and sprint1. When the 2 branches are merged I expected "second commit" (Wed Oct 19 19:58:15 2016 -0400) to be after "sprint 1 first commit" (Wed Oct 19 19:57:13 2016 -0400) as that's the time next to "sprint 1 first commit" commit time.
Question: How does the merge happen? Does the timestamp being considered affect it at all?
ds-MacBook-Pro:Test1 aks$ git log  --graph
*   commit 48bbcabf5d50e080c82e71ce8661571f061a35c2
|\  Merge: b59ca50 e1195c7
| | Author: hmanan <test@gmail.com>
| | Date:   Wed Oct 19 19:59:53 2016 -0400
| |
| |     merge commit
| |
| * commit e1195c7230fd50b3831b3c1ab597bb691c593550
| | Author: hmanan <test@gmail.com>
| | Date:   Wed Oct 19 19:58:15 2016 -0400
| |
| |     second commit
| |
* | commit b59ca508357f151520ce7c88c5cc439992bc477c
| | Author: hmanan <test@gmail.com>
| | Date:   Wed Oct 19 19:59:22 2016 -0400
| |
| |     sprint 1 third commit
| |
* | commit 68064f65d2570b8f0c22273b431444610c49d97d
|/  Author: hmanan <test@gmail.com>
|   Date:   Wed Oct 19 19:58:56 2016 -0400
|
|       sprint 1 second commit
|
* commit f9b26255345373f2cb63d26845d2c651527e13ac
| Author: hmanan <test@gmail.com>
| Date:   Wed Oct 19 19:57:13 2016 -0400
|
|     Sprint 1 first commit
|
* commit faa866e8d994f32feed8c1d5e26d4d5eb4197a6f
  Author: hmanan <test@gmail.com>
  Date:   Wed Oct 19 19:55:28 2016 -0400

      first commit

A: As @bmargulies mentioned, the timestamps have nothing to do with how the merge is performed. A merge commit merely has pointers to two parent commits, rather than one. You can see this in the third line of your output: Merge: b59ca50 e1195c7.
To display the commits in "proper" order, use either --date-order (for committer date), or --author-date-order (for author date).
E.g.:
git log --graph --date-order


text:
Q: Using Describe to return single field result I wrote a generic method that takes an object, field and value as string parameters and returns the picklist label.
I was wondering if there is a more efficient way to write the method instead of returning all fields in a map from the sObject and then looping over to find the specific field?
Here is the method:
    public static String getSobjectPicklistLabel(string obj, string fld, string value) {
        String retval = '';
        Map<String , Schema.SObjectType> globalDescription = Schema.getGlobalDescribe();
        Schema.sObjectType sObjType = globalDescription.get(obj);
        Schema.DescribeSObjectResult sObjectResult = sObjType.getDescribe();
        Map<String , Schema.SObjectField> mapFieldList = sObjectResult.fields.getMap();
        for(Schema.SObjectField field : mapFieldList.values()) {
            Schema.DescribeFieldResult fieldResult = field.getDescribe();
            if(fieldResult.getLabel() == fld) {
                List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();
                for(Schema.PicklistEntry f : ple) {
                    if(f.getValue() == value) {
                        retval = f.getLabel();
                        break;
                    }
                }
            }
        }
        return retval;
    }

A: Yes, you can use the code I devised as a starting point:
public static String getLabelForPicklistValue(String objectName, String fieldName, String value) {
    // Dynamically create a reference to an object and field, and describe.
    // NOTE: No error checking, so if it's not a picklist, expect a crash.
    for(PicklistEntry entry: ((SObject)(Type.forName('Schema.'+objectName).newInstance())).getSObjectType()
        .getDescribe().fields.getMap().get(fieldName).getDescribe().getPicklistValues()) {
        if(entry.getValue() == value) {
            return entry.getLabel();
        }
    }
    return null; // value not found...
}


text:
Q: How can I correct this Dockerfile to take arguments properly? I have this dockerfile content:
FROM python:latest

ARG b=8
ARG r=False
ARG p=1

ENV b=${b}
ENV r=${r}
ENV p=${p}

# many lines of successful setup
ENTRYPOINT python analyze_all.py /analysispath -b $b -p $p -r $r

My intention was to take three arguments at the command line like so:
docker run -it -v c:\analyze containername -e b=16 -e p=22 -e r=False

But unfortunately, I'm misunderstanding something fundamental and simple here instead of something complicated, so I'm helpless :).

A: If I understood the question correctly, this Dockerfile should do what is required:
FROM python:latest

# test script that prints argv
COPY analyze_all.py /

ENTRYPOINT ["python", "analyze_all.py", "/analysispath"]

Launch:
$ docker run -it test:latest -b 16 -p 22 -r False
sys.argv=['analyze_all.py', '/analysispath', '-b', '16', '-p', '22', '-r', 'False']

Looks like your Dockerfile is designed to build and run a container on Windows. I tested my Dockerfile on Linux, it probably won't be much different to use this approach on Windows.
I think ARG instructions isn't needed in this case because it defines a variable that users can pass at build-time using the docker build command. I would also suggest that you take a look at the Dockerfile reference for the ENTRYPOINT instruction:

Command line arguments to docker run  will be appended after all elements in an exec form ENTRYPOINT, and will override all elements specified using CMD. This allows arguments to be passed to the entry point, i.e., docker run  -d will pass the -d argument to the entry point.

Also, this question will probably be useful for you: How do I use Docker environment variable in ENTRYPOINT array?


text:
Q: Setting node to spawn randomly from an array of points and to fall at gradually faster speeds The result I am looking to achieve: I am looking to spawn a node randomly from 3 different locations stored in an array. Once spawned, I would like the node to fall. Gradually over time, I would like to have the node fall at faster speeds.
What I currently have: The node spawns at a set location and falls like it should. The node currently doesn't spawn randomly and the speed at which it falls doesn't increase. I have an array written but it currently isn't functioning the way it should.
Updated code:
 var nodeDropTime:TimeInterval = 5

   func fallingNodeAction(){

        self.node = SKSpriteNode(imageNamed: "node 2")
        self.node.zPosition = 1
        self.node.physicsBody = SKPhysicsBody(circleOfRadius: self.node.size.height / 10.0)
        self.node.physicsBody?.isDynamic = true
        self.node.physicsBody?.allowsRotation = false
        self.node.physicsBody?.affectedByGravity = true

        nodeDropTime -= 1

        var nodePosition = Array<CGPoint>()

        nodePosition.append((CGPoint(x:400, y:475)))
        nodePosition.append((CGPoint(x:450, y:475)))
        nodePosition.append((CGPoint(x:500, y:475)))

        self.node.physicsBody?.categoryBitMask = ColliderType.nodeCategory
        self.node.physicsBody?.contactTestBitMask = ColliderType.boundary
        self.node.physicsBody?.collisionBitMask = 0

        let shuffledLocations = GKRandomSource.sharedRandom().arrayByShufflingObjects(in: nodePosition) as! [CGPoint]

        self.node.position = shuffledLocations[0]

    }

    fallingNodeAction()

A: For the random location, import
GameplayKit, so you can use arrayByShufflingObjectsInArray on the array of CGPoints to then choose the first item in the array as the location. The code:
let shuffledLocations = GKRandomSource.sharedRandom().arrayByShufflingObjects(in: nodePosition) as! [CGPoint]

self.node.position = shuffledLocations[0]


text:
Q: How to reverse RGB array to BGR array in tensorflow.js There is a RGB image with [512,512,3] shape ,now I want to reverse the array in BGR  not in RGB,how to do it in tensorflow.js

A: You can use tf.reverse along the channel axis
tf.reverse(tensor, -1)

One can also use tf.unstack and tf.stack. That can be useful if one wants to reverse the image channel in any order
temp = tf.unstack(tensor, axis)
tf.stack([temp[2], temp[1], temp[0]], axis)

const x = tf.tensor3d([1, 2 , 3, 4 , 5, 6, 7, 8], [2, 2, 2]);

const axis = 2;
// tf.reverse
x.reverse(axis).print();

// tf.stack and tf.unstack
const temp = tf.unstack(x, axis)
tf.stack([temp[1], temp[0]], 2).print()

// tf.split and tf.concat
const temp1 = tf.split(x, 2, 2)
tf.concat([temp1[1], temp1[0]], 2).print()
<html>
  <head>
    <!-- Load TensorFlow.js -->
    <script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@0.14.1"> </script>
  </head>

  <body>
  </body>
</html>


text:
Q: Showing $ | 1 - \frac{x^2}{2} - \cos x | \leq \frac{1}{24}$ using Taylor Use Taylor's theorem to show that for $x \in [-1, 1] $ we have that $$ \left| 1 - \frac{x^2}{2} - \cos x \right| \leq \frac{1}{24}. $$
Attempt: Since $\cos(x) = 1 - \frac{x^2}{2} + \frac{x^4}{4!} - \ldots $, I see that $1 - \frac{x^2}{2} = P_2 (x)$ is the second order Taylor polynomial of $f(x) = \cos(x)$ around $x_0 = 0$. So we have that $\cos(x) =  P_2(x) + r(x)$, where $r(x)$ is the remainder term. But I'm not sure how to use this remainder term to get a proper upper bound for $ | 1 - \frac{x^2}{2} - \cos x | \leq \frac{1}{24}$.

A: Since the term in $x^3$ is $0$, your approximation $P_2(x)$ can also be thought of as $P_3(x)$.
By the Lagrange form of the remainder, the absolute value of the error in $P_3(x)$ is $\frac{1}{4!}|\cos(c_x)||x|^4$ for some $c_x$ between $0$ and $x$. We have $|\cos(c_x)|\le 1$, and $|x|\le 1$.


text:
Q: Aggregation in array element - python I have a OP : {'2017-05-06': [3, 7, 8],'2017-05-07': [3, 9, 10],'2017-05-08': [4]}
from the OP I just want another OP :
{'2017-05-06': [15, 11, 10],'2017-05-07': [19, 13, 12],'2017-05-08': [4]}
which means:
Ncleand is 2017-05-06
element total is 18 so '2017-05-06': [3 -18, 7-18, 8-18] = '2017-05-06': [15, 11, 10]
likewise all elements data.
So final output is {'2017-05-06': [15, 11, 10],'2017-05-07': [19, 13, 12],'2017-05-08': [4]}
How to do this?
Note : I am using python 3.6.2 and pandas 0.22.0
code so far :
import pandas as pd
dfs = pd.read_excel('ff2.xlsx', sheet_name=None)
dfs1 = {i:x.groupby(pd.to_datetime(x['date']).dt.strftime('%Y-%m-%d'))['duration'].sum() for i, x in dfs.items()}
d = pd.concat(dfs1).groupby(level=1).apply(list).to_dict()
actuald = pd.concat(dfs1).div(80).astype(int)
sum1 = actuald.groupby(level=1).transform('sum')
m = actuald.groupby(level=1).transform('size') > 1
cleand = sum1.sub(actuald).where(m, actuald).groupby(level=1).apply(list).to_dict()
print (cleand)

From the cleand I want to do this?

A: def get_list_manipulation(list_):
    subtraction = list_
    if len(list_) != 1:
        total = sum(list_)
        subtraction = [total-val for val in list_]
    return subtraction

for key, values in data.items():
    data[key] = get_list_manipulation(values)
>>>{'2017-05-06': [15, 11, 10], '2017-05-07': [19, 13, 12], '2017-05-08': [4]}

A: In a compact (but somehow inefficient) way:
>>> op = {'2017-05-06': [3, 7, 8],'2017-05-07': [3, 9, 10],'2017-05-08': [4]}
>>> { x:[sum(y)-i for i in y] if len(y)>1 else y for x,y in op.items() }

#output:
{'2017-05-06': [15, 11, 10], '2017-05-07': [19, 13, 12], '2017-05-08': [4]}


text:
Q: iOS comparing english with german characters I am using string search "rangeOfString" method available in NSString class. If the string to search and the search string both are in English, I'm able to perform the search perfectly. But if the search string has german characters like umlauts and accents (like German characters Ä,Ö,Ü) I'm not able to compare. Can some one suggest me the correct method to compare/search English and German characters?

A: Use NSDiacriticInsensitiveSearch option while using the compare/rangeOfString method. Check the documentation here.

NSDiacriticInsensitiveSearch:
Search ignores diacritic marks.
For example, 'ö' is equal to 'o'.


text:
Q: WPF: Dynamically change dependency property value for all user controls of same type I'm rather new to WPF and encountered some difficulties with user controls.
Please consider the following scenario:
I have a WPF application with a user control, say
MySpecialButtonControl

This "button" has two appearances "oldStyle" and "newStyle" (specified by the Enum "AppearanceStyle") which are controlled by a dependency property with the name
MyLayoutProperty

The callback function has to carry out the code which changes the layout.
Now here is what I would like to do:
I need to change the appearance of all (!) instances of the user control in this window at once in a code-behind file at run-time.
Binding (e.g.) a property to individual instances of the UC like
Binding binding = new Binding("AppearanceStyle");
binding.Source = myOptionsClass;
this.myButton.SetBinding(UserControls.MySpecialButtonControl.MyLayoutProperty, binding);

works perfectly well. But how can I directly change the dependency property for ALL UC instances without having to iterate over collections of the UCs, etc.? Is there even a way to achieve this in WPF/C#?
I tried to solve this problem by using styles, but changing the style which is shared by all UCs itself at runtime is not possible since it is already in use (and the UCs which use this style have already been drawn).
Next, I tried to use a dynamic resource in the style like this:
  <uc:MySpecialButtonControl x:Key="myFakeButton" ></uc:MySpecialButtonControl >

    <Style x:Key="myButtonStyle" TargetType="uc:MySpecialButtonControl ">
        <Setter Property="MyLayoutProperty" Value="{DynamicResource myFakeButton}"></Setter>
    </Style>

This allows me to change the "MyLayoutProperty" for "myFakeButton" at runtime which is half of what I want, but even after googling for some time I still could not find a way to bind the "MyLayoutProperty" of "myFakeButton" to the setter which is what I really need.
Any help would be greatly appreciated!
Update:
I tried to implement the solution provided by Michael, but unfortunately, I got the following exception:
PropertyMetadata is already registered for type 'MySpecialButtonControl'.

After some googling (see MSDN) I found that the OverrideMetadata call should be placed in a static constructor of "MySpecialButtonControl" which I did:
static MySpecialButtonControl()
{
    DefaultStyleKeyProperty.OverrideMetadata(
    typeof(MySpecialButtonControl),
    new FrameworkPropertyMetadata(typeof(MySpecialButtonControl)));
}

Now, the application compiles. And now it works perfectly.

A: I'm not entirely sure I follow, but I'll attempt an answer. Please comment if this is close, and I'll edit until we get there.
All controls in WPF have a property DefaultStyleKey. Any derived custom control or user control can use this property to set the key of the default style. At runtime, the framework will try to find a resource of this key. It is common to set the default style key equal to the runtime type of the class.
public MySpecialButtonControl()
{
    DefaultStyleKeyProperty.OverrideMetadata(
        typeof (MySpecialButtonControl),
        new FrameworkPropertyMetadata(typeof (MySpecialButtonControl)));

    InitializeComponent();
}

When a control placed onto a Window, the framework will look in the available resources for a resource with the key that is defined by DefaultStyleKey. The resource can be defined in a number of places. Google "WPF resource resolution" for more info. The simplest way to illustrate is to show the default style defined in your App.xaml.
<Application.Resources>

    <!-- the default style for MySpecialButtonControls -->
    <Style x:Key="{x:Type uc:MySpecialButtonControl}"
           TargetType="{x:Type uc:MySpecialButtonControl}"
           BasedOn="{StaticResource {x:Type UserControl}}" >
        <Setter Property="Background" Value="Blue" />
    </Style>

</Application.Resources>

Now suppose you have two different styles that you want to switch between at runtime. You might define those styles in your App.xaml.
<Application.Resources>

    <!-- the first style -->
    <Style x:Key="Style1"
           TargetType="{x:Type uc:MySpecialButtonControl}"
           BasedOn="{StaticResource {x:Type UserControl}}">
        <Setter Property="Background" Value="Blue" />
    </Style>

    <!-- the second style -->
    <Style x:Key="Style2"
           TargetType="{x:Type uc:MySpecialButtonControl}"
           BasedOn="{StaticResource {x:Type UserControl}}">
        <Setter Property="Background" Value="Red" />
    </Style>

    <!-- the default style, now based on Style1 -->
    <Style x:Key="{x:Type uc:MySpecialButtonControl}"
           TargetType="{x:Type uc:MySpecialButtonControl}"
           BasedOn="{StaticResource Style1}" />

</Application.Resources>

At runtime, you could do something like this to toggle the default style of the controls.
private void Button_Click(object sender, RoutedEventArgs e)
{
    // get the style resources
    var style1 = FindResource("Style1") as Style;
    var style2 = FindResource("Style2") as Style;
    var defaultStyle = FindResource(typeof (MySpecialButtonControl)) as Style;
    if (style1 == null || style2 == null || defaultStyle == null)
        return;

    // create a new style based on the "other" style
    var newDefaultStyle = new Style(
        typeof (MySpecialButtonControl),
        (defaultStyle.BasedOn == style1 ? style2 : style1));

    // set the application-level resource to the new default style
    Application.Current.Resources[typeof (MySpecialButtonControl)] = newDefaultStyle;
}

Is this even close?


text:
Q: Show div on selecting name from array I have a div hidden initially, a text box which performs a live search in the database and returns an array of the matched results. I want to make the div visible only if a value from the array is selected and hide it otherwise. How can i do this?

<link rel="stylesheet" type="text/css" href="b.css" />

ESAMP

SUPPORT

FEEDBACK

SEARCH

<input class="box" type="text" name="serch" id="serch" placeholder="Enter Your Software Name" onEnter="showDiv()"/>
<input class="mybutton" type = "submit" value="Search"  onclick="showDiv()">
 </form>

HELLO

currently i am showing the div on a button click. I want to show the div when the input value is selected from an array.


text:
Q: Do different parts of body conduct current in different ways? When we touch anything(with small amount of current), like the end of our CPU cabinet, with our hands, it does feel like a small current is flowing through.But the same doesn't occur when touch the cabinet with our foot.Why does this happen?

A: I assume two things here:

*

*You are mainly asking about why we feel the zap sometimes and don't at other times.

*You are talking about a metal computer case and not a computer cabinet, which is usually wooden.

As to why you sometimes feel or don't feel the zap, this is primarily because of how densely packed some of your receptors are in your skin and how sensitive they are at that area. For example, your back is significantly less sensitive than your hands (palm, fingertips, back of hand, etc.) and your heel is even more insensitive than your back. You have many biological reasons why this is so but I'm not going into them here.
From a purely physical point of view, the body really doesn't vary much (nothing more than an order of magnitude) in conductivity or resistivity regardless of area chosen. Your body's composition is nowhere significantly different from the rest of it. Bone and fat have the greatest resistivity, muscle and blood the least. Surprisingly, skin isn't a great conductor because of its nature of having multiple layers of dry epidermis, dermis and fatty hypodermis. Things just do not flow and exchange as much when it comes to skin. Note that the thickness of the dead-cell layer and the wetness of skin are the greatest factors here (which is why capital punishment via electrocution needs a sponge wet with salt solution and why doctors use conducting gels for electrodes).
Note the difference between resistivity and resistance here; resistivity is an intrinsic property of the material (or composite, in this case) while resistance is an extrinsic property depending on various changeable factors like length, area, temperature, etc. Someone's resistance can be significantly changed based on where the current flows in and out. For example, someone grabbing a wire and standing on the opposite foot on the ground forces the current to travel a much longer distance through much more stuff than if the same person was insulated from the ground and touched on his skin with two wires of a circuit close together.

A: Yes, different tissues, and therefore body parts and organs generally have varying impedances.
Also, if it's really a current that you're sensing, then the grounding of your PC is compromised, and could pose a fire hazard.
In any case, the situation you're describing is, I believe, solved primarily by accounting for the thickness of the skin at the foot versus hand.  Perhaps you should give a little more details (where exactly are you touching the PC, a flat surface or a corner, and which part of the hand/foot, ...), and try touching with different parts of the foot to see if it makes a difference.
PCs emit vibrations and varying electromagnetic fields, either or both of which could be the physics underlying your sensation.  While in the latter case (EM fields) this could actually mean that your nerve cells are triggering as a response to the field, and therefore a current is involved, it doesn't imply that you're actually connected to any of the electric potentials within the cabinet.


text:
Q: react-router inconsistent `exact` behaviour in `matchPath()` function I have two level navigation in my application. Top level items should have different color when any of the sub-items are active. In order to achieve that, I tried using matchPath() function.
Top level navigation route is /app/production, sub item route is /app/production/:id.
I want matchPath() to return true for /app/production when user is on /app/production/:id.
This is the code I'm using for this check:
matchPath("/app/production", { path: location.pathname, exact: false})
Following the documentation and how <Route> component works, I need to set exact parameter to false - but I get null match object anyway. It's just as if matchPath() works with { exact: true } always. Any ideas what I might be doing wrong?
PS. No, I can't use <NavLink> for this.

A: Please try by reverting the order of parameter :
matchPath(location.pathname, { path: "/app/production"})

Also, exact has a default value of false, so we can skip that.

A: Ok, I found the issue. I've messed up the order of the parameters.
Instead of:
matchPath("/app/production", { path: location.pathname, exact: false})
It should be:
matchPath(location.pathname, { path: "/app/production", exact: false})


text:
Q: Notepad++ mass multiply a specific integer after a text I have notepad++ with python script installed, is there a way to mass multiply all numbers that come after a specific string?
For example:
ExperienceGained 10 + X
I have thousands of those lines and I need to multiply all X by 3.
I tried this but without any success:
def multiply_number_in_context(match):
    return "{0}{1}{2}{3}".format(match.group(1), str(int(match.group(3))*3), '"')

editor.rereplace(r'(ExperienceGained 10 + )(\d+)"', multiply_number_in_context)

A: You can run a python script within the PythonScript plugin.
If it is not yet installed, follow this guide

*

*Create a script (Plugins >> PythonScript >> New Script)

*Copy this code and save the file (for example multiply.py):

import re

def multiply(match):
    val = int(match.group(1)) * 3
    return str(val)

editor.rereplace(r'^ExperienceGained 10 \+ \K(\d+)$', multiply)

*

*Open the file you want to modify

*Run the script (Plugins >> PythonScript >> Scripts >> multiply)

*Done

Screenshot (before):

Screenshot (after):


text:
Q: Open eclipse view along with custom editor in PDE I have created a custom eclipse editor and want a view to be opened in the event the editor is active. If the view is already open then nothing should be done. I also want this functionality for the console in that the console should be open in the event my custom editor is active. Is this possible to do in Eclipse plugin development environment?

A: You can open the view in the init method of your editor using something like:
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
page.showView("org.eclipse.ui.console.ConsoleView");

This will open the view if it is not open or make it the active view if it is already open.


text:
Q: React is not rendering components I'm working on a project with a single component (Home). I'm trying to render the component on localhost:3000. But it's not showing up in the browser.
The error is:
Uncaught TypeError: Cannot read properties of null (reading 'useRef')
         at useRef (bundle.js:48556:25)
         at BrowserRouter (bundle.js:45657:65)
         at renderWithHooks (bundle.js:23687:22)
         at mountIndeterminateComponent (bundle.js:28304:17)
         at beginWork (bundle.js:29759:20)
         at beginWork$1 (bundle.js:34660:18)
         at performUnitOfWork (bundle.js:33821:16)
         at workLoopSync (bundle.js:33734:9)
         at renderRootSync (bundle.js:33703:11)
         at performSyncWorkOnRoot (bundle.js:33346:24)

This error was logged on to the console.
Below are my code files:

*

*App.js

import {BrowserRouter as Router,Route,Routes} from 'react-router-dom'
import Home from './Components/Home';
import Login from './Components/Login';
import React from 'react';
import './App.css'

function App() {
  return (
    <>

     <Router>
      <Routes>
        <Route exact path="/" element={<Home/>}></Route>
        <Route exact path="/login" element={<Login/>}/>
      </Routes>
    </Router>
    </>

  );
}

export default App;

*Index.js

import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
import reportWebVitals from './reportWebVitals';

ReactDOM.render(
  <React.StrictMode>
    <App />
  </React.StrictMode>,
  document.getElementById('root')
);

reportWebVitals();

3.Home.js
import React from 'react'

export default function Home() {[![enter image description here][1]][1]
  return (
    <>
    <h1 style={{backgroundColor:'red'}}>Home Component </h1>
    </>
  )
}

A: Try to change the route. Give any other directory other than 30000. Hopefully, it will work.
also in the App.js>login part> give route closing tag.


text:
Q: How can I have a what3words style effect on my google map tiles? For reference, what I'm specifically referring to is how they highlight the square border and draw the line out to the tooltip. I didn't really care about the line but found the mouseover behavior interesting.
I also like the hover effect over the various tiles before they're selected.
Here it is in action

A: Here's something I threw together that I'm happy with:
https://jsfiddle.net/0zkyx8g9/14/

    const HOVERED_CLASS_NAME = "tile-hover-hack"

    /*
     * This demo illustrates the coordinate system used to display map tiles in the
     * API.
     *
     * Tiles in Google Maps are numbered from the same origin as that for
     * pixels. For Google's implementation of the Mercator projection, the origin
     * tile is always at the northwest corner of the map, with x values increasing
     * from west to east and y values increasing from north to south.
     *
     * Try panning and zooming the map to see how the coordinates change.
     */
    class CoordMapType {
      tileSize;
      constructor(tileSize) {
        this.tileSize = tileSize;
      }
      getTile(coord, zoom, ownerDocument) {
        const div = ownerDocument.createElement("div");
            div.id = "block_" + coord.x + "_" + coord.y;
        div.innerHTML = String(coord);
        div.style.width = this.tileSize.width + "px";
        div.style.height = this.tileSize.height + "px";
        div.style.fontSize = "0";
        div.style.borderStyle = "solid";
        div.style.borderWidth = "1px";
        div.style.borderColor = "lightgrey";
        div.className = 'tile';
        return div;
      }
      releaseTile(tile) {}
    }

    // must be a factor of 2 (max 256) or swap8 breaks
    const TILE_SIZE = 32;

    let map;

    function initMap() {
      const chicago = new google.maps.LatLng(41.85, -87.65);
      map = new google.maps.Map(document.getElementById("map"), {
        center: chicago,
        zoom: 3,
      });

      // Insert this overlay map type as the first overlay map type at
      // position 0. Note that all overlay map types appear on top of
      // their parent base map.
      map.overlayMapTypes.insertAt(
        0,
        new CoordMapType(new google.maps.Size(TILE_SIZE, TILE_SIZE))
      );

      // https://developers.google.com/maps/documentation/javascript/examples/map-coordinates#maps_map_coordinates-javascript
      map.addListener('mousemove', (event) => {
        const zoom = map.getZoom();
        // console.log('swap 8 on', TILE_SIZE, 'is', swap8(TILE_SIZE));
        const scale = swap8(TILE_SIZE) << zoom;
        const worldCoordinate = project(event.latLng);
        /* console.log('scale:', scale);
        console.log('world:', worldCoordinate.x, worldCoordinate.y); */
        // x = floor ( 5 * 8 ) / 28
        const x = Math.floor((worldCoordinate.x * scale) / TILE_SIZE);
        const y = Math.floor((worldCoordinate.y * scale) / TILE_SIZE);
        const tile = document.getElementById('block_' + x + '_' + y);
    //     console.log(x, y);

        // I have the block!
        if (previousTile == null) {
          newTileDetected(tile);
        } else if (previousTile !== tile) {
            newTileDetected(tile);
        }
      });

    }

    // do all side-effects relating to new tile
    // 1) de-activate any previous tile styling for active state
    // 2) active tile styling for new tile
    let previousTile;
    const newTileDetected = (tile) => {
        if (tile == null) {
        throw Error("New tile detected was null");
      }
        if (previousTile == null) {
        previousTile = tile;
      } else {
        previousTile.className = "";
      }
      tile.className = HOVERED_CLASS_NAME;
      previousTile = tile;
    }

    function swap8(val) {
      return ((val & 0x1) << 8) |
        ((val & 0x2) << 6) |
        ((val & 0x4) << 4) |
        ((val & 0x8) << 2) |
        ((val >> 2) & 0x8) |
        ((val >> 4) & 0x4) |
        ((val >> 6) & 0x2) |
        ((val >> 8) & 0x1);
    }

    // The mapping between latitude, longitude and pixels is defined by the web
    // mercator projection.
    const project = (latLng) => {
      let siny = Math.sin((latLng.lat() * Math.PI) / 180);

      // Truncating to 0.9999 effectively limits latitude to 89.189. This is
      // about a third of a tile past the edge of the world tile.
      siny = Math.min(Math.max(siny, -0.9999), 0.9999);
      return new google.maps.Point(
        TILE_SIZE * (0.5 + latLng.lng() / 360),
        TILE_SIZE * (0.5 - Math.log((1 + siny) / (1 - siny)) / (4 * Math.PI))
      );
    }

    .tile-hover-hack {
      background-color: rgba(0, 0, 255, 0.5);
    }

This example is what helped a ton for just generally how to handle the mismatch between the information the tiles have available at creation time and the information available in the mouse event.


text:
Q: How to disable stripe pay button when payment is processing using reactjs?
I have created using reactjs stripe card section and in card section, adding card element and in the checkout form render it and in checkout form pay button is also there but I want to disable the pay button unless response gets from backend?
  Here is my code:-

class CheckoutForm extends React.Component {
  handleCallback = status => {
    if (status === "success") {
      message.success("Payment is successfull");
      this.props.history.push("/main");
    } else {
      message.error("Some error occoured");
    }
  };

  handleSubmit = ev => {
    ev.preventDefault();
    const { userDetails, user, tempPassDate } = this.props;
    const { paymentId } = this.props;
    this.props.stripe
      .createPaymentMethod("card", { billing_details: { name: "Jenny Rosen" } })
      .then(({ paymentMethod }) => {
        console.log("Received Stripe PaymentMethod:", paymentMethod.id);
        this.props.payment(
          {
            paymentMethodId: paymentMethod.id,
            paymentId: paymentId,

          },

        );
      })
      .catch(err => console.log(err));
  };
  render() {

    return (
          <form onSubmit={this.handleSubmit}>
            <CardSection/>
            <button>
              Pay
            </button>
          </form>
    );
  }
}

A: Manage that in state like:
class CheckoutForm extends React.Component {
  constructor(props){
    super(props);
    this.state = {
      disableBtn: false;
    }
  }
  handleCallback = status => {
    if (status === "success") {
      message.success("Payment is successfull");
      this.props.history.push("/main");
    } else {
      message.error("Some error occoured");
    }
  };

  handleSubmit = ev => {
    ev.preventDefault();
    this.setState({ disableBtn: true });
    const { userDetails, user, tempPassDate } = this.props;
    const { paymentId } = this.props;
    this.props.stripe
      .createPaymentMethod("card", { billing_details: { name: "Jenny Rosen" } })
      .then(({ paymentMethod }) => {
        console.log("Received Stripe PaymentMethod:", paymentMethod.id);
        this.props.payment(
          {
            paymentMethodId: paymentMethod.id,
            paymentId: paymentId,

          },

        );
        this.setState({ disableBtn: false });
      })
      .catch(err => console.log(err));
  };
  render() {

    return (
          <form onSubmit={this.handleSubmit}>
            <CardSection/>
            <button disabled={this.state.disableBtn}>
              Pay
            </button>
          </form>
    );
  }
}


text:
Q: Decrease one columns height bootstrap What I want to achieve is a footer design like this with bootstrap:

I already have managed to get the left column (Red Background ) of the footer set up. The problem is, that somehow I can't style the Right column (Black Background). As soon as I set the height to 70%, the column height shrinks to the content. I see that this has to do with no height being set to the parent container. But how can I set a fixed height, and still maintain responsiveness? With media queries?
Also as soon as I set the display to flex for the right-column that contains the 2 rows ( One with the links, and one with the white logo), the rows get displayed as columns next to each other. If I dont do so, the content alignment has no effect.
Can anyone help me with this issue? It seems like I missed some important point about the grid system and display utilities.
This is what it looks right now:

Here is my code:

<img
                            src="<?php echo get_stylesheet_directory_uri(); ?>/images/logo_white.png">

© Copyright <?php echo date( 'Y' );  ?> - All rights
                    reserved.

 Impressum

 Datenschutz

 Sitemap

 Designed by

                    <img src="<?php echo get_stylesheet_directory_uri()?>/images/logo_fewture.png" style="height: 50px">

A: You can set your second column as display: flex and define it with flex-direction: column and justify-content-end.
Put your content inside the second column div, and the content will start to grow from bottom.

.box-1 {
  height: 400px;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.5.0/css/bootstrap.min.css" rel="stylesheet"/>

Column 1

As the content is growing

Justify content end with

Flex direction column

Will make content growing up :)


text:
Q: Loop ansible json_query in Ansible So, I'm fetching Grafana alerts and I want to get a list of the alerts that don't end with two specific strings:
grafana_alerts_exclusion_list: "['one', 'three']"

Here's how I'm fetching all the Grafana alerts:
- name: Get Grafana alerts
   URI:
    url: "{{ grafana_endpoint }}/api/alerts"
    method: GET
    headers:
      Authorization: "Bearer {{ grafana_api_token }}"
    body_format: json
  register: alerts_output

And here I'm trying to use json_query to exclude the grafana_alerts_exclusion_list alerts:
- set_fact:
    alerts: "{{ alerts + [ alerts_output.json | to_json | from_json | json_query(query) ] }}"
  with_items: "{{ grafana_alerts_exclusion_list }}"
  vars:
    alerts: []
    query: "[?!ends_with(name, '{{ item }}')]"

The problem I'm getting is that it runs the json_query once for string "one" and then it runs it again against the initial "alerts_output.json" for string "three", and not against the results from string "one".
How do I get the output without strings "one" and "three" (grafana_alerts_exclusion_list)?
Here's my "alerts_output":
{
    "cache_control": "no-cache",
    "changed": false,
    "connection": "Close",
    "content_length": "3175",
    "content_type": "application/json",
    "cookies": {},
    "cookies_string": "",
    "date": "Tue, 09 Aug 2022 14:52:07 GMT",
    "elapsed": 0,
    "expires": "-1",
    "failed": false,
    "json": [
        {
            "dashboardId": 238,
            "evalData": {
                "noData": true
            },
            "evalDate": "0001-01-01T00:00:00Z",
            "executionError": "",
            "id": 94,
            "name": "Something one",
            "newStateDate": "2022-08-09T14:48:48Z",
            "panelId": 4,
            "state": "no_data"
        },
        {
            "dashboardId": 238,
            "evalData": {
                "noData": true
            },
            "evalDate": "0001-01-01T00:00:00Z",
            "executionError": "",
            "id": 93,
            "name": "Something two",
            "newStateDate": "2022-08-09T14:48:28Z",
            "panelId": 3,
            "state": "no_data"
        },
        {
            "dashboardId": 238,
            "evalData": {
                "noData": true
            },
            "evalDate": "0001-01-01T00:00:00Z",
            "executionError": "",
            "id": 95,
            "name": "Something three",
            "newStateDate": "2022-08-09T14:48:48Z",
            "panelId": 7,
            "state": "no_data"
        },
        {
            "dashboardId": 238,
            "evalData": {
                "noData": true
            },
            "evalDate": "0001-01-01T00:00:00Z",
            "executionError": "",
            "id": 96,
            "name": "Something four",
            "newStateDate": "2022-08-09T14:48:16Z",
            "panelId": 10,
            "state": "no_data"
        }
    ],
    "msg": "OK (3175 bytes)",
    "pragma": "no-cache",
    "redirected": false,
    "status": 200,
    "x_content_type_options": "nosniff",
    "x_frame_options": "deny",
    "x_xss_protection": "1; mode=block"
}

A: You don't need json_query nor loop and not even set_fact. Just filter out the relevant alerts from your list, e.g.
- vars:
    reject_regex: "({{ grafana_alerts_exclusion_list | map('regex_escape') | join('|') }})$"
  debug:
    msg: "{{ alerts_output.json | rejectattr('name', 'regex', reject_regex) }}"


text:
Q: Seeming inconsistencies with "Eigenfunction" I am working on a problem which involves calculating the spectrum of a family of 2970x2970 Hermitian matrices. I have done similar things with Mathematica in the past, but this time there is an odd, seeming inconsistency in the data reported by Eigensystem. Looking at the eigenvalues of a representative example of these matrices, 2949 of them are nonzero. However, I have found that many of the eigenvectors are equivalent to the null vector - 2957 of them, in fact.
The null vector cannot have a nonzero eigenvalue, so these facts seem inconsistent. Is anyone familiar with some aspect of how Eigensystem reports data which might account for this discrepancy? Note that I have checked the Hermiticity of the matrices of interest explicitly, so this does not seem like an issue with the matrices whose spectra I am computing.
Edit: It has been requested that I make an example matrix available. You can get it as a txt file here through google drive. I encourage you to check that the matrix is Hermitian, and upon diagonalization I consistently find that it has many more nonzero eigenvalues than non-null eigenvectors. If another answer is found, please let me know. Also note that the matrix is sparse.


text:
Q: Show warnings and errors on PhpStorm project tree? How to show if a file has warnings or errors on PhpStorm project tree?

A: PhpStorm have feature of showing errors in file/tree/code..
It will make it red line for error, yellow for warnings. and you can switch to that error/warning directly by clicking on that red/yellow line with Ctrl (Ctrl+click)


text:
Q: Is this circuit possible? I am making an electrical circuit for a school project, yet electrical engineering skills cease after Ohm's law :) Now I did some research but I find electric circuits harder to design than I had expected.
For the project, we need to control 6 12 V DC motors. We found that 4 of these motors need 1.2 A and 2 need 0.2 A. We control these motors with an Arduino, this Arduino needs 0.04 A. Motors and Arduino are powered separately by a 12 V DC transformer with max 5.83 A.
Since the motors need to rotate CW and CCW, a Dual H-Bridge DC Stepper Motor Driver - L298N is used and this driver drops the voltage by 2 V (from 12V input to 10 V output):
https://howtomechatronics.com/tutorials/arduino/arduino-dc-motor-control-tutorial-l298n-pwm-h-bridge/
The circuit I made is here:

Now my question is: Is this a viable circuit or have I overlooked / misunderstood something?
Thanks in advance!

A: You meant, something like this?

simulate this circuit – Schematic created using CircuitLab


text:
Q: iOS 6: Error while updating sqlite table with text data I am trying to update a table in sqlite database. I get no troubles when updating ints but now I have insert (update) a text.
-(void)updateItemMemo:(NSString*)text itemID:(int)itemID
{
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *path = [documentsDirectory stringByAppendingPathComponent:user_data];
sqlite3* database = NULL;
sqlite3_stmt *statement;
if (sqlite3_open([path UTF8String], &database) == SQLITE_OK)
{
    const char *sqlItems=sqlite3_mprintf("UPDATE itemStatus\
                                         SET memo=?\
                                         where refID=?",text,itemID);
    if(sqlite3_prepare_v2(database, sqlItems, -1, &statement, NULL) != SQLITE_OK)

        sqlite3_bind_text(statement, 1, [text UTF8String], -1, SQLITE_TRANSIENT);
        sqlite3_bind_int(statement, 2, itemID);

    char* errmsg;
    sqlite3_exec(database, "sqlItems", NULL, NULL, &errmsg);
    sqlite3_free((char*)errmsg);

    if(SQLITE_DONE != sqlite3_step(statement))
        sqlite3_finalize(statement);
    sqlite3_free((char*)sqlItems);
    sqlite3_close(database);
}
else
{
    NSLog(@"%s: prepare failed: %s", __FUNCTION__, sqlite3_errmsg(database));
}

}

The query is right: checked in SQLiteStudio exchanging params with text and real id. It works. The problem is that the method won't work for some mysterious reason. Also it doesn't return any errors. Please help.

A: Well, solved it. The reason was the word "text" as parameter. Just changed it to "memoContext" and it worked like charm.


text:
Q: Morita equivalence for compact groups Let $K$ be a compact or a finite group with a closed subgroup $H$. Let $C(K)$ be the convolution algebra of continuous functions on $K$.
The Peter Weyl theorem asserts that the $*$ algebra $C(K)$ and the subalgebra $C(K)^H$ of functions with
$$ f(h^{-1}k h) = f(k) \qquad h\in H$$
are Morita equivalent (wrong!). The algebra $C(K)^H$ can have additional modules.

A: I don't believe this statement. In the finite case $C(K)$ is the usual group algebra. Let $K$ be nonabelian of order $6$ and let $H\subset K$ have order $2$. Then $C(K)^H$ is not Morita equivalent to $C(K)$: It is semisimple, but it has four simple modules up to isomorphism whereas $C(K)$ has three.


text:
Q: tikz--center a block diagram and a matrix below block diagram with custom spacing--pdf previewing under TexStudio I would like to create a block diagram in tikz and to center a matrix below the block diagram.  When I use the following, the block diagram snaps to the left and the matrix snaps to the right.  What's wrong here?  Also, how do I control the vertical distance between the diagram and the matrix?
\documentclass[crop,tizk]{standalone}

\usepackage{tikz,pgfplots}
\usetikzlibrary{matrix}

\begin{document}

\begin{tikzpicture}[node distance=3cm]
    \node [draw, shape=rectangle] (stage1) {Stage 1};
    \node [draw, shape=rectangle] (stage2) [right of= stage1]  {Stage 2};
    \draw (stage1) -- (stage2);
    \node[align = center, anchor=south, matrix of nodes, column sep=1cm, row sep=1cm] at (current page.south)
    {
                $y=x$ & &   \begin{tabular}{c}
                                         11\\
                                         12
                                     \end{tabular}  \\
    };
\end{tikzpicture}

\end{document}

OK.  I discovered that this is an issue with the TexStudio pdf previwer which gives:

When I open the pdf directly, I get what I wanted:

Why does the TexStudio pdf previewer give different rendering than the actual pdf file?


text:
Q: Rails/SQL - How to search for partial match and get results? This is the code for the location search field of a real estate search site:
   scope :location, lambda{|l|  where("city LIKE ? OR zip_code LIKE ? OR address LIKE ?", l, l, l)}

But I have to put the complete city name or zip code or address to get results, how do I fix it so that I can search for just 2 or 3 letters or numbers and get results that contain those letters or numbers? I tried wrapping the l like this: '%l%' but no luck.

A: Try this:
scope :location, lambda{|l|  where("city LIKE :l OR zip_code LIKE :l OR address LIKE :l", l: "%#{l}%")}


text:
Q: vector script in python 3 I'm writing a code to calculate some vector-operations my scalarproduct script doesn't work:
Traceback (most recent call last):
  File "C:\Dokumente und Einstellungen\A-PC\Desktop\Kopie von vektorrechnung.py", line 28, in <module>
    D = D + my_list1[i] * my_list2[i] #this part prints an Error-Code
TypeError: can only concatenate list (not "int") to list

The first block makes no problems, I think the problem is the json call. I don't understand, why the first block works an the second one fails. Is mupliplication not defined on lists created by json ?
here is my code:
import json

str_list1 = input("Geben Sie den 1. Vektor in der Form [x, y, z] ein: ") #enter 3 coordinates
my_list1 = json.loads(str_list1) #build vector as list in R3
print(my_list1)

str_list2 = input("Geben Sie den 2. Vektor in der Form [x, y, z] ein: ")# ""
my_list2 = json.loads(str_list2) #""
print(my_list2)

print("Welche Berechnung möchten Sie ausführen ?") #choose case
print ("[v]ektoraddition") #vector addition
print ("[s]kalarprodukt") #scalarproduct
Fall = input() # input first char

if Fall == "v": #when input = "v"
    C=[]

    for i in range(3):
         C+=[my_list1[i] + my_list2[i]]
print("Das Ergebnis lautet: ")
print(C) #this part works

elif Fall == "s": #when input = "s"
D=[]

    for i in range(3):
        D = D + my_list1[i] * my_list2[i] #this part prints an Error-Code

print("Das Skalarprodukt beträgt: ")
print(D)
else:
    print("Ungültiger Eingabewert")

A: The problem in your code is, as the error says, you are trying to concatenate a list with an int. Only a list can be concatenated with another list. If you want to add elements, then you would need to use .append(..) function
for i in range(3):
    D.append(my_list1[i] * my_list2[i])

print(D)

From your code, I can make out that you are trying to do a dot product between two lists. In that case you can do sum(D) as above, or as @Steve says in the comment, do something like below:
D = 0
for i in range(3):
    D += my_list1[i] * my_list2[i]

print D


text:
Q: An unhandled exception of type system.net.webException occured in microsoft.sharepoint.client.dll click here to see the photo
I am using visual studio 2015......I need to connect to sharepoint through visual stuido.
I added microsoft sharepoint online csom reference in vs 2015
but i unable to execute the code due to error.....

A: If you are using SharePoint Online, please use SharePointOnlineCredentials class to set credentials to ClientContext object, here is a code snippet for your reference:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Microsoft.SharePoint.Client;

namespace CSOMWinApp
{
    public partial class Form1 : System.Windows.Forms.Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            string password = "xxxxxx";
            string account = "user@Tenant.onmicrosoft.com";
            var secret = new System.Security.SecureString();
            foreach (char c in password)
            {
                secret.AppendChar(c);
            }

            var credentials = new SharePointOnlineCredentials(account, secret);
            using (ClientContext ctx = new ClientContext("https://zheguo.sharepoint.com/sites/dev"))
            {

                ctx.Credentials = new SharePointOnlineCredentials(account, secret);
                Web web = ctx.Web;
                ctx.Load(web);
                ctx.ExecuteQuery();
            }
        }
    }
}

Reference:
SharePoint Online console application with csom


text:
Q: Sticky footer in master page After days of searching for some code that makes the footer stick to the end of the page, I finally found something that works.
But now I realized, It only sticks to the end of the page if you have that specific resolution.
What if someone has a bigger screen or is looking at the page in full view, then it doesn't work anymore.
Please some help?
And also, I know about the oh-so-famous sticky-footer sites. Can't seem to find an answer here
I need specific help with my code.
Thanks!
MASTERPAGE:
<form id="form1" runat="server">

            <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">

            </asp:ContentPlaceHolder>

        <asp:ContentPlaceHolder ID="FooterPlaceHolder" runat="server">
        </asp:ContentPlaceHolder>

</form>

CONTENTPAGE aspx
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

Knowledge Base

</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="FooterPlaceHolder" Runat="Server">

        © "companyName"

</asp:Content>

CSS:
html {
    height: 100%;*/
}
body
{
    height: 100%;
    margin: 0px;
}
.page
{
    width: 1200px;
    margin: auto;
    height: 100%;
}
.main
{
    text-align: left;
    padding: 5px 15px;
    margin-top: 10px;
}
.footer
{
    text-align: center;
}
.wrapper
{
    min-height: 100%;
    height: auto !important;
    height: 100%;
    margin: 0px auto -449px;
}
.push
{
    clear: both;
    height: 449px;
}

A: Why not take the standard approach:

© <%: DateTime.Now.Year %> - Sometext

Css:
footer {
    display: block;
    position: absolute;
    bottom: 10px;
}

Edit: JSFiddle. Excactly the same code. The footer is always at the bottom, no matter which way you resize the browser window.

A: Personally, I solved this issue using the following piece of code. Place it inside the head elements of the master page:

After that insert any custom footer inside the following div which does the trick.

It also adjusts the footer very well to pages with much content. I found this solution  here.


text:
Q: Plot two regression equations (or more) on the same graph ggplot I need to display on the same graph two linear regression equations and the coefficients (r, r², p, N). I did this using the facet_grid, but now the two curves can not be displayed separately.
I modified the code that was like facet_grid function:
  equation = function(file) {
  mod = lm(y ~ x,data=file)
  mod_sum = summary(mod)
  formula = sprintf("y= %.3f %+.3f*x", coef(mod)[1], coef(mod)[2])
  r = mod_sum$r.squared
  r2 = sprintf("r2= %.3f", r)
  x  = cor.test(~x + y,data=file)
  r0 = sprintf("r= %.3f", x[4])
  p1 = pf(mod_sum$fstatistic[1],mod_sum$fstatistic[2],mod_sum$fstatistic[3],lower.tail=F)
 p =sprintf("p = %.3f", p1)
n0 = length(mod_sum$residual)
n1 = sprintf("N = %.f", n0)
data.frame(formula=formula, r=r0,r2=r2, p=p,n=n1, stringsAsFactors=FALSE)
}

equation_end = ddply(file, c("outlier"), equation)

The data of the two regressions are in the same column and are separated by the factor "outlier"
How can I display these equations on the same graph?

A: You can use annotate to place text on your figure
library(ggplot2)
ggplot(file, aes(x, y, color=outlier)) +
  geom_point() +
  annotate("text", c(-1,-1), c(3,4), label=equation_end$formula)

If you want the text the same color as some lines, try using geom_text,
ggplot(file, aes(x, y, color=outlier)) +
  geom_point() +
  geom_smooth(fill=NA) +
  geom_text(data=equation_end, aes(x=c(-1,-1), y=c(3,4), label=formula), show_guide=F)

Data:
library(plyr)
x <- rnorm(100)
file <- data.frame(x=x, y=2*x + rnorm(100), outlier=factor(sample(0:1, 100, rep=T)))
equation_end = ddply(file, c("outlier"), equation)


text:
Q: NDK Toolchain documentation faulty for 'Autoconf' projects (for example libxml2) Using Google NDK toolchain with NDK21 for 'autoconf' projects says this:
# Check out the source.
git clone https://github.com/glennrp/libpng -b v1.6.37
cd libpng
# Only choose one of these, depending on your build machine...
export TOOLCHAIN=$NDK/toolchains/llvm/prebuilt/darwin-x86_64
export TOOLCHAIN=$NDK/toolchains/llvm/prebuilt/linux-x86_64
# Only choose one of these, depending on your device...
export TARGET=aarch64-linux-android
export TARGET=armv7a-linux-androideabi
export TARGET=i686-linux-android
export TARGET=x86_64-linux-android
# Set this to your minSdkVersion.
export API=21
# Configure and build.
export AR=$TOOLCHAIN/bin/llvm-ar
export CC=$TOOLCHAIN/bin/$TARGET$API-clang
export AS=$CC
export CXX=$TOOLCHAIN/bin/$TARGET$API-clang++
export LD=$TOOLCHAIN/bin/ld
export RANLIB=$TOOLCHAIN/bin/llvm-ranlib
export STRIP=$TOOLCHAIN/bin/llvm-strip
./configure --host $TARGET
make

It seems that this example cannot be used for other 'autoconf' projects like 'libxml2'. Using the lines above will break build process when trying to create a shared library.
'libtool' does not create a 'so' file in this case but only creates a 'la' file.
The reason for that is that the line

export LD=$TOOLCHAIN/bin/ld

is pointed to a non existing file. Because of that libtool does not invoke the linking process. If I change the line to

export LD=$TOOLCHAIN/bin/ld.lld

or do not export 'LD' at all it is working fine.
See the same problem here https://github.com/libexpat/libexpat/issues/312
Question
Is the Google NDK documentation really wrong here or do I miss something?

A: The docs also say

The tools selected in this sample are correct for NDK r22 and newer. Older NDKs may require different tools.

You're using r21.
I just followed the instructions using r24 and the only issue I ran into was https://github.com/glennrp/libpng/issues/347, which is a libpng issue, not an Android issue. Replacing that #ifdef __clang__ with #if defined(__clang__) && defined(__APPLE__) makes the project compile just fine.


text:
Q: How to fix game loop running at different framerate than VSync? For example, I have 60 fps for game logic but 50 fps for VSync. Should I move game loop into a different thread and send drawing requests for drawing thread or I can still fix this with one thread?

A: Does your game logic take 1s/60 to compute or is this just the simulation interval you use? In case of it being an interval I suggest you adjust the simulation intervals by the time it took to display a frame each, i.e. you measure the time between frames and feed your simulation with that.

A: You should rather use a timer than hard-coded timing. (Rather use the difference between the previous update and current update than 1/60 seconds.) That avoid situations where computations that can not keep up at 60fps. Then VSync won't be an issue also.
Correct me if I am wrong, but you can render at any fps and the screen draw at any other fps without any issues (except maybe a little bit of jitter)
With multi-core CPUs, I recommend rather use thread where practical. For example physics in one thread, and render in another (Render with snap-shot data to prevent side-effects).

A: Take a look at this article by Glenn Fiedler, "Fix your timestep":
http://gafferongames.com/game-physics/fix-your-timestep/


text:
Q: Find the equation of the tangent line to $x^2-xy+y-3=0$ when $x=-1$ Find the equation of the tangent line to:    $x^2-xy+y-3=0$   at the point   $x=-1$
I've tried to use implicit differentiation to do this, but in the answer I got, if I substitute $x=-1$ into the equation it will be undefined. I'm not sure I've done it right. Any help will be much appreciated.

A: Without resorting to implicit differentiation, $$ x^2 - xy + y - 3 = 0 $$ could be rearranged as $$ y = \frac{3-x^2}{1-x}$$ (for $x \neq 1)$  , the derivative of which equals $$ \frac{x^2 - 2x +3}{(1-x)^2} $$
The derivative evaluated at $x=-1$ equals $\frac{3}{2} $.
Also, one verifies that for $x=-1$, $y=1$.
So the equation for the tangent line equals $$ y - 1 = \frac{3}{2} (x+1) $$

A: When $x = -1$, we have
$$ (-1)^2 - (-1)y + y - 3 = 1 + y + y - 3 = -2 + 2y = 0
\implies y = 1.
$$
Thus we are seeking $\frac{\mathrm{d}y}{\mathrm{d}x}$ when $(x,y) = (-1,1)$.  Via implicit differentiation, we obtain
\begin{align}
x^2 - xy + y - 3 = 0 &\implies 2x - \left( x\frac{\mathrm{d}y}{\mathrm{d}x} + y\right) + \frac{\mathrm{d}y}{\mathrm{d}x} = 0 \\
&\implies 2x - x\frac{\mathrm{d}x}{\mathrm{d}y} - y + \frac{\mathrm{d}x}{\mathrm{d}y} = 0 \\
&\implies (1-x)\frac{\mathrm{d}x}{\mathrm{d}y} = y-2x \\
&\implies \frac{\mathrm{d}x}{\mathrm{d}y} = \frac{y-2x}{1-x}.\tag{$\ast$}
\end{align}
Substituting the point $(x,y) = (-1,1)$ into ($\ast$), we conclude that
$$ \frac{\mathrm{d}y}{\mathrm{d}x} = \frac{1-2(-1)}{1-(-1)} = \frac{1+2}{1+1} = \frac{3}{2}. $$
This gives the slope of the tangent line.  To obtain the equation for the tangent line, remember that a line with slope $m$ passing through a point $(x_0,y_0)$ has equation
$$ y-y_0 = m(x-x_0).$$
Therefore an equation for the line tangent to the given curve through the point $(-1,1)$ is given by
$$y - 1 = \frac{3}{2} (x+1). $$

A: This is purely algebraic:
As  the point with abscissa $-1$ is $(-1,1=$, set $X=x+1$, $Y=y-1$ (i.e. change origin) and rewrite the equation with $X$ and $Y$. You obtain
$$X^2-XY-3X+2Y=0.$$
The equation at tangent at origin is the linear part of this equation:
$$-3X+2Y=0\iff 3x-2y+5=0.$$


text:
Q: VBA - Subtracting varying amount of dates I am having trouble figuring out how to subtract the very end date of a contract with the beginning date. However, I cannot figure out how to reference the initial date..
For example, =D2 - C2 as well as be able to do =D10 - C5.  This is what I currently have, and it does not work at all.
Dim sla As Long, slacnt As Long, drng As Long, i As Long
i = 2

With Worksheets("Raw")
    slacnt = .Cells(.rows.Count, 2).End(xlUp).Row
    For sla = i To slacnt
        drng = Sheets("Data").Range("B" & i).Value
        If .Range("B" & i) <> .Range("B" & i).Offset(1, 0) Then
        Else: drng = .Range("D" & i).Value - .Range("C" & i).Value
        End If
    Next sla
End With

Any direction would be greatly appreciated, thanks in advance.

A: This would be a perfect problem to be resolved with a dictionary, but somehow I am too lazy to do it this way.
However, let's imagine that all the dates are actually numbers (and in Excel they are!) then your input can be translated to something like this:

What is wanted now is to get the smallest value for each value in column A in column D and the biggest in column E. I have achieved the following:

This is how the code looks like:
Option Explicit

Sub TestMe()

    Dim lngLastRow          As Long
    Dim rngCell             As Range
    Dim rngRange            As Range
    Dim lngMin              As Long
    Dim lngMax              As Long
    Dim lngPreviousRow      As Long
    Dim ws                  As Worksheet

    lngLastRow = lastRow(column_to_check:=2)

    Set ws = ActiveSheet
    Set rngRange = ws.Range(ws.Cells(1, 1), ws.Cells(lngLastRow, 1))

    For Each rngCell In rngRange

        If Len(rngCell) > 0 Then
            If lngPreviousRow > 0 And (rngCell.Row - 1 <> lngPreviousRow) Then
                ws.Cells(lngPreviousRow, 4) = lngMin
                ws.Cells(lngPreviousRow, 5) = lngMax
            End If

            If (rngCell.Row = 1) Or lngPreviousRow = (rngCell.Row - 1) Then
                ws.Cells(rngCell.Row, 4) = WorksheetFunction.Min(rngCell.Offset(0, 1), rngCell.Offset(0, 2))
                ws.Cells(rngCell.Row, 5) = WorksheetFunction.Max(rngCell.Offset(0, 1), rngCell.Offset(0, 2))
            End If

            lngPreviousRow = rngCell.Row
            lngMin = WorksheetFunction.Min(rngCell.Offset(0, 1), rngCell.Offset(0, 2))
            lngMax = WorksheetFunction.Max(rngCell.Offset(0, 1), rngCell.Offset(0, 2))

        Else
            lngMin = WorksheetFunction.Min(lngMin, rngCell.Offset(0, 1), rngCell.Offset(0, 2))
            lngMax = WorksheetFunction.Max(lngMax, rngCell.Offset(0, 1), rngCell.Offset(0, 2))
        End If
    Next rngCell

    Cells(lngPreviousRow, 4) = lngMin
    Cells(lngPreviousRow, 5) = lngMax

End Sub

Function lastRow(Optional strSheet As String, Optional column_to_check As Long = 1) As Long

    Dim shSheet As Worksheet

    If strSheet = vbNullString Then
        Set shSheet = ActiveSheet
    Else
        Set shSheet = Worksheets(strSheet)
    End If

    lastRow = shSheet.Cells(shSheet.Rows.Count, column_to_check).End(xlUp).Row

End Function

Points for improvement:

*

*WorksheetFunction.Min and WorksheetFunction.Max are repeating 3 times, it would be a good idea to build a separate function for them.

*simply use a dictionary, it will give a clearer solution. The dictionary should hold an array with two positions, one for the min and one for the max. But it is not as fun as the one above.

A: Vityata has beaten me to it, but I started this so might as well post it.
Sub x()

Dim r As Range, r1 As Range, a, b

With Worksheets("Raw")
    Set r1 = .Range("A2", .Range("D" & Rows.Count).End(xlUp))
End With

With r1.Columns(1)
    .SpecialCells(xlCellTypeBlanks).FormulaR1C1 = "=R[-1]C"
    For Each r In .SpecialCells(xlCellTypeConstants)
        a = Evaluate("MIN(IF(" & .Address & "=" & r & ",IF(" & r1.Columns(3).Address & "<>""""," & r1.Columns(3).Address & ")))")
        b = Evaluate("MAX(IF(" & .Address & "=" & r & "," & r1.Columns(4).Address & "))")
        r.Offset(, 4) = b - a
    Next r
    .SpecialCells(xlCellTypeFormulas).ClearContents
End With

End Sub


text:
Q: Is there a pre coding stage forum? SO frowns on algorithm/analysis/design advice questions which are pre coding stage.
Is there a low noise forum available to air these discussions ?

A: Stack Overflow does frown on vaguely stated, airy or too open questions along the lines of "What's the easiest way to <do something genuinely hard>?" or "What data structure should I used to <some imprecise problem specification>?"
Step one is to not write that kind of question.
Give your audience some specifics. How big is the data set? Is this a one-off or production? What means are you considering to solve the problem?


text:
Q: How to zip a Universal Build Package in Azure DevOps? I have a pipeline set up to build a Universal Package. After it finishes, I get a build package (contains folders and required config files as per my solution). I want that to be packaged into a zip file.

Try1:
I have tried to create another inline-PowerShell step that will create a zip file and place it inside the build folder but it doesn't create any. It does create on my local, but not in the pipeline.
Then I have tried another option. I have added the following step to do the job. It creates the zip folder, but I don't see a zip file when I download it.

Note:
Is there a way to set up a publish profile so that it can automatically publish the build content into a zip folder?

A: Universal packages publish task should be the last task in your pipeline. You need to put Archive Files task before Universal packages publish task.
If you want to download the zip files on your local machine. You can aslo use publish build artifacts task to publish the zip files as build artifacts. Then you can download the artifacts in the build summary UI page.


text:
Q: Query Results as Views on Local Host I have Read Only access to Oracle Server. Sometimes, I write very lengthy Queries. Is there a way that I can save these Queries on Local Host as Views.
Example:
Remote Server : ABC  (I have read only Access)
Local Host: Localhost ( I am the Admin)
I built a query select * from employee; on Remote Server, and I want to save this query on my Localhost as View.
Is it possible? If yes, please advise, how do i achieve this.
Btw, I am using SQL Navigator to pull the data from the Server.


text:
Q: python : cannot import tensorflow-gpu I successfully created my tensorflow environment with Anaconda3 on my machine with the steps introduced on this link. But when I try to try to do :
>>> import tensorflow as tf

I get the following error messages : OSError and ImportError.
Traceback (most recent call last):
  File "C:\Users\Froilan\Anaconda3\envs\tensorflow\lib\site-
packages\tensorflow\python\platform\self_check.py", line 75, in preload_check
ctypes.WinDLL(build_info.cudart_dll_name)
  File "C:\Users\Froilan\Anaconda3\envs\tensorflow\lib\ctypes\__init__.py", line 351, in __init__
self._handle = _dlopen(self._name, mode)
OSError: [WinError 126] This specified module could not be found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\Froilan\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
from tensorflow.python import *
  File "C:\Users\Froilan\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
  File "C:\Users\Froilan\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 30, in <module>
self_check.preload_check()
  File "C:\Users\Froilan\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\platform\self_check.py", line 82, in preload_check
% (build_info.cudart_dll_name, build_info.cuda_version_number))
ImportError: Could not find 'cudart64_80.dll'. TensorFlow requires that this DLL be installed in a directory that is named in your %PATH% environment variable. Download and install CUDA 8.0 from this URL: https://developer.nvidia.com/cuda-toolkit

Could it be something to do with my cpu? I use Ryzen 1700.
+ GPU : GTX 1050 Ti  - A bit inferior to 1080 ti or so.. but I've heard that GPU's would still be way better than CPU's.

A: you need to install CUDA library first, I would recommend to follow this link:
https://gist.github.com/mjdietzx/0ff77af5ae60622ce6ed8c4d9b419f45
UPDATE:
for the Windows OS, please follow this approach:
http://blog.nitishmutha.com/tensorflow/2017/01/22/TensorFlow-with-gpu-for-windows.html


text:
Q: OpenOffice.org installation image does not mount The newest OpenOffice.org v3.1.1 does not want to mount on my Mac. It just says it couldn't.
I have 10.5.4.
How can I solve this?

A: If it's the US English version for Intel, then compare the output of the following with the results for your DMG. If it doesn't match then you need to download again.
md5 ~/Downloads/OOo_3.1.1_MacOSXIntel_install_en-US.dmg

  MD5([..]) = d20e8ad6f0d8e93860f1ea2cd2371c86

A link to checksums for other downloads can be found at the download page.

A: Try using PowerISO. Scroll down to "Other Downloads" and download PowerISO for OSX.

A: If you still can't mount the dmg, rebuild Launch Services by trashing the following two files in the Macintosh HD > Library > Caches folder: com.apple.LaunchServices-0140.csstore and com.apple.LaunchServices-014nnn.csstore  The "nnn" in the second file name is going to be your User ID number, but that probably doesn't matter.
Restart and OS X will rebuild Launch Services.


text:
Q: I want to add more than one argument in callbacks. How can i solve this error? I get this error

" AttributeError: 'list' object has no attribute 'set_model' "

when I add learning schedule callback callbacks_list in model.fit_generator
<callbacks=[callback,callbacks_list]>

How can i solve this error??
lrate = LearningRateScheduler(step_decay)
callbacks_list = [lrate]
history=model.fit_generator(generate_arrays_for_training(indexPat, filesPath, end=75), #end=75),
                                validation_data=generate_arrays_for_training(indexPat, filesPath, start=75),#start=75),
                                steps_per_epoch=int((len(filesPath)-int(len(filesPath)/100*25))),#*25),
                                validation_steps=int((len(filesPath)-int(len(filesPath)/100*75))),#*75),
                                verbose=2,
                                epochs=300, max_queue_size=2, shuffle=True, callbacks=[callback,callbacks_list])

A: You are putting one of your callbacks in an unnecessary list, which produces the error. Just do this:
callbacks=[callback, lrate]


text:
Q: I need help to Convert a SQL Statement to C# LINQ I need help with Converting this Select statement in LINQ C# Code
SELECT TagName
from Tags
Where TagId IN(
    SELECT TagId
    from PresentationTags
    Where PresentationId = 2
)

A: Where() with nested Any() should do the job
context.Tags.Where(
    x => context.PresentationTags.Any(
        y => y.PresentationId == 2 && x.TagId == y.TagId
    )
).Select(x => x.TagName);


text:
Q: searching on an array when search string contains wild card characters in typescript/javascript? I am having an array of phone numbers . I have also a search string. The search string is provided by the user. The search string can contain wild cards such as asterik(*) or question mark (?). I need a way to filter out elements from my phone number array .
 The following is my phone number array.
    let mobileNumbersArray = ["830456481", "831456481", "9886503103" ]

    **Condition 1**
    when search string is *
    let searchString = "*"
    expected result = ["830456481", "831456481", "9886503103"]

    **Condition 2**
    when search string is 83*
    let searchString = "83*"
    expected result = ["830456481", "831456481"]

    **condition 3**
    let searchString = "*456*"
    expected result = ["830456481", "831456481"]

    **condition 4**
    exact search
    let searchString = "9886503103"
    expected result = ["9886503103"]

    **condition 5**
    exact search
    let searchString = "83?4"
    expected result = ["830456481", "831456481"]

how can i achieve searching a string on my phone number array and getting the result as an array in the cleanest way as possible.
appreciate any help
thank you .

A: I think I may have an interesting solution. Please take a look at the following snippet and let me know if it works for you.
You can read about Regular Expressions on MDN.
Then about the RegExp Constructor. Here is the key. Not everyone know that you can generate Regular Expressions dynamically.
Update:
The idea is to traduce the 'wildcard' syntax into a RegExp syntax, like this:

*

*? means: 'any single number', in RegExp: [0-9] or \d

** means: 'one or more numbers', in RegExp: .+ (actually this means one or more 'anything')
This is why I do the double replacement at the beginning before feeding the query to the RegExp constructor.
Finally, yes, this can be extended to work with non number characters. It is sufficient to replace [0-9] with .

function queryNumbers(array, query) {
  const src = query.replace(/\?/g, '[0-9]').replace(/\*/g, '.+');
  const regexp = new RegExp('^' + src + '$');
  return array.filter((item) => regexp.test(item));
}

const mobileNumbersArray = ['830456481', '831456481', '9886503103'];

console.log(queryNumbers(mobileNumbersArray, '*'));
console.log(queryNumbers(mobileNumbersArray, '83*'));
console.log(queryNumbers(mobileNumbersArray, '*456*'));
console.log(queryNumbers(mobileNumbersArray, '9886503103'));
console.log(queryNumbers(mobileNumbersArray, '83?4*'));
console.log(queryNumbers(mobileNumbersArray, '8*'));

A: The easiest way I can imagine is using regular expressions. You can learn more about it here.


text:
Q: Linear independence of $x, x^3, |x^3|$ How do I make sure whether $x, x^3, |x^3|$ are linearly independent? I know I have to show that $$kx+lx^3+m|x^3|=0\quad\forall x\in\mathbb{R}\quad \Rightarrow k=l=m=0,$$ but I'm not sure how to do this. Should I plug in different values for $x$?

A: Idea: if they were dependent, $|x|^3$ was a polynomial as a linear combination of $x$ and $x^3$. This is of course impossible.

A: Yes, the idea is good! For $x=1$ you get
$$
k+l+m=0
$$
For $x=-1$ you get
$$
-k-l+m=0
$$
Can you finish?


text:
Q: Flex + DataGrid + Dynamic Display on Selection Back again with another Flex question.
I have an XML structure like...
<Student>
  <Name>X</Name>
  <Age>14</Age>
</Student>

<Student>
  <Name>Y</Name>
  <Age>16</Age>
  <Address>
    <HNumber>1</HNumber>
    <HName>Something</HName>
    <HPin>33607</HPin>
  </Address>
</Student>

Now I got his displaying on my grid by saying dataProvider=XMLListCollection...
What I want to do is on selection of a row, check if it has "Address" tag, if it has display the other grid, else hide the grid.
Any help!!

A: if(myDataGrid.selectedItem.hasownproperty("Address")){
  display other grid
}else{
  hide other grid
}

A: To bind / link two grids You write something like below:
<mx:DataGrid id="grid1" width="100%" dataProvider="{data1}" >
    <mx:columns>
  <mx:DataGridColumn headerText="Name" dataField="@Name"/>
  </mx:columns>
</mx:DataGrid>

<mx:DataGrid id="grid2" width="100%" >
    <mx:columns>
  <mx:DataGridColumn headerText="Name" dataField="@HNumber"/>
  </mx:columns>
</mx:DataGrid>
  <mx:Binding source="grid1.selectedItem.Address" destination="grid2.dataProvider"/>
</mx:Application>

hope this helps.
xxx


text:
Q: Object reference not set to an instance of an object when using wsdl tool I'm trying to get class from this wsdl
http://e-pelmex.com.br/services/soap?wsdl
But i get this error
nati pelmex # wsdl  http://e-pelmex.com.br/services/soap?wsdl
    Web Services Description Language Utility
    Mono Framework v4.0.30319.17020
    Error: Object reference not set to an instance of an object
    Stack:
       at System.Xml.Serialization.XmlSerializationReader.OnUnknownNode (System.Xml.XmlNode node, System.Object o, System.String qnames) [0x00000] in <filename unknown>:0
      at System.Xml.Serialization.XmlSerializationReader.UnknownNode (System.Object o, System.String qnames) [0x00000] in <filename unknown>:0
      at System.Xml.Serialization.XmlSerializationReader.UnknownNode (System.Object o) [0x00000] in <filename unknown>:0
      at System.Web.Services.Description.ServiceDescriptionReaderBase.ReadObject_ServiceDescription (Boolean isNullable, Boolean checkType) [0x00000] in <filename unknown>:0
      at System.Web.Services.Description.ServiceDescriptionReaderBase.ReadRoot_ServiceDescription () [0x00000] in <filename unknown>:0
      at System.Web.Services.Description.ServiceDescription+ServiceDescriptionSerializer.Deserialize (System.Xml.Serialization.XmlSerializationReader reader) [0x00000] in <filename unknown>:0
      at System.Xml.Serialization.XmlSerializer.Deserialize (System.Xml.XmlReader xmlReader) [0x00000] in <filename unknown>:0
      at System.Web.Services.Description.ServiceDescription.Read (System.Xml.XmlReader reader) [0x00000] in <filename unknown>:0
      at System.Web.Services.Discovery.DiscoveryClientProtocol.DiscoverAny (System.String url) [0x00000] in <filename unknown>:0
      at (wrapper remoting-invoke-with-check) System.Web.Services.Discovery.DiscoveryClientProtocol:DiscoverAny (string)
      at Mono.WebServices.Driver.Run (System.String[] args) [0x00000] in <filename unknown>:0
    nati pelmex #

Any idea?


text:
Q: get genre_id and audio_id from audio_genres_map from mediastore I want to retrieve whole audio_genres_map table from mediastore in one query. I have all the audio info and genre info but the missing piece is the mapping. I am able to do it in multiple queries. I want to achieve it one query

A: managed to solve this using following query
String[] genresProjection = {
            Audio.Genres.Members.AUDIO_ID,
            Audio.Genres.Members.GENRE_ID
    };
context.getContentResolver().query(Uri.parse("content://media/external/audio/genres/all/members"), genresProjection, null, null, null);

A: Or to retrieve all genres using MediaStore.Audio
    public Cursor getGenrecursor(Context context) {
    ContentResolver cr = context.getContentResolver();
    Uri uri = MediaStore.Audio.Genres.getContentUri("external");
    String genre = MediaStore.Audio.Genres.NAME;
    final String[] columns = { "_id", genre };
    return  cr.query(uri, columns, null, null, null);
}

A: and to expand your question, using the genre_id to bring back further details
        public Cursor getgenre_TrackCursor(Context context, long genreID) {
    final String track_id = MediaStore.Audio.Genres.Members._ID;
    final String track_no = MediaStore.Audio.Genres.Members.TRACK;
    final String track_name = MediaStore.Audio.Genres.Members.TITLE;
    final String artist = MediaStore.Audio.Genres.Members.ARTIST;
    final String duration = MediaStore.Audio.Genres.Members.DURATION;
    final String album = MediaStore.Audio.Genres.Members.ALBUM;
    final String composer = MediaStore.Audio.Genres.Members.COMPOSER;
    final String year = MediaStore.Audio.Genres.Members.YEAR;
    final String path = MediaStore.Audio.Genres.Members.DATA;
    final ContentResolver resolve = context.getContentResolver();
    Uri uri = MediaStore.Audio.Genres.Members.getContentUri("external",
            genreID);
    final String[] columns = { track_id, track_no, artist, track_name,
            album, duration, year };
    return resolve.query(uri, columns, null, null, null);
}


text:
Q: How to add a link in console.table When I do
console.log('http://example.com');

what is logged in the console is a clickable link. But when I use console.table() no matter what I do it is shown as a string. I even tried to set HtmlElement for the value but still, it is being converted to a string. but when a column value is a number, it is being displayed as a number, so obviously it doesn't just convert everything to string.
Is there a possible way to add a link?