text:
Q: Como hacer incremental el campo de la ID en phpmyadmin estoy intentando crear una base de datos pero no encuentro la forma de que el campo de la ID sea incremental.

A: Ve a Tabla > Estructura > Marca AI. Asegúrate de tener "None" en "Default". Tienes aquí la imagen:

Fuente: Aquí


text:
Q: Python authenticate as a Twitter application via python-twitter library I implemented a Python app that is used python-twitter library.
Right now I am authenticated only as an user and get the responses successfully.
However, while reading a little bit the TwitterAPI I found that as a Twitter application I will be able to gather more information than a user.
Unfortunately, I did not understand how to do it with this library so I would glad for help.
I created a class named TwitterRequester:
class TwitterRequester:
    def __init__(self):
        self.create_twitter_api(consumer_key, consumer_secret, access_token_key, access_token_secret)

    def create_twitter_api(self, consumer_key, consumer_secret, access_token_key, access_token_secret):
        self.api = twitter.Api(consumer_key=consumer_key,
                           consumer_secret=consumer_secret,
                           access_token_key=access_token_key,
                           access_token_secret=access_token_secret)

        logging.info("The twitter.Api object created")

    def get_friends(self):
        friends = self.api.GetFriends()
        return friends

In the run file:
if __name__ == '__main__':
    twitter_requester = TwitterRequester()
    friends = twitter_requester.get_friends()
    print(friends)

I did not manage to understand how can I authenticate as an application with this particular library. Someone can help me please?

A: The pyhon-twitter library does not support application authentication. You have to dig into the source code here to see this. Basically, for application authentication you would supply only the consumer key and the consumer secret (access token and access token secret are not required).
I suggest switching to another Python library that supports both user and application authentication, such as tweepy or TwitterAPI.

redpajama_set_name: RedPajamaStackExchange


text:
Q: HTML5 block-quote with author Hi I'm seeing a great number of different ways to implementat blockquote in html but it doesn't seem clear in its documentation how should I properly format a blockquote let's say of a famous quote and metion its author like:

In victory, you deserve Champagne, in defeat, you need it.
Napoleon Bonaparte

What would the correct format of that be in HTML5?
Should the author be inside or outside the blockquote tag?
Should it be inside the cite attribute? (even knowing the documentation specifies an URI , not author)

A: I googled about this and it looks like
 and
 should do the job:

    Quotes, parts of poems can also be a part of figure.

MDN editors

https://developer.mozilla.org/samples/html/figure.html

    The figure element represents some flow content, optionally with a caption,
    that is self-contained and is typically referenced as a single unit from the
    main flow of the document.

asdf

http://www.w3.org/html/wg/drafts/html/master/grouping-content.html#the-figure-element

A: UPDATE 2020
WHATWG says about the blockquote element

Attribution for the quotation, if any, must be placed outside the
blockquote element.

WHATWG says about the cite element

The cite element represents the title of a work (e.g. a book, a paper,
[...])

A person's name is not the title of a work [...] and the element must
therefore not be used to mark up people's names.

So the following HTML it's fine:

In victory, you deserve Champagne, in defeat, you need it.

— Napoleon Bonaparte

OLD POST 2018
HTML 5.3 Editor's Draft, 9 March 2018
W3C says about the cite element:

The cite element represents a reference to a creative work. It must
include the title of the work or the name of the author (person,
people or organization) or an URL reference, or a reference in
abbreviated form as per the conventions used for the addition of
citation metadata.

So the following HTML it's fine:

    Those who pass by us, do not go alone, and do not leave us alone;
    they leave a bit of themselves, and take a little of us.
    Antoine de Saint-Exupéry

A: This is how Bootstrap does quotes in v3.3.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.

  Someone famous in Source Title

More on the footer element from MDN: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/footer

The HTML  Element represents a footer for its nearest
  sectioning content or sectioning root element (i.e, its nearest parent

, , ,
,
, , ,
  <fieldset>,
, ). A footer typically contains information
  about the author of the section, copyright data or links to related
  documents.

You may also consider using Structured Data, such as microdata, RDFa, and microformats.

A: http://neilpie.co.uk/2011/12/13/html5-quote-attribution/
For example, use
Napoleon Bonaparte

HTML 5 documentation says, "Small print typically features disclaimers, caveats, legal restrictions, or copyrights. Small print is also sometimes used for attribution, or for satisfying licensing requirements."

A: My preference and it validates...
<!doctype html>

<title>Blockquote Test</title>

In victory, you deserve Champagne, in defeat, you need it.

Napoleon Bonaparte

A: This can be covered by Bootstrap 4  element:

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css">

In the digital age, knowledge is our lifeblood. And documents are the DNA of knowledge.

  Rick Thoman, CEO, Xerox


text:
Q: How to resolve included schema types in .xsd I have two .xsd files in the same src/main/resource folder:

*

*outer.xsd

*inner.xsd

outer.xsd looks like this:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           xmlns:tns="http://project.domain.com/model"
           targetNamespace="http://project.domain.com/model"
           elementFormDefault="qualified" attributeFormDefault="unqualified">
  <xs:include schemaLocation="inner.xsd"/>
  <xs:element name="innerObject" type="tns:InnerObjectType"/>
</xs:schema>

and inner.xsd looks like this:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           xmlns:model="http://project.domain.com/model"
           targetNamespace="http://project.domain.com/model"
           elementFormDefault="qualified" attributeFormDefault="qualified" version="1.0">
  <xs:complexType name="InnerObjectType">
    <xs:sequence>
      <xs:element name="property1" type="xs:string"/>
      <xs:element name="property2" type="xs:string"/>
    </xs:sequence>
  <xs:complexType>
</xs:schema>

Now, in another project, I'm using outer.xsd to validate input XML files like so:
SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
try {
    ClassLoader classLoader = objectType.getClassLoader();
    InputStream stream = classLoader.getResourceAsStream(schemaPath);
    Source schemaSource = new StreamSource(stream);
    Schema schema = factory.newSchema(schemaSource);
    ...
} catch (SAXException exception) {...}

On the line where I call newSchema, I am getting the following exception:
src-resolve: Cannot resolve the name 'tns:InnerObjectType' to a(n) 'type definition' component.

It appears that this code is able to find the outer schema by path, but during the process of resolving the inner type, it cannot find the inner schema.
Anybody have a suggestion of how I can get it to resolve that inner type?
Note: I was able to use outer.xsd to generate an XML file in eclipse, so I am relatively certain that the structure of the .xsd files is correct ... it's just that whatever the context is when outer.xsd is being resolved doesn't have access to inner.xsd.
A parallel question is: How can I find out what the context is in which the type is being resolved? (ie ... where is it looking for inner.xsd?)


text:
Q: Read a dynamically created textbox in a Gridview I am dynamically adding a textbox to certain rows (one column only) of a gridview.  I add the controls with this insdie of a test condition (works fine):
        TextBox txtASIN = new TextBox();
        txtASIN.ID = "TxtASIN" + e.Row.RowIndex;
        e.Row.Cells[4].Controls.Add(txtASIN);
        int i = e.Row.Cells[4].Controls.Count; //TEST: This returns 1 correctly

