text:
Q: Using Redactor as a WSIWYG editor with Ruby on Rails I'm trying to add a few simple WYSIWYG fields to a form. Initially redactor was working perfectly but somewhere along the line I lost the toolbars. I think that somehow the original code was overidden by other members in the team but I don't know and I'm not comfortable enough with Git to go back and check.
This is in edit_content.html.erb

     <fieldset>
         <legend><%= @category.title.capitalize %> Content</legend>

                 <%= f.label :statement %>

                 <%= f.text_area :statement, rows: 10, cols: 80, :class=>'redactor_text' %>

                  <%= f.label :quote %>

                  <%= f.text_area :quote, row: 10, cols: 80, :class=>'redactor_text' %>

    </fieldset>

And this is in assets\javascripts\redactor-rails\config.js
 $('.redactor').redactor(
   { "imageUpload":"/redactor_rails/pictures?" + params,
     "imageGetJson":"/redactor_rails/pictures",
     "fileUpload":"/redactor_rails/documents?" + params,
     "fileGetJson":"/redactor_rails/documents",
     "path":"/assets/redactor-rails",
     "css":"style.css"
  });
$('.redactor_text').redactor(
  { buttons: ["html", "|", "formatting", "|", "bold", "italic", "underline", "deleted", "|",
   "unorderedlist", "orderedlist", "outdent", "indent", "|", "image", "video", "file", "link", "table", "|",
   "fontcolor", "backcolor", "|", "alignment", "|", "horizontalrule"]
});

I initially chose redactor because I've heard it can work with paperclip and I'd like to use that functionality later on so any help on this matter would be greatly appreciated!!

A: maybe you can do this?
var buttons = ["html", "|", "formatting", "|", "bold", "italic", "underline", "deleted", "|",
   "unorderedlist", "orderedlist", "outdent", "indent", "|", "image", "video", "file", "link", "table", "|",
   "fontcolor", "backcolor", "|", "alignment", "|", "horizontalrule"];

 $('.redactor').redactor(
   { "imageUpload":"/redactor_rails/pictures?" + params,
     "imageGetJson":"/redactor_rails/pictures",
     "fileUpload":"/redactor_rails/documents?" + params,
     "fileGetJson":"/redactor_rails/documents",
     "path":"/assets/redactor-rails",
     "css":"style.css",
     "buttons": buttons

  });

how you think?

A: Your class should be redactor, not redactor-text if you want redactor to show properly.
... :class=>' redactor redactor_text' %>

I'm currently struggling with customising the toolbar with custom buttons. But I hope my answer helps with getting the toolbar showing again.


text:
Q: Is there a limit on how many different apps can single developer publish on Android Market? I did the googling and checked all the relevant questions on StackOverflow but question is still standing:
Is there a limit on how many different apps can single developer publish on Android Market?
I am not talking about updates etc. I mean different Free Applications with different ID, different functionality and different APKs under same developer ID.
Proof links are more than welcome.
Update: I am aware of the limit on size. But the question is there a limit on amount?
Failed to find anything on it in Terms of Service but I am not a lawyer.
Thanks.

A: Updated 2021
After conversing with Google Play Console customer support, the answer is that there is no max limit on the number of apps you can have. The only limit is of uploading a maximum of 15 new apps per day. Quoting the conversation:
Ques:

Is there a limit to number of apps per account or the number of app updates per day per account? The only limit I could find in documentation was for private apps within a organization. The Manage private Android apps in Google Play document mentions : You can upload up to 15 private apps per day. However, it talks nothing about the public apps.

Ans:

The current upload limit for apps on the Play Console is 15 apps within a 24 hour period.
This limit includes the first APK uploaded for an app project, even if those projects that are deleted later on. The 15 app limit does not include APK updates for existing apps.
To upload another APK to an app project for the first time, you'll need to wait 24 hours after you uploaded your last APK. To prevent reaching this limit in the future, I recommend updating an app instead of deleting and recreating a project.

Ques:

Is there a document that I can refer to which states the limit?

Ans:

Unfortunately, there isn't at the moment.

A: I have an old suspended account from 2012 had over 2500 apps published, but with new policies coming out Google forced us to update all apps in 30 days, impossible to update that many in a month so my account got terminated even though I unpublished the apps I didn't update. I also had a friend that had over 5000 live wallpapers on his account.

A: Judging by the lack of "any" documentation that would stipulate these regulations, I'd have to say NO. There is no limit to the number of apps per developer ID that can be uploaded, simply size constraints per apk. Why would the Android team try to limit the amount applications uploaded by any developer?
For instance: If I were to create 5 really bad apps, and they had a cap of 5, I would then not be able to take my experience programming those bad apps to create my final "well rounded" application. Thus they would be allowing me to put 5 bad apps and not the good ones, and in essence bringing the overall quality of their market WAY DOWN. That's just a simple example of why I don't think this would ever happen.
Another would be that there are people, or companies, that can code 15-20 good apps that would benefit the Android Market. If they limit them to a certain number, then they're shooting themselves in the foot again..

A: Google publisher account have a limit of 15 APKs per day. and there is no limit on number of apps by developer. i have uploaded more than hundred apps in my account and it is still active .

redpajama_set_name: RedPajamaStackExchange


text:
Q: Why can't I load a WFS into Openlayers: "TypeError: null is not an object (evaluating 'Ob(d).b')" I am teaching myself the use of Services (WFS) in and OpenLayers itself. As far as I know I managed to get a proper gml-file (GML2, I hope [EDIT: It is GML 3.1, I figured]) from a governmental server by calling the following url:
https://www.wfs.nrw.de/geobasis/wfs_nw_atkis-basis-dlm_aaa-modell-basiert?service=WFS&version=1.1.0&srsName=EPSG:25832&request=GetFeature&typeName=adv:AX_Strassenachse&bbox=391918,5709660,393499,5710570,urn:ogc:def:crs:EPSG::25832&fin=fin
(I can get a GML3.2-File by using this url instead, but I think OL can't handle that)
var utm32nName = 'EPSG:25832';
proj4.defs(utm32nName, "+proj=utm +zone=32 +ellps=GRS80 +units=m +no_defs");
utm32n = ol.proj.get(utm32nName)
var wfsSource = new ol.source.Vector({
    format: new ol.format.WFS({gmlFormat: ol.format.GML3 }),
    loader: function(extent, resolution, projection) {
        var url = 'https://www.wfs.nrw.de/geobasis/wfs_nw_atkis-basis-dlm_aaa-modell-basiert?service=WFS&' +
              'version=1.1.0&srsName=EPSG:25832&request=GetFeature&' +
              'typeName=adv:AX_Strassenachse&' +
              'bbox=' + [391918,5709660,393499,5710570].join(',') +
              ',urn:ogc:def:crs:EPSG::25832&fin=fin';
        console.log(url);
        $.ajax({
              url
        }).done(
                loadFeatures
        ).fail(
                function(err, txtstatus) {
                   console.log('something went wrong')
                   console.log(err)
                   console.log(txtstatus)
                }
        );
    },
    strategy: ol.loadingstrategy.bbox
});
var loadFeatures = function(response) {
    //console.log(response)
    wfsSource.addFeatures(new ol.format.WFS().readFeatures(response));
    console.log(wfsSource.getFeatures());
};

var wfsvector = new ol.layer.Vector({
    source: wfsSource,
    style: new ol.style.Style({
      stroke: new ol.style.Stroke({
        color: 'rgba(0, 0, 0, 1.0)',
        width: 2
      })
    }),
    name: 'basisdlm'
});
fliederstrasse = [7.453175, 51.531939];
fliederstrasseWebMercator = ol.proj.transform(
    ol.proj.fromLonLat(fliederstrasse), 'EPSG:3857', 'EPSG:25832'
);
map = new ol.Map({
    layers: [
        wfsvector,
        raster
    ],
    target: document.getElementById('map'),
    controls: ol.control.defaults({
      attributionOptions: {
        collapsible: false
      }
    }),
    view: new ol.View({
        projection: 'EPSG:25832',
      center: fliederstrasseWebMercator,
      maxZoom: 19,
      zoom: 17
    })
});

At
new ol.format.WFS().readFeatures(response)

I get the Error from the Headline and deep inside in ol.js in Ob(d).b it handles the srs-string, as far as I can tell. At some point in me working (don't know what I did, then), I managed to get no error, but nevertheless no feature has been loaded (0 features in source). Initially I tried to load the WFS with the url-attribute of ol.source.Vector() but that didn't work, either.
Even if I changed it to:
new ol.format.GML2().readFeatures(response)

or
new ol.format.GML3().readFeatures(response) //with different url

I got stuck at the same line in ol.js
Does anyone have a clue whats wrong?
I am not a native speaker of English.

EDIT:
As requested in the comments, here is a small portion of the GML provided by the link above (and it seems to be GML3.1, not GML2):

<gmlx:FeatureCollection
    xmlns="http://www.adv-online.de/namespaces/adv/gid/6.0"
    xmlns:gmlx="http://www.opengis.net/gml"
    xmlns:xlink="http://www.w3.org/1999/xlink"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.adv-online.de/namespaces/adv/gid/6.0 http://www.wfs.nrw.de/aaa-suite/schema/old-gml-versions/3.1.1/NAS/6.0/schema/AAA-Fachschema.xsd http://www.opengis.net/gml http://www.wfs.nrw.de/aaa-suite/schema/old-gml-versions/3.1.1/NAS/6.0/schema/gml/3.1.1/base/gml.xsd http://www.isotc211.org/2005/gco http://www.wfs.nrw.de/aaa-suite/schema/old-gml-versions/3.1.1/NAS/6.0/schema/iso/19139/20070417/gco/gco.xsd http://www.isotc211.org/2005/gmd http://www.wfs.nrw.de/aaa-suite/schema/old-gml-versions/3.1.1/NAS/6.0/schema/iso/19139/20070417/gmd/gmd.xsd">
    <gmlx:boundedBy>
        <gmlx:Envelope srsName="urn:ogc:def:crs:EPSG::25832" srsDimension="2">
            <gmlx:lowerCorner>391831.345 5709517.376</gmlx:lowerCorner>
            <gmlx:upperCorner>393630.29 5710694.863</gmlx:upperCorner>
        </gmlx:Envelope>
    </gmlx:boundedBy>
    <gmlx:featureMember>
        <AX_Strassenachse gmlx:id="DENWAT01D0001uqC">
            <lebenszeitintervall>
                <AA_Lebenszeitintervall>
                    <beginnt>2015-12-06T19:58:47Z</beginnt>
                </AA_Lebenszeitintervall>
            </lebenszeitintervall>
            <modellart>
                <AA_Modellart>
                    <advStandardModell>Basis-DLM</advStandardModell>
                </AA_Modellart>
            </modellart>
            <istTeilVon xlink:href="urn:adv:oid:DENWAT01D000070p"/>
            <position>
                <gmlx:LineString srsName="urn:ogc:def:crs:EPSG::25832" srsDimension="2">
                    <gmlx:posList>
    392921.714 5709720.797 392991.374 5709731.245 392999.596 5709734.109 393006.221 5709739.54
    </gmlx:posList>
                </gmlx:LineString>
            </position>
            <anzahlDerFahrstreifen>2</anzahlDerFahrstreifen>
        </AX_Strassenachse>
    </gmlx:featureMember>
    ...

A: I found out, what the problem was, after switching from ol.js to ol-debug.js (should have done this earlier!).
This issue isn't in the WFS/GML3 or Openlayers. The issue was in the identifier for the utm32n-SRS. urn:ogc:def:crs:EPSG::25832 and EPSG:25832 aren't the same (the identifier, the SRS is)!
After replacing the short code with the long one (as the WFS-Server requires...) all the data has been loaded into Openlayers. Though I had to use ol.format.WFS().


text:
Q: Why does Java display 10 digit numbers in scientific notation? I have retrieved a large number from an Access database. Why does Java display this 10 digit no. as E+9 in its cells, instead of displaying the full number, even though i am using "Number" as datatype for that column.
Is there any way to display the full number instead of E+" " in the cells, other than using the "Text" datatype. If there is no way, how should a long no. coded from Java program be retrieved from database?
For eg :- 9867605659 will be displayed as E+9 using Number datatype, which may be entered as long from a java program, how to fetch it back from the database and set it to a textfield as 9867605659?

import javax.swing.*;
import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JComponent;
import javax.swing.SwingUtilities;
import net.java.dev.designgridlayout.DesignGridLayout;
import java.io.*;
import net.java.dev.designgridlayout.Tag;
import javax.swing.JButton;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;
import java.sql.*;

class Driverproblem
{
JFrame JF;
JDesktopPane JDP;
JInternalFrame JIF4,JIF13;
Container C,C4,C13;
JMenu FileMenu;
JMenuItem Settings,CompanyInfo;
JMenuBar JMB;
JLabel i4l1,i4l2,i4l3,i4l4,i4l5,i4l6,i4l7,i13l1,i13l2,i13l3,i13l4,i13l5,i13l6,i13l7;
JTextField i4t1,i4t2,i4t3,i4t4,i4t5,i4t6,i13t1,i13t2,i13t3,i13t4,i13t5,i13t6;
JButton i4b1,i13b1;
JTextArea i4ta1,i13ta1;
Color color;
public Driverproblem()
{
JF=new JFrame("Quick Accounting");
JDP=new JDesktopPane();
JMB=new JMenuBar();

C=JF.getContentPane();
color = Color.lightGray;
JDP.setBackground(color);
C.add(JDP,BorderLayout.CENTER);
C.add(JMB, BorderLayout.NORTH);
JF.pack();
JF.setLocationRelativeTo(null);
JF.setVisible(true);

FileMenu=new JMenu("File");

CompanyInfo=new JMenuItem("Company Info");

CompanyInfo.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent ae)
    {
    JIF4.setVisible(true);
    try
    {
        Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
        Connection i4conn =        DriverManager.getConnection("Jdbc:Odbc:TomsJava");
        PreparedStatement i4ps = i4conn.prepareStatement("select * from i13SaveUserSettings");
ResultSet i4rs =     i4ps.executeQuery();
        while(i4rs.next())
        {
            String i4companyName = i4rs.getString("Company_Name");
            String i4address = i4rs.getString("Address");
            String i4place = i4rs.getString("Place");
            long i4phone = i4rs.getLong("Phone");
            int i4pincode = i4rs.getInt("Pincode");
            String i4email = i4rs.getString("Email");
            String i4website = i4rs.getString("Website");
            System.out.println(i4phone);

            i4t1.setText(i4companyName);
            i4ta1.setText(i4address);
            i4t2.setText(i4place);
            i4t4.setText(String.valueOf(i4phone));
            i4t4.setText(String.valueOf(i4pincode));
            i4t5.setText(i4email);
            i4t6.setText(i4website);
        }
        i4rs.close();
        i4ps.close();
        i4conn.close();

    }
    catch(SQLException e)
    {
        System.out.println(e);
    }
    catch(ClassNotFoundException z)
    {
        System.out.println(z);
    }
    catch(NumberFormatException n)
    {
        System.out.println(n);
    }
}
});
  JIF4 = new JInternalFrame("Company Information",true,true, true, true);
 JIF4.setBounds(10, 10, 600, 500);
    C4 = JIF4.getContentPane();
DesignGridLayout layout4 = new DesignGridLayout(C4);

    i4l1 = new JLabel("Company Name : ");
    i4l2 = new JLabel("Address : ");
    i4l3 = new JLabel("Place : ");
    i4l4 = new JLabel("Phone : ");
    i4l5 = new JLabel("Pincode : ");
    i4l6 = new JLabel("Email : ");
    i4l7 = new JLabel("Website : ");
    i4t1 = new JTextField(20);
    i4t2 = new JTextField(20);
    i4t3 = new JTextField(20);
    i4t4 = new JTextField(20);
    i4t5 = new JTextField(20);
    i4t6 = new JTextField(20);
    i4ta1 = new JTextArea(5,20);
    i4b1 = new JButton("Close");
i4b1.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent ae)
    {
    JIF4.dispose();
    }
});

