text:
Q: YUI Compressor: is the obfuscation safe? YUI Compressor has an option to obfuscate local symbols (it's on by default, and you can turn it off with --nomunge. My question is: how safe is this? What are the situations (if any) where it can break code?

A: From your link

DESCRIPTION
The YUI Compressor is a JavaScript compressor which, in addition
  to removing
      comments and white-spaces, obfuscates local variables using the
  smallest
      possible variable name. This obfuscation is safe, even when using
  constructs
      such as 'eval' or 'with' (although the compression is not optimal
  is those
      cases) Compared to jsmin, the average savings is around 20%.


text:
Q: Download a page using bash which requires authentication I know this has been asked several times before but the solutions didnt work for me.
I'm using ubuntu 14 TLS and i want to download a certain page on an external appliance and save it as html file.
The problems:

*

*To get to the page a need to enter a username and password on a login page. As far as i know the authentication works over JavaScript.

*The page i want to download is something like a database. And to see the information i want to save i have to click a "show all" button on that page which also uses JavaScript.
I've tried
wget --secure-protocol=TLSv1 --user=op --password=pw --save-cookies cookies.txt --no-check-certificate https://10.84.163.146/login/login

wget --load-cookies cookies.txt -p https://10.84.163.146/analyses.

but it doesnt work.
Also i tried
wget --cookies=on --save-cookies=cookies.txt --keep-session-cookies --no-check-certificate  --post-data 'user=op&passwort=pw' https://10.84.163.146/

wget --cookies=on --load-cookies=cookies.txt --keep-session-cookies --no-check-certificate https://10.84.163.146/analyses

It downloads a file but its always the Login Page.
The cookie.txt contains following information:
# HTTP cookie file.
# Generated by Wget on 2015-08-24 15:29:10.
# Edit at your own risk.

10.84.163.146   FALSE   /   TRUE    0   BALANCEID   balancer.thin1
10.84.163.146   FALSE   /   TRUE    0   _session_id dcfd63dad96cede4c3e5927335cbf411

This is the login script:
// Make sure we have cookies enabled for this site
var tmpcookie = new Date();
chkcookie = (tmpcookie.getTime() + '');
document.cookie = "chkcookie=" + chkcookie + "; path=/";
if (document.cookie.indexOf(chkcookie,0) < 0) {
   alert("Cookies are required for this site.\n" +
    "Please unblock cookies in your browser setting.");
 }

 (function($){
   $(document).ready(function(){
     $('#login-container').find('input.form-control').blur(function(e){
       $('#login-container').find('.form-group.auth').removeClass('focus');
}).focus(function(e){
  $(this).parents('.form-group:first').addClass('focus');
    });
   });
 })(jQuery);

And ideas?

A: Why your attempt might not work:
The login script you mention is javascript code that should run in a browser as a pre-check to presenting the file for download.
Since you are running from wget, it shouldn't be able to download jQuery sources from a CDN, execute the different modules, turn on whatever flags are needed and and finally let the browser present the download dialog.
In this case, it should be a client-side validation, but from the looks of it, but we are talking about an excerpt so we are tied to wondering and making assumptions.
Some tasks to follow that may guide you in the right direction:
Your best bet, is to install somethng that actually let's you see what is going on and where the browser is downloading the data from.

*

*If Firefox, you can use Live HTTP Headers to see what is the actual file link you desire, be careful, it is very verbose but that also means it give you a lot of control.

*If Chrome, you might want to try with its own set of tools, just press F2 and be vigilant on the Network tab.

It might be possible the download link have extra parameters that you may tweak from your bash script, these tools should let you see them and act accordingly :)

redpajama_set_name: RedPajamaStackExchange


text:
Q: Очистить выборочно инпуты в форме <form method="POST" action="">
<input id=\"datepicker1\" type=\"text\" name=\"van1\" size=\"10\" ><button type=\"button\" onclick=\"van.reset()\">Очистить</button>
<input id=\"datepicker2\" type=\"text\" name=\"van2\" size=\"10\" ><button type=\"button\" onclick=\"van.reset()\">Очистить</button>
<input id=\"datepicker3\" type=\"text\" name=\"van3\" size=\"10\" ><button type=\"button\" onclick=\"van.reset()\">Очистить</button>
<input id=\"datepicker4\" type=\"text\" name=\"van4\" size=\"10\" ><button type=\"button\" onclick=\"van.reset()\">Очистить</button>
<input  id=\"datepicker5\" type=\"text\" name=\"van5\" size=\"10\" ><button type=\"button\" onclick=\"van.reset()\">Очистить</button>

Как очищать поля выборочно, при нажатии на кнопку очистить рядом с нужным полем?

A: <input id=\"datepicker1\" type=\"text\" name=\"van1\" size=\"10\" ><button type=\"button\" onclick=\"clearInput('datepicker1')\">Очистить</button>
function clearInput(id) {
        try{
            document.querySelector('#' + id).value = '';
        }catch (e) {
            console.log(e);
        }
    }


text:
Q: How Drools works? I have a scenario wherein I need to add rules to a rule engine dynamically.
What if I add same rule twice/multiple times?
I am not able to get exact behavior of Drools by doing POC(I am a newbie to Drools).
Also, if a rule once inserted remain in knowledgeBase until I explicitly remove it?

