text:
Q: How can I show the 3D render with stereo? I just learned how to create 3D images with PyVista, but I got a problem when I wanted to show the image with stereo rendering. Here's the error code: vtkRenderWindow.cxx:267   WARN| vtkWin32OpenGLRenderWindow (0000018518100300): Adjusting stereo mode on a window that does not support stereo type CrystalEyes is not possible.
And here's my code
import pyvista as pv
pl = pv.Plotter()
_ = pl.add_mesh(pv.Cube())
pl.enable_stereo_render()
pl.show()

Maybe it's just a basic model rendered in 3D, but I cannot find the solution.

A: What you are calling an error is actually a warning:

vtkRenderWindow.cxx:267 WARN| vtkWin32OpenGLRenderWindow (0000018518100300): Adjusting stereo mode on a window that does not support stereo type CrystalEyes is not possible.

Note the "WARN" at the start, and the orange (rather than red) colour in case your shell can render that. Unless you are seeing issues with stereo rendering you can ignore this warning.
To elaborate on this a bit, it's not clear to me why you see the warning (I don't see it on my linux system with current PyVista and VTK). In PyVista calling enable_stereo_render() calls
ren_win.StereoRenderOn()
ren_win.SetStereoTypeToAnaglyph()

on the render window attached to the Plotter. It could happen that enabling stereo mode before choosing anaglyph type raises that warning, but vtkRenderWindow's default stereo type seems to be red-blue. This line of code in VTK seems to have been there for the past 27 years, although it's possible that some subclass changes the default to something else. There's also this vtkusers mailing list email from 2013 that mentions this warning appearing when someone accidentally enables stereo render, so it's plausible that the default stereo type (sometimes) ends up being Crystal Eyes.
You should only worry if your render doesn't end up with anaglyph stereo as designed. Here's what it should look like:

Note the green-red tinting around the edges of the cube, most prominently closest to the camera.
I've opened a pull request to replace the order of the two method calls, so that by the time we switch on stereo render it's guaranteed to go for anaglyph type.


text:
Q: ggplot + dplyr not stacking data correctly or removing data I'm trying to a stacked bar graph, and for some reason my bars are not stacking correctly. The stacks are out of order and the colors consolidated. I'm not really sure how to fix the problem
g12<-terror %>%
group_by(attacktype1_txt,iyear,nkillter) %>%
ggplot(aes(x=iyear,y=nkillter,fill=attacktype1_txt)) +
geom_bar(stat='identity',position='stack')  + xlab('Year of Attack') +
ylab('Number of Deaths')
g12=g12+ guides(fill=guide_legend(title="Attack Types"))
g12

or when I try and use the summarise function to make the bars stack correctly I get this oddity
g12<-terror %>%
group_by(attacktype1_txt,iyear,nkillter) %>% summarise(number=n()) %>%
ggplot(aes(x=iyear,y=nkillter,fill=attacktype1_txt)) +
geom_bar(stat='identity',position='stack')  + xlab('Year of Attack') +
ylab('Number of Deaths')
g12=g12+ guides(fill=guide_legend(title="Attack Types"))
g12

This results in this a graph that is correctly stacked, but as you can see by comparing the two that it has thrown out a lot of the data. Is there some function I could use that will still consolidate the data without throwing out data like summarise seems to be?

A: I think the first piece of code works. Granted, you can simplify it:
ggplot(terror, aes(iyear, nkillter)) +
geom_bar(aes(fill = attacktype1_txt), stat = "identity") +
    xlab('Year of Attack') + ylab('Number of Deaths') +
    guides(fill=guide_legend(title="Attack Types"))

But this seems to be a correct representation of the data, if I understand it correctly. Just to check ourselves, lets check 2015:
> (terror %>% select(iyear, attacktype1_txt, nkillter) %>%
              arrange(attacktype1_txt, nkillter) %>%
              filter(iyear==2015, nkillter > 0))
       iyear                     attacktype1_txt nkillter
    1   2015                       Armed Assault        1
    2   2015                       Armed Assault        1
    3   2015                       Armed Assault        1
    4   2015                       Armed Assault        1
    5   2015                       Armed Assault        1
    6   2015                       Armed Assault        2
    7   2015                   Bombing/Explosion        1
    8   2015                   Bombing/Explosion        1
    9   2015                   Bombing/Explosion        1
    10  2015                   Bombing/Explosion        1
    11  2015                   Bombing/Explosion        2
    12  2015 Hostage Taking (Barricade Incident)        1
    13  2015 Hostage Taking (Barricade Incident)        2
    14  2015         Hostage Taking (Kidnapping)        3

As depicted in the plot, we have 7 armed assault deaths, 6 bombing/explosion, 3 barricade and 3 kidnappings.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to select column based on monthwise condition I have a mysql table like below,
Test :

Id   start_Date    End Date      Points
1     01-01-2017    15-01-2017     4
2     01-02-2017    28-02-2017     5
3     16-01-2017    31-01-2017     5
4     01-03-2017    15-03-2017     3
5     16-03-2017    31-03-2017     4
6     01-04-2017    30-04-2017     5

In this i want to select the Points based on Quatarwise ( Jan - Mar, Apr - Jun, Jul - Sep , Oct  - Dec ).
I am trying the Following Query,
$q1 = "select sum(points) as point from Test where month(start_Date) Between '00' and '03' ";

    $q2 = "select sum(points) as point from Test where month(start_Date) Between '04' and '06' ";

    $q3 = "select sum(points) as point from Test where month(start_Date) Between '07' and '09' ";

    $q1 = "select sum(points) as point from Test where month(start_Date) Between '10' and '12' ";

i am  getting the correct result . but what i want is ,
If any month having 2 rows of records then that particular month of records have to add and divide into 2 and sum into remaining 2 months.
Ex :  Here jan month having 2 records ( 01 to 15 and  16 to 31 ) . so while getting the quarterwise result these 2 records want to add ( 4 + 5 = 9 ) and divide by 2 and take the points as  jan month same for all months and finally want to get the quarterwise points.
How to do this in Mysql .


