问:
How to have a private Crude application in Laravel (Shows inputs created by specific user)
I am trying to create a job board, I am using Crud application for the cv part of the portal, i don want everyone to see other user's cvs.

So the user inputs his data, then only sees his data to apply, edit, show etc. A possible way is to add a created by, but I am not sure if it is the best option.

Users migration
<?php

```<code>use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->id();
            $table->string('name');
            $table->string('email')->unique();
            $table->timestamp('email_verified_at')->nullable();
            $table->boolean('status')->default(1);
            $table->string('password');
            $table->rememberToken();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('users');
    }
}
</code>```

cv migrations

```<code><?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateCvTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('cv', function (Blueprint $table) {
            $table->index('user_id');
            $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
            $table->string ('FName');
            $table->string ('Nationality');
            $table->string ('Residence');
            $table->string ('email');
            $table->string ('Phone');
            $table->string('DOB');
            $table->string ('Gender');
            $table->string ('EmploymentStatus');
            $table->string ('EducationLevel');
            $table->string ('MajorField');
            $table->string ('Major');
            $table->string ('university');
            $table->string ('GradCounrty');
            $table->string ('GPA');
            $table->string ('ProfCertifications');
            $table->string ('PrevJobTitle');
            $table->date('PrevJobStart');
            $table->date('PrefJobEnd');
            $table->integer('WorkExp');
            $table->string('fileCV');
            $table->boolean('status')->default(0);
            $table->boolean('trash')->default(0);
            $table->timestamps();

        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('cv');
    }
}
</code>```

CV controller

```<code><?php

namespace App\Http\Controllers;
use App\Models\cv;
use Illuminate\Http\Request;

class cvController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    function __construct()
    {
         $this->middleware('permission:cv-list|cv-create|cv-edit|cv-delete', ['only' => ['index', 'show']]);
         $this->middleware('permission:cv-create', ['only' => ['create', 'store']]);
         $this->middleware('permission:cv-edit', ['only' => ['edit', 'update']]);
         $this->middleware('permission:cv-delete', ['only' => ['destroy']]);
    }

    public function index(Request $request)
    {
        $data = cv::all();

        return view('cv.index',compact('data'));
    }

    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function create()
    {
        return view('cv.create');
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {
        $this->validate($request, [

            'FName' => 'required',

        ]);

        $input = $request->all();
        if ($image = $request->file('image')) {
            $imageDestinationPath = 'uploads/images/sliders';
            $postImage = date('YmdHis') . "." . $image->getClientOriginalExtension();
            $image->move($imageDestinationPath, $postImage);
            $input['image'] = "$postImage";
        }

        cv::create($input);

        return redirect()->route('cv.index')
            ->with('success','CV Upladed successfully.');
    }

    /**
     * Display the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function show($id)
    {
        $cv = cv::find($id);

        return view('cv.show', compact('cv'));
    }

    /**
     * Show the form for editing the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function edit($id)
    {

        $cv = cv::find($id);

        return view('cv.edit',compact('cv'));
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request, $id)
    {

        $cv = cv::find($id);
        $this->validate($request, [

            'FName' => 'required',

        ]);

        $input=$request->all();
        if ($image = $request->file('image')) {
            $imageDestinationPath = 'uploads/images/sliders';
            $postImage = date('YmdHis') . "." . $image->getClientOriginalExtension();
            $image->move($imageDestinationPath, $postImage);
            //dd($path);
            $input['image'] = "$postImage";
        }
        else{
            unset($input['image']);
        }
        $cv->update($input);

        return redirect()->route('cv.index')
            ->with('success', 'CV updated successfully.');
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function destroy($id)
    {
        cv::find($id)->delete();

        return redirect()->route('cv.index')
            ->with('success', 'CV deleted successfully.');
    }

    public $gender = [
        "0" => "Female",
        "1" => "Male",
    ];

}
</code>```

答:
Add where clause to the index function</p>
```<code>public function index(Request $request)
{
    $data = cv::where('user_id', $request->user()->id)->get();
    return view('cv.index', compact('data'));
}
</code>```

Body:
I am trying to create a job board, I am using Crud application for the cv part of the portal, i don want everyone to see other user's cvs.

So the user inputs his data, then only sees his data to apply, edit, show etc. A possible way is to add a created by, but I am not sure if it is the best option.

Users migration
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->id();
            $table->string('name');
            $table->string('email')->unique();
            $table->timestamp('email_verified_at')->nullable();
            $table->boolean('status')->default(1);
            $table->string('password');
            $table->rememberToken();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('users');
    }
}

cv migrations

<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateCvTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('cv', function (Blueprint $table) {
            $table->index('user_id');
            $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
            $table->string ('FName');
            $table->string ('Nationality');
            $table->string ('Residence');
            $table->string ('email');
            $table->string ('Phone');
            $table->string('DOB');
            $table->string ('Gender');
            $table->string ('EmploymentStatus');
            $table->string ('EducationLevel');
            $table->string ('MajorField');
            $table->string ('Major');
            $table->string ('university');
            $table->string ('GradCounrty');
            $table->string ('GPA');
            $table->string ('ProfCertifications');
            $table->string ('PrevJobTitle');
            $table->date('PrevJobStart');
            $table->date('PrefJobEnd');
            $table->integer('WorkExp');
            $table->string('fileCV');
            $table->boolean('status')->default(0);
            $table->boolean('trash')->default(0);
            $table->timestamps();

        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('cv');
    }
}

CV controller

<?php

namespace App\Http\Controllers;
use App\Models\cv;
use Illuminate\Http\Request;