A: You cannot add  the save rule twice (which is sufficient to rule out "multiple times"). If it is the "same", it simply replaces the previous "same" rule. If only the titles differ, then (it isn't the same rule and) you have two rules with the same LHS and the same RHS. This may, or may not, produces the same reaction a second time: this depends on what the RHS does or does not.
You can and should clarify these things by reading the documentation and/or experimenting with a simple setup.


text:
Q: making simple Calculator using netbeans i am making a simple calculator using Net beans but there is a problem in between Button and text field .
i want that thing where i click button "1" after clicking one it supposed to show one but nothing showing and please help how to setup "+" button in between them help please.
    /*
     * To change this template, choose Tools | Templates
     * and open the template in the editor.
     */
/**
 *
 * @author Administrator
 */
public class Calculator extends javax.swing.JFrame {

    /**
     * Creates new form Calculator
     */
    public Calculator() {
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jButton12 = new javax.swing.JButton();
        jButton10 = new javax.swing.JButton();
        jButton11 = new javax.swing.JButton();
        jButton9 = new javax.swing.JButton();
        jButton1 = new javax.swing.JButton();
        jTextField1 = new javax.swing.JTextField();
        jButton8 = new javax.swing.JButton();
        jButton5 = new javax.swing.JButton();
        jButton4 = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        jButton7 = new javax.swing.JButton();
        jButton6 = new javax.swing.JButton();
        jButton13 = new javax.swing.JButton();
        jButton3 = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Rajendra Calculator", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.ABOVE_TOP));

        jButton12.setFont(new java.awt.Font("Arial Black", 0, 11)); // NOI18N
        jButton12.setText("=");

        jButton10.setFont(new java.awt.Font("Arial Black", 0, 11)); // NOI18N
        jButton10.setText("0");

        jButton11.setFont(new java.awt.Font("Arial Black", 0, 11)); // NOI18N
        jButton11.setText("+");
        jButton11.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton11ActionPerformed(evt);
            }
        });

        jButton9.setFont(new java.awt.Font("Arial Black", 0, 11)); // NOI18N
        jButton9.setText("9");

        jButton1.setFont(new java.awt.Font("Arial Black", 0, 11)); // NOI18N
        jButton1.setText("1");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jTextField1.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        jTextField1.setText("0");
        jTextField1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextField1ActionPerformed(evt);
            }
        });

        jButton8.setFont(new java.awt.Font("Arial Black", 0, 11)); // NOI18N
        jButton8.setText("8");

        jButton5.setFont(new java.awt.Font("Arial Black", 0, 11)); // NOI18N
        jButton5.setText("5");

        jButton4.setFont(new java.awt.Font("Arial Black", 0, 11)); // NOI18N
        jButton4.setText("4");
        jButton4.setToolTipText("");
        jButton4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton4ActionPerformed(evt);
            }
        });

        jButton2.setFont(new java.awt.Font("Arial Black", 0, 11)); // NOI18N
        jButton2.setText("2");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });

        jButton7.setFont(new java.awt.Font("Arial Black", 0, 11)); // NOI18N
        jButton7.setText("7");

        jButton6.setFont(new java.awt.Font("Arial Black", 0, 11)); // NOI18N
        jButton6.setText("6");

        jButton13.setFont(new java.awt.Font("Arial Black", 0, 11)); // NOI18N
        jButton13.setText("Clear");

        jButton3.setFont(new java.awt.Font("Arial Black", 0, 11)); // NOI18N
        jButton3.setText("3");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                        .addGroup(jPanel1Layout.createSequentialGroup()
                            .addComponent(jButton4)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(jButton5)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(jButton6))
                        .addComponent(jTextField1)
                        .addGroup(jPanel1Layout.createSequentialGroup()
                            .addComponent(jButton1)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(jButton2)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(jButton3))
                        .addGroup(jPanel1Layout.createSequentialGroup()
                            .addComponent(jButton7)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(jButton8)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(jButton9)))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jButton11, javax.swing.GroupLayout.DEFAULT_SIZE, 65, Short.MAX_VALUE)
                            .addComponent(jButton10, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jButton12, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jButton13, javax.swing.GroupLayout.DEFAULT_SIZE, 66, Short.MAX_VALUE)))))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addContainerGap(25, Short.MAX_VALUE)
                .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButton1)
                    .addComponent(jButton2)
                    .addComponent(jButton3))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButton4)
                    .addComponent(jButton5)
                    .addComponent(jButton6))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButton7)
                    .addComponent(jButton8)
                    .addComponent(jButton9))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButton10)
                    .addComponent(jButton13))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButton11)
                    .addComponent(jButton12))
                .addContainerGap())
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(18, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>

    private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {
        // TODO add your handling code here:
    }

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
 jTextField1.setText(jTextField1.getText()+"1");
    }

    private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {
        // TODO add your handling code here:
    }

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
   jTextField1.setText(jTextField1.getText()+"2"); // TODO add your handling code here:
    }

    private void jButton11ActionPerformed(java.awt.event.ActionEvent evt) {
    int valA = Integer.parseInt(jTextField1.getText());
int valB = Integer.parseInt(jTextField1.getText());        // TODO add your handling code here:

        int valC = valA+valB;
        jTextField1.append(Integer.toString(valC));
        jTextField1.append("\n");    // TODO add your handling code here:
    }

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(Calculator.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(Calculator.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(Calculator.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(Calculator.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new Calculator().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton10;
    private javax.swing.JButton jButton11;
    private javax.swing.JButton jButton12;
    private javax.swing.JButton jButton13;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JButton jButton4;
    private javax.swing.JButton jButton5;
    private javax.swing.JButton jButton6;
    private javax.swing.JButton jButton7;
    private javax.swing.JButton jButton8;
    private javax.swing.JButton jButton9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JTextField jTextField1;
    // End of variables declaration
}

A: JTextField does not have an append method, it only has a setText method.
If you really need "appending" capability, then you need to use a JTextArea instead...
Take some time and read through Creating a GUI with Swing and Using text components.
Personally, I would throw out the form designer and get to know the API as well as you can, it will give a greater appreciation of what the form designer does and when it's appropriate to use it...IMHO
Updated
Your basic flow is off.  A user enters a value and press "+", you then try and add the value in the text field to itself and re-apply the value back to the text field...This means that it is unlikely that the user will actually ever be able to sum two values together.
Instead, you should be storing the value in the text field in some kind of List each time the user clicks the "+" button and clearing the text field for the next value.  When they press the "=" button, you should simply iterate over this list and put the result into the textfield and clear the list...
For example...
private List<Integer> values = new ArrayList<Integer>(25);
/*...*/

private void jButton11ActionPerformed(java.awt.event.ActionEvent evt) {
    try {
        int valA = Integer.parseInt(jTextField1.getText());
        values.add(valA);
    } catch (NumberFormatException exp) {
        exp.printStackTrace();
    }
    jTextField1.setText("");
}

You haven't provided an actionPerformed method for the "=" button, but it's contents would look something like...
int result = 0;
for (int value : values) {
    result += value;
}
values.clear();
jTextField1.setText(Integer.toString(result));

A:
...How to set up JButton ..where i press it and it shows "1" on textField

Typically, in cases like this the text field would be non-editable so you can effectively "append" text to the text field by using:
textField.replaceSelection("1");

However, the better approach is to share an Action for all the buttons:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.border.*;

public class ButtonCalculator extends JPanel
{
    private JButton[] buttons;
    private JTextField display;

    public ButtonCalculator()
    {
        Action numberAction = new AbstractAction()
        {
            @Override
            public void actionPerformed(ActionEvent e)
            {
                display.replaceSelection(e.getActionCommand());
            }
        };

        display = new JTextField();
        display.setEditable( false );
        display.setHorizontalAlignment(JTextField.RIGHT);

        JPanel buttonPanel = new JPanel();
        buttonPanel.setLayout( new GridLayout(0, 5) );
        buttons = new JButton[10];

        for (int i = 0; i < buttons.length; i++)
        {
            String text = String.valueOf(i);
            JButton button = new JButton( text );
            button.addActionListener( numberAction );
            buttons[i] = button;
            buttonPanel.add( button );

            //  Support Key Bindings

            KeyStroke pressed = KeyStroke.getKeyStroke(text);
            InputMap inputMap = button.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
            inputMap.put(pressed, text);
            button.getActionMap().put(text, numberAction);
        }

        setLayout( new BorderLayout() );
        add(display, BorderLayout.NORTH);
        add(buttonPanel, BorderLayout.SOUTH);
    }

    private static void createAndShowUI()
    {
        UIManager.put("Button.margin", new Insets(5, 10, 5, 10) );
        JFrame frame = new JFrame("Button Calculator");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.add( new ButtonCalculator() );
        frame.setResizable( false );
        frame.pack();
        frame.setLocationByPlatform( true );
        frame.setVisible( true );
    }

    public static void main(String[] args)
    {
        EventQueue.invokeLater(new Runnable()
        {
            public void run()
            {
                createAndShowUI();
            }
        });
    }
}


text:
Q: Is there a way to push message (LINE app) when there is an edit at google sheet? I don't really know much about coding and I'm doing a project creating Line chat bot that will alarm user (push message to user) when google sheet got edit at column I. Just being clear here I did this for my own entertainment and for school project. I used google script editor to write the code.
But I got error after using UrlFetchApp.fetch('https://api.line.me/v2/bot/message/push',options);
it said error code 400  content {"message":"The request body could not be parsed as JSON (line: 1, column: 10)"} this still be the same after "muteHttpExceptions": true
I'd really appreciate some new Idea or solution for LINE push message when there is an edit in google sheet.
Here is the code! I created function pushMsg() to push message from chatbot to a LINE user (in this case I use my userid to push message to)
function pushMsg() {
  var usrId = "Uc2db25baf...";
  var url = 'https://api.line.me/v2/bot/message/push';
  var channel_access_token = "soEtz7raMUcVQDhlQ7ttFaqUyiktj0...";
  var postData = {
    "to": "U1426ccaa18df...",
    "messages" : [
      {
        "type" : "text",
        "text" : "Hello World"
      }
    ]
  };
  var options = {
    "method" : "post",
    "headers" : {
      "Content-Type" : "application/json",
      "Authorization" : "Bearer " + channel_access_token
    },
    "payload" : JSON.stringify(postData),
    "muteHttpExceptions": true
  };
  var result = UrlFetchApp.fetch(url, options);
  Logger.log("code: " + result.getResponseCode());
  Logger.log("text: " + result.getContentText());
}

I think the issue is at UrlFetchApp.fetch(url,options);
I'm really new to this and not really at good english so sorry if I am not clear. please help I really need some advice. Thank you in advance!
Update
The expected result is code:200 but I got code:400 text: {"message":"Bad request"}
This is another version of code. I tried remove the JSON.stringify but still got error:
function pushMsg() {
  var usrId = "Uc2db25baf...";
  var url = 'https://api.line.me/v2/bot/message/push';
  var channel_access_token = "soEtz7raMUcVQDhlQ7ttFaqUyiktj0...";
  var options = {
    "method" : "post",
    "headers" : {
      "Content-Type" : "application/json",
      "Authorization" : "Bearer " + channel_access_token
    },
    "payload" : {
    "to": "U1426ccaa18df...",
    "messages" : [
      {
        "type" : "text",
        "text" : "Hello World"
      }
    ]
  },
    "muteHttpExceptions": true
  };
  var result = UrlFetchApp.fetch(url, options);
  Logger.log("code: " + result.getResponseCode());
  Logger.log("text: " + result.getContentText());
}

I got error code:400 text: text: {"message":"The request body could not be parsed as JSON (line: 1, column: 10)"} this time.
So as far as I know the problem should be the authorization step right?
Here is the step that I did.

*

*Create Line API

*Create google sheet

*Write the function onEdit(e) make it call pushMsg()

*Deploy web app and put the link to webhook URL at messaging API
Is there any step I missed which can result in the errors I got? Again thank you in advance!!

A: You are on the right track. The issue seems to be that you are telling the endpoint that you are POSTing a JSON "payload". But your payload is not a JSON string yet.
Try changing your options object to:
var options = {
  ...,
  "payload":JSON.stringify({
    "to": "U1426ccaa18df...",
    "messages":[
        {"type":"text", "text":"Hello wor1"}
    ]
  }),
  ...
}


text:
Q: multiple JButton update cluttering the Swing thread I have 100,000 JButton instances that need to update 2 times per sec, each time with different values.
All the JButtons are showing at all times.
What I am seeing is the UI will lag: dragging, moving windows around.
Any way I can enhance the painting / setText process?


text:
Q: Input value changing the display of divs I'm trying to make a div dissapearing after a X value on the input, i can make the value changing when clicked on a div, but the div i want to hide, doesn't hide.. looks like it doesn't update when changing the value of the input.
$("#ticket-plus").on('click', function() {
  $("#naenae").val( +$("#naenae").val() + 5 );
});

if ($("#naenae").val() == 10) {
  $("#badge-one > div").hide();
}

A: use parseInt( befor adding the value
$("#ticket-plus").on('click', function() {
 $("#naenae").val( parseInt($("#naenae").val()) + 5 );
 });

A: You can try to use keyup() or keydown() event :
$("#naenae").keyup(function() {
    if ($("#naenae").val() == 10) {
        $("#badge-one > div").hide();
    }
});

A: Html
<input type="text"/>

Hide me

jQuery
$('input').val(0);

$('input').on('click',function() {
   var $input = $(this);
   $input.val(parseInt($input.val()) + 5);

    if($input.val() == 10) {
         $('div').hide();
    } else {
         $('div').show();
    }
});

Fiddle

A: $("#ticket-plus").on('click', function() {
  $("#naenae").val( +$("#naenae").val() + 5 );
if ($("#naenae").val() == 10) {
  $("#badge-one > div").hide();
}
});


text:
Q: ValueError: negative number cannot be raised to a fractional power When I tried this in terminal
>>> (-3.66/26.32)**0.2

I got the following error
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: negative number cannot be raised to a fractional power

However, I am able to do this in two steps like,
>>> (-3.66/26.32)
-0.13905775075987842
>>> -0.13905775075987842 ** 0.2
-0.6739676327771593

Why this behaviour? What is the way to solve this in single line?

A: Switch to Python 3 which automatically promotes the result to a complex number:
>>> (-3.66/26.32)**0.2
(0.5452512685753758+0.39614823506888347j)

A: Raising to a power takes precedence over the unary minus sign.
So you have -(0.13905775075987842 ** 0.2) and not (-0.13905775075987842) ** 0.2 as you expect:
>>> -0.13905775075987842 ** 0.2
-0.6739676327771593
>>> (-0.13905775075987842) ** 0.2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: negative number cannot be raised to a fractional power

If you want it to work you should write (-3.66/26.32 + 0j)**0.2
>>> (-3.66/26.32 + 0j)**0.2
(0.5452512685753758+0.39614823506888347j)

Or switch Python 3 as noted by @TimPietzcker.


text:
Q: SQL "deduplicate" using NULL as a wildcard Consider the following table, where none of the columns have a NULL constraint:
  a   |  b   |  c   |  d
------+------+------+------
    3 |    5 |   12 | NULL
 NULL |    5 |   12 | NULL
   13 | NULL |   26 | NULL
 NULL | NULL |   26 |    4
    6 |    7 |    5 | NULL
    6 | NULL | NULL | NULL
    6 | NULL |    5 | NULL
    6 |    7 | NULL | NULL
 NULL | NULL | NULL | NULL
(9 rows)

All nine rows are distinct, but if we take NULL to be a "wildcard," meaning that it can take on any value, then only the first, third, fourth, and fifth rows are surely distinct. Since the non-null values of the other rows all appear in the surely distinct rows, I would like to drop these rows to yield the following table:
  a   |  b   | c  |  d
------+------+----+------
    3 |    5 | 12 | NULL
   13 | NULL | 26 | NULL
 NULL | NULL | 26 |    4
    6 |    7 |  5 | NULL
(4 rows)

In a given table, how does one delete rows whose values represent a subset of the values of another row in the same table? Another way of asking this question is, how does one deduplicate a table using NULL as a wildcard?
Don't worry about deleting actual duplicate rows (which is why I put "deduplicate" in quotes in the title). In particular, I would like to be able to do this in both PostgreSQL and Redshift.
For reference, these statements create the original table described above:
CREATE TABLE t (a int, b int, c int, d int);
INSERT INTO t
VALUES (   3,    5,   12, NULL),
       (NULL,    5,   12, NULL),
       (  13, NULL,   26, NULL),
       (NULL, NULL,   26,    4),
       (   6,    7,    5, NULL),
       (   6, NULL, NULL, NULL),
       (   6, NULL,    5, NULL),
       (   6,    7, NULL, NULL),
       (NULL, NULL, NULL, NULL);

A: To only select those without a match based on the NULL wildcards.
Using NOT EXISTS:

SELECT *
FROM T AS t
WHERE NOT EXISTS (
    SELECT 1
    FROM T AS dup
    WHERE (dup.a = t.a OR t.a IS NULL)
      AND (dup.b = t.b OR t.b IS NULL)
      AND (dup.c = t.c OR t.c IS NULL)
      AND (dup.d = t.d OR t.d IS NULL)
      AND CONCAT(dup.a,'-',dup.b,'-',dup.c,'-',dup.d) <> CONCAT(t.a,'-',t.b,'-',t.c,'-',t.d)
)

To only select the duplicates based on the NULL wildcards.
Using EXISTS:

SELECT *
FROM T AS t
WHERE EXISTS (
    SELECT 1
    FROM T AS dup
    WHERE (dup.a = t.a OR t.a IS NULL)
      AND (dup.b = t.b OR t.b IS NULL)
      AND (dup.c = t.c OR t.c IS NULL)
      AND (dup.d = t.d OR t.d IS NULL)
      AND CONCAT(dup.a,'-',dup.b,'-',dup.c,'-',dup.d) <> CONCAT(t.a,'-',t.b,'-',t.c,'-',t.d)
)

To delete the dups from the table, based on the NULL wildcards.
Using EXISTS:

DELETE
FROM T AS t
WHERE EXISTS (
    SELECT 1
    FROM T AS dup
    WHERE (dup.a = t.a OR t.a IS NULL)
      AND (dup.b = t.b OR t.b IS NULL)
      AND (dup.c = t.c OR t.c IS NULL)
      AND (dup.d = t.d OR t.d IS NULL)
      AND CONCAT(dup.a,'-',dup.b,'-',dup.c,'-',dup.d) <> CONCAT(t.a,'-',t.b,'-',t.c,'-',t.d)
)

Do note that because of the compare on the CONCAT, that records which have an exact duplicate won't be seen as dups.
If the table has an ID as primary key, then the compare of the CONCAT's could be replaced by
AND dup.ID <> t.ID

But then those with an exact duplicate would also both be seen as dups.

A: This will fail to detect true duplicates (catches both), I think we still need the ctid (or some cursor-stuff)

WITH enums AS (
        SELECT x.a, x.b,x.c,x.d
        -- , (x.a IS NULL)::integer + (x.b IS NULL)::integer
         -- + (x.c IS NULL)::integer + (x.d IS NULL)::integer AS nnull
        , row_number() OVER www AS rn
        FROM tbl x
        JOIN tbl y
        ON (x.a =y.a OR x.a IS NULL)
        AND (x.b =y.b OR x.b IS NULL)
        AND (x.c =y.c OR x.c IS NULL)
        AND (x.d =y.d OR x.d IS NULL)
        WINDOW WWW AS
        (PARTITION BY COALESCE(x.a ,y.a), COALESCE(x.b ,y.b)
                , COALESCE(x.c ,y.c), COALESCE(x.d ,y.d)
         ORDER BY x.a NULLS LAST
        , x.b NULLS LAST
        , x.c NULLS LAST
        , x.d NULLS LAST )
        )
SELECT* --DELETE
-- FROM  enums ex ; \q
FROM tbl del
WHERE EXISTS ( SELECT *
        FROM  enums ex
        WHERE ex.rn > 1
        AND ex.a IS NOT DISTINCT FROM del.a
        AND ex.b IS NOT DISTINCT FROM del.b
        AND ex.c IS NOT DISTINCT FROM del.c
        AND ex.d IS NOT DISTINCT FROM del.d
        );

A: FYI
Someone posted a pretty tidy answer shortly after I asked my question, but it looks like he/she later deleted it. The code in the answer didn't quite work, but I liked the approach. I've modified it, and it seems to do the job:
DELETE FROM t
 WHERE EXISTS (
   SELECT u.*
     FROM t AS u
    WHERE (t.a IS NULL OR t.a = u.a)
      AND (t.b IS NULL OR t.b = u.b)
      AND (t.c IS NULL OR t.c = u.c)
      AND (t.d IS NULL OR t.d = u.d)
      AND NOT (
        (
          t.a IS NULL AND u.a IS NULL
          OR (
            t.a IS NOT NULL AND u.a IS NOT NULL
            AND t.a = u.a
          )
        )
        AND (
          t.b IS NULL AND u.b IS NULL
          OR (
            t.b IS NOT NULL AND u.b IS NOT NULL
            AND t.b = u.b
          )
        )
        AND (
          t.c IS NULL AND u.c IS NULL
          OR (
            t.c IS NOT NULL AND u.c IS NOT NULL
            AND t.c = u.c
          )
        )
        AND (
          t.d IS NULL AND u.d IS NULL
          OR (
            t.d IS NOT NULL AND u.d IS NOT NULL
            AND t.d = u.d
          )
        )
      )
 );

A more concise version that is not (yet) supported on Redshift:
DELETE FROM t
 WHERE EXISTS (
   SELECT u.*
     FROM t AS u
    WHERE (t.a IS NULL OR t.a = u.a)
      AND (t.b IS NULL OR t.b = u.b)
      AND (t.c IS NULL OR t.c = u.c)
      AND (t.d IS NULL OR t.d = u.d)
          EXCEPT
   SELECT t.*
 );

A: This will find unique rows with wild cards (nulls), but it might not work if there are more than 1 null per match.
This works by first getting rows with without nulls, and joining it back to the base table and filling the nulls. finally, selecting distinct yields the desired result.
WITH nn AS (
    SELECT *
    FROM t
    WHERE a IS NOT NULL
      AND b IS NOT NULL
      AND c IS NOT NULL
      AND d IS NOT NULL
)
SELECT DISTINCT
      COALESCE(t1.a, nn.a) a
    , COALESCE(t1.b, nn.b) b
    , COALESCE(t1.c, nn.c) c
    , COALESCE(t1.d, nn.d) d
    FROM t t1
    LEFT JOIN nn
           ON (t1.a IS NULL OR t1.a = nn.a)
          AND (t1.b IS NULL OR t1.b = nn.b)
          AND (t1.c IS NULL OR t1.c = nn.c)
          AND (t1.d IS NULL OR t1.d = nn.d)

For example, this won't work if two additional rows are inserted:
insert into t values (2, 10, 12, null), (2, null, 12, 10);

because the cte of not-nulls (nn) omits both.


text:
Q: cant get token from laravel passport with authorization_code flow im using laravel passport and i want to get a token like this
https://laravel.com/docs/9.x/passport#requesting-tokens-converting-authorization-codes-to-access-tokens
this is the code in my controller
$response = Http::asForm()->post('http://passport-app.test/sso/oauth/token', [
           'grant_type' => 'authorization_code',
           'client_id' =>env( 'CLIENT_ID'),
          'client_secret' =>env( 'CLIENT_SECRET'),
          'redirect_uri' =>env( 'REDIRECT_URI'),
          'code' => $request->code,
        ]);

        return $response->json();

but im getting an error

  "error": "invalid_request",
    "error_description": "The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed.",
    "hint": "Cannot decrypt the authorization code",
    "message": "The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed."

``


text:
Q: Modifying Alarms Which Trigger Services Based on Screen Status I am currently starting a service using a Broadcast Receiver which fires 60 seconds after the  device boots up. This broadcast receiver triggers an alarm so that my service runs every 60 seconds. Code for this is as follows:
public class ScheduleReceiver extends BroadcastReceiver {
    // Restart service every 60 seconds
    private static final long REPEAT_TIME = 1000 * 60;

    @Override
    public void onReceive(Context context, Intent intent) {
        AlarmManager service = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
        Intent i = new Intent(context, StartServiceReceiver.class);
        PendingIntent pending = PendingIntent.getBroadcast(context, 0, i,PendingIntent.FLAG_CANCEL_CURRENT);

        Calendar cal = Calendar.getInstance();
        // Start 60 seconds after boot completed
        cal.add(Calendar.SECOND, 60);
        // Fetch every 60 seconds
        // InexactRepeating allows Android to optimize the energy consumption
        service.setInexactRepeating(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), REPEAT_TIME, pending);
    }
}

The above starts the service as follows:
public class StartServiceReceiver extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        Intent service = new Intent(context, PhotoService.class);
        context.startService(service);
    }
}

I would like to somehow modify this so that my service runs every 60 seconds when the phone screen is on and every 20 minutes when off.
What is the best way to do this ? Can I modify the alarm dynamically when the screen is switched off/on ?
Thanks for any help,
Regards,
Fido

A: Okay I have found out how to do this so I thought I would put this here in case anyone else is ever curious. (More elegant solutions are always welcome):
First thing is that in my service I added the following to the OnCreate:
 @Override
 public void onCreate() {
     super.onCreate();
     // REGISTER RECEIVER THAT HANDLES SCREEN ON AND SCREEN OFF LOGIC
     IntentFilter filter = new IntentFilter(Intent.ACTION_SCREEN_ON);
     filter.addAction(Intent.ACTION_SCREEN_OFF);
     BroadcastReceiver mReceiver = new ScheduleReceiver();
     registerReceiver(mReceiver, filter);
 }

This is done so that my broadcast receiver can handle those events.  Apparently you cannot register these via intent-filters in the xml.
This means that when the service is created it ensures that these additional system actions can be handled.
I then modified my broadcast receiver to be:
public class ScheduleReceiver extends BroadcastReceiver {
    private static final int ALARM_ID = 909;

    @Override
    public void onReceive(Context context, Intent intent) {
        SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
        AlarmManager service = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
        Intent i = new Intent(context, StartServiceReceiver.class);
        PendingIntent pending = PendingIntent.getBroadcast(context, ALARM_ID, i,PendingIntent.FLAG_CANCEL_CURRENT);
        service.cancel(pending);

        Calendar cal = Calendar.getInstance();
        cal.add(Calendar.SECOND, 60); //Delay startup by one minute - This is useful to prevent over utilization of resources at boot

        // Start alarm. Set a long repeat time if the screen is off and a short repeat time if the screen is on
        if (intent.getAction().equals(Intent.ACTION_SCREEN_ON) || intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)){
            service.setInexactRepeating(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), 60000, pending);
        }
        else if (intent.getAction().equals(Intent.ACTION_SCREEN_OFF)){
            service.setInexactRepeating(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), 600000, pending);
        }
    }
}

