问:
Populate with new value(s) to a fixed-shape numpy array filled with zeros
Given that a numpy array is stored contiguously, if we try to append or extend to it then this happens not in-place but, instead, a new copy of the array is created with adequate 'room' for the append or extend to occur contiguously (see https://stackoverflow.com/a/13215559/3286832).

To avoid that, and assuming we are lucky enough to know the specific number of elements we expect the array to have, we can create a numpy array with a fixed size filled with zeros:

```<code>import numpy as np

a = np.zeros(shape=(100,))  # [0. 0. 0. ... 0. 0. 0.]
</code>```

Say that we want to populate this array each element with a new value each time (e.g. provided by the user) by editing this array in-place:

```<code>pos = 0
a[pos] = 0.002              # [0.002 0. 0. ... 0. 0. 0.]

pos = pos + 1
a[pos] = 0.101              # [0.002 0.101 0. ... 0. 0. 0.]

# etc.

pos = -1
a[pos] = 42.00              # [0.002 0.101 ... ... ... 42.]
</code>```

Question:

Is there a way to keep track of the next available position pos (i.e. last position not previously populated with a new input value) instead of manually incrementing pos each time?

Is there a way in efficiently achieving this in numpy, preferably? Or is there a way of achieving this in another Python library (e.g. scipy or Pandas)?

(edited the question according the comments and initial answers which stated how not clear my initial question was phrased - hope this now is clearer)

答:
Actually, your question is still confusing for me. How do you define the new value you want to insert to the new position? Is it coming from outside of your code? Do you have all the new values for your array, or only part of it?

Probably, you can use the slices in numpy, which are exactly for fast updating of the array, however, I'm not exactly sure that this is what you want to do.

Some samples for you:

```<code>>>> import numpy as np
>>> a = np.zeros(shape=(10,))
>>> a
array([0., 0., 0., 0., 0., 0., 0., 0., 0., 0.])
>>> a[3:6] += 1
>>> a
array([0., 0., 0., 1., 1., 1., 0., 0., 0., 0.])
>>> a[:4] += .001
>>> a
array([1.000e-03, 1.000e-03, 1.000e-03, 1.001e+00, 1.000e+00, 1.000e+00,
       0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00])
>>> a[3:5] = [2, 1]
>>> a
array([1.e-03, 1.e-03, 1.e-03, 2.e+00, 1.e+00, 1.e+00, 0.e+00, 0.e+00,
       0.e+00, 0.e+00])
>>>
</code>```

Body:
Given that a numpy array is stored contiguously, if we try to append or extend to it then this happens not in-place but, instead, a new copy of the array is created with adequate 'room' for the append or extend to occur contiguously (see https://stackoverflow.com/a/13215559/3286832).

To avoid that, and assuming we are lucky enough to know the specific number of elements we expect the array to have, we can create a numpy array with a fixed size filled with zeros:

import numpy as np

a = np.zeros(shape=(100,))  # [0. 0. 0. ... 0. 0. 0.]

Say that we want to populate this array each element with a new value each time (e.g. provided by the user) by editing this array in-place:

pos = 0
a[pos] = 0.002              # [0.002 0. 0. ... 0. 0. 0.]

pos = pos + 1
a[pos] = 0.101              # [0.002 0.101 0. ... 0. 0. 0.]

# etc.

pos = -1
a[pos] = 42.00              # [0.002 0.101 ... ... ... 42.]

Question:

Is there a way to keep track of the next available position pos (i.e. last position not previously populated with a new input value) instead of manually incrementing pos each time?

Is there a way in efficiently achieving this in numpy, preferably? Or is there a way of achieving this in another Python library (e.g. scipy or Pandas)?

(edited the question according the comments and initial answers which stated how not clear my initial question was phrased - hope this now is clearer)

Body:
Actually, your question is still confusing for me. How do you define the new value you want to insert to the new position? Is it coming from outside of your code? Do you have all the new values for your array, or only part of it?

Probably, you can use the slices in numpy, which are exactly for fast updating of the array, however, I'm not exactly sure that this is what you want to do.

Some samples for you:

>>> import numpy as np
>>> a = np.zeros(shape=(10,))
>>> a
array([0., 0., 0., 0., 0., 0., 0., 0., 0., 0.])
>>> a[3:6] += 1
>>> a
array([0., 0., 0., 1., 1., 1., 0., 0., 0., 0.])
>>> a[:4] += .001
>>> a
array([1.000e-03, 1.000e-03, 1.000e-03, 1.001e+00, 1.000e+00, 1.000e+00,
       0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00])
>>> a[3:5] = [2, 1]
>>> a
array([1.e-03, 1.e-03, 1.e-03, 2.e+00, 1.e+00, 1.e+00, 0.e+00, 0.e+00,
       0.e+00, 0.e+00])
>>>


来源: stackexchange

问:
VBA Excel row height to the last row
This is the query strongly related to this one:

Setting RowHeight Excel VBA

but when I modify it a bit (as I want the row height = 15 only).

```<code> Dim ws As Worksheet
 Set ws = ActiveSheet

 Dim Rng As Range
 Dim cel As Range
 Set Rng = Range(ActiveCell, Cells(Rows.Count, ActiveCell.Column).End(xlUp)) '& lastRow

 For Each cel In Rng
 cel.Rows.AutoFit
 cel.Rows.RowHeight = 15
Next cel
</code>```

I am getting the result in the place, where the cell has been clicked (active cell).

I tried to put the & lastRow straight after the .End(xlUp), but it didn't work, unfortunately.

The situation looks as follows:

Only the first 5 rows have been adjusted (where the cell was initially activated), but I need all of them down to the end. The value it's going to be flexible in the future.

How can I do that?

答:
In set rng you specify activecell which is causing the problem. Also you have xlUp which is, as you can see here, formatting the cells upwards of your selection. Does this work for you?

```<code> Sub test()
    ActiveSheet.UsedRange.Rows.AutoFit
    ActiveSheet.UsedRange.Rows.RowHeight = 15
 End Sub
</code>```

ContentLicense: CC BY-SA 4.0

Title: VBA Excel row height to the last row

Body:
This is the query strongly related to this one:

Setting RowHeight Excel VBA

but when I modify it a bit (as I want the row height = 15 only).

 Dim ws As Worksheet
 Set ws = ActiveSheet

 Dim Rng As Range
 Dim cel As Range
 Set Rng = Range(ActiveCell, Cells(Rows.Count, ActiveCell.Column).End(xlUp)) '& lastRow

 For Each cel In Rng
 cel.Rows.AutoFit
 cel.Rows.RowHeight = 15
Next cel

I am getting the result in the place, where the cell has been clicked (active cell).

I tried to put the & lastRow straight after the .End(xlUp), but it didn't work, unfortunately.

The situation looks as follows:

Only the first 5 rows have been adjusted (where the cell was initially activated), but I need all of them down to the end. The value it's going to be flexible in the future.

How can I do that?

Body:
In set rng you specify activecell which is causing the problem. Also you have xlUp which is, as you can see here, formatting the cells upwards of your selection. Does this work for you?

 Sub test()
    ActiveSheet.UsedRange.Rows.AutoFit
    ActiveSheet.UsedRange.Rows.RowHeight = 15
 End Sub


问:
How do I rotate text in css?
How do I rotate text in CSS to get following output:

The problem I am facing is that when we rotate the text then it breaks the alignment and positions. So what is causing that, and how can I manage them?

HTML:

```<code><div class="mainWrapper">
    <div class="rotateObj">
        <div class="title active">First Text Title</div>
        <div class="content">
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
        </div>
        <div class="title">First Text Title</div>
        <div class="content hide">
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
        </div>
        <div class="title">First Text Title</div>
        <div class="content hide">
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
        </div>
        <div class="title">First Text Title</div>
        <div class="content hide">
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
        </div>
        <div class="title">First Text Title</div>
        <div class="content hide">
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
        </div>
    </div>
</div>
</code>```

CSS:

```<code>    .mainWrapper{margin:0 auto; width:960px; background:#EFEFEF;}
    .rotateObj{position:relative; height:400px;}
    .rotateObj .title{
        float:left;
        background:gray;
        width:50px;
        height:100%;

        /** Rounded Border */
        border-radius:5px;-moz-border-radius:5px;

        /** Rotation */
        -webkit-transform: rotate(-90deg);
        -moz-transform: rotate(-90deg);
        transform:rotate(-90deg);
        filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
    }
    .rotateObj .active{background:green;}
    .rotateObj .content{float:left;width:600px;height:100%;padding:20px;}
    .hide{display:none;}
</code>```

http://jsfiddle.net/koolkabin/yawYM/

答:
I guess this is what you are looking for?

Added an example:

The html:

```<code><div class="example-date">
  <span class="day">31</span>
  <span class="month">July</span>
  <span class="year">2009</span>
</div>
</code>```

The css:

```<code>.year
{
    display:block;
    -webkit-transform: rotate(-90deg);
    -moz-transform: rotate(-90deg);
    filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3); //For IE support
}
</code>```

Alle examples are from the mentioned site.

Title: How do I rotate text in css?

Body:
How do I rotate text in CSS to get following output:

The problem I am facing is that when we rotate the text then it breaks the alignment and positions. So what is causing that, and how can I manage them?

HTML:

First Text Title

            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...

First Text Title

            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...

First Text Title

            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...

First Text Title

            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...

First Text Title

            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...
            Here goes my bla bla bla text and more stuffs...

CSS:

    .mainWrapper{margin:0 auto; width:960px; background:#EFEFEF;}
    .rotateObj{position:relative; height:400px;}
    .rotateObj .title{
        float:left;
        background:gray;
        width:50px;
        height:100%;

        /** Rounded Border */
        border-radius:5px;-moz-border-radius:5px;

        /** Rotation */
        -webkit-transform: rotate(-90deg);
        -moz-transform: rotate(-90deg);
        transform:rotate(-90deg);
        filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
    }
    .rotateObj .active{background:green;}
    .rotateObj .content{float:left;width:600px;height:100%;padding:20px;}
    .hide{display:none;}

http://jsfiddle.net/koolkabin/yawYM/

Body:
I guess this is what you are looking for?

Added an example:

The html:

<div class="example-date">
  <span class="day">31</span>
  <span class="month">July</span>
  <span class="year">2009</span>
</div>

The css:

.year
{
    display:block;
    -webkit-transform: rotate(-90deg);
    -moz-transform: rotate(-90deg);
    filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3); //For IE support
}

Alle examples are from the mentioned site.

ContentLicense: CC BY-SA 3.0


问:
css image not displaying in codeigniter 3.10
my home page looks like

when i click on five species it displays like this

config.php in application folder.

<?php
defined('BASEPATH') OR exit('No direct script access allowed');

$config['base_url'] = 'http://localhost/antimalarial/';
$config['index_page'] = "index.php?";
$config['uri_protocol'] = 'REQUEST_URI';
$config['url_suffix'] = '';
$config['language'] = 'english';
$config['charset'] = 'UTF-8';
$config['enable_hooks'] = FALSE;
$config['subclass_prefix'] = 'MY_';
$config['composer_autoload'] = FALSE;
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';
$config['allow_get_array'] = TRUE;
$config['enable_query_strings'] = FALSE;
$config['controller_trigger'] = 'c';
$config['function_trigger'] = 'm';
$config['directory_trigger'] = 'd';
$config['log_threshold'] = 0;
$config['log_path'] = '';
$config['log_file_extension'] = '';
$config['log_file_permissions'] = 0644;
$config['log_date_format'] = 'Y-m-d H:i:s';
$config['error_views_path'] = '';
$config['cache_path'] = '';
$config['cache_query_string'] = FALSE;
$config['encryption_key'] = '';
$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = NULL;
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;
$config['cookie_prefix'] = '';
$config['cookie_domain'] = '';
$config['cookie_path']  = '/';
$config['cookie_secure'] = FALSE;
$config['cookie_httponly']  = FALSE;
$config['standardize_newlines'] = FALSE;
$config['global_xss_filtering'] = FALSE;
$config['csrf_protection'] = FALSE;
$config['csrf_token_name'] = 'csrf_test_name';
$config['csrf_cookie_name'] = 'csrf_cookie_name';
$config['csrf_expire'] = 7200;
$config['csrf_regenerate'] = TRUE;
$config['csrf_exclude_uris'] = array();
$config['compress_output'] = FALSE;
$config['time_reference'] = 'local';
$config['rewrite_short_tags'] = FALSE;
$config['proxy_ips'] = '';```
</div>
</div>

routes.php in config folder.</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code><?php
defined('BASEPATH') OR exit('No direct script access allowed');

$route['default_controller'] = 'Welcome';
$route['(:any)'] = 'Welcome/$1';</code>```

Welcome.php in Controller folder

<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Welcome extends CI_Controller {

 /**
  * Index Page for this controller.
  *
  * Maps to the following URL
  *   http://example.com/index.php/welcome
  * - or -
  *   http://example.com/index.php/welcome/index
  * - or -
  * Since this controller is set as the default controller in
  * config/routes.php, it's displayed at http://example.com/
  *
  * So any other public methods not prefixed with an underscore will
  * map to /index.php/welcome/<method_name>
  * @see https://codeigniter.com/user_guide/general/urls.html
  */

 public function __construct() {
        parent::__construct();

    }
 public function index()
 {
     $this->load->view('header.php');
            $this->load->view('home.php');
            $this->load->view('footer.php');
 }
 public function home()
 {
     $this->load->view('header.php');
            $this->load->view('home.php');
            $this->load->view('footer.php');
 }
 public function fivespecies()
 {
     $this->load->view('header.php');
            $this->load->view('fivespecies.php');
            $this->load->view('footer.php');
 }
 public function parasite()
 {
     $this->load->view('header.php');
            $this->load->view('parasite.php');
            $this->load->view('footer.php');
 }
 public function definite()
 {
     $this->load->view('header.php');
            $this->load->view('definite.php');
            $this->load->view('footer.php');
 }
 public function currenttools()
 {
     $this->load->view('header.php');
            $this->load->view('currenttools.php');
            $this->load->view('footer.php');
 }
 public function malariatreatment()
 {
     $this->load->view('header.php');
            $this->load->view('malariatreatment.php');
            $this->load->view('footer.php');
 }
 public function history()
 {
     $this->load->view('header.php');
            $this->load->view('history.php');
            $this->load->view('footer.php');
 }
 public function Areasofwork()
 {
     $this->load->view('header.php');
            $this->load->view('Areasofwork.php');
            $this->load->view('footer.php');
 }
 public function mapofprojects()
 {
     $this->load->view('header.php');
            $this->load->view('mapofprojects.php');
            $this->load->view('footer.php');
 }
 public function toolkits()
 {
     $this->load->view('header.php');
            $this->load->view('toolkits.php');
            $this->load->view('footer.php');
 }
 public function globalmalariamapper()
 {
     $this->load->view('header.php');
            $this->load->view('globalmalariamapper.php');
            $this->load->view('footer.php');
 }
 public function aboutus()
 {
     $this->load->view('header.php');
            $this->load->view('aboutus.php');
            $this->load->view('footer.php');
 }
 public function faq()
 {
     $this->load->view('header.php');
            $this->load->view('faq.php');
            $this->load->view('footer.php');
 }
 public function privacy()
 {
     $this->load->view('header.php');
            $this->load->view('privacy.php');
            $this->load->view('footer.php');
 }
 public function feedback() {

        if (isset($_POST ['feedsubmit'])) {

            $in_name = $this->input->post('name');
            $in_email = $this->input->post('email');
            $in_college = $this->input->post('college');
            $in_phone = $this->input->post('phone');
            $in_message = $this->input->post('message');

            $result = $this->USER_MODEL->add_new_feedback($in_name, $in_email, $in_college, $in_phone, $in_message);

            if ($result) {
                echo "";
                unset($_POST);
                $this->feedback();
                //redirect(base_url() . "feedback");
            } else {
                echo "";
                unset($_POST);
                $this->feedback();
                //redirect(base_url() . "feedback");
            }
        } else {
            $this->load->view('header');
            $this->load->view('feedback');
            $this->load->view('footer');
        }
    }
}```
</div>
</div>
</p>

<p>header.php in view folder.</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code><!-- === BEGIN HEADER === -->
<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9"> <![endif]-->
<!--[if !IE]><!-->
<html lang="en">
    <!--<![endif]-->
    <head>
        <!-- Title -->
        <title>Database for antimalarial Drug</title>
        <!-- Meta -->
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <meta name="description" content="">
        <meta name="author" content="">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
        <!-- Favicon -->
        <link href="favicon.ico" rel="shortcut icon">
        <!-- Bootstrap Core CSS -->
        <link rel="stylesheet" href="assets/css/bootstrap.css" rel="stylesheet">
        <!-- Template CSS -->
        <link rel="stylesheet" href="assets/css/animate.css" rel="stylesheet">
        <link rel="stylesheet" href="assets/css/font-awesome.css" rel="stylesheet">
        <link rel="stylesheet" href="assets/css/nexus.css" rel="stylesheet">
        <link rel="stylesheet" href="assets/css/responsive.css" rel="stylesheet">
        <link rel="stylesheet" href="assets/css/custom.css" rel="stylesheet">
        <!-- Google Fonts-->
        <link href="http://fonts.googleapis.com/css?family=Roboto+Condensed:400,300" rel="stylesheet" type="text/css">
    </head>
    <body>
        <div id="body-bg">
            <!-- Phone/Email -->
            <div id="pre-header" class="background-gray-lighter">
                <div class="container no-padding">
                    <div class="row hidden-xs">
                         <!--<div class="col-sm-6 padding-vert-5">
                            <strong>Phone:</strong> 9030051219
                        </div>-->

                    </div>
                </div>
            </div>
            <!-- End Phone/Email -->
            <!-- Header -->
            <div id="header">
                <div class="container">
                    <div class="row">
                        <!-- Logo -->
                        <div class="logo">

                                <img src="assets/img/logo1.png" alt="Logo" />

                        </div>
                        <!-- End Logo -->
                    </div>
                </div>
            </div>
            <!-- End Header -->
            <!-- Top Menu -->
            <div id="hornav" class="bottom-border-shadow">
                <div class="container no-padding border-bottom">
                    <div class="row">
                        <div class="col-md-8 no-padding">
                            <div class="visible-lg">
                                <ul id="hornavmenu" class="nav navbar-nav">
                                    <li>
                                        home
                                    </li>
                                    <li>
                                        <span class="fa-gears  ">Malaria</span>
                                        <ul>

                                            <li>
                                                index.php/Welcome/fivespecies">five Species
                                            </li>
                                            <li>
                                                index.php/Welcome/parasite">Parasite life cycle
                                            </li>
                                            <li>
                                                index.php/Welcome/definite">Definite and symptoms
                                            </li>
                                            <li>
                                                index.php/Welcome/currenttools">Current tools
                                            </li>
                                            <li>
                                                index.php/Welcome/malariatreatment">Malaria Treatment
                                            </li>
                                            <li>
                                                index.php/Welcome/history">History of antimalarials
                                            </li>
                                        </ul>
                                    </li>
                                    <li>
                                        <span class="fa-copy  ">Access</span>
                                        <ul>
                                            <li>
                                                index.php/Welcome/Areasofwork">Areas of work
                                            </li>
                                            <li>
                                                index.php/Welcome/mapofprojects">Map of Projects
                                            </li>
                                            <li>
                                                index.php/Welcome/toolkits">Tool kits
                                            </li>
                                            <li>
                                                index.php/Welcome/globalmalariamapper">Global malaria mapper
                                            </li>
                                            <li>
                                                index.php/Welcome/fivespecies">Access interviews
                                            </li>
                                        </ul>
                                    </li>
                                    <li>
                                        <span class="fa-th  ">News room</span>
                                        <ul>
                                            <li>
                                                News
                                            </li>
                                            <li>
                                                Press Releases
                                            </li>
                                            <li>
                                                Publications
                                            </li>
                                            <li>
                                                Events
                                            </li>
                                        </ul>
                                    </li>
                                    <li>
                                        <span class="fa-font  ">Blog</span>

                                    </li>
                                    <li>
                                        Drugs
                                    </li>
                                </ul>
                            </div>
                        </div>
                        <div class="col-md-4 no-padding">
                            <ul class="social-icons pull-right">
                                <li class="social-youtube">

                                </li>
                                <li class="social-twitter">

                                </li>
                                <li class="social-facebook">

                                </li>
                                <li class="social-googleplus">

                                </li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
            <!-- End Top Menu -->
            <!-- === END HEADER === --></code>```

.htaccess file

Options +FollowSymLinks
Options -Indexes
DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]```

答:
add assets/ to all link in css
Example
        assets/css/nexus.css" rel="stylesheet"></p>

Body:
my home page looks like

when i click on five species it displays like this

config.php in application folder.

<?php
defined('BASEPATH') OR exit('No direct script access allowed');

$config['base_url'] = 'http://localhost/antimalarial/';
$config['index_page'] = "index.php?";
$config['uri_protocol'] = 'REQUEST_URI';
$config['url_suffix'] = '';
$config['language'] = 'english';
$config['charset'] = 'UTF-8';
$config['enable_hooks'] = FALSE;
$config['subclass_prefix'] = 'MY_';
$config['composer_autoload'] = FALSE;
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';
$config['allow_get_array'] = TRUE;
$config['enable_query_strings'] = FALSE;
$config['controller_trigger'] = 'c';
$config['function_trigger'] = 'm';
$config['directory_trigger'] = 'd';
$config['log_threshold'] = 0;
$config['log_path'] = '';
$config['log_file_extension'] = '';
$config['log_file_permissions'] = 0644;
$config['log_date_format'] = 'Y-m-d H:i:s';
$config['error_views_path'] = '';
$config['cache_path'] = '';
$config['cache_query_string'] = FALSE;
$config['encryption_key'] = '';
$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = NULL;
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;
$config['cookie_prefix'] = '';
$config['cookie_domain'] = '';
$config['cookie_path']  = '/';
$config['cookie_secure'] = FALSE;
$config['cookie_httponly']  = FALSE;
$config['standardize_newlines'] = FALSE;
$config['global_xss_filtering'] = FALSE;
$config['csrf_protection'] = FALSE;
$config['csrf_token_name'] = 'csrf_test_name';
$config['csrf_cookie_name'] = 'csrf_cookie_name';
$config['csrf_expire'] = 7200;
$config['csrf_regenerate'] = TRUE;
$config['csrf_exclude_uris'] = array();
$config['compress_output'] = FALSE;
$config['time_reference'] = 'local';
$config['rewrite_short_tags'] = FALSE;
$config['proxy_ips'] = '';

routes.php in config folder.

<?php
defined('BASEPATH') OR exit('No direct script access allowed');

$route['default_controller'] = 'Welcome';
$route['(:any)'] = 'Welcome/$1';

Welcome.php in Controller folder

<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Welcome extends CI_Controller {

 /**
  * Index Page for this controller.
  *
  * Maps to the following URL
  *   http://example.com/index.php/welcome
  * - or -
  *   http://example.com/index.php/welcome/index
  * - or -
  * Since this controller is set as the default controller in
  * config/routes.php, it's displayed at http://example.com/
  *
  * So any other public methods not prefixed with an underscore will
  * map to /index.php/welcome/<method_name>
  * @see https://codeigniter.com/user_guide/general/urls.html
  */

 public function __construct() {
        parent::__construct();

    }
 public function index()
 {
     $this->load->view('header.php');
            $this->load->view('home.php');
            $this->load->view('footer.php');
 }
 public function home()
 {
     $this->load->view('header.php');
            $this->load->view('home.php');
            $this->load->view('footer.php');
 }
 public function fivespecies()
 {
     $this->load->view('header.php');
            $this->load->view('fivespecies.php');
            $this->load->view('footer.php');
 }
 public function parasite()
 {
     $this->load->view('header.php');
            $this->load->view('parasite.php');
            $this->load->view('footer.php');
 }
 public function definite()
 {
     $this->load->view('header.php');
            $this->load->view('definite.php');
            $this->load->view('footer.php');
 }
 public function currenttools()
 {
     $this->load->view('header.php');
            $this->load->view('currenttools.php');
            $this->load->view('footer.php');
 }
 public function malariatreatment()
 {
     $this->load->view('header.php');
            $this->load->view('malariatreatment.php');
            $this->load->view('footer.php');
 }
 public function history()
 {
     $this->load->view('header.php');
            $this->load->view('history.php');
            $this->load->view('footer.php');
 }
 public function Areasofwork()
 {
     $this->load->view('header.php');
            $this->load->view('Areasofwork.php');
            $this->load->view('footer.php');
 }
 public function mapofprojects()
 {
     $this->load->view('header.php');
            $this->load->view('mapofprojects.php');
            $this->load->view('footer.php');
 }
 public function toolkits()
 {
     $this->load->view('header.php');
            $this->load->view('toolkits.php');
            $this->load->view('footer.php');
 }
 public function globalmalariamapper()
 {
     $this->load->view('header.php');
            $this->load->view('globalmalariamapper.php');
            $this->load->view('footer.php');
 }
 public function aboutus()
 {
     $this->load->view('header.php');
            $this->load->view('aboutus.php');
            $this->load->view('footer.php');
 }
 public function faq()
 {
     $this->load->view('header.php');
            $this->load->view('faq.php');
            $this->load->view('footer.php');
 }
 public function privacy()
 {
     $this->load->view('header.php');
            $this->load->view('privacy.php');
            $this->load->view('footer.php');
 }
 public function feedback() {

        if (isset($_POST ['feedsubmit'])) {

            $in_name = $this->input->post('name');
            $in_email = $this->input->post('email');
            $in_college = $this->input->post('college');
            $in_phone = $this->input->post('phone');
            $in_message = $this->input->post('message');

            $result = $this->USER_MODEL->add_new_feedback($in_name, $in_email, $in_college, $in_phone, $in_message);

            if ($result) {
                echo "";
                unset($_POST);
                $this->feedback();
                //redirect(base_url() . "feedback");
            } else {
                echo "";
                unset($_POST);
                $this->feedback();
                //redirect(base_url() . "feedback");
            }
        } else {
            $this->load->view('header');
            $this->load->view('feedback');
            $this->load->view('footer');
        }
    }
}

header.php in view folder.

<!DOCTYPE html>

        <title>Database for antimalarial Drug</title>

        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <meta name="description" content="">
        <meta name="author" content="">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />

        <link href="favicon.ico" rel="shortcut icon">

        <link rel="stylesheet" href="assets/css/bootstrap.css" rel="stylesheet">

        <link rel="stylesheet" href="assets/css/animate.css" rel="stylesheet">
        <link rel="stylesheet" href="assets/css/font-awesome.css" rel="stylesheet">
        <link rel="stylesheet" href="assets/css/nexus.css" rel="stylesheet">
        <link rel="stylesheet" href="assets/css/responsive.css" rel="stylesheet">
        <link rel="stylesheet" href="assets/css/custom.css" rel="stylesheet">

        <link href="http://fonts.googleapis.com/css?family=Roboto+Condensed:400,300" rel="stylesheet" type="text/css">

                                        home

                                        Malaria

                                                <a href="<?php echo base_url() ?>index.php/Welcome/fivespecies">five Species

                                                <a href="<?php echo base_url() ?>index.php/Welcome/parasite">Parasite life cycle

                                                <a href="<?php echo base_url() ?>index.php/Welcome/definite">Definite and symptoms

                                                <a href="<?php echo base_url() ?>index.php/Welcome/currenttools">Current tools

                                                <a href="<?php echo base_url() ?>index.php/Welcome/malariatreatment">Malaria Treatment

                                                <a href="<?php echo base_url() ?>index.php/Welcome/history">History of antimalarials

                                        Access

                                                <a href="<?php echo base_url() ?>index.php/Welcome/Areasofwork">Areas of work

                                                <a href="<?php echo base_url() ?>index.php/Welcome/mapofprojects">Map of Projects

                                                <a href="<?php echo base_url() ?>index.php/Welcome/toolkits">Tool kits

                                                <a href="<?php echo base_url() ?>index.php/Welcome/globalmalariamapper">Global malaria mapper

                                                <a href="<?php echo base_url() ?>index.php/Welcome/fivespecies">Access interviews

                                        News room

                                                News

                                                Press Releases

                                                Publications

                                                Events

                                        Blog

                                        Drugs

.htaccess file

Options +FollowSymLinks
Options -Indexes
DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]


问:
If column contain string from array of strings create new column with
I have a data frame that look like this

```<code>     Col1     Col2
0     22     Apple
1     43     Carrot
2     54     Orange
3     74     Spinach
4     14     Cucumber
</code>```

And I need to add new column with the category "Fruit" , "Vegetable" or "Leaf"
I created a list for each category

```<code>Fru = {'Apple','Orange', 'Grape', 'Blueberry', 'Strawberry'}
Veg = {'Cucumber','Carrot','Broccoli', 'Onion'}
Leaf = {'Lettuce', 'Kale', 'Spinach'}
</code>```

And the result should look like this

```<code>    Col1      Col2     Category
0     22     Apple      Fruit
1     43     Carrot     Vegetable
2     54     Orange     Fruit
3     74     Spinach    Leaf
4     14     Cucumber   Vegetable
</code>```

I tried np.where  and contains yet both functions give: 'in ' requires string as left operand, not set

答:
Use Series.map with new dictionary d1:

```<code>Fru = {'Apple','Orange', 'Grape', 'Blueberry', 'Strawberry'}
Veg = {'Cucumber','Carrot','Broccoli', 'Onion'}
Leaf = {'Lettuce', 'Kale', 'Spinach'}

d = {'Fruit':Fru, 'Vegetable':Veg,'Leaf':Leaf}

#swap key values in dict
#http://stackoverflow.com/a/31674731/2901002
d1 = {k: oldk for oldk, oldv in d.items() for k in oldv}
print (d1)

df['Category'] = df['Col2'].map(d1)
print (df)
   Col1      Col2   Category
0    22     Apple      Fruit
1    43    Carrot  Vegetable
2    54    Orange      Fruit
3    74   Spinach       Leaf
4    14  Cucumber  Vegetable
</code>```

Or use numpy.select:

```<code>df['Category'] = np.select([df['Col2'].isin(Fru),df['Col2'].isin(Veg),df['Col2'].isin(Leaf)],
                           ['Fruit','Vegetable','Leaf'])
print (df)

   Col1      Col2   Category
0    22     Apple      Fruit
1    43    Carrot  Vegetable
2    54    Orange      Fruit
3    74   Spinach       Leaf
4    14  Cucumber  Vegetable
</code>```

Body:
I have a data frame that look like this

     Col1     Col2
0     22     Apple
1     43     Carrot
2     54     Orange
3     74     Spinach
4     14     Cucumber

And I need to add new column with the category "Fruit" , "Vegetable" or "Leaf"
I created a list for each category

Fru = {'Apple','Orange', 'Grape', 'Blueberry', 'Strawberry'}
Veg = {'Cucumber','Carrot','Broccoli', 'Onion'}
Leaf = {'Lettuce', 'Kale', 'Spinach'}

And the result should look like this

    Col1      Col2     Category
0     22     Apple      Fruit
1     43     Carrot     Vegetable
2     54     Orange     Fruit
3     74     Spinach    Leaf
4     14     Cucumber   Vegetable

I tried np.where  and contains yet both functions give: 'in ' requires string as left operand, not set

Body:
Use Series.map with new dictionary d1:

Fru = {'Apple','Orange', 'Grape', 'Blueberry', 'Strawberry'}
Veg = {'Cucumber','Carrot','Broccoli', 'Onion'}
Leaf = {'Lettuce', 'Kale', 'Spinach'}

d = {'Fruit':Fru, 'Vegetable':Veg,'Leaf':Leaf}

#swap key values in dict
#http://stackoverflow.com/a/31674731/2901002
d1 = {k: oldk for oldk, oldv in d.items() for k in oldv}
print (d1)

df['Category'] = df['Col2'].map(d1)
print (df)
   Col1      Col2   Category
0    22     Apple      Fruit
1    43    Carrot  Vegetable
2    54    Orange      Fruit
3    74   Spinach       Leaf
4    14  Cucumber  Vegetable

Or use numpy.select:

df['Category'] = np.select([df['Col2'].isin(Fru),df['Col2'].isin(Veg),df['Col2'].isin(Leaf)],
                           ['Fruit','Vegetable','Leaf'])
print (df)

   Col1      Col2   Category
0    22     Apple      Fruit
1    43    Carrot  Vegetable
2    54    Orange      Fruit
3    74   Spinach       Leaf
4    14  Cucumber  Vegetable


答:
That's because you did not create a list, you created a set as your error shows. You can try making the set a list as the argument for the .isin():

```<code>import pandas as pd
import numpy as np
df = pd.DataFrame({'Col1':[22,43,54,74,14],'Col2':['Apple','Carrot','Orange','Spinach','Cucumber']})

Fru = {'Apple','Orange', 'Grape', 'Blueberry', 'Strawberry'}
Veg = {'Cucumber','Carrot','Broccoli', 'Onion'}
Leaf = {'Lettuce', 'Kale', 'Spinach'}

df['Category'] = np.where(df['Col2'].isin(Fru),'Fruit',
  np.where(df['Col2'].isin(Veg),'Vegetable',
  np.where(df['Col2'].isin(Leaf),'Leaf')))
print(df)
</code>```

Output:

```<code>  Col1      Col2   Category
0    22     Apple      Fruit
1    43    Carrot  Vegetable
2    54    Orange      Fruit
3    74   Spinach       Leaf
4    14  Cucumber  Vegetable
</code>```

Title: If column contain string from array of strings create new column with

Body:
That's because you did not create a list, you created a set as your error shows. You can try making the set a list as the argument for the .isin():

import pandas as pd
import numpy as np
df = pd.DataFrame({'Col1':[22,43,54,74,14],'Col2':['Apple','Carrot','Orange','Spinach','Cucumber']})

Fru = {'Apple','Orange', 'Grape', 'Blueberry', 'Strawberry'}
Veg = {'Cucumber','Carrot','Broccoli', 'Onion'}
Leaf = {'Lettuce', 'Kale', 'Spinach'}

df['Category'] = np.where(df['Col2'].isin(Fru),'Fruit',
  np.where(df['Col2'].isin(Veg),'Vegetable',
  np.where(df['Col2'].isin(Leaf),'Leaf')))
print(df)

Output:

  Col1      Col2   Category
0    22     Apple      Fruit
1    43    Carrot  Vegetable
2    54    Orange      Fruit
3    74   Spinach       Leaf
4    14  Cucumber  Vegetable


问:
Asymmetric GridLayout / RecyclerView with GridLayoutManager
I'm trying to display a grid like this one (graphical rack cabinet representation) with one of the title mentioned methods (help me to find what's best), but I can't find a proper solution.

At the moment I'm using a GridLayout inside a ScrollView, first by generating the index column (text views) to then add buttons at the correct index (effective position in which the device is mounted) with span to expand the button on multiple rows where it's needed (device that occupies more than one rack unit).

With every path I've tried, I've always encountered the same problems :

How to dinamically add buttons that takes more than one row for only one column (the devices one).

How to leve blank spaces (only for the devices column) for the units that aren't used.

Since I've finished mine, any idea is welcome.

答:
Use recyclerview and customize your list item height in your onBindViewHolder method of RecyclerView.Adapter like bellow</p>

```<code>override fun onBindViewHolder(holder: ViewHolder, position: Int) {
    val item = values[position]
    // You can customize it as per your requirement
    holder.itemView.layoutParams.height = position*50
}
</code>```

Body:
Use recyclerview and customize your list item height in your onBindViewHolder method of RecyclerView.Adapter like bellow

override fun onBindViewHolder(holder: ViewHolder, position: Int) {
    val item = values[position]
    // You can customize it as per your requirement
    holder.itemView.layoutParams.height = position*50
}


问:
Multiple comparisons inside for loops don't break php code. Why?
Why this piece of code works when it is clearly wrong in the second for loop (for ($i==0; $i<$parts; $i++) {)?
Does php allows for multiple comparisons inside for loops?

```<code>function split_integer ($num,$parts) {
    $value = 0;
    $i = 0;
    $result = [];
    $modulus = $num%$parts;

    if ($modulus == 0) {
        for($i = 0; $i < $parts; $i++)
        {
            $value = $num/$parts;
            $result[] = $value;
        }
    } else {
        $valueMod = $parts - ($num % $parts);
        $value = $num/$parts;

        for ($i==0; $i<$parts; $i++) {
            if ($i >= $valueMod) {
                $result[] = floor($value+1);
            } else {
                $result[] = floor($value);
            }
        }
    }
    return $result;
}
</code>```

答:
Code for ($i==0; $i < $parts; $i++) runs because $i==0 has no impact on loop.

In normal for loop first statement just sets $i or any other counter's initial value. As you already set $i to 0 earlier, your loop runs from $i = 0 until second statement $i < $parts is not true.

Going further, you can even omit first statement:

```<code>$i = 0;
for (; $i < 3; $i++) {
    echo $i;
}
</code>```

And loop will still run 3 times from 0 to 2.

Body:
Why this piece of code works when it is clearly wrong in the second for loop (for ($i==0; $i<$parts; $i++) {)?
Does php allows for multiple comparisons inside for loops?

function split_integer ($num,$parts) {
    $value = 0;
    $i = 0;
    $result = [];
    $modulus = $num%$parts;

    if ($modulus == 0) {
        for($i = 0; $i < $parts; $i++)
        {
            $value = $num/$parts;
            $result[] = $value;
        }
    } else {
        $valueMod = $parts - ($num % $parts);
        $value = $num/$parts;

        for ($i==0; $i<$parts; $i++) {
            if ($i >= $valueMod) {
                $result[] = floor($value+1);
            } else {
                $result[] = floor($value);
            }
        }
    }
    return $result;
}

Body:
Code for ($i==0; $i < $parts; $i++) runs because $i==0 has no impact on loop.

In normal for loop first statement just sets $i or any other counter's initial value. As you already set $i to 0 earlier, your loop runs from $i = 0 until second statement $i < $parts is not true.

Going further, you can even omit first statement:

$i = 0;
for (; $i < 3; $i++) {
    echo $i;
}

And loop will still run 3 times from 0 to 2.


问:
Installing fresh react app with dockerfile
I'm trying to run a fresh installation of React using a Dockerfile.

```<code>FROM node:12.14-alpine

RUN mkdir /app
WORKDIR /app

RUN npm install -g nodemon \
    npx create-react-app .

COPY package.json package.json
RUN npm install --silent

COPY . .

CMD [ "node", "start" ]
</code>```

My root folder is empty so no package.json file exists etc. When I run docker-compose up --build I get the following error which indicates that's failing on npx create-react-app .

```<code>Step 5/9 : RUN npm install -g nodemon     npx create-react-app .
 ---> Running in c4878af5f94d
npm ERR! code ENOLOCAL
npm ERR! Could not install from "" as it does not contain a package.json file.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2020-02-18T12_55_14_899Z-debug.log
ERROR: Service 'react' failed to build: The command '/bin/sh -c npm install -g nodemon     npx create-react-app .' returned a non-zero code: 1
</code>```

Any ideas what I'm doing wrong? I'm not having node or npm installed natively so all needs t run through docker

答:
You forgot "&&" at the beginning line 7</p>

```<code>FROM node:12.14-alpine

RUN mkdir /app
WORKDIR /app

RUN npm install -g nodemon \
    && npx create-react-app .

COPY package.json package.json
RUN npm install --silent

...

CMD [ "node", "start" ]
</code>```

Body:
I'm trying to run a fresh installation of React using a Dockerfile.

FROM node:12.14-alpine

RUN mkdir /app
WORKDIR /app

RUN npm install -g nodemon \
    npx create-react-app .

COPY package.json package.json
RUN npm install --silent

COPY . .

CMD [ "node", "start" ]

My root folder is empty so no package.json file exists etc. When I run docker-compose up --build I get the following error which indicates that's failing on npx create-react-app .

Step 5/9 : RUN npm install -g nodemon     npx create-react-app .
 ---> Running in c4878af5f94d
npm ERR! code ENOLOCAL
npm ERR! Could not install from "" as it does not contain a package.json file.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2020-02-18T12_55_14_899Z-debug.log
ERROR: Service 'react' failed to build: The command '/bin/sh -c npm install -g nodemon     npx create-react-app .' returned a non-zero code: 1

Any ideas what I'm doing wrong? I'm not having node or npm installed natively so all needs t run through docker

Body:
You forgot "&&" at the beginning line 7

FROM node:12.14-alpine

RUN mkdir /app
WORKDIR /app

RUN npm install -g nodemon \
    && npx create-react-app .

COPY package.json package.json
RUN npm install --silent

...

CMD [ "node", "start" ]


问:
post fetch method is not working using placeholder typicode
```<code>fetch('https://jsonplaceholder.typicode.com/posts', {
    method: 'POST'
}).then(function (response) {
    // The API call was successful!
    if (response.ok) {
        return response.json();
    } else {
        return Promise.reject(response);
    }
}).then(function (data) {
    // This is the JSON from our response
    console.log(data);
}).catch(function (err) {
    // There was an error
    console.warn('Something went wrong.', err);
});
</code>```

post fetch method is not working tried below code does not responding any response what could the cause please guide

Getting failed net err_failed typicode placeholder

or probably Access to fetch at 'https://jsonplaceholder.typicode.com/posts' from origin 'https://cdpn.io' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

答:
Please remove completely the fetch options object

{
    method: 'POST'
}

from your call.

This call should be GET and no POST

Body:
fetch('https://jsonplaceholder.typicode.com/posts', {
    method: 'POST'
}).then(function (response) {
    // The API call was successful!
    if (response.ok) {
        return response.json();
    } else {
        return Promise.reject(response);
    }
}).then(function (data) {
    // This is the JSON from our response
    console.log(data);
}).catch(function (err) {
    // There was an error
    console.warn('Something went wrong.', err);
});

post fetch method is not working tried below code does not responding any response what could the cause please guide

Getting failed net err_failed typicode placeholder

or probably Access to fetch at 'https://jsonplaceholder.typicode.com/posts' from origin 'https://cdpn.io' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.


问:
spark submit add multiple jars in classpath
I am trying to run a spark program where i have multiple jar files, if I had only one jar I am not able run. I want to add both the jar files which are in same location. I have tried the below but it shows a dependency error

```<code>spark-submit \
  --class "max" maxjar.jar Book1.csv test \
  --driver-class-path /usr/lib/spark/assembly/lib/hive-common-0.13.1-cdh5.3.0.jar
</code>```

How can i add another jar file which is in the same directory?

I want add /usr/lib/spark/assembly/lib/hive-serde.jar.

答:
Pass --jars with the path of jar files separated by , to spark-submit.

For reference:

```<code>--driver-class-path is used to mention "extra" jars to add to the "driver" of the spark job

--driver-library-path is used to "change" the default library path for the jars needed for the spark driver

--driver-class-path will only push the jars to the driver machine. If you want to send the jars to "executors", you need to use --jars
</code>```

And to set the jars programatically set the following config:
spark.yarn.dist.jars with comma-separated list of jars.

Eg:

```<code>from pyspark.sql import SparkSession

spark = SparkSession \
        .builder \
        .appName("Spark config example") \
        .config("spark.yarn.dist.jars", "<path-to-jar/test1.jar>,<path-to-jar/test2.jar>") \
        .getOrCreate()
</code>```

Body:
I am trying to run a spark program where i have multiple jar files, if I had only one jar I am not able run. I want to add both the jar files which are in same location. I have tried the below but it shows a dependency error

spark-submit \
  --class "max" maxjar.jar Book1.csv test \
  --driver-class-path /usr/lib/spark/assembly/lib/hive-common-0.13.1-cdh5.3.0.jar

How can i add another jar file which is in the same directory?

I want add /usr/lib/spark/assembly/lib/hive-serde.jar.

Body:
Pass --jars with the path of jar files separated by , to spark-submit.

For reference:

--driver-class-path is used to mention "extra" jars to add to the "driver" of the spark job

--driver-library-path is used to "change" the default library path for the jars needed for the spark driver

--driver-class-path will only push the jars to the driver machine. If you want to send the jars to "executors", you need to use --jars

And to set the jars programatically set the following config:
spark.yarn.dist.jars with comma-separated list of jars.

Eg:

from pyspark.sql import SparkSession

spark = SparkSession \
        .builder \
        .appName("Spark config example") \
        .config("spark.yarn.dist.jars", "<path-to-jar/test1.jar>,<path-to-jar/test2.jar>") \
        .getOrCreate()


问:
Business Model + Database Mapper + Joins
I am studying business models and UML. I read that a 'Model' is a series of 'Business Objects'.

From what I have understood a model would be 'Blog' whereas the business objects could be 'Post' and 'Comment'. The 'Blog' decides which objects to use and how they are to be persisted with appropriate mappers.

I have thrown together a few UML diagrams to explore this concept and it does seem quite logical. However I am a little confused:

Issue #1 - In Joomla models appear to represent a singular 'Business Object' (as opposed to coordinating multiple business objects and mappers). Does Joomla adopt a different approach to models?

Issue #2 - Is it acceptable for 'Mapper' objects to perform left joins in queries? Or should this kind of logic be moved into the 'Service' layer?

It seems most logical to utilise left join capabilities of the database, but I cannot figure out how this fits into (Mapper + BusinessObject + Model + Service) design.

答:
In the java language  the persistence annotations are written as java annotations in the code. This is really cool because you can focus on objects and therefore model you application within a class diagram.

Note that only the class diagram has a real code equivalent while other diagrams are using Model Driven Development with a code generator. This is important to see that only the class diagram could be used for Business object and mapper together.

You can still use AndroMDA and create persistence layers using code generator but I think this approach is now dead when using Java code.

How it works. You model class diagrams to create the static object (e.g. packages, classes, interface, enum etc....) of your applications in a class diagram. You then add persistence stereotypes which will create immediately java annotations in your code. Finally to create your database you only need to use Hibernate mapper which will take the java code in entry and generate a database. At deployment stage you will need to code directly in the code sql queries related to your database but this is the latest and usually none critical development which could be done in an offshore country


问:
Popover on vertical scroll-able table is not working (Means popover does not scroll up or down with triggered element)
I am working on a table (vertical scrollable) where I have to open a popover on click event. But when i scroll up the table, the popover remains on the same position. I want the popover to scroll up or down with the respective element.

https://codepen.io/LAXMI1991/pen/jOPrrpj

$(document).ready(function() {
  $('[data-toggle="popover"]').popover();
});```
<pre class="snippet-code-css lang-css prettyprint-override"><code>.fixed_header {
  width: 100%;
}

.fixed_header tbody {
  display: block;
  overflow: auto;
  height: 200px;
  width: 100%;
}

.fixed_header thead tr {
  display: block;
}</code>```

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

          Firstname
          Lastname
          Email
          Action

          July
          Dooley
          july@example.com
          ...

```

答:
This is just a simple fix to your problem but it will not work in complex programming. just give an id or something to your (...) element that toggles the popover.and you need a good CSS practice .

$(document).ready(function(){
    $('[data-toggle="popover"]').popover();

  var $element = $('[data-toggle="popover"]');

$(window).scroll(function() {

    if($(this).scrollTop() > 0) {
        $element.fadeOut(1000);
    } else {
        $element.fadeIn(1000);
    }
});
  $('a').click(function(){
    $('.popover').css({position: 'sticky'});
  });
});```
<pre class="snippet-code-css lang-css prettyprint-override"><code>.fixed_header
{
  width:100%;
}
.fixed_header tbody{
  display:block;
  overflow:auto;
  height:200px;
  width:100%;
}
.fixed_header thead tr{
  display:block;
}

/* .popover-body {
    height: 50px;
    overflow-y: auto;
    white-space:pre-wrap;
} */</code>```

<!DOCTYPE html>

  <title>Bootstrap Example</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">

        Firstname
        Lastname
        Email
        Action

        John
        Doe
        john@example.com
         ...

        Mary
        Moe
        mary@example.com
         ...

        July
        Dooley
        july@example.com
         ...

        July
        Dooley
        july@example.com
            ...

        July
        Dooley
        july@example.com
            ...

        July
        Dooley
        july@example.com
            ...

        July
        Dooley
        july@example.com
            ...

        July
        Dooley
        july@example.com
            ...

        July
        Dooley
        july@example.com
            ...

        July
        Dooley
        july@example.com
            ...

        July
        Dooley
        july@example.com
            ...

        July
        Dooley
        july@example.com
            ...

        July
        Dooley
        july@example.com
            ...

        July
        Dooley
        july@example.com
            ...

```

Body:
I am working on a table (vertical scrollable) where I have to open a popover on click event. But when i scroll up the table, the popover remains on the same position. I want the popover to scroll up or down with the respective element.

https://codepen.io/LAXMI1991/pen/jOPrrpj

$(document).ready(function() {
  $('[data-toggle="popover"]').popover();
});

.fixed_header {
  width: 100%;
}

.fixed_header tbody {
  display: block;
  overflow: auto;
  height: 200px;
  width: 100%;
}

.fixed_header thead tr {
  display: block;
}

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

          Firstname
          Lastname
          Email
          Action

          July
          Dooley
          july@example.com
          ...

Body:
This is just a simple fix to your problem but it will not work in complex programming. just give an id or something to your (...) element that toggles the popover.and you need a good CSS practice .

$(document).ready(function(){
    $('[data-toggle="popover"]').popover();

  var $element = $('[data-toggle="popover"]');

$(window).scroll(function() {

    if($(this).scrollTop() > 0) {
        $element.fadeOut(1000);
    } else {
        $element.fadeIn(1000);
    }
});
  $('a').click(function(){
    $('.popover').css({position: 'sticky'});
  });
});

.fixed_header
{
  width:100%;
}
.fixed_header tbody{
  display:block;
  overflow:auto;
  height:200px;
  width:100%;
}
.fixed_header thead tr{
  display:block;
}

/* .popover-body {
    height: 50px;
    overflow-y: auto;
    white-space:pre-wrap;
} */

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Bootstrap Example</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
</head>
<body>

<div class="container">
    <div class="fixed_header">
     <table class="table ">
    <thead>
      <tr>
        <th>Firstname</th>
        <th >Lastname</th>
        <th>Email</th>
        <th>Action</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td>John</td>
        <td>Doe</td>
        <td>john@example.com</td>
         <th><a href="#"  data-toggle="popover" title="Popover Header" data-trigger="click" data-content="Some content inside the popover" >...</a></th>
      </tr>
      <tr>
        <td>Mary</td>
        <td>Moe</td>
        <td>mary@example.com</td>
         <th><a href="#" data-toggle="popover" data-trigger="click" title="Popover Header" data-content="Some content inside the popover" >...</a></th>
      </tr>
      <tr>
        <td>July</td>
        <td>Dooley</td>
        <td>july@example.com</td>
         <th><a href="#" data-toggle="popover" data-trigger="focus" title="Popover Header" data-content="Some content inside the popover" >...</a></th>
      </tr>
         <tr>
        <td>July</td>
        <td>Dooley</td>
        <td>july@example.com</td>
            <th><a href="#" data-toggle="popover" data-trigger="focus" title="Popover Header" data-content="Some content inside the popover" >...</a></th>
      </tr>
         <tr>
        <td>July</td>
        <td>Dooley</td>
        <td>july@example.com</td>
            <th><a href="#" data-toggle="popover" data-trigger="focus" title="Popover Header" data-content="Some content inside the popover" >...</a></th>
      </tr>
         <tr>
        <td>July</td>
        <td>Dooley</td>
        <td>july@example.com</td>
            <th><a href="#" data-toggle="popover" data-trigger="focus" title="Popover Header" data-content="Some content inside the popover" >...</a></th>
      </tr>
         <tr>
        <td>July</td>
        <td>Dooley</td>
        <td>july@example.com</td>
            <th><a href="#" data-toggle="popover" data-trigger="focus" title="Popover Header" data-content="Some content inside the popover" >...</a></th>
      </tr>
         <tr>
        <td>July</td>
        <td>Dooley</td>
        <td>july@example.com</td>
            <th><a href="#" data-toggle="popover" data-trigger="focus" title="Popover Header" data-content="Some content inside the popover" >...</a></th>
      </tr>
         <tr>
        <td>July</td>
        <td>Dooley</td>
        <td>july@example.com</td>
            <th><a href="#" data-toggle="popover" data-trigger="focus" title="Popover Header" data-content="Some content inside the popover" >...</a></th>
      </tr>
         <tr>
        <td>July</td>
        <td>Dooley</td>
        <td>july@example.com</td>
            <th><a href="#" data-toggle="popover" data-trigger="focus" title="Popover Header" data-content="Some content inside the popover" >...</a></th>
      </tr>
         <tr>
        <td>July</td>
        <td>Dooley</td>
        <td>july@example.com</td>
            <th><a href="#" data-toggle="popover" data-trigger="focus" title="Popover Header" data-content="Some content inside the popover" >...</a></th>
      </tr>
         <tr>
        <td>July</td>
        <td>Dooley</td>
        <td>july@example.com</td>
            <th><a href="#" data-toggle="popover" title="Popover Header" data-content="Some content inside the popover" >...</a></th>
      </tr>
         <tr>
        <td>July</td>
        <td>Dooley</td>
        <td>july@example.com</td>
            <th><a href="#" data-toggle="popover" title="Popover Header" data-content="Some content inside the popover" >...</a></th>
      </tr>
         <tr>
        <td>July</td>
        <td>Dooley</td>
        <td>july@example.com</td>
            <th><a href="#" data-toggle="popover" title="Popover Header" data-content="Some content inside the popover" >...</a></th>
      </tr>
    </tbody>
  </table>
  </div>
  </div>

</body>
</html>


问:
Modal is closed when cursor is released outside the modal after Chrome update (angularjs and bootstrap-ui)
Sometimes when I want to quickly select the entire text of an input (within a modal), I begin selecting from the end of the text and move the mouse to the left until the entire text is selected and then I release.

Sometimes this release will occur outside the modal because the mouse movement is fast.

Picture describing the movement:

The problem is that the modal is closed when I release outside.

Question: how can I prevent the modal from closing when releasing outside?

I'm okay with the modal being closed with a click outside. But not okay with the release event.

I'm using:

angularjs 1.5.8

angular-bootstrap 2.5.0 (aka bootstrap-ui)

bootstrap 3.3.7 (only css!!! not js, because js is provided by the above)

Update:
I've created a plunkr and a GIF:
https://plnkr.co/edit/mxDLAdnrQ4p0KKyw?p=info

```<code><div class="modal-body">
  <div class="form-group">
    <label for="">Foo</label>
    <input type="text" class="form-control input-sm" ng-model="foo">

    <p>Do this: select the text from right to left and release the mouse outside the modal.</p>
  </div>
</div>
</code>```

GIF:

Update 2

I have new information! This started happening after the last Goole Chrome update! I tried with another computer that had the previous version of Chrome and the modal doesn't close.

答:
I had a similar situation with range slider. leaving click during slide outside the modal closes it. so I removed data-toggle="modal" and data-target="#mymodal" and added a click event with extra parameters

```<code>jQuery('button#modal_toggler').click(function(){
  jQuery('#myModal').modal({
          backdrop: 'static',
          keyboard: false
  })
})
</code>```

backdrop to disable modal close on clicking outside
keyboard this is for my scenario, to disable keyboard entry for closing modal

Body:
Sometimes when I want to quickly select the entire text of an input (within a modal), I begin selecting from the end of the text and move the mouse to the left until the entire text is selected and then I release.

Sometimes this release will occur outside the modal because the mouse movement is fast.

Picture describing the movement:

The problem is that the modal is closed when I release outside.

Question: how can I prevent the modal from closing when releasing outside?

I'm okay with the modal being closed with a click outside. But not okay with the release event.

I'm using:

angularjs 1.5.8

angular-bootstrap 2.5.0 (aka bootstrap-ui)

bootstrap 3.3.7 (only css!!! not js, because js is provided by the above)

Update:
I've created a plunkr and a GIF:
https://plnkr.co/edit/mxDLAdnrQ4p0KKyw?p=info

    Foo
    <input type="text" class="form-control input-sm" ng-model="foo">

Do this: select the text from right to left and release the mouse outside the modal.

GIF:

Update 2

I have new information! This started happening after the last Goole Chrome update! I tried with another computer that had the previous version of Chrome and the modal doesn't close.

Body:
I had a similar situation with range slider. leaving click during slide outside the modal closes it. so I removed data-toggle="modal" and data-target="#mymodal" and added a click event with extra parameters

jQuery('button#modal_toggler').click(function(){
  jQuery('#myModal').modal({
          backdrop: 'static',
          keyboard: false
  })
})

backdrop to disable modal close on clicking outside
keyboard this is for my scenario, to disable keyboard entry for closing modal


问:
How are array elements stored when the array has null elements?
I know this is basic but I'm not finding sources that confirms my interpretation.

The goal is to understand how arrays are stored in memory, below you will find my interpretation.

If a 4 size Array is like:

```<code>array[0] = 0

array[1] = null

array[2] = 2

array[3] = 3
</code>```

Is it stored adjacently in memory without counting nulls, like this for instance?

```<code>[0], [2], [3]
</code>```

if you add an element in a null position ([1]), than the next elements are pulled 1 position in memory?

[0], [1] (New), [2] (Pulled), [3] (Pulled)

References (Amoung others):

Arrays in Java

答:
If you start with an empty array like so:

```<code>int[] intArray = new int[];
String[] stringArray = new String[];
</code>```

you'll have this in you java memory (this is oversimplified):

Both arrays get initialized with their default values (null for String because it's an object and 0 for int).

What is the default initialization of an array in Java?

Now if you try to populate the arrays:

```<code>intArray[0] = 0
intArray[2] = 2
intArray[3] = 3

stringArray[0] = "0"
stringArray[2] = "2"
stringArray[3] = "3"
</code>```

you'll output in memory will become this:

if you add an element in a null position (1), than the next elements are pulled 1 position in memory?

No this is not true, if a index(1) has a value of null it will still populate his place in the index (see last picture see 2). Because the index(1) actually is populated with a value, only it's the default value.

Body:
I know this is basic but I'm not finding sources that confirms my interpretation.

The goal is to understand how arrays are stored in memory, below you will find my interpretation.

If a 4 size Array is like:

array[0] = 0

array[1] = null

array[2] = 2

array[3] = 3

Is it stored adjacently in memory without counting nulls, like this for instance?

[0], [2], [3]

if you add an element in a null position ([1]), than the next elements are pulled 1 position in memory?

[0], [1] (New), [2] (Pulled), [3] (Pulled)

References (Amoung others):

Arrays in Java

Body:
If you start with an empty array like so:

int[] intArray = new int[];
String[] stringArray = new String[];

you'll have this in you java memory (this is oversimplified):

Both arrays get initialized with their default values (null for String because it's an object and 0 for int).

What is the default initialization of an array in Java?

Now if you try to populate the arrays:

intArray[0] = 0
intArray[2] = 2
intArray[3] = 3

stringArray[0] = "0"
stringArray[2] = "2"
stringArray[3] = "3"

you'll output in memory will become this:

if you add an element in a null position (1), than the next elements are pulled 1 position in memory?

No this is not true, if a index(1) has a value of null it will still populate his place in the index (see last picture see 2). Because the index(1) actually is populated with a value, only it's the default value.


问:
C++: Rotating point around origin, but output point is not correct by some margin
first time asking.
I want to rotate a point in 3d in c++ in the XY Plane and am using the following function for the task.

void rotateXY(double angle){
    //save the x and y and z coordinates in seperate variables
    double x = this->pos[0]; // value 1
    double y = this->pos[1]; // value 0
    double z = this->pos[2]; // value 0, but in the xy rotation it is not important
    double radian = angle*M_PI/180;

    this->pos[0] = cos(radian)*x - sin(radian)*y;
    this->pos[1] = sin(radian)*x + cos(radian)*y;
    this->pos[2] = 1*z;
};
```

<p>I got the matrix from https://gamedevelopment.tutsplus.com/tutorials/lets-build-a-3d-graphics-engine-linear-transformations--gamedev-7716</p>

<p>In this I am directly manipulating the coordinates of the point, hence the this->pos[0]</p>

<p>If I call another function called rotateXYP where I first substract a mathematical vector from the rotating point and add the same mathematical vector to it after the rotate I get the wanted results.</p>

<pre class="lang-cpp prettyprint-override"><code>void rotateXYP(double angle, eng::point originOfRotation){
    this->subVec(originOfRotation);
    this->rotateXY(angle);
    this->addVec(originOfRotation);
};

void rotateXY(double angle){
    //save x,y and z in seperate variables for manipulation
    double x = this->pos[0]; // value 1
    double y = this->pos[1]; // value 0
    double z = this->pos[2]; // value 0, but in the xy rotation it is not important
    //convert from degrees to radians because cmath requires it
    double radian = angle*M_PI/180;
    //apply the values according to a rotation matrix found on the internet
    this->pos[0] = cos(radian)*x - sin(radian)*y;
    this->pos[1] = sin(radian)*x + cos(radian)*y;
    this->pos[2] = 1*z;
};
</code>```

My Question

Why am I getting with the point (1|0|0) as an input to the function rotateXY(90) the follwing as an output.

```<code>(6.12323e-17|1|0)
</code>```

instead of

```<code>(0|1|0)
</code>```

and if I call the function rotateXYP(90, some point), I get the correct point, without the tiny number on the x-coordinate.
I suspect it has something to do with the cos and sin in the following line of code:

```<code>this->pos[0] = cos(radian)*x - sin(radian)*y;
</code>```

As I am too inexperienced with c++ I seek answeres and hope that this was not a bad question.

答:
I have solved my problem by adding a variable named accuracy which controls the number of decimal places the double is allowed to have.</p>

```<code>void rotateXY(double angle){
                //Accuracy: a is the number of decimal places
                int a = 2;
                int acc = pow(10,a);
                //save x,y and z in seperate variables for manipulation
                double x = this->pos[0]; // value 1
                double y = this->pos[1]; // value 0
                double z = this->pos[2]; // value 0, but in the xy rotation it is not important
                //convert from degrees to radians because cmath requires it
                double radian = angle*M_PI/180;
                //apply the values according to a rotation matrix found on the internet
                this->pos[0] = round((cos(radian)*x - sin(radian)*y)*acc)/acc;
                this->pos[1] = round((sin(radian)*x + cos(radian)*y)*acc)/acc;
                this->pos[2] = round((1*z)*acc)/acc;
            };
</code>```

Body:
first time asking.
I want to rotate a point in 3d in c++ in the XY Plane and am using the following function for the task.

void rotateXY(double angle){
    //save the x and y and z coordinates in seperate variables
    double x = this->pos[0]; // value 1
    double y = this->pos[1]; // value 0
    double z = this->pos[2]; // value 0, but in the xy rotation it is not important
    double radian = angle*M_PI/180;

    this->pos[0] = cos(radian)*x - sin(radian)*y;
    this->pos[1] = sin(radian)*x + cos(radian)*y;
    this->pos[2] = 1*z;
};

I got the matrix from https://gamedevelopment.tutsplus.com/tutorials/lets-build-a-3d-graphics-engine-linear-transformations--gamedev-7716

In this I am directly manipulating the coordinates of the point, hence the this->pos[0]

If I call another function called rotateXYP where I first substract a mathematical vector from the rotating point and add the same mathematical vector to it after the rotate I get the wanted results.

void rotateXYP(double angle, eng::point originOfRotation){
    this->subVec(originOfRotation);
    this->rotateXY(angle);
    this->addVec(originOfRotation);
};

void rotateXY(double angle){
    //save x,y and z in seperate variables for manipulation
    double x = this->pos[0]; // value 1
    double y = this->pos[1]; // value 0
    double z = this->pos[2]; // value 0, but in the xy rotation it is not important
    //convert from degrees to radians because cmath requires it
    double radian = angle*M_PI/180;
    //apply the values according to a rotation matrix found on the internet
    this->pos[0] = cos(radian)*x - sin(radian)*y;
    this->pos[1] = sin(radian)*x + cos(radian)*y;
    this->pos[2] = 1*z;
};

My Question

Why am I getting with the point (1|0|0) as an input to the function rotateXY(90) the follwing as an output.

(6.12323e-17|1|0)

instead of

(0|1|0)

and if I call the function rotateXYP(90, some point), I get the correct point, without the tiny number on the x-coordinate.
I suspect it has something to do with the cos and sin in the following line of code:

this->pos[0] = cos(radian)*x - sin(radian)*y;

As I am too inexperienced with c++ I seek answeres and hope that this was not a bad question.

Body:
I have solved my problem by adding a variable named accuracy which controls the number of decimal places the double is allowed to have.

void rotateXY(double angle){
                //Accuracy: a is the number of decimal places
                int a = 2;
                int acc = pow(10,a);
                //save x,y and z in seperate variables for manipulation
                double x = this->pos[0]; // value 1
                double y = this->pos[1]; // value 0
                double z = this->pos[2]; // value 0, but in the xy rotation it is not important
                //convert from degrees to radians because cmath requires it
                double radian = angle*M_PI/180;
                //apply the values according to a rotation matrix found on the internet
                this->pos[0] = round((cos(radian)*x - sin(radian)*y)*acc)/acc;
                this->pos[1] = round((sin(radian)*x + cos(radian)*y)*acc)/acc;
                this->pos[2] = round((1*z)*acc)/acc;
            };


问:
Default color of the cosmo shinytheme
May I know what is the default color/ color code of the below image. I got in cosmo shiny theme.I tried with #f5f5f5 . But there is a slight difference between these? Can anyone please help

答: Using paint.net colorpicker tool it says the color code is: #ecf0f5

Title: Default color of the cosmo shinytheme


问:
Android device and Unity connection failure
I'm trying to debug Unity game from PC with Windows 10 to Android phone:

In Unity from File > Build Settings I've Switch Platform to Android

In Android device I've downloaded and installed Unity Remote 5 application.

In phone Settings/About phone with 7 taps on Build number I get Developer Options and turned on USB debugging and tap on Revoke USB debugging authorization

In Select USB Configuration I've checked PTP (Picture Transfer Protocol)

I've checked 2 different USB cables with 3 different phones and each device is successfully detected and recognized by PC OS, Unity Remote says "Connect this device with a USB Cable to your computer. Press PLAY in the Unity Editor to test", but Unity Editor by some reason does not shows any of my devices in Edit > Project Settings > Editor device:

edit:

I've downloaded both Android Studio and separately sdk-tools-windows-4333796.exe from Command line tools only.

First I've installed from Java SE Development Kit 8u241 jdk-8u241-windows-x64.exe for Windows x64

In Windows 10 OS Environment Variables/System Variables/Path, I've added C:\Program Files\Java\jdk1.8.0_241\bin and C:\Program Files\Java\jre1.8.0_241\bin

In User Variables I've added Variable name: JAVA_HOME and Variable value: C:\Program Files\Java\jdk1.8.0_241\bin

So, first I did not used  sdk-tools-windows-4333796.exe and have installed Android Studio, here is what  Edit > Preferences > External Tools shows:

Then, I've removed Android Studio and tried to use only sdk-tools-windows-4333796.exe, I've extracted tools folder to previously created folders path C:\Android\android-sdk,  then from C:\Android\android-sdk\tools\bin load sdkmanager.bat with "platform;android-25" or "platform;android-26" argument, but error says:

Warning: File C:\Users\User.android\repositories.cfg could not be
  loaded. Warning: Failed to find package platform;android-25 [===

  ] 10% Computing updates... C:\Android\android-sdk\tools\bin>

And finally I've tried install with Unity Hub:

but it same result, device does not appears in Editor, and External Tools shows checked:

and if unchecked:

I'm not quite sure, what I've missed or what I'm doing incorrectly

Any guide, advice or example would be helpful

答: For Unity Remote to work, you need to have the Android SDK on your development machine. Do you have it? If yes, then to specify the location of your Android SDK, go to Edit > Preferences. Unity Docs will help you.</p>


问:
How to display the list response which inside the object - react js
How to display the data in the below from the below json.

```<code>{
"a":
{
"b":[
  {"id":"ef718cce-1269-4fbd-827c-832f7824c025","name":"Veera6"},
  {"id":"0cda5ae9-e287-4666-804a-03f25e642d1f","name":"Veera9"},
  {"id":"31f8f042-dbc0-4dbf-ada8-b94c7e2d2a39","name":"Veera8"},
  {"id":"6292054c-8bfc-4d2d-b2f8-92e2bac5a578","name":"Veera7"},
  {"id":"c6756e5c-8fa5-40a9-ab92-5242bda97de3","name":"Veera10"}]
}
}
</code>```

code snipped below.

```<code>render() {

        return (
            <table>
                <thead>
                    <tr>
                    {
                        this.headers.map(function(h) {
                            return (
                                <th key = {h.key}>{h.label}</th>
                            )
                        })
                    }
                    </tr>
                </thead>
                <tbody>
                    {
                        this.state.tags.b.map(function(item, key) {
                        return (
                                <tr key = {key}>
                                  <td>{item.id}</td>
                                  <td>{item.name}</td>
                                </tr>
                            )
                        })
                    }
                </tbody>
            </table>
        )

    }
}
</code>```

How to display the data in table. Here i need to get the array/list b. Tried different approaches to get the data from the object array but no luck.

答:
Don't know what you were going to do in first
.

Maybe this will point you to the right direction.

```<code>import React from "react";
import "./styles.css";