layout4.row().grid(i4l1).add(i4t1);
layout4.row().grid(i4l2).add(i4ta1);
layout4.row().grid(i4l3).add(i4t2);
layout4.row().grid(i4l4).add(i4t3);
layout4.row().grid(i4l5).add(i4t4);
layout4.row().grid(i4l6).add(i4t5);
layout4.row().grid(i4l7).add(i4t6);
layout4.emptyRow();
layout4.row().center().add(i4b1);
JDP.add(JIF4);

Settings=new JMenuItem("Settings");
Settings.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent ae)
    {
    JIF13.setVisible(true);
    }
});
JIF13 = new JInternalFrame("User Settings",true,true, true, true);
JIF13.setBounds(10, 10, 600, 500);

    C13 = JIF13.getContentPane();
DesignGridLayout layout13 = new DesignGridLayout(C13);

    i13l1 = new JLabel("Company Name : ");
    i13l2 = new JLabel("Address : ");
    i13l3 = new JLabel("Place : ");
    i13l4 = new JLabel("Phone : ");
    i13l5 = new JLabel("Pincode : ");
    i13l6 = new JLabel("Email : ");
    i13l7 = new JLabel("Website : ");
    i13t1 = new JTextField(20);
    i13t2 = new JTextField(20);
    i13t3 = new JTextField(20);
    i13t4 = new JTextField(20);
    i13t5 = new JTextField(20);
    i13t6 = new JTextField(20);
    i13ta1 = new JTextArea(5,20);
    i13b1 = new JButton("Save");
i13b1.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent ae)
    {
            try
        {
        Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
        Connection i13conn = DriverManager.getConnection("Jdbc:Odbc:TomsJava");

        String i13companyName = i13t1.getText();
        String i13address = i13ta1.getText();
        String i13place = i13t2.getText();
        long i13phone = Long.valueOf(i13t3.getText());
        int i13pincode = Integer.parseInt(i13t4.getText());
        String i13email = i13t5.getText();
        String i13website = i13t6.getText();

        Statement i13stmt = i13conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
        ResultSet i13rs = i13stmt.executeQuery("SELECT * FROM i13SaveUserSettings");
        i13rs.absolute(1);
        i13rs.updateString("Company_Name", i13companyName);
        i13rs.updateString("Address",i13address);
        i13rs.updateString("Place",i13place);
        i13rs.updateLong("Phone",i13phone);
        i13rs.updateInt("Pincode",i13pincode);
        i13rs.updateString("Email",i13email);
        i13rs.updateString("Website",i13website);
        i13rs.insertRow();

        i13rs.close();
        i13stmt.close();

        }

    catch(SQLException e)
    {
    System.out.println(e);
    }
    catch(ClassNotFoundException z)
    {
    System.out.println(z);
    }
    catch(NumberFormatException n)
    {
    System.out.println(n);
    }
    JIF13.dispose();
    }
});

layout13.row().grid(i13l1).add(i13t1);
layout13.row().grid(i13l2).add(i13ta1);
layout13.row().grid(i13l3).add(i13t2);
layout13.row().grid(i13l4).add(i13t3);
layout13.row().grid(i13l5).add(i13t4);
layout13.row().grid(i13l6).add(i13t5);
layout13.row().grid(i13l7).add(i13t6);
layout13.emptyRow();
layout13.row().center().add(i13b1);

JDP.add(JIF13);

FileMenu.add(Settings);
FileMenu.add(CompanyInfo);
JMB.add(FileMenu);
}

public static void main(String args[]) throws SQLException,ClassNotFoundException
{
new Driverproblem();
}

}

A: Your issue stems from the fact that you are apparently trying to store [Phone] as a Number. While we tend to call them "phone numbers" they are really just strings of digits. They are not "numbers" in the mathematical sense because we have no need to perform calculations on them. (For example, adding or subtracting two phone numbers serves no useful purpose.)
So, you should simply use a Text field in the Access database to store [Phone] (and probably use a Text field for [Pincode], too).
edit re: comment
Regarding the display of very large (or very small) numbers, there are several factors that could cause a number to appear in scientific notation. For example, when displaying a very large number in a text box the UI code could switch the number to scientific notation

*

*if the value has more than a given number of significant digits, or

*if the text box is too narrow to display the entire number in standard notation then the UI code might opt for scientific notation instead of truncating the value (or producing an "overflow" display like #######).

Certainly floating-point types like Double and Single are the most likely to appear in scientific notation because their range of values is so large that at some point we'd be forced to use it. This can be illustrated with the following Java code, where both fields in the Access table contain 12345678
ps = con.prepareStatement(
        String.format("SELECT DoubleField, LongIntField FROM DemoTable WHERE ID=1")
        );
ResultSet rs = ps.executeQuery();
rs.next();
System.out.println(rs.getDouble(1));
System.out.println(rs.getInt(2));
System.out.println(9223372036854775807L);

The console output is
1.2345678E7
12345678
9223372036854775807

Notice that the [DoubleField] value is displayed in scientific notation even though it takes more space than the standard notation equivalent would (12345678.0). Java has apparently decided that the number is "big enough" to warrant switching to scientific notation. Notice also that Java happily prints out the largest possible Long value, even though it is much larger than the Double value.


text:
Q: mongoose field with the name type I am trying to validate and save a Passport profile with this structure:
http://passportjs.org/guide/profile/
This is the scheme I came up with:
// Define the schema.
schema = new mongoose.Schema({
    // The name of this user, suitable for display.
    displayName: String,
    // Each e-mail address ...
    emails: [{
        // ... with the actual email address ...
        value: String,
        // ... and the type of email address (home, work, etc.).
        type: String
    }],
    // A unique identifier for the user, as generated by the service provider.
    id: String,
    // The name ...
    name: {
        // ... with the family name of this user, or "last name" in most Western languages ...
        familyName: String,
        // ... with the given name of this user, or "first name" in most Western languages ...
        givenName: String,
        // ... and with the middle name of this user.
        middleName: String
    },
    // The provider which with the user authenticated.
    provider: String
});

The e-mail has a property called 'type', which is reserved for a mongoose type. How do I solve this?

A: You need to define the field using an object:
type: {type: String}

A: Update for Mongoose 4+
You have to define the typeKey to the schema.
const schema = new Schema({
    //Define a field called type of type String
    type: { $type: String },
    //Define a field called whatever of type Array
    whatever: { $type: Array }
}, { typeKey: '$type' });

So all the schema will use the keyword $type to set the type of the field. And you can safely use type to set the name of the field.
https://mongoosejs.com/docs/guide.html#typeKey


text:
Q: Device driver code signing for windows XP 32 bit I have written a device driver for a device but each time I connect the device in windows XP 32 bit, "found new hardware" wizard appears.
I am signing the driver using a Comodo code signing certificate and not using the cross certificate chain to link to microsoft root authority. Nor is the driver wql certified.
So my question is to disable the found new hardware wizard on windows xp:
i) Does my driver needs to be wql certified?
ii) signed with microsoft root certificate using cross certificate from verisign?
iii) or something i missed out in my code which needs to be changed?