From the above I cancel any current alarms with the same pending intent and then I set a new alarm whenever the screen if switched off/on.
This seems to be working for me. As always any improvements are very welcome.


text:
Q: I have two GPUs, how can I just let one to do certain CUDA task? New to CUDA, but have some time spending on computing, and I have geforces at home and tesla (same generation) in the office.
At home I have two gpus installed in the same computer, one is GK110 (compute capability 3.5), the other is GF110 (compute capability 2.0), I perfer to use GK110 for computation task ONLY and GF110 for display UNLESS I tell it to do computation, is there a way to do this through driver setting or I still need to rewrite some of my codes?
Also, if I understand correctly, if the display port of GK110 is not being connected, then the annoying windows timeout detection will not try to reset it even if the computation time is very long?
Btw my CUDA codes are compiled with both compute_35 and compute20, so the codes can be run on both GPUs, however I plan to use features that being exclusive to GK110 so the codes in the future may not being able to run on GF110 at all, and the OS is windows 7.

A: With a GeForce GTX Titan (or any GeForce product) on Windows, I don't believe there is a way to prevent the GPU from appearing in the system in WDDM mode, which means that windows will build a display driver stack on it, even if the card has no physical display attached to it.  So you may be stuck with the windows TDR mechanism.  You could try experimenting with it to confirm that. (The windows TDR behavior can be modified via registry hacking).
Regarding steering CUDA tasks to the GTX Titan, the display driver control panel should have a selectable setting for this.  It may be in the "Manage 3D settings" area or some other area depending on which driver you have.  When you find the appropriate settings area, there will be a selection entitled something like CUDA - GPUs which will probably be set to "All".  If you change the "Global Presets" selection to "Base Profile" you should be able to change this CUDA-GPUs setting.  Clicking on it should give you a selection of "All" or a set of checkboxes for each GPU detected.  If you uncheck the GF110 device and check the GK110 device, then CUDA programs that do not select a particular GPU via cudaSetDevice() should be steered to the GK110 device based on this checkbox selection.  You may want to experiment with this as well to confirm.
Other than that, as mentioned in the comments, using a programmatic method, you can always query device properties and then select the device that reports itself as a cc3.5 device.