I want the user to be able to enter values into one or more of these textboxes and then update the database with a single button click (not one click for each row).  The problem I'm having is how to access those values on a button click event.  I did a simple test this way to try to see the value in the second row but get null in temp1 (I am certain there is a value entered in that textbox):
    protected void btnUpdate1_Click(object sender, EventArgs e)
    {
        TextBox temp = (TextBox)GridView2.Rows[1].FindControl("txt1");
        string temp1 = temp.Text;
        int i = GridView2.Row.Cells[4].Controls.Count; //TEST: This returns 0 incorrectly        }

Once I can make this work, I can iterate through the rows and do what I need to do with the values.  I don't know if the text entered in the textbox is actually readable without a postback but I'm otherwise stumped.  Open to better suggestions on how to do this.
Thanks.
EDIT:  Here is where I am now.  I can see the textboxes in my column fine.  I put a break in on a button that attempts to read them and this is what I'm seeing.  If I check GridView2.Rows[0].Controls.Count, I get 8, which is the correect number of columns.  If I check GridVeiw2.Rows[0].Cells[4].Controls.Count, I get 0, which is wrong because the textbox is there.  I can get a Count of 1 right after I dynamically create it but not when I perform a subsequent button click.
Can anyone explain this?  I feel if I can get past this holdup, I can get the rest done.
Thanks again.

A: You need to assign an ID to the TextBox controls and then access them by that ID in FindControl(). Also, make sure you're adding the controls in the Page's Init() method of the life-cycle. That way it gets added to ViewState.
TextBox txt1 = new TextBox();
txt1.ID = "txt1";
e.Row.Cells[4].Controls.Add(txt1);

EDIT: I just remembered another possible solution. Instead of programatically creating the TextBox controls in the code-behind just create a TemplateField in the GridView.
Add Textbox TemplateField Column To GridView Programmatically

A: I would try a different approach, putting the text box in the html markup of the page and then control the visible or readonly property of it on the ItemDataBound event.  That way, the control will always be there and you don't have to worry about the lifecycle stuff.


text:
Q: JSON serialization algorithm in express.js I'm curious what is the algorithm the express uses to serialize objects to JSON and if there's a way to modify it.
I notice that it only serializes objects' own properties, which makes it difficult to send out objects that inherit from other objects. It also omits any properties whose value is undefined. I understand that functionally, omitting them is the same as including them and saves bandwidth, but including them makes the JSON more discoverable for people reading it trying to figure out how to use an API.
In any case, it's a question more about how express does things and less about what my code should do :=)

A: It isn't express that does the serialization, it uses the standard serialization method stringify. You can do a certain amount of modification to how things are serialized using the replacer argument, but it is not possible to force it to show undefined values.

A:
It also omits any properties whose value is undefined.

There are no properties whose value is undefined.  If you read a property that does not exist, undefined will be returned, not because its value equals undefined, but because there is no value to return because there is no such property.
The set of undefined properties is (infinity - defined values).
var o = {};
o.x  // undefined

If express uses the below algorithm to find properties, it will never find x.
for (var key in o) {
    if (o.hasOwnProperty(key)) {
        console.log(o[key]);
    }
}


text:
Q: Create a tree-like json object from an array of objects I am a beginner in javascript object and tree creation, so please bear with me.
I have an array of objects like this
[
    {
        "l1": 1,
        "l2": 2,
        "l3": 3,
        "l4": 4,
        "l5": 5,
        "l6": null
    },
    {
        "l1": 1,
        "l2": 2,
        "l3": 3,
        "l4": 4,
        "l5": 6,
        "l6": null
    },
    {
        "l1": 1,
        "l2": 2,
        "l3": 7,
        "l4": 8,
        "l5": 9,
        "l6": null
    },
    {
        "l1": 1,
        "l2": 2,
        "l3": 7,
        "l4": 8,
        "l5": 10,
        "l6": null
    },
    {
        "l1": 1,
        "l2": 2,
        "l3": 3,
        "l4": 11,
        "l5": 12,
        "l6": null
    },
    {
        "l1": 1,
        "l2": 2,
        "l3": 3,
        "l4": 11,
        "l5": 13,
        "l6": null
    }
]

I have stored this data in json file, and I want to create a tree-structure-like object using this array of objects. Something like this.
{
  "1": [
    {
      "2": [
        {
          "3": [
            {
              "4": [
                {
                  "5": [
                    null
                  ]
                },
                {
                  "6": [
                    null
                  ]
                }
              ]
            },
            {
              "11": [
                {
                  "12": [
                    null
                  ]
                },
                {
                  "13": [
                    null
                  ]
                }
              ]
            }
          ]
        },
        {
          "7": [
            {
              "8": [
                {
                  "9": [
                    null
                  ]
                },
                {
                  "10": [
                    null
                  ]
                }
              ]
            }
          ]
        }
      ]
    }
  ]
}

I am trying to do this on my own but I'm failing right in the beginning itself.
This is my attempt
var fs = require('fs');
var file = 'levels.json';
var content = fs.readFileSync(file, { encoding: 'binary' });
var obj = {}
JSON.parse(content).forEach((curr, i, arr)=>{
    if(curr.l1){
        obj[curr.l1] = []
    }
    if(curr.l2){
        var l2obj = {}
        l2obj[curr.l2] = []
        obj[curr.l1].push(l2obj)
        // obj[curr.l1].push({curr.l2:[]})
    }
})

fs.writeFileSync('theObject.json', JSON.stringify(obj), 'utf8');

The problem I found out is that the line l2obj[curr.l2] = [] is overwriting the previous array and I'm not able to nest them properly.SAme problem exists with the line obj[curr.l1] = []. I tried the commented line as well but it throwing syntax error. I feel it is pretty basic but also very confusing, how do I create objects from dynamic values and push them to an array without overwriting the previous one. Any suggestions, hints.
Second line of question, Is this the best way to represent data like this? I wanted to use a tree structure because it seemed like an accurate and shortest form of data structure.The json data has almost 20k objects with level information. Suggestions are highly appreciated.

A: You could first build a bit different nested structure without arrays and then use other recursive function to iterate through that data and change it do desired output.

const data =[{"l1":1,"l2":2,"l3":3,"l4":4,"l5":5,"l6":null},{"l1":1,"l2":2,"l3":3,"l4":4,"l5":6,"l6":null},{"l1":1,"l2":2,"l3":7,"l4":8,"l5":9,"l6":null},{"l1":1,"l2":2,"l3":7,"l4":8,"l5":10,"l6":null},{"l1":1,"l2":2,"l3":3,"l4":11,"l5":12,"l6":null},{"l1":1,"l2":2,"l3":3,"l4":11,"l5":13,"l6":null}]
const result = {}

data.forEach(o => {
  Object.keys(o).reduce((r, e, i, arr) => {
    const key = o[e];
    if (o[e] == null) return r;
    if (o[arr[i + 1]] == null) r[key] = null
    else if (!r[key]) r[key] = {}
    return r[key]
  }, result)
})

function build(input) {
  for (let key in input) {
    if (input[key] && Object.keys(input[key]).length) build(input[key]);
    input[key] = [input[key]]
  }
}

build(result)

console.log(result)

Update: You can also get nested structure with just objects like this.

const data =[{"l1":1,"l2":2,"l3":3,"l4":4,"l5":5,"l6":null},{"l1":1,"l2":2,"l3":3,"l4":4,"l5":6,"l6":null},{"l1":1,"l2":2,"l3":7,"l4":8,"l5":9,"l6":null},{"l1":1,"l2":2,"l3":7,"l4":8,"l5":10,"l6":null},{"l1":1,"l2":2,"l3":3,"l4":11,"l5":12,"l6":null},{"l1":1,"l2":2,"l3":3,"l4":11,"l5":13,"l6":null}]
const result = {}

data.forEach(o => {
  Object.keys(o).reduce((r, e) => {
    if (o[e] == null) return r;
    return r[o[e]] = (r[o[e]] || {})
  }, result)
})

console.log(result)

A: I figured this out, I had to change the format of result, instead of array I used object format itself. I realized the array data structure was defeating my purpose.
so the result I actually wanted was
{
  "1": {
    "2": {
      "3": {
        "4": {
          "5": {},
          "6": {}
        },
        "11": {
          "12": {},
          "13": {}
        }
      },
      "7": {
        "8": {
          "9": {},
          "10": {}
        }
      }
    }
  }
}

Solution looks little wierd but very simple to understand, I'm running 6 passes to create the nesting objects.
var data = JSON.parse(content)
data.forEach((curr, i, arr)=>{
    if(curr.l1){
        obj[curr.l1] = {}
    }
})
data.forEach((curr, i, arr)=>{
    if(curr.l2 ){
        obj[curr.l1][curr.l2] = {}
    }
})
data.forEach((curr, i, arr)=>{
    if(curr.l3 ){
        obj[curr.l1][curr.l2][curr.l3] = {}
    }
})
data.forEach((curr, i, arr)=>{
    if(curr.l4 ){
        obj[curr.l1][curr.l2][curr.l3][curr.l4] = {}
    }
})
data.forEach((curr, i, arr)=>{
    if(curr.l5 ){
        obj[curr.l1][curr.l2][curr.l3][curr.l4][curr.l5] = {}
    }
})
data.forEach((curr, i, arr)=>{
    if(curr.l6 ){
        obj[curr.l1][curr.l2][curr.l3][curr.l4][curr.l5][curr.l6] = {}
    }
})


text:
Q: Check if user is in current domain We have a website that is public and one that is internal.
We want the one that is internal to be accessed only for those that are connected to the network of our company. But it's not only that.
The problem here is that some pages in our internal needs to be accessed from the public and some not.
I tried to get the domain name of the computer of the user, but I'm getting the one from the server that is hosting our WebSite. The code was something like that :
Set wshShell = CreateObject("WScript.Shell")
strUserDomain = wshShell.ExpandEnvironmentStrings("%USERDOMAIN%")
response.Write("User Domain: " & strUserDomain)

EDIT : I'm trying to get the domain of the user accessing our Website to know if he is one of our employees. It not, I don't want anyone from the outside accessing those pages. If there is an other way to do that, I would gladly accept an other solution if it's detailed.
EDIT : I'm using VBScript and our Website is in ASP.


text:
Q: PyTorch - Shapes Don't Match Unfortunately, I get the following RuntimeError:

This error hapens at epoch 1 during the last batch (so all other batches run through),
and I don't know what causes the error in my code. Here is a code snippet of my function
def gradient_penalty(critic, real, fake, device):

    BATCH_SIZE, C, H, W = real.shape
    epsilon = torch.rand(size = (BATCH_SIZE, 1, 1, 1)).repeat(1, C, H, W).to(device)

    # generate tensor filles only with ones
    x = torch.ones(size = (BATCH_SIZE, C, H, W), dtype = int)

    # interpolate images
    interpolated_images = real * epsilon + fake * (x - epsilon)

The variable real stands for images and has the shape (128, 3, 64, 64).
I need to admit that I don't find the error message concretely, i. e. where don't the shapes of the tensors coincide?
Any help would be appreciated!

A: You can discard incomplete batches when instantiating a DataLoader with the drop_last argument:
torch.utils.data.DataLoader(trainset, batch_size=128, discard_last=True)

However, this seems a bit drastic measure since 128 elements from your dataset will go to waste.


text:
Q: Delete marker when new marker is added? I am having a problem deleting user added markers upon a new marker being add. I originally tried to go about the right click method but I only want the user to be able to create one marker at a time. Can someone please help me?
function addMarker(location){

marker = new google.maps.Marker({
    position: location,
    map: GlobalMap,
    draggable: true,
    animation: google.maps.Animation.DROP,
    clickable: true

});

var form = $("#form").clone().show();
var contentString = form[0];
infowindow = new google.maps.InfoWindow({
    content: contentString
});

google.maps.event.addListener(marker, 'click', function(){
    infowindow.open(GlobalMap,this);
});

infowindow.open(GlobalMap,marker);
markerPosition = marker.getPosition();

populateInputs(markerPosition);
google.maps.event.addListener(marker, "dragend", function (mEvent){
    populateInputs(mEvent.latLng);
});

google.maps.event.addListener(marker, 'rightclick', function(){
    marker.setMap(null)

});

}
google.maps.event.addDomListener(window, 'load', window.onload);

function populateInputs(pos){
 document.getElementById("latitude").value=pos.lat()
 document.getElementById("longitude").value=pos.lng();
}

function clearOverlays(){
 for(var i = 0; i <markers.length; i++){
    markers[i].setMap(null);
 }
}

var markers= [];
var center= null;
var GlobalMap = null;
var marker = null;
var infowindow;
var geocoder = new google.maps.Geocoder();
window.onload = function() {
// Creating a reference to the mapDiv, which is defined in the host html    file
var mapDiv = document.getElementById('map');

// Creating a latLng for the center of the map, these coordinates set the   center of the initial map to the center of Springfield.
var latlng = new google.maps.LatLng(37.1950, -93.2861);

// Creating an object literal containing the properties
// we want to pass to the map
var options = {
  center: latlng,
  zoom: 11,                                     // This zoom level shows the OTO area.
  mapTypeId: google.maps.MapTypeId.ROADMAP      // We want to show the data on the road map, as opposed to the satellite view.
};

// Now Creating the map
GlobalMap = new google.maps.Map(mapDiv, options);
oto.setMap(GlobalMap);

$('#address').keypress(function(e){
    if(e.which==13){
        e.preventDefault();
        window.geocode();
    }
});
markers.push(marker);
google.maps.event.addListener(GlobalMap, "click", function (event)
{
    addMarker(event.latLng);
});

google.maps.event.addListener(marker, 'dragend', function(marker){
    var latLong = marker.latLng;
    $latitude.value = latLong.lat();
    $longitude.value = latLong.lng();
});

}
Here is the HTML:

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Public Comment</title>
    <link type="text/css" href="css/style.css" rel="stylesheet" media="all" />
    <link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.3.0/css/font-awesome.min.css">

  <button onclick="toggle_visibility('checkboxes')" style="float: right;">Toggle legend</button>

    <input type="text" id="address" class="form-control" placeholder="e.g., 205 Park Central East, Springfield MO" size="35">

        <button onClick="window.geocode()" class="btn btn-success" value=>
            Go
        </button>

    Left click to drop a marker.
 Right click to delete most recent marker.
Cancel to reset with no markers.

Left click to drop a marker.
 Right click to delete marker.
Cancel to reset with no markers.

<input type="checkbox" id="NAME" checked="true" onClick="toggleOto()"/>OTO Boundary

        OTO MPO |
        August 20, 2015 |
        Disclaimer

      For best results view in Google Chrome

    <form role="form" id = "form">
        Loading...

Please copy and paste the Latitude and Longitude values into the above form.

            Latitude
            <input id ="latitude" type="text" class="form-control" name="lat"     `enter code here`placeholder="Latitude" required="yes">

            Longitude
            <input id ="longitude" type="text" class="form-control" name="lng" placeholder="Longitude" required="yes">

            <button class="btn btn-primary" id ="delete-button">Cancel</button>

    </form>

A: Looks like your marker is already global.  This should work:
function addMarker(location){
  // check if the marker already exists and has a .setMap method
  if (marker && marker.setMap) {
    // remove existing marker from the map
    marker.setMap(null);
  }
  // create the marker
  marker = new google.maps.Marker({
    position: location,
    map: GlobalMap,
    draggable: true,
    animation: google.maps.Animation.DROP,
    clickable: true
 });
 // ... rest of your code


text:
Q: is there a way to log/see a javascript local variable without using breakpoints in a browser? I'm trying to log a local variable in an external script that is called on the page. If I place a breakpoint I can see its values, but it becomes inaccessible if I make the code start again. Is there any way to do this?

A: that's how you do it console.log(variablename);


text:
Q: WPF TextBox BorderBrush Style vs. No Style Why does a border appear around a TextBox when a Style is used as opposed to no Style being used? Is there a way to set this using a Style so no border appears, like in the "Phone" Grid/TextBox? See below:

WINDOW XAML
    <!-- City, State, Zip -->
    <Grid Grid.Column="0" Grid.Row="2" Background="White" Margin="50,2,25,2">
        <Viewbox>
            <TextBox Style="{Binding StandardTextBox1}" Text="{Binding CityStateZip}"/>
        </Viewbox>
    </Grid>

    <!-- Phone -->
    <Grid Grid.Column="0" Grid.Row="3" Background="White" Margin="50,2,25,2">
        <Viewbox>
            <TextBox
                 Background="Transparent"
                 BorderBrush="Transparent"
                 Text="{Binding FacilityPhoneMain}"
                 TextAlignment="Center"
                 FontSize="14"
                 />
        </Viewbox>
    </Grid>

STYLE XAML
<!-- Standard TextBox 1 -->
<Style TargetType="TextBox" x:Key="StandardTextBox1">
    <Setter Property="Background" Value="Transparent"/>
    <Setter Property="BorderBrush" Value="Transparent"/>
    <Setter Property="TextAlignment" Value="Center"/>
    <Setter Property="FontSize" Value="14"/>
</Style>

A: You can modify the BorderThickness property of the TextBox in your Style to remove the border.
As for why the border is not affected in the Style, I have a hunch that this is due to dependency property precedence.
Animations have a higher precedence than property setters. Due to the default WPF Textbox template having animations that affect the BorderBrush property, the setters are not being applied.
This link has some relevant information
To quote: "Animation values always take precedence over local values, setters and triggers"


text:
Q: Unable to fetch json data using angular factory service I am unable to fetch my json data using angular factory service.
I seem to load the files correctly, no error on developer tools console, still the data is undefined on the request - means empty.
My json file:
{
  "Translations": [
    {
      "WhatsNew": [
        {
          "English": "Whats New",
          "Hebrew": "מה חדש?",
          "Arabic": "الجديد في الموقع"
        }

      ],
      "SearchByWord": [
        {
          "English": "Search By Word",
          "Hebrew": "חיפוש לפי ערך",
          "Arabic": "البحث حسب الكلمة"
        }
      ],
      "SearchByRoot": [
        {
          "English": "Search By Root",
          "Hebrew": "חיפוש לפי שורש",
          "Arabic": "البحث حسب الجذر"
        }
      ],
      "HebrewArabicIndex": [
        {
          "English": "to the Hebrew-Arabic Index",
          "Hebrew": "לאינדקס העברי-ערבי",
          "Arabic": "إلى الفهرس العبري- العربي"
        }
      ],
      "ArabicHebrewDictionary": [
        {
          "English": "to the Arabic-Hebrew Dictionary",
          "Hebrew": "למילון הערבי-עברי",
          "Arabic": "إلى القاموس العربي- العبري"
        }
      ],
      "ExamplesAndNotes": [
        {
          "English": "Examples and Notes",
          "Hebrew": "דוגמאות והערות",
          "Arabic": "أمثلة    وملاحظات"
        }
      ],
      "IdiomsAndExpressions": [
        {
          "English": "Idioms and Expressions",
          "Hebrew": "ביטויים וצירופים",
          "Arabic": "تعابير لغوية"
        }
      ],
      "WordsFromSameRoot": [
        {
          "English": "Words From Same Root",
          "Hebrew": "ערכים מאותו השורש",
          "Arabic": "مشتقات الجذر"
        }
      ],
         "SearchResults": [
        {
          "English": "Search Results",
          "Hebrew": "תוצאות החיפוש",
          "Arabic": "نتائج البحث"
        }
      ]
    }
  ]
}

JS file:
adicApp.factory('langService', function ($http) {
    return {
        getLanguage: getLanguage,
        setLanguage: setLanguage,
        getLangRes: getLangRes
    };

    var _lang;
    function getLanguage() {
        return _lang;
    }
    function setLanguage(lang) {
        _lang = lang;
    }

    function getLangRes(lang) {
        var langRes;

        _lang = lang;

        switch (lang) {
            case "English":
                langRes = getEnglishLangRes();
                break;

            case "Hebrew":
                langRes = getHebrewLangRes();
                break;

            case "Arabic":
                langRes = getArabicLangRes();
                break;

            default:
                langRes = getEnglishLangRes();
                break;
        }

        return langRes;
    }

    function getEnglishLangRes() {
        var res = [];
            //{
            //    Partial1_Key: "Partial 1",
            //    Partial2_Key: "Partial 2",
            //    Search_String_Value_Key: "Search String Value",
            //    Count_Of_Words_Key: "Count Of Words",
            //    Data_Id_Key: "Data ID",
            //    Value_Key: "Value",
            //    Search_Category_Key: "Search Category",
            //    Whats_New: null
            //};
        $http.get('../Scripts/Languages/languages.json').success(function (data) {
              res = data.translations
        })
        .error(function (data, status, headers, config) {
            alert("Status: " + status);
            //$log.error('Problem on selectCountry api Cities :' + status);
        });

        return res;
    }

    function getHebrewLangRes() {
        var res =
            {
                Partial1_Key: "חֵלֶק 1",
                Partial2_Key: "חֵלֶק 2",
                Search_String_Value_Key: "ערך מחרוזת חיפוש",
                Count_Of_Words_Key: "ספירת מילים",
                Data_Id_Key: "מספר מזהה",
                Value_Key: "ערך",
                Search_Category_Key: "חיפוש קטגוריה"
            };

        return res;
    }

    function getArabicLangRes() {
        var res =
            {
                Partial1_Key: "الجزء 1",
                Partial2_Key: "الجزء 2",
                Search_String_Value_Key: "قيمة سلسلة البحث",
                Count_Of_Words_Key: "عدد الكلمات",
                Data_Id_Key: "رقم الهوية",
                Value_Key: "القيمة",
                Search_Category_Key: "فئة البحث"
            };

        return res;
    }
});

And view:

{{langRes.WhatsNew[0]}}

Any idea as to why it is not working? I am at a loss. I tried looking through the web for an answer, non seemed to help so far.
I thought there is a problem with my json but I can find no suspicious things about my file.

A: The $http request success and failure callbacks are no more coming as "success" or "error" as a curry function. They are based on Promises concept. So there will be a "then" curry function which will have both success and error inside its control block.
The format you have used is supported in AngularJS 1.4 Library. So please check first what version of Angular you are using.
If you are using latest AngularJS 1.6 library then format your request as below -
$http.get('data.json').then(function success(data) {
      console.log(data)
}, function error(res){
      console.log(res);
});

I have checked this in Plunker and it is working fine.
https://embed.plnkr.co/eoLHfd3gzbTLAXdnNVXi/

A: To start, return your promises:
function getEnglishLangRes() {
    var res = [];
        //{
        //    Partial1_Key: "Partial 1",
        //    Partial2_Key: "Partial 2",
        //    Search_String_Value_Key: "Search String Value",
        //    Count_Of_Words_Key: "Count Of Words",
        //    Data_Id_Key: "Data ID",
        //    Value_Key: "Value",
        //    Search_Category_Key: "Search Category",
        //    Whats_New: null
        //};
     ͟r͟e͟t͟u͟r͟n͟ $http.get('../Scripts/Languages/languages.json')
      ̶.̶s̶u̶c̶c̶e̶s̶s̶ .then(function (response) {
          var data = response.data
          res = data.translations
          ͟r͟e͟t͟u͟r͟n͟  res;
    })
      ̶.̶e̶r̶r̶o̶r̶ .catch(function (response) {
        var status = response.status;
        alert("Status: " + status);
        //$log.error('Problem on selectCountry api Cities :' + status);
        //IMPORTANT
        throw response;
    });

    ̶r̶e̶t̶u̶r̶n̶ ̶r̶e̶s̶;̶
}

When a .catch method response handler omits a throw statement it converts a rejected promise to a fulfilled promise.


text: Q: dnsmasq: assign nameserver override from nameserver with dynamic ip? I have a scenario where I connect to a handful of internal domains and I've been using dnsmasq to resolve those from our internal nameserver--the problem is that the nameserver's IP can change.  NetworkManager picks up the change but I don't know how to keep my server entries (e.g. server=/wiki.internal.com/10.21.3.20) in dnsmasq.conf up to date, since they are hard-coded in the config file.  I could read /etc/NetworkManager/resolv.conf and sed the dnsmasq.conf, but that's messy and manual.  Is there an automatic way to set up the IP that those entries point to?


text:
Q: Match a url with quety string I'm pretty new to regex.
I researched a lot, but I can't figure out the problem.
I have this url
https://kompozitor.fr/thenotebar/?s=test.
The query string ?s= is the search parameter on my blog.
I'd like to write a regex expression that matches only
/thenotebar/?s=
and any parameter given to the search engine.
I tried a few things like /thenotebar/\?s=(.*)
,but it didn't work.
Any help is appreciated. Thank you in advance.

A: As I understand, you need the "thenotebar/?s=" and at least one character in the parameters.
Try to use this regex for it.
/\/thenotebar\/\?s=.(.*)/g

In your regex, you miss the '\' before the '/', probably this is the reason, it not works. You need a dot before (.*). This means you need at least one character as parameter. You need it? Leave this extra dot if you only check the "/thenotebar/?s=" string.


text:
Q: Does $\lim_{n \to \infty} a_n = \alpha$ imply $\lim \left(1+ \frac {a_n}{n} \right) =e^\alpha$ for real value Does $\lim_{n \to \infty}  a_n = \alpha$   imply $\lim_{n \to \infty} \left(1+ \frac {a_n}{n} \right)^n =e^\alpha$?
I'm only considering real value
and also, does the value of $\alpha$ makes a difference?\
I tried considering $$\left|\left(1+ \frac {a_n}{n} \right)^n-e^\alpha\right|\leq\left|\left(1+ \frac {a_n}{n} \right)^n-\left(1+ \frac {\alpha}{n} \right)^n\right|+\left|\left(1+ \frac {\alpha}{n} \right)^n-e^\alpha\right|$$
I know that for any fixed $\alpha$, $\left|\left(1+ \frac {\alpha}{n} \right)^n-e^\alpha\right|$ tends to zero.
But I don't know how to deal with $$\left|\left(1+ \frac {a_n}{n} \right)^n-\left(1+ \frac {\alpha}{n} \right)^n\right|$$, I tried binomial expansion but didn't get anywhere. Is this where the value of $\alpha$ come to matter?
Thanks

A: HINT: If $a_n\to \alpha > 0$ as $n\to\infty$, then $b_n := na_n\to\infty$ as $n\to\infty$. Therefore, make the substitution $n \mapsto na_n$ in the limit, which yields the following equality:
$$\lim_{n\to\infty} \bigg(1+\frac{a_n}{n}\bigg)^n = \lim_{n\to\infty} \bigg(1+\frac{a_n}{na_n}\bigg)^{na_n} = \lim_{n\to\infty} \bigg(1+\frac{1}{n}\bigg)^{na_n}$$
Does this help?

A: It requires breaking up the expansion of $e^a$ into two parts depending on $\epsilon$.  Let $N_1$ be defined by $\sum\limits_{k=N_1+1}^\infty \frac{a^k}{k!}\lt \epsilon$.  Then the binomial expansion can be used on the sum to $N_1$.  Let $N_2$ be defined by $\sum\limits_{k=0}^{N_1} \binom{n}{k}|a_n^k-a^k|\lt \epsilon$ for $n\gt N_2$.  Let $N=max(N_1,N_2)$  Expansion differences should be $\lt 2\epsilon$ for $n\gt N$.
To handle the tails for $a_n$ would require a little work showing $|\sum\limits_{k=N_1}^n\binom{n}{k}a_n^k-\sum\limits_{k=N_1+1}^\infty \frac{a^k}{k!}|\lt \sum\limits_{k=N_1+1}^\infty \frac{a^k}{k!}$ for $n\gt N$.


text:
Q: What is wrong with the if/else syntax in this code? Why will this code not work?  Are the indentations wrong or is the code wrong?
print "Welcome to the English to Pig Latin translator!"
original = raw_input('Enter a word.')
if len(original) > 0:
    print original
else print "empty":

Any suggestions would be appreciated.  I am trying to learn Python through Codecademy.

A: else print "empty":
    ^             ^

needs to have : after the else and not after the string you are printing, ie
else: print "empty"
    ^              ^

so, you had :, but in the wrong place :)

A: You either need to move the colon to just after the else:
if len(original) > 0:
    print original
else: print "empty"

Or if you prefer, you can use a conditional expression:
print original if len(original) > 0 else "empty"

A: What you did:
    print "Welcome to the English to Pig Latin translator!"
    original = raw_input('Enter a word.')
    if len(original) > 0:
        print original
    else print "empty":

What you need to do:
    print("Welcome to the English to Pig Latin translator!")
    original = raw_input('Enter a word.')
    if len(original) > 0:
        print("original")
    else:
        print("empty")

you missed out brackets, put a colon in the wrong place and didn't go onto another line on the last bit. Hope this helps :)

A: The tutorial has excellent example of all types of statements you'll need:
http://docs.python.org/tutorial/controlflow.html#if-statements
if condition_1:
    (execute)
elif condition_2:
    (execute)
else:
    (execute)


text:
Q: how to put the value of the id of a table into another table i have two table in a database one is register table another is type table.
I'm trying to create a form that will include a drop down menu derived from the 'type' table and the values of the form will be inserted in the 'register' table. When a option is selected the id of the type will be inserted in to foreign id field of the 'register' table where the values of the form is actually posted. I'm really stuck with this problem. please help.
my form looks like this
enter code here
<form action="form1.php" method="post">
    Name: <input type="text" name="name" />

    Username: <input type="text" name="username" />

    Password: <input type="password" name="password" />

    Email: <input type="text" name="email" />

    You are:
    <select name="type" size="3 multiple">
        <option value="1" selected="selected">Super admin</option>
        <option value="2">Admin</option>
        <option value="3">User</option>
    </select>
    <input type="submit" name="submit" value="Submit" />
    </form>

and the tables

*

*Table project.type

CREATE  TABLE IF NOT EXISTS `project`.`type` (

  `id` INT NOT NULL AUTO_INCREMENT ,

  `type` VARCHAR(45) NULL ,

  PRIMARY KEY (`id`) )

ENGINE = InnoDB;

*

*Table project.register

CREATE  TABLE IF NOT EXISTS `project`.`register` (

  `id` INT NOT NULL ,

  `name` VARCHAR(45) NULL ,

  `username` VARCHAR(45) NULL ,

  `password` VARCHAR(45) NULL ,

  `email` VARCHAR(45) NULL ,

  `phone` VARCHAR(45) NULL ,

  `type_id` INT NOT NULL ,

  PRIMARY KEY (`id`) ,

  UNIQUE INDEX `id_UNIQUE` (`id` ASC) ,

  INDEX `fk_register_type1` (`type_id` ASC) ,

  CONSTRAINT `fk_register_type1`

    FOREIGN KEY (`type_id` )

    REFERENCES `project`.`type` (`id` )

    ON DELETE NO ACTION

    ON UPDATE NO ACTION)

ENGINE = InnoDB;

A: The value of your select options should be their id in the type table. So if the id of Super User is 10 in the project table, that should also be the value in the select box.
This way when you retrieve the value selected in the drop down box you can insert it as the foreign key in your register table.
Here's an illustration:
Project Table:

________________________
| id | type            |
________________________
| 10 | SuperSuper User |
________________________
| 11 | SuperDuper User |
________________________

Your Html:
<select name="type" size="3 multiple">
  <option value="10" selected="selected">SuperSuper User</option>
  <option value="11">SuperDuper User</option>
  ...
  ...
</select>

A: This is just an idea, it will not work. It should be enough to help you start though. Btw, you don't actually have to "connect" foreign ID. Yes, in school they teach you that you have to connect  FOREIGN KEY (type_id) like this but you don't really need to, since DB doesn't really care if it's a foreign key or just a number.
if(isset($_POST["submit"])){
    if(empty($_POST["name"])||empty($_POST["username"])||empty($_POST["password"])||empty($_POST["email"])){
        echo "Something is wrong";
        exit;
    }
    mysql_query("INSERT INTO register (name, username, password, email, type_id)
    VALUES ($_POST[name], $_POST[username], $_POST[password], $_POST[email], $_POST[type])");
}

Also do you want values in drop-down selected from DB or static like it is now?

EDIT: so, dropdown needs to be dynamic...
<select name="type" size="3 multiple">
<?php
    $getType = mysql_query("SELECT id, type FROM type ORDER BY id");
    while($type = mysql_fetch_object($getType)){
        echo "<option value=\"$type->id\">$type->type</option>";
    }
?>
</select>

or something like this


text:
Q: Efficiently Store Decimal Numbers with Many Leading Zeros in Postgresql A number like:
0.000000000000000000000000000000000000000123456

is difficult to store without a large performance penalty with the available numeric types in postgres. This question addresses a similar problem, but I don't feel like it came to an acceptable resolution. Currently one of my colleagues landed on rounding numbers like this to 15 decimal places and just storing them as:
0.000000000000001

So that the double precision numeric type can be used which prevents the penalty associated with moving to a decimal numeric type. Numbers that are this small for my purposes are more or less functionally equivalent, because they are both very small (and mean more or less the same thing). However, we are graphing these results and when a large portion of the data set would be rounded like this it looks exceptionally stupid (flat line on the graph).

Because we are storing tens of thousands of these numbers and operating on them, the decimal numeric type is not a good option for us as the performance penalty is too large.
I am a scientist, and my natural inclination would just be to store these types of numbers in scientific notation, but it does't appear that postgres has this kind of functionality. I don't actually need all of the precision in the number, I just want to preserve 4 digits or so, so I don't even need the 15 digits that the float numeric type offers. What are the advantages and disadvantages of storing these numbers in two fields like this:
1.234 (real)
-40 (smallint)

where this is equivalent to 1.234*10^-40? This would allow for ~32000 leading decimals with only 2 bytes used to store them and 4 bytes to store the real value, for a total of maximally 6 bytes per number (gives me the exact number I want to store and takes less space than the existing solution which consumes 8 bytes). It also seems like sorting these numbers would be much improved as you'd need only sort on the smallint field first followed by the real field second.

A: You and/or your colleague seem to be confused about what numbers can be represented using the floating point formats.
A double precision (aka float) number can store at least 15 significant digits, in the range from about 1e-307 to 1e+308. You have to think of it as scientific notation. Remove all the zeroes and move that to the exponent. If whatever you have once in scientific notation has less than 15 digits and an exponent between -307 and +308, it can be stored as is.
That means that 0.000000000000000000000000000000000000000123456 can definitely be stored as a double precision, and you'll keep all the significant digits (123456). No need to round that to 0.000000000000001 or anything like that.
Floating point numbers have well-known issue of exact representation of decimal numbers (as decimal numbers in base 10 do not necessarily map to decimal numbers in base 2), but that's probably not an issue for you (it's an issue if you need to be able to do exact comparisons on such numbers).

A:
What are the advantages and disadvantages of storing these numbers in
  two fields like this

You'll have to manage 2 columns instead of one.
Roughly, what you'll be doing is saving space by storing lower-precision floats. If you only need 4 digits of precision, you can go further and save 2 more bytes by using smallint + smallint (1000-9999 + exponent). Using that format, you could cram the two smallint into one 32 bits int (exponent*2^16 + mantissa), that should work too.
That's assuming that you need to save storage space and/or need to go beyond the +/-308 digits exponent limit of the double precision float. If that's not the case, the standard format is fine.


text:
Q: Eclipse 202003 javaIO error during build project Has anyone encountered with the following error during use Eclipse latest version: 202003?
I've downloaded it, update Java 1.8 to the latest Java version, start eclipse, add my PHP project and during the building or validation or DLTK indexing I got an Internal error.
Part from eclipse .log file:
!ENTRY org.eclipse.dltk.core.index.lucene 1 1 2020-04-30 16:33:01.599
!MESSAGE Recovering index storage: Y:\.metadata\.plugins\org.eclipse.dltk.core.index.lucene\index\4b74b979-df85-4fb0-bd11-ad91f89ae355\timestamps

!ENTRY org.eclipse.dltk.core.index.lucene 4 4 2020-04-30 16:33:01.617
!MESSAGE Index writer could not be created, index data might be corrupted.
!STACK 0
java.io.IOException: The request is not supported
    at sun.nio.ch.FileDispatcherImpl.lock0(Native Method)
    at sun.nio.ch.FileDispatcherImpl.lock(Unknown Source)
    at sun.nio.ch.FileChannelImpl.tryLock(Unknown Source)
    at java.nio.channels.FileChannel.tryLock(Unknown Source)
    at org.apache.lucene.store.NativeFSLockFactory.obtainFSLock(NativeFSLockFactory.java:126)
    at org.apache.lucene.store.FSLockFactory.obtainLock(FSLockFactory.java:41)
    at org.apache.lucene.store.BaseDirectory.obtainLock(BaseDirectory.java:45)
    at org.apache.lucene.store.SleepingLockWrapper.obtainLock(SleepingLockWrapper.java:84)
    at org.apache.lucene.index.IndexWriter.<init>(IndexWriter.java:729)
    at org.eclipse.dltk.internal.core.index.lucene.IndexContainer.createWriter(IndexContainer.java:139)
    at org.eclipse.dltk.internal.core.index.lucene.IndexContainer.getWriter(IndexContainer.java:146)
    at org.eclipse.dltk.internal.core.index.lucene.IndexContainer.getTimestampsWriter(IndexContainer.java:167)
    at org.eclipse.dltk.internal.core.index.lucene.IndexRecovery.tryRecover(IndexRecovery.java:62)
    at org.eclipse.dltk.internal.core.index.lucene.IndexContainer.getWriter(IndexContainer.java:149)
    at org.eclipse.dltk.internal.core.index.lucene.IndexContainer.getTimestampsWriter(IndexContainer.java:167)
    at org.eclipse.dltk.internal.core.index.lucene.IndexRecovery.tryRecover(IndexRecovery.java:62)
    at org.eclipse.dltk.internal.core.index.lucene.IndexContainer.getWriter(IndexContainer.java:149)
    at org.eclipse.dltk.internal.core.index.lucene.IndexContainer.getTimestampsWriter(IndexContainer.java:167)
 ........

I've no idea what is going wrong? WTF?
Java version is: jre1.8.0_251 and I've also tried reinstall previous java version what I used. This was: 1.8.0_202...but I got the same error again, and again, and again :(
I would like upgrade my Eclipse because of Symfony plugin...
Previous used java version: 1.8.0_191. I've reinstalled it and got back the error:
An internal error occurred during: "Build Modules".
java.lang.StackOverflowError

Building process stop at 49% :(
Can anybody help me?

A: Hi this is problem with DLTK 6.1 + PDT 7.1. We already fixed this: no more async and FS locks. Please update to recent snapshots or try Eclipse 2020-06 M2 or newest: https://www.eclipse.org/downloads/packages/release/2020-06/m2


text:
Q: Which transformer faults will lead to power outage? I have year by year data of number of faults in 330 kV power transformers. Faults are of various kinds and there is no additional information about how many of those faults led to power outage.
I am a mathematician and just have basic knowledge in power engineering.
I do understand that not all faults in a transformer will lead to a power outage in lines connected to those transformers. However, is there a conservative bound for the probability power outage?
For example, approximately 16 % of all faults lead to a power outage. I assume it is a very long shot, but maybe someone might have some suggestions.
In addition, maybe someone has some knowledge about which components in a transformer will fail and usually/definitely lead to a power outage?
Any references to papers or other literature would be appreciated.

A: A transformer is inherently a fuse at the end of the day. All distribution transformers have damage curves. If many faults have occurred on a feeder and a transformer has seen excess current multiple times those damage curves change. Eventually the transformer will fail and it will fail open after some time if faults are allowed to persist.
Distribution protection schemes are geared at protecting transformers and other infrastructure. Generally, when a fault occurs (the vast majority are single phase to ground and caused by wildlife and vegetation) a breaker, recloser, or fuse up stream from the transformer should open before the transformer is damaged, or a fuse down stream from the transformer should burn up. All fuses have time current curves (TCC) and those curves should be arranged so they are beneath the transformer's damage curves. Fuses are cheaper to replace (~$25-50) than transformers and lines.
There is a lot more to it that I wont go into. But it all has to do with power company performance ratings and whether they would rather breakers trip to save fuses, or rather have fuses blow to minimize the number of customers affected by outages. These schemes may be alternated at different times of year, in different areas, and in different whether conditions.
So to answer your question in simple terms - most faults don't originate in the transformer. They can, but generally it is because the transformer has already been damaged. The fault generally originates on the line and may quickly end up in the transformer - e.g. the insulation is breaking down (faults can 'evolve'). Generally you're trying to save the transformer from faults to protect them from damage in the first place.
Of course, around here folks like to make sport of shooting transformers to watch them burn. That would be a good example of a fault originating in a transformer (seriously). I have no useful numbers on how many outages are caused because of that!
Here is a detailed article on the subject from cooper that shows  a fuse TCC curve and transformer damage curve
Edit: Looked back at your OP and saw where you said '300kV' which is generation/transmission class, not distribution. You still have zones of protection and will try to protect your transformer from faults on the secondary using downstream breakers and fuses. So some of what I said will still be true, but my answer isn't completely relevant. Unfortunately I know very little about transmission systems or transformer insulation breakdown so I can't edit this post to contribute much else. I'll keep this post here in case it contains some useful information or is useful to someone else.
I do agree with some of the comments before though about transformers showing symptoms of an impending failure. A transformer that is beginning to fail may not cause an outage at all if engineers can identify the issue and reroute power quickly enough before the protection equipment is engaged, a fuse blows, or the transformer burns. But it may mean a generator has to be taken off line or big substation air break switches need to be operated (which can be a big and costly effort and may or may not mean there will be momentary service interruptions).


text:
Q: How to hide fullscreen window header line in MacOS app? My problem is header of window in fullscreen mode.
When I move cursor to the top of screen I see the following:

But I want to see the following:

Hiding of buttons is not a problem:
wnd.standardWindowButton(NSWindow.ButtonType.closeButton)?.isHidden = true
wnd.standardWindowButton(NSWindow.ButtonType.miniaturizeButton)?.isHidden = true
wnd.standardWindowButton(NSWindow.ButtonType.zoomButton)?.isHidden = true

but how to hide the line?
Google say nothing about this =(
Maybe there is some sort of additional "safe zone area" that must be disabled in another way?

WindowGroup {
    SomeView()
        .edgesIgnoringSafeArea(.top)

}
.windowStyle( HiddenTitleBarWindowStyle() )

hides only titlebar from windowed mode, but not from fullscreen
The code:
 NSApp?.mainWindow?.styleMask.insert(NSWindow.StyleMask.unifiedTitleAndToolbar)
 NSApp?.mainWindow?.styleMask.insert(NSWindow.StyleMask.fullSizeContentView)
 NSApp?.mainWindow?.styleMask.insert(NSWindow.StyleMask.titled)
NSApp?.mainWindow?.toolbar?.isVisible = false
NSApp?.mainWindow?.titleVisibility = .hidden
NSApp?.mainWindow?.titlebarAppearsTransparent = true

also do nothing with header line in fullscreen mode

A: This seems to be a bug. There is no workaround found for this issue (just file a bug to Apple), but you might find useful to disable menubar at all by returning only [.fullscreen] in below callback of window delegate (if you have access to NSWindow instance) and add, say, own floating control panel on full-screen (just idea).
class WindowDelegate: NSObject, NSWindowDelegate {
    func window(_ window: NSWindow, willUseFullScreenPresentationOptions proposedOptions: NSApplication.PresentationOptions = []) -> NSApplication.PresentationOptions {
        return [.fullScreen]
    }
}

Note: alternate way to change application options is via NSApp (just in case), like
NSApp.presentationOptions = [.hideMenuBar, .hideDock]

A: To remove the title bar entirely, use NSWindow.StyleMask.Borderless.
Note, by default this also disables the canBecomeKey and canBecomeMain properties which you will need to change back to true or else various other things won't work properly (for example, keyboard input).
I'm not sure if an existing window can become a borderless window. I vaguely recall something about having to create a new window (or enable the flag in the storyboard).
You also won't have a full screen button anymore, so entering and exiting will have to be done programatically.


text:
Q: Why Apex has much lower limit of simultaneously scheduled actions comparing to Process Builder? From Apex DeveloperGuide: Apex Scheduler Docs:

*

*You can only have 100 scheduled Apex jobs at one time. You can
  evaluate your current count by viewing the Scheduled Jobs page in
  Salesforce and creating a custom view with a type filter equal to
  "Scheduled Apex". You can also programmatically query the CronTrigger
  and CronJobDetail objects to get the count of Apex scheduled jobs.

From Automate Your Business Processes: How Does Salesforce Process Scheduled Actions? Docs:

*

*An org can have up to 50,000 pending schedules and paused flow
  interviews at one time.

What's the reason for that? Shouldn't Apex, as the tool dedicated for the most complex solutions in Salesforce, offer broader scope of possibilities than Process Builder?

A: The Scheduled Flow actions are actually more similar to Time-Based Workflow Rules, not Scheduled Apex. In that sense, they're actually incredibly limited compared to the feature they're based on, which can have an unlimited number of scheduled actions. The reason why you can only have 100 scheduled jobs is because those jobs can repeat, meaning you could have as many as 2,400 jobs running per day (100 jobs running hourly). Scheduled Flow actions can't repeat indefinitely on an hourly schedule, so there's a higher limit to how many you can have in the queue.


text:
Q: MySQL: How to optimize pagination of a SQL script which has "order by" on a muliti-column index? we know that
select * from table order by id limit 1000000,10

can be optimized in this way
select * from table where id > (select id from table  order by id limit 1000000,1) limit 10

but if we are using a multi-column index like idx_ab (a,b), how to optimize the following sql command?
select * from table order by a,b limit 1000000,10

A: select * from table order by a,b limit 1000000,10

will be somewhat optimized with the help of this composite index: INDEX(a,b).
However, it must step over 1000000 rows, one at a time, before finding the 10 that you want.  This is very inefficient, no matter how many columns in the index, etc.
Some "pagination" applications can be sped up by "remembering where you left off", as discussed here:
http://mysql.rjweb.org/doc.php/pagination  It also has a link to how to do such when the key is composite.


text:
Q: Django - Create custom PrimaryKey with selected ForeignKey object Problem:
I want to create a custom-PrimaryKey in ItemCode Model contain with selected-ForeignKey object. So, It's gonna change the custom-PrimaryKey every time submit a new ForeignKey field.
Here's my Model:
class ItemCategory(models.Model):
    idItemCat = models.CharField(primary_key=True max_length=5)
    nameCategory = models.CharField(max_length=150)

class ItemCode(models.Model):
    idItemCode = models.CharField(primary_key=True, editable=False, max_length=20)
    idItemCat = models.ForeignKey(ItemCategory, on_delete=models.DO_NOTHING)

To illustrate, here's the example of custom-PrimaryKey I wanna create: MN.202203.001

*

*MN means Monitor from selected-ForeignKey object

Then, it change every time I submit new ForeignKey field, like this: CM.202203.002

*

*CM means Camera from new selected-ForeignKey object

What I've tried:
I've tried to using request method but I don't know how to implemented it in my Model.
def CustomPK(request):
    if request.method == 'POST':
        category = ItemCategory.objects.get(pk=request.POST.get('idItemCat'))
    return category

Question:
Is there anyway to get or fetch the object from selected-ForeignKey field to make a custom-PrimaryKey with request method? or is there any better way to do it?
If my question isn't clear enough, please let me know...


text:
Q: Using the Test Runner with Mocha and Zombie I would like to run the test runner as well as command line for my Zombie tests. So far what i tried is:
1) One Test
var Browser = require('zombie'),
should = require('should'),
browser = new Browser();

describe('Loads pages', function() {

    it('Google.com', function(done) {
        browser.visit('/index.html', function () {
            browser.text('title').should.equal('Hello World');
            done();
        });
    });

});

2) This Html Page
<!DOCTYPE html>

  <meta charset="utf-8">
  <title>Tests</title>
  <link rel="stylesheet" media="all" href="../node_modules/mocha/mocha.css">

Index

Everything is fine running mocha from the command line but if i open the browser page I get..

Error: Module name "zombie" has not been loaded yet for context: _. Use
  require([]) http://requirejs.org/docs/errors.html#notloaded

I was looking around for a zombie.js file in the node modules to load but I dont see any thing obvious?
Is there a way to get rid if this error and have this working?

A: var Browser = require('zombie'),
this is nodejs syntax, but you're using this in the context of requirejs in browser. requirejs is complaining that you have to use the amd format to load your module like:
var Browser = require(['zombie'], function(zombie) { ... });
BUT this will not work anyway because zombie is build for nodejs (commandline). It tries everything to simulate a browser - so its a little bit to much to actually call it in the browser.
Whats the reason that you want zombie tests to have in the mocha test runner? Seperate your tests into acceptance tests that will be called from commandline (with zombie) and those that are real unit tests (for the browser, without zombie) that will be called with the testrunner.


text:
Q: Is it possible to update array elements using foreach? It's easy to fill up an array using for loop:
ulong[] chessArray = new ulong[64];
chessArray[0] = 1;
for (int i = 1; i < 64; i++)
{
    chessArray[i] = 2 * chessArray[i - 1];
}

But is there a way to do it using foreach operator? The following code won't compile:
ulong[] chessArray = new ulong[64];
chessArray[0] = 1;
foreach (int element in chessArray)
{
    element = 2 * (element - 1);
}

A:
is there a way to do it using foreach operator?

No. The loop variable element is a read-only variable that contains a copy of the value of the array element, which is a variable. It is not an alias to the array element variable.

A: It is not possible to modify the array you are iterating using foreach, check this link : https://msdn.microsoft.com/en-us/library/ttw7t8t6.aspx

A: Why foreach? Your goal is to fill an array, in which each element's value is based on previous one. Clojure natively support such sequence creation by iterate.
(take 10 (iterate (partial * 2) 1)) //(1 2 4 8 16 32 64 128 256 512)

Notice the integer overflow if you want to take 64.
The same idea can apply to C#. (Please tell me if there is already an Iterate function).
public static IEnumerable<T> Iterate<T>(Func<T, T> f, T seed)
{
    var val = seed;
    while (true)
    {
        yield return val;
        val = f(val);
    }
}

Then you can fill an array by
Iterate(i => i * 2, (ulong)1).Take(64).ToArray()

A: The other answers and comments already show nicely that you cannot write to the loop variable in a foreach loop. However, even if this was possible, the two loops in the question would not do the same thing:
You cannot access the previous value of the loop variable by element - 1! Instead this will simply subtract one from the current variable before it is doubled. The result is completely independent of the previous value.
I.e. your foreach loop would correspond to 2 * chessArray[i] - 1; in the for loop.


text:
Q: RecyclerView внутри другого RecyclerView Хочу добавить в свою приложуху расписание пар. В нашем ВУЗе максимум 5 пар в день, но не факт что таких пар 5 и не факт что в этот день есть пары. Данные сохраняются в БД.  главный Item у меня по идее должен быть С TextView "День" и RecyclerView который является собой тремя TextView "№ пары" "числитель" "знаменатель". Я бы сделал это всё как один item, но если у меня в день 2 пары, например, то оставшееся место будет попросту пустовать и получаться большие пустые пространства между днями.
На словах всё просто но как этот RecyclerView запихнуть в главный Item и потом его заполнять? Понимаю, что это небольшое извращение, но другого способа не придумал.

A: "Я бы сделал это всё как один item, но если у меня в день 2 пары, например, то оставшееся место будет попросту пустовать и получаться большие пустые пространства между днями." - Вот лучше сделайте одним айтемом, в котором 5 пар, чем плодить RecyclerView и их адаптеры. "Пары" поместите в LinearLayout, те пары которые не пригодятся(если к примеру в этот день только 3 пары) прячьте методом view.setVisibility(View.GONE) - тогда у Вас не будет пустого пространства.
При таком подходе для RecyclerView оставить параметр recyclerView.setHasFixedSize(false).


text:
Q: Oracle SQL automatically create VARCHAR incremented PK I'm trying to write an Oracle SQL table such that whenever a row is inserted (through an Oracle APEX form), the PK is automatically populated with a varchar type that automatically increments. Eg. TNT00000001, TNT00000002, TNT00000003...
 create table sample (
Tnt_ID CHAR(8) NOT NULL,
wtv NUMBER(3)
);

CREATE SEQUENCE Tnt_ID_Auto
 MINVALUE 1  START WITH 1 INCREMENT BY 1  CACHE 10;

CREATE OR REPLACE TRIGGER sample_on_insert
  BEFORE INSERT ON sample
  FOR EACH ROW
BEGIN
  SELECT CONCAT('TNT', LPAD(Tnt_ID_Auto.nextval, 5, '0'))
  INTO :new.Tnt_ID
  FROM dual;
END;

When I try to run this:
INSERT INTO SAMPLE (wtv) VALUES (1);

I get the error

PLS-00103: Encountered the symbol "INSERT"

A: This is a good use case for IDENTITY and VIRTUAL columns. So, no need of an additional SEQUENCE and TRIGGER.
Demo:
CREATE TABLE sample (
    serial_no NUMBER GENERATED ALWAYS AS IDENTITY,
    tnt_id GENERATED ALWAYS AS (CONCAT('TNT', LPAD(serial_no, 5, '0'))) VIRTUAL,
    wtv    NUMBER(3)
);

insert into sample (wtv) values(100);
insert into sample (wtv) values(200);
insert into sample (wtv) values(300);

Result:
select * from sample;

 SERIAL_NO TNT_ID                         WTV
---------- ----------------------- ----------
         1 TNT00001                       100
         2 TNT00002                       200
         3 TNT00003                       300

How it works:

*

*NUMBER GENERATED ALWAYS AS IDENTITY: This automatically creates the required sequence for you, starts with 1 and increments  by 1 by default.

*GENERATED ALWAYS AS VIRTUAL: This creates a virtual column whose values are calculated automatically using other column values. In this demo it uses the identity column.

*LPAD: This will ensure zeroes are left padded while the column value is incremented, but will also ensure that when the number is incremented it doesn't increase the length of the string.

*CONCAT: This will concat TNT to above value.

A: If you want to know what is wrong with your queries, It is missing /
create table sample (
Tnt_ID CHAR(8) NOT NULL,
wtv NUMBER(3)
);

CREATE SEQUENCE Tnt_ID_Auto
 MINVALUE 1  START WITH 1 INCREMENT BY 1  CACHE 10;

CREATE OR REPLACE TRIGGER sample_on_insert
  BEFORE INSERT ON sample
  FOR EACH ROW
BEGIN
  SELECT CONCAT('TNT', LPAD(Tnt_ID_Auto.nextval, 5, '0'))
  INTO :new.Tnt_ID
  FROM dual;
END;
/ -- this needs here

INSERT INTO SAMPLE (wtv) VALUES (1);

PL/SQL code must be ended with the / before starting another code below it.


text:
Q: Asp.Net MVC EnableClientValidation doesn't work I want as well as Client Side Validation as Server Side Validation. I realized this as the following:
Model: ( The model has a DataModel(dbml) which contains the Test class )
namespace MyProject.TestProject
{
    [MetadataType(typeof(TestMetaData))]
    public partial class Test
    {

    }

    public class TestMetaData
    {
        [Required(ErrorMessage="Please enter a name.")]
        [StringLength(50)]
        public string Name { get; set; }
    }
}

Controller is nothing special.
The View:
<% Html.EnableClientValidation(); %>
<% using (Ajax.BeginForm("Index", "Test", FormMethod.Post,
            new AjaxOptions {}, new { enctype = "multipart/form-data" }))
   {%>
   <%= Html.AntiForgeryToken()%>
    <fieldset>
        <legend>Widget Omschrijving</legend>

            <%= Html.LabelFor(Model => Model.Name) %>
            <%= Html.TextBoxFor(Model => Model.Name) %>
            <%= Html.ValidationMessageFor(Model => Model.Name) %>

    </fieldset>

        <input type="submit" value="Save" />

 <% } %>

To make this all work I added also references to js files:

Eventually it has to work, but it doesnt work 100%:
It does validates with no page refresh after pressing the button.
It also does "half" Client Side Validation. Only when you type some text into the textbox and then backspace the typed text. The Client Side Validation appears. But when I try this by tapping between controls there's no Client Side Validation.
Do I miss some reference or something? (I use Asp.Net MVC 2 RTM)

A: Change the order of the loaded javascript...

Had the exact same problem and this cleared it up for me...

A: I thought I was missing something too, but I do know that the jQuery validation plug in doesn't react to mouseEnter/mouseLeave. According to the documentation for that plug in (at the plug in page - look for the section labeled "A few things to look for when playing around with the demo"):

Before a field is marked as invalid, the validation is lazy: Before submitting the form for the first time, the user can tab through fields without getting annoying messages - he won't get bugged before he had the chance to actually enter a correct value

I assume it's the same rule with MVC 2 client-side validation. I can't be sure of that because the documentation doesn't say anything but "it works on my machine" :).
I went with the jQuery validation route, which is supported in MVC Futures (note that the documentation for that is non-existent). To use it, you just need to replace the script tags for MicrosoftAjax.js, MicrosoftMvcAjax.js and MicrosoftMvcValidation.js files with these two tags:

replacing the path with yours.
I also found the need to upgrade to the latest version of jquery.validate.js from the developer's page, because we are using a later version of jQuery (1.4) here.
Hope that helps.

A: hm..., it's late to answer but try this:


text:
Q: Why is my database migration not doing anything? When I run my migrations, it doesn't do anything:
➔ python db_control.py db upgrade
INFO  [alembic.migration] Context impl PostgresqlImpl.
INFO  [alembic.migration] Will assume transactional DDL.


text:
Q: Trace(AB) = Trace(BA) for rectangular matrices Given A is $m\times n$ and B is a $n \times m$ matrix, can we say trace(AB) = trace(BA)? It worked for a few examples with $m = 2$ and $n = 3$.

A: Yes, It is true. Trace(AB) = Trace(BA) for rectangular matrices.
You can rewrite the expression used for calculating trace to prove this.
tr(AB) = $\sum_{i=1}^{m}(AB)_{ii} = \sum_{i=1}^{m}\sum_{j=1}^{n}A_{ij}B_{ji} = \sum_{j=1}^{n}\sum_{i=1}^{m}B_{ji}A_{ij} = \sum_{j=1}^{n}(BA)_{jj} $= tr(BA)
For more references, you can see the answers in this link : Read more here..


text:
Q: JavaScript: Dynamically created html-like string won't tun into html in DOM I already have a wrapper

which I need to fill with bunch of divs, where each will represent new category.
Each category will be then filled with various cards representing items of that category. Like this:

    Dynamically created category wrapper

...

...

    ...

I use following code to create and fill category, but I always end up either having empty category or having a string inside reprenting the html.
var categoryWrapper = document.createElement("div");
categoryWrapper.setAttribute("data-category", key);
categoryWrapper.innerHtml = htmlString;

Here is a fiddle demo of my issue.
https://jsfiddle.net/uuqj4ad5/
I'll be grateful for a help.

A: There is a typo, innerHml should be innerHTML(Javascript object properties are case sensitive) otherwise it simply add an additional property and nothing gets happened.
categoryWrapper.innerHTML = htmlString;

var htmlString = "

Puppy Yawning

Awww!

";

var outerWrapper = $("#wrapper");
var categoryWrapper = document.createElement("div");
categoryWrapper.innerHTML = htmlString;
outerWrapper.append(categoryWrapper);

    Under this title various categories should be dynamically created

outerWrapper waiting for dynamic data...

FYI : If you want to remove the existing content then use html() method instead of append() method.

A: innerHtml

should be
innerHTML

Javascript is case sensitive
If you are using jQuery why do you want to mix jQuery and Vanilla JS.
var outerWrapper = $("#wrapper");

// I created new categoryWrapper object
var categoryWrapper = $('
', {
                          html: htmlString
                       });