const headers = {
  a: {
    b: [
      { id: "ef718cce-1269-4fbd-827c-832f7824c025", name: "Veera6" },
      { id: "0cda5ae9-e287-4666-804a-03f25e642d1f", name: "Veera9" },
      { id: "31f8f042-dbc0-4dbf-ada8-b94c7e2d2a39", name: "Veera8" },
      { id: "6292054c-8bfc-4d2d-b2f8-92e2bac5a578", name: "Veera7" },
      { id: "c6756e5c-8fa5-40a9-ab92-5242bda97de3", name: "Veera10" }
    ]
  }
};

let keys = Object.getOwnPropertyNames(headers.a.b[0]);
let head = keys.map(propertyName => <th key={propertyName}>{propertyName}</th>);
export default function App() {
  return (
    <table>
      <thead>
        <tr>{head}</tr>
      </thead>
      <tbody>
        {headers.a.b.map(function(item, key) {
          return (
            <tr key={key}>
              <td>{item.id}</td>
              <td>{item.name}</td>
            </tr>
          );
        })}
      </tbody>
    </table>
  );
}
</code>```

So you should access b with headers.a.b and then map().
Your b array is nested inside the headers a object, which is nested in headers object.

Result will be:

```<code>id                                      name
ef718cce-1269-4fbd-827c-832f7824c025    Veera6
0cda5ae9-e287-4666-804a-03f25e642d1f    Veera9
31f8f042-dbc0-4dbf-ada8-b94c7e2d2a39    Veera8
6292054c-8bfc-4d2d-b2f8-92e2bac5a578    Veera7
c6756e5c-8fa5-40a9-ab92-5242bda97de3    Veera10
</code>```

Also be sure to check sandbox demo out.

Body:
How to display the data in the below from the below json.

{
"a":
{
"b":[
  {"id":"ef718cce-1269-4fbd-827c-832f7824c025","name":"Veera6"},
  {"id":"0cda5ae9-e287-4666-804a-03f25e642d1f","name":"Veera9"},
  {"id":"31f8f042-dbc0-4dbf-ada8-b94c7e2d2a39","name":"Veera8"},
  {"id":"6292054c-8bfc-4d2d-b2f8-92e2bac5a578","name":"Veera7"},
  {"id":"c6756e5c-8fa5-40a9-ab92-5242bda97de3","name":"Veera10"}]
}
}

code snipped below.

render() {

        return (

                    {
                        this.headers.map(function(h) {
                            return (
                                {h.label}
                            )
                        })
                    }

                    {
                        this.state.tags.b.map(function(item, key) {
                        return (

                                  {item.id}
                                  {item.name}

                            )
                        })
                    }

        )

    }
}

How to display the data in table. Here i need to get the array/list b. Tried different approaches to get the data from the object array but no luck.

Body:
Don't know what you were going to do in first < tr >.

Maybe this will point you to the right direction.

import React from "react";
import "./styles.css";

const headers = {
  a: {
    b: [
      { id: "ef718cce-1269-4fbd-827c-832f7824c025", name: "Veera6" },
      { id: "0cda5ae9-e287-4666-804a-03f25e642d1f", name: "Veera9" },
      { id: "31f8f042-dbc0-4dbf-ada8-b94c7e2d2a39", name: "Veera8" },
      { id: "6292054c-8bfc-4d2d-b2f8-92e2bac5a578", name: "Veera7" },
      { id: "c6756e5c-8fa5-40a9-ab92-5242bda97de3", name: "Veera10" }
    ]
  }
};

let keys = Object.getOwnPropertyNames(headers.a.b[0]);
let head = keys.map(propertyName => <th key={propertyName}>{propertyName}</th>);
export default function App() {
  return (
    <table>
      <thead>
        <tr>{head}</tr>
      </thead>
      <tbody>
        {headers.a.b.map(function(item, key) {
          return (
            <tr key={key}>
              <td>{item.id}</td>
              <td>{item.name}</td>
            </tr>
          );
        })}
      </tbody>
    </table>
  );
}

So you should access b with headers.a.b and then map().
Your b array is nested inside the headers a object, which is nested in headers object.

Result will be:

id                                      name
ef718cce-1269-4fbd-827c-832f7824c025    Veera6
0cda5ae9-e287-4666-804a-03f25e642d1f    Veera9
31f8f042-dbc0-4dbf-ada8-b94c7e2d2a39    Veera8
6292054c-8bfc-4d2d-b2f8-92e2bac5a578    Veera7
c6756e5c-8fa5-40a9-ab92-5242bda97de3    Veera10

Also be sure to check sandbox demo out.


问:
Create LINQ request
I have some collections:

Dictionary<InvoceHeader, List<InvoiceHierarchy>> where

```<code>public class InvoceHeader
{
    public int InvoiceId { get; set; }
    public string DocumentNumber { get; set; }
    public string DocumentDate { get; set; }
    public string DocumentReference { get; set; }
}