text:
Q: create sql table in SQLServer with the name of the current session variable c# I am developing an application in c #. Net and I need to create a table in sql with the name of the current session variable.
How I can send the value of the session variable to current sql server to create this query?
My idea is something like this:
In sql server:
CREATE TABLE Customer_ + 'current user name' // current session variable in c#
(First_Name char(50),
Last_Name char(50),
Address char(50),
City char(50),
Country char(25),
Birth_Date datetime);

Thank you very much for your help.

A: Are you creating a query in c# as a string and sending via sqlcommand? If so, just use
System.Environment.UserName


text:
Q: Post request error using retrofit android I'm using Retrofit on my app to download a video file from the server, in the request i need to do a Post request,
on the interface I have added the parameters needed it....and on the java function I'm passing the parameters too, but
when I try to run the code i get an error:

java.lang.RuntimeException: An error occurred while executing
  doInBackground()

@Headers("Content-Type: application/json; charset=UTF-8")
@Streaming
@POST
Call<ResponseBody> downloadFileStream(@Url String url, @QueryMap Map<String, Object> postdata);

private void downloadFile(String url) {

    FileDownloadClient fileDownloadClient = retrofit.create(FileDownloadClient.class);

    Call<ResponseBody> call = fileDownloadClient.downloadFileStream(url,postdata);
    postdata.put("user", "test@test.com");
    postdata.put("test", "test");

    Call<ResponseBody> call = fileDownloadClient.downloadFileStream(url, postdata);

    call.enqueue(new Callback<ResponseBody>() {
        @Override
        public void onResponse(Call<ResponseBody> call, final Response<ResponseBody> response) {

            new AsyncTask<Void, Void, Void>() {
                @Override
                protected Void doInBackground(Void... voids) {
                    boolean success = writeResponseBodyToDisk(response.body());

                    return null;
                }
            }.execute();
        }

        @Override
        public void onFailure(Call<ResponseBody> call, Throwable t) {
            Toast.makeText(MainActivity.this, "Mal", Toast.LENGTH_LONG).show();
        }
    });
}

A: I was having the same problm, try this...this worked for me
Your interface:
public interface FileDownloadClient {
    @Streaming
    @POST("yourAPI")
    Call<ResponseBody> downloadFileStream(@Body Map<String, Object> postdata);
}

Change this on your downloadFile:
private void downloadFile() {
        Retrofit.Builder builder = new Retrofit.Builder().baseUrl("yourwebsite/api/")
                .addConverterFactory(ScalarsConverterFactory.create())
                .addConverterFactory(GsonConverterFactory.create());

        Retrofit retrofit = builder.build();

        FileDownloadClient fileDownloadClient = retrofit.create(FileDownloadClient.class);

        Map<String, Object> postdata = new HashMap<>();
        postdata.put("user", "test@test.com");
        postdata.put("test", "test");

        Call<ResponseBody> call = fileDownloadClient.downloadFileStream(postdata);
}

Grandle:
implementation 'com.squareup.retrofit2:retrofit:2.5.0'
implementation 'com.google.code.gson:gson:2.6.1'
implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
implementation 'com.squareup.retrofit2:converter-scalars:2.5.0'


text:
Q: Rails: Render a status code without rendering a template I'm trying to make an ajax call to a rails (5.1.3) app. I want the targeted action in the controller to render a status code 200 and do nothing else. Here's how the action looks like.
  def some_delete_action
    respond_to do |format|
      format.js do
        render status: 200, layout: false
      end
    end
  end

The issue is that rails tries to load the template associated with that action. Since there's no such template in my app, I get a ActionView::MissingTemplate error.
How can I render the status code without having rails try to reach for the template ?

A: You could use the ActionController::Head and pass :ok as value:
# home_controller.rb
def do_nothing
  head :ok
end

# routes
get 'home/do_nothing

# request in view
<script type="text/javascript">
  $.get('<%= home_do_nothing_path %>')
</script>


text:
Q: MySQL result to PHP array I want to retrieve order ID's based on order status, then for each order ID retrieve line items to do some stuff for each.
So I have two tables "order_stats" which stores order statuses ofr orders and "order_items" which has line items for each order.
So first MySQL query is
SELECT * FROM `order_stats` WHERE `status` LIKE 'artwork-ready'

Then for each order ID I'll do this to retrieve the line items of each order
SELECT * FROM `order_items` WHERE `order_item_type` LIKE 'line_item' AND `order_id` = 6598

So what I think I need to do is store the first query into a PHP array so I can loop into the second query.
I attempted trying examples I found of using associative arrays but they didn't seem to work for me (e.g.: print_r showed no output). I think if I can see an example specific to what I'm attempting it will help me better understand the syntax. Or maybe I should be doing it another way?


text:
Q: "circular" dependencies in Apache ivy I have a simple ant build with the following ivy dependencies:
<ivy-module version="2.0">
  <info organisation="de.jflex" module="examples.simple"/>
  <dependencies>
    <dependency org="junit" name="junit" rev="4.12"/>
    <dependency org="com.google.guava" name="guava" rev="26.0-jre"/>
    <dependency org="com.google.truth" name="truth" rev="0.36"/>
  </dependencies>
</ivy-module>

ant build fails with:

circular dependency found: com.google.truth#truth;0.36->com.google.testing.compile#compile-testing;0.12->com.google.truth#truth;0.35

But it's not a hard circular dependency: they depend on different versions. How do I work around this?

A: You are only getting a warning, which is also a default value of the circularDependencyStrategysetting. If you really want to hide this, you can set that attribute to ignore. But it looks like that even if you change this, dependecy resolution will still fail, due to unresolved com.google.gwt#gwt-user;2.8.0: com.google.gwt#gwt;2.8.0->org.sonatype.oss#oss-parent;4


text:
Q: Testing Javascript Using Selenium I am trying to test a website. I am able to access most web elements, except the menu items.
Basically there is a drop-down menu, I managed to click on the menu using Selenium, thus opening the drop down menu. Now I need to click on an element in the menu, but the menu seems to be written in Javascript, not as web elements, so I cannot find a way to access the menu items.
Any Ideas? I specifically need to do this in Selenium.
UPDATE: --------------------------------------------------------------------------------------
The menu on the website might be a context menu. It is opened using the left click. Any ideas how I can access its options?

A: The menu may be constructed and manipulated with the page's javascript, but it will exist as html. You can interact with this html using Selenium.

A:  WebElement dropDownListBox = driver.findElement(By.id("Menu_id"));
                  Select clickThis = new Select(dropDownListBox);
                  clickThis.selectByVisibleText(activity); //If you know visible text
                //clickThis.getFirstSelectedOption();  // This will auto select first option in the drop down
               // clickThis.selectByValue(1); //if you the value of drop down list items

A: Opening a contextmenu isn't that easy.
Till now, I'm triggering an mouse-event via execution of a javascript (didn't find an other solution).
It's simular to that discussion:
Trigger right-click
or
Selenium 2 right-click
Sometimes it's useful, if you are are just triggering the underlying js-function.
Most of the time the developer can give you one entrypoint to call.
This will give you the possibility to keep on building your tests and after some time you implemented the javascript function which opens the contextmenu via triggering the event.

A: I have not managed to access the menu items using Selenium other than by clicking the menu, and scrolling through the items using up and down arrows through selenium.
I used OpenScript in order to record/playback the test, and it has worked. In my particular case, the website I was using required a flag to be set to make it testable. If you're encountering problems with testing a website, you might need to contact the developers and ask whether an "automation" flag has been set.


text:
Q: How can I call a cell's contents in MS Excel? I am using Excel to display a chart with some chart summary information in a textbox on top of it. The texbox must contain various data which is obtained from several cell formulas. To avoid changing the values of the text box manually everyday, I would like the textbox to be automatically updated by using the necessary cell values which are elsewhere in the Excel sheet.
What I would like to know is: Is there a way to reference the contents of several cells in a textbox?
Will I have to write a macro to do this? Or am I missing the trick altogether?
Any help would be much appreciated.
Many thanks :)

A: *

*Insert text box

*Click the text box, cut it, click your graph and paste.

*With the text box selected, click the formula bar and insert your formula referencing the cell you want.  Should be good to go.


text:
Q: split string into 3 parts, the middle starts and ends with alphacharacter from A to z $str="&%*&^h-e_l_lo*&^*&";

How to split it into
$left="&%*&^";//until the first A-Za-z character
$right="*&^*&";//right after the last A-Za-z character
$middle = "h-e_l_lo";

I've found this way to find the $left, but I doubt it is the best way:
$curr_word = "&%*&^h-e_l_lo*&^*&";
preg_match('~[a-z]~i', $curr_word, $match, PREG_OFFSET_CAPTURE);
$left = substr($curr_word, 0,$match[0][1]);// &%*&^

A: You could use:
/([^a-zA-Z]*)(.*[a-zA-Z])(.*)/

Explanation
[^a-zA-Z]* Selects everything until it reaches a letter
.*[a-zA-Z] Selects everything until it reaches the last letter
.* Selects the remainder of the string
Example Use
$string = "&%*&^h-e_l_lo*&^*&";
preg_match('/([^a-zA-Z]*)(.*[a-zA-Z])(.*)/', $string, $matches);

echo $matches[1]; // Results in: &%*&^
echo $matches[2]; // Results in: h-e_l_lo
echo $matches[3]; // Results in: &^*&


text:
Q: Splitting strings with slashes in C# I have the following types of strings. One with three slashes and one with two:
a) filepath = "/F00C/Home/About"

b) filepath = "/Administration/Menus"

What I need to do is a function that will allow me to get the values of "home" and "administration" and put into topMenu variable and get the values of "Menus" and "About" and put this into the subMenu variable.
I am familiar with the function slashes = filePath.Split('/');  but my situation is not so simple as there are the two types of variables and in both cases I just need to get the last two words.
Is there a simple way that I could make the Split function work for both without anything to complex?