class cvController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    function __construct()
    {
         $this->middleware('permission:cv-list|cv-create|cv-edit|cv-delete', ['only' => ['index', 'show']]);
         $this->middleware('permission:cv-create', ['only' => ['create', 'store']]);
         $this->middleware('permission:cv-edit', ['only' => ['edit', 'update']]);
         $this->middleware('permission:cv-delete', ['only' => ['destroy']]);
    }

    public function index(Request $request)
    {
        $data = cv::all();

        return view('cv.index',compact('data'));
    }

    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function create()
    {
        return view('cv.create');
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {
        $this->validate($request, [

            'FName' => 'required',

        ]);

        $input = $request->all();
        if ($image = $request->file('image')) {
            $imageDestinationPath = 'uploads/images/sliders';
            $postImage = date('YmdHis') . "." . $image->getClientOriginalExtension();
            $image->move($imageDestinationPath, $postImage);
            $input['image'] = "$postImage";
        }

        cv::create($input);

        return redirect()->route('cv.index')
            ->with('success','CV Upladed successfully.');
    }

    /**
     * Display the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function show($id)
    {
        $cv = cv::find($id);

        return view('cv.show', compact('cv'));
    }

    /**
     * Show the form for editing the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function edit($id)
    {

        $cv = cv::find($id);

        return view('cv.edit',compact('cv'));
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request, $id)
    {

        $cv = cv::find($id);
        $this->validate($request, [

            'FName' => 'required',

        ]);

        $input=$request->all();
        if ($image = $request->file('image')) {
            $imageDestinationPath = 'uploads/images/sliders';
            $postImage = date('YmdHis') . "." . $image->getClientOriginalExtension();
            $image->move($imageDestinationPath, $postImage);
            //dd($path);
            $input['image'] = "$postImage";
        }
        else{
            unset($input['image']);
        }
        $cv->update($input);

        return redirect()->route('cv.index')
            ->with('success', 'CV updated successfully.');
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function destroy($id)
    {
        cv::find($id)->delete();

        return redirect()->route('cv.index')
            ->with('success', 'CV deleted successfully.');
    }

    public $gender = [
        "0" => "Female",
        "1" => "Male",
    ];

}

Body:
Add where clause to the index function

public function index(Request $request)
{
    $data = cv::where('user_id', $request->user()->id)->get();
    return view('cv.index', compact('data'));
}


来源: stackexchange

问:
Selection and automatic deselection problem
as I stated above, I need help with my c# code which I'm using in unity to make a 3D game.
When I click on an object it should change color and if there was previously another object selected, I need it to be deselected automatically.
I already wrote a code which is supposed to at least help me select(change a material color) but it isn't working.
I am checking if the left mouse button is pressed down and using raycast to check if there is something under a cursor. Also wrote a Selection class with 2 methods(Select/deselect) that are supposed to change color of an object.
I'll be thankful if you can help me.
Here's the code with mouse click:

```<code>public class ClickSelect : MonoBehaviour
{

    private void Update()
    {
        Click();

    }
    public void Click()
    {
        if (Input.GetMouseButtonDown(0))
        {
            RaycastHit hit;
            Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            if (Physics.Raycast(ray, out hit))
            {
                Selectable selectable = hit.collider.gameObject.GetComponent<Selectable>();
                if (selectable)
                {
                    hit.collider.gameObject.GetComponent<Selectable>().Select();
                }

            }
        }
    }

}
</code>```

And this is code of a selection class:

```<code>public class Selectable : MonoBehaviour
{

    public void Select()
    {
        GetComponent<Renderer>().material.color = Color.yellow;
    }

    public void Deselect()
    {
        GetComponent<Renderer>().material.color = Color.gray;
    }
}
</code>```

答:
To expand a bit on this answer, once you get the raycast itself to work properly, you want to store the current selection so you can fire deselect where necessary.

I would keep this information in the Selectable class itself like e.g.

```<code>public class Selectable : MonoBehaviour
{
    // Stores the current selection and can only be modified by this class
    private static Selectable _currentSelection;
    // Public read-only accessor if needed
    public static Selectable CurrentSelection => _currentSelection;

    // Deselcts if current selection and resets the selection
    public static void ClearSelection()
    {
        // if there is a current selection -> deselect it
        if(_currentSelection) _currentSelection.Deselect();

        // "forget" the reference
        _currentSelection = null;
    }

    // In general rather cache reused references
    [SerializeField] private Renderer _renderer;

    // Optional accessor
    public bool IsSelected => _currentSelection == this;

    private void Awake ()
    {
        // if not referenced yet get it ONCE on runtime
        if(!_renderer) _renderer = GetComponent<Renderer>();

        // I would also ensure the default state initially
        Deselect();
    }

    public void Select()
    {
        // if this is already the selected object -> nothing to do
        if(_currentSelection == this) return;

        // otherwise first clear any existing selection
        ClearSelection();

        // set your color
        _renderer.material.color = Color.yellow;

        // and store yourself as the current selection
        _currentSelection = this;
    }

    public void Deselect()
    {
        // set your color
        _renderer.material.color = Color.gray;

        // if this is the current selection forget the reference
        // usually this should always be the case anyway
        if(_currentSelection == this)
        {
            _currentSelection = null;
        }
    }
}
</code>```

and then

```<code>public class ClickSelect : MonoBehaviour
{
    // in general Camera.main is expensive -> rather store he reference and reuse it
    // Already reference this via the Inspector if possible
    [SerializeField] private Camera _mainCamera;

    private void Awake ()
    {
        // as fallback get it ONCE on runtime
        if(!_mainCamera) _mainCamera = Camera.main;
    }

    private void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            var ray = _mainCamera.ScreenPointToRay(Input.mousePosition);
            if (Physics.Raycast(ray, out var hit))
            {
                // Is what you clicked on a selectable?
                if (hit.transform.TryGetComponent<Selectable>(out var selectable))
                {
                    // Internally already handles deselection of current selected and skips if already selected this
                    selectable.Select();
                }
                // Optional: Deselect the current selection if you click on something else
                else
                {
                    Selectable.ClearSelection();
                }
            }
            // Optional: Deselect the current selection if you click on nothing
            else
            {
                Selectable.ClearSelection();
            }
        }
    }
}
</code>```

ContentLicense: CC BY-SA 4.0

Body:
as I stated above, I need help with my c# code which I'm using in unity to make a 3D game.
When I click on an object it should change color and if there was previously another object selected, I need it to be deselected automatically.
I already wrote a code which is supposed to at least help me select(change a material color) but it isn't working.
I am checking if the left mouse button is pressed down and using raycast to check if there is something under a cursor. Also wrote a Selection class with 2 methods(Select/deselect) that are supposed to change color of an object.
I'll be thankful if you can help me.
Here's the code with mouse click:

public class ClickSelect : MonoBehaviour
{

    private void Update()
    {
        Click();

    }
    public void Click()
    {
        if (Input.GetMouseButtonDown(0))
        {
            RaycastHit hit;
            Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            if (Physics.Raycast(ray, out hit))
            {
                Selectable selectable = hit.collider.gameObject.GetComponent<Selectable>();
                if (selectable)
                {
                    hit.collider.gameObject.GetComponent<Selectable>().Select();
                }

            }
        }
    }

}

And this is code of a selection class:

public class Selectable : MonoBehaviour
{

    public void Select()
    {
        GetComponent<Renderer>().material.color = Color.yellow;
    }

    public void Deselect()
    {
        GetComponent<Renderer>().material.color = Color.gray;
    }
}

Body:
To expand a bit on this answer, once you get the raycast itself to work properly, you want to store the current selection so you can fire deselect where necessary.

I would keep this information in the Selectable class itself like e.g.

public class Selectable : MonoBehaviour
{
    // Stores the current selection and can only be modified by this class
    private static Selectable _currentSelection;
    // Public read-only accessor if needed
    public static Selectable CurrentSelection => _currentSelection;

    // Deselcts if current selection and resets the selection
    public static void ClearSelection()
    {
        // if there is a current selection -> deselect it
        if(_currentSelection) _currentSelection.Deselect();

        // "forget" the reference
        _currentSelection = null;
    }

    // In general rather cache reused references
    [SerializeField] private Renderer _renderer;

    // Optional accessor
    public bool IsSelected => _currentSelection == this;

    private void Awake ()
    {
        // if not referenced yet get it ONCE on runtime
        if(!_renderer) _renderer = GetComponent<Renderer>();

        // I would also ensure the default state initially
        Deselect();
    }

    public void Select()
    {
        // if this is already the selected object -> nothing to do
        if(_currentSelection == this) return;

        // otherwise first clear any existing selection
        ClearSelection();

        // set your color
        _renderer.material.color = Color.yellow;

        // and store yourself as the current selection
        _currentSelection = this;
    }

    public void Deselect()
    {
        // set your color
        _renderer.material.color = Color.gray;

        // if this is the current selection forget the reference
        // usually this should always be the case anyway
        if(_currentSelection == this)
        {
            _currentSelection = null;
        }
    }
}

and then

public class ClickSelect : MonoBehaviour
{
    // in general Camera.main is expensive -> rather store he reference and reuse it
    // Already reference this via the Inspector if possible
    [SerializeField] private Camera _mainCamera;

    private void Awake ()
    {
        // as fallback get it ONCE on runtime
        if(!_mainCamera) _mainCamera = Camera.main;
    }

    private void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            var ray = _mainCamera.ScreenPointToRay(Input.mousePosition);
            if (Physics.Raycast(ray, out var hit))
            {
                // Is what you clicked on a selectable?
                if (hit.transform.TryGetComponent<Selectable>(out var selectable))
                {
                    // Internally already handles deselection of current selected and skips if already selected this
                    selectable.Select();
                }
                // Optional: Deselect the current selection if you click on something else
                else
                {
                    Selectable.ClearSelection();
                }
            }
            // Optional: Deselect the current selection if you click on nothing
            else
            {
                Selectable.ClearSelection();
            }
        }
    }
}


问:
Pine script: ist it possible to evaluate next candle values? to get relative lowest

I'm trying to detect the if each candle is the lowest value, checking 5 previous candles lows and 5 next candles lows

I found no problem with previous:

if ta.lowest(low, 5) == low
    line.new(bar_index - 1, low, bar_index + 1, low, color = color.red, width = 1)

To evaluate if current canle is lower than next ones, I've tried to use negative value on "ta.lowest(low, -5)" but it does not work.
Can you give me a hand?

答: It is not possible in PineScript to “look into the future”. PineScript is designed to make trading strategies and it would become a bit broken, if it was possible to look into the future. That is why you can’t look at the “next candle”.</p>


问:
Why am I getting these Oracle SQL Developer errors
I can't figure out what I am doing wrong here

enter image description here

--1.Create a unique Profile based on the following requirements

```<code>CREATE PROFILE PDylanReed LIMIT

  SESSIONS_PER_USER          3

  CPU_PER_SESSION            UNLIMITED

  CPU_PER_CALL               3000

  CONNECT_TIME               45

  LOGICAL_READS_PER_SESSION  DEFAULT

  LOGICAL_READS_PER_CALL     1000

  PRIVATE_SGA                15K

  COMPOSITE_LIMIT            5000000

  FAILED_LOGIN_ATTEMPTS   4

  PASSWORD_LIFE_TIME         120

  PASSWORD_LOCK_TIME         1/24

  PASSWORD_GRACE_TIME        110

  PASSWORD_REUSE_TIME        600

  PASSWORD_REUSE_MAX         5

  PASSWORD_VERIFY_FUNCTION   ora12c_verify_function;
</code>```

--2.Verify your Profile was successfully created by Creating and executing a SQL statement querying the appropriate Data Dictionary objects

```<code>SELECT * FROM DBA_SQL_PROFILES where name = PDylanReed;
</code>```

--3.Create 2 users assign them to the Permanent Tablespace of Users with a Quota of 30M

```<code>CREATE USER U1DylanReed

   IDENTIFIED BY temporary_password

   PERMANENT TABLESPACE Users

   QUOTA 30M ON Users

   PROFILE PDylanReed

   PASSWORD EXPIRE;

CREATE USER U2DylanReed

   IDENTIFIED BY temporary_password

   PERMANENT TABLESPACE Users

   QUOTA 30M ON Users

   PROFILE PDylanReed

   PASSWORD EXPIRE;
</code>```

--4.Create a role allowing users assigned to be able to connect to the database and create tables.

```<code>CREATE ROLE R1DylanReed;

GRANT CREATE SESSION, CREATE TABLE TO R1DylanReed;

SET ROLE R1DylanReed;  -> enables the role
</code>```

Errors I'm getting

enter image description here

enter image description here

```<code>Error starting at line : 3 in command -
CREATE PROFILE PDylanReed LIMIT
  SESSIONS_PER_USER          3
  CPU_PER_SESSION            UNLIMITED
  CPU_PER_CALL               3000
  CONNECT_TIME               45
  LOGICAL_READS_PER_SESSION  DEFAULT
  LOGICAL_READS_PER_CALL     1000
  PRIVATE_SGA                15K
  COMPOSITE_LIMIT            5000000
  FAILED_LOGIN_ATTEMPTS   4
  PASSWORD_LIFE_TIME         120
  PASSWORD_LOCK_TIME         1/24
  PASSWORD_GRACE_TIME        110
  PASSWORD_REUSE_TIME        600
  PASSWORD_REUSE_MAX         5
  PASSWORD_VERIFY_FUNCTION   ora12c_verify_function
Error report -
ORA-01031: insufficient privileges
01031. 00000 -  "insufficient privileges"
*Cause:    An attempt was made to perform a database operation without
           the necessary privileges.
*Action:   Ask your database administrator or designated security
           administrator to grant you the necessary privileges

Error starting at line : 23 in command -
SELECT * FROM DBA_SQL_PROFILES where name = PDylanReed
Error at Command Line : 23 Column : 15
Error report -
SQL Error: ORA-00942: table or view does not exist
00942. 00000 -  "table or view does not exist"
*Cause:
*Action:

Error starting at line : 28 in command -
CREATE USER U1DylanReed
   IDENTIFIED BY temporary_password
   PERMANENT TABLESPACE Users
   QUOTA 30M ON Users
   PROFILE PDylanReed
   PASSWORD EXPIRE
Error report -
ORA-00922: missing or invalid option
00922. 00000 -  "missing or invalid option"
*Cause:
*Action:

Error starting at line : 35 in command -
CREATE USER U2DylanReed
   IDENTIFIED BY temporary_password
   PERMANENT TABLESPACE Users
   QUOTA 30M ON Users
   PROFILE PDylanReed
   PASSWORD EXPIRE
Error report -
ORA-00922: missing or invalid option
00922. 00000 -  "missing or invalid option"
*Cause:
*Action:

Error starting at line : 44 in command -
CREATE ROLE R1DylanReed
Error report -
ORA-01031: insufficient privileges
01031. 00000 -  "insufficient privileges"
*Cause:    An attempt was made to perform a database operation without
           the necessary privileges.
*Action:   Ask your database administrator or designated security
           administrator to grant you the necessary privileges

Error starting at line : 46 in command -
GRANT CREATE SESSION, CREATE TABLE TO R1DylanReed
Error report -
ORA-01031: insufficient privileges
01031. 00000 -  "insufficient privileges"
*Cause:    An attempt was made to perform a database operation without
           the necessary privileges.
*Action:   Ask your database administrator or designated security
           administrator to grant you the necessary privileges

Role R1DYLANREED succeeded.

Error starting at line : 48 in command -
  -> enables the role
Error report -
Unknown Command
</code>```

答:
Screenshots you posted suggest that you don't have privileges to do those operations. User you're connected to lacks in the DBA role; "normal" users can't create profiles or other users.

Therefore, connect as a privileged user (such as SYS or SYSTEM) which is capable of maintaining the system. Or, even better, create a new user (let's call it MY_DBA) which will be granted the DBA role. Why? So that you wouldn't have to work with SYS and/or SYSTEM who are special, they own the database so you'd rather NOT mess up something.

How to get those privileges? If you're the only user of that database (because you installed it on your PC, for example), then do as I suggested. Otherwise, talk to your DBA (a person) who'll know how to help you.

Once you do that, work on tasks you've been given.

Note that create table statements you wrote are invalid; there's no such thing as permanent tablespace. You should follow documentation and use valid options only. If you meant to say that you don't want to use a temporary tablespace (which is a valid option) but rather a "permanent" (which doesn't exist), then you're wrong. A "temporary tablespace" is used for e.g. sorting data (if you're working with millions of rows and don't have enough RAM, it is done on a hard disk, in a temporary tablespace).

Body:
I can't figure out what I am doing wrong here

enter image description here

--1.Create a unique Profile based on the following requirements

CREATE PROFILE PDylanReed LIMIT

  SESSIONS_PER_USER          3

  CPU_PER_SESSION            UNLIMITED

  CPU_PER_CALL               3000

  CONNECT_TIME               45

  LOGICAL_READS_PER_SESSION  DEFAULT

  LOGICAL_READS_PER_CALL     1000

  PRIVATE_SGA                15K

  COMPOSITE_LIMIT            5000000

  FAILED_LOGIN_ATTEMPTS   4

  PASSWORD_LIFE_TIME         120

  PASSWORD_LOCK_TIME         1/24

  PASSWORD_GRACE_TIME        110

  PASSWORD_REUSE_TIME        600

  PASSWORD_REUSE_MAX         5

  PASSWORD_VERIFY_FUNCTION   ora12c_verify_function;

--2.Verify your Profile was successfully created by Creating and executing a SQL statement querying the appropriate Data Dictionary objects

SELECT * FROM DBA_SQL_PROFILES where name = PDylanReed;

--3.Create 2 users assign them to the Permanent Tablespace of Users with a Quota of 30M

CREATE USER U1DylanReed

   IDENTIFIED BY temporary_password

   PERMANENT TABLESPACE Users

   QUOTA 30M ON Users

   PROFILE PDylanReed

   PASSWORD EXPIRE;

CREATE USER U2DylanReed

   IDENTIFIED BY temporary_password

   PERMANENT TABLESPACE Users

   QUOTA 30M ON Users

   PROFILE PDylanReed

   PASSWORD EXPIRE;

--4.Create a role allowing users assigned to be able to connect to the database and create tables.

CREATE ROLE R1DylanReed;

GRANT CREATE SESSION, CREATE TABLE TO R1DylanReed;

SET ROLE R1DylanReed;  -> enables the role

Errors I'm getting

enter image description here

enter image description here

Error starting at line : 3 in command -
CREATE PROFILE PDylanReed LIMIT
  SESSIONS_PER_USER          3
  CPU_PER_SESSION            UNLIMITED
  CPU_PER_CALL               3000
  CONNECT_TIME               45
  LOGICAL_READS_PER_SESSION  DEFAULT
  LOGICAL_READS_PER_CALL     1000
  PRIVATE_SGA                15K
  COMPOSITE_LIMIT            5000000
  FAILED_LOGIN_ATTEMPTS   4
  PASSWORD_LIFE_TIME         120
  PASSWORD_LOCK_TIME         1/24
  PASSWORD_GRACE_TIME        110
  PASSWORD_REUSE_TIME        600
  PASSWORD_REUSE_MAX         5
  PASSWORD_VERIFY_FUNCTION   ora12c_verify_function
Error report -
ORA-01031: insufficient privileges
01031. 00000 -  "insufficient privileges"
*Cause:    An attempt was made to perform a database operation without
           the necessary privileges.
*Action:   Ask your database administrator or designated security
           administrator to grant you the necessary privileges

Error starting at line : 23 in command -
SELECT * FROM DBA_SQL_PROFILES where name = PDylanReed
Error at Command Line : 23 Column : 15
Error report -
SQL Error: ORA-00942: table or view does not exist
00942. 00000 -  "table or view does not exist"
*Cause:
*Action:

Error starting at line : 28 in command -
CREATE USER U1DylanReed
   IDENTIFIED BY temporary_password
   PERMANENT TABLESPACE Users
   QUOTA 30M ON Users
   PROFILE PDylanReed
   PASSWORD EXPIRE
Error report -
ORA-00922: missing or invalid option
00922. 00000 -  "missing or invalid option"
*Cause:
*Action:

Error starting at line : 35 in command -
CREATE USER U2DylanReed
   IDENTIFIED BY temporary_password
   PERMANENT TABLESPACE Users
   QUOTA 30M ON Users
   PROFILE PDylanReed
   PASSWORD EXPIRE
Error report -
ORA-00922: missing or invalid option
00922. 00000 -  "missing or invalid option"
*Cause:
*Action:

Error starting at line : 44 in command -
CREATE ROLE R1DylanReed
Error report -
ORA-01031: insufficient privileges
01031. 00000 -  "insufficient privileges"
*Cause:    An attempt was made to perform a database operation without
           the necessary privileges.
*Action:   Ask your database administrator or designated security
           administrator to grant you the necessary privileges

Error starting at line : 46 in command -
GRANT CREATE SESSION, CREATE TABLE TO R1DylanReed
Error report -
ORA-01031: insufficient privileges
01031. 00000 -  "insufficient privileges"
*Cause:    An attempt was made to perform a database operation without
           the necessary privileges.
*Action:   Ask your database administrator or designated security
           administrator to grant you the necessary privileges

Role R1DYLANREED succeeded.

Error starting at line : 48 in command -
  -> enables the role
Error report -
Unknown Command


问:
allowProvisioningUpdates not working in automatic signing fastlane
I'm trying to upload build through Github action but i'm stuck in the last point. I'm trying to upload build through automatic signing. But every time got the error.

FastFile:-

```<code>platform :ios do
lane :closed_beta do
keychain_name = TEMP_KEYCHAIN_USER
keychain_password = TEMP_KEYCHAIN_PASSWORD
ensure_temp_keychain(keychain_name, keychain_password)

  api_key = app_store_connect_api_key(
  key_id: APPLE_KEY_ID,
  issuer_id: APPLE_ISSUER_ID,
  key_content: "#{ENV["APPLE_KEY_CONTENT"]}".gsub('\n', '\\n'),
  is_key_content_base64:true,
  duration: 1200,
  in_house: false
  )

  increment_build_number(xcodeproj: "**********")

  enable_automatic_code_signing(
    team_id: "********",
  )

  gym(
  configuration: "Release",
  scheme: "*******",
  export_xcargs: "-allowProvisioningUpdates",
  workspace: '********',
  include_bitcode: false,
  export_method: "app-store",
  export_options: {
  uploadBitcode: false,
    uploadSymbols: false,
    compileBitcode: false,
    provisioningProfiles: {
        DEVELOPER_APP_ID => PROVISIONING_PROFILE_SPECIFIER
     },
        "signingStyle": "manual"
    }
  )

  pilot(
  apple_id: "*******",
  app_identifier: "*******",
  skip_waiting_for_build_processing: true,
  skip_submission: true,
  distribute_external: false,
  notify_external_testers: false,
  ipa: "./*******.ipa"
 )

  delete_temp_keychain(keychain_name)
 end
</code>```

Xcode:-

I have tried with and without “-allowProvisioningUpdates”.

With I get the following:

Code Signing Error: There are no accounts registered with Xcode. Add your developer account to Xcode
Code Signing Error: No profiles for '[my app name]' were found:  Xcode couldn't find any iOS App Development provisioning profiles matching '[my app name]'.

Without I get:

No profiles for '[my app name]' were found:  Xcode couldn't find any iOS App Development provisioning profiles matching '[my app name]'.
Automatic signing is disabled and unable to generate a profile.
To enable automatic signing, pass -allowProvisioningUpdates to xcodebuild.

Question: Can someone please explain to me how to solve this, I've tried with above code but no results yet.

Can someone please explain to me How to upload app test Flight with automatic signing?

Any help would be greatly appreciated.

Thanks in advance.

答: My biggest Mistake, i was not set the provisional profile in the build settings. Please update the same provisional profile in the build setting option.</p>

Body:
I'm trying to upload build through Github action but i'm stuck in the last point. I'm trying to upload build through automatic signing. But every time got the error.

FastFile:-

platform :ios do
lane :closed_beta do
keychain_name = TEMP_KEYCHAIN_USER
keychain_password = TEMP_KEYCHAIN_PASSWORD
ensure_temp_keychain(keychain_name, keychain_password)

  api_key = app_store_connect_api_key(
  key_id: APPLE_KEY_ID,
  issuer_id: APPLE_ISSUER_ID,
  key_content: "#{ENV["APPLE_KEY_CONTENT"]}".gsub('\n', '\\n'),
  is_key_content_base64:true,
  duration: 1200,
  in_house: false
  )

  increment_build_number(xcodeproj: "**********")

  enable_automatic_code_signing(
    team_id: "********",
  )

  gym(
  configuration: "Release",
  scheme: "*******",
  export_xcargs: "-allowProvisioningUpdates",
  workspace: '********',
  include_bitcode: false,
  export_method: "app-store",
  export_options: {
  uploadBitcode: false,
    uploadSymbols: false,
    compileBitcode: false,
    provisioningProfiles: {
        DEVELOPER_APP_ID => PROVISIONING_PROFILE_SPECIFIER
     },
        "signingStyle": "manual"
    }
  )

  pilot(
  apple_id: "*******",
  app_identifier: "*******",
  skip_waiting_for_build_processing: true,
  skip_submission: true,
  distribute_external: false,
  notify_external_testers: false,
  ipa: "./*******.ipa"
 )

  delete_temp_keychain(keychain_name)
 end

Xcode:-

I have tried with and without “-allowProvisioningUpdates”.

With I get the following:

Code Signing Error: There are no accounts registered with Xcode. Add your developer account to Xcode
Code Signing Error: No profiles for '[my app name]' were found:  Xcode couldn't find any iOS App Development provisioning profiles matching '[my app name]'.

Without I get:

No profiles for '[my app name]' were found:  Xcode couldn't find any iOS App Development provisioning profiles matching '[my app name]'.
Automatic signing is disabled and unable to generate a profile.
To enable automatic signing, pass -allowProvisioningUpdates to xcodebuild.

Question: Can someone please explain to me how to solve this, I've tried with above code but no results yet.

Can someone please explain to me How to upload app test Flight with automatic signing?

Any help would be greatly appreciated.

Thanks in advance.


问:
Using string as a comparator - Python
I would like to use a string, such as "==" or ">" as a comparator for an if statement. For example:

```<code>comparator = ">="

if y comparator x:
    print("hello world")
</code>```

I want to get

```<code>if y >= x:
    print("hello world")
</code>```

答:
You could use eval to convert strings into code:</p>
```<code>comparator = ">="
if eval(f"{x}{comparator}{y}"):
    print("hello world")
</code>```

Title: Using string as a comparator - Python

Body:
I would like to use a string, such as "==" or ">" as a comparator for an if statement. For example:

comparator = ">="

if y comparator x:
    print("hello world")

I want to get

if y >= x:
    print("hello world")

Body:
You could use eval to convert strings into code:

comparator = ">="
if eval(f"{x}{comparator}{y}"):
    print("hello world")


问:
how to conda pack the base env
I know the commands:

```<code># Pack environment my_env into my_env.tar.gz
$ conda pack -n my_env

# Pack environment my_env into out_name.tar.gz
$ conda pack -n my_env -o out_name.tar.gz

# Pack environment located at an explicit path into my_env.tar.gz
$ conda pack -p /explicit/path/to/my_env
</code>```

are used to pack the environment named as my_env.

But, how to conda pack the base env of the anaconda?

答:
How about making a clone of the base env first?
conda create --name baseclone --clone base

There is some packages that cannot be cloned though, don't know if it is a critical issue: (The following packages cannot be cloned out of the root environment.. blablabla)

Then the cloned env you just created can be packed by the conda pack command.

Title: how to conda pack the base env

Body:
I know the commands:

# Pack environment my_env into my_env.tar.gz
$ conda pack -n my_env

# Pack environment my_env into out_name.tar.gz
$ conda pack -n my_env -o out_name.tar.gz

# Pack environment located at an explicit path into my_env.tar.gz
$ conda pack -p /explicit/path/to/my_env

are used to pack the environment named as my_env.

But, how to conda pack the base env of the anaconda?


问:
Is there a cleaner way to map an object to a class (e.g. using a dictionary)?

public static class SceneToGame{
    public static GameParentServer Server(int scene, Server server){
        switch (scene){
            case 1:
                return new SnapGameServer(server);
            default:
                return null;
        }
    }
}
```

I'm currently using this to map ints to classes with a common parent. Is there a cleaner way to do this? From what I've read you can't because C# is type safe despite this being type safe.

答:
One potential method might be to use reflection to enable intelligent mapping to the GameParentServer child. The primary benefit of this method is that it will use a few lines of codes, and won't require changes to the mapping for every new value of 'scene'. This fits my definition of clean, although opinions can vary.

Edit:
As @JHBonarius has pointed out, it's worth considering that there is a performance hit when using this approach. Based on the name of your class - GameServerParent - my presumption is that this is a heavy object that will be initialised only once per application execution. In this scenario, the performance hit here is perfectly acceptable. However, for smaller objects that are constantly initialised, this approach might degrade performance too heavily to be useable. We can discuss implementing a cache of this information if your GameServerParent objects are something you intend to initialise constantly.

To implement this approach, we simply add an identifier attribute to the relevant GameParentServer child classes.

```<code>public class GameServerAttribute: Attribute
{
    public GameServerAttribute(int gameServerId)
    {
        GameServerId = gameServerId;
    }

    private int GameServerId { get; }
}
</code>```

Then, we add to this to the classes that inherit GameParentServer:

```<code>[GameServer(1)]
public class SnapGameServer : GameParentServer
{
    public SnapGameServer(Server server) : base(server)
    {
    }
}
</code>```

Now, we just need to modify the mapping to actually use the attribute and call the constructor via reflection:

```<code>public static class SceneToGame{
    public static GameParentServer Server(int scene, Server server)
    {
        Type types = Assembly
            .GetCallingAssembly()
            .GetTypes()
            .FirstOrDefault(t => t.GetCustomAttributes()
                                     .Contains(new GameServerAttribute(scene))
                                 && t.IsSubclassOf(typeof(GameParentServer)));

        return (GameParentServer) types?
            .InvokeMember("", BindingFlags.CreateInstance, null, null, new object?[] {server});
    }
}
</code>```

This code identifies the assembly that is calling the code, retrieves the types in the assembly, and then checks if they have an instance of our new custom attribute with the passed value. If so, we take the first one, and then invoke the constructor, passing in the server parameter.

You are now free to add new [GameServer(scene)] attributes to any class, and a passed int will automatically map to the relevant class. Please keep in mind that my example does not handle construction exceptions, or classes that have duplicate scene values. I also would recommend using an enum instead of an int for mapping, as it will be easier to read and maintain.

One last note, my example here makes the assumption that the classes that inherit GameParentServer are all in the same assembly, and that this assembly is making the call to this code. If you have separated them out, you'll need to retrieve the types of the different assemblies in order to find the applicable types.

Body:
public static class SceneToGame{
    public static GameParentServer Server(int scene, Server server){
        switch (scene){
            case 1:
                return new SnapGameServer(server);
            default:
                return null;
        }
    }
}

I'm currently using this to map ints to classes with a common parent. Is there a cleaner way to do this? From what I've read you can't because C# is type safe despite this being type safe.

Body:
One potential method might be to use reflection to enable intelligent mapping to the GameParentServer child. The primary benefit of this method is that it will use a few lines of codes, and won't require changes to the mapping for every new value of 'scene'. This fits my definition of clean, although opinions can vary.

Edit:
As @JHBonarius has pointed out, it's worth considering that there is a performance hit when using this approach. Based on the name of your class - GameServerParent - my presumption is that this is a heavy object that will be initialised only once per application execution. In this scenario, the performance hit here is perfectly acceptable. However, for smaller objects that are constantly initialised, this approach might degrade performance too heavily to be useable. We can discuss implementing a cache of this information if your GameServerParent objects are something you intend to initialise constantly.

To implement this approach, we simply add an identifier attribute to the relevant GameParentServer child classes.

public class GameServerAttribute: Attribute
{
    public GameServerAttribute(int gameServerId)
    {
        GameServerId = gameServerId;
    }

    private int GameServerId { get; }
}

Then, we add to this to the classes that inherit GameParentServer:

[GameServer(1)]
public class SnapGameServer : GameParentServer
{
    public SnapGameServer(Server server) : base(server)
    {
    }
}

Now, we just need to modify the mapping to actually use the attribute and call the constructor via reflection:

public static class SceneToGame{
    public static GameParentServer Server(int scene, Server server)
    {
        Type types = Assembly
            .GetCallingAssembly()
            .GetTypes()
            .FirstOrDefault(t => t.GetCustomAttributes()
                                     .Contains(new GameServerAttribute(scene))
                                 && t.IsSubclassOf(typeof(GameParentServer)));

        return (GameParentServer) types?
            .InvokeMember("", BindingFlags.CreateInstance, null, null, new object?[] {server});
    }
}

This code identifies the assembly that is calling the code, retrieves the types in the assembly, and then checks if they have an instance of our new custom attribute with the passed value. If so, we take the first one, and then invoke the constructor, passing in the server parameter.

You are now free to add new [GameServer(scene)] attributes to any class, and a passed int will automatically map to the relevant class. Please keep in mind that my example does not handle construction exceptions, or classes that have duplicate scene values. I also would recommend using an enum instead of an int for mapping, as it will be easier to read and maintain.

One last note, my example here makes the assumption that the classes that inherit GameParentServer are all in the same assembly, and that this assembly is making the call to this code. If you have separated them out, you'll need to retrieve the types of the different assemblies in order to find the applicable types.


问:
How to load pop-up ad inside an iframe
I'm implementing pop up ads for my site. The popup opens when clicked anywhere on the site except on iframe. Why does this happen? Sure iframe is separate from the entire website but why does it prevent a pop up from loading? Is there anyway to load pop-up ad inside an iframe i.e when someone press yt play button</p>

答:
YT will not allow anyone to use its play button with a event listener.
So, you have to make a

 make its position: absolute; and z-index: (any bigger value) and then put it in front of the play button and then if anyone tries to click on paly button of your video he will click on the div which will show a ad and when some closes the ad then make .play{ display: none;} and now your div will be removed so the person would be able to click on the play button and see the video.

Title: How to load pop-up ad inside an iframe

Body:
YT will not allow anyone to use its play button with a event listener.
So, you have to make a <div class="play"></div> make its position: absolute; and z-index: (any bigger value) and then put it in front of the play button and then if anyone tries to click on paly button of your video he will click on the div which will show a ad and when some closes the ad then make .play{ display: none;} and now your div will be removed so the person would be able to click on the play button and see the video.


问:
SCRUM - non cooperative team members
What do you do if members of your team are not cooperative during scrum meetings?
They either provide a very high level definition of what they are currently working on, ("working on feature x"), or go into extremely irrelevant details, in spite of being well educated in SCRUM methodology.
This causes the scrum meeting to be ineffective and boring.

As a scrum master, what are your techniques to getting the best out of people during the meeting?

Edited to add:

What technique do you use to stop someone who is talking too much, without being offensive?

What technique do you use to encourage someone to provide a more detailed answer?

How do you react when you find yourself being the only one who listens, while other team members just sit there and maybe even fall asleep?

答:
Ask for the specific details you need. People won't be aware of stuff you are interested in.

Also try to put forth some guidelines for better and effective presentation before the meeting.

OwnerDisplayName: lilian

ContentLicense: CC BY-SA 2.5

Title: SCRUM - non cooperative team members

LastEditorDisplayName: Tipa Shel Or

OwnerDisplayName: Niyaz


问:
ToolStripMenuItem can't show checkmark and Image (icon) when RenderMode is "System"?
My Windows Forms application has a MenuStrip and some of the menu items (ToolStripMenuItem) have an icon (setting the ToolStripMenuItem.Image property).

When the RenderMode property of the MenuStrip is set to ToolStripRenderMode.System, the checkmark doesn't display when the Checked or CheckOnClick property is true and the menu item has an icon.

It does display when i switch the MenuStrip.RenderMode property to ToolStripRenderMode.Professional or ToolStripRenderMode.RenderManagerMode.

Unfortunately, this is a problem because my app requires:

A ProgressBar in marquee mode, so Application.EnableVisualStyles() is required to get this to work.

The app requires a "flat" visual style, which i accomplished by leaving out the call to Application.EnableVisualStyles() and leaving the default ToolStripRenderMode.RenderManagerMode on the MenuStrip.  But then i can't get my marquee ProgressBar!

Setting the RenderMode to ToolStripRenderMode.System solves the look and feel requirement, but takes away the ability to have checked menu items w/icons.

Is there any way to satisfy all my requirements?  Am i missing something?  Thanks for looking.

答:
Wow, i stumped SO!  Now i know i must be working on some serious code.

Anyway, the answer is: implement your own ToolStripRenderer by creating a class that inherits from ToolStripSystemRenderer.

Override the methods that draw the items with your own code.  Here's what i was looking for specifically that draws the checked item.  It draws a check if there's no image for the ToolStripMenuItem.

```<code>protected override void OnRenderItemCheck(ToolStripItemImageRenderEventArgs e)
{
    base.OnRenderItemCheck(e);
    if (e.Item.Selected)
    {
        Rectangle rect = new Rectangle(3, 1, 20, 20);
        Rectangle rect2 = new Rectangle(4, 2, 18, 18);
        SolidBrush b = new SolidBrush(Color.FromArgb(49, 106, 197));
        SolidBrush b2 = new SolidBrush(Color.Orange);

        e.Graphics.FillRectangle(b, rect);
        e.Graphics.FillRectangle(b2, rect2);
        e.Graphics.DrawImage(e.Image, new Point(5, 3));
    }
    else
    {
        Rectangle rect = new Rectangle(3, 1, 20, 20);
        Rectangle rect2 = new Rectangle(4, 2, 18, 18);
        SolidBrush b = new SolidBrush(Color.FromArgb(49, 106, 197));
        SolidBrush b2 = new SolidBrush(Color.Orange);

        e.Graphics.FillRectangle(b, rect);
        e.Graphics.FillRectangle(b2, rect2);
        e.Graphics.DrawImage(e.Image, new Point(5, 3));
    }
}
</code>```

OwnerDisplayName: Matt

Body:
Wow, i stumped SO!  Now i know i must be working on some serious code.

Anyway, the answer is: implement your own ToolStripRenderer by creating a class that inherits from ToolStripSystemRenderer.

Override the methods that draw the items with your own code.  Here's what i was looking for specifically that draws the checked item.  It draws a check if there's no image for the ToolStripMenuItem.

protected override void OnRenderItemCheck(ToolStripItemImageRenderEventArgs e)
{
    base.OnRenderItemCheck(e);
    if (e.Item.Selected)
    {
        Rectangle rect = new Rectangle(3, 1, 20, 20);
        Rectangle rect2 = new Rectangle(4, 2, 18, 18);
        SolidBrush b = new SolidBrush(Color.FromArgb(49, 106, 197));
        SolidBrush b2 = new SolidBrush(Color.Orange);

        e.Graphics.FillRectangle(b, rect);
        e.Graphics.FillRectangle(b2, rect2);
        e.Graphics.DrawImage(e.Image, new Point(5, 3));
    }
    else
    {
        Rectangle rect = new Rectangle(3, 1, 20, 20);
        Rectangle rect2 = new Rectangle(4, 2, 18, 18);
        SolidBrush b = new SolidBrush(Color.FromArgb(49, 106, 197));
        SolidBrush b2 = new SolidBrush(Color.Orange);

        e.Graphics.FillRectangle(b, rect);
        e.Graphics.FillRectangle(b2, rect2);
        e.Graphics.DrawImage(e.Image, new Point(5, 3));
    }
}


问:
Finger swipe in Android application
I have created an application where in I have a page which contains for text and one 'Next' button and one 'Previous' button. Clicking 'Next' button, page shows some next text that is being takes from a list which contains a list of String text. 'Previous' button shows the last visited text.

It is working fine. But now I want to implement something new where swipe of finger by user would take to the next text or previous. Finger swipe as used while accepting a call.

答:
You are looking for gesture detectors. And you can find it here.

http://android-journey.blogspot.com/2010/01/android-gestures.html

http://coderzheaven.com/2011/03/using-gestures-in-androida-simple-example/

```<code>    @Override
    public boolean onTouchEvent(MotionEvent me) {
        return gestureScanner.onTouchEvent(me);
    }

    public boolean onDown(MotionEvent e) {
        viewA.setText("-" + "DOWN" + "-");
        return true;
    }

    public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
        viewA.setText("-" + "FLING" + "-");
        return true;
    }

    public void onLongPress(MotionEvent e) {
        viewA.setText("-" + "LONG PRESS" + "-");
    }

    public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
        viewA.setText("-" + "SCROLL" + "-");
        return true;
    }

    public void onShowPress(MotionEvent e) {
        viewA.setText("-" + "SHOW PRESS" + "-");
    }

    public boolean onSingleTapUp(MotionEvent e) {
        viewA.setText("-" + "SINGLE TAP UP" + "-");
        return true;
    }
</code>```

ContentLicense: CC BY-SA 3.0

Title: Finger swipe in Android application

Body:
You are looking for gesture detectors. And you can find it here.

http://android-journey.blogspot.com/2010/01/android-gestures.html

http://coderzheaven.com/2011/03/using-gestures-in-androida-simple-example/

    @Override
    public boolean onTouchEvent(MotionEvent me) {
        return gestureScanner.onTouchEvent(me);
    }

    public boolean onDown(MotionEvent e) {
        viewA.setText("-" + "DOWN" + "-");
        return true;
    }

    public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
        viewA.setText("-" + "FLING" + "-");
        return true;
    }

    public void onLongPress(MotionEvent e) {
        viewA.setText("-" + "LONG PRESS" + "-");
    }

    public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
        viewA.setText("-" + "SCROLL" + "-");
        return true;
    }

    public void onShowPress(MotionEvent e) {
        viewA.setText("-" + "SHOW PRESS" + "-");
    }

    public boolean onSingleTapUp(MotionEvent e) {
        viewA.setText("-" + "SINGLE TAP UP" + "-");
        return true;
    }


问:
'Go To Definition' opens tab on right and doesn't keep open (implied), how to open as normal?
I'm using Visual Studio 2022 Community.

If I right click, say, a class name in some code and 'Go To Definition' it'll open the file's tab on the right instead of left (as it would if I double clicked the same file to open it).

On the tab is a button saying 'Keep Tab Open', implying it might be closed at any point automatically; though it never was.

How can I make 'Go To Definition' on a class just open the file as normal, on the left, like double clicking a file?

I've searched extensively and can't even find any references to what's going on.

Thx

答:
That feature is called a Preview Tab.  Only one Preview Tab can be open at a time, so the next action you take that would open a different one would close this one (hence the "Keep tab open" button).

You can find the settings for it in Tools -> Options -> Environment -> Tabs and Windows.


问:
C# non-nullable field: Lateinit?
I am wondering how to use late-initialized class fields in C# with nullable reference types.
Imagine the following class:

```<code>public class PdfCreator {

   private PdfDoc doc;

   public void Create(FileInfo outputFile) {
       doc = new PdfWriter(outputFile);
       Start();
   }

   public void Create(MemoryStream stream) {
       doc = new PdfWriter(stream);
       Start();
   }

   private void Start() {
      Method1();
      // ...
      MethodN();
   }

   private void Method1() {
      // Work with doc
   }

   // ...

   private void MethodN() {
      // Work with doc
   }
}
</code>```

The above code is very simplified. My real class uses many more fields like doc and also has some constructors with some arguments.

Using the above code, I get a compiler warning on the constructor, that doc is not initialized, which is correct. I could solve this by setting the type of doc to PdfDoc?, but then I have to use ?. or !. everywhere it is used, which is nasty.

I could also pass doc as a parameter to each method, but remember that I have some fields like this and this violates the clean code principle in my eyes.

I am looking for a way to tell the compiler, that I will initialize doc before using it (actually I do it, there is no possibility for the caller to get a null reference exception!). I think Kotlin has the lateinit modifier exactly for this purpose.

How would you solve this problem in "clean" C# code?

答:
It might not directly solve the OP's problem but as searching for 'late init' brought me here, I am going to post.

Although you can use the null! technique explained in other answers, if you initialize your non-null class members in the constructor not directly but through some helper methods, there is a more elegant way to declare this. You need to use MemberNotNull(nameof(Member)) attribute on your helper method.

```<code>public class TestClass
{
    private string name;

    public TestClass()
    {
        Initialize();
    }

    [MemberNotNull(nameof(name))]
    private void Initialize()
    {
        name = "Initialized";
    }
}
</code>```

This way, the compiler will no longer argue about non-nullable name not being set after exiting the constructor, as it knows calling Initialize ensures that the name field is initialized with a non-null value.

Title: C# non-nullable field: Lateinit?

Body:
I am wondering how to use late-initialized class fields in C# with nullable reference types.
Imagine the following class:

public class PdfCreator {

   private PdfDoc doc;

   public void Create(FileInfo outputFile) {
       doc = new PdfWriter(outputFile);
       Start();
   }

   public void Create(MemoryStream stream) {
       doc = new PdfWriter(stream);
       Start();
   }

   private void Start() {
      Method1();
      // ...
      MethodN();
   }

   private void Method1() {
      // Work with doc
   }

   // ...

   private void MethodN() {
      // Work with doc
   }
}

The above code is very simplified. My real class uses many more fields like doc and also has some constructors with some arguments.

Using the above code, I get a compiler warning on the constructor, that doc is not initialized, which is correct. I could solve this by setting the type of doc to PdfDoc?, but then I have to use ?. or !. everywhere it is used, which is nasty.

I could also pass doc as a parameter to each method, but remember that I have some fields like this and this violates the clean code principle in my eyes.

I am looking for a way to tell the compiler, that I will initialize doc before using it (actually I do it, there is no possibility for the caller to get a null reference exception!). I think Kotlin has the lateinit modifier exactly for this purpose.

How would you solve this problem in "clean" C# code?

Body:
It might not directly solve the OP's problem but as searching for 'late init' brought me here, I am going to post.

Although you can use the null! technique explained in other answers, if you initialize your non-null class members in the constructor not directly but through some helper methods, there is a more elegant way to declare this. You need to use MemberNotNull(nameof(Member)) attribute on your helper method.

public class TestClass
{
    private string name;

    public TestClass()
    {
        Initialize();
    }

    [MemberNotNull(nameof(name))]
    private void Initialize()
    {
        name = "Initialized";
    }
}

This way, the compiler will no longer argue about non-nullable name not being set after exiting the constructor, as it knows calling Initialize ensures that the name field is initialized with a non-null value.


问:
Spring JUnit5 test not loading resource values
I know there are a lot of questions regarding this, but all of them are suggesting to use @TestPropertySource and @EnableConfigurationProperties. I have already used them but still not working.

Config class - src/main/java/com/demo/config/AppConfig.java

```<code>@Configuration
@ConfigurationProperties(prefix = "api")
@Getter
@Setter
public class AppConfig {
   private List<String> providers;
   private boolean enabled;
}
</code>```

Property source - src/test/resources/application-test.yml

```<code>api:
  enabled: true
  providers:
    - prov1
    - prov2
</code>```

Test class - src/test/../MyTest.java

```<code>@ExtendWith(SpringExtension.class)
@ContextConfiguration(classes = MyTestConfiguration.class)
class MyTest {

    @Autowired
    private AppConfig appConfig;

    @Test
    void runTest() {//some code with breakpoint}
}
</code>```

Test configuraton - src/test/.../MyTestConfiguration.java

```<code>@TestConfiguration
@TestPropertySource(locations = "classpath:application-test.yml")
@EnableConfigurationProperties(value = AppConfig.class)
@ActiveProfiles("test")
public class MyTestConfiguration {
}
</code>```

When I run the test, runTest() and inspect autowired appConfig value, the providers are empty and enabled is false. That means the values in yml file were not loaded.
I found a similar kind of question, but without answer.

答:
I think you need to replace

@ExtendWith(SpringExtension.class)
@ContextConfiguration(classes = MyTestConfiguration.class)
```
<p>with</p>
<pre class="lang-java prettyprint-override"><code>@SpringBootTest(classes = {MyTestConfiguration.class})
</code>```

Then application-test.yml will be picked up automatically.

Body:
I know there are a lot of questions regarding this, but all of them are suggesting to use @TestPropertySource and @EnableConfigurationProperties. I have already used them but still not working.

Config class - src/main/java/com/demo/config/AppConfig.java

@Configuration
@ConfigurationProperties(prefix = "api")
@Getter
@Setter
public class AppConfig {
   private List<String> providers;
   private boolean enabled;
}

Property source - src/test/resources/application-test.yml

api:
  enabled: true
  providers:
    - prov1
    - prov2

Test class - src/test/../MyTest.java

@ExtendWith(SpringExtension.class)
@ContextConfiguration(classes = MyTestConfiguration.class)
class MyTest {

    @Autowired
    private AppConfig appConfig;

    @Test
    void runTest() {//some code with breakpoint}
}

Test configuraton - src/test/.../MyTestConfiguration.java

@TestConfiguration
@TestPropertySource(locations = "classpath:application-test.yml")
@EnableConfigurationProperties(value = AppConfig.class)
@ActiveProfiles("test")
public class MyTestConfiguration {
}

When I run the test, runTest() and inspect autowired appConfig value, the providers are empty and enabled is false. That means the values in yml file were not loaded.
I found a similar kind of question, but without answer.

Body:
I think you need to replace

@ExtendWith(SpringExtension.class)
@ContextConfiguration(classes = MyTestConfiguration.class)

with

@SpringBootTest(classes = {MyTestConfiguration.class})

Then application-test.yml will be picked up automatically.


答: Have a look at the GreenDroid project. It has a simple swipe view that can be easily customized. In particular, have a look at PagedView and examples on how to use it.

Title: Finger swipe in Android application

Body:
I have created an application where in I have a page which contains for text and one 'Next' button and one 'Previous' button. Clicking 'Next' button, page shows some next text that is being takes from a list which contains a list of String text. 'Previous' button shows the last visited text.

It is working fine. But now I want to implement something new where swipe of finger by user would take to the next text or previous. Finger swipe as used while accepting a call.


问:
rados list-inconsistent-obj gives "Operation not permitted" error
When "rados list-inconsistent-pg " returns several inconsistent pgs such as ["1.12","1.2c","1.2d","1.57"], "rados list-inconsistent-obj " gives "Unknown error (1) Operation not permitted".

What should I do to correct his error?

-- update:

"ceph health detail" returns:

```<code>HEALTH_ERR 8 scrub errors; Possible data damage: 4 pgs inconsistent
OSD_SCRUB_ERRORS 8 scrub errors
PG_DAMAGED Possible data damage: 4 pgs inconsistent
    pg 1.12 is active+clean+inconsistent, acting [2,1]
    pg 1.2c is active+clean+scrubbing+deep+inconsistent+repair, acting [2,1]
    pg 1.2d is active+clean+inconsistent, acting [2,0]
    pg 1.57 is active+clean+inconsistent, acting [1,2]
</code>```

答:
Looking at your  sudo ceph health detail, first thing is to get help of following general repair command:

ceph pg repair {pgid}

In your case it would be:

ceph pg repair 1.12

ceph pg repair 1.2c

ceph pg repair 1.2d

ceph pg repair 1.57

Also, please try to backup the PG copies you are repairing.

Limitations of Ceph repair:
My experience says that Ceph repair does not automatically repair placement groups when inconsistencies are found in them. For instance this also explains why repair will not automatically solve it. There are chances you have to manually diagnose like this.

Dig deeper:
In addition to it, I maintain following helpful notes for solving PG inconsistencies in my cluster:

PG inconsistent with empty inconsistent objects

How to recover from active+clean+inconsistent+failed_repair?

Scrub Error / How does ceph pg repair work?

PG show inconsistent active+clean+inconsistent

Body:
When "rados list-inconsistent-pg " returns several inconsistent pgs such as ["1.12","1.2c","1.2d","1.57"], "rados list-inconsistent-obj " gives "Unknown error (1) Operation not permitted".

What should I do to correct his error?

-- update:

"ceph health detail" returns:

HEALTH_ERR 8 scrub errors; Possible data damage: 4 pgs inconsistent
OSD_SCRUB_ERRORS 8 scrub errors
PG_DAMAGED Possible data damage: 4 pgs inconsistent
    pg 1.12 is active+clean+inconsistent, acting [2,1]
    pg 1.2c is active+clean+scrubbing+deep+inconsistent+repair, acting [2,1]
    pg 1.2d is active+clean+inconsistent, acting [2,0]
    pg 1.57 is active+clean+inconsistent, acting [1,2]


问:
Python get variables from AppleScript program
I have recently been working with AppleScript, and was wondering if there is a way to get variables from AppleScript, and use them in Python. For example, say I have an AppleScript program called test.scpt and it has the following code in it:

```<code>set var1 to "hello"
set var2 to "hi"
</code>```

In my python, I want to do something (like print) the values of those two variables:

```<code>print(var1)
print(var2)
</code>```

I looked at answers like this, however most of the ones I found at years old. Is there a newer/better way to do this, and if not, what is the best way?

EDIT:
I have also tried using osascript and os.system together, however I cannot store the output as a variable, as to the best of my knowledge osascript just runs the code, but cannot store variables.

答:
Options:

NSAppleScript

AppleScript-ObjC+PyObjC

Body:
I have recently been working with AppleScript, and was wondering if there is a way to get variables from AppleScript, and use them in Python. For example, say I have an AppleScript program called test.scpt and it has the following code in it:

set var1 to "hello"
set var2 to "hi"

In my python, I want to do something (like print) the values of those two variables:

print(var1)
print(var2)

I looked at answers like this, however most of the ones I found at years old. Is there a newer/better way to do this, and if not, what is the best way?

EDIT:
I have also tried using osascript and os.system together, however I cannot store the output as a variable, as to the best of my knowledge osascript just runs the code, but cannot store variables.


问:
How to set correct position of a NESTED draggable element
BACKGROUND:
I have a draggable that I drop inside a droppable cum draggable. On 'Drop',  the draggable becomes nested inside droppable. On 'out' (i.e. dragging the draggable outside the droppable) the draggable becomes un-nested - i.e. becomes nested to the body.

ISSUE:
The nesting and un-nesting of a draggable causes the position of the draggable snapping to a new position. This is because the css of the draggable contains the relative position to the previsous parent, and in the process of nesting to a new parent, this relative css is assumed to be with respect to the new parent.

EXAMPLE AND PROBLEM:
Example at http://jsfiddle.net/sandeepy02/CNtRX/2/
You can replicate the issue by

create objects 'Room' and 'Table'.

Move 'Room'.

Drop 'Table' into 'Room'.

The table is repositioned away from the mouse cursor. The reason this is happening is because the css for 'table' contains the position of table relative to main boundaryContainer. When i drop and nest  'table' into 'room', the same relative position is then applied relative to 'room', thus causing the sudden change in position of 'table'.

Infact when I drag out the 'table' then the position again snaps to a different psoition because the 'table' css now contains relative position to 'room' and appending 'table' back to 'boundaryContainer' causes the relative position to 'room' being assumed as relative position to 'boundaryContainer'.

Any help will be appreciated.

答:
i solved in this way

in jquery_ui.js i found _mouseDrag: part

```<code>this.helper[ 0 ].style.left = this.position.left - new_el_pos + "px";
this.helper[ 0 ].style.top = this.position.top - new_el_pos + "px";
</code>```

i've added new_el_pos variable, that equal to first position of an element, when elemen was created. so every time i drag - it corrects css of object.

no other solutions i've found at internet..

Body:
i solved in this way

in jquery_ui.js i found _mouseDrag: part

this.helper[ 0 ].style.left = this.position.left - new_el_pos + "px";
this.helper[ 0 ].style.top = this.position.top - new_el_pos + "px";

i've added new_el_pos variable, that equal to first position of an element, when elemen was created. so every time i drag - it corrects css of object.

no other solutions i've found at internet..


问:
Webapplication unable to run in IIS 7
We have a webapplication, made in ASP.NET 2.

This app runs without problems in IIS 6. When we upload it to an IIS 7 (Windows Server 2008 R2 Datacenter) it runs in IIS, but when we open the site in a browser we get this error:

```<code>Server Error
500 - Internal server error.
There is a problem with the resource you are looking for, and it cannot be displayed.
</code>```

答: The problem was that I nedded to add a feature to the server. After I added .NET Framework 3.5.1 Features it worked.

Title: Webapplication unable to run in IIS 7

Body:
We have a webapplication, made in ASP.NET 2.

This app runs without problems in IIS 6. When we upload it to an IIS 7 (Windows Server 2008 R2 Datacenter) it runs in IIS, but when we open the site in a browser we get this error:

Server Error
500 - Internal server error.
There is a problem with the resource you are looking for, and it cannot be displayed.


问:
How to connect to and access information on a NoSQL database using C++
I want my code to be able to connect to a wide-column store database like Cassandra or DynamoDB and read/write information to it.

I have been working on a project primarily written in C++ and was able to use a MySQL database simply by including mysql.h header file and using some functions defined in this file to connect to the database and perform queries. I'm not sure if this is even the right way, but it gets the job done.

However, my project requires data to be stored in such a way that an entity can have multiple values under a single attribute (eg. hobbies: {fishing, camping, coding} )and so, I've come to a realization that RDBMS is not efficient in this scenario and decided to shift to a wide-column store database. But, I am not able to find any sort of guildlines on how I can connect to Cassandra or DynamoDB and perform queries using C++.

答:
There's a full working example of a C++ app which shows how to connect to an Apache Cassandra database here -- Developing your app with the C++ driver. You can re-purpose/re-factor the app for your needs.

If it's your first time developing apps for Cassandra, there are free tutorials, code samples and other resources on datastax.com/dev for developers.

And in case you're interested, Stargate.io is an open-source data gateway which allows you to connect to a Cassandra DB using REST API, JSON/Document API or GraphQL API. Stargate allows you to code apps in your language of choice using APIs you're already familiar with and since it's open-source, it's free to use. Cheers!


问:
BigQuery on .NET Core - Error on insertion
I'm developing a Google Cloud Function with .NET Core 3.1, and I'm also using BigQuery Library on C#.

When I try to make a insertion like so:

```<code>BigQueryResults newResult = client.ExecuteQuery(
        @$"INSERT {table}
        (deal_id,
         deal_name,
         deal_amount,
         deal_deal_stage_name,
         deal_cf_tipos_de_operao,
         deal_cf_vidas,
         deal_cf_faturamento_estimativa,
         deal_cf_vigncia_mmaaaa,
         deal_cf_agenciamento,
         deal_cf_comisso_mensal,
         deal_cf_valor_por_vida,
         deal_cf_produto,
         deal_cf_benefcios,
         deal_closed_date,
         created_at,
         updated_at)

        VALUES(
            {newRequest.deal_id},
            '{newRequest.deal_name}',
            {Convert.ToInt32(newRequest.deal_amount)},
            '{newRequest.deal_deal_stage_name}',
            '{newRequest.deal_cf_tipos_de_operao}',
            {newRequest.deal_cf_vidas},
            {newRequest.deal_cf_faturamento_estimativa},
            '{newRequest.deal_cf_vigncia_mmaaaa}',
            {newRequest.deal_cf_agenciamento},
            {newRequest.deal_cf_comisso_mensal},
            {newRequest.deal_cf_valor_por_vida},
            '{newRequest.deal_cf_produto}',
            '{newRequest.deal_cf_benefcios}',
            '{newRequest.deal_closed_date}',
            '{newRequest.created_at}',
            '{newRequest.updated_at}')",
        null)
        .ThrowOnAnyError();
</code>```

But I get the following error:

```<code>The service bigquery has thrown an exception: Google.GoogleApiException: Google.Apis.Requests.RequestError
    Could not cast literal "01/01/0001 00:00:00" to type DATETIME at [27:37] [400]
    Errors [
        Message[Could not cast literal "01/01/0001 00:00:00" to type DATETIME at [27:37]]
        Location[q - parameter] Reason[invalidQuery] Domain[global]
    ]
</code>```

What I'm not understanding is that, the variables I use to store the date values are already of DateTime, like for example, newRequest.deal_closed_date. Maybe the format is wrong?

What can I do to solve this?

Thanks!

答:
Error occured because you are inserting data in string to a column with DATETIME data type in BigQuery.

Convert your data first from String to DateTime data type before inserting into BigQuery. You can do this by using the DateTime.Parse()  method:

```<code>DateTime dateTime = DateTime.Parse(dateTimeString);
</code>```

Body:
I'm developing a Google Cloud Function with .NET Core 3.1, and I'm also using BigQuery Library on C#.

When I try to make a insertion like so:

BigQueryResults newResult = client.ExecuteQuery(
        @$"INSERT {table}
        (deal_id,
         deal_name,
         deal_amount,
         deal_deal_stage_name,
         deal_cf_tipos_de_operao,
         deal_cf_vidas,
         deal_cf_faturamento_estimativa,
         deal_cf_vigncia_mmaaaa,
         deal_cf_agenciamento,
         deal_cf_comisso_mensal,
         deal_cf_valor_por_vida,
         deal_cf_produto,
         deal_cf_benefcios,
         deal_closed_date,
         created_at,
         updated_at)

        VALUES(
            {newRequest.deal_id},
            '{newRequest.deal_name}',
            {Convert.ToInt32(newRequest.deal_amount)},
            '{newRequest.deal_deal_stage_name}',
            '{newRequest.deal_cf_tipos_de_operao}',
            {newRequest.deal_cf_vidas},
            {newRequest.deal_cf_faturamento_estimativa},
            '{newRequest.deal_cf_vigncia_mmaaaa}',
            {newRequest.deal_cf_agenciamento},
            {newRequest.deal_cf_comisso_mensal},
            {newRequest.deal_cf_valor_por_vida},
            '{newRequest.deal_cf_produto}',
            '{newRequest.deal_cf_benefcios}',
            '{newRequest.deal_closed_date}',
            '{newRequest.created_at}',
            '{newRequest.updated_at}')",
        null)
        .ThrowOnAnyError();

But I get the following error:

The service bigquery has thrown an exception: Google.GoogleApiException: Google.Apis.Requests.RequestError
    Could not cast literal "01/01/0001 00:00:00" to type DATETIME at [27:37] [400]
    Errors [
        Message[Could not cast literal "01/01/0001 00:00:00" to type DATETIME at [27:37]]
        Location[q - parameter] Reason[invalidQuery] Domain[global]
    ]

What I'm not understanding is that, the variables I use to store the date values are already of DateTime, like for example, newRequest.deal_closed_date. Maybe the format is wrong?

What can I do to solve this?

Thanks!

Body:
Error occured because you are inserting data in string to a column with DATETIME data type in BigQuery.

Convert your data first from String to DateTime data type before inserting into BigQuery. You can do this by using the DateTime.Parse()  method:

DateTime dateTime = DateTime.Parse(dateTimeString);


问:
Change state of parent component in child component
I want to change a value in the parent component by changing the state in the child component which is passed by props.

// This is the parent component
const [showEdit, setShowEdit] = useState(false);
<EditApplicationSettings
  appSettings={appSettings}
  changeState={(showEdit) => setShowEdit(showEdit)}
/>

// This is the child component
export default function EditApplicationSettings({ appSettings, props }) {
  return (
    <button
      className="button-red"
      onClick={() => props.changeState(false)}
    >
      Cancel
    </button>
  );
}
```
<p>When I click on the button, that <strong>should change the state in parent</strong>, but instead, I get an <strong>error</strong>.</p>
```TypeError: Cannot read properties of undefined (reading 'changeState')
```

Where did I do wrong in passing the props?

答:
To solve this error

```<code>TypeError: Cannot read properties of undefined (reading 'changeState')
</code>```

then this line

```<code>export default function EditApplicationSettings({ appSettings, props }) {
</code>```

should be

```<code>export default function EditApplicationSettings({ appSettings, ...props }) {
                                                               ^^^
</code>```

You could read more at MDN doc for destructuring assignment

Body:
I want to change a value in the parent component by changing the state in the child component which is passed by props.

// This is the parent component
const [showEdit, setShowEdit] = useState(false);
<EditApplicationSettings
  appSettings={appSettings}
  changeState={(showEdit) => setShowEdit(showEdit)}
/>

// This is the child component
export default function EditApplicationSettings({ appSettings, props }) {
  return (
    <button
      className="button-red"
      onClick={() => props.changeState(false)}
    >
      Cancel
    </button>
  );
}

When I click on the button, that should change the state in parent, but instead, I get an error.

TypeError: Cannot read properties of undefined (reading 'changeState')

Where did I do wrong in passing the props?

Body:
To solve this error

TypeError: Cannot read properties of undefined (reading 'changeState')

then this line

export default function EditApplicationSettings({ appSettings, props }) {

should be

export default function EditApplicationSettings({ appSettings, ...props }) {
                                                               ^^^

You could read more at MDN doc for destructuring assignment


问:
Fastlane MapBox Framework Architecture arm64 Symbol
I'm trying to upload build through GitHub action and fastlane. I'm stuck in the MapBox framework. I'm using Github LFS to upload the Mapbox framework. But in the last I'm getting error given below please check.

ld: ignoring file /Users/runner/Library/Developer/Xcode/DerivedData/test-dplpvtipvtqvtobqpvumxtffttst/Build/Intermediates.noindex/ArchiveIntermediates/test/BuildProductsPath/Release-iphoneos/XCFrameworkIntermediates/MapboxCoreMaps/MapboxCoreMaps.framework/MapboxCoreMaps, building for iOS-arm64 but attempting to link with file built for unknown-unsupported file format ( 0x76 0x65 0x72 0x73 0x69 0x6F 0x6E 0x20 0x68 0x74 0x74 0x70 0x73 0x3A 0x2F 0x2F )

Error:-

❌ Undefined symbols for architecture arm64
Symbol: OBJC_CLASS$_MBMLayerPosition
Referenced from: objc-class-ref in Style.o
❌ ld: symbol(s) not found for architecture arm64
❌ clang: error: linker command failed with exit code 1 (use -v to see invocation)

▸ Linking FirebaseCoreDiagnostics
** ARCHIVE FAILED **

The following build commands failed:
Ld /Users/runner/Library/Developer/Xcode/DerivedData/test-dplpvtipvtqvtobqpvumxtffttst/Build/Intermediates.noindex/ArchiveIntermediates/test/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/MapboxMaps.framework/MapboxMaps normal (in target 'MapboxMaps' from project 'Pods')
(1 failure)
[10:59:06]: Exit status: 65

Question:- Can someone please explain to me how to solve this issue.

Can someone please explain to me How to get Progress?

Any help would be greatly appreciated.

Thanks in advance.

Github LFS

答:
Thank you so much @f4z3k4s. I updated my YML file with the Github Action LFS value set to true.

Here is the Updated YML file:-


Title: SVG is not displaying in the mobile

Body:
I have written an SVG code, it is working perfectly on the desktop, but not working on mobile devices. I also have referred to the previous SVG questions, but they are not helpful

<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="11565.35433070866" height="4006.2992125984247" viewBox="0 0 11565.35433070866 4006.2992125984247" overflow="hidden" id="svgcontent" style="">
   <g>
      <title>background</title>
      <rect fill="#FFF" id="canvas_background" stroke-width="0" height="4006.29921" width="11565.35433" y="0" x="0"></rect>
   </g>
   <g>
      <title>Layer 1</title>
      <image x="16.33879" y="5.77534" width="11532.67714" height="3994.74844" preserveAspectRatio="none" id="svg_2" orighref="path/to/img" templatesrc="path/to/img" xlink:href="path/to/img" origwidth="16626" origheight="5759" lock="true"></image>
      <g label="Age" max-char="2" isrequired="true" yscale="1" xscale="1" elembboxheight="2253.91772" elembboxwidth="1446.53174" shapeval="0" shapeid="0" lineheight="1" font-style="normal" font-weight="normal" text-anchor="start" fill="ee3b25" font-family="Gogono Cocoa Mochi" font-size="3000" text="3" type="text" id="svg_4">
         <path d="m7308.22719,2397.90878c100,33.33333 108.33333,158.33333 166.66667,241.66667c233.33333,50 316.66667,-216.66667 141.66667,-308.33333c-141.66667,-8.33333 -275,-41.66667 -391.66667,-83.33333c-50,-116.66667 -66.66667,-225 -41.66667,-325c116.66667,-50 241.66667,-83.33333 375,-91.66667c108.33333,-100 116.66667,-250 58.33333,-383.33333c-66.66667,-58.33333 -225,-41.66667 -191.66667,66.66667c100,308.33333 -458.33333,375 -566.66667,116.66667c-300,-700 825,-1008.33333 1233.33333,-475c108.33333,141.66667 183.33333,333.33333 150,583.33333c-16.66667,125 -133.33333,250 -316.66667,375c208.33333,83.33333 358.33333,241.66667 325,541.66667c-50,500 -875,625 -1266.66667,316.66667c-108.33333,-158.33333 -225,-341.66667 -133.33333,-541.66667c58.33333,-16.66667 208.33333,-33.33333 458.33333,-33.33333c0,0 0,0 0,0" stroke-width="0" fill="#ee3b25" id="svg_5"></path>
         <rect opacity="0" fill="#ee3b25" height="2253.91748" width="1446.53125" y="886.26029" x="6808.00671" id="svg_6"></rect>
      </g>
   </g>
</svg>

Body:
It is actually displaying but to to your pretty large width and height values, you will need to scroll for some minutes ...

Just remove them and make sure your svg has an appropriate width like 100% (default)

<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 11565.35433070866 4006.2992125984247" overflow="hidden" id="svgcontent" style="">
   <g>
      <title>background</title>
      <rect fill="#FFF" id="canvas_background" stroke-width="0" height="4006.29921" width="11565.35433" y="0" x="0"></rect>
   </g>
   <g>
      <title>Layer 1</title>
      <image x="16.33879" y="5.77534" width="11532.67714" height="3994.74844" preserveAspectRatio="none" id="svg_2" orighref="path/to/img" templatesrc="path/to/img" xlink:href="path/to/img" origwidth="16626" origheight="5759" lock="true"></image>
      <g label="Age" max-char="2" isrequired="true" yscale="1" xscale="1" elembboxheight="2253.91772" elembboxwidth="1446.53174" shapeval="0" shapeid="0" lineheight="1" font-style="normal" font-weight="normal" text-anchor="start" fill="ee3b25" font-family="Gogono Cocoa Mochi" font-size="3000" text="3" type="text" id="svg_4">
         <path d="m7308.22719,2397.90878c100,33.33333 108.33333,158.33333 166.66667,241.66667c233.33333,50 316.66667,-216.66667 141.66667,-308.33333c-141.66667,-8.33333 -275,-41.66667 -391.66667,-83.33333c-50,-116.66667 -66.66667,-225 -41.66667,-325c116.66667,-50 241.66667,-83.33333 375,-91.66667c108.33333,-100 116.66667,-250 58.33333,-383.33333c-66.66667,-58.33333 -225,-41.66667 -191.66667,66.66667c100,308.33333 -458.33333,375 -566.66667,116.66667c-300,-700 825,-1008.33333 1233.33333,-475c108.33333,141.66667 183.33333,333.33333 150,583.33333c-16.66667,125 -133.33333,250 -316.66667,375c208.33333,83.33333 358.33333,241.66667 325,541.66667c-50,500 -875,625 -1266.66667,316.66667c-108.33333,-158.33333 -225,-341.66667 -133.33333,-541.66667c58.33333,-16.66667 208.33333,-33.33333 458.33333,-33.33333c0,0 0,0 0,0" stroke-width="0" fill="#ee3b25" id="svg_5"></path>
         <rect opacity="0" fill="#ee3b25" height="2253.91748" width="1446.53125" y="886.26029" x="6808.00671" id="svg_6"></rect>
      </g>
   </g>
</svg>

SVG limits for coordinates

You should also consider to round the coordinates number precision to avoid issues. Still OK in your example, but your drawing app or source seems to produce rather large numbers.

The Limits of Numbers in SVG

Edit: issue with image element:

Try to rewrite you image element like this:

  <image  width="100%" height="100%" preserveAspectRatio="none" id="svg_2" orighref="path/to/img" templatesrc="path/to/img" href="https://picsum.photos/200/300" origwidth="16626" origheight="5759" lock="true" />

<image> is no self contained – so there is no closing </image> tag.

I also replace the deprecated xlink:href with href


问:
Elegant Numpy ways to implement this matrix operation
I'm looking to vectorize the following equation:

Where x represents an N x T list of observations, and gamma is an N x K matrix. The intended output, theta, is a K x T matrix. Of course, I have a naive implementation that works by just looping through the elements and setting the array manually, but I just know there's a much cleaner solution lurking out here somewhere.

Below is my naive implementation, however it is much too slow for my purposes.

    theta = np.zeros((K, T))
    for k in range(K):
        numerator = np.zeros((T,))
        denominator = 0
        for i in range(N):
            gamma_ik = r[i,k]
            numerator = numerator + gamma_ik * x[i]
            denominator = denominator + gamma_ik
        theta[k] = numerator / denominator
```

答:
The other answers are both correct. I just wanted to add that we could also sum on axis and keepdims to keep the sum as a column vector.

Reusing @ramzeek's input (note that gamma is already transposed from construction in their example; here I use the original dimension):

```<code>N = 2
T = 3
K = 4

X = np.cumsum(np.ones((N,T)), axis = 0)
gamma = np.cumsum(np.ones((N,K)), axis = 0)
</code>```

where X is an NxT matrix and gamma is an NxK matrix. Then np.matmul(gamma.T, X) creates the numerator (of dimension (NxK)' x (NxT) = KxT ) and gamma.T.sum(axis=1, keepdims=True) creates the denominator (of dimension sum^N(NxK)' = Kx1 ).

You can also use np.divide to element-wise divide as well:

```<code>theta = np.divide(np.matmul(gamma.T, X), gamma.T.sum(axis=1, keepdims=True))
</code>```

then theta's dimension: (KxT / Kx1 = KxT)

Output:

```<code>array([[1.66666667, 1.66666667, 1.66666667],
       [1.66666667, 1.66666667, 1.66666667],
       [1.66666667, 1.66666667, 1.66666667],
       [1.66666667, 1.66666667, 1.66666667]])
</code>```

Body:
The other answers are both correct. I just wanted to add that we could also sum on axis and keepdims to keep the sum as a column vector.

Reusing @ramzeek's input (note that gamma is already transposed from construction in their example; here I use the original dimension):

N = 2
T = 3
K = 4

X = np.cumsum(np.ones((N,T)), axis = 0)
gamma = np.cumsum(np.ones((N,K)), axis = 0)

where X is an NxT matrix and gamma is an NxK matrix. Then np.matmul(gamma.T, X) creates the numerator (of dimension (NxK)' x (NxT) = KxT ) and gamma.T.sum(axis=1, keepdims=True) creates the denominator (of dimension sum^N(NxK)' = Kx1 ).

You can also use np.divide to element-wise divide as well:

theta = np.divide(np.matmul(gamma.T, X), gamma.T.sum(axis=1, keepdims=True))

then theta's dimension: (KxT / Kx1 = KxT)

Output:

array([[1.66666667, 1.66666667, 1.66666667],
       [1.66666667, 1.66666667, 1.66666667],
       [1.66666667, 1.66666667, 1.66666667],
       [1.66666667, 1.66666667, 1.66666667]])


答:
In React terms props tends to refer to the entire property object:

```<code>EditApplicationSettings(props)
</code>```

But since you're destructuring the properties from the object you need to reference the changeState property explicitly:

```<code>EditApplicationSettings({ appSettings, changeState })
</code>```

and

```<code>onClick={() => changeState(false)}
</code>```

Title: Change state of parent component in child component

Body:
In React terms props tends to refer to the entire property object:

EditApplicationSettings(props)

But since you're destructuring the properties from the object you need to reference the changeState property explicitly:

EditApplicationSettings({ appSettings, changeState })

and

onClick={() => changeState(false)}