instruction
stringlengths
0
30k
I am new to iOS development and I have shifted my project form my m1 mac to intel mac. After that its preview start crashing and Xcode is showing this error to me. Here are the details of the error that Xcode is showing to me. > LinkDylibError: Failed to build ContentView.swift > > Linking failed: linker command failed with exit code 1 (use -v to see invocation) > > ld: warning: search path '/Applications/Xcode.app/Contents/SharedFrameworks-iphonesimulator' not found > ld: warning: Could not find or use auto-linked framework 'CoreAudioTypes': framework 'CoreAudioTypes' not found > ld: Undefined symbols: > _OBJC_CLASS_$_CNContactsUserDefaults, referenced from: > in GoogleMaps.a > clang: error: linker command failed with exit code 1 (use -v to see invocation) I want to run my preview working in Xcode on my intel mac.
Preview Crash issue in swiftUi Xcode 15
|swift|xcode|swiftui|
null
I'm currently in the process of transitioning from using Terraform for managing my GitLab CI/CD pipelines to using OpenTofu. In this migration, I also need to integrate OIDC (OpenID Connect) authentication into my GitLab pipelines. Previously, my .gitlab-ci.yml file looked something like this with Terraform: `You should upgrade to the latest version. You can find the latest version at https://gitlab.com/gitlab-com/gl-security/security-operations/infrastructure-security-public/oidc-modules/-/releases include: - remote: 'https://gitlab.com/gitlab-com/gl-security/security-operations/infrastructure-security-public/oidc-modules/-/raw/3.1.2/templates/gcp_auth.yaml' - template: "Terraform/Base.gitlab-ci.yml" variables: WI_POOL_PROVIDER: //iam.googleapis.com/projects/$GCP_PROJECT_NUMBER/locations/global/workloadIdentityPools/$WORKLOAD_IDENTITY_POOL/providers/$WORKLOAD_IDENTITY_POOL_PROVIDER SERVICE_ACCOUNT: $SERVICE_ACCOUNT TF_ROOT: infrastructure TF_STATE_NAME:tfstate stages: - validate - test - build - deploy validate: extends: .terraform:validate needs: [] build: extends: - .google-oidc:auth - .terraform:build deploy: extends: - .google-oidc:auth - .terraform:deploy dependencies: - build` Now, I want to replace the Terraform-based setup with OpenTofu, while also incorporating OIDC authentication into my pipeline. However, I'm unsure about how to structure the .gitlab-ci.yml file and configure OpenTofu to achieve this. Could someone provide guidance on how to migrate from Terraform to OpenTofu for GitLab CI/CD pipelines, particularly focusing on integrating OIDC authentication into the pipeline setup? Any examples, tips, or resources would be greatly appreciated. Thank you!
An easy way to do what you are asking is with [`QtConcurrent::run`][1] and an object. The way it goes is: 1. Start a function in a separate thread using `QtConcurrent::run`. What you get from that is a [`QFuture`][2] that you can inquire to get the execution status.<br/>As you will see in the documentation, you can make that work with a thread pool created beforehand. 2. You have 2 ways to detect the execution has ended: - Call `QFuture::waitForFinished`: it will block your thread until the execution is done.<br/>This can be useful if you are already in a worker thread, starting tasks in other worker threads; however, it is safe to say you should never want to call it in the main thread and block it. - Have an object send a signal from the worker thread, caught in the main thread. In that case, the main thread does not get blocked. Here is a quick example that runs 5x a function in worker threads. A `taskNo` (from 1 to 5) is passed from the main thread to the worker thread in `QtConcurrent::run` and back in signals.<br/> The tasks basically consist in printing the id of the thread executing them. There are also a number of lines that print what is executed in the main thread. For illustration's sake, this example works with a single worker object.<br/> You can work with separate worker objects though, but you'll need to create pointers inside the `for` loop, change their thread affinity in `QtConcurrent::run` (instead of just printing to the screen like I did), do the connection and only then start the work. In any case, always explicitly mark your connection with `Qt::QueuedConnection`. That may be what `QObject::connect` will do by default but at least, it makes your intention clear. In the `main` function, I have put comments in 3 places for illustration: - 1<sup>st</sup> comment: you may set up your connection so that it disconnects after the first `taskCompleted` signal is emitted. - 2<sup>nd</sup> comment: a thread pool is created in `main`. I have made it so that it is **not** used though, that is unless you uncomment it.<br/>BTW, pay close attention to the thread that executes `QtConcurrent::run` vs `QFuture::then` and how tasks won't start until the `QFuture` chain is over (you can make it more obvious adding `QThread::msleep(1000);` in `Worker::run`). - 3<sup>rd</sup> comment: This is an illustration of what `QFuture::waitForFinished` does. If you were to uncomment it, work would still be done in the worker thread but with no parallelism: since it is blocking the main thread before it can create the next worker thread (see my comment above). `Worker.h` ```c++ #include <QObject> class Worker : public QObject { Q_OBJECT public: void run(int taskNo); signals: void taskCompleted(Qt::HANDLE, int); }; ``` `Worker.cpp` ```c++ #include "Worker.h" #include <QtCore/QDebug> #include <QtCore/QThread> void Worker::run(int taskNo) { qDebug() << "Executing task" << taskNo << "in worker thread" << QThread::currentThreadId(); emit taskCompleted(QThread::currentThreadId(), taskNo); } ``` `main.cpp` ```c++ #include <QtCore/QFuture> #include <QtCore/QThread> #include <QtCore/QThreadPool> #include <QtConcurrent/QtConcurrentRun> #include "Worker.h" int main(int argc, char* argv[]) { QApplication a(argc, argv); QThreadPool pool; pool.setMaxThreadCount(2); QObject catchObject; Worker worker; QObject::connect(&worker, &Worker::taskCompleted, &catchObject, [](Qt::HANDLE workerThreadId, int taskNo) { qDebug() << "Message from main thread" << QThread::currentThreadId() << ": Task" << taskNo << "completed in thread" << workerThreadId; } , static_cast<Qt::ConnectionType>(Qt::QueuedConnection /*| Qt::SingleShotConnection*/) //Uncomment to catch only the first task to complete. ); qDebug() << "Tasks will now be created from main thread" << QThread::currentThreadId(); for (int taskNo = 1; taskNo <= 5; ++taskNo) { QtConcurrent::run( /*&pool,*/ //Uncomment to work with the 2 threads of the thread pool. [](int taskNo) -> int { qDebug() << "Hello from worker thread" << QThread::currentThreadId() << ", starting task" << taskNo; return taskNo; }, taskNo ).then( [&worker](int taskNo) { worker.run(taskNo); } )/*.waitForFinished()*/; //Uncomment to make the main thread wait for the task to finish before resuming the loop. } return a.exec(); } ``` [1]: https://doc.qt.io/qt-6/qtconcurrentrun.html [2]: https://doc.qt.io/qt-6/qfuture.html [3]: https://doc.qt.io/qt-6/qobject.html#thread-affinity
You are using a modal and the outer `setState` doesn't affect the modal after it's created. One solution is to make the modal stateful, you can wrap your widget with a `StatefulBuilder` like this: ```dart showModalBottomSheet( context = context, builder = (BuildContext context) { return StatefulBuilder(builder: (context, setState) { // return your widget here }); }, ); ```
{"Voters":[{"Id":2670892,"DisplayName":"greg-449"},{"Id":22180364,"DisplayName":"Jan"},{"Id":16217248,"DisplayName":"CPlus"}],"SiteSpecificCloseReasonIds":[18]}
I calculate SMA(10) using last 9 bars Close + current Close. I have done it in Google Sheet and this is the correct values I also get in my trading platform. Date Time Open High Low Close Volume SMA_Close10 SMA_Close20 2022-01-02 18:01:00 17535.75 17601 17535.75 17564.25 1024 #REF! #REF! 2022-01-02 18:02:00 17562.25 17578.5 17560.75 17573.25 610 #REF! #REF! 2022-01-02 18:03:00 17573.25 17579.25 17566 17566.75 347 #REF! #REF! 2022-01-02 18:04:00 17566.5 17568.75 17563 17565 206 #REF! #REF! 2022-01-02 18:05:00 17564.25 17567.75 17558.5 17565 257 #REF! #REF! 2022-01-02 18:06:00 17565 17570.5 17563.25 17567.5 283 #REF! #REF! 2022-01-02 18:07:00 17567.25 17573.75 17566.75 17573 141 #REF! #REF! 2022-01-02 18:08:00 17573.25 17574.25 17567 17568.25 209 #REF! #REF! 2022-01-02 18:09:00 17568.5 17571.5 17564.25 17566.25 261 17567.69 #REF! 2022-01-02 18:10:00 17565 17565 17552.5 17557 342 17566.63 #REF! 2022-01-02 18:11:00 17557.5 17558.5 17555 17557 83 17565.90 #REF! 2022-01-02 18:12:00 17557 17562 17556 17559.25 162 17564.50 #REF! 2022-01-02 18:13:00 17558.5 17559.75 17556.75 17558.25 56 17563.65 #REF! 2022-01-02 18:14:00 17558.5 17558.75 17552.25 17554.25 160 17562.58 #REF! 2022-01-02 18:15:00 17555.25 17555.25 17552.25 17552.25 68 17561.30 #REF! 2022-01-02 18:16:00 17552 17559.75 17551.5 17559.5 103 17560.50 #REF! 2022-01-02 18:17:00 17558.75 17560.25 17556.75 17559.5 122 17559.15 #REF! 2022-01-02 18:18:00 17559.75 17564.5 17559.75 17564 179 17558.73 #REF! 2022-01-02 18:19:00 17563.75 17564.25 17561.75 17564 50 17558.50 17562.86 2022-01-02 18:20:00 17564.25 17565.25 17561.5 17562 70 17559.00 17562.81 2022-01-02 18:21:00 17562.5 17562.5 17560.5 17561.5 59 17559.45 17562.68 2022-01-02 18:22:00 17561.5 17563 17556.75 17562.25 112 17559.75 17562.13 2022-01-02 18:23:00 17562 17567.75 17562 17563.25 168 17560.25 17561.95 2022-01-02 18:24:00 17564 17564 17559 17559.75 90 17560.80 17561.69 2022-01-02 18:25:00 17560 17560.25 17557.25 17558.75 86 17561.45 17561.38 2022-01-02 18:26:00 17558.5 17558.5 17550.5 17551.5 186 17560.65 17560.58 2022-01-02 18:27:00 17550.75 17556 17550.75 17555.5 76 17560.25 17559.70 2022-01-02 18:28:00 17555.5 17556.5 17554 17554 38 17559.25 17558.99 2022-01-02 18:29:00 17554.5 17558.75 17551.5 17558.25 85 17558.68 17558.59 2022-01-02 18:30:00 17558.5 17560.5 17557.25 17559.75 73 17558.45 17558.73 2022-01-02 18:31:00 17560.25 17561 17554.75 17556 123 17557.90 17558.68 2022-01-02 18:32:00 17556.5 17556.75 17554 17555.25 70 17557.20 17558.48 2022-01-02 18:33:00 17555 17555 17549 17550 108 17555.88 17558.06 2022-01-02 18:34:00 17551 17552.25 17549.75 17551.25 72 17555.03 17557.91 2022-01-02 18:35:00 17552.25 17554.75 17552.25 17554 79 17554.55 17558.00 2022-01-02 18:36:00 17554.5 17554.75 17551.25 17551.5 46 17554.55 17557.60 2022-01-02 18:37:00 17551.5 17555.75 17551.5 17555 41 17554.50 17557.38 2022-01-02 18:38:00 17554.5 17557.25 17552.75 17553.5 76 17554.45 17556.85 2022-01-02 18:39:00 17553.5 17557 17553 17555.5 64 17554.18 17556.43 2022-01-02 18:40:00 17555.75 17557.25 17555.25 17556.5 35 17553.85 17556.15 2022-01-02 18:41:00 17556.25 17556.25 17552.25 17555 74 17553.75 17555.83 2022-01-02 18:42:00 17555.25 17556 17554.75 17556 25 17553.83 17555.51 2022-01-02 18:43:00 17555.75 17555.75 17553.5 17553.75 34 17554.20 17555.04 2022-01-02 18:44:00 17554.5 17557.25 17554.5 17556.5 41 17554.73 17554.88 2022-01-02 18:45:00 17556.75 17557.75 17556.25 17557 32 17555.03 17554.79 2022-01-02 18:46:00 17557 17561.25 17556 17556.75 119 17555.55 17555.05 2022-01-02 18:47:00 17556.25 17559.25 17555.25 17559.25 61 17555.98 17555.24 2022-01-02 18:48:00 17558.5 17560 17558 17559 49 17556.53 17555.49 2022-01-02 18:49:00 17559 17559.75 17558 17559.75 27 17556.95 17555.56 2022-01-02 18:50:00 17559.5 17563 17559.5 17561.75 148 17557.48 17555.66 2022-01-02 18:51:00 17561.75 17562.5 17559.5 17559.75 44 17557.95 17555.85 2022-01-02 18:52:00 17559.5 17561.25 17559 17561.25 39 17558.48 17556.15 2022-01-02 18:53:00 17561 17563 17561 17562.5 51 17559.35 17556.78 2022-01-02 18:54:00 17563.25 17564.5 17562.5 17564.25 74 17560.13 17557.43 2022-01-02 18:55:00 17564 17564.75 17563.5 17564 27 17560.83 17557.93 2022-01-02 18:56:00 17563.75 17563.75 17560.75 17562.75 98 17561.43 17558.49 2022-01-02 18:57:00 17562.25 17563.5 17562.25 17563 29 17561.80 17558.89 2022-01-02 18:58:00 17563 17563 17561 17561.75 37 17562.08 17559.30 2022-01-02 18:59:00 17562.25 17567.75 17562.25 17566.5 126 17562.75 17559.85 2022-01-02 19:00:00 17565.5 17566.25 17563.25 17563.5 56 17562.93 17560.20 2022-01-02 19:01:00 17564 17570.75 17564 17564.75 155 17563.43 17560.69 2022-01-02 19:02:00 17565.5 17568.5 17565.5 17566.75 69 17563.98 17561.23 2022-01-02 19:03:00 17567.75 17570.25 17566.75 17568.5 103 17564.58 17561.96 2022-01-02 19:04:00 17568.25 17573 17567 17569 109 17565.05 17562.59 2022-01-02 19:05:00 17569.25 17570.5 17567 17568.25 75 17565.48 17563.15 2022-01-02 19:06:00 17567.5 17571 17567.5 17568.5 55 17566.05 17563.74 2022-01-02 19:07:00 17569 17570.5 17569 17570 33 17566.75 17564.28 2022-01-02 19:08:00 17570 17570.25 17567 17568.5 48 17567.43 17564.75 2022-01-02 19:09:00 17567.5 17567.5 17566 17566.75 66 17567.45 17565.10 2022-01-02 19:10:00 17566.75 17571 17566.75 17571 79 17568.20 17565.56 2022-01-02 19:11:00 17571 17572 17569.75 17572 95 17568.93 17566.18 2022-01-02 19:12:00 17571.75 17572.75 17570.25 17571 75 17569.35 17566.66 2022-01-02 19:13:00 17570.5 17570.5 17566.75 17566.75 93 17569.18 17566.88 2022-01-02 19:14:00 17567.5 17567.75 17565.5 17566.5 38 17568.93 17566.99 2022-01-02 19:15:00 17566.75 17567.25 17564.25 17565 68 17568.60 17567.04 2022-01-02 19:16:00 17565.25 17569.5 17564 17568.5 109 17568.60 17567.33 WITH Calculations AS ( SELECT Date, Time, Close, CASE WHEN ROW_NUMBER() OVER (ORDER BY Date, Time) >= 10 THEN AVG(Close) OVER (ORDER BY Date, Time ROWS BETWEEN 9 PRECEDING AND CURRENT ROW) ELSE NULL END AS SMA_Close10, CASE WHEN ROW_NUMBER() OVER (ORDER BY Date, Time) >= 20 THEN AVG(Close) OVER (ORDER BY Date, Time ROWS BETWEEN 19 PRECEDING AND CURRENT ROW) ELSE NULL END AS SMA_Close20 FROM NQ_06_24_1_Minute ) UPDATE NQ_06_24_1_Minute SET SMA_Close10 = CASE WHEN Calculations.SMA_Close10 IS NULL THEN 0 ELSE Calculations.SMA_Close10 END, SMA_Close20 = CASE WHEN Calculations.SMA_Close20 IS NULL THEN 0 ELSE Calculations.SMA_Close20 END FROM Calculations WHERE NQ_06_24_1_Minute.Date = Calculations.Date AND NQ_06_24_1_Minute.Time = Calculations.Time; What do I need to fix on the code to calculate skip the first rows (only when I have enough data) I should start calculate SMA_Close10 and SMA_Close20? [![enter image description here][1]][1] [1]: https://i.stack.imgur.com/3yUrJ.png
Calculate SMA_Close10 and SMA_Close20 of minute data
|sql|sqlite|
In aosp 11, there are two mode to execute java function in art. In the interpreter mode, the execution always passes through ExecuteSwitchImplCpp, whereas in the assembly mode, it always passes through ExecuteMterpImpl. But I can not find ExecuteMterpImpl in aosp android 13. How does Android 13 handle the assembly mode?
Where is the ExecuteMterpImpl function in aosp 13?
|android|android-source|
I'm working on a CLI tool. I'm using macOS. I was using `node index.js <command>` when running it locally. I decided to publish it as an npm package, but the command I've defined in the `bin` section of my `package.json` won't work. In my `package.json`, i've defined `bin` as follows: ```JSON "bin": { "scaffold": "index.js" }, ``` I'm really not sure how to navigate this and quite unfamiliar. Would appreciate any help. I've installed the package globally. Tried to troubleshoot by running a few commands from posts, here are the results if they help: Running `npm bin -g` results in: ```bash Unknown command: "bin" To see a list of supported npm commands, run: npm help ``` Running `npm root -g` results in: ```bash /opt/homebrew/lib/node_modules ``` Running `which scaffold` results in: ```bash /opt/homebrew/bin/scaffold ``` Running `npm list -g project-scaffold` results in: ```bash /opt/homebrew/lib └── project-scaffold@1.1.1 ```
NPM Command Line Tool - Command not working
|node.js|npm|command-line|command-line-interface|
null
I using VScode create a new SpringBoot project,and just add spring Web this dependent.The most changes are just add `server.address=8088` in application.properties.But I using Vscode start SpringBoot project get error. ``` 2024-03-31T10:05:42.222+08:00 INFO 11840 --- [demo] [ main] com.example.demo.DemoApplication : Starting DemoApplication using Java 17.0.9 with PID 11840 (E:\毕设\1\Maven project04\demo\target\classes started by 22328 in E:\毕设\1\Maven project04\demo) 2024-03-31T10:05:42.227+08:00 INFO 11840 --- [demo] [ main] com.example.demo.DemoApplication : No active profile set, falling back to 1 default profile: "default" 2024-03-31T10:05:43.379+08:00 INFO 11840 --- [demo] [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port 8080 (http) 2024-03-31T10:05:43.392+08:00 INFO 11840 --- [demo] [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat] 2024-03-31T10:05:43.393+08:00 INFO 11840 --- [demo] [ main] o.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/10.1.19] 2024-03-31T10:05:43.472+08:00 INFO 11840 --- [demo] [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext 2024-03-31T10:05:43.473+08:00 INFO 11840 --- [demo] [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1165 ms 2024-03-31T10:05:43.786+08:00 WARN 11840 --- [demo] [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Failed to start bean 'webServerStartStop' 2024-03-31T10:05:43.800+08:00 INFO 11840 --- [demo] [ main] .s.b.a.l.ConditionEvaluationReportLogger : Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled. 2024-03-31T10:05:43.816+08:00 ERROR 11840 --- [demo] [ main] o.s.boot.SpringApplication : Application run failed org.springframework.context.ApplicationContextException: Failed to start bean 'webServerStartStop' at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:291) ~[spring-context-6.1.5.jar:6.1.5] at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:471) ~[spring-context-6.1.5.jar:6.1.5] at java.base/java.lang.Iterable.forEach(Iterable.java:75) ~[na:na] at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:260) ~[spring-context-6.1.5.jar:6.1.5] at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:205) ~[spring-context-6.1.5.jar:6.1.5] at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:981) ~[spring-context-6.1.5.jar:6.1.5] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:627) ~[spring-context-6.1.5.jar:6.1.5] at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[spring-boot-3.2.4.jar:3.2.4] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) ~[spring-boot-3.2.4.jar:3.2.4] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:456) ~[spring-boot-3.2.4.jar:3.2.4] at org.springframework.boot.SpringApplication.run(SpringApplication.java:334) ~[spring-boot-3.2.4.jar:3.2.4] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1354) ~[spring-boot-3.2.4.jar:3.2.4] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1343) ~[spring-boot-3.2.4.jar:3.2.4] at com.example.demo.DemoApplication.main(DemoApplication.java:10) ~[classes/:na] Caused by: org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat server at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.start(TomcatWebServer.java:249) ~[spring-boot-3.2.4.jar:3.2.4] at org.springframework.boot.web.servlet.context.WebServerStartStopLifecycle.start(WebServerStartStopLifecycle.java:44) ~[spring-boot-3.2.4.jar:3.2.4] at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:288) ~[spring-context-6.1.5.jar:6.1.5] ... 13 common frames omitted Caused by: java.lang.IllegalArgumentException: standardService.connector.startFailed at org.apache.catalina.core.StandardService.addConnector(StandardService.java:235) ~[tomcat-embed-core-10.1.19.jar:10.1.19] at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.addPreviouslyRemovedConnectors(TomcatWebServer.java:306) ~[spring-boot-3.2.4.jar:3.2.4] at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.start(TomcatWebServer.java:234) ~[spring-boot-3.2.4.jar:3.2.4] ... 15 common frames omitted Caused by: org.apache.catalina.LifecycleException: Protocol handler start failed at org.apache.catalina.connector.Connector.startInternal(Connector.java:1046) ~[tomcat-embed-core-10.1.19.jar:10.1.19] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:171) ~[tomcat-embed-core-10.1.19.jar:10.1.19] at org.apache.catalina.core.StandardService.addConnector(StandardService.java:232) ~[tomcat-embed-core-10.1.19.jar:10.1.19] ... 17 common frames omitted Caused by: java.net.BindException: Cannot assign requested address: bind at java.base/sun.nio.ch.Net.bind0(Native Method) ~[na:na] at java.base/sun.nio.ch.Net.bind(Net.java:555) ~[na:na] at java.base/sun.nio.ch.ServerSocketChannelImpl.netBind(ServerSocketChannelImpl.java:337) ~[na:na] at java.base/sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:294) ~[na:na] at org.apache.tomcat.util.net.NioEndpoint.initServerSocket(NioEndpoint.java:247) ~[tomcat-embed-core-10.1.19.jar:10.1.19] at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:202) ~[tomcat-embed-core-10.1.19.jar:10.1.19] at org.apache.tomcat.util.net.AbstractEndpoint.bindWithCleanup(AbstractEndpoint.java:1282) ~[tomcat-embed-core-10.1.19.jar:10.1.19] at org.apache.tomcat.util.net.AbstractEndpoint.start(AbstractEndpoint.java:1368) ~[tomcat-embed-core-10.1.19.jar:10.1.19] at org.apache.coyote.AbstractProtocol.start(AbstractProtocol.java:635) ~[tomcat-embed-core-10.1.19.jar:10.1.19] at org.apache.catalina.connector.Connector.startInternal(Connector.java:1043) ~[tomcat-embed-core-10.1.19.jar:10.1.19] ... 19 common frames omitted ``` And my pom.xml ``` <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>3.2.4</version> <relativePath/> <!-- lookup parent from repository --> </parent> <groupId>com.example</groupId> <artifactId>demo</artifactId> <version>0.0.1-SNAPSHOT</version> <name>demo</name> <description>Demo project for Spring Boot</description> <properties> <java.version>17</java.version> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build> </project> ``` I don't know how to solve it from which direction.Thank you very much for telling me the answer or direction. Created many times, hoping to run successfully.
Created the new project about SpringBoot can't start
|spring-boot|
null
{"Voters":[{"Id":4541695,"DisplayName":"DVT"},{"Id":22180364,"DisplayName":"Jan"},{"Id":16217248,"DisplayName":"CPlus"}]}
When using google colab with python language. How exacly to copy specific amount of data like 100 file (from 900 file) from downloaded directory to another directory? since i use this command it copying all file din directory `!cp /content/dataset/train/rottenapples/*.png /content/fresh_rotten/rotten_pic` is it using loop with spesific range?
Or, as a one-liner: <!-- begin snippet:js console:true --> <!-- language:lang-js --> const count=(n1,n2)=>Array(n2+1).fill(0).map((_,i)=>i).slice(n1).join(","); console.log(count(0,8)); console.log(count(2,5)); console.log(count(5,2)); <!-- end snippet --> The `.fill(0)` looks a bit superfluous here, but it is necessary, since `.map()` will not iterate over `undefined` elements.
I need to print the bounding box coordinates of a walking person in a video. Using YOLOv5 I detect the persons in the video. Each person is tracked. I need to print each person's bounding box coordinate with the frame number. Using Python how to do this. The following is the code to detect, track persons and display coordinates in a video using YOLOv5. ``` #display bounding boxes coordinates import cv2 from ultralytics import YOLO # Load the YOLOv8 model model = YOLO('yolov8n.pt') # Open the video file cap = cv2.VideoCapture("Shoplifting001_x264_15.mp4") #get total frames frame_count = int(cap.get(cv2.CAP_PROP_FRAME_COUNT)) print(f"Frames count: {frame_count}") # Initialize the frame id frame_id = 0 # Loop through the video frames while cap.isOpened(): # Read a frame from the video success, frame = cap.read() if success: # Run YOLOv8 tracking on the frame, persisting tracks between frames results = model.track(frame, persist=True,classes=[0]) # Visualize the results on the frame annotated_frame = results[0].plot() # Print the bounding box coordinates of each person in the frame print(f"Frame id: {frame_id}") for result in results: for r in result.boxes.data.tolist(): if len(r) == 7: x1, y1, x2, y2, person_id, score, class_id = r print(r) else: print(r) # Display the annotated frame cv2.imshow("YOLOv5 Tracking", annotated_frame) # Increment the frame id frame_id += 1 # Break the loop if 'q' is pressed if cv2.waitKey(1) & 0xFF == ord("q"): break else: # Break the loop if the end of the video is reached break # Release the video capture object and close the display window cap.release() cv2.destroyAllWindows() ``` The above code is working and display the coordinates of tracked persons. But the problem is in some videos it is not working properly 0: 384x640 6 persons, 1292.9ms Speed: 370.7ms preprocess, 1292.9ms inference, 20.8ms postprocess per image at shape (1, 3, 384, 640) Frame id: 0 [849.5707397460938, 103.34817504882812, 996.0990600585938, 371.2213439941406, 1.0, 0.9133888483047485, 0.0] [106.60043334960938, 74.8958740234375, 286.6423645019531, 562.144287109375, 2.0, 0.8527513742446899, 0.0] [221.3446044921875, 60.8421630859375, 354.4775390625, 513.18017578125, 3.0, 0.7955091595649719, 0.0] [472.7821044921875, 92.33056640625, 725.2569580078125, 632.264404296875, 4.0, 0.7659056782722473, 0.0] [722.457763671875, 222.010986328125, 885.9102783203125, 496.00372314453125, 5.0, 0.7482866644859314, 0.0] [371.93310546875, 46.2138671875, 599.2041625976562, 437.1387939453125, 6.0, 0.7454277873039246, 0.0] This output is correct. But for another video there are only three people in the video but at the beginning of the video at 1st frame identify as 6 person. 0: 480x640 6 persons, 810.5ms Speed: 8.0ms preprocess, 810.5ms inference, 8.9ms postprocess per image at shape (1, 3, 480, 640) Frame id: 0 [0.0, 10.708396911621094, 37.77726745605469, 123.68929290771484, 0.36418795585632324, 0.0] [183.0453338623047, 82.82539367675781, 231.1952667236328, 151.8341522216797, 0.2975049912929535, 0.0] [154.15158081054688, 74.86528778076172, 231.10934448242188, 186.2017822265625, 0.23649221658706665, 0.0] [145.61187744140625, 69.76246643066406, 194.42532348632812, 150.91973876953125, 0.16918501257896423, 0.0] [177.25042724609375, 82.43289947509766, 266.5430908203125, 182.33889770507812, 0.131477952003479, 0.0] [145.285400390625, 69.32669067382812, 214.907470703125, 184.0771026611328, 0.12087596207857132, 0.0] Also, the output does not show the person ID here. Only display coordinates, confidence score, and class id. What is the reason for that?
I have written a sql query to find prev year sales one using lag and with `nested cte` and another just without `nested cte` .I am seeing difference in output in MS SQL environment .Query are as below. **Without Nested CTE(Correct output):** with cte as(select * from (select category,product_id,DATEPART(YEAR ,order_date) as order_year,sum(sales) as sales from namastesql.dbo.orders GROUP BY category,product_id,DATEPART(YEAR ,order_date))a) select *,lag(sales) over(partition by category order by order_year) as prev_year_sales from cte where product_id='FUR-FU-10000576' **With Nested CTE (Wrong):** with cte as ( select category, product_id, DATEPART(YEAR, order_date) as order_year, sum(sales) as t_sales from namastesql.dbo.orders GROUP BY category, product_id, DATEPART(YEAR, order_date) ), cte2 as ( select *, lag(t_sales) over (partition by category order by order_year) as prev_year_sales from cte ) select * from cte2 where product_id = 'FUR-FU-10000576'; **Correct Output:** [![enter image description here][1]][1] **Wrong output from nested cte:** [![enter image description here][2]][2] [1]: https://i.stack.imgur.com/kVcTr.png [2]: https://i.stack.imgur.com/X0wMG.png Any help on this will be appreciated .
Writing query in CTE giving wrong output
|sql|sql-server|
I am getting such kind of response for my submission. ``` > Passed Test 1: successfully logged consoleStyler() variables > Failed Test 2: Not logging celebrateStyler() variables > Failed Test 3: Not calling consoleStyler() and celebrateStyler() > Passed Test 4: successfully called styleAndCelebrate() ``` Here is my code. // Task 1: Build a function-based console log message generator ``` function consoleStyler(color,background,fontSize,txt) { var message = "%c" + txt; var style = `color: ${color};` style += `background: ${background};` style += `font-size: ${fontSize};` console.log(message,style) } ``` // Task 2: Build another console log message generator ``` function celebrateStyler(reason) { var fontStyle = "color: tomato; font-size: 50px"; if(reason == "birthday") { console.log("%cHappy Birthday", fontStyle); }else if(reason == "champions") { console.log("%cCongrats on the title!", fontStyle); } else { console.log(message, style); } } ``` // Task 3: Run both the consoleStyler and the celebrateStyler functions ``` consoleStyler('#1d5c63', '#ede6db', '40px', 'Congrats!') celebrateStyler('birthday') ``` // Task 4: Insert a congratulatory and custom message ``` function styleAndCelebrate(color, background, fontSize, txt,reason) { consoleStyler(color, background, fontSize, txt); celebrateStyler(reason); } ``` // Call styleAndCelebrate ``` styleAndCelebrate('ef7c8e','fae8e0','30px','You made it!','champions') ```
I'm newbie in Go. I try to create simple database with sqlite3. I know that sqlite3 doesn't support arrays. Database must send unique feed object for each unique user with array row of authors. When user auth in system, it creates new record in table user: ``` id: 0 <- unique user id phone: "+0 000" feed: 0 <- feed id, same as user id ``` Than in table feed I have row's like: ``` id: 0 <- feed id, same as user id authors: now it's integer and it's needs to be an array isFave: bool <- is user like this author or not ``` So I also have author table where: ``` id: 0 <- unique author id name: "name" ``` So for every unique user I want create unique feed where I store array of authors and I can for every record of authors set isFave or not. How to do it? I also make reference feed id from user table to feed table and make reference from feed author row to author table id. But I can't figure it out what to do further. [![enter image description here](https://i.stack.imgur.com/SJhs0.png)](https://i.stack.imgur.com/SJhs0.png)
How add array of authors for unique user in database in Goland IDE?
|sqlite|go|goland|
null
I have a null object reference but object exist. My model ``` public int getId() { return id; } public void setId(int id) { this.id = id; } public String getPlayerName() { return playerName; } public void setPlayerName(String playerName) { this.playerName = playerName; } public String getPlayerBirthday() { return playerBirthday; } public void setPlayerBirthday(String playerBirthday) { this.playerBirthday = playerBirthday; } public String getPlayerClub() { return playerClub; } public void setPlayerClub(String playerClub) { this.playerClub = playerClub; } public PlayerModel(int id, String playerName, String playerBirthday, String playerClub){ this.id = id; this.playerName = playerName; this.playerBirthday = playerBirthday; this.playerClub = playerClub; } public PlayerModel(String playerName, String playerBirthday, String playerClub) { this.playerName = playerName; this.playerBirthday = playerBirthday; this.playerClub = playerClub; } ``` In my PlayerList activity ``` public class PlayerList extends AppCompatActivity { ListView lvPlayerList; ArrayList<PlayerModel> arrayList; PlayerListAdapter adapter; DatabaseManager playerDb; ImageButton btnPLToHome,btnToAP; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_player_list); playerDb = new DatabaseManager(this); arrayList=playerDb.getPlayerData(); lvPlayerList = findViewById(R.id.lvPlayerList); btnPLToHome=findViewById(R.id.btnPLToHome); btnToAP=findViewById(R.id.btnToAP); lvPlayerList.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { PlayerModel playerModel=arrayList.get(position); Intent intent = new Intent(PlayerList.this, MainActivity.class); intent.putExtra("PLAYER",playerModel); startActivity(intent); } }); ``` In my main activity ``` public class MainActivity extends AppCompatActivity { Button btnToMatch,btnToDataListActivity,btnToAddPlayer,btnToAddClub; int year,month,day; TextView tvMainPN,tvMainPB,tvMainPC; EditText etOpponentClub,etCategory,etDate; String playerName,opponent,date; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); btnToMatch = findViewById(R.id.btnToMatch); btnToDataListActivity = findViewById(R.id.btnToDataListActivity); btnToAddPlayer=findViewById(R.id.btnToAddPlayer); btnToAddClub=findViewById(R.id.btnToAddClub); tvMainPN = findViewById(R.id.tvMainPN); tvMainPB = findViewById(R.id.tvMainPB); tvMainPC = findViewById(R.id.tvMainPC); etOpponentClub = findViewById(R.id.etOpponentClub); etCategory = findViewById(R.id.etCategory); etDate = findViewById(R.id.etDate); PlayerModel playerModel=(PlayerModel) getIntent().getExtras().getSerializable("PLAYER"); tvMainPN.setText(playerModel.getPlayerName()); tvMainPB.setText(playerModel.getPlayerBirthday()); tvMainPC.setText(playerModel.getPlayerClub()); ``` Logcat error ``` Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.io.Serializable android.os.Bundle.getSerializable(java.lang.String)' on a null object reference ``` I try differents solutions for display data from sqlite but nothing work. Always the same error with getting data directly from database, intent, parcelable. What do i forget? I think i must to inisialize something but what and where? Someone have an idea? tks
null object reference with intent,parcelable and getting data sqlite. Everythink is coded in onCreate in the different layout
This is more a hint than a question: The goal is to parse a command line **AND** create a useful *usage* message code: for arg ; do case "$arg" in --edit) # edit file cd "$(dirname $0)" && vim $0 ;; --noN) # do NOT create 'NHI1/../tags' let noN=1 ;; --noS) # do NOT create 'HOME/src/*-latest/tags' let noS=1 ;; --help) ;& *) echo -e "usage: $(basename $0) options...\n$(awk '/--?\w+\)/' "$0")" ; exit ;; esac done this create the *usage* message: > build_tags.bash -x usage: build_tags.bash options... --edit) # edit file --noN) # do NOT create 'NHI1/../tags' --noS) # do NOT create 'HOME/src/*-latest/tags' --help) # write this help message the clue is that the *definition* of the *case* target is also the *documentation* of the *case* target.
I am using linux (Ubuntu 22.04) and wanted to run the gitlab-runner with the following yaml file locally: ```yaml image: ubuntu:latest test: script: - echo "Hello Gitlab-Runner" ``` When I execute `gitlab-runner exec docker test`, I get the following error: ``` Running with gitlab-runner 11.2.0 (11.2.0) Using Docker executor with image ubuntu:latest ... ERROR: Preparation failed: Error response from daemon: {"message":"client version 1.18 is too old. Minimum supported API version is 1.24, please upgrade your client to a newer version"} (executor_docker.go:1147:0s) Will be retried in 3s ... ``` I checked the docker version I have: ``` Client: Docker Engine - Community Version: 26.0.0 API version: 1.45 Go version: go1.21.8 Git commit: 2ae903e Built: Wed Mar 20 15:17:51 2024 OS/Arch: linux/amd64 Context: default Server: Docker Engine - Community Engine: Version: 26.0.0 API version: 1.45 (minimum version 1.24) Go version: go1.21.8 Git commit: 8b79278 Built: Wed Mar 20 15:17:51 2024 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.6.28 GitCommit: ae07eda36dd25f8a1b98dfbf587313b99c0190bb runc: Version: 1.1.12 GitCommit: v1.1.12-0-g51d5e94 docker-init: Version: 0.19.0 GitCommit: de40ad0 ``` Any ideas?
KeyboardAvoidingView makes a messy the flexbox
|javascript|css|react-native|mobile|expo|
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) ``` 1B rows: ``` # top_k ??? (crashed) # filter+rank 1min 6s ± 559 ms per loop (mean ± std. dev. of 7 runs, 1 loop each) # argpartition 7.86 s ± 48.7 ms per loop (mean ± std. dev. of 7 runs, 1 loop each) ```
I'm trying to follow a tutorial on DirectX, and the tutorial is working with DX9. I do not have the older SDK (June 2010) installed, and would prefer to keep it that way. All the blurb I can find says 'everything's now in the Windows SDK'. I've got a basic app running, showing a triangle on the screen - by supplying pre-transformed vertices. Now I want to start doing the transforms from model to world space (and the other pipeline bits). The problem is, the tutorial uses D3DXMATRIX, and that is deprecated in the new SDK so I don't have the header files for it. The code calls `SetTransform(D3DTS_WORLD, &matTranslate)`, which actually takes a D3DMATRIX. I can declare a D3DMATRIX, no problem. The problem is that the tutorial uses `D3DMatrixTranslation()`, which is also in the older SDK. Irritatingly, whenever I search for "D3DMATRIX translation" it always comes up with D3DXMATRIX - I cannot for the life of me find anything for a D3DMATRIX. I have scanned `directxmath.h`, the advised replacement, but that only deals with XMMATRIX (and for some reason Visual Studio says `XMMatrixTranslation` is undefined). I've also scanned `d3d9.h` where `SetTransform()` is defined, and `d3d9types.h` where D3DMatrix is defined... but I cannot find anything about translating, scaling, and rotating. Are there functions - in the Windows SDK stuff for DirectX - that transform D3DMATRIX? A link to a DX10 tutorial using XMMATRIX would be OK, if anyone has one - as long as it starts from the ground up - but since D3DMATRIX and `SetTransform()` exist in the Windows SDK, I'd prefer to find that 'missing link' and know how to manipulate D3DMATRIX. Can anyone help?
I want to do marquee animation in tailwind and next.js and some of it I have done. Only issue I am having is that it is not showing one after the other with first. Second time it will show after some time. I want it to be like this [![Want it like this](https://i.stack.imgur.com/5AKUJ.png)](https://i.stack.imgur.com/5AKUJ.png) but it is showing like this [![Showing like this](https://i.stack.imgur.com/x48lE.png)](https://i.stack.imgur.com/x48lE.png). Here is the code of the tailwind css ``` .animate-marquee { animation: marquee 10s linear infinite; float: left; } ``` Here is the component code ``` import { useRouter } from "next/router"; import pathChecking from "../../utils/pathChecking"; import Image from "next/image"; const testimonial_data = [ { desc: "Inform, inspire, connect, and collaborate for meaningful action.", id: "0General Partner at Entrepreneur", }, { desc: "Addressing the world’s biggest environmental and social challenges.", id: "1General Partner at Entrepreneur", }, { desc: "Fun, interactive, and immersive technology for real-world positive outcomes. ", id: "2General Partner at Entrepreneur", }, ]; const HeroSliderComponent = () => { const route = useRouter(); return ( <> <div className=" flex animate-marquee space-x-8 w-10000"> {testimonial_data.map((item, index) => { const { id, img, title, desc, name } = item; return ( <div className="text-white" key={id}> <div className={`relative rounded-2.5xl border border-jacarta-100 bg-white p-12 transition-shadow hover:shadow-xl dark:border-jacarta-700 dark:bg-jacarta-700 `} > <p className="block font-display text-xl font-medium group-hover:text-accent dark:text-white text-center"> {desc} </p> </div> </div> ); })} </div> </> ); }; export default HeroSliderComponent; ``` Infinite marquee with break or delays.
I want to do marquee animation in tailwind and next.js
|css|next.js|tailwind-css|
null
I want to create custom text input component using this guide https://docs.expo.dev/modules/native-view-tutorial/ however I found that to provide ability to use styling and all another basic things from React Native TextInput I should extend it somehow. My current implementation relay on UITextField. How can I extend RN TextInput instead of UITextField? ```swift class InputView: ExpoView, UITextFieldDelegate { var value: String? { didSet { updateTextField() } } var textField = UITextField() required init(appContext: AppContext? = nil) { super.init(appContext: appContext) self.addSubview(textField) clipsToBounds = true addSubview(textField) textField.delegate = self } // Another implementation } ```
I developed a Windows Form application and I used "Windows Application Packaging Project" in Visual Studio 2022 (17.9.4) to generate the appxbundle and the appinstaller file to sideload the app, published on my website (accessible using HTTPS). Appxbundle is generated correctly and I'm able to install the app by double-clicking it. However, double-clicking the appinstaller file fails with error "Error in parsing the app package". No errors are logged in Event viewer, in the registries Microsoft/Windows/AppxDeployment* and Microsoft/Windows/AppxPackagingOM. App is signed with a certificate (not self-signed) and the certificate is installed onto the PCs on which I'm trying to install the app; I tried both on Windows 11 and Windows 10 with the latest updates. Using `Add-AppxPackage -Appinstaller` command in PowerShell works, but I need to install the app by double-clicking appinstaller file. I already read many similar posts on SO (["Error in parsing the app package." when opening Windows 10 .appinstaller file from web (MSIX)](https://stackoverflow.com/questions/55810387/error-in-parsing-the-app-package-when-opening-windows-10-appinstaller-file-f), [MSIX Web Installer not working - Error in parsing the app package](https://stackoverflow.com/questions/65151313/msix-web-installer-not-working-error-in-parsing-the-app-package), [UWP .appinstaller - "Error in parsing the app package."](https://stackoverflow.com/questions/50485153/uwp-appinstaller-error-in-parsing-the-app-package) and others) but none of them solve my problem. Checks I've done so far: - following the guide [Troubleshoot installation issues with the App Installer file](https://learn.microsoft.com/en-us/windows/msix/app-installer/troubleshoot-appinstaller-issues) - setting MIME type (both [these](https://learn.microsoft.com/en-us/windows/msix/app-installer/troubleshoot-appinstaller-issues#files-not-accessible) and [these](https://learn.microsoft.com/en-us/windows/msix/app-installer/web-install-iis#step-7---configure-the-web-app-for-app-package-mime-types)) - checking that my webserver supports byte range requests - checking the accessibility of appinstaller URI and appxbundle URI set in appinstaller file What else could I check? Thank you in advance.
I want to create a new puppeteer browser when a Laravel Worker gets created. Right now, my Horizon config allows for a minimum of 2 and a maximum of 10 workers running. As demand increases and workers are created, I'd like to create a new browser for Puppeteer. When a worker is removed, it can close that browser. Are there any Laravel events that would work for this? Or am I coming at this the wrong way? I looked into puppeteer-cluster, but that's another queue to interact with when I already have one with Laravel. And the puppeteer-pool is out of date.
I used part of above as a basis then below to get the values from id = 2 select * from ( select id,json_parse(super_field::text) super_field from test.array_test ) arr, arr.super_field t1 I am only using insert to show example I am using redshift copy command to import the data so I don't have the option to put json_parse round values when inserting
`pipewire` is a higher lever tool than **ALSA**. When **ALSA** provides direct access right to the sound devices, **Pipewire** manages the connections between them and provides a higher level entry points to the same set of devices. As the name says, pipewire wires the PIPES, which in the case of sound contain audio streams - it's a sound server. With pipewire your app will have it easier to output or input to multiple sound devices, and pipewire will do the mixing of the signals for you (or you can instruct it explicitly what to do thanks to the pipewire plugins or filter chains). Pipewire should also provide a rather low latency (compared to raw ALSA) - it's made both for audio professionals and the casual users. And lastly, ALSA is cumbersome to use, the library is barely documented, `pipewire` being more modern should come with a better set of examples and more responsive community. If you do not know the target sound device that your app will work with then `pipewire` is the better choice. On the other hand if the app is meant for a specific hardware, then direct connection to ALSA makes more sens, certainly providing the lowest latency and most flexibility.
I'm having trouble building v8 and libv8 to use with v8js php library. I'm running `gm x64.release` on the depot_tools git repo after running `fetch v8; cd v8` and the v8 file and g8 file gets created but the problem is that i cannot find the libv8/libnode required to compile v8js using pecl (https://github.com/phpv8/v8js). I tried installing libv8-dev (on Ubuntu 22 it automatically replaces it with libnode-dev) but still nothing. How can i solve this? Thanks a lot! P.S: This is the output i get once i run the pecl install: ```shell sudo pecl install v8js WARNING: channel "pecl.php.net" has updated its protocols, use "pecl channel-update pecl.php.net" to update downloading v8js-2.1.2.tgz ... Starting to download v8js-2.1.2.tgz (102,977 bytes) ........................done: 102,977 bytes 28 source files, building running: phpize Configuring for: PHP Api Version: 20210902 Zend Module Api No: 20210902 Zend Extension Api No: 420210902 configure.ac:22: warning: $as_echo is obsolete; use AS_ECHO(["message"]) instead build/php.m4:2111: PHP_CONFIG_NICE is expanded from... configure.ac:22: the top level configure.ac:165: warning: The macro `AC_PROG_LIBTOOL` is obsolete. configure.ac:165: You should run autoupdate. build/libtool.m4:99: AC_PROG_LIBTOOL is expanded from... configure.ac:165: the top level Please provide the installation prefix of libv8 [autodetect] : /home/romeo/v8/out/x64.release building in /tmp/pear/temp/pear-build-rootfd2rq7/v8js-2.1.2 running: /tmp/pear/temp/v8js/configure --with-php-config=/usr/bin/php-config --with-v8js=/home/romeo/v8/out/x64.release checking for grep that handles long lines and -e... /usr/bin/grep checking for egrep... /usr/bin/grep -E checking for a sed that does not truncate output... /usr/bin/sed checking for pkg-config... /usr/bin/pkg-config checking pkg-config is at least version 0.9.0... yes checking for cc... cc checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether the compiler supports GNU C... yes checking whether cc accepts -g... yes checking for cc option to enable C11 features... none needed checking how to run the C preprocessor... cc -E checking for icc... no checking for suncc... no checking for system library directory... lib checking if compiler supports -Wl,-rpath,... yes checking build system type... x86_64-pc-linux-gnu checking host system type... x86_64-pc-linux-gnu checking target system type... x86_64-pc-linux-gnu checking for PHP prefix... /usr checking for PHP includes... -I/usr/include/php/20210902 -I/usr/include/php/20210902/main -I/usr/include/php/20210902/TSRM -I/usr/include/php/20210902/Zend -I/usr/include/php/20210902/ext -I/usr/include/php/20210902/ext/date/lib checking for PHP extension directory... /usr/lib/php/20210902 checking for PHP installed headers prefix... /usr/include/php/20210902 checking if debug is enabled... no checking if zts is enabled... no checking for gawk... gawk checking for V8 Javascript Engine... yes, shared checking for V8 files in default path... not found configure: error: Please reinstall the v8 distribution ERROR: `/tmp/pear/temp/v8js/configure --with-php-config=/usr/bin/php-config --with-v8js=/home/romeo/v8/out/x64.release' failed ```
Unable to run gitlab-runner with docker
|linux|docker|api|gitlab-ci-runner|
The answer above is old. `http.request` now accepts a timeout option in: http.request(options[, callback]) http.request(url[, options][, callback]) From the [doc][1]: > timeout <number>: A number specifying the socket timeout in > milliseconds. This will set the timeout before the socket is > connected. [1]: https://nodejs.org/api/http.html#httprequestoptions-callback
A service pod is running with Istio sidecar container and is MTLS enabled. How do we define a service monitor to scrape metrics from this service ? Do we need to update the Prometheus server for the same ?
How do we configure prometheus server to scrape metrics from a pod with Istio sidecar proxy?
|kubernetes|prometheus|istio-sidecar|istio-prometheus|
I’m making an in app purchase for my game on Steam. On my server I use python 3. I’m trying to make an https request as follows: conn = http.client.HTTPSConnection("partner.steam-api.com") orderid = uuid.uuid4().int & (1<<64)-1 print("orderid = ", orderid) key = "xxxxxxxxxxxxxxxxxxx" # omitted for security reason steamid = "xxxxxxxxxxxxxxxxxxx" # omitted for security reason pid = "testItem1" appid = "480" itemcount = 1 currency = 'CNY' amount = 350 description = 'testing_description' urlSandbox = "/ISteamMicroTxnSandbox/" s = f'{urlSandbox}InitTxn/v3/?key={key}&orderid={orderid}&appid={appid}&steamid={steamid}&itemcount={itemcount}&currency={currency}&itemid[0]={pid}&qty[0]={1}&amount[0]={amount}&description[0]={description}' print("s = ", s) conn.request('POST', s) r = conn.getresponse() print("InitTxn result = ", r.read()) I checked the s in console, which is: ``` s = /ISteamMicroTxnSandbox/InitTxn/v3/?key=xxxxxxx&orderid=11506775749761176415&appid=480&steamid=xxxxxxxxxxxx&itemcount=1&currency=CNY&itemid[0]=cgdiamond5&qty[0]=1&amount[0]=350&description[0]=testing_description ``` However I got a bad request response: ``` InitTxn result = b"<html><head><title>Bad Request</title></head><body><h1>Bad Request</h1>Required parameter 'orderid' is missing</body></html>" ```` How to solve this? Thank you! BTW I use almost the same way to call GetUserInfo, except changing parameters and replace POST with GET request, and it works well.
null
I am learning how to create Extent Reports from Youtube. I am trying to write the code for the same. But when I am trying to attach sparkeReports to extentreports, I am facing the mentioned error. Below is my code: ```java public class ExtentReports { ExtentSparkReporter sparkReports; ExtentReports reports; ExtentTest test; @Test public void startReport() { sparkReports = new ExtentSparkReporter(System.getProperty("user.dir") + "/test-output/MyOwnReports.html"); reports = new ExtentReports(); reports.attachReporter(sparkReports); } } ``` I tried multiple ways but I am not able to find 'attachReporter()' method due to which I am not able to move ahead. Please help me. I am using Selenium version 4.8.3 and Extent Reports version 5.0.9
DirectX 9 With No SDK Installed - How To Translate a D3DMATRIX?
|windows|matrix|sdk|translation|directx-9|
def swap(lst): l=len(lst) l2=list(lst) l3=[] l6=[] if l<4: for i in range(len(l2)): if i+2<len(l2): l3.append(l2[i+2]) l3.append(l2[i]) elif l>4: l4=lst[:4]#1st 4 l5=lst[4:] for i in range(len(l4)): if i+2<len(l4): l3.append(l4[i+2]) l3.append(l4[i]) for i in range(len(l5)): if i+1<len(l5) and (l5[i+1] not in l6): l6.append(l5[i+1]) if len(l6)<len(l5) and l5[i] not in l6: l6.append(l5[i]) lst=l3+l6 return lst print(swap([200,456,300,100,234,678])) What the question mentioned was not an ordinary shuffle/alternate shuffle Look at the image for understanding:[1] Here is my thought process: For the first four elements, last two elements replace [n-2]th element for the next consecutive terms, each term is swapped with next one continously [1]: https://i.stack.imgur.com/Qgw6u.jpg
Some problems with pm2. have latest version of pm2. After any commands pm2 think about 30-40 seconds. in processes I see nodejs process that consume CPU and memory by exponent. After reach limit - crush. win PC. nvm installed. What is happenned with pm2? I tried uninstall-install pm2. problem not solved
pm2 problems: slow and crush
|node.js|pm2|
null
This should only be used in testing. [Here is some documentation in golang's wiki][1] If you've generated some mock code such as with mockgen and it imports your package code, and then your testing package **also** imports your package code, you get a circular dependency (Something golang chooses to let the user to decide how to resolve). However, if inside your testing package you use dot notation on the package you're testing then they are treated as the same package and there is no circular dependency to be had! [1]: https://go.dev/wiki/CodeReviewComments#import-dot
null
You cannot set the StatusBar background color in iOS. However, there’s a work-around, i.e, you have to define the background color of the header in the Stack Navigator of @react-navigation/stack import React, {useState, useEffect} from 'react'; import {NavigationContainer} from '@react-navigation/native'; import {createStackNavigator} from '@react-navigation/stack'; //Pages import Dashboard from "./Dashboard"; const AppLoad = createStackNavigator(); const App = () => { return ( <NavigationContainer> <AppLoad.Navigator initialRouteName='Dashboard'> <AppLoad.Screen name="Dashboard" component={Dashboard} options={{ headerTitle: null, headerLeft: null, headerStyle: { backgroundColor: '#0891b2', shadowColor: 'transparent', elevation: 0, height: 48, }, }}/> </AppLoad.Navigator> </NavigationContainer> ) } [![Expo SDK50][1]][1] [1]: https://i.stack.imgur.com/XVjJi.png
"Error in parsing the app package" with AppInstaller with online Uri
|.net|msix|appinstaller|
null
You can use [ZREMRANGEBYRANK][1] to remove the rest of the elements, that is, `ZREMRANGEBYRANK key 0 -1501` You can execute this command periodically / after each insertion / after each _k_ insertions. [1]: https://redis.io/commands/zremrangebyrank/
No, you can't do that in JavaScript or TypeScript. But depending on *why* you're trying to do it, destructuring can help. The closest you can get is to use the deprecated `with` statement *(I **don't** recommend it)*, which adds an object to the top of the scope chain, so any freestanding identifier references are checked against the object's properties: <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-js --> function example(o) { with (o) { // deprecated console.log(answer); } } const obj = { answer: 42 }; example(obj); // Outputs 42 <!-- end snippet --> **There are several problems with `with`, though**, which is why it's disallowed in the strict variant of JavaScript (which is the default inside modules, `class` constructs, and other new scopes created in ES2015+, as well as any function or script with `"use strict";` at the beginning). Those same problems are why it's not supported in TypeScript (TypeScript *will* copy it over to the transpiled JavaScript code, but with an error, and it will use `any` as the type of symbols inside the `with`; [example][1]). Another close version is to pass an object to a function that uses destructuring in its parameter list: <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-js --> function example({answer}) { console.log(answer); } const obj = { answer: 42 }; example(obj); // Outputs 42 <!-- end snippet --> **but** a major caveat there is that you can't assign new values to properties that way (and worse, if you try&nbsp;&mdash; for instance, with `answer = 67`&nbsp;&mdash; it updates the parameter's value but not the object's property value). To deal with that, you might use destructuring inside the function instead, with `const` so you don't forget you can't update the value (or to get an early error if you try): <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-js --> function example(o) { const {answer} = o; console.log(answer); // answer = 67; // <== Would cause error // o.answer = 67; // <== Would work } const obj = { answer: 42 }; example(obj); // Outputs 42 <!-- end snippet --> [1]: https://www.typescriptlang.org/play?alwaysStrict=false#code/MYewdgzgLgBCBGArGBeGBvAhgLhgFgCYBfAbgCgB3ASygAsYAKBRASgzJk5lEhABsApgDo+IAOZMkLcl27gI-YaImZpZIkA
Here is example code using .map with simplified data: import pandas as pd df = pd.DataFrame({'x1': [65, 66, 67], 'x2': [68, 69, 70], 'x3': [71, 72, 73], 'y': [10, 11, 12] }) x_list = ['x1', 'x2', 'x3'] df[x_list] = df[x_list].map(chr) print(df) gives x1 x2 x3 y 0 A D G 10 1 B E H 11 2 C F I 12 and to join the characters: df['x'] = pd.Series(map(''.join, df[x_list].values.astype(str).tolist())) giving: x1 x2 x3 y x 0 A D G 10 ADG 1 B E H 11 BEH 2 C F I 12 CFI
Here Is my error for the my javascript code
|javascript|
null
Apache Cassandra Node Driver Connection
I have the following code: ``` - var a = 5; - var b = 3; script if (a === 5) if (b === 2) . var x = true; include script.js ``` I want to include the script.js file when `a == 5` and if `b === 2`, I want to insert a new line `var x = true` above, inside the <script> tag. However, when I use the code, the `x = true` is always inserted. [![enter image description here][1]][1] You can verify it here: https://pugjs.org/language/includes.html [1]: https://i.stack.imgur.com/awYZX.png
Is this a pug template bug or my misunderstanding of the grammar?
|pug|
I have a `@Retryable` placed at the class level. ``` @Import({GrpcClientRetryConfig.class}) @Retryable(interceptor = "grpcClientRetryInterceptor") @Component public class Profile { public void method1() { System.out.println("Method1"); method2(); } public void method2() { System.out.println("Method2"); ... throw new RunTimeException("Testing"); } } @EnableRetry @Configuration public class GrpcClientRetryConfig { @Bean public RetryOperationsInterceptor grpcClientRetryInterceptor() { val template = new RetryTemplate(); val backOffPolicy = new ExponentialBackOffPolicy(); // Set the exponential backoff parameter val interceptor = new RetryOperationsInterceptor(); val simpleRetry = new SimpleRetryPolicy(); simpleRetry.setMaxAttempts(2); template.setRetryPolicy(simpleRetry); template.setBackOffPolicy(backOffPolicy); template.setListeners(new GrpcClientRetryListener[] {new GrpcClientRetryListener()}); interceptor.setRetryOperations(template); return interceptor; } } ``` **Case 1** ``` val profile = new Profile(); profile.method2(); // retried 2 times. "Method2" is printed twice, and then an exception is thrown ``` **Case 2** ``` val profile = new Profile(); profile.method1(); // "Method1" printed once. "Method2" is printed twice, and then an exception is thrown ``` Can someone let me know why `method1()` is not retried twice in the second case? How does spring determine which methods to be retried when a `@Retryable` is placed at the class level?
How does spring-retry determine which methods to retry when @Retryable is placed at the class level?
|java|spring|spring-boot|spring-retry|
I have two tables `keywords` and `posts` in my PieCloudDB Database. Each topic can be expressed by one or more keywords. If a keyword of a certain topic exists in the content of a post (**case insensitive**) then the post has this topic. For example: | topic_id | keyword | | -------- | ---------- | | 1 | basketball | | 2 | music | | 3 | food | | 4 | war | | post_id | content | | ------- | --------------------------------------------------------------- | | 1 | A typhoon warning has been issued in southern Japan | | 2 | We are going to play neither basketball nor volleyball | | 3 | I am indulging in both the delightful music and delectable food | | 4 | That basketball player fouled again | Now I want to find the topics of each post according to the following rules: - If the post does not have keywords from any topic, its topic should be "`Vague!`". - If the post has at least one keyword of any topic, its topic should be a string of the IDs of its topics sorted in ascending order and separated by commas ','. For the above example data, the results should be: | post_id | topics | | ------- | ------ | | 1 | Vague! | | 2 | 1 | | 3 | 2,3 | | 4 | 1 | ``` SELECT post_id, COALESCE(array_to_string(array_agg(DISTINCT topic_id ORDER BY topic_id), ','), 'Vague!') AS topic FROM ( SELECT p.post_id, k.topic_id FROM Posts p LEFT JOIN Keywords k ON LOWER(content) LIKE '% ' || keyword || ' %' OR content LIKE keyword || ' %' OR content LIKE '% ' || keyword ) a GROUP BY post_id ORDER BY post_id ``` I tried this query but the results I got were not exactly correct. I don't know why the output of post 1 is `null`: | post_id | topics | | ------- | ------ | | 1 | | | 2 | 1 | | 3 | 2,3 | | 4 | 1 | Can anyone give me a correct answer?(If you don’t know the database I use, you can use PostgreSQL instead, thanks)
How to install V8Js for PHP on Linux Ubuntu 22.04?
|php|build|v8|pecl|v8js|
I would like some help with a problem that has had stumped me for two days. I have 'results' table like this: ``` result_id competition_id competitor_id competitor_ranking 1 1 1 0.1 2 1 2 0.4 3 1 3 0.2 4 1 4 0.3 5 2 1 0.4 6 2 2 0.1 7 2 3 0.2 8 2 5 0.3 9 3 3 0.1 10 3 4 0.4 11 3 5 0.2 12 3 6 0.3 ``` From the 'results' table I want to get a grouped ranking of competitors with penalties points (+1.0) included, like this: ``` competitor_id competitions rankings ranking_with_penalties 1 1; 2; M 0.1; 0.4 0.1; 0.4; +1.0 2 1; 2; M 0.4; 0.1 0.4; 0.1; +1.0 3 1; 2; 3 0.2; 0.2; 0.1 0.2; 0.2; 0.1 4 1; M; 3 0.3; 0.4 0.3; +1.0; 0.4 5 M; 2; 3 0.3; 0.2 +1.0; 0.3; 0.2 6 3 M; M; 0.3 0.3; +1.0; +1.0 ``` I know that group_concat function is an aggregate function that concatenates all non-null values in a column. I understand that the task is quite trivial. But I can not solve it. ``` CREATE TABLE results ( result_id INTEGER PRIMARY KEY, competition_id INTEGER, competitor_id INTEGER, competitor_ranking ); INSERT INTO results(competition_id, competitor_id, competitor_ranking) VALUES (1, 1, 0.1), (1, 2, 0.4), (1, 3, 0.2), (1, 4, 0.3), (2, 1, 0.4), (2, 2, 0.1), (2, 3, 0.2), (2, 5, 0.3), (3, 3, 0.1), (3, 4, 0.4), (3, 5, 0.2), (3, 6, 0.3) ; SELECT competitor_id, group_concat(coalesce(competition_id, NULL), '; ') AS competitions, group_concat(coalesce(competitor_ranking, NULL), '; ') AS rankings, group_concat(coalesce(NULLIF(competitor_ranking, NULL), '+1.0'), '; ') AS ranking_with_penalties FROM results GROUP BY competitor_id; ``` I'm looking forward to any help.
(SQLite) Help me with GROUP BY and GROUP_CONCAT for calculating competitions ranking
|sqlite|group-by|ranking|group-concat|
null
I was searching to see if anyone else ran into our problem with `&&`, and our solution was to use `;` in its place. `&&` worked fine in RHEL 7, but the server was upgraded to RHEL 8 over the weekend and the task file started failing. So try replacing `&&` with `;`.
I have a large program that's generating object files that are much larger than I expect. My suspicion is that somewhere in the program, someone is using inefficient template metaprogramming that's generating O(n**2) template types. Is there a command-line tool that I can use to list all of the template types that exist in an object file (.o)? Normally I would suspect `nm` or `objdump` is the right tool for this kind of thing, but it's not obvious to me what flags to pass to list the template types. I've verified that the information is in the .o file using this simple test program: ``` template <typename T, typename... Ts> struct foo : public foo<Ts...> {}; template <> struct foo<int> {}; void bar() { foo<int, int, int, int, int, int, int, int> x; } ``` Then running: ``` gcc -g -c test.c -o test.o && strings test.o ``` Outputs: ``` foo<int, int, int, int, int, int, int, int> GNU C++17 13.2.0 -mtune=generic -march=x86-64 -g -fasynchronous-unwind-tables _Z3barv foo<int, int, int, int, int, int, int> foo<int, int, int, int> foo<int, int, int, int, int, int> foo<int, int, int> foo<int> foo<int, int> foo<int, int, int, int, int> /tmp test.cc /tmp test.cc test.cc GCC: (Debian 13.2.0-10) 13.2.0 test.cc _Z3barv .symtab .strtab .shstrtab .text .data .bss .rela.debug_info .debug_abbrev .rela.debug_aranges .rela.debug_line .debug_str .debug_line_str .comment .note.GNU-stack .rela.eh_frame ``` I'm looking for a command that will output `foo<int>`, `foo<int, int>`, etc. from test.o.
I would like to lazy load some components but later after the components immediately visible have been loaded. How to do ?
use suspense and lazy loading but with more delay between each
|reactjs|lazy-loading|
I am new in Selenium, here is the error that i showed up **My code:** ```python def job_search(self): """This function goes to the 'Jobs' section and looks for all the jobs that match the keywords and location""" # Go to the LinkedIn job search page self.driver.get("https://www.linkedin.com/jobs") # Wait for the job search page to load fully WebDriverWait(self.driver, 15).until(EC.presence_of_element_located((By.CSS_SELECTOR, ".jobs-search-box__text-input[aria-label='Search by title, skill, or company']"))) # Search based on keywords and location search_keywords = self.driver.find_element(By.CSS_SELECTOR, ".jobs-search-box__text-input[aria-label='City, state, or zip code']") search_keywords.clear() search_keywords.send_keys(self.keywords) # Wait for the search location input field to be interactable search_location = WebDriverWait(self.driver, 10).until(EC.element_to_be_clickable((By.CSS_SELECTOR, ".jobs-search-box__input--location"))) search_location.clear() search_location.send_keys(self.location) search_location.send_keys(Keys.RETURN) ``` **Here is the error that i got** ``` ElementNotInteractableException: element not interactable (Session info: chrome=114.0.5735.134) ``` I want to interact with "Search bar" in LinkedIN, but unfortunately the error welcomed me