text:
Q: If data already exists, I need to update it and add old values and new values in some column, but it was showing syntax error in line 8 CREATE DEFINER = CURRENT_USER TRIGGER `common`.`material_reservation_BEFORE_INSERT` BEFORE INSERT ON `material_reservation` FOR EACH ROW

 IF EXISTS (SELECT Reservation_DATE,Item_Number , OU_Organization_Id , INV_Organization_Id FROM common.material_onhand WHERE
        (Transaction_DATE=NEW.Reservation_DATE  AND Item_Number=NEW.Item_Number AND OU_Organization_Id=NEW.OU_Organization_Id AND INV_Organization_Id=NEW.INV_Organization_Id))
    THEN
        UPDATE common.material_onhand SET Onhand_Quantity = Onhand_Quantity + NEW.Quantity,  Reserved_Quantity = Reserved_Quantity +  NEW.Quantity
        WHERE (Onhand_Quantity=NEW.Quantity AND Reserved_Quantity=NEW.Quantity)
   END IF;

but it was showing the error in line no 8

A: I don't know which RDBMS you are using but in SSMS the update statement would need aliases when two or more tables are involved.
Look:
UPDATE t
set t.onhand_quantity = t.onhand_quantity + i.quantity,
t.reserved_quantity = t.reserved_quantity + i.quantity
from your_table t inner join inserting_values_table i
on t.onhand_quantity = i.quantity and t.reserved_quantity = i.quantity

Listen to me, it's really difficult to answer if you use those strange aliases and you don't write in a more readable way.


text:
Q: Adding the file sizes of Get-ChildItem listing My goal is to figure out how much space all images on my network drives are taking up.
So my command to retrieve a list of all images is this:
Get-ChildItem -recurse -include *jpg,*bmp,*png \\server01\folder

Then I would like to just retrieve the file size (Length).
Get-ChildItem -recurse -include *jpg,*bmp,*png \\server01\folder | Select-Object -property Length

Now this outputs:
                                         Length
                                         ------
                                         85554
                                         54841
                                         87129
                                        843314

I don't know why it is aligned to the right, but I want to grab each length and add them all together. I am lost and have tried every thing I know (which isn't much since I am new to PS), tried searching Google but couldn't find any relevant results.
Any help or alternative methods are appreciated!

A: Use the Measure-Object cmdlet:
$files = Get-ChildItem -Recurse -Include *jpg,*bmp,*png \\server01\folder
$totalSize = ($files | Measure-Object -Sum Length).Sum

To get the size in GB divide the value by 1GB:
$totalSize = ($files | Measure-Object -Sum Length).Sum / 1GB

A: You could do this as a one liner with something like this.
Get-Childitem -path  "C:\Program Files\Internet Explorer" | Select-Object
Name, @{Name="KBytes";Expression={ "{0:N0}" -f ($_.Length / 1KB) }}

Name          KBytes
----          ------
en-US         0
images        0
SIGNUP        0
ExtExport.exe 52
hmmapi.dll    53
iediagcmd.exe 500
ieinstal.exe  490
ielowutil.exe 219
IEShims.dll   398
iexplore.exe  805
sqmapi.dll    49

redpajama_set_name: RedPajamaStackExchange


text:
Q: Select change eventListener triggered several times (the number increasing on every change) I need the chosed option to be added to the table after the submit button is pressed (the button is mandatory). The first chosen option is added only once, when the option in select element is chosen for the second time, both 1st and 2nd options are added, on the third 3 change, all the previous changes are added to the table and in the end the new one.
I read the topic here, but I still can't get what can be done about it? Whenever I remove the button event listener, the problem goes away, every change is added only once to the table, but I can't discard the button, information must be added just after "submit".
My code

window.addEventListener("load", function(){
    let select = document.getElementById("select");
    let tbl = document.getElementById("tbl");
    let btn = document.getElementById("submit_btn");

    select.addEventListener("change", function(){
        let val = this.value;
        let text = this.options[select.selectedIndex].text;

        showOption(val, text);
    });

    function showOption(val, text){
        //when Submit is pressed
        btn.addEventListener("click", function(e){
            let tr = document.createElement("tr");
            //add info about the value of the chosen option
            let td1 = document.createElement("td");
            td1.innerHTML = val;
            //add info about the text of the chosen option
            let td2 = document.createElement("td");
            td2.innerHTML = text;
            tr.append(td1, td2);
            tbl.append(tr);
        });
    }
})
<!DOCTYPE html>

    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

        <select id="select">
            <option disabled selected>Choose your option</option>
            <option value="1">Option 1</option>
            <option value="2">Option 2</option>
            <option value="3">Option 3</option>
        </select>
    <input type="button" value="Submit" id="submit_btn">

            Option ID
            Option itself

Expected output after choosing "Option 1", "Option 2" and "Option 3" consecutively:
Option ID   Option itself
   1        Option 1
   2        Option 2
   3        Option 3

What I actually get:
Option ID   Option itself
   1    Option 1
   1    Option 1
   2    Option 2
   1    Option 1
   2    Option 2
   3    Option 3

A: Try using:

window.addEventListener("load", function(){
    let select = document.getElementById("select");
    let tbl = document.getElementById("tbl");
    let btn = document.getElementById("submit_btn");
    let val = '';
    let text = '';

    select.addEventListener("change", function(){
        val = this.value;
        text = this.options[select.selectedIndex].text;
    });

    btn.addEventListener("click", function(e){
            if(val == '') { alert("Please Choose Option"); }
            else {
               let tr = document.createElement("tr");
               //add info about the value of the chosen option
               let td1 = document.createElement("td");
               td1.innerHTML = val;
               //add info about the text of the chosen option
               let td2 = document.createElement("td");
               td2.innerHTML = text;
               tr.append(td1, td2);
               tbl.append(tr);
            }
    });

})
<!DOCTYPE html>

    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

        <select id="select">
            <option disabled selected>Choose your option</option>
            <option value="1">Option 1</option>
            <option value="2">Option 2</option>
            <option value="3">Option 3</option>
        </select>
    <input type="button" value="Submit" id="submit_btn">

            Option ID
            Option itself

A: Every change you add the event listener. Just don't do that.
Re-reading, you do not event need to save the value and text when you change the select. Just read it in the click
Note I do not capture the click if the select is on the first option
I also fixed your table HTML
Here I assume One option added per click

window.addEventListener("load", function() {
  const select = document.getElementById("select"),
    tbl = document.getElementById("tbl"),
    btn = document.getElementById("submit_btn");

  btn.addEventListener("click", function(e) {
    if (select.selectedIndex === 0) return; // don't add the first
    const val = select.value;
    const text = select.options[select.selectedIndex].text;
    let tr = document.createElement("tr");
    //add info about the value of the chosen option
    let td1 = document.createElement("td");
    td1.innerHTML = val;
    //add info about the text of the chosen option
    let td2 = document.createElement("td");
    td2.innerHTML = text;
    tr.append(td1, td2);
    tbl.append(tr);
  });
})
<select id="select">
  <option disabled selected>Choose your option</option>
  <option value="1">Option 1</option>
  <option value="2">Option 2</option>
  <option value="3">Option 3</option>
</select>
<input type="button" value="Submit" id="submit_btn">

      Option ID
      Option itself

Here is a version where you can change the select and each time it will add the option to an array and then write them all when submit is clicked

window.addEventListener("load", function() {
  const select = document.getElementById("select"),
    tbl = document.getElementById("tbl"),
    btn = document.getElementById("submit_btn");
  let collection = [];

  select.addEventListener("change",function() {
    if (this.selectedIndex === 0) return;
    collection.push({val: this.value,text:this.options[this.selectedIndex].text});
  })

  btn.addEventListener("click", function(e) {
    const html = collection.map(item => `<tr><td>${item.val}</td><td>${item.text}</td></tr>`)
    tbl.innerHTML=html.join("")
    collection=[]; // reset
  });
})
<select id="select">
  <option disabled selected>Choose your option</option>
  <option value="1">Option 1</option>
  <option value="2">Option 2</option>
  <option value="3">Option 3</option>
</select>
<input type="button" value="Submit" id="submit_btn">

      Option ID
      Option itself


text:
Q: Group_Concat with join I have these two tables: t_main

Ticket
Date
Main_Status

1
23/11/2020
AA

1
23/11/2020
BB

2
10/11/2020
BB

3
13/11/2020
AA

3
13/11/2020
CC

3
13/11/2020
BB

4
13/11/2020
AA

And t_task

Ticket
Task_Number
Task_Status

1
3
BB

1
3
CC

3
1
AA

3
2
CC

3
2
AA

3
1
BB

4
1
AA

4
2
AA

4
2
CC

So Far I´ve acheived to group_concat the status for the t_main and t_task separatelly.
This is the desired output:

Ticket
Date
Main_Status_Concat
Task_Number
Task_Status_Concat

1
23/11/2020
AA BB
3
BB CC

2
10/11/2020
BB
NULL
NULL

3
13/11/2020
AA CC BB
1
AA BB

3
13/11/2020
AA CC BB
2
CC AA

4
13/11/2020
AA
1
AA

4
13/11/2020
AA
2
AA CC

Thank you so much!
Edit:
I can execute the queries sepparatelly, I cannot join them
1st Query Returning all concatenated status for tickets
SELECT t_main.ticket,
    Group_Concat( MAIN_STATUS Separator ' ' )
AS Main_Status_Concat FROM t_main t1
group by  t1.ticket;

