text:
Q: React Lifecycle Events - Child Component Inherits Old State Props Im probably getting something not right with my understanding of states & props in React. This is using React, Redux based app.
Scenario:
I have a global SVG component, which gets the dimensions of the viewport from the app within the componentDidMount method.
The default (upon initialisation of the app) props of the SVG in the state are:
dimension : {
 width : 0,
 height : 0
}

The componentDidMount retrieves the width & height values from the DOM
and dispatches the values to the state.
Now I have a child component of SVG component, which needs the updated svg width & height values to calculate the default viewbox & update the state again. This needs to be executed only once upon mounting (important point), hence the calcuation of the viewbox is in the componentDidMount of the child component.
Whats Happening:
However, I guess because of React batch updating the DOM, the props passed to the child component are the default initial width & height values, not the updated state after SVG component's componentDidMount.
Question:
How can I pass the updated state to componentDidMount of the child component. Note:

*

*I cannot use componentDidUpdate, which would mean, that everytime the component is updated, it will calculate the default values & update the view again, thereby, over-riding the user position.

A: If you set the state in componentDidMount() than it will re-render the component.
If you want to use the props, you should work in componentWillReceiveProps(nextProps), that in the React life-cycle is called each time the component receave props from parent component.
That seems what you're trying to achieve so far.

A: What happens in your case is that before the componentDidMount of the parent component executes, your child component is rendered and hence it receives the default props. So the props that get updated in the componentDidMount of the parent will reflect in your child as the updated props
You can make use of componentWillReceiveProps function in the child component to set the state based on the updated props.
However this will be executed everytime the props get updated from the parent, so what you can do is that pass some prop from the parent which is being set with a particular value in the componentDidMount of parent and later has a diffrent value. Based on this props in componentWillReceiveProp you can set the initial state of the child component.


text:
Q: Microsoft Azure AD Connect Provisioning Agent error 5 I am getting this error. How I going to solve this. Some configurations are disabled and inactive. Please help me. Thank you.
Also when connecting the Microsoft Azure Active Directory Connect Provisioning Agent Configuration. Its say that error. Please see images.

A: Provisioning Agent cloud sync keeps track of the condition of your configuration and quarantines any unhealthy components. Whenever calls sent to the target system continually fail on invalid credentials.
To resolve this issue:
You can clear the quarantine and restart the provisioning job like below:

You can view additional details regarding the quarantine by selecting the status and the error code message also will display.
To restart provisioning job, click on your domain -> edit cloud sync configuration and -> Restart sync.

we encountered an unexpected error when registering the agent please try again

When you deploy the cloud provisioning agent, you may receive an error message. Generally, the agent's unable to implement the PowerShell registration scripts is what causes this issue.
Try to change PowerShell execution policies  make sure local machine and user policy should be RemoteSigned or Undefined
If still error persists you can repair the cloud sync service account using below cmd:

*

*Install AADCloudSyncTool Connect-AADCloudSyncTools , Enter credentials

*Run Repair-AADCloudSyncToolsAccount
Reference:
Azure AD Cloud Sync Highlights and Deployment (misconfig.io)

redpajama_set_name: RedPajamaStackExchange