A: did some research and found the answer:
windows XP does not support authenticode driver signing and there are no plans to add it. Only way is to sign using microsoft certificate by using a cross certificate

A: As far as I know, the only driver signing recognized by Windows XP is a WHQL signature. Cross-signing has nothing to do with it. (Cross-signing allows the Windows Vista kernel driver loader to recognize Authenticode signatures. It has nothing to do with Windows XP driver loading.)
Authenticode signatures, while they would validate with DIFx / DpInst, would fail to validate later when SetupAPI tries to install your device driver out of the driver store.


text:
Q: python replace will not replace "'" with "\'"     dctLineItems = InvFunctions.dctLineItems
    for value in dctLineItems.values():
        iORDER_ID = value[0]
        iITEM_No = value[1]
        iQUANTITY = value[2]
        sTmp = value[3]
        sTmp2 = sTmp.replace("'", "\'", 1)
        #sTmp2 = connPy.escape(sTmp)
        sITEM_Name = sTmp2
        sPART_No = value[4]
        fPRICE = value[5]
        fPRICE = fPRICE.lstrip('$')
        iDOGWOOD = value[6]
        iADVANCED = value[7]

I have tested it extensively and replace works for just about anything except what I need it to do. When I try to replace " ' " with " \' " it doesn't do anything. Notice the commented line#8 connPy.escape(sTmp), it doesn't work either but that is going to be a separate question.

A: Another option: using Python's raw strings:
>>> "'hello'".replace("'", "\'")
>>> "'hello'"
>>>
>>> "'hello'".replace("'", "\\'")
>>> "\\'hello\\'"
>>>
>>> "'hello'".replace("'", r"\'")  # <- Note the starting r
>>> "\\'hello\\'"

A: My best guess is that the backslash is known in Python as an escape sequence. Python doesn't recognize this as a literal, so you would have to put \\ instead. The same applies to the single quote (\')
So where you're using your replace function (I'm guessing the 5th line from the top), try typing this:
sTmp.replace("'", "\\", 1)


text:
Q: Modify compile steps of glibc I am trying to recompile the standard Glibc 2.20, with a requirement that I disable optimizations for a few specific components. In particular, I'm looking to remove the -O2 flag that's inherited from the parent make files, to components like saying malloc. Where the standard process of making does gcc malloc.c -O2, I'd want to specify my own command line for this particular module.
Is there a way that can be done?

A: In order to compile malloc/malloc.c with -O0, you can add this to malloc/Makefile:
CFLAGS-malloc.c = -O0 -D__OPTIMIZE__

The -D__OPTIMIZE__ flag is needed to bypass a check in include/libc-symbols.h.  This trick does not work for all parts of glibc, but for malloc.c, it produces a working library.


text:
Q: How do we use the result of one function in another (Haskell)? I would like to test if a a series of 3 inputs can together form a triangle, before calculating the area.
to see if they can form a triangle i have:
test :: Float -> Float -> Float -> Bool
test a b c
    | a>0 && b>0 && c>0 && a+b>c && c+b>a &&c+a > b= True
    | otherwise = False

To calculate the area i have:
sqrt(s(s-a)(s-b)(s-c))
where s= (a+b+c)/2

I thought maybe something like this would work:
area_of_triangle :: Float -> Float -> Float -> Bool-> Maybe Float
area_of_triangle
    | test== True = sqrt(s(s-a)(s-b)(s-c))
    | True = Nothing
        where s= (a+b+c)/2

but it returns the error:
Solution.hs:8:31: Not in scope: 'a'

Solution.hs:8:36: Not in scope: 'b'

Solution.hs:8:41: Not in scope: 'c'

Solution.hs:10:19: Not in scope: 'a'

Solution.hs:10:21: Not in scope: 'b'

Solution.hs:10:23: Not in scope: 'c'

A: First of all, there is no need to test a boolean in order to return True or False: just return the boolean!
test :: Float -> Float -> Float -> Bool
test a b c = a>0 && b>0 && c>0 && a+b>c && c+b>a && c+a>b

Then, for the other function:
We have to add arguments a b c, and multiplication signs *.
We need to use Just in the first case to turn a Float into a Maybe Float.
test needs its three arguments.
Also, there is no point in checking whether boolean == True -- just use the boolean!
Finally, why the Bool argument? We don't need that -- let's remove it.
area_of_triangle :: Float -> Float -> Float -> Maybe Float
area_of_triangle a b c
    | test a b c = Just (sqrt (s * (s-a) * (s-b) * (s-c)))
    | otherwise  = Nothing
        where s = (a+b+c)/2

It is common in Haskell to use camelCase for function names. Consider renaming your function to areaOfTriangle to follow the convention.


text:
Q: JavaScript error only in Chrome, works fine in Safari? I have the following code to set up a database and its tables on an iDevice, when a user starts a standalone web app. The code is working fine if it is used on the device with Safari but if it is opened in Chrome it throws the following error
Uncaught Error: INVALID_STATE_ERR: DOM Exception 11

Besides the error it also prevents other functions from working, again only in Chrome.
Here is the code, including the function to create the tables. I have added a comment in the code on the line that Chrome indicates the error.
//this sets up the DB name global variable and uses it to open the DB
        var dbName = 'CBNapp',
        db = openDatabase(dbName, '1.0', dbName, 65536);// chrome error = UncaughtError: INVALID_STATE_ERR: DOM Exception 11 (anonymous function) line 43
//            db = openDatabase(dbName, '1.0' /*version*/, dbName, 65536 /*max size*/);
//opens the database when the document is loaded
$(document).ready(openCBNappDB);

function openCBNappDB(){
//this if statement checks to see if device supports offline storage
    if ( !window.openDatabase ) {
        $('add_note').innerHTML = "Browser does not support local storage."
        return;
    }
// create tables in the DB
    function dbTransaction(fn) {
       db.transaction(fn);
    }
    /*create 5 tables*/ //colums in tables are not correct as of apr 25 2012
    dbTransaction(
        function (tx) {
        tx.executeSql('CREATE TABLE CBNapp_Usage (key INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, MemberID TEXT NOT NULL DEFAULT "", NewKnife INTEGER NOT NULL DEFAULT 0, True INTEGER NOT NULL DEFAULT 0, Trivia INTEGER NOT NULL DEFAULT 0, Movies INTEGER NOT NULL DEFAULT 0, Jokes INTEGER NOT NULL DEFAULT 0, Musings INTEGER NOT NULL DEFAULT 0, Stories INTEGER NOT NULL DEFAULT 0);');
    tx.executeSql('CREATE TABLE CBNapp_Members (key INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, MemberID TEXT NOT NULL DEFAULT "", CBNname TEXT NOT NULL DEFAULT "", Community TEXT NOT NULL DEFAULT "", BirthDay TEXT NOT NULL DEFAULT "", BirthMonth TEXT NOT NULL DEFAULT "", Gender TEXT NOT NULL DEFAULT "Male", iOS TEXT NOT NULL DEFAULT "", Device TEXT NOT NULL DEFAULT "");');
    tx.executeSql('CREATE TABLE CBNapp_Scores (key INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, MemberID TEXT NOT NULL DEFAULT "", GameName TEXT NOT NULL DEFAULT "", TimesPlayed INTEGER NOT NULL DEFAULT 0, HiScore INTEGER NOT NULL DEFAULT 0 );');
    tx.executeSql('CREATE TABLE CBNapp_UserPrefs (key INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, MemberID TEXT NOT NULL DEFAULT "", TextSize INTEGER NOT NULL DEFAULT 14, AutoRetrieve INTEGER NOT NULL DEFAULT 0 );');
    tx.executeSql('CREATE TABLE CBNapp_Errors (key INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, MemberID TEXT NOT NULL DEFAULT "", code INTEGER NOT NULL, message TEXT NOT NULL );');
    }
);
}

If anyone could please suggest a specific solution to get this to work properly with Chrome and Safari it would be much appreciated.
I am sure I have made many other errors in the script as well. If anyone wishes to take the time to show me how I should improve it I would be very thankful for any ideas. I am VERY new at this and would ask for specific suggestions please.

A: Well it's hard to say for sure without knowing the HTML but I'm guessing chrome doesn't have a openDataBase method assigned to its window object and that branches to some bad JQuery:
$('add_note').innerHTML = "Browser does not support local storage."

'add_note' is meaningless. If add_note is a class it should be '.add_note' or '#add_note' if an ID.
Also, since it's JQuery, it's probably not going to have the innerHTML method. Quickest fix assuming an ID would probably be:
$('#add_note')[0].innerHTML = "Browser does not support local storage."

But that might bust if it's a form element like a text input.


text:
Q: Strange behaviour in JPA2 entities While observing some log entries, I observed a behaviour, I do not understand.
I have recreated the scenario.
The entity:
@Entity
public class SimpleEntity implements Serializable {

    private static final long serialVersionUID = 2777681889998131084L;

    @Id
    @GeneratedValue
    private Long id;
    @Version
    private Long version;
    @Column(length = 20, nullable = false, unique = true, updatable = false)
    @NotNull
    private String username;
    @Column(length = 60)
    private String email;

    // Constructors

    // getters/setters

    // @Override
    // toString : generated by eclipse, modified to include super.toString
    // hashCode, equals : generated by eclipse, based on 'username'

}

The Testcase
@Test
public void testUpdate() {
    SimpleEntity simple;
    SimpleEntity simple2;

    try {
        simple = bean.create(new SimpleEntity("user",
                "original@original.com"));  // em.persist
        simple.setEmail("updated@updated.com");
        simple2 = bean.update(simple);          // em.merge
        System.out.println(simple);
        System.out.println(simple2);
    } catch (EJBException e) {
        System.out.println(e.getMessage());
    }
}

It prints following lines corresponding to above System.out.println lines
...SimpleEntity@36ebea SimpleEntity [id=1, version=1, username=user, email=updated@updated.com]
...SimpleEntity@36ebea SimpleEntity [id=1, version=2, username=user, email=updated@updated.com]

What I find strange is the address is same for both entities (SimpleEntity@36ebea), but if I look at the data, it is not same. 'version' is different. (1 & 2)
How can same instance (as address is same), show different data? Is there some proxy in play? how?

A: simple and simple2 are actually two different instances. You said that "toString : generated by eclipse, modified to include super.toString". The inherited toString() from Object looks like:
public String toString() {
    return getClass().getName() + "@" + Integer.toHexString(hashCode());
}

So @36ebea is not the object's address, but its hashcode which (being based only on username) remains the same for different instances where only the version differs.
You might want to use System.identityHashCode() to get a hashcode derived from the object's address (it basically returs what you would get from calling hashCode() if you didn't override the one inherited from Object).


text:
Q: How can I change activity in flutter on appropriate nfc call? I am new to flutter and I have problem on NFC call.
I just want to change activity on appropriate NFC call. for example:
IF on NFC tag is written 'Card1', it will open Card1 activity from Home Page
If there is written 'Card2', it will open Card2 activity and so on..
I am using this plug in: https://pub.dev/packages/nfc_in_flutter#-readme-tab-
I import it in initState() method but it doesn't work:
NDEFMessage message = NFC.readNDEF(once: true).first as NDEFMessage;
  print("payload: ${message.payload}");
  if (message.payload == 'Card3') {
    Navigator.push(context, MaterialPageRoute(builder: (context) => Menu()));
  }