2nd Query Returning tickets with task and concat task_status
SELECT  t_task.ticket, t_task.task_number,
    Group_Concat( TASK_STATUS Separator ' ' ) AS Task_Status_Concat FROM t_task t2
group by  t2.ticket, t2.task;

I can join having the task ID with the t_main columns, but cannot get to show the concat tasks status properly.

A: Join the main table with the subquery that gets the tasks.
SELECT m.ticket, m.date, GROUP_CONCAT(m.main_status SEPARATOR ' ') AS main_status_concat, t.task_number, t.task_status_concat
FROM t_main AS m
LEFT JOIN (
    SELECT ticket, task_number,
        Group_Concat(TASK_STATUS Separator ' ') AS Task_Status_Concat
    FROM t_task
    group by ticket, task_number
) AS t ON m.ticket = t.ticket
GROUP BY m.ticket, t.task_number, m.date, t.task_status_concat

DEMO


text:
Q: Imgur TagVote issue python A beginner here, I am using the imgur python library to get tags related to an image. For this I am using the gallery_item_tags method as mentioned here.
However whenever i call the method it gives me an output as shown here.
I have followed the authorization procedure using the needed client id and client secret and i can run all methods not involving TagVotes array. How can i get the required information from this?

A: You're getting a list of TagVote instances. You probably want the name, you can access it like this:
for tag in tags:
  print tag.name


text:
Q: Latitude/Longitude finder not working I've been trying for a few days to get a lat/lon checker, speedometer, altimeter working but nothing seems to be working. I've tried using Android's built-in locationmanager and google play services. Now I'm back trying Google play services. I followed the online tutorial: https://developer.android.com/training/location/retrieve-current.html#play-services
I'm just trying to display current lat/lon (from lastknownlocation)
My android phone (android 6, API 23) doesn't show the lat/lon values on the screen.
Anyone help out?
CODE BELOW:
MainActivity
package example.locationtracker;

import android.content.pm.PackageManager;
import android.location.Location;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.ActivityCompat;
import android.support.v7.app.AppCompatActivity;
import android.widget.TextView;

import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.common.api.GoogleApiClient.ConnectionCallbacks;
import com.google.android.gms.common.api.GoogleApiClient.OnConnectionFailedListener;
import com.google.android.gms.location.LocationServices;

public class MainActivity extends AppCompatActivity implements ConnectionCallbacks, OnConnectionFailedListener {

    TextView mLatitudeText;
    TextView mLongitudeText;

    GoogleApiClient mGoogleApiClient = null;
    Location mLastLocation;

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

        mLatitudeText = (TextView) findViewById(R.id.latitudeTextView);
        mLongitudeText = (TextView) findViewById(R.id.longitudeTextView);

        // Create an instance of GoogleAPIClient.
        if (mGoogleApiClient == null) {
            mGoogleApiClient = new GoogleApiClient.Builder(this)
                    .addConnectionCallbacks(this)
                    .addOnConnectionFailedListener(this)
                    .addApi(LocationServices.API)
                    .build();
        }
    }

    protected void onStart() {
        mGoogleApiClient.connect();
        super.onStart();
    }

    protected void onStop() {
        mGoogleApiClient.disconnect();
        super.onStop();
    }

    @Override
    public void onConnected(@Nullable Bundle bundle) {
        if (ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
            return;
        }

        mLastLocation = LocationServices.FusedLocationApi.getLastLocation(mGoogleApiClient);

        if (mLastLocation != null) {
            mLatitudeText.setText(String.valueOf(mLastLocation.getLatitude()));
            mLongitudeText.setText(String.valueOf(mLastLocation.getLongitude()));
        }
    }

    @Override
    public void onConnectionSuspended(int i) {

    }

    @Override
    public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {

    }
}

Gradle module:app:
apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.2"
    defaultConfig {
        applicationId "example.locationtracker"
        minSdkVersion 15
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:26.+'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    testCompile 'junit:junit:4.12'

    compile 'com.google.android.gms:play-services:11.4.2'
}

Gradle Project:LocationTracker:
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.3'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        maven {
            url "https://maven.google.com"
        }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

actitivity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="example.locationtracker.MainActivity">

    <TextView
        android:id="@+id/latitudeTextView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="67dp"
        android:text="latitude"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <TextView
        android:id="@+id/longitudeTextView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="8dp"
        android:layout_marginRight="8dp"
        android:layout_marginTop="8dp"
        android:text="longitude"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/latitudeTextView" />

</android.support.constraint.ConstraintLayout>

Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="example.locationtracker">

    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
    <uses-permission android:name="android.permission.INTERNET"/>

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>


text:
Q: Gitlab CI: jobs config should contain at least one visible job i have started to build my .gitlab-ci.yml on Gitlab CI so i created it with simple stages like this
image: node:alpine

variables:
  PUBLIC_URL: /my-app

cache:
  paths:
    - node_modules

stages:
  - build
  - deploy

install_dependencies:
  stage: build
  script:
    - npm install
  artifacts:
    paths:
      - node_modules/

deploy_to_cloud:
  stage: deploy
  script:
    - echo Deployed

but job failed and responded with:
Found errors in your .gitlab-ci.yml:
"jobs config should contain at least one visible job"

A: Note:
the answer is not specific for this case, but might be useful to mention, since I missed this GitLab behaviour, from the official documentation.
(if you do, please edit or comment)
My case
I was having a main gitlab-ci.yaml that included definitions from a template.
gitlab-ci-template
.deploy_to_cloud:
  stage: deploy
  script:
    - echo Deployed

gitlab-ci
include: repo.url/gitlab-ci-template

stages:
  - deploy

deploy:
  extends: .deploy_to_cloud

The problem
After copy-pasting and merging all in a single gitlab-ci.yml file
gitlab-ci
stages:
  - deploy_to_cloud

.deploy_to_cloud:
  stage: deploy
  script:
    - echo Deployed

I started to get a

jobs config should contain at least one visible job

and to notice that no job was being created anymore; this, just by moving some code to another place.
The problem was because I forgot to rename all the stage definitions!
The solution
There is Gitlab-CI naming rule:

The stage definition name must not start with a leading dot; otherwise it will be hidden and no job will be created for that stage!

Once noticed it makes total sense, given that linux files behave the same way.
Removing the initial dot from the stage definition name made Gitlab see the jobs again in my case.
gitlab-ci
stages:
  - deploy_to_cloud

deploy_to_cloud:   # notice the removed dot at the beginning
  stage: deploy
  script:
    - echo Deployed

A: There is probably some sort of BOM or other invalid characters in your yml which are not visible.
Try validating it with another editor to check that. If you found nothing, try to delete the file and recreate it again using another method.

A: In my case, was a space in the beginning of the file. I delete it ad works now.

A: In my case, I'd miswritten stages as stage.
stage: # this is the problem. it should be "stages"
  - install

job-install:
  stage: install
  script:
    - npm install

A: in my case was just a wrong indexation issue (with the script parameter):
Before:
build_job:
  stage: build
  tags:
    - docker
script:
 - echo "Maven compile started"
 - "mvn compile"

After:
build_job:
  stage: build
  tags:
    - docker
  script:
    - echo "Maven compile started"
    - "mvn compile"


text:
Q: scrollIntoView() doesn't work with application selector Does anybody know the proper implementation of scrolling to anchor. This approach doesn't work:
Angular2 scroll to element that has *ngIf
Here is the template that has references to other components:
<app-app1 id="id1"></app-app1>
<app-app2 id="id2"></app-app2>
<app-app3 id="id3" *ngIf="test"></app-app3>

By clicking on a button I'd like to scroll to the appropriate section:
let elm = document.querySelector("#id1");
if (elm)
  elm.scrollIntoView();

The scrollIntoView() is executed but it scroll to wrong place (like to the middle of the section) and doesn't work for app-app3 at all.

A: I fixed it this way:
1. Remove "id3" from app selector component:

   change: <app-app3 id="id3" *ngIf="test"></app-app3>
   to:     <app-app3 *ngIf="test"></app-app3>

*Put new div inside  component at the very top:

< div id="id3"> < /div >

*Change:

let elm = document.querySelector("#id3");
if (elm)
  elm.scrollIntoView();

to:

let elm = document.getElementById("id3");
elm.scrollIntoView({behavior: "instant", block: "center", inline: "center"});


text:
Q: Call Php function in Javascript
Possible Duplicate:
Reference: Why does the PHP code in my Javascript not work?

I have been researching for days now and cant seem to find anything that allows me what I need to do.
What I am trying to do, is call a Php function in another file from Javascript.
I have a captcha on my contact form, and a Javascript file that checks the form and alerts the user if they have missed anything. My problem is I cant check the captcha.
        Send

That is my link that calls the Javascript and the Php
        var nameStr = safe_string(document.getElementById('cf_name').value);
        var emailStr = safe_string(document.getElementById('cf_email').value);
        var messageStr = safe_string(document.getElementById('cf_message').value);

        if(nameStr == "")
        document.getElementById('cf_nameCheck').value = "*Enter your name*";
        else
        document.getElementById('cf_nameCheck').value = "";

        if(emailStr == "" || emailStr.indexOf("@") == -1 || emailStr.indexOf(".") == -1)
        document.getElementById('cf_emailCheck').value = "*Enter a valid email*";
        else
        document.getElementById('cf_emailCheck').value = "";

        if(messageStr == "")
        document.getElementById('cf_messageCheck').value = "*Enter your message*";
        else
        document.getElementById('cf_messageCheck').value = "";

        document.getElementById('cf_name').value = nameStr;
        document.getElementById('cf_email').value = emailStr;
        document.getElementById('cf_message').value = messageStr;

        if(document.getElementById('cf_nameCheck').value == "")
        if(document.getElementById('cf_emailCheck').value == "")
        if(document.getElementById('cf_messageCheck').value == "")
            open_page('#Email_Succesful');

