text:
Q: My Java GUI will not display when I hit run in NetBeans I'm using Java, and I am trying to create a Calculator with NetBeans but my Jframe won't start.
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package Calculation;

/**
 *
 * @author rishi
 */
public class Calculator extends javax.swing.JFrame {

    double firstnumber;
    double secondnumber;
    double result;
    String operations;

    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() {

        jtxtDisplay = new javax.swing.JTextField();
        jBtn1 = new javax.swing.JButton();
        jBtn2 = new javax.swing.JButton();
        jBtn3 = new javax.swing.JButton();
        jBtn4 = new javax.swing.JButton();
        jBtn5 = new javax.swing.JButton();
        jBtn6 = new javax.swing.JButton();
        jBtn7 = new javax.swing.JButton();
        jBtn8 = new javax.swing.JButton();
        jBtn9 = new javax.swing.JButton();
        jBtn10 = new javax.swing.JButton();
        jBtn11 = new javax.swing.JButton();
        jBtn12 = new javax.swing.JButton();
        jBtn13 = new javax.swing.JButton();
        jBtn14 = new javax.swing.JButton();
        jBtn15 = new javax.swing.JButton();
        jBtn16 = new javax.swing.JButton();
        jBtn17 = new javax.swing.JButton();
        jBtn18 = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jtxtDisplay.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
        jtxtDisplay.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        jtxtDisplay.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtxtDisplayActionPerformed(evt);
            }
        });

        jBtn1.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
        jBtn1.setText("1");
        jBtn1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBtn1ActionPerformed(evt);
            }
        });

        jBtn2.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
        jBtn2.setText("2");
        jBtn2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBtn2ActionPerformed(evt);
            }
        });

        jBtn3.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
        jBtn3.setText("3");
        jBtn3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBtn3ActionPerformed(evt);
            }
        });

        jBtn4.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
        jBtn4.setText("4");
        jBtn4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBtn4ActionPerformed(evt);
            }
        });

        jBtn5.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
        jBtn5.setText("5");
        jBtn5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBtn5ActionPerformed(evt);
            }
        });

        jBtn6.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
        jBtn6.setText("6");
        jBtn6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBtn6ActionPerformed(evt);
            }
        });

        jBtn7.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
        jBtn7.setText("7");
        jBtn7.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBtn7ActionPerformed(evt);
            }
        });

        jBtn8.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
        jBtn8.setText("8");
        jBtn8.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBtn8ActionPerformed(evt);
            }
        });

        jBtn9.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
        jBtn9.setText("+");
        jBtn9.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBtn9ActionPerformed(evt);
            }
        });

        jBtn10.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
        jBtn10.setText("-");
        jBtn10.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBtn10ActionPerformed(evt);
            }
        });

        jBtn11.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
        jBtn11.setText("9");
        jBtn11.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBtn11ActionPerformed(evt);
            }
        });

        jBtn12.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
        jBtn12.setText("0");
        jBtn12.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBtn12ActionPerformed(evt);
            }
        });

        jBtn13.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
        jBtn13.setText("+/-");
        jBtn13.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBtn13ActionPerformed(evt);
            }
        });

        jBtn14.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
        jBtn14.setText(".");
        jBtn14.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBtn14ActionPerformed(evt);
            }
        });

        jBtn15.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
        jBtn15.setText("/");
        jBtn15.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBtn15ActionPerformed(evt);
            }
        });

        jBtn16.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
        jBtn16.setText("*");
        jBtn16.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBtn16ActionPerformed(evt);
            }
        });

        jBtn17.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
        jBtn17.setText("c");
        jBtn17.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBtn17ActionPerformed(evt);
            }
        });

        jBtn18.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
        jBtn18.setText("=");
        jBtn18.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBtn18ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jtxtDisplay)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(layout.createSequentialGroup()
                            .addComponent(jBtn1, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(18, 18, 18)
                            .addComponent(jBtn2, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jBtn3, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(18, 18, 18)
                            .addComponent(jBtn4, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(layout.createSequentialGroup()
                            .addComponent(jBtn5, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(18, 18, 18)
                            .addComponent(jBtn6, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jBtn7, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(18, 18, 18)
                            .addComponent(jBtn8, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(layout.createSequentialGroup()
                            .addComponent(jBtn11, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(18, 18, 18)
                            .addComponent(jBtn12, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jBtn9, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(18, 18, 18)
                            .addComponent(jBtn10, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(layout.createSequentialGroup()
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                .addComponent(jBtn17, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addGroup(layout.createSequentialGroup()
                                    .addComponent(jBtn15, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(18, 18, 18)
                                    .addComponent(jBtn16, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addGap(18, 18, 18)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(layout.createSequentialGroup()
                                    .addComponent(jBtn13, javax.swing.GroupLayout.PREFERRED_SIZE, 69, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(jBtn14, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(0, 0, Short.MAX_VALUE))
                                .addComponent(jBtn18, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(22, 22, 22)
                .addComponent(jtxtDisplay, javax.swing.GroupLayout.PREFERRED_SIZE, 46, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jBtn1, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jBtn2, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jBtn3, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jBtn4, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jBtn5, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jBtn6, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jBtn7, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jBtn8, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jBtn11, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jBtn12, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jBtn9, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jBtn10, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jBtn15, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jBtn16, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jBtn13, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jBtn14, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jBtn17, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jBtn18, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(18, Short.MAX_VALUE))
        );

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

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

    private void jBtn1ActionPerformed(java.awt.event.ActionEvent evt) {
       String Enternumber = jtxtDisplay.getText() + jBtn1.getText();
        jtxtDisplay.setText(Enternumber);
    }

    private void jBtn2ActionPerformed(java.awt.event.ActionEvent evt) {
        String Enternumber = jtxtDisplay.getText() + jBtn2.getText();
        jtxtDisplay.setText(Enternumber);
    }

    private void jBtn3ActionPerformed(java.awt.event.ActionEvent evt) {
        String Enternumber = jtxtDisplay.getText() + jBtn3.getText();
        jtxtDisplay.setText(Enternumber);
    }

    private void jBtn4ActionPerformed(java.awt.event.ActionEvent evt) {
        String Enternumber = jtxtDisplay.getText() + jBtn4.getText();
        jtxtDisplay.setText(Enternumber);
    }

    private void jBtn5ActionPerformed(java.awt.event.ActionEvent evt) {
        String Enternumber = jtxtDisplay.getText() + jBtn5.getText();
        jtxtDisplay.setText(Enternumber);
    }

    private void jBtn6ActionPerformed(java.awt.event.ActionEvent evt) {
        String Enternumber = jtxtDisplay.getText() + jBtn6.getText();
        jtxtDisplay.setText(Enternumber);
    }

    private void jBtn7ActionPerformed(java.awt.event.ActionEvent evt) {
       String Enternumber = jtxtDisplay.getText() + jBtn7.getText();
        jtxtDisplay.setText(Enternumber);
    }

    private void jBtn8ActionPerformed(java.awt.event.ActionEvent evt) {
        String Enternumber = jtxtDisplay.getText() + jBtn8.getText();
        jtxtDisplay.setText(Enternumber);
    }

    private void jBtn11ActionPerformed(java.awt.event.ActionEvent evt) {
        String Enternumber = jtxtDisplay.getText() + jBtn11.getText();
        jtxtDisplay.setText(Enternumber);
    }

    private void jBtn12ActionPerformed(java.awt.event.ActionEvent evt) {
       String Enternumber = jtxtDisplay.getText() + jBtn12.getText();
        jtxtDisplay.setText(Enternumber);
    }

    private void jBtn9ActionPerformed(java.awt.event.ActionEvent evt) {
       firstnumber = Double.parseDouble(jtxtDisplay.getText());
       jtxtDisplay.setText("");
       operations="+";
    }

    private void jBtn10ActionPerformed(java.awt.event.ActionEvent evt) {
        firstnumber = Double.parseDouble(jtxtDisplay.getText());
       jtxtDisplay.setText("");
       operations="-";
    }

    private void jBtn15ActionPerformed(java.awt.event.ActionEvent evt) {
        firstnumber = Double.parseDouble(jtxtDisplay.getText());
       jtxtDisplay.setText("");
       operations="/";
    }

    private void jBtn16ActionPerformed(java.awt.event.ActionEvent evt) {
        firstnumber = Double.parseDouble(jtxtDisplay.getText());
       jtxtDisplay.setText("");
       operations="*";
    }

    private void jBtn13ActionPerformed(java.awt.event.ActionEvent evt) {

        double ops = Double.parseDouble(String.valueOf(jtxtDisplay.getText()));
        ops = ops * (-1);
         jtxtDisplay.setText(String.valueOf(ops));

    }

    private void jBtn14ActionPerformed(java.awt.event.ActionEvent evt) {
        String Enternumber = jtxtDisplay.getText() + jBtn14.getText();
        jtxtDisplay.setText(Enternumber);
    }

    private void jBtn17ActionPerformed(java.awt.event.ActionEvent evt) {
       String Enternumber = jtxtDisplay.getText() + jBtn17.getText();
        jtxtDisplay.setText(Enternumber);
    }

    private void jBtn18ActionPerformed(java.awt.event.ActionEvent evt) {

        String answer;
       secondnumber = Double.parseDouble(jtxtDisplay.getText());
       if (operations == "+")
       {
           result = firstnumber + secondnumber;
           answer = String.format("%.0f", result);
                   jtxtDisplay.setText(answer);
       }
       else if (operations == "-")
       {
           result = firstnumber - secondnumber;
           answer = String.format("%.0f", result);
                   jtxtDisplay.setText(answer);
       }
        else if (operations == "*")
       {
           result = firstnumber * secondnumber;
           answer = String.format("%.0f", result);
                   jtxtDisplay.setText(answer);
       }
        else if (operations == "/")
       {
           result = firstnumber / secondnumber;
           answer = String.format("%.0f", result);
                   jtxtDisplay.setText(answer);
       }
        else if (operations == "%")
       {
           result = firstnumber % secondnumber;
           answer = String.format("%.0f", result);
                   jtxtDisplay.setText(answer);
       }
    }

    /**
     * @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 jBtn1;
    private javax.swing.JButton jBtn10;
    private javax.swing.JButton jBtn11;
    private javax.swing.JButton jBtn12;
    private javax.swing.JButton jBtn13;
    private javax.swing.JButton jBtn14;
    private javax.swing.JButton jBtn15;
    private javax.swing.JButton jBtn16;
    private javax.swing.JButton jBtn17;
    private javax.swing.JButton jBtn18;
    private javax.swing.JButton jBtn2;
    private javax.swing.JButton jBtn3;
    private javax.swing.JButton jBtn4;
    private javax.swing.JButton jBtn5;
    private javax.swing.JButton jBtn6;
    private javax.swing.JButton jBtn7;
    private javax.swing.JButton jBtn8;
    private javax.swing.JButton jBtn9;
    private javax.swing.JTextField jtxtDisplay;
    // End of variables declaration
}

A: The code works perfectly fine with eclipse you might see if the netbeans installed on your system is working correctly ,try reinstalling it.


text:
Q: SQLAlchemy: How can I create a hybrid property for the disjunction of columns? I have a User class which stores a "first_name" column and an "alias" column to describe a person's name and their nickname. I want to be able to query this class to find users by either their first_name or their alias, so I wrote my class like this:
from sqlalchemy import Column, Integer, String, create_engine, orm
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.ext.hybrid import hybrid_property

engine = create_engine('sqlite:///:memory:')
Base = declarative_base()
Session = orm.sessionmaker(engine)

class User(Base):
    __tablename__ = 'user'
    id = Column(Integer, primary_key=True)
    first_name = Column(String(64))
    alias = Column(String(64), nullable=True)

    @hybrid_property
    def name(self):
        return self.alias or self.first_name

    def __repr__(self):
        return 'User("{}" a.k.a. "{}")'.format(self.first_name, self.alias)

if __name__ == "__main__":
    Base.metadata.create_all(engine)

This almost works. I'm able to search for users by their first name. But I'm not able to search for users by their aliases.
>>> session = Session()
>>> user = User(first_name="Edward", alias="Ed")
>>> session.add(user)
>>> session.flush()
>>> session.query(User).filter_by(name="Edward").first()
User("Edward" a.k.a. "Ed")
>>> session.query(User).filter_by(name="Ed").first()
>>>

This makes sense-- the expressions generated by name are not the ones I want.
>>> print session.query(User).filter_by(name="Ed")
SELECT "user".id AS user_id, "user".first_name AS user_first_name, "user".alias AS user_alias
FROM "user"
WHERE "user".first_name = :first_name_1

The SQLAlchemy docs on hybrid properties seems to suggest the solution is use hybrid_property.expression() to change the generated expression. However, I can't see what expression would make sense to return.
My first idea was to return some sort of OR:
from sqlalchemy.sql import or_

@name.expression
def name(cls):
    return or_(cls.first_name, cls.alias)

But the expressions it generates are predictably wrong:
SELECT "user".id AS user_id, "user".first_name AS user_first_name, "user".alias AS user_alias
FROM "user"
WHERE ("user".first_name OR "user".alias) = :param_1

How can I make this work?

A: After some more studying and experimentation, it turns out the solution is described in the "Building Custom Comparators" section. You can use a Comparator object to implement custom comparisons:
class Either(Comparator):
    def __init__(self, left, right):
        self.left = left
        self.right = right

    def __eq__(self, other):
        return or_(other == self.left, other == self.right)

class User(Base):
    # ...

    @name.comparator
    def name(self):
        return Either(self.first_name, self.alias)

Which works as expected:
>>> user
User("Edward" a.k.a. "Ed")
>>> print session.query(User).filter_by(name="Edward")
SELECT "user".id AS user_id, "user".first_name AS user_first_name, "user".alias AS user_alias
FROM "user"
WHERE "user".first_name = :first_name_1 OR "user".alias = :alias_1
>>> print session.query(User).filter_by(name="Edward").first()
User("Edward" a.k.a. "Ed")
>>> print session.query(User).filter_by(name="Ed").first()
User("Edward" a.k.a. "Ed")

I think there is more room improvement here by studying the "Hybrid Value Objects", however, it's still evading me.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Will using ACCEPT then DROP for a specific port/ip couple allow the ip but nothing else on that port? I'm working on a server and am supposed to configure it, such that requests on port 8080 are allowed only from a specific IP. (On other http(s) ports nothing is listening anyway.)
Everything else shall stay unrestricted.
After researching about /etc/host and iptables I wrote this script to activate (and deactivate) that rule:
#!/bin/bash

if ["$1" != 'restrict'] && ["$1" != 'restore']
  then
    echo "Usage:"
    echo "'${0##*/} restrict' to activate rules."
    echo "'${0##*/} restore' to deactivate rules."
    echo "'${0##*/}' to show this help."
    exit 0
fi

# Set default policies for INPUT, FORWARD and OUTPUT chains
# Allowing everything else.
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT

# Flush all current rules from iptables
iptables -F

if [$1 == "restrict"]
  then

    # Allow HTTP connections on tcp port 8080 from X.X.X.X
    # [I]nserting the rules as first in the chain.
    iptables -I INPUT -p tcp --dport 8080 -s X.X.X.X -j ACCEPT

    # Denying all other connections on tcp port 8080
    # [A]ppending the rule as last in the chain.
    iptables -A INPUT -p tcp --dport 8080 -j DROP
fi

# Save settings
/sbin/service iptables save

# List rules
iptables -L -v

Since I only have access to the machine via SSH, I don't wanna screw up and lock myself out. Thus I'd like to ask if this script

*

*works?

*will do what is desired?

*won't do anything else?

*stays nonvolatile?

A: While this will work, it is not best practice. Instead of allowing everything and only dropping specific things, it is best practice to drop everything, and then only allow what you actually want to go through.
A 'normal' IP table ruleset usually begins like this:
# Flush rules
iptables -F

# Policy drop
iptables -P INPUT DROP
iptables -P OUTPUT DROP
iptables -P FORWARD DROP

# Permit loopback device
iptables -A INPUT -i lo -j ACCEPT
iptables -A OUTPUT -o lo -j ACCEPT

# Permit new outgoing connections, and packets that belong to
# an existing connection. You might actually not want to allow
# all new connections from the inside if you want to restrict
# this, you will have to allow DNS, updates, etc.. manually
iptables -A OUTPUT -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT

# Same for input
iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT

# SSH
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
iptables -A OUTPUT -p tcp --sport 22 -j ACCEPT

# Custom rules
# ...
iptables -A INPUT -p tcp --dport 8080 -s 5.35.252.105 -j ACCEPT

Also, when setting up a new firewall, do not automatically run the script, or make the changes permanent. This way, if you mess up, a reboot of the server will give you connectivity back.

A: Your rules are correct (in case you fix the syntax error in the shell script, mentioned in the previous comment) for IPv4.
For IPv6, your machine is likely completely open.
Tips for the future:

*

*Preventing lock out: If you write your rules in iptables-save style directly, you may love the iptables-apply command which restores your previous rules in case the new ones will lock you out.

*Making rules persistent: On ubuntu, there should be the iptables-persistent package to make sure your rules survive a reboot. Just set up your rules and go apt-get install iptables-persistent and follow the interactive dialogue.

*Improving style and security: mzhaase gave a very nice tutorial how to write whitelisting rules.

A: Here's an easy way to prevent lockout.  It will work in principle on any *nix system, not just Ubuntu.
Let's presume your script is called /usr/local/bin/start-iptables.sh and you disable iptables entirely with the command /usr/local/bin/stop-iptables.sh
/usr/local/bin/start-iptables.sh ; sleep 30 ; /usr/local/bin/stop-iptables.sh

If you run the commands like this, on one line, the shell will run them sequentially.  If you control-c, the entire command string will be aborted - it won't just cancel the running command and move to the next.
So, the shell will run your start script, then sleep 30 seconds.  During that 30 seconds, verify that you can still access the server.  Make a new connection, there are ways you could hose up new connections but leave your existing one active.  Once you're sure, control-c and the sleep and the stop-iptables script will be aborted.
If you do lock yourself out, after 30 seconds, the stop script will run and you'll be back.


text:
Q: WPF: Stop Binding if a UI element is not visible Can I delay binding of a ui element if the element is not currently visible. Sometimes I have a form that has some hidden/minimised elements, I would like to not update them if they are not on the screen. I suspect the answer is no, but it never hurts to ask?

A: I know this is an old question, but as I failed to find an implemented class or something, I did it myself, following @Nir answer.
This is a Markup Extension that wraps normal binding to only really bind when the object IsVisible property becomes true for the first time:
using System;
using System.ComponentModel;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
using System.Windows.Markup;

namespace MakupExtensions {
    [MarkupExtensionReturnType(typeof(object))]
    public class LazyBindingExtension : MarkupExtension {
        public LazyBindingExtension() {
        }
        public LazyBindingExtension(PropertyPath path) : this() {
            Path = path;
        }

        public IValueConverter Converter {
            get;
            set;
        }
        [TypeConverter(typeof(CultureInfoIetfLanguageTagConverter))]
        public CultureInfo ConverterCulture {
            get;
            set;
        }
        public object ConverterParamter {
            get;
            set;
        }
        public string ElementName {
            get;
            set;
        }
        [ConstructorArgument("path")]
        public PropertyPath Path {
            get;
            set;
        }
        public RelativeSource RelativeSource {
            get;
            set;
        }
        public object Source {
            get;
            set;
        }
        public UpdateSourceTrigger UpdateSourceTrigger {
            get;
            set;
        }
        public bool ValidatesOnDataErrors {
            get;
            set;
        }
        public bool ValidatesOnExceptions {
            get;
            set;
        }
        public bool ValidatesOnNotifyDataErrors {
            get;
            set;
        }

        private Binding binding;
        private DependencyObject bindingTarget;
        private DependencyProperty bindingTargetProperty;

        public override object ProvideValue(IServiceProvider serviceProvider) {
            var valueProvider = serviceProvider.GetService(typeof(IProvideValueTarget)) as IProvideValueTarget;
            if (valueProvider != null) {
                bindingTarget = valueProvider.TargetObject as DependencyObject;
                bindingTargetProperty = valueProvider.TargetProperty as DependencyProperty;
                if (bindingTargetProperty == null || bindingTarget == null) {
                    throw new NotSupportedException($"The property '{valueProvider.TargetProperty}' on target '{valueProvider.TargetObject}' is not valid for a LazyBinding. The LazyBinding target must be a DependencyObject, and the target property must be a DependencyProperty.");
                }
                binding = new Binding {
                    Path = Path,
                    Converter = Converter,
                    ConverterCulture = ConverterCulture,
                    ConverterParameter = ConverterParamter
                };
                if (ElementName != null) {
                    binding.ElementName = ElementName;
                }
                if (RelativeSource != null) {
                    binding.RelativeSource = RelativeSource;
                }
                if (Source != null) {
                    binding.Source = Source;
                }
                binding.UpdateSourceTrigger = UpdateSourceTrigger;
                binding.ValidatesOnDataErrors = ValidatesOnDataErrors;
                binding.ValidatesOnExceptions = ValidatesOnExceptions;
                binding.ValidatesOnNotifyDataErrors = ValidatesOnNotifyDataErrors;
                return SetBinding();
            }
            return null;
        }
        public object SetBinding() {
            var uiElement = bindingTarget as UIElement;
            if (uiElement != null && !uiElement.IsVisible) {
                uiElement.IsVisibleChanged += UiElement_IsVisibleChanged;
            }
            else {
                ConsolidateBinding();
            }
            return bindingTarget.GetValue(bindingTargetProperty);
        }
        private void ConsolidateBinding() => BindingOperations.SetBinding(bindingTarget, bindingTargetProperty, binding);
        private void UiElement_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e) {
            var uiElement = sender as UIElement;
            if (uiElement != null && uiElement.IsVisible) {
                uiElement.IsVisibleChanged -= UiElement_IsVisibleChanged;
                ConsolidateBinding();
            }
        }
    }
}

To use:
<ItemsControl ItemsSource="{mx:LazyBinding Documents}"/>

In this example, it will only bind when the ItemsControl IsVisible becomes true for the first time.
It will not unbind when the IsVisible gets false again, but I think someone can change it as needed.

A: There is no built in way to do this - but you can write it yourself.
The trick is to wrap binding in your own markup extension that uses the original binding but adds new behavior around it (for example, by setting UpdateSourceTrigger to Explicit when you don't want the binding to work.
Here's an example (that delays the binding's data transfer):
http://www.paulstovell.com/wpf-delaybinding
Now, there are a lot of possible edge conditions with disabling bindings for invisible controls, especially around showing and hiding controls, so I wouldn't write a generic extension for this - but maybe in your specific application this can be useful.

A: For a workaround I have a binding to the visibility of the object, when the object is set to visible, the property triggers the construction of the element behind it which have a binding via a ContentPresenter.

A: The answer is no because the binding might be cause of making an element visible again. So if binding did not work on hidden controls it would not allow the binding to make it visible again.

A: Improved MarkupExtension that wraps normal Binding to auto bind/unbind data model if visible changed.
See previous version here.
using System;
using System.ComponentModel;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
using System.Windows.Markup;

namespace UtilsWPF
{
    [MarkupExtensionReturnType(typeof(object))]
    public class LazyBindingExtension : MarkupExtension
    {
        public LazyBindingExtension()
        { }

        public LazyBindingExtension(PropertyPath path) : this()
        {
            Path = path;
        }

        #region Properties

        public IValueConverter Converter { get; set; }
        [TypeConverter(typeof(CultureInfoIetfLanguageTagConverter))]
        public CultureInfo ConverterCulture { get; set; }
        public object ConverterParamter { get; set; }
        public string ElementName { get; set; }
        [ConstructorArgument("path")]
        public PropertyPath Path { get; set; }
        public RelativeSource RelativeSource { get; set; }
        public object Source { get; set; }
        public UpdateSourceTrigger UpdateSourceTrigger { get; set; }
        public bool ValidatesOnDataErrors { get; set; }
        public bool ValidatesOnExceptions { get; set; }
        public bool ValidatesOnNotifyDataErrors { get; set; }

        private Binding binding;
        private UIElement bindingTarget;
        private DependencyProperty bindingTargetProperty;

        #endregion

        #region Init

        public override object ProvideValue(IServiceProvider serviceProvider)
        {
            var valueProvider = serviceProvider.GetService(typeof(IProvideValueTarget)) as IProvideValueTarget;
            if (valueProvider != null)
            {
                bindingTarget = valueProvider.TargetObject as UIElement;

                if (bindingTarget == null)
                {
                    throw new NotSupportedException($"Target '{valueProvider.TargetObject}' is not valid for a LazyBinding. The LazyBinding target must be a UIElement.");
                }

                bindingTargetProperty = valueProvider.TargetProperty as DependencyProperty;

                if (bindingTargetProperty == null)
                {
                    throw new NotSupportedException($"The property '{valueProvider.TargetProperty}' is not valid for a LazyBinding. The LazyBinding target property must be a DependencyProperty.");
                }

                binding = new Binding
                {
                    Path = Path,
                    Converter = Converter,
                    ConverterCulture = ConverterCulture,
                    ConverterParameter = ConverterParamter
                };

                if (ElementName != null)
                {
                    binding.ElementName = ElementName;
                }

                if (RelativeSource != null)
                {
                    binding.RelativeSource = RelativeSource;
                }

                if (Source != null)
                {
                    binding.Source = Source;
                }

                binding.UpdateSourceTrigger = UpdateSourceTrigger;
                binding.ValidatesOnDataErrors = ValidatesOnDataErrors;
                binding.ValidatesOnExceptions = ValidatesOnExceptions;
                binding.ValidatesOnNotifyDataErrors = ValidatesOnNotifyDataErrors;

                return SetBinding();
            }

            return null;
        }

        public object SetBinding()
        {
            bindingTarget.IsVisibleChanged += UiElement_IsVisibleChanged;

            updateBinding();

            return bindingTarget.GetValue(bindingTargetProperty);
        }

        #endregion

        #region Event Handlers

        private void UiElement_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            updateBinding();
        }

        #endregion

        #region Update Binding

        private void updateBinding()
        {
            if (bindingTarget.IsVisible)
            {
                ConsolidateBinding();
            }
            else
            {
                ClearBinding();
            }
        }

        private bool _isBind;

        private void ConsolidateBinding()
        {
            if (_isBind)
            {
                return;
            }

            _isBind = true;

            BindingOperations.SetBinding(bindingTarget, bindingTargetProperty, binding);
        }

        private void ClearBinding()
        {
            if (!_isBind)
            {
                return;
            }

            BindingOperations.ClearBinding(bindingTarget, bindingTargetProperty);

            _isBind = false;
        }

        #endregion
    }
}

To use:
<ItemsControl ItemsSource="{utils:LazyBinding Documents}"/>


text:
Q: Find out if laptop is docked in Linux I've recently purchased a Lenovo X200s laptop with a docking station which I used with Ubuntu 9.10.  When the laptop is docked, I use a keyboard and trackball.  I would like to have some different configuration options when the laptop is docked vs. when it is not docked.  Is there some event I can hook up to and run a script when the laptop gets docked/undocked?  Otherwise, is there anyway to find out if the laptop is docked?  Kind of like an "is_docked" command.
Thanks

A: See the article Linux Laptop-HOWTO, and especially the chapter Docking Station / Port Replicator, where a script is described that detects the docking state of the laptop.
The basic idea is to examine /proc for devices that are only available when in docked state.
In the script below, if the laptop is in docking-station then 4 PCMCIA slots are available,
while if it is standalone then only 2 slots are available:
# check, if Laptop is in docking-station (4 PCMCIA slots available)
# or if it is standalone (2 slots available)
# Start after cardmgr has started
#
# Friedhelm Kueck mailto:fk@impress.de
# 08-Sep-1998
#
# Find No. of Sockets
SOCKETS=`tail -1 /var/run/stab | cut -d ":" -f 1`

case "$SOCKETS" in

"Socket 3")
echo Laptop is in Dockingstation ...
echo Disabeling internal LCD Display for X11
echo
cp /etc/XF86Config_extern /etc/XF86Config
#
# Setup of PCMCIA Network Interface after start of cardmge
#
echo
echo "Setting up eth0 for use at Network ..."
echo
/sbin/ifconfig eth0 10.1.9.5 netmask 255.255.0.0 broadcast 10.1.255.255
/sbin/route add -net 10.1.0.0 gw 10.1.9.5
/sbin/route add default gw 10.1.10.1
;;

"Socket 1")
echo Laptop is standalone
echo Disabling external Monitor for X11
cp /etc/XF86Config_intern /etc/XF86Config
echo
echo Network device NOT setup
;;
esac

A: Look at how you can get notifications from X6 Ultrabase: http://www.thinkwiki.org/wiki/X6_UltraBase
I don't know about X200 Ultrabase, but I guess this should be very similar.


text:
Q: Timber get_posts in template/view I have an ACF field that allows a choice of post types, these are then going to be put in a carousel. There could be any number as every module on the page is controlled by the admin users.
In the carousel template, I want to be able to get the recent posts for the selected post type. I can to this with:
{% set items = fn('get_posts', {'post_type': 'team' }) %}

Is there a way to do this without calling it as a function? I was thinking along the lines of:
{% set items = Posts(params) %}

Is this possible or is the function call the only/best way?
Thanks

A: Currently, what you want to do is not possible. You could use Timber::get_posts through the array notation to get an array of Timber posts instead of regular WordPress posts:
{% set items = fn(['Timber\Timber', 'get_posts'], { 'post_type': 'team' }) %}

But in the future, the recommended way to get posts will be to use Timber\PostQuery. In the upcoming version 2 of Timber, we will add a PostQuery function to Twig. This means that you'll be able to do something like this:
{% for items in PostQuery(params) %}
    {# Display item #}
{% endfor }

This would work well for simpler use cases. I'd also recommend what Luckyfella said, it may be better to not have this in Twig at all, but prepare everything in PHP and then pass the items on to the Twig view.


text:
Q: American apostrophe clears form input ' this kind of apostrophe ruins my input which is saved to database. I've tried
$GeneralChangeDescriptions[$ChampionNumber+1][$indexGeneral+1]=str_replace("'", "'",

$GeneralChangeDescriptions[$ChampionNumber+1][$indexGeneral+1]);

So changing ' to ' with no results I still get empty field.
This value with apostrophe is shown just fine but after sending it with
 <input type="hidden" name="GeneralChangeDescriptions" value="'.htmlspecialchars(json_encode($GeneralChangeDescriptions)).'">

it no longer is visible the whole input is blank is there any way to fix this?
Update:
After fiddling a bit with code I found out that json_encode completely wipes my input after sending are there any easy solutions?


text:
Q: How do you use a list that was created in another function in Python? I have these two functions.
def get_numbers():
    phone_num = []
    df = pd.read_csv('students.csv', names = ['name', 'phone number', 'class time', 'duration'])
    phone = df['phone number'].tolist()
    print(phone)
    for i in phone:
        phone_num.append(i)

def use_num_list():
    print(phone_num)

I basically want to use the 'phone_num' list in another function. How would I go about doing that?

A: You need to return it from your function, and then pass it in to your other function.
def get_numbers():
    phone_num = []
    df = pd.read_csv('students.csv', names = ['name', 'phone number', 'class time', 'duration'])
    phone = df['phone number'].tolist()
    print(phone)
    for i in phone:
        phone_num.append(i)
    return phone_num

def use_num_list(phone_number):
    print(phone_number)

numbers = get_numbers()
use_num_list(numbers)

Also, remember that the names of the objects only exist in their local scope. In other words, the variable name phone_num only exist in the function get_numbers.
So when you call the function you have to assign the list to a new name, like numbers = get_numbers(). Now, numbers will contain the list and you'll be be able to access the list within the global scope. From here, you can pass it to other functions.


text:
Q: Path-connected components of the configuration space $F_n(R^d)$ Let $X$ be a topological space, for $n \geq 1$ we define
   $F_n(X) = \lbrace{ (x_1,...,x_n) \in X^n | x_i \neq x_j for i \neq j \rbrace} $ the configuration space of n points of X.
My question is about the path-connected components of $F_n(\mathbb{R}^d)$.
I know that :
1- for $n=1$, $F_1(X) = X$ and hence $\pi_0(F_1(\mathbb{R}^d)) = \pi_0(\mathbb{R}^d) = \lbrace \mathbb{R}^d \rbrace \: \forall d \geq 1  $
2- $\forall n \geq 1$, $F_n(\mathbb{R}) = \bigcup \lbrace x_i < x_j \: or \: x_i > x_j \: | \: \forall \: 0 \leq i,j \geq n \rbrace $
Hence $\pi_0(F_n(\mathbb{R})) =   \lbrace x_i < x_j \: or \: x_i > x_j \: | \: \forall \: 0 \leq i,j \geq n \rbrace   $
I am unable to see how the path-connected componnents of $F_n(\mathbb{R}^d$) look like for all $n \geq 1$ and for all $d \geq 1$...


text:
Q: How to pause a loop without blocking the UI and restart with button I am looking for the best practice to pause foreach or for loops (it has to wait until the user inserts text and presses a button to confirm).
private void btnStarten_Click(object sender, RoutedEventArgs e)
{
      //using a foreach loop blocks the UI I read?

      for (int i = list.Count; i >= 0; i--)
      {
          //Here I want to pauze the loop and being able to insert a valeu in a textbox after I
          //clicked another button to confirm, I resume the Loop
      }
}

A: My final code looked like this:
private void btnResultaat_Click(object sender, RoutedEventArgs e)
        {
            if (leerlingIngave.RandomLijst.Count - 1 == leerlingIngave.AntwoordEnUitkomstLijst.Count)
//I compair my 2 lists to eachother (theRandom list was already filled)
            {

                btnResultaat.IsEnabled = false; // I ended the loop by disabeling the button
                leerlingIngave.VerderZettenLoop();
            }
            else
            {
                leerlingIngave.VerderZettenLoop();
            }
        }

public void VerderZettenLoop() // Add object to the list
        {

                    AntwoordEnUitkomstLijst.Add(new LeerlingModel(Uitkomst, Antwoord));
        }

A: I would recommend separating out your code a bit, rather than having a loop that "waits".
For example:
private int _loopIndexer = 0;

public void ContinueLoop()
{
    for (; _loopIndexer < list.Count; ++_loopIndexer)
    {
        if (list[_loopIndexer].Property == "value")
        {
            // on a matching condition do something and then exit the method
            ++_loopIndexer; // we need to increment the position before we exit the method
            return;
        }
    }
}

private void btnStarten_Click(object sender, RoutedEventArgs e)
{
    // reset to the beginning
    _loopIndexer = 0;
    ContinueLoop();
}

private void btnContinue_Click(object sender, RoutedEventArgs e)
{
    // If the end of the loop is reached, quit (or do whatever)
    if (_loopIndexer + 1 == list.Count)
    {
        // _loopIndexer = 0; // you could reset it to 0 if you wanted to loop again
        return;
    }

    ContinueLoop();
}

The idea is that btnStarten will start the loop, and the loop will stop whenever a condition is met. Then, when you click the Continue button, it will continue the loop if there are any list items left.
Try it online


text:
Q: Authentication issue using the QuickBooks Web Connector: Object reference not set to an instance of an object I have a SOAP server to handle connections from the QuickBooks Web Connector. The first method it calls is "authenticate" which correctly returns the data it expects, however it's giving me the error
QBWC1012: Authentication failed due to following error message.
Object reference not set to an instance of an object.

I'm at a loss on this one and there doesn't seem to be a solution on the web. The error message doesn't really give me anything to go on.
If anyone has any idea where I can look for more information about this I'd be grateful.
Here is the WC error log for the issue:
20140215.17:15:32 UTC    : QBWebConnector.RegistryManager.setUpdateLock() : HKEY_CURRENT_USER\Software\Intuit\QBWebConnector\UpdateLock has been set to False
20140215.17:15:32 UTC    : QBWebConnector.RegistryManager.setUpdateLock() : ********************* Update session unlocked *********************
20140215.17:15:32 UTC    : QBWebConnector.WebServiceManager.DoUpdate() : Update completed with errors. See log (QWClog.txt) for details.
20140215.17:15:32 UTC    : UpdateThisScheduledApp() : QBWC1031: Update completed with some error. Application has been notified of the error accordingly. See QWCLog for further information.
20140215.17:16:30 UTC    : UpdateThisScheduledApp() : Password management - Started
20140215.17:16:30 UTC    : UpdateThisScheduledApp() : Password management - Ended
20140215.17:16:30 UTC    : UpdateThisScheduledApp() : Performing SCHEDULED UPDATE for application = PManager SOAP
20140215.17:16:30 UTC    : QBWebConnector.RegistryManager.getUpdateLock() : HKEY_CURRENT_USER\Software\Intuit\QBWebConnector\UpdateLock = FALSE
20140215.17:16:30 UTC    : QBWebConnector.RegistryManager.setUpdateLock() : HKEY_CURRENT_USER\Software\Intuit\QBWebConnector\UpdateLock has been set to True
20140215.17:16:30 UTC    : QBWebConnector.RegistryManager.setUpdateLock() : ********************* Update session locked *********************
20140215.17:16:30 UTC    : QBWebConnector.SOAPWebService.instantiateWebService() : Initiated connection to the following application.
20140215.17:16:30 UTC    : QBWebConnector.SOAPWebService.instantiateWebService() : AppName: PManager SOAP
20140215.17:16:30 UTC    : QBWebConnector.SOAPWebService.instantiateWebService() : AppUniqueName (if available): PManager SOAP
20140215.17:16:30 UTC    : QBWebConnector.SOAPWebService.instantiateWebService() : AppURL: https://[SNIP]/pmanager/soapserver.php
20140215.17:16:30 UTC    : QBWebConnector.SOAPWebService.do_serverVersion() : *** Calling serverVersion().
20140215.17:16:31 UTC    : QBWebConnector.SOAPWebService.do_serverVersion() : Received from serverVersion() following parameter:<serverVersionRet="">
20140215.17:16:31 UTC    : QBWebConnector.SOAPWebService.do_serverVersion() : This application sent a null for server version. Allowing update operation.
20140215.17:16:31 UTC    : QBWebConnector.SOAPWebService.do_clientVersion() : *** Calling clientVersion() with following parameter:<productVersion="2.1.0.30">
20140215.17:16:32 UTC    : QBWebConnector.SOAPWebService.do_clientVersion() : Received from clientVersion() following parameter:<clientVersionRet="">
20140215.17:16:32 UTC    : QBWebConnector.SOAPWebService.do_clientVersion() : This application agrees with the current version of QBWebConnector. Allowing update operation.
20140215.17:16:32 UTC    : QBWebConnector.SOAPWebService.do_authenticate() : Authenticating to application 'PManager SOAP', username = '[SNIP]'
20140215.17:16:32 UTC    : QBWebConnector.SOAPWebService.do_authenticate() : *** Calling authenticate() with following parameters:<userName="[SNIP]"><password=<MaskedForSecurity>
20140215.17:16:33 UTC    : QBWebConnector.SOAPWebService.do_authenticate() : QBWC1012: Authentication failed due to following error message.
Object reference not set to an instance of an object.
More info:
StackTrace =    at QBWebConnector.WebService.do_authenticate(String& ticket, String& companyFileName)
Source = QBWebConnector
20140215.17:16:33 UTC    : QBWebConnector.RegistryManager.setUpdateLock() : HKEY_CURRENT_USER\Software\Intuit\QBWebConnector\UpdateLock has been set to False
20140215.17:16:33 UTC    : QBWebConnector.RegistryManager.setUpdateLock() : ********************* Update session unlocked *********************
20140215.17:16:33 UTC    : QBWebConnector.WebServiceManager.DoUpdate() : Update completed with errors. See log (QWClog.txt) for details.
20140215.17:16:33 UTC    : UpdateThisScheduledApp() : QBWC1031: Update completed with some error. Application has been notified of the error accordingly. See QWCLog for further information.

SOAP response being sent to WC:
<?xml version="1.0" encoding="ISO-8859-1"?>
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns1:authenticateResponse xmlns:ns1="http://developer.intuit.com/">
    <return xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="xsd:string[2]">
        <item xsi:type="xsd:string">8d51474324d94e25aa1e6670da584204</item>
        <item xsi:type="xsd:string">C:/Path/File.QBW</item>
    </return>
</ns1:authenticateResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

A: Probably a little late, but in case it helps anyone else, I had a similar issue, and changing the style from 'RPC' to 'DocWrapped' in the QWC file fixed the issue.
UPDATE 5/2017:
The OP's issue was related to a version number mismatch, but I have had the same symptoms where the issue was related to a Style mismatch in the QWC config.  According to QBWC_proguide the correct version will depend on the server setup, but valid options include: "Document" (which is the default), "DocWrapped", and "RPC".
For my Rails setup, either "Document" or "DocWrapped" worked.
After changing this config, remove and re-add the Web Connector app.

A: I should have updated this sooner... The problem turned out to be the version number, I was trying to use an older version that didn't support some features. Changing the version in the call to the WC solved it.


text:
Q: without applicationDidFinishLaunching in Objective-C I've many classes in my XCode project, and only the class from where the control comes from main.m will be having applicationDidFinishlaunching method. in my other classes will the methods in it knows how to go to its own method implementation, or do i need to write init method?

A: I'm not sure I understand what you are asking about, but I will try.. :-)
applicationDidFinishLaunching is part of the UIApplicationDelegate protocol. Typically, only one class will implement this protocol in one application.
In you other classes, you implement the init method if you need to do something when an instance of that class is created, like instantiating and initializing property values for that instance.


text:
Q: ios: why not use just ONE view controller for every app This may sound a bit strange: Since there is only one screen visible at a give time why not use a single view controller and regenerate view hierachy/content by allocating,adding, destroying subviews programmatically as needed?
I'm porting a VOIP SW that runs on a hardware phone. The hw phone has a touch sreen. The touch screens contents are created by a core module that provides instructions to the rendering module displaying these on the touch screen (createscreen,createbutton, createtextfield,..,destroyscreen, destroybutton,..).Naturally, the module managing the screen layout being part of the core voip sw,runs on it's own thread. It would therefore be necessary to create/destroy views in the background and push them on the main thread for display.
Since all the screens/subscreens items are known, i prefer the classic approach (storyboard,xib,additional code where needed) and match the incoming draw request to the layout items, thus just updating the data. Allocating/destroying all these view structures seems a performance nightmare to me as well, but i have been hard pressed to dynamically do it.
I need your help in reasoning against it.

A: Why would you ever want do that? Yes, it is completely possible, but it would require far more work to create and would be much more confusing to troubleshoot and debug. Also, using more than one view controller also decreases the amount of code, which potentially could help your app run better.

A: If your app is simple enough sure.. Once you start getting more and more elements your VC will become a PITA to manage. If you have more than 1 tableview you will have to check which one you want to work with on all calls..


text:
Q: I'm curious if this sentence is grammatically correct. Also, what kind of phrase is it called
In the pocket of his shirt is a protein bar, soft from the sun,
  uneaten, untouched, forgotten.

What is happening after a protein bar? Those aren't things in his shirt pocket; they are adjectives for the protein bar, I think.
Why are these adjectives following the noun? Why isn't there an and before the last adjective?
I searched comma after noun before adjective and further confused myself.


text:
Q: Least conservative multiple testing correction This is a general question regarding multiple testing when making confidence intervals. Suppose I have an unknown vector
$$\mu = (\mu_1, \dots, \mu_p).$$
My goal is to estimate this vector, and create a $100(1-\alpha)\%$ confidence interval for each component $\mu_i$. I can of course make a $p$-dimensional ellipsoidal confidence region, but let's assume I don't want to do that.
Due to the problem of multiple intervals, my realized coverage probability is going to be smaller that $(1-\alpha)$, and so there is a need for correcting for this. The most common way is to use a Bonferroni correction, but Bonferroni is ridiculously conservative as $p$ increases.
My question: what is the least conservative method for correcting for multiple intervals?
--EDIT--
I am not assuming any model setup. Lets assume $\mu$ is the mean vector of a $p$ dimensional distribution $F$, which I sample from using, say Monte Carlo.

A: The least conservative multiple comparison adjustment is to not do one. In that case you are accepting a familywise error-rate that is (likely) larger than your per-comparison error-rate. How much larger depends on the correlation among your random variables. If you have perfect positive dependence between the coverage of any two intervals than your per comparison error rate is identical to your family-wise error rate:
$$P(\mu_1 \in CI_{u_1}, \mu_2 \in CI_{u_2}) = P(\mu_1 \in CI_{u_1}) = P(\mu_2 \in CI_{u_2}) $$
Complete independence between the coverage of any two intervals means that a joint interval of $p$ intervals will have coverage of $(1-\alpha)^p$:
$$P(\mu_1 \in CI_{u_1}, \mu_2 \in CI_{u_2}) = P(\mu_1 \in CI_{u_1}) * P(\mu_2 \in CI_{u_2}) $$
Bonferroni actually controls for perfect negative dependence between the coverage of any two intervals and so is the most strict:
$$P(\mu_1 \in CI_{u_1}, \mu_2 \in CI_{u_2}) = 1 - P(\mu_1 \notin CI_{u_1} \cup \mu_2 \notin CI_{u_2}) $$
If you do want to control for multiple comparisons, you have other options beside Bonferroni and beside controlling for the familywise error rate. One option is to instead control for the false discovery rate, which controls the proportion of false discoveries (or in your case, missed individual confidence interval) among your rejected hypothesis.
However, probably the best approach is to use a model that means you don't have to worry about multiple comparisons. In the classic linear modelling or ANOVA-like models, Andrew Gelman has pointed out that using multi-level models in large part frees us from worrying about multiple comparisons. In the context of your question, if you think that your various $\mu$'s are related to each other with positive or negative dependence, then use a multivariate probability model or a multi-level model, whichever is more appropriate for your conceptual model and research question.


text:
Q: exec: "git": executable file not found in $PATH when running golangcli-lint I'm using golangcli-lint for my projects. But, when I run it using golangcli-lint run, it throws this error
ERRO Running error: context loading failed: failed to load packages: failed to load with go/packages: err: exit status 1: stderr: go: github.com/personal/private-repo@v1.5.4-staging.0.20221037132524-fa474c90e736: git init --bare in /home/personal/snap/golangci-lint/104/go/pkg/mod/cache/vcs/0478a3848f1237177112e0218abaefe19791c78a4f537df39ac0804ae69a3a05: exec: "git": executable file not found in $PATH
go: github.com/personal/private-repo@v1.5.4-staging.0.20221037132524-fa474c90e736: git init --bare in /home/koinworks/snap/golangci-lint/104/go/pkg/mod/cache/vcs/0478a3848f1237177112e0218abaefe19791c78a4f537df39ac0804ae69a3a05: exec: "git": executable file not found in $PATH

What happens here? I googled it, but they told me to install git because it's not installed. But I've been using this laptop for coding and using git & github for years with countless commits without any problem.
I use Ubuntu 20.04.


text:
Q: ignore element for page size calculation How to force browser NOT to calculate the size of the content based on some absolute positioned elements?
I am looking for something like https://developer.mozilla.org/en-US/docs/CSS/-moz-stack-sizing
For a simplistic use case please view http://jsfiddle.net/edzis/5nnYk/
html, body, .container {
    /**
        https://developer.mozilla.org/en-US/docs/CSS/-moz-stack-sizing
        DOES NOT WORK
    **/
    -moz-stack-sizing: ignore;
    -webkit-stack-sizing: ignore;
    stack-sizing: ignore;
}

A: This may not be an exact match to what you are looking for, but maybe it can present some ideas.
If you can change the html code, you could make use of "overflow: hidden" by using a second absolute positioned layer and let the "container" div only be responsible for the dimensions where you want to have scrolling.
NB: There is a possible issue here if the initial window width is small and the container causes scrolling, the elements off screen may not be rendered and will require refreshing.
Here's an updated jsfiddle link: http://jsfiddle.net/5nnYk/24/
code e.g:

LEFT

RIGHT

Then set the panel class to:
.panel{
    width:99%;
    height:200px;
    position:absolute;
    z-index:1;
    overflow:hidden;
    -webkit-transform-style: preserve-3d;
}

BTW: I set width to 99% instead of 100% because it fixes another issue that sometimes rises and causes a horizontal scroll. Another way to solve this is use left: 0px; on the panel.


text:
Q: Visual Studio Community 2015 where is the ISO to download? I installed Visual Studio Community 2015 on Windows 7 x64 after multiple troubles. The solution was to reset my notebook, update all I can on Windows Update, stop the antivirus and then install Visual Studio Community 2015
Now I need Visual Studio Community 2015 on another notebook, almost the same model and nothing works. I tryed most of the tips from this post
Visual Studio 2015 installer hangs during install?
and nothing. Allways stuck on kb2999226 thing.
Some users talks about installing from the ISO but on the official link
https://www.visualstudio.com/downloads/download-visual-studio-vs
I don't find the ISO, only the web installer file.
Where can I download the Visual Studio Community 2015 ISO?

A: On the link you provided, you have to click on Visual Studio 2015 and then select radio button ISO and then press download, everything should go fine


text:
Q: Connecting to MS SQL Server on a remote desktop from Python I am connecting to a SQL Server hosted on a remote desktop using Windows server through VBA with this code:
Set objMyConn = New ADODB.Connection
Set objMyCmd = New ADODB.Command
Set objMyRecordset = New ADODB.Recordset

'Open Connection
objMyConn.ConnectionString = "Provider=SQLOLEDB.1;User ID=sa;Password=xxxxx;Persist Security Info=True;Initial Catalog=databaseName;Data Source=192.168.1.xxx;"
objMyConn.Open

Currently trying to use python to connect to the same SQL Server database with this code:
import pyodbc
server_name='192.168.1.xxx'
db_name='databaseName'
username='sa'
password='xxxxx'
conn = pyodbc.connect('DRIVER={ODBC Driver 11 for SQL Server};'
                      'Server=server_name;'
                      'Database=db_name;'
                      'UID=username;'
                      'PWD=password;'
                      'Trusted_Connection=yes;')
cursor=conn.cursor()

TRACEBACK:
File "x/test.py", line 6, in <module>
    conn = pyodbc.connect('DRIVER={ODBC Driver 11 for SQL Server};'
pyodbc.OperationalError: ('08001', '[08001] [Microsoft][ODBC Driver 11 for SQL Server]Named Pipes Provider: Could not open a connection to SQL Server [53].  (53) (SQLDriverConnect); [08001] [Microsoft][ODBC Driver 11 for SQL Server]Login timeout expired (0); [08001] [Microsoft][ODBC Driver 11 for SQL Server]A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online. (53)')

A: You should omit argument trusted_connection since you are providing UID and PWD. Trusted_connection fills UID and PWD values with your current windows user values so it is probably reserved for a local connection within the host.
I belive connection string should look like this:
'DRIVER={ODBC Driver 11 for SQL Server};'
                      'Server=server_name;'
                      'Database=db_name;'
                      'UID=username;'
                      'PWD=password;'


text:
Q: Move database from SQL Server 2012 to 2008 I have a database on a SQL Sever 2012 instance which I would like to copy to a 2008 server.
The 2008 server cannot restore backups created by a 2012 server (I have tried).
I cannot find any options in 2012 to create a 2008 compatible backup. Am I missing something?
Is there an easy way to export the schema and data to a version-agnostic format which I can then import into 2008?
The database does not use any 2012 specific features. It contains tables, data and stored procedures.
Here is what I have tried so far
I tried Tasks → Generate Scripts on the 2012 server, and I was able to generate the schema (including stored procedures) as a SQL script. This didn't include any of the data, though.
After creating that schema on my 2008 machine, I was able to open the "Export Data" wizard on the 2012 machine, and after configuring the 2012 as source machine and the 2008 as target machine, I was presented with a list of tables which I could copy. I selected all my tables (300+), and clicked through the wizard. Unfortunately it spends ages generating its scripts, then fails with errors like "Failure inserting into the read-only column 'FOO_ID'".
I also tried the "Copy Database Wizard", which claimed to be able to copy "from 2000 or later to 2005 or later". It has two modes:

*

*"Detach and Attach", which failed with error:
Message: Index was outside the bounds of the array.
StackTrace:    at Microsoft.SqlServer.Management.Smo.PropertyBag.SetValue(Int32 index, Object value)
...
at Microsoft.SqlServer.Management.Smo.DataFile.get_FileName()

*SQL Management Object Method which failed with error

Cannot read property IsFileStream. This property is not available on SQL Server 7.0."

A: Right click on the database in the 2012 SQL Management Studio, and choose "Tasks -> Generate Scripts". Click past the welcome screen, choose "script entire database and all database objects". On the "specify how scripts should be saved" page, click "advanced". Under "General" in the pop up properties page, change "Types of data to script" from "Schema only" to "Schema and data", and change "Script for Server Version" from "2012" to "2008".
I then had to find some way to edit the start of this massive SQL file, to tweak how the database would be created -- see this q: https://stackoverflow.com/questions/102829/best-free-text-editor-supporting-more-than-4gb-files
And finally I had to find some way to run the SQL script, which was too large to open in SQL Management Studio -- see this q: https://stackoverflow.com/questions/431913/how-do-you-run-a-300mb-ms-sql-sql-file

A: I'm new to SQL, but I managed to migrate from 2012 to 2008. To do so I used the SQL import and export utility. I chose the SQL 2012 server and the database I want to migrate and finally the 2008 server and created a new database as my database of destination. It worked.

A: Try APEXSQL tools.  They have a tool that will script the database and script the data also.

A: For SQL migrations, use the free and open source SQL Database Migration Wizard.
I had a 5GB database with couple ~10 million records and tried the route via Generate Script and than ran it with sqlcmd.exe. First of all, the generated script was not always working correct. Secondly, sqlcmd.exe can fail on large files too, complaining about available memory. osql.exe works, but just takes ages (and has the same command line arguments).
Then I came across a wonderful tool for migrating SQL Server to SQL Azure databases. This works for SQL Server to SQL Server as well, for example if you'd like to migrate a SQL 2012 database to 2008 R2. It uses bcp.exe, which uses bulk copy. There is a GUI and command-line (Batch) version available and it's open source. See http://sqlazuremw.codeplex.com/. In my case, the operation took 16 minutes.
In an advanced screen you can select that your target is SQL Server, not SQL Azure.

A:
After creating that schema on my 2008 machine, I was able to open the
  "Export Data" wizard on the 2012 machine, and after configuring the
  2012 as source machine and the 2008 as target machine, I was presented
  with a list of tables which I could copy. I selected all my tables
  (300+), and clicked through the wizard. Unfortunately it spends ages
  generating its scripts, then fails with errors like "Failure inserting
  into the read-only column 'FOO_ID'".

The problem is that it is not able to insert the ID columns, so:

*

*Select all the tables by ticking them

*Select all the tables
(the way to do this is click on the first one and hold shift and click on the last table)

*Click on "Edit Mappings" - you can see that just above the next button and next to preview .

*You will get a window, tick on the "Enable identity insert" and then click next and go ahead, this should work. It worked for me.

A: I followed Rich's solution https://superuser.com/a/469597/312310 above and it worked great! Thanks - I can't vote up yet in here!
The extra steps I had to do to get this to work are:

*

*Change the logical file names and ensure the path is correct. I also had to change the generated log name, else it tried to overwrite the mdf file with the log and then threw this error https://stackoverflow.com/questions/7534664/sql-server-script-error-database-is-already-in-use

CREATE DATABASE [xxxxx] ON  PRIMARY
      ( NAME = xxxxx', FILENAME = N'C:\Program Files\Microsoft SQL
  Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\xxxxx.mdf' , SIZE =
  14400KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )
       LOG ON
      ( NAME = N'xxxxxldf', FILENAME = N'C:\Program Files\Microsoft SQL
  Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\xxxxx_log.ldf' ,
  SIZE = 18560KB , MAXSIZE = 2048GB , FILEGROWTH = 10%)
      GO

*I had to comment out the generated section and add the user permissions manually afterwards
USE [xxxxx]
GO
/****** Object:  User [xxxxx]    Script Date: 30/11/2014 12:44:07 ******/
CREATE USER [xxxxx] FOR LOGIN [xxxxx] WITH DEFAULT_SCHEMA=[dbo]
GO
sys.sp_addrolemember @rolename = N'db_owner', @membername = N'Umbraco'
GO
sys.sp_addrolemember @rolename = N'db_datareader', @membername = N'Umbraco'
GO
sys.sp_addrolemember @rolename = N'db_datawriter', @membername = N'Umbraco'
GO

Ran it up, and lo and behold I can now restore my new Umbraco 7.1.2 database to my web server that only has SQL Server 2008 R2!

A: Have a look at xSQL Schema Compare and xSQL Data Compare. You can first synchronize the schema with schema compare and then copy the data.
Disclaimer: I'm affiliated with xSQL.


text:
Q: Fix DIV to bottom right corner I have used html and body attributes to have a gradient background and a flower background for my website.
I have also used a div to have the bottom right hand flower where it is. Works great, but not when scrolling. How do i get the bottom right hand corner image to stick to the bottom of the screen ?

A: You will want to set position: fixed; instead of position: absolute;.
Here's more info on the Position Property.

.bottomright {
     position: fixed;
     bottom: 0px;
     right: 0px;
}

.demo {
     background-color: HotPink;
     padding: 20px;
     margin: 5px;
}
Hello

   I'm a Div!

there

A: if you put the flower inside a div and position it absolute bottom and right this will stick it there.
For example, something like this will work
#mystylename{
     position:absolute;
     bottom:0;
     right:0;
}

you may need to tweak it to get it sat where you want and also maybe add a z-index

A: If you require animation, set you div as absolute before the animation and then after the animation re set it to fixed as the below example.
$('.mydiv').animate({
opacity: 1,
right: "50px",
bottom: "50px",
height: "toggle"
}, 1000, function() {
// Animation complete.
}).css('position','fixed');

css for the above div is below as well.
.mydiv {
  text-align: center;
  background: #00DD88;
  background: -moz-linear-gradient(center top , #00DD88 0%, #00CC00 100%) repeat scroll 0 0 transparent;
  border-radius: 30px 30px 30px 30px;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
  margin: 5px 0 10px 15px;
  position: absolute;
  right: -980px;
  width: 200px;
  height: 50px;
  display: none;
  z-index: 100;
}

I know this is old but it will definitely help someone :)

A: A css-only trick for this old post is to put a  after the div and position the top -1.2em so it overlaps the bottom of the element above it.
html:
<textarea class="no-whitespace-right">This is a test resize it.</textarea>
length could go here

css:
.no-whitespace-right {
  /* any whitespace to the right and the overlap trick fails */
  width: 100%;
}

.float-lower-left {
  position: relative;
  float: right;
  right: 1em;
  top: -1.2em;
  /* push it up into the element before it. This is a trick for bottom-right */
  right: 1em;
  z-index: 200;
  opacity: 0.5;
  font-weight:bolder;
}

https://jsfiddle.net/qwm3pu8d/

A: You might need to use JavaScript to accomplish this task. Such techniques will accomplish the effect you desire, but they tend not be animate very smoothly. When scrolling, such a "stuck" object will tend to skip and stutter. I found an example here but have not tried it myself. I recommend searching for a few examples and trying out the one that looks cleanest and most modern.

A: You will want to set position: fixed; instead of position: absolute;


text: Q: Is the WP audio shortcode still relevant? I'm not very familiar with audio integration so I'm wondering why I couldn't simply use the plain <audio> element? This would avoid the overhead of medialement.js that WP seems to use. I'm fine with targeting only recent browsers that support <audio> . Am I missing something? Cheers.


text:
Q: Error when using Sabre SOAP API to retrieve flight information I'm sending first a request to retrieve the auth token; with that token I try todo an OTA_AirAvailLLSRS call which gives the following result back:
<?xml version="1.0" encoding="UTF-8"?>
<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
   <soap-env:Header>
      <eb:MessageHeader xmlns:eb="http://www.ebxml.org/namespaces/messageHeader" eb:version="1.0" soap-env:mustUnderstand="1">
         <eb:From>
            <eb:PartyId eb:type="urn:x12.org:IO5:01">123982</eb:PartyId>
         </eb:From>
         <eb:To>
            <eb:PartyId eb:type="urn:x12.org:IO5:01">234552</eb:PartyId>
         </eb:To>
         <eb:CPAId>adf</eb:CPAId>
         <eb:ConversationId>1343843</eb:ConversationId>
         <eb:Service eb:type="OTA">OTA_AirAvailLLSRQ</eb:Service>
         <eb:Action>OTA_AirAvailLLSRS</eb:Action>
         <eb:MessageData>
            <eb:MessageId>6ef80a1d-a960-4ab1-bf52-bab150ef7a16@61</eb:MessageId>
            <eb:Timestamp>2016-01-14T12:37:31</eb:Timestamp>
            <eb:RefToMessageId>91082930-babb-11e5-b8df-057c6da3c883</eb:RefToMessageId>
         </eb:MessageData>
      </eb:MessageHeader>
      <wsse:Security xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/12/secext">
         <wsse:BinarySecurityToken valueType="String" EncodingType="wsse:Base64Binary">asds</wsse:BinarySecurityToken>
      </wsse:Security>
   </soap-env:Header>
   <soap-env:Body>
      <OTA_AirAvailRS xmlns="http://webservices.sabre.com/sabreXML/2011/10" xmlns:stl="http://services.sabre.com/STL/v01" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Version="2.3.0">
         <stl:ApplicationResults status="Unknown">
            <stl:Error type="Application" timeStamp="2016-01-14T06:37:31-06:00">
               <stl:SystemSpecificResults>
                  <stl:Message>Sending request to the Host failed</stl:Message>
                  <stl:ShortText>ERR.SWS.HOST.CONNECTOR_ERROR</stl:ShortText>
               </stl:SystemSpecificResults>
            </stl:Error>
         </stl:ApplicationResults>
      </OTA_AirAvailRS>
   </soap-env:Body>
</soap-env:Envelope>

Does anyone has a idea what the problem could be?
Please let me know if you need more info.
Response Request:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sec="http://schemas.xmlsoap.org/ws/2002/12/secext" xmlns:mes="http://www.ebxml.org/namespaces/messageHeader" xmlns:ns="http://webservices.sabre.com/sabreXML/2011/10">
   <soapenv:Header>
      <sec:Security>
         <!--Optional:-->
         <!--Optional:-->
         <!--<sec:SabreAth>?</sec:SabreAth>-->
         <!--Optional:-->
         <sec:BinarySecurityToken>rfsd</sec:BinarySecurityToken>
      </sec:Security>
      <mes:MessageHeader mes:version="2.0">
         <mes:From>
            <!--1 or more repetitions:-->
            <mes:PartyId mes:type="urn:x12.org:IO5:01">234552</mes:PartyId>
            <!--Optional:-->
            <!-- <mes:Role>?</mes:Role> -->
         </mes:From>
         <mes:To>
            <!--1 or more repetitions:-->
            <mes:PartyId mes:type="urn:x12.org:IO5:01">123982</mes:PartyId>
            <!--Optional:-->
            <!-- <mes:Role>?</mes:Role> -->
         </mes:To>
         <mes:CPAId>dfsf</mes:CPAId>
         <mes:ConversationId>3424</mes:ConversationId>
         <mes:Service mes:type="OTA">OTA_AirAvailLLSRS</mes:Service>
         <mes:Action>OTA_AirAvailLLSRQ</mes:Action>
         <mes:MessageData>
            <mes:MessageId>766fe600-bb54-11e5-b803-b7a2549d49cb</mes:MessageId>
            <mes:Timestamp>2016-01-15T06:51:54.336Z</mes:Timestamp>
            <!--Optional:-->
            <!-- <mes:RefToMessageId>?</mes:RefToMessageId> -->
            <!--Optional:-->
            <!-- <mes:TimeToLive>?</mes:TimeToLive> -->
            <!--Optional:-->
            <!-- <mes:Timeout>?</mes:Timeout> -->
         </mes:MessageData>
         <!--Optional:-->
         <!-- <mes:DuplicateElimination>?</mes:DuplicateElimination> -->
         <!--Zero or more repetitions:-->
         <!-- <mes:Description xml:lang="?">?</mes:Description> -->
         <!--You may enter ANY elements at this point-->
      </mes:MessageHeader>
   </soapenv:Header>
   <soapenv:Body>

      <ns:OTA_AirAvailRQ Version="2.3.0">
         <!--Optional:-->
         <ns:OptionalQualifiers>
            <!--Optional:-->
            <!-- <ns:AdditionalAvailability AirExtras="?" DirectAccess="?" Ind="?" MoveDown="?"/> -->
            <!--Optional:-->

            <ns:FlightQualifiers DirectOnly="false">

            <!-- <ns:FlightQualifiers Charters="?" DirectOnly="" ExcludeCodeshares="?" Scan="?"> -->
               <!--Optional:-->
               <!-- <ns:AlliancePartner> -->
                  <!-- <ns:Group>?</ns:Group> -->
               <!-- </ns:AlliancePartner> -->
               <!--Optional:-->
               <!-- <ns:Cabin Exclude="?"> -->
                  <!--1 or more repetitions:-->
                  <!-- <ns:Designator>?</ns:Designator> -->
               <!-- </ns:Cabin> -->
               <!--Optional:-->
               <!-- <ns:VendorPrefs DirectAccess="?" Exclude="?"> -->
                  <!--0 to 20 repetitions:-->
                  <!-- <ns:Airline Code="?"/> -->
               <!-- </ns:VendorPrefs> -->
            </ns:FlightQualifiers>
            <!--Optional:-->
            <!-- <ns:TimeQualifiers> -->
               <!--Optional:-->
               <!-- <ns:ArrivalTime WindowAfter="?" WindowBefore="?"/> -->
               <!--Optional:-->
               <!-- <ns:DepartureTime WindowBefore="?" WindowAfter="?"/> -->
            <!-- </ns:TimeQualifiers> -->
         </ns:OptionalQualifiers>
         <!--Optional:-->
         <ns:OriginDestinationInformation>
            <ns:FlightSegment DepartureDateTime="2016-02-01">
            <!-- <ns:FlightSegment DepartureDateTime="2016-02-01" NumberInParty="1"> -->
               <ns:DestinationLocation LocationCode="LAX"/>
               <ns:OriginLocation LocationCode="JFK"/>
            </ns:FlightSegment>

            <!-- <ns:FlightSegment ArrivalDateTime="?" DepartureDateTime="?" FlightNumber="?" NumberInParty="?" ResBookDesigCode="?"> -->
               <!--Optional:-->
               <!-- <ns:ConnectionLocations> -->
                  <!--Optional:-->
                  <!-- <ns:CarrierSpecificDisplay> -->
                     <!-- <ns:LegOne> -->
                        <!-- <ns:VendorPrefs Exclude="?" ExcludeCodeshares="?" Any="?"> -->
                           <!--0 to 20 repetitions:-->
                           <!-- <ns:Airline Code="?"/> -->
                        <!-- </ns:VendorPrefs> -->
                     <!-- </ns:LegOne> -->
                     <!--Optional:-->
                     <!-- <ns:LegThree> -->
                        <!-- <ns:VendorPrefs Exclude="?" ExcludeCodeshares="?" Any="?"> -->
                           <!--0 to 20 repetitions:-->
                           <!-- <ns:Airline Code="?"/> -->
                        <!-- </ns:VendorPrefs> -->
                     <!-- </ns:LegThree> -->
                     <!-- <ns:LegTwo> -->
                        <!-- <ns:VendorPrefs Exclude="?" ExcludeCodeshares="?" Any="?"> -->
                           <!--0 to 20 repetitions:-->
                           <!-- <ns:Airline Code="?"/> -->
                        <!-- </ns:VendorPrefs> -->
                     <!-- </ns:LegTwo> -->
                  <!-- </ns:CarrierSpecificDisplay> -->
                  <!--1 to 2 repetitions:-->
                  <!-- <ns:ConnectionLocation LocationCode="?"> -->
                     <!--Optional:-->
                     <!-- <ns:ConnectTimeOverrides Max="?" Min="?"/> -->
                  <!-- </ns:ConnectionLocation> -->
               <!-- </ns:ConnectionLocations> -->
               <!-- <ns:DestinationLocation LocationCode="?"/> -->
               <!-- <ns:OriginLocation LocationCode="?"/> -->
            <!-- </ns:FlightSegment> -->

         </ns:OriginDestinationInformation>
      </ns:OTA_AirAvailRQ>

   </soapenv:Body>
</soapenv:Envelope>

A: Yes, sharing the request will help.
Also, I'm not sure if it was a typo, but your <eb:Action> element value on the soap header should be = OTA_AirAvailLLSRQ and not OTA_AirAvailLLSRS.
As noted in the documentation:
https://developer.sabre.com/docs/read/soap_apis/air/search/Air_Availability

A: The <mes:Service> value seems off. Could you please try these values?

*

*OTA_AirAvailLLSRQ

*OTA_AirAvailLLS

*OTA_AirAvail
Also, check that you're invoking the correct endpoint: https://developer.sabre.com/docs/read/soap_basics/environments.
Since the error is a ERR.SWS.HOST.CONNECTOR_ERROR, have you tried to repeat the call today? Maybe it was just an intermittent issue on Sabre's side.

A: try the following Code.

header
===========
<eb:ConversationId>1343843</eb:ConversationId>
<eb:Service eb:type="OTA">Air</eb:Service>
<eb:Action>OTA_AirAvailLLSRQ</eb:Action>
<eb:CPAID>123</eb:CPAID>

Body
===============

<OTA_AirAvailRQ Version="1.11.1">
  <POS>
    <Source PseudoCityCode="123"/>
  </POS>
  <SpecificFlightInfo>
    <FlightNumber Number="831"/>
    <Airline Code="9W"/>
    <TPA_Extensions>
      <DepartureDateTime DateTime="2016-01-31T19:30:00"/>
      <OriginLocation LocationCode="MAA"/>
      <DestinationLocation LocationCode="DEL"/>
    </TPA_Extensions>
  </SpecificFlightInfo>
</OTA_AirAvailRQ>