debugger;
// WHen I have the category filled with inner data, I will append it into outerwrapper
outerWrapper.append(categoryWrapper);

jsFiddle

A: Checkout my fiddle:-
https://jsfiddle.net/dhruv1992/1xg18a3f/1/
your js code should look like this
// This is dynamically filled html template. The data comes from some JSON.
var htmlString = "

Puppy Yawning

Awww!

";

// This outer wrapper will in the end contain few categories
var outerWrapper = $("#wrapper");

outerWrapper.append('
'+htmlString+'
')


text:
Q: Unwanted border around background image div I am getting a slight line or border around my background image. I am dynamically changing the height of the parent div via javascript so that the inner div (which has the background image set) will "stick" to the bottom of the window.
No line appears on the desktop browsers, but on the mobile browser after the script runs, there is usually a thin border around it:

The border is on the left and the way it should be is on the right. Any suggestions?
This is the script:
<script type="text/javascript">
function layoutHandler(){
    if(window.innerHeight > 1061){
    var newsize = 150 + (window.innerHeight - 1061);

        document.getElementById("footerwrapper").style.height = newsize+'px';
    }
    else {
        document.getElementById("footerwrapper").style.height = '150px';
    }
}
window.onload = layoutHandler;

window.onresize = layoutHandler;
layoutHandler();
</script>

And then the inner div is setup like so:
#inner {
    background-color: #FFF;
    padding: 0px;
    height: 150px;
    bottom: 0px;
    width: 100%;
    position: absolute;
    background-image: url(Images/grad.png);
    background-repeat: repeat-x;
}