That is my Javascript which is called when the href is clicked. It checks the name,email and message and then displays an error message on another text field if neccesary.
The issue is I cannot check the captcha without using some Php.
        include_once $_SERVER['DOCUMENT_ROOT'] . '/securimage/securimage.php';

        $securimage = new Securimage();
        if ($securimage->check($_POST['captcha_code']))
        {
            $mail_status = mail($mail_to, $subject, $body_message, $headers);
        }

That is my Php script in another file that checks if the captcha is valid, and if so, performs the email. It is called on the onClick event of the link.
So... can anybody tell me how I would be able to call the check in the Javascript? That would allow me to check a true/false value and determine whether to show a warning message or not about the captcha.
If not, is there any other way I can do what I need to do? Show the warning in the Php maybe?
If the solution is to use some other thing like Ajax, please post the code required as well, ive looked into Ajax and a few other things as well but cant seem to get it working either.

A: Need to know this:
Javascript (unless specified) is a "client-side" language, meaning that it runs on the client's browser AFTER  page has been compiled and sent from the server. This means that there is no PHP/ASP in the code, only HTML & Javascript.
PHP, ASP, JSP are server-side languages which only run on the server-side.
So to answer your question, no you can't directly get the Javascript to call a PHP (server-side) function, but you can post to a PHP page which will then in turn carry out whatever function you like.

A: Try this (Ajax Request to a php document)

A: Technology exists to abstract away the client-server border. If you have ever used the Java RMI, you will be right at home with one of those:

*

*XML-RPC

*JSON-RPC (Implementations)

A: To call any php function from javascript, you need to send an Ajax request which in turn can always return the computed value you are expecting from the function.


text:
Q: Displaying a matplotlib graph in a wxPython bitmap I am trying to generate a graph from matplotlib, store it in a buffer, and then set it as a bitmap in a wxPython window.
The following code shows what I am trying to do.  If I replace the buffer stored image with a PNG loaded from disk, the program executes as expected.
import io
import wx
import numpy as np
import matplotlib.pyplot as plt

class MainPanel(wx.Panel):
    def __init__(self, parent):
        wx.Panel.__init__(self, parent=parent)
        self.SetSize((1024,768))
        self.SetBackgroundColour('yellow')

        #Generate Sample Graph
        t = np.arange(0.0, 2.0, 0.01)
        s = 1 + np.sin(2 * np.pi * t)
        fig, ax = plt.subplots()
        ax.plot(t, s)

        ax.set(xlabel='time (s)', ylabel='voltage (mV)',
               title='About as simple as it gets, folks')
        ax.grid()

        #Save into Buffer
        buf = io.BytesIO()
        plt.savefig(buf,format='png')

        self.Image = wx.Image(buf, wx.BITMAP_TYPE_ANY)
        self.Image = wx.StaticBitmap(self, wx.ID_ANY,
                                         wx.Bitmap(self.Image))
        self.sizer = wx.BoxSizer(wx.HORIZONTAL)
        self.sizer.Add(self.Image,1,wx.ALIGN_CENTRE)
        self.SetSizer(self.sizer)

class MyForm(wx.Frame):
    def __init__(self):
        wx.Frame.__init__(self, None, wx.ID_ANY,
            "Graph to Image Test", size=(1024,768))
        self.panel = MainPanel(self)

if __name__ == "__main__":
    app = wx.App(False)
    frame = MyForm()
    frame.Show()
    app.MainLoop()

I get the following error message and the program stops:
Traceback (most recent call last):
 File "/home/mike/Projects/Python/wxerg/wx + matplotlib test.py", line 42, in <module>
frame = MyForm()
 File "/home/mike/Projects/Python/wxerg/wx + matplotlib test.py", line 37, in __init__
self.panel = MainPanel(self)
 File "/home/mike/Projects/Python/wxerg/wx + matplotlib test.py", line 28, in __init__
wx.Bitmap(self.Image))
wx._core.wxAssertionError: C++ assertion "image.IsOk()" failed at /home/vagrant/wxPython-4.0.4/ext/wxWidgets/src/gtk/bitmap.cpp(581) in wxBitmap(): invalid image

A: You need to re-set the position within the buffer back to zero, so that wx.Image reads from the beginning of the data, not the end.
#Save into Buffer
buf = io.BytesIO()
plt.savefig(buf,format='png')
buf.seek(0)


text:
Q: Angular2 ng-translate not importing I am working on ng2-translate in my ionic2 app and following its Github's docs instructions.
However when I import "TranslateModule"
import {TranslateModule} from 'ng2-translate/ng2-translate';it gives me this error "Module my_node-module_path/ng2-translate/ng2-translate has no exported member TranslateModule."
And I have npm installed it.
Can anyone help me out here? Thanks.
**@NgModule Code **
@NgModule({
  declarations: [
    MyApp,
    FillForm,
    MainPage,
    TabsPage
  ],
  imports: [
     IonicModule.forRoot(MyApp),
     BrowserModule,
     HttpModule,
     TranslateModule.forRoot()
   ],
  bootstrap: [IonicApp],
  entryComponents: [
    MyApp,
    FillForm,
    MainPage,
    TabsPage
  ],
  providers: []
})

File Structure


text:
Q: Drop down not showing value in IE The first dropdown "Select device" is not showing any value in IE:

<SELECT Id="Device" name="device" onchange="javascript:LoadDevice(this.value);">
</SELECT>

<SELECT name="model" ><OPTION>Select Model</OPTION>
</SELECT>

Please check the HTML entire page here: http://goo.gl/1kEc2J
It works in all other browsers.
The dropdown gets its value from an external PHP page.
Any help would be very appreciated.

A: Your site is wrong on so many levels. But to your problem that you've listed here.
remove all of the "javascript: text from your events as these are not needed.
remove the onclick statements from
<option value="1" onclick="javascript:LoadDevice(1);">iPhone</option>
Why are you doing this?


text:
Q: How do I make it so that you can't @everyone with an echo command I want to add a way so that you cannot ping roles with the echo command. The only way I can think of is to check if 'content' starts with @ then it just responds with a message saying no, how can I do that?
@client.command()
async def echo(ctx, *, content:str):
    await ctx.send(content)
    print("Echo command works")

A: We can control pings in a message we send with allowed_mentions,
allowed_mentions = discord.AllowedMentions(everyone=False)
await ctx.send(content, allowed_mentions=allowed_mentions)

This will successfully send the echo, even if there is an everyone ping, but will not ping everyone. If you want to reply to the user saying No, we have to check for mentions and reply.
mentions = ctx.message.role_mentions
if any([mention.is_default() for mention in mentions]): # there is an everyone mention
    return await ctx.send('No')
else:
    # do stuff

References:

*

*Messagable.send

*AllowedMentions

*Message.role_mentions

*is_default

A: You could use character in string like so:
@client.command()
async def echo(ctx, *, content:str):
    if "@" in content:
        return await ctx.send("No")
    await ctx.send(content)
    print("Echo command works")


text:
Q: Rails: Single Table Inheritance - Subclass model with specific attribute Lets say I have a model named Animal with attribute species.
I intend to subclass Tiger from Animal, which attribute species is "tiger", how to define it so that
Animal.where(:species => 'tiger').where(:age => 12)
can be written as
Tiger.where(:age => 12)?
My attempted solution:
class Tiger < Animal
  def self.inherited(child)
    child.instance_eval do
      def type
        "tiger"
      end
    end
    super
  end
end

References:
 1. http://eewang.github.io/blog/2013/03/12/how-and-when-to-use-single-table-inheritance-in-rails/
 2. http://www.alexreisner.com/code/single-table-inheritance-in-rails

A: Whereas I have understand your problem you just want to implement simple STI.
I have tried it and it worked for me. Create a base class Animal in which
Animal table attributes will be species, name and age.
class Animal < ApplicationRecord
  self.inheritance_column = :species

  def self.species
    %w(Lion Tiger)
  end
end

Inherited classes.
class Lion < Animal
end
class Tiger < Animal
end

Try this hope it will solve your problem.


text:
Q: multiple xampp with same vhost documentroot I am developing a website app on my local environment using XAMPP.
At the moment my client server only serves PHP version 5, and after a few months they are going to upgrade the same web server to PHP version 7,,,
What I am thinking of doing is, develop using XAMPP of PHP7, and copy the exact source code to XAMPP of PHP5 (so I will have 2 XAMPP installed in my pc).This way i can test if the exact code does not break if it is in PHP5 environment.
But having to develop in PHP7 env, and the work of copying and pasting each time is more work than I have expected, not to mention the time taken to do that.
Is there anyway of setting the apache vhost of both XAMPP to point at the same documentroot? This way there is not need of copy paste anymore.

A: Yes it is possible goto C:\xampp\apache\conf\extra
and edit httpd-vhosts.conf
and uncomment the line and add you root directory location like below example.and more like.
<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host2.example.com
    DocumentRoot "C:/xampp/htdocs/test1"
    ServerName test1.com
    ErrorLog "logs/test1-error.log"
    CustomLog "logs/dummy-host2.example.com-access.log" common
