text:
Q: get list of site-collections,subsites,List in a particular web application using Powershell in csv or excel I have used the below
Get-SPWebApplication http://site | Get-SPSite -Limit All | Get-SPWeb -Limit All | Select Title, URL, ID, ParentWebID,AssociatedMemberGroup,AssociatedOwnerGroup | Export-CSV C:\InfoArch.csv -NoTypeInformation

to list out title,url etc..of a site collection and subsite.
But how can i get the list of users in the AssociatedMemberGroup,AssociatedOwnerGroup, I can get the group but i want the user listed in my excelsheet e.g James Bond, Hulk Hogan etc..
I guess can i loop through the property collection to retrieve ths values in my powerssell above?
Also is it also possible to identify if there list with infopath forms in a site?
Thanks in Advance

A: Try the below script
 $userarray = @()
  $fth = "C:\User.csv"

  $wp = Get-SPWebApplication
  foreach($sw in $wp){
   foreach($sst in $wp.sites)
   {

    foreach($sweb in $sst.AllWebs)
    {
        $op = New-Object PSObject

        [string]$amgu =$sweb.AssociatedMemberGroup.Users.DisplayName
        [string]$aogu = $sweb.AssociatedOwnerGroup.Users.DisplayName
        $op | Add-Member NoteProperty -name "Title" -Value $sweb.Title
        $op | Add-Member NoteProperty -name "URL" -Value $sweb.Url
        $op | Add-Member NoteProperty -name "ID" -Value $sweb.ID
        $op | Add-Member NoteProperty -name "ParentWeb" -Value $sweb.ParentWeb
        $op | Add-Member NoteProperty -name "ParentWebId" -Value $sweb.ParentWebID
        $op | Add-Member NoteProperty -name "AssociatedMemberGroup" -Value $amgu
        $op | Add-Member NoteProperty -name "AssociatedOwnerGroup" -Value $aogu
        $userarray += $op

    }
   }
  }
  $userarray |  Export-Csv $fth -NoTypeInformation

This will give you Title, URL, ID, Parent web and Users in both groups. each web in a single row....AssociatedOwner Group column contains all users in single cell.

A: Here's a quick solution, but the group members will all be in one column.
Get-SPWebApplication http://site | Get-SPSite -Limit All | Get-SPWeb -Limit All | Select Title, URL, ID, ParentWebID,AssociatedMemberGroup, {$_.AssociatedMemberGroup.Users}, AssociatedOwnerGroup, {$_.AssociatedOwnerGroup.Users} | ConvertTo-Csv

Here's a sample result:
"Sales Team Site","http://site","00000000-661b-489f-af9a-6c8490dafb7c","00000000-0000-0000-0000-000000000000","Sales Team Site Members","i:0#.w|spdemo\richardm i:0#.w|spdemo\samc c:0+.w|s-1-5-21-492373370-1002446965-3707187856-1124 i:0#.w|spdemo\stellas i:0#.w|spdemo\susanj","Sales Team Site Owners","i:0#.w|spdemo\administrator"

A: Since you are using PnP, there is a PowerShell command to get group members.
Get-PnPGroupMembers -Identity <GroupPipeBind>
As you indicated that, you are able to get the group name, you can use that to get the group object and pass it to the above command to get all the members.
Store them in an array and output it to a csv in the end.

A: Updated... better answer here:
http://www.sharepointdiary.com/2016/01/find-all-infopath-list-forms-in-sharepoint-using-powershell.html
And here is a shorter version:
Get-SPWebApplication http://site |
Get-SPSite -Limit All |
Get-SPWeb -Limit All |
Select -ExpandProperty Lists |
Where { $_.ContentTypes[0].ResourceFolder.Properties["_ipfs_infopathenabled"]  } |
Select Title, {$_.ParentWeb.Url}


text:
Q: Protobuf-net disable seeking I am using protobuf-net in a network client/server application. Each packet of data is zipped with a BZip2Input/Output stream to compress my messages. This has worked fine for several weeks, but I have recently modified the server's objects, and am getting an exception that the BZip2Input stream does not support seeking (which it does not). I imagine this is because protobuf detects it can skip some fields, and tries to do so expediently.
Is there a way to disable this behavior, and force protobuf-net to skip fields by reading the data? (Not seeking).
Update: added the full stack trace below. Based on your comment, the stream must have a bug in it's CanSeek callback. What do you think?
Server First Chance Exception: BZip2InputStream Seek n
ot supported Stack Trace:    at ICSharpCode.SharpZipLib.BZip2.BZip2InputStream.S
eek(Int64 offset, SeekOrigin origin)
Server_NewRequestReceived Exception: System.NotSupportedException: BZip2InputStream Seek not supported
   at ICSharpCode.SharpZipLib.BZip2.BZip2InputStream.Seek(Int64 offset, origin)
   at ProtoBuf.ProtoReader.Seek(Stream source, Int32 count, Byte[] buffer)
   at ProtoBuf.ProtoReader.SkipField()
   at proto_2(Object, ProtoReader)
   at ProtoBuf.Serializers.CompiledSerializer.ProtoBuf.Serializers.IProtoSeriali    zer.Read(Object value, ProtoReader source)
   at ProtoBuf.Meta.RuntimeTypeModel.Deserialize(Int32 key, Object value, source)
   at ProtoBuf.Meta.TypeModel.TryDeserializeAuxiliaryType(ProtoReader reader, format, Int32 tag, Type type, ref Object value, Boolean skipOtherFields, asListItem, Boolean autoCreate, Boolean insideList)
   at ProtoBuf.Meta.TypeModel.TryDeserializeList(TypeModel model, ader, DataFormat format, Int32 tag, Type listType, Type itemType, ref Object value)

   at ProtoBuf.Meta.TypeModel.TryDeserializeAuxiliaryType(ProtoReader reader, format, Int32 tag, Type type, ref Object value, Boolean skipOtherFields, asListItem, Boolean autoCreate, Boolean insideList)
   at ProtoBuf.Meta.TypeModel.DeserializeCore(ProtoReader reader, Type type, value, Boolean noAutoCreate)
   at ProtoBuf.Meta.TypeModel.Deserialize(Stream source, Object value, Type type, SerializationContext context)
   at ProtoBuf.Meta.TypeModel.Deserialize(Stream source, Object value, Type type)
   at ProtoBuf.Serializer.Deserialize(Stream source)

Created this class to get around the SharpZipLib bug.
    public class NonSeekableStreamWrapper : Stream
    {
        public Stream BaseStream { get; private set; }

        public NonSeekableStreamWrapper(Stream baseStream)
        {
            BaseStream = baseStream;
        }

        public override void Flush()
        {
            BaseStream.Flush();
        }

        public override long Seek(long offset, SeekOrigin origin)
        {
            return BaseStream.Seek(offset, origin);
        }

        public override void SetLength(long value)
        {
            BaseStream.SetLength(value);
        }

        public override int Read(byte[] buffer, int offset, int count)
        {
            return BaseStream.Read(buffer, offset, count);
        }

        public override void Write(byte[] buffer, int offset, int count)
        {
            BaseStream.Write(buffer, offset, count);
        }

        public override bool CanRead
        {
            get { return true; }
        }

        public override bool CanSeek
        {
            get { return false; }
        }

        public override bool CanWrite
        {
            get { return false; }
        }

        public override long Length
        {
            get { return BaseStream.Length; }
        }

        public override long Position { get; set; }
    }

A: That is interesting. I would be very interested in a full stacktrace when that happens, because AFAIK it checks the correct APIs for this, for example (from ProtoReader.Seek).
if (source.CanSeek)
{
    source.Seek(count, SeekOrigin.Current);
    // ...
}
else
{
    // ... does it the hard way, even if that means a Read loop
}

So no, it doesn't currently have an option for this because it trusts the streams to tell the truth. Of course, it could simply be a bug on my part, hence the request for a stacktrace.
If this is a genuine "thing", it would probably be possible to add such a mechanism.

Edit: yup, this is a bug in BZip2InputStream.cs in SharpZipLib; it has:
    /// <summary>
    /// Gets a value indicating whether the current stream supports seeking.
    /// </summary>
    public override bool CanSeek {
        get {
            return baseStream.CanSeek;
        }
    }

but it also has:
    /// <summary>
    /// Set the streams position.  This operation is not supported and will throw a NotSupportedException
    /// </summary>
    /// <param name="offset">A byte offset relative to the <paramref name="origin"/> parameter.</param>
    /// <param name="origin">A value of type <see cref="SeekOrigin"/> indicating the reference point used to obtain the new position.</param>
    /// <returns>The new position of the stream.</returns>
    /// <exception cref="NotSupportedException">Any access</exception>
    public override long Seek(long offset, SeekOrigin origin)
    {
        throw new NotSupportedException("BZip2InputStream Seek not supported");
    }

So, it can never seek, but it claims it can if the base stream can.
It should have reported false instead of echoing the base-stream's CanSeek.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to restart a QWizard? I have a QWizard that I have subsclassed, that don't want to finish.  When the user clicks the finish button I want to just go back to the beginning.  I first tried just overriding the nextId() method, but that will not allow me to go backwards.  Any other ideas?  This is with Qt 4.6

A: There's restart() for example, which could be called from done(). Note that this resets your fields, though.


text:
Q: Inclusion/Exclusion, finding $x,y,z$ and $a,b,c$ In a competition with 80 participants, a school awarded medals in different categories. 36 medals in dance (D), 12 medals in dramatics (R) and 18 medals in music (M). If these medals went to a total of 45 persons and only 4 persons got medals in all the three categories, find the number of persons who received medals in only one of the categories.
From the problem we have
$nD=36,nR=12,nM=18, n(D\cup{R}\cup{M})=45,n(D\cap{R}\cap{M})=4$
and let $D\cap{M}=y+4, D\cap{R}=x+4,R\cap{M}=z+4$
and by inclusion/exclusion,i.e.
$n(D\cup{R}\cup{M})=nD+nR+nM-n(D\cap{M})-n(D\cap{R})-n(R\cap{M})+n(D\cap{R}\cap{M})$
$45=36+12+18-(y+4)-(x+4)-(z+4)+4$ which simplifies into $13=x+y+z$
Let $a$ be the number of persons who recieves medals in Dance $(D)$ only. Similarly, let $b,c$ be the number of person who receives medals only in Dramatics$(R)$ and Music $(M)$ respectively.
Then,
using $13=x+y+z$
$a=32-(x+y)\sim{a}=z+19$
$b=8-(x+z)\sim{b}=y-5$
$c=14-(y+z)\sim{c}=x+1$
adding the equations we get
$a+b+c=15+(x+y+z)\sim{a+b+c}=15+13=28$
Therefore, the number of persons who received medals in only one of the categories is 28
However, I want to find further the value of $x,y,z$ and $a,b,c$ is it possible given such information?

A: No.
There are multiple solutions to these constraints. For example:
$a=20, b=4, c=4, x=3, y=9, z=1$ works
But  $a=22, b=3, c=3, x=2, y=8, z=3$ also works
And many more ...


text:
Q: Python Serial: How to make a robust querying process. New query receives answer to previous query. Why? I am trying to communicate with a stepper motor drives SMCI33-1. It has a serial port interface with predefined commands. Every command I send is at least acknowledged with some answer.
I wrote a query function that sends a command and waits for the answer.
My problem is, that sometimes the answer to the previous query is received instead of the one for the current query, which breaks the program. I don't know why this happens.
I even implemented a blocking mechanism, so that only ever one command is sent at a time.
    @atomic_section
    def query(self, message):
        """
        Send a message to the controller with newline char and reads response.

        :param message: The message to send, should be in proper syntax
        :returns: The response without newline
        :rtype: String
        """
        msg = message + '\r'
        if self._debug: print(message)
        #with self._serial_port:
        if not self._connection_error:
            self._serial_port.write(msg.encode())
            ans = self._serial_port.read_until(b'\r').decode('utf-8')
            if len(ans) == 0:
                raise TimeoutError('Port Timeout!')
            else:
                if self._debug: print(ans.strip())
                return ans.strip()
        else:
            raise ConnectionError("Connection Failed!")

    def atomic_section(func):
        """ Function wrapper. Any function wrapped by this can only be run one at a time.
        Used to prevent multiple queries from running at once. """
        @functools.wraps(func)
        def wrapper(*args, **kwargs):
            if args[0]._is_querying:
                logging.debug("stage control: atomic section waiting for clear")
            while args[0]._is_querying:
                pass
            args[0]._is_querying = True
            try:
                ret = func(*args, **kwargs)
            except:
                raise
            finally:
                args[0]._is_querying = False
            return ret
        return wrapper