Edit:
Okay, after testing this a bit more I narrowed down when it happens. (This might get frustratingly specific) It happens most noticeably on the iPad in portrait mode. I turned off the "repeat-x" and it goes away completely. That led me to try a much wider background image which would not be repeating within the width of the iPad and it took away this issue. Any ideas why the heck this is happening?

A: I had the same problem and removing repeat-x solved it. I think it is bug of phone browsers.


text:
Q: Would like to plot triangles while specifying color of vertices In the following code, trying to specify that the points are red?  Why not all of them are red?  Also, is it possible to combine a and b into one plot?
n = 3;
\[Theta] = (2 \[Pi] Range[0, n])/n;
points = Transpose@{Cos[\[Theta]], Sin[\[Theta]]}; k = Range[3];
p = Outer[Times, k, points];
a = ListLinePlot[p, Frame -> True, Axes -> False,
   AspectRatio -> 2/Sqrt[3], PlotStyle -> Blue, PlotRange -> All];
b = ListPlot[p, PlotStyle -> {Red, PointSize[Medium]}];
Show[a, b]

Here is the resulting plot:

A: OP
We should Flatten the data about b and set the AspectRatio -> Automatic to use the original scaling.
n = 3;
θ = (2 π Range[0, n])/n;
points = Transpose@{Cos[θ], Sin[θ]};
k = Range[3];
p = Outer[Times, k, points]; a =
 ListLinePlot[p, Frame -> True, Axes -> False, PlotStyle -> Blue,
  PlotRange -> All];
