问:
Z3Py - Calling functions written as Z3 expressions
I am using Z3Py and I have a function which is written as Z3 expressions in Python, can I call that function in another function?

```<code>def func1 (a,b,c):
    vara = a * b
    varb = URem (vara, c)
    result = If (vara > 0, varb, 0)
    return result

def func2 (a,b,c):
    var1 = func1 (a,b,c)
    var2 = URem (var1, c)
    result2 = If (var1 > 0, var2, 0)
    return result2
</code>```

The problem i am facing is that if I call a function from another function, in this case calling func1 from func2, i always get UNSAT for some invariant. However, if i copy and paste the complete code at the location of functional call, everything works. So, my question is how does function calling work in Z3Py?

Body:
I am using Z3Py and I have a function which is written as Z3 expressions in Python, can I call that function in another function?

def func1 (a,b,c):
    vara = a * b
    varb = URem (vara, c)
    result = If (vara > 0, varb, 0)
    return result

def func2 (a,b,c):
    var1 = func1 (a,b,c)
    var2 = URem (var1, c)
    result2 = If (var1 > 0, var2, 0)
    return result2

The problem i am facing is that if I call a function from another function, in this case calling func1 from func2, i always get UNSAT for some invariant. However, if i copy and paste the complete code at the location of functional call, everything works. So, my question is how does function calling work in Z3Py?


来源: stackexchange

问:
Why I can't change a single row?
When I sort the data according to the value named "TC NO" and make the edits, all the data in the table changes. For example; I have a, b, and c values. I'm trying to make the value "a" to "d" but the values a,b, and c each convert to the value "d". I just want the value I selected to change. Where am I doing wrong?

```<code>public partial class muster_guncelleme : Form
{
    public muster_guncelleme()
    {
        InitializeComponent();
    }
    static string conString = "Server=localhost;Database=master; Trusted_Connection=True;";
    SqlConnection baglanti = new SqlConnection(conString);
    private void btn_arama_Click(object sender, EventArgs e)
    {
        baglanti.Open();
        string kayit = "SELECT * from [user] where tc_no=@tc_no";
        SqlCommand komut = new SqlCommand(kayit, baglanti);
        komut.Parameters.AddWithValue("@tc_no", txt_tc.Text);
        SqlDataAdapter da = new SqlDataAdapter(komut);
        SqlDataReader dr = komut.ExecuteReader();
        if (dr.Read())
        {
            lbl_tc.Text = dr["tc_no"].ToString();
            txt_user.Text = dr["user_name"].ToString();
            txt_pass.Text = dr["password"].ToString();
            txt_name.Text = dr["full_name"].ToString();
            bday_date.Text = dr["birth_date"].ToString();
            txt_phone.Text = dr["phone_number"].ToString();
        }
        else
            MessageBox.Show("Müşteri Bulunamadı.");
        baglanti.Close();
    }
    private void muster_guncelleme_Load(object sender, EventArgs e)
    {
    }
    private void btn_kaydet_Click(object sender, EventArgs e)
    {
        baglanti.Open();
        string kayit = "update [user] set user_name=@user_name, password=@password, full_name=@full_name, phone_number=@phone_number";
        SqlCommand komut = new SqlCommand(kayit, baglanti);
        komut.Parameters.AddWithValue("@user_name", txt_user.Text);
        komut.Parameters.AddWithValue("@password", txt_pass.Text);
        komut.Parameters.AddWithValue("@full_name", txt_name.Text);
        komut.Parameters.AddWithValue("@phone_number", txt_phone.Text);
        komut.ExecuteNonQuery();
        baglanti.Close();
        MessageBox.Show("Kullanıcı Bilgileri Güncellendi.");
    }
}
</code>```

ContentLicense: CC BY-SA 4.0

Title: Why I can't change a single row?

Body:
When I sort the data according to the value named "TC NO" and make the edits, all the data in the table changes. For example; I have a, b, and c values. I'm trying to make the value "a" to "d" but the values a,b, and c each convert to the value "d". I just want the value I selected to change. Where am I doing wrong?

public partial class muster_guncelleme : Form
{
    public muster_guncelleme()
    {
        InitializeComponent();
    }
    static string conString = "Server=localhost;Database=master; Trusted_Connection=True;";
    SqlConnection baglanti = new SqlConnection(conString);
    private void btn_arama_Click(object sender, EventArgs e)
    {
        baglanti.Open();
        string kayit = "SELECT * from [user] where tc_no=@tc_no";
        SqlCommand komut = new SqlCommand(kayit, baglanti);
        komut.Parameters.AddWithValue("@tc_no", txt_tc.Text);
        SqlDataAdapter da = new SqlDataAdapter(komut);
        SqlDataReader dr = komut.ExecuteReader();
        if (dr.Read())
        {
            lbl_tc.Text = dr["tc_no"].ToString();
            txt_user.Text = dr["user_name"].ToString();
            txt_pass.Text = dr["password"].ToString();
            txt_name.Text = dr["full_name"].ToString();
            bday_date.Text = dr["birth_date"].ToString();
            txt_phone.Text = dr["phone_number"].ToString();
        }
        else
            MessageBox.Show("Müşteri Bulunamadı.");
        baglanti.Close();
    }
    private void muster_guncelleme_Load(object sender, EventArgs e)
    {
    }
    private void btn_kaydet_Click(object sender, EventArgs e)
    {
        baglanti.Open();
        string kayit = "update [user] set user_name=@user_name, password=@password, full_name=@full_name, phone_number=@phone_number";
        SqlCommand komut = new SqlCommand(kayit, baglanti);
        komut.Parameters.AddWithValue("@user_name", txt_user.Text);
        komut.Parameters.AddWithValue("@password", txt_pass.Text);
        komut.Parameters.AddWithValue("@full_name", txt_name.Text);
        komut.Parameters.AddWithValue("@phone_number", txt_phone.Text);
        komut.ExecuteNonQuery();
        baglanti.Close();
        MessageBox.Show("Kullanıcı Bilgileri Güncellendi.");
    }
}


问:
Mongoose document.save() method is blocking websocket execution
I have a NodeJS app running a websocket server using the ws npm package. In a callback from the message event ws.on("message", async (rawData, isBinary) => {}), I'm trying to update a document and then save it. The .find() method works fine, but the .save() method blocks execution completely.

const users = await Promise.all(
    game.players.map((p) => User.findById(p.id)) // This works fine
);

// mess with users here

await Promise.all(users.map(u => u.save())) // <-- This doesn't work
await users[0].save() // <--- This doesn't work either
users[0].save((err, doc) => {
   // This doesn't work either
})
users[0].save().then(doc => {
    // console.log(doc) // <-- This doesn't work either
})
```
<p>For starters, is this even possible ? Or am I thinking about it the wrong way and should I trigger some kind of POST request from the client to hit my http server instead to do the mongodb operations ? In any case, I'm struggling to understand why this is not possible.</p>
<p>Also something interesting is when I tried logging everything everywhere I tried to do the following</p>
<pre class="lang-js prettyprint-override"><code>console.log(users[0].save())
users[0].save((err, doc) => {
    if (err) console.log(err) // <-- no log here
    console.log(doc) // <-- no log here
})
</code>```

which threw mongoose's ParallelSaveError: Can't save() the same doc multiple times in parallel. So I'm guessing the action does take place but not entirely ?

Any insight on this is welcome.

Body:
I have a NodeJS app running a websocket server using the ws npm package. In a callback from the message event ws.on("message", async (rawData, isBinary) => {}), I'm trying to update a document and then save it. The .find() method works fine, but the .save() method blocks execution completely.

const users = await Promise.all(
    game.players.map((p) => User.findById(p.id)) // This works fine
);

// mess with users here

await Promise.all(users.map(u => u.save())) // <-- This doesn't work
await users[0].save() // <--- This doesn't work either
users[0].save((err, doc) => {
   // This doesn't work either
})
users[0].save().then(doc => {
    // console.log(doc) // <-- This doesn't work either
})

For starters, is this even possible ? Or am I thinking about it the wrong way and should I trigger some kind of POST request from the client to hit my http server instead to do the mongodb operations ? In any case, I'm struggling to understand why this is not possible.

Also something interesting is when I tried logging everything everywhere I tried to do the following

console.log(users[0].save())
users[0].save((err, doc) => {
    if (err) console.log(err) // <-- no log here
    console.log(doc) // <-- no log here
})

which threw mongoose's ParallelSaveError: Can't save() the same doc multiple times in parallel. So I'm guessing the action does take place but not entirely ?

Any insight on this is welcome.


问:
Click event is calling twice in bootstrap select
I am using the bootstrap-select plugin to style the select.

By clicking on the Select All, Deselect All buttons, I filter. The problem is, if you open a select, then close it and reopen it by clicking on Select All or Deselect All, the click handler fires twice. If you repeat the algorithm - three times, and so on.

After a lot of googling, I found a solution to this problem - through the method - e.stopImmediatePropagation(). However, its use gives rise to a new problem - the bootstrap select functionality stops marking selected elements.

Please tell me how to solve this dilemma.

The link to the sandbox is here.

$('select').selectpicker();

$('select').on('shown.bs.select', function () {
  let selectAllBtn = document.querySelector('.bs-select-all'),
      deselectAllBtn = document.querySelector('.bs-deselect-all');

  console.log(selectAllBtn);

  selectAllBtn.addEventListener('click', function selectAllFunc(e) {
    // e.stopImmediatePropagation();
    console.log('fire select all')
  });

  deselectAllBtn.addEventListener('click', function deselectAllFunc(e) {
    // e.stopImmediatePropagation();
    console.log('fire deselect all')
  });
});```
<pre class="snippet-code-html lang-html prettyprint-override"><code><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0/css/bootstrap.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.13.18/css/bootstrap-select.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/js/bootstrap.bundle.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap-select@1.13.14/dist/js/bootstrap-select.min.js"></script>

<select class="selectpicker" multiple data-actions-box="true">
  <option>Mustard</option>
  <option>Ketchup</option>
  <option>Relish</option>
</select></code>```

Body:
I am using the bootstrap-select plugin to style the select.

By clicking on the Select All, Deselect All buttons, I filter. The problem is, if you open a select, then close it and reopen it by clicking on Select All or Deselect All, the click handler fires twice. If you repeat the algorithm - three times, and so on.

After a lot of googling, I found a solution to this problem - through the method - e.stopImmediatePropagation(). However, its use gives rise to a new problem - the bootstrap select functionality stops marking selected elements.

Please tell me how to solve this dilemma.

The link to the sandbox is here.

$('select').selectpicker();

$('select').on('shown.bs.select', function () {
  let selectAllBtn = document.querySelector('.bs-select-all'),
      deselectAllBtn = document.querySelector('.bs-deselect-all');

  console.log(selectAllBtn);

  selectAllBtn.addEventListener('click', function selectAllFunc(e) {
    // e.stopImmediatePropagation();
    console.log('fire select all')
  });

  deselectAllBtn.addEventListener('click', function deselectAllFunc(e) {
    // e.stopImmediatePropagation();
    console.log('fire deselect all')
  });
});

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0/css/bootstrap.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.13.18/css/bootstrap-select.min.css">