A: What's wrong with something like this ?
var splits = filePath.Split('/');
var secondLast = splits[splits.Length-2];
var last = splits[splits.Length-1];

Remarks:

*

*Any check on the length of splits array (that must be >= 2) is missing.

*Also, this code works only with forward-slash ('/'). To support both backslash and forward-slash separators, have a look at @Saeed's answer

A: var items = filePath.Split('/');
first = items[items.Length - 2];
second = items[items.Length - 1];

Also if this is a actual path you can use Path:
var dir = Path.GetDirectoryName(filePath);
dir  = Path.GetFileName(dir);
var file = Path.GetFileName(filePath);

Edit: I edited Path version as the way discussed my digEmAll.

A: Am I'm missing something or you just want:
var split = filepath.Split('/');
var last = split[split.Length -1];
var prev = split[split.Length -2];


text:
Q: React native: horizontal swipe-scene pagination with dynamic loading I want to implement horizontal swipe-scene-pagination in react-native app. I need it to have only 3 pages rendered at any moment (current, previous and next) and i want to add new pages dynamically on page change.
I bet there are implementation for that is already done by someone, but i haven't found any.
Also, as far as i remember, this kind of questions are not allowed in stackoverflow. Could you, please, point to the stack-exchange site where i can ask this question?


text:
Q: Rendering Problems error in Android Studio I have a problem that I am having trouble solving. I installed Android Studio with correct ways. When I put a widget in the project, it gives this error and the Gradle processing doesn't finish and its working on button. What should I do now?

A: Try to change this number 8 to 23. it will most probably solve your issue


text:
Q: Azure App Service ModueNotFoundError opencensus I am trying to use application insights inside of a flask app using:
from opencensus.ext.azure.log_exporter import AzureLogHandler

but the runtime throws the following error:
 ModuleNotFoundError: No module named 'opencensus'
However it works perfectly fine locally. I don't have anything to investigate next What should I do now?

A: To add to what Jason shared, please review, https://pypi.org/project/opencensus/ for further troubleshooting of the module including how to export traces.


text:
Q: Error: [ngRepeat:dupes] on a seemingly valid object I am getting a duplicate keys error
This object gives me the error:
$scope.workoutData = {
    "2015-02-01":[["16:22:45","2","7","270","1"]],
    "2015-06-11":[["18:34:10","2","8","225","1"]],
    "2015-06-22":[["18:30:45","1","8","185","1"]]
};

But this one does not:
$scope.workoutData = {
    "2015-02-01":[["16:22:45","2","7","270","1"]],
    "2015-06-11":[["18:34:10","2","8","225","1"]]
};

Here is my HTML

                        {{date}}

                                    Time
                                    Exercise
                                    Reps
                                    Weight
                                    Location

                                    {{dataPoint}}

When the larger object is used,
 properly repeats 3 times, but the data is not added to the 3rd

What is it about "2015-06-22":[["18:30:45","1","8","185","1"]] that gives me this error?


text:
Q: Absolute positioning not working So I'm working with bootstrap and then I have this images which I want to put on the top right part of the page but it seems that position:absolute is not working so I don't know what I'm missing here. I've googled many times but gives me no luck, I have the same code tho. And also I've tried some of those alternatives or tips and tricks but still doesn't work. So here is my code html.

This is the html structure of my images and I have this css:
   #swirl-left { position:absolute; left:0; top:-10px;z-index: 2;}
   #swirl-right { position:absolute; right:0;top:-11px; z-index: 1;}

I tried float:right but still doesn't make it work. I got this output as of now.

So when I re-size the browser it goes with it.I want it to stuck on the top right part of the page.  What I'm missing? If I adjust the browser the images moves with it. It takes me an hour so any help will be appreaciated.

A: Your code works just fine to pin images to the top-left and top-right corners, if the images are smaller than the body tag.
How large are the images you're using, and how wide is your ?
You aren't setting any specific values, so the images are appearing at full size.
Your "output" image looks like all images are the same size as the body, so they're just piled on top of each other.
If you give them all specific width/height attributes in CSS it should work.
In this 2nd example, the images are actually 500x500, which would overlap at full-size, but the CSS width attribute makes them fit properly. You can either use a fixed pixel value, or a percentage if you want the image to be responsive.
body {
    width: 900px;
}

#swirl-left {
    width: 150px;
    position:absolute;
    left:0;
    top:-10px;
}

#swirl-right {
    width: 150px;
    position:absolute;
    right:0;
    top:-10px;
}

Or, since you're using Bootstrap, you could use a class on your img tag to describe the size & # of columns you want the image to take up, like col-sm-2 or something.


text:
Q: Error occurred in deployment step 'Activate Features': Attempted to perform an unauthorized operation I Created a web part and add Event Receiver to handle ItemAdded event.
When run in visual studio , i get error
Error occurred in deployment step 'Activate Features': Attempted to perform an unauthorized operation.

A: Couple of questions

*

*Are you deploying via Visual Studio? or Installing using STSADM/Powershell?

*Did you follow the guidelines for setting up your permissions to deploy from Visual Studio - Read here for those steps:
http://rsuharta.wordpress.com/2011/05/25/error-occurred-in-deployment-step-activate-features-attempted-to-perform-an-unauthorized-operation/
The "unauthorized operation" is a very generic error and doesn't always tell you where you dont have permissions.
The link shared above though should help.


text:
Q: PowerShell nested loop for renaming files in directory I am trying to do a nested loop in PowerShell.  I am renaming images in a several sub directories but i need the loop to reset based on it finding a new directory.
Here is the code I wrote but I can't get it to work as it gives me an error saying the file doesn't exist.

function rename-cruise {

    Param([string]$parkname, [string]$extension=".jpg")

    if(!$parkname){
        $park = $args[0];
    } else {
        $park = $parkname;
    }

    $dirs = Get-ChildItem -Recurse | ?{ $_.PSIsContainer };

    foreach($dir in $dirs){
        if($dir -cnotlike "177"){

            $i = 0;
            $currentDir = get-location;
            $location = "$currentDir\$dir";

             write-host $currentDir
             write-host $location

             Get-ChildItem -Path $location -Filter "*$extension" |
             ForEach-Object {

               if($i -lt 10){

                    $newName = "$park-0$i$extension";
                    Rename-Item $_.Name -NewName $newName;

               } else {

                    $newName = "$park-$i$extension";
                    Rename-Item $_.Name -NewName $newName;

               }

               $i++;

            }

        }
    }

}


text:
Q: creating list of top values in all columns pandas I am trying to get list of top 2 value counts in all columns in my pandas dataframe. DF is something like this
            column1          column2          column3
 1           apple            red               cat
 2          banana            blue              dog
 3          grapes            yellow            cat
 4           apple            blue              cat
 5          banana            red               tiger
 6          banana            blue              dog

I want the result to be in the form of a list. Something like this:
 ['banana', 'apple', 'blue', 'red', 'cat', 'dog']

can someone please help me with this?

A: Use Series.value_counts per all columns and filter top values by index with slice (because value_counts sorting values) and then convert values to list:
a = df.apply(lambda x: x.value_counts()[:2].index.tolist()).to_numpy().ravel('F').tolist()
print (a)
['banana', 'apple', 'blue', 'red', 'cat', 'dog']

List comprehension solution with flatten values:
a = [x for c in df.columns for x in df[c].value_counts()[:2].index]
print (a)
['banana', 'apple', 'blue', 'red', 'cat', 'dog']

A: You can use a simple list comprehension calling value_counts combined with itertools.chain:
from itertools import chain

out = list(chain.from_iterable(df[c].value_counts()[:2].index for c in df))

output: ['banana', 'apple', 'blue', 'red', 'cat', 'dog']


text:
Q: Php curl Jira issue creation not working with custom field All , I am using PHP to create jira issues , below code is working fine , only issue if I sends custom fields value it sending error. please let me know if I am doing it in wrong way.
function createJiraServiceDeskRequestWithAttachment($serviceDeskId,$requestTypeId,$summary,$description = '', array $files = [],
    $url,$user, $token, $primaryCustomerRepId=10202, $isAttachmentPublic = true
): array {

    $returnValue = ['ticket' => [], 'temporaryAttachmentIds' => [], 'attachments' => [], 'error' => null];
    // make sure to remove additional forward slashes /
    $url = rtrim($url, '/');
    $endPoint = $url . '/rest/servicedeskapi/request';
    $data = [
        "serviceDeskId" => $serviceDeskId,
        "requestTypeId" => $requestTypeId,
        "requestFieldValues" => [
            "summary" => $summary,
            "description" => $description,
            // "customfield_10100" => $primaryCustomerRepId
        ],
    ];
    try {
        $ch = curl_init($endPoint);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_POST, 1);
        $jsonData = json_encode($data);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonData);
        curl_setopt($ch, CURLOPT_USERPWD, $user . ":" . $token);
        curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
        $issueResult = curl_exec($ch);
        $issueResult = json_decode($issueResult, true);
        if (curl_errno($ch) || empty($issueResult))
            return $returnValue;
        curl_close($ch);
        $returnValue['ticket'] = $issueResult;
        // here add temporary attachment
        if (! empty ($files)):
            $uploadedAttachments = [];
            $endPoint = $url . "/rest/servicedeskapi/servicedesk/{$serviceDeskId}/attachTemporaryFile";
            foreach ($files as $index => $file) {
                $ch = curl_init($endPoint);
                curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
                curl_setopt($ch, CURLOPT_POST, 1);

                curl_setopt($ch, CURLOPT_POSTFIELDS, ['file' => curl_file_create(
                    realpath($file),
                    mime_content_type($file),
                    basename($file)
                )]);
                curl_setopt($ch, CURLOPT_USERPWD, $user . ":" . $token);
                curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: multipart/form-data', 'X-Atlassian-Token: no-check']);
                $tmpResult = curl_exec($ch);
                if (! curl_errno($ch) && ! empty($tmpResult = json_decode($tmpResult, true))) {
                    if (isset($tmpResult['temporaryAttachments']) && isset($tmpResult['temporaryAttachments'][0]['temporaryAttachmentId']))
                        $uploadedAttachments[] = $tmpResult['temporaryAttachments'][0]['temporaryAttachmentId'];
                }
                curl_close($ch);
            }
        else:
            return $returnValue;
        endif;
        // check if there are temporary attachments uploaded, then link them with the request

        if (! empty($uploadedAttachments)):
            $returnValue['temporaryAttachmentIds'] = $uploadedAttachments;
            $endPoint = $url . "/rest/servicedeskapi/request/{$issueResult['issueId']}/attachment";
            $ch = curl_init($endPoint);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
            curl_setopt($ch, CURLOPT_POST, 1);
            $jsonData = json_encode(["temporaryAttachmentIds" => $uploadedAttachments, 'public' => $isAttachmentPublic]);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonData);
            curl_setopt($ch, CURLOPT_USERPWD, $user . ":" . $token);
            curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
            $attachresult = curl_exec($ch);

            $attachresult = json_decode($attachresult, true);
            if (! curl_errno($ch) && ! empty($attachresult))
                $returnValue['attachments'] = $attachresult;
            curl_close($ch);
            return $returnValue;
        else:
            return $returnValue;
        endif;
    } catch (\Exception $e) {
        $returnValue['error'] = $e->getMessage();
        return $returnValue;
    }
}

