instruction
stringlengths
0
30k
Install version 33.1.24 of emulator using this instruction https://developer.android.com/studio/emulator_archive and the error in the device list will disappear. Maybe some other version will work.
So coming back to this the answer is no, but actually yes in a limited sense. The XML doesn't allow any data input, except complications and predefined inputs such as steps and moon phase. Basically you can make a complication as data channel. You only get 8 complications per watch face so you have to be sparing. The complication has to be in a separate app. The XML doesn't support text to number conversion so all numbers have to be sent in through a RangedValue as either a min, max or value. In the above question I managed to make a complication that calculates sun rise, set and position. Then uses some math slight of hand to sneak them into the watch face.
Get rid of all the `time.sleep()`s... they are a bad practice and slow down your script. Replace them with `WebDriverWait`. If you are going to click an element, wait for it to be clickable. wait = WebDriverWait(driver, 10) wait.until(EC.element_to_be_clickable(...)).click() If you are going to otherwise interact with an element, e.g. `.text` or `.send_keys()`, wait for it to be visible. wait.until(EC.visibility_of_element_located(...)).send_keys() For example, wait = WebDriverWait(driver, 10) wait.until(EC.visibility_of_element_located((By.XPATH, "//input[@name='text']"))).send_keys(self.username) For more info and examples, see [the docs](https://selenium-python.readthedocs.io/waits.html#explicit-waits). If you want even more speed and you are doing multiple tasks in one run, you can add parallelism and run each action as a separate thread. I'll leave that as an exercise for the reader because it's more involved and there are some risks if you don't know what you're doing. See [the docs](https://docs.python.org/3/library/multiprocessing.html) for more info.
I am getting this error when trying to run exaple code on my WeMos D1 Mini (Clone) Here is the code: I am not sure why this is happening, I have checked that the wiring is correct and this script does work with a Arduino. I am not sure if the error judt comes from it being an esp8266 as I am very new and just playing around with this thing ``` #include <TinyGPSPlus.h> #include <SoftwareSerial.h> /* This sample sketch demonstrates the normal use of a TinyGPSPlus (TinyGPSPlus) object. It requires the use of SoftwareSerial, and assumes that you have a 4800-baud serial GPS device hooked up on pins 4(rx) and 3(tx). */ static const int RXPin = 4, TXPin = 3; static const uint32_t GPSBaud = 4800; // The TinyGPSPlus object TinyGPSPlus gps; // The serial connection to the GPS device SoftwareSerial ss(RXPin, TXPin); void setup() { Serial.begin(115200); ss.begin(GPSBaud); } void loop() { // This sketch displays information every time a new sentence is correctly encoded. while (ss.available() > 0) { if (gps.encode(ss.read())) { displayInfo(); } } if (millis() > 5000 && gps.charsProcessed() < 10) { Serial.println(F("No GPS detected: check wiring.")); while(true); } } void displayInfo() { Serial.print(F("Location: ")); if (gps.location.isValid()) { Serial.print(gps.location.lat(), 6); Serial.print(F(",")); Serial.print(gps.location.lng(), 6); } else { Serial.print(F("INVALID")); } Serial.print(F(" Date/Time: ")); if (gps.date.isValid()) { Serial.print(gps.date.month()); Serial.print(F("/")); Serial.print(gps.date.day()); Serial.print(F("/")); Serial.print(gps.date.year()); } else { Serial.print(F("INVALID")); } Serial.print(F(" ")); if (gps.time.isValid()) { if (gps.time.hour() < 10) Serial.print(F("0")); Serial.print(gps.time.hour()); Serial.print(F(":")); if (gps.time.minute() < 10) Serial.print(F("0")); Serial.print(gps.time.minute()); Serial.print(F(":")); if (gps.time.second() < 10) Serial.print(F("0")); Serial.print(gps.time.second()); Serial.print(F(".")); if (gps.time.centisecond() < 10) Serial.print(F("0")); Serial.print(gps.time.centisecond()); } else { Serial.print(F("INVALID")); } Serial.println(); } ``` and here is the error: ``` --------------- CUT HERE FOR EXCEPTION DECODER --------------- Soft WDT reset Exception (4): epc1=0x402013a0 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000 >>>stack>>> ctx: cont sp: 3ffffe50 end: 3fffffd0 offset: 0160 3fffffb0: 00000000 00000000 3ffee6dc 40203378 <<<stack<<< --------------- CUT HERE FOR EXCEPTION DECODER --------------- ets Jan 8 2013,rst cause:2, boot mode:(3,6) load 0x4010f000, len 3424, room 16 tail 0 chksum 0x2e load 0x3fff20b8, len 40, room 8 ``` I have read some post before this and is leads me to believe the program is crashing somewhere
Statically computing an accurate C++ call graph is hard, because you need a precise language parser, correct name lookup, and a good points-to analyzer that honors the language semantics properly. Doxygen doesn't have any of these, I don't know why people claim to like it for C++; it is easy to construct a 10 line C++ example that Doxygen erroneously analyzes). You might be better off running a <a href="http://www.semanticdesigns.com/Products/Profilers">timing profiler which collects a call graph dynamically</a> (this describes ours) and simply exercise a lot of cases. Such profilers will show you the actual call graph exercised. EDIT: I suddenly remembered <a href="http://www.scitools.com">Understand for C++</a>, which claims to construct call graphs. I don't know what they use for a parser, or whether they do the detailed analysis right; I have very little specific experience with their product. My few encounters suggests it does not do points-to analysis. I am impressed by Schaub's answer, using Clang; I would expect Clang to have all the elements right.
{"Voters":[{"Id":1765658,"DisplayName":"F. Hauri - Give Up GitHub"},{"Id":1409374,"DisplayName":"rickhg12hs"},{"Id":9952196,"DisplayName":"Shawn"}]}
Single backtick is working in the browser or anywhere else with the combination Shift + ^ but in VSCode I am unable to type a single backtick, I need to do this combination twice & get 2 backticks and the cursor jumps to the right of the second backtick then when I try to go back with the left arrow key I get a special symbol as in the image; FS in a red square, I think some other key combination must be in conflict with the backtick. I'm using a Macbook with Swiss keyboard layout. I tried to assign commands which use Shift + ^ combination to another key combination without ^ but with no success[enter image description here](https://i.stack.imgur.com/hHoGi.png)
Cannot type single backtick in VSCode
|visual-studio-code|
null
when click matlab Registration(use the NFRI function),occur matlab has encountered an internal problem needs to close. [enter image description here][1] this is the error detail. ``` ------------------------------------------------------------------------ Access violation detected at Sun Mar 31 11:08:39 2024 ------------------------------------------------------------------------ Configuration: Crash Decoding : Disabled Default Encoding : GBK MATLAB Architecture: win64 MATLAB Root : E:\Matlab2013b\Mingchuan Matlab2013B\matlab2013 MATLAB Version : 8.2.0.701 (R2013b) Operating System : Microsoft Windows 8 Processor ID : x86 Family 175 Model 80 Stepping 0, AuthenticAMD Virtual Machine : Java 1.7.0_11-b21 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode Window System : Version 6.2 (Build 9200) Fault Count: 2 Abnormal termination: Illegal instruction Register State (from fault): RAX = 0000000096366000 RBX = 0000000096367000 RCX = 00000000043ef6b0 RDX = 0000000096797800 RSP = 00000000043ef4c0 RBP = 00000000043eff80 RSI = 00000000043eff88 RDI = 00000000043eff80 R8 = 0000000000000080 R9 = 0000000096367000 R10 = 0000000000000780 R11 = 0000000000000280 R12 = 0000000000000004 R13 = 0000000000000048 R14 = 0000000000000004 R15 = 0000000000000004 RIP = 00000001317805b2 EFL = 00010212 CS = 0033 FS = 0053 GS = 002b Stack Trace (from fault): [ 0] 0x00000001317805b2 E:\Matlab2013b\Mingchuan Matlab2013B\matlab2013\bin\win64\mkl.dll+24642994 xerbla+22640098 [ 1] 0x0000000130dbd484 E:\Matlab2013b\Mingchuan Matlab2013B\matlab2013\bin\win64\mkl.dll+14406788 xerbla+12403892 [ 2] 0x0000000130db2db8 E:\Matlab2013b\Mingchuan Matlab2013B\matlab2013\bin\win64\mkl.dll+14364088 xerbla+12361192 [ 3] 0x00000001300d10e5 E:\Matlab2013b\Mingchuan Matlab2013B\matlab2013\bin\win64\mkl.dll+00856293 mkl_cbwr_set+00472453 [ 4] 0x0000000130019d5a E:\Matlab2013b\Mingchuan Matlab2013B\matlab2013\bin\win64\mkl.dll+00105818 dgemm+00000362 [ 5] 0x000000005d0eac3b E:\Matlab2013b\Mingchuan Matlab2013B\matlab2013\bin\win64\libmwmathlinalg.dll+00437307 UMFPACK_ComplexLUFactor::extractFactors+00103211 [ 6] 0x000000005d0eb21d E:\Matlab2013b\Mingchuan Matlab2013B\matlab2013\bin\win64\libmwmathlinalg.dll+00438813 mfMatrixMult+00000125 [ 7] 0x000000005d0ecec3 E:\Matlab2013b\Mingchuan Matlab2013B\matlab2013\bin\win64\libmwmathlinalg.dll+00446147 mfMatrixMult+00007459 [ 8] 0x000000005d0ecfd6 E:\Matlab2013b\Mingchuan Matlab2013B\matlab2013\bin\win64\libmwmathlinalg.dll+00446422 mfMatrixMult+00007734 [ 9] 0x000000005d0ed1e3 E:\Matlab2013b\Mingchuan Matlab2013B\matlab2013\bin\win64\libmwmathlinalg.dll+00446947 mfMatrixMult+00008259 [ 10] 0x000000018000d7ff E:\Matlab2013b\Mingchuan Matlab2013B\matlab2013\bin\win64\m_dispatcher.dll+00055295 Mfh_file::dispatch_fh+00001167 [ 11] 0x000000018000ddb7 E:\Matlab2013b\Mingchuan Matlab2013B\matlab2013\bin\win64\m_dispatcher.dll+00056759 Mfunction_handle::dispatch+00000487 [ 12] 0x0000000011c268a7 E:\Matlab2013b\Mingchuan Matlab2013B\matlab2013\bin\win64\m_interpreter.dll+00420007 inFunctionHandleInterface::DestroyWorkspace+00242727 [ 13] 0x0000000011c29b38 E:\Matlab2013b\Mingchuan Matlab2013B\matlab2013\bin\win64\m_interpreter.dll+00432952 inFunctionHandleInterface::DestroyWorkspace+00255672 ``` 1、uninstall and reinstall,but also occur expect result: can run success [1]: https://i.stack.imgur.com/Qrhob.jpg
I had a similar issue in the past when working on my localhost database. The solution was to set the manual proxy configuration of the Android emulator. https://i.stack.imgur.com/WpX5I.png
I figured it out. I had to change the folder that this component was in. I had it in the same folder as the page. The `/src/app` folder had both `page.tsx` and `icon.tsx` I moved the `icon.tsx` to `/src/app/api/` and that resolved it. I feel silly for not realizing that but this page of the Next.js docs helped: https://nextjs.org/docs/app/building-your-application/routing/route-handlers#route-resolution
You can the use the `-backend-config="KEY=VALUE"` option when running `terraform init` (see [Partial configuration](https://developer.hashicorp.com/terraform/language/settings/backends/configuration#partial-configuration) for the correct syntax) As n alternative, you can use [terragrunt](https://terragrunt.gruntwork.io/) to automatically generate the remote backend for each environment. Consider the following backend: ```lang-hcl terraform { backend "local" { path = "foobar.tfstate" } } ``` I can change the `path` using the following command: ```bash terraform init -backend-config="path=./dev.tfstate" ENVIRONMENT="prod" terraform init -backend-config="path=./$ENVIRONMENT.tfstate" ``` This will generate a `prod.tfstate` in the local folder. Now, back to your code: ```lang-hcl terraform { backend "gcs" { bucket = "my-bucket" prefix = "" } } ``` I haven't tested this but I suppose you can do something like: ```lang-bash ENVIRONMENT="pre-prod" COUNTRY="Portugal" terraform init -backend-config="prefix=/tfstate/$ENVIRONMENT/$COUNTRY" ```
|python|pytorch|
{"Voters":[{"Id":600486,"DisplayName":"blurfus"},{"Id":560942,"DisplayName":"jnpdx"},{"Id":8565438,"DisplayName":"zabop"}],"SiteSpecificCloseReasonIds":[13]}
What's wrong with this HSQLDB syntax: ``` REGEXP_REPLACE(Title, '([0-9]{4})$') ``` The regular expression is intended to remove 4 gits in parentheses at the end of a string. Thanks for taking a look. I tried various escaping with no success. Apparently the curly braces are being intercepted by JDBC as an escape sequence of its own.
HSQLDB regular expression ssyntax
|hsqldb|
null
It works for me. I had exact same problem. HTML: <mat-calendar [selected]="selectedRangeValue" (selectedChange)="selectedChange($event)"> </mat-calendar> TS: import { Component, EventEmitter, Input, Output } from '@angular/core'; import { DateRange } from '@angular/material/datepicker'; @Component({ selector: 'inline-range-calendar', templateUrl: './inline-range-calendar.component.html', }) export class InlineRangeCalendarComponent { @Input() selectedRangeValue: DateRange<Date> | undefined; @Output() selectedRangeValueChange = new EventEmitter<DateRange<Date>>(); selectedChange(m: any) { if (!this.selectedRangeValue?.start || this.selectedRangeValue?.end) { this.selectedRangeValue = new DateRange<Date>(m, null); } else { const start = this.selectedRangeValue.start; const end = m; if (end < start) { this.selectedRangeValue = new DateRange<Date>(end, start); } else { this.selectedRangeValue = new DateRange<Date>(start, end); } } this.selectedRangeValueChange.emit(this.selectedRangeValue); } }
Soft WDT reset on Wemos D1 Mini
|arduino|
null
Here is an example to break a string into multiple lines in a @dataclass for use with QT style sheets. The end of each line need to be terminate in double quote followed by a slash. Indentation of the start of each line is also critical. `@dataclass class button_a: i: str = "QPushButton:hover {background: qradialgradient(cx:0, cy:0, radius:1,fx:0.5,fy:0.5,stop:0 white, stop:1 green);"\ "color:qradialgradient(cx:0, cy:0, radius:1,fx:0.5,fy:0.5,stop:0 yellow, stop:1 brown);"\ "border-color: purple;}" `
I am trying to send multiple images and data in the same observables. I was doing some research but all I found is about how to send a file. My API is ready to accept various files and data, I tested it with Postman ``` formData.set("IdUsuario", IdUsuario); formData.set("IdSucursal", IdSucursal); formData.set("IdMarca", IdMarca); formData.set("Estatus", Estatus); formData.set("Nombre", Nombre); formData.set("SKU", SKU); formData.set("Tipo", Tipo); formData.set("Costo", Costo); formData.set("Precio", Precio); formData.set("Descripcion", Descripcion); if(Array.isArray(params.images) && params.images.length !== 0){ params.images.forEach((image: any) => { formData.append("Imagenes", image); }); } return this.http.post(`${environment.server}producto/insertar`, formData); ``` [My API works very well](https://i.stack.imgur.com/W2ni5.png) I found that it's important to send de data and images with formData
How send multiples images and data in the same observable from Angular?
|angular|laravel|image|
null
I'm trying to understand your scenario, i.e. why do you need to cancel a job? In case you need to be able to choose which job(s) to run when you queue a new build you can: 1. use parameters to choose which job to run OR 1. create a separate stage for each job ## Running jobs in the same stage The trick is to add boolean pipeline parameters for each job type and select which jobs to run when queuing a new build: [![Pipeline with parameters][1]][1] Pipeline code: ```yaml name: test-pipeline-$(date:yyyyMMdd-HHmmss) parameters: - name: deployTerraform type: boolean displayName: 'Deploy Terraform?' default: true - name: deployAnsible type: boolean displayName: 'Deploy Ansible?' default: true trigger: none pool: Default stages: - stage: deploy_stuff displayName: 'Deploy stuff' dependsOn: [] jobs: - ${{ if parameters.deployAnsible }}: - job: deployAnsible displayName: 'Deploy Ansible' steps: - checkout: none - script: echo "Deploying Ansible" displayName: 'Deploy Ansible' - ${{ if parameters.deployTerraform }}: - job: deployTerraform displayName: 'Deploy Terraform' steps: - checkout: none - script: echo "Deploying Terraform" displayName: 'Deploy Terraform' ``` ## Running jobs in separate stages This is the simplest solution - you can decide which stages to run when queuing a new build: [![Queue pipeline][2]][2] [![Select stages to run][3]][3] Pipeline code: ```yaml name: test-pipeline-2-$(date:yyyyMMdd-HHmmss) trigger: none pool: Default stages: - stage: deploy_terraform displayName: 'Deploy Terraform' dependsOn: [] jobs: - job: deployTerraform displayName: 'Deploy Terraform' steps: - checkout: none - script: echo "Deploying Terraform" displayName: 'Deploy Terraform' - stage: deploy_ansible displayName: 'Deploy Ansible' dependsOn: deploy_terraform jobs: - job: deployAnsible displayName: 'Deploy Ansible' steps: - checkout: none - script: echo "Deploying Ansible" displayName: 'Deploy Ansible' ``` [1]: https://i.stack.imgur.com/eAWRb.png [2]: https://i.stack.imgur.com/MPmKL.png [3]: https://i.stack.imgur.com/gZTff.png
Android studio : Required type Fragment, provided : FragmentActivity
|java|android|xml|
null
Instead of using the CustomFormatter in the other answer, you can also pass a dictionary with default values to the formatter, starting with python 3.10: https://docs.python.org/3/library/logging.html#logging.Formatter logger = logging.getLogger(__name__) handler = logging.StreamHandler() formatter = logging.Formatter('{"message": "%(message)s", "user": "%(user)s"}', defaults={"user":""}) handler.setFormatter(formatter) logger.setLevel(logging.INFO) logger.addHandler(handler)
{"Voters":[{"Id":4108803,"DisplayName":"blackgreen"}]}
I am trying to open google maps in selenium webdriver using python and drag the map around but my current solution doesnt drag the map. My code opens a map in google maps using selenium Webdriver. I am attempting to drag this map by using `.click_and_hold()` followed by `.move_to_element_with_offset`. This is my code block for this part. ``` map = driver.find_element(By.ID, "app-container") ActionChains(driver)\ .click_and_hold(map)\ .move_to_element_with_offset(map, 500, 500)\ .perform() ``` I am taking a screenshot before and after this block to see if it works but sadly it doesnt seem to do so. I can see that the screen is being clicked because a pop-up on the top left of the screen disappears which does not happen if i remove this part of the code.
Not able to move a google maps map using move_to_element_with_offset() in selenium
|python|google-maps|selenium-webdriver|webdriver|
null
{"Voters":[{"Id":5577765,"DisplayName":"Rabbid76"},{"Id":16632281,"DisplayName":"Yun"},{"Id":44729,"DisplayName":"genpfault"}]}
{"Voters":[{"Id":197758,"DisplayName":"toolic"},{"Id":2766176,"DisplayName":"brian d foy"},{"Id":9014097,"DisplayName":"Topaco"}],"SiteSpecificCloseReasonIds":[13]}
I have a project, and the directory structure is: ``` . ├── bin ├── README.md ├── src │ ├── blocking_deque │ │ └── blocking_deque.hpp │ ├── buffer │ │ ├── buffer.cpp │ │ └── buffer.h │ ├── epoller │ │ ├── epoller.cpp │ │ └── epoller.h │ └── log │ ├── log.cpp │ └── log.h └── test ├── Makefile └── test_log.cpp ``` When I use `g++ -g test/test_log.cpp src/blocking_deque/blocking_deque.hpp src/buffer/buffer.cpp src/log/log.cpp -o ./a`, the compiler(specifically, it's the linker) informs me that **undefined reference to `some function`**. The detail is shown below: ``` /usr/bin/ld: /tmp/cc3lAVRd.o: in function `test_log()': /home/fansuregrin/workshop/my_http_server/test/test_log.cpp:18: undefined reference to `Log::is_open()' /usr/bin/ld: /home/fansuregrin/workshop/my_http_server/test/test_log.cpp:28: undefined reference to `Log::is_open()' /usr/bin/ld: /tmp/ccnM4HDs.o: in function `Log::write(int, char const*, ...)': /home/fansuregrin/workshop/my_http_server/src/log/log.cpp:167: undefined reference to `Buffer::has_written(unsigned long)' collect2: error: ld returned 1 exit status ``` However, the `Log::is_open()` is defined in `src/log/log.cpp`, the `Buffer::has_written(unsigned long)` is defined in `src/buffer/buffer.cpp`. Why it can't be compiled?
ircular dependency between the following tasks: :app:processDebugResources \--- :app:processDebugResources (*) * Try: > Run with --info or --debug option to get more log output. > Run with --scan to get full insights. > Get more help at https://help.gradle.org. * Exception is: org.gradle.api.CircularReferenceException: Circular dependency between the following tasks: :app:processDebugResources \--- :app:processDebugResources (*) (*) - details omitted (listed previously) at org.gradle.execution.plan.DetermineExecutionPlanAction.onOrderingCycle(DetermineExecutionPlanAction.java:295) at org.gradle.execution.plan.DetermineExecutionPlanAction.processNodeQueue(DetermineExecutionPlanAction.java:187) at org.gradle.execution.plan.DetermineExecutionPlanAction.run(DetermineExecutionPlanAction.java:93) at org.gradle.execution.plan.DefaultExecutionPlan.determineExecutionPlan(DefaultExecutionPlan.java:223) at org.gradle.internal.build.DefaultBuildWorkPreparer.populateWorkGraph(DefaultBuildWorkPreparer.java:43) at org.gradle.internal.build.BuildOperationFiringBuildWorkPreparer$PopulateWorkGraph.populateTaskGraph(BuildOperationFiringBuildWorkPreparer.java:106) at org.gradle.internal.build.BuildOperationFiringBuildWorkPreparer$PopulateWorkGraph.run(BuildOperationFiringBuildWorkPreparer.java:92) at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:29) at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:26) at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66) at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59) at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157) at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59) at org.gradle.internal.operations.DefaultBuildOperationRunner.run(DefaultBuildOperationRunner.java:47) at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:68) at org.gradle.internal.build.BuildOperationFiringBuildWorkPreparer.populateWorkGraph(BuildOperationFiringBuildWorkPreparer.java:67) at org.gradle.internal.build.DefaultBuildLifecycleController.lambda$populateWorkGraph$8(DefaultBuildLifecycleController.java:189) at org.gradle.internal.model.StateTransitionController.lambda$inState$1(StateTransitionController.java:99) at org.gradle.internal.model.StateTransitionController.lambda$inState$2(StateTransitionController.java:114) at org.gradle.internal.work.DefaultSynchronizer.withLock(DefaultSynchronizer.java:44) at org.gradle.internal.model.StateTransitionController.inState(StateTransitionController.java:110) at org.gradle.internal.model.StateTransitionController.inState(StateTransitionController.java:98) at org.gradle.internal.build.DefaultBuildLifecycleController.populateWorkGraph(DefaultBuildLifecycleController.java:189) at org.gradle.internal.build.DefaultBuildWorkGraphController$DefaultBuildWorkGraph.populateWorkGraph(DefaultBuildWorkGraphController.java:169) at org.gradle.composite.internal.DefaultBuildController.populateWorkGraph(DefaultBuildController.java:76) at org.gradle.composite.internal.DefaultIncludedBuildTaskGraph$DefaultBuildTreeWorkGraphBuilder.withWorkGraph(DefaultIncludedBuildTaskGraph.java:153) at org.gradle.internal.buildtree.DefaultBuildTreeWorkPreparer.lambda$scheduleRequestedTasks$1(DefaultBuildTreeWorkPreparer.java:41) at org.gradle.composite.internal.DefaultIncludedBuildTaskGraph$DefaultBuildTreeWorkGraph$1.run(DefaultIncludedBuildTaskGraph.java:209) at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:29) at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:26) at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66) at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59) at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157) at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59) at org.gradle.internal.operations.DefaultBuildOperationRunner.run(DefaultBuildOperationRunner.java:47) at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:68) at org.gradle.composite.internal.DefaultIncludedBuildTaskGraph$DefaultBuildTreeWorkGraph.scheduleWork(DefaultIncludedBuildTaskGraph.java:204) at org.gradle.internal.buildtree.DefaultBuildTreeWorkPreparer.scheduleRequestedTasks(DefaultBuildTreeWorkPreparer.java:37) at org.gradle.configurationcache.VintageBuildTreeWorkController$scheduleAndRunRequestedTasks$1.apply(VintageBuildTreeWorkController.kt:36) at org.gradle.configurationcache.VintageBuildTreeWorkController$scheduleAndRunRequestedTasks$1.apply(VintageBuildTreeWorkController.kt:35) at org.gradle.composite.internal.DefaultIncludedBuildTaskGraph.withNewWorkGraph(DefaultIncludedBuildTaskGraph.java:112) at org.gradle.configurationcache.VintageBuildTreeWorkController.scheduleAndRunRequestedTasks(VintageBuildTreeWorkController.kt:35) at org.gradle.internal.buildtree.DefaultBuildTreeLifecycleController.lambda$scheduleAndRunTasks$1(DefaultBuildTreeLifecycleController.java:77) at org.gradle.internal.buildtree.DefaultBuildTreeLifecycleController.lambda$runBuild$4(DefaultBuildTreeLifecycleController.java:120) at org.gradle.internal.model.StateTransitionController.lambda$transition$6(StateTransitionController.java:169) at org.gradle.internal.model.StateTransitionController.doTransition(StateTransitionController.java:266) at org.gradle.internal.model.StateTransitionController.lambda$transition$7(StateTransitionController.java:169) at org.gradle.internal.work.DefaultSynchronizer.withLock(DefaultSynchronizer.java:44) at org.gradle.internal.model.StateTransitionController.transition(StateTransitionController.java:169) at org.gradle.internal.buildtree.DefaultBuildTreeLifecycleController.runBuild(DefaultBuildTreeLifecycleController.java:117) at org.gradle.internal.buildtree.DefaultBuildTreeLifecycleController.scheduleAndRunTasks(DefaultBuildTreeLifecycleController.java:77) at org.gradle.internal.buildtree.DefaultBuildTreeLifecycleController.scheduleAndRunTasks(DefaultBuildTreeLifecycleController.java:72) at org.gradle.tooling.internal.provider.runner.BuildModelActionRunner.run(BuildModelActionRunner.java:53) at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35) at org.gradle.internal.buildtree.ProblemReportingBuildActionRunner.run(ProblemReportingBuildActionRunner.java:49) at org.gradle.launcher.exec.BuildOutcomeReportingBuildActionRunner.run(BuildOutcomeReportingBuildActionRunner.java:65) at org.gradle.tooling.internal.provider.FileSystemWatchingBuildActionRunner.run(FileSystemWatchingBuildActionRunner.java:140) at org.gradle.launcher.exec.BuildCompletionNotifyingBuildActionRunner.run(BuildCompletionNotifyingBuildActionRunner.java:41) at org.gradle.launcher.exec.RootBuildLifecycleBuildActionExecutor.lambda$execute$0(RootBuildLifecycleBuildActionExecutor.java:40) at org.gradle.composite.internal.DefaultRootBuildState.run(DefaultRootBuildState.java:123) at org.gradle.launcher.exec.RootBuildLifecycleBuildActionExecutor.execute(RootBuildLifecycleBuildActionExecutor.java:40) at org.gradle.internal.buildtree.InitDeprecationLoggingActionExecutor.execute(InitDeprecationLoggingActionExecutor.java:66) at org.gradle.internal.buildtree.InitProblems.execute(InitProblems.java:36) at org.gradle.internal.buildtree.DefaultBuildTreeContext.execute(DefaultBuildTreeContext.java:40) at org.gradle.launcher.exec.BuildTreeLifecycleBuildActionExecutor.lambda$execute$0(BuildTreeLifecycleBuildActionExecutor.java:71) at org.gradle.internal.buildtree.BuildTreeState.run(BuildTreeState.java:60) at org.gradle.launcher.exec.BuildTreeLifecycleBuildActionExecutor.execute(BuildTreeLifecycleBuildActionExecutor.java:71) at org.gradle.launcher.exec.RunAsBuildOperationBuildActionExecutor$3.call(RunAsBuildOperationBuildActionExecutor.java:61) at org.gradle.launcher.exec.RunAsBuildOperationBuildActionExecutor$3.call(RunAsBuildOperationBuildActionExecutor.java:57) at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:200) at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:195) at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66) at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59) at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157) at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59) at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:53) at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:73) at org.gradle.launcher.exec.RunAsBuildOperationBuildActionExecutor.execute(RunAsBuildOperationBuildActionExecutor.java:57) at org.gradle.launcher.exec.RunAsWorkerThreadBuildActionExecutor.lambda$execute$0(RunAsWorkerThreadBuildActionExecutor.java:36) at org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:264) at org.gradle.internal.work.DefaultWorkerLeaseService.runAsWorkerThread(DefaultWorkerLeaseService.java:128) at org.gradle.launcher.exec.RunAsWorkerThreadBuildActionExecutor.execute(RunAsWorkerThreadBuildActionExecutor.java:36) at org.gradle.tooling.internal.provider.continuous.ContinuousBuildActionExecutor.execute(ContinuousBuildActionExecutor.java:110) at org.gradle.tooling.internal.provider.SubscribableBuildActionExecutor.execute(SubscribableBuildActionExecutor.java:64) at org.gradle.internal.session.DefaultBuildSessionContext.execute(DefaultBuildSessionContext.java:46) at org.gradle.tooling.internal.provider.BuildSessionLifecycleBuildActionExecuter$ActionImpl.apply(BuildSessionLifecycleBuildActionExecuter.java:92) at org.gradle.tooling.internal.provider.BuildSessionLifecycleBuildActionExecuter$ActionImpl.apply(BuildSessionLifecycleBuildActionExecuter.java:80) at org.gradle.internal.session.BuildSessionState.run(BuildSessionState.java:71) at org.gradle.tooling.internal.provider.BuildSessionLifecycleBuildActionExecuter.execute(BuildSessionLifecycleBuildActionExecuter.java:62) at org.gradle.tooling.internal.provider.BuildSessionLifecycleBuildActionExecuter.execute(BuildSessionLifecycleBuildActionExecuter.java:41) at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:64) at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:32) at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:51) at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:39) at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:47) at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:31) at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:65) at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:37) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104) at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:39) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104) at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:29) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104) at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:35) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104) at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.create(ForwardClientInput.java:78) at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.create(ForwardClientInput.java:75) at org.gradle.util.internal.Swapper.swap(Swapper.java:38) at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:75) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104) at org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:64) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104) at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:63) at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:37) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104) at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:84) at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:37) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104) at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:52) at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:297) at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64) at org.gradle.internal.concurrent.AbstractManagedExecutor$1.run(AbstractManagedExecutor.java:47)
circular dependency between items. :app.progressDebugResources
|circular-dependency|
null
``` import csv def addr(): with open('csvfile.csv','a',newline='') as f: w=csv.writer(f,delimiter=',') tid=int(input('Teacher ID: ')) nm=input('Enter Name: ') mo=int(input('Mobile Number: ')) w.writerow(tid,nm,mo) def countr(): with open('csvfile.csv') as f: c=csv.rowcount print('Number of records:',c) while True: addr() if input('Do you Wish to Continue(Y/N): ').lower() in ('n','no'): break ``` [enter image description here](https://i.stack.imgur.com/cpfdW.png) it showed no error when i tried to use the normal file.write()
Its showing me error when i try to use csv.writer() in python claiming that the writer function does not exist in csv module what should i do
|csv|csvwriter|
null
Below you can find (the relevant excerpt of) my "server-side" FastAPI code. ```python from fastapi import FastAPI, UploadFile, HTTPException from fastapi.responses import FileResponse, HTMLResponse, StreamingResponse from pydantic import BaseModel qh = os.getenv('QDRANTHOST','qdrant') qc = os.getenv('QDRANTCOLL','documents') class QdrantQuery(BaseModel): query: str host: str | None = qh collection: str | None = qc def execute(question: str, host: str, collection: str): index = qdrant_index(qdranthost=host,collection=collection) query_engine = index.as_query_engine(similarity_top_k=int(similarity),response_mode=responsemode) return query_engine.query(question) @app.post("/query") async def query(input: QdrantQuery ): question = input.query host = input.host collection = input.collection result = execute(question,host,collection) return result ``` When I call this code from a BASH shell, with this command line: ```bash curl -H 'content-type: application/json' -d '{"query": "Chi è Blair Clarimonde?","collection": "documents"}' http://localhost:9999/query ``` It works perfectly. However, when calling from within a Streamlit frontend, through **requests** module... I keep getting 422 error codes ```python queryurl = f"http://dctvllm01.upgrade.lan:9999/query" headers={"Content-type": "application/json"} a = {"question": "Chi è Blair Clarimonde?","collection": "documents"} b = json.dumps(a) r = requests.post(url=queryurl,data=b, headers=headers) print(r.text) ``` Error detail: ``` {"detail":[{"type":"missing","loc":["body","query"],"msg":"Field required","input":{"question":"Chi è Blair Clarimonde?","collection":"documents"},"url":"https://errors.pydantic.dev/2.6/v/missing"}]} ``` Could someone point out the fault in my "client-side" code? Thanks.
I can't call a FastAPI POST route using Python's "requests" module, but I'm able to call the same route via cURL command line
|python|python-requests|fastapi|
null
I have problem with "ModuleNotFoundError" in my Django app. This problem start when i write serializers.py and other files in my app. All code you see it in my [Github](https://github.com/BMWdejf/Django_address_book) This code is without syntax errors because I use PyCharm IDE. When I start server I get this error: [PyCharm IDE with terminal after run python server](https://i.stack.imgur.com/d5YO8.png) I would appreciate any comments on where I made a mistake. I expect my code to work correctly.
I'm new to Unity and C# in general, just started using them less than a month ago so I can make a school project. A little background about my project, I'm making a maths game, the specific problem I'm working on is related to taking in the answer of a question through an input box. Since it's maths, each question has only one specific answer, so I thought I could use a regular conditional statement to compare the stored value of the answer with the user's input, that much is fine. My problem is that I'm considering if someone puts in an input, they'll leave white space at the start or the end or in the middle of the text (for example, if writing a fraction they could write it as "3 / 4" or " 3/4"), and if my statement compares the stored value with their input, it'll say their answer is wrong because there's some white space so it's not the exact same. I'm aware of the Trim() method in C# but as far as I'm aware it only removes leading and trailing white spaces, nothing in between. Is there an in-built method that allows me to remove white space between characters as well, or is there a way I can do that myself? Thank you very much in advance!
How to remove white space in a user's input through an input field in Unity?
|c#|unity-game-engine|
null
{"Voters":[{"Id":9504406,"DisplayName":"emeraldsanto"},{"Id":7733418,"DisplayName":"Yunnosch"},{"Id":6296561,"DisplayName":"Zoe is on strike"}]}
|python|development-environment|jax|
You were pretty close, the last iteration of your template needs to be updated to be: ``` {% if projects %} {% for x in projects %} {{ x.project_number }} | {{ x.project_name }} | {% for y in x.buildingtypes.all %} {{ y.buildingtype }} {% endfor %} {% endfor %} {% endif %} ``` It does access the `all()` method of m2m relation loading the values for you which you can iterate over. if you want to read more about it: https://docs.djangoproject.com/en/5.0/ref/templates/language/#accessing-method-calls
{"Voters":[{"Id":5228202,"DisplayName":"Cfun"}],"DeleteType":1}
I am building a RAG-based ChatPDF application. The user can enter the PDF to generate the embeddings for, the embeddings are stored in a vector database (I am using Chromadb). Now all the basic chat functionality is working all fine along with the basic chat. The user asks questions and the model can remember the context all fine. But, it does as long as the user is in the current session. As soon as the session is closed, the model does not remember anything. I am using MongoDB for storing chat messages. The chat messages are being stored all fine in the database. But the model somehow does not remember previous context once the session is closed and restarted. All I want is someway for the user to navigate back to the previous chats (much like ChatGPT) and that the model should remember what is being talked about in that particular window. **EDITED**: I am sharing the entire script (the minimum runnable as per requested). This is actually an API so I will share the code accordingly. ```python import os import shutil from datetime import datetime from dotenv import dotenv_values from collections import namedtuple import uuid from fastapi import File, UploadFile, APIRouter, Form, status from langchain_openai import ChatOpenAI, OpenAIEmbeddings from langchain_community.document_loaders import PyPDFLoader from langchain.text_splitter import CharacterTextSplitter from langchain_community.vectorstores import Chroma from langchain.chains import ConversationalRetrievalChain, RetrievalQA, LLMChain from langchain.chains.question_answering import load_qa_chain from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder from langchain.prompts import PromptTemplate from langchain_mongodb import MongoDBChatMessageHistory import chromadb from chromadb.utils import embedding_functions config = dotenv_values(".env") chat_router = APIRouter() Constants = namedtuple('Constants', ['OPEN_API_KEY', 'EMBEDDINGS_MODEL', 'CHAT_MODEL', 'MONGO_CONNECTION_STRING']) configs = Constants(config["OPENAI_API_KEY"], config["EMBEDDINGS_MODEL"], config["CHAT_MODEL"], config['MONGO_CONNECTION_STRING']) @chat_router.post("/trainpdf/", status_code=status.HTTP_201_CREATED) async def create_upload_file(user_id: str = Form(...), pdf_file: UploadFile = File(...)): if not pdf_file.filename.endswith(".pdf"): return {"code": "400", "answer": "Only PDF files are allowed."} client = chromadb.PersistentClient(path="./trained_db") collection = client.get_or_create_collection("PDF_Embeddings") vectordb = Chroma(persist_directory="./trained_db", collection_name = collection.name, client = client) if check_for_existing_embeddings(pdf_file.filename, vectordb): return {"code": "400", "answer": "PDF EMBEDDINGS HAVE ALREADY BEEN GENERATED FOR THIS FILE. PLEASE PROVIDE A NEW FILE."} pdf_folder_path = f"Training_Data" os.makedirs(pdf_folder_path, exist_ok=True) file_path = os.path.join(pdf_folder_path, pdf_file.filename) with open(file_path, "wb") as temp_dest_file: temp_dest_file.write(await pdf_file.read()) docs = read_docs(file_path, user_id) vectordb = generate_and_store_embeddings(docs, pdf_file, user_id) shutil.rmtree(pdf_folder_path, ignore_errors=True) if vectordb is None: return {"code": "400", "answer": "Error Occurred during Data Extraction from Pdf."} return {"code": "201", "answer": "PDF EMBEDDINGS GENERATED SUCCESSFULLY"} @chat_router.post("/chatpdf/", status_code=status.HTTP_200_OK) async def pdf_chat(query_params: dict): user_id: str = query_params.get('user_id') query: str = query_params.get('query') session_id: str = user_id + "-" + datetime.now().strftime("%d/%m/%Y") embeddings = OpenAIEmbeddings(openai_api_key=configs.OPEN_API_KEY) client = chromadb.PersistentClient(path="./trained_db") collection = client.get_or_create_collection("PDF_Embeddings", embedding_function=embedding_functions.OpenAIEmbeddingFunction(api_key=config["OPENAI_API_KEY"], model_name=configs.EMBEDDINGS_MODEL)) vectordb = Chroma(persist_directory="./trained_db", embedding_function=embeddings, collection_name = collection.name) """Retrieve the documents relevant to the query and generate the response.""" retriever = vectordb.as_retriever(search_type="mmr") relevant_docs = retriever.get_relevant_documents(query) user_specific_chat_memory = get_message_history(session_id) """Now I am going about adding chat history into two ways. Both have their share of problems. 1. Adding chat history to the prompt template. This method takes in chat history as context. But it returns the error: ValueError: Missing some input keys: {'context'} Note that the error is returned once the user asks a second question after the chat model responds to the first one. """ prompt_template = f"""You are engaged in conversation with a human, your responses will be generated using a comprehensive long document as a contextual reference. You can summarize long documents and also provide comprehensive answers, depending on what the user has asked. You also take context in consideration and answer based on chat history. Chat History: {{context}} Question: {{question}} Answer : """ PROMPT = PromptTemplate(template=prompt_template, input_variables=["context", "question"]) model = configs.CHAT_MODEL streaming_llm = ChatOpenAI(openai_api_key=configs.OPEN_API_KEY, model = model, temperature = 0.1, streaming=True) # use the streaming LLM to create a question answering chain qa_chain = load_qa_chain( llm=streaming_llm, chain_type="stuff", prompt=PROMPT ) question_generator_chain = LLMChain(llm=streaming_llm, prompt=PROMPT) qa_chain_with_history = ConversationalRetrievalChain( retriever = vectordb.as_retriever(search_kwargs={'k': 3}, search_type='mmr'), combine_docs_chain=qa_chain, question_generator=question_generator_chain ) response = qa_chain_with_history( {"question": query, "chat_history": user_specific_chat_memory.messages} ) user_specific_chat_memory.add_user_message(response["question"]) user_specific_chat_memory.add_ai_message(response["answer"]) #return {"code": "200", "answer": response["answer"]} """2. Adding chat history to the memory. This saves the memory in a buffer which is passed to the retrieval chain. But it forgets the entire context of the conversation once the session restarts (even though messages are being added to MongoDB). """ memory = ConversationBufferMemory( memory_key="chat_history", chat_memory=user_specific_chat_memory, output_key="answer", return_messages=True ) qa_chain_with_history = ConversationalRetrievalChain.from_llm( ChatOpenAI(openai_api_key = config["OPENAI_API_KEY"], model_name = model, temperature = 0.1), retriever = vectordb.as_retriever(search_kwargs={'k': 3}, search_type='mmr'), memory = memory, chain_type="stuff" ) result = qa_chain_with_history.invoke({'question': query}) user_specific_chat_memory.add_user_message(result["question"]) user_specific_chat_memory.add_ai_message(result["answer"]) return {"code": "200", "answer": result["answer"]} def read_docs(pdf_file, user_id: str): pdf_loader = PyPDFLoader(pdf_file) pdf_documents = pdf_loader.load() text_splitter = CharacterTextSplitter(chunk_size=1000, chunk_overlap=200) documents = text_splitter.split_documents(pdf_documents) now = datetime.now() for doc in documents: doc.metadata = { "user": user_id, "id": str(uuid.uuid4()), "source": pdf_file.split("\\")[-1], 'created_at': now.strftime("%d/%m/%Y %H:%M:%S") } return documents def generate_and_store_embeddings(documents, pdf_file, user_id): client = chromadb.PersistentClient(path="./trained_db") collection = client.get_or_create_collection("PDF_Embeddings", embedding_function=embedding_functions.OpenAIEmbeddingFunction(api_key=config["OPENAI_API_KEY"], model_name=configs.EMBEDDINGS_MODEL)) try: vectordb = Chroma.from_documents( documents, embedding=OpenAIEmbeddings(openai_api_key=config["OPENAI_API_KEY"], model=configs.EMBEDDINGS_MODEL), persist_directory='./trained_db', collection_name = collection.name, client = client ) vectordb.persist() data_associated_with_ids = vectordb.get(where={"source": pdf_file.filename}) except Exception as err: return None return vectordb def check_for_existing_embeddings(pdf_filename, vectordb): doc_metadatas: list = vectordb.get(include=['metadatas'])['metadatas'] results = [doc['source'].split("\\")[-1] for doc in doc_metadatas] if pdf_filename in list(set(results)): return True def get_message_history(session_id: str) -> MongoDBChatMessageHistory: return MongoDBChatMessageHistory(connection_string=configs.MONGO_CONNECTION_STRING, session_id=session_id, collection_name="Chat_History") ``` As mentioned in the pdf_chat function, there are two ways that I tried to incorporate chat history. The second method forgets the context after the session restarts (even for the same user) and the first method returns the error when the user follows up the model's _first_ response with more queries (not on user's first question to the model). I will be quite satisfied if either of them works and remembers what the chat was about prior to the termination of the session, with date information of the particular conversation (i.e. somewhat mimics ChatGPT). >ValueError: Missing some input keys: {'context'}
Use the scapy library in python to read the file captured by wireshark and then rewrite it into a new pacp file. After opening it again with wireshark, some fields cannot be displayed. This is code written in python from scapy.all import * PKT_List = [] pkts = rdpcap("E:\test.pcap") for pkt in pkts: PKT_List.append(pkt) wrpcap("E:\output.pcap", pkts) The first picture below is the original data packet, and the second picture is the data packet processed by python and then opened with wireshark. [enter image description here](https://i.stack.imgur.com/G4xkd.png) [enter image description here](https://i.stack.imgur.com/RMEw6.png)
Python uses the scapy library to read the wireshark packet capture file and then writes a new file and it cannot be displayed
|python|wireshark|scapy|
null
|c++|codeblocks|access-denied|
I am working on a little project and I have came across an error when I try to run snort. I went into snort.conf and changed my HOME_NET ip address to the address of the virtual machine since it will be acting as a DHCP server and I want to monitor traffic coming into it. I also commented out all snort rule files that were pre-added. I wanted the only rules used to be my snort local.rules file. In this file I wrote a log, alert, and drop rule. I verified that my snort.conf was accurate by validating it with a test but when i go to actually run snort, I am presented with the error "Cannot decode data link type 113". I am not sure what the solution is. I checked around on google but could not find any solutions.
Snort Error Cannot decode data link type 113
|rules|snort|ids|ips|
null
This code compiles and runs and works fine as a hash for an array of ints : def hashValue(a: List[int]) -> int: return tuple(a) But I don't understand what's going on under the hood. Does py maintain an internal hash of the immutable tuple ?
How can py tuple implicit cast to int?
|python|hash|tuples|
i implemented chatbot in dart ... my issue which is i have many lists like greeting list , bye list and so on when the use enter the question , the response will be only for the longest key for example : greeting list has [ hello ] --> return Hello how can i help you bye list has [ Good Bye ] --> return see you later if the user input was : Hello good bye the expected output : Hello how can i help you see you later but the result was ' see you later ' i wanna it work as the expected the chatbot i implemented depends on similarity between input and keys ``` import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; import 'package:flutterapp/screens/home_screen.dart'; import 'package:flutterapp/screens/search_screen.dart'; import 'package:flutterapp/screens/task_manager.dart'; import 'package:google_nav_bar/google_nav_bar.dart'; import 'package:google_fonts/google_fonts.dart'; import '../widgets/widgets.dart'; import 'chats_screen.dart'; import 'package:string_similarity/string_similarity.dart'; List<String> Letters =['\0','\0','\0']; class chatbot_Screen extends StatefulWidget { final int selectedIndex; const chatbot_Screen({Key? key, required this.selectedIndex}) : super(key: key); @override State<chatbot_Screen> createState() => _chatbot_ScreenState(selectedIndex); } class _chatbot_ScreenState extends State<chatbot_Screen> { _chatbot_ScreenState(this._selectedIndex); int _selectedIndex = 2; final List<String> _messages = []; final TextEditingController _controller = TextEditingController(); void _handleSubmitted(String text) { _controller.clear(); setState(() { _messages.add("You \n$text"); _messages.add("Bot \n${_getResponse(text)}"); }); } String? greetingList(String userText) { List<String> greetings = [ 'hello', 'hi', 'hey', 'howdy', 'hi there', 'hello there', 'greetings', 'good morning', 'good afternoon', 'good evening', 'hey there', 'yo', 'hiya', 'what\'s up', 'how\'s it going', 'nice to see you', 'how are you', 'how do you do', 'what\'s new', 'what\'s happening', 'sup', 'hola', 'bonjour', 'ciao', 'namaste', 'hallo', 'salutations', 'top of the morning to you', 'how are things', 'pleased to meet you', 'how\'s everything', 'what\'s cracking', 'what\'s good', 'how are you doing', 'good to see you', 'long time no see', 'how have you been', 'what\'s the news', 'how\'s your day', 'howdy-do', 'g\'day mate', 'hi-ya', 'how goes it', 'good day', 'what\'s popping', 'what\'s the craic', 'what\'s cooking', 'good to meet you', 'how\'s life', 'hi-ho', 'well hello there', 'what\'s the buzz', 'hi-de-ho', 'hi-ya', 'hi there, partner', 'how\'s your day going', 'what\'s the good word', 'what\'s shakin\'', 'what\'s happening', 'how\'s your morning', 'what\'s new with you', 'greetings and salutations', 'what\'s the latest', 'what\'s been happening', 'how are things going', 'how are you keeping', 'how\'s tricks', 'how\'s your day been', 'how goes the battle', 'how goes the day', 'how goes your day', 'how do you do', 'how\'s your afternoon', 'what\'s the news', 'how\'s your evening', 'good morning to you', 'how\'s it hanging', 'what\'s new with you', 'how\'s your day been', 'how are things with you', 'how do you fare', 'how\'s your afternoon been', 'how have you been doing', 'how\'s your day treating you', 'what\'s been going on', ]; // Define the target phrases for other responses // Initialize variables to keep track of the maximum similarity and the best matching phrase double maxSimilarity = 0; // to count the similarity of the user input and keys String bestPhrase = ''; // the key has the most maxSimilarity it's gonna be ourphrase // Iterate through the list of greetings and find the one with the highest similarity for (String greeting in greetings) { //for i=0 , greeting[i] != null, i++ double similarity = userText.similarityTo( greeting); //compareTwoString(str1,str2) //and value between 0 to 1 if (similarity > maxSimilarity) { //find the maximum similarity of the list maxSimilarity = similarity; bestPhrase = greeting; //the phrase needed assigned to variable bestPhrase } } // Iterate through the list of other phrases and find the one with the highest similarity // Set a threshold for similarity score double threshold = 0.5; // Adjust as needed // If the best matching phrase has a similarity score above the threshold, respond accordingly if (maxSimilarity >= threshold) { Letters[0]='g'; if (bestPhrase == 'hello' || bestPhrase == 'hi') { return 'Hello there! How can I help you today?'; } else if (bestPhrase == 'hey') { return 'Hey! What can I do for you?'; } else if (bestPhrase == 'howdy') { return 'Howdy! How can I assist you?'; } else if (bestPhrase == 'hi there') { return 'Hi there! How may I assist you?'; } else if (bestPhrase == 'hello there') { return 'Hello there! How can I assist you today?'; } else if (bestPhrase == 'greetings') { return 'Greetings! How can I assist you today?'; } else if (bestPhrase == 'good morning') { return 'Good morning! How may I help you?'; } else if (bestPhrase == 'good afternoon') { return 'Good afternoon! How can I assist you today?'; } else if (bestPhrase == 'good evening') { return 'Good evening! How may I assist you?'; } else if (bestPhrase == 'hey there') { return 'Hey there! How can I help you today?'; } else if (bestPhrase == 'yo') { return 'Yo! How can I assist you?'; } else if (bestPhrase == 'hiya') { return 'Hiya! How may I help you?'; } else if (bestPhrase == 'what\'s up') { return 'Hey! What\'s up?'; } else if (bestPhrase == 'how\'s it going') { return 'Hey! How\'s it going?'; } else if (bestPhrase == 'nice to see you') { return 'Nice to see you too! What can I assist you with?'; } else if (bestPhrase == 'how are you') { return 'I\'m just a bot, but thanks for asking!'; } else if (bestPhrase == 'how do you do') { return 'How do you do? How can I assist you today?'; } else if (bestPhrase == 'what\'s new') { return 'Not much, just here to assist you. How about you?'; } else if (bestPhrase == 'what\'s happening') { return 'Not much, just here to assist you. How about you?'; } else if (bestPhrase == 'sup') { return 'Sup! How can I assist you today?'; } else if (bestPhrase == 'hola') { return 'Hola! How can I assist you today?'; } else if (bestPhrase == 'bonjour') { return 'Bonjour! How can I assist you today?'; } else if (bestPhrase == 'ciao') { return 'Ciao! How may I assist you?'; } else if (bestPhrase == 'namaste') { return 'Namaste! How can I help you today?'; } else if (bestPhrase == 'hallo') { return 'Hallo! How may I assist you?'; } else if (bestPhrase == 'salutations') { return 'Salutations! How can I assist you today?'; } else if (bestPhrase == 'top of the morning to you') { return 'Top of the morning to you! How can I help you today?'; } else if (bestPhrase == 'how are things') { return 'How are things with you? How can I assist you today?'; } else if (bestPhrase == 'pleased to meet you') { return 'Pleased to meet you too! What can I assist you with?'; } else if (bestPhrase == 'how\'s everything') { return 'How\'s everything going? How can I assist you today?'; } else if (bestPhrase == 'what\'s cracking') { return 'Not much, just here to assist you. How about you?'; } else if (bestPhrase == 'what\'s good') { return 'Not much, just here to assist you. How about you?'; } else if (bestPhrase == 'how are you doing') { return 'I\'m just a bot, but thanks for asking!'; } else if (bestPhrase == 'good to see you') { return 'Good to see you too! What can I assist you with?'; } else if (bestPhrase == 'long time no see') { return 'Long time no see indeed! How may I assist you?'; } else if (bestPhrase == 'how have you been') { return 'I\'m just a bot, but thanks for asking!'; } else if (bestPhrase == 'what\'s the news') { return 'Not much, just here to assist you. How about you?'; } else if (bestPhrase == 'how\'s your day') { return 'How\'s your day going? How can I assist you today?'; } else if (bestPhrase == 'howdy-do') { return 'Howdy-do! How may I assist you?'; } else if (bestPhrase == 'g\'day mate') { return 'G\'day mate! How can I assist you today?'; } else if (bestPhrase == 'hi-ya') { return 'Hi-ya! How may I assist you?'; } else if (bestPhrase == 'how goes it') { return 'How goes it? How may I assist you?'; } else if (bestPhrase == 'good day') { return 'Good day! How can I assist you today?'; } else if (bestPhrase == 'what\'s popping') { return 'What\'s popping? How may I assist you?'; } else if (bestPhrase == 'what\'s the craic') { return 'What\'s the craic? How may I assist you?'; } else if (bestPhrase == 'what\'s cooking') { return 'What\'s cooking? How may I assist you?'; } else if (bestPhrase == 'good to meet you') { return 'Good to meet you too! What can I assist you with?'; } else if (bestPhrase == 'how\'s life') { return 'How\'s life going? How may I assist you?'; } else if (bestPhrase == 'hi-ho') { return 'Hi-ho! How may I assist you?'; } else if (bestPhrase == 'well hello there') { return 'Well hello there! How may I assist you?'; } else if (bestPhrase == 'what\'s the buzz') { return 'What\'s the buzz?'; } else if (bestPhrase == 'hi-de-ho') { return 'Hi-de-ho! How may I assist you?'; } else if (bestPhrase == 'hi there, partner') { return 'Hi there, partner! How may I assist you?'; } else if (bestPhrase == 'how\'s your day going') { return 'How\'s your day going? How may I assist you?'; } else if (bestPhrase == 'what\'s the good word') { return 'What\'s the good word? How may I assist you?'; } else if (bestPhrase == 'what\'s shakin\'') { return 'What\'s shakin\'? How may I assist you?'; } else if (bestPhrase == 'what\'s happening') { return 'What\'s happening? How may I assist you?'; } else if (bestPhrase == 'how\'s your morning') { return 'How\'s your morning? How may I assist you?'; } else if (bestPhrase == 'what\'s new with you') { return 'What\'s new with you? How may I assist you?'; } else if (bestPhrase == 'greetings and salutations') { return 'Greetings and salutations! How may I assist you?'; } else if (bestPhrase == 'what\'s the latest') { return 'What\'s the latest? How may I assist you?'; } else if (bestPhrase == 'what\'s been happening') { return 'What\'s been happening? How may I assist you?'; } else if (bestPhrase == 'how are things going') { return 'How are things going? How may I assist you?'; } else if (bestPhrase == 'how are you keeping') { return 'How are you keeping? How may I assist you?'; } else if (bestPhrase == 'how\'s tricks') { return 'How\'s tricks? How may I assist you?'; } else if (bestPhrase == 'how\'s your day been') { return 'How\'s your day been? How may I assist you?'; } else if (bestPhrase == 'how goes the battle') { return 'How goes the battle? How may I assist you?'; } else if (bestPhrase == 'how goes the day') { return 'How goes the day? How may I assist you?'; } else if (bestPhrase == 'how goes your day') { return 'How goes your day? How may I assist you?'; } else if (bestPhrase == 'how do you do') { return 'How do you do? How may I assist you?'; } else if (bestPhrase == 'how\'s your afternoon') { return 'How\'s your afternoon? How may I assist you?'; } else if (bestPhrase == 'what\'s the news') { return 'What\'s the news? How may I assist you?'; } else if (bestPhrase == 'how\'s your evening') { return 'How\'s your evening? How may I assist you?'; } else if (bestPhrase == 'good morning to you') { return 'Good morning to you! How may I assist you?'; } else if (bestPhrase == 'how\'s it hanging') { return 'How\'s it hanging? How may I assist you?'; } else if (bestPhrase == 'what\'s new with you') { return 'What\'s new with you? How may I assist you?'; } else if (bestPhrase == 'how\'s your day been') { return 'How\'s your day been? How may I assist you?'; } else if (bestPhrase == 'how are things with you') { return 'How are things with you? How may I assist you?'; } else if (bestPhrase == 'how do you fare') { return 'How do you fare? How may I assist you?'; } else if (bestPhrase == 'how\'s your afternoon been') { return 'How\'s your afternoon been? How may I assist you?'; } else if (bestPhrase == 'how have you been doing') { return 'How have you been doing? How may I assist you?'; } else if (bestPhrase == 'how\'s your day treating you') { return 'How\'s your day treating you? How may I assist you?'; } else if (bestPhrase == 'what\'s been going on') { return 'What\'s been going on? How may I assist you?'; } } // Fallback response return null; } String? byeList(String userText) { List<String> byeWords = [ 'bye', 'goodbye', 'see you later', 'farewell', 'take care', 'see you', 'catch you later', 'adios', 'later', 'so long', 'until next time', 'bye for now', 'bye-bye', 'see ya', 'thank you', 'thanks', 'i love you', ]; double maxSimilarity = 0; String bestPhrase = ''; for (String byeWord in byeWords) { double similarity = userText.similarityTo(byeWord); if (similarity > maxSimilarity) { maxSimilarity = similarity; bestPhrase = byeWord; } } double threshold = 0.5; // If the best matching phrase has a similarity score above the threshold, respond accordingly if (maxSimilarity >= threshold) { Letters[1]='b'; if (bestPhrase == 'bye' || bestPhrase == 'goodbye' || bestPhrase == 'thank you' || bestPhrase == 'thanks' || bestPhrase == 'i love you' ) { return 'Goodbye! Have a great day!'; } else if (bestPhrase == 'see you later') { return 'See you later! Take care!'; } else if (bestPhrase == 'farewell') { return 'Farewell! Until we meet again!'; } else if (bestPhrase == 'take care') { return 'Take care! See you soon!'; } else if (bestPhrase == 'catch you later') { return 'Catch you later! Bye!'; } else if (bestPhrase == 'adios') { return 'Adios! Hasta luego!'; } else if (bestPhrase == 'later') { return 'Later! Take care!'; } else if (bestPhrase == 'so long') { return 'So long! See you soon!'; } else if (bestPhrase == 'until next time') { return 'Until next time! Bye!'; } else if (bestPhrase == 'bye for now') { return 'Bye for now! See you later!'; } else if (bestPhrase == 'bye-bye') { return 'Bye-bye! Take care!'; } else if (bestPhrase == 'see ya') { return 'See ya! Have a good one!'; } // Add more response conditions here for other bye words as needed } // Fallback response return null; } String? drEmail(String userText) { List<String>Dr_Names = [ 'bassam hammo', 'firas alghanim', 'ahmad altamimi', 'ammar odeh' , 'abdallah qusef', 'hazem qattous', 'abdullah al refai', 'rania alzubaidi' ]; double maxSimilarity = 0; String bestPhrase = ''; for (String DrName in Dr_Names) { double similarity = userText.similarityTo(DrName); if (similarity > maxSimilarity) { maxSimilarity = similarity; bestPhrase = DrName; } } double threshold = 0.4; if (maxSimilarity >= threshold) { Letters[2] = 'd'; if (bestPhrase == 'bassam hammo') { return 'Email of Dr.Bassam Hammo that you are looking for is b.hammo@psut.edu.jo'; } else if (bestPhrase == 'firas alghanim') { return 'Email of Dr.Firas Alghanim that you are looking for is f.ghanim@psut.edu.jo'; } else if (bestPhrase == 'ahmad altamimi') { return 'Email of Dr.Ahmad Altamimi that you are looking for is a.altamimi@psut.edu.jo'; } else if (bestPhrase == 'ammar odeh') { return 'Email of Dr.Ammar Odeh that you are looking for is a.odeh@psut.edu.jo'; } else if (bestPhrase == 'abdallah qusef') { return 'Email of Dr.Abdallah Qusef that you are looking for is a.qusef@psut.edu.jo'; } else if (bestPhrase == 'hazem qattous') { return 'Email of Dr.Hazem Qattous that you are looking for is h.qattous@psut.edu.jo'; } else if (bestPhrase == 'abdullah al refai') { return 'Email of Dr.Abdullah Al-Refai that you are looking for is a.alrefai@psut.edu.jo'; } else if (bestPhrase == 'rania alzubaidi') { return 'Email of Dr.Rania Alzubaidi that you are looking for is r.alzubaidi@psut.edu.jo'; } } return null; } String _getResponse(String userText) { // Lowercase the user text to simplify matching userText = userText.toLowerCase(); //Get the message from the user . //to make sure we filled the list with the letters String? isGreeting=greetingList(userText); String? isBye=byeList(userText); String? isDr=drEmail(userText); //check which query needed if (isGreeting!=null && isBye!=null && isDr!=null) { return isGreeting + isBye + isDr; } else if (isGreeting!=null && isDr!=null) { return isGreeting +isDr; } else if (isGreeting!=null && isBye!=null ) { return isGreeting + isBye; } else if (isBye!=null && isDr!=null) { return isBye + isDr; } else if (isGreeting!=null) { return isGreeting; } else if (isBye!=null ) { return isBye; } else if (isDr!=null) { return isDr; } else { return 'Sorry, I\'m not sure how to respond to that.'; } } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( centerTitle: true, title: const Text( 'Ask AI', style: TextStyle( color: Colors.blue, fontSize: 30, fontWeight: FontWeight.bold, ), ), ), body: Column( children: <Widget>[ Expanded( child: ListView.builder( padding: const EdgeInsets.all(8.0), reverse: true, itemCount: _messages.length, itemBuilder: (_, int index) => Align( alignment: Alignment.centerRight, child: ListTile( leading: _messages.reversed.toList()[index].contains("You") ? const Icon(Icons.person, color: Colors.blue) : const Icon(Icons.chat_bubble_outline), title: Text( _messages.reversed.toList()[index], style: TextStyle( fontWeight: _messages.reversed.toList()[index].contains("You") ? FontWeight.normal : FontWeight.normal, ), ), ), ), ), ), const Divider(height: 1.0), Container( decoration: BoxDecoration( color: Theme.of(context).cardColor, ), child: _buildTextComposer(), ), ], ), bottomNavigationBar: Container( color: Colors.blue, child: Padding( padding: const EdgeInsets.symmetric(horizontal: 15.0, vertical: 15.0), child: GNav( backgroundColor: Colors.blue, color: Colors.white, activeColor: Colors.white, tabBackgroundColor: Colors.blue.shade200, gap: 8, selectedIndex: _selectedIndex, onTabChange: _onItemTapped, padding: const EdgeInsets.all(18), tabs: [ GButton( icon: Icons.home, text: 'Home', onPressed: () { Navigator.push( context, MaterialPageRoute(builder: (context) => const HomeScreen(selectedIndex: 0)), ); }, ), GButton( icon: Icons.chat_outlined, text: 'Chats', onPressed: () { Navigator.push( context, MaterialPageRoute(builder: (context) => const chatScreen(selectedIndex: 1)), ); }, ), GButton( icon: Icons.question_answer_outlined, text: 'Ask AI', ), GButton( icon: Icons.assignment_sharp, text: 'Task manager', onPressed: () { Navigator.push( context, MaterialPageRoute(builder: (context) => const TaskManagar_Screen(selectedIndex: 3)), ); }, ), ], ), ), ), ); } Widget _buildTextComposer() { return IconTheme( data: IconThemeData(color: Theme.of(context).colorScheme.secondary), child: Container( margin: const EdgeInsets.symmetric(horizontal: 20.0, vertical: 8), child: Row( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ Flexible( child: TextField( controller: _controller, onSubmitted: _handleSubmitted, decoration: InputDecoration( hintText: 'How can I help you today?', hintStyle: GoogleFonts.albertSans(color: Colors.black54.withOpacity(0.5)), enabledBorder: OutlineInputBorder( borderSide: BorderSide( color: Colors.black.withOpacity(0.5), width: 1, ), borderRadius: BorderRadius.circular(20), ), ), ), ), Container( margin: const EdgeInsets.symmetric(horizontal: 4.0), child: IconButton( icon: const Icon(Icons.send), onPressed: () => _handleSubmitted(_controller.text), color: Colors.blue, ), ), ], ), ), ); } void _onItemTapped(int index) { setState(() { _selectedIndex = index; }); } @override void initState() { super.initState(); _selectedIndex = widget.selectedIndex; } } ```
|c|
Are there any benefits to Session Storage over Local Storage?
Solved! It was necesary to use [] in my attribute Imagenes, with that I send the images like array. if(Array.isArray(params.images) && params.images.length !== 0){ params.images.forEach((image: any) => { formData.append("**Imagenes[]**", image); }); } [enter image description here][1] [1]: https://i.stack.imgur.com/ARjEC.png
When creating a Table type with a single string column and trying to INSERT 2 differents strings make it fails. First, I created a new Table Type with a single string column: CREATE TYPE [dbo].[String_Table] AS TABLE( [Value] [nvarchar](255) NOT NULL, PRIMARY KEY CLUSTERED ( [Value] ASC )WITH (IGNORE_DUP_KEY = OFF) Second, I try to add to a variable defined using this new table type 2 different string value: DECLARE @p1 dbo.String_Table INSERT INTO @p1 VALUES(N'') INSERT INTO @p1 VALUES(N'') On the second INSERT the following error is returned by SQL: Msg 2627, Level 14, State 1, Line 3 Violation of PRIMARY KEY constraint 'PK__#A6AA779__07D9BBC3B1FF3702'. Cannot insert duplicate key in object 'dbo.@p1'. The duplicate key value is (). Please advise why this is happening because the strings are differents. The collation for the database is SQL_Latin1_General_CP1_CI_AS
Adding a different string to a table fails
|sql-server|types|sql-insert|constraintviolationexception|
I'm putting this answer here for future me: I was able to use MongoDbBuilder to get a single node replica set working with the following which allows me to use transactions: var cancellationTokenSource = new CancellationTokenSource(); cancellationTokenSource.CancelAfter(TimeSpan.FromSeconds(10)); mongoContainer = new MongoDbBuilder() .WithUsername("") .WithPassword("") .WithImage("mongo:latest") .WithExtraHost("host.docker.internal", "host-gateway") .WithCommand("--replSet", "rs0") .WithWaitStrategy(Wait.ForUnixContainer()) .Build(); await mongoContainer.StartAsync(cancellationTokenSource.Token); await mongoContainer.ExecScriptAsync($"rs.initiate({{_id:'rs0',members:[{{_id:0,host:'host.docker.internal:{mongoContainer.GetMappedPublicPort(27017)}'}}]}})", cancellationTokenSource.Token); var connectionString = mongoContainer.GetConnectionString(); var client = new MongoClient(connectionString); Using an empty string for `.WithUserName("")` and `.WithPassword("")` seems to be equivalent to "No Auth". I think `.WithUserName(null)` and `.WithPassword(null)` works as well. > Important: Make sure your hosts file (on host machine) has the entry `127.0.0.1 host.docker.internal`
Cart ui not loading data after reload although data are in local storage
|javascript|reactjs|node.js|cart|react-fullstack|
null
I was solving a programming task where we wanted to find a smallest integer not satisfying a given (monotone) property. This can be achieved via binary search. Using C++20, I decided to use `std::partition_point` together with `std::iota_view`. I had several types mixed up and my code was very slow for some reason. My code (simplified): ``` bool monotone(int n) { return n <= 1000000000; } long long MAX = INT_MAX; //weird? int main() { using namespace std; cout << *ranges::partition_point(ranges::iota_view(1,MAX), monotone) << endl; } ``` by looking closer, it is weird that `MAX` is of type `long long` while it could be int. Running this on my machine yields a running time of approximately 12 seconds, which is too much, it should be logarithmic in `MAX`. I noticed that if i changed `ranges::iota_view(1,MAX)` to `ranges::iota_view(1ll, MAX)` or `ranges::iota_view(1,(int)MAX)` the code suddenly began to "work" fast as intended (completed in few milliseconds). Can someone explain to me what is going on under the hood and why mixing up types in the `iota_view` produced such slow code?
`std::iota_view` is slow when given different types of value and bound?
|c++|c++20|binary-search|std-ranges|iota|
New here and I'm happy I found this site! It helped me a lot so far! I want to make a contextual drop down menu based on 2 other conditions. All of my data are in the same table, 3 columns. ![see picture here](https://i.stack.imgur.com/QlfSo.png) The list of results needs to be dependent of the column A first (yellow), and then B (blue), which will list all the results the results in column C (green). I can't seem to be able to do that on the 3rd level (column c in green) and I need help with that. ![see actual result here](https://i.stack.imgur.com/KTVZE.png) My Excel is in French so I'll use OFFSET (DECALER) and MATCH (EQUIV) function and the `COUNTIFS (NB.SI.ENS)` to determine length of the list. ``` =DECALER(TAB_NOM_DEMO[[#En-têtes];[SUCCURSALE]];EQUIV(TABLEAU_ACC_SUCC[@SUCCURSALE];TAB_NOM_DEMO[SUCCURSALE];0);EQUIV(TABLEAU_ACC_SUCC[[#En-têtes];[TYPE DEMO]];TAB_NOM_DEMO[#En-têtes];0);NB.SI.ENS(TAB_NOM_DEMO[SUCCURSALE];TABLEAU_ACC_SUCC[@SUCCURSALE];TAB_NOM_DEMO[TYPE DEMO];TABLEAU_ACC_SUCC[@[TYPE DEMO]]);1) ``` my problem that I see right now is that the start cell ``` TAB_NOM_DEMO[[#En-têtes];[SUCCURSALE]] ``` needs to be variable of column A first, then column B to get the right data in column C. I'm not sure I'm using the right function right now so I'm open to suggestions and need help ASAP!
I'm not sure if it is because of problems in the below SQL coding which gives me both the Error 3464 Data type mismatch in criteria expression, and runtime error 91 object variable or With block variable not yet. Can anyone help? Thanks SQL = "SELECT TempRFQ.[RFQID] AS [RFQID], TempRFQ.[LI] AS [LI], TempRFQ.[QTY] AS [QTY], TempRFQ.[UI] AS [UI], TempRFQ.[PN] AS [PN], " & _ "TempRFQ.[Description] AS [Description], TempRFQ.MFR AS [MFR], TempRFQ.MFC AS [MFC], TempRFQ.[AC] AS [AC], TempRFQ.[Remarks] AS [Remarks] " & _ "FROM RFQ INNER JOIN TempRFQ ON RFQ.[RFQID] = TempRFQ.[RFQID] " & _ "WHERE RFQ.[RFQID] ='" & Me![RFQID] & "' ORDER BY len(TempRFQ.[LI]),TempRFQ.[LI];"
I am trying to use DGS Codegen plugin in my spring boot GQL project, Here is the build.gradle.kts file, where the respective dependencies mentioned ``` kotlin plugins { java id("org.springframework.boot") version "3.2.4" id("io.spring.dependency-management") version "1.1.4" id("com.netflix.dgs.codegen") version "6.1.5" } dependencyManagement { imports { mavenBom("com.netflix.graphql.dgs:graphql-dgs-platform-dependencies:latest.release") } } ``` The plugin generates the code as expected from the schema file, However I am still seeing the unresolved reference error for each 3 lines in the given script as below, ``` kotlin tasks.generateJava { schemaPaths.add("${projectDir}/src/main/resources/schema") // List of directories containing schema files packageName = "com.example.dgsdemo" // The package name to use to generate sources generateClient = true // Enable generating the type safe query API } ``` [Error screen shot] (https://i.stack.imgur.com/LCj73.png) Do we need to check any other config settings, to make sure if the plugin is imported properly? Any suggestions to debug more? **Tried options:** - Upgraded to the latest package - Invalidated cache and restarted intellij - Tried to clean before the gradle build
I try to make a little program wit Pycharm, following some tutorials. But i get this error: **Exception in Tkinter callback Traceback (most recent call last): File "C:\Users\Anton1n\AppData\Local\Programs\Python\Python311\Lib\tkinter\__init__.py", line 1967, in __call__ return self.func(*args) ^^^^^^^^^^^^^^^^ File "C:\Users\Anton1n\PycharmProjects\Livechatvideo\Base.py", line 5, in open_file file_path = filedialog.askopenfilename() ^^^^^^^^^^ NameError: name 'filedialog' is not defined ** with this code : ``` import tkinter as tk from tkinter import * from tkinter import filedialog def open_file(): filename = filedialog.askopenfilename(initialdir = "/", title = "Select a File", filetypes=(("PNG", "*.png"), ("JPEG", "*.jpg;*.jpeg"), ("GIF", "*.gif") )) send_button.configure(text="File Opened: " + filename) # Créer une fenêtre root = Tk() # Personnaliser la fenêtre root.title("LivechatVideo") root.geometry("300x300") root.minsize(350, 400) root.iconbitmap("livechatico.ico") root.config(bg="#4279B4") # Créer la frame frame = Frame(root, bg="#4279B4", bd=1, relief=SUNKEN) # Ajouter un premier texte label_title = Label(frame, text="Bienvenue sur LivechatVideo", font=("calibri", 15), fg="orange", bg="#4279B4") label_title.pack() # Ajouter second texte label_subtitle = Label(frame, text="Envoyez vos photos ou vidéos directement à vos amis", font=("calibri", 10), fg="white", bg="#4279B4") label_subtitle.pack() # Ajouter frame.pack(pady=5) # Ajout de widgets (boutons, labels, etc.) à la fenêtre send_button = Button(root, text="Sélectionnez votre fichier", font=("calibri", 10), bg="white", fg="black", command=open_file) send_button.pack(pady=15) # Création barre de menu menu_bar = Menu(root) # Création d'un menu file_menu = Menu(menu_bar, tearoff=0) file_menu.add_command(label="Option") menu_bar.add_cascade(label="Fichier", menu=file_menu) # Configuraiton de la fenêtre pour menu root.config(menu=menu_bar) # Afficher root.mainloop() ``` I get the error when i launch the program and click on the button "Sélectionnez votre fichier". I tried almost everything I found on internet, and every way to import tkmodule. I use Python 3. I simply want to open a windows file explorer to select an image on my computer. Why can't it work please ?
Django - ModuleNotFoundError: No module named 'backend'
|django|api|django-rest-framework|django-views|active-model-serializers|
null
I will calculate the time delay so I need clock cycle number. What is the clock cycle in this code total? ``` .ORG 0 LDI R20, 200 ; Load immediate value 200 into register R20 BACK: LDI R25, 120 ; Load immediate value 120 into register R25 NOP ; No operation NOP ; No operation NOP ; No operation HERE: DEC R25 ; Decrement R25 BRNE HERE ; Branch to HERE if R25 is not zero DEC R20 ; Decrement R20 BRNE BACK ; Branch to BACK if R20 is not zero LDI R22, 0xFF ; Load immediate value 0xFF into register R22 ``` I understand the LDI, NOP,DEC instructions have 1 clock cycle each time and depend on their loops, but I confused BRNE instructions.
AVR Assembly Clock Cycle
|assembly|avr|timedelay|