</VirtualHost>
<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host2.example.com
    DocumentRoot "C:/xampp/htdocs/test2"
    ServerName test2.com
    ErrorLog "logs/test2-error.log"
    CustomLog "logs/dummy-host2.example.com-access.log" common
</VirtualHost>


text:
Q: mysql.data.entity.mysqlconnectionfactory.createconnection(System.String): overriding method must match the security accessibility I have a visual c# project using mysql.data & mysql.data.entities (from NuGet) for mysql connectivity.
But for some reason, this breaks data binding in blend with the following error:
"mysql.data.entity.mysqlconnectionfactory.createconnection(System.String)"
"overriding method must match the security accessibility"
error message: http://i.stack.imgur.com/e6fcy.png

A: The way I solved it after a while is by installing mysql.data only (so remove the mysql.data.entities package that's causing issues). so far everything still works & edge doesn't make an issue anymore.


text:
Q: Cannot compile 3D point viewer in Visual Studio 2008 Can someone help me ?I am trying to run the 3d point cloud viewer .However it shows me the following errors
Error   1   error C2144: syntax error : 'void' should be preceded by ';'    c:\program files\microsoft sdks\windows\v6.0a\include\gl\gl.h   1152    Viewer
Error   2   error C4430: missing type specifier - int assumed. Note: C++ does not support default-int   c:\program files\microsoft sdks\windows\v6.0a\include\gl\gl.h   1152    Viewer
Error   3   error C2146: syntax error : missing ';' before identifier 'glAccum' c:\program files\microsoft sdks\windows\v6.0a\include\gl\gl.h   1152    Viewer
Error   4   error C2182: 'APIENTRY' : illegal use of type 'void'    c:\program files\microsoft sdks\windows\v6.0a\include\gl\gl.h   1152    Viewer
Error   5   error C4430: missing type specifier - int assumed. Note: C++ does not support default-int   c:\program files\microsoft sdks\windows\v6.0a\include\gl\gl.h   1152    Viewer
Error   6   error C2144: syntax error : 'void' should be preceded by ';'    c:\program files\microsoft sdks\windows\v6.0a\include\gl\gl.h   1153    Viewer
Error   7   error C4430: missing type specifier - int assumed. Note: C++ does not support default-int   c:\program files\microsoft sdks\windows\v6.0a\include\gl\gl.h   1153    Viewer

and so on ...
Beginning of my code is :
    #include <cstdlib>
    #include <GL/glut.h>

    #include <cmath>
    #include "arcball.h"
    #include <vector>
    #include <iostream>
    #include <fstream>
 using namespace std;

Can someone please tell me what is going wrong?

A: Well, the first reported error is on the first line that declares a function with the WINGDIAPI modifier. Apparently, this is declared in wingdi.h. However, I'm not sure if you're meant to #include that directly, or whether there's a more formal recommendation for compiling opengl code in the windows environment. I'll have a hunt around.
The page on MSDN discussing the necessary headers for OpenGL work are a bit vague, but I take:

The Windows functions that support Microsoft's implementation of OpenGL in Windows must include the header file Windows.h.

To mean that you ought to include windows.h first.

Really? If I create a blank C++ project in VS2008, create an empty cpp file, copy and paste your includes in, and hit compile, I get exactly the errors you described. If I change my includes to:
#include <cstdlib>
#include <windows.h>
#include <GL/gl.h>

#include <cmath>
#include "arcball.h"
#include <vector>
#include <iostream>
#include <fstream>

Then the first reported error I get is that it can't find "arcball.h" (hardly unexpected). Are you still getting the same errors once windows.h is included?


text:
Q: is this a valid interpretation of the composite pattern? One recommendation I get out of the composite pattern is to provide default operations that handle inappropriate child management operations for a Leaf node (ie, throwing an exception on AddChild, returning an empty enumeration for Children, etc.).
My understanding of the classic pattern is to have a single abstract class with a Leaf subclass and a Composite subclass but if you provide default ops in the parent, doesn't it effectively obviate the need for the Leaf?
Does anyone do it this way?
Cheers,
Berryl

A: it's possible we're talking about different things.  i am assuming the composite pattern is as described on http://en.wikipedia.org/wiki/Composite_pattern
for that pattern, you would not expose operations that don't apply to the leaf node, like AddChild (your example) because the Component interface (using the names from the wikipedia article) is intended to expose only common actions that can be performed on either a leaf or a node.  so there is no need for defaults.
there is an add() on the Composite class in the wikipedia article, but that is to add things to the composite "view", not to any particular data structure.  in other words, you might access some parts of a tree of data through a composite interface, but the add() method on the interface is adding or removing items from that collection, and not from the tree itself.


text:
Q: What maven-jetty-plugin 8 configuration allows reloading of JSP files when they change? Consider a default webapp configuration in Maven (for the test case I used struts2-blank-archetype from https://repository.apache.org/content/groups/public/archetype-catalog.xml ).
This archetype comes with maven jetty plugin's version 6. With the configuration below, if I change a jsp under /src/main/webapp/WEB-INF/ and save it, refreshing the browser will show these changes.

        <plugin>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>maven-jetty-plugin</artifactId>
            <version>6.1.21</version>
            <configuration>
                <scanIntervalSeconds>10</scanIntervalSeconds>
            </configuration>
        </plugin>

(notice that one doesn't even need to put the scantarget element, as we don't want a complete container reload when you just change a jsp).

However, the exact same configuration of version 8 of the plugin (see below) does not work. If I change the same jsp, refreshing the browser will show the old JSP contents. Only by stopping and starting the server will I see the changes.

        <plugin>
            <groupId>org.mortbay.jetty</groupId>
             <artifactId>jetty-maven-plugin</artifactId>
             <version>8.1.7.v20120910</version>
            <configuration>
                <scanIntervalSeconds>10</scanIntervalSeconds>
            </configuration>
        </plugin>

What is wrong with this configuration, and what configuration would produce the same results in version 8 (ie, auto-refreshing the jsp contents without restarting the server)?
EDIT:
Here's a 2 minute test you can try:

*

*Create archetype struts2-archetype-convention ("mvn archetype:generate", 308, package war).

*Edit the pom and set the jetty plugin configuration to the one listed above (version 6)

*mvn jetty:run

*Open the browser on "http://localhost:8080"

*See "Languages" on the page

*Edit /src/main/webapp/WEB-INF/content/hello.jsp - change "Languages" for something else. Save.

*Refresh the browser and see the change.

*Repeat the steps. On step 2, change the artifactId and version to the ones listed above (version 8)

*Confirm the webpage does not change upon refresh after you perform the change in the JSP.

A: There have been a host of improvements to the plugin since jetty-6 days to run a variety of different project configurations. Take a look at the documentation page for the plugin, choose the scenario that best meets you needs and adapt the configuration as needed.  I suspect your case is under 'Running an unassembled webapp'.
http://wiki.eclipse.org/Jetty/Feature/Jetty_Maven_Plugin
I'll note that for jetty-9 we are finally bringing the plugin over to eclipse so it can live with the project which will change the groupId to org.eclipse.jetty, the jetty-maven-plugin for 9.0.0.M2 will be in central early next week (documentation to be updated for that as well still)
cheers

A: mmalmeida,
I've tested this scenario using the standard jetty-test-webapp. I put a jsp in src/main/webapp/jsp that forwards to another jsp in src/main/webapp/WEB-INF. Starting the jetty maven plugin with mvn jetty:run, the forward happens correctly. If I leave the plugin running and modify the jsp in WEB-INF, and do a shift-reload on the browser, it picks up the changed page as expected.
Note that you do not need to declare scanTargets or anything else of that nature. The above behaviour (jsp reload) is a function of the jsp engine, which when running in development mode will check the timestamps on jsp files as it receives requests, and recompile on the fly as necessary.
I think you'll have to provide more details about your specific webapp - in particular how your setup is different to the test scenario I just described - in order to get any further with this.
regards
Jan

A: After the previous comments I was able to identify the root cause of this issue. While this is a bit specific to our use case, I share this with the community nonetheless.
This is basically caused by the timestamps of the files. My work directory is an NFS mount of another server. For some strange reason* the clock on that server is delayed. This means that if it's 9:00 and I change the JSP file, the file will be timestamped with 8:40.
There might have been a change in Jetty from 6 to 8 regarding the strategy used for JSP file reloading - while Jetty 6 does not seem to care about the file's timestamp and refreshes anyway, Jetty 8 is more sensitive and does not reload the file.
So the "solution" here was simply to update the remote NFS server's clock.
*meaning the NTP deamon is running, I can ping the ntp servers, other machines on the same networks have the same NTP settings and yet this machine is still having its clock drift


text:
Q: Pandas Qcut, rounding values, Python I want to create a key for the qcut bins I have from my data set.
So below I have the data from the 'total' column into ten bins, I have dropped the duplicates and sorted the values so I can see what the bin values are and in order. The below has the bins without using 'precision'.
bin_key=pd.qcut(bin_key['Total'], 10).drop_duplicates().sort_values()
bin_key.reset_index(drop=True, inplace=True)
bin_key

Output:
0           (11.199, 7932.26]
1        (7932.26, 15044.289]
2      (15044.289, 22709.757]
3      (22709.757, 32762.481]
4      (32762.481, 43491.146]
5       (43491.146, 55728.56]
6       (55728.56, 72823.314]
7     (72823.314, 100161.814]
8    (100161.814, 156406.846]
9    (156406.846, 1310448.18]

I want to round the values to the nearest thounsand. Using precision it looks like this:
bin_key=pd.qcut(bin_key['Total_Costs'], 10, 'precision=-3').drop_duplicates().sort_values()
bin_key.reset_index(drop=True, inplace=True)
bin_key

Output
0        (-1000.0, 8000.0]
1        (8000.0, 15000.0]
2       (15000.0, 23000.0]
3       (23000.0, 33000.0]
4       (33000.0, 43000.0]
5       (43000.0, 56000.0]
6       (56000.0, 73000.0]
7      (73000.0, 100000.0]
8     (100000.0, 156000.0]
9    (156000.0, 1310000.0]

How can I round to 0 rather than -1000?


text:
Q: How to detect whether a UEFI booted linux machine's video mode is graphics output protocol (GOP) or universal graphics adapter (UGA)? UEFI firmware appears to support GOP or UGA graphics protocols. GOP is newer and has replaced UGA. On my machine which does not have an integrated graphics adapter (only a discrete graphics adapter NVIDIA GTX 965m), I found that upon live booting a Linux installation CD, there is no kernel module driving my graphics card (I checked lspci and X logs).
After doing some research on UEFI, I found these 2 kinds of graphics protocols, and I was wondering if there was a way (a command line query) to find out which of the 2 is being used, because it seems that it is the UEFI firmware that is providing the ability to drive my machine's display (probably through my "VGA compatible" discrete graphics card).
Furthermore, at the BIOS settings (is it still called a BIOS settings when using UEFI firmware?), I was also able to change my Video Op Rom settings to "BIOS compatibility mode". When I left it as "UEFI only", I got full resolution at the BIOS configuration settings and at the POST display, and boot loader display. When choosing "BIOS compatibility mode", I got a much smaller resolution. Does this basically mean the firmware was able to use the VGA protocol instead?

A: To elaborate on grawity's answer, there are several issues, of varying degrees of relevance, to your question:

*

*UGA vs. GOP -- As you say, there are two EFI video systems, UGA and GOP. The latter was introduced with EFI 2.x (aka UEFI), IIRC, and AFAIK all UEFI-based systems use GOP. In principle, all EFI 1.x systems should use UGA; however, Apple (which still uses EFI 1.x, even in its most recent products) has ported UGA to its EFI, so some (but not all) Macs have EFI 1.x with GOP. There may be other oddball exceptions. As grawity says, this distinction is important at the firmware level, but not really at the OS level, at least not AFAIK.

*Linux framebuffer devices -- Whether it's UGA or GOP, the firmware gives the OS access to its video hardware, which Linux exposes via a framebuffer device -- specifically, efifb. On EFI-based systems, this is often the basis for text-mode operation (if you don't start X or if you hit Ctrl+Alt+F1 through Ctrl+Alt+F6). OTOH, there are also framebuffer devices provided by some kernel drivers for specific video chipsets, so you might not end up using the efifb device. I don't know offhand if there are any differences in the way UGA and GOP present themselves to the OS. Certainly I know of no differences at a higher level, like commands you'd use in Linux.

*X Window System drivers -- X drivers can rely on kernel video drivers or be basically independent of them. In most cases, you use an X driver that's written for a specific video chipset (ATI, Nvidia, Intel, etc.), and these don't work through the firmware. Thus, these drivers should not be affected by UGA vs. GOP (or even BIOS vs. EFI, although there are some caveats about that). That said, there is an X framebuffer driver that will work via whatever framebuffer device is active, including the efifb device. Thus, you could be driving a display via the EFI's UGA or GOP modes. This is definitely a sub-optimal way to do it, though, because the framebuffer drivers tend to be slow. Modern windowing environments, including Ubuntu's Unity, are increasingly relying on video acceleration features that aren't accessible through a framebuffer.

You can see some of this at work by examining the kernel ring buffer via dmesg, as in:
$ dmesg | grep fb
[    0.625015] efifb: probing for efifb
[    0.625207] efifb: framebuffer at 0xc0000000, mapped to 0xffffc90010880000, using 3072k, total 3072k
[    0.625208] efifb: mode is 1024x768x32, linelength=4096, pages=1
[    0.625209] efifb: scrolling: redraw
[    0.625210] efifb: Truecolor: size=8:8:8:8, shift=24:16:8:0
[    0.627994] fb0: EFI VGA frame buffer device
[    6.086695] fb: conflicting fb hw usage radeondrmfb vs EFI VGA - removing generic driver
[    6.689526] [drm] fb mappable at 0xC1488000
[    6.689531] [drm] fb depth is 24
[    6.689610] fbcon: radeondrmfb (fb0) is primary device
[    6.804904] radeon 0000:00:01.0: fb0: radeondrmfb frame buffer device

This example shows a number of framebuffer-related messages on a system with an AMD/ATI GPU. You'll note there's no mention of UGA vs. GOP, but the efifb device is referenced, as is fbcon (the framebuffer console) and radeondrmfb (the framebuffer device for ATI/AMD Radeon devices). The removing generic driver message denotes a handoff from the efifb driver to the radeondrmfb driver. You can also examine /var/log/Xorg.0.log for messages related to the X server. In the case of my system, these are less interesting, but if you're having problems with X starting up, Xorg.0.log may be of more interest to you.
One more point: When asking for help on hardware issues, it's generally important that you specify what your hardware is -- "a discrete graphics adapter" is insufficiently specific when soliciting help on your video problem. For that matter, it's not clear what your problem is -- or are you simply looking for information on how it all fits together so as to further your understanding?


text:
Q: Facebook application iframe php Please excuse me for being thick (or not) but does a FaceBook iframe (canvas) application "behave" like any other iframe on a website? - OK I'll accept you need access to the api etc with the keys, but once that is achieved am I being totally off the wall in thinking that a FB iframe application "just" runs the relevant app. pages in an iframe, exactly the same way that any other site does?

A: Basically, you are correct.  Facebook does post some information through the iFrame to enable different parts of the JS library that you should load with the page to access their features.  But in essance, they are loading an iFrame of a website and displaying it inside of their wrapper.  Also it is very different than an FBML app because it is rendered on your server and then the rendered content is sent to the iFrame rather than the FBML being rendered by FB then displayed on the screen.


text:
Q: Android: How to add data to an empty listView I have a problem with listView, I used ArrayList to store data, and a customized Adapter. But, when I remove all the data, and add one item again, it does not display anything in this list. What happens to my List, can anyone help me?
static ArrayList<String>  chattingListData=new ArrayList<String>();
static IconicAdapter chattingListDataAdapter;

@Override
public void onCreate(Bundle icicle) {

   super.onCreate(icicle);
   chattingListDataAdapter=new IconicAdapter(this);
   setListAdapter(chattingListDataAdapter);
   registerForContextMenu(this.getListView());

}

class IconicAdapter extends ArrayAdapter {

   Activity context;

   IconicAdapter(Activity context) {
      super(context, R.layout.chatting_list, chattingListData);
      this.context=context;
   }

   public View getView(int position, View convertView, ViewGroup parent) {
      LayoutInflater inflater=context.getLayoutInflater();
      View row=inflater.inflate(R.layout.chatting_list, null);
      TextView label=(TextView)row.findViewById(R.id.chattinglist_userName);
      label.setText(chattingListData.get(position));
      return(row);
   }
}

I use static ArrayList to modify data from outside, when I start the ListView activity and add data, it's Ok, but when I remove all data, I can not add anymore to the data list. Please help me.

A:
I use static ArrayList to modify data from outside

Don't do that.
Step #1: Use a non-static ArrayList data member as the basis for your ArrayAdapter.
Step #2: Expose methods on your activity that adds and removes items via the add(), insert(), and remove() methods on ArrayAdapter. By using these methods, your ListView will automatically update when you make the changes.
Step #3: Use the methods you wrote in Step #2 to modify the contents of your ListView, by whoever is doing this (not shown in your code).

A: You can also use the Adapter's notifyDataSetChanged() method, in order to force it to refresh.


text:
Q: Exporting model from Blender to three.js CanvasRenderer weird distorded normals I'm trying to export a model using the Three.js import export for blender and everything is working fine when I used the WebGLRenderer, but if I use CnavasRenderer (what I need for crossbrowsing support) I get a model but with a weird behavior (if I export a model with more than 2 geometries touching each other) with blinking and distorded normals from my mesh. I doesnt matter if I have tested joining the model before exporting into a single mesh and is the same, its like if there are 2 different geometries touching each other this happens)
I link a image from the model as an example!
http://i.stack.imgur.com/ATjLH.png
Someone have some tip to export this from blender to use with CanvasRenderer? I will appreciate any help :)
Thank you!!