b = ListPlot[Flatten[p, 1], PlotStyle -> {Red, PointSize[Medium]}];
Show[a, b, AspectRatio -> Automatic]

Another way
RegularPolygon or CirclePoints is convenient.
Graphics[{Table[
   HighlightMesh[
    TransformedRegion[RegularPolygon[r, 3],
     RotationTransform[3 π/2]], {Style[
      0, {Red, PointSize[Medium]}], Style[1, Blue],
     Style[2, None]}], {r, {1, 2, 3}}]}]


text:
Q: Given $(a,4)=2, (b,4)=2$, prove $(a+b,4)=4$ So if $(a,4)=2,$ then $a=4k+2$, for some integer $k$
if $(b,4)=2$, then $b=4m+2$, for some integer $m$
Then $a+b=4(k+m)+4=4(k+m+1)$  So $a+b$ is a multiple of $4$, and thus, $(a+b,4)=4$.
Are my first two statements obvious or do I have to prove those as well?  I'd like to think they are obvious, but assuming obviousness seems like a bad way to do proofs.

A: By the hypothesis we have $a=2a'$ and $b=2b'$ where $a'$ and $b'$ are odd numbers so $a+b=2(a'+b')$ and $a'+b'$ is even say equal $2c$ and the result is now clear.


text:
Q: Matching Users Based On Info They Have Submitted Now I know this is a very broad question, and that is why I expect a broad answer. I'm just looking to be steered in the right direction.
Simply put, I am intending to make a website where users can include specific data in their profile and be matched with other users that have entered corresponding data in order to create a "match".
Similar to a dating site that matches users based on best "chemistry". However, this is even simpler than that. I do have coding experience in NetBeans and am constantly expanding my knowledge of website development.
For example:
101, 102 and 103 = MATCH
User A - Data [User lists they have 101]
User B - Data [User lists they have 102 and 103]