I also tried this:
if (NFCMessage == Text('Card3')) {
  Navigator.push(context, MaterialPageRoute(builder: (context) => MenuStFulState()));
}

but it doesn't work either.
I also tried to change initState() method to async but it doesn't work either
Here is my code:
main.dart
import 'dart:async';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:nfc_in_flutter/nfc_in_flutter.dart';
import 'package:nfcflutterapp/Menu.dart';

void main() => runApp(NfcApp());

class NfcApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        backgroundColor: Color.fromARGB(255, 248, 248, 248),
        appBar: AppBar(
          title: Text("Presto"),
          backgroundColor: Colors.yellow,
        ),
        body: NfcStFul(),

    ),
    );
  }
}

class NfcStFul extends StatefulWidget {
  @override
  _NfcStFulState createState() => _NfcStFulState();
}

class _NfcStFulState extends State<NfcStFul> {

  bool _supportsNFC = false;
  bool _reading = true;
  StreamSubscription<NDEFMessage> _stream;

  @override
  void initState() {
    super.initState();
    NFC.isNDEFSupported.then((bool isSupported) {
      setState(() {
        _supportsNFC = isSupported;
      });
    });
    NDEFMessage message = NFC.readNDEF(once: true).first as NDEFMessage;
    print("payload: ${message.payload}");
    if (message.payload == 'Card3') {
      Navigator.push(
          context, MaterialPageRoute(builder: (context) => Menu()));
    }
  }

  @override
  Widget build(BuildContext context) {
    if (!_supportsNFC) {
      return Center(
        child: RaisedButton(
          child: Text('Ups.. Your phone doesn\'t have NFC'),
          onPressed: null,
        ),
      );
    } else {
      return Center(
        child: RaisedButton(
            child: Text(
              'Main Actvity',
              style: TextStyle(color: Colors.white),
            ),
            color: Colors.blue,
            onPressed: null;
        ),
      );
    }
  }
}

menu.dart    where it should go
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class Menu extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Menu'),
        backgroundColor: Colors.yellow,
      ),
      body: SafeArea(
        child: Center(
          child: RaisedButton(
            color: Colors.green,
            onPressed: () {
              Navigator.pop(context);
            },
            child: Text(
              'Menu Activity',
              style: TextStyle(color: Colors.white),
            ),
          ),
        ),
      ),
    );
  }
}


text:
Q: React.js controlled select option (drop-down) select the changed value I have the following code but when i change the value from drop-down the drop-down sticks to Select the status Rather changing it to the selected value i.e
const [formData, setFormData] = useState({
    title: "",
    status: "",
    priority: "",
    start_date: new Date(),
    due_date: new Date(),
    progress: 0,
    user_id: null,
  });

const task_statuses = ["active", "pending", "inactive", "completed"];

  const setData = (e) => {
    setFormData({ ...formData, [e.target.name]: e.target.value });
  };
    <select onChange={setData} name="status">
      <option value=""> Select Task Status </option>
        {task_statuses.map((status) => {
          return (
            <option key={shortid.generate()} value={status}>
              {capitalizeFirstLetter(status)}
            </option>
          );
        })}
      </select>

I would like it to change it to selected option, can't do it please help
Please Help

A: Because you are not setting value prop of select tag
Add value prop to value={formData.priority}
<select onChange={setData} value={formData.priority} name="status">
Thanks


text:
Q: cant get image to display inline with no margin in bootstrap I am trying to have an icon display right after the textbox, left edge of image abutting right edge of textbox. I cant get it to happen. The image is always low and offset to the right. Im certain bootstrap is having something to do with this but Ive tried turning off almost all the css in dev tools but it still wont display right after the texbox.
Here is the code, I even wrapped it in a span hoping to force it in one line. The bootstrap classes start the textbox where I want it, I just simply want the icon directly next to the textbox.

        <asp:Label runat="server" AssociatedControlID="tbCCNum" CssClass="col-md-2 control-label">Credit Card No.</asp:Label>

               <asp:TextBox runat="server" ID="tbCCNum" CssClass="form-control" Width="300" MaxLength="20" ClientIDMode="Static" /><asp:Image ID="ccImage" runat="server" ClientIDMode="Static" ImageUrl="~/Images/CC Icons/amex_small.png"/>

Here is the css
span.imageinline img {
    display: inline !important;
    margin-left: 2px;
}

A: In order for the controls to display horizontally in bootstrap, the form-inline class from bootstrap must be used, without any additional css of your own, as shown below

        <asp:Label runat="server" AssociatedControlID="tbCCNum" CssClass="col-md-2 control-label">Credit Card No.</asp:Label>
        **
**

                <asp:TextBox runat="server" ID="tbCCNum" CssClass="form-control"
                     Width="300" MaxLength="20" ClientIDMode="Static" TabIndex="8"/>
                <asp:Image ID="ccImage" runat="server" ClientIDMode="Static"
                     ImageUrl="~/Images/CC Icons/amex_small.png"/>


text:
Q: Javafx - change shape RotateTransition start point I am trying to rotate multiple spheres around one object in the center and the challenge I am facing now is how to put different start points (maybe angle?) for the shapes so that they all don't start right from the same spot all at once.
This is my code :
    Sphere earth = new Sphere(2);
    earth.setTranslateZ(7);
    earth.setTranslateX(30);

    RotateTransition rt4 = new RotateTransition();
    rt4.setNode(earth);
    rt4.setDuration(Duration.millis(3000));
    rt4.setAxis(Rotate.Y_AXIS);
    rt4.setByAngle(360);
    rt4.setCycleCount(Animation.INDEFINITE);
    rt4.setInterpolator(Interpolator.LINEAR);
    rt4.play();

Edit (for clarification): earth is rotating around itself and around the center point with coordinates (0,0,0) at the same time. What I want to change the from where earth starts rotating around the center point and NOT around itself.


text:
Q: RSpec functional test is redirecting to the wrong place I need some help guys, trying to make this test to pass but with no luck.
describe 'PUT posts/:id' do

  describe 'with valid attributes' do

    let(:mock_post) { mock_model('Post', title: 'hey! iam a mock!', description: 'a sexy model', location: 'everywhere') }

    login_user

    it 'should update the object and redirect to the post' do
      Post.stub!(:find).with(mock_post.id).and_return(mock_post)

      Post.any_instance.should_receive(:update_attributes).with({"these" => "params"}).and_return(true)

      response.should redirect_to post_path(mock_post)

      put :update, id: mock_post.id, post: { these: 'params' }
    end

    it 'should have a current_user' do
      subject.current_user.should_not be_nil
    end

  end

For now, I have something like the above test and getting the following error:
1) PostsController PUT posts/:id with valid attributes should update the object and redirect to the post
     Failure/Error: response.should redirect_to post_path(mock_post)
       Expected response to be a <:redirect>, but was <200>
     # ./spec/controllers/posts_controller_spec.rb:200:in `block (4 levels) in <top (required)>'

PostsController:
class PostsController < ApplicationController
  load_and_authorize_resource except: [:index, :show]
  before_filter :authenticate_user!, except: [:index, :show, :tags]
  before_filter :find_post, only: [:show, :edit, :update, :suspend, :suspend_alert]

def update
  if @post.update_attributes(params[:post])
    flash[:success] = 'Cool.'
    redirect_to post_path(@post)
  else
    render :edit
  end
end

protected
  def find_post
    @post = Post.find(params[:id])
  end
end

Also, how should I write the test for the render :edit part?

A: Your spec never calls the controller action. Try adding:
Post.any_instance.
  should_receive(:update_attributes).
  with({"these" => "params"})
put :update, :id => "1", :post => {"these" => "params"}

To test the two paths that result from the call to update_attributes, substitute the value in the expectation:
it "should redirect when successful" do
  Post.any_instance.
    should_receive(:update_attributes).
    with({"these" => "params"}).
    and_return(true)`
  response.should_redirect_to(post_path(@mock_post))
  put :update, :id => "1", :post => {"these" => "params"}
end

it "should render the edit page when unsuccessful" do
  Post.any_instance.
    should_receive(:update_attributes).
    with({"these" => "params"}).
    and_return(false)`
  response.should render_template("edit")
  put :update, :id => "1", :post => {"these" => "params"}
end