text:
Q: Automatically use Timestamp in Laravel 5.4 Query builder is there any way to automatically use time-stamp when using query builder, currently I'm using CARBON.
here is my code:
DB::table('product_in_out')->insert(
                ['product_id'                   => $product_id,
                 'warehouse_id'                 => $warehouse_id,
                 'balance_before'               => Product::getProductBalanceOf($action_id, $product_id),
                 'in'                           => $product_qty,
                 'out'                          => '0',
                 'after_balance'                => Product::getProductBalanceOf($action_id, $product_id)+$product_qty,
                 'action'                       => 'ProcurementReceipt',
                 'action_id'                    => $action_id,
                 'created_by'                   => auth()->user()->id,
                 'updated_by'                   => auth()->user()->id,
                 'is_active'                    => '1',
                 'created_at'                   =>  \Carbon\Carbon::now(), # \Datetime()
                 'updated_at'                   => \Carbon\Carbon::now(),# \Datetime() ]

            );

A: Fields created_at and update_at are part of Eloquent.
You need to use Eloquent instead of query builder to insert and update the record in to database for automatic time handling. Eloquent will handle auto update of updated_at column for you,
here is the way,
If you have model name Product,
$product = new Product();
$product->column_name = $column_value;
....
...
$product->save();

Above code will add time stamp automatically at created_at and updated_at column.
Now use Eloquent to update your records like,
$product = Product::find($id);
$product->update_column_name = $update_value;
...
...
$product->update();

This will update your updated_at column value accordingly.
Hope you understand.

A: Use Laravel Macros:
https://medium.com/fattihkoca/laravel-auto-save-timestamps-with-query-builder-without-using-eloquent-123f7ebfeb92
It is wise to create a macro to avoid typing the same things every time.

*

*insertTs method inserting records into database with created_at data:

DB::table('users')->insertTs([
   'email' => 'john@example.com'
]);
$id = DB::table('users')->insertGetIdTs([
   'email' => 'john@example.com'
]);

*updateTs method updating records into database with updated_at data:

DB::table('users')
   ->where('id', 1)
   ->updateTs(['email' => 'john@example.com']);

*deleteTs method deleting records into database with deleted_at data (soft delete):

DB::table('users')
   ->where('id', 1)
   ->deleteTs();


text:
Q: How to copy/paste test steps in test case viewed in browser? If I am editing a test case using Microsoft Test Manager (2017), I can select a set of test steps and then copy and paste them into the same or a different test case.
Is it possible to do the same thing when editing the test case from the browser (TFS 2017)? If so, how?

A: There is an option "Edit Selected test cases in grid view" in the test case context menu, you can copy/paste test steps with the feature in browser.
But unfortunately the feature is missed in TFS 2017 Update1, So you cannot copy/paste the test steps by editing the test case from the browser if you are using TFS 2017 Update1.
As a workaround you can create a test case query, then open the query in Excel, then copy/paste test steps cross test cases, then publish the update.
Edit Selected test cases in grid view option is back in the latest TFS 2017 Update2. So, you can also upgrade to the latest TFS 2017 Update2, then edit case within the grid view.


text:
Q: JavaScript "document.getElementById().innerHTML" waits in loop I have a JS program which cycles through a list of words and sets the text of the

To the current item in the list. Here's my code:
const words = [
  "Amazing",
  "Simple",
  "Powerful",
  "Extensible",
  "Fast",
  "Lightweight",
  "Integrated",
  "Incredible",
];

let num = 0;

function infinite() {
  while (num < 1) {
    words.forEach((item) => {
      document.getElementById("changing").innerHTML = item;
    });
  }
}

How can I wait 1 second each time it changes the word? (also, this doesn't seem to do anything, so if you could help with that, that would be absolutely amazing)

A: You can do this with a little bit of recursion, and using the setTimeout function.
const words = ["Amazing", "Simple", "Powerful", "Extensible", "Fast", "Lightweight", "Integrated", "Incredible"];
function infinite(index) {
   if (index === words.length) {
       index = 0;
   }

   document.getElementById("changing").innerHTML = words[index];
   setTimeout(() => infinite(index + 1), 1000);
}

infinite(0);

Or you could use setInterval to acheive the same thing
const words = ["Amazing", "Simple", "Powerful", "Extensible", "Fast", "Lightweight", "Integrated", "Incredible"];

let index = 0;

function infinite() {
   if (index >= words.length) {
       index = 0;
   }

   document.getElementById("changing").innerHTML = words[index];
   index++;
}

setInterval(infinite, 1000);

With that specific implementation however, the index variable would be open to change from anything else in that scope. The setTimeout method encapsulates the index value so that it can't be changed externally.

A: There is a built-in javascript function called setInterval() which infinitely does a function in intervals of n in milliseconds. Applying this to your situation:

const words = ["Amazing", "Simple", "Powerful", "Extensible", "Fast", "Lightweight", "Integrated", "Incredible"];

var index = 0;
setInterval(() => {
  document.getElementById("changing").textContent = words[index];
  index = (index+1) % words.length;// If index becomes the last element, it will then go to the first element, making a loop
}, 1000); // 1000 ms = 1 s


text:
Q: Errno 13 Permission denied when python script called by php I am trying to open a file, which is present on network through python script. This is working fine when running python script through my windows command prompt:
python script.py \\jocker\linux\

import sys

filename =  sys.argv[1]+"notes\\details.txt"
try:
    f= open(filename,"r")
    for line in f:
        print (line)
except Exception as e:
    print (str(e))

But problem occurs when I calling this python file through php script,
<?php
$file = "\\\\jocker\linux\\";
$com='python ./script.py '.$file ;
$ret= system($com,$outp);

 [Errno 13] Permission denied. \\\\jocker\\linux\\notes\\details.txt

I am not getting: is there any permission issues or any problem with path?


text:
Q: Can't setup TwistPHP. File not found but it's right there I am trying to setup the TwistPHP framework for my new website, and I've run into a problem.
On their Getting Started page, you're told to paste the twist folder into root dir, then include the framework file in your index page. And to then run your site and follow the GUI wizard to set things up.
However, following the steps, all I get is a 404 Not Found error. I then decided to directly run the framework.php page and still, I got a 404.
My code is:
index.php:
<?php require_once 'twist/framework.php';

Why am I getting a 404 on a page that does exist, and how can I fix it?

Upon discovering the log file (it was a hidden file), I see that it logs two exceptions where it cannot find certain files. But this is how the framework was setup, so how am I supposed to fix it? This is a fresh untouched download. Nothing has been changed.
[2015-06-11 08:04:46] Warning: [2]
include_once(C:\Users\Jason\Documents\Visual Studio 2015\Projects\Royal Plaza\Royal Plaza\twist/modules//.gitignore/register.php):
failed to open stream: No such file or directory
[2015-06-11 08:04:46] Warning: [2]
include_once(): Failed opening 'C:\Users\Jason\Documents\Visual Studio 2015\Projects\Royal Plaza\Royal Plaza\twist/modules//.gitignore/register.php' for inclusion
(include_path='.;C:\php\pear')
[2015-06-11 08:04:46] Notice: [8] Undefined index: title
[2015-06-11 08:04:46] Notice: [8] Undefined index: title
[2015-06-11 08:04:46] Warning: [2] mkdir(): Invalid argument
[2015-06-11 08:04:46] Warning: [2] mkdir(): Invalid argument
[2015-06-11 08:04:46] Warning: [2] mkdir(): Invalid argument
[2015-06-11 08:04:46] Warning: [2] mkdir(): Invalid argument
[2015-06-11 08:04:46] Warning: [2] mkdir(): Invalid argument
[2015-06-11 08:04:46] Warning: [2] mkdir(): Invalid argument
[2015-06-11 08:04:46] Warning: [2] mkdir(): Invalid argument
[2015-06-11 08:04:46] Warning: [2]
file_put_contents(C:\Users\Jason\Documents\Visual Studio 2015\Projects\Royal Plaza\Royal Plaza/cache/pkgTemplate/\twist-core/templates//system/error-page.tpl.twi):
failed to open stream: No such file or directory

A: I am one of the creators of Twist. I'm sorry you are having problems setting up the framework. It sounds like a server configuration issue, but you also have a very old copy of the framework.
Check out the latest verion of TwistPHP (https://twistphp.com)
Enjoy!

A: TwistPHP 3 has now been released (https://twistphp.com) you should really consider using the new MVC version. It is faster, more reliable and has many new features over its predecessors.
However in answer to the question:
The register.php file warnings should not be causing any problems with the output of the setup wizard, the reason that the errors are present is that the framework thinks the .gitignore files are modules and is trying to include them.
.gitignore files are used to ensure that folders remain in a github repository even though they are empty. These files can be removed from live projects.

A: I have no idea why this works.

Running index.php or framework.php in the browser results in a 404 Not Found error.
But, if you close all files in Visual Studio, and ensure that only your Project Name is selected in Solution Explorer, then hit F5 (Debug), the Wizard will appear in the browser.


text:
Q: Read annotations of a typedef from Scala Macro Given a wrapper case class which has a set of values of which the types will be typedefs with annotations on them. I want to inspect the types to see whether the annotation is present and what the value is. This is so that I can create a macro that will construct an instance of my case class.
This should be enough code to see how far I've gotten:
class MyAnnotation(val value: String)

@MyAnnotation("some value")
type MyType = String

case class MyWrapper(myType: MyType)

// macro impl
def impl[T: c.WeakTypeTag](c: blackbox.Context): c.Expr[T] = {
    import c.universe._
    val tpe = weakTypeOf[T]
    val sym = tpe.typeSymbol.asClass
    val cSym = sym.companion
    val cTpe = cSym.typeSignature
    val apply = cTpe.member(TermName("apply")).asMethod
    val applyParamTypes = apply.paramLists.flatten.map(p => p.typeSignature)

    // now I have the types of the parameters to the case class companion object apply method, I want to look at the types (of which they will be typedefs), see if the MyAnnotation annotation is present, and pull out the MyAnnotation.value
}

I am using Scala 2.12


text:
Q: How to read a specific string from text file I just want to read the bottom line of the file (only bottom line ) and very selective string.
For example: file name is Test.txt and if content would be as below
2015/08/22 - disabled and path was //CN=Abhi\, O.T. (TJ),OU=NL,DC=abc,DC=com//
2015/09/12 - disabled and path was //CN=Abhi\, O.T. (TJ),OU=IN,DC=abc,DC=com//

then i would like to read the content in between "//" i.e.:
CN=Abhi\, O.T. (TJ),OU=IN,DC=abc,DC=com

could anyone help me on this
-Abhishek

A: If // are the last Characters in all the lines, The bellow code will help you.
[String]$LastLine=(Get-Content 'C:\StackOverFlow\bottomLine''.txt')[-1]
if($LastLine|Select-String '//' -Quiet)
{
    ($LastLine -split '//')[-1]
}

Here,
      The last line in the .txt file is taken using the output from the Get-Content cmdlet and by using the index number as '-1', we get the last value of that array.
Then the in the If statement, It'll check the presence of '//', If found it'll split the string by '//' and again selecting the last value using index '-1'  (assuming '//' is the last value for each line)
Regards,
Prasoon Karunan V


text:
Q: Boot file system partition at the begining of the hard drive My hard drive have Windows, Ubuntu and Debian installed. For some reason Debian is not showed in the grub list. If I use a bootable grub rescue software, it shows a message like this "Please create a boot partition greater than 200 Mb at the beginning of the disk". What is the size recommended for this partition? "greater than 200 Mb" is not particularly specific.
The beginning of the disk contains the Windows partition. I am afraid that creating a Linux made Boot partition could break Windows. Have somebody been previously in this situation?
   Model: ATA TOSHIBA-TR200 (scsi) Disk /dev/sdb: 240GB Sector size
    logical/physical): 512B/512B Partition Table: msdos Disk Flags:

Number  Start   End     Size    Type      File system     Flags
1     1049kB  86,8GB  86,8GB  primary   ntfs
4     86,8GB  240GB   153GB   extended
11    86,8GB  87,9GB  1081MB  logical   linux-swap(v1)
5     87,9GB  105GB   16,8GB  logical   ext4
6     105GB   116GB   11,8GB  logical   ext4
7     116GB   131GB   14,8GB  logical   ext4
8     131GB   147GB   15,5GB  logical   ext4
9     147GB   198GB   51,7    logical   ext4
10    198GB   240GB   41,6GB  logical   ext4


text:
Q: Erro: "error: array type 'int [tamanhoExcedente]' is not assignable" Ao tentar compilar o programa recebo a seguinte mensagem:

error: array type 'int [tamanhoExcedente]' is not assignable
maiorVetor = vetorII;
~~~~~~~~ ^
error: array type 'int [tamanhoExcedente]' is not assignable
maiorVetor = vetorI;
~~~~~~~~ ^

#include <stdio.h>

int main()
{
  int tamanhoI;
  int tamanhoII;
  int indice;
  int tamanho;
  int vetorSoma[tamanho];
  int tamanhoExcedente; //Se os vetores possuírem tamanhos diferentes, o tamanhoExcedente será o tamanho do maior vetor
  int maiorVetor[tamanhoExcedente];

  printf("\nDigite o tamanho do primeiro vetor\n(O valor do tamanho deve pertencer ao intervalo [1,20])\n");
  scanf("%d", &tamanhoI);

  printf("Digite o tamanho do segundo vetor\n(O valor do tamanho deve pertencer ao intervalo [1,20]\n");
  scanf("%d", &tamanhoII);

  int vetorI[tamanhoI];
  int vetorII[tamanhoII];

  while (tamanhoI >= 1 && tamanhoI <= 20 && tamanhoII >= 1 && tamanhoII <= 20)
  {
    if (tamanhoI < tamanhoII)
    {
      tamanho = tamanhoI;
      tamanhoExcedente = tamanhoII;
      maiorVetor = vetorII;
    }

    else if (tamanhoI > tamanhoII)
    {
      tamanho = tamanhoII;
      tamanhoExcedente = tamanhoI;
      maiorVetor = vetorI;
    }

    else
    {
      tamanho = tamanhoI; //Como neste caso os dois vetores possuem tamanhos iguais, *tamanho deve ser igual ao tamanho de qualquer um dos vetores
      tamanhoExcedente = tamanhoI;
    }

    for (indice = 0; indice < tamanho; indice++)
    {
      vetorSoma[indice] = (vetorI[indice] + vetorII[indice]);
    }

    for (indice = (tamanho); indice < (tamanhoExcedente); indice++)
    {
      vetorSoma[indice] = maiorVetor[indice];
    }

    printf("\nVetor Soma = {");

    for (indice = 1; indice < tamanhoExcedente; indice++)
    {
      printf("%d", vetorSoma[0]);
      printf(", %d", vetorSoma[indice]);
    }

    printf("}\n");

    return 0;
  }

  printf("ERRO\n O tamanho de um vetor excede o limite permitido!!!\n");

  return 0;
}

A: C só consegue copiar memória simples, para copiar um array precisa de uma função (na verdade todas linguagens são iguais, C só diferente que dá o poder de você fazer do jeito que desejar enquanto as outras fazem um padrão sem você ver). Então use memcpy().
memcpy(maiorVetor, vetorI);

Coloquei no GitHub para referência futura.
Mas talvez possa otimizar o código para nem precisar disto.


text:
Q: Landscaped longtable not showing the page as landscape I use the following, however the page does not come out as landscape and the first column title (ESG Features) is really odd, I would like it left aligned and ideally underlined if possible. To go over two pages with longtable would be great. I have not used longtable before, so I am not sure what I am doing wrong. Any help would be super!
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{lscape}
\usepackage{longtable}

\begin{document}

\begin{landscape}
\begingroup
    %\centering
    \renewcommand\arraystretch{.5}
    \setlength\tabcolsep{3pt}
    \tiny
    \begin{longtable}{llll}
        \caption {ESG features \\ This table reports the ESG features used in this study.}
        \toprule
            \thead[l]{ESG Features}  &  &  &  \\
            \addlinespace
                Accidental Spills & Eco-Design Products & Internal Carbon Pricing & Renewable Energy Produced \\
                Accidents Total & Electricity Produced & Internal Promotion & Renewable Energy Purchased \\
                Accounting Controversies & Electricity Purchased & ISO 14000 or EMS & Renewable Energy Use \\
                Advance Notice for Shareholder Proposals & Elimination of Cumulative Voting Rights & ISO 9000 & Renewable Energy Use Ratio \\
                Advance Notice Period Days & Embryonic Stem Cell Research & Labeled Wood & Renewable/Clean Energy Products \\
                Agrochemical 5 \% Revenue & Emissions Score & Land Environmental Impact Reduction & Resource Reduction Policy \\
                Agrochemical Products & Emissions Trading & Limitation of Director Liability & Resource Reduction Targets \\
                Alcohol & Employee Accidents & Limitations on Removal of Directors & Resource Use Score \\
                Animal Testing & Employee Engagement Voluntary Work & Limited Shareholder Rights to Call Meetings & Responsible Marketing Controversies \\
                Animal Testing Cosmetics & Employee Fatalities & Litigation Expenses & Retailing Responsibility \\
                Animal Testing Reduction & Employee Health  Safety Training Hours & Lobbying Contribution Amount & Salary Gap \\
                Announced Layoffs & Employee Lost Working Days & Lost Days To Total Days & Self-Reported Environmental Fines \\
                Announced Layoffs To Total Employees & Employee Resource Groups & Lost Time Injury Rate Contractors & Shareholder Approval Significant Transactions \\
                Anti Takeover Devices Above Two & Employee Satisfaction & Lost Time Injury Rate Employees & Shareholder Rights Policy \\
                Anti-competition Controversies & Employees Health  Safety Controversies & Lost Time Injury Rate Total & Shareholders Approval Stock Compensation Plan \\
                Anti-Competition Controversies Count & Employees Health  Safety OHSAS 18001 & Lost Working Days & Shareholders Score \\
                Anti-Personnel Landmines & Employees Health  Safety Team & Management Departures & Shareholders Vote on Executive Pay \\
                Armaments & Employees With Disabilities & Management Score & Six Sigma and Quality Mgt Systems \\
                Audit Board Committee & EMS Certified Percent & Management Training & Social Pillar Score \\
                Audit Committee Expertise & Energy Produced Direct & Minimum Number of Shares to Vote & SOx Emissions \\
                Audit Committee Independence & Energy Purchased Direct & Net Employment Creation & Staff Transportation Impact Reduction \\
                Audit Committee Mgt Independence & Energy Use Total & New Women Employees & Staggered Board Structure \\
                Audit Committee NonExecutive Members & Env Supply Chain Partnership Termination & Noise Reduction & Stakeholder Engagement \\
                Auditor Tenure & Environment Management Team & Nomination Board Committee & State Owned Enterprise SOE \\
                Average Board Tenure & Environment Management Training & Nomination Committee Independence & Strictly Independent Board Members \\
                Average Training Hours & Environment Pillar Score & Nomination Committee Involvement & Strikes \\
                Biodiversity Impact Reduction & Environmental Assets Under Mgt & Nomination Committee Mgt Independence & Succession Plan \\
                Board Attendance & Environmental Controversies & Nomination Committee NonExecutive Members & Supermajority Vote Requirement \\
                Board Background and Skills & Environmental Expenditures & Non-audit to Audit Fees Ratio & Supplier ESG training \\
                Board Cultural Diversity, Percent & Environmental Expenditures Investments & Non-Executive Board Members & Supply Chain Health  Safety Improvements \\
                Board Functions Policy & Environmental Innovation Score & Non-Hazardous Waste & Supply Chain Health  Safety Training \\
                Board Gender Diversity, Percent & Environmental Investments Initiatives & NOx and SOx Emissions Reduction & Sustainability Compensation Incentives \\
                Board Individual Re-election & Environmental Materials Sourcing & NOx Emissions & Sustainable Building Products \\
                Board Meeting Attendance Average & Environmental Partnerships & Nuclear & Take-back and Recycling Initiatives \\
                Board Member Affiliations & Environmental Products & Number of Board Meetings & Targets Diversity and Opportunity \\
                Board Member Compensation & Environmental Project Financing & Number of Employees~ from CSR reporting & Targets Emissions \\
                Board Member LT Compensation Incentives & Environmental Provisions & Obesity Risk & Targets Energy Efficiency \\
                Board Member Membership Limits & Environmental Restoration Initiatives & Occupational Diseases & Targets Water Efficiency \\
                Board Member Term Duration & Environmental Supply Chain Management & OECD Guidelines for Multinational Enterprises & Tobacco \\
                Board Size & Environmental Supply Chain Monitoring & Organic Products Initiatives & Total CO2 Equivalent Emissions To Revenues USD \\
                Board Size More Ten Less Eight & Equal Shareholder Rights & Ozone-Depleting Substances & Total Donations To Revenues \\
                Board Specific Skills, Percent & Equator Principles & Particulate Matter Emissions Reduction & Total Energy Use To Revenues USD \\
                Board Structure Policy & ESG Combined Score & Poison Pill & Total Hazardous Waste To Revenues USD \\
                Board Structure Type & ESG Controversies Score & Policy Board Diversity & Total Injury Rate Employees \\
                Bribery, Corruption and Fraud Controversies & ESG Reporting Scope & Policy Board Experience & Total Injury Rate Total \\
                Business Ethics Controversies & ESG Score & Policy Board Independence & Total Senior Executives Compensation \\
                CEO Board Member & Estimated CO2 Equivalents Emission Total & Policy Board Size & Total Waste To Revenues USD \\
                CEO Compensation Link to TSR & Ethical Trading Initiative ETI & Policy Bribery and Corruption & Toxic Chemicals Reduction \\
                CEO-Chairman Separation & Executive Compensation Controversies & Policy Business Ethics & Trade Union Representation \\
                Chairman is ex-CEO & Executive Compensation LT Objectives & Policy Career Development & Training and Development Policy \\
                Classified Board Structure & Executive Compensation Policy & Policy Child Labor & Training Costs Per Employee \\
                Climate Change Commercial Risks Opportunities & Executive Individual Compensation & Policy Community Involvement & Training Costs Total \\
                Cluster Bombs & Executive Members Gender Diversity, Percent & Policy Customer Health  Safety & Training Hours Total \\
                CO2 Equivalent Emissions Direct, Scope 1 & Executives Cultural Diversity & Policy Data Privacy & TRDIR Controversies Score \\
                CO2 Equivalent Emissions Indirect, Scope 2 & External Consultants & Policy Diversity and Opportunity & TRDIR Diversity Score \\
                CO2 Equivalent Emissions Indirect, Scope 3 & Extractive Industries Transparency Initiative & Policy Emissions & TRDIR Inclusion Score \\
                CO2 Equivalent Emissions Total & Fair Price Provision & Policy Employee Health  Safety & TRDIR People Development Score \\
                CO2 Estimation Method & Firearms & Policy Energy Efficiency & TRDIR Score \\
                Committee Meetings Attendance Average & Flexible Working Hours & Policy Environmental Supply Chain & Turnover of Employees \\
                Community Score & Fossil Fuel Divestment Policy & Policy Equal Voting Right & Unlimited Authorized Capital or Blank Check \\
                Company Cross Shareholding & Fresh Water Withdrawal Total & Policy Executive Compensation ESG Performance & UNPRI Signatory \\
                Compensation Board Committee & Fundamental Human Rights ILO UN & Policy Executive Compensation Performance & Veto Power or Golden share \\
                Compensation Committee Independence & Gambling & Policy Executive Retention & VOC Emissions \\
                Compensation Committee Mgt Independence & Global Compact Signatory & Policy Fair Competition & VOC Emissions Reduction \\
                Compensation Committee NonExecutive Members & GMO Products & Policy Fair Trade & VOC or Particulate Matter Emissions Reduction \\
                Compensation Improvement Tools & Golden Parachute & Policy Forced Labor & Voting Cap \\
                Confidential Voting Policy & Governance Pillar Score & Policy Freedom of Association & Voting Cap Percentage \\
                Consumer Complaints Controversies & Green Buildings & Policy Human Rights & Wages Working Condition Controversies \\
                Consumer Complaints Controversies Count & GRI Report Guidelines & Policy Responsible Marketing & Wages Working Condition Controversies Count \\
                Contraceptives & Hazardous Waste & Policy Shareholder Engagement & Waste Recycled To Total Waste \\
                Contractor Fatalities & Health  Safety Policy & Policy Skills Training & Waste Recycled Total \\
                Corporate Governance Board Committee & Health  Safety Training & Policy Supply Chain Health  Safety & Waste Recycling Ratio \\
                Corporate Responsibility Awards & Healthy Food or Products & Policy Sustainable Packaging & Waste Reduction Initiatives \\
                Crisis Management Systems & Highest Remuneration Package & Policy Water Efficiency & Waste Total \\
                CSR Strategy Score & HIV-AIDS Program & Political Contributions & Water Discharged \\
                CSR Sustainability Committee & HRC Corporate Equality Index & Pornography & Water Pollutant Emissions \\
                CSR Sustainability External Audit & Human Rights Breaches Contractor & Pre-emptive Rights & Water Pollutant Emissions To Revenues USD \\
                CSR Sustainability Report Global Activities & Human Rights Contractor & Product Access Low Price & Water Recycled \\
                CSR Sustainability Reporting & Human Rights Policy & Product Environmental Responsible Use & Water Technologies \\
                Customer Satisfaction & Human Rights Score & Product Impact Minimization & Water Use To Revenues USD \\
                Day Care Services & Hybrid Vehicles & Product Quality Controversies & Water Withdrawal Total \\
                Different Voting Right Share & Improvement Tools Business Ethics & Product Recall & Whistleblower Protection \\
                Director Election Majority Requirement & Independent Board Members & Product Responsibility Monitoring & Women Employees \\
                Diseases of the Developing World & Injuries To Million Hours & Product Responsibility Score & Women Managers \\
                Diversity and Opportunity Controversies & Insider Dealings Controversies & Product Sales at Discount to Emerging Markets & Workforce Score \\
                Donations Total & Integrated Strategy in MDA & Profit Warnings & Written Consent Requirements \\
                e-Waste Reduction & Intellectual Property Controversies & Public Availability Corporate Statutes &  \\
                Earnings Restatement & Internal Audit Department Reporting & Quality Mgt Systems \\
            \bottomrule
        \end{longtable}
\endgroup
    \end{landscape}

\end{document}

A: Since your table is not really a table but more a list, I suggest using an itemize environment. In order to save space, I placed the itemize inside of a multicols environment. If you also adjust the spacing of tie itemize list, as well as the font size to \small, the whole list fits onto a total of 4 pages while still being at a readable font size.
(Unrelated, but I also used \ch from chemformula in order to get the correct subscript "2" in CO2)

\documentclass{article}

\usepackage{pdflscape}
\usepackage{enumitem}
\usepackage{multicol}
\usepackage{chemformula}
\begin{document}

\begin{multicols}{2}
\small
\begin{itemize}[nosep,leftmargin=*,labelsep=3pt]
\item  Accidental Spills
\item  Accidents Total
\item  Accounting Controversies
\item  Advance Notice for Shareholder Proposals
\item  Advance Notice Period Days
\item  Agrochemical 5 \% Revenue
\item  Agrochemical Products
\item  Alcohol
\item  Animal Testing
\item  Animal Testing Cosmetics
\item  Animal Testing Reduction
\item  Announced Layoffs
\item  Announced Layoffs To Total Employees
\item  Anti Takeover Devices Above Two
\item  Anti-competition Controversies
\item  Anti-Competition Controversies Count
\item  Anti-Personnel Landmines
\item  Armaments
\item  Audit Board Committee
\item  Audit Committee Expertise
\item  Audit Committee Independence
\item  Audit Committee Mgt Independence
\item  Audit Committee NonExecutive Members
\item  Auditor Tenure
\item  Average Board Tenure
\item  Average Training Hours
\item  Biodiversity Impact Reduction
\item  Board Attendance
\item  Board Background and Skills
\item  Board Cultural Diversity, Percent
\item  Board Functions Policy
\item  Board Gender Diversity, Percent
\item  Board Individual Re-election
\item  Board Meeting Attendance Average
\item  Board Member Affiliations
\item  Board Member Compensation
\item  Board Member LT Compensation Incentives
\item  Board Member Membership Limits
\item  Board Member Term Duration
\item  Board Size
\item  Board Size More Ten Less Eight
\item  Board Specific Skills, Percent
\item  Board Structure Policy
\item  Board Structure Type
\item  Bribery, Corruption and Fraud Controversies
\item  Business Ethics Controversies
\item  CEO Board Member
\item  CEO Compensation Link to TSR
\item  CEO-Chairman Separation
\item  Chairman is ex-CEO
\item  Classified Board Structure
\item  Climate Change Commercial Risks Opportunities
\item  Cluster Bombs
\item  \ch{CO2} Equivalent Emissions Direct, Scope 1
\item  \ch{CO2} Equivalent Emissions Indirect, Scope 2
\item  \ch{CO2} Equivalent Emissions Indirect, Scope 3
\item  \ch{CO2} Equivalent Emissions Total
\item  \ch{CO2} Estimation Method
\item  Committee Meetings Attendance Average
\item  Community Score
\item  Company Cross Shareholding
\item  Compensation Board Committee
\item  Compensation Committee Independence
\item  Compensation Committee Mgt Independence
\item  Compensation Committee NonExecutive Members
\item  Compensation Improvement Tools
\item  Confidential Voting Policy
\item  Consumer Complaints Controversies
\item  Consumer Complaints Controversies Count
\item  Contraceptives
\item  Contractor Fatalities
\item  Corporate Governance Board Committee
\item  Corporate Responsibility Awards
\item  Crisis Management Systems
\item  CSR Strategy Score
\item  CSR Sustainability Committee
\item  CSR Sustainability External Audit
\item  CSR Sustainability Report Global Activities
\item  CSR Sustainability Reporting
\item  Customer Satisfaction
\item  Day Care Services
\item  Different Voting Right Share
\item  Director Election Majority Requirement
\item  Diseases of the Developing World
\item  Diversity and Opportunity Controversies
\item  Donations Total
\item  e-Waste Reduction
\item  Earnings Restatement
\item  Eco-Design Products
\item  Electricity Produced
\item  Electricity Purchased
\item  Elimination of Cumulative Voting Rights
\item  Embryonic Stem Cell Research
\item  Emissions Score
\item  Emissions Trading
\item  Employee Accidents
\item  Employee Engagement Voluntary Work
\item  Employee Fatalities
\item  Employee Health  Safety Training Hours
\item  Employee Lost Working Days
\item  Employee Resource Groups
\item  Employee Satisfaction
\item  Employees Health  Safety Controversies
\item  Employees Health  Safety OHSAS 18001
\item  Employees Health  Safety Team
\item  Employees With Disabilities
\item  EMS Certified Percent
\item  Energy Produced Direct
\item  Energy Purchased Direct
\item  Energy Use Total
\item  Env Supply Chain Partnership Termination
\item  Environment Management Team
\item  Environment Management Training
\item  Environment Pillar Score
\item  Environmental Assets Under Mgt
\item  Environmental Controversies
\item  Environmental Expenditures
\item  Environmental Expenditures Investments
\item  Environmental Innovation Score
\item  Environmental Investments Initiatives
\item  Environmental Materials Sourcing
\item  Environmental Partnerships
\item  Environmental Products
\item  Environmental Project Financing
\item  Environmental Provisions
\item  Environmental Restoration Initiatives
\item  Environmental Supply Chain Management
\item  Environmental Supply Chain Monitoring
\item  Equal Shareholder Rights
\item  Equator Principles
\item  ESG Combined Score
\item  ESG Controversies Score
\item  ESG Reporting Scope
\item  ESG Score
\item  Estimated \ch{CO2} Equivalents Emission Total
\item  Ethical Trading Initiative ETI
\item  Executive Compensation Controversies
\item  Executive Compensation LT Objectives
\item  Executive Compensation Policy
\item  Executive Individual Compensation
\item  Executive Members Gender Diversity, Percent
\item  Executives Cultural Diversity
\item  External Consultants
\item  Extractive Industries Transparency Initiative
\item  Fair Price Provision
\item  Firearms
\item  Flexible Working Hours
\item  Fossil Fuel Divestment Policy
\item  Fresh Water Withdrawal Total
\item  Fundamental Human Rights ILO UN
\item  Gambling
\item  Global Compact Signatory
\item  GMO Products
\item  Golden Parachute
\item  Governance Pillar Score
\item  Green Buildings
\item  GRI Report Guidelines
\item  Hazardous Waste
\item  Health  Safety Policy
\item  Health  Safety Training
\item  Healthy Food or Products
\item  Highest Remuneration Package
\item  HIV-AIDS Program
\item  HRC Corporate Equality Index
\item  Human Rights Breaches Contractor
\item  Human Rights Contractor
\item  Human Rights Policy
\item  Human Rights Score
\item  Hybrid Vehicles
\item  Improvement Tools Business Ethics
\item  Independent Board Members
\item  Injuries To Million Hours
\item  Insider Dealings Controversies
\item  Integrated Strategy in MDA  Profit Warnings
\item  Intellectual Property Controversies
\item  Internal Audit Department Reporting
\item  Internal Carbon Pricing
\item  Internal Promotion
\item  ISO 14000 or EMS
\item  Lost Time Injury Rate Contractors
\item  Labeled Wood
\item  Land Environmental Impact Reduction
\item  Limitation of Director Liability
\item  Limitations on Removal of Directors
\item  Limited Shareholder Rights to Call Meetings
\item  Litigation Expenses
\item  Lobbying Contribution Amount
\item  Lost Days To Total Days
\item  Lost Time Injury Rate Contractors
\item  Lost Time Injury Rate Employees
\item  Lost Time Injury Rate Total
\item  Lost Working Days
\item  Management Departures
\item  Management Score
\item  Management Training
\item  Minimum Number of Shares to Vote
\item  Net Employment Creation
\item  New Women Employees
\item  Noise Reduction
\item  Nomination Board Committee
\item  Nomination Committee Independence
\item  Nomination Committee Involvement
\item  Nomination Committee Mgt Independence
\item  Nomination Committee NonExecutive Members
\item  Non-audit to Audit Fees Ratio
\item  Non-Executive Board Members
\item  Non-Hazardous Waste
\item  NOx and SOx Emissions Reduction
\item  NOx Emissions
\item  Nuclear
\item  Number of Board Meetings
\item  Number of Employees from CSR reporting
\item  Obesity Risk
\item  Occupational Diseases
\item  OECD Guidelines for Multinational Enterprises
\item  Organic Products Initiatives
\item  Ozone-Depleting Substances
\item  Particulate Matter Emissions Reduction
\item  Poison Pill
\item  Policy Board Diversity
\item  Policy Board Experience
\item  Policy Board Independence
\item  Policy Board Size
\item  Policy Bribery and Corruption
\item  Policy Business Ethics
\item  Policy Career Development
\item  Policy Child Labor
\item  Policy Community Involvement
\item  Policy Customer Health  Safety
\item  Policy Data Privacy
\item  Policy Diversity and Opportunity
\item  Policy Emissions
\item  Policy Employee Health  Safety
\item  Policy Energy Efficiency
\item  Policy Environmental Supply Chain
\item  Policy Equal Voting Right
\item  Policy Executive Compensation ESG Performance
\item  Policy Executive Compensation Performance
\item  Policy Executive Retention
\item  Policy Fair Competition
\item  Policy Fair Trade
\item  Policy Forced Labor
\item  Policy Freedom of Association
\item  Policy Human Rights
\item  Policy Responsible Marketing
\item  Policy Shareholder Engagement
\item  Policy Skills Training
\item  Policy Supply Chain Health  Safety
\item  Policy Sustainable Packaging
\item  Policy Water Efficiency
\item  Political Contributions
\item  Pornography
\item  Pre-emptive Rights
\item  Product Access Low Price
\item  Product Environmental Responsible Use
\item  Product Impact Minimization
\item  Product Quality Controversies
\item  Product Recall
\item  Product Responsibility Monitoring
\item  Product Responsibility Score
\item  Product Sales at Discount to Emerging Markets
\item  Written Consent Requirements
\item  Public Availability Corporate Statutes
\item  Quality Mgt Systems
\item  Renewable Energy Produced
\item  Renewable Energy Purchased
\item  Renewable Energy Use
\item  Shareholder Approval Significant Transactions
\item  Renewable/Clean Energy Products
\item  Resource Reduction Policy
\item  Resource Reduction Targets
\item  Resource Use Score
\item  Responsible Marketing Controversies
\item  Retailing Responsibility
\item  Salary Gap
\item  Self-Reported Environmental Fines
\item  Shareholder Approval Significant Transactions
\item  Shareholder Rights Policy
\item  Shareholders Approval Stock Compensation Plan
\item  Shareholders Score
\item  Shareholders Vote on Executive Pay
\item  Six Sigma and Quality Mgt Systems
\item  Social Pillar Score
\item  SOx Emissions
\item  Staff Transportation Impact Reduction
\item  Staggered Board Structure
\item  Stakeholder Engagement
\item  State Owned Enterprise SOE
\item  Strictly Independent Board Members
\item  Strikes
\item  Succession Plan
\item  Supermajority Vote Requirement
\item  Supplier ESG training
\item  Supply Chain Health  Safety Improvements
\item  Supply Chain Health  Safety Training
\item  Sustainability Compensation Incentives
\item  Sustainable Building Products
\item  Take-back and Recycling Initiatives
\item  Targets Diversity and Opportunity
\item  Targets Emissions
\item  Targets Energy Efficiency
\item  Targets Water Efficiency
\item  Tobacco
\item  Total \ch{CO2} Equivalent Emissions To Revenues USD
\item  Total Donations To Revenues
\item  Total Energy Use To Revenues USD
\item  Total Hazardous Waste To Revenues USD
\item  Total Injury Rate Employees
\item  Total Injury Rate Total
\item  Total Senior Executives Compensation
\item  Total Waste To Revenues USD
\item  Toxic Chemicals Reduction
\item  Trade Union Representation
\item  Training and Development Policy
\item  Training Costs Per Employee
\item  Training Costs Total
\item  Training Hours Total
\item  TRDIR Controversies Score
\item  TRDIR Diversity Score
\item  TRDIR Inclusion Score
\item  TRDIR People Development Score
\item  TRDIR Score
\item  Turnover of Employees
\item  Unlimited Authorized Capital or Blank Check
\item  UNPRI Signatory
\item  Veto Power or Golden share
\item  VOC Emissions
\item  VOC Emissions Reduction
\item  VOC or Particulate Matter Emissions Reduction
\item  Voting Cap
\item  Voting Cap Percentage
\item  Wages Working Condition Controversies
\item  Wages Working Condition Controversies Count
\item  Waste Recycled To Total Waste
\item  Waste Recycled Total
\item  Waste Recycling Ratio
\item  Waste Reduction Initiatives
\item  Waste Total
\item  Water Discharged
\item  Water Pollutant Emissions
\item  Water Pollutant Emissions To Revenues USD
\item  Water Recycled
\item  Water Technologies
\item  Water Use To Revenues USD
\item  Water Withdrawal Total
\item  Whistleblower Protection
\item  Women Employees
\item  Women Managers
\item  Workforce Score

\end{itemize}
\end{multicols}

\end{document}

Update: Here is a suggestion using a 4 column list, \footnotesize text and smaller margins in order to fit all contents onto two pages. I also added the caption using the \captionof command from the caption package. (The following MWE is shortened due to character limit in posts on this site.)

\documentclass{article}
\usepackage[pass]{geometry}
\usepackage{pdflscape}
\usepackage{enumitem}
\usepackage{multicol}
\usepackage{chemformula}
\usepackage{caption}
\usepackage{booktabs}

\usepackage{lipsum}
\begin{document}
\lipsum
\newgeometry{margin=2.25cm}
\begingroup

\captionof{table}{This table reports the ESG features used in this study.}

\hrule
\footnotesize
\raggedright
\begin{multicols}{4}
\begin{itemize}[nosep,leftmargin=*,labelsep=3pt]
\item  Accidental Spills
\item  Accidents Total
\item  Accounting Controversies
\item  Advance Notice for Shareholder Proposals
\item  Advance Notice Period Days
\item  Agrochemical 5 \% Revenue
\item  Agrochemical Products
\item  Alcohol
\item  Animal Testing
\item  Animal Testing Cosmetics
\item  Animal Testing Reduction
\item  Announced Layoffs
\item  Announced Layoffs To Total Employees
\item  Anti Takeover Devices Above Two
\item  Anti-competition Controversies
\item  Anti-Competition Controversies Count
\item  Anti-Personnel Landmines
\item  Armaments
\item  Audit Board Committee
\item  Audit Committee Expertise
\item  Audit Committee Independence
\item  Audit Committee Mgt Independence
\item  Audit Committee NonExecutive Members
\item  Auditor Tenure
\item  Average Board Tenure
\item  Average Training Hours
\item  Biodiversity Impact Reduction
\item  Board Attendance
\item  Board Background and Skills
\item  Board Cultural Diversity, Percent
\item  Board Functions Policy
\item  Board Gender Diversity, Percent
\item  Board Individual Re-election
\item  Board Meeting Attendance Average
\item  Board Member Affiliations
\item  Board Member Compensation
\item  Board Member LT Compensation Incentives
\item  Board Member Membership Limits
\item  Board Member Term Duration
\item  Board Size
\item  Board Size More Ten Less Eight
\item  Board Specific Skills, Percent
\item  Board Structure Policy
\item  Board Structure Type
\item  Bribery, Corruption and Fraud Controversies
\item  Business Ethics Controversies
\item  CEO Board Member
\item  CEO Compensation Link to TSR
\item  CEO-Chairman Separation
\item  Chairman is ex-CEO
\item  Classified Board Structure
\item  Climate Change Commercial Risks Opportunities
\item  Cluster Bombs
\item  \ch{CO2} Equivalent Emissions Direct, Scope 1
\item  \ch{CO2} Equivalent Emissions Indirect, Scope 2
\item  \ch{CO2} Equivalent Emissions Indirect, Scope 3
\item  \ch{CO2} Equivalent Emissions Total
\item  \ch{CO2} Estimation Method
\item  Committee Meetings Attendance Average
\item  Community Score
\item  Company Cross Shareholding
\item  Compensation Board Committee
\item  Compensation Committee Independence
\item  Compensation Committee Mgt Independence
\item  Compensation Committee NonExecutive Members
\item  Compensation Improvement Tools
\item  Confidential Voting Policy
\item  Consumer Complaints Controversies
\item  Consumer Complaints Controversies Count
\item  Contraceptives
\item  Contractor Fatalities
\item  Corporate Governance Board Committee
\item  Corporate Responsibility Awards
\item  Crisis Management Systems
\item  CSR Strategy Score
\item  CSR Sustainability Committee
\item  CSR Sustainability External Audit
\item  CSR Sustainability Report Global Activities
\item  CSR Sustainability Reporting
\item  Customer Satisfaction
\item  Day Care Services
\item  Different Voting Right Share
\item  Director Election Majority Requirement
\item  Diseases of the Developing World
\item  Diversity and Opportunity Controversies
\item  Donations Total
\item  e-Waste Reduction
\item  Earnings Restatement
\item  Eco-Design Products
\item  Electricity Produced
\item  Electricity Purchased
\item  Elimination of Cumulative Voting Rights
\item  Embryonic Stem Cell Research
\item  Emissions Score
\item  Emissions Trading
\item  Employee Accidents
\item  Employee Engagement Voluntary Work
\item  Employee Fatalities
\item  Employee Health  Safety Training Hours
\item  Employee Lost Working Days
\item  Employee Resource Groups
\item  Employee Satisfaction
\item  Employees Health  Safety Controversies
\item  Employees Health  Safety OHSAS 18001
\item  Employees Health  Safety Team
\item  Employees With Disabilities
\item  EMS Certified Percent
\item  Energy Produced Direct
\item  Energy Purchased Direct
\item  Energy Use Total
\item  Env Supply Chain Partnership Termination
\item  Environment Management Team
\item  Environment Management Training
\item  Environment Pillar Score
\item  Environmental Assets Under Mgt
\item  Environmental Controversies
\item  Environmental Expenditures
\item  Environmental Expenditures Investments
\item  Environmental Innovation Score
\item  Environmental Investments Initiatives
\item  Environmental Materials Sourcing
\item  Environmental Partnerships
\item  Environmental Products
\item  Environmental Project Financing
\item  Environmental Provisions
\item  Environmental Restoration Initiatives
\item  Environmental Supply Chain Management
\item  Environmental Supply Chain Monitoring
\item  Equal Shareholder Rights
\item  Equator Principles
\item  ESG Combined Score
\item  ESG Controversies Score
\item  ESG Reporting Scope
\end{itemize}
\end{multicols}
\hrule
\clearpage
\endgroup
\restoregeometry

\lipsum

\end{document}


text:
Q: reviews extraction based on given links from csv data python? I am a very newbie in python. I want to extract all reviews details of each hotel based on given links from csv file, named hotel_FortWorth.csv, there are 3 columns: order, name, link.
hotel_FortWorth.csv example:
     name            link

1   Crockett Hotel            https://www.tripadvisor.com.au/Hotel_Review-g60956-d553469-Reviews-Crockett_Hotel-San_Antonio_Texas.html
2   La Cantera Resort & Spa   https://www.tripadvisor.com.au/Hotel_Review-g60956-d108571-Reviews-La_Cantera_Resort_Spa-San_Antonio_Texas.html
3   .....
4....

I got error at thepage = urllib.request.urlopen(url). Someone please help me in this issue. I highly appreciate this.
data = pd.read_csv('hotel_FortWorth.csv', header = None)
df = data[2]

for url in df:
  print(url)
  thepage = urllib.request.urlopen(url)
  soup = BeautifulSoup(thepage, "html.parser")
  while True:
    a = b = 0
    overallRatingarray = seeAllReviewsarray =  rankarray = hotelarray = ""

    for profile in soup.findAll(attrs={"class": "overview_card"}):
        image = profile.text.replace("\n", "|||||").strip()
        if image.find("rating") > 0:
            counter = image.split("rating", 1)[0].split("|", 1)[1][-4].replace("|", "").strip()
            if len(overallRatingarray) == 0:
                overallRatingarray = [counter]
            else:
                overallRatingarray.append(counter)

The error was:
 Traceback (most recent call last):
 File "E:/LA TROBE SUBJECTS/Python/testing.py", line 33, in <module>
counter = image.split("rating", 1)[0].split("|", 1)[1][-4].replace("|", "").strip()
IndexError: list index out of range

Process finished with exit code 1

A: An example of requests, see http://docs.python-requests.org/en/master/ for more.
import requests
import pandas as pd
from bs4 import BeautifulSoup

def main():
    data = pd.read_csv("hotel_FortWorth.csv", header=None)
    df = data[2]

    for url in df:
        print(url)
        thepage = requests.get(url).text
        soup = BeautifulSoup(thepage, "html.parser")
        print(soup)
        ...

if __name__ == '__main__':
    main()


text:
Q: Binary XML file line #14: Error inflating class com.google.android.gms.ads.AdView Getting this error working with the AdView class. What is the problem? I've tried Order & Export, closing and reopening Eclipse, and pretty much every suggestion I could find on the net. Nothing worked so I'm here.
Line 14 of the XML file is:
<com.google.android.gms.ads.AdView

Here is said XML file for the activity that contains the AdView (That's not my actual id) :
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:ads= "http://schemas.android.com/apk/res-auto"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal"
        android:orientation="horizontal"
        android:paddingBottom="@dimen/activity_vertical_margin"
        android:paddingLeft="@dimen/activity_horizontal_margin"
        android:paddingRight="@dimen/activity_horizontal_margin"
        android:paddingTop="@dimen/activity_vertical_margin"
        tools:context=".SearchActivity" >

    <com.google.android.gms.ads.AdView
        android:id = "@+id/adView"
        xmlns:ads="http://schemas.android.com/apk/libs/com.google.ads"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        ads:adSize="MEDIUM_RECTANGLE"
        ads:adUnitId="pub-1234567891234567" >
    </com.google.android.gms.ads.AdView>

    <ListView
        android:id="@+id/list"
        android:layout_width="248dp"
        android:layout_height="392dp"
        android:layout_marginTop="30dp" >
    </ListView>

    <TextView
        android:layout_width="200dp"
        android:layout_height="18dp"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:text="Search results"/>

</RelativeLayout>

And here is the logcat:
05-18 16:00:00.233: I/Process(6997): Sending signal. PID: 6997 SIG: 9
05-18 16:03:29.038: I/dalvikvm(7141): Could not find method android.content.pm.PackageManager.getActivityLogo, referenced from method android.support.v7.internal.widget.ActionBarView.<init>
05-18 16:03:29.038: W/dalvikvm(7141): VFY: unable to resolve virtual method 511: Landroid/content/pm/PackageManager;.getActivityLogo (Landroid/content/ComponentName;)Landroid/graphics/drawable/Drawable;
05-18 16:03:29.038: D/dalvikvm(7141): VFY: replacing opcode 0x6e at 0x008b
05-18 16:03:29.038: I/dalvikvm(7141): Could not find method android.content.pm.ApplicationInfo.loadLogo, referenced from method android.support.v7.internal.widget.ActionBarView.<init>
05-18 16:03:29.038: W/dalvikvm(7141): VFY: unable to resolve virtual method 504: Landroid/content/pm/ApplicationInfo;.loadLogo (Landroid/content/pm/PackageManager;)Landroid/graphics/drawable/Drawable;
05-18 16:03:29.038: D/dalvikvm(7141): VFY: replacing opcode 0x6e at 0x0099
05-18 16:03:29.042: D/dalvikvm(7141): VFY: dead code 0x008e-0092 in Landroid/support/v7/internal/widget/ActionBarView;.<init> (Landroid/content/Context;Landroid/util/AttributeSet;)V
05-18 16:03:29.042: D/dalvikvm(7141): VFY: dead code 0x009c-00a0 in Landroid/support/v7/internal/widget/ActionBarView;.<init> (Landroid/content/Context;Landroid/util/AttributeSet;)V
05-18 16:03:29.116: D/skia(7141): purging 6K from font cache [1 entries]
05-18 16:03:29.116: D/SKIA_FONT(7141): stored typeface in slot 0
05-18 16:03:29.116: D/SKIA_FONT(7141): SKIA_FONT fontfile: /data/data/com.android.settings/app_fonts/default/DroidSans.ttf
05-18 16:03:29.116: D/SKIA_FONT(7141): SKIA_FONT fontfile: /data/data/com.android.settings/app_fonts/default/DroidSans.ttf
05-18 16:03:29.116: D/SKIA_FONT(7141): load_system_fonts(), name = Droid Sans, style = 0, uniqueID = 13
05-18 16:03:29.120: D/SKIA_FONT(7141): SKIA_FONT fontfile: /data/data/com.android.settings/app_fonts/default/DroidSans-Bold.ttf
05-18 16:03:29.120: D/SKIA_FONT(7141): SKIA_FONT fontfile: /data/data/com.android.settings/app_fonts/default/DroidSans-Bold.ttf
05-18 16:03:29.120: D/SKIA_FONT(7141): load_system_fonts(), name = Droid Sans, style = 1, uniqueID = 14
05-18 16:03:29.128: D/SKIA_FONT(7141): load_system_fonts(), name = Droid Serif, style = 0, uniqueID = 15
05-18 16:03:29.135: D/SKIA_FONT(7141): load_system_fonts(), name = Droid Serif, style = 1, uniqueID = 16
05-18 16:03:29.143: D/SKIA_FONT(7141): load_system_fonts(), name = Droid Serif, style = 2, uniqueID = 17
05-18 16:03:29.167: D/SKIA_FONT(7141): load_system_fonts(), name = Droid Serif, style = 3, uniqueID = 18
05-18 16:03:29.171: D/SKIA_FONT(7141): load_system_fonts(), name = Droid Sans Mono, style = 0, uniqueID = 19
05-18 16:03:29.171: D/SKIA_FONT(7141): load_system_fonts(), name = Droid Sans Arabic, style = 0, uniqueID = 20
05-18 16:03:29.171: D/SKIA_FONT(7141): load_system_fonts(), name = Droid Sans Hebrew, style = 0, uniqueID = 21
05-18 16:03:29.175: D/SKIA_FONT(7141): load_system_fonts(), name = Droid Sans Thai, style = 0, uniqueID = 22
05-18 16:03:29.178: D/SKIA_FONT(7141): load_system_fonts(), name = Droid Sans, style = 0, uniqueID = 23
05-18 16:03:29.198: D/SKIA_FONT(7141): load_system_fonts(), name = Droid Sans Fallback, style = 0, uniqueID = 24
05-18 16:03:29.198: D/SKIA_FONT(7141): load_system_fonts(), oldSansUID = 1, newSansUID = 13
05-18 16:03:29.198: D/SKIA_FONT(7141): load_system_fonts(), oldSansBoldUID = 2, newSansBoldUID = 14
05-18 16:03:32.210: D/SearchDialog(7141): launching Intent { act=android.intent.action.SEARCH flg=0x10000000 cmp=com.example.activity2/.SearchActivity (has extras) }
05-18 16:03:32.214: I/SearchDialog(7141): Starting (as ourselves) #Intent;action=android.intent.action.SEARCH;launchFlags=0x10000000;component=com.example.activity2/.SearchActivity;S.query=J;S.user_query=J;end
05-18 16:03:32.288: I/System.out(7141): file is /mnt/sdcard
05-18 16:03:32.292: W/dalvikvm(7141): VFY: unable to resolve static field 4641 (AdsAttrs) in Lcom/google/android/gms/R$styleable;
05-18 16:03:32.292: D/dalvikvm(7141): VFY: replacing opcode 0x62 at 0x0009
05-18 16:03:32.292: D/dalvikvm(7141): VFY: dead code 0x000b-0068 in Lcom/google/android/gms/internal/ao;.<init> (Landroid/content/Context;Landroid/util/AttributeSet;)V
05-18 16:03:32.303: D/AndroidRuntime(7141): Shutting down VM
05-18 16:03:32.303: W/dalvikvm(7141): threadid=1: thread exiting with uncaught exception (group=0x4001d7d0)
05-18 16:03:32.339: D/dalvikvm(7141): GC_FOR_MALLOC freed 3272 objects / 222072 bytes in 30ms
05-18 16:03:32.358: E/AndroidRuntime(7141): FATAL EXCEPTION: main
05-18 16:03:32.358: E/AndroidRuntime(7141): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.activity2/com.example.activity2.SearchActivity}: android.view.InflateException: Binary XML file line #14: Error inflating class com.google.android.gms.ads.AdView
05-18 16:03:32.358: E/AndroidRuntime(7141):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
05-18 16:03:32.358: E/AndroidRuntime(7141):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
05-18 16:03:32.358: E/AndroidRuntime(7141):     at android.app.ActivityThread.access$2300(ActivityThread.java:125)
05-18 16:03:32.358: E/AndroidRuntime(7141):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
05-18 16:03:32.358: E/AndroidRuntime(7141):     at android.os.Handler.dispatchMessage(Handler.java:99)
05-18 16:03:32.358: E/AndroidRuntime(7141):     at android.os.Looper.loop(Looper.java:123)
05-18 16:03:32.358: E/AndroidRuntime(7141):     at android.app.ActivityThread.main(ActivityThread.java:4627)
05-18 16:03:32.358: E/AndroidRuntime(7141):     at java.lang.reflect.Method.invokeNative(Native Method)
05-18 16:03:32.358: E/AndroidRuntime(7141):     at java.lang.reflect.Method.invoke(Method.java:521)
05-18 16:03:32.358: E/AndroidRuntime(7141):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
05-18 16:03:32.358: E/AndroidRuntime(7141):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
05-18 16:03:32.358: E/AndroidRuntime(7141):     at dalvik.system.NativeStart.main(Native Method)
05-18 16:03:32.358: E/AndroidRuntime(7141): Caused by: android.view.InflateException: Binary XML file line #14: Error inflating class com.google.android.gms.ads.AdView
05-18 16:03:32.358: E/AndroidRuntime(7141):     at android.view.LayoutInflater.createView(LayoutInflater.java:513)
05-18 16:03:32.358: E/AndroidRuntime(7141):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:565)
05-18 16:03:32.358: E/AndroidRuntime(7141):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
05-18 16:03:32.358: E/AndroidRuntime(7141):     at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
05-18 16:03:32.358: E/AndroidRuntime(7141):     at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
05-18 16:03:32.358: E/AndroidRuntime(7141):     at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
05-18 16:03:32.358: E/AndroidRuntime(7141):     at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:200)
05-18 16:03:32.358: E/AndroidRuntime(7141):     at android.app.Activity.setContentView(Activity.java:1647)
05-18 16:03:32.358: E/AndroidRuntime(7141):     at com.example.activity2.SearchActivity.onCreate(SearchActivity.java:76)
05-18 16:03:32.358: E/AndroidRuntime(7141):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
05-18 16:03:32.358: E/AndroidRuntime(7141):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
05-18 16:03:32.358: E/AndroidRuntime(7141):     ... 11 more
05-18 16:03:32.358: E/AndroidRuntime(7141): Caused by: java.lang.reflect.InvocationTargetException
05-18 16:03:32.358: E/AndroidRuntime(7141):     at com.google.android.gms.ads.AdView.<init>(Unknown Source)
05-18 16:03:32.358: E/AndroidRuntime(7141):     at java.lang.reflect.Constructor.constructNative(Native Method)
05-18 16:03:32.358: E/AndroidRuntime(7141):     at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
05-18 16:03:32.358: E/AndroidRuntime(7141):     at android.view.LayoutInflater.createView(LayoutInflater.java:500)
05-18 16:03:32.358: E/AndroidRuntime(7141):     ... 21 more
05-18 16:03:32.358: E/AndroidRuntime(7141): Caused by: java.lang.NoClassDefFoundError: com.google.android.gms.R$styleable
05-18 16:03:32.358: E/AndroidRuntime(7141):     at com.google.android.gms.internal.ao.<init>(Unknown Source)
05-18 16:03:32.358: E/AndroidRuntime(7141):     at com.google.android.gms.internal.au.<init>(Unknown Source)
05-18 16:03:32.358: E/AndroidRuntime(7141):     at com.google.android.gms.internal.au.<init>(Unknown Source)
05-18 16:03:32.358: E/AndroidRuntime(7141):     ... 25 more
05-18 16:08:37.901: I/Process(7141): Sending signal. PID: 7141 SIG: 9

Any suggestions? Been trying to get this very simple AdView to work all day. Thanks.

A: Don't put google-play-services.jar in the /libs/ folder. Instead, reference the google play services library in your project.
Import the library into your workspace. You'll find it in sdk/extras/google/.. if you downloaded via the sdk manager. Then reference by right clicking your project => selecting properties => Android => Add
First attached Google play services in your app properly, then add xml-name-space in layout xml file.
 xmlns:ads="http://schemas.android.com/apk/res-auto"

then use this
<com.google.android.gms.ads.AdView
    android:id="@+id/adView"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_gravity="center"
    ads:adSize="BANNER"
    ads:adUnitId="Your AddUnitID" />

add this in manifiest.xml
    <activity
                android:name="com.google.android.gms.ads.AdActivity"
                android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
                android:screenOrientation="portrait" />

            <meta-data
                android:name="com.google.android.gms.version"
                android:value="@integer/google_play_services_version" />

and add permission
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

A: Replace this line:
xmlns:ads="http://schemas.android.com/apk/libs/com.google.ads"

with
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"

The namespace is under the lib name not libs.
and make sure you have the google play services in your  build.gradle
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.google.android.gms:play-services:7.0.0'
}


text:
Q: How to change an ImageView with a filename I have a string with the name of the file that I want (R.drawable.square) to put in the imageview.
String shape = "square"

I am trying to use the method below to show the image
imageView.setImageResource()

Hardcoding the filename in works but I want to be able to pass different filenames in.
image.setImageResource(R.drawable.square)

tl;dr
can't get from String:"square" to int:R.drawable.square

A: Please see Android, reference things in R.drawable. using variables?

//to retrieve image in res/drawable and set image in ImageView
String imageName = "picture"
int resID = getResources().getIdentifier(imageName, "drawable", "package.name");
ImageView image;
image.setImageResource(resID );

A: I achieved the effect by putting the images in the assets directory

A: I think it's better to use you Strings as key and your resource ids as value in a Map Object.
    Map<String, Integer> resources = new HashMap<>();

    resources.put("square", R.drawable.square);
    // resources.put("...", R.drawable....);

    imageView.setImageResource(resources.get("square"));


text:
Q: NumPyArrayToTable - RuntimeError: unsupported time units. use M8[us] I'm trying to convert a pandas dataframe (df) to a table in a file geodatabase using code below:
records = df.to_records(index=False)
arcpy.da.NumPyArrayToTable(records,r'C:\TEST.gdb\records')

Error message:

RuntimeError: unsupported time units. use M8[us]

Using df.dtypes I can see that my date fields are type datetime64[ns]:
>>df.dtypes

field1              float64
field2              float64
field3              object
field4              float64
field5          datetime64[ns]
...

So I guess I need to change the type from datetime64[ns] to M8[us]. How do I do that?

A: Playing around with dates using numpy, pandas, and arcpy tools for writing numpy arrays into geodatabase tables can be challenging.
I usually use arcpy.da.InsertCursor in favor of arcpy.da.NumPyArrayToTable just because I get a more fine grained control over the data types. The performance of InsertCursor is great, you will be able to write millions of records in minutes.
Something like this:
# create a feature class
#...
# add fields from df.columns
#...

rows_to_write = [tuple(r[1:]) for r in df.itertuples()]
with arcpy.da.InsertCursor(out_fc,df.columns) as ins_cur:
    for row in rows_to_write:
        ins_cur.insertRow(row)

However, if you do need to use arcpy.da.NumPyArrayToTable, here is the code that will work:
import numpy as np
print(np.version.full_version)
import pandas as pd
print(pd.__version__)

from datetime import datetime
data = [(1,datetime(2011, 1, 2)), (2,datetime(2011, 1, 5)), (3,datetime(2011, 1, 7))]
df = pd.DataFrame(data,columns=['RowId','RowDate'])
print(df)
#   RowId    RowDate
#0      1 2011-01-02
#1      2 2011-01-05
#2      3 2011-01-07

#for pandas 0.17 (ArcGIS Pro 1.3 Python)
#in_array = np.array([(r.RowId,np.datetime64(r.RowDate)) for r in df.itertuples()],
                    #np.dtype([('CustomId', '<i8'),
                              #('CustomDate', 'M8[us]')]))

#for pandas 0.16 (ArcGIS Desktop 10.4 Python)
in_array = np.array([(r[1],np.datetime64(r[2])) for r in df.itertuples()],
                    np.dtype([('CustomId', '<i8'),
                              ('CustomDate', 'M8[us]')]))

print(in_array)
#array([(1, datetime.datetime(2011, 1, 2, 0, 0)),
#   (2, datetime.datetime(2011, 1, 5, 0, 0)),
#   (3, datetime.datetime(2011, 1, 7, 0, 0))],
#  dtype=[('CustomId', '<i8'), ('CustomDate', '<M8[us]')])

import arcpy
arcpy.da.NumPyArrayToTable(in_array,r'C:\GIS\Temp\test.gdb\records_pandas')

You won't be able to use the df.to_records() because you will lose the numpy types. You have to construct a numpy.array manually before feeding it to the arcpy function.
To verify the contents:
print([f.name for f in arcpy.ListFields(r'C:\GIS\Temp\test.gdb\records_pandas')])
for i in [i for i in arcpy.da.SearchCursor(r'C:\GIS\Temp\test.gdb\records_pandas',"*")]:
    print(i)

['OBJECTID', 'CustomId', 'CustomDate']
(1, 1, datetime.datetime(2011, 1, 2, 0, 0))
(2, 2, datetime.datetime(2011, 1, 5, 0, 0))
(3, 3, datetime.datetime(2011, 1, 7, 0, 0))

A: We recently encountered the same issue. This approach worked on my dataframe (ArcGIS Pro 2.9, python 3.7, pandas 1.2.3) and didn't require knowing the field names or types. Hopefully this is more broadly applicable.
import pandas as pd
# Assuming you have a pandas dataframe named 'df'
# list data types
list_dtypes = [i.str for i in df.dtypes]

# turn object type into 255 character string type
# turn datetimes type into M8[us] type
list_dtypes = ['<U255'  if d == '|O'      else d for d in list_dtypes]
list_dtypes = ['M8[us]' if d == '<M8[ns]' else d for d in list_dtypes]

# format as list of tuples (field name and adjusted dtype)
tup_dtypes =  [(f,t) for f,t in zip(list(df.columns.values),list_dtypes)]

# write to array, recasting the to_records array with .astype()
arcpy.da.NumPyArrayToTable(df.to_records(index=False).astype(tup_dtypes),r"tablepath")


text:
Q: Review Suggested Edits I don't know if I can I ask this here or not, but I don't know any other place to ask this.
I saw a person review a Suggested Edit post in SO with only a total reputation of 119 in SO. He is not a moderator too. This is the person.
How is this possible?

A: That was a suggested edit to his own question. Any OP of a post can review those.

A: It's probably someone who reviewed an edit to his own post. When someone edit your post you can review it, even though you don't have 2k reputation.
Your vote counts for 3 vote. That means if you reject it, it'll be rejected right away. If you accept it'll be accepted right away.


text:
Q: HTML Tag in Java Swing Components Does adding HTML tags to Swing components, for example JLabels, make rendering of JFrame slow?
I mean how is the performance of HTML rendering in Swing components?

A: Yes, depending on the complexity of your html.
Actually when you have html in your jlabel, the BasicLabelUI uses a View to paint the label instead of simple paint logic. Now you can check various different implementations of View class to check how it affects you.
You can read the code of BasicLabelUI.paint() for clarity.
But for simple decorated html, I don't think you need to worry at all.

A: Swing's HTML rendering support uses many classes, therefore users on older systems might notice a delay the first time a component with HTML formatting is shown. One way to avoid this delay is not to show the HTML-formatted component immediately and to create it (or another component that uses HTML) on a background thread.


text:
Q: What is the best way to structure a spark structured streaming pipeline? I'm moving data from my postgres database to kafka and in the middle doing some transformations with spark.
I Have 50 tables and for each table i have transformations totally different from the others.
So, i want to know how is the best way to structure my spark structured streaming code. I think in three options:

*

*To Put all the logical of read and write this 50 tables in one object and call only this object.

*Create 50 different objects for each table and in a new object create a main method calling each of 50 objects and after call spark.streams.awaitAnyTermination()

*Submit individually each of these 50 objects via spark submit
If exist another better option, please talk to me.
Thank you

A: Creating single object as per your approach 1 does not look good. It will be difficult to understand and maintain.
Between step2 and step3, I would still prefer 3rd. Having separate jobs will be a bit of hassle to maintain (managing deployment and structuring out the common code), but if done well it will give us more flexibility. We could easily undeploy a single table if needed. Also any subsequent deployments or changes would mean deploying only the concerned table flows. The other existing table pipelines will keep working as it is.


text:
Q: Understanding simple simulation and rendering loop This is an example (pseudo code) of how you could simulate and render a video game.
//simulate 20ms into the future
const long delta = 20;
long simulationTime = 0;
while(true)
{
    while(simulationTime < GetMilliSeconds())   //GetMilliSeconds = Wall Clock Time
        {
            //the frame we simulated is still in the past
            input = GetUserlnput();
            UpdateSimulation(delta, input);
            //we are trying to catch up and eventually pass the wall clock time
            simulationTime += delta;
        }

    //since my current simulation is in the future and
    //my last simulation is in the past
    //the current looking of the world has got to be somewhere inbetween
    RenderGraphics(InterpolateWorldState(GetMilliSeconds() - simulationTime));
}

That's my question:
I have 40ms to go through the outer 'while true' loop (means 25FPS).
The RenderGraphics method takes 10ms. So that means I have 30ms for the inner loop. The UpdateSimulation method takes 5ms. Everything else can be ignored since it's a value under 0.1ms.
What is the maximum I can set the variable 'delta' to in order to stay in my time schedule of 40ms (outer loop)?
And why?

A: This largely depends on how often you want and need to update your simulation status and user input, given the constraints mentioned below. For example, if your game contains internal state based on physical behavior, you would need a smaller delta to ensure that movements and collisions, if any, are properly evaluated and reflected within the game state. Also, if your user input requires fine-grained evaluation and state update, you would also need smaller delta values. For example, a shooting game with analogue user input (e.g. mouse, joystick), would benefit from update frequencies larger than 30Hz. If your game does not need such high-frequency evaluation of input and game state, then you could get away with larger delta values, or even by simply updating your game state once any input by the player was being detected.
In your specific pseudo-code, your simulation would update according to a fixed time-slice of length delta, which requires your simulation update to be processed in less wallclock time than the wallclock time to be simulated. Otherwise, wallclock time would proceed faster, than your simulation time can be updated. This ultimately limits your delta depending on how quick any simulation update of delta simulation time can actually be computed. This relationship also depends on your use case and may not be linear or constant. For example, physics engines often would divide your delta time given internally to what update rate they can reasonably process, as longer delta times may cause numerical instabilities and harder to solve linear systems raising processing effort non-linearly. In other use cases, simulation updates may take a linear or even constant time. Even so, many (possibly external) events could cause your simulation update to be processed too slowly, if it is inherently demanding. For example, loading resources during simulation updates, your operating system deciding to lay your execution thread aside, another process run by the user, anti-virus software kicking in, low memory pressure, a slow CPU and so on. Until now, I saw mostly two strategies to evade this problem or remedy its effects. First, simply ignoring it could work if the simulation update effort is low and it is assumed that the cause of the slowdown is temporary only. This would result in more or less noticeable "slow motion" behavior of your simulation, which could - in worst case - lead to simulation time lag piling up forever. The second strategy I often saw was to simply cap the measured frame time to be simulated to some artificial value, say 1000ms. This leads to smooth behavior as soon as the cause of slow down disappears, but has the drawback that the 'capped' simulation time is 'lost', which may lead to animation hiccups if not handled or accounted for. To choose a strategy, analyzing your use case could consist of measuring the wallclock time it takes to process simulation updates of delta and x * delta time and how changing the delta time and simulation load to process actually reflects in wallclock time needed to compute it, which will hint you to what the maximum value of delta is for your specific hardware and software environment.


text:
Q: Want to Add a submit button instead of Enter key I want to add a Submit button instead of Enter key
Here is my code
<!DOCTYPE html>
<html>
    <body>
        <input type="text" name="logsarchives" id="logsarchives" autocomplete="off"  placeholder="Enter Console Command" onkeydown="redirect(this)">
    </body>
    <script>
        function redirect(ele) {
            if(event.key === 'Enter') {
                if(ele.value === 'google')
                     window.location.href = 'https://google.com';
                else
                    alert("Invalid");
            }
        }
    </script>
</html>

A: remove the onkeydown="redirect(this)" from your <input> and add the submit button along with the wrapper form:
<form method="post" action="https://where.you.want/to/process">
    <input type="text" name="logsarchives" id="logsarchives" autocomplete="off"  placeholder="Enter Console Command">
    <input type="submit" name="submit" value="submit>
</form>


text:
Q: iOS Rotating Phone crashes I support portrait only ATM, I get these error when rotating the device:
[__NSCFData setProperRotation]: unrecognized selector sent to instance 0x2dc890
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFData setProperRotation]: unrecognized selector sent to instance 0x2dc890'

This is in iOS5.1. Initially I just left the default portrait clause in, but changed it to:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if (interfaceOrientation == UIInterfaceOrientationPortrait) { // Or whatever orientation it will be presented in.
        return YES;
    }
    return NO;
}