<select class="selectpicker" multiple data-actions-box="true">
  <option>Mustard</option>
  <option>Ketchup</option>
  <option>Relish</option>
</select>


问:
Excel send the coordinates of one cell to another
I am creating an xlsx sheet programmatically using PhpSpreadSheet.

The rows are created dynamically and I dont know in advance how many or in what groups they will be.

In one group of rows I have a count function in one of the cells so I know how many rows I have.  I need to access that count from another cell but not knowing the row of that cell I can't access it directly.

My thought was if I had a row prior to the creation of the dynamic rows and function, I could send the coordinates of that one cell to a known static location and from there I could do some math and increment and be where I need to be.

```<code>[A1] = coord of [A?]

[A2]

.

.

.

[A?] -> send coord to [A1]

[A?+1] Count Formula
</code>```

I could then look at coord in [A1], add a row and have my count.

I hope this makes sense or maybe I going in the wrong direction.

Body:
I am creating an xlsx sheet programmatically using PhpSpreadSheet.

The rows are created dynamically and I dont know in advance how many or in what groups they will be.

In one group of rows I have a count function in one of the cells so I know how many rows I have.  I need to access that count from another cell but not knowing the row of that cell I can't access it directly.

My thought was if I had a row prior to the creation of the dynamic rows and function, I could send the coordinates of that one cell to a known static location and from there I could do some math and increment and be where I need to be.

[A1] = coord of [A?]

[A2]

.

.

.

[A?] -> send coord to [A1]

[A?+1] Count Formula

I could then look at coord in [A1], add a row and have my count.

I hope this makes sense or maybe I going in the wrong direction.


问:
Undefined array key "email"
I can't seems to find the reason why it gives me the error Undefined array key "email"
I'm sorry in advance if the info that I'm providing is not enough please tell me what info you guys need.

here is my admin controller

```<code>
namespace App\Http\Controllers\Admin;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;

class AdminController extends Controller
{
    public function dashboard()
    {
        return view('admin.dashboard');
    }

    public function login(Request $request)
    {
        if ($request->isMethod('post')) {
            $data = $request->all();
            // echo "```";
            // print_r($data);
            // die;

            if (Auth::guard('admin')->attempt(['email' => $data['email'], 'password' => $data['password'], 'status' => 1])) {
                return redirect('admin/dashboard');
            } else {
                return redirect()->back()->with('error_message', 'Invalid Email or Password');
            }
        }
        return view('admin.login');
    }
}
```
```
namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Foundation\Auth\User as Authenticatable;

class Admin extends Authenticatable
{
    use HasFactory;
    protected $guard = 'admin';
}
```

I already try changing the ['email' => $data['email'] to $data['email'] = 'example@example.com'

but it just give me the error that i have to migrate again which i'm not aiming for, should i migrate?

Title: Undefined array key "email"

Body:
I can't seems to find the reason why it gives me the error Undefined array key "email"
I'm sorry in advance if the info that I'm providing is not enough please tell me what info you guys need.

here is my admin controller

namespace App\Http\Controllers\Admin;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;

class AdminController extends Controller
{
    public function dashboard()
    {
        return view('admin.dashboard');
    }

    public function login(Request $request)
    {
        if ($request->isMethod('post')) {
            $data = $request->all();
            // echo "
";
            // print_r($data);
            // die;

            if (Auth::guard('admin')->attempt(['email' => $data['email'], 'password' => $data['password'], 'status' => 1])) {
                return redirect('admin/dashboard');
            } else {
                return redirect()->back()->with('error_message', 'Invalid Email or Password');
            }
        }
        return view('admin.login');
    }
}

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Foundation\Auth\User as Authenticatable;

class Admin extends Authenticatable
{
    use HasFactory;
    protected $guard = 'admin';
}

I already try changing the ['email' => $data['email'] to $data['email'] = 'example@example.com'

but it just give me the error that i have to migrate again which i'm not aiming for, should i migrate?


问:
MySQL Query, how to compare unix timestamps in WHERE
I am trying to perform a request for a Grafana dashboard from my Raspberry SQL database. The goal is to look for the most recent timestamp in another table (this performs as unique-ID) and get the requested data (TimeAxis and WeightAxis) from a second table.

```<code>SELECT
  (SELECT @stamp := unix_timestamp(coffeeTimestamp)
    FROM CoffeeData
    ORDER BY timestamp DESC LIMIT 1
  ),
  TimeAxis,
  WeightAxis
FROM ArrayLog
WHERE unix_timestamp(coffeeTimestamp) = @stamp
</code>```

I tried several variation of this query. What hurdles me: I can get this query to do what I want, if I don't write "= @stamp" but "= 1614251117" (which is the result from the query in the brackets, if run separately). With "= @stamp" however, the query returns null.

Do you have any idea on how to solve this? Thanks!

Body:
I am trying to perform a request for a Grafana dashboard from my Raspberry SQL database. The goal is to look for the most recent timestamp in another table (this performs as unique-ID) and get the requested data (TimeAxis and WeightAxis) from a second table.

SELECT
  (SELECT @stamp := unix_timestamp(coffeeTimestamp)
    FROM CoffeeData
    ORDER BY timestamp DESC LIMIT 1
  ),
  TimeAxis,
  WeightAxis
FROM ArrayLog
WHERE unix_timestamp(coffeeTimestamp) = @stamp

I tried several variation of this query. What hurdles me: I can get this query to do what I want, if I don't write "= @stamp" but "= 1614251117" (which is the result from the query in the brackets, if run separately). With "= @stamp" however, the query returns null.

Do you have any idea on how to solve this? Thanks!


问:
MariaDB extract json nested data
I have following SQL query and trying to extract nested json data field.

```<code>*************************** 2. row ***************************
       created_at: 2023-01-05 14:25:52
       updated_at: 2023-01-05 14:26:02
       deleted_at: NULL
          deleted: 0
               id: 2
    instance_uuid: ef6380b4-5455-48f8-9e4b-3d04199be3f5
    numa_topology: NULL
     pci_requests: []
           flavor: {"cur": {"nova_object.name": "Flavor", "nova_object.namespace": "nova", "nova_object.version": "1.2", "nova_object.data": {"id": 2, "name": "tempest2", "memory_mb": 512, "vcpus": 1, "root_gb": 1, "ephemeral_gb": 0, "flavorid": "202", "swap": 0, "rxtx_factor": 1.0, "vcpu_weight": 0, "disabled": false, "is_public": true, "extra_specs": {}, "description": null, "created_at": "2023-01-05T05:30:36Z", "updated_at": null, "deleted_at": null, "deleted": false}}, "old": null, "new": null}
       vcpu_model: {"nova_object.name": "VirtCPUModel", "nova_object.namespace": "nova", "nova_object.version": "1.0", "nova_object.data": {"arch": null, "vendor": null, "topology": {"nova_object.name": "VirtCPUTopology", "nova_object.namespace": "nova", "nova_object.version": "1.0", "nova_object.data": {"sockets": 1, "cores": 1, "threads": 1}, "nova_object.changes": ["cores", "threads", "sockets"]}, "features": [], "mode": "host-model", "model": null, "match": "exact"}, "nova_object.changes": ["mode", "model", "vendor", "features", "topology", "arch", "match"]}
migration_context: NULL
         keypairs: {"nova_object.name": "KeyPairList", "nova_object.namespace": "nova", "nova_object.version": "1.3", "nova_object.data": {"objects": []}}
  device_metadata: NULL
    trusted_certs: NULL
           vpmems: NULL
        resources: NULL
</code>```

In flavor: section i have some json data and i am trying to extract "name": "tempest2" value in my question but it's nested so i am not able to find way to extract that value.

My query but how do i remove [] square brackets in value

```<code>MariaDB [nova]> select uuid, instances.created_at, instances.deleted_at, json_extract(flavor, '$.cur.*.name') AS FLAVOR from instances join instance_extra on instances.uuid = instance_extra.instance_uuid;
+--------------------------------------+---------------------+---------------------+--------------+
| uuid                                 | created_at          | deleted_at          | FLAVOR       |
+--------------------------------------+---------------------+---------------------+--------------+
| edb0facb-3353-4848-82e2-f12701a0a3aa | 2023-01-05 05:37:13 | 2023-01-05 05:37:49 | ["tempest1"] |
| ef6380b4-5455-48f8-9e4b-3d04199be3f5 | 2023-01-05 14:25:51 | NULL                | ["tempest2"] |
+--------------------------------------+---------------------+---------------------+--------------+
</code>```

#Update

This is the MariaDB version I have

```<code>MariaDB [nova]> SELECT VERSION();
+-------------------------------------------+
| VERSION()                                 |
+-------------------------------------------+
| 10.5.12-MariaDB-1:10.5.12+maria~focal-log |
+-------------------------------------------+
1 row in set (0.000 sec)
</code>```

Title: MariaDB extract json nested data

Body:
I have following SQL query and trying to extract nested json data field.

*************************** 2. row ***************************
       created_at: 2023-01-05 14:25:52
       updated_at: 2023-01-05 14:26:02
       deleted_at: NULL
          deleted: 0
               id: 2
    instance_uuid: ef6380b4-5455-48f8-9e4b-3d04199be3f5
    numa_topology: NULL
     pci_requests: []
           flavor: {"cur": {"nova_object.name": "Flavor", "nova_object.namespace": "nova", "nova_object.version": "1.2", "nova_object.data": {"id": 2, "name": "tempest2", "memory_mb": 512, "vcpus": 1, "root_gb": 1, "ephemeral_gb": 0, "flavorid": "202", "swap": 0, "rxtx_factor": 1.0, "vcpu_weight": 0, "disabled": false, "is_public": true, "extra_specs": {}, "description": null, "created_at": "2023-01-05T05:30:36Z", "updated_at": null, "deleted_at": null, "deleted": false}}, "old": null, "new": null}
       vcpu_model: {"nova_object.name": "VirtCPUModel", "nova_object.namespace": "nova", "nova_object.version": "1.0", "nova_object.data": {"arch": null, "vendor": null, "topology": {"nova_object.name": "VirtCPUTopology", "nova_object.namespace": "nova", "nova_object.version": "1.0", "nova_object.data": {"sockets": 1, "cores": 1, "threads": 1}, "nova_object.changes": ["cores", "threads", "sockets"]}, "features": [], "mode": "host-model", "model": null, "match": "exact"}, "nova_object.changes": ["mode", "model", "vendor", "features", "topology", "arch", "match"]}
migration_context: NULL
         keypairs: {"nova_object.name": "KeyPairList", "nova_object.namespace": "nova", "nova_object.version": "1.3", "nova_object.data": {"objects": []}}
  device_metadata: NULL
    trusted_certs: NULL
           vpmems: NULL
        resources: NULL

In flavor: section i have some json data and i am trying to extract "name": "tempest2" value in my question but it's nested so i am not able to find way to extract that value.

My query but how do i remove [] square brackets in value

MariaDB [nova]> select uuid, instances.created_at, instances.deleted_at, json_extract(flavor, '$.cur.*.name') AS FLAVOR from instances join instance_extra on instances.uuid = instance_extra.instance_uuid;
+--------------------------------------+---------------------+---------------------+--------------+
| uuid                                 | created_at          | deleted_at          | FLAVOR       |
+--------------------------------------+---------------------+---------------------+--------------+
| edb0facb-3353-4848-82e2-f12701a0a3aa | 2023-01-05 05:37:13 | 2023-01-05 05:37:49 | ["tempest1"] |
| ef6380b4-5455-48f8-9e4b-3d04199be3f5 | 2023-01-05 14:25:51 | NULL                | ["tempest2"] |
+--------------------------------------+---------------------+---------------------+--------------+

#Update

This is the MariaDB version I have

MariaDB [nova]> SELECT VERSION();
+-------------------------------------------+
| VERSION()                                 |
+-------------------------------------------+
| 10.5.12-MariaDB-1:10.5.12+maria~focal-log |
+-------------------------------------------+
1 row in set (0.000 sec)


问:
vscode emphasises in red my project due to something inside `.terraform` folder despite explicitly telling it to ignore it
I have tried to configure every possible thing I can find in vscode to make sure that the .terraform folder gets ignored, but nothing seems to have done the trick.

Current configs:

  "search.exclude": {
    "**/.terraform/**": true
  },
  "files.watcherExclude": {
    "**/.terraform/**": true
  },
  "files.exclude": {
    "**/.terraform": true
  },
```