A: After struggling a bit I found this alternative, I hope it helps if someone have the same problem.
To me, the solution was to use the ThreeCSG library to make substractions, unions, etc. I think that doesn't work for most cases because is a little bit messy to do that with a complex model, but it's ok in my case.
I leave you an image with the result, and the render using CanvasRenderer it works perfectly
Thank you!


text:
Q: How to get scaffolding to work in Bootstrap? I can't seem to get the scaffolding grid to work for my Bootstrap code. The two different div classes are appearing on different lines and are both the full width of the screen. Any help would be much appreciated

Lorem ipsum, Lorem ipsum! Lorem ipsum, Lorem ipsum! Lorem ipsum, Lorem ipsum! Lorem ipsum, Lorem ipsum! Lorem ipsum, Lorem ipsum! Lorem ipsum, Lorem ipsum! Lorem ipsum, Lorem ipsum! Lorem ipsum, Lorem ipsum! Lorem ipsum, Lorem ipsum! Lorem ipsum, Lorem ipsum! Lorem ipsum, Lorem ipsum! Lorem ipsum, Lorem ipsum! Lorem ipsum, Lorem ipsum! Lorem ipsum, Lorem ipsum! Lorem ipsum, Lorem ipsum! Lorem ipsum, Lorem ipsum! Lorem ipsum, Lorem ipsum! Lorem ipsum, Lorem ipsum! Lorem ipsum, Lorem ipsum! Lorem ipsum, Lorem ipsum!