Either User A or B uses "Find Users Who Complete Your Set" and a table or column lists said users who complete this set.
So, if anyone can at least point me in the right direction, that would be greatly appreciated! I have made several website on Webs.com but I don't believe their tools come with anything similar to filling this need. I intend to program this matching system using Java (likely with NetBeans) and implementing into the website. Thanks guys!!!

A: You would probably want to use a database to store your users and also all possible sets of attributes that can be completed to make a match. Here's one way of creating such a database with PostgreSQL:
create table person (
  id int primary key,
  first_name text not null,
  attributes text[]
);

create table match (
  id int primary key,
  attributes text[]
);

insert into person values (1, 'Bob', array['A']);
insert into person values (2, 'Alice', array['B','D']);
insert into person values (3, 'Carol', array['B','C']);
insert into person values (4, 'Ted', array['D']);
insert into match values (1, array['A','B','D']);

I'm using arrays instead junction tables to be less verbose. You can now find all persons that complete set #1 for Alice for example by running the following query:
select
  id,
  first_name
from
  (select
    p2.id as id,
    p2.first_name as first_name,
    array(
      select unnest(p1.attributes) union select unnest(p2.attributes)
    ) as match_potential
  from
    person p1
    inner join person p2 on (p1.id = 2 and p2.id <> 2)) as p