The folder is indeed excluded from search and the explorer on the left, but the parent folder remains emphasised in red.

Any ideas how to get around this?

Body:
I have tried to configure every possible thing I can find in vscode to make sure that the .terraform folder gets ignored, but nothing seems to have done the trick.

Current configs:

  "search.exclude": {
    "**/.terraform/**": true
  },
  "files.watcherExclude": {
    "**/.terraform/**": true
  },
  "files.exclude": {
    "**/.terraform": true
  },

The folder is indeed excluded from search and the explorer on the left, but the parent folder remains emphasised in red.

Any ideas how to get around this?


问:
How to make a Golang custom SSH server openable by Vscode remote feature
I'm trying to make a tool that makes docker containers automatically sshable without modifying the containers themselves. I run the code below to spin up a Golang ssh server outside the container which directs requests to the container's bash:

```<code>import (
    "io"
    "log"
    "os"
    "os/exec"
    "syscall"
    "unsafe"

    "github.com/creack/pty"
    "github.com/gliderlabs/ssh"
)
func setWinsize(f *os.File, w, h int) {
    syscall.Syscall(syscall.SYS_IOCTL, f.Fd(), uintptr(syscall.TIOCSWINSZ),
        uintptr(unsafe.Pointer(&struct{ h, w, x, y uint16 }{uint16(h), uint16(w), 0, 0})))
}

func main() {
    ssh.Handle(func(s ssh.Session) {
        cmd := exec.Command("docker", "exec", "-it", "nongpu_sam_test_sshd_container", "bash")
        _, winCh, _ := s.Pty()

            f, err := pty.Start(cmd)
            if err != nil {
                panic(err)
            }
            go func() {
                for win := range winCh {
                    setWinsize(f, win.Width, win.Height)
                }
            }()
            go func() {
                io.Copy(f, s) // stdin
            }()
            io.Copy(s, f) // stdout
            cmd.Wait()

    })

    log.Fatal(ssh.ListenAndServe(":2217", nil))
}
</code>```

It works fine to SSH in via command, but when I open with Vscode remote - it says "Failed to parse remote port from server output". Is there something I need to send back to make vscode connect successfully?
thanks in advance for any help :)

I also tried just running the system bash instead of the container's bash and that still fails.

Body:
I'm trying to make a tool that makes docker containers automatically sshable without modifying the containers themselves. I run the code below to spin up a Golang ssh server outside the container which directs requests to the container's bash:

import (
    "io"
    "log"
    "os"
    "os/exec"
    "syscall"
    "unsafe"

    "github.com/creack/pty"
    "github.com/gliderlabs/ssh"
)
func setWinsize(f *os.File, w, h int) {
    syscall.Syscall(syscall.SYS_IOCTL, f.Fd(), uintptr(syscall.TIOCSWINSZ),
        uintptr(unsafe.Pointer(&struct{ h, w, x, y uint16 }{uint16(h), uint16(w), 0, 0})))
}

func main() {
    ssh.Handle(func(s ssh.Session) {
        cmd := exec.Command("docker", "exec", "-it", "nongpu_sam_test_sshd_container", "bash")
        _, winCh, _ := s.Pty()

            f, err := pty.Start(cmd)
            if err != nil {
                panic(err)
            }
            go func() {
                for win := range winCh {
                    setWinsize(f, win.Width, win.Height)
                }
            }()
            go func() {
                io.Copy(f, s) // stdin
            }()
            io.Copy(s, f) // stdout
            cmd.Wait()

    })

    log.Fatal(ssh.ListenAndServe(":2217", nil))
}

It works fine to SSH in via command, but when I open with Vscode remote - it says "Failed to parse remote port from server output". Is there something I need to send back to make vscode connect successfully?
thanks in advance for any help :)

I also tried just running the system bash instead of the container's bash and that still fails.


问:
Building a ROC producing function in R
I want to make a function that accepts an xgboost model and the data (test set that I already got, called mydata[[2]]) and returns a ROC curve.
My first try was like this:

```<code> evaluate_model_plot = function(model,data) {

  plt = roc(data[,1],predict(model, data[,-1]))
  plot(plt, main = 'Test Set')

}
</code>```

I get this error:

```<code>> evaluate_model_plot(myxgb, mydata[[2]])

Error in xgb.DMatrix(newdata, missing = missing) :
xgb.DMatrix does not support construction from list
</code>```

I tried again:

```<code> evaluate_model_plot = function(model,data) {

  dtest = xgb.DMatrix(data = data.matrix(data[,-1]),label=as.numeric(as.character(data[,1])))

  plt = roc(dtest,predict(model, dtest))
  plot(plt, main = 'Test Set')

}
</code>```

Now the error is:

```<code>Error in unique.default(x, nmax = nmax) :
unique() applies only to vectors
</code>```

I'm not sure how to fix this. The first error is not very clear to me since the data I'm providing is a data frame, it's saying that it doesn't accept a list, although the input is not a list..

Here is a sample from my test set:

```<code>> dput(data[[2]][1:15,1:5])
structure(list(CR = structure(c(1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L,
1L, 2L, 2L, 1L, 1L, 1L, 1L), levels = c("0", "1"), class = "factor"),
    CD4.T.cells = c(0.0410284948786532, -0.0366277340916379,
    -0.0349008907108641, -0.062499826731091, -0.206241592996545,
    -0.0874700869552125, -0.182120904486964, -0.171941115538424,
    -0.101887370292612, -0.0471260521659922, 0.00336508376392719,
    -0.0558977705951249, -0.0346269111530533, 0.0405376992753275,
    -0.116824556352525), CD8.T.cells = c(-0.0372301980787381,
    -0.0550538743643369, -0.157003425700701, -0.280984614146961,
    -0.245432535063266, -0.147192190940429, -0.244633652045209,
    -0.213892169574032, -0.301036923607255, -0.427604924497491,
    -0.371628492024595, -0.0166106304573527, -0.200413064153971,
    -0.276715360733834, -0.13198989690999), T.helpers = c(0.186447606591857,
    0.0686746776877563, -0.0662055287009653, -0.0969110962088053,
    -0.176807066557773, -0.079679981476819, -0.0642576894506894,
    -0.0543810984331623, -0.0741755574175595, -0.0131228323048211,
    -0.214234307929943, -0.0137492004706794, -0.000982317887326278,
    -0.126128005295858, -0.177662982037535), NK.cells = c(-0.0172673823614314,
    -0.0518877213975413, -0.129207379606117, -0.174457678991973,
    -0.103184559349521, -0.0415572732935339, -0.100644327844509,
    -0.124636632740142, -0.131184498665394, -0.181979331198521,
    0.0352080568467581, -0.00354359170704435, -0.0820137078499403,
    -0.167969284367181, 0.132078267822988)), row.names = c("Pt101",
"Pt18", "Pt2", "Pt3", "Pt48", "Pt59", "Pt67", "Pt82", "Pt98",
"EA595647", "EA632133", "EA632149", "EA632171", "EA639018", "G109543_RCCBMS-00114-T_v1_RNA_OnPrem"
), class = "data.frame")
</code>```

Title: Building a ROC producing function in R

Body:
I want to make a function that accepts an xgboost model and the data (test set that I already got, called mydata[[2]]) and returns a ROC curve.
My first try was like this:

 evaluate_model_plot = function(model,data) {

  plt = roc(data[,1],predict(model, data[,-1]))
  plot(plt, main = 'Test Set')

}

I get this error:

> evaluate_model_plot(myxgb, mydata[[2]])

Error in xgb.DMatrix(newdata, missing = missing) :
xgb.DMatrix does not support construction from list

I tried again:

 evaluate_model_plot = function(model,data) {

  dtest = xgb.DMatrix(data = data.matrix(data[,-1]),label=as.numeric(as.character(data[,1])))

  plt = roc(dtest,predict(model, dtest))
  plot(plt, main = 'Test Set')

}

Now the error is:

Error in unique.default(x, nmax = nmax) :
unique() applies only to vectors

I'm not sure how to fix this. The first error is not very clear to me since the data I'm providing is a data frame, it's saying that it doesn't accept a list, although the input is not a list..

Here is a sample from my test set:

> dput(data[[2]][1:15,1:5])
structure(list(CR = structure(c(1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L,
1L, 2L, 2L, 1L, 1L, 1L, 1L), levels = c("0", "1"), class = "factor"),
    CD4.T.cells = c(0.0410284948786532, -0.0366277340916379,
    -0.0349008907108641, -0.062499826731091, -0.206241592996545,
    -0.0874700869552125, -0.182120904486964, -0.171941115538424,
    -0.101887370292612, -0.0471260521659922, 0.00336508376392719,
    -0.0558977705951249, -0.0346269111530533, 0.0405376992753275,
    -0.116824556352525), CD8.T.cells = c(-0.0372301980787381,
    -0.0550538743643369, -0.157003425700701, -0.280984614146961,
    -0.245432535063266, -0.147192190940429, -0.244633652045209,
    -0.213892169574032, -0.301036923607255, -0.427604924497491,
    -0.371628492024595, -0.0166106304573527, -0.200413064153971,
    -0.276715360733834, -0.13198989690999), T.helpers = c(0.186447606591857,
    0.0686746776877563, -0.0662055287009653, -0.0969110962088053,
    -0.176807066557773, -0.079679981476819, -0.0642576894506894,
    -0.0543810984331623, -0.0741755574175595, -0.0131228323048211,
    -0.214234307929943, -0.0137492004706794, -0.000982317887326278,
    -0.126128005295858, -0.177662982037535), NK.cells = c(-0.0172673823614314,
    -0.0518877213975413, -0.129207379606117, -0.174457678991973,
    -0.103184559349521, -0.0415572732935339, -0.100644327844509,
    -0.124636632740142, -0.131184498665394, -0.181979331198521,
    0.0352080568467581, -0.00354359170704435, -0.0820137078499403,
    -0.167969284367181, 0.132078267822988)), row.names = c("Pt101",
"Pt18", "Pt2", "Pt3", "Pt48", "Pt59", "Pt67", "Pt82", "Pt98",
"EA595647", "EA632133", "EA632149", "EA632171", "EA639018", "G109543_RCCBMS-00114-T_v1_RNA_OnPrem"
), class = "data.frame")