I am using ARC btw.
Hoping that would help stop the crashing. My info.plist has portrait and portrait upside down.  There is nothing else I have done thats stock practice except my main view has multiple ViewControllers and its set to:
self.wantsFullScreenLayout=YES;

Any ideas peoples? Thanks in advance.
My project adds the main view from the appdelegate as such:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
mainViewController=[[MainViewController alloc] init];

[self.window addSubview:mainViewController.view];

And I have 2 ViewControllers on that mainViewController and I use a Navigation controller to push several ViewControllers as such:
- (void) loadActionsView {

NSArray* views = [self.navigationController viewControllers];

if ([views containsObject: actionsPanelViewController])
{
    [self.navigationController popToViewController:actionsPanelViewController animated:YES];
} else {

    [self.navigationController pushViewController:actionsPanelViewController animated:YES];
}

[[StateModel stateModel] setCurrentScreenIndex:0];

}
This is the first view that is called btw.
Update 2 with Solution/problem found:
I was using part of SHK the SHKActivityIndicator, that had a notification that was capturing the screen rotation and its selectors where causing the issue:
[[NSNotificationCenter defaultCenter] addObserver:currentIndicator selector:@selector(setProperRotation) name:UIDeviceOrientationDidChangeNotification object:nil];

A: It sounds like your ViewController is released and another Object receives setProperRotation message. Check if your ViewController is alive.
mainViewController=[[MainViewController alloc] init];
[self.window addSubview:mainViewController.view];