Serial port is set up with 115200 baud, 0.2 seconds timeout.
This only happens if I try to send many queries. Like with my plan to adjust the movement speed according to some function of the current position.
For that, I have a thread to run the following queries with a pause of 0.1 seconds in each loop:
while(True):
    #query motor status, stop loop if target reached
    tmp = self.query('#1$')
    if tmp[-1] != '?':
        tmp = int(tmp.split("$")[-1][-3:],16)
        status = tmp & 0xF
        positioning_error = (status & 0b0100) >> 2
        if positioning_error: break
    #query position
    ans = self.query('#1C')
    ans = ans[2:] # extract position
    new_speed = some_func(ans)
    _ = self.query('#1o' + str(new_speed)) #set new speed
    time.sleep(.1)


text:
Q: JAXB unmarshalling issues when elements have namespaces This code only works if I remove "bpmn:" from all the elements inside the XML file, otherwise it throws the following exception:

javax.xml.bind.UnmarshalException: unexpected Element (URI:"http://www.omg.org/spec/BPMN/20100524/MODEL", local:"definitions"). Expected elements are <{}definitions> .

Im trying to make it work without modifying the XML file. Any help would be greatly appreciated. Thanks in advance :)
<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_13d3a6z" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.1.1">
  <bpmn:process id="Process_1tovjba" isExecutable="true">
    <bpmn:startEvent id="StartEvent_1">
      <bpmn:outgoing>Flow_06i118e</bpmn:outgoing>
    </bpmn:startEvent>
    <bpmn:task id="Activity_1d3friu" name="Task 1">
      <bpmn:incoming>Flow_06i118e</bpmn:incoming>
      <bpmn:outgoing>Flow_0linmbs</bpmn:outgoing>
    </bpmn:task>
    <bpmn:sequenceFlow id="Flow_06i118e" sourceRef="StartEvent_1" targetRef="Activity_1d3friu" />
    <bpmn:task id="Activity_1e17g78" name="Task 2">
      <bpmn:incoming>Flow_0linmbs</bpmn:incoming>
      <bpmn:outgoing>Flow_0yu7ggy</bpmn:outgoing>
    </bpmn:task>
    <bpmn:intermediateThrowEvent id="Event_1tlw9ds">
      <bpmn:incoming>Flow_0yu7ggy</bpmn:incoming>
    </bpmn:intermediateThrowEvent>
    <bpmn:sequenceFlow id="Flow_0yu7ggy" sourceRef="Activity_1e17g78" targetRef="Event_1tlw9ds" />
    <bpmn:sequenceFlow id="Flow_0linmbs" sourceRef="Activity_1d3friu" targetRef="Activity_1e17g78" />
  </bpmn:process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1tovjba">
      <bpmndi:BPMNEdge id="Flow_06i118e_di" bpmnElement="Flow_06i118e">
        <di:waypoint x="215" y="117" />
        <di:waypoint x="360" y="117" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_0yu7ggy_di" bpmnElement="Flow_0yu7ggy">
        <di:waypoint x="840" y="117" />
        <di:waypoint x="931" y="117" />
        <di:waypoint x="931" y="190" />
        <di:waypoint x="1022" y="190" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_0linmbs_di" bpmnElement="Flow_0linmbs">
        <di:waypoint x="460" y="117" />
        <di:waypoint x="600" y="117" />
        <di:waypoint x="600" y="90" />
        <di:waypoint x="740" y="90" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
        <dc:Bounds x="179" y="99" width="36" height="36" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Activity_1d3friu_di" bpmnElement="Activity_1d3friu">
        <dc:Bounds x="360" y="77" width="100" height="80" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Activity_1e17g78_di" bpmnElement="Activity_1e17g78">
        <dc:Bounds x="740" y="77" width="100" height="80" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Event_1tlw9ds_di" bpmnElement="Event_1tlw9ds">
        <dc:Bounds x="1022" y="172" width="36" height="36" />
      </bpmndi:BPMNShape>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</bpmn:definitions>

@XmlRootElement
public class Definitions {

 private String id;
 private Process process;

    public Definitions(){};
    public Definitions(String id, Process process){
        this.id = id;
        this.process = process;
    }

    @XmlAttribute
    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    @XmlElement(namespace = "bpmn",name = "process")
    public Process getProcess() {
        return process;
    }

    public void setProcess(Process process) {
        this.process = process;
    }
}

public class XMLToObject {
    public static void main(String[] args) {

        try {

            File file = new File("process.bpmn");
            JAXBContext jaxbContext = JAXBContext.newInstance(Definitions.class);
            Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
            Definitions definitions= (Definitions) jaxbUnmarshaller.unmarshal(file);
            System.out.println(definitions.getId());

        } catch (JAXBException e) {
            e.printStackTrace();
        }

    }
}

A: You need to specify the XML namespace URIs in your
@XmlRootelement and @XmlElement annotations,
not the XML namespace prefixes ("bpmn" or "bpmndi").
So then your Definitions class would look like this:
@XmlRootElement(namespace = "http://www.omg.org/spec/BPMN/20100524/MODEL")
public class Definitions {

    private String id;
    private Process process;
    private BPMNDiagram bpmnDiagram;

    public Definitions(){};
    public Definitions(String id, Process process, BPMNDiagram bpmnDiagram){
        this.id = id;
        this.process = process;
        this.bpmnDiagram = bpmnDiagram;
    }

    @XmlAttribute
    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    @XmlElement(namespace = "http://www.omg.org/spec/BPMN/20100524/MODEL", name = "process")
    public Process getProcess() {
        return process;
    }

    public void setProcess(Process process) {
        this.process = process;
    }

    @XmlElement(namespace = "http://www.omg.org/spec/BPMN/20100524/DI", name = "BPMNDiagram")
    public BPMNDiagram getBpmnDiagram() {
        return bpmnDiagram;
    }

    public void setBpmnDiagram(BPMNDiagram bpmnDiagram) {
        this.bpmnDiagram = bpmnDiagram;
    }
}

In a similar way you need to modify the @XmlElement annotations in your
other classes (Process, BPMNDiagram, ...).


text:
Q: Why does the graph have tick and thin lines? I have the following code:
RdmMatrix = vertcat(Round_deviation_mean {:});
rslMatrix = vertcat(roundsumlive {:});
correctsMatrix=vertcat(corrects{:});
A = [ RdmMatrix(:,1), rslMatrix(:,1) ];

figure(88);
bar([RdmMatrix(:,1) rslMatrix(:,1)], 0.05, 'stack');
legend('Correct', 'Functioning');
xlabel('Run');
ylabel('Sensor Count');
hold on;

I am not sure I understand the following outout can anyone help?!
output of my code
the data of round deviation mean are zeros

here are data from 65 to 100 of round sumlive

23.000 19.000 17.000 16.000 38.000 35.000 31.000 25.000 23.000 19.000 16.000 14.000
13.000 11.000 36.000 33.000 31.000 28.000 25.000 21.000 20.000 20.000 14.000 12.000
38.000 35.000 31.000 26.000 23.000 16.000 15.000 13.000 12.000 10.000 37.000

A: The best choice was to decrease the number of runs by taking the mean.


text:
Q: 3rd div doesn't touch the top because first and second are under eachother I don't think the title is a good one but I don't know how to say it in a better way.
I have 3 divs representing an image, user info, user experience.
Due to mobile responsiveness experience must come last, but with the code below the experience div doesn't touch the top.

.one{
 width: 40%;
 height: 50px;
 padding: 5px;
 background-color: #0f0;
}
.two{
 width: 40%;
 height: 70px;
 padding: 5px;
 background-color: #0ff;
 float: left;
}
.three{
 width: 56%;
 height: 100px;
 padding: 5px;
 background-color: #f00;
 float: right;
}
.four{
 width: 500px;
 padding: 5px;
 margin: 5px;
 background-color: #ff0;
 float: left;
}

1 image

2 info

3 experience

How it should look like:

A: You can wrap the left hand side in a separate div and float that left.

.left {
  float: left;
    width: 40%;
}

.one {
  height: 50px;
  padding: 5px;
  background-color: #0f0;
}

.two {
  height: 70px;
  padding: 5px;
  background-color: #0ff;
}

.three {
 width: 58%;
  height: 100px;
  padding: 5px;
  background-color: #f00;
  float: right;
}

.four {
  width: 500px;
  padding: 5px;
  margin: 5px;
  background-color: #ff0;
  float: left;
}

1 image

2 info

3 experience

An alternative approach using flexbox:

.left {
  min-width: 40%;
}

.one {
  height: 50px;
  padding: 5px;
  background-color: #0f0;
}

.two {
  height: 70px;
  padding: 5px;
  background-color: #0ff;
}

.three {
  flex: 1;
  height: 100px;
  padding: 5px;
  background-color: #f00;
}

.four {
  width: 500px;
  padding: 5px;
  margin: 5px;
  background-color: #ff0;
  float: left;
  display: flex;
}

1 image

2 info

3 experience

A: Your 1st div(image) has a margin to the right so 3rd div(experience) won't fit in. So at first you have to wrap the 1st two div's into a container like the example below

1 image

2 info

3 experience

After that you will need to inline the container and set the width of container to 40% and first two div's to 100% like the CSS below.
.one{
    width: 100%;
    height: 50px;
    padding: 5px;
    background-color: #0f0;
}
.container {
    display:inline-block;
    width:40%;
 }
.two{
    width: 100%;
    height: 70px;
    padding: 5px;
    background-color: #0ff;
    float: left;
}
.three{
    width: 56%;
    height: 100px;
    padding: 5px;
    vertical-align: text-top;
    background-color: #f00;
    float: right;
 }
.four{
    width: 500px;
    padding: 5px;
    margin: 5px;
    background-color: #ff0;
    float: left;
}

Here's it on Codepen and Jsfiddle

A: Wrap div's one and two in a div that sets the width and floats left, then float div three to the right.
Make div class one and two to 100% width so they fill the left div completely, and set the left div to the width you wanted.
HTML:

            1 image

            2 info

        3 experience

CSS:
.one{
    height: 50px;
    padding: 5px;
    background-color: #0f0;
    display: block;
}
.two{
    height: 70px;
    padding: 5px;
    background-color: #0ff;
    display: block;
}
.three{
    width: 56%;
    height: 100px;
    padding: 5px;
    background-color: #f00;
    float: right;
    display: inline-block;
}

.left {
    float: left;
    display: block;
    width: 42%;
}
.four{
    width: 500px;
    padding: 5px;
    margin: 5px;
    background-color: #ff0;
    display: block;
    float: left;
}


text:
Q: Office 2010 documents via Windows 7 symlinks on network share very slow in comparison to network path access Client: Windows 7 Premium, Office 2010 Pro Plus, both fully patched.
Server: Samba 3.5.10 on CentOS6 (SELinux enabled), Shadow copies enabled. Link speed: 1MBps.
As Windows 7 doesn't like me to use a network folder as a "Library" without making it offline, I used the trick of symlinking' them (like mklink /d c:\share\documents \server\documents)
Everything works fine - I can open the documents via:
c:\share\documents (the symlink)
\server\documents (the network path)
and X:\ (after a net use X: \server\documents ....)
Now comes the interesting part:
When I open an Office 2010 document - most noticeably an older Word version (97, 2000) which is being opened with Word 2010, via the symlink or, respectively, the "Library", opening the document is practically impossible. It takes minutes to open a small document.
BUT, when I open the SAME document via the direct path or network letter, the speed is satisfactory.
Did anyone come across this? Anything I'm missing?