Same Line?

A: That should be working correctly. Do you have any example online? (The only thing I can think of without more detail is that you do not have the correct bootstrap css file loading in the header)

A: You are probably using the bootstrap 3 stylesheet with version 2.3 html.
use this stylesheet: http://getbootstrap.com/2.3.2/assets/css/bootstrap.css
vs
http://getbootstrap.com/dist/css/bootstrap.css


text:
Q: Get current month in Eleventy using Nunjucks? Just trying to get the current month in Eleventy with a shortcode but having a bit of trouble.
Here's where I'm at:
config.addShortcode("month", () => {
let d = new Date();
let month = new Array();
month[0] = "January";
month[1] = "February";
month[2] = "March";
month[3] = "April";
month[4] = "May";
month[5] = "June";
month[6] = "July";
month[7] = "August";
month[8] = "September";
month[9] = "October";
month[10] = "November";
month[11] = "December";
var n = month[d.getMonth()];

return n;
    })

All responses are very much appreciated, thank you :)

A: This way is easier.

const currentMonth = (new Date()).toLocaleString('en-US', {month: 'long'});
console.log(currentMonth);


text:
Q: What's the correct word to refer to a believer of scientism? Scientism is, roughly speaking, the belief that the only legitimate knowledge is scientific knowledge and all other sources of knowledge - like religion - should be rejected.
If it is still unlcear, here is the relevant Wikipedia link: https://en.wikipedia.org/wiki/Scientism
Now in my language (Polish) there are two distinct terms: "naukowiec" - which means a scientist (the person who conducts scientific research and who can win a Nobel prize for discovering a vaccine against AIDS) and "scjentysta" - which means a person whose worldview is in accordance to scientism (so "scjentysta" will reject all arguments that are not scientific in nature and will condemn religion).
But, how to say "scjentysta" in English? Since what I want is a believer of scientism, I would say "scientist" BUT - this will cause confusion since not every practicioner of science believes in scientism and not every person whose worldview is in accordance with scientism will have PhD.
So, is my only option still "scientist" or is there any better word?
"A ___ believes that science is the only legitimate source of knowledge."
As opposed to:
"A scientist has won the Nobel prize for discovering a vaccine against AIDS."


text:
Q: How can i solve this Error Subsequent property declarations must have the same type and Duplicate identifier. Angular 9 * I really dont know and dont understand why this is happening, im new using Angular *

*

*Below i will let my full code and the complete error

ErrorSubsequent property declarations must have the same type.  Property 'post1' must be of type 'Posts', but here has type 'any' and Duplicate identifier 'post1'
Post class
export class Posts{
    Key:string;
    Email:string;
    Password:string;
}

AppComponent class where i use the post class
export class AppComponent {
  title = 'proyecto-nro2';

  post1 = new Posts();
//Said the error above in every post1.
  post1.Key = 'NONE';
  post1.Email = 'NONE';
  post1.Password = '2';
}

A: Properties can't initialised directly on a class in ES6. Initialise the post object inside the constructor and set the properties.
export class AppComponent {
  title = 'proyecto-nro2';

  post1: Posts;

 constructor(){
  this.post1 = new Posts();
  this.post1.Key = 'NONE';
  this.post1.Email = 'NONE';
  this.post1.Password = '2';

 }
}

Other Option:
class Posts {
    Key: string;
    Email: string;
    Password: string;

    constructor(key: string, email: string, password: string) {
        this.Key = key;
        this.Email = email;
        this.Password = password;
    }
}

export class AppComponent {
  title = 'proyecto-nro2';
  post1: Posts = new Posts('NONE', 'NONE', '2');
}

A: As @nayakam said you should set the properties in the constructor of your Posts object
export class Posts{
    key: string;
    email: string;
    password: string;

    constructor(key: string, email: string, password: string) {
        this.key = key;
        this.email = email;
        this.password = password;
    }
}

The problem with this is that it can become annoying if some parameters are optionals, for me the best syntax is to send an object to initialize your models and export an interface so that your AppComponent knows what the Posts constructor needs as input
export interface IPosts {
    key: string;
    email: string;
    password: string;
}

export class Posts{
    key: string;
    email: string;
    password: string;

    constructor(inputData: IPosts) {
        this.key = inputData.key;
        this.email = inputData.email;
        this.password = inputData.password;
    }
}

export class AppComponent {
    title = 'proyecto-nro2';
    post1: Posts = new Posts({
       key: 'NONE',
       email: 'NONE',
       password: '2'
    });
}


text:
Q: Layout problem after integrating a slideshow html css one page of my website is locking like that:
http://www.pflanzspass.bplaced.net/
Yesterdy I tried to integrate a slideshow:
http://www.pflanzspass.bplaced.net/indextest.php
The slideshow is working, but now there are some new layout problems:
now:

before:

I don't know why.
This is my new css-Code for the slideshow:
  * {box-sizing: border-box}
  /*body {
  font-family: Verdana, sans-serif;
  margin:0
  }*/
  .mySlides {display: none}
  img {vertical-align: middle;}
  .slideshow-container {
  max-width: 1000px;
  position: relative;
  margin: auto;
  }
  /* Next & previous buttons */
  .prev, .next {
  cursor: pointer;
  position: absolute;
  top: 50%;
  width: auto;
  padding: 16px;
  margin-top: -22px;
  color: white;
  font-weight: bold;
  font-size: 18px;
  transition: 0.6s ease;
  border-radius: 0 3px 3px 0;
  user-select: none;
  }
  /* Position the "next button" to the right */
  .next {
  right: 0;
  border-radius: 3px 0 0 3px;
  }
  /* On hover, add a black background color with a little bit see-through */
  .prev:hover, .next:hover {
  background-color: rgba(0,0,0,0.8);
  }
  /* Caption text */
  .text {
  color: #ffffff;
  font-size: 15px;
  padding: 8px 12px;
  position: absolute;
  bottom: 8px;
  width: 100%;
  text-align: center;
  }
  /* Number text (1/3 etc) */
  .numbertext {
  color: #ffffff;
  font-size: 12px;
  padding: 8px 12px;
  position: absolute;
  top: 0;
  }
  /* The dots/bullets/indicators */
  .dot {
  cursor: pointer;
  height: 15px;
  width: 15px;
  margin: 0 2px;
  background-color: #999999;
  border-radius: 50%;
  display: inline-block;
  transition: background-color 0.6s ease;
  }
  .active, .dot:hover {
  background-color: #111111;
  }
  /* Fading animation */
  .fade {
  -webkit-animation-name: fade;
  -webkit-animation-duration: 1.5s;
  animation-name: fade;
  animation-duration: 1.5s;
  }
  @-webkit-keyframes fade {
  from {opacity: .4}
  to {opacity: 1}
  }
  @keyframes fade {
  from {opacity: .4}
  to {opacity: 1}
  }
  /* On smaller screens, decrease text size */
  @media only screen and (max-width: 300px) {
  .prev, .next,.text {font-size: 11px}
  }

This is the css-code, already online before added the slide-show css-code:
*{
    margin: 0px;
    padding: 0px;
}
body {
    font-family:Verdana;
    font-size:10px;
}
#wrapper{
    width:1000px;overflow:hidden;
    margin:0 auto 10px auto;background-image: url(./grafics/bg.gif);background-repeat:repeat-y;
}
/*-------------------------------------------------------------------*/
/*                          font-size                                */
/*-------------------------------------------------------------------*/
h1 {
   font-size: 25px;
}
h2 {
   font-size: 19px;
}
h3{
    font-size:18px;
    color:#660033;
}
h4, h5, h6 {
   font-size: 16px;
}
p{
    font-size: 14px;
    margin-right:20px;
}
h2, h3, h4, h5, p{
    margin-bottom:10px;
}
h5{

}
/*-------------------------------------------------------------------*/
/*                          links                                    */
/*-------------------------------------------------------------------*/
a:link, a:visited, a:active, a:hover{
    text-decoration:none;
    color:#634142;
    font-size:12px;
    font-weight:bold;
}
a:active, a:hover{
    text-decoration:underline;
}
/*-------------------------------------------------------------------*/
/*                          header                                   */
/*-------------------------------------------------------------------*/
#header {
    width:968px;
    height:161px;
    margin:0 13px 0 13px;
    border:3px solid #000;
    background-color: #000;
}
#header2{
    width:974px;
    height:65px;
    padding:5px 0 0 0;
    margin:0 13px 0 13px;
    background:#fff;
    clear:both;
}
#logo {
    width:222px;
    margin: 0 0 0 0;
    padding: 0 5px 0 0;
    float: left;
    overflow: hidden;
}
#header-title {
    height: 160px;
    background: transparent url(banner_2.jpg) no-repeat 0 0;
    float:left;
}