text:
Q: Change value in an array I am import from a CSV to Mysql, every works fines the only problem is i have to convert normal date to mysql date. can anyone help.
$row = 1;
if (($handle = fopen($_FILES['Filedata']['tmp_name'], "r")) !== FALSE) {
    while (($data = fgetcsv($handle, 10000, ";")) !== FALSE) {
        if($row != 1) {
            $sql = sprintf('INSERT INTO %s ('.$fields.') VALUES ("%s")',
              'flight_tbl',
              implode('", "', array_map('mysql_escape_string', $data))
            );
            mysql_query("SET names latin5");
            mysql_query($sql);
        }
        $row++;

A: Since you don't define "normal date" this is not guaranteed to work, but if your date is held in a string the answer will almost certainly be:
$mySqlDate = date('Y-m-d H:i:s', strtotime($normalDate));

And if it is an integer Unix timestamp, it will be:
$mySqlDate = date('Y-m-d H:i:s', $normalDate);

A: Do you mean this?
$data[$your_date_field_index] = date('Y-m-d H:i:s', strtotime($data[$your_date_field_index]));


text:
Q: Kervaire invariant: Why dimension 126 especially difficult? Is there any resource that might help non-experts gains some understanding of why
the Kervaire invariant problem remains open now only in dimension $126$? ($126 =2^7-2=2^{j+1}-2$;
whether $\theta_j=\theta_6$ exists in the "$128$-stem"), i.e., why the celebrated Hill-Hopkins-Ravenel
proof technique fails in this last remaining case?
I read a delightful exposition by Erica Klarreich ("Mathematicians solve 45-year-old Kevaire Invariant Puzzle,"
The Best Writing on Mathematics, 2010, 373ff, Simons Foundation link), which piqued my interest.
But Michael Hopkins' online presentation slides announcing the result
in 2009 ("Applications of algebra to a problem in topology") are beyond my ken.
Perhaps this an area too abstruse for all but the experts?
I'd appreciate pointers to expositions.  Thanks!

A: I'll give a shot at an answer.  The relevant dimensions are of the form $2^j-2$. For
$j\leq 4$, it is easy and classical that we can construct manifolds of Kervaire invariant one. The
problem was ``reduced'' from differential topology to pure stable homotopy
theory by Browder in 1969.  Direct calculational methods in
homotopy theory were used by Barratt, Jones, and Mahowald to construct a
cell complex that can be used to solve the homotopy theory problem and prove
that such manifolds also exist in dimensions 30 and 62.  I believe a construction
of such a manifold has been worked out in dimension 30, but that has certainly not
been done in dimension 62. Periodicity phenomena play a huge role in modern stable
homotopy theory, and a crucial feature of the Hill, Hopkins, Ravenel proof is a
periodicity of order $2^8 = 256$.  That enables them to solve the stable homotopy problem
and prove there is no manifold of Kervaire invariant one for $j\geq 8$.  The reasons $j=7$
is so hard are several. Nobody has a really good reason for guessing which way the answer
will go. There is no reason to expect a relevant periodicity of order $2^7$. Direct calculation
of the Adams spectral sequence through dimension $126$ is just plain hard: the
calculations blow up.  There is a chance that the methodology of Barratt, Jones,
and Mahowald might extend to prove existence (if that is how the answer turns out!),
but it will probably be much harder to prove nonexistence (if that is the answer).

A: More detail on Jones's 30 manifold and analogous constructions can be found in my  Extended powers of manifolds and the Adams spectral sequence , Cont. Math. 271, 41--51.  The basic idea in it dates from 1979 or so (immediately upon seeing Jones's construction) but didn't make it into print for another 20 years.  There are also comments about the homotopy theoretic approach to the problem in   the talk I gave in Edinburgh  in 2011 at the workshop on the Kervaire invariant.
The main point is that there is a small set of homology classes in low dimension (dimension 2 for Jones' construction) which one wants to realize as the fundamental class of a manifold with tangent bundle realized by a permutation representation of $\pi_1$.  To get the 30 dimensional Kervaire manifold from $S^7$ one only needs a two manifold and an appropriate representation in $S_4$.  ($D_8$ will do:  only the Sylow 2-subgroup matters.)  To get from $S^7$ to the 62 dimensional Kervaire manifold requires a 6-manifold with a representation of $\pi_1$ in $S_8$.  Unfortunately, no such manifold exists.  In dimension 126, one would need a 14 manifold, and presumably such also fails to exist. So, one needs to find another approach that relaxes the input data needed.


text:
Q: Relevant HTTP Status code on the Rest API I have a scenario by passing invalid data in Path variable which is input to fetch the data from Database.As the provided data is not valid so it triggers "500 Internal Server Error" from the database as could not found the data.
and have customized HTTP Status as 404(NOT_FOUND) because data is not found.
Would like to understand,what can be the best HTTP Status code for this scenario other than 404?

A: HTTP is an application protocol, whose application domain is the transfer of documents over a network (Jim Webber, 2011).  The status codes we use in the response are metadata from the domain of document transfer -- which is to say, we care about what the message means, not why our implementation is sending it.
The information specific to your domain, which communicates the details of the problem to the client, belongs in the message-body of the response.  The status code is there so that generic components, that don't know the specifics of your domain, can "do the right thing" -- where the right thing is constrained by HTTP semantics.
Michael Kropat published flow charts that may help select the correct status code.  Alternatively, you can look through the HTTP Status Code Registry, which has links to the standard that defines the semantics of each code.
Broadly speaking, if the problem is with the request, then we use some message from the 4xx message class; problems in the request are client errors.  404 specifically directs the client's attention to the target-uri.
So if the request is bad because information encoded into a path segment is incorrect, then 404 is the correct choice, because it tells the client where to look for the problem.  The only reason that you would look elsewhere is if some other part of the 404 semantics were inappropriate for your circumstances.

A:
Would like to understand what can be the best HTTP status code for this scenario other than 404?

If you are looking for something other than 404, then you could look into the more generic 400. From the RFC 7231:

6.5.1.  400 Bad Request
The 400 (Bad Request) status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).

But bear in mind that the 404 status code itself is suitable for this situation. See the following quote from the RFC 7231:

6.5.4.  404 Not Found
The 404 (Not Found) status code indicates that the origin server did not find a current representation for the target resource or is not willing to disclose that one exists. [...]


text:
Q: CoreLocation not working for Adhoc Distribution on iOS 8 I've been developing an app that depends on CoreLocation since the first Xcode 6 beta 1. Last week I submitted it for test on iTunes connect/TestFlight. The app works perfectly on develop devices, but when I create adhoc version, it doesn't ask for authorization.
The details:

*

*Settings > General > Reset > Reset Location Warnings didn't solve

*I set NSLocationWhenInUseUsageDescription on Info.plist

*CoreLocation.framework is added on Linked Frameworks and Libraries (but nothing changed when I remove)

*I'm using cocoapods for MBProgressHUD

*My ViewController is like: https://gist.github.com/thiagogabriel/d0120547565c91089b72

*I recently changed the Product Name to lowercase

*I started a new project from scratch and it happened the same on Adhoc for internal testers

A: Change this code:
func askForLocation(sender: AnyObject) {
    if (locationStatus == CLAuthorizationStatus.Denied) {
        let url = NSURL.URLWithString(UIApplicationOpenSettingsURLString)
        UIApplication.sharedApplication().openURL(url)
    } else if (locationStatus != CLAuthorizationStatus.AuthorizedWhenInUse) {
        locationManager.requestWhenInUseAuthorization()
    } else if (locationStatus == CLAuthorizationStatus.AuthorizedWhenInUse){
        self.performSegueWithIdentifier("seguePlaceViewController", sender: sender)
    }
}

to
func askForLocation(sender: AnyObject) {
    locationManager.requestWhenInUseAuthorization()

    if (locationStatus == CLAuthorizationStatus.Denied) {
        let url = NSURL.URLWithString(UIApplicationOpenSettingsURLString)
        UIApplication.sharedApplication().openURL(url)
    } else if (locationStatus == CLAuthorizationStatus.AuthorizedWhenInUse){
        self.performSegueWithIdentifier("seguePlaceViewController", sender: sender)
    }
}

This update solves your problem.


text:
Q: How do I get Date only from epoch time having time as 23:59:59 I have date 2015-12-25 23:59:59 in the form of epoch milliseconds 1451087999000, And I want the date part only i.e. 2015/12/25, how do I do that efficiently might be with the JODA time library which is nowdays standard for dealing with Date time in java.
I have this code which works in most the case but when time is like 23:59:59 it gives me the next date (as in my case it gives 2015-12-26 with input of 2015-12-25 23:59:59)-
String dateInMilliSeconds = "1451087999000";
String dateInYYYYMMDDFormat = DateHelper.convertDateFormat(new Date(Long.valueOf(dateInMilliSeconds)),DateHelper.yyyy_MM_dd);

DateHelper.convertDateFormat() -
public static final String yyyy_MM_dd = "yyyy-MM-dd";
public static String convertDateFormat( Date date, String outputFormat )
{
    String returnDate = "";
    if( null != date )
    {
        SimpleDateFormat formatter = new SimpleDateFormat(outputFormat);
        returnDate = formatter.format(date);
    }
    return returnDate;
}

A: You can use localDate from java 8
LocalDate date = Instant.ofEpochMilli(dateInMilliSeconds).atZone(ZoneId.of(timeZone)).toLocalDate();

A: I should like to make two points:

*

*Time zone is crucial.

*Skip the outdated classes Date and SimpleDateFormat.

My suggestion is:
    String dateInMilliSeconds = "1451087999000";
    LocalDate date = Instant.ofEpochMilli(Long.parseLong(dateInMilliSeconds))
            .atOffset(ZoneOffset.UTC)
            .toLocalDate();
    System.out.println(date);

This prints
2015-12-25

Please note that you get your desired output format for free: LocalDate.toString() produces it. If you want to be able to produce different output formats, use a DateTimeFormatter.
Time zone
Your millisecond value isn't just equal to 2015-12-25 23:59:59. It is equal to this date and time in UTC, so you need to make sure that your conversion uses this time zone offset. When I run your code from the question on my computer, I incorrectly get 2015-12-26 because my computer is in the Europe/Copenhagen time zone.
JSR-310 AKA java.time
Joda-Time was the widely acknowledged better alternative to the original date and time API from Java 1 that many considered poor and troublesome. The Joda-Time project is now finished because the modern Java date and time API known as JSR-310 or java.time came out three and a half years ago, so they recommend we use this instead. So my code does.

A: The timestamp 1451087999000 is 2015-12-25 23:59:59 in UTC. In your code, you're not specifying the timezone when you format it with a SimpleDateFormat, so it's formatted in your local timezone.
With Joda Time:
String dateInMilliSeconds = "1451087999000";

LocalDate date = new LocalDate(Long.parseLong(dateInMilliSeconds), DateTimeZone.UTC);

DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-dd");

String result = formatter.print(date);


text:
Q: Functor from orbit category to Top Given a topological group $G$, define the orbit category $\mathcal{O}(G)$ as the category whose objects are the $G$-sets $G / H$, and whose morphisms are the $G$-equivariant maps. Peter May's book has the following lemma on page 31:

Let $X$ be a $G$-space. Then passage to orbit spaces defines a functor $X / (-) : \mathcal{O}(G) \to \textbf{Top}$.

This functor sends $G / H$ to $X / H$, and sends a $G$-equivariant map $\alpha : G / H \to G / K$ given by $gH \mapsto g\gamma H$ (note that every $G$-equivariant map is of this form) to the continuous map $Hx \mapsto K\gamma^{-1}x$. May uses this functor in his construction of covering spaces of a space $B$ corresponding to subgroups of $\pi_1(B, b)$.
Why is this functor defined this way? I'm having trouble understanding why $\alpha$ is taken to $Hx \mapsto K\gamma^{-1}x$.

A: As you note, every $G$-equivariant map $\alpha\colon G/H\rightarrow G/K$ has the form $gH\mapsto g\gamma K$ (though be cautious that $\gamma$ is only determined modulo $K$ and needs to satisfy $\gamma^{-1}H\gamma\subseteq K$ for this to be a $G$-equivariant map). This means we can consider the $G$-equivariant map $\tilde{\alpha}\colon G\rightarrow G$ given by $g\mapsto g\gamma$ (in fact, every $G$-equivariant map $G\rightarrow G$ has this form for a unique and arbitrary $\gamma$). Thus, we obtain a commutative diagram
$\require{AMScd}$
\begin{CD}
G @>\tilde{\alpha}>> G\\
@Vp_HVV @Vp_KVV\\
G/H @>\alpha>> G/K.
\end{CD}
Assume $F\colon\mathcal{O}(G)\rightarrow\textbf{Top}$ is a functor such that $F(G/H)=X/H$ on objects. This functor then transforms the diagram into a commutative diagram
\begin{CD}
X @>F\tilde{\alpha}>> X\\
@VFp_HVV @VFp_KVV\\
X/H @>F\alpha>> X/K.
\end{CD}
I propose we take $Fp_H\colon X\rightarrow X/H$ to be the natural projection $x\mapsto Hx$. Hopefully, that feels natural. Then, the vertical maps are quotient maps, so $F\alpha$ would already be uniquely determined by $F\tilde{\alpha}$ in case we have functoriality.
Now, $\tilde{\alpha}$ comes from the element $\gamma$ of $G$ acting on $G$ via right translation. We require a homeomorphism $F\tilde{\alpha}\colon X\rightarrow X$, so since we have the element $\gamma$ of $G$ lying around, it's not far-fetched to think we might simply want to let $F\tilde{\alpha}$ to be the map $x\mapsto\gamma.x$. However, that doesn't work. Why? The action of $G$ on itself via right translation is an action from the right, whereas the action of $G$ on $X$ is an action from the left. Even though the $G$-equivariant maps $G\rightarrow G$ are in $1-1$-correspondence with the elements of $G$, the composition of those maps does not correspond to the composition in $G$, but rather composition in the opposite order (the resulting group is sometimes called $G^{op}$). To witness, following the map $g\mapsto g\gamma$ corresponding to $\gamma$ by the map $g\mapsto g\eta$ corresponding to $\eta$ yields $g\mapsto g\gamma\eta$, corresponding to $\gamma\eta$ rather than  $\eta\gamma$. But, there is a simple way of identifying $G$ and $G^{op}$ (i.e. reversing the order of composition), namely by inversion, so if we let $F\tilde{\alpha}$ be $x\mapsto\gamma^{-1}.x$, this recovers functoriality for these types of maps.
Of course, it remains to check that this actually gives a well-defined functor on the entire category, but the point I'm trying to make is that a few hopefully more "natural" choices and considerations actually force us to define the functor the way it is defined. The ultimate justification as to why the functor is defined the way it is will be give once you learn its application, but I understand that tautological answers of the form "it is defined this way, because that's what's needed to make the following theorem work" are not always satisfying as someone is learning something for the first time, and don't necessarily motivate how the definition was come up with in the first place.


text:
Q: TABLE_NAME has no column COLUMN_NAME I am getting this error when I write data in edit text and press save
2020-04-07 18:30:53.114 5580-5580/com.example.app100 E/SpannableStringBuilder: SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
2020-04-07 18:30:53.115 5580-5580/com.example.app100 E/SpannableStringBuilder: SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
2020-04-07 18:30:59.915 5580-5580/com.example.app100 E/SQLiteLog: (1) table SUBJECT_LIST has no column named MIN_TO
2020-04-07 18:30:59.916 5580-5580/com.example.app100 E/SQLiteDatabase: Error inserting MIN_TO=0 HRS_FROM=0 MIN_FROM=0 NAME=subject CREDITS=41 HRS_TO=0 from {P:5580;U:10348}
    android.database.sqlite.SQLiteException: table SUBJECT_LIST has no column named MIN_TO (code 1 SQLITE_ERROR): , while compiling: INSERT INTO SUBJECT_LIST(MIN_TO,HRS_FROM,MIN_FROM,NAME,CREDITS,HRS_TO) VALUES (?,?,?,?,?,?)
        at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
        at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:986)
        at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:593)
        at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:590)
        at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:61)
        at android.database.sqlite.SQLiteStatement.<init>(SQLiteStatement.java:33)
        at android.database.sqlite.SQLiteDatabase.insertWithOnConflict(SQLiteDatabase.java:1637)
        at android.database.sqlite.SQLiteDatabase.insert(SQLiteDatabase.java:1494)
        at com.example.app100.DatabaseHelper.addData(DatabaseHelper.java:59)
        at com.example.app100.AddSubject.AddData(AddSubject.java:46)
        at com.example.app100.AddSubject.access$000(AddSubject.java:12)
        at com.example.app100.AddSubject$1.onClick(AddSubject.java:40)
        at android.view.View.performClick(View.java:7201)
        at android.view.View.performClickInternal(View.java:7170)
        at android.view.View.access$3500(View.java:806)
        at android.view.View$PerformClick.run(View.java:27562)
        at android.os.Handler.handleCallback(Handler.java:883)
        at android.os.Handler.dispatchMessage(Handler.java:100)
        at android.os.Looper.loop(Looper.java:214)
        at android.app.ActivityThread.main(ActivityThread.java:7682)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:516)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)