If I uncomment this code customfield_10100, it doesn't work
I also tried to place it outside of requested values array
"fields" =>[
        "customfield_10100" => $primaryCustomerRepId
        ]


text:
Q: Using matplotlib to generate 3D surfaces from 2D matrices Using a 2d matrix in python, how can I create a 3d surface plot, where columns=x, rows=y and the values are the heights in z?
I can't understand how to creat 3D surface plot using matplotlib.
Maybe it's different from MatLab.
example:
from pylab import *
from mpl_toolkits.mplot3d import Axes3D

def p(eps=0.9, lmd=1, err=10e-3, m=60, n=40):

    delta_phi = 2 * np.pi / m
    delta_lmd = 2 / n
    k = 1
    P0 = np.zeros([m + 1, n + 1])
    P = np.zeros([m + 1, n + 1])
    GAP = 1

    while GAP >= err:
        k = k + 1
        for i in range(0, m):
            for j in range(0, n):
                if (i == 1) or (j == 1) or (i == m + 1) or (i == n + 1):
                    P[i,j] = 0
                else:
                    A = (1+eps*np.cos((i+1/2)*delta_phi))**3
                    B = (1+eps*np.cos((i-1/2)*delta_phi))**3
                    C = (lmd*delta_phi/delta_lmd)**2 * (1+eps*np.cos((i)*delta_phi))**3
                    D = C
                    E = A + B + C + D
                    F = 3*delta_phi*((1+eps*np.cos((i+1/2)*delta_phi))-(1+eps*np.cos((i-1/2)*delta_phi)))
                    P[i,j] = (A*P[i+1,j] + B*P[i-1,j] + C*P[i,j+1] + D*P[i,j-1] - F)/E
                    if P[i,j] < 0:
                        P[i,j] = 0
        S = P.sum() - P0.sum()
        T = P.sum()
        GAP = S / T
        P0 = P.copy()
    return P, k

def main():
    start = time.time()
    eps = 0.9
    lmd = 1
    err = 10e-8
    m = 60
    n = 40
    P, k = p()

    fig = figure()
    ax = Axes3D(fig)
    X = np.linspace(0, 2*np.pi, m+1)
    Y = np.linspace(-1, 1, n+1)
    X, Y = np.meshgrid(X, Y)
    #Z = P[0:m, 0:n]
    #Z = Z.reshape(X.shape)
    ax.set_xticks([0, np.pi/2, np.pi, np.pi*1.5, 2*np.pi])
    ax.set_yticks([-1, -0.5, 0, 0.5, 1])
    ax.plot_surface(X, Y, P)
    show()

if __name__ == '__main__':
    main()

ValueError: shape mismatch: objects cannot be broadcast to a single
  shape

And the pic
pic by matplotlic
And I also use MatLab to generate,the pic:
pic by MatLab

A: I should think this is a problem of getting the notaton straight. A m*n matrix is a matrix with m rows and n columns. Hence Y should be of length m and X of length n, such that after meshgridding X,Y and P all have shape (m,n).
At this point there would be no need to reshape of reindex and just plotting
ax.plot_surface(X, Y, P)

would give your the desired result.

A: Let's assume if you have a matrix mat.
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits import mplot3d

h, w = mat.shape
plt.figure(figsize=(16, 8))
ax = plt.axes(projection='3d')
X, Y = np.meshgrid(np.arange(w), np.arange(h))
ax.plot_surface(X, Y, mat, rstride=1, cstride=1, cmap='viridis', edgecolor='none', antialiased=False)


text:
Q: cmake's ExternalProject_Add: how to set source, build and install directories I want to use ExternalProject_Add function to install cmake enabled projects. I need to control the building and installation processes. More specifically, I want that cmake build and install in specific directories.
There is an option to select a path where to put the source directory: SOURCE_DIR. Is there something equivalent for BUILD_DIR and INSTALL_DIR? I did not see anything alike.
There is a PREFIX option:

Root dir for entire project

What does it mean exactly? An how does cmake's ExternalProject_Add do the installation?
Edit:
This work, but I have no control over source directory and it does not install the library:
ExternalProject_Add(
    wjelement-project

    GIT_REPOSITORY "https://github.com/netmail-open/wjelement.git"
    GIT_TAG "v1.2"

    UPDATE_COMMAND ""
    PATCH_COMMAND ""
    TEST_COMMAND ""
    INSTALL_COMMAND ""

    #SOURCE_DIR "${MY_SOURCE_ROOT}/wjelement"
    BINARY_DIR "${MY_BUILD_DIR}/wjelement"
    INSTALL_DIR "${CCT_INSTALL_DIR}/wjelement"
)

*