#ueberschrift {
    padding:60px 0 0 20px;
    color:#fff;
}
#ueberschrift p{
    font-size:16px;
}
#content-header{
    width:990px;height:60px;
    padding:0 0 20px 10px;
}
#like{
    width:77px;
    margin:5px 30px 0 10px;
    float:left;
}
#kaktus-banner{
    width:468px;
    margin:5px 0 0 129px;
    float:left;
}
#wobinich{
    width:964px;height:16px;
    margin:0 13px 0 13px;
    font-size:12px;
    border-bottom:1px solid #000;
    background:#fff;
    float:left;padding:0 0 0 10px;

}
h2.title{
    text-align:center;
    height:40px;
    font-size:30px;
    background: transparent url(./grafics/bg-title1.gif) no-repeat 0px 35px;
}
h2.title2{

    height:40px;
    font-size:30px;
    background: transparent url(./grafics/bg-title3.gif) no-repeat 0px 35px;
}
h2.gb{
    height:30px;
    background: transparent url(./grafics/bg-title3.gif) no-repeat 0px 25px;
}
/*-------------------------------------------------------------------*/
/*                          content                                  */
/*-------------------------------------------------------------------*/

#content {
    width:974px;
    margin:0 13px 0 13px;
    background:#fff;
    float:left;
}
#content p{
    line-height:24px;
}
#links{
    width:185px;
    margin:0 0 0 0;
    float:left;
}
#mitte{
    width:609px; /*609px*/
    padding:10px 10px 0 10px;
    float:left;
}
#mitte_a-z{
    width:873px;
    padding:10px 0 0 20px;
}
#mitte1{
    width:767px;
    padding:10px 10px 0 10px;
    float:left;
}
#rechts{
    width:160px;
    margin:0 0px 10px 0;
    float:right;
}
#film{
    margin:10px 0 10px 182px;
}

#footer{
    width:974px;height:30px;

    font-size:12px;
    line-height: 27px;
    text-align:center;
    color:#000;
    border-top:1px solid #000;background:#fff;border-bottom:1px solid #000;background:#fff;
    float:left;
}
#footer a{
    font-weight:normal;
    color:#000;
}
/*-------------------------------------------------------------------*/
/*                          navigation                               */
/*-------------------------------------------------------------------*/
.navtitle{
    margin:0px;
    background:#7fb37f;
    text-align:center;
}
#navigationsleiste{
    margin:0 16px 20px 0;padding:0 0 10px 0;
    width:185px;background:#a5e8a5;
}
#navigationsleiste a{
    display: block;
    height: 20px;
    padding:8px 0 0 19px;

    color: #000;
    text-decoration: none;
}
#navigationsleiste a:hover{
    background: transparent url(./grafics/liste.gif) no-repeat 5px 12px;

}
#navigationsleiste a.aktiv{
    background: transparent url(./grafics/liste.gif) no-repeat 5px 12px;

}
.link{
    /*margin:0 16px -2000px 0;padding-bottom:2000px;*/
    width: 185px;background:#a5e8a5;
}
.link a{
    display: block;
    height: 20px;
    margin:2px;
    padding:10px 0 10px 9px;
    font-size:12px;
}
.link-re{
    /*margin:0 0px -2500px 0;padding:0 0 2500px 0;*/
    width: 160px;background:#a5e8a5;
}
.link-re a{
    display: block;
    height: 20px;
    margin:0px;
    padding:2px 0 0 20px;
    font-size:12px;
    font-weight:bold;

}
#zapp{
    width:964px;height:20px;
    margin:0 13px 0 13px;
    font-size:12px;
    background:#fff;
    border-bottom:1px solid #000;
    padding:10px 0 0 10px;
    float:left;

}
.up{
    margin:10px 0 10px 0px;
    text-align:right;

}
.up a{
    font-weight:bold;
}
.back{
    margin:0 60px 0 0;
    float:left
}
.zurueck{
    float:left;
}
.ist{
    float:left;
    color:#a5a5a5;
    margin-left:30px;
}
.vor{
    margin:0 0 0 30px;
    float:left;
}
/*-------------------------------------------------------------------*/
/*                          listenelemente                           */
/*-------------------------------------------------------------------*/
ul{
    list-style-type:none;
}
li{

}
#mitte ul{
    list-style-type:disc;
    margin-left:15px;
}
#mitte li a{

}
ol{
    font-size:14px;
    margin:0 0 0 20px;
    line-height:24px;
}
.cb{
    clear:both;
}
img{

}
#table{
}
p.hn {
  color: #870B0B;
}

p.se {
  color:#057C11;
}

p.nanl {
  color:#64057C;
}

p.bild {
    float:left;
    }

A: Remove height:20px form this style
.link a{
    display: block;
    height: 20px;
    margin:2px;
    padding:10px 0 10px 9px;
    font-size:12px;
}

A: * {

    box-sizing: border-box;
}

.link a {
        display: block;
        height: auto;
        margin: 2px;
        padding: 10px 0 10px 9px;
        font-size: 12px;
    }


text:
Q: Certificate credentials for WCF service on an Azure cloud service signed by our own CA We have front and back end cloud service that communicate via WCF services which are secured using certificate credentials. The problem we are having is that the request fails with the following error:
           verb="POST"
           authenticationType="NOT_AVAILABLE" activityId="{00000000-0000-0000-0400-0080000000F7}"
           failureReason="STATUS_CODE"
           statusCode="403.16"
           triggerStatusCode="403.16"

(From IIS failed request tracing)
I believe the issue is as described here:
https://support.microsoft.com/en-gb/help/252657/iis-5.0-http-403.16-forbidden-client-certificate-untrusted-or-invalid
(That the server does not trust third party CAs by default. )
If I do as described in the link the issue is resolved but the cloud service isn't part of a domain and I don't know how to apply this setting as part of the deployment or programmatically as part of the start-up.
What I also find strange is that this issue doesn't seem common even though I presume securing WCF communications on Azure cloud services using certificates isn't unusual, so I wonder if the issue is a symptom of something else I am doing wrongly.


text:
Q: SF Movie where different ships are sent to find a habitable world for humanity I recall that the Earth is dying. Different ships were sent to different planets looking for one that was habitable for humans.
The survivors have to pick which planet to go to and one guy lies in order to get rescued.
The people left on earth receive a couple of transmissions from different planets and must decide which one to go to.

A: This is a pretty fair description of Interstellar

*

*Earth is dying / Check, there's something called the blight attacking all the crops and making the air unbreathable

*Different ships sent to different planets / Check, the "Lazarus Project" involves multiple ships going to various potentially habitable planets.

*The guy lies to get rescued / Check, a major plot-point is that Dr Mann lies to get himself rescued, despite having been hailed as a paragon by the other scientists.

A: No it was a TV show Defying Gravity


text:
Q: FileNet Social Collaboration - search by comments We have social collaboration enabled on our FileNet system. I can add comment, tag, like and track how many times a document has been downloaded. These features are nice. When I tag a document, I can search documents by the tag text.
Ex: If I tag a document as say "test". I can user a search template to search for a document by its tag value i.e. test.
When I comment, I can't search document based on Comment Text.
Say I added a comment as "good doc". I can't search it by the text. Rather I need to provide an integer value like 1 search. Then search happens like "get all documents which has number of comments =1". I don't want this behavior instead I should be able to search on the comment text.
Can anybody help on this?

A: One way to achieve this would be to use CBR on the property. See how to enable CBR on a property
The property will then be full-text searchable using the CONTAINS statement, see doc.
Optionally (but i'm not sure as i've never personally used it) - the satisfies operator might exactly what you're looking for according to the documentation.


text:
Q: split ввод в одну строчку ошибка с "с" помогите. Написал простой калькулятор,в котором элементы вводятся в одну строчку. Использовал split, ошибка с "с"
def sum (a, b, c):
    if c == "+":
        return a + b
    elif c == "-":
        return a - b
    elif c == "*":
        return a * b
    elif c == "/":
        return a / b
    else:
        return "unknown value"
result = sum (int, input().split())
print(result)

A: Не особо понял, зачем наворотили туда сплиты и тип переменной. Можно попросту огласить три переменные-вводы и затем провести над ними операцию.
intA = int(input("Введите число:  "))
intB = int(input("Введите число: "))
oper = input("Введите оператор: ")
result = sum(intA, intB, oper)
print(result)

Этот код вставляете вместо вашей переменной result. Также, советую не называть такую функцию sum(), ибо здесь кроме сложения присутствуют другие операторы.

A: Вероятно вот что вы хотели получить. Ошибки были в том, что вы складывали строки и тогда 1+3 = 13, а во вторых функция split возвращает массив, а не несколько переменных, и тогда весь массив из [1,+,3] попадал в переменную b, а переменная c оставалась пустовать. А в переменной a вообще какая-то страшилка сидела в виде просто типа int
def sum (a):
    if a[1] == "+":
        return int(a[0]) + int(a[2])
    elif a[1] == "-":
        return int(a[0]) - int(a[2])
    elif a[1] == "*":
        return int(a[0]) * int(a[2])
    elif a[1] == "/":
        return int(a[0]) / int(a[2])
    else:
        return "unknown value"

result = sum((input().split()))
print(result)


text:
Q: Serverless deployment lambda cannot assume existing IAM Role I feel this question has been asked quite a bit but nothing is working for me from the current answers.
I am trying the deploy an app with Serverless. My serverless.yml is:
app: product-events-api