问:
Response Surface Modeling (RSM) surface plot in R - can't visualize contours
I am a new user of R, mostly interested in the RSM package. I'm really kindly thanking in advance whoever would like to help on this one, which is becaming a little bit frustrating.

I have generated an RSM model from a dataset (which I attach here in a shortened version, as an image):

Example of the .csv DATASET

```<code>library(rsm)

remove(list = ls())
setwd(" ... ")
dataf= read.csv("DATASET_ex.csv")

x1 <- dataf$alfa
x2 <- dataf$ER
x3 <- dataf$Temp

y = dataf$Speed

y_model <-  rsm(y ~ SO(x1,x2,x3), data=dataf)
summary(y_model)

</code>```

...but surface plots simply do not work (no matter if I use the x1,x2,x3 notation or the "real" variable names or any combination of them):

```<code>par(mfrow = c(1,3))
contour(y_model, ~ alfa+ER+Temp)

par(mfrow = c(1,3))
contour(y_model, ~ dataf$alfa+dataf$ER+dataf$Temp)

par(mfrow=c(1,3))
contour(y_model, ~x1+x2+x3, image=TRUE, at=summary(y_model$canonical$xs))

</code>```

I keep facing errors like: "Error in [.data.frame(dat, , vars, drop = FALSE) :
undefined columns selected".

Eventually, my final goal would be to produce plots like the following one, where I could simply show the y trends fixing the other independent variables.

Ideal plot type

I'm attaching here the dataf link:  files.fm/f/tsmcsj3gh

Here instead the dput(head(dataf)):

```<code>> head(dataf)
          Ref. H2 CO alfa P Temp  ER  Speed
1 Bouvet, 2011 50 50  0.5 1  295 0.4  13.64
2 Bouvet, 2011 50 50  0.5 1  295 0.6  42.31
3 Bouvet, 2011 50 50  0.5 1  295 0.8  72.83
4 Bouvet, 2011 50 50  0.5 1  295 1.0  96.88
5 Bouvet, 2011 50 50  0.5 1  295 1.2 118.61
6 Bouvet, 2011 50 50  0.5 1  295 1.5 149.13

> dput(head(dataf))
structure(list(Ref. = c("Bouvet, 2011", "Bouvet, 2011", "Bouvet, 2011",
"Bouvet, 2011", "Bouvet, 2011", "Bouvet, 2011"), H2 = c(50L,
50L, 50L, 50L, 50L, 50L), CO = c(50L, 50L, 50L, 50L, 50L, 50L
), alfa = c(0.5, 0.5, 0.5, 0.5, 0.5, 0.5), P = c(1L, 1L, 1L,
1L, 1L, 1L), Temp = c(295L, 295L, 295L, 295L, 295L, 295L), ER = c(0.4,
0.6, 0.8, 1, 1.2, 1.5), Speed = c(13.64, 42.31, 72.83, 96.88,
118.61, 149.13)), row.names = c(NA, 6L), class = "data.frame")
</code>```

Body:
I am a new user of R, mostly interested in the RSM package. I'm really kindly thanking in advance whoever would like to help on this one, which is becaming a little bit frustrating.

I have generated an RSM model from a dataset (which I attach here in a shortened version, as an image):

Example of the .csv DATASET

library(rsm)

remove(list = ls())
setwd(" ... ")
dataf= read.csv("DATASET_ex.csv")

x1 <- dataf$alfa
x2 <- dataf$ER
x3 <- dataf$Temp

y = dataf$Speed

y_model <-  rsm(y ~ SO(x1,x2,x3), data=dataf)
summary(y_model)

...but surface plots simply do not work (no matter if I use the x1,x2,x3 notation or the "real" variable names or any combination of them):

par(mfrow = c(1,3))
contour(y_model, ~ alfa+ER+Temp)

par(mfrow = c(1,3))
contour(y_model, ~ dataf$alfa+dataf$ER+dataf$Temp)

par(mfrow=c(1,3))
contour(y_model, ~x1+x2+x3, image=TRUE, at=summary(y_model$canonical$xs))

I keep facing errors like: "Error in [.data.frame(dat, , vars, drop = FALSE) :
undefined columns selected".

Eventually, my final goal would be to produce plots like the following one, where I could simply show the y trends fixing the other independent variables.

Ideal plot type

I'm attaching here the dataf link:  files.fm/f/tsmcsj3gh

Here instead the dput(head(dataf)):

> head(dataf)
          Ref. H2 CO alfa P Temp  ER  Speed
1 Bouvet, 2011 50 50  0.5 1  295 0.4  13.64
2 Bouvet, 2011 50 50  0.5 1  295 0.6  42.31
3 Bouvet, 2011 50 50  0.5 1  295 0.8  72.83
4 Bouvet, 2011 50 50  0.5 1  295 1.0  96.88
5 Bouvet, 2011 50 50  0.5 1  295 1.2 118.61
6 Bouvet, 2011 50 50  0.5 1  295 1.5 149.13

> dput(head(dataf))
structure(list(Ref. = c("Bouvet, 2011", "Bouvet, 2011", "Bouvet, 2011",
"Bouvet, 2011", "Bouvet, 2011", "Bouvet, 2011"), H2 = c(50L,
50L, 50L, 50L, 50L, 50L), CO = c(50L, 50L, 50L, 50L, 50L, 50L
), alfa = c(0.5, 0.5, 0.5, 0.5, 0.5, 0.5), P = c(1L, 1L, 1L,
1L, 1L, 1L), Temp = c(295L, 295L, 295L, 295L, 295L, 295L), ER = c(0.4,
0.6, 0.8, 1, 1.2, 1.5), Speed = c(13.64, 42.31, 72.83, 96.88,
118.61, 149.13)), row.names = c(NA, 6L), class = "data.frame")


问:
R: Second Level of categorical variable levels are not shown in the output of GLM model when inside lapply loop, but are when outside
I'm trying to calculate the adjusted odds ratios of lots of different outcomes with a set number of factors in a data frame in R. I'm using a loop to output these to a list.

```<code>Outcomes <- c("Q1", "Q2", "Q3", ....)

List <- lapply(Outcomes , function(x) {
    z = glm(substitute(i ~ ., list(i = as.name(x))), data = select(df, x, 100:102, Year, Country), family = "binomial")
    exp(cbind(OR = coef(z), confint(z)))
})
</code>```

I have 3 categorical factors: age range (3 levels), year (8 levels: 2015, 2016...), and country (3 levels)

When outputting the odds ratio the first two levels of year are missing - I know the first level should be missing because that's the comparison, but the second...The other two categorical factors are fine.

(sidenote does exp(cbind(OR = coef(z), confint(z))) calculate the odds ratio or the adjusted odds ratio?)

If I complete the the glm outside the loop

```<code>glm(substitute(i ~ ., list(i = as.name("Q1"))), data = select(ASHDATA, B2, Year), family = "binomial")
</code>```

The second level 2016 is included in the output!

Why is it not included when I use the lapply function and is there a way to make it work?

Thank you in advance!

Body:
I'm trying to calculate the adjusted odds ratios of lots of different outcomes with a set number of factors in a data frame in R. I'm using a loop to output these to a list.

Outcomes <- c("Q1", "Q2", "Q3", ....)

List <- lapply(Outcomes , function(x) {
    z = glm(substitute(i ~ ., list(i = as.name(x))), data = select(df, x, 100:102, Year, Country), family = "binomial")
    exp(cbind(OR = coef(z), confint(z)))
})

I have 3 categorical factors: age range (3 levels), year (8 levels: 2015, 2016...), and country (3 levels)

When outputting the odds ratio the first two levels of year are missing - I know the first level should be missing because that's the comparison, but the second...The other two categorical factors are fine.

(sidenote does exp(cbind(OR = coef(z), confint(z))) calculate the odds ratio or the adjusted odds ratio?)

If I complete the the glm outside the loop

glm(substitute(i ~ ., list(i = as.name("Q1"))), data = select(ASHDATA, B2, Year), family = "binomial")

The second level 2016 is included in the output!

Why is it not included when I use the lapply function and is there a way to make it work?

Thank you in advance!


问:
Problem with expiring kubernetes tokens in pulumi provider
After I create a kubernetes cluster in pulumi, I get the following error when trying to delete it:

```<code> error: configured Kubernetes cluster is unreachable: unable to load schema information from the API server: the server has asked for the client to provide credentials
    If the cluster has been deleted, you can edit the pulumi state to remove this resource
</code>```

I can refresh the credentials by running a targeted pulumi refresh and then a targeted pulumi up on the k8s provider. Is there an easier way to keep the kubernetes clusters updated without having to run the targeted commands all the time?

Body:
After I create a kubernetes cluster in pulumi, I get the following error when trying to delete it:

 error: configured Kubernetes cluster is unreachable: unable to load schema information from the API server: the server has asked for the client to provide credentials
    If the cluster has been deleted, you can edit the pulumi state to remove this resource

I can refresh the credentials by running a targeted pulumi refresh and then a targeted pulumi up on the k8s provider. Is there an easier way to keep the kubernetes clusters updated without having to run the targeted commands all the time?


问:
R 4.1.2: Put DF values in a vector then change their values in a function by referring to their position in the vector
Trying to create an array/vector of values from a df which I can point to in a function to change those values. Example is a pseudo example as my df is actually larger, but concept is the same.

I'm obviously doing this wrong, but if someone could point out my error(s) it would be appreciated.

```<code>#Create Df
df=data.frame(ID=numeric(),
              q1=numeric(),
              q2=numeric())

set.seed(1)
for(i in 1:2){
  list_i=c(i)
  df[i,]=list_i
}

#Put df values in a vector???
scores=c(df[1,2],df[2,1])
#Try change score by pointing to its position in vector?
scores[1]=7
#Value remains unchanged in DF
#Create function to replicate the above?
ChangeScores=function(temp){
  scores[1]=temp
}
ChangeScores(99)
#Value remains unchanged in DF as expected as first code did not work
</code>```

Body:
Trying to create an array/vector of values from a df which I can point to in a function to change those values. Example is a pseudo example as my df is actually larger, but concept is the same.

I'm obviously doing this wrong, but if someone could point out my error(s) it would be appreciated.

#Create Df
df=data.frame(ID=numeric(),
              q1=numeric(),
              q2=numeric())