public class InvoiceHierarchi
{
    public string SerialNumber { get; set; }
    public string ProductCode { get; set; }
    public string Certificate { get; set; }
    public string Description { get; set; }
}
</code>```

I need to write a LINQ request to get such a collection from the original collection --> Dictionary<string, List<string>>, where key --> InvoceHeader.DocumentNumber, value --> List two elements from InvoiceHierarchi such as the SerialNumber and Certificate.

答:
```<code>Dictionary<string, List<string>> converted = original
    .ToDictionary(
        kvp => kvp.Key.DocumentNumber,
        kvp => kvp.Value.Select(ih => ih.SerialNumber + ih.Certificate).ToList());
</code>```

Title: Create LINQ request

Body:
I have some collections:

Dictionary<InvoceHeader, List<InvoiceHierarchy>> where

public class InvoceHeader
{
    public int InvoiceId { get; set; }
    public string DocumentNumber { get; set; }
    public string DocumentDate { get; set; }
    public string DocumentReference { get; set; }
}

public class InvoiceHierarchi
{
    public string SerialNumber { get; set; }
    public string ProductCode { get; set; }
    public string Certificate { get; set; }
    public string Description { get; set; }
}

I need to write a LINQ request to get such a collection from the original collection --> Dictionary<string, List<string>>, where key --> InvoceHeader.DocumentNumber, value --> List two elements from InvoiceHierarchi such as the SerialNumber and Certificate.