where
  p.match_potential @> (select attributes from match where id = 1);

Bob and Alice are now a match.
You would need to do something more sophisticated in the end but something like this should get you started on your website and would allow you to build your first prototype you can use to test your concept.


text:
Q: Preform sql query programatically in php script to write totals to excel file I have a pretty straight forward MySQL query that works properly, and I have it in a scheduled PHP script. Currently, It selects the data I need and writes it to a CSV.
This is something I've done quite a few times before, but I now need to do something that I've not done before. I need to change this to write to an excel file and I need to add a 'Total' or 'Sum' row to the file for each user.
Currently it pulls this data for CSR agents and it will display every single record for the day for each agent, so I would need to insert totals for each user after their daily records.
I'm wondering how I can change this query to use PHP variables possibly, and store the data so that I can insert totals for each user at the end of their records. I don't know how possible this is or how it should be done, but I would also be changing format from CSV to XSLX(excel) which may help in terms of how to do this programatically. .
So instead of the current format:
      John  |   Doe   |   x   |   x   |   10
      John  |   Doe   |       |   x   |   10
      John  |   Doe   |   x   |       |   10
      John  |   Doe   |   x   |   x   |   10
      John  |   Doe   |   x   |   x   |   10
      John  |   Doe   |       |       |   10
      Jane  |   Doe   |   x   |   x   |   10
      Jane  |   Doe   |   x   |       |   10
      Jane  |   Doe   |   x   |       |   10
      Jane  |   Doe   |       |   x   |   10
      Jane  |   Doe   |       |   x   |   10
      Jane  |   Doe   |   x   |   x   |   10