set.seed(1)
for(i in 1:2){
  list_i=c(i)
  df[i,]=list_i
}

#Put df values in a vector???
scores=c(df[1,2],df[2,1])
#Try change score by pointing to its position in vector?
scores[1]=7
#Value remains unchanged in DF
#Create function to replicate the above?
ChangeScores=function(temp){
  scores[1]=temp
}
ChangeScores(99)
#Value remains unchanged in DF as expected as first code did not work


问:
Alternate solution to using variable in resources/repositories/repository/ref
I am trying to find an alternate solution to using variable in resources/repositories/repository/ref because using a variable is technically not allowed.
resources:

```<code>resources:
  repositories:
  - repository: devops
    name: MyProjects/devops
    type: git
    ref: master
</code>```

The workaround of doing a git clone of the external repository will not work for me because my dependency on that repository is for referencing the templates.

Example:

```<code> - template: Build/Templates/downloadFiles.yaml@devops
</code>```

Does anyone have a solution? Thank you for reading my post!

Body:
I am trying to find an alternate solution to using variable in resources/repositories/repository/ref because using a variable is technically not allowed.
resources:

resources:
  repositories:
  - repository: devops
    name: MyProjects/devops
    type: git
    ref: master

The workaround of doing a git clone of the external repository will not work for me because my dependency on that repository is for referencing the templates.

Example:

 - template: Build/Templates/downloadFiles.yaml@devops

Does anyone have a solution? Thank you for reading my post!


问:
error 500 when loading a jsp page in Spring Boot
I am trying to load a page with my simple Spring Boot application but it is giving me 500 error(Server). There is nothing in my jsp page except from text "hello" in body
my project structure - structure

my pom.xml -

```<code><?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>3.0.1</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.example</groupId>
    <artifactId>BootTest2</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>war</packaging>
    <name>BootTest2</name>
    <description>BootTest2</description>
    <properties>
        <java.version>17</java.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.tomcat.embed</groupId>
            <artifactId>tomcat-embed-jasper</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>
</code>```

Those 3 classes are just deafult classes so there cant be a problem.
And my application.properties file contains -

```<code>spring.mvc.view.prefix=/WEB-INF/jsp/
spring.mvc.view.suffix=.jsp
</code>```

What did I do wrong?

Body:
I am trying to load a page with my simple Spring Boot application but it is giving me 500 error(Server). There is nothing in my jsp page except from text "hello" in body
my project structure - structure

my pom.xml -

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>3.0.1</version>
        <relativePath/>
    </parent>
    <groupId>com.example</groupId>
    <artifactId>BootTest2</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>war</packaging>
    <name>BootTest2</name>
    <description>BootTest2</description>
    <properties>
        <java.version>17</java.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.tomcat.embed</groupId>
            <artifactId>tomcat-embed-jasper</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>

Those 3 classes are just deafult classes so there cant be a problem.
And my application.properties file contains -

spring.mvc.view.prefix=/WEB-INF/jsp/
spring.mvc.view.suffix=.jsp

What did I do wrong?


问:
Continuous deploy to CloudRun from a container registry
I have an application which is built as a docker container. The users of these applications are different people with their own GCP account. I want to continue to build my applications and release by pushing to a public container registry. I want all my users to automatically pull the latest container image and update their GCP CloudRun service.

In addition, I want to enable the following capabilities

Only users who has enabled automatic updates get updates automatically. Others can install them manually or when they enable automatic updates.

Ability to deploy to select set of users if they have automatic updates enabled.

(Basically, some custom logic in the continuous deployment workflow to see whether we can do an automatic update or not)

How to achieve this?

GCP documentation shows, I can do continuous deployment if my code in is GitHub and I enable Code build on every change. I want to skip this. Instead, I want all my users to listen to new container images and use them.


问:
A navigationDestination for “app.Type" was declared earlier on the stack
I understand what this means conceptually, but I don't understand why I'm not navigating to my ThirdView in response to it.

I'm trying to navigate two levels into the NavigationStack. But I keep pushing the second view on top of itself.

Here's my code:

Model

```<code>struct Person: Identifiable, Hashable {
    var id = UUID()
    var firstName: String
    var lastName: String
}
</code>```

View

```<code>struct Person: View {
    @EnvironmentObject var appState: AppState

    var body: some View {
        NavigationStack(path: $appState.path) {
            ZStack {
                Color.theme.color
                    .ignoresSafeArea()

                ScrollView(showsIndicators: false) {
                    PersonListView()
                }
            }
            .navigationTitle("People")
        }
    }
}

</code>```

Person List View

```<code>
struct PersonListView: View {

    let people = Person.persons.sorted(by: { $0.firstName < $1.firstName })

    var body: some View {
        VStack {
            VStack(spacing: 25.0) {
                ForEach(people) { person in
                    NavigationLink(value: person) {
                        VStack(spacing: 10.0) {
                            HStack {
                                Text(person.firstName)
                                    .foregroundColor(.black)
                                    .font(.system(size: 20.0, weight: .semibold))
                                    .padding(.top)
                                Spacer()
                            }
                            HStack {
                                Text(person.lastName)
                                    .foregroundColor(.gray)
                                    .font(.subheadline)
                                Spacer()
                            }
                        }
                        .frame(width: 350.0)
                        .cornerRadius(10.0)
                        .shadow(radius: 1.0)
                        .padding()
                        .background(.white)
                    }
                }
                .navigationDestination(for: Person.self) { person in
                    PersonDetailView(person: person)
                }
            }
        }
    }
}

</code>```

I have a var person: Person on my DetailView and an environment variable of path on my third view. PersonView is embedded in a custom TabView, if that's helpful.

Body:
I understand what this means conceptually, but I don't understand why I'm not navigating to my ThirdView in response to it.

I'm trying to navigate two levels into the NavigationStack. But I keep pushing the second view on top of itself.

Here's my code:

Model

struct Person: Identifiable, Hashable {
    var id = UUID()
    var firstName: String
    var lastName: String
}

View

struct Person: View {
    @EnvironmentObject var appState: AppState

    var body: some View {
        NavigationStack(path: $appState.path) {
            ZStack {
                Color.theme.color
                    .ignoresSafeArea()

                ScrollView(showsIndicators: false) {
                    PersonListView()
                }
            }
            .navigationTitle("People")
        }
    }
}

Person List View

struct PersonListView: View {

    let people = Person.persons.sorted(by: { $0.firstName < $1.firstName })

    var body: some View {
        VStack {
            VStack(spacing: 25.0) {
                ForEach(people) { person in
                    NavigationLink(value: person) {
                        VStack(spacing: 10.0) {
                            HStack {
                                Text(person.firstName)
                                    .foregroundColor(.black)
                                    .font(.system(size: 20.0, weight: .semibold))
                                    .padding(.top)
                                Spacer()
                            }
                            HStack {
                                Text(person.lastName)
                                    .foregroundColor(.gray)
                                    .font(.subheadline)
                                Spacer()
                            }
                        }
                        .frame(width: 350.0)
                        .cornerRadius(10.0)
                        .shadow(radius: 1.0)
                        .padding()
                        .background(.white)
                    }
                }
                .navigationDestination(for: Person.self) { person in
                    PersonDetailView(person: person)
                }
            }
        }
    }
}

I have a var person: Person on my DetailView and an environment variable of path on my third view. PersonView is embedded in a custom TabView, if that's helpful.


问:
Chart.js Data Looks Faint On First Page Load
I have a chart.js chart, when I access or view the chart on mobile (iPhone) it looks very faint, however, if I rotate the phone to its side (landscape) it looks normal, and if I turn it back to portrait it works fine again, until it is reloaded. examples example of it faint, example of it working (after landscape and back to portrait)

I have tested this on multiple browsers on my phone, all seem to do the same, is it a code error on my end? is it not supported by apple? I haven't been able to test it on android yet.

JS Fiddle Of Chart - https://jsfiddle.net/kmnd5b7o/

/*EXCHANGE RATES*/
var data = {
    labels: ["Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov"],
    datasets: [{
        backgroundColor: "rgba(0,0,0,0)",
        borderColor: "rgba(91,37,245, 1)",
        borderWidth: 4.5,
        data: [10.2, 10, 13, 12, 15, 13, 14.5, 11, 13.5, 13, 11],
    }]
};

var options = {
    maintainAspectRatio: false,
    legend: {
        display: false
    },
    scales: {
        yAxes: [{
            stacked: true,
            gridLines: {
                display: true,
                color: "rgba(91,37,245, 0.03)"
            },
            ticks: {
                maxTicksLimit: 5,
                min: 9,
                max: 16
            }
        }],
        xAxes: [{
            gridLines: {
                display: false
            }
        }]
    },
    elements: {
        point: {
            radius: 0
        }
    }
};

var ctx = document.getElementById('exchangeRates').getContext('2d');
var myLineChart = new Chart(ctx, {
    type: 'line',
    data: data,
    options: options
});```
<pre class="snippet-code-css lang-css prettyprint-override"><code>/*NAVBAR*/
:root {
    --primary-color: #5B25F5;
    --secondary-color: #9792c7;
    --secondary-color-with-opacity: #bab4e21f;
    --background-color: #F5F5FD;
    --background-color-hover: #e5e5ec;
    --text: #9792c7;
    --white: #fff;
    --black: #000;
}

body {
    margin: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--white);
    color: var(--primary-color);
    display: flex;
    flex-direction: row;
    flex: 1;
}

/*HEADER*/
main {
    margin-top: 1em;
    margin-right: 1em;
    border-radius: 2.5em;
    margin-left: 18.75em;
    width: 100%;
    height: 100%;
    background-color: var(--background-color);
    padding: 2.3em;
}

main header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

main header .icon.search {
    -webkit-mask: url(https://ozcanzaferayan.github.io/financial-crm/icon/search.svg) no-repeat center;
    mask: url(https://ozcanzaferayan.github.io/financial-crm/icon/search.svg) no-repeat center;
}

main header .form-inline {
    display: flex;
    width: 100%;
}

main h1 {
    font-size: 3em;
    color: var(--black);
    margin-top: 0;
}

@media screen and (max-width: 2850px) {
    /* Tablet (768px) */
    main {
        margin-left: 0;
        border-radius: 0;
        margin: 0;
        padding: 0em;
    }
    main header {
        margin-bottom: 0em;
        padding: 1em;
    }
    main header button.change-view {
        display: none;
    }
    main h1 {
        display: none;
    }
}

@media screen and (max-width: 500px) {
    /* Phone (Large)*/
}

/*CHARTS*/.charts-wrapper {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

main section[role="chart"] {
    width: 100%;
    margin-left: 1em;
    height: 18em;
    background-color: var(--white);
    border-radius: 2em;
    margin-bottom: 1em;
    padding: 2em;
    padding-bottom: 5em;
    box-sizing: border-box;
}

section[role="chart"] .title {
    color: var(--black);
    font-weight: 700;
    margin-top: 0;
}

main section[role="chart"].exchange-rates {
    width: calc(100% - 270px);
}

@media screen and (max-width: 768px) {
    /* Tablet (768px) */
    .charts-wrapper {
        flex-direction: column;
    }
    main section[role="chart"].exchange-rates, {
        margin-left: 0;
        width: 100%;
        padding: 2em;
        border-radius: 0;
        padding-bottom: 5em;
    }
}

@media screen and (max-width: 500px) {
    main section[role="chart"].exchange-rates, {
        padding: 0.5em;
        padding-bottom: 3em;
    }
}

@media screen and (max-width: 320px) {
    /* Phone (Small) */
    section[role="chart"] .title {
        margin-bottom: 0.2em;
    }
    main section[role="chart"].exchange-rates, {
        height: 12em;
    }
}</code>```