here is the problem. You adding only the view. ARC thinks that you dont need your MainViewController anymore.

*

*Make MainViewController as a Class variable or

*set window.rootViewController
self.window.rootViewController = mainViewController;

A: The exception shows that you are likely over-releasing an object which is supposed to responds to -setProperRotation. Look for that object and try to understand where you forgot to retain it (for example, track its retains and releases with Object allocation instrument)


text:
Q: C# Smtp delete file after sending as an attachment; denied because it's in use? I have problem after sending an email with an attachment.
After such a send I would like to delete this file and the process is denied because another process is using the file I want to delete.
This is message I am getting:
"The process cannot access the file 'C:\Users\x\AppData\Roaming\ipconfig.txt' because it is being used by another process."
There is some code from me:
    public static void SendAnEmail(string host, string username, string password, string mailTo, string subject, string body, List<string> attachmentsFileNames)
    {
        SmtpClient client = new SmtpClient();
        client.Port = 587;
        client.Host = host;
        client.EnableSsl = true;
        client.Timeout = 60000;
        client.DeliveryMethod = SmtpDeliveryMethod.Network;
        client.UseDefaultCredentials = false;
        client.Credentials = new System.Net.NetworkCredential(username, password);

        MailMessage mailMessage = new MailMessage(username, mailTo, subject, body);
        foreach(string singleAttachmentFileName in attachmentsFileNames)
        {
            Attachment attachment = new Attachment(singleAttachmentFileName, "text/plain");
            mailMessage.Attachments.Add(attachment);
        }
        mailMessage.BodyEncoding = UTF8Encoding.UTF8;
        mailMessage.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure;
    }