DataHelper class:
package com.example.app100;

import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

import androidx.annotation.ContentView;
import androidx.annotation.Nullable;

public class DatabaseHelper extends SQLiteOpenHelper {

    private static final String table_name = "SUBJECT_LIST";
    private static final String COL1 = "ID";
    private static final String COL2 = "NAME";
    private static final String COL3 = "HRS_FROM";
    private static final String COL4 = "MIN_FROM";
    private static final String COL5 = "HRS_TO";
    private static final String COL6 = "MIN_TO";
    private static final String COL7 = "CREDITS";

    public DatabaseHelper(@Nullable Context context) {
        super(context, table_name, null, 3);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        String CREATE_TABLE = "CREATE TABLE " + table_name + "("+COL1+ " INTEGER PRIMARY KEY AUTOINCREMENT, " +
                COL2 + "TEXT, " +
                COL3 + "INTEGER, " +
                COL4 + "INTEGER, " +
                COL5 + "INTEGER, " +
                COL6 + "INTEGER, " +
                COL7 + "INTEGER);";
        db.execSQL(CREATE_TABLE);
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        db.execSQL("DROP TABLE IF EXISTS " + table_name);
        onCreate(db);
    }

    public boolean addData(String name , int  h1 , int m1 , int h2 , int m2, int credit ){
        SQLiteDatabase db =  this.getWritableDatabase();
        ContentValues contentValues = new ContentValues();
        contentValues.put(COL2 , name);
        contentValues.put(COL3 , h1);
        contentValues.put(COL4 , m1);
        contentValues.put(COL5 , h2);
        contentValues.put(COL6 ,m2);
        contentValues.put(COL7 , credit);

        long result = db.insert(table_name , null , contentValues);
        return result != -1;
    }

    public Cursor getdata(){
        SQLiteDatabase db = this.getWritableDatabase();
        String query = "SELECT * FROM " +table_name;
        return db.rawQuery(query , null);
    }
}

When I remove the mentioned column in the error from my database I get an error saying another column in missing.
I tried changing my database version and reinstalling my app but that didn't work.
After trying a couple of times app crashes.
Please help

A: You need spaces between your column names and types. Change
COL2 + "TEXT, " +

to
COL2 + " TEXT, " +

and similarly for the other columns. After that you can uninstall your app to recreate the database with correct column names.


text:
Q: Получить ID всех детей, страницы wordpress Допустим есть страница, Games и есть дети этой страницы WarCraft, Half Life, Counter Strike. Как получить мне все id страниц детей ? Дело в том что нужно создавать множество Родителей и Детей. И что бы все время не иcкать где то id, я хочу их просто где то выводить, или получать, указывая "Родителя". Как это осуществить ?

A: Воспользуйтесь функцией get_page_children()
<?php
// Получим страницы, по которым будет идти поиск
$my_wp_query = new WP_Query();
$all_wp_pages = $my_wp_query->query(array('post_type' => 'page'));

// На примере страницы с id = 2
$page_id = 2;

// Фильтруем страницы полученного ранее массива $all_wp_pages и находим в них всех потомков страницы с id = $page_id
$page_childrens = get_page_children($page_id, $all_wp_pages);

//выводим id и заголовок каждого потомка
foreach ($page_childrens as $page_children) {
    echo 'page_id: ' . $page_children->ID . '; page_title: ' . $page_children->post_title . '
';
}
?>

A: Но спасибо, тем временем, я нашел ответ на другом источнике, и не много переделал сам код, скажем привел его в нормальный вид, и вывод результатов.
<?php
function get_all_pages($page_title) {
  $page = get_page_by_title($page_title);

  if (empty($page)) return array();

  $children = new WP_Query(
    array(
      'post_type' => 'page',
      'post_parent' => $page->ID,
      'fields' => 'ids',
      'posts_per_page' => -1 //Покажем всех детей ! Хороших и плохих :)
    )
  );
  array_unshift($children->posts,"{$page->ID}");
  return $children->posts;
}
//Имя страницы родителя, айди детей которых хотим получить.
$allpages = get_all_pages('Имя страницы родителя'); //Сдесь указываем имя страницы (Родителя)
foreach($allpages as $page)
{
//Выводим айди и имя страницы.
echo "
".$page."->".get_the_title($page);
}
?>

Может кому то будет полезно. Спасибо за помощь.


text:
Q: ViewPager's onPageSelected never called I need to implement setOnPageChangeListener because i need to hide certain item from ActionBar if the first fragment is showed to the user.
My simple code :
    viewPager.setOnPageChangeListener(new OnPageChangeListener() {

        @Override
        public void onPageSelected(int page) { //never called
            // TODO Auto-generated method stub
            if(page == 0)
            {
                isSearch = false;
            }
            else
            {
                isSearch = true;
            }
            supportInvalidateOptionsMenu();
        }

        @Override
        public void onPageScrolled(int arg0, float arg1, int arg2) {
            // TODO Auto-generated method stub

        }

        @Override
        public void onPageScrollStateChanged(int arg0) {
            // TODO Auto-generated method stub

        }
    });
viewPager.setCurrentItem(0); //not working

If the first fragment is shown (page == 0), isSearch should be false but the onPageSelected never getting called when i debug it.
Please kindly help me, Thanks for your help.
Note : My adapter does not implements OnPageChangeListener. Or should i implement it? Is it a must?

A: If you are using PageIndicator in conjunction with the Viewpager then the onPageChangeListener of the ViewPager is not called. You should set a page change listener to the PageIndicator and it will be called when the page changes.
indicator.setOnPageChangeListener(new OnPageChangeListener() {

    @Override
    public void onPageSelected(int page) {
        if(page == 0)
        {
            isSearch = false;
        }
        else
        {
            isSearch = true;
        }
        supportInvalidateOptionsMenu();
    }

    @Override
    public void onPageScrolled(int arg0, float arg1, int arg2) {
        // TODO Auto-generated method stub

    }

    @Override
    public void onPageScrollStateChanged(int arg0) {
        // TODO Auto-generated method stub

    }
});

Hope this will help you ツ


text:
Q: How do i apply both hard-coded and method classes in Elmish? I am formatting a web application made using F# and the SAFE stack. I am using a variable to determine a CSS class to change the formatting of a tag, but I also need two hard-coded CSS classes, and I am unsure how to have both.
I have this:
let statusTag (state:Appointment.State) =
    span [ Class (state.ToString()) ] [ str (sprintf "%A" state) ]

And i need it to work more like this:
let statusTag (state:Appointment.State) =
    span [ Class "status text" + (state.ToString()) ] [ str (sprintf "%A" state) ]

But i dont know how to do this in F#
Any help would be appreciated

A: The only thing that seems wrong with your attempt is that you need extra parentheses around the expression that constructs the string with the names of the classes (on the other hand, you do not need it around the state.ToString() call). The following should do the trick:
let statusTag (state:Appointment.State) =
    span [ Class("status text" + state.ToString()) ] [ str (sprintf "%A" state) ]


text:
Q: Error trying to convert excel sheet to pdf with xlwings I have been trying to convert an excel sheet to a pdf using xlwings. I got it to work but I cannot update all links automatically without getting this error. I need the sheet to update without prompting the user to update. Anyone know how to fix this problem without running into an error. This is my code:
def create_report(name):
    if len(name) > 30:
        name = name[0:30]
    wb = xw.Book("Individual Supplier Report Cards.xlsx", update_links = all)
    sheet = wb.sheets[name]
    current_work_dir = os.getcwd()
    pdf_path = os.path.join(current_work_dir, "Report Card.pdf")
    sheet.api.ExportAsFixedFormat(0, pdf_path)
    os.startfile(pdf_path)

This is the error I am getting:
ret = self._oleobj_.InvokeTypes(0, LCID, 2, (9, 0), ((12, 1),),Index
pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, None, None, None, 0, -2147352565), None)

Edit:
The conversion to a PDF works but when it from my email function i get the same error. Anyone know what the problem is here? Here is my code:
def send_email(contact_list):
    for email, name in contact_list.items():
        if email == "[no contact]":
            continue
        msg = MIMEMultipart("alternative")
        msg['From']= "xxxx"
        msg['To']= email
        msg['Subject']= "xxxx"
        message = open("Message template.txt", "r")
        str1 = ""
        for line in message:
            str1 = str1 + line
        message.close()
        message1 = MIMEText(str1)
        msg.attach(message1)
        create_report(name)
        pdfname = "Report Card.pdf"
        binary_pdf = open(pdfname, 'rb')
        payload = MIMEBase('application', 'octate-stream', Name=pdfname)
        payload.set_payload((binary_pdf).read())
        binary_pdf.close()
        encoders.encode_base64(payload)
        payload.add_header('Content-Decomposition', 'attachment', filename=pdfname)
        msg.attach(payload)
        s = smtplib.SMTP_SSL(host='smtp.gmail.com')
        s.login("xxx", "xxx")
        s.send_message(msg)
        s.quit
    del msg