I need to do this:
      John  |   Doe   |   x   |   x   |   10
      John  |   Doe   |       |   x   |   10
      John  |   Doe   |   x   |       |   10
      John  |   Doe   |   x   |   x   |   10
      John  |   Doe   |   x   |   x   |   10
      John  |   Doe   |       |       |   10
      ---------------------------------------
      John Doe Totals |   4   |   4   |   60

      Jane  |   Doe   |   x   |   x   |   10
      Jane  |   Doe   |   x   |       |   10
      Jane  |   Doe   |   x   |       |   10
      Jane  |   Doe   |       |   x   |   10
      Jane  |   Doe   |       |   x   |   10
      Jane  |   Doe   |   x   |   x   |   10
      ---------------------------------------
      Jane Doe Totals |   4   |   4   |   60

Here's the query and CSV code:
$result2 = mysqli_query($conn2,
    " SELECT
        FirstN
        , LastN
        , Info1
        , Info2
        , Duration

        FROM (
          SELECT distinct
           firstn
           , lastn
           , CASE WHEN LEGTYPE1 = 2 AND ANSWERED = 1 THEN 'x' ELSE '' END AS Info1
           , case when LEGTYPE1 = 2 and answered = 1 and CALLINGPARTYNO = k.phone_number then 'x' ELSE '' end as Info2
           , b.duration as Time

          FROM session a
                INNER JOIN callsummary b ON a.callID = b.callID
                right join users u on a.callingpartyno = u.extension or a.finallycalledpartyno = u.extension
                LEFT JOIN known_numbers k ON a.callingpartyno = k.phone_number
            left join known_numbers kn on a.finallycalledpartyno = kn.long_number
                    WHERE a.ts >= curdate()
                    and(a.CALLINGPARTYNO in (select extension from ambition_users) OR a.finallycalledpartyno IN (select extension from ambition_users))
          ) x
      order by extension;") or die(mysqli_error( $conn2));

if (!$result2) die('Couldn\'t fetch records');
$num_fields = mysqli_num_fields($result2);
$headers = array();
while ($fieldinfo = mysqli_fetch_field($result2)) {
  $headers[] = $fieldinfo->name;
}
$fp = fopen('test.csv', 'w');
if ($fp && $result2) {
  fputcsv($fp, $headers);
  while ($row = $result2->fetch_array(MYSQLI_NUM)) {
    fputcsv($fp, array_values($row));
}
    fclose($fp);
}


text:
Q: JavaScript object method name for setTimeout my object has a function that i want to call recurseively.
my problem is how do i use setTimeout to point to the method of that instance of the object?
MyObject.prototype.Play = function() {

  // do some stuff
  setTimeout(thecurrentmethodnameHERE, 1000);
}

var test = new MyObject();

test.Play();

A: Just do setTimeout(this.someMethod, 1000), but keep in mind that it will be called in a global context, so any reference to this inside someMethod will be window, assuming a web browser.
You can do it like this in your constructor, if that's an issue:
YourObject = function(name) {
  var self = this;
  self.name = name;
  self.someMethod = function() {
    alert(self.name); // this.name would have been window.name
  };
  setTimeout(self.someMethod, 1000);
};

Some libraries define Function.prototype.bind which you can use in these situations, setTimeout(this.someMethod.bind(this), 1000), which simply returns a new function that gets call()ed with your desired object as this, it's a nice, simple function that you can implement without messing with the Function prototype too.

A: Function.prototype.bind = function(scope) {
  var _function = this;

  return function() {
    return _function.apply(scope, arguments);
  }
}

MyObject.prototype.Play = function() {

  // do some stuff
  setTimeout(thecurrentmethodnameHERE.bind(this), 1000);
}