A: You don't mention whether or not the same behavior exists with other files and since you didn't I'm going to assume that it doesn't.
Is it possible that you are seeing an issue with Office File Validation? I suggest you use a combination of ProcMon, TCPView and Wireshark/TCPDump to try and get a view into what Office is doing when you try to open documents via your symlinked directory. Additionally, crank the logging level up on Samba to 10 and see what it's doing.


text:
Q: How can I make a TextBox accepts only numeric values in WinUI 3? I have a TextBox which I use in Settings page of my app. Now, this textbox should only accept/display digits. There are several examples and solutions for this problem however, none of them work for WinUI 3 as they are mostly from 5-10 years ago.
KeyPress event does not exists in WinUI 3 TextBox. While looking for alternatives I saw KeyDown event however this event arguments are different and KeyRoutedEventArgs do not contain any property like KeyChar.
The example code I found that's applicable for WPF applications:
private void txtbox1_KeyPress(object sender, KeyPressEventArgs e)
{
    if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar))
    {
        e.Handled = true;
    }
}

How can I achieve this behaviour in WinUI 3 TextBox?

A: You can use InputScope!
You can find a reference from the Microsoft docs.
Here's an example from Microsoft:
<TextBox Header="Telephone Number" InputScope="TelephoneNumber"/>

You can also do further verifications in the code-behind by listening to the TextChanged event:
<TextBox TextChanged="OnTextChanged" />

<!-- In your code-behind file -->

private void OnTextChanged(object sender, TextChangedEventArgs e)
{
    // Get the current text of the TextBox
    var text = ((TextBox)sender).Text;

    // Use a regular expression to only allow numeric values
    var regex = new Regex("^[0-9]*$");

    // If the text does not match the regular expression, undo the change
    if (!regex.IsMatch(text))
    {
        ((TextBox)sender).Undo();
    }
}

Edit:
In WinUI 3, you can use KeyDown event too.
It's very similar to the way you did in WPF:
<TextBox KeyDown="OnKeyDown" />

private void OnKeyDown(object sender, KeyRoutedEventArgs e)
{
    // Check if the key pressed is a numeric key
    if (!((e.Key >= VirtualKey.Number0 && e.Key <= VirtualKey.Number9) || (e.Key >= VirtualKey.NumberPad0 && e.Key <= VirtualKey.NumberPad9)))
    {
        // If the key is not numeric, cancel the event and prevent the key from being entered
        e.Handled = true;
    }
}

A: @Link Hylia's answer was somehow correct in achieving the behaviour requested. I expanded on that answered by:

*

*Changed the event used. The KeyDown or TextChanged events were asynchronous events and would not block the entered input to appear on the screen. I changed this to TextChanging event which is run synchronously and before the TextBox.Text is rendered. Using this method, I can control the text before its rendered and improve UX.

*Instead of undoing, I now do just remove the char entered from the text and pass it back to the TextBox.

*I put the cursor back to where it was before so that the user can continue typing from where they left.

The code can be found below:
private void textBox1_TextChanging(TextBox sender, TextBoxTextChangingEventArgs args)
{
    var currentPosition = textBox1.SelectionStart - 1;
    var text = ((TextBox)sender).Text;

    var regex = new Regex("^[0-9]*$");

    if(!regex.IsMatch(text))
    {
        var foundChar = Regex.Match(textBox1.Text, @"[^0-9]");
        if(foundChar.Success)
        {
            textBox1.Text = textBox1.Text.Remove(foundChar.Index, 1);
        }

        textBox1.Select(currentPosition, 0);
    }
}


text:
Q: MYSQL Most Frequent Value Given a Certain Category How do I find the most frequent flight type, given the Destination?
Table: Flight:
+-------------+---------------+
| Destination | Type          |
+-------------+---------------+
| Beijing     | First Class   |
| Beijing     | First Class   |
| Beijing     | First Class   |
| Beijing     | First Class   |
| Beijing     | Coach         |
| London      | Coach         |
| London      | First Class   |
| London      | Coach         |
+-------------+---------------+

Every query I've tried so far has given the total number of each flight type as opposed to the most frequent flight type for each destination.
Here is the desired output:
+-------------+--------------+-------+
| Destination | Type         | count |
+-------------+--------------+-------+
| Beijing     | First Class  |     4 |
| London      | Coach        |     2 |
+-------------+--------------+-------+

EDIT:
So I found the easiest way was this:
SELECT destination, type, count FROM Flight WHERE total=
(
SELECT MAX(total) FROM Flight fl WHERE fl.destination = Flight.destination
);

A: You can try GROUP BY and HAVING. You have to select the rows which have the MAX total rows for each group (Destination, Type).
SELECT Destination, `Type`, COUNT(*) AS total
FROM your_table AS aa
GROUP BY Destination, `Type`
HAVING COUNT(*) = (
    SELECT MAX(each_total)
    FROM (
        SELECT COUNT(*) AS each_total
        FROM your_table
        GROUP BY Destination, `Type`
    )
)
ORDER BY Destination ASC;


text:
Q: If the sum of a sequence of positive rational numbers is transcendental, is the sum of every subsequence that is irrational, also transcendental? Assume we have a sequence of positive rational numbers $(a_n)$, and $\sum_{n=1}^\infty a_n = x$ and $x$ is transcendental. If we have a subsequence of $(a_n)$, $(b_n)$ and $\sum_{n=1}^\infty b_n = y$ and $y$ is not a rational number, is $y$ also transcendental? Further, if $y$ is transcendental, is it of the form $x-s,$ where $s$ is a rational number?
Take as an example the Basel problem. We have that $\sum_{n=1}^\infty \frac{1}{n^2} = \frac{\pi^2}{6}.$ This is a transcendental number. The sum of every finite subsequence of $(\frac{1}{n^2})$ is rational and there are infinitely many infinite subsequences that sum to a rational number, for example, $(\frac{1}{(p^n)^{2}})$ where $p$ is a prime.
What if we have a subsequence whose sum is not a rational number? Say $(k_n)$ is such a sequence. Is the sum $\sum_{n=1}^\infty k_n$ transcendental? Is $\sum_{n=1}^\infty k_n = \frac{\pi^2}{6}-s$, where $s\in\mathbb Q$? Or could we select the members very carefully and get, say, $\sqrt{2}?$
I figured that if we see the reciprocals of squares as a set $A$, and let $B = \{z \in P(A)\ |\ \sum_{i \in z} i \in \mathbb Q\}$, then $B$ is an ideal, so the set of subsets whose sum is irrational ($P(a)\setminus B$) should be filter. But I doubt it is much use.

A: In this answer, I prove that there is a subsequence of $\sum \frac{1}{n^2}$ which sums to $x$, for any $x \in \left(0, \frac{\pi^2}{6} - 1\right] \cup \left(1, \frac{\pi^2}{6}\right]$. You can produce such a subsequence greedily: that is, at each step, always take the largest remaining term which doesn't cause you to exceed your target.
For example, this method gives us a series
$$
\sqrt{2}=1+1/2^2+1/3^2+1/5^2+1/9^2 + 1/37^2+1/195^2+1/8584^2+1/1281816^2+\dots
$$
assuming I haven't run into any roundoff errors.


text:
Q: How to block sites such as checkip.amazonaws.com I'd like to find a way to block websites like https://checkip.amazonaws.com or at least restrict them to the point they can no longer output my server's public IP address.
For example, if I do curl https://checkip.amazonaws.com my output would simply be 1.1.1.1 (or in other words, my IP address).
Is there a way to have an app that would inspect the output of each website my server tries to connect to and if the output contains a specific string, it automatically blocks it?
I know a way to block them one by one, but is it possible to block all similar websites based on their output?
But why?!
The reason is simple. There are people hosting game servers on a dedicated server. However, with extensions to those servers, people can easily find the public IP of the machine they are on. The public IP is hidden via reverse proxy for network protection. If a user finds the real IP of a machine, they can use it to perform an attack or do other malicious activities.
Thanks!

A: Don't bother, you are fighting against windmills. This is just one of an endless list of services that show your IP address, you will never be able to block them all.
And even if you could, the user could just run his own anywhere he wants.
Restricting outgoing IP connections would be more useful, if that doesn't disrupt your services.

A: the easiest thing to do is put an entry in your local machine /etc/hosts for checkip.amazonaws.com and point it at whatever IP you wish. Point it to the machine's IP or simply to 127.0.0.1. Or setup a machine on your network that collects those requests and point checkip.amazonaws.com to that machine's IP and find out when people try to do this. There are other sites that will give you the public IP your traffic comes from however, so this one may not be the only one they're using.
However, if you know the miscreants mostly use this one, an entry in the system's /etc/hosts file will put a stop to it, pronto! Child's play!


text:
Q: Change image outside
* selector on bootstrap, but linked with this selector See this image:

I'm using an adapted Brando Theme. I want to change the image when using the selector, but i can only change the text, and i know why. I'll post the code on the bottom, but on the code i define a background div with

col-md-6 col-sm-6 col-xs-12

and the item selector on the right have this

col-md-12 col-sm-12

Obviously, when i try to repeat the bigger div inside any smaller div, it don't work properly. Above the selector, i have this:

I was trying to make a PHP/Javascript variable, but i'm kinda new and i still don't know how to do it properly. i was thinking about putting the background-image on a PHP variable or with javascript, but i really don't know how to do it. Here is the code:

                             CONHEÇA O COMPLEXO

Viva

Trabalhe

Aproveite

Lorem Ipsum is simply dummy text of the printing & typesetting industry. Lorem Ipsum has been the industry's standard dummy. Lorem Ipsum is simply dummy text of the printing & typesetting industry. Lorem Ipsum has been the industry's standard dummy.

Lorem Ipsum is simply dummy text of the printing & typesetting industry. Lorem Ipsum has been the industry's standard dummy. Lorem Ipsum is simply dummy text of the printing & typesetting industry. Lorem Ipsum has been the industry's standard dummy.

Lorem Ipsum is simply dummy text of the printing & typesetting industry. Lorem Ipsum has been the industry's standard dummy. Lorem Ipsum is simply dummy text of the printing & typesetting industry.

Lorem Ipsum is simply dummy text of the printing & typesetting industry. Lorem Ipsum has been the industry's standard dummy. Lorem Ipsum is simply dummy text of the printing & typesetting industry. Lorem Ipsum has been the industry's standard dummy. Lorem Ipsum has been the industry's standard dummy.

Lorem Ipsum is simply dummy text of the printing & typesetting industry. Lorem Ipsum has been the industry's standard dummy. Lorem Ipsum is simply dummy text of the printing & typesetting industry. Lorem Ipsum has been the industry's standard dummy.

Lorem Ipsum is simply dummy text of the printing & typesetting industry. Lorem Ipsum has been the industry's standard dummy. Lorem Ipsum is simply dummy text of the printing & typesetting industry. Lorem Ipsum has been the industry's standard dummy.

PS: To explain why my question is different of that marked as "duplicate" : In the suggested example, the two elements were not working, but they was INSIDE the same "mother div". I couldn't do that because the elements on the selector were on the right, and the image was on the left.

So, i resolved it by Javascript, now it works fine.

A: After struggling with the "duplicate" example and don't get any result, i've tried the "onclick" function. Here is my selection buttons after:

Viva

Trabalhe

Aproveite

Here is my div, with my created Javascript:

.viva { background-image:url('../images/viva.jpg'); }
.trabalhe { background-image:url('../images/trabalhe.jpg'); }
.aproveite { background-image:url('../images/aproveite.jpg'); }

A: As a proof of concept, here is a minimal code example of a single .nav-tab controlling two separate .tabpanel containers and their active contents:

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

Your Page Header

Tab 1

Tab 2

Tab 3

Tab #1 Contents

Tab #2 Contents

Tab #3 Contents