text:
Q: OpenCV-Python: Draw Parabolical Line I'm trying to draw a curved line, but I just can't figure out how to do that.
I've got 3 coordinates to work with - [line_start_x, line_start_y], [clicked_x, clicked_y], and [line_end_x, line_end_y] and my code looks like this:
pts = np.array(
        [
            [line_start_x, line_start_y],
            [clicked_x, clicked_y],
            [line_end_x, line_end_y],
        ], np.int32)
image = cv2.polylines(image, [pts], True, (0, 255, 0), 2)
cv2.imshow(window_name, image)

However, the above code outputs a triangle and not a parabolical line, as I need.
I'd appreciate any help with that matter!

A: assuming I understand the problem, 2 points will be ever fixed (line_start,line_end). when you have 3 points an a 2nd grade polinomial you there's only onse solution. you can calculate the expresion using numpy and then draw it evaluating this is a toy example with fixed image an point (change it's coords and try diferent solutions). I didn't put any condition on clicked_point so it could be out of the rect.

*

*create image, rectangle and put bias points
 import cv2
 import numpy as np

 width,height = 900,600
 img = np.zeros((height,width,3), np.uint8)
 white_rect = np.array([[100, 100],
                        [width-100, 100],
                        [width-100, height-100],
                        [100, height-100],
                        [100, 100] ], np.int32)

 img = cv2.polylines(img, [white_rect], True, (255,255,255), 3)

 line_start_x = int(white_rect[0:2,0].mean())
 line_start_y = int(white_rect[0:2,1].mean())
 line_end_x   = int(white_rect[2:4,0].mean())
 line_end_y   = int(white_rect[2:4,1].mean())
 clicked_x    = 555
 clicked_y    = 192

 img =cv2.circle(img, (clicked_x, clicked_y), 5, (0,0,255), -1)
 img =cv2.circle(img, (line_start_x, line_start_y), 5, (0,0,255), -1)
 img =cv2.circle(img, (line_end_x, line_end_y), 5, (0,0,255), -1)

 cv2.imshow('fr', img)
 cv2.waitKey(1)

*Then create point array 'pts' fit parabola and evaluate with numpy.
 pts = np.array([ [line_start_x, line_start_y],
                  [clicked_x, clicked_y],
                  [line_end_x, line_end_y] ], np.int32)

 #side parabola coeffs

 coeffs = np.polyfit(pts[:,1], pts[:,0], 2)
 poly = np.poly1d(coeffs)

 yarr = np.arange(line_start_y, line_end_y)
 xarr = poly(yarr)