text:
Q: I'm trying to add an external library to a Source mod, and I'm having some trouble I'm trying to add this Serial Communications library to the Source SDK code to try to integrate my own serial input into Steam games.  I've got the example projects on the Serial library I downloaded working fine.  I added the Serial project to the Source solution and gave the "Server (HL2)" project a dependency to it (I'm using Visual Studio 2013 Express).  I then went to my .cpp file under the Server (HL2) project and simply added
#include "Serial.h"
#define STRICT
#include <tchar.h>
#include <stdio.h>
#include <string.h>

which are the headers defined in the example project that was working for me, and got a lot of errors when I went to compile.  The errors are all along the lines of:
\serial.h(190): error C2065: 'CE_RXOVER' : undeclared identifier
\serial.h(191): error C2065: 'CE_RXPARITY' : undeclared identifier
\serial.h(193): error C2065: 'CE_TXFULL' : undeclared identifier
\serial.h(215): error C2061: syntax error : identifier 'LPCTSTR'
\serial.h(220): error C2146: syntax error : missing ';' before identifier 'Open'
\serial.h(220): error C2433: 'CSerial::LONG' : 'virtual' not permitted on data declarations
\serial.h(220): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
\serial.h(220): error C2061: syntax error : identifier 'LPCTSTR'
\serial.h(220): warning C4183: 'Open': missing return type; assumed to be a member function returning 'int'
\serial.h(223): error C2146: syntax error : missing ';' before identifier 'Close'
\serial.h(223): error C2433: 'CSerial::LONG' : 'virtual' not permitted on data declarations
\serial.h(223): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
\serial.h(223): warning C4183: 'Close': missing return type; assumed to be a member function returning 'int'
\serial.h(241): error C2146: syntax error : missing ';' before identifier 'Setup'
\serial.h(241): error C2433: 'CSerial::LONG' : 'virtual' not permitted on data declarations
\serial.h(241): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
\serial.h(244): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
\serial.h(244): warning C4183: 'Setup': missing return type; assumed to be a member function returning 'int'
\serial.h(250): error C2146: syntax error : missing ';' before identifier 'SetEventChar'
\serial.h(250): error C2433: 'CSerial::LONG' : 'virtual' not permitted on data declarations

They repeat and then...
\serial.h(361): error C2061: syntax error : identifier 'LPOVERLAPPED'
\serial.h(329): error C2065: 'm_lLastError' : undeclared identifier
\serial.h(345): error C2065: 'DCBlength' : undeclared identifier
\serial.h(345): error C2065: 'DCB' : undeclared identifier
\serial.h(345): error C2070: 'unknown-type': illegal sizeof operand

There's also a whole lot more "undeclared identifiers" where that came from.  I feel like there's a very obvious solution somewhere, either the way I have the solution set up or the linker or something.  But it finds the file, it's just not interpreting it correctly it seems.  When I take out
#include "Serial.h"

It compiles fine, so it has something to do with the way I'm adding that new header file.  Any help would be much appreciated.


text:
Q: Double loop for whois.py I'm using a dictionary with the id as the key and the names as the values. What I'm trying to do is get the names in the values that have the same name in them and put them in a list. Like for example with the name tim:
{'id 1': ['timmeh', 'user543', 'tim'], 'id 2': ['tim', 'timmeh', '!anon0543']}
whois_list = ['timmeh', 'user543', 'tim', '!anon0543']

The bot would append the names that are not in list yet. This is the code to execute this example:
def who(name):
    whois_list = []
    if not any(l for l in whois.whoisDB.values() if name.lower() in l):
        return 'No alias found for %s." % name.title()
    else:
        for l in whois.whoisDB.values():
            if name.lower() in l:
                for names in l:
                    if names not in whois_list
                        whois_list.append(names)
        return "Possible alias found for %s: %s" % (name.title(), whois_list)

The issue is: I do not want to have a double loop in this code, but I'm not really sure how to do it, if  it's possible.

A: A logically equivalent, but shorter and more efficient solution is to use sets instead of lists.
Your innermost for loop simply extends whois_list with every non-duplicate name in l. If you originally define whois_list = set([]) then you can replace the three lines of the inner for loop with:
whois_list = whois_list.union(l)

For example,
>>> a = set([1,2,3])
>>> a = a.union([3,4,5])
>>> a
set([1, 2, 3, 4, 5])

You'll notice a prints out slightly differently, indicating that it is a set instead of a list. If this is a problem, you could convert it right before your return statement as in
>>> a = list(a)
>>> a
[1, 2, 3, 4, 5]


text:
Q: Should I use arm7 or arm64 in info.plist when publishing to Apple App Store (iOS/iPad) Xcode has set arm7 as default when I started the project, but if I can recall, it should be arm64? Or do I remember wrong?
(info.plist > Required device capabilities > Item 0)

A: As far as I have understood, armv7 is only relevant to filter out some 32 bit devices if you want your app to support the older Apple devices. From iOS 11, only 64bits applications are allowed to be installed from the Apple App Store, so if you do not target any earlier iOS versions, its safe to put the Item 0 on arm64.


text:
Q: Hello, can somebody help me making a checkbox to be mandatory in my shopify checkout page? I have dawn them I have to make a required / mandatory checkbox so when my clients go to the cart page they have to agree with my terms and conditions before proceeding to the checkout page
I was able to put the checkbox right next to the "checkout" button but I cannot make it required

A: You will have to have shopify-plus package in order to make changes inside checkout page. so when you will have shopify-plus admin access,

*

*Go to storefront code editor(shopify's code editor)

*Open checkout.liquid named layout and use jQuery to make condition that
if ($('input[name=className]:checked')) {
$('#id').show(); // show proceeding to the checkout HTML
}


text:
Q: how do I re-write/redirect URLs in Gunicorn web server configuration? I'm building a Django-based app, and I need it to use secure requests. The secure requests in my site are enabled and manually writing the url gets it through fine.
As I have quite a lot of urls I don't want to do it manually, but instead do something so Django always sends secure requests.
How can I make it so it always send https?


text:
Q: No style for results of my JavaScript quiz, why? I produced this psychological test:

Q1: What do you think about XYZ?

<input type="radio" name="group1" id="A1"> Agree strongly

<input type="radio" name="group1" id="E1"> Disagree very much

Q1: What do you think about ABC?

<input type="radio" name="group2" id="A2"> Agree strongly

<input type="radio" name="group2" id="E2"> Disagree very much

<button onclick="myFunction()">GET RESULTS</button>

When "GET RESULTS" button is clicked results are displayed properly but there is no CSS style applied. What can I do to make results appear on a styled page? Thank you!

A: Because you used document.write.
When you use document.write the entire document, head, body, everything is replaced by whatever you write. Therefore you need to recreate a complete document if you use it.
The standard advise applies: never use document.write(). Learn about innerHTML instead (after that read the rest of the DOM API).


text:
Q: When I use CListView widget in YII the fontsize of my whole website changes. (I use flowtype for fontscaling) When I use my CListView Widget in a page the fontsize of my whole website changes. I use flowtype to scale my fonts and keep everything responsive. Only when I use this widget everything changes, nog only the data of the widget itself.
I tried to turn the css styling of the widget of and tried to control it via an own css file, but this doesn't matter.
<?php $this->widget('zii.widgets.CListView', array(
    'dataProvider'=>$dataProvider,
    'itemView'=>'_view',
    'cssFile'=>false,
)); ?>

The content of the view I'm calling doesn't matter either. Only when I remove the widget and put some text instead it changes back to normal.
Does someone have any idea what's happening here?

A: Quoted from official documentation for ClistView

cssFile property
public string $cssFile;
the URL of the CSS file used by this list view. Defaults to null,
  meaning using the integrated CSS file. If this is set false, you are
  responsible to explicitly include the necessary CSS file in your page.

Follow it, when you used CListView, default css .../listview/style.css file would be imported into your page, it could change your current layout if some of css is coincided with each other.
You can override it
 $this->widget('zii.widgets.CListView', array(
     'cssFile' => 'your-css-file-path.css',
      ...
      )

A: So, eventually tried to copy the parsed code from the page source into my view. So in pagecode this was exactly the same output as the widget does in the page. Now I didn't had the resizing problem. So the widgets do something more then I can see.
For the solution I wrote an own widget to get my data in which I can control everything that happens. So no problem left anymore. Thanks for your help Telvin!


text:
Q: How to display a report in IFrame in CRM, when CRM is in offline mode (all network connections are disabled)? I have created a SSRS report and uploaded it to report server. On my Opportunity product form I am using a IFrame to display this report.
I am passing parameters to this report by checking " Pass record object-type code and unique identifier as parameters " checkbox on iframe.
Iframe is displaying report as i wish in online mode only. When I changed the crm to offline mode and disabled all the network connections, IFrame is not displaying report, it's giving me error message "Internet explorer cannot display the web page". How can I display the report in CRM offline mode with all network connections disabled?

A: Obviously you're not going to reach the report server if you can't access it.  I would check in your form load script whether you are online or offline and then give an appropriate message that the report can't be displayed.


text:
Q: pandas concat two column values which do not have headers Attached is the data file.
In the Department column (column 4), the last column, there are values that have been split into additional columns. The data should only have 4 columns.
How can I join the data in columns 4 and up via Pandas?
CSV RAW DATA FILE

A: A quick fix could be to name columns 5 and 6 and then address the value via column4 + column5 + column6.


text:
Q: Jquery validation not working on IE 8 I am attempting to implement Jquery validation using this plugin.
I have seen these three links pertaining to this problem: Link 1, Link 2, Link 3
Validation works perfectly on all other browswers, ie Firefox, Chrome, Safari and mobile devices.
I have tried using different JQuery versions, 1.9.0, 1.1.0.2 and 1.5.2.
I am using the latest validation 1.11.1.
I ensured my code is wrapped in DOM ready.
Not sure what I may be overlooking, any help/assistance appreciated.  Please tell me if you would like me to include html.
My code:
$.validator.setDefaults({
    submitHandler: function() { alert("Report submitted! Thank you!"); }
});

$(document).ready(function() {
    //validate on keyup
    $("#testForm").validate({
        rules: {
            fullname: {
                required: true,
                minlength: 2
            },
            phone: {
                required: true,
                rangelength: [10, 10]
            },
            building: {
                required: true,
                minlength: 2
            },
            room: {
                required: true,
                minlength: 2
            },
            around: {
                required: true,
                minlength: 10
            },
            email: {
                required: true,
                email: true

            },
            desc: {
                required: true,
                minlength: 15
            },
        } // <------- LINE 228
        messages: {
            fullname: {
                required: "Please enter your full name.",
                minlength: "Your fullname must consist of at least 2 characters."
            },
            phone: {
                required: "Please enter a valid 10 digit phone number.",
                rangelength: "Please enter a valid 10 digit phone number."
            },
            email: "Please enter a valid email address."
        }
    });
});

IE Error given:
Expected identifier, string or number
Line: 228, Char:3

I currently have the site hosted locally with XAMPP.
I have found the site will give no errors in IE if:
I navigate to localhost or opening html file directly.

Will not work:
navigate to //computername or 127.0.0.1

A: Your code...
    ....
        desc: {
            required: true,
            minlength: 15
        },
    } // <------- LINE 228
    messages: {
    ....

You're missing the comma on line 228...
$(document).ready(function() {
    $("#testForm").validate({
        rules: {
            // rules,
            desc: {
                required: true,
                minlength: 15
            }                       // <-- the "trailing comma" was here
        }, // <------- LINE 228     // <-- you MUST have a comma here
        messages: {
            // messages
        }
    });
});

A: The same problem happened to me
jQuery has removed support of IE8 and older from jQuery 2.0.  Try to use on older version of jQuery - something 1.9x as an example.
Make sure to check the documentation of the plugin before using it.  The plugin may not be supported with the version of jQuery you are using


text:
Q: Implementing Gradcam on Siamese network? I am a beginner in deep learning and I am experimenting on siamese networks. I learnt that we can visualize any CNN network using grad cam. I want to visualize how the network is working using grad cam but I could not find any implementations related to that on the web and couldn't code it on my own too for siamese network. Can anyone help me out?
This is the network I created but don't know how to use grad cam to visualize it.
Thank you
class SiameseNetwork(nn.Module):
    def __init__(self):
        super(SiameseNetwork, self).__init__()
        self.cnn1 = nn.Sequential(
            nn.ReflectionPad2d(1),
            nn.Conv2d(1, 4, kernel_size=3),
            nn.ReLU(inplace=True),
            nn.BatchNorm2d(4),

            nn.ReflectionPad2d(1),
            nn.Conv2d(4, 8, kernel_size=3),
            nn.ReLU(inplace=True),
            nn.BatchNorm2d(8),

            nn.ReflectionPad2d(1),
            nn.Conv2d(8, 8, kernel_size=3),
            nn.ReLU(inplace=True),
            nn.BatchNorm2d(8),

        )

        self.fc1 = nn.Sequential(
            nn.Linear(8*200*200, 500),
            nn.ReLU(inplace=True),

            nn.Linear(500, 500),
            nn.ReLU(inplace=True),

            nn.Linear(500, 5))

    def forward_once(self, x):
        output = self.cnn1(x)
        output = output.view(output.size()[0], -1)
        output = self.fc1(output)
        return output

    def forward(self, input1, input2):
        output1 = self.forward_once(input1)
        output2 = self.forward_once(input2)
        return output1, output2


text:
Q: Block select all everywhere except in inputs I'm writing an Electron app with an Angular renderer and want to disable keyboard shortcuts like select all (Ctrl+A), but still want to be able to select all in inputs/textareas.
So first I have this in my Angular main.js to disable the keyboard shortcut:
document.onkeydown = function(e: KeyboardEvent) {
  if (e.ctrlKey && e.code === "KeyA") {
    return false;
  }
};

and then I want to make individual exceptions for specific inputs/textareas in my component something like this:
Template:
<textarea (keydown)="rejectInput($event)"></textarea>

Component:
public rejectInput(event: KeyboardEvent) {
  if (event.ctrlKey && event.code === "KeyA") {
    // Opposite of event.preventDefault() or something...
  }
}

I want to do the same for Ctrl+C to be able to copy the text in the inputs as well.
Can this be achieved somehow? Am I on the right track or thinking entirely wrong?


text:
Q: I can't login with facebook in laravel socialite , where it works for google and github the error it shows when i click to login:
    Error message from facebook, i think
Error it Shows
GuzzleHttp\Exception\ClientException
Client error: `POST https://graph.facebook.com/v3.3/oauth/access_token` resulted in a `400 Bad Request` response: {"error":{"message":"Can't load URL: The domain of this URL isn't included in the app's domains. To be able to load this (truncated...)
http://socialite.com/login/facebook/callback?error_code=1349187&error_message=Insecure%20Login%20Blocked%3A%20You%20can%27t%20get%20an%20access%20token%20or%20log%20in%20to%20this%20app%20from%20an%20insecure%20page.%20Try%20re-loading%20the%20page%20as%20https%3A%2F%2F


text:
Q: Derived Class Deserialization I have a problem with deserialization with my logic simulation program.
Here are my element classes:
public class AndGateData : TwoInputGateData
{

}

public class TwoInputGateData : GateData
{
    public TwoInputGateData()
    {
        Input2 = new InputData();
        Input1 = new InputData();
    }
    public InputData Input1 { get; set; }
    public InputData Input2 { get; set; }
}

public class GateData : ElementData
{
    public GateData()
    {
        OutputData = new OutputData();
    }

    public OutputData OutputData { get; set; }
}

public class ElementData
{
    public int Delay { get; set; }
    public Guid Id { get; set; }
}

And here are classes responsible for sockets:
public class InputData : SocketData
{

}

public class SocketData
{
    public Guid Id { get; set; }
    public SignalData SignalData { get; set; }
}

SignalData is not important here. So, I won't write it (in order to keep this question clean) here unless somebody says it is necessary.
CircuitData is very important:
[XmlRoot("Circuit")]
public class CircuitData
{
    [XmlElement(typeof(AndGateData))]
    [XmlElement(typeof(OrGateData))]
    public List<ElementData> elements = new List<ElementData>();
    public List<WireData> wires = new List<WireData>();
    public void AddElement(ElementData element)
    {
        elements.Add(element);
    }
    public void AddWire(WireData wire)
    {
        wires.Add(wire);
    }
}

Wires are not important right now.
Now, I have written some Serialization:
public class CircuitDataWriter
{
     public static void Write(object obj, string fileName)
     {
         var xmlFormat = new XmlSerializer(typeof(CircuitData));
         using(Stream fStream = new FileStream(fileName, FileMode.Create, FileAccess.Write, FileShare.None) )
         {
             xmlFormat.Serialize(fStream,obj);
         }
         Console.WriteLine("Circuit saved in XML format.");
     }

}

It works just like I wanted, it produces that xml document:
<?xml version="1.0"?>
-<Circuit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
-<AndGateData>
<Delay>10</Delay>
<Id>bfee6dd7-5946-4b7b-9d0b-15d5cf60e2bf</Id>
-<OutputData> <Id>00000000-0000-0000-0000-000000000000</Id> </OutputData>
-<Input1> <Id>7c767caf-79a9-4c94-9e39-5c38ec946d1a</Id> <SignalData xsi:type="SignalDataOn"/> </Input1>
-<Input2> <Id>d2cad8f8-8528-4db3-9534-9baadb6a2a14</Id> <SignalData xsi:type="SignalDataOff"/> </Input2>
</AndGateData>
<wires/>
</Circuit>

But I have problem with my DESERIALIZATION. Here is the code:
public static CircuitData Read()
{
    var reader = new XmlSerializer(typeof(CircuitData));
    StreamReader file = new StreamReader("Circuit.xml");
    var returnCircuitData = new CircuitData();
    returnCircuitData = (CircuitData) reader.Deserialize(file);
    return returnCircuitData;
}

Now, it deserializes my Circuit.xml to object, but this object only contains Id and Delay, it does not contain Input1, Input2 or Output. So, it is treated like Element, not like AndGate. I tried to solve it out for a day but it seems that no one has that kind of problem.

A: I have a suggestion for you, make the Write method generic like this and create the serializer using objectToSerialize.GetType():
public static void Write<T>(T objectToSerialize, string fileName)
{
    var xmlSerializer = new XmlSerializer(objectToSerialize.GetType());
    ...
}

The XmlSerializer.Deserialize() method returns object, you can make your Read method generic like this:
public static T Read<T>(string fileName)
{
    var serializer = new XmlSerializer(typeof(T));
    using (StreamReader file = new StreamReader(fileName))
    {
        return (T)serializer.Deserialize(file);
    }
}

Other than that you might want to read about:

*

*XmlInclude that is used when you serialize derived classes.

*XmlArray and XmlArrayItem that are used for controlling serialization of arrays


text:
Q: API Connection Limit for R I am using R to make a simple prediction model, and I am using "Jug" package to run a hosted service which provides me with predictive output.
Code is below:
library(randomForest)
library(jug)

#***************************************************************************************************#
#*                   BUILDING THE RANDOM FOREST MODEL                                        *#
#***************************************************************************************************#

mpg_fit<-randomForest(mpg~disp+wt+hp, mtcars)

saveRDS(mpg_fit, "mpg_fit.Rdata")

pg_fit<-readRDS("mpg_fit.Rdata")

#***************************************************************************************************#
#*         CREATING A FUNCTION THAT WILL PREDICT BASED ON THE PARAMETERS                           *#
#***************************************************************************************************#

predict_mpg<-function(disp, wt, hp){
  new_data<-data.frame(disp=as.numeric(disp),
                       wt=as.numeric(wt),
                       hp=as.numeric(hp))
  predict(mpg_fit, newdata = new_data)
}

#***************************************************************************************************#
#*         HOSTING THE PREDICTION FUNCTION AS A WEB SERVICE                       *#
#***************************************************************************************************#

jug() %>%
  post("/mpg_api", decorate(predict_mpg)) %>%
  simple_error_handler() %>%
  serve_it()

The service/API runs great and returns the value when the following is used:
 curl -s --data "disp=160&wt=2620&hp=110" http://127.0.0.1:8080/mpg_api

This returns:
18.9758366666667

What I wanted to know is:

*

*How scalable is this package, that is how many concurrent request can this handle if I am running this on my server.

*Can this be used in production assuming I took care of the security aspect of it.

*I know that Azure machine learning and predictionIO does the same, but with Jug I can control everything

I tired to read about this in the documentation of Jug but did not find my answer. If you have a better method to do the same I am eager to know.


text:
Q: Delete items from ListBox in WPF? I am trying to delete items from listbox which is data bound.
Here is the screenshot how listbox look like.

This is the code which adds items in lists.
    public class Task
    {
        public string Taskname { get; set; }

        public Task(string taskname)
        {
            this.Taskname = taskname;
        }
    }

    public void GetTask()
    {
        taskList = new List<Task>
                           {
                               new Task("Task1"),
                               new Task("Task2"),
                               new Task("Task3"),
                               new Task("Task4")
                           };

        lstBxTask.ItemsSource = taskList;
    }

This is the Xaml code,
 <ListBox x:Name="lstBxTask" Style="{StaticResource ListBoxItems}" >
        <ListBox.ItemTemplate>
            <DataTemplate>
                <StackPanel Orientation="Horizontal">
                    <TextBlock Text="{Binding Taskname}"  Style="{StaticResource TextInListBox}"/>
                    <Button Name="btnDelete" Style="{StaticResource DeleteButton}" Click="btnDelete_Click">
                    </Button>
                </StackPanel>
            </DataTemplate>
        </ListBox.ItemTemplate>
    </ListBox>

Whenever item in a listbox is selected, delete (x) button is displayed. When clicked it should delete that item from the listbox. Can anyone tell me how can I do this?

A: Try using an ObservableCollection<T> instead of a simple List<T>.
The ObservableCollection<T> will notify the WPF-binding-system whenever its content has changed. Therefore, you will only have to remove the item from the list and the UI will be updated.

A: ok this is what i did. Observablecollection worked like charm.
private ObservableCollection<Task> taskList;

public void GetTask()
        {
            taskList = new ObservableCollection<Task>
                               {
                                   new Task("Task1"),
                                   new Task("Task2"),
                                   new Task("Task3"),
                                   new Task("Task4")
                               };

            lstBxTask.ItemsSource = taskList;
        }

 private void btnDelete_Click(object sender, RoutedEventArgs e)
        {
            var button = sender as Button;
            if (button != null)
            {
                var task = button.DataContext as Task;

                ((ObservableCollection<Task>) lstBxTask.ItemsSource).Remove(task);
            }
            else
            {
                return;
            }
        }


text:
Q: VBA Application Defined or Object-Defined Error with Formula I'm trying to use the following formula, but am getting the error application defined or object defined error. I have a feeling it's due to the line break, but it looks good to me.
ActiveCell.FormulaR1C1 = _
        "=IF(AND(R[1]C[-13]=RC[-13],R[1]C[-15]=RC[-15]),IF(AND(R[1]C[-8]=RC[-8],R[1]C[-3]<>RC[-3]),IF(AND(R[2]C[-8]=R[1]C[-8],R[2]C[-3]<>R[1]C[-3]),IF(AND(R[3]C[-8]=R[2]C[-8],R[3]C[-3]<>R[2]C[-3]),IF(AND(R[4]C[-13]=R[3]C[-13],R[4]C[-15]=R[3]C[-15]),"""",RC[-3]),IF(AND(R[3]C[-13]=R[2]C[-13],R[3]C[-15]=R[2]C[-15]),"""",RC[-3]))," & _
        "IF(AND(R[2]C[-13]=R[1]C[-13],R[2]C[-15]=R[1]C[-15],"""",RC[-3])),""""),IF(RC[-3]="""","""",RC[-3]))"


text:
Q: Return the index of the deselected item of a list box? I'm aware of finding the index of the item selected but how would i go about finding the item that was deselected? I have a list box that has mutli select and checkbox option. When I deselect a item, I want to know the index of it.
Here's my code to get index of selected.
Private Sub ListBox1_Change()
Dim lItem, indexNum As Long
For lItem = 0 To Me.ListBox1.ListCount - 1
    If Me.ListBox1.Selected(lItem) Then
        indexNum = lItem + 1
    End If
Next lItem
End Sub

A: Something like this would work:
Private Sub ListBox1_Change()
Dim lItem, indexNum As Long
For lItem = 0 To Me.ListBox1.ListCount - 1
    If Me.ListBox1.Selected(lItem) Then
        indexNum = lItem + 1
    Else
        indexNum = lItem + 1
        deselected = indexNum
        MsgBox deselected
    End If
Next lItem
End Sub

If it is selected, it sums. Otherwise, it adds a new one but do the thing you want (In my case msgbox)
Remember to stop the code with a exit for if you only need the first deselected item. On my example I had a list with 5 items. If I selected all of them, nothing happened. If I then selected the first one, it would give me 2, 3, 4, and 5 on msgboxes


text:
Q: GAS Add-on, onOpen function running continuously? I have two Google Sheets add-ons that I have written for private use by users in my domain. Both add-ons use the onOpen function to generate a menu in Sheets. Both are written with the standard format provided in the Google Developers documentation. An example of the code for the menu is below. Note that no triggers are installed in any portion of my script.
function onOpen(e) {
  var ui = SpreadsheetApp.getUi();
  ui.createAddonMenu()
    .addItem('1⃣ Authorize', 'authFunction')
    .addItem('2⃣ Format Sheet', 'ResetDataHTML')
    .addSubMenu(ui.createMenu('3⃣ Type & Clean Up')
      .addItem(' Set Trip type', 'setTripType')
      .addItem(' Remove & Set Count', 'deleteNoTrans'))
    .addItem('4⃣  Email to Transportation', 'emailSheetNote')
  .addToUi();
  return;
}

The add-ons both function properly. The "problem" I am noticing is when viewing the Execution Logs in the new IDE. For one add-on the onOpen function is constantly running/completing at an interval of about 1-3 seconds. The other add-on seems to run the onOpen function at intervals of about 20-30 minutes. My question is, "why would these add-ons continue to run the onOpen function? Am I noticing normal behavior or is this abnormal? (I have not noticed this behavior with any other script that uses the onOpen function.)
Thank you to anyone that might have some insight as to my issue.

A: Yes. Every time you or the other users visit or refresh the sheet, it does trigger the onOpen trigger thus possibly showing in your execution logs multiple times. Don't worry about it as that is entirely normal.


text:
Q: Can't get images into proper container. Images stacked, divs out of order? I'm a visual designer, so this may seem a silly question (and at one point, this wasn't broken!) but I'm stuck. I'm trying to get images to appear in a responsive row with a mouseover.
Can anyone help? I know the code is jacked; I've been struggling with the order of the divs. The mouseover is working, BUT the images are now stacking and aren't appearing in a row anymore. They're outside of the col-lg-4 container, but I've included that. What am I missing?
*image is FPO
/// HTML:

LOREM IMPSUM DOLAR

The fox and the rabbit.

                            <figcaptions>
Please let this work
</figcaptions>

                            <figcaptions>
Please let this work
</figcaptions>

/// JSFiddle:
http://jsfiddle.net/zvcNa/

A: This is due to your padding: 30px 40px; for figcaptions{}.
figcaptions is 100% width and height, but add your padding to this size.
Remove this padding and add it to your figcaptions children :
figcaptions h4{
    padding:30px;
}

FIDDLE
EDIT #1:
Replaced :
figure {
    display: block;
    position: relative;
}

.col-lg-4 {
    display:block;
    float:left;
  }

FIDDLE


text:
Q: Semigroup with exactly one left(right) identity? Are there any examples of a semigroup (which is not a group) with exactly one left(right) identity (which is not the two-sided identity)? Are there any "real-world" examples of these (semigroups of some more or less well-known mathematical objects) or they could only be "manually constructed" from abstract symbols (a, b, c…) subject to operation given by a Caley table?

A: Take the semigroup $S = \{a, b, 0\}$ with $a^2 = a$, $ab = b$ and every other product equal to $0$. Then $a$ is a left identity (since $ax = x$ for all $x \in S$) but it is not an identity (since $ba = 0$). You can define this semigroup in three other equivalent ways:
(1) As a transformation semigroup on $\{1, 2, 0\}$. Just take the semigroup generated by $a = [1, 0, 0]$ and $b = [2, 0, 0]$.
(2) As a semigroup of matrices. Just take $a = \pmatrix{1 & 0\\ 0 & 0}$, $b = \pmatrix{0 & 1\\ 0 & 0}$ and $0 = \pmatrix{0 & 0\\ 0 & 0}$.
(3) As the syntactic semigroup of the regular language $a^*b$ [or as the transformation semigroup of its minimal automaton, which is just (1)].

A: Consider for example the semigroup consisting of all constant functions on a set $X$ [acting on the right], together with one non-constant idempotent function $f$ (for example, let $f$ fix some point $x\in X$ and send every other point to some $y\neq x$).  Then $f$ is a unique left identity, and $f$ is not a right identity.
In general I think it's probably helpful to think about this question in terms of transformation semigroups.
EDIT:  Since this question has been sitting around with no accepted answer for a while, I'll state my last sentence a bit more strongly:  You can determine exactly which transformation semigroups have a single left (or right) identity, and since every semigroup is isomorphic to a transformation semigroup, doing this will give you all examples.
[Although I just noticed that the OP hasn't been on this site for about a month, so I guess the question might remain 'unanswered'.]

A: Take a finite semigroup $S$. Then $S$ has an idempotent element $e$ since $S$ is finite.
Let $T = \{se : s \in S\}$. Then $T$ is a subsemigroup of $S$. We have $e \in T$ because $e = ee$. And $e$ is a right identity of $T$ since $(se)e = s(ee) = se$ for all $s \in S$.
My problem with this example is that I don't think $e$ is the only right identity of $T$ for every such $T$ and this is probably still not real world enough.
I believe if we give more conditions when we construct $T$, we might be able to get a semigroup with only one right identity. But, it may not be a real example for OP.


text:
Q: Is there a (documented) way to get attributes from the data point library via API? In cumulocity cockpit you can specify data point attributes like a display name, unit, value range etc in a so called "data point library". I wonder how I can use these attributes when developing custom dashboard widgets.
I figured out that there is a fragmentType c8y_Kpi for API requests and a class called c8yKpi in the JS client lib which provides all necessary functions. It works fine in my custom widets, but the API/JS class are not documented.
Is there any (official, documented, supported) way to request attributes from the "data point library" via API or JS client library?

A: These kind of "internal" structures are not documented officially but like you already did you can of course use them in your code.
The risk coming with using undocumented structures are that they might change and then you would need to adapt your code.
Like you already found out yourself the way to get them on API is to call inventory with fragmentType=c8y_Kpi
/inventory/managedObjects?fragmentType=c8y_Kpi

A: No: currently there is no official, documented and support API for accessing the data point library.


text:
Q: How to add the Chi-square effect size Cramer's V in the summary table using R package "gtsummary"? Question
I am working with a gtsummary table that includes statistical tests for both means and frequencies. I want to include effect sizes to the table and came across this post which shows how to do it for Wilcox test effect size. The code also works for Cohen's d, but I am struggling to modify it for Cramer's V. It seems the cramer_v() function needs to call a ready-made contingency table, rather than working with raw data. Is there any way to calculate and include Cramer's V for the chi-square in the gtsummary table?
Example
library(tidyverse)
library(rstatix)
library(gtsummary)
theme_gtsummary_mean_sd()

my_ES_test <- function(data, variable, by, ...) {
  rstatix::cohens_d(data, as.formula(glue::glue("{variable} ~ {by}")))$effsize
}

gtTable <- mtcars %>%
  select(hp, vs, am) %>%
  tbl_summary(by = vs) %>%
  add_p() %>%
  add_stat(fns = all_continuous() ~ my_ES_test) %>%
  modify_header(add_stat_1 ~ "Effect size")
print(gtTable)

contTable <- table(mtcars$vs, mtcars$am)
chisq.test(contTable, correct = FALSE)
#>
#>  Pearson's Chi-squared test
#>
#> data:  contTable
#> X-squared = 0.90688, df = 1, p-value = 0.3409
cramer_v(contTable)
#> [1] 0.1042136

A: I added an example including Cramer's V in the output table. Happy Programming!
library(gtsummary)

my_ES_test <- function(data, variable, by, ...) {
  rstatix::cohens_d(data, as.formula(glue::glue("{variable} ~ {by}")))$effsize
}
my_cramer_v <- function(data, variable, by, ...) {
  table(data[[variable]], data[[by]]) %>%
    rstatix::cramer_v()
}

gtTable <-
  mtcars %>%
  select(hp, vs, am) %>%
  tbl_summary(by = vs) %>%
  add_p() %>%
  add_stat(
    fns = list(all_continuous() ~ my_ES_test,
               all_categorical() ~ my_cramer_v)) %>%
  modify_header(add_stat_1 ~ "**Effect size**")

Created on 2021-09-07 by the reprex package (v2.0.1)
FYI, there is built-in support for Cohen's D so you don't need to create a custom method. You can see a complete list here https://www.danieldsjoberg.com/gtsummary/reference/tests.html


text:
Q: CMake generated source is not compiled I added code to generate a file using the MOC executable from QT. When I try to build it, the file is generated, but it doesn't get compiled.
find_program (QT_UIC uic)
find_program (QT_MOC moc)

set(TARGET_LIBRARY support_qt_${UNICODE_FLAG}${STATIC_FLAG}${BUILD_TYPE_FLAG})

# Enable the build directory as an include path as well, required for
# qt moc generated files.
set(CMAKE_INCLUDE_CURRENT_DIR ON)

find_package(Qt5Widgets REQUIRED)
find_package(Qt5Core REQUIRED)
find_package(Qt5Gui REQUIRED)

include_directories(${Qt5Widgets_INCLUDES})
include_directories("..")

set(SUPPORT_SOURCE
    ${CMAKE_CURRENT_SOURCE_DIR}/support_qt_dll_api.h
    ${CMAKE_CURRENT_SOURCE_DIR}/supportlib_qt_namespace.h
    ${CMAKE_CURRENT_SOURCE_DIR}/dll_main.cpp
)

if (STATIC_BUILD)
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBUILD_SUPPORT_QT_STATIC")
else (NOT STATIC_BUILD)
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBUILD_SUPPORT_QT_DLL")
endif()

if (UNICODE_BUILD)
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUNICODE")
endif()

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -pedantic -Wextra")

set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3")

add_subdirectory (logging)
add_subdirectory (models)
add_subdirectory (window)

#QT5_WRAP_UI(QT_UI_HEADERS ${QT_UI_SOURCES} )

# Process each .ui file and create a dependency to the
# the corresponding .h file.
set(GENERATED_SOURCES "")
foreach(ui_file ${SUPPORT_SOURCE})
    get_filename_component(ui_ext ${ui_file} EXT)
    string(TOLOWER ${ui_ext} ui_ext)

    set(ui_dependency "")
    string(REPLACE "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" ui_gen_file ${ui_file})
    if( ${ui_ext} STREQUAL ".ui" )
        string(REGEX REPLACE ".ui$" ".h" ui_gen_file "${ui_gen_file}")
        add_custom_command(
            #PRE_BUILD
            OUTPUT "${ui_gen_file}"
            COMMAND ${QT_UIC} -g cpp -o "${ui_gen_file}" "${ui_file}"
            MAIN_DEPENDENCY "${ui_file}"
            COMMENT "Generating UI: ${ui_gen_file}"
        )

        # A .ui File always has a .moc file with it.
        string(REGEX REPLACE ".h$" ".moc" ui_gen_file "${ui_gen_file}")
        set(ui_ext ".moc")
    endif()

    if( ${ui_ext} STREQUAL ".moc" )
        string(REGEX REPLACE ".moc$" ".cpp" ui_gen_file "${ui_gen_file}")
        set(GENERATED_SOURCES "${GENERATED_SOURCES} ${ui_gen_file}")
        add_custom_command(
            #PRE_BUILD
            OUTPUT "${ui_gen_file}"
            COMMAND ${QT_MOC} -o "${ui_gen_file}" -f "${ui_file}" "${ui_file}"
            MAIN_DEPENDENCY "${ui_file}"
            COMMENT "Generating MOC: ${ui_gen_file}"
        )

        set(GENERATED_SOURCE "${GENERATED_SOURCE} ${ui_gen_file}")
        #message("Generated: ${ui_gen_file}")
    endif()

endforeach()

set_source_files_properties(${GENERATED_SOURCES} PROPERTIES GENERATED TRUE)
add_library(${TARGET_LIBRARY} ${BUILD_TYPE} ${SUPPORT_SOURCE} ${GENERATED_SOURCES})
target_link_libraries(${TARGET_LIBRARY} Qt5::Widgets)

set_target_properties(${TARGET_LIBRARY} PROPERTIES
                      RUNTIME_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH}
                      ARCHIVE_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH}
                      LIBRARY_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH}
)

When I remove the ${GENERATED_SOURCES} from the append_library  I get this error:
CMake Error at support_qt/CMakeLists.txt:109 (add_library):
  Cannot find source file:

     D:/src/c/support_lib/build/support_qt/logging/logging_dialog_box_gui.cpp D:/src/c/support_lib/b
uild/support_qt/logging/logging_dialog_box_gui.cpp

  Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp
  .hxx .in .txx

CMake Error: CMake can not determine linker language for target: support_qt_ad
CMake Error: Cannot determine link language for target "support_qt_ad".

I have seen other postings where similar scripts were shown using add_custom_command but when I do it like this, I get:
mingw32-make[2]: *** No rule to make target 'support_qt/ D:/src/c/support_lib/build/support_qt/loggi
ng/logging_dialog_box_gui.cpp D:/src/c/support_lib/build/support_qt/logging/logging_dialog_box_gui.c
pp', needed by 'support_qt/CMakeFiles/support_qt_ad.dir/_D_/src/c/support_lib/build/support_qt/loggi
ng/logging_dialog_box_gui.cpp_D_/src/c/support_lib/build/support_qt/logging/logging_dialog_box_gui.c
pp.obj'.  Stop.
CMakeFiles\Makefile2:236: recipe for target 'support_qt/CMakeFiles/support_qt_ad.dir/all' failed
mingw32-make[1]: *** [support_qt/CMakeFiles/support_qt_ad.dir/all] Error 2
makefile:74: recipe for target 'all' failed
mingw32-make: *** [all] Error 2

and the file is not compiled only generated.
Update:
I also tried set(CMAKE_AUTOMOC ON) and the generated cpp gets compiled, but only once. When the moc is modified, or the included ui file, it doesn't update it. It would be helpfull to see a fully working example. When I google I only find snippets. :(

A: It should be enough to set: SET(CMAKE_AUTOMOC ON) to instruct CMake to run moc automatically when needed (requires CMake 2.8.6+).
Don't forget to remove the ${GENERATED_SOURCES} from the append_library.
Also add QT5_WRAP_UI macro, for example:
FILE (GLOB_RECURSE project_UIS *.ui)
QT5_WRAP_UI(project_FORM_HDR ${project_UIS})

ADD_LIBRARY(${project_LIB} ${project_SRCS} ${project_FORM_HDR})

EDIT: Fully working example. For simplicity some irrelevant to Qt stuff omitted.
LIST (APPEND CMAKE_PREFIX_PATH "/opt/Qt5.4.1/5.4/gcc_64")

# Instruct CMake to run moc automatically when needed.
SET(CMAKE_AUTOMOC ON)
# Find includes in corresponding build directories
SET(CMAKE_INCLUDE_CURRENT_DIR ON)

# Widgets finds its own dependencies (QtGui and QtCore).
FIND_PACKAGE(Qt5Widgets REQUIRED)

FILE (GLOB_RECURSE project_SRCS *.cpp *.cxx *.cc *.C *.c *.h *.hpp)
SET (project_LIBS Qt5::Widgets)
SET (project_BIN ${APP_NAME})

FILE (GLOB_RECURSE project_UIS *.ui)
QT5_WRAP_UI(project_FORM_HDR ${project_UIS})

ADD_EXECUTABLE(${project_BIN} ${project_SRCS} ${project_FORM_HDR})
TARGET_LINK_LIBRARIES(${project_BIN} ${project_LIBS})


text:
Q: How to create a subview inside an SKScene? Before "Buy Ship" is pressed So I am trying to create a shop where players can buy new ships. When the player hits the "buy button" image I want a combination of images and texts to become visible which acts as a sort of conformation screen. Hopefully you can see here what I mean. I would also greatly appreciate if you could tell me how to dim everything besides the conformation box. After "Buy Ship" is pressed.
This is what my code looks like so far:
 import Foundation
 import SpriteKit

 class ShopPage1: SKScene{

override func didMove(to view: SKView) {

    let background = SKSpriteNode(imageNamed: "background")
    background.position = CGPoint(x: self.size.width/2, y: self.size.height/2)
    background.zPosition = 0
    self.addChild(background)

    let balance = SKLabelNode(fontNamed: "The Bold Font")
    balance.text = "$\(balanceAmount)"
    balance.fontSize = 100
    balance.fontColor = SKColor.green
    balance.position = CGPoint(x: self.size.width/2, y: self.size.height*0.87)
    balance.zPosition = 1
    self.addChild(balance)

    let backToMainMenuButton = SKSpriteNode(imageNamed: "backButton2")
    backToMainMenuButton.position = CGPoint(x: self.size.width*0.25, y: self.size.height*0.89)
    backToMainMenuButton.zPosition = 1
    backToMainMenuButton.size = CGSize(width: 200, height: 200)
    backToMainMenuButton.name = "backToMainMenuButton"
    self.addChild(backToMainMenuButton)

    let shipNameLabel = SKLabelNode(fontNamed: "The Bold Font")
    shipNameLabel.text = "Stealth"
    shipNameLabel.fontSize = 200
    shipNameLabel.fontColor = SKColor.white
    shipNameLabel.position = CGPoint(x: self.size.width/2, y: self.size.height*0.60)
    shipNameLabel.zPosition = 1
    shipNameLabel.name = "shipNameLabel"
    self.addChild(shipNameLabel)

    let nextShipButton = SKSpriteNode(imageNamed: "nextShipButton1")
    nextShipButton.position = CGPoint(x: self.size.width*0.75, y: self.size.height*0.40)
    nextShipButton.zPosition = 1
    nextShipButton.size = CGSize(width: 300, height: 300)
    nextShipButton.name = "nextShipButton"
    self.addChild(nextShipButton)

    let nextShipClick = SKLabelNode(fontNamed: "The Bold Font")
    nextShipClick.text = "▲"
    nextShipClick.fontSize = 300
    nextShipClick.fontColor = UIColor.clear
    nextShipClick.position = CGPoint(x: self.size.width*0.753, y: self.size.height*0.36)
    nextShipClick.zPosition = 2
    nextShipClick.name = "nextShipClick"
    self.addChild(nextShipClick)

    let shipForSale = SKSpriteNode(imageNamed: "playerShip4")
    shipForSale.position = CGPoint(x: self.size.width/2, y: self.size.height*0.40)
    shipForSale.zPosition = 1
    shipForSale.size = CGSize(width: 150, height: 300)
    self.addChild(shipForSale)

    let shipPodium = SKSpriteNode(imageNamed: "shipPodium")
    shipPodium.position = CGPoint(x: self.size.width*0.527, y: self.size.height*0.31)
    shipPodium.zPosition = 1
    shipPodium.size = CGSize(width: 1200, height: 70)
    self.addChild(shipPodium)

    let shipsCostLabel = SKLabelNode(fontNamed: "The Bold Font")
    shipsCostLabel.text = "$500"
    shipsCostLabel.fontSize = 200
    shipsCostLabel.fontColor = SKColor.white
    shipsCostLabel.position = CGPoint(x: self.size.width/2, y: self.size.height*0.20)
    shipsCostLabel.zPosition = 1
    self.addChild(shipsCostLabel)

    let shipBuyButton = SKSpriteNode(imageNamed: "shipBuyButton")
    shipBuyButton.position = CGPoint(x: self.size.width*0.54, y: self.size.height*0.15)
    shipBuyButton.zPosition = 1
    shipBuyButton.size = CGSize(width: 1500, height: 900)
    shipBuyButton.name = "shipBuyButton"
    self.addChild(shipBuyButton)

    let conformationBackground = SKSpriteNode(imageNamed: "conformationBackground")
    conformationBackground.position = CGPoint(x: self.size.width*0.51, y: self.size.height*0.40)
    conformationBackground.zPosition = 2
    conformationBackground.size = CGSize(width: 1300, height: 1400)
    conformationBackground.name = "conformationBackground"
    self.addChild(conformationBackground)

    let conformationScreenTextTop = SKLabelNode(fontNamed: "The Bold Font")
    conformationScreenTextTop.text = "Are you sure you wish to"
    conformationScreenTextTop.fontSize = 80
    conformationScreenTextTop.fontColor = SKColor.white
    conformationScreenTextTop.position = CGPoint(x: self.size.width/2, y: self.size.height*0.46)
    conformationScreenTextTop.zPosition = 3
    self.addChild(conformationScreenTextTop)

    let conformationScreenTextBottom = SKLabelNode(fontNamed: "The Bold Font")
    conformationScreenTextBottom.text = "pruchase this ship?"
    conformationScreenTextBottom.fontSize = 80
    conformationScreenTextBottom.fontColor = SKColor.white
    conformationScreenTextBottom.position = CGPoint(x: self.size.width/2, y: self.size.height*0.41)
    conformationScreenTextBottom.zPosition = 3
    self.addChild(conformationScreenTextBottom)

    let conformationScreenTextYes = SKLabelNode(fontNamed: "The Bold Font")
    conformationScreenTextYes.text = "Yes"
    conformationScreenTextYes.fontSize = 150
    conformationScreenTextYes.fontColor = SKColor.green
    conformationScreenTextYes.position = CGPoint(x: self.size.width*0.30, y: self.size.height*0.30)
    conformationScreenTextYes.zPosition = 3
    self.addChild(conformationScreenTextYes)

    let conformationScreenTextNo = SKLabelNode(fontNamed: "The Bold Font")
    conformationScreenTextNo.text = "No"
    conformationScreenTextNo.fontSize = 150
    conformationScreenTextNo.fontColor = SKColor.red
    conformationScreenTextNo.position = CGPoint(x: self.size.width*0.70, y: self.size.height*0.30)
    conformationScreenTextNo.zPosition = 3
    self.addChild(conformationScreenTextNo)

}

override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {

    for touch: AnyObject in touches{

        let pointOfTouch = touch.location(in: self)
        let tappedNode = atPoint(pointOfTouch)
        let tappedNodeName = tappedNode.name

        if  tappedNodeName == "nextShipClick"{

            let sceneToMoveTo = ShopPage2(size: self.size)
            sceneToMoveTo.scaleMode = self.scaleMode
            let myTransition = SKTransition.fade(withDuration: 0.5)
            self.view!.presentScene(sceneToMoveTo, transition: myTransition)
        }

        if  tappedNodeName == "backToMainMenuButton"{

            let sceneToMoveTo = MainMenuScene(size: self.size)
            sceneToMoveTo.scaleMode = self.scaleMode
            let myTransition = SKTransition.fade(withDuration: 0.5)
            self.view!.presentScene(sceneToMoveTo, transition: myTransition)
        }

    }

}

}

A: As Whirlwind said in his comment you can create an SKNode to the center of your scene (position CGPoint.zero) prepare it with all your stuff and hide it with the alpha properties set to 0 and put it's zPosition to -1 (under all the other visible nodes of your scene).
So when you button will be pressed, you simply change the zPosition to an highest value and the alpha to 1. To make more realistic these action s you could use some animations like:
extension UIView {
    func fadeIn(_ duration:TimeInterval=1.0) {
        UIView.animate(withDuration: duration, delay: 0.0, options: UIViewAnimationOptions.curveEaseIn, animations: {
            self.alpha = 1.0 // Instead of a specific instance of, say, birdTypeLabel, we simply set [thisInstance] (ie, self)'s alpha
        }, completion: nil)
    }
    func fadeOut(_ duration:TimeInterval=1.0) {
        UIView.animate(withDuration: duration, delay: 0.0, options: UIViewAnimationOptions.curveEaseOut, animations: {
            self.alpha = 0.0
        }, completion: nil)
    }
}

A: I have figured out how to get the conformation screen to work. Thanks to @AlessandroOrnano for all the help! I have attached my code below for future reference. If anyone has a more efficient way of doing this I would greatly appreciate any suggestions.
import Foundation
import SpriteKit

class ShopPage1: SKScene{

override func didMove(to view: SKView) {

    let background = SKSpriteNode(imageNamed: "background")
    background.position = CGPoint(x: self.size.width/2, y: self.size.height/2)
    background.zPosition = 0
    self.addChild(background)

    let balance = SKLabelNode(fontNamed: "The Bold Font")
    balance.text = "$\(balanceAmount)"
    balance.fontSize = 100
    balance.fontColor = SKColor.green
    balance.position = CGPoint(x: self.size.width/2, y: self.size.height*0.87)
    balance.zPosition = 1
    self.addChild(balance)

    let backToMainMenuButton = SKSpriteNode(imageNamed: "backButton2")
    backToMainMenuButton.position = CGPoint(x: self.size.width*0.25, y: self.size.height*0.89)
    backToMainMenuButton.zPosition = 1
    backToMainMenuButton.size = CGSize(width: 200, height: 200)
    backToMainMenuButton.name = "backToMainMenuButton"
    self.addChild(backToMainMenuButton)

    let shipNameLabel = SKLabelNode(fontNamed: "The Bold Font")
    shipNameLabel.text = "Stealth"
    shipNameLabel.fontSize = 200
    shipNameLabel.fontColor = SKColor.white
    shipNameLabel.position = CGPoint(x: self.size.width/2, y: self.size.height*0.60)
    shipNameLabel.zPosition = 1
    shipNameLabel.name = "shipNameLabel"
    self.addChild(shipNameLabel)

    let nextShipButton = SKSpriteNode(imageNamed: "nextShipButton1")
    nextShipButton.position = CGPoint(x: self.size.width*0.75, y: self.size.height*0.40)
    nextShipButton.zPosition = 1
    nextShipButton.size = CGSize(width: 300, height: 300)
    nextShipButton.name = "nextShipButton"
    self.addChild(nextShipButton)

    let nextShipClick = SKLabelNode(fontNamed: "The Bold Font")
    nextShipClick.text = "▲"
    nextShipClick.fontSize = 300
    nextShipClick.fontColor = UIColor.clear
    nextShipClick.position = CGPoint(x: self.size.width*0.753, y: self.size.height*0.36)
    nextShipClick.zPosition = 2
    nextShipClick.name = "nextShipClick"
    self.addChild(nextShipClick)

    let shipForSale = SKSpriteNode(imageNamed: "playerShip4")
    shipForSale.position = CGPoint(x: self.size.width/2, y: self.size.height*0.40)
    shipForSale.zPosition = 1
    shipForSale.size = CGSize(width: 150, height: 300)
    self.addChild(shipForSale)

    let shipPodium = SKSpriteNode(imageNamed: "shipPodium")
    shipPodium.position = CGPoint(x: self.size.width*0.527, y: self.size.height*0.31)
    shipPodium.zPosition = 1
    shipPodium.size = CGSize(width: 1200, height: 70)
    self.addChild(shipPodium)

    let shipsCostLabel = SKLabelNode(fontNamed: "The Bold Font")
    shipsCostLabel.text = "$500"
    shipsCostLabel.fontSize = 200
    shipsCostLabel.fontColor = SKColor.white
    shipsCostLabel.position = CGPoint(x: self.size.width/2, y: self.size.height*0.20)
    shipsCostLabel.zPosition = 1
    self.addChild(shipsCostLabel)

    let shipBuyButton = SKSpriteNode(imageNamed: "shipBuyButton")
    shipBuyButton.position = CGPoint(x: self.size.width*0.54, y: self.size.height*0.15)
    shipBuyButton.zPosition = 1
    shipBuyButton.size = CGSize(width: 1500, height: 900)
    shipBuyButton.name = "shipBuyButton"
    self.addChild(shipBuyButton)

    let shipBuyButtonClick = SKLabelNode(fontNamed: "The Bold Font")
    shipBuyButtonClick.text = "▅▅"
    shipBuyButtonClick.fontSize = 300
    shipBuyButtonClick.fontColor = UIColor.clear
    shipBuyButtonClick.position = CGPoint(x: self.size.width/2, y: self.size.height*0.05)
    shipBuyButtonClick.zPosition = 2
    shipBuyButtonClick.name = "shipBuyButtonClick"
    self.addChild(shipBuyButtonClick)

}

override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {

    for touch: AnyObject in touches{

        let pointOfTouch = touch.location(in: self)
        let tappedNode = atPoint(pointOfTouch)
        let tappedNodeName = tappedNode.name

        if  tappedNodeName == "nextShipClick"{

            let sceneToMoveTo = ShopPage2(size: self.size)
            sceneToMoveTo.scaleMode = self.scaleMode
            let myTransition = SKTransition.fade(withDuration: 0.5)
            self.view!.presentScene(sceneToMoveTo, transition: myTransition)
        }

        if  tappedNodeName == "backToMainMenuButton"{

            let sceneToMoveTo = MainMenuScene(size: self.size)
            sceneToMoveTo.scaleMode = self.scaleMode
            let myTransition = SKTransition.fade(withDuration: 0.5)
            self.view!.presentScene(sceneToMoveTo, transition: myTransition)
        }

        if  tappedNodeName == "shipBuyButtonClick"{

            let sceneToMoveTo = ShopPage1ConformationScreen(size: self.size)
            sceneToMoveTo.scaleMode = self.scaleMode
            let myTransition = SKTransition.fade(withDuration: 0.5)
            self.view!.presentScene(sceneToMoveTo, transition: myTransition)
           }

    }

}

}

This is the code for ShopPage1ConformationScreen:
 import Foundation
 import SpriteKit

 let shipForSale = SKSpriteNode(imageNamed: "playerShip4")

 class ShopPage1ConformationScreen: SKScene{

override func didMove(to view: SKView) {

    let background = SKSpriteNode(imageNamed: "background")
    background.position = CGPoint(x: self.size.width/2, y: self.size.height/2)
    background.zPosition = 0
    self.addChild(background)

    let balance = SKLabelNode(fontNamed: "The Bold Font")
    balance.text = "$\(balanceAmount)"
    balance.fontSize = 100
    balance.fontColor = SKColor.green
    balance.position = CGPoint(x: self.size.width/2, y: self.size.height*0.87)
    balance.zPosition = 1
    self.addChild(balance)

    let backToMainMenuButton = SKSpriteNode(imageNamed: "backButton2")
    backToMainMenuButton.position = CGPoint(x: self.size.width*0.25, y: self.size.height*0.89)
    backToMainMenuButton.zPosition = 1
    backToMainMenuButton.size = CGSize(width: 200, height: 200)
    backToMainMenuButton.name = "backToMainMenuButton"
    self.addChild(backToMainMenuButton)

    let shipNameLabel = SKLabelNode(fontNamed: "The Bold Font")
    shipNameLabel.text = "Stealth"
    shipNameLabel.fontSize = 200
    shipNameLabel.fontColor = SKColor.white
    shipNameLabel.position = CGPoint(x: self.size.width/2, y: self.size.height*0.60)
    shipNameLabel.zPosition = 1
    shipNameLabel.name = "shipNameLabel"
    self.addChild(shipNameLabel)

    let nextShipButton = SKSpriteNode(imageNamed: "nextShipButton1")
    nextShipButton.position = CGPoint(x: self.size.width*0.75, y: self.size.height*0.40)
    nextShipButton.zPosition = 1
    nextShipButton.size = CGSize(width: 300, height: 300)
    nextShipButton.name = "nextShipButton"
    self.addChild(nextShipButton)

    let nextShipClick = SKLabelNode(fontNamed: "The Bold Font")
    nextShipClick.text = "▲"
    nextShipClick.fontSize = 300
    nextShipClick.fontColor = UIColor.clear
    nextShipClick.position = CGPoint(x: self.size.width*0.753, y: self.size.height*0.36)
    nextShipClick.zPosition = 2
    nextShipClick.name = "nextShipClick"
    self.addChild(nextShipClick)

    shipForSale.position = CGPoint(x: self.size.width/2, y: self.size.height*0.40)
    shipForSale.zPosition = 1
    shipForSale.size = CGSize(width: 150, height: 300)
    self.addChild(shipForSale)

    let shipPodium = SKSpriteNode(imageNamed: "shipPodium")
    shipPodium.position = CGPoint(x: self.size.width*0.527, y: self.size.height*0.31)
    shipPodium.zPosition = 1
    shipPodium.size = CGSize(width: 1200, height: 70)
    self.addChild(shipPodium)

    let shipsCostLabel = SKLabelNode(fontNamed: "The Bold Font")
    shipsCostLabel.text = "$500"
    shipsCostLabel.fontSize = 200
    shipsCostLabel.fontColor = SKColor.white
    shipsCostLabel.position = CGPoint(x: self.size.width/2, y: self.size.height*0.20)
    shipsCostLabel.zPosition = 1
    self.addChild(shipsCostLabel)

    let shipBuyButton = SKSpriteNode(imageNamed: "shipBuyButton")
    shipBuyButton.position = CGPoint(x: self.size.width*0.54, y: self.size.height*0.15)
    shipBuyButton.zPosition = 1
    shipBuyButton.size = CGSize(width: 1500, height: 900)
    shipBuyButton.name = "shipBuyButton"
    self.addChild(shipBuyButton)

    let conformationBackground = SKSpriteNode(imageNamed: "conformationBackground")
    conformationBackground.position = CGPoint(x: self.size.width*0.51, y: self.size.height*0.40)
    conformationBackground.zPosition = 2
    conformationBackground.size = CGSize(width: 1300, height: 1400)
    conformationBackground.name = "conformationBackground"
    self.addChild(conformationBackground)

    let conformationScreenTextTop = SKLabelNode(fontNamed: "The Bold Font")
    conformationScreenTextTop.text = "Are you sure you wish to"
    conformationScreenTextTop.fontSize = 80
    conformationScreenTextTop.fontColor = SKColor.white
    conformationScreenTextTop.position = CGPoint(x: self.size.width/2, y: self.size.height*0.46)
    conformationScreenTextTop.zPosition = 3
    conformationScreenTextTop.name = "comformationScreenTextTop"
    self.addChild(conformationScreenTextTop)

    let conformationScreenTextBottom = SKLabelNode(fontNamed: "The Bold Font")
    conformationScreenTextBottom.text = "purchase this ship?"
    conformationScreenTextBottom.fontSize = 80
    conformationScreenTextBottom.fontColor = SKColor.white
    conformationScreenTextBottom.position = CGPoint(x: self.size.width/2, y: self.size.height*0.41)
    conformationScreenTextBottom.zPosition = 3
    conformationScreenTextBottom.name = "conformationScreenTextBottom"
    self.addChild(conformationScreenTextBottom)

    let conformationScreenTextYes = SKLabelNode(fontNamed: "The Bold Font")
    conformationScreenTextYes.text = "Yes"
    conformationScreenTextYes.fontSize = 150
    conformationScreenTextYes.fontColor = SKColor.green
    conformationScreenTextYes.position = CGPoint(x: self.size.width*0.30, y: self.size.height*0.30)
    conformationScreenTextYes.zPosition = 3
    conformationScreenTextYes.name = "conformationScreenTextYes"
    self.addChild(conformationScreenTextYes)

    let conformationScreenTextNo = SKLabelNode(fontNamed: "The Bold Font")
    conformationScreenTextNo.text = "No"
    conformationScreenTextNo.fontSize = 150
    conformationScreenTextNo.fontColor = SKColor.red
    conformationScreenTextNo.position = CGPoint(x: self.size.width*0.70, y: self.size.height*0.30)
    conformationScreenTextNo.zPosition = 3
    conformationScreenTextNo.name = "conformationScreenTextNo"
    self.addChild(conformationScreenTextNo)
}

override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {

    for touch: AnyObject in touches{

        let pointOfTouch = touch.location(in: self)
        let tappedNode = atPoint(pointOfTouch)
        let tappedNodeName = tappedNode.name

        if(balanceAmount >= 500){
        if  tappedNodeName == "conformationScreenTextYes"{
            player = shipForSale
            balanceAmount -= 500
            let sceneToMoveTo = ShopPage1(size: self.size)
            sceneToMoveTo.scaleMode = self.scaleMode
            let myTransition = SKTransition.fade(withDuration: 0.5)
            self.view!.presentScene(sceneToMoveTo, transition: myTransition)
        }
        }

        if  tappedNodeName == "conformationScreenTextNo"{
            let sceneToMoveTo = ShopPage1(size: self.size)
            sceneToMoveTo.scaleMode = self.scaleMode
            let myTransition = SKTransition.fade(withDuration: 0.5)
            self.view!.presentScene(sceneToMoveTo, transition: myTransition)
        }

    }
}
}

For additional shop pages just copy and paste these sets of codes. With the exception of changing the the tapped nodes around to the correct order in which you wish to move from page to page.


text:
Q: Trying to find a Scifi comedy short about time travel / meeting yourself from the future I was full sure this was by the Invisible Engine guys but I've searched their Youtube and Vimeo feeds and can't find anything.
Plot in full:
A man is being stalked by a weirdo in a helmet. He goes through a doorway and waits around the corner for his stalker, then grabs and confronts him.
The stalker reveals he is the man's future self, and has come back in time to warn him about something, but basically he's so stoned he can't remember. He decides he must get a degree from Brown University. Then he asks him for some weed, and a loan of 5000 dollars. Then he pulls a gun on his past self. Past self tries to talk sense into him.
Suddenly a very old man appears in front of them. Future self shoots him, and it turns out he is the far, distant future version of both of them. He dies saying "in a way, I think, I've always known!"
Can anyone find this for me?

A: I found it!
I'm From The Future, written and directed by Chris Cantwell, who is one of the Invisible Engine crew, so I was right

A: Sounds like "By His Bootstraps" by Heinlein, sort of.
Protagonist is met by a future copy, while drunkenly trying to finish a college paper.  Future copy tries to get him to come to the future, but second copy arrives to stop them.  Fist fight ensues, first guy gets knocked through the gate.  Older man sends him back to get himself forward...
Later, he borrows money to buy things to help him out, as he wants to replace the older man that he is now suspicious of.  He goes back 10 year.  He eventually realizes the old man was himself when his drunk first self plops through the gate 10 years later.


text:
Q: Architecture Implementation and Design for a Notification System using socket.io node.js and incoming messages Disclaimers

*

*I have not worked with node.js before

*I have not used socket.io before

I'm looking at implementing a Google Plus, Facebook, StackOverflow style notification system. I'm not an inexperienced developer, and eventually I will figure this out, but I'm just looking for a thrust to the right direction.
What I want is for users who are browsing my site to be notified during their browsing session when they receive a new message.
Currently, all of my messages are stored in a single table.
  |  id    | messageSubject   | messageBody     | hasRead   | readDate   | sentDate   | sentToUser  | sentFromUser  |
  |   1    |   HelloWorld     | Nada            |   0       | `null`     | `null      |      1      |      10       |

Now, all of my messages are retrieved from dozens of different sources.

*

*A message can be entered via an API by third parties

*Message are pulled from Send Grid

*Messages can be sent via private message Controllers.

*Etc etc

What I want is to have a way to be able to notify users when a new message is received. I'm happy to refactor my code any way which makes it possible to notify my node.js when I receive a insert a message if that is what I need to do.
But I am just not quite sure where to start.
My problem is that all of my messages are entered into mysql through dozens of different sources, my Insert statements are in a lot of areas. So I just don't know the best way to proceed.
Thanks.

A: Try to look at presentation Why databases suck for messaging which is namely about why you shouldn't use databases such as MySQL for messaging. Messaging and notifications systems works well with Event Driven Architecture and I would recommend to watch this presentation or to learn more on this topic from here in order to get a bigger picture about event driven "ecosystem".


text:
Q: Перезаписывается переменная, а не должна Мне необходимо отследить нажатия клавиатуры и если подряд будет нужное сочетание букв выполнить определённый код(эта часть работает) и ещё надо отслеживать состояние кода, то есть если первое действие действие не было выполнено(не был набран определённый набор символов) второе действие не выполнялось(защита от ложного срабатывания). Проблема в том что функция on_press не хочет принимать второй аргумент и выпадает в ошибку, а если я пытаюсь инициализироать переменную состояния внутри функции, то она перезаписывается при каждой итерации функции, хотя я попятался установить защиту от этого.
Вот мой код:
from pynput import keyboard

mass = ['0', '0', '0', '0', '0', '0,']
obraz_m = ["'m'", "'i'", "'c'", "'u'", "'r'", "'i'"]
obraz_naz = ["'g'", "'o'", "'b'", "'a'", "'c'", "'k'"]

#sost = False

def naz(key):
    try:
        sost = sost
    except NameError:
        sost = False
        print('отладочное сообщение')
    mass[0] = mass[1]
    mass[1] = mass[2]
    mass[2] = mass[3]
    mass[3] = mass[4]
    mass[4] = mass[5]
    key = str(key)
    mass[5] = key
    print(mass)
    print(sost)
    if mass == obraz_m and sost == False:
        print('horay')
        sost = True
        print(sost)
    elif mass == obraz_naz and sost == True:
        print('back tak back')
        sost = False
        print(sost)

def otz(key):
    if key == keyboard.Key.esc:
         return False

with keyboard.Listener(on_press=naz, on_release=otz) as listener:
    listener.join()

А если подать второй аргумент, то появляется такая ошибка:
Unhandled exception in listener callback
Traceback (most recent call last):
  File "C:\Program Files (x86)\Python37-32\lib\site-packages\pynput\_util\__init__.py", line 162, in inner
    return f(self, *args, **kwargs)
  File "C:\Program Files (x86)\Python37-32\lib\site-packages\pynput\keyboard\_win32.py", line 280, in _process
    self.on_press(key)
  File "C:\Program Files (x86)\Python37-32\lib\site-packages\pynput\_util\__init__.py", line 78, in inner
    if f(*args) is False:
TypeError: naz() missing 1 required positional argument: 'key'
Traceback (most recent call last):
  File "C:/Users/Kirill/Desktop/cmena_oboi/main.py", line 41, in <module>
    listener.join()
  File "C:\Program Files (x86)\Python37-32\lib\site-packages\pynput\_util\__init__.py", line 210, in join
    six.reraise(exc_type, exc_value, exc_traceback)
  File "C:\Program Files (x86)\Python37-32\lib\site-packages\six.py", line 695, in reraise
    raise value.with_traceback(tb)
  File "C:\Program Files (x86)\Python37-32\lib\site-packages\pynput\_util\__init__.py", line 162, in inner
    return f(self, *args, **kwargs)
  File "C:\Program Files (x86)\Python37-32\lib\site-packages\pynput\keyboard\_win32.py", line 280, in _process
    self.on_press(key)
  File "C:\Program Files (x86)\Python37-32\lib\site-packages\pynput\_util\__init__.py", line 78, in inner
    if f(*args) is False:
TypeError: naz() missing 1 required positional argument: 'key'

A: А если переменную sost использовать как глобальную в функции? Видимо ты пытался, но из за того, что она была локальной, тебе било ошибку.
from pynput import keyboard

mass = ['0', '0', '0', '0', '0', '0,']
obraz_m = ["'m'", "'i'", "'c'", "'u'", "'r'", "'i'"]
obraz_naz = ["'g'", "'o'", "'b'", "'a'", "'c'", "'k'"]

sost = False

def naz(key):
    global sost
    mass[0] = mass[1]
    mass[1] = mass[2]
    mass[2] = mass[3]
    mass[3] = mass[4]
    mass[4] = mass[5]
    key = str(key)
    mass[5] = key
    print(mass)
    print(sost)
    if mass == obraz_m and sost == False:
        print('horay')
        sost = True
        print(sost)
    elif mass == obraz_naz and sost == True:
        print('back tak back')
        sost = False
        print(sost)

def otz(key):
    if key == keyboard.Key.esc:
         return False

with keyboard.Listener(on_press=naz, on_release=otz) as listener:
    listener.join()


text:
Q: Android edit DB record in list detail using intent I woul like to edit my DB record using ListDetail. Currently my project display listView of exercises sorting by day. When u click on list position, you get new window with exercise's details. There are 2 buttons: edit and delete. Delete button is working good using intent, but I have no idea how to easily make EDIT button working. What should I do to solve that problem?
Here are my classes:
ListExerciseFragment - fragment which displaying listView
public class ListExercisesFragment extends Fragment {
    String TAG="ListExercisesFragment";
    private ExercisesDbAdapter dbHelper;
    private ListView listView;
    private ArrayList<Exercise> lExercise=new ArrayList<Exercise>();
    private CustomListAdapter dataAdapter;
    private static  final int REQUEST_CODE=100;
    public ListExercisesFragment(){
    }
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.list_fragment, container, false);
        listView = (ListView) view.findViewById(R.id.listView1);
        dbHelper = new ExercisesDbAdapter(getActivity());
        dbHelper.open();

        displayListView();

       listView.setOnItemClickListener(new AdapterView.OnItemClickListener(){
               public void onItemClick(AdapterView<?> parent,View view,int position,long id){
                   Exercise exercise=(Exercise) listView.getItemAtPosition(position);
                   //wysyłam dane do ListDetail
                   Intent intent = new Intent(getContext(),ListDetail.class);
                   intent.putExtra("id",exercise.getId());
                   intent.putExtra("name",exercise.getName());
                   intent.putExtra("series",exercise.getSeries());
                   intent.putExtra("reps",exercise.getReps());
                   intent.putExtra("weights",exercise.getWeights());
                   intent.putExtra("notes",exercise.getNotes());
                   intent.putExtra("date",exercise.getDate());
                   startActivityForResult(intent,REQUEST_CODE);
               }
       });

        return view;
    }

    @Override
    public void onActivityResult(int requestCode,int resultCode,Intent data){
        if(requestCode==REQUEST_CODE){
            int id=data.getIntExtra("id",-1);
            if(id!=-1){
                Log.d(TAG,"success"+Integer.toString(id));
                deleteExerciseWithID(id);
            }
            else{
                Log.d(TAG,"not working");
            }
        }
        super.onActivityResult(requestCode,resultCode,data);
    }

    private void deleteExerciseWithID(int id){
        for(Exercise e:lExercise){
            if( e.getId()==id ){
                dbHelper.deleteRowWithId(id);
                lExercise.remove(e);
                dataAdapter.notifyDataSetChanged();
                break;
            }
        }
    }
    private void displayListView() {
        Cursor cursor = dbHelper.fetchAllExercises();

        cursor.moveToFirst();
        while (cursor.moveToNext()) {
            int _id = cursor.getColumnIndex(ExercisesDbAdapter.KEY_ROWID);
            int name = cursor.getColumnIndex(ExercisesDbAdapter.KEY_NAME);
            int series = cursor.getColumnIndex(ExercisesDbAdapter.KEY_SERIES);
            int reps = cursor.getColumnIndex(ExercisesDbAdapter.KEY_REPS);
            int weights = cursor.getColumnIndex(ExercisesDbAdapter.KEY_WEIGHTS);
            int notes = cursor.getColumnIndex(ExercisesDbAdapter.KEY_NOTES);
            int date = cursor.getColumnIndex(ExercisesDbAdapter.KEY_DATE);

            Exercise exercise = new Exercise();
            exercise.setId(cursor.getInt(_id));
            exercise.setName(cursor.getString(name));
            exercise.setSeries(cursor.getInt(series));
            exercise.setReps(cursor.getInt(reps));
            exercise.setWeights(cursor.getInt(weights));
            exercise.setNotes(cursor.getString(notes));
            exercise.setDate(cursor.getString(date));

            lExercise.add(exercise);
        }

        Collections.sort(lExercise);

        dataAdapter = new CustomListAdapter(getActivity(),0, lExercise);
        // Assign adapter to ListView
        listView.setAdapter(dataAdapter);

    }

}

ListDeatil- class with intent, currently it is displaying exercise's details and by clicking delet button deleting that exercise
public class ListDetail extends AppCompatActivity {
String TAG="ListDetails";

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

    final int id=getIntent().getIntExtra("id",-1);
    String name=getIntent().getStringExtra("name");
    int series=getIntent().getIntExtra("series",-1);
    int reps=getIntent().getIntExtra("reps",-1);
    int weights=getIntent().getIntExtra("weights",-1);
    String date=getIntent().getStringExtra("date");
    String notes=getIntent().getStringExtra("notes");

    TextView txtName=(TextView) findViewById(R.id.detail_name);
    TextView txtSeries=(TextView) findViewById(R.id.detail_series);
    TextView txtReps=(TextView) findViewById(R.id.detail_reps);
    TextView txtWeights=(TextView) findViewById(R.id.detail_weights);
    TextView txtNotes=(TextView) findViewById(R.id.detail_notes);
    TextView txtDate=(TextView) findViewById(R.id.detail_date);

    txtName.setText(name);
    txtDate.setText(date);
    txtSeries.setText(Integer.toString(series));
    txtReps.setText(Integer.toString(reps));
    txtWeights.setText(Integer.toString(weights));
    txtNotes.setText(notes);

    Log.d(TAG,"Got id: "+Integer.toString(id));

    Button btnDelete=(Button) findViewById(R.id.btn_delete);
    btnDelete.setOnClickListener(new View.OnClickListener(){
        @Override
        public void onClick(View v){
            Intent intent=new Intent();
            intent.putExtra("id",id);
            setResult(RESULT_OK,intent);
            finish();
        }
    });

}
@Override
public void onBackPressed() {

    Intent intent=new Intent();
    setResult(RESULT_OK,intent);
    finish();

}
}

Currently view looks like this:
ListDetail view screenshot
I was thinking about create EditTexts, make them GONE at default, when u click on button EDIT, TextViews' visibility from ListDetails class  GONE, EditTexts are VISIBLE, with infos from TextViews, then you will be able to edit it. I have no idea how to write that to be honest. Thanks for any help.

A: Try this:
I have created the Demo with two activities one is MainActivity.class which is launcher activity and Second is SecondActivity.class which is second activity.Please go through this both activity you will get the idea:
MainActivity.class
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Intent iv =new Intent(MainActivity.this,SecondActivity.class);
        startActivityForResult(iv,1);
    }
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    switch (resultCode){
        case 1:
            Log.d("Edit","Edit");
            break;
        case 2:
            Log.d("Delete","Delete");
            break;
    }
}

SecondActivity.class
bt_edit=(Button)findViewById(R.id.bt_edit);
        bt_delete=(Button)findViewById(R.id.bt_delete);
    bt_edit.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            setResult(1);
            finish();

        }
    });

    bt_delete.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            setResult(2);
            finish();
        }
    });

Please check the logs once you click on edit it will go to EditPart of onActivityResult and if you click on delete it will redirect you to Delete Part of OnActivityResult. Hope this will help you.


text:
Q: Get access to existing thread python Pretend one have a script with creating some testing Thread: test1.py
import threading
import time

class Test(threading.Thread):
    def __init__(self, name, alist):
        threading.Thread.__init__(self)
        self.alist = alist
        self.name = name

    def run(self):
        print "Starting thread " + self.name
        self.append_to_alist(self.alist)
        print "Exiting thread" + self.name

    def append_to_alist(self, alist):
        for x in range(5):
            self.alist.append(alist[-1]+1)
            time.sleep(10)

def main():
    alist = [1]
    # Create new thread
    thread = Test("Test thread", alist)
    thread.start()
    thread.join()
    print alist
main()

Now I run it python test1.py and then I want to run another script test2.py in order to modify existing Test thread which is working, something like this, test2.py:
import threading
thread = somehow_get_access_to_Test_thread()
thread.alist.append('test')

Is it possible?

A: To my knowledge there is no way for the threads to interact directly. Not only are they different threads, but they also run in separate Python processes.
In this case I believe the simplest solution is to have the list thread listen on a TCP port, and the other thread write to that port.
See for example this library.


text: Q: Writing long number to excel from pandas I'm trying to figure out how to change the format of one of my columns when writing to a excel file. Currently if a number is over 15 digits the end digits get truncated. Setting column format to a string negates this issue. I cant figure out how to do this before I write to to a file though


text:
Q: Can somebody explain what is the role of URLPermission class in Java 1.8 in client server architecture When I was going through the Java 1.8 features, I came across java.net.URLPermission class.I didn't get much documentation on the usage of this library can some body help with a working code for this class.

A: This class is used by security manager to control HTTP URL permissions. For example
grant codebase "example.jar" {
    // allow only GET requests http://www.example.com
    permission java.net.URLPermission
        "http://www.example.com", "GET";
};

You can find more info in JEP-184 and java.net.URLPermission javadoc.


text:
Q: Checking for errors from Scanner? So I decided to make a program that makes Orc objects that each have a name.
import java.util.*;
public class Main {

    public static void main(String[] args) {

        Scanner input = new Scanner(System.in);

        for (int x = 0; x < 10; x++){

            System.out.println("Input the name of your Orc here:");

            String name = input.nextLine(); //THIS is where the inputed name is registerd.

            Orcmaker Orc = new Orcmaker(name);

            System.out.println(Orc);

            input.close();
        }

        System.out.println("Fire");

        //Find a way to run validation code while not obstructing the for loop to make multiple orc objects.

    }
}

So I made that for loop to go through the code so that I can make a name for each orc until eventually I make 10 orcs. The problem is that I'm having issues now injecting input validation that won't make certain lines of code go blank because the loop swallowing up vital code.
Also I just don't know how to make it so that my if statement can see a number or special character to invalidate. Because these are NAMES I only want a String.
Just for completeness' sake here is my constructor. This is the only other class in this mini-project I have made myself.
public class Orcmaker {

private String name;
private int age;
private String weapon;

public Orcmaker(String OrcName){
    this.name = OrcName;
}

@Override
  public String toString() {
    return String.valueOf(name);
  }

}


text:
Q: Calling setsid() at proc created by posix_spawn() This question is follow-up for this question.
When the bash command is issued by posix_spawn() I get the message:

bash: no job control in this shell

I think is because in the fork sequence there is call to the function setsid() and I don't know how to simulate this operation while using posix_spawn().
Is there a way to make new session for the bash process?

A: You can't. It's not part of the current posix_spawn interface.
Adding it has been discussed at http://austingroupbugs.net/view.php?id=1044
and apparently at least one implementation (QNX) provides POSIX_SPAWN_SETSID as an extension, but to stay standard compliant you need to use fork.
Using fork shouldn't be an issue if the parent process is small, so I imagine that to get the best of both worlds, you could use posix_spawn to launch a small helper binary that forks and calls setsid.
IMO, using setsid should be rare enough for the small additional cost of double-execing to be negligible.


text:
Q: Не работает javascript в WebView на версии 4.0.3 Пытаюсь загрузить страницу при помощи Webview. Создаю html код:

    <title>Моя карта</title>

На версиях Андроида 2.1-2.3.3 прорабатывает идеально, но на версии 4.0.3 не удается загрузить страницу. Остается пустой Webview. Как это можно исправить?

A: В общем это не баг, а фича, точнее исправленный баг. Дубльгис использует куки, которые для about:blank не устанавливаются, ибо не секьюрно.
Короче говоря, нужно заменить в вашем примере
WebView1_H.loadDataWithBaseURL(null, html, mime, encoding, null);
//Здесь первый параметр null эквивалентен базовому url about:blank

на что-то типа (можно дословно):
WebView1_H.loadDataWithBaseURL("http://www.example.com", html, mime, encoding, null);

Проверено в эмуляторе и на реальном девайсе.
A: Если все так как вы описали - то тянет на выставление minor bug report. Выставить баг можно здесь. Очень похоже что ICS не хочет почему-то подгружать скрипт от внешнего источника http://maps.api.2gis.ru/1.0 (хотя он вроде доступен). Если баг подтвердится, то очень скоро вы получите ответ от разработчиков Android.
P.S. Надо все таки перепроверить на других устройствах. Было бы хорошо если бы скинули народу полные исходники.


text:
Q: Python 3.5 Type Error Comparing Int to List I am working on a pretty simple script for my intro to python class. The script will eventually automate dice rolls for the board game Risk. It is still early on in its development, but I have run into a type error I do not entirely understand. The two variables should both be lists as they are generated by the same basic code, yet it returns a type error. Here is the code I have done so far:
print ("Please input Attacking number and defending number, in that order.")
def numdiceroll(x, y):
    import random
    sides = 6
    attacking = x
    defending = y
    if attacking >= 3 and defending >= 2:
        dicea = random.sample(range(1, sides + 1), 3)
        print (dicea)
        diced = random.sample(range(1, sides +1), 2)
        print (diced)
        if max(dicea) > max(diced) and min(dicea) > (diced):
            print ("Attacker Wins Both")
        if max(dicea) > max(diced) and min(dicea) < (diced):
            print ("Both Lose 1")
        if max(dicea) < max(diced) and min(dicea) > (diced):
            print ("Both Lose 1")
        if max(dicea) < max(diced) and min(dicea) < (diced):
            print ("Defender Wins Both")

A: min(dicea) > (diced)

diced is a list, and min and max return numbers. You cannot compare a number with a list. Now it depends on what you actually want to do.


text:
Q: Detect element deletion using MutationObserver I want to observe and element that sometimes gets deleted and then recreated. My problem is that the observer gets destroyed with the element and doesn't get recreated with the element, and I have no way to detect when that happens in order to re-create the observer.
MDN says that "Note: According to specification a MutationObserver is deleted by the garbage collector if the target element is deleted."
Is there anyway to detect that deletion? I'm observing an element, I want to know when that element was deleted. I can detect if its sub-nodes have been deleted, but I have no way to detect if it itself has been removed.
I registered to all mutations but the callback doesn't get called when the element is deleted.
I tried setInterval to check every second if the element disappears but this doesn't work well when the element gets removed and then re-created quickly.

A: A MutationObserver doesn't fire when the element on which it is set is removed. The specification only allows to listen for changes on attributes, character data and child nodes.
So the solution to this is to set the MutationObserver on the parent (or ancestor) element that is not deleted. In the callback you then have to loop through the MutationRecords to check whether their removedNodes property contains the element you are looking for.
The code for that will look something like this:
let mutationObserver = new MutationObserver((mutationList, observer) => {
  for (let mutationRecord of mutationList) {
    if (mutationRecord.removedNodes) {
      for (let removedNode of mutationRecord.removedNodes) {
        if (removedNode.id === 'myElement') {
          ...
          return;
        }
      }
    }
  }
});

The return statement is in there to stop looping through the rest of the elements once you handled the deletion of the searched element.


text:
Q: SDFX / Developer Console Delay in Deploying Lightning Component Changes I am using the sfdx force:source:push plugin, and editing my components in a <aura:component>, that is displayed inside a Lightning Component Tab. When I make markup changes to the component in my local file-system and push via the above command OR in the developer console to my scratch org,
I am not seeing the changes reflected until I log out of the org and reload the app?
I am not seeing any errors in the developer console "Problems" tab? Is there some sort of delay in updating lightning components?
I have disabled the cache in chrome developer tools, to no greater effect.
Sometimes they show immediately, otherwise I am not sure if they have unless I change a text string?


text:
Q: Encog Workbench Analysis Wizard Multiple Target Field I am using Encog Workbench Analysis Wizard.
As I understood "target field" is the output neuron. Nevertheless, in my network I have 75 input neurons and 44 output neurons. I cannot figure out how I set up more than one target field in the Analysis Wizard. Could anyone help with it, please? Or do I misunderstand the conception of the target field in this case?

A: Run the analyst wizard as normal. Let it choose one field for a single output. Then go into the .ega file. Scroll down to where it says [NORMALIZE:RANGE]. You will see a list of inputs and one output at the end. Now change the word input to output for all the relevant neurons.
Then you can change equilateral to oneof for all the target fields if you are using a 1 of n classification.
Yes target and output mean the same thing in this case.
If you are starting out with this, I highly recommend you begin the problem with say 5 or 10 input and output neurons, to greatly simplify your problem.


text:
Q: Check URL InputStream contains a GIF I want to get file type of the file on provided URL. If is it a GIF file, I need to know that.
Example URL : https://media3.giphy.com/avatars/100soft/WahNEDdlGjRZ.gif (it may not always include a file extension)
I'm working on Android

A: Get the InputStream from the URL: InputStream from a URL
Most solutions will have you reading the whole stream, but that's not completely necessary because you only need to check the first three bytes.
Convert it to a byte[] : Convert InputStream to byte array in Java

All GIF files must start with a header block. The header takes up the first six bytes of the file. These bytes should all correspond to ASCII character codes. The first three bytes are called the signature. These should always be "GIF" (ie 47="G", 49="I", 46="F")

http://giflib.sourceforge.net/whatsinagif/bits_and_bytes.html


text:
Q: Adding a custom Android build target I have developed a project with a custom sdk in Eclipse. Now, I need to
build the app using the android tool specified here : http://developer.android.com/tools/projects/projects-cmdline.html#UpdatingAProject
The problem is that when I pass in my project path to the tool as below
android update project --path $directory
I get an error saying the following:
Error: The project either has no target set or the target is invalid.
Please provide a --target to the 'android update' command.
My project.properties file is as below
#Project target.
target=Custom SDK Addon:19
android.library=true
android.library.reference.1=../someOtherProject

So it seems that the android utility is not recognizing my Custom SDK. I placed the custom SDK into the add-ons folder of the android sdk installation. This works with Eclipse which can find my target but it still does not work for the android utility.
The command "android list targets" gives me the following
Available Android targets:
id: 1 or "android-8"
     Name: Android 2.2
     Type: Platform
     API level: 8
     Revision: 3
     Skins: HVGA, WQVGA400, WVGA800 (default), WQVGA432, QVGA, WVGA854

id: 2 or "android-17"
     Name: Android 4.2.2
     Type: Platform
     API level: 17
     Revision: 2
     Skins: HVGA, WXGA800-7in, WQVGA400, WVGA800 (default), WQVGA432, WSVGA, WXGA800, QVGA, WXGA720, WVGA854
 Tag/ABIs : default/armeabi-v7a
As you can see, I can't find my custom target there. How do I make my target visible to the
android utility?