text:
Q: Play music once CountDownTimer android I want to play a sound file ONLY once in some second, but if I set countDownInterval of from 100 to 700, I get the operation two or three times (due to rounding). If I set countDownInterval of from 700 to 1000, I get one operation in a range from 10 to 2, but if I set play a sound file in 1 second, I get two play, because onTick rounds to one.
Yes, I know that CountDownTimer is not precise .
Thanks for help!
  public void startTimer() {
          tCountDownTimer = new CountDownTimer(tTime * 1000, 1000) {
      @Override
      public void onTick(long millisUntilFinished) {
          int seconds = (int) (millisUntilFinished / 1000);
          int minutes = seconds / 60;
          int hours = minutes / 60;
          minutes = minutes % 60;
          seconds = seconds % 60;
          String curTime = hours + ":" + minutes + "::" + seconds;
          Log.v("log_tag", "Log is here Time is now" + curTime);
          tTimeLabel.setText(String.format("%02d:%02d:%02d", hours, minutes, seconds));
          runSec (seconds);
          runMin (minutes);
          runHou (hours);
          if (seconds == 3) {
              playAlertSound(R.raw.beep1);
              }
          else if(seconds == 2){
              playAlertSound(R.raw.beep1);
              }
          else if(seconds == 1){
              playAlertSound(R.raw.beep1);
              }
          else if(seconds == 0){
              playAlertSound(R.raw.beep2);
              }

if I use int seconds = Math.round(millisUntilFinished / 1000);
12-06 19:16:54.320: V/log_tag(1121): Log is here Time is now0:0::4
12-06 19:16:55.379: V/log_tag(1121): Log is here Time is now0:0::3
12-06 19:16:56.437: V/log_tag(1121): Log is here Time is now0:0::2
12-06 19:16:57.478: V/log_tag(1121): Log is here Time is now0:0::1

if I use int seconds = Math.round(millisUntilFinished / 1000f);
12-06 19:20:14.851: V/log_tag(1167): Log is here Time is now0:0::5
12-06 19:20:15.885: V/log_tag(1167): Log is here Time is now0:0::4
12-06 19:20:16.931: V/log_tag(1167): Log is here Time is now0:0::3
12-06 19:20:17.973: V/log_tag(1167): Log is here Time is now0:0::2

It`s user set time on the tamer:
protected int tTime = 0;

public void onClick(View v) {
    if(v == upTimesl && tTime <= (11*60*60+1*59*60+55))
      settTime(tTime + 5);
    else if(v == downTimesl && tTime > 5)
      settTime(tTime - 5);
    else if(v == downTimesl && tTime <= 5)
          settTime(tTime=0);
...

A: Mathematically you are not rounding, you are taking the floor operation. If millisUntilFinished / 1000 is actually 0.9999 you are guaranteed to get 0. You should use Math.round():
int seconds = Math.round(millisUntilFinished / 1000f);

(Notice I am dividing by 1000f, diving a long by an integer is still a floor operation.)
Your current interval is 100ms, this doesn't make sense since all of your calculations are based off of seconds. You should use:
tCountDownTimer = new CountDownTimer(tTime * 1000, 1000) {

Also CountDownTimer has a couple quirks: it adds a few milliseconds to each interval and often skips the last interval before calling onFinish(). I made a few changes to this class a while back to remove these errors in android CountDownTimer - additional milliseconds delay between ticks.


text:
Q: How to conditionally turn off a JS plugin in Foundation? Using jQuery, I am trying to conditionally load the Magellan sticky nav plugin of the Foundation framework depending on screensize:
window width > 640px ==> Load Magellan with specified options
window width < 640px ==> Turn Magellan off
The resizing event seems to fire, but the plugin does not seem to have an off option.
I got the following JS:
$(document).ready(function() {

/* foundation magellan scroller*/

    function checkWidth() {

        var $windowSize = $(window).width();

        if ( $windowSize > 640 ) {

            $(document).foundation({

                "magellan-expedition": {
                  active_class: 'active', // specify the class used for active sections
                  threshold: 0, // how many pixels until the magellan bar sticks, 0 = auto
                  destination_threshold: 50, // pixels from the top of destination for it to be considered active
                  throttle_delay: 50, // calSculation throttling to increase framerate
                  fixed_top: 75, // top distance in pixels assigend to the fixed element on scroll
                  offset_by_height: true // whether to offset the destination by the expedition height. Usually you want this to be true, unless your expedition is on the side.
                }

            });

        } else {

            $(document).foundation('magellan', 'off');

        }
    }

    // Execute on load
    checkWidth();

    // Bind event listener
    $(window).resize(checkWidth);

});

A: You don't have the html markup but you can remove or turn off the magellan sticky by removing the data attribute
if you html looks like this

inside you else statement remove att
 else {

          $(".navi-f").removeAttr("data-magellan-expedition");

    }

this way its like turning off the plugin


text:
Q: Who has been killed by a Terminator, a Predator, and a Xenomorph? The in memoriam for Bill Paxton, over on meta, reads

(...) Bill Paxton, one of only two actors to have the distinction of being killed by a Xenomorph, a Predator and a Terminator (...)

Who's the other one?

A: Lance Henriksen

Henriksen is typically considered the correct answer, though whether or not he qualifies is more ambiguous than Paxton1:

*

*In the original Terminator film, Henriksen plays one of the detectives working the "Phone Book Killer" case. He's shot repeatedly during the T-800's attack on the police station, and we're presumably meant to understand that he was killed.
That being said, he's never actually shown dead (he just kind of falls out of frame and we never see him again, or in later films), so it's not impossible that he survived

*In Aliens, he plays the robot Bishop, who gets ripped in half by the Xenomorph Queen shortly before the iconic power loader fight. However, being a robot and everything, this doesn't kill him; his top half is seen wriggling on the floor, and saves Newt from being sucked into space when Ripley opens the airlock. His head turns up in the third film, and Ripley has a short conversation with it before permanently switching it off (at Bishop's request).
This is the most debatable "death" of the three, and I've seen two main arguments against counting it, neither of which are entirely meritless:

*

*Bishop is a robot and isn't capable of dying, in the strictest sense. That's a far more philosophical question than I'm comfortable answering, but it's worth keeping in mind

*Bishop doesn't "die" from these wounds, and in fact is "killed" by Ripley. He clearly survives his bifurcation (his top half saves Newt from being sucked into space when Ripley opens the airlock), and he's finally deactivated for good by Ripley in the third film

*In Alien vs. Predator he plays Charles Weyland. He tries to distract one of the Predators with an improvised flamethrower, and gets stabbed for his troubles. Of the three claims, this is the only unambiguous one.
That being said, Henriksen and Paxton also share the honour of being the only actors (or actresses) common to all three franchises, so they're the only ones even in the running.

1 Though it should be noted that Paxton's claim isn't unambiguous either; his character in The Terminator is only thrown into a metal fence and it's possible, though admittedly unlikely, that he survived


text:
Q: Why does increment operator modify the original value and bit operators don't? The increment operator modifies the original value like,
int i = 5;
i++;
printf("%d",i); //prints 6

but the bit operator does not, example,
int x = 5;
x<<1;
printf("%d",x);//should print 10 but outputs the original value i.e. 5

A: x << 1 is analogous to operations like x * 2. If you don't store the result anywhere, it is just discarded and the line may just get omitted entirely by an optimizing compiler.
If you want to store the result of an operation like that back into x, you have options like:
x = x * 2;
x *= 2;

The << operator is the same:
x = x << 1;
x <<= 1;


text:
Q: How can I an arrayList(indexOf) to displays the occurrences of a specific number in an array? //Program generates 500 random numbers between 0 and 9 and then displays the number of occurrences of each number.
I'm a new programmer, does anyone have any idea how to solve this question using something from the array list, specifically indexOf?
The code below is what I coded with simple 1d arrays.
int []randomNum = new int[500];
int zero = 0, one = 0, two = 0, three= 0, four = 0,
    five = 0, six = 0, seven = 0, eight = 0, nine = 0;

for (int i = 0; i < randomNum.length; i++) {
    randomNum[i] = (int)Math.floor(Math.random()*(9-0+1));

    if (randomNum[i] == 0) {
        zero++;
    } else if (randomNum[i] == 1) {
        one++;
    } else if (randomNum[i] == 2) {
        two++;
    } else if (randomNum[i] == 3) {
        three++;
    } else if (randomNum[i] == 4) {
        four++;
    } else if (randomNum[i] == 5) {
        five++;
    } else if (randomNum[i] == 6) {
        six++;
    } else if (randomNum[i] == 7) {
        seven++;
    } else if (randomNum[i] == 8) {
        eight++;
    } else if (randomNum[i] == 9) {
        nine++;
    }
}
System.out.printf( "%-15s  %15s  %n", "Number", "Occurrence");
System.out.printf( "%-15s  %15s  %n", "0", zero);
System.out.printf( "%-15s  %15s  %n", "1", one);
System.out.printf( "%-15s  %15s  %n", "2", two);
System.out.printf( "%-15s  %15s  %n", "3", three);
System.out.printf( "%-15s  %15s  %n", "4", four);
System.out.printf( "%-15s  %15s  %n", "5", five);
System.out.printf( "%-15s  %15s  %n", "6", six);
System.out.printf( "%-15s  %15s  %n", "7", seven);
System.out.printf( "%-15s  %15s  %n", "8", eight);
System.out.printf( "%-15s  %15s  %n", "9", nine);

A: There are better and effective ways to do this but this is my simple solution.
Integer[] randomNum={1,2,3,4,5,2,4,5,3,2,1};
    Set<Integer> set= new HashSet<>(Arrays.asList(randomNum));
    System.out.println(set);
    int count=0;
    for (Integer i:set){
        for (Integer j:randomNum){
            if (i ==j){
                count++;
            }
        }
        count=0;
        System.out.println("number of "+i +" is "+ count);

    }

A: It is quite ok to use plain int[] to count the frequencies of the elements, and use of List/ArrayList and their methods seems to be a bit redundant.  Upon calculating the frequencies, the array may be converted into
the list.
However, existing solution offers a lot of duplicated code which may be reduced significantly:

*

*Array randomNum is redundant, a single random digit may be calculated

*It's better to use array instead of separate int values to count and print frequencies.

*It's better to use method nextInt of class Random instead of calculating with Math.random()
final int SEQ_LENGTH = 500;
final int NUM_COUNT = 10;

int[] frequency = new int[NUM_COUNT];

Random randomGenerator = new Random();

for (int i = 0; i < SEQ_LENGTH; i++) {
    int num = randomGenerator.nextInt(NUM_COUNT);
    frequency[num]++;
}

System.out.printf( "%s  %s%n", "Number", "Occurrence");

for (int i = 0; i < frequency.length; i++) {
    System.out.printf( "%6d  %10d %n", i, frequency[i]);
}

List<Integer> counts = Arrays.stream(frequency).boxed().collect(Collectors.toList());
System.out.println(counts);

int digit = 2;
System.out.printf("The occurrence of %d's is %d%n", digit, counts.get(digit));

Output:
Number  Occurrence
     0          54
     1          40
     2          45
     3          57
     4          47
     5          50
     6          59
     7          50
     8          47
     9          51
[54, 40, 45, 57, 47, 50, 59, 50, 47, 51]
The occurrence of 2's is 45


text:
Q: How to list roles from Identity on Registry Page I was looking everywhere but all the answers that I found are not working.
How to list all roles on Registry page? I'm working with ASP.NET Core 2.2.

A: This can be accomplished fairly easily as long as you are using the existing DI container that will allow you to access available roles.  Below is just an example of how this could be set up in the controller.
[Authorize(Roles = "Administrator")]
public class RolesController : BaseController
{
    public RolesController(ApplicationDbContext context, UserManager<IdentityUser> userManager, RoleManager<IdentityRole> roleManager) : base(context, userManager, roleManager)
    {
    }

    [HttpGet]
    public async Task<IActionResult> Index()
    {
        List<IdentityRole> roles = await RoleManager.Roles.ToListAsync();
        return View(roles);
    }
}


text:
Q: How to fix the error: The markup in the document following the root element must be well-formed <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>org.apache.maven</groupId>
  <artifactId>Serializer</artifactId>
  <version>0.0.1-SNAPSHOT</version>
</project>

<dependency>
    <groupId>com.opencsv</groupId>
    <artifactId>opencsv</artifactId>
    <version>5.2</version>
</dependency>

The error is occurring right where the first <dependency> is located for OpenCsv. I tried using re-formatters online, but all my efforts were unsuccessful.


text:
Q: vue.js 2 view not refreshing after data change in Vuex store Hi I try to create a table to track validation status for several items.
The vue xstore:
  mutations: {
...,
    set_scaninfos: function (state, scaninfos) {
      Vue.set(state, 'scaninfos', scaninfos)
    }
  },
  actions: {
...,
    setScanInfo (store, scinfo) {
      store.commit('set_scaninfos', scinfo)
    }
  },

The component - first I initialize the scaninfos in the vuex store:
 initScanInfos () {
   var scanIds = this.$store.state.scanids
   console.log(this.$store.state.scanids.length)
   for (var i = 0; i < scanIds.length; i++) {
     this.scaninfos[scanIds[i]] = Object.assign({}, this.ruleForm)
   }
   this.$store.dispatch('setScanInfo', this.scaninfos)
 }

},
When updates arrive I push them like this:
  saveForm (formName) {
    this.$refs[formName].validate((valid) => {
      if (valid) {
        console.log('form valid!')
        this.ruleForm.validated = true
        var scanId = this.$store.state.scanids[this.scanindex]
        this.scaninfos[scanId] = Object.assign({}, this.ruleForm)
        this.$store.dispatch('setScanInfo', this.scaninfos)
        this.saveSuccess()
      } else {
        console.log('error: form invalid!!')
        this.ruleForm.validated = false
        this.saveFail()
        return false
      }
    })
  },

I present the data like this:
computed: {
  scanId () {
    var pId = this.$store.state.scanids[this.scanindex]
    return pId
  },
  scinfo () {
    var scinfo = this.$store.state.scaninfos
    return scinfo
  }

HTML:

            scan
            validation

            {{ scanid }}

Data arrives at the store in the correct format. However the view does not refresh when the vuex store changes. How can I fix this? What am I doing wrong?
PS:
My data is a pretty ugly nested JSON dict:
{ "Ex1": { "pseudonym": "asd", "yob": "2009-12-31T23:00:00.000Z", "scanmonth": "2018-01-31T23:00:00.000Z", "gender": "male", "therapy": "sda", "doa": "alive", "diagnosis": "shanghai", "mgmt": "unmethylated", "validated": true, "survival": 1, "karnofsky": 10, "ki67": 1 }, "Ex2": { "pseudonym": "asdsad", "yob": "2010-12-31T23:00:00.000Z", "scanmonth": "2018-02-28T23:00:00.000Z", "gender": "male", "therapy": "asd", "doa": "alive", "diagnosis": "shanghai", "mgmt": "unmethylated", "validated": true, "survival": 1, "karnofsky": 10, "ki67": 1 } }

A: I solved it by adding
this.$forceUpdate()

to my save function but this seems to be a pretty ugly hack.


text:
Q: Latex - How can I use minipage inside longtable? I have a table that I would like to split over pages, but I can't seem to figure out how I can do it with my current lay-out or commands that I use.
At this time, I used landscape and minipage so that it would fit on one page:
\documentclass[11pt]{article}

\usepackage{pdflscape}
\usepackage{longtable}
\usepackage{lipsum}
\usepackage{bm}
\usepackage{makecell}

\begin{document}

\begin{landscape}
\centering
\begin{table}[!htb]
\caption{\label{CH2_tab:P80L} Empirical power from the simulation study with the indicators having an overall reliability of 80\% and a linear relationship with the latent variable. The highest power per setting is indicated in bold.}
\renewcommand{\arraystretch}{1.5}
\begin{minipage}{.5\linewidth}
\centering

\medskip
\scalebox{0.45}{
\begin{tabular}{rcccccc}
   \hline
 &   \multicolumn{6}{c}{\textbf{Linear}} \\
\cline{2-7}
&  \makecell{\textbf{WMW -- max rel} } &  \makecell{\textbf{WMW -- mean }} &  \makecell{\textbf{\textit{t} test -- max rel }} &  \makecell{\textbf{\textit{t} test -- mean }} &  \makecell{\textbf{SEM} }  & \makecell{\textbf{SEM -- corrected}}  \\
  \hline
      \multicolumn{7}{l}{$\mathcal{N}(0,1)$} \\
  \multicolumn{7}{l}{\bm{$m=n=15$}} \\
  \hline
  Setting 1 & 29.7 & 31.0 &  \textbf{33.2} & 32.9 & 32.4 & 32.1 \\
  Setting 2 & 28.4 & 29.2 & 30.7 &  \textbf{31.3} & 30.0 & 30.3 \\
  Setting 3 & 29.5 & 29.3 & 31.8 &  \textbf{32.3} & 32.0 & 31.9 \\
  Setting 4 & 25.8 & 26.2 & 28.5 & 27.4 &  \textbf{29.4} & 28.6 \\
 \hline
  \multicolumn{7}{l}{\bm{$m=n=50$}} \\
  \hline
  Setting 1 & 78.7 & 79.1 & 81.7 & 81.4 & \textbf{83.2} & 83.1 \\
  Setting 2 & 79.5 & 78.8 & 81.0 & 80.4 & 82.0 & \textbf{82.1} \\
  Setting 3 & 79.2 & 79.9 & 81.2 & 81.8 & \textbf{82.2} & 82.0 \\
  Setting 4 & 74.8 & 72.3 & 77.6 & 74.4 & \textbf{80.0} & \textbf{80.0} \\
   \hline
  \multicolumn{7}{l}{\bm{$m=n=100$}} \\
  \hline
  Setting 1 & 98.2 & 98.1 & 98.5 & 98.6 & \textbf{98.7} & \textbf{98.7} \\
  Setting 2 & 97.7 & 97.7 & 98.2 & \textbf{98.3} & \textbf{98.3} & \textbf{98.3} \\
  Setting 3 & 97.6 & 97.5 & 98.1 & \textbf{98.2} & \textbf{98.2} & \textbf{98.2} \\
  Setting 4 & 97.4 & 95.1 & 98.1 & 95.8 & 98.1 & \textbf{98.2} \\
  \hline
  \multicolumn{7}{l}{$t_5$} \\
  \multicolumn{7}{l}{\bm{$m=n=15$}} \\
  \hline
   Setting 1 & 23.5 & 23.9 & 24.2 & 24.1 & \textbf{24.4} & 23.9 \\
  Setting 2 & 24.0 & \textbf{24.1} & 23.1 & 22.6 & 22.0 & 22.2 \\
  Setting 3 & 23.7 & \textbf{23.8} & 22.4 & 23.1 & 22.5 & 23.3 \\
  Setting 4 & 22.1 & 22.4 & 22.2 & 22.4 & 22.4 & \textbf{23.5} \\
\hline
  \multicolumn{7}{l}{\bm{$m=n=50$}} \\
  \hline
  Setting 1 & 65.8 &  \textbf{66.1} & 60.8 & 60.9 & 61.8 & 61.4 \\
  Setting 2 &  \textbf{68.7} &  \textbf{68.7} & 62.2 & 62.2 & 63.7 & 63.4 \\
  Setting 3 & 67.3 &  \textbf{67.6} & 61.1 & 61.4 & 62.7 & 62.2 \\
  Setting 4 &  \textbf{63.9} & 58.4 & 57.6 & 53.7 & 60.2 & 60.0 \\
 \hline
  \multicolumn{7}{l}{\bm{$m=n=100$}} \\
  \hline
  Setting 1 & 92.3 &  \textbf{92.4} & 87.6 & 87.6 & 88.0 & 88.1 \\
  Setting 2 &  \textbf{91.7} &  \textbf{91.7} & 87.0 & 87.4 & 87.9 & 87.8 \\
  Setting 3 & 93.2 &  \textbf{93.4} & 88.9 & 88.7 & 89.4 & 89.5 \\
  Setting 4 &  \textbf{90.6} & 86.8 & 85.7 & 83.4 & 87.4 & 87.4 \\
 \hline
   \hline
   \end{tabular}
}

\end{minipage}\hfill
\begin{minipage}{.5\linewidth}
\centering

\medskip

\scalebox{0.45}{
\begin{tabular}{rcccccc}
   \hline
 &   \multicolumn{6}{c}{\textbf{Linear}} \\
\cline{2-7}
&  \makecell{\textbf{WMW -- max rel} } &  \makecell{\textbf{WMW -- mean }} &  \makecell{\textbf{\textit{t} test -- max rel }} &  \makecell{\textbf{\textit{t} test -- mean }} &  \makecell{\textbf{SEM} }  & \makecell{\textbf{SEM -- corrected}}  \\
  \hline
    \multicolumn{7}{l}{$Laplace(0,1.25)$} \\
  \multicolumn{7}{l}{\bm{$m=n=15$}} \\
  \hline
  Setting 1 & 21.5 & \textbf{22.3} & 19.6 & 20.4 & 19.3 & 19.0 \\
  Setting 2 & \textbf{21.9} & 21.4 & 21.0 & 21.1 & 19.8 & 21.0 \\
  Setting 3 & 22.0 & \textbf{22.5} & 20.6 & 20.3 & 20.1 & 20.3 \\
  Setting 4 & 17.3 & \textbf{19.8} & 16.5 & 18.8 & 19.4 & 19.3 \\
    \hline
  \multicolumn{7}{l}{\bm{$m=n=50$}} \\
  \hline
  Setting 1 & 61.8 & \textbf{62.0} & 53.2 & 53.2 & 55.0 & 54.6 \\
  Setting 2 & 62.2 & \textbf{63.2} & 52.7 & 53.3 & 54.5 & 53.8 \\
  Setting 3 & 64.6 & \textbf{66.0} & 52.9 & 52.8 & 54.7 & 54.2 \\
  Setting 4 & \textbf{58.9} & 56.9 & 51.7 & 49.8 & 56.0 & 56.1 \\
 \hline
  \multicolumn{7}{l}{\bm{$m=n=100$}} \\
  \hline
  Setting 1 & \textbf{92.3} & 92.2 & 83.2 & 82.9 & 83.5 & 83.4 \\
  Setting 2 & \textbf{88.1} & 87.9 & 77.7 & 77.5 & 78.2 & 78.1 \\
  Setting 3 & \textbf{91.0} & 90.7 & 82.6 & 82.9 & 82.9 & 83.0 \\
  Setting 4 & \textbf{85.5} & 80.4 & 77.7 & 74.2 & 79.3 & 79.3 \\
  \hline
  \multicolumn{7}{l}{Exp} \\
  \multicolumn{7}{l}{\bm{$m=n=15$}} \\
  \hline
  Setting 1 & 22.2 & \textbf{23.1} & 18.1 & 18.2 & 18.7 & 18.3 \\
  Setting 2 & 19.7 & \textbf{19.8} & 17.0 & 17.5 & 17.2 & 17.5 \\
  Setting 3 & 19.4 & \textbf{20.2} & 16.9 & 17.6 & 16.9 & 17.0 \\
  Setting 4 & 15.7 & \textbf{16.0} & 13.4 & 14.9 & 14.8 & 14.9 \\
  \hline
  \multicolumn{7}{l}{\bm{$m=n=50$}} \\
  \hline
  Setting 1 & 61.9 & \textbf{62.0} & 40.8 & 41.8 & 42.6 & 42.6 \\
  Setting 2 & 56.2 & \textbf{57.6} & 38.0 & 38.2 & 39.9 & 39.3 \\
  Setting 3 & 63.0 & \textbf{63.5} & 42.6 & 42.6 & 44.9 & 44.8 \\
  Setting 4 & \textbf{50.1} & 45.0 & 36.9 & 36.7 & 40.6 & 40.4 \\
 \hline
  \multicolumn{7}{l}{\bm{$m=n=100$}} \\
  \hline
  Setting 1 & 86.7 & \textbf{87.2} & 67.2 & 67.5 & 67.7 & 67.8 \\
  Setting 2 & 85.4 & \textbf{85.6} & 65.5 & 66.0 & 66.6 & 66.8 \\
  Setting 3 & 88.2 & \textbf{88.4} & 66.4 & 66.3 & 67.3 & 67.6 \\
  Setting 4 & \textbf{83.5} & 76.1 & 65.2 & 61.1 & 66.9 & 67.7 \\
  \hline
   \hline
   \end{tabular}
}

\end{minipage}\hfill
\end{table}
\end{landscape}

\end{document}

However, I would like to split this table nicely over multiple pages (and thus by using e.g. longtable), in such way that on one page, I have the results for the N(0,1) and Laplace distribution (side by side), and then on the second page the t_5 and Exp distribution (side by side), i.e. split each table over 2 pages, but have 2 tables side by side by using minipage inside long table.
I know I could converge them and just make one large table and then use long table, however, I would really like not to rewrite the code (since I have 10 more tables like this). Does someone know how I could do this? I tried several ways, but none of them produce the result I am looking for.
Thank you for all your feedback!
Heidelinde


text:
Q: difference between column of dates and a fixed date shoot <- read.csv('shoot.csv')
finish <- as.Date(shoot$`Year of Incorporation`, format="%mm/%dd/%yyyy")
start <- 12/31/2016
date_diff <- as.data.frame(finish-start)

What changes should be done in this to get output as number of dates between data set and 31/12/2016??


text:
Q: C# Dynamic Class Type -- generate lambda expression for DbContext .Select So I have to generate dynamic classes at runtime.  I use AssemblyBuilder, ModuleBuilder, TypeBuilder.  I can get the Type and created an instance with Activator.
But later I need to use the type as part of a derived DbContext.  I got that far.
But now I need to generate a .Select expression in the DbContext for specifying just the columns I want to select.  I found a method to do this.
public static Func<T, T> DynamicSelectGenerator<T>(string fields = "")
{
   ...

   return lambda.Compile();
}

But I can't figure out how to send my dynamic class's Type into this method.
How do I turn my type into a generic type to pass into this DynamicSelectGenerator ?
I've tried to take my type and call type.MakeGenericType(), but that isn't working.
How would I use this Type of a dynamic class built at runtime to generate my Select clause lambda expression?
I've tried using Dynamic Linq but am getting errors with that approach as well.


text:
Q: Flutter on Android - Street view - Google Maps Android API(15449): Authorization failure I am getting an issue trying to display a Google Street View inside my flutter app on an Android device.  I'm using the 'flutter_google_street_view' package
https://pub.dev/packages/flutter_google_street_view
The error is shown as:
I/zzbz    (15449): Making Creator dynamically
I/DynamiteModule(15449): Considering local module com.google.android.gms.maps_dynamite:0 and remote module com.google.android.gms.maps_dynamite:203115000
I/DynamiteModule(15449): Selected remote version of com.google.android.gms.maps_dynamite, version >= 203115000
V/DynamiteModule(15449): Dynamite loader version >= 2, using loadModule2NoCrashUtils
I/Google Maps Android API(15449): Google Play services client version: 12451000
I/Google Maps Android API(15449): Google Play services package version: 224915040
I/Google Maps Android API(15449): Google Play services maps renderer version(legacy): 203115000
I/PlatformViewsController(15449): Using hybrid composition for platform view: 0
D/EGL_emulation(15449): eglMakeCurrent: 0xdaa4be60: ver 3 0 (tinfo 0xc2885d30) (first time)
W/Gralloc4(15449): allocator 3.x is not supported
I/bb      (15449): Successfully registered with Phenotype.
D/HostConnection(15449): HostConnection::get() New Host Connection established 0xf3666c70, tid 15611
D/HostConnection(15449): HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_YUV_Cache ANDROID_EMU_has_shared_slots_host_memory_allocator ANDROID_EMU_sync_buffer_data ANDROID_EMU_read_color_buffer_dma GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_host_side_tracing ANDROID_EMU_gles_max_version_3_0
D/EGL_emulation(15449): eglCreateContext: 0xf3665460: maj 3 min 0 rcv 3
D/EGL_emulation(15449): eglMakeCurrent: 0xf3665460: ver 3 0 (tinfo 0xaf4e40f0) (first time)
E/Google Maps Android API(15449): Authorization failure.  Please see https://developers.google.com/maps/documentation/android-api/start for how to correctly set up the map.
E/Google Maps Android API(15449): In the Google Developer Console (https://console.developers.google.com)
E/Google Maps Android API(15449): Ensure that the "Google Maps Android API v2" is enabled.
E/Google Maps Android API(15449): Ensure that the following Android Key exists:
E/Google Maps Android API(15449):   API Key: AIzaSyAFUSjY6bWNijau1hVmoePif_zYwp2j_Sk
E/Google Maps Android API(15449):   Android Application (<cert_fingerprint>;<package_name>): C9:CB:67:3B:98:A1:0E:2D:92:94:C4:29:96:E4:B7:52:BA:FA:F5:CD;com.eis.lejog.lejog
W/DynamiteModule(15449): Local module descriptor class for com.google.android.gms.googlecertificates not found.
I/DynamiteModule(15449): Considering local module com.google.android.gms.googlecertificates:0 and remote module com.google.android.gms.googlecertificates:7
I/DynamiteModule(15449): Selected remote version of com.google.android.gms.googlecertificates, version >= 7
I/SnapshotHandler(15449): Unable to retrieve flag snapshot for com.google.android.libraries.consentverifier#com.eis.lejog.lejog, using defaults.
W/MobStoreFlagStore(15449): Unable to update local snapshot for com.google.android.libraries.consentverifier#com.eis.lejog.lejog, may result in stale flags.
W/MobStoreFlagStore(15449): java.util.concurrent.ExecutionException: java.lang.SecurityException: GoogleCertificatesRslt: not allowed: pkg=com.eis.lejog.lejog, sha256=[cf712b5da7a865ec27ce35698f601b49a5b0a8c7d1246750082d43b9916d2142], atk=false, ver=224915040.true (go/gsrlt)
W/MobStoreFlagStore(15449):     at ajg.s(:com.google.android.gms.dynamite_mapsdynamite@224915040@22.49.15 (150700-0):3)
W/MobStoreFlagStore(15449):     at ajg.get(:com.google.android.gms.dynamite_mapsdynamite@224915040@22.49.15 (150700-0):2)
W/MobStoreFlagStore(15449):     at akq.g(:com.google.android.gms.dynamite_mapsdynamite@224915040@22.49.15 (150700-0):2)
W/MobStoreFlagStore(15449):     at yo.d(:com.google.android.gms.dynamite_mapsdynamite@224915040@22.49.15 (150700-0):1)
W/MobStoreFlagStore(15449):     at yq.run(:com.google.android.gms.dynamite_mapsdynamite@224915040@22.49.15 (150700-0):0)
W/MobStoreFlagStore(15449):     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
W/MobStoreFlagStore(15449):     at java.util.concurrent.FutureTask.run(FutureTask.java:266)
W/MobStoreFlagStore(15449):     at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
W/MobStoreFlagStore(15449):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
W/MobStoreFlagStore(15449):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
W/MobStoreFlagStore(15449):     at java.lang.Thread.run(Thread.java:923)
W/MobStoreFlagStore(15449): Caused by: java.lang.SecurityException: GoogleCertificatesRslt: not allowed: pkg=com.eis.lejog.lejog, sha256=[cf712b5da7a865ec27ce35698f601b49a5b0a8c7d1246750082d43b9916d2142], atk=false, ver=224915040.true (go/gsrlt)
W/MobStoreFlagStore(15449):     at android.os.Parcel.createExceptionOrNull(Parcel.java:2373)
W/MobStoreFlagStore(15449):     at android.os.Parcel.createException(Parcel.java:2357)
W/MobStoreFlagStore(15449):     at android.os.Parcel.readException(Parcel.java:2340)
W/MobStoreFlagStore(15449):     at android.os.Parcel.readException(Parcel.java:2282)
W/MobStoreFlagStore(15449):     at fc.c(:com.google.android.gms.dynamite_mapsdynamite@224915040@22.49.15 (150700-0):2)
W/MobStoreFlagStore(15449):     at rr.a(:com.google.android.gms.dynamite_mapsdynamite@224915040@22.49.15 (150700-0):4)
W/MobStoreFlagStore(15449):     at ji.e(:com.google.android.gms.dynamite_mapsdynamite@224915040@22.49.15 (150700-0):2)
W/MobStoreFlagStore(15449):     at kh.t(:com.google.android.gms.dynamite_mapsdynamite@224915040@22.49.15 (150700-0):2)
W/MobStoreFlagStore(15449):     at kh.u(:com.google.android.gms.dynamite_mapsdynamite@224915040@22.49.15 (150700-0):3)
W/MobStoreFlagStore(15449):     at kh.e(:com.google.android.gms.dynamite_mapsdynamite@224915040@22.49.15 (150700-0):2)
W/MobStoreFlagStore(15449):     at kl.handleMessage(:com.google.android.gms.dynamite_mapsdynamite@224915040@22.49.15 (150700-0):69)
W/MobStoreFlagStore(15449):     at android.os.Handler.dispatchMessage(Handler.java:102)
W/MobStoreFlagStore(15449):     at android.os.Looper.loop(Looper.java:223)
W/MobStoreFlagStore(15449):     at android.os.HandlerThread.run(HandlerThread.java:67)

This feature was working, but suddenly it no longer is. Any suggestions


text:
Q: Django static files 404 not found I have read all of the similar questions regarding this and still can't find an answer. I downloaded a template from HTML5 and all of the required CSS, JS and images but when I run the server I get:
**
Not Found: /erthreal/assets/js/main.js
[04/Aug/2018 12:02:40] "GET /erthreal/assets/js/main.js HTTP/1.1" 404 2126
[04/Aug/2018 12:02:40] "GET /erthreal/images/gallery/thumbs/06.jpg HTTP/1.1" 404 2159
[04/Aug/2018 12:02:40] "GET /erthreal/images/gallery/thumbs/07.jpg HTTP/1.1" 404 2159
**

I have the following written in my settings.py file:
TEMPLATES = [
{
    'BACKEND': 'django.template.backends.django.DjangoTemplates',
    'DIRS': [
        'erthreal/erthreal/templates/'
    ],

STATIC_URL = '/static/'

STATICFILES_DIRS = [
    os.path.join(BASE_DIR, 'static/',),
    'erthreal/static/erthreal',
]

In my index.html:
    {% load static %}
<!DOCTYPE html>
<html>
    <head>
        <title>personal</title>
        <meta charset="utf-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
        <link rel="stylesheet" href="{% static "erthreal/assets/css/main.css" %}"/>
        <noscript><link rel="stylesheet" href="erthreal/assets/css/noscript.css" /></noscript>
    </head>

I'm pretty sure the problem is in my views.py:
from django.shortcuts import render, HttpResponse

def index(request):
    index = Index.objects.all()
    return render(request, 'erthreal/templates/index.html')

I have read through all of the documentation both on the django website and the howto folders (which are pretty much copies of each other), but cant find an answer on how to fix it. This is my folder layout:
      erthreal/
    static/
        erthreal/
            assets/
                CSS/
                fonts/
                js/
                sass/
            images/
    templates/
        erthreal/
          index.html

It will load the template just not the associated static file.

A: If you haven't successfully ran collectstatic then your static folder didn't update; explaining why you're receiving the Not Found error.
Update the error in your structure /home/user1/virtualenvironment/mysite/static


text:
Q: Go gorilla websocket write deadline I am unable to understand this part of the code which uses c.conn.SetWriteDeadline function.

    // Time allowed to write a message to the peer.
    writeWait = 10 * time.Second

    // Time allowed to read the next pong message from the peer.
    pongWait = 60 * time.Second

    // Send pings to peer with this period. Must be less than pongWait.
    pingPeriod = (pongWait * 9) / 10

// A goroutine running writePump is started for each connection. The
// application ensures that there is at most one writer to a connection by
// executing all writes from this goroutine.
func (c *Client) writePump() {
    ticker := time.NewTicker(pingPeriod)
    defer func() {
        ticker.Stop()
        c.conn.Close()
    }()
    for {
        select {
        case message, ok := <-c.send:
            // LOGIC TO WRITE MESSAGE TO THE CONNECTION
        case <-ticker.C:
            c.conn.SetWriteDeadline(time.Now().Add(writeWait)) //  ??
            if err := c.conn.WriteMessage(websocket.PingMessage, nil); err != nil {
                return
            }
        }
    }
}

I am unable to wrap my head around the ticket channel logic. What are we trying to achieve here?
I am referring to the official docks for go/gorilla/websocket here

A: From the SetWriteDeadline function documentation:
SetWriteDeadline sets the write deadline on the underlying network connection.
After a write has timed out, the websocket state is corrupt and
all future writes will return an error.
A zero value for t means writes will not time out.

So every ticker on the goroutine it is setting the write deadline to the current time plus whatever you have the writeWait const set to. The subsequent line then sends a ping message, with that deadline. This all happens on the ticker interval which is the const pingPeriod. The other go-routine, readPump(), should be setting a read deadline and handler for the pong message. This constant ping-pong keeps the connection alive according to the wait times you have set.


text:
Q: Comparing two text files printing result in new header Okay i will reupdate this
I have 2 files - File1.txt , File2.txt
File1 is base template
File2 is having status result
file1.txt
N1,N2,N3,N4,N5,N6
XX,ZZ,XC,EE,RR,BB
XC,CF,FG,RG,GH,GH

file2.txt
DF,GH,MH,FR,FG,GH,NA
XX,ZZ,XC,EE,RR,BB,OK

Below command compares column 1 in both files if it matches then it retrieves the value from 7th cell in file2 and appends in file1.txt as last column with new header.
if not found NA is updated .
Command used :
awk -F  '
  FNR==NR { a[$1]=$7; next }
  FNR==1  { print $0; len=length($0); next }
  {
    printf $0
    cont=(($1 in a) ? ","a[$1] : ",NA")
    for ( i=length($0)+1; i<=len-length(cont); i++)
      printf " "
    print cont
  }
'  file2.txt file1.txt > tmp &&

Day1 - After running above command
N1,N2,N3,N4,N5,N6,D1
XX,ZZ,XC,EE,RR,BB,OK
XC,CF,FG,RG,GH,GH,NA

Day 2 - After running above command
N1,N2,N3,N4,N5,N6,D1,D2
XX,ZZ,XC,EE,RR,BB,OK,OK
XC,CF,FG,RG,GH,GH,NA,NA

At Day3 i inserted a new row in File1 at bottom
N1,N2,N3,N4,N5,N6,D1,D2
XX,ZZ,XC,EE,RR,BB,OK,OK
XC,CF,FG,RG,GH,GH,NA,NA
DM,LC,VF,GR,GH,ES

now when i run above command on Day3 , i need output like this
N1,N2,N3,N4,N5,N6,D1,D2,D3
XX,ZZ,XC,EE,RR,BB,OK,OK,OK
XC,CF,FG,RG,GH,GH,NA,NA,NA
DM,LC,VF,GR,GH,ES,,,NA

A: This awk script seems to do the job:
awk -F, '
BEGIN   { OFS = FS }
FNR==NR { a[$1] = $7; next }
FNR==1  { n1 = n = NF + 1; $n = "D" (n-6); print; next }
        { $n1 = ($1 in a) ? a[$1] : "NA"; print }
' file2.txt file1.txt

OFS is the output field separator; FS is the (input) field separator.  Both are set to ,, FS by the -F option and OFS by the assignment.  This makes it easy to get the correct number of fields in the output.  awk's string concatenation with no operator, exemplified by "D" (n-6) is slightly weird; you get used to it, up to a point, but it still looks a little odd.
Example
The example run uses a program ow that has the synopsis:
ow file cmd …args…

It preserves the contents of the file by having the cmd …args… write to a temporary file, and if the command succeeds (exit status 0) and the output is not empty, it then preserves a copy of the original, ignores a number of signals, and then copies the temporary output over the original and cleans up.  It is rather useful — code at the bottom.  This is how I did my test.  Clearly, I could use tmp=$(mktemp tmp.XXXXXX); awk … file1.txt > $tmp; mv $tmp file1.txt instead, or something along those lines.  However, since I have ow, I use it.
$ cat file1.txt
N1,N2,N3,N4,N5,N6
XX,ZZ,XC,EE,RR,BB
XC,CF,FG,RG,GH,GH
$ ow file1.txt awk -F, '
> BEGIN   { OFS = FS }
> FNR==NR { a[$1] = $7; next }
> FNR==1  { n1 = n = NF + 1; $n = "D" (n-6); print; next }
>         { $n1 = ($1 in a) ? a[$1] : "NA"; print }
> ' file2.txt file1.txt
$ cat file1.txt
N1,N2,N3,N4,N5,N6,D1
XX,ZZ,XC,EE,RR,BB,OK
XC,CF,FG,RG,GH,GH,NA
$ ow file1.txt awk -F, '
> BEGIN   { OFS = FS }
> FNR==NR { a[$1] = $7; next }
> FNR==1  { n1 = n = NF + 1; $n = "D" (n-6); print; next }
>         { $n1 = ($1 in a) ? a[$1] : "NA"; print }
> ' file2.txt file1.txt
$ cat file1.txt
N1,N2,N3,N4,N5,N6,D1,D2
XX,ZZ,XC,EE,RR,BB,OK,OK
XC,CF,FG,RG,GH,GH,NA,NA
$ echo DM,LC,VF,GR,GH,ES >> file1.txt
$ ow file1.txt awk -F, '
> BEGIN   { OFS = FS }
> FNR==NR { a[$1] = $7; next }
> FNR==1  { n1 = n = NF + 1; $n = "D" (n-6); print; next }
>         { $n1 = ($1 in a) ? a[$1] : "NA"; print }
> ' file2.txt file1.txt
$ cat file1.txt
N1,N2,N3,N4,N5,N6,D1,D2,D3
XX,ZZ,XC,EE,RR,BB,OK,OK,OK
XC,CF,FG,RG,GH,GH,NA,NA,NA
DM,LC,VF,GR,GH,ES,,,NA
$

Note that as you assign to $i and i is larger than NF was, NF increases, and any missing fields are created as empty fields.
The first working version of this script had more complex logic, with a loop creating the empty fields, but since awk will do that automatically, the script simplified considerably.  You'll often find that with a bit of time and care, initial solutions can be simplified and cleaned up.
However, it is probably also relevant to point out that this code is very trusting.  It doesn't ensure that there are exactly 7 fields in file2.txt.  It doesn't check that each line in file1.txt has either the same number of fields as the first line in the file or exactly 6 fields.  If you supply screwy data in, you get screwy data out — the age-old GIGO principle: Garbage In, Garbage Out.
ow
:   "@(#)$Id: ow.sh,v 1.6 2005/06/30 18:14:08 jleffler Exp $"
#
#   Overwrite file
#   From: The UNIX Programming Environment by Kernighan and Pike
#   Amended: remove PATH setting; handle file names with blanks.

case $# in
0|1)    echo "Usage: $0 file command [arguments]" 1>&2
    exit 1;;
esac

file="$1"
shift
new=${TMPDIR:-/tmp}/ovrwr.$$.1
old=${TMPDIR:-/tmp}/ovrwr.$$.2

trap "rm -f '$new' '$old' ; exit 1" 0 1 2 15

if "$@" >"$new"
then
    cp "$file" "$old"
    trap "" 1 2 15
    cp "$new" "$file"
    rm -f "$new" "$old"
    trap 0
    exit 0
else
    echo "$0: $1 failed - $file unchanged" 1>&2
    rm -f "$new" "$old"
    trap 0
    exit 1
fi

Adding date instead of Dn to heading

Is it possible that awk can print a date in the header instead of D1?

If you want the current date added, you have two main options. One, using GNU gawk (often also installed as awk), then the time functions make it easy. Failing that, awk -v date=$(date +'%Y-%m-%d') -F, … has the system command date format a value and pass it into the awk script as variable date, which you can then print where you want it.  If you want arbitrary dates passed in, then the second mechanism is the one to use.
awk -F, -v date=$(date +'%Y-%m-%d') '
BEGIN   { OFS = FS }
FNR==NR { a[$1] = $7; next }
FNR==1  { n1 = n = NF + 1; $n = date; print; next }
        { $n1 = ($1 in a) ? a[$1] : "NA"; print }
' file2.txt file1.txt

That forces today's date into the command.  You can also do things prospectively or retrospectively, such as:
tmp=$(mktemp coladd.XXXXXXXXX)
trap "rm -f $tmp; exit 1" 0 1 2 3 13 15

for dd in $(seq 1 31)
do
    awk -F, -v date="2014-12-$dd" '
    BEGIN   { OFS = FS }
    FNR==NR { a[$1] = $7; next }
    FNR==1  { n1 = n = NF + 1; $n = date; print; next }
            { $n1 = ($1 in a) ? a[$1] : "NA"; print }
    ' file2.txt file1.txt > $tmp
    mv $tmp file1.txt
done

Given this extra flexibility, I'd recommend using the externally-defined date over GNU's internal date manipulating functions, but YMMV.


text:
Q: How does start-point work when checking out a new branch in git? Reading the docs, it looks like this command should give me a branch named cart pointing at the HEAD of upstream master:
git checkout -b cart upstream/master
However even though I had just done a pull from upstream master before running that command, after running that command, within the new branch, if I run git pull upstream master I get a slew of commits.
So, clearly my starting point was not what I thought it was.  Where am I going wrong?
Thanks!
Tom

A: Running git pull upstream master explicitly does not update any remote-tracking branches. This leaves your upstream/master branch alone and containing older data. If you run git fetch origin, then git checkout -b cart upstream/master, you should find that your new branch is up-to-date.


text:
Q: Trying to mask the text in a UIButton with a UIView Using iOS 13, swift 5.
Trying to mask the text in a UIButton so that I can do a gradual reveal. I created an extension, and managed to draw the view over the button, but cannot seem to work out how to mask the text shown.
This code for example clearly creates a UIView over the button, it looks like this.

Here is the code, an extension to UIButton
extension UIButton {
  func coverWord() {
    let frame = self.frame
    let hider = UIView(frame: CGRect(origin: CGPoint(x: 0, y: 0), size: CGSize(width: 32, height: 64)))
    hider.backgroundColor = UIColor.init(hue: 1, saturation: 1, brightness: 1, alpha: 1)
    self.addSubview(hider)
    self.bringSubviewToFront(hider)
}

Now I know that the UIView is over the button, cause I get no action if I touch the left hand side [red], but it works as expected if I touch the right side [white].
But how, do I get the stupid UIView to cover up the text. I tried creating a shape within the hidden UIView and adding to it with this code.
let layer = CAShapeLayer()
layer.path = UIBezierPath(roundedRect: CGRect(x: 0, y: 0, width: 32, height: 64), cornerRadius: 0).cgPath
layer.fillColor = UIColor.green.cgColor
layer.fillMode = .forwards
hider.layer.addSublayer(layer)

This works, only of course it doesn't. No it simply colors the [red] portion in green. I can still read the stupid text on the button.

A: Of course as soon as I posted this question the answer dawned on me. Rather than delete it I post it here for posterity :)
func showWord() {

  let sizer = self.frame.size
  let hider = UIView(frame: CGRect(origin: CGPoint(x: 0, y: 0), size: sizer))
  hider.backgroundColor = UIColor.white

  let sub = self.titleLabel
  sub!.addSubview(hider)
  sub!.bringSubviewToFront(hider)

  self.addSubview(hider)
  self.bringSubviewToFront(hider)

  UIView.animate(withDuration: 4, animations: {

    hider.alpha = 0
  }) { ( _ ) in
    hider.removeFromSuperview()
 }
}

The text in the UIButton is a UILabel within it. I need to add the UIView to it to hide the label AND to the button to mask the action when it is pressed.
There is a view in Xcode that shows you the sublayers. That is all I needed to do to figure the solution.
Here is a second version that acts like a pair of curtains, coloured in red and green for good measure.
func splitWord() {
  let sizer = self.frame.size
  print("sizer",sizer)
  let hider0 = UIView(frame: CGRect(origin: CGPoint(x: 0, y: 0), size:sizer))

  let hider1 = UIView(frame: CGRect(origin: CGPoint(x: 0, y: 0), size: CGSize(width: 18, height: 64)))
  let hider2 = UIView(frame: CGRect(origin: CGPoint(x: 18, y: 0), size: CGSize(width: 18, height: 64)))
  hider1.backgroundColor = UIColor.red
  hider2.backgroundColor = UIColor.green
  hider0.backgroundColor = UIColor.clear

  let sub = self.titleLabel
  let subs = sub?.frame.size
  print("sub",subs)
  sub?.insertSubview(hider1, at: 1)
  sub?.insertSubview(hider2, at: 2)
  self.insertSubview(hider0, at: 1)

  UIView.animate(withDuration: 4, animations: {
    hider1.center = CGPoint(x: -18, y: 0)
    hider2.center = CGPoint(x: 54, y: 0)
  }) { (_) in
    hider0.removeFromSuperview()
  }
}

Obviously the sizes shown here -18 and 54 are linked to the size of the label which says "next" in my case. Room for improvement I know, but its late here and time for bed.


text:
Q: Restricted access page not visible in IE( 8 and 7) problem with cookieDomain variable in typo3 FE Restricted access page works fine with Firefox, but in IE and chrome it not. Cookie domain is not set properly on IE. I come across with some patch , it not seems to be work.
My current localconf.php configuration is:
$TYPO3_CONF_VARS['SYS']['cookieDomain'] = 'www.domain.com';

i tried domain.com also.
i come across many bugs reported regarding this issue. http://bugs.typo3.org/view.php?id=11858
In google chrome also i am facing the same problem.
Non of the solution works for me.
What should be the configuration for cookie domain.

Typo3 Version: 4.4.9   PHP Version 5.2.6-1+lenny13

A: Your cookieDomain config is correct. A more stable and versatile version would look like this:
$TYPO3_CONF_VARS['SYS']['cookieDomain'] = $_SERVER['SERVER_NAME'];

This one also works in multi-website / multi-domain setups.
If you still experience problems, you should check the Set-Cookie header that is sent in the server response: Use FF with Add-on "Live HTTP headers" (LHh). First delete any existing cookies for your domain (Firefox: Tools –> Options –> Privacy –> remove individual cookies –> select all entries matching your domain –> hit "remove cookies"), now open the LHh window (tools menu, last entry), keep it open and open your website in FF. Then inspect the response that comes back from the server after the first GET request. It should start with
HTTP/1.1 302 Found

and should contain a line like this
Set-Cookie: fe_typo_user=abcdefghabcdefghabcdefghabcdefgh; path=/; domain=www.domain.com

Check whether the domain is the one that you are calling the website by and the path is root ("/").
If this is all correct, your login problem is probably not connected to the cookieDomain setting.


text:
Q: Implementar Mapa Globo Rajawali en un fragment Andriod Buenos días, tengo problemas con incorporar el mapa tierra en un  fragment android
Desde una actividad se realiza de esta manera:
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    final RajawaliSurfaceView surface = new RajawaliSurfaceView(this);
    surface.setFrameRate(60.0);
    surface.setRenderMode(IRajawaliSurface.RENDERMODE_CONTINUOUSLY);

    // Add mSurface to your root view
    addContentView(surface, new  ActionBar.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT));

    renderer = new Renderer(this);
    surface.setSurfaceRenderer(renderer);
}

Pero  cuando quiero hacerlo dentro de un fragment me da error la línea
addContentView(surface, new  ActionBar.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT));

Error:(81, 9) error: cannot find symbol method addContentView(RajawaliSurfaceView,LayoutParams)

A: Existe un problema al diferenciar Fragmento y Actividad, este mensaje de error:

cannot find symbol method addContentView()

indica que este método no existe.
Además la documentación es incorrecta, no puedes cargar el mapa desde un fragmento con (this) :
final RajawaliSurfaceView surface = new RajawaliSurfaceView(this);

Este es un ejemplo basico de Como cargar el mapa Rajawali3D  dentro de un Fragmento

Crea la Actividad, agregando la transacción del Fragmento, el Fragmento es cargado dentro del contenedor map_fragment, definido en el layout act_frag_map:
public class Map3DFragActivity extends AppCompatActivity {

    public RajawaliSurfaceView rajawaliTexture;
    Renderer renderer;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.act_frag_map);

        setFragment();

    }

    protected void setFragment() {
        FragmentManager fragmentManager = getSupportFragmentManager();
        Fragment mapFragment = new FragmentMap();
        FragmentTransaction ft =
                fragmentManager.beginTransaction();
        ft.add(R.id.map_fragment, mapFragment).commit();
    }

}

Este es el layout que contiene un fragmento, se agrega en la propiedad android:name el nombre de nuestra clase fragmento:
act_frag_map
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".FragmentExampleActivity" >

    <fragment
        android:id="@+id/map_fragment"
        android:name="com.test.FragmentMap"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
         />
</RelativeLayout>

Este es el Fragmento que crea el Mapa:
FragmentMap
import org.rajawali3d.surface.RajawaliSurfaceView;

public class FragmentMap extends Fragment {

    public RajawaliSurfaceView rajawaliTexture;
    Renderer renderer;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.activity_frag_map,
                container, false);

        rajawaliTexture = (RajawaliSurfaceView) view.findViewById(R.id.rajawali_surface);
        renderer = new Renderer(getActivity());
        rajawaliTexture.setSurfaceRenderer(renderer);

        return view;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState); // make sure this line exists

    }
}

activity_frag_map
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:surfaceview="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <org.rajawali3d.surface.RajawaliSurfaceView
        android:id="@+id/rajawali_surface"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        surfaceview:frameRate="60.0"
        surfaceview:renderMode="RENDER_WHEN_DIRTY"/>

</FrameLayout>


text:
Q: Can't set layout gravity for RelativeLayout programmatically Try #1: I am trying to set layout gravity for RelativeLayout programmatically.
    FrameLayout frameLayout = new FrameLayout(this);
    FrameLayout.LayoutParams frameLayoutParams = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
    frameLayout.setLayoutParams(frameLayoutParams);
    setViewPaddingInDp(frameLayout, 16, 16, 16, 16);

    RelativeLayout relativeLayout = new RelativeLayout(this);
    LinearLayout.LayoutParams relativeLayoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    relativeLayoutParams.gravity = Gravity.CENTER;
    relativeLayout.setLayoutParams(relativeLayoutParams);
    frameLayout.addView(relativeLayout);

    ImageView imageView = new ImageView(this);
    setViewWidthAndHeight(imageView, 128, 192);
    imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
    imageView.setImageResource(R.drawable.maxwell);
    relativeLayout.addView(imageView);

    setContentView(frameLayout);

This is what I am getting as result:

Try #2: I have tried set CENTER_IN_PARENT programmatically, but no result
RelativeLayout relativeLayout = new RelativeLayout(this);
        RelativeLayout.LayoutParams relativeLayoutParams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        relativeLayoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);
        relativeLayout.setLayoutParams(relativeLayoutParams);
        frameLayout.addView(relativeLayout);

Try #3: Also tried to set CENTER_HORIZONTAL, but no effect:
    RelativeLayout relativeLayout = new RelativeLayout(this);
    RelativeLayout.LayoutParams relativeLayoutParams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    relativeLayoutParams.addRule(RelativeLayout.CENTER_HORIZONTAL, RelativeLayout.TRUE);
    // relativeLayoutParams.addRule(RelativeLayout.CENTER_VERTICAL, RelativeLayout.TRUE);
    // relativeLayoutParams.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE);
    relativeLayout.setLayoutParams(relativeLayoutParams);
    frameLayout.addView(relativeLayout);

How to set layout gravity CENTER for RelativeLayout? I need to set gravity for RelativeLayout without changing FrameLayout or ImageView layout params.

A: Here is the fix, just verified myself. Working as required. The important part we were missing is imageViewParam.addRule(RelativeLayout.CENTER_HORIZONTAL);
FrameLayout frameLayout = new FrameLayout(this);
FrameLayout.LayoutParams frameLayoutParams = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
frameLayout.setLayoutParams(frameLayoutParams);
//setViewPaddingInDp(frameLayout, 16, 16, 16, 16);

RelativeLayout relativeLayout = new RelativeLayout(this);
RelativeLayout.LayoutParams relativeLayoutParams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
relativeLayoutParams.addRule(CENTER_IN_PARENT, TRUE);
relativeLayout.setLayoutParams(relativeLayoutParams);

frameLayout.addView(relativeLayout);

ImageView imageView = new ImageView(this);
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
params.addRule(RelativeLayout.CENTER_HORIZONTAL);
imageView.setLayoutParams(params);
// params.addRule(RelativeLayout.CENTER_IN_PARENT);
// params.addRule(RelativeLayout.CENTER_VERTICAL);
// setViewWidthAndHeight(imageView, 128, 192); // if you are using this method, then set the layout param accordingly
// imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
imageView.setImageResource(R.drawable.maxwell);

relativeLayout.addView(imageView);

setContentView(frameLayout);

A: Set MATCH_PARENT instead of WRAP_CONTENT to RelativeLayout like
RelativeLayout.LayoutParams relativeLayoutParams = new
RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT);

And set a RelativeLayout.LayoutParams to your ImageView
RelativeLayout.LayoutParams layoutParams =
(RelativeLayout.LayoutParams) imageView.getLayoutParams();
layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT,
RelativeLayout.TRUE);
imageView.setLayoutParams(layoutParams);


text:
Q: Writing specific values from list I come with a short question. I've wrote this part of code, where from an array of my data, values are saved when the condition below is fulfilled. Right now I'd like to narrow a little bit this condition and write a function, which will save only data above some value.
For e.g.
res >= 100.0.
res = [j for i, j, k in zip(lst, lst[1:], lst[2:]) if i < j and j > k]
with open("S:\Doc\Python\Data\Codes\BxHPF.txt", 'w') as Peak1:
    Peak1.write(str(res))
    Peak1.close()

A: Add the additional condition to the list comprehension.
res = [j for i, j, k in zip(lst, lst[1:], lst[2:]) if i < j and j > k and j >= 100.0]


text:
Q: jQuery push multiple values in input tag Input tags
<input id="user" type="text" name="user" class="form-control" />
<input id="user_id" type="hidden" name="user_id" value="" />

jQuery code to change value in hidden input when any user is searched
terms.push( ui.item.emp_id );
jQuery("#user_id").val(ui.item.emp_id);

Here emp_id is the userId passed from ajax response, so the input now looks like (12 is userID)
<input id="user_id" type="hidden" name="user_id" value="12" />

How can I push multiple values in input so that it look like below
<input id="user_id" type="hidden" name="user_id" value="12,13,14" />

Array being passed in json_encode
$array_pm[] = array('label' => $row['emp_name'],
                            'value' => $row['emp_name'],
                            'emp_id' => $row['emp_id']
                            );

My current script pushes only single value in hidden inpput, but how to push multiple values when user searches more than one record ?
Thanks.

A: Just before you set value to input store it in some temporary variable, append the value you want to store and set the value of input to this temporary variable eg.
var oldValue = jQuery("#user_id").val();
var arr = oldValue === "" ? [] : oldValue.split(',');
arr.push(ui.item.emp_id);
var newValue = arr.join(',');

jQuery("#user_id").val(newValue);

If the terms is the array you want to add to input, you can do something like this:
jQuery("#user_id").val(terms.join(','));

http://jsfiddle.net/9y2shao8/