*create parab points as int to draw with polylines (might be other choices but i'm gonna use this for simplicity).
 parab_pts = np.array([xarr, yarr],dtype=np.int32).T
 cv2.polylines(img, [parab_pts], False, (255,0,0), 3)

 cv2.imshow('fr', img)
 cv2.waitKey(1)

The output !!!


text:
Q: Virtual particles I use Wikipedia to learn physics. In a recent search I found an ample description of virtual particles in terms of a discontinuous (in the present) and asymptotic distribution of these particles from -infinity (past) to +infinity(future) BUT on revisiting the site THIS DESCRIPTION WAS NO LONGER THERE. It was replaced with "Since these particles do not have a permanent existence,[clarification needed]".Also missing was a statement to the effect "These particles are extremely short lived. The longer a virtual particle acts, the higher the probability of it reversing in time to its assymptotes." Is the conservation of propability (happening +not-happening = 1) broken and in any case, what does "happening" mean for virtual particles? Can anyone clarify this gap for me?

A: The term particle  together with virtual means we are in the realm of particle physics.
Particle physics has  been successfully, in the sense that it has not been falsified, modeled by the standard model of particle physics. You see that I give reference to the wikipedia article, because it has broad lines and a lot of references. This is the use of it, since it is a site where any registered user can always modify a content he/she disagrees with, it cannot be taken as  a  fixed reference  statement by statement. The content you quote is not within  mainstream physics about quantum mechanics and the standard model so somebody edited it. Due to these random wikipedia editings , it is not recommended to study physics from it. For seriously studying physics one needs a serious mathematical background, calculus +, anyway, it cannot be done with hand waving and words, at the present age.
Virtual particles belong to the framework of particle physics and quantum mechanics. The concept of virtual particles appears in using the standard model and calculating the integrals implied in the interactions of particles, scatterings and decays, which are the measurable quantities in the laboratory.
Here is an example of such an integral, a Feynman diagram, which is a pictorial representation of the quite complicated integral one has to calculate, in order to predict the probability of electron electron scattering.

Only lines entering or leaving the diagram represent observable particles. Here two electrons enter, exchange a photon, and then exit. The time and space axes are usually not indicated. The vertical direction indicates the progress of time upward, but the horizontal spacing does not give the distance between the particles.

The concept of "virtual" particle comes because in the pictorial representation, the input quantum numbers of the two particles have to be represented and evaluated for  the output particles and the line in the diagram represents this transfer, together with the energy momentum transfer by the name of the appropriate particle with those quantum numbers: a virtual photon for this diagram. It is called virtual because it does not have the mass of its name. Under the integral it balances the energy and momentum at the input and output, and as a result it does not have a fixed energy-momentum four vector, and thus not a fixed mass. It is an imaginary particle in this sense, because real particles have a fixed unchangeable mass, the one seen in the table of particle physics in the link above.
That is why the article in the wikipedia  was changed because it does not fit within the above mainstream description.The interaction is short lived, and they had attributed real particle status to a mathematical construct.
The statement "virtual particles exist" is talking about mathematics, not physics. Of course the mathematical model has an effect in the probability distributions for the interaction, otherwise it would be useless!! , but in physics one defines  as real, quantities that can be measured in the laboratory, and mathematics is used as a tool with no reality except to give the correct input and output four vectors.
Physics uses mathematics as a tool, not as a generator of reality. When in classical physics one calculates the orbit of the moon, the orbit is an imaginary, virtual, line in space, it is not a measurable quantity, except by measuring the position of the moon and checking. The same is true with virtual particles, their effect is not measurable except by checking the computed probability distributions. The virtual particles are hidden within the calculation, and their mathematical existence is necessary to get the correct probability distribution for the interactions, but the virtual particle's four vectors  are not measurable, they are a continuum of values under the limits of integration.
You could also read this answer of mine here.

A: What exactly do you mean conservation of probability ( happening +not happening )? That seems to be a contradiction in itself without reference to science. One thing has to be kept in mind, the fact that we do not "know" is irrelevant. Once we introduce that , you  get a series of qualifications. Known to whom? How much effort was made to know ? And so on. So that part has nothing to do with virtual particles in any  case.
As to virtual particles, it is a common misconception to think of these as completely hypothetical. Casimir Force, has been experimentally confirmed. So they are as real as any other quantum objects.
So happening has the same meaning for a "virtual" photon as for a "real" photon  created in the central region of the sun and absorbed by a Sodium atom in the outer layer of the sun and detected by us as a dark line when sunlight passes through a prism
Obviously a virtual particle has a high probability of disappearing in time. That is after all what makes them. "virtual" . I suspect that the rest of the description you had earlier come across is not based on published and accepted research. So it was eventually removed by other editors.


text:
Q: Linux: Update DNS with client IP address after connecting via VPN In this related question, the asker has a problem where clients connecting in over the VPN are not updating the DNS records with their SSLVPN Adapter IP address.
The solution is Windows turns out to be very simple - simply tick Register this connection's addresses in DNS in the SSLVPN adapter's  TCP/IP properties.
I am looking to achieve the same thing, but on Linux.
Specifics:

*

*The DNS is managed by Microsoft Active Directory.

*The client is running Ubuntu 18.04.

*The client is connecting to a Fortigate VPN using the forticlientsslvpn_cli command line client wrapped in a bash script.


text:
Q: how to replace n-th occurrence in Go how to replace a func function (s, old, new [] bytes, n int) [] bytes which, given three
slice of bytes, s, old, new, and an integer n, returns a slice corresponding to s in which the
n-th occurrence of old is replaced with new. In case this occurrence does not exist,
the function returns s without changing it? thanks

import (

    "fmt"
    "os"
    "strconv"
)

func main() {
    s := os.Args[1]
    old := os.Args[2]
    new := os.Args[3]
    n, _ := strconv.Atoi(os.Args[4])
    fmt.Println(s)
    replaced := replace([]byte(s), []byte(old), []byte(new), n)
    fmt.Println(string(replaced))
}

func replace(s, old, new []byte, i int) (replaced []byte) {

}```

A: You can try to use a combinaison of bytes.SplitAfter, which will split your original string after the separator (old for you), bytes.Replace() on the N element of your slice, and then, bytes.Join to re-compose your original string.
You should check for the documentation which is pretty clear :)
package main

import (
    "bytes"
    "fmt"
)

func main() {
    str := []byte("oink oink oink oink")
    old := []byte("k")
    new := []byte("X")

    splitedStr := bytes.SplitAfter(str, old)
    splitedStr[2] = bytes.Replace(splitedStr[2], old, new, -1)

    fmt.Printf("%s", bytes.Join(splitedStr, []byte("")))
}


text:
Q: Equation of state of cosmic strings and branes I'm sure these are basic ideas covered in string cosmology or advanced GR, but I've done very little string theory, so I hope you will forgive some elementary questions. I'm just trying to fit some ideas together here. Following my answer to this question I began to wonder what sort of fluid would have a cosmological equation of state $ w = -\frac{1}{3} $. Note the minus sign. I was interested because it seem like a critical case: the scale factor evolves as
$$ a \propto t^{\frac{2}{3(1+w)}} $$
so for $ w = -\frac{1}{3} $,
$$ a \propto t $$
which is neither accelerating nor deccelerating. I was thinking that a fluid of cosmic strings fits the bill since the energy momentum tensor for a string directed along the 3-axis is (effective on scales $\gg$ than the transverse dimension of the string)
$$ T^{\mu\nu}=T_{\text{str}}\left(\begin{array}{cccc}
1 & 0 & 0 & 0\\
0 & 0 & 0 & 0\\
0 & 0 & 0 & 0\\
0 & 0 & 0 & -1
\end{array}\right)\delta^{\left(2\right)}\left(x_{\perp}\right) $$
(c.f. Shifman Chapter 3) and $w$ is defined through the trace
$$ T^\mu_\mu = \rho - 3 p = (1-3w) \rho = 2 \rho $$
the last equality using the explicit form of $T^{\mu\nu}$. This gives $w = -1/3$ as desired.

*

*Question 1: Does this continue to hold for a gas of non-interacting strings? I would expect so since the general case is described by the $T^{\mu\nu}$ above, suitably Lorentz transformed and convoluted with a distribution function. All the operations just mentioned being linear nothing should break, but is there a rigorous result?

*Question 2: Is the lack of acceleration/decceleration in any way related to the well known fact that cosmic strings do not gravitate? (There is a conical singularity on the string, yes, but no propagating curvature.) This is where I would really like some elaboration, because it seems intuitive. But I know that the gravitational effect of a slow rolling scalar is counter-intuitive so I don't want to jump to conclusions here.
Finally, the obvious extension of these ideas are to branes. Take 2-branes embedded in our ordinary 4D universe. The energy momentum tensor is
$$ T^{\mu\nu}=T_{\text{w}}\left(\begin{array}{cccc}
1 & 0 & 0 & 0\\
0 & 0 & 0 & 0\\
0 & 0 & -1 & 0\\
0 & 0 & 0 & -1
\end{array}\right)\delta^{\left(1\right)}\left(x_{\perp}\right) $$
for a brane (domain wall) oriented in the 2-3 plane (see Shifman again, chapter 2). This gives $w = -\frac{2}{3}$ and an expansion history $a \propto t^{2}$, an accelerating expansion. Is this connected to the fact that domain walls antigravitate?

EDIT: Partial answer: Kolb & Turner do the calculation I outlined above for a non-interacting gas of strings and domain walls. The result is a little more involved than I had envisioned. For strings:
$$ w = \frac{2}{3} v^2 - \frac{1}{3}, (7.57)$$
where $v$ is the average velocity of the strings. For branes they find
$$ w = v^2 - \frac{2}{3}, (7.45)$$
where again $v$ is the average velocity. The equation numbers refer to Kolb & Turner, The Early Universe, 1990 ed. So my speculations really only hold for the static case.

A: *

*No, the simple result $w=-1/3$ ceases to hold when the strings start to interact. The cosmic strings must really be "long" for the classical estimates to be OK and for other portions of the energy to be negligible. Interactions add new terms to the energy and strings may also be short, tearing apart etc., and short and compact strings behave like particles (dust), and so on.

*No, it is a coincidence that in $d=4$, the acceleration of the expansion vanishes for $w=-1/3$. It has to be true for some value. The value would be different in a different dimension, I think. Moreover, $d=4$ isn't the right spacetime dimension in string theory. On the other hand, the absence of gravitational waves holds because the codimension is just 2. That's why the geometry is flat almost everywhere (deficit angle only). In full superstring theory, the same property (codimension 2) is shared by 7-branes.


text:
Q: Android webview open target="_blank" urls in popup window i am using webview in my android app.
i want to know is it possible to open target="_blank" urls on my webpage into android popup window??
or any other way to pop up links??

A: //LAYOUT FILE webview_content.xml

    <WebView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"

        android:id="@+id/webView"
        android:scrollbarAlwaysDrawVerticalTrack="false"
        android:scrollbars="none" >
    </WebView>

</RelativeLayout>

///CODE IN ACTIVITY

final Dialog dialog = new Dialog(context);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.getWindow().requestFeature(Window.FEATURE_PROGRESS);
    dialog.setContentView(R.layout.webview_content);

    WebView webView = (WebView) dialog
            .findViewById(R.id.webView);
    webView.getSettings().setJavaScriptEnabled(true);
             webView.loadUrl("YOUR URL");

       dialog.show();


text:
Q: How to start an activity in finish() I want to start another activity in finish() depending on a condition. I got the same code working in onDestroy() but I think this is not the right place from the lifecycle point of view.
(Activities might be destroyed, although there were not actively left by the user).
The following code did not have any effect:
@Override
public void finish() {
    if (mCondition) {
        Intent intent = new Intent(this, OtherActivity.class);
        startActivity(intent);
    }
    super.finish();
}

Why is it not working, are there alternatives?

A: I think the best option is starting the new activity then finish the current one:
if (mCondition) {
    Intent intent = new Intent(this, OtherActivity.class);
    startActivity(intent);
    finish();
}

A: I have Used Myself this and it is working fine
   public void ToBeClosed()
    {
        Intent a = new Intent(context,NewActivity.class);
        startActivity(a);
        OldActivity.this.finish();
    }

and use the function in if statement body
 if (mCondition) { ToBeClosed(); }


text:
Q: How to prepend each line with an instance of a pattern found with awk I have a file with many lines. Some lines display the date and time, e.g. 2022-03-16-08:00
I want all lines following the pattern found to have that pattern prepended
In addition, because there are many lines with different times, I want this to change for every instance of the pattern, and prepend the following lines of that instance with the respective date&time.
For example, I have the following file (example.txt):
Date1: 2022-03-16-08:00
Something happened
Something else happened
Date2: 2022-03-16-08:10
Something happened
Something else happened
Something else happened

And the result I want is:
Date1: 2022-03-16-08:00
2022-03-16-08:00 Something happened
2022-03-16-08:00 Something else happened
Date2: 2022-03-16-08:10
2022-03-16-08:10 Something happened
2022-03-16-08:10 Something else happened
2022-03-16-08:10 Something else happened

I tried with sed to prepend the pattern found to each other line, but the sed variable doesn't seem to work:
sed -e '/2022-/s/\(.*\)/\1/' -e 's/^/$1/' example.txt
Result:
$1Date1: 2022-03-16-08:00
$1Something happened
$1Something else happened
$1Date2: 2022-03-16-08:10
$1Something happened
$1Something else happened
$1Something else happened

I thought that it may be feasible with awk, to take the pattern with awk -F: '/2022/{var=$2}'
and then prepend it to the next lines, but I don't know how I would change it to the new instance of Date
Any help is appreciated and very welcome.

A: I would GNU AWK for this task following way, let file.txt content be
Date1: 2022-03-16-08:00
Something happened
Something else happened
Date2: 2022-03-16-08:10
Something happened
Something else happened
Something else happened

then
awk 'BEGIN{FPAT="[0-9]{4}-[0-9]{2}-[0-9]{2}-[0-9]{2}:[0-9]{2}"}NF{when=$1;print}!NF{print when,$0}' file.txt

output
Date1: 2022-03-16-08:00
2022-03-16-08:00 Something happened
2022-03-16-08:00 Something else happened
Date2: 2022-03-16-08:10
2022-03-16-08:10 Something happened
2022-03-16-08:10 Something else happened
2022-03-16-08:10 Something else happened

Explanation: Inside BEGIN I inform GNU AWK using FPAT (Field PATtern) that it should consider field to be following string: 4 digits followed by - followed by 2 digits followed by - followed by 2 digits followed by - followed by 2 digits followed by : followed by 2 digits, i.e. timestamp compliant with format you are using. For each line if it does contain such file (i.e number of fields that is NF is non-zero) do set when variable value for content of 1st such field ($1) and do print current line as is, if there is not such field (!NF that is negation of NF) then do print when variable value followed by whole current line ($0).
Warning: my code assume that if you have more than one timestamp in single line you want to use first one and there is always timestamp in first line
(tested in gawk 4.2.1)

A: Using sed:
sed -e '/: 2[0-9]\{3\}-/{p;s/.*: //;h;d;}' -e 'G;s/\(.*\)\n\(.*\)/\2 \1/' example.txt

A: This solution should work in any version of awk:
awk -F ': ' 'NF == 2 && $2 ~ /^20[0-9]{2}/ {
   dt = $2; print; next} {print dt, $0}' file.log

Date1: 2022-03-16-08:00
2022-03-16-08:00 Something happened
2022-03-16-08:00 Something else happened
Date2: 2022-03-16-08:10
2022-03-16-08:10 Something happened
2022-03-16-08:10 Something else happened
2022-03-16-08:10 Something else happened

A: With your shown samples, please try following awk code. Written and tested in GNU awk, should work in any awk.
awk '
match($0,/[0-9]{4}(-[0-9]{2}){3}:[0-9]{2}/){
  value=substr($0,RSTART,RLENGTH)
  print
  next
}
{
  print value,$0
}
'  Input_file


text:
Q: Swift show button to refresh table like in twitter Please can someone tell me how I get a button to appear if there are new information like in twitter 'more tweets'
Just would like to know the coding to show the button and make the button disappear
Thanks in advance

A: This approach called "Pull to Refresh". Adding the button is one of many steps you will need to take in order to apply this functionality. There are many good tutorials over the web for how to do it, here are few:

*

*https://www.andrewcbancroft.com/2015/03/17/basics-of-pull-to-refresh-for-swift-developers/

*https://grokswift.com/pull-to-refresh-swift-table-view/

*https://www.appcoda.com/custom-pull-to-refresh/


text:
Q: Hibernate configuration in Eclipse Luna I installed the Hibernate plug-in on Eclipse from here.
Installation is successful-- I'm now seeing Hibernate as an option in Window > Open Perspective.
I've set the properties on the project itself-- Enable Hibernate support is now checked in Properties > Hibernate Settings.
Also, Hibernate Builder is checked (was automatically) in Properties Builders.
However, Java is not seeing Hibernate-- I'm getting errors to all Hibernate imports in my source code.
When I attempt to "Fix project setup..." in the editor, I get "No proposals found ... click for manual configuration."
What am i missing?
I downloaded Hibernate plug-in to get around this manual fix for one thing. The same code is working all fine when I manually add the jars to the project build path.
I'm using Eclipse Luna 4.4.2
TIA.
//-------------------------
EDIT:
While autocreating persistence.xml, Eclipse is (must be) looking at the version of Hibernate plug-in, not the jars on the project's build-path.
And that's causing a version conflict in between JPA and ORM. See the accepted answer here for reference.
Burned me half a day.

A: The plug-ins make Eclipse Hibernate-aware, not necessarily your project. Your project still must be configured (either manually or via a dependency management tool like Maven or Gradle) with the appropriate Hibernate JARs. It's the difference between development-time (the Eclipse plug-ins), compile-time (JARs on the build path) and runtime (JARs on the runtime classpath).
It would be nice if the plug-in provided a Quick Fix (à la Fix project setup...) that offered to download and/or add Hibernate JARs to your project, but as far as I know that's not something they implemented.


text:
Q: Proper way to use an url in the action attribute of a form in wordpress I have a custom form in one of my wordpress pages(this page uses a custom template)-
       <form action="www.mysite.com/custom-page-2" method="post">
                    .
                    .
                    .
       </form>

Now the problem is that on submitting the browser shows the url "www.mysite.com/custom-page-2" in the address bar but shows a 404 page not found error.
I read other solutions which ask to use action attribute for the same form page or use ajax or jquery. But my question is that why cant we use this method like normal php.
What am I missing?

A: Try changing the action to: http://www.mysite.com/custom-page-2
UPDATE
After a little bit of digging it seems you need to set your action to an empty string, and redirect to the page you want during the form submission handler.
Try following steps 1 - 3 of this answer but instead of redirecting back to the same page, redirect to the page you want to go to.
Hope that helps

A: The problem is if you use general values for your "name" attribute it surprisingly fails(example- name="name")...just prefix it with some unique name...maybe wordpress uses these names itself and causes clashes..


text:
Q: Is there anything wrong with generating large migrations? I just sat down and figured out all the indexes I want in my program.  I already have 7 models in place and I realized I want to add 14 indices to the database.
This is my first real Rails project and the migrations I've made and seen in guides have been specific to just one model.  I haven't seen any guides explicitly comment on this one way or the other--is it considered a best practice to make one migration per model?  Or to limit the size and complexity of a migration?

A: Generally I make my migrations purpose-driven. Its okay if they are big, but most of the time you want them small. Think of them like functions - easier to understand when small. Smaller migrations also make it easier to fix a problem if something goes wrong during the migration.

A: Migration size doesn't matter. When your development is all done, you will be using
rake:db:schema:dump
RAILS_ENV=production rake db:schema:load

It'll put everything into a concise file which will be used to recreate your production database.

A: This might be a minor point for most, and a big deal for some.
I was just cleaning house on a project.  I had a model that was unused.  I happily executed:
rails destroy scaffold LouseyModel

... and the scaffolding was removed.  This also removed the original migration file.  I suppose if you are one who keeps one action == one migration file, then this is no problem and a nice way to clean-up your development mess.  If you are one who likes to hand edit your migrations and add multiple things to a single migration file, then this might have the potential to introduce undesired behavior with db:setup and some other db rake tasks that depend on sequential migrations to do their thing.