And here is the call of the SendAnEmail function and try of deleting those files I sent as an attachments.
            Transport.SendAnEmail(Settings.mailHost, Settings.mailUsername, Settings.mailPassword, Settings.mailTargetAddress, Settings.ftpDirectory, " ", Settings.attachmentsListFileNames);

            foreach(string singlePath in Settings.attachmentsListFileNames)
                File.Delete(singlePath);

I would like an advise how I may resolve this issue and after send an email with attachment - delete those attachment.
Please ask me if something is not clear.
edit:
Sure, I am using C#, framework 4.5, WPF. Platform targeted is Windows and the environment used to programming is Visual Studio 2013 :)

A: Before deleting, you have to do this :
mailMessage.Attachments.Dispose();
client.Dispose();

It worked for me.


text:
Q: MySQL performance – Multiple queries or one inefficient query? I have three tables, each contain some common information, and some information that is unique to the table.
For example: uid, date are universal among the tables, but one table can contain a column type while the other contains currency.
I need to query the database and get the last 20 entries (date DESC) that have been entered in all three tables.
My options are:

*

*Query the database once, with one large query, containing three UNION ALL clauses, and pass along fake values for columns, IE:
FROM    (
    SELECT  uid, date, currency, 0, 0, 0

and later on
FROM    (
    SELECT  uid, date, 0, type, 0, 0

This would leave me with allot of null-valued fields..

*OR I can query  the database three times, and somehow within PHP sort through the information to get the combined latest 20 posts. This would leave me with an excess of information - 60 posts to look through (LIMIT 20) * 3 - and force me to preform some type of addtional quicksort every time.
What option is better/any alternate ideas?
Thanks.

A: Those two options are more similar than you make it sound.
When you perform the single large query with UNIONs, MySQL will still be performing three separate queries, just as you propose doing in your alternative plan, and then combining them into a single result.
So, you can either let MySQL do the filtering (and LIMIT) for you, or you can do it yourself.  Given that choice, letting MySQL do all the work sounds far preferable.
Having extra columns in the result set could theoretically hinder performance, but with so small a result set as your 20 rows, I wouldn't expect it to have any detectable impact.

A: It all depends of how big your tables are. If each table has a few thousands records, you can go with the first solution (UNION), and you'll be fine.
On bigger tables, I'd probably go with the second solution, mostly because it will use much less ressources (RAM) than the UNION way, and still be reasonably fast.
But I would advise you to think about your data model, and maybe optimize it. The fact you have to use UNION-based queries usually means there's room for optimization, typically by merging the three tables, with an added "type" field (names isn't good at all, but you see my point).

A: if you know your limits you can limit each query and had union only run on little data. this should be better as mysql will return only 20 rows and will make the sorting faster then you can in php...
select * from (
  SELECT  uid, date, currency, 0, 0, 0 from table_a order by date desc limit 20
  union
  SELECT  uid, date, 0, type, 0, 0  from table_b order by date desc limit 20
...
) order by date desc limit 20


text:
Q: SOAP client produces memory error by large response I'm stuck with a strange issue. Below my code:
$response = $client->__soapCall('ProcessXmlString', [['xmlRequest' => $xml]]);

XML is something like this:
<columns code="..">
    <column id="..">
        <field>...</field>
        test
        <visible>true</visible>
        <ask>false</ask>
        <operator>none</operator>
        <from></from>
        <to></to>
        <finderparam>...</finderparam>
    </column>
</columns>

When I run this code I get a memory error:
Allowed memory size of 134217728 bytes exhausted (tried to allocate 65183479 bytes) ...
As you can see the response is just about 60MB's. I thought SoapClient just handle things in chunks? (request with less data works perfectly)
I don't want to set my memory limit higher but want to handle response part by part.
I don't really get it why this error occurred. Does anybody has a idea / solution?
I'm using php version 5.6 and SOAP version 1.2
Thanks in advance,
Niels

A: My advice would be to use XMLREADER for large (anything above 10mb) XML files.
XML Reader is a so called pull parser. Advantage of that is that you can start parsing without loading the entire fill into the memory (like SimpleXML or DOMDocument does).
Once you get to the level/node that you need, pass that part of the xml to simpleXML.
An example:
<?php
$xml = new XMLReader;
$xml->open('example.xml');

$searchfor='Customer'; //nodename you're intending to find

while ($xml->read()){
    $nodename=$xml->localName;
    if ($nodename==$searchfor &&  $xml->nodeType == XMLReader::ELEMENT){ // does nodename match what we're looking for AND is it of type start elemenet (<example> but not </example>)

        ECHO '
============= NODE FOUND ===================
';

        // Option 1
        //convert that into array so we can proceed with plain PHP
        $doc = new DOMDocument('1.0', 'UTF-8');
        $temp = simplexml_import_dom($doc->importNode($xml->expand(),true));
        $array = json_decode( json_encode($temp) , 1);

        echo "
";
            print_r($array);
        echo "
";

        // Option 2 Put current NODE contents into simpleXML object
        // $nodecontent = simplexml_load_string($xml->readOuterXML());
        // var_dump($nodecontent);

    }

}


text:
Q: $x\mapsto a\,x$ is an unbounded function yet a bounded functional Let $f:\mathbb{R}\rightarrow \mathbb{R}$ be the linear function $f(x):=ax$ for some fixed $a\in \mathbb{R}$. Then $f$ is a continuous function that is linear and unbounded.
If we look at $f$ as a real functional on the real normed space $(\mathbb{R},|.|)$ then $f$ is clearly a linear functional. And we do have
$$|f(x)|=|a||x|,\qquad \forall x\in\mathbb{R}$$
which shows $f$ is a bounded functional.
In fact the same thing applies to linear functions $f(x):=Ax$ on $\mathbb{R}^{n}$, $A\in M_{n\times n}$, in higher dimensions.
Am I missing something or is it true that the concept of boundedness of the this $f$ does depend on the context (viewing it as a function as opposed to as a functional ) ?

A: Yes, boundedness means different things in these two different contexts.
For a function $f \mathpunct{:} \mathbb{R} \to \mathbb{R}$ boundedness means that the range of $f$ is a bounded subset of $\mathbb{R}$.
However, for a normed vector space $X$, a bounded linear functional $f \mathpunct{:} X \to\mathbb{R}$ is one that maps bounded sets in $X$ to bounded sets in $\mathbb{R}$.
Whilst this justifies the use of the word boundedness in each case, it is somewhat unfortunate that the word is used with conflicting meanings in these two contexts. However it is usually clear from context in which way it is meant.


text:
Q: Test statistic (e.g. chisquare test) inside latex table using the tables-package in R/Knitr/Rstudio I would like to use the tabular()-function from the tables-package to do a cross-tabulation of two variables (e.g. v1 and v2), and present the p-value of the chisq-test in the table. It is easy to get the crosstabulation, but I cant get the p-value inside the table. This is what I've been trying, without any luck:

\documentclass{article}

\begin{document}

<<echo=TRUE,message=FALSE>>=
library(Hmisc)
library(tables)
v1 <- sample(letters[1:2],200,replace=TRUE)
v2 <- sample(month.name[1:3],200,replace=TRUE)
df <- data.frame(v1,v2)
@

It is straight forward to get the crosstabulation:
<<results='asis'>>=
latex(   tabular(    Factor(v1)   ~   Factor(v2)      , data=df)  )
@

But I cant get the p-value inside the table:

<<results='asis'>>=
latex(   tabular(    Factor(v1)*chisq.test(v1,v2)$p.value   ~   Factor(v2)      , data=df)  )
@

\end{document}

A: I don't know how to do it with tables::tabular but this will do it with Hmisc::summary.formula.reverse assuming you have your system configured to produce pdf files through latex(). I had to do searching of the Rhelp archives to figure out that the 'exclude1' argument needed to go in the latex argument list. Once you go back through the documentation exclude1 does appear in the usage example of latex.summary.formula.reverse although I thought I was reading the help page for summary.rms:
library(Hmisc)
latex(summary( v2 ~ v1, data=df,  method="reverse" ,test=TRUE), exclude1=FALSE)

You can intercept the latex output "along the way" if you want to embed it in a longer document by assigning the output to a named file.
latex(summary( v2 ~ v1, data=df,  method="reverse" ,test=TRUE), exclude1=FALSE, file="")
#--------
% latex.default(cstats, title = title, caption = caption, rowlabel = rowlabel,      col.just = col.just, numeric.dollar = FALSE, insert.bottom = legend,      rowname = lab, dcolumn = dcolumn, extracolheads = extracolheads,      extracolsize = Nsize, ...)
%
\begin{table}[!tbp]
\caption{Descriptive Statistics by v2\label{summary}}
\begin{center}
\begin{tabular}{lcccc}
\hline\hline
\multicolumn{1}{l}{}&\multicolumn{1}{c}{February}&\multicolumn{1}{c}{January}&\multicolumn{1}{c}{March}&\multicolumn{1}{c}{Test Statistic}\tabularnewline
&\multicolumn{1}{c}{{\scriptsize $N=56$}}&\multicolumn{1}{c}{{\scriptsize $N=73$}}&\multicolumn{1}{c}{{\scriptsize $N=71$}}&\tabularnewline
\hline
v1~:~a&43\%~{\scriptsize~(24)}&47\%~{\scriptsize~(34)}&44\%~{\scriptsize~(31)}&$ \chi^{2}_{2}=0.21 ,~ P=0.901  $\tabularnewline
~~~~b&57\%~{\scriptsize~(32)}&53\%~{\scriptsize~(39)}&56\%~{\scriptsize~(40)}&\tabularnewline
\hline
\end{tabular}
\end{center}
Numbers after percents are frequencies.\\\noindent Test used:\\Pearson test\end{table}

A: You can also paste text from a chi-squared statistic into a caption via xtable(). For example:
#sample data
var1<-sample(c('A', 'B'), 10, replace=T)
var2<-sample(c('Red', 'Blue'), 10, replace=T)
#join in frequency table
tab<-table(var1, var2)
#conduct chisq.test
test<-chisq.test(tab)
#show values of chisq.test()
name(test)
#Use xtable, use print.xtable for further manipulations
out<-xtable(tab, caption=paste('Important table, chi-squared =', test$statistic, ', p=', test$p.value,',' ,test$parameter, 'df', sep=' '))
#print
out