instruction
stringlengths
0
30k
Why 2nd layer of image attached to 1st in Gimp?
|gimp|
null
When I open the "recently opened file" tab in MS word, I see that each file is marked with a green check: [![enter image description here][1]][1] The green check sign is usually used to indicate a file is uploaded and synced with cloud. But I never turned on any cloud sync, my onedrive app is not logined in. [![enter image description here][2]][2] Does it mean MS-word secrectly upload my doc anywhere? [1]: https://i.stack.imgur.com/kQsyc.png [2]: https://i.stack.imgur.com/TnThD.png
Does MS Word secretly upload my file to cloud?
|ms-word|cloud|
{"Voters":[{"Id":21137419,"DisplayName":"Hang"}],"DeleteType":1}
{"Voters":[{"Id":21137419,"DisplayName":"Hang"}]}
{"Voters":[{"Id":21137419,"DisplayName":"Hang"}],"DeleteType":1}
{"Voters":[{"Id":16217248,"DisplayName":"CPlus"},{"Id":1974224,"DisplayName":"Cristik"},{"Id":18157,"DisplayName":"Jim Garrison"}]}
I am using Python 3.10.5 and Rasa 3.6.19 in env. When I execute: ``` rasa init ``` this error occurred: >Deprecated API features detected! These feature(s) are not compatible with SQLAlchemy 2.0. To prevent incompatible upgrades prior to updating applications, ensure requirements files are pinned to "sqlalchemy<2.0". Set environment variable SQLALCHEMY_WARN_20=1 to show all deprecation warnings. Set environment variable SQLALCHEMY_SILENCE_UBER_WARNING=1 to silence this message. (Background on SQLAlchemy 2.0 at: https://sqlalche.me/e/b8d9) Base: DeclarativeMeta = declarative_base() /mnt/837a55f3-96e7-4e14-8bba-9d93475fb8ae/PYTHON/Maia_2/maia_2_env/lib/python3.10/site-packages/rasa/shared/utils/validation.py:134: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html import pkg_resources /mnt/837a55f3-96e7-4e14-8bba-9d93475fb8ae/PYTHON/Maia_2/maia_2_env/lib/python3.10/site-packages/pkg_resources/__init__.py:2868: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('google')`. Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages declare_namespace(pkg) /mnt/837a55f3-96e7-4e14-8bba-9d93475fb8ae/PYTHON/Maia_2/maia_2_env/lib/python3.10/site-packages/pkg_resources/__init__.py:2868: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('mpl_toolkits')`. Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages declare_namespace(pkg) /mnt/837a55f3-96e7-4e14-8bba-9d93475fb8ae/PYTHON/Maia_2/maia_2_env/lib/python3.10/site-packages/pkg_resources/__init__.py:2868: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('ruamel')`. Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages declare_namespace(pkg) Welcome to Rasa! > >To get started quickly, an initial project will be created. If you need some help, check out the documentation at https://rasa.com/docs/rasa. Now let's start! > >? Please enter a path where the project will be created [default: current directory] ? Directory '/mnt/837a55f3-96e7-4e14-8bba-9d93475fb8ae/PYTHON/rasachatbot' is not empty. Continue? Yes 2024-03-20 14:45:47 INFO root - copying /mnt/837a55f3-96e7-4e14-8bba-9d93475fb8ae/PYTHON/Maia_2/maia_2_env/lib/python3.10/site-packages/rasa/cli/initial_project/actions/actions.py -> ./actions 2024-03-20 14:45:47 INFO root - copying /mnt/837a55f3-96e7-4e14-8bba-9d93475fb8ae/PYTHON/Maia_2/maia_2_env/lib/python3.10/site-packages/rasa/cli/initial_project/actions/__pycache__/__init__.cpython-310.pyc -> ./actions/__pycache__ 2024-03-20 14:45:47 INFO root - copying /mnt/837a55f3-96e7-4e14-8bba-9d93475fb8ae/PYTHON/Maia_2/maia_2_env/lib/python3.10/site-packages/rasa/cli/initial_project/actions/__pycache__/actions.cpython-310.pyc -> ./actions/__pycache__ 2024-03-20 14:45:47 INFO root - copying /mnt/837a55f3-96e7-4e14-8bba-9d93475fb8ae/PYTHON/Maia_2/maia_2_env/lib/python3.10/site-packages/rasa/cli/initial_project/actions/__init__.py -> ./actions 2024-03-20 14:45:47 INFO root - copying /mnt/837a55f3-96e7-4e14-8bba-9d93475fb8ae/PYTHON/Maia_2/maia_2_env/lib/python3.10/site-packages/rasa/cli/initial_project/endpoints.yml -> . 2024-03-20 14:45:47 INFO root - copying /mnt/837a55f3-96e7-4e14-8bba-9d93475fb8ae/PYTHON/Maia_2/maia_2_env/lib/python3.10/site-packages/rasa/cli/initial_project/credentials.yml -> . 2024-03-20 14:45:47 INFO root - copying /mnt/837a55f3-96e7-4e14-8bba-9d93475fb8ae/PYTHON/Maia_2/maia_2_env/lib/python3.10/site-packages/rasa/cli/initial_project/tests/test_stories.yml -> ./tests 2024-03-20 14:45:47 INFO root - copying /mnt/837a55f3-96e7-4e14-8bba-9d93475fb8ae/PYTHON/Maia_2/maia_2_env/lib/python3.10/site-packages/rasa/cli/initial_project/data/rules.yml -> ./data 2024-03-20 14:45:47 INFO root - copying /mnt/837a55f3-96e7-4e14-8bba-9d93475fb8ae/PYTHON/Maia_2/maia_2_env/lib/python3.10/site-packages/rasa/cli/initial_project/data/stories.yml -> ./data 2024-03-20 14:45:47 INFO root - copying /mnt/837a55f3-96e7-4e14-8bba-9d93475fb8ae/PYTHON/Maia_2/maia_2_env/lib/python3.10/site-packages/rasa/cli/initial_project/data/nlu.yml -> ./data 2024-03-20 14:45:47 INFO root - copying /mnt/837a55f3-96e7-4e14-8bba-9d93475fb8ae/PYTHON/Maia_2/maia_2_env/lib/python3.10/site-packages/rasa/cli/initial_project/domain.yml -> . 2024-03-20 14:45:47 INFO root - copying /mnt/837a55f3-96e7-4e14-8bba-9d93475fb8ae/PYTHON/Maia_2/maia_2_env/lib/python3.10/site-packages/rasa/cli/initial_project/config.yml -> . Created project directory at '/mnt/837a55f3-96e7-4e14-8bba-9d93475fb8ae/PYTHON/rasachatbot'. Finished creating project structure. ? ? Do you want to train an initial model? Yes Training an initial model... Illegal instruction (core dumped) and a model is not generated. It happens every time I try to upgrade my package using pip, but nothing works. I expected to have default train model, as mention in Rasa manual, which I can then train later.
{"Voters":[{"Id":16217248,"DisplayName":"CPlus"},{"Id":1974224,"DisplayName":"Cristik"},{"Id":18157,"DisplayName":"Jim Garrison"}]}
I got into the exact same issue And solve it just upgrading the version of "next-auth" to "next-auth@beta"
I have two databases, the first for user names and their data, and the other database is for training, and I did not find a way to link the trainee from the training table and the users table in the first database for users. Two Contexts were used, but I did not find the solution. `CentralBase` db context: public partial class CentralBase : DbContext { public CentralBase() { } public CentralBase(DbContextOptions<CentralBase> options) : base(options) { } public virtual DbSet<AspNetUser> AspNetUsers { get; set; } protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) #warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see https://go.microsoft.com/fwlink/?LinkId=723263. => optionsBuilder.UseSqlServer("data source =.\\SQLEXPRESS;initial catalog=CentralBase;integrated security=SSPI;TrustServerCertificate=True"); protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.Entity<AspNetUser>(entity => { entity.ToTable("AspNetUser"); entity.HasKey(e => e.Id); }); OnModelCreatingPartial(modelBuilder); } partial void OnModelCreatingPartial(ModelBuilder modelBuilder); } `Training` db context: public partial class Training : DbContext { public Training() { } public Training(DbContextOptions<Training> options) : base(options) { } public virtual DbSet<TrainingPrograme> TrainingPrograme { get; set; } protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) #warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see https://go.microsoft.com/fwlink/?LinkId=723263. => optionsBuilder.UseSqlServer("data source =.\\SQLEXPRESS;initial catalog=Training;integrated security=SSPI;TrustServerCertificate=True"); protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.Entity<TrainingPrograme>(entity => { entity.ToTable("TrainingPrograme"); entity.HasOne(p => p.AspNetUser) .WithMany(u => u.TrainingPrograme) .HasForeignKey(p => p.IdUserTraining); }); OnModelCreatingPartial(modelBuilder); } partial void OnModelCreatingPartial(ModelBuilder modelBuilder); } Table `AspNetUser` : public partial class AspNetUser { [Key] public string Id { get; set; } = null!; public string? UserName { get; set; } public virtual ICollection<EduQ2024.Areas.Train.Data.TableTraining.TrainingPrograme> TrainingPrograme { get; set; } = new List<EduQ2024.Areas.Train.Data.TableTraining.TrainingPrograme>(); } Table `TrainingPrograme`: public partial class TrainingPrograme { public int Id { get; set; } public string? IdUserTraining { get; set; } public EduQ2024.data.TableCentral.AspNetUser AspNetUser { get; set; } } Test code Data.DbTraining.Training Cn = new Data.DbTraining.Training(); var f = Cn.TrainingPrograme.ToList(); var g = f.Where(L => L.AspNetUser != null).ToList();. Result: AspNetUser = null
|c#|entity-framework-core|
Use below procedure. 1. Give your elements unique ids. Like ```html <div id="tab1"></div> <div id="tab2"></div> <div id="tab3"></div> <div id="tab4"></div> ``` 2. Give your urls tab id, that you need to focus ```python url_path#tab2 ``` 3. Use js to focus tab with id from url ```javascript document.getElementById(window.location.hash).click(); ```
`[root@workspace tmp]# ll total 8 -rw-------. 1 root root 6 Mar 31 13:18 * -rw-------. 1 root root 6 Mar 31 13:18 ? [root@workspace tmp]# for f in "`find . -type f`";do echo "$f";done ./* ./? [root@workspace tmp]# for f in "`find . -type f`";do echo $f;done ./* ./? ./* ./? ` I am confused about the output ... the differenct of the commands is: the double quote around the $f thanx any help in advance.
1. Return a pointer to the `Node` of interest instead of updating the out parameter `head_dest`. The stack will implicitly hold `cur_list_dest`. 1. The original implementation changes the original list. To create a new list you need to return a pointer to *copy* of the smallest node or NULL. To emphasize that I made the argument constant with `const Node *head`. 1. Finally, you can optimize the implementation of `pairWiseMinimumInNewList_Rec()` by observing that we return either a copy of the first or 2nd node or NULL (base case). The recursive call is either two nodes ahead or we are done: ``` #include <stdio.h> #include <stdlib.h> #include <string.h> typedef struct Node { int val; struct Node *pt_next; } Node; Node *linked_list_new(int val, Node *pt_next) { Node *n = malloc(sizeof *n); if(!n) { printf("malloc failed\n"); exit(1); } n->val = val; n->pt_next = pt_next; return n; } Node *linked_list_create(size_t n, int *vals) { Node *head = NULL; Node **cur = &head; for(size_t i=0; i < n; i++) { *cur = linked_list_new(vals[i], NULL); if(!head) head = *cur; cur = &(*cur)->pt_next; } return head; } void linked_list_print(Node *head) { for(; head; head=head->pt_next) printf("%d->", head->val); printf("NULL\n"); } void linked_list_free(Node *head) { while(head) { Node *tmp = head->pt_next; free(head); head=tmp; } } Node *pairWiseMinimumInNewList_Rec(const Node* head) { if(!head) return NULL; return linked_list_new( (head->pt_next && head->val < head->pt_next->val) || (!head->pt_next) ? head->val : head->pt_next->val, pairWiseMinimumInNewList_Rec(head->pt_next ? head->pt_next->pt_next : NULL) ); } int main() { Node *head=linked_list_create(7, (int []) {2,1,3,4,5,6,7}); Node* head_dest=pairWiseMinimumInNewList_Rec(head); linked_list_free(head); linked_list_print(head_dest); linked_list_free(head_dest); } ``` Example run that exercises the 3 code paths: ``` 1->3->5->7->NULL ```
|python-3.x|pandas|
I'm currently working on a VHDL project involving a finite state machine (FSM) that transitions through three states (STATE_0, STATE_1, and STATE_2) based on an external signal T. Each state should wait for a certain number of pulses from T before transitioning to the next state. The behavior I'm expecting is as follows: When in STATE_0, the FSM should transition to STATE_1 after receiving 2 pulses from T. When in STATE_1, it should transition to STATE_2 after receiving 4 pulses. When in STATE_2, it should transition back to STATE_0 after receiving 6 pulses. However, my FSM implementation doesn't seem to be behaving correctly. It's not transitioning states as expected, and I suspect there might be issues with how I'm handling the counter and state transitions. I've provided the VHDL code below, along with a waveform file from my simulation (used Quartus II 9.0 web edition). The code compiles correctly. Take into account I am a complete beginner in VHDL and this is my first question in Stack Overflow, so any feedback on how to better the way I ask questions will be highly appreciated. ```vhdl library IEEE; use IEEE.STD_LOGIC_1164.ALL; entity STLC is Port ( clk, T : in STD_LOGIC; state_out : out STD_LOGIC_VECTOR(1 downto 0) ); end entity STLC; architecture Behavioral of STLC is type state_type is (STATE_0, STATE_1, STATE_2); signal current_state, next_state : state_type; signal counter : integer range 0 to 63 := 0; -- Inner counter to track state durations signal B : integer range 0 to 63 := 0; begin state_transition_process: process(current_state, counter) begin case current_state is when STATE_0 => if counter - B > 2 then next_state <= STATE_1; B <= counter; -- Reset counter else next_state <= STATE_0; end if; when STATE_1 => if counter - B > 4 then next_state <= STATE_2; B <= counter; -- Reset counter else next_state <= STATE_1; end if; when STATE_2 => if counter - B > 6 then next_state <= STATE_0; B <= counter; -- Reset counter else next_state <= STATE_2; end if; when others => next_state <= STATE_0; end case; end process; -- Output logic output_logic: process (current_state) begin case current_state is when STATE_0 => state_out <= "00"; when STATE_1 => state_out <= "01"; when STATE_2 => state_out <= "10"; when others => state_out <= "00"; -- Default state end case; end process output_logic; -- State flip-flop state_ff: process (clk) begin if clk'event and clk='1' then current_state <= next_state; if T='1' then counter <= counter + 1; -- Increment counter on T signal activation end if; end if; end process state_ff; end architecture Behavioral; ``` [Updated simulation after adding B to sensitivity list][1] Could someone please review my code and provide guidance on what might be causing this issue? Any help would be greatly appreciated. Thank you! I've implemented a finite state machine in VHDL, specifying the transitions between states based on the number of pulses received from the external signal T. I've coded the logic for each state transition and initialized counters to track the number of pulses. However, despite my efforts, the FSM isn't transitioning states as expected. I expected the FSM to transition from STATE_0 to STATE_1 after 2 pulses, from STATE_1 to STATE_2 after 4 pulses, and from STATE_2 back to STATE_0 after 6 pulses. [1]: https://i.stack.imgur.com/TCTN8.png
If you need the main `ScrollView` or `List` to display another horizontal list or lists there is very good trick to make the performance perfect, just wrap each of your horizontal collections with `Section` like this: ``` Section { //horizontal collection here } ```
I'm encountering an issue in my Vue application where the use of functional components within a table leads to entire re-renders of all cells when any cell's value changes, triggering a backend request and subsequently updating a list of cells based on the response. However, when I switch to using stateful template components for these cells, only the affected cell re-renders upon update. Environment: - Vue 2.7, Webpack 5.11 Problem Detail: My table component renders each cell as a separate component. The table includes column aggregators, and cell value changes initiate a backend request. The response dictates which cells to update. Using functional components for these cells results in the entire table re-rendering, but switching to standard stateful template components limits the re-render to only the changed cell. ``` // table.vue <tr v-for="row in cells" :key="row[0].id"> <TableCellHeader /> <TableCell v-for="(cell, idx) in row.slice(1)" :key="row[0].data.id+'_'+idx" :cell="cell" :col-index="idx+1" :row-id="row[0].id" :disable="isDisabled(row[0], cell, idx+1)" @saved="save" /> </tr> ``` ``` // tableCell.vue <script> import Stack from '@ej/components/stack'; import { updateValue } from '@ej/spo/api'; import dompurify from 'dompurify'; export default { functional: true, props: { cell: { type: Object, required: true, }, disable: { type: Boolean, default: false, }, rowId: { type: Number, required: true, }, }, render(h, { props, $style, listeners }) { let element; // some other class like validation before request let setClass = (className) => { if (!element) return; let classNames = ['error', 'saved', 'saving']; classNames.forEach((name) => { element.classList.remove(name); }); if (!className) return; element.classList.add(className); }; let save = (updatedValue, cell, rowId) => { // post to server updateValue(updatedValue) .then((result) => { setClass('saved'); setTimeout(() => { setClass(''); }, 3000); listeners.saved?.(result); }) .catch(e => { setClass('error'); }); }; let onFocusOut = (event) => { element = event.target.closest('td'); let updatedValue = event.target.innerText.trim(); setClass('saving'); event.target.innerHTML = dompurify.sanitize(updatedValue); save(updatedValue, props.cell, props.rowId); }; return h('td', { class: [$style.cell, 'spo-table-cell'], attrs: { 'data-disabled': props.disable, }, }, [ h(Stack, { props: { verticalAlign: 'center', fill: true, }, }, [ h('div', { attrs: { contenteditable: !props.disable, }, class: $style.content, on: { blur: onFocusOut, }, domProps: { innerHTML: props.cell.value || '', }, }), ]), ]); }, }; </script> <style lang="less" module> // some styles </style> ``` [The first is render and second is re-render after cell update](https://i.stack.imgur.com/Kww5U.png) [Performance of update. Function createFunctionalComponent has been called 802 times](https://i.stack.imgur.com/MJtFi.png) What could be causing this discrepancy in re-render behavior between functional components and stateful components in Vue? How can I ensure that only the updated cells re-render in the table when using functional components, similar to the behavior observed with stateful template components?
I have a circle that follows my curser and I also made it expand when I hover over any text. The problem is when I try to add a `transition: 2s;` to the CSS to make it expand smoothly. it ruins my JavaScript animation so I was wondering if I could add only a transition time to when the the circle expands. <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-js --> document.addEventListener('DOMContentLoaded', () => { const interBubble = document.getElementById('circle'); let curX = 0; let curY = 0; let tgX = 0; let tgY = 0; function move() { curX += (tgX - curX) / 10; curY += (tgY - curY) / 10; interBubble.style.transform = `translate(${Math.round(curX)}px, ${Math.round(curY)}px)`; requestAnimationFrame(() => { move(); }); } window.addEventListener('mousemove', (e) => { tgX = e.clientX; tgY = e.clientY; if (e.target.tagName === 'P' || e.target.tagName === 'BUTTON' || e.target.parentNode.tagName === 'BUTTON') { interBubble.classList.add('big'); } else { interBubble.classList.remove('big'); } }); move(); }); <!-- language: lang-css --> .mouseFollowCircle { width: 50px; height: 50px; border: 3px solid white; border-radius: 999px; position: absolute; z-index: 999; top: -25px; left: -25px; box-shadow: 0 0 10px white; pointer-events: none; backdrop-filter: blur(2px); } .mouseFollowCircle.big { width: 70px; height: 70px; border-radius: 999px; border: 1px solid white; position: absolute; z-index: 999; top: -35px; left: -35px; box-shadow: 0 0 10px white; pointer-events: none; backdrop-filter: blur(2px); } <!-- language: lang-html --> <section class="mouseFollowCircle" id="circle"></section> <!-- end snippet -->
|javascript|css|css-animations|css-transitions|
null
I have a circle that follows my curser and I also made it expand when I hover over any text. The problem is when I try to add a `transition: 2s;` to the CSS to make it expand smoothly. When I add it it ruins my JavaScript animation so I was wondering if I could add only a transition time to when the the circle expands. I also tired to add the `transition: 2s;` to just the `.mouseFollowCircle.big` class but it causes the same problems to the JavaScript only when I'm hovering over text <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-js --> document.addEventListener('DOMContentLoaded', () => { const interBubble = document.getElementById('circle'); let curX = 0; let curY = 0; let tgX = 0; let tgY = 0; function move() { curX += (tgX - curX) / 10; curY += (tgY - curY) / 10; interBubble.style.transform = `translate(${Math.round(curX)}px, ${Math.round(curY)}px)`; requestAnimationFrame(() => { move(); }); } window.addEventListener('mousemove', (e) => { tgX = e.clientX; tgY = e.clientY; if (e.target.tagName === 'P' || e.target.tagName === 'A' || e.target.tagName === 'BUTTON' || e.target.parentNode.tagName === 'BUTTON') { interBubble.classList.add('big'); } else { interBubble.classList.remove('big'); } }); move(); }); <!-- language: lang-css --> Body { background-color: black; overflow: hidden; } div { width: 100%; height: 100vh; display: flex; justify-content: center; align-items: center; } p { color: white; font-size: 30px; } .mouseFollowCircle { width: 50px; height: 50px; border: 3px solid white; border-radius: 999px; position: absolute; z-index: 999; top: -25px; left: -25px; box-shadow: 0 0 10px white; pointer-events: none; backdrop-filter: blur(2px); } .mouseFollowCircle.big { width: 70px; height: 70px; border-radius: 999px; border: 1px solid white; position: absolute; z-index: 999; top: -35px; left: -35px; box-shadow: 0 0 10px white; pointer-events: none; backdrop-filter: blur(2px); } <!-- language: lang-html --> <div><p>Hello</p></div> <section class="mouseFollowCircle" id="circle"></section> <!-- end snippet -->
Can't import LlamaParse
|python|docker|llama-index|
I'm trying to understand the differences between the `mov` and `lea` instructions in x86 assembly language. I've written a simple assembly code snippet , and I've added comments to explain my understanding of these instructions. ```x86asm .data num: .int 2 # Declare an integer variable num with value 2 .text .globl _start _start: movl num, %eax # num stores an address, take the value inside that address into eax movl $num, %ebx # num stores an address, $ tells us to take the address itself into ebx leal num, %ecx # num stores an address, take the address itself into ecx (lea) #initialize movl $0, %eax movl $0, %ebx movl $0, %ecx movl $num, %edx # num stores an address, take the address itself into edx movl %edx, %eax # edx is an address, take the value inside that address into eax leal (%edx), %ecx # () tells us to go to the address inside edx, take the address itself into ecx (lea) movl (%edx), %ebx # () tells us to go to the address inside edx, take the value inside that address into ebx # Exit movl $1, %eax # System call number for exit xorl %ebx, %ebx # Exit status 0 int $0x80 # Invoke the syscall ``` However, I'm a bit confused about how these instructions work with registers. and I'll be glad if someone will give me his explanation.
null
I am a beginner trying to build very simple inventory system using PHP + SQL I have 2 warehouse. I added 2 tables, 1 for each warehouse contains (item id)-(in)- (out) like shown below table1 | item id | in | out | | -------- | -- |-----| | item1 | 10 | 0 | | item1 | 5 | 0 | | item2 | 0 | 3 | | item2 | 0 | 2 | table2 | item id | in | out | | -------- | -- |-----| | item1 | 12 | 0 | | item1 | 50 | 0 | | item2 | 0 | 10 | | item2 | 0 | 30 | I have report show balance for each warehouse separately by using query below `Select item_id, sum(in-out) as balance from table1 group by item_id` My question is how show each warehouse balance in one table like below | item id | warehouse1 | warehouse2| | -------- | ---------- |-----------| | item1 | 7 | 2 | | item2 | 3 | 20 | I tired with this query but I get wrong results `SELECT table1.item_id, sum(table1.in)-sum(table1.out) as tb1, sum(table2.in)-sum(table2.out) as tb2 FROM table1 , table2 WHERE table1.item_id=table2.item_id GROUP by item_id`
Multitable joining in Sql
|php|sql|mysql|select|left-join|
null
I have 1 parent(Container) and 2 (List, SelectedItem) child components, Initially I render all data to Container and send all data to list and first item as selectedItem to selected Item component. So ar so good When a user clicks an item in the List component, it updates the selected item of the Parent through a function, the parent is able to update state, But it is not re-rendering selected item component. List Component: ``` import "./SelectedImage.css" function ListSection({items, updateSelectedItem}) { return ( <div className="list-section"> <ul> { (items).map((item) => { return <li key={item.id} onClick={() => updateSelectedItem(item.id)}>{item.name}</li> }) } </ul> </div> ); } export default ListSection; ``` Container Component ``` import LeftSection from './LeftSection'; import logo from './logo.svg'; import RightSection from './RightSection '; import SelectedItem from './SelectedItem'; import "./App.css"; import ListSection from './ListSection'; import { Component, useState } from 'react'; const products = [ {id: 1, name: "Lime", size: ["large", "medium", "small"], category: "Juice", image: "lime-juice.jpg"}, {id: 2, name: "Orange", size: ["large", "medium", "small"], category: "Juice", image: "orange-juice.jpg"}, {id: 3, name: "Mango", size: ["large", "medium", "small"], category: "Juice", image: "mango-juice.jpg"}, ] function Container() { let [selectItem, setSelectItem] = useState(products[0]); function chooseSelectedItem(id) { let item = products.filter((value) => { console.log(value.id); return (value.id == id) }) setSelectItem(item[0]); console.log(item[0]); } return ( <div className="Container"> <ListSection items={products} updateSelectedItem={chooseSelectedItem}/> <SelectedItem CurrentSelectedItem={selectItem}/> </div> ); } export default Container; ``` SelectedItemComponent ``` import QuantityBar from "./QuantityBar"; import "./SelectedImage.css" import { useState } from "react"; function SelectedItem({CurrentSelectedItem}) { let [item, setItem] = useState(CurrentSelectedItem); return ( <div className="selected-item"> {/* <img src={item.image} className="selected-image" /> */} {item.name} {/* <QuantityBar itemCount={0} /> */} </div> ); } export default SelectedItem; ```
I am using an ASP.NET Core Web API with Entity Framework Core (pomelo). I have a MariaDB database. I use Swagger UI to explore my API, as per the template. When I try to use it to delete a row, I get the following error: > Microsoft.EntityFrameworkCore.DbUpdateException: An error occurred while saving the entity changes. See the inner exception for details. > > MySqlConnector.MySqlException (0x80004005): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'RETURNING 1' at line 3 > > at MySqlConnector.Core.ServerSession.ReceiveReplyAsync(IOBehavior ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/Core/ServerSession.cs:line 894 at MySqlConnector.Core.ResultSet.ReadResultSetHeaderAsync(IOBehavior ioBehavior) in /_/src/MySqlConnector/Core/ResultSet.cs:line 37 at MySqlConnector.MySqlDataReader.ActivateResultSet(CancellationToken cancellationToken) in /_/src/MySqlConnector/MySqlDataReader.cs:line 130 at MySqlConnector.MySqlDataReader.InitAsync(CommandListPosition commandListPosition, ICommandPayloadCreator payloadCreator, IDictionary`2 cachedProcedures, IMySqlCommand command, CommandBehavior behavior, Activity activity, IOBehavior ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/MySqlDataReader.cs:line 483 at MySqlConnector.Core.CommandExecutor.ExecuteReaderAsync(CommandListPosition commandListPosition, ICommandPayloadCreator payloadCreator, CommandBehavior behavior, Activity activity, IOBehavior ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/Core/CommandExecutor.cs:line 56 at MySqlConnector.MySqlCommand.ExecuteReaderAsync(CommandBehavior behavior, IOBehavior ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/MySqlCommand.cs:line 357 at MySqlConnector.MySqlCommand.ExecuteDbDataReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/MySqlCommand.cs:line 350 at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.ExecuteAsync(IRelationalConnection connection, CancellationToken cancellationToken) The delete should be handled here in my controller and repository, like this: [HttpDelete("alertId")] public async Task<IActionResult> DeleteAlert(int alertId) { var alert = await _dataRepository.GetAlertAsync(alertId); if (alert is null) { return NotFound("Alert not found"); } await _dataRepository.DeleteAlertAsync(alert); return NoContent(); } and this public class AlertRepository (IrtsContext context) : IDataRepositoryAlerts { readonly IrtsContext _alertContext = context; public async Task DeleteAlertAsync(Alert entity) { if (entity != null) { _alertContext.Remove(entity); await _alertContext.SaveChangesAsync(); } else { throw new NotImplementedException(); } } } I do not understand this. I believe it is my `dbContext` that handles the "saving the entity changes". How can I have a SQL syntax error? I cannot find "Returning 1" anywhere in my code. I have tried deleting the row manually in my database. That works. All other operations (GET, POST and PUT) work just fine. I have tried running this with holding points to see where the error occurs but everything seems to execute without issue. I am grateful for any hints. I am obviously very new to this ;) Edit: MariaDB version 11.2.2 Edit2: This is my Alert class: public partial class Alert { public int AlertId { get; set; } public DateTime? Zeitpunkt { get; set; } public string? Quelle { get; set; } public string? AlertStatus { get; set; } public string? AlertTyp { get; set; } public string? BetroffeneSysteme { get; set; } public virtual ICollection<Vorfall> Vorfalls { get; set; } = new List<Vorfall>(); } and this is its entity configuration: modelBuilder.Entity<Alert>(entity => { entity.HasKey(e => e.AlertId).HasName("PRIMARY"); entity .ToTable("alert") .HasCharSet("utf8mb4") .UseCollation("utf8mb4"); entity.Property(e => e.AlertId) .HasColumnType("int(11)") .HasColumnName("AlertID"); entity.Property(e => e.AlertStatus).HasMaxLength(255); entity.Property(e => e.AlertTyp).HasMaxLength(255); entity.Property(e => e.BetroffeneSysteme).HasMaxLength(255); entity.Property(e => e.Quelle).HasMaxLength(255); entity.Property(e => e.Zeitpunkt).HasColumnType("datetime"); }); edit3: I found the parameterized query. It goes thus: [The error in the log with sql query] Edit 4: copying the query into workbench gives the following error: [![sql][1]][1] It appears that the problem really is the "RETURNING 1" and I must admit I have no idea what it is for. Is there a way to remove it? I have found no way to edit the EF queries themselves. Alternatively I might need to try a different database. Thank you for your help! [1]: https://i.stack.imgur.com/5jiaK.png
I’m using cjoint for the first time to analyze the results of a conjoint experiment I ran f few years ago. I’m able to produce the table in my R console, but does anyone know how I can produce the table in LaTeX, e.g. with tex reg…? I’m copying my code below. ``` Women_Committee_women = amce( picked_A ~ A_female + A_reserved_seat + A_edu + A_prev_exp + A_married + B_female + B_reserved_seat + B_edu + B_prev_exp + B_married, data = Women_Committee_what_women_think, cluster = TRUE, respondent.id = "ID", design = candidate_design ) ```
null
I don't really understand why you are messing around with central directories and building the Zip manually. None of this is necessary as you can use `ZipArchive` to do this in one go. Furthermore, you can't compress chunks of bytes like that and then just concatenate them. The Deflate algorithm doesn't work that way. Your concern about flushing is misplaced: if the `ZipArchive` is closed then everything is flushed. You just need to make it leave the stream open once you dispose it. I would advise you to only work with `Stream`, but you could use `byte[]` or `Memory<byte>` if absolutely necessary. ```cs public async Task<Memory<byte>> Compress(string fileName, IAsyncEnumerable<Memory<byte>> data) { var ms = new MemoryStream(); using (var zip = new ZipArchive(ms, ZipArchiveMode.Create, leaveOpen: true)) { var entry = zip.CreateEntry(fileName); using var zipStream = entry.Open(); await foreach (var bytes in data) { zipStream.Write(bytes); } } return new ms.GetBuffer().AsMemory(0, (int)ms.Length); }
I wait until the page is loaded and use the "DOMContentLoaded" method to add eventhandlers on some p tags. This works until I open and close the modal. Can someone please tell me why the page fully freezes? ``` <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <body> <div id="div_1"> <p>One</p> <p>Two</p> <p>Three</p> </div> <p id="open_modal">open the modal</p> <script> document.addEventListener("DOMContentLoaded", () => { let test = document.querySelector("#div_1") for (let i = 0; i < test.children.length; i++) { test.children[i].addEventListener("click", () => { console.log(test.children[i].innerHTML) }); }; }); document.querySelector("#open_modal").addEventListener("click", () => { if (!document.querySelector("#modal")) { document.body.innerHTML += ` <div id="modal" style="display: block; position: fixed; z-index: 1; padding-top: 100px; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgb(0,0,0); background-color: rgba(0,0,0,0.4)"> <div id="modal_content"> <span id="modal_close">&times;</span> <p style="color: green;">Some text in the Modal..</p> </div> </div> `; document.querySelector("#modal_close").addEventListener("click", () => { document.querySelector("#modal").style.display = "none"; }); } else { document.querySelector("#modal").style.display = "block"; }; }); </script> </body> </html> ```
{"Voters":[{"Id":839601,"DisplayName":"gnat"},{"Id":5468463,"DisplayName":"Vega"},{"Id":546871,"DisplayName":"AdrianHHH"}]}
I'm on a mac and trying to run a local Postgres database with the PostGIS extension, and then populate the database with a shapefile, without having to load the data in manually. I have a ```docker-compose.yml``` where I'm first using the postgis docker image and using port 5432. I've already tested this when the container is running and I can successfully connect. The second part, ```import-shapefile``` uses the postgres image and installs the needed extensions, converts the shapefile and should add the results into the db running in the postgis container. docker-compose.yml: ``` services: postgis: image: postgis/postgis restart: always env_file: - .env ports: - 5432:5432 platform: linux/amd64 volumes: - ./dataset:/dataset import-shapefile: image: postgres depends_on: - postgis volumes: - ./dataset:/dataset entrypoint: sh command: -c "apt-get update && apt-get install -y postgis && shp2pgsql -s 4326 -I -D -W UTF-8 dataset/my_shapefile.shp my_table | psql -U username -d my_db" environment: - POSTGRES_USER - POSTGRES_DB ``` When looking at the container logs I see the error in the import-shapefile container: ``` sql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory Is the server running locally and accepting connections on that socket? ```
Connecting to Postgres running in a Docker container using psql
|postgresql|docker|postgis|psql|shapefile|
null
This works for me in NodeJS: import * as lib from 'somewhere...' Object.assign(global, lib)
I have an Admin area in my asp.net core MVC app and when I try to reach to /Admin/Category/Add it says No webpage was found for the web address: https://localhost:7002/Category/Add?area=Admin. My routing in program.cs: ``` app.MapDefaultControllerRoute(); app.MapAreaControllerRoute( name: "Admin", areaName: "Admin", pattern: "Admin/{controller=Home}/{action=Index}/{id?}" ); ``` My view: ``` @model List<Category> @{ ViewData["Title"] = "Index"; Layout = "~/Areas/Admin/Views/Shared/_AdminLayout.cshtml"; } <div class="row"> <div class="col-lg-12"> <div class="card"> <div class="card-body"> <a asp-area="Admin" asp-controller="Category" asp-action="Update" class="btn mb-1 btn-primary">Add Category</a> <div class="card-title"> <h4>Table Basic</h4> </div> <div class="table-responsive"> <table class="table"> <thead> <tr> <th>Name</th> <th>Created By</th> <th>Status</th> <th>Actions</th> </tr> </thead> <tbody> @foreach (var item in Model) { <tr> <td>@item.Name</td> <td>@item.CreatedBy</td> <td>@item.IsDeleted</td> <td> <a asp-area="Admin" asp-controller="Category" asp-action="Update" asp-route-id="@item.Id"> <button type="button" class="btn mb-1 btn-warning">Update</button> </a> <a asp-area="Admin" asp-controller="Category" asp-action="Delete" asp-route-id="@item.Id"> <button type="button" class="btn mb-1 btn-danger">Delete</button> </a> </td> </tr> } </tbody> </table> </div> </div> </div> </div> </div> ``` My controller: ``` namespace AnimeUI.Areas.Admin.Controllers { [Area("Admin")] public class CategoryController : Controller { private readonly ICategoryService categoryService; private readonly IValidator<Category> validator; private readonly IMapper mapper; public CategoryController(ICategoryService categoryService, IValidator<Category> validator, IMapper mapper) { this.categoryService = categoryService; this.validator = validator; this.mapper = mapper; } public async Task<IActionResult> Index() { var categories = await categoryService.GetAllCategoriesNonDeletedAsync(); return View(categories); } [HttpGet] public IActionResult Add() { return View(); } [HttpPost] public async Task<IActionResult> Add(AddCategoryDto addCategoryDto) { var category = mapper.Map<Category>(addCategoryDto); var result = validator.Validate(category); var exists = await categoryService.Exists(category); if (exists) result.Errors.Add(new ValidationFailure("Name", "This category name already exists")); if (result.IsValid) { await categoryService.CreateCategoryAsync(addCategoryDto); return RedirectToAction("Index", "Category", new { Area = "Admin" }); } result.AddToModelState(this.ModelState); return View(addCategoryDto); } } } ``` I have been searching for whole day, yet couldn't find a valid solve to this annoying problem. For some reason my url is being generated like this: https://localhost:7002/Category/Add?area=Admin instead of https://localhost:7002/Admin/Category/Add. I tried to change my port, add different routing syntax. I am currently using visual studio 2022 and my project is .NET 8.0 PS: My problem only occurs when I need to go to the pages of Admin.
Perhaps you could simply do, > n_dice <- 10 > n_toss <- 1e6 > set.seed(42) > tss <- replicate(n_dice, sample.int(6, n_toss, replace=TRUE)) > table(cut(rowSums(tss), seq(0, 6*n_dice, 10)))/n_toss (0,10] (10,20] (20,30] (30,40] (40,50] (50,60] 0.000000 0.002883 0.202386 0.638278 0.154963 0.001490
I'm trying to see a video in my Opera for Linux mint browser, but when I click the play button it appears the error "Format is not supported or source is unavailable." or something like that. I already tried the players of other sites, such as amazon prime and unity learn, on Firefox and it works perfectly. My Opera version is Opera One version: 108.0.5067.40 and I'm using Linux Mint LMDE 6 Faye Here's the error in the Unity Learn player: [![Unity learn player error][1]][1] [1]: https://i.stack.imgur.com/3hGGk.png
Video Format is not supported or source is unavailable. - Opera
|video|opera|video-player|
I'm using template haskell to include content from non-Haskell files in some of my code, and this content is then parsed and used. The problem that I have with using `cabal` as a build tool for this is that it doesn't detect when these files changes and so I find myself using `cabal clean; cabal build` which forces the _whole_ project to be rebuilt (including some dependencies) which is slower than it could otherwise be.
You could use [`top_k`](https://docs.pola.rs/py-polars/html/reference/dataframe/api/polars.DataFrame.top_k.html) and slice the last row: ``` import polars as pl np.random.seed(0) df = pl.DataFrame({'col': np.random.choice(5, size=5, replace=False)}) out = df.top_k(2, by='col')[-1] ``` You could also [`filter`](https://docs.pola.rs/py-polars/html/reference/dataframe/api/polars.DataFrame.filter.html) with [`rank`](https://docs.pola.rs/py-polars/html/reference/expressions/api/polars.Expr.rank.html), but this will perform a full sort, so it could be algorithmically less efficient: ``` out = df.filter(pl.col('col').rank(descending=True)==2) ``` Or with [tag:numpy]'s [`argpartition`](https://numpy.org/doc/stable/reference/generated/numpy.argpartition.html): ``` out = df[int(np.argpartition(df['col'], -N)[-N])] ``` Output: ``` shape: (1, 1) ┌─────┐ │ col │ │ --- │ │ i64 │ ╞═════╡ │ 3 │ └─────┘ ``` Input: ``` shape: (5, 1) ┌─────┐ │ col │ │ --- │ │ i64 │ ╞═════╡ │ 2 │ │ 0 │ │ 1 │ │ 3 │ │ 4 │ └─────┘ ``` ##### timings: 1M rows ``` # top_k 39.3 ms ± 7.23 ms per loop (mean ± std. dev. of 7 runs, 10 loops each) # filter+rank 54.6 ms ± 8.58 ms per loop (mean ± std. dev. of 7 runs, 10 loops each) ``` 10M rows: ``` # top_k 427 ms ± 84.8 ms per loop (mean ± std. dev. of 7 runs, 1 loop each) # filter+rank 639 ms ± 102 ms per loop (mean ± std. dev. of 7 runs, 1 loop each) ``` 100M rows ``` # top_k 4.04 s ± 411 ms per loop (mean ± std. dev. of 7 runs, 1 loop each) # filter+rank 6.12 s ± 244 ms per loop (mean ± std. dev. of 7 runs, 1 loop each) # argpartition 1.48 s ± 25.6 ms per loop (mean ± std. dev. of 7 runs, 1 loop each) ```
I have increased the session timing to following <?php header('Content-Type: application/json'); //error_reporting(0); ini_set('session.gc_maxlifetime', 86400); session_set_cookie_params(86400); session_start(); But I get logged out every 1 or 2 hours randomly or if there is no activity in session. Why does this happen?
In stripe I have 2 products. Monthly subscription ($50 for beginner). Monthly subscription ($70 for advanced). The user (a parent) can complete a form "Add student to courses". The result is creating tabs with content specific for each kid they sign up to classes. If the user pays a subscription for each kid, in my supabase "subscriptions" table, a column student_id will be populated with the student's id that is the foreign key to a students table. So the parent can have multiple subscriptions for each of his/her kids. Problem: Let's say both kids are beginners for the classes. If I go to stripe customer portal from the parent's page, I will have 2 subscriptions, both named "Monthly subscription". How can I differentiate between the 2? Something like "Monthly Subscription for Hannah" and "Monthly Subscription for Paul" It looks like I can only create one customer portal, but then all I can see are 2 subscriptions "Monthly Subscription"
Need some advice on differentiating between subscriptions using Stripe
|next.js|stripe-payments|supabase|
null
i have this page component for each product information: ``` export default function Product() { const { data } = useContext(ShopContext); const { id } = useParams(); if (!data) { return <div>Loading product...</div>; } const product = data.find((item) => item.id === id); return ( <div> {product.title} </div> ); } ``` somehow product is undefined though data and id can be logged into console and their value is available, i made sure of it like this: ``` export default function Product() { const { data } = useContext(ShopContext); const { id } = useParams(); if (!data) { return <div>Loading product...</div>; } return ( <div> <div>{id}</div> {/*this div is displayed as expected*/} <div> {/*this div is displayed as expected*/} {data.map((item) => ( <div key={item.id}>{item.title}</div> ))} </div> <div>{product?.title}</div> {/*this div is empty*/} </div> ); } ``` i really can't find a solution when i even don't understand what's going on but i did it this way too and still nothing on the page (the url is correct and loading div is displayed): ``` export default function Product() { const { data } = useContext(ShopContext); const { id } = useParams(); if (!data) { return <div>Loading product...</div>; } return ( <div> {data.map(item => ( <div key={item.id}> {item.id === id ? item.title : null} </div> ))} </div> ); } ``` for additional information i'm fetching the data from [fakestoreapi.com](fakestoreapi.com) in the app component and it works fine in other components. here's the fetching piece: ``` useEffect(() => { async function FetchData() { try { const response = await fetch("https://fakestoreapi.com/products"); if (!response.ok) { throw new Error(`HTTP error: Status ${response.status}`); } let postsData = await response.json(); postsData.sort((a, b) => { const nameA = a.title.toLowerCase(); const nameB = b.title.toLowerCase(); return nameA.localeCompare(nameB); }); setData(postsData); setError(null); } catch (err) { setData(null); setError(err.message); } finally { setLoading(false); } } FetchData(); }, []); ``` this is the context: ``` import { createContext } from "react"; export const ShopContext = createContext({ data: [], loading: true, error: "", setData: () => {}, cart: [], addToCart: () => {}, removeFromCart: () => {}, }); ``` and this is its states in app component: ``` const [data, setData] = useState(null); const [loading, setLoading] = useState(true); const [error, setError] = useState(null); const [cart, setCart] = useState([]); const addToCart = (productId) => { .... }; const removeFromCart = (productId) => { ..... }; return ( <ShopContext.Provider value={{ data, loading, error, setData, cart, addToCart, removeFromCart, }} > <Header /> <Body /> <Footer /> </ShopContext.Provider> ); ``` i really don't know what is the problem and what to search.
How to make a linear graph plotting gene counts on y axis and gene lengths on x?
|r|ggplot2|histogram|
Please I am very new to flutter. I am working on a project and i got stuck in the implementation. I was wondering if you can help out. I am creating an audiobook. It converts pdf to audiofiles. I created a list of the books on a screen and if you tap on a book, it should list out the audios associated with it. Now the problem is that I split the audios into different parts as seen below: ``` import 'package:audioplayers/audioplayers.dart'; import 'package:flutter/material.dart'; import 'audio.dart'; class Audios with ChangeNotifier { final List<Audio> _audios = [ Audio( audioId: 1, bookId: 1, userId: 1, audioFile: [ "https://myaudiobookapp.s3.eu-central-1.amazonaws.com/the_frog_prince_part1.mp3", "https://myaudiobookapp.s3.eu-central-1.amazonaws.com/the_frog_prince_part2.mp3", "https://myaudiobookapp.s3.eu-central-1.amazonaws.com/the_frog_prince_part3.mp3" ], audioName: "the_frog_prince", bookImage: "https://myaudiobookapp.s3.amazonaws.com/1_The-Frog-Prince-Landscape-Book-CKF-FKB.pdf.png"), Audio( audioId: 2, bookId: 2, userId: 1, audioFile: [ "https://myaudiobookapp.s3.amazonaws.com/sara_menker_part1.mp3" ], audioName: "sara_menker", bookImage: "https://myaudiobookapp.s3.amazonaws.com/Data_Analysis_Plan_of_Sara_Menker.pdf.png", ), ]; // current song playing index int? _currentAudioIndex; /* A U D I O P L A Y E R */ // audio player final AudioPlayer _audioPlayer = AudioPlayer(); // durations Duration _currentDuration = Duration.zero; Duration _totalDuration = Duration.zero; // constructor Audios() { listenToDuration(); } // initially not playing bool _isPlaying = false; // play the audio void playAudio(int index) async { // final audIndex = _audios.indexWhere((aud) => aud.audioId == index + 1); int i = 0; while (i < _audios[index].audioFile.length) { final audioUrl = _audios[index].audioFile[i]; await _audioPlayer.stop(); await _audioPlayer.play(audioUrl); _isPlaying = true; _currentAudioIndex = index; notifyListeners(); } } // pause current song void pauseAudio() async { await _audioPlayer.pause(); _isPlaying = false; notifyListeners(); } // resume playing void resumeAudio() async { await _audioPlayer.resume(); _isPlaying = true; notifyListeners(); } // pause or resume void pauseOrResumeAudio() async { if (_isPlaying) { pauseAudio(); } else { resumeAudio(); } notifyListeners(); } // seek to a specific position in the current audio void seek(Duration position) async { await _audioPlayer.seek(position); } // play next song void playNextAudio() { if (_currentAudioIndex != null) { if (_currentAudioIndex! < _audios.length - 1) { // go to the next audio if it's not the last audio currentAudioIndex = _currentAudioIndex! + 1; } else { // if it's the last song, loop back to the first song currentAudioIndex = 0; } } } // play previous song void playPreviousAudio() { // if more than 2 seconds have passed, restart the current audio if (_currentDuration.inSeconds > 2) { // if it's within first 2 second of the audio, go to previous song seek(Duration.zero); } else { if (_currentAudioIndex! > 0) { currentAudioIndex = _currentAudioIndex! - 1; } else { // if it's the first song, loop back to last song currentAudioIndex = _audios.length - 1; } } } // listen to duration void listenToDuration() { // listen for total Duration _audioPlayer.onDurationChanged.listen((newDuration) { _totalDuration = newDuration; notifyListeners(); }); // listen for current Duration _audioPlayer.onAudioPositionChanged.listen((newPosition) { _currentDuration = newPosition; notifyListeners(); }); // listen for song completion _audioPlayer.onPlayerCompletion.listen((event) {}); } // dispose audio player /* G E T T E R S */ // List<Audio> get items { // return [...audios]; // } List<Audio> get audios => _audios; int? get currentAudioIndex => _currentAudioIndex; bool get isPlaying => _isPlaying; Duration get currentDuration => _currentDuration; Duration get totalDuration => _totalDuration; List getAudioFilesById(int audioId) { final audio = _audios.firstWhere((audio) => audio.audioId == audioId, orElse: () => throw Exception('Audio ID not found')); return audio.audioFile; } /* S E T T E R S */ set currentAudioIndex(int? newIndex) { //update current Audio Index _currentAudioIndex = newIndex; if (newIndex != null) { playAudio(newIndex); } //update UI notifyListeners(); } Audio findById(int id) { return audios.firstWhere((audio) => audio.audioId == id); } } ``` So now, I have to let it know the selected book and create a listTile of audioFiles related to that book. I also want the audioName to be reflected for each audioFile. This is the audioList widget I created: ``` import 'package:audio_book_app/screens/audio_page_screen.dart'; import 'package:flutter/material.dart'; import 'package:audio_book_app/providers/audio.dart'; import 'package:provider/provider.dart'; class AudioList extends StatelessWidget { const AudioList({Key? key}) : super(key: key); @override Widget build(BuildContext context) { final List<Audio> audios = Provider.of<List<Audio>>(context); return ListView.builder( itemCount: audios.length, itemBuilder: (context, index) { final audio = audios[index]; return ListTile( leading: Image.network( audio.bookImage, width: 50, height: 50, ), title: Text(audio.audioName), subtitle: Text(audio.audioName), onTap: () { Navigator.push( context, MaterialPageRoute( builder: (context) => AudioPage(), ), ); }, ); }, ); } } ``` This is my audioplayerscreen.dart: ``` import 'package:audio_book_app/screens/audio_page_screen.dart'; import 'package:audio_book_app/widgets/audio_list.dart'; import 'package:flutter/material.dart'; import 'package:audio_book_app/providers/audios.dart'; import 'package:audio_book_app/widgets/app_drawer.dart'; import 'package:provider/provider.dart'; class AudioPlayerScreen extends StatefulWidget { final int bookId; AudioPlayerScreen({required this.bookId}); static const routeName = '/audioplayerscreen'; @override State<AudioPlayerScreen> createState() => _AudioPlayerScreenState(); } class _AudioPlayerScreenState extends State<AudioPlayerScreen> { late final dynamic audiosprovider; late List audioFiles = []; bool isPlaying = false; // Duration duration = Duration.zero; // Duration position = Duration.zero; @override void initState() { super.initState(); audiosprovider = Provider.of<Audios>(context, listen: false); final bookId = ModalRoute.of(context)!.settings.arguments as int; audioFiles = audiosprovider.getAudioFilesById(bookId); } void goToAudio(int audioIndex) { // update current audio index audiosprovider.currentAudioIndex = audioIndex; // navigate to song page Navigator.push( context, MaterialPageRoute( builder: (context) => AudioPage(), ), ); } @override Widget build(BuildContext context) { return Scaffold( backgroundColor: const Color.fromARGB(255, 243, 243, 243), appBar: AppBar( backgroundColor: Theme.of(context).colorScheme.inversePrimary, title: const Text('My Library'), ), drawer: AppDrawer(), body: ListView.builder( itemCount: audioFiles.length, itemBuilder: (context, index) { return AudioList(); }, )); } } ``` This is my main.dart: ``` import 'package:audio_book_app/providers/audios.dart'; import 'package:audio_book_app/providers/books.dart'; import 'package:audio_book_app/screens/audio_player_screen.dart'; import 'package:audio_book_app/screens/convertin_screen.dart'; import 'package:audio_book_app/screens/home_screen.dart'; import 'package:audio_book_app/screens/login_screen.dart'; import 'package:audio_book_app/screens/logout_screen.dart'; import 'package:audio_book_app/screens/mylibrary_screen.dart'; import 'package:audio_book_app/screens/signup_screen.dart'; // import 'package:audio_book_app/screens/splash_screen.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import './providers/auth.dart'; void main() { runApp(const MyApp()); } class MyApp extends StatelessWidget { const MyApp({super.key}); // This widget is the root of your application. @override Widget build(BuildContext context) { return MultiProvider( providers: [ ChangeNotifierProvider( create: (ctx) => Auth(), ), ChangeNotifierProvider( create: (ctx) => Books(), ), ChangeNotifierProvider( create: (ctx) => Audios(), ), ], child: Consumer<Auth>( builder: (ctx, auth, _) => MaterialApp( title: 'Audify', theme: ThemeData( colorScheme: ColorScheme.fromSeed( seedColor: Colors.orange, secondary: Colors.deepOrange), primaryColor: Colors.orange, useMaterial3: true, ), home: auth.isAuth ? const HomeScreen() // : FutureBuilder( // future: auth.tryAutoLogin(), // builder: (ctx, authResultSnapshot) => // authResultSnapshot.connectionState == // ConnectionState.waiting // ? SplashScreen() : AuthScreen(), // ), routes: { HomeScreen.routeName: (ctx) => const HomeScreen(), ConvertingScreen.routeName: (ctx) => const ConvertingScreen(), LogoutScreen.routeName: (ctx) => const LogoutScreen(), MyLibraryScreen.routeName: (ctx) => const MyLibraryScreen(), SignUpScreen.routeName: (ctx) => SignUpScreen(), AuthScreen.routeName: (ctx) => AuthScreen(), // I also need to pass the bookId here AudioPlayerScreen.routeName: (ctx) => AudioPlayerScreen() })), ); } } ``` Please let me know if there are more screens you need to see. I expect the audioFiles of the selected book to be displayed but in my implementation, I am not able to pass the bookId from the selected book in the previous page as seen below: mylibraryscreen.dart: ``` import 'package:audio_book_app/providers/auth.dart'; import 'package:audio_book_app/providers/books.dart'; import 'package:audio_book_app/widgets/app_drawer.dart'; import 'package:audio_book_app/widgets/mylibrary.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; class MyLibraryScreen extends StatefulWidget { const MyLibraryScreen({super.key}); static const routeName = '/mylibrary'; @override State<MyLibraryScreen> createState() => _MyLibraryScreenState(); } class _MyLibraryScreenState extends State<MyLibraryScreen> { // ignore: unused_field var _isInit = true; // ignore: unused_field var _isLoading = false; @override void initState() { setState(() { _isLoading = true; }); _isLoading = true; final authData = Provider.of<Auth>(context, listen: false); Provider.of<Books>(context, listen: false) .fetchAndSetBooks(authData.token) .then((_) { setState(() { _isLoading = false; }); }); super.initState(); } @override Widget build(BuildContext context) { final booksData = Provider.of<Books>(context); final books = booksData.items; return Scaffold( backgroundColor: const Color.fromARGB(255, 243, 243, 243), appBar: AppBar( backgroundColor: Theme.of(context).colorScheme.inversePrimary, title: const Text('My Library'), ), drawer: AppDrawer(), body: ListView.builder( itemBuilder: (ctx, i) => ChangeNotifierProvider.value( value: books[i], child: const MyLibrary(), ), itemCount: books.length, ), ); } } ``` mylibrary.dart: ``` // import 'package:audio_book_app/providers/audios.dart'; import 'package:audio_book_app/providers/book.dart'; import 'package:audio_book_app/screens/audio_player_screen.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; class MyLibrary extends StatelessWidget { const MyLibrary({super.key}); @override Widget build(BuildContext context) { final book = Provider.of<Book>(context, listen: false); // final audiosProvider = Provider.of<Audios>(context); return Stack( alignment: Alignment.centerLeft, children: [ Container( margin: const EdgeInsets.symmetric(vertical: 45, horizontal: 18), width: 550, height: 100, color: Colors.white, ), Positioned( child: Image.network( book.bookImage, // Replace with your image asset path width: 180, height: 130, ), ), Positioned( left: 200, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ FadeTransition( opacity: const AlwaysStoppedAnimation(1), // Adjust opacity as needed child: SizedBox( width: 130, child: Text( book.bookName, overflow: TextOverflow.ellipsis, maxLines: 2, style: const TextStyle( fontSize: 16, fontWeight: FontWeight.bold, ), ), ), ), const Text("John Smith"), ], ), ), Positioned( left: 330, top: 70, child: IconButton( onPressed: () { Navigator.of(context).pushReplacementNamed( AudioPlayerScreen.routeName, arguments: book.bookId, ); }, icon: const Icon( Icons.play_circle_fill_rounded, color: Colors.orange, size: 50, ), ), ), ], ); } } ```
How to create a listTile from a class in Flutter based on an collected id from the previous page
|flutter|dart|
null
You'd have to edit file `gradle/libs.versions.toml` and add in TOML format: [versions] androidx_compose_bom = '2024.03.00' androidx_compose_uitest = '1.6.4' androidx_media3 = '1.3.0' # ... [libraries] androidx_compose_bom = { module = "androidx.compose:compose-bom", version.ref = "androidx_compose_bom" } androidx_compose_uitest = { module = "androidx.compose.ui:ui-test-junit4", version.ref = "androidx_compose_uitest" } androidx_media3_exoplayer = { module = "androidx.media3:media3-exoplayer", version.ref = "androidx_media3" } androidx_media3_exoplayer_dash = { module = "androidx.media3:media3-exoplayer-dash", version.ref = "androidx_media3" } androidx_media3_exoplayer_ui = { module = "androidx.media3:media3-exoplayer-ui", version.ref = "androidx_media3" } # ... As one can see, one sometimes can use the version reference for multiple entries. And one can even bundle these (optional): [bundles] exoplayer = ["androidx_media3_exoplayer", "androidx_media3_exoplayer_dash", "androidx_media3_exoplayer_ui"] Which means, you can't just copy & paste, but have to convert to TOML.<br/> Be aware that for BOM dependencies, this only works for the BOM itself.<br/> When there's no version number, one can use: `//noinspection UseTomlInstead`. The names of the definitions of the default empty activity app are kind of ambiguous, since they're not explicit enough. There `androidx` should better be called `androidx_compose`... because eg. `libs.androidx.ui` does not provide any understandable meaning (readability), compared to `libs.androidx.compose.ui`. Proper labeling is important there. Further reading: - [Sharing dependency versions between projects](https://docs.gradle.org/current/userguide/platforms.html) - [Migrate your build to version catalogs](https://developer.android.com/build/migrate-to-catalogs)
I am tryin to upload a new app to the App Store. It was built with expo and I am now tryin to build it using EAS. I've uploaded my first and only app a few months ago. From the root of my project I run: `eas build --platform ios` - Do you want to log in to your Apple account - I choose yes - Apple ID (presented and correct) - I click yes Then the following Restoring session C:\Users\Yanay\.app-store\auth\yanaycodes@gmail.com\cookie › Team My Name (My ID) › Provider My Name (Some Numbers maybe another ID) √ Logged in Local session ✔ Bundle identifier registered MY.ACTUAL.BUNDLE.IDENTIFIER ✔ Synced capabilities: Enabled: Push Notifications | Disabled: Sign In with Apple ✔ Synced capability identifiers: No updates ✔ Fetched Apple distribution certificates - Reuse this distribution certificate? Cert ID: SOME ID, Serial number: SOME SERIAL NUMBER, Team ID: MY TEAM ID, Team name: MY NAME (Individual) - I choose yes - Generate a new Apple Provisioning Profile? - I choose yes And then I get ✖ Failed to create Apple provisioning profile Failed to set up credentials. There is a problem with the request entity - You are not allowed to create 'iOS' profile with App ID 'APP ID'. Error: build command failed. What is happening? I went to my developer account and I can even find that APP ID it shows me (last error log) in any of the apps (there like two there, one was just created to support apple log in). How can I fix this? This is my app.json if that helps { "expo": { "name": "My Apps Name", "slug": "MyAppsName", "version": "1.0.3", "orientation": "portrait", "icon": "./assets/icon.png", "userInterfaceStyle": "light", "splash": { "image": "./assets/splash.png", "resizeMode": "contain", "backgroundColor": "#202022" }, "assetBundlePatterns": ["**/*"], "ios": { "supportsTablet": true, "bundleIdentifier": "my.package.url", "buildNumber": "1", "infoPlist": { "NSMicrophoneUsageDescription": "This app uses the microphone to allow you to capture audio as a note.", "NSPhotoLibraryUsageDescription": "This app needs access to the photo library to allow you to upload photos as notes.", "NSCameraUsageDescription": "This app uses the camera to allow you to capture photos as notes.", "NSLocationWhenInUseUsageDescription": "This app needs access to your location to allow you to capture your location as a note." } }, "android": { "package": "my.package.url", "versionCode": 5, "adaptiveIcon": { "foregroundImage": "./assets/adaptive-icon.png", "backgroundColor": "#202022" }, "permissions": [ "android.permission.INTERNET", "android.permission.READ_EXTERNAL_STORAGE", "android.permission.WRITE_EXTERNAL_STORAGE", "android.permission.MODIFY_AUDIO_SETTINGS", "android.permission.AUDIO_CAPTURE", "android.permission.CAMERA", "android.permission.RECORD_AUDIO", "android.permission.ACCESS_FINE_LOCATION", "android.permission.ACCESS_COARSE_LOCATION", "android.permission.FOREGROUND_SERVICE" ] }, "web": { "favicon": "./assets/favicon.png" }, "extra": { "eas": { "projectId": "my-project-id" } } } }
As of pydantic version 2.6.4, you cannot modify the behavior of `extra` on a per-call basis. However, you can easily remove the extra fields from the input to achieve equivalent behavior: ```python validated = NoExtras.model_validate({key:value for key,value in somedict.items() if key in NoExtras.model_fields}) ``` Be aware, this only works for flat models.
I facing the above error where I testing the model of traffic sign detection. I am just Beginner to learning the model train. I watch the test in YouTube you are going well but the video was 4 year old may be that why I facing this error I have not idea what to do if any one can please answer me. thank you # PROCESS IMAGE img = np.asarray(imgOrignal) img = cv2.resize(img, (32, 32)) img = preprocessing(img) cv2.imshow("Processed Image", img) img = img.reshape(1, 32, 32, 1) cv2.putText(imgOrignal, "CLASS: " , (20, 35), font, 0.75, (0, 0, 255), 2, cv2.LINE_AA) cv2.putText(imgOrignal, "PROBABILITY: ", (20, 75), font, 0.75, (0, 0, 255), 2, cv2.LINE_AA) # PREDICT IMAGE predictions = model.predict(img) classIndex = model.predict_classes(img) probabilityValue =np.amax(predictions) cv2.putText(imgOrignal,str(classIndex)+" "+str(getCalssName(classIndex)), (120, 35), font, 0.75, (0, 0, 255), 2, cv2.LINE_AA) cv2.putText(imgOrignal, str(round(probabilityValue*100,2) )+"%", (180, 75), font, 0.75, (0, 0, 255), 2, cv2.LINE_AA) cv2.imshow("Result", imgOrignal) k=cv2.waitKey(1) if k== ord('q'): break cv2.destroyAllWindows() cap.release()
AttributeError: 'Sequential' object has no attribute 'predict_classes'. Did you mean: 'predict_step'?
|machine-learning|digital-signature|
null
I figured this out. Those variables need to be marked as build variables within coolify's ui, and then under advanced there is an option that says force deploy without using cache. This forces next.js to rebuild again and put in the build environment variables.
Based purely on [this documentation](http://re2c.org/manual/manual_c.html#regular-expressions), a form of lookahead is supported. So one might hope that this would work: ``` BINARY_NUM = "0b" ("0"|"1") ("_"? ("0"|"1"))* / [^_01] ; ``` or slightly more compactly: ``` BINARY_NUM = "0b" [01]+ ( "_" [01]+ )* / [^_01] ; ``` although something more sophisticated would be needed, since the example above implies that: ``` 0b010101010222 ``` would be parsed as `0b010101010` followed by `222`. However, I discovered "trailing contexts are not allowed in named definitions" when I tried substituting the above into the [introductory sample code in the manual](http://re2c.org/manual/manual_c.html#introduction). Modifying it with [the "sentinel" example](http://re2c.org/manual/manual_c.html#sentinel), I get: ``` // re2c $INPUT -o $OUTPUT -i --case-ranges #include <assert.h> bool lex(const char *s) { const char *YYCURSOR = s; const char *YYMARKER; for(;;) { /*!re2c re2c:yyfill:enable = 0; re2c:define:YYCTYPE = char; number = "0b" [01]+ ( "_" [01]+ )*; number { continue; } [\x00] { return true; } * { return false; } */ } } int main() { assert(lex("0b01_001")); assert(lex("0b00000_")); return 0; } ``` This successfully rejects trailing `_`. It is also possible to just include the null sentinel directly: ``` number = "Ob" [01]+ ("_"[01]+)* "\x00"; ``` ``` // re2c $INPUT -o $OUTPUT -i --case-ranges #include <assert.h> bool lex(const char *s) { const char *YYCURSOR = s; const char *YYMARKER; /*!re2c re2c:yyfill:enable = 0; re2c:define:YYCTYPE = char; number = "0b" [01]+ ( "_" [01]+ )* "\x00"; number { return true; } * { return false; } */ } } int main() { assert(lex("0b01_001")); assert(lex("0b00000_")); return 0; } ```
Is there a way for Spark to read a single date partition from a Snowflake table, update it and then to overwrite this single date partition. Concurrent writes should be supported. Currently Spark has two overwrite modes, so I don't see a way to overwrite a single partition. It's an easy thing to do in Iceberg, as there overwrite mode overwrites only a single partition. Am I missing out some obvious solution? I am interested in a solution that would not require transactions or complex SQLs. Ideally, the same behavior as in Iceberg, that is operation that allows to overwrite a single partition
How to overwrite a single partition in Snowflake when using Spark connector
|apache-spark|pyspark|snowflake-cloud-data-platform|
null
My website does not redirect from exsample.com to www .exsample.com. My website is built in laravel My htaccess file is as below. <IfModule mod_rewrite.c> <IfModule mod_negotiation.c> Options -MultiViews -Indexes </IfModule> RewriteEngine On ErrorDocument 406 / # Disable Directory listing Options -Indexes # Block files <Files ~ "\.(env|config.js|md|gitignore|gitattributes|lock)$"> Order allow,deny Deny from all </Files> # Handle Authorization Header RewriteCond %{HTTP:Authorization} . RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] # Redirect Trailing Slashes If Not A Folder... RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} (.+)/$ RewriteRule ^ %1 [L,R=301] # Send Requests To Front Controller... RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [L] </IfModule> Even if page rules are created by Cloudflare, it does not work
Redirect non-www to www in Laravel
|php|laravel|no-www|
null
I’m interested in understanding the distinctions between context.watch and context.select in the context of blocs. Can you provide insights into when it is more appropriate to utilize watch and when select would be the better choice in a bloc scenario? Thank you for your assistance in clarifying this matter.
What is the difference between `context.watch` and `context.select` in flutter_bloc?
|flutter|dart|bloc|flutter-bloc|
In flutter_bloc, `context.watch` and `context.select` are both useful for interacting with the states of your blocs, but they have slightly different use cases. `context.watch`: Use `context.watch` when you want to listen to changes in the state of any bloc or Cubit and rebuild your widget whenever the state changes. This can be useful when you need to rebuild your widget based on any change in the bloc state, regardless of which part of the state changed. `context.watch` ensures that your widget rebuilds if any state in the observed bloc changes. `context.select`: Use `context.select` when you only want to listen to specific parts of the state and rebuild your widget when those specific parts change. This can be more efficient than context.watch because it allows you to be more selective about which state changes trigger a rebuild. By selecting only specific parts of the state to listen to, you can avoid unnecessary rebuilds when other parts of the state change. In summary: Use `context.watch` when you want to rebuild your widget on any state change in the observed bloc. Use `context.select` when you want to be more selective about which state changes trigger a rebuild in your widget. It’s generally better to use `context.watch` when you need to react to changes in various parts of the state, and context.select when you only care about specific parts of the state. Choose the one that best fits your specific use case to improve performance and minimize unnecessary widget rebuilds.
Is there a way to get `cabal` to detect changes to non-Haskell source files?
|haskell|cabal|template-haskell|
Here's how you can do it: In your HTML template, bind the (keydown.enter) event to a function that handles the "Enter key" press: <!-- Assuming you have an input field --> <input type="text" (keydown.enter)="onEnterPressed($event)"> In your component TypeScript file, define the onEnterPressed function to handle the "Enter key" press event. Within this function, prevent the default behavior of changing focus and instead call your API: import { Component } from '@angular/core'; import { ApiService } from './api.service'; // Assuming you have an ApiService for making API calls @Component({ selector: 'app-your-component', templateUrl: './your-component.component.html', styleUrls: ['./your-component.component.css'] }) export class YourComponent { constructor(private apiService: ApiService) { } onEnterPressed(event: KeyboardEvent): void { event.preventDefault(); // Prevent the default behavior of changing focus // Call your API here this.apiService.callYourApi(); // Optionally, you can keep the focus on the current input field // If you want to change focus, you can programmatically do so // Example: event.target.blur(); // to remove focus from the current input } } With this implementation, when the "Enter key" is pressed on any input field, it will trigger the onEnterPressed function, preventing the default focus change behavior, and instead calling your API. You can further customize this behavior as per your requirements.
Is there a penalty to calling `with_column` many times in polars. Does it lead to dataframe "fragmenting"?
Do repeated calls to polars with_column cause fragmenting?
|python-polars|rust-polars|
|html|pdf|
{"Voters":[{"Id":724039,"DisplayName":"Luuk"},{"Id":5389997,"DisplayName":"Shadow"},{"Id":286934,"DisplayName":"Progman"}]}
I override the main branch by: `git push origin feature/create_ffmpeg_dockerfile` `git push -f -u origin feature/create_ffmpeg_dockerfile` my commite appear in the main branch how can I restore the main? I try this: `git rebase --abort` fatal: No rebase in progress and also this: `git revert <commit id>` error: Reverting is not possible because you have unmerged files. hint: Fix them up in the work tree, and then use 'git add/rm <file>' hint: as appropriate to mark resolution and make a commit. fatal: revert failed
How to fix overriding the main branch in Git?
|git|reset|rebase|git-revert|
null
You should first install portaudio through brew: brew install portaudio pip3 install pyaudio
I am trying to estimate a choice model between highspeed rail, conventional train, bus and car, using biogeme 2.3.12. When I run command biogeme = biogeme.BIOGEME (database, log prob), i got error like this: ``` KeyError Traceback (most recent call last) Cell In[33], line 2 1 import biogeme.biogeme ----> 2 biogeme = bio.BIOGEME(database,logprob) File F:\Anaconda\Lib\site-packages\biogeme\biogeme.py:240, in BIOGEME.__init__(self, database, formulas, userNotes, parameter_file, skip_audit, **kwargs) 237 self._prepareDatabaseForFormula() 239 if not self.skip_audit: --> 240 self._audit() 242 self.reset_id_manager() 244 self.theC = cb.pyBiogeme(self.id_manager.number_of_free_betas) File F:\Anaconda\Lib\site-packages\biogeme\biogeme.py:815, in BIOGEME._audit(self) 810 err_msg = ( 811 f"The following random variables are defined " 812 f"outside the Integrate operator: {check_rv}" 813 ) 814 list_of_errors.append(err_msg) --> 815 err, war = v.audit(self.database) 816 list_of_errors += err 817 list_of_warnings += war File F:\Anaconda\Lib\site-packages\biogeme\expressions\logit_expressions.py:123, in LogLogit.audit(self, database) 121 choices = np.array([self.choice.getValue_c()]) 122 else: --> 123 choices = database.valuesFromDatabase(self.choice) 124 correctChoices = np.isin(choices, listOfAlternatives) 125 indexOfIncorrectChoices = np.argwhere(~correctChoices) File F:\Anaconda\Lib\site-packages\biogeme\database.py:395, in Database.valuesFromDatabase(self, expression) 392 error_msg = 'Database has no entry' 393 raise excep.BiogemeError(error_msg) --> 395 return expression.getValue_c(database=self, prepareIds=True) File F:\Anaconda\Lib\site-packages\biogeme\expressions\base_expressions.py:829, in Expression.getValue_c(self, database, betas, numberOfDraws, aggregation, prepareIds) 823 error_msg = ( 824 "An expression involving MonteCarlo integration " 825 "must be associated with a database." 826 ) 827 raise excep.BiogemeError(error_msg) --> 829 f, _, _, _ = self.getValueAndDerivatives( 830 betas=betas, 831 database=database, 832 numberOfDraws=numberOfDraws, 833 gradient=False, 834 hessian=False, 835 bhhh=False, 836 aggregation=aggregation, 837 prepareIds=prepareIds, 838 ) 839 if database is None: 840 if len(f) != 1: File F:\Anaconda\Lib\site-packages\biogeme\expressions\base_expressions.py:974, in Expression.getValueAndDerivatives(self, betas, database, numberOfDraws, gradient, hessian, bhhh, aggregation, prepareIds) 970 # Now, if we had to set the IDS, we reset them as they cannot 971 # be used in another context. 972 if prepareIds: 973 # We restore the previous Id manager --> 974 self.setIdManager(self.keep_id_manager) 975 return results File F:\Anaconda\Lib\site-packages\biogeme\expressions\elementary_expressions.py:267, in Variable.setIdManager(self, id_manager) 265 self.variableId = None 266 return --> 267 self.elementaryIndex = self.id_manager.elementary_expressions.indices[self.name] 268 self.variableId = self.id_manager.variables.indices[self.name] KeyError: 'CHOICE' ``` I dont have any clue and i've tried everything but nothing works. I would be very thankful if you could help me