*If I uncomment SOURCE_DIR, it does not clone from GIT_CLONE but try to get source from SOURCE_DIR (and it fails because that's not what I expected...)

*If I comment INSTALL_COMMAND  "", then it try to install in C:/Program Files/wjelement, the default (apparently) and not in INSTALL_DIR

*default path for source files seem to be ${CMAKE_BINARY_DIR}/wjelement-project-prefix/src
Another Stackoverflow question report problem (or at least non intuitive behavior) with INSTALL_DIR.


text:
Q: Chrome Extension - pass parameter to new tab I would like to create a chrome extension that open my website on homepage / new tab. I used the HTML tag <meta http-equiv.. to redirect the user to my website and it working great.
The problem is that I want to pass parameter (create unique ID for each user) and to attach this parameter to my website URL:
for example: http://www.mywebsite.com/?user_id=parameter_value_here

*

*where I should create my user id?

*how I pass it to the new tab html file?
My extension code:
newTab.html
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="refresh" content="0; url=http://www.mywebsite.com/?user_id=value_here" />
    </head>
    <body style="display: none;">

    </body>
</html>

Manifest
{
  "name": "My website name",
  "version": "1.1",
  "description": "website description goes here",
  "chrome_url_overrides" : {
    "newtab": "newTab.html"
  },
  "permissions": [
    "topSites",
    "chrome://favicon/"
  ],
  "manifest_version": 2,
  "permissions":[
    "http://*/*",
    "https://*/*",
    "management",
    "storage",
    "tabs",
    "webRequest",
    "webRequestBlocking",
    "cookies",
    "bookmarks"
]
}


text:
Q: Create a button for multiple events on every single click I want a button named forward which helps the program to shift the string O from Label1 to Label2 and Label2 to Label3 on the next click and so on.

A: Following is example code for forward button, and you can do backward by yourself. hope this can help you.
using System;
using System.Windows.Forms;

namespace WindowsFormsApp1
{
    public partial class Form1 : Form
    {
        enum stringLocation : int
        {
            label1,label2, label3, label4
        }
        int location =(int) stringLocation.label1;
        string contentToMove= "0";
        public Form1()
        {
            InitializeComponent();
        }

        private void forward_Click(object sender, EventArgs e)
        {
            location = (location+1) % 4;
            switch (location){
            case (int) stringLocation.label1:
                    label1.Text = contentToMove;
                    label2.Text = "";
                    label3.Text = "";
                    label4.Text = "";
                    break;
            case (int) stringLocation.label2:
                    label1.Text = "";
                    label2.Text = contentToMove;
                    label3.Text = "";
                    label4.Text = "";
                    break;
            case (int) stringLocation.label3:
                    label1.Text =  "";
                    label2.Text = "";
                    label3.Text = contentToMove;
                    label4.Text = "";
                    break;
            case (int)stringLocation.label4:
                    label1.Text = "";
                    label2.Text = "";
                    label3.Text = "";
                    label4.Text = contentToMove;
                    break;
            default:
                break;
            }

        }

        private void Form1_Load(object sender, EventArgs e)
        {
            label1.Text = contentToMove;
            label2.Text = "";
            label3.Text = "";
            label4.Text = "";
        }
    }
}


text:
Q: MVC razor view with EditorFor helper, check box displayed twice Rendered image :
Image Link
cshtml
<label>
   @Html.DisplayFor(model => @Model.LeaveDetailsList[i].LeaveType)
   @Html.EditorFor(model => @Model.LeaveDetailsList[i].IsSelected)
</label>

View in Browser
<label>
       Annual Leave
       <input class="check-box" data-val="true" data-val-required="The IsSelected field is required." id="LeaveDetailsList_0__IsSelected" name="LeaveDetailsList[0].IsSelected" type="checkbox" value="true" />
       <input name="LeaveDetailsList[0].IsSelected" type="hidden" value="false" />
    </label>


text:
Q: How to kill processes autostarted by another process in ubuntu 20 after recent apt get update on ubuntu (20.04.4 LTS), my laptop's %CPU is skyrocketing and the villain is this process (output from top):
 126978 5050      20   0   65460  59152   5824 R 100.0   0.4   0:03.45 gunicorn

i do not have gunicorn installed;
no matter how i kill this process (kill -9 $PID, pkill -f gunicorn, etc.), it comes back, and it seems it is autostarted by another process:
$ ps -faux | grep gunicorn
gosia     128413  0.0  0.0   9036   716 pts/0    S+   11:33   0:00  |   |   \_ grep --color=auto gunicorn
5050      125403  0.2  0.1  23380 20748 ?        Ss   11:26   0:01  \_ /venv/bin/python3 /venv/bin/gunicorn --timeout 86400 --bind [::]:9432 -w 1 --threads 25 --access-logfile - -c gunicorn_config.py run_pgadmin:app
5050      128411  0.0  0.1  37436 30912 ?        R    11:33   0:00      \_ /venv/bin/python3 /venv/bin/gunicorn --timeout 86400 --bind [::]:9432 -w 1 --threads 25 --access-logfile - -c gunicorn_config.py run_pgadmin:app

i'm not using any virtual environment at the moment:
$ which python3
/usr/bin/python3

i don't know where to go from this point... how can i effectively kill it and prevent from autostart?
thanks so much for any help!

A: I got some more info using the command pstree -aH $PID, which showed me this:
systemd splash
...
  ├─containerd-shim -namespace moby -id 56b1f6243bde3d21fcfcdc6ff77e6dce9d92acbc9583d7cc3a3f8420a33855ce -address /run/containerd/containerd.sock
  │   ├─gunicorn /venv/bin/gunicorn --timeout 86400 --bind [::]:9432 -w 1 --threads 25 --access-logfile - -c gunicorn_config.py run_pgadmin:app
  │   │   ├─gunicorn /venv/bin/gunicorn --timeout 86400 --bind [::]:9432 -w 1 --threads 25 --access-logfile - -c gunicorn_config.py run_pgadmin:app
  │   │   └─master -w
  │   │       ├─pickup -l -t unix -u
  │   │       └─qmgr -l -t unix -u

and so it seems these are container issues?
This is weird - i played with docker some time (months) ago, but uninstalled it from my system and removed all containers just after (or that's what i thought...)
but to be sure there are no leftovers, i found this post: https://fedingo.com/how-to-uninstall-docker-in-ubuntu/ and followed the steps to completely purge docker.
This seems to have worked, no more gunicorn processes.
Could this be something i pulled with apt update (only recommended and trusted ubuntu software updates)?


text:
Q: Hold RMB after button and click I can't figure this out.
I'm trying to accomplish something like this:

*

*Press a GUI button

*When I click the mouse next hold the RMB

*When I click again release the RMB

Current work:
    Toggle=0
    GUI, Add, Button, w50 h50, Nbutton
    GUI, Show, x50 y50
    return

    ButtonNButton:
    {
        Toggle:=!Toggle
    }

    if GetKeyState("LButton","P")
        if (Toggle == 1)
            MsgBox, Do
            Toggle:=!Toggle
    return

A: This should work to accomplish what you want.
Note that right now, this example script is limited to only work in Notepad. You should update the script to target whatever program/game/window you want the hotkey to be active in.
Toggle := 0
GUI, Add, Button, w50 h50, Nbutton
GUI, Show, x50 y50
return

ButtonNButton:
    Toggle:=!Toggle

    ; Update this line to match whatever window you want the hotkey active
    ; in, or delete this line to make the hotkey active everywhere.
    Hotkey, IfWinActive, ahk_class Notepad

    if Toggle
    {
        Hotkey, ~*LButton Up, RBSwitch, On
    }
    else
    {
        if GetKeyState("RButton") ;release RButton when hotkey is disabled
            Send {RButton Up}
        Hotkey, ~*LButton Up, RBSwitch, Off
    }
RETURN

RBSwitch:
    if GetKeyState("RButton")
        Send {RButton Up}
    else
        Send {RButton Down}
RETURN


text:
Q: Is there any way can I use chrome in different region without installing on AWS ec2 neither any other server I have a website that is only accessible from the European Union. Let's say I've traveled to Asia and need to view some websites (booking tickets etc). because it states that this site is inaccessible from your current location
Do I make use of any other services besides AWS workspace/DAAS?

A: You can use a VPN. Some options are:

*

*Install a VPN server in an allowed region and connect from your client. AWS and Digital Ocean might have some out-of-box VPN servers on the marketplace

*Alternatively, you can try using some free VPN server like VPN Gate

*Or choosing a cloud VPN service like ExpressVPN

A: Create an AWS Workspace virtual desktop in whichever region you need. Takes no time, there's a small monthly charge then it's hourly, or you can pay a single monthly charge if you use it a lot that works out better value.


text:
Q: Problem is infeasible with Gurobi, feasible with cbc (but can't access objective value) I am solving a MILP with cbc and gurobi (via pyomo). Gurobi states that the model is infeasible. As to cbc the solver status states that a feasible and optimal solution is found, but then it fails to access the value of the objective (which in turn crashed my program).
Here is how I access the objective value
solver_parameters = "ResultFile=model.lp"
opt = SolverFactory(solver)

results = opt.solve(self.model, tee=False, options_string=solver_parameters,logfile="model.log")
# checking status and terminiation condition
print ("The solver returned a status of: "+str(results.solver.status))
print (str(results.solver))
if (results.solver.status == SolverStatus.ok) and (results.solver.termination_condition== TerminationCondition.optimal):
   print ("Problem is feasible and solution is optimal")
        objective_value = value(self.model.objective)
else:
   print("Problem is infeasible")
   objective_value = None

With cbc I get
The solver returned a status of: ok

- Status: ok
  Message: CBC 2.10.5
  Termination condition: optimal
  Id: 0
  Error rc: 0
  Time: 0.011972904205322266

Problem is feasible and solution is optimal

ERROR: evaluating object as numeric value: x[0]
        (object: <class 'pyomo.core.base.var._GeneralVarData'>)
    No value for uninitialized NumericValue object x[0]
ERROR: evaluating object as numeric value: objective
        (object: <class 'pyomo.core.base.objective.SimpleObjective'>)
    No value for uninitialized NumericValue object x[0]
Traceback (most recent call last):
...
  File "c:...", line 531, in solve
    objective_value = value(self.model.objective)
  File "pyomo\core\expr\numvalue.pyx", line 246, in pyomo.core.expr.numvalue.value
  File "pyomo\core\expr\numvalue.pyx", line 231, in pyomo.core.expr.numvalue.value
  File "C:...\lib\site-packages\pyomo\core\base\expression.py", line 55, in __call__
    return self.expr(exception=exception)
  File "pyomo\core\expr\numeric_expr.pyx", line 218, in pyomo.core.expr.numeric_expr.ExpressionBase.__call__
  File "C:...\lib\site-packages\pyomo\core\expr\visitor.py", line 1054, in evaluate_expression
    return visitor.dfs_postorder_stack(exp)
  File "C:...\venv\lib\site-packages\pyomo\core\expr\visitor.py", line 584, in dfs_postorder_stack
    flag, value = self.visiting_potential_leaf(_sub)
  File "C:...\lib\site-packages\pyomo\core\expr\visitor.py", line 962, in visiting_potential_leaf
    return True, value(node)
  File "pyomo\core\expr\numvalue.pyx", line 246, in pyomo.core.expr.numvalue.value
  File "pyomo\core\expr\numvalue.pyx", line 233, in pyomo.core.expr.numvalue.value
ValueError: No value for uninitialized NumericValue object x[0]

On the other hand with gurobi I get
WARNING: Loading a SolverResults object with a warning status into
    model.name="unknown";
      - termination condition: infeasible
      - message from solver: Model was proven to be infeasible.
The solver returned a status of: warning

- Status: warning
  Return code: 0
  Message: Model was proven to be infeasible.
  Termination condition: infeasible
  Termination message: Model was proven to be infeasible.
  Wall time: 0.0019626617431640625
  Error rc: 0
  Time: 0.08476400375366211

Problem is infeasible

I'm assuming problem is indeed infeasible and the error comes from cbc. Is this kind of error common, and what would be a way to avoid this?
Finally, this is the lp model returned by gurobi
\ Model x79
\ LP format - for model browsing. Use MPS format to capture full model detail.
Maximize
  - 100 x12 - 200 x13 - 300 x14 - 400 x15 - 70 x16 - 140 x17 - 90 x18
   - 90 x19
Subject To
 c_u_x80_: x12 - 100 x1 <= 0
 c_u_x81_: x13 - 100 x2 <= 0
 c_u_x82_: x14 - 100 x3 <= 0
 c_u_x83_: x15 - 100 x4 <= 0
 c_u_x84_: x16 - 50 x5 <= 0
 c_u_x85_: x17 - 50 x6 <= 0
 c_u_x86_: x18 - 25 x7 <= 0
 c_u_x87_: x19 - 25 x8 <= 0
 c_l_x88_: x12 >= 0
 c_l_x89_: x13 >= 0
 c_l_x90_: x14 >= 0
 c_l_x91_: x15 >= 0
 c_l_x92_: x16 >= 0
 c_l_x93_: x17 >= 0
 c_l_x94_: x18 >= 0
 c_l_x95_: x19 >= 0
 c_u_x96_: x1 <= 1
 c_u_x97_: x2 <= 1
 c_u_x98_: x3 <= 1
 c_u_x99_: x4 <= 1
 c_u_x100_: x5 <= 1
 c_u_x101_: x6 <= 1
 c_u_x102_: x7 <= 1
 c_u_x103_: x8 <= 1
 c_e_x104_: x12 + x16 = 51
 c_e_x105_: x13 + x17 = 51
 c_e_x106_: x14 + x18 = 51
 c_e_x107_: x15 + x19 = 51
 c_u_x108_: - x7 + x9 <= 0
 c_u_x109_: - x6 + x10 <= 0
 c_u_x110_: - x2 - x3 + x11 <= 0
 c_u_x111_: x7 - 2 x9 <= 0
 c_u_x112_: x6 - 2 x10 <= 0
 c_u_x113_: x2 + x3 - 2 x11 <= 0
 c_u_x114_: 100 x13 + 20 x14 + 100 x17 + 20 x18 <= 6072
 c_u_x115_: - 20 x18 + 1260 x9 <= 0
 c_u_x116_: - 100 x17 + 1260 x10 <= 0
 c_u_x117_: - 100 x13 - 20 x14 + 1260 x11 <= 0
 c_u_x118_: 2 x1 - x24 <= 0
 c_u_x119_: 2 x2 - x25 <= 0
 c_u_x120_: 15 x3 - x26 <= 0
 c_u_x121_: 10 x4 - x27 <= 0
 c_u_x122_: 1.4 x5 - x24 <= 0
 c_u_x123_: 1.4 x6 - x25 <= 0
 c_u_x124_: 4.5 x7 - x26 <= 0
 c_u_x125_: 2.25 x8 - x27 <= 0
 c_u_x126_: 100 x12 + 200 x13 + 300 x14 + 400 x15 + 70 x16 + 140 x17
   + 90 x18 + 90 x19 - 2550 x24 - 5100 x25 - 1020 x26 - 2040 x27 + 6072 x48
   + 100 x60 + 100 x61 + 100 x62 + 100 x63 + 50 x64 + 50 x65 + 25 x66
   + 25 x67 - 1260 x76 - 1260 x77 - 1260 x78 <= 0
 c_u_x127_: - 1000 x1 + x60 <= 0
 c_u_x128_: - 1000 x2 + x61 <= 0
 c_u_x129_: - 1000 x3 + x62 <= 0
 c_u_x130_: - 1000 x4 + x63 <= 0
 c_u_x131_: - 1000 x5 + x64 <= 0
 c_u_x132_: - 1000 x6 + x65 <= 0
 c_u_x133_: - 1000 x7 + x66 <= 0
 c_u_x134_: - 1000 x8 + x67 <= 0
 c_u_x135_: x60 - x32 <= 0
 c_u_x136_: x61 - x33 <= 0
 c_u_x137_: x62 - x34 <= 0
 c_u_x138_: x63 - x35 <= 0
 c_u_x139_: x64 - x36 <= 0
 c_u_x140_: x65 - x37 <= 0
 c_u_x141_: x66 - x38 <= 0
 c_u_x142_: x67 - x39 <= 0
 c_u_x143_: 1000 x1 - x60 + x32 <= 1000
 c_u_x144_: 1000 x2 - x61 + x33 <= 1000
 c_u_x145_: 1000 x3 - x62 + x34 <= 1000
 c_u_x146_: 1000 x4 - x63 + x35 <= 1000
 c_u_x147_: 1000 x5 - x64 + x36 <= 1000
 c_u_x148_: 1000 x6 - x65 + x37 <= 1000
 c_u_x149_: 1000 x7 - x66 + x38 <= 1000
 c_u_x150_: 1000 x8 - x67 + x39 <= 1000
 c_u_x151_: - 1000 x1 + x68 <= 0
 c_u_x152_: - 1000 x2 + x69 <= 0
 c_u_x153_: - 1000 x3 + x70 <= 0
 c_u_x154_: - 1000 x4 + x71 <= 0
 c_u_x155_: - 1000 x5 + x72 <= 0
 c_u_x156_: - 1000 x6 + x73 <= 0
 c_u_x157_: - 1000 x7 + x74 <= 0
 c_u_x158_: - 1000 x8 + x75 <= 0
 c_u_x159_: x68 - x40 <= 0
 c_u_x160_: x69 - x41 <= 0
 c_u_x161_: x70 - x42 <= 0
 c_u_x162_: x71 - x43 <= 0
 c_u_x163_: x72 - x44 <= 0
 c_u_x164_: x73 - x45 <= 0
 c_u_x165_: x74 - x46 <= 0
 c_u_x166_: x75 - x47 <= 0
 c_u_x167_: 1000 x1 - x68 + x40 <= 1000
 c_u_x168_: 1000 x2 - x69 + x41 <= 1000
 c_u_x169_: 1000 x3 - x70 + x42 <= 1000
 c_u_x170_: 1000 x4 - x71 + x43 <= 1000
 c_u_x171_: 1000 x5 - x72 + x44 <= 1000
 c_u_x172_: 1000 x6 - x73 + x45 <= 1000
 c_u_x173_: 1000 x7 - x74 + x46 <= 1000
 c_u_x174_: 1000 x8 - x75 + x47 <= 1000
 c_u_x175_: - 1000 x9 + x76 <= 0
 c_u_x176_: - 1000 x10 + x77 <= 0
 c_u_x177_: - 1000 x11 + x78 <= 0
 c_u_x178_: x76 - x49 <= 0
 c_u_x179_: x77 - x50 <= 0
 c_u_x180_: x78 - x51 <= 0
 c_u_x181_: 1000 x9 - x76 + x49 <= 1000
 c_u_x182_: 1000 x10 - x77 + x50 <= 1000
 c_u_x183_: 1000 x11 - x78 + x51 <= 1000
 c_l_x184_: - 50 x24 + x32 - x40 >= -100
 c_l_x185_: - 100 x25 + 100 x48 + x33 - x41 - 100 x51 >= -200
 c_l_x186_: - 20 x26 + 20 x48 + x34 - x42 - 20 x51 >= -300
 c_l_x187_: - 40 x27 + x35 - x43 >= -400
 c_l_x188_: - 50 x24 + x36 - x44 >= -70
 c_l_x189_: - 100 x25 + 100 x48 + x37 - x45 - 100 x50 >= -140
 c_l_x190_: - 20 x26 + 20 x48 + x38 - x46 - 20 x49 >= -90
 c_l_x191_: - 40 x27 + x39 - x47 >= -90
 c_u_x192_: x24 <= 2
 c_u_x193_: x25 <= 2
 c_u_x194_: x26 <= 15
 c_u_x195_: x27 <= 10
 c_e_ONE_VAR_CONSTANT: ONE_VAR_CONSTANT = 1
Bounds
 x24 free
 x25 free
 x26 free
 x27 free
Binaries
 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11
End

A: This is already answered in this duplicate question over on OR exchange: The problem is indeed infeasible and CBC reports an incorrect optimality status.

A: Try running the model through IIS, which will show what constraints cause the infeasibilities.


text:
Q: Access SharePoint list from Node.js I am trying to get SharePoint list items from Node.js app but I am still getting following error:
No XML to parse!
at new XmlDocument (C:\Users\xx\Desktop\AppTest2\node_modules\xmldoc\lib\xmldoc.js:247:11)
at C:\Users\xx\Desktop\AppTest2\node_modules\node-sp-auth\lib\src\utils\AdfsHelper.js:28:25
at processTicksAndRejections (node:internal/process/task_queues:96:5)
As you may see, I tried it with 'node-sp-auth' and 'sp-request' but result is the same.
Could it be some security or network related issue or do I miss something?
I tried the same http request via power automate and it was working.
Thanks for your help in advance.

var express = require('express');
var app = express();
const port = process.env.PORT || 3000;

//sharepoint auth libs
var spauth = require('node-sp-auth');
var request = require('request-promise');
var $REST = require("gd-sprest");
var url = "https://inoffice.sharepoint.com/sites/";
const credentialOptions =
  {
  username: "xx",
  password: "oxxVMQOz",
  online: true
  };
const credentialOptions2 =
  {
  username: "yy",
  password: "xxx",
  online: true
  };
var sprequest = require('sp-request');
let spr = sprequest.create(credentialOptions);

spr.get('https://inoffice.sharepoint.com/sites/DEV/_api/web/lists/GetByTitle(\'Users\')')
  .then(response => {
    console.log('List Id: ' + response.body.d.Id);
  })
  .catch(err =>{
    console.log(err);
  });

/*
spauth.getAuth(
  url,
  {
  username: "WW_DEV_AAPeople_Mgmt@emea.adecco.net",
  password: "oq&a@Dl59XVMQOz",
  online: true
  }
).then(options => {
  // Log
  console.log("Connected to SPO");

  // Code Continues in 'Generate the Request'
});
*/


text:
Q: Routing not working in a react app with webpack I'm trying to create a react app with webpack which has some routing as well.
 "react-router-dom": "^5.2.0",

The routing works but when I go to a specific route and reload the page, it gives an error cannot get /about
import React from "react";
import {
  BrowserRouter as Router,
  Switch,
  Route,
  Link
} from "react-router-dom";

export default function App() {
  return (
    <Router>

              <Link to="/">Home</Link>

              <Link to="/about">About</Link>

              <Link to="/users">Users</Link>

        <Switch>
          <Route path="/about">
            <About />
          </Route>
          <Route path="/users">
            <Users />
          </Route>
          <Route path="/">
            <Home />
          </Route>
        </Switch>

    </Router>
  );
}

function Home() {
  return
Home
;
}

function About() {
  return
About
;
}

function Users() {
  return
Users
;
}

As mentioned in this answer, adding
devServer: {
    historyApiFallback: true,
  }

fixes the issue when its being run locally, but as soon as I deploy it, I get the same error

A: This happens because your server does not know what to do when it is hit by the /about route, initially when the browser has no asset files (HTML, JS, etc.). It occurs only when you are at /about and you refresh the page.
React router is a client side router, and hence the browser needs to load the client assets completely before it can work on your routes.
All you need to do is to configure your server to give all your assets to client even if it hit by an unknown route. i.e. when the 404 (Not found) situation arises at the server, your server should still provide all the assets that would otherwise be delivered when the route is at /.
And your react router should handle the 404 (Not found) event at the client side. as follows,
<Router>

          <Link to="/">Home</Link>

          <Link to="/about">About</Link>

          <Link to="/users">Users</Link>

    <Switch>
      <Route exact path="/about">
        <About />
      </Route>
      <Route exact path="/users">
        <Users />
      </Route>
      <Route exact path="/">
        <Home />
      </Route>
      <Route path="*">

Page Not Found

      </Route>
    </Switch>

</Router>

Please remember that, if you want to nest the routes then remove the exact property from the parent Route.


text:
Q: enter Odd, Even, zero and negative numbers and count using for and while loop in C++ without using arrray I've met some problem during programming. I want to write a program to differentiate even numbers, odd numbers, zero values and negative numbers by using while and for loop.
1st question :
However, when I try to run my program, the last number I've entered will not be counted. I know it occur because of my o++ put at the top of the if condition, how should I solve my problem?
2nd question :
For the for loop parts, actually it may ignored those negative values. How should I solve it to let the negative numbers also count in loop ? May I changed the num>0 to num < 100000 to let the for loop works?
#include<iostream>
using namespace std;

#include<iostream>
using namespace std;

int main ()
{
    int num ,numbers = 1 ;
    char answer = 'Y' ;
    int o=0, e=0, z=0 ,n=0 ;
    // o for odd numbers, e for even numbers, z for zero values, n for negative numbers
    cout << "Enter number" << numbers << ": " << endl ;
    cin >> num ;
    for ( num = num ; num >0; num++)
    while (answer == 'y' || answer == 'Y')
    {
        if (num % 2 == 0 && num > 0)
            {
                e++ ;
                cout<< "The number of even numbers is :" << e << endl;
                numbers ++ ;
                cout<<"Please enter number" << numbers  << endl ;
                cin >> num ;
                cout<<"If you wish to continue, Please enter y or Y to continue this program : "<< endl ;
                cin>> answer ;
            }
        else if (num % 2 == 1 && num > 0)
            {
                o++;
                cout<< "The number of odd numbers is :" << o << endl;
                numbers ++ ;
                cout<<"Please enter number" << numbers  << endl ;
                cin >> num;
                cout<<"If you wish to continue, Please enter y or Y to continue this program : "<< endl ;
                cin>> answer ;
            }
        else if (num == 0)
            {
                z ++;
                cout<< "The total of 0 is :" << z << endl;
                numbers ++ ;
                cout<<"Please enter number" << numbers  << endl ;
                cin >> num;
                cout<<"If you wish to continue, Please enter y or Y to continue this program : "<< endl ;
                cin>> answer ;
            }

    }

    cout << "The total even numbers is :" << e << endl;
    cout << "The total odd numbers is :" << o << endl ;
    cout << "The total negative numbers is :" << n << endl ;
    cout << "The total zero number is:" << z << endl;
    return 0;
}

A: This line, in main() is really puzzling:
// ...
for ( num = num ; num >0; num++)
while (answer == 'y' || answer == 'Y')

The for(;;) statement is your main loop.  The while statement will be executed as long as num is positive.
Let's look at this for() statement in detail:
for (num = num;   // num = num ???  this statement does nothing.
     num > 0;     // the while statement (and the contents of the whule() loop block)
                  // will only execute if num is > 0.
     ++num)       // if num was > 0 then this loop will run until num overflows...

Removing the for(;;) statement will make your program run a lot better.

A: Your o++ has nothing do with it.
(Perhaps you have been so convinced about that being the problem that you didn't think of looking elsewhere. It happens to everyone.)
The problem is that your sequence is this:

*

*Check the most recently entered number and print the result

*Ask the user for a number, but don't do anything with it

*Ask the user whether they want to continue

*

*If they want to continue, repeat from item 1

*If they don't, stop counting

And since you stop counting if the user doesn't want to continue, the last number seems to have disappeared.
Fixing it left as an exercise.
(Think more carefully about which order you need to do things in.)
Handling negative numbers requires you to write some code to do that - you handle two cases of positive numbers, and one for zero, but you must have forgotten about the negatives.
Fixing this also left as an exercise.


text:
Q: iOS app structure I am very new to iOS and is hoping someone with experience will be able to provide me with some insight into the program structure/architecture of an iOS app which sells books. For instance the News stand application.
Are those books additional programs which run 'outside' the newsstand app or are they modules which are loaded inside the parent app? And how would you reference them inside the appstore?
I would like to build a bookshelf for some books. Each book are built using Cocos2D (works like a game) and needs to be sold individually, but they also need to 'belong' to my bookshelf. The bookshelf will need to manage i.e. 'save, edit, delete' all books previously downloaded etc.
Would anyone be able to provide some guidance? Since I don't understand the architecture, I also have no idea where to start my search.
Many thanks!

A: I think you should break down your problem into small parts or modules.
First make learn about cocos2d.Then search about UICollectionView to make shelf like view.Then
integrate UICollectionView into Cocos2d.
For UICollectionView read This
and also look at This Tutorial

A: To save the books, you can use NSUserDefaults. Would you actually be getting actual books or would you be making your own? You can look up thenewboston on YouTube and learn how to actually make simple apps.