Exchange rates

                <canvas id="exchangeRates"></canvas>

```

Body:
I have a chart.js chart, when I access or view the chart on mobile (iPhone) it looks very faint, however, if I rotate the phone to its side (landscape) it looks normal, and if I turn it back to portrait it works fine again, until it is reloaded. examples example of it faint, example of it working (after landscape and back to portrait)

I have tested this on multiple browsers on my phone, all seem to do the same, is it a code error on my end? is it not supported by apple? I haven't been able to test it on android yet.

JS Fiddle Of Chart - https://jsfiddle.net/kmnd5b7o/

/*EXCHANGE RATES*/
var data = {
    labels: ["Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov"],
    datasets: [{
        backgroundColor: "rgba(0,0,0,0)",
        borderColor: "rgba(91,37,245, 1)",
        borderWidth: 4.5,
        data: [10.2, 10, 13, 12, 15, 13, 14.5, 11, 13.5, 13, 11],
    }]
};

var options = {
    maintainAspectRatio: false,
    legend: {
        display: false
    },
    scales: {
        yAxes: [{
            stacked: true,
            gridLines: {
                display: true,
                color: "rgba(91,37,245, 0.03)"
            },
            ticks: {
                maxTicksLimit: 5,
                min: 9,
                max: 16
            }
        }],
        xAxes: [{
            gridLines: {
                display: false
            }
        }]
    },
    elements: {
        point: {
            radius: 0
        }
    }
};

var ctx = document.getElementById('exchangeRates').getContext('2d');
var myLineChart = new Chart(ctx, {
    type: 'line',
    data: data,
    options: options
});

/*NAVBAR*/
:root {
    --primary-color: #5B25F5;
    --secondary-color: #9792c7;
    --secondary-color-with-opacity: #bab4e21f;
    --background-color: #F5F5FD;
    --background-color-hover: #e5e5ec;
    --text: #9792c7;
    --white: #fff;
    --black: #000;
}

body {
    margin: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--white);
    color: var(--primary-color);
    display: flex;
    flex-direction: row;
    flex: 1;
}

/*HEADER*/
main {
    margin-top: 1em;
    margin-right: 1em;
    border-radius: 2.5em;
    margin-left: 18.75em;
    width: 100%;
    height: 100%;
    background-color: var(--background-color);
    padding: 2.3em;
}

main header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

main header .icon.search {
    -webkit-mask: url(https://ozcanzaferayan.github.io/financial-crm/icon/search.svg) no-repeat center;
    mask: url(https://ozcanzaferayan.github.io/financial-crm/icon/search.svg) no-repeat center;
}

main header .form-inline {
    display: flex;
    width: 100%;
}

main h1 {
    font-size: 3em;
    color: var(--black);
    margin-top: 0;
}

@media screen and (max-width: 2850px) {
    /* Tablet (768px) */
    main {
        margin-left: 0;
        border-radius: 0;
        margin: 0;
        padding: 0em;
    }
    main header {
        margin-bottom: 0em;
        padding: 1em;
    }
    main header button.change-view {
        display: none;
    }
    main h1 {
        display: none;
    }
}

@media screen and (max-width: 500px) {
    /* Phone (Large)*/
}

/*CHARTS*/.charts-wrapper {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

main section[role="chart"] {
    width: 100%;
    margin-left: 1em;
    height: 18em;
    background-color: var(--white);
    border-radius: 2em;
    margin-bottom: 1em;
    padding: 2em;
    padding-bottom: 5em;
    box-sizing: border-box;
}

section[role="chart"] .title {
    color: var(--black);
    font-weight: 700;
    margin-top: 0;
}

main section[role="chart"].exchange-rates {
    width: calc(100% - 270px);
}

@media screen and (max-width: 768px) {
    /* Tablet (768px) */
    .charts-wrapper {
        flex-direction: column;
    }
    main section[role="chart"].exchange-rates, {
        margin-left: 0;
        width: 100%;
        padding: 2em;
        border-radius: 0;
        padding-bottom: 5em;
    }
}

@media screen and (max-width: 500px) {
    main section[role="chart"].exchange-rates, {
        padding: 0.5em;
        padding-bottom: 3em;
    }
}

@media screen and (max-width: 320px) {
    /* Phone (Small) */
    section[role="chart"] .title {
        margin-bottom: 0.2em;
    }
    main section[role="chart"].exchange-rates, {
        height: 12em;
    }
}

Exchange rates

                <canvas id="exchangeRates"></canvas>


问:
How can I color points in Three JS using OpenGL and Fragment Shaders to depend on the points' distance to the scene origin
To clarify I am using React, React Three Fiber, Three JS

I have 1000 points mapped into the shape of a disc, and I would like to give them texture via ShaderMaterial. It takes a vertexShader and a fragmentShader. For the color of the points I want them to transition in a gradient from blue to red, the further away points are blue and the closest to origin points are red.

This is the vertexShader:

```<code>const vertexShader = `
uniform float uTime;
uniform float uRadius;

varying float vDistance;
void main() {

  vec4 mvPosition = modelViewMatrix * vec4(position, 1.0);
  vDistance = length(mvPosition.xyz);
  gl_Position = projectionMatrix * mvPosition;
  gl_PointSize = 5.0;
}

`

export default vertexShader
</code>```

And here is the fragmentShader:

```<code>const fragmentShader = `
uniform float uDistance[1000];

varying float vDistance;

  void main() {
    // Calculate the distance of the fragment from the center of the point
    float d = 1.0 - length(gl_PointCoord - vec2(0.5, 0.5));

    // Interpolate the alpha value of the fragment based on its distance from the center of the point
    float alpha = smoothstep(0.45, 0.55, d);

    // Interpolate the color of the point between red and blue based on the distance of the point from the origin
    vec3 color = mix(vec3(1.0, 0.0, 0.0), vec3(0.0, 0.0, 1.0), vDistance);

    // Set the output color of the fragment
    gl_FragColor = vec4(color, alpha);
  }

`

export default fragmentShader
</code>```

I have tried solving the problem at first by passing an array of normalized distances for every point, but I now realize the points would have no idea how to associate which array index is the distance correlating to itself.

The main thing I am confused about it is how gl_FragColor works. In the example linked the idea is that every point from the vertexShader file will have a vDistance and use that value to assign a unique color to itself in the fragmentShader

So far I have only succeeded in getting all of the points to be the same color, they do not seem to differ based on distance at all

Body:
To clarify I am using React, React Three Fiber, Three JS

I have 1000 points mapped into the shape of a disc, and I would like to give them texture via ShaderMaterial. It takes a vertexShader and a fragmentShader. For the color of the points I want them to transition in a gradient from blue to red, the further away points are blue and the closest to origin points are red.

This is the vertexShader:

const vertexShader = `
uniform float uTime;
uniform float uRadius;

varying float vDistance;
void main() {

  vec4 mvPosition = modelViewMatrix * vec4(position, 1.0);
  vDistance = length(mvPosition.xyz);
  gl_Position = projectionMatrix * mvPosition;
  gl_PointSize = 5.0;
}

`

export default vertexShader

And here is the fragmentShader:

const fragmentShader = `
uniform float uDistance[1000];

varying float vDistance;

  void main() {
    // Calculate the distance of the fragment from the center of the point
    float d = 1.0 - length(gl_PointCoord - vec2(0.5, 0.5));

    // Interpolate the alpha value of the fragment based on its distance from the center of the point
    float alpha = smoothstep(0.45, 0.55, d);

    // Interpolate the color of the point between red and blue based on the distance of the point from the origin
    vec3 color = mix(vec3(1.0, 0.0, 0.0), vec3(0.0, 0.0, 1.0), vDistance);

    // Set the output color of the fragment
    gl_FragColor = vec4(color, alpha);
  }