service: product-events
custom:
  secrets: ${ssm:/aws/reference/secretsmanager/serverless-product-events-${self:provider.stage}~true, ''}
  provider:
    name: aws
    runtime: nodejs10.x
    region: eu-west-1
    stage: ${opt:stage, 'preview'}
    timeout: 30
    # Role ARN must adhere to the RegEx: arn:(aws[a-zA-Z-]*)?:iam::\d{12}:role/?[a-zA-Z_0-9+=,.@\-_/]+
    role: arn:aws:iam::${self:custom.secrets.AWS_ACCOUNT_ID}:role/${self:custom.secrets.IAM_ROLE_NAME}
    vpc: ${self:custom.secrets.vpc}
    environment:
      STAGE: ${self:provider.stage}
      NODE_ENV: production
      DB_NAME: ${self:custom.secrets.DB_NAME}
      DB_URL: ${self:custom.secrets.DB_URL}

functions:
  getProductEvents:
    handler: src/routes/api/handler.events
    memorySize: 1024
    description: Get product event
    events:
      - http:
          path: /events
          method: get

The role evals to an absolute ARN of arn:aws:iam::<Account ID>:role/lambda_basic_execution.
Running sls deploy --stage production gave me the error:

An error occurred: GetProductEventsLambdaFunction - The role defined for the function cannot be assumed by Lambda. (Service: AWSLambdaInternal; Status Code: 400; Error Code: InvalidParameterValueException; Request ID: 4750b33e-329c-4383-abd4-a61ec4d326b2).

This IAM Role is used by almost every lambda we have. I turned to this answer to attempt to define the role just by the name at function level but got:

The CloudFormation template is invalid: Template error: instance of Fn::GetAtt references undefined resource lamba_basic_execution

If I run; aws iam get-role --role-name lambda_basic_execution, I am returned with:
{
    "Role": {
        "AssumeRolePolicyDocument": {
           "Version": "2012-10-17",
            "Statement": [
                {
                    "Action": "sts:AssumeRole",
                    "Principal": {
                        "Service": "lambda.amazonaws.com"
                    },
                    "Effect": "Allow",
                    "Sid": ""
                }
            ]
        },
        "MaxSessionDuration": 3600,
        "RoleId": "<Role ID>",
        "CreateDate": "2015-10-13T15:06:34Z",
        "RoleName": "lambda_basic_execution",
        "Path": "/",
        "Arn": "arn:aws:iam::<Account ID>:role/lambda_basic_execution"
    }
}

If I remove declaring the role from the template, deployment works & then I can add the role manually via the console. I imagine this is a serverless issue.

A: As you mentioned that you have few lambdas which uses the same IAM role, I would suggest that you create an IAM role as part of your serverless.yml script. The benefit of this approach is that you can easily add or remove any permissions based on your future needs. You can do something like
  YourIAMRole:
     Type: AWS::IAM::Role
     Properties:
       AssumeRolePolicyDocument:
         Statement:
          - Effect: Allow
            Principal:
              Service: lambda.amazonaws.com
            Action: sts:AssumeRole

       Path: /
       ManagedPolicyArns:
       - arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole
       Policies:
         - # Any permission you want to add, For an example I am adding S3
          PolicyName: "resources_access"
          PolicyDocument:
            Version: "2012-10-17"
            Statement:
             -
              Effect: "Allow"
              Action: "s3:Get*"
              Resource: !Join
                - ''
                - - "arn:aws:s3:::"
                  - !Ref YourParameteredBucketName

Once you do that, you can assign this role to your function as follows:
 Role: !GetAtt YourIAMRole.Arn


text:
Q: Return many responses from a single ajax method in Rails I have to make an ajax request in Rails application. This ajax request has to make many other http requests to a few servers. There might be a lot of them (requests).
def ajax_request
  # request to the server1....
  # request to the server2....
  # request to the server3....
  # request to the server4....
  respond_to {|format| format.js }
end

The problem is, of course, it can take a lot of time. Note that each request returns an independent a part of a data which can be shown on a page and it doesn't depend on the other requests.
What I'd like to do is to return the data partially like this
def ajax_request
  # request to the server1....
  respond_to {|format| format.js }

  # request to the server2....
  respond_to {|format| format.js }

  # request to the server3....
  respond_to {|format| format.js }

  # request to the server4....
  respond_to {|format| format.js }
end

I know that it won't work, nevertheless I'm looking for a code that will work the way I mentioned. What would you recommend me?
Another option would be to send many ajax requests
def ajax_request1
  # request to the server1....
  respond_to {|format| format.js }
end

def ajax_request2
  # request to the server2....
  respond_to {|format| format.js }
end

def ajax_request3
  # request to the server3....
  respond_to {|format| format.js }
end

but it might hurt the performance of my server, isn't it?
Your thoughts?

A: 3 fast responses is better than 1 long one.
This is one of the reasons for pagination.
You can only have one response per request.
Rails 4 does support server sent events which would change that a little, but is not likely to be what you want.
It really ends up being a balance, if you have tons of requests instead of 1 then that would be bad, but if you are splitting up 1 request into 2 or 3 then that's great and may actually perform better.
In the case of tons of requests then instead of having several responses you would just need to store your data in ivars pass it on to your view to handle.
If you aren't doing blocking I/O here then you can also break these out into separate threads to improve response time... and if you are doing blocking I/O, and expect a lot of these types of requests then it maybe a good idea to look into using a Ruby implementation that does real threads (JRuby or Rubinius) instead of MRI.

A: Here's an idea using a cache server and background processing workers. For example let's assume Redis for caching and Resque for background processing, but you could also use memcached and backburner (beanstalkd) or anything else that serves the function.
When the initial request comes in, create a unique id for the request, possibly a GUID, and return that to the client as a JSON response. Use the GUID as a cache key (probably with some expiration time) to hold the results, and create one background task for each server you need to request data from. These background tasks should include any request parameters plus the GUID of the cache key.
Your resque workers can pull these tasks from the queue, run the requests, and put the responses as JSON into the redis/memcached cache store. If you have enough workers it can all be parallel, if not they'll all get done eventually, FIFO. Meanwhile the initial client can use long polling to request new results every 1-2 seconds. It may find no results, 1 new result, or several. Just need to keep track of which results are already seen, and when you have all the results. This way the user will see progressively more information come back, and you could even show percentages or "4 / 20 complete" type information.


text:
Q: An internal error occurred during: "Launching testng.xml" while running testng suite Environment details

*

*Eclipse Version: Oxygen.3a Release (4.7.3a)

*Project: maven project

*Testing Dependency Version: 6.14.3

*Testing Eclipse Plugin Version: 6.14.0.2

Problem - My initial version of testng was 6.14.3, then i tried to upgrade to the latest version 7.0.0-beta5,got some error.
Then I put dependency of 7.0.0-beta4 in pom file, there was no error in building and compilation.When I tried to run testng.xml file, I get following error.
Then I again put dependancy of 6.14.3 for testng and updated maven project, but stll getting same issue.
'Launching temp_testng.xml' has encountered a problem.
An internal error occurred during: "Launching temp_testng.xml".

plugin- org.eclipse.core.jobs
**Exception stack trace**

java.lang.AbstractMethodError: org.testng.eclipse.maven.MavenTestNGLaunchConfigurationProvider.getClasspath(Lorg/eclipse/debug/core/ILaunchConfiguration;)Ljava/util/List;
    at org.testng.eclipse.launch.TestNGLaunchConfigurationDelegate.getClasspath(TestNGLaunchConfigurationDelegate.java:350)
    at org.testng.eclipse.launch.TestNGLaunchConfigurationDelegate.createVMRunner(TestNGLaunchConfigurationDelegate.java:192)
    at org.testng.eclipse.launch.TestNGLaunchConfigurationDelegate.launchTypes(TestNGLaunchConfigurationDelegate.java:157)
    at org.testng.eclipse.launch.TestNGLaunchConfigurationDelegate.launch(TestNGLaunchConfigurationDelegate.java:91)
    at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:885)
    at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:739)
    at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:1039)
    at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1256)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:56)

Im my testng.xml file I am getting yellow mark at line .So is this causing above error while execution?
Tried following solutions to fix the above issue, but unable to resolve the issue.

*

*Re-installed TestNG plugin multiple times

*uninstalling of the optional M2E from TestNG plugin

*Project>Build path>Source>removed source folders and added again

*Cleaned .m2 repository and build/updated maven workspace again

*Created new workspace and sample testng project with only one class

*Re-installed eclipse

Struggling to resolve this error, If anyone knows how to fix this configuration issue Please Help!

A: Maven also has its own Testng plugin installed with it .Try to uninstall that and install tesng from eclipse marketplace it worked for me


text:
Q: Select Newest Instead of Distinct Currently I have a stored procedure that returns data from a database table that is populated from an API. The current query is:
Select *
From Inventory
where StockNumber in (select distinct stocknumber)
order by Make

Instead of this I actually need to take the top 1 newest record based on a DateTimeStamp column as there are often many records with the same stocknumber but different timestamp.

A: One method is to use a correlated subquery:
Select i.*
From Inventory i
where i.datetime in (select max(i2.datetime)
                     from Inventory i2
                     where i2.stocknumber = i.stocknumber
                    )
order by i.Make;

Another method is to use the ANSI standard window function row_number():
select i.*
from (select i.*,
             row_number() over (partition by stocknumber order by datetime desc) as seqnum
      from Inventory i
     ) i
where seqnum = 1;

A: Use INNER JOIN clause:
Select t1.* From Inventory t1
INNER JOIN (SELECT StockNumber, MAX(Make) AS Make FROM Inventory GROUP BY StockNumber) t2
ON t1.StockNumber = t2.StockNumber AND t1.Make = t2.Make