`

export default fragmentShader

I have tried solving the problem at first by passing an array of normalized distances for every point, but I now realize the points would have no idea how to associate which array index is the distance correlating to itself.

The main thing I am confused about it is how gl_FragColor works. In the example linked the idea is that every point from the vertexShader file will have a vDistance and use that value to assign a unique color to itself in the fragmentShader

So far I have only succeeded in getting all of the points to be the same color, they do not seem to differ based on distance at all


问:
How can I handle with Pywin32 and Readthedocs?
I'm trying to publish a documentation project in ReadTheDocs, but I'm having the following mensage:

```<code>ERROR: No matching distribution found for pywin32==305
</code>```

I've tried to remove "pywin32" from my requirements.txt, but it didn't work and the same mensage pops up.

Do you guys have any suggestion how I can handle with that?

Body:
I'm trying to publish a documentation project in ReadTheDocs, but I'm having the following mensage:

ERROR: No matching distribution found for pywin32==305

I've tried to remove "pywin32" from my requirements.txt, but it didn't work and the same mensage pops up.

Do you guys have any suggestion how I can handle with that?


问:
Java Spring. Set Enum value with @Value annotation
I have class Computer which has MusicPlayer(Enum musicType) that plays diferent music depending on enum value.
When I try to do something like this

```<code>@Value("${musicPlayer.currentlyPlaying}")
Enum currentlyPlaying;
new MusicPlayer().play(currentlyPlaying);
</code>```

MusicPlayer.properties file

musicPlayer.currentlyPlaying = MusicEnum.rockMusic

Ofcourse it gives me Failed to convert value type of String to required type Enum
What can I do?

Body:
I have class Computer which has MusicPlayer(Enum musicType) that plays diferent music depending on enum value.
When I try to do something like this

@Value("${musicPlayer.currentlyPlaying}")
Enum currentlyPlaying;
new MusicPlayer().play(currentlyPlaying);

MusicPlayer.properties file

musicPlayer.currentlyPlaying = MusicEnum.rockMusic

Ofcourse it gives me Failed to convert value type of String to required type Enum
What can I do?


问:
How to read dynamic data (Blood pressure monitor)using BLE in android
I am new to work on ble stuff. I am working on a project which is related to medical field. I did read all static data like(device info battery level) etc. but When I try to read dynamic data like blood pressure using (omron Blood pressure monitor) ble. But it doesn't work. nothing happen. Please help me to read blood pressure data.</p>
```<code>
    private final BluetoothGattCallback mGattCallback = new BluetoothGattCallback() {
        @Override
        public void onConnectionStateChange(BluetoothGatt gatt, int status, int newState) {
            String intentAction;
            if (newState == BluetoothProfile.STATE_CONNECTED) {
                intentAction = ACTION_GATT_CONNECTED;
                mConnectionState = STATE_CONNECTED;
                broadcastUpdate(intentAction);
                Log.i(TAG, "Connected to GATT server.");
                // Attempts to discover services after successful connection.
                Log.i(TAG, "Attempting to start service discovery:" +
                        mBluetoothGatt.discoverServices());

            } else if (newState == BluetoothProfile.STATE_DISCONNECTED) {
                intentAction = ACTION_GATT_DISCONNECTED;
                mConnectionState = STATE_DISCONNECTED;
                Log.i(TAG, "Disconnected from GATT server.");
                broadcastUpdate(intentAction);
            }
        }

        @Override
        public void onServicesDiscovered(BluetoothGatt gatt, int status) {
            if (status == BluetoothGatt.GATT_SUCCESS) {

                broadcastUpdate(ACTION_GATT_SERVICES_DISCOVERED);
                //setHeartRateNotification(true);

            } else {
                Log.w(TAG, "onServicesDiscovered received: " + status);
            }

        }

        @Override
        public void onCharacteristicRead(BluetoothGatt gatt,
                                         BluetoothGattCharacteristic characteristic,
                                         int status) {

            if (status == BluetoothGatt.GATT_SUCCESS) {
                Log.w(TAG, "on characteristic received: " + Arrays.toString(characteristic.getValue()));
                dtaholder = Arrays.toString(characteristic.getValue());
                broadcastUpdate(ACTION_DATA_AVAILABLE, characteristic);
            }

            byte[] value = characteristic.getValue();
            Log.i("BLE", "receive value ----------------------------");
            for (int i = 0; i < value.length; i++) {
                Log.w("BLE", "character_value = " + value[i]);
            }
        }

        @Override
        public void onCharacteristicChanged(BluetoothGatt gatt,
                                            BluetoothGattCharacteristic characteristic) {
            //Log.w(TAG, "on characteristic received: " + Arrays.toString(characteristic.getValue()));
            dtaholder = Arrays.toString(characteristic.getValue());
            Log.w(TAG, "data received on characteristic change received: " + Arrays.toString(characteristic.getValue()));
            broadcastUpdate(ACTION_DATA_AVAILABLE, characteristic);
        }
    };

    private void broadcastUpdate(final String action) {
        final Intent intent = new Intent(action);
        sendBroadcast(intent);
    }

    private void broadcastUpdate(final String action,
                                 final BluetoothGattCharacteristic characteristic) {
        final Intent intent = new Intent(action);

//         This is special handling for the Heart Rate Measurement profile.  Data parsing is
//         carried out as per profile specifications:
//         http://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.heart_rate_measurement.xml
        if (Blood_Pressure_Measurement_CHAR_UUID.equals(characteristic.getUuid())) {
            int flag = characteristic.getProperties();
            int format = -1;
            if ((flag & 0x01) != 0) {
                format = BluetoothGattCharacteristic.FORMAT_UINT16;
                Log.d(TAG, "Heart rate format UINT16.");
            } else {
                format = BluetoothGattCharacteristic.FORMAT_UINT8;
                Log.d(TAG, "Heart rate format UINT8.");
            }
            final int heartRate = characteristic.getIntValue(format, 1);
            Log.d(TAG, String.format("Received heart rate: %d", heartRate));

            intent.putExtra(EXTRA_DATA, String.valueOf(heartRate));
        } else {
            // For all other profiles, writes the data formatted in HEX.
            final byte[] data = characteristic.getValue();
            if (data != null && data.length > 0) {
                final StringBuilder stringBuilder = new StringBuilder(data.length);
                for(byte byteChar : data)
                    stringBuilder.append(String.format("%02X ", byteChar));
                intent.putExtra(EXTRA_DATA, new String(data) + "\n" + stringBuilder.toString());
            }
        }

        sendBroadcast(intent);
    }

    public class LocalBinder extends Binder {
        BluetoothLeService getService() {
            return BluetoothLeService.this;
        }
    }

    @Override
    public IBinder onBind(Intent intent) {
        return mBinder;
    }

    @Override
    public boolean onUnbind(Intent intent) {
        // After using a given device, you should make sure that BluetoothGatt.close() is called
        // such that resources are cleaned up properly.  In this particular example, close() is
        // invoked when the UI is disconnected from the Service.
        close();
        return super.onUnbind(intent);
    }

    private final IBinder mBinder = new LocalBinder();

    /**
     * Initializes a reference to the local Bluetooth adapter.
     *
     * @return Return true if the initialization is successful.
     */
    public boolean initialize() {
        // For API level 18 and above, get a reference to BluetoothAdapter through
        // BluetoothManager.
        if (mBluetoothManager == null) {
            mBluetoothManager = (BluetoothManager) getSystemService(Context.BLUETOOTH_SERVICE);
            if (mBluetoothManager == null) {
                Log.e(TAG, "Unable to initialize BluetoothManager.");

                return false;
            }
        }

        mBluetoothAdapter = mBluetoothManager.getAdapter();
        if (mBluetoothAdapter == null) {
            Log.e(TAG, "Unable to obtain a BluetoothAdapter.");
            return false;
        }

        return true;
    }

    /**
     * Connects to the GATT server hosted on the Bluetooth LE device.
     *
     * @param address The device address of the destination device.
     *
     * @return Return true if the connection is initiated successfully. The connection result
     *         is reported asynchronously through the
     *         {@code BluetoothGattCallback#onConnectionStateChange(android.bluetooth.BluetoothGatt, int, int)}
     *         callback.
     */
    public boolean connect(final String address) {
        if (mBluetoothAdapter == null || address == null) {
            Log.w(TAG, "BluetoothAdapter not initialized or unspecified address.");
            return false;
        }

        // Previously connected device.  Try to reconnect.
        if (mBluetoothDeviceAddress != null && address.equals(mBluetoothDeviceAddress)
                && mBluetoothGatt != null) {
            Log.d(TAG, "Trying to use an existing mBluetoothGatt for connection.");
            if (mBluetoothGatt.connect()) {
                mConnectionState = STATE_CONNECTING;
                return true;
            } else {
                return false;
            }
        }

        final BluetoothDevice device = mBluetoothAdapter.getRemoteDevice(address);
        if (device == null) {
            Log.w(TAG, "Device not found.  Unable to connect.");
            return false;
        }
        // We want to directly connect to the device, so we are setting the autoConnect
        // parameter to false.
        mBluetoothGatt = device.connectGatt(this, false, mGattCallback);
        Log.d(TAG, "Trying to create a new connection.");
        mBluetoothDeviceAddress = address;
        mConnectionState = STATE_CONNECTING;
        return true;
    }

    /**
     * Disconnects an existing connection or cancel a pending connection. The disconnection result
     * is reported asynchronously through the
     * {@code BluetoothGattCallback#onConnectionStateChange(android.bluetooth.BluetoothGatt, int, int)}
     * callback.
     */
    public void disconnect() {
        if (mBluetoothAdapter == null || mBluetoothGatt == null) {
            Log.w(TAG, "BluetoothAdapter not initialized");
            return;
        }
        mBluetoothGatt.disconnect();
    }

    /**
     * After using a given BLE device, the app must call this method to ensure resources are
     * released properly.
     */
    public void close() {
        if (mBluetoothGatt == null) {
            return;
        }
        mBluetoothGatt.close();
        mBluetoothGatt = null;
    }

    /**
     * Request a read on a given {@code BluetoothGattCharacteristic}. The read result is reported
     * asynchronously through the {@code BluetoothGattCallback#onCharacteristicRead(android.bluetooth.BluetoothGatt, android.bluetooth.BluetoothGattCharacteristic, int)}
     * callback.
     *
     * @param characteristic The characteristic to read from.
     */
    public void readCharacteristic(BluetoothGattCharacteristic characteristic) {
        if (mBluetoothAdapter == null || mBluetoothGatt == null) {
            Log.w(TAG, "BluetoothAdapter not initialized");
            return;
        }
        mBluetoothGatt.readCharacteristic(characteristic);
        //Log.w(TAG, "The characteristic to read from maunally called"+ characteristic.getUuid());
    }

    /**
     * Enables or disables notification on a give characteristic.
     *
     * @param characteristic Characteristic to act on.
     * @param enabled If true, enable notification.  False otherwise.
     */
    public void setCharacteristicNotification(BluetoothGattCharacteristic characteristic,
                                              boolean enabled) {
        if (mBluetoothAdapter == null || mBluetoothGatt == null) {
            Log.w(TAG, "BluetoothAdapter not initialized");
            return;
        }
        mBluetoothGatt.setCharacteristicNotification(characteristic, enabled);

        // This is specific to Heart Rate Measurement.
        if (Blood_Pressure_Measurement_CHAR_UUID.equals(characteristic.getUuid())) {
            BluetoothGattDescriptor descriptor = characteristic.getDescriptor(
                    UUID.fromString(SampleGattAttributes.CLIENT_CHARACTERISTIC_CONFIG));
            descriptor.setValue(BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE);
            mBluetoothGatt.writeDescriptor(descriptor);
        }
    }

    /**
     * Retrieves a list of supported GATT services on the connected device. This should be
     * invoked only after {@code BluetoothGatt#discoverServices()} completes successfully.
     *
     * @return A {@code List} of supported services.
     */
    public List<BluetoothGattService> getSupportedGattServices() {
        if (mBluetoothGatt == null) return null;

        return mBluetoothGatt.getServices();
    }
`   this is the main ble service class i am going to mention control activity

     private final ExpandableListView.OnChildClickListener servicesListClickListner =
            new ExpandableListView.OnChildClickListener() {
                @Override
                public boolean onChildClick(ExpandableListView parent, View v, int groupPosition,
                                            int childPosition, long id) {
                    if (mGattCharacteristics != null) {
                        final BluetoothGattCharacteristic characteristic =
                                mGattCharacteristics.get(groupPosition).get(childPosition);
                        final int charaProp = characteristic.getProperties();
                        if ((charaProp | BluetoothGattCharacteristic.PROPERTY_READ) > 0) {
                            // If there is an active notification on a characteristic, clear
                            // it first so it doesn't update the data field on the user interface.
                            if (mNotifyCharacteristic != null) {
                                mBluetoothLeService.setCharacteristicNotification(
                                        mNotifyCharacteristic, false);
                                mNotifyCharacteristic = null;
                            }
                            mBluetoothLeService.readCharacteristic(characteristic);
                        }
                        if ((charaProp | BluetoothGattCharacteristic.PROPERTY_NOTIFY) > 0) {
                            mNotifyCharacteristic = characteristic;
                            mBluetoothLeService.setCharacteristicNotification(
                                    characteristic, true);
                        }
                        return true;
                    }
                    return false;
                }
            };    ````
</code>```

Body:
I am new to work on ble stuff. I am working on a project which is related to medical field. I did read all static data like(device info battery level) etc. but When I try to read dynamic data like blood pressure using (omron Blood pressure monitor) ble. But it doesn't work. nothing happen. Please help me to read blood pressure data.

    private final BluetoothGattCallback mGattCallback = new BluetoothGattCallback() {
        @Override
        public void onConnectionStateChange(BluetoothGatt gatt, int status, int newState) {
            String intentAction;
            if (newState == BluetoothProfile.STATE_CONNECTED) {
                intentAction = ACTION_GATT_CONNECTED;
                mConnectionState = STATE_CONNECTED;
                broadcastUpdate(intentAction);
                Log.i(TAG, "Connected to GATT server.");
                // Attempts to discover services after successful connection.
                Log.i(TAG, "Attempting to start service discovery:" +
                        mBluetoothGatt.discoverServices());

            } else if (newState == BluetoothProfile.STATE_DISCONNECTED) {
                intentAction = ACTION_GATT_DISCONNECTED;
                mConnectionState = STATE_DISCONNECTED;
                Log.i(TAG, "Disconnected from GATT server.");
                broadcastUpdate(intentAction);
            }
        }

        @Override
        public void onServicesDiscovered(BluetoothGatt gatt, int status) {
            if (status == BluetoothGatt.GATT_SUCCESS) {

                broadcastUpdate(ACTION_GATT_SERVICES_DISCOVERED);
                //setHeartRateNotification(true);

            } else {
                Log.w(TAG, "onServicesDiscovered received: " + status);
            }

        }

        @Override
        public void onCharacteristicRead(BluetoothGatt gatt,
                                         BluetoothGattCharacteristic characteristic,
                                         int status) {

            if (status == BluetoothGatt.GATT_SUCCESS) {
                Log.w(TAG, "on characteristic received: " + Arrays.toString(characteristic.getValue()));
                dtaholder = Arrays.toString(characteristic.getValue());
                broadcastUpdate(ACTION_DATA_AVAILABLE, characteristic);
            }

            byte[] value = characteristic.getValue();
            Log.i("BLE", "receive value ----------------------------");
            for (int i = 0; i < value.length; i++) {
                Log.w("BLE", "character_value = " + value[i]);
            }
        }

        @Override
        public void onCharacteristicChanged(BluetoothGatt gatt,
                                            BluetoothGattCharacteristic characteristic) {
            //Log.w(TAG, "on characteristic received: " + Arrays.toString(characteristic.getValue()));
            dtaholder = Arrays.toString(characteristic.getValue());
            Log.w(TAG, "data received on characteristic change received: " + Arrays.toString(characteristic.getValue()));
            broadcastUpdate(ACTION_DATA_AVAILABLE, characteristic);
        }
    };

    private void broadcastUpdate(final String action) {
        final Intent intent = new Intent(action);
        sendBroadcast(intent);
    }

    private void broadcastUpdate(final String action,
                                 final BluetoothGattCharacteristic characteristic) {
        final Intent intent = new Intent(action);

//         This is special handling for the Heart Rate Measurement profile.  Data parsing is
//         carried out as per profile specifications:
//         http://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.heart_rate_measurement.xml
        if (Blood_Pressure_Measurement_CHAR_UUID.equals(characteristic.getUuid())) {
            int flag = characteristic.getProperties();
            int format = -1;
            if ((flag & 0x01) != 0) {
                format = BluetoothGattCharacteristic.FORMAT_UINT16;
                Log.d(TAG, "Heart rate format UINT16.");
            } else {
                format = BluetoothGattCharacteristic.FORMAT_UINT8;
                Log.d(TAG, "Heart rate format UINT8.");
            }
            final int heartRate = characteristic.getIntValue(format, 1);
            Log.d(TAG, String.format("Received heart rate: %d", heartRate));

            intent.putExtra(EXTRA_DATA, String.valueOf(heartRate));
        } else {
            // For all other profiles, writes the data formatted in HEX.
            final byte[] data = characteristic.getValue();
            if (data != null && data.length > 0) {
                final StringBuilder stringBuilder = new StringBuilder(data.length);
                for(byte byteChar : data)
                    stringBuilder.append(String.format("%02X ", byteChar));
                intent.putExtra(EXTRA_DATA, new String(data) + "\n" + stringBuilder.toString());
            }
        }

        sendBroadcast(intent);
    }

    public class LocalBinder extends Binder {
        BluetoothLeService getService() {
            return BluetoothLeService.this;
        }
    }

    @Override
    public IBinder onBind(Intent intent) {
        return mBinder;
    }

    @Override
    public boolean onUnbind(Intent intent) {
        // After using a given device, you should make sure that BluetoothGatt.close() is called
        // such that resources are cleaned up properly.  In this particular example, close() is
        // invoked when the UI is disconnected from the Service.
        close();
        return super.onUnbind(intent);
    }

    private final IBinder mBinder = new LocalBinder();

    /**
     * Initializes a reference to the local Bluetooth adapter.
     *
     * @return Return true if the initialization is successful.
     */
    public boolean initialize() {
        // For API level 18 and above, get a reference to BluetoothAdapter through
        // BluetoothManager.
        if (mBluetoothManager == null) {
            mBluetoothManager = (BluetoothManager) getSystemService(Context.BLUETOOTH_SERVICE);
            if (mBluetoothManager == null) {
                Log.e(TAG, "Unable to initialize BluetoothManager.");

                return false;
            }
        }

        mBluetoothAdapter = mBluetoothManager.getAdapter();
        if (mBluetoothAdapter == null) {
            Log.e(TAG, "Unable to obtain a BluetoothAdapter.");
            return false;
        }

        return true;
    }

    /**
     * Connects to the GATT server hosted on the Bluetooth LE device.
     *
     * @param address The device address of the destination device.
     *
     * @return Return true if the connection is initiated successfully. The connection result
     *         is reported asynchronously through the
     *         {@code BluetoothGattCallback#onConnectionStateChange(android.bluetooth.BluetoothGatt, int, int)}
     *         callback.
     */
    public boolean connect(final String address) {
        if (mBluetoothAdapter == null || address == null) {
            Log.w(TAG, "BluetoothAdapter not initialized or unspecified address.");
            return false;
        }

        // Previously connected device.  Try to reconnect.
        if (mBluetoothDeviceAddress != null && address.equals(mBluetoothDeviceAddress)
                && mBluetoothGatt != null) {
            Log.d(TAG, "Trying to use an existing mBluetoothGatt for connection.");
            if (mBluetoothGatt.connect()) {
                mConnectionState = STATE_CONNECTING;
                return true;
            } else {
                return false;
            }
        }

        final BluetoothDevice device = mBluetoothAdapter.getRemoteDevice(address);
        if (device == null) {
            Log.w(TAG, "Device not found.  Unable to connect.");
            return false;
        }
        // We want to directly connect to the device, so we are setting the autoConnect
        // parameter to false.
        mBluetoothGatt = device.connectGatt(this, false, mGattCallback);
        Log.d(TAG, "Trying to create a new connection.");
        mBluetoothDeviceAddress = address;
        mConnectionState = STATE_CONNECTING;
        return true;
    }

    /**
     * Disconnects an existing connection or cancel a pending connection. The disconnection result
     * is reported asynchronously through the
     * {@code BluetoothGattCallback#onConnectionStateChange(android.bluetooth.BluetoothGatt, int, int)}
     * callback.
     */
    public void disconnect() {
        if (mBluetoothAdapter == null || mBluetoothGatt == null) {
            Log.w(TAG, "BluetoothAdapter not initialized");
            return;
        }
        mBluetoothGatt.disconnect();
    }

    /**
     * After using a given BLE device, the app must call this method to ensure resources are
     * released properly.
     */
    public void close() {
        if (mBluetoothGatt == null) {
            return;
        }
        mBluetoothGatt.close();
        mBluetoothGatt = null;
    }

    /**
     * Request a read on a given {@code BluetoothGattCharacteristic}. The read result is reported
     * asynchronously through the {@code BluetoothGattCallback#onCharacteristicRead(android.bluetooth.BluetoothGatt, android.bluetooth.BluetoothGattCharacteristic, int)}
     * callback.
     *
     * @param characteristic The characteristic to read from.
     */
    public void readCharacteristic(BluetoothGattCharacteristic characteristic) {
        if (mBluetoothAdapter == null || mBluetoothGatt == null) {
            Log.w(TAG, "BluetoothAdapter not initialized");
            return;
        }
        mBluetoothGatt.readCharacteristic(characteristic);
        //Log.w(TAG, "The characteristic to read from maunally called"+ characteristic.getUuid());
    }

    /**
     * Enables or disables notification on a give characteristic.
     *
     * @param characteristic Characteristic to act on.
     * @param enabled If true, enable notification.  False otherwise.
     */
    public void setCharacteristicNotification(BluetoothGattCharacteristic characteristic,
                                              boolean enabled) {
        if (mBluetoothAdapter == null || mBluetoothGatt == null) {
            Log.w(TAG, "BluetoothAdapter not initialized");
            return;
        }
        mBluetoothGatt.setCharacteristicNotification(characteristic, enabled);

        // This is specific to Heart Rate Measurement.
        if (Blood_Pressure_Measurement_CHAR_UUID.equals(characteristic.getUuid())) {
            BluetoothGattDescriptor descriptor = characteristic.getDescriptor(
                    UUID.fromString(SampleGattAttributes.CLIENT_CHARACTERISTIC_CONFIG));
            descriptor.setValue(BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE);
            mBluetoothGatt.writeDescriptor(descriptor);
        }
    }

    /**
     * Retrieves a list of supported GATT services on the connected device. This should be
     * invoked only after {@code BluetoothGatt#discoverServices()} completes successfully.
     *
     * @return A {@code List} of supported services.
     */
    public List<BluetoothGattService> getSupportedGattServices() {
        if (mBluetoothGatt == null) return null;

        return mBluetoothGatt.getServices();
    }
`   this is the main ble service class i am going to mention control activity

     private final ExpandableListView.OnChildClickListener servicesListClickListner =
            new ExpandableListView.OnChildClickListener() {
                @Override
                public boolean onChildClick(ExpandableListView parent, View v, int groupPosition,
                                            int childPosition, long id) {
                    if (mGattCharacteristics != null) {
                        final BluetoothGattCharacteristic characteristic =
                                mGattCharacteristics.get(groupPosition).get(childPosition);
                        final int charaProp = characteristic.getProperties();
                        if ((charaProp | BluetoothGattCharacteristic.PROPERTY_READ) > 0) {
                            // If there is an active notification on a characteristic, clear
                            // it first so it doesn't update the data field on the user interface.
                            if (mNotifyCharacteristic != null) {
                                mBluetoothLeService.setCharacteristicNotification(
                                        mNotifyCharacteristic, false);
                                mNotifyCharacteristic = null;
                            }
                            mBluetoothLeService.readCharacteristic(characteristic);
                        }
                        if ((charaProp | BluetoothGattCharacteristic.PROPERTY_NOTIFY) > 0) {
                            mNotifyCharacteristic = characteristic;
                            mBluetoothLeService.setCharacteristicNotification(
                                    characteristic, true);
                        }
                        return true;
                    }
                    return false;
                }
            };    ````