instruction
stringlengths
0
30k
|excel|excel-formula|
If there is in fact no way to add that content to its own section which is set to be full width (instead of it being a part of the main body), then the following CSS, added to the CSS you posted in your question, will achieve the full-width effect that you're looking for. width: calc(100vw - 17px); margin-left: calc((100vw - (100% + 17px)) / -2); box-sizing: border-box; As a preemptive note, if you were to add the CSS via the CSS Editor instead of via a `style` tag as you did, you would have to use the following instead of the above, due to Squarespace's LESS interpreter/compiler: width: ~"calc(100vw - 17px)"; margin-left: ~"calc((100vw - (100% + 17px)) / -2)"; box-sizing: border-box;
This is not a complete answer, but a demonstration of a strategy. You could try pre-parsing your input statements to extract parenthesised blocks, and replace them with placeholders. After that, it should be trivial to parse the other statements. And with the placeholders in the original string, it is easy to reassemble it. ```perl use strict; use warnings; use Data::Dumper; my @data; while (<DATA>) { my %block; my $count = 0; chomp; $block{original} = $_; while (s/\(([^)]+)\)/block$count/) { $block{"block$count"} = $1; $count++; if ($count > 100) { # safety precaution warn "Too many blocks!"; last; } } $block{main} = $_; push @data, \%block; } print Dumper \@data; __DATA__ test1=1 AND ( test2=2 ) AND (test3=4 OR test3=9 OR test3=3 OR test3=5) ( test1=2 AND test2=1 ) OR ( test1=2 AND test2=6 ) OR ( test1=2 AND test2=8 ) OR ( test1=2 AND test2=10 ) test1 = '1' AND test3 = '3' ``` Output: ``` $VAR1 = [ { 'main' => 'test1=1 AND block0 AND block1', 'block0' => ' test2=2 ', 'original' => 'test1=1 AND ( test2=2 ) AND (test3=4 OR test3=9 OR test3=3 OR test3=5)', 'block1' => 'test3=4 OR test3=9 OR test3=3 OR test3=5' }, { 'block0' => ' test1=2 AND test2=1 ', 'main' => 'block0 OR block1 OR block2 OR block3', 'original' => '( test1=2 AND test2=1 ) OR ( test1=2 AND test2=6 ) OR ( test1=2 AND test2=8 ) OR ( test1=2 AND test2=10 )', 'block1' => ' test1=2 AND test2=6 ', 'block3' => ' test1=2 AND test2=10 ', 'block2' => ' test1=2 AND test2=8 ' }, { 'original' => 'test1 = \'1\' AND test3 = \'3\'', 'main' => 'test1 = \'1\' AND test3 = \'3\'' } ]; ```
null
null
null
null
{"OriginalQuestionIds":[72895405],"Voters":[{"Id":3001761,"DisplayName":"jonrsharpe"},{"Id":9072753,"DisplayName":"KamilCuk"},{"Id":724039,"DisplayName":"Luuk"}]}
|avaloniaui|avalonia|
I have Map in Java: Map<Pair<String, String>, MyClass> myMap; I need the Pair to **NOT** be case-sensitive. The solution in case of regular string key is simple: TreeMap<String, MyClass> myMap= new TreeMap(String.CASE_INSENSITIVE_ORDER); But, what about case of strings-pair key? I need to compare `first` (left) value *case-sensitive* and then `second` (right) *case-insensitive*.
Case-insensitive map key where key is Pair<String, String>
I am looking for an operation that creates a matrix from a colwise operation in Eigen. I could not find an appropriate operation in [VectorwiseOp](https://eigen.tuxfamily.org/dox/classEigen_1_1VectorwiseOp.html) (sorry if I overlooked one). It seems that it is supported for some operations. First output compiles fine, second output gives an error. (https://www.godbolt.org/z/qrrfa1brx) ``` #include <Eigen/Core> #include <iostream> int main() { Eigen::Matrix3d m; m << 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0; std::cout << m + m.rowwise().sum().replicate(1, 3) << std::endl; // OK std::cout << m + m.rowwise() << std::endl; // Failure: operator + not found. } ``` In the context I want to apply this, it is not possible for me to use `rowwise` as an lhs operator. I want to apply other matrix operations on the result. Maybe an `matri()` or `array()` method in the `VectorwiseOp` would solve this gap.
Converting rowwise back to matrix
|eigen|eigen3|
I'm working on a project with a multi-tenant database (MySQL, Java JDBC). Each tenant can be considered a "group", and each "group" has multiple "users". My main confusion is how best to secure this, so members of a group can only access data from that group, even though they're all logging in with separate credentials. If I was just having a group-based login, it'd be simple: one schema per group, one database user with access to each schema. This could make it so that access would be completely restricted, since without that group's password no one can access that schema. It's with the users, what I'll be calling the "application users", that things get complicated. Each application user would be associated with a group, and when that application user logs in, they would need access to the group they are associated with. In essence, they log in as an application user, and are granted the credentials for a database user. Right now, the idea just seems to unwieldy and insecure. If there is a way for the JDBC application layer to grant access to any database level user account, then that security becomes pointless, since it would become easy to bypass. I'm looking for guidance about how to best secure this kind of environment.
I'm facing a perplexing issue in Visual Studio Code where the string "\<ctrl63\>" is unexpectedly appearing in my code when using autocompletion. I'm pretty sure it's related to Copilot. Here's a couple of random examples of how it just throws in the \<ctrl63\>: ``` app.get (""), (req, res) => { res.send("This is the home page.");<ctrl63> } ``` ''' const express = require('express'); const app = express(); const port = 3000; app.get('/', (req, res) => { res.send('Hello World!'); }); app.listen(port, () => { console.log(`Example app listening at http://localhost:${port}`); });<ctrl63> This code will create a simple web server that listens on port 3000. When a request is made to the root URL ('/'), the server will send the response 'Hello World!'. ''' Checking Keyboard Shortcuts: I've reviewed the keyboard shortcuts in Visual Studio Code to ensure that "\<ctrl63\>" is not inadvertently mapped to any action. Disabling Extensions: I've disabled all extensions in Visual Studio Code, including Copilot, to rule out any extension-related conflicts. No auto complete, no issues when Copilot is disabled. Reviewing Code Editor Settings: I've reviewed my Visual Studio Code settings and configurations to see if there's anything that might be causing this issue, but haven't found any relevant settings.
If you enable warnings in your compiler, you'll see something like this: ``` warning: passing argument 1 of 'redim' from incompatible pointer type [-Wincompatible-pointer-types] 41 | if (lista->lungime == lista->capacitate) redim(&lista); | ^~~~~~ | | | Lista ** ``` That's telling you something very important. What you have right now causes undefined behavior. The variable `lista` is a pointer to the location of your data in memory. You are reinterpreting `&redis` as that pointer, but now the `redis` function is going to modify memory where the `lista` pointer was stored, instead of what it was pointing at. This will result in some form of memory corruption, as your struct is larger than a pointer and you're writing into uncharted territory. Changing the call to `redim(lista)` will fix this problem.
An internal error occurred during: "Updating Maven Project". Receiver class com.baselet.plugin.MavenProjectChangedListener does not define or inherit an implementation of the resolved method 'abstract void mavenProjectChanged(java.util.List, org.eclipse.core.runtime.IProgressMonitor)' of interface org.eclipse.m2e.core.project.IMavenProjectChangedListener. I tried changing the version of java I was using from 1.8 to 17 but that caused the above error that would not leave the screen . I then after searching for answers managed to change it back to 1.8 but now that error keeps popping up and gets stuck on the screen . Could someone advise how to resolve this error. p.s. I am relatively new to eclipse maven . Also i saw advice for the guy with the uml error but I changed it back to 1.8 so I do not understand why the error is still occuring.
Maven Eclipse Pom Error. I was trying to edit my pom to change the java but now I am getting a builder error and I cannot update maven pom
{"Voters":[{"Id":9952196,"DisplayName":"Shawn"},{"Id":22180364,"DisplayName":"Jan"},{"Id":466862,"DisplayName":"Mark Rotteveel"}]}
Found a workaround! For some reason, setting the system property in the serenity.properties file or serenity.conf will not work for msedgedriver. But if your project is a gradle build, you can set the system property in there and it will work: test { systemProperty("webdriver.edge.driver", "src/test/resources/webdriver/windows/edgedriver-win64/msedgedriver.exe") }
Below we will be discussing about one of the workaround solution that has been identified. In this approach one will be relying on adb (Android databridge command) to switch between primary and secondary display. So when ever the scripts needs to perform action on the secondary screen the app activity running on that screen will be switched to primary screen so that appium will be able to continue the execution without interruption. Switching of screens can be achieved using **adb shell cmd activity display move-stack \<taskID> \<displayID>** which will move the taskID (Task Id of the activity) to displayID (display 0 represents primary, 1 represents secondary or so on). In order to capture the taskId we can use another adb command named **adb shell am stack list** which will list out all the stack number along with task id of all activities running on the device ( The command need to be execution by having the application running either in emulator or real device). The above adb command can be integrated into the appium scripts so that we can dynamically capture the taskID and flip the screen at run time. These call will be done once we start the application or startexisting application. Challenges with the approach 1. Switching the screens of the application may affect the behaviour of the application because of display size, activity setting etc – its advice to discuss this approach with the team and should be adopted after sufficient testing. 2. Switching screen can lead to flaky test – so do test the execution behaviour of the scripts before fully adopting this approach into your framework. 3. adb command may not get executed from the appium scripts due to different reasons. a. Improper setting of adb Path b. JDK version issues c. Permission issue within android Manifest.xml – In order to enable this following line need to be added <uses-permission android:name="android.permission.DUMP" /> and then apk file need to be recompiled and reinstalled. Basically a different version
I am investigating some flakiness in e2e Cypress tests which are testing a web site that uses [Monaco Editor for React](https://github.com/suren-atoyan/monaco-react#readme). When I do `.type('{{} "e2e-custom-data": 9999 }')` into the editor (`.view-line`), the tests crash on approximately every third run with the following error: ``` We detected that the Electron Renderer process just crashed. We have failed the current spec but will continue running the next spec. This can happen for a number of different reasons. If you're running lots of tests on a memory intense application. - Try increasing the CPU/memory on the machine you're running on. - Try enabling experimentalMemoryManagement in your config file. - Try lowering numTestsKeptInMemory in your config file during 'cypress open'. You can learn more here: https://on.cypress.io/renderer-process-crashed ``` But if I leave out the closing `}`, which gets automatically generated by the editor, the tests become stable. So using `.type('{{} "e2e-custom-data": 9999 ')` doesn't crash the tests. Same behavior happens also when using Chrome instead of Electron, and regardless of running in headless more or not. The problem occurs when running the tests locally on a sufficiently powerful machine, so it should not be related to CPU/memory in reality. │ Cypress: 13.7.0 │ Browser: Electron 118 (headless) │ Node Version: v18.19.1 (/opt/homebrew/Cellar/node@18/18.19.1_1/bin/node) I would like to understand why the Monaco Editor is crashing the Cypress tests, and also why leaving out the `}` makes it not crash. Is the problem in the Monaco Editor, or in Cypress, or our web site? Is there something that could be done so that we could type in also the closing `}` instead of having to remember to omit that? Any help is appreciated!
I faced with that problem on Windows and other answers didn't help. That's because I have two versions of Python3 (3.8 and 3.12) on my machine. In this case call: ``` pip3 install setuptools ``` just installs `setuptools` for Python 3.8: ``` $ pip3 install setuptools Requirement already satisfied: setuptools in c:\users\username\appdata\local\programs\python\python38\lib\site-packages (69.2.0) ``` Meanwhile `python3` refers to another version: ``` $ python3 --version Python 3.12.2 ``` To correctly install `setuptools` I have to run `pip` in a different way: ``` python3 -m pip install setuptools ```
Is there a possibility to mark specific enum values as deprecated in OpenAPI defintion? For example, how can I mark Value1 as deprecated? ``` type: string title: CustomEnum enum: - Value1 - Value2 ```
I need to run that hook which fetch documents with currentUser.uid names but it fails. The hook starts before i get currentUser so basically it starts when the currentUser is null. Also i can't understand such behaviour. TypeError: Cannot read properties of null (reading 'uid') Source src/layout/SideBar/index.tsx (29:22) @ SideBar Context: ``` export const AuthContextProvider = ({ children }: { children: ReactNode }) => { const [currentUser, setCurrentUser] = useState<any>(null); useEffect(() => { const unsub = onAuthStateChanged( auth, (user) => user && setCurrentUser(user) ); return () => unsub(); }, []); return ( <AuthContext.Provider value={{ currentUser }}> {children} </AuthContext.Provider> ); }; ``` Component: ``` export const SideBar = () => { const { currentUser } = useContext(AuthContext); useEffect(() => { const unsub = onSnapshot(doc(db, "userChats", currentUser.uid), (doc) => { setUserChats(doc.data()); setLoading(false); }); return () => unsub(); }, [currentUser.uid]); return ( ... ); }; ```
TypeError: Cannot read properties of null (reading 'uid')
|reactjs|react-hooks|react-context|
I am trying to use `geofirestore` to get from the documents of a collection those that are a certain distance from the user's location in a `react native Cli` application, when trying to implement geofirestore I get the following TypeError: >error: _$$_REQUIRE(_dependencyMap[9 ], "(...)estore").GeoFirestore.collection is not a function (it is undefined), could you help me solve this problem please note: the implementation of firestore is correct since I have other methods where documents from firestore collections are obtained correctly, I only get the error with the implementation of geofirestore These are the versions that are installed in the project ```json "firebase": "^9.23.0", "geofirestore": "^5.2.0", ``` **this is my firebase configuration file** ```javascript import { initializeApp } from 'firebase/app'; import { getAuth } from 'firebase/auth'; import { getFirestore } from 'firebase/firestore'; import { GeoFirestore } from 'geofirestore'; const firebaseConfig = { apiKey: "", authDomain: "", databaseURL: "", projectId: "", storageBucket: "", messagingSenderId: "", appId: "", measurementId: "" }; const app = initializeApp(firebaseConfig); const authentication = getAuth(app); const db = getFirestore(app); const geofirestore = new GeoFirestore(db); export { app, authentication, db, geofirestore }; ``` **and this is my file where I implement geofirestore** ```javascript import { useNavigation } from "@react-navigation/native"; import { useEffect, useState } from "react"; import GetLocation from 'react-native-get-location' import { collection, onSnapshot, orderBy, query, where, getDocs } from "firebase/firestore"; import { db } from "../../utils/keys" import { getAuth } from "firebase/auth"; import { GeoFirestore } from 'geofirestore'; const obtenerRegistrosCercanos = async () => { const eventosCollection = GeoFirestore.collection(db,'eventos'); const center = new firestore.GeoPoint(19.325471, -99.656188); const radius = 10; const query = eventosCollection.near({ center, radius, }); query.get().then((snapshot) => { snapshot.docs.forEach((doc) => { const data = doc.data(); console.log(data); }); }); }; ```
|java|eclipse|maven|pom.xml|
null
|javascript|reactjs|svg|path|
I learned that common practice in django is, to put your css files into the static folder, although it should be possible to link them with `<link rel="stylesheet" href="styles.css">` too, when stored in together with the html in templates. .../templates/newyear/ both html and css stored here. For a short test I just linked the css like this: ``` <!DOCTYPE html> <html lang="en" dir="ltr"> <head> <meta charset="utf-8"> <title>Is it Newyear?</title> <link rel="stylesheet" href="styles.css"> </head> <body> {% if newyear %} <h1>YES</h1> {% else %} <h1>NO</h1> {% endif %} </body> </html> ``` But it IS NOT applied when I run the page with django. If i open the SAME html file with my browser, the css IS applied. No file locations or code changed. When i run (css now stored in static): ``` {% load static %} <!DOCTYPE html> <html lang="en" dir="ltr"> <head> <meta charset="utf-8"> <title>Is it Newyear?</title> <link rel="stylesheet" href="{% static 'newyear/styles.css' %}"> </head> <body> {% if newyear %} <h1>YES</h1> {% else %} <h1>NO</h1> {% endif %} </body> </html> ``` with django, the css IS applied. Is it possible to link a stylesheet with`<link rel="stylesheet" href="{% static 'newyear/styles.css' %}">` in django or not?
Linking CSS from the same directory in Django
|html|django-templates|
null
From the `plm` packages first vignette we see both function can estimate the common correlated effects MG (CCEMG) model (and also from `?plm::pmg` and `?plm::pcce`): > `pmg`: estimators for mean groups (MG), demeaned MG (DMG) and common > correlated effects MG (CCEMG) for heterogeneous panel models > `pcce`: estimators for common correlated effects mean groups (CCEMG) and > pooled (CCEP) for panel data with common factors So, let's see if we can get the same estimates from both function with the parametrisation to estimate a "CCEMG" model: library(plm) data("Produc", package = "plm") pProduc <- pdata.frame(Produc) form <- log(gsp) ~ log(pcap) + log(pc) + log(emp) + unemp pccemgmod <- pcce(form, data = pProduc, model = "mg") pmgccemgmod <- pmg (form, data = pProduc, model = "cmg") common <- intersect(names(pccemgmod[["coefficients"]]), names(pmgccemgmod[["coefficients"]])) (coef_pccemgmod <- round(pccemgmod[["coefficients"]][common], digits = 7)) #> log(pcap) log(pc) log(emp) unemp #> 0.0899850 0.0335784 0.6258657 -0.0031178 (coef_pmgccemgmod <- round(pmgccemgmod[["coefficients"]][common], digits = 7)) #> log(pcap) log(pc) log(emp) unemp #> 0.0899850 0.0335784 0.6258659 -0.0031178 You get the same results. `pcce(., model = "mg")` and `pmg(., model = "cmg")` estimate the same model but internally in a different way, hence coefficients might slightly diverge due to numerical precision when you look at many digits. In the example above, I have just printed the coefficents common to both model objects. For the "`pmg`-way" (object `pmgccemgmod`), you get an intercept and the coefficients of auxiluary variables used for that estimation approach as well, so the full picture is: > (pmgccemgmod) Model Formula: log(gsp) ~ log(pcap) + log(pc) + log(emp) + unemp Coefficients: (Intercept) log(pcap) log(pc) log(emp) unemp y.bar log(pcap).bar log(pc).bar log(emp).bar -0.6741754 0.0899850 0.0335784 0.6258659 -0.0031178 1.0038005 -0.0491919 -0.0033198 -0.6978359 unemp.bar 0.0025544
{"Voters":[{"Id":573032,"DisplayName":"Roman C"},{"Id":17562044,"DisplayName":"Sunderam Dubey"},{"Id":466862,"DisplayName":"Mark Rotteveel"}]}
There is a code like this: ``` using d2dArray = vector<vector<double>>; // Псевдоним d2dArray calcNextArray(d2dArray array) { d2dArray nextArray; int nextArrSize = array.size() - 1; d2dArray detArray = { {0, 0}, {0, 0} }; for (int i = 0; i < nextArrSize; i++) // Идём по столбцу { for (int j = 0; j < nextArrSize; j++) // Идём по строке { detArray[0][0] = array[0 + i][0 + j]; detArray[0][1] = array[0 + i][1 + j]; detArray[1][0] = array[1 + i][0 + j]; detArray[1][1] = array[1 + i][1 + j]; nextArray.emplace(*pos*, calcDeterminant(detArray)); // The problem is here. //calcDeterminant(detArray) - returns double } } return nextArray; } ``` The code should calculate the determinants and write them into a new vector, but since I just started learning vectors in C++, I don't understand how to work with multidimensional vectors. And information so specific is difficult to find, unless you read all the documentation. The problem is solved! ``` d2dArray calcNextArray(d2dArray array) { int nextArrSize = array.size() - 1; d2dArray nextArray(nextArrSize, d1dArray(nextArrSize)); d2dArray detArray(2, d1dArray(2)); for (int i = 0; i < nextArrSize; i++) // Идём по столбцу { for (int j = 0; j < nextArrSize; j++) // Идём по строке { detArray[0][0] = array[0 + i][0 + j]; detArray[0][1] = array[0 + i][1 + j]; detArray[1][0] = array[1 + i][0 + j]; detArray[1][1] = array[1 + i][1 + j]; nextArray[i][j] = calcDeterminant(detArray); } } return nextArray; } ```
|c++|vector|emplace|
I have a `ChildView` that you can access via `NavigationLink` and that will display in a `NavigationSplitView`’s detail pane. NavigationSplitView { ListView() } detail: { } And .navigationDestination(for: ChildModel.self) { post in ChildView() } `ChildView` declares an Environment property for the model context: @Environment(\.modelContext) private var modelContext It also has a SwiftData `@Query` property declared to retrieve all stored DbModel objects: @Query private var dbModel: [DbModel] However, it always returns empty (when it is not true) and I see this warning pop: > Set a .modelContext in view's environment to use Query I have seen https://stackoverflow.com/questions/76878894/query-in-view-with-model-container-attached-shows-error-saying-it-does-not-hav which is similar but I wanted to follow up for a better understanding. If I follow the advice in the answer above, and drop the @Query to replace with a `FetchDescription` in the `ChildView` constructor: init() { let predicate = #Predicate<DbModel> { $0.id == self.id } let descriptor = FetchDescriptor<DbModel>(predicate: predicate) if let models = try? modelContext.fetch(descriptor) { /// do something here } } It crashes: > Thread 1: Fatal error: 'try!' expression unexpectedly raised an error: SwiftData.SwiftDataError(_error: SwiftData.SwiftDataError._Error.loadIssueModelContainer) And has an accompanying warning: > Accessing Environment<ModelContext>'s value outside of being installed on a View. This will always read the default value and will not update. If I instead I refer to a reference of the context that I store after an app launch, it works fine: if let models = try? AppController.shared.modelContextReference.fetch(descriptor) { That’s progress, but I would appreciate clarification on two things: 1) How can I ensure the `ChildView` has environment access to the model context from a SwiftUI perspective? As in without needing to refer to a stored reference inside a class object. 2) I know `@Query` automatically stays up to date every time my data changes, and will reinvoke my SwiftUI view so it stays in sync. However, given I’m being forced to use a `FetchDescriptor` in the view’s constructor, does the same hold true? As in will the view also update whenever there are changes detected to the DbModel set? The wider context is I am only interested in `DbModel` results for `ChildView` that are relevant (i.e. share the same id). So I’m also curious whether — [short of having ability to dynamically query][1] — that this will perform similarly to a `@Query` that has a filter defined with no dynamic value check. [1]: https://stackoverflow.com/a/76530446/698971
Crash accessing SwiftData model context from environment in a child SwiftUI view in NavigationSplitView resulting in ability to @Query successfully
|swiftui|swift-data|swift-data-modelcontext|
I just included below header file and everything worked for me. #include <algorithm>
I can run lintDebug or the test cases in my local Android studio terminal, builds are successful. I am currently learning CI/CD and trying to run Github Actions to do the job when I push my code. But when pushing, CI fails on the first job with below exception: ``` > Could not resolve all files for configuration ':classpath'. > Could not resolve androidx.navigation:navigation-safe-args-gradle-plugin:2.7.7. Required by: project : > androidx.navigation.safeargs:androidx.navigation.safeargs.gradle.plugin:2.7.7 > No matching variant of androidx.navigation:navigation-safe-args-gradle-plugin:2.7.7 was found. The consumer was configured to find a library for use during runtime, compatible with Java 11, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.gradle.plugin.api-version' with value '8.4' but: - Variant 'apiElements' capability androidx.navigation:navigation-safe-args-gradle-plugin:2.7.7 declares a library, packaged as a jar, and its dependencies declared externally: - Incompatible because this component declares a component for use during compile-time, compatible with Java 17 and the consumer needed a component for use during runtime, compatible with Java 11 - Other compatible attribute: - Doesn't say anything about org.gradle.plugin.api-version (required '8.4') - Variant 'runtimeElements' capability androidx.navigation:navigation-safe-args-gradle-plugin:2.7.7 declares a library for use during runtime, packaged as a jar, and its dependencies declared externally: - Incompatible because this component declares a component, compatible with Java 17 and the consumer needed a component, compatible with Java 11 - Other compatible attribute: - Doesn't say anything about org.gradle.plugin.api-version (required '8.4') - Variant 'sourcesElements' capability androidx.navigation:navigation-safe-args-gradle-plugin:2.7.7 declares a component for use during runtime, and its dependencies declared externally: - Incompatible because this component declares documentation and the consumer needed a library - Other compatible attributes: - Doesn't say anything about its target Java version (required compatibility with Java 11) - Doesn't say anything about its elements (required them packaged as a jar) - Doesn't say anything about org.gradle.plugin.api-version (required '8.4') ``` As I understand from the error, GitHub runner uses Java 11 and my code uses Java 17. So in my CI, I've added java-version and distribution under each uses keyword to solve it. I've also tried to run with self hosted, did not work either. Here is my beginning part of the CI code that generates error: ``` name: CI on: push: branches: [master] pull_request: branches: [master] jobs: start: runs-on: ubuntu-latest steps: - name: Checkout the code uses: actions/checkout@v4 with: distribution: 'temurin' java-version: '17' overwrite-settings: false - name: Run sample script run: echo Hello, world lint: name: Perform lint check needs: [start] runs-on: ubuntu-latest steps: - name: Checkout the code uses: actions/checkout@v4 with: distribution: 'temurin' java-version: '17' overwrite-settings: false - name: Cache Gradle uses: actions/cache@v4 with: distribution: 'temurin' java-version: '17' overwrite-settings: false path: ~/.gradle/caches key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} restore-keys: ${{ runner.os }}-gradle- - name: Make Gradle executable run: chmod +x ./gradlew - name: Run lint run: ./gradlew lintDebug - name: Upload html test report uses: actions/upload-artifact@v4 with: distribution: 'temurin' java-version: '17' overwrite-settings: false name: lint.html path: app/build/reports/lint-results-debug.html unit-test: name: Perform Unit Testing needs: [lint] runs-on: ubuntu-latest steps: - name: Checkout the code uses: actions/checkout@v4 with: distribution: 'temurin' java-version: '17' overwrite-settings: false - name: Run tests run: ./gradlew test - name: Upload test report uses: actions/upload-artifact@v4 with: distribution: 'temurin' java-version: '17' overwrite-settings: false name: unit_test_report path: app/build/reports/test/testDebugUnitTest/ ``` As I search similar issues, suggestions were putting the related plugin `id("androidx.navigation.safeargs.kotlin")` to the end of plugin sections, and check compileOptions to be `JavaVersion.VERSION_17` in build.gradle. Done those but still can not resolve the error. Any help or ideas will be appreciated. Thanks in advance.
I was solving this problem on Leetcode but I am unable to understand why my solution is wrong I am using the hash map approach to solve this, the time complexity is O(n) but the error is not something related to time exceeding **Question:** You are given two strings `s` and `t`. String `t` is generated by random shuffling string `s` and then add one more letter at a random position. Return the letter that was added to `t`. ``` lang-none Example 1: Input: s = "abcd", t = "abcde" Output: "e" Explanation: 'e' is the letter that was added. Example 2: Input: s = "", t = "y" Output: "y" Constraints: 0 <= s.length <= 1000 ``` **my Solution** ``` lang-javascript var findTheDifference = function (s, t) { let mapSet = {} let final = "" s.split('').forEach((elem) => { mapSet[elem] === undefined ? mapSet[elem] = 1 : mapSet[elem]++ }) t.split('').forEach((elem) => { mapSet[elem] === undefined ? mapSet[elem] = 1 : mapSet[elem]-- if (mapSet[elem] != 0) { final = elem } }) return final }; ``` the Error was for this testcase -> ``` lang-none s = "ymbgaraibkfmvocpizdydugvalagaivdbfsfbepeyccqfepzvtpyxtbadkhmwmoswrcxnargtlswqemafandgkmydtimuzvjwxvlfwlhvkrgcsithaqlcvrihrwqkpjdhgfgreqoxzfvhjzojhghfwbvpfzectwwhexthbsndovxejsntmjihchaotbgcysfdaojkjldprwyrnischrgmtvjcorypvopfmegizfkvudubnejzfqffvgdoxohuinkyygbdzmshvyqyhsozwvlhevfepdvafgkqpkmcsikfyxczcovrmwqxxbnhfzcjjcpgzjjfateajnnvlbwhyppdleahgaypxidkpwmfqwqyofwdqgxhjaxvyrzupfwesmxbjszolgwqvfiozofncbohduqgiswuiyddmwlwubetyaummenkdfptjczxemryuotrrymrfdxtrebpbjtpnuhsbnovhectpjhfhahbqrfbyxggobsweefcwxpqsspyssrmdhuelkkvyjxswjwofngpwfxvknkjviiavorwyfzlnktmfwxkvwkrwdcxjfzikdyswsuxegmhtnxjraqrdchaauazfhtklxsksbhwgjphgbasfnlwqwukprgvihntsyymdrfovaszjywuqygpvjtvlsvvqbvzsmgweiayhlubnbsitvfxawhfmfiatxvqrcwjshvovxknnxnyyfexqycrlyksderlqarqhkxyaqwlwoqcribumrqjtelhwdvaiysgjlvksrfvjlcaiwrirtkkxbwgicyhvakxgdjwnwmubkiazdjkfmotglclqndqjxethoutvjchjbkoasnnfbgrnycucfpeovruguzumgmgddqwjgdvaujhyqsqtoexmnfuluaqbxoofvotvfoiexbnprrxptchmlctzgqtkivsilwgwgvpidpvasurraqfkcmxhdapjrlrnkbklwkrvoaziznlpor" t = "qhxepbshlrhoecdaodgpousbzfcqjxulatciapuftffahhlmxbufgjuxstfjvljybfxnenlacmjqoymvamphpxnolwijwcecgwbcjhgdybfffwoygikvoecdggplfohemfypxfsvdrseyhmvkoovxhdvoavsqqbrsqrkqhbtmgwaurgisloqjixfwfvwtszcxwktkwesaxsmhsvlitegrlzkvfqoiiwxbzskzoewbkxtphapavbyvhzvgrrfriddnsrftfowhdanvhjvurhljmpxvpddxmzfgwwpkjrfgqptrmumoemhfpojnxzwlrxkcafvbhlwrapubhveattfifsmiounhqusvhywnxhwrgamgnesxmzliyzisqrwvkiyderyotxhwspqrrkeczjysfujvovsfcfouykcqyjoobfdgnlswfzjmyucaxuaslzwfnetekymrwbvponiaojdqnbmboldvvitamntwnyaeppjaohwkrisrlrgwcjqqgxeqerjrbapfzurcwxhcwzugcgnirkkrxdthtbmdqgvqxilllrsbwjhwqszrjtzyetwubdrlyakzxcveufvhqugyawvkivwonvmrgnchkzdysngqdibhkyboyftxcvvjoggecjsajbuqkjjxfvynrjsnvtfvgpgveycxidhhfauvjovmnbqgoxsafknluyimkczykwdgvqwlvvgdmufxdypwnajkncoynqticfetcdafvtqszuwfmrdggifokwmkgzuxnhncmnsstffqpqbplypapctctfhqpihavligbrutxmmygiyaklqtakdidvnvrjfteazeqmbgklrgrorudayokxptswwkcircwuhcavhdparjfkjypkyxhbgwxbkvpvrtzjaetahmxevmkhdfyidhrdeejapfbafwmdqjqszwnwzgclitdhlnkaiyldwkwwzvhyorgbysyjbxsspnjdewjxbhpsvj" Output "j" Expected "t" ```
null
|javascript|firebase|react-native|google-cloud-firestore|geofirestore|
null
Assuming that the legal document will not be just a single-line sentence. In that case one can use a loop. First use a minimum line height and generate the pdf and calculate the total number of pages, then increase the line height by say 0.05 each time (line height=line height +0.05) and perform the iteration until suddenly the total number of pages increase by one, then fall back to (line height = previous line height before the increase of page number), now generate the pdf So, please run the following script (e.g. pre-genpdf.php) to initalize the setting: ``` <?php session_start(); unset($_SESSION["pageCount"]); unset($_SESSION["initialpageCount"]); unset($_SESSION["line-height"]); unset($_SESSION["good-line-height"]); ?> Initalization completed, please run genpdf.php by clicking <A href=genpdf.php>HERE</a> ``` After that, click the hyperlink to trigger the following genpdf.php ``` <?php session_start(); $initiallineheight=1.0; if (!isset( $_SESSION["pageCount"] )) { $_SESSION["pageCount"]=0; } if (!isset( $_SESSION["initialpageCount"] )) { $_SESSION["initialpageCount"]=0; } if (!isset( $_SESSION["line-height"] )) { $_SESSION["line-height"]=$initiallineheight; } if (!isset( $_SESSION["good-line-height"] )) { $_SESSION["good-line-height"]=$initiallineheight; } $teststring0=" This section will guide you through the general configuration and installation of PHP on Unix systems. Be sure to investigate any sections specific to your platform or web server before you begin the process. As our manual outlines in the General Installation Considerations section, we are mainly dealing with web centric setups of PHP in this section, although we will cover setting up PHP for command line usage as well. There are several ways to install PHP for the Unix platform, either with a compile and configure process, or through various pre-packaged methods. This documentation is mainly focused around the process of compiling and configuring PHP. Many Unix like systems have some sort of package installation system. This can assist in setting up a standard configuration, but if you need to have a different set of features (such as a secure server, or a different database driver), you may need to build PHP and/or your web server. If you are unfamiliar with building and compiling your own software, it is worth checking to see whether somebody has already built a packaged version of PHP with the features you need. Prerequisite knowledge and software for compiling: Basic Unix skills (being able to operate make and a C compiler) An ANSI C compiler A web server Any module specific components (such as GD, PDF libs, etc.) When building directly from Git sources or after custom modifications you might also need: autoconf: 2.59+ (for PHP >= 7.0.0), 2.64+ (for PHP >= 7.2.0) automake: 1.4+ libtool: 1.4.x+ (except 1.4.2) re2c: 0.13.4+ bison: PHP 7.0 - 7.3: 2.4 or later (including Bison 3.x) End TEST."; $teststring=$teststring0; $teststring.=$teststring0; $teststring.=$teststring0; require_once __DIR__ . '/vendor/autoload.php'; $mpdf = new \Mpdf\Mpdf(); $mpdf->useFixedNormalLineHeight = true; $mpdf->useFixedTextBaseline = true; $mpdf->normalLineheight = $_SESSION["line-height"]; $teststring=str_replace(chr(13),'<br>',$teststring); $mpdf->WriteHTML($teststring); $mpdf->Output('temp1.pdf', \Mpdf\Output\Destination::FILE); $pageCount = count($mpdf->pages); $_SESSION["pageCount"]=$pageCount; if ($_SESSION["line-height"]==$initiallineheight) { $_SESSION["initialpageCount"]=$pageCount; } if ($_SESSION["initialpageCount"]==$_SESSION["pageCount"]){ $_SESSION["good-line-height"]=$_SESSION["line-height"]; $_SESSION["line-height"]=$_SESSION["line-height"]+0.05; ?> <script> location.reload(); </script> <?php } else{ $mpdf = new \Mpdf\Mpdf(); $mpdf->useFixedNormalLineHeight = true; $mpdf->useFixedTextBaseline = true; $mpdf->normalLineheight = $_SESSION["good-line-height"]; $teststring=str_replace(chr(13),'<br>',$teststring); $mpdf->WriteHTML($teststring); $mpdf->Output('final.pdf', \Mpdf\Output\Destination::FILE); ?> <script> alert("Done ! Please use the final.pdf"); </script> <?php } ?> ``` Please note that I have used some PHP documentation as `$teststring0` for testing, for real case please use the actual textual data of your legal document. It will generate temp.pdf on the loop (just ignore it, each iteration over the loop will generate the file and overwrite the previous one since they are of the same name), but finally will generate the "final.pdf" which is the one with best line-height and then the process will STOP. See result (initial line-height): [![enter image description here][1]][1] and final.pdf (best line-height) [![enter image description here][2]][2] Note: for better result you may adjust the increment value of line-height each time from 0.05 to say 0.01 (each time smaller step) and the result may even be better, but of course it may then take longer time for the iteration to complete. [1]: https://i.stack.imgur.com/SZxjs.jpg [2]: https://i.stack.imgur.com/xCqab.jpg
A thread must own the `Lock` which created the `Condition` before it can invoke the latter's methods. If the thread does not own the lock then an exception is thrown. If you look at the rest of the implementation, you will see the values of those two fields are never used, and the two fields are never written to, unless `isHeldExclusively()` returns true. That method will only return true if the thread has acquired the lock, *and acquiring a lock creates a **happens-before** relationship*. In other words, those two fields are properly guarded by the `Lock` and thus do not need to be volatile. It is no different from guarding your own state with a lock.
I'm working with the library `PyYAML==6.0.1` and trying to retrieve an object from a string representation of a YAML. The problem is, when I use `yaml.safe_load` with a text containing a line break then it removes the whitespaces. For example: data = yaml.safe_load("first\n\n second") returns a string with the linebreak but the whitespaces removed 'first\nsecond' If I don't add the line break then the whitespaces are kept. How can I keep both things (the linebreak and the whitespace)?
I found a funny solution. plot(mpg ~ hp, data = mtcars) curve(expr = cbind(1, poly(x, degree = 2, raw = TRUE)) %*% fit$coefficients, add = TRUE, col = "red") Essentially, it simply applies the matrix definition of a linear regression. a %*% coef = b Here, the matrix `a` can be expressed either way: cbind(1, poly(x, degree = 2, raw = TRUE)) t(sapply(x, `^`, e2 = 0:2)) And this works because `curve` takes expressions where `x` is the variable.
I have come up with this which returns the correct matches. (?i)((?!:xyz-\d{8})&(?<![.\d])\d{8}(?![\d.])|abc?.\s?\d{8})|(\s\d{8}\s)
My problem was that the objects $Right and $Left are not exposed unless they are in a script block so the way to get the desired output in my example is: $objectA = @( @{ "Id"="1" "Name"="Bob" }, @{ "Id"="2" "Name"="Bill" }, @{ "Id"="3" "Name"="Ted" } ) $objectB = @( @{ "Id"="2" "Name"="John" } ) $objectA | leftjoin $objectB -On Id -Property @{ID = 'Left.ID'}, @{Name = {if($Right['Name'] -ne $null){$Right['Name']}else{$Left['Name']}}}|Format-Table
You can try one of these publicly accessible RFC 3161 compliant time-stamping services: 1. https://freetsa.org Supports HTTP, HTTPS and TCP transports and has other features 2. http://time.certum.pl 3. http://zeitstempel.dfn.de (errors out) 4. http://tsa.tecxoft.com Requires registration & paid 5. http://timestamp.sectigo.com (formerly http://timestamp.comodoca.com/rfc3161) 6. http://sha256timestamp.ws.symantec.com/sha256/timestamp 7. https://ca.signfiles.com/tsa/get.aspx Still active, but the configuration panel for the CA is wide open. I'd recommend against using it, as anyone can remove your access anytime. 8. https://tsp.iaik.tugraz.at/tsp/TspRequest Uses a test certificate. Timestamping services that went offline : 1. http://dse200.ncipher.com/TSS/HttpTspServer 2. http://tsa.safecreative.org 3. https://timestamp.geotrust.com/tsa 4. http://timestamp.globalsign.com/scripts/timstamp.dll 5. http://services.globaltrustfinder.com/adss/tsa You can also try one of these publicly accessible RFC 3161 compliant client applications: 1. [TimeStampClient](https://github.com/disig/TimeStampClient) Feel free to edit the answer and extend the list.
I was using this code in my Cypress tests using Cypress version 8: ``` beforeEach(() => { Cypress.Cookies.preserveOnce( 'csrftoken', 'sessionid', // ...other cookies... ) }) ``` and now I have finally upgraded to Cypress 13 and am told to use `cy.session` instead. I'm having trouble figuring out what the equivalent of the above would look like based on the examples provided in the [documentation](https://docs.cypress.io/api/commands/session) and [migration guide](https://docs.cypress.io/guides/references/migration-guide#Command--Cypress-API-Changes). The use of `preserveOnce` in `beforeEach` was working perfectly for ensuring cookies persisted like they would in a browser session between all of my tests. Could someone please explain how I can code the equivalent of the above code using Cypress 13+? If I wrap the requests that create the cookies in `session` calls, the page is automatically cleared afterwards so the next tests fail. It seems I'll need to majorly refactor my test suite, or am I missing a simpler method of achieving the same effect as `preserveOnce`?
I'm trying to show an awesome dialog after the user signs up to tell him that he got a message to verify his email, but when the user signs up it goes to the login page without clicking on any button that's my function code, and my awesome dialog. showDialogawesomeregister(BuildContext context, String text) async { AwesomeDialog( context: context, dialogType: DialogType.success, animType: AnimType.rightSlide, headerAnimationLoop: false, title: "Success", desc: text, btnOkOnPress: () { Get.off(const Login()); }, btnOkIcon: Icons.check, btnOkColor: Colors.deepPurple, ).show(); } void signUpUser(BuildContext context) async { // set loading to true setState(() { _isLoading = true; }); // signup user using our authmethodds String res = await AuthMethod().signupUser( email: _emailController.text, password: _passController.text, fullname: _usernameController.text, country: _countrynameController.text); setState(() { _isLoading = false; }); // if string returned is sucess, user has been created if (res == "Please check Your email address to activate your account") { if (context.mounted) { await showDialogawesomeregister(context, res); } } else { // show the error if (context.mounted) { await showDialogawesomeerror(context, res); } } } that's my widget I got a blue message in the debug console > ( 6238): Ignoring header X-Firebase-Locale because its value was null. > W/LocalRequestInterceptor( 6238): Error getting App Check token; using > placeholder token instead. Error: > com.google.firebase.FirebaseException: No AppCheckProvider installed. > > I/flutter ( 6238): setState() called after dispose(): > _RegisterState#7439c(lifecycle state: defunct, not mounted) I/flutter ( 6238): This error happens if you call setState() on a State object > for a widget that no longer appears in the widget tree (e.g., whose > parent widget no longer includes the widget in its build). This error > can occur when code calls setState() from a timer or an animation > callback. I/flutter ( 6238): The preferred solution is to cancel the > timer or stop listening to the animation in the dispose() callback. > Another solution is to check the "mounted" property of this object > before calling setState() to ensure the object is still in the tree @override void dispose() { super.dispose(); _emailController.dispose(); _passController.dispose(); _usernameController.dispose(); _countrynameController.dispose(); controller?.dispose(); } AnimationController? controller; bool country = true; bool textshow = true; bool _isLoading = false; final TextEditingController _emailController = TextEditingController(); final TextEditingController _passController = TextEditingController(); final TextEditingController _usernameController = TextEditingController(); final TextEditingController _countrynameController = TextEditingController(); Tween<double> scale = Tween<double>(begin: 0.0, end: 1.0); //country TweenAnimationBuilder( tween: scale, curve: Curves.bounceOut, duration: const Duration(milliseconds: 3500), builder: (BuildContext context, double size, Widget? child) { return Opacity( opacity: size, child: Padding( padding: EdgeInsets.only(top: size * 0.3), child: child, ), ); }, child: Container( margin: const EdgeInsets.symmetric(vertical: 10), padding: const EdgeInsets.symmetric( horizontal: 20, vertical: 5), width: size.width * 0.8, decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(29), ), child: TextField( controller: _countrynameController, readOnly: true, onTap: () { showCountryPicker( context: context, //Optional. Shows phone code before the country name. showPhoneCode: false, onSelect: (Country c) { setState(() { country = false; _countrynameController.text = c.name; }); }, ); }, decoration: InputDecoration( hintText: country ? "Select Country" : _countrynameController.text, icon: const Icon( Icons.place, color: Color(0xFF6F35A5), ), border: InputBorder.none, ), cursorColor: const Color(0xFF6F35A5), ), ), ), //signup TweenAnimationBuilder( tween: scale, curve: Curves.bounceOut, duration: const Duration(milliseconds: 3500), builder: (BuildContext context, double size, Widget? child) { return Opacity( opacity: size, child: Padding( padding: EdgeInsets.only(top: size * 0.3), child: child, ), ); }, child: InkWell( onTap: () { signUpUser(context); }, child: Container( height: 48, decoration: BoxDecoration( borderRadius: BorderRadius.circular(10), gradient: const LinearGradient(colors: [ Color.fromRGBO(78, 84, 200, 1.0), Color.fromRGBO(127, 133, 239, 1.0), ])), child: Center( child: !_isLoading ? const Text( "Signup", style: TextStyle( fontSize: 19.0, color: Colors.white, fontWeight: FontWeight.bold), ) : const CircularProgressIndicator(), ), ), ), ),
If you want to require your users to access their location. You can try : "requestForegroundPermissionsAsync" and get the current location: "getCurrentPositionAsync"
I am trying to: Copy an entire row from Sheet1 if cell value in the row is for example >3000. Paste that row in sheet2. It gets stuck at `EntireRow.EntireRow` while I am trying to copy that entire row to sheet2. ```vba Sub deviation() Dim DataRg As Range Dim blankrng As Range Dim cell As Range Dim I As Long Q = Worksheets("Sheet2").UsedRange.Rows.Count P = Worksheets("Sheet1").UsedRange.Rows.Count If I = 1 Then If Application.WorksheetFunction.CountA(Worksheets("Sheet1").UsedRange) = 0 Then Q = 0 End If Set DataRg = Worksheets("Sheet1").Range("b2:w185" & P) Application.ScreenUpdating = False If CStr(DataRg(I).Value) >= "3000" Then EntireRow.EntireRow End If End Sub ``` Sheet1 a 10 100 4000 b 15 102 2900 c 3000 3010 129 Expected output, as the value in at least one cell is >3000 a 10 100 4000 c 3000 3010 129
Copy entire row based on a cell value and paste in another sheet
null
I face some problem in excel file. I am exporting excel file with data. This code is **working fine in localhost**. But in **live server**, the **excel file is not opening** and display message as > Excel cannot open the file "users_download_.xlsx" because the file format or > file extension is not valid. Verify that the file has not been > corrupted and that the file extension matches the format of the file. My controller code is: <?php declare(strict_types=1); namespace App\Controller\Admin; use App\Controller\Admin\AppController; use Cake\Datasource\ConnectionManager; use Cake\Utility\Hash; use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Writer\Xlsx; use Cake\Http\CallbackStream; class UsersController extends AppController { public function initialize(): void { parent::initialize(); $this->loadComponent('Paginator'); } public function exportUsers() { // Create a new spreadsheet $spreadsheet = new Spreadsheet(); // Add value in a sheet inside of that spreadsheet. // // (It's possible to have multiple sheets in a single spreadsheet) $sheet = $spreadsheet->getActiveSheet(); // styles: $from = "A1"; $to = "J1"; $spreadsheet->getActiveSheet()->getColumnDimension("B")->setWidth(30); $spreadsheet->getActiveSheet()->getColumnDimension("C")->setWidth(30); $spreadsheet->getActiveSheet()->getColumnDimension("D")->setWidth(20); $spreadsheet->getActiveSheet()->getColumnDimension("E")->setWidth(15); $spreadsheet->getActiveSheet()->getColumnDimension("F")->setWidth(20); $spreadsheet->getActiveSheet()->getColumnDimension("G")->setWidth(30); $spreadsheet->getActiveSheet()->getColumnDimension("H")->setWidth(15); $spreadsheet->getActiveSheet()->getColumnDimension("I")->setWidth(15); $spreadsheet->getActiveSheet()->getColumnDimension("J")->setWidth(15); $spreadsheet->getActiveSheet()->getStyle("$from:$to")->getFont()->setBold(true); $spreadsheet->getActiveSheet()->getStyle("$from:$to")->getFont()->setSize(14); $spreadsheet ->getActiveSheet() ->getStyle('A1:J1') ->getFill() ->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID) ->getStartColor() ->setARGB('ff6a98fc'); // styles end $sheet->setCellValue('A1', 'Sr.No.'); $sheet->setCellValue('B1', 'Name'); $sheet->setCellValue('C1', 'Email'); $sheet->setCellValue('D1', 'Mobile'); $sheet->setCellValue('E1', 'Total steps'); $sheet->setCellValue('F1', 'Age group'); $sheet->setCellValue('G1', 'Centre'); $sheet->setCellValue('H1', 'State'); $sheet->setCellValue('I1', 'Country'); $sheet->setCellValue('J1', 'Gender'); $connection = ConnectionManager::get('default'); $users_list = $connection->execute( "SELECT fname, lname, email, agegroup_id, agegroups.NAME AS age_group_name, center, centremaster.centre AS centre_name, states.name AS state_name, countries.name AS country, gender, parent_email, mobile, user_name, parent_mobile, (SELECT SUM(steps) FROM steps WHERE steps.users_id=users.id) AS total_steps FROM `users` LEFT JOIN agegroups ON agegroups.id = users.agegroup_id LEFT JOIN centremaster ON centremaster.`id` = users.centreid LEFT JOIN countries ON countries.`id` = users.country_id LEFT JOIN states ON states.`id` = users.stateid " )->fetchAll('assoc'); // $centres_list = []; foreach ($users_list as $key => $user) { $keyCell = $key + 2; if ($user['agegroup_id'] == 1) { // SSE CHILDREN $sheet->setCellValue('A' . $keyCell, $key + 1); $sheet->setCellValue('B' . $keyCell, $user['user_name']); $sheet->setCellValue('C' . $keyCell, $user['parent_email']); $sheet->setCellValue('D' . $keyCell, $user['parent_mobile']); $sheet->setCellValue('E' . $keyCell, $user['total_steps'] ?: 0); $sheet->setCellValue('F' . $keyCell, $user['age_group_name']); $sheet->setCellValue('G' . $keyCell, $user['centre_name']); $sheet->setCellValue('H' . $keyCell, $user['state_name']); $sheet->setCellValue('I' . $keyCell, $user['country']); $sheet->setCellValue('J' . $keyCell, $user['gender']); } else { $sheet->setCellValue('A' . $keyCell, $key + 1); $sheet->setCellValue('B' . $keyCell, $user['fname'] . " " . $user['lname']); $sheet->setCellValue('C' . $keyCell, $user['email']); $sheet->setCellValue('D' . $keyCell, $user['mobile']); $sheet->setCellValue('E' . $keyCell, $user['total_steps'] ?: 0); $sheet->setCellValue('F' . $keyCell, $user['age_group_name']); $sheet->setCellValue('G' . $keyCell, $user['centre_name']); $sheet->setCellValue('H' . $keyCell, $user['state_name']); $sheet->setCellValue('I' . $keyCell, $user['country']); $sheet->setCellValue('J' . $keyCell, $user['gender']); } } $writer = new Xlsx($spreadsheet); // ↓↓ Added new code from here in the eariler sample code // Save the file in a stream $stream = new CallbackStream(function () use ($writer) { $writer->save('php://output'); }); $filename = 'users_download_' . date('Y-m-d') . time(); $response = $this->response; // Return the stream in a response return $response->withType('xlsx') ->withHeader('Content-Disposition', "attachment;filename=\"{$filename}.xlsx\"") ->withBody($stream); } } Any help will be appreciate. Thank you.
Excel file is not opening while export data in excel, but working fine in localhost
|cakephp|export-to-excel|
I am currently working on a complex ReactJS project and have encountered an issue. I am sharing the reduced version of the problem I have identified. ``` import { useEffect, useState } from "react"; function App() { const [clicked, setClicked] = useState(false); const [text, setText] = useState(null); const addText = (word) => { setText(word); }; useEffect(() => { const getLocation = (e) => { const targetClassList = e.target.classList; if (targetClassList.contains("click-btn")) { setClicked(true); } }; document.addEventListener("click", getLocation); return () => { document.removeEventListener("click", getLocation); }; }, []); return ( <> <div> <div>{text ? text : "Any?"}</div> <div onClick={clicked ? () => addText("Hello World") : null} className="click-btn" > Click me </div> </div> </> ); } export default App; ``` What I want is, if the classlist contains 'click-btn' after the first click, I want the click to work directly and add the text. However, it doesn't happen on the first click, and the text changes only on the second click.
{"Voters":[{"Id":18157,"DisplayName":"Jim Garrison"},{"Id":17562044,"DisplayName":"Sunderam Dubey"},{"Id":466862,"DisplayName":"Mark Rotteveel"}]}
This is a bug in AppiumLibrary and how it handles its dependencies. It pulls in python appium bindings that have stuff deprecated that AppiumLibrary still expects to be present. Fix: `pip install --force-reinstall "Appium-Python-Client<4.0.0"` I've filed an issue and pull request to fix it: * https://github.com/serhatbolsu/robotframework-appiumlibrary/issues/417 * https://github.com/serhatbolsu/robotframework-appiumlibrary/pull/418
I'm currently trying to deploy my MERN application's backend on Vercel. Before this try, I learned to deploy the MERN site on Vercel by small todo project. I work fine now and I do the same for the following project. but it shows a 404 error This is my file structure [![enter image description here](https://i.stack.imgur.com/zeiNH.png)](https://i.stack.imgur.com/zeiNH.png) This is my package.json ``` { "name": "backend", "version": "1.0.0", "description": "simple mern note taking application for open ended assignment", "main": "server.js", "engines": { "node": "20.x" }, "scripts": { "test": "echo \"Error: no test specified\" && exit 1", "dev": "nodemon server.js" }, "author": "baos sora", "license": "ISC", "dependencies": { "cors": "^2.8.5", "dotenv": "^16.4.5", "express": "^4.18.3", "mongodb": "^6.5.0", "mongoose": "^8.2.3", "node-cron": "^3.0.3", "nodemon": "^3.1.0" } } ``` this is my vercel.json ``` { "version": 2, "builds": [{ "src": "./server.js", "use": "@vercel/node" }], "routes": [ { "src": "/(.*)", "dest": "/" } ] } ``` this is my env ``` URL= worked url from mongodb PORT=3000 ``` This is my server.js ``` //import required modules const express = require('express'); require('dotenv').config(); const mongoose = require('mongoose'); const cors = require('cors'); const NoteRoutes = require('./routes/noteRoutes') const { getCategory, deleteCategory, getOneCategryData } = require('./controller/categoryController') const { getDynamicNoteData, DeleteInActiveNotes, AutoHardDeleteNotes } = require('./controller/noteController') //initialize express app const app = express(); // Middleware to parse incoming requests with JSON app.use(express.json()) //middleware to handle Cors policy app.use(cors()); app.get('/', (req, res) => { res.json({ message: 'Welcome to Note API' }) }) app.use('/note', NoteRoutes) //manually create routes because of casting issues app.get('/search', getDynamicNoteData) app.delete('/remove', DeleteInActiveNotes) app.get('/category', getCategory) app.get('/category/:id', getOneCategryData) app.delete('/category/:id', deleteCategory) const PORT = process.env.PORT || 5000; const URL = process.env.URL; //establish the connection to MongoDB database using Mongoose mongoose.connect(URL) //if the connection is successful display the success messages .then(() => { console.log("Connected with MongoDB"); //call auto deletion function AutoHardDeleteNotes() //app listening port app.listen(PORT, () => { console.log("Server is running on port " + PORT); }) }) //if there is an error on connecting show display the error message .catch(err => { console.log("Application has Following Errors: \n" + err); }) ``` This shows when I deploy the project [![enter image description here](https://i.stack.imgur.com/UFVe0.png)](https://i.stack.imgur.com/UFVe0.png) Please help me find this issue. this is my internship's 2nd round open-ended assignment the deadline ends tomorrow. Until today I only used Netlify. but their guideline said need to add in Vercel.
Enumerations are members of the *class* in C++, not any specific object (they are in essence static). Because of this you need to use the class-name and the scope operator `::` to access the enumeration values. As in ``` RayCast(ray, CEntityManager::FAll, range); ```
|curl|postman|
|javascript|payment-gateway|mastercard|
|javascript|reactjs|next.js|
|node.js|mongodb|mongodb-query|
|python|bing|bing-ads-api|
I'm encountering an issue when it comes to applying a lag/windows function to entire dataframe on a condition. I want to times the previous rows value(value1), with the current rows value(value2), from week 2 onwards. Here is my data: ''' from pyspark.sql import functions as f data = [ (1, 1, 1), (2, 0, 5), (3, 0, 10), (4, 0, 20), (5, 0, 30), (6, 0, 40) ] columns = ["week", "value1", "value2"] df = spark.createDataFrame(data, columns) ''' Here is my logic to do the calc: ''' w=Window.orderBy("week") df2 = df.withColumn('value1', f.when((f.col('week') > 1), f.lag(df['value1']).over(w) * df['value2'] ).otherwise( f.col('value1') ) ) ''' My output looks like this: [![enter image description here][1]][1] You can see only week 2 is following the logic. Week 3 should be 50 (5 * 10), not zero... Can anyone please help me here? [1]: https://i.stack.imgur.com/FiBVM.png
Pyspark windows function not applying to entire dataframe
|pyspark|
|c#|reactjs|.net|azure|
|facebook|post|charts|
|javascript|next.js|whatsapp|brevo|
As @rici said, for CGF, but in other words [1] (p.179)"any derivation has an equivalent leftmost and an equivalent rightmost derivation." Furthermore, @rici wrote > This has nothing to do with which way the parse tree leans. The same parse tree is produced regardless. (Or the same parse trees, if the grammar is ambiguous.) Interesting, your grammar is ambiguous, as can be seen for string acccc, using leftmost derivation: [![enter image description here][1]][1] [1]: Hopcroft et al. Introduction to Automata Theory, Languages, and Computation, Addison-Wesley, 3rd ed. [1]: https://i.stack.imgur.com/KNoPV.png
|vba|charts|ms-word|
null
I am looking for some help getting with sending emails from VBA using the MS Graph API. I have registered an app in Azure|Entra ID, and recorded the Tenant ID, Client ID and Client Secret. I know I have them correct, as I have tested them by sending an email via the graph API using PowerShell. This worked a dream. I now want to send using VBA. Why? The CDO Outlook interface is deprecated, New Outlook currently does not offer a viable alternative. We are a small UK charity (www.e-a-s-t.org.uk) run entirely by volunteers. Our membership database is implemented in Access; we email the membership using VBA from the database. As stated, I am trying to generate VBA code to send email via Graph. I am developing the macro in Word as I do not have Access. When I run the macro I get:- Status Code: 400 bad request “Message:/me” request is only valid with delegated authentication. [My app permissions are thus:-](https://i.stack.imgur.com/9MQ0t.png) Some of them have been installed on a 'poke and hope' basis! As I previously said, using PowerShell just works! I have spent hours looking for the solution and I am reaching out for help. Any thoughts?
Yes with the help of Arrays you can initialize an unmodifiable `List` (instead of an `ArrayList`) in one line, List<String> strlist= Arrays.asList("aaa", "bbb", "ccc");
This code that I took form another web, works! but only when I put my Instagram ID. Otherwise when I want to get a media from another user (changing the variable `userid`) it stops working. To be sure I use https://www.otzberg.net/iguserid/index.php to get the user ID. And to get the Access Token (only with my account): http://instagram.pixelunion.net/ <?php // Supply a user id and an access token $userid = "-----"; $accessToken = "---"; // Gets our data function fetchData($url){ $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 20); $result = curl_exec($ch); curl_close($ch); return $result; } // Pulls and parses data. $result = fetchData("https://api.instagram.com/v1/users/{$userid}/media/recent/?access_token={$accessToken}"); $result = json_decode($result); ?> <?php if(!empty($result->data)): ?> <?php foreach ($result->data as $post): ?> <!-- Renders images. @Options (thumbnail,low_resoulution, high_resolution) --> <a class="group" rel="group1" href="<?= $post->images->standard_resolution->url ?>"><img src="<?= $post->images->thumbnail->url ?>"></a> <?php endforeach ?> <?php endif ?>
null
|php|instagram-api|
Yes. With the help of [`Arrays`](https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/util/Arrays.html) you can initialize an immutable `List` (instead of an `ArrayList`) in one line: List<String> strlist = Arrays.asList("aaa", "bbb", "ccc");
The mistake was that my index.ts file was inside a src folder. I moved the index.ts outside the src folder, and now all changes are reflected correctly
I would like to color my boxplot-outliers in my Seaborn Boxplot when using a hue variables. Something along the line of this, from [seaborn boxplot examples][1], [![sns.boxplot(data=titanic, x="class", y="age", hue="alive", fill=False, gap=.1)][2]][2] but, with the code below, I get this. What should I change? [![enter image description here][3]][3] import seaborn as sns import matplotlib.pyplot as plt # Sample data data = sns.load_dataset('tips') # Boxplot with outliers colored by hue variable ('sex' in this sns.boxplot(data=data, x='day', y='total_bill', hue='sex') plt.show() [1]: https://seaborn.pydata.org/generated/seaborn.boxplot.html# [2]: https://i.stack.imgur.com/AwFcG.png [3]: https://i.stack.imgur.com/NM2g7.png
Seaborn boxplot color outliers by hue variable
|python|plot|seaborn|
FastAPI runs the dependency for each request, meaning that each request gets a new `MockUserRepo` instance. If you want it to persist per test, you could to something like ```python @fixture(scope="function") def user_repo(app: FastAPI): print("created") @dataclass class User: id: int username: str password: str database = [] class MockUserRepo: def create_user(self, user_create_model: UserCreateModel, session: Session) -> User | None: if session: user = User( id=len(database) + 1, username=user_create_model.username, password=user_create_model.password, ) database.append(user) return user def get_user_by_id(self, id: int, session: Session) -> User | None: print(database) if session: for user in database: if user.id == id: return user return None app.dependency_overrides[UserRepo] = MockUserRepo yield ```
Why Backend deployment show 404 error message when deploy project on Vercel?
null
I'm implementing uploading big files to OneDrive by using the BITS protocol. Here is the [documentation][1]. [1]: https://gist.github.com/rgregg/37ba8929768a62131e85 I'm having the following issue. After a certain period of time of being logged in when I'm trying to create a session I'm receiving 401 error. Here's the complete response: <NSHTTPURLResponse: 0x7d6ee0f0> { URL: https://cid-da1cedf5484811a9.users.storage.live.com/items/DA1CEDF5484811A9!373/IMG_0003.JPG } { status code: 401, headers { "BITS-Packet-Type" = Ack; "Content-Length" = 0; Date = "Mon, 22 Dec 2014 09:50:22 GMT"; P3P = "CP=\"BUS CUR CONo FIN IVDo ONL OUR PHY SAMo TELo\""; Server = "Microsoft-HTTPAPI/2.0"; "X-AsmVersion" = "UNKNOWN; 19.9.0.0"; "X-ClientErrorCode" = AccessDenied; "X-MSNSERVER" = "SN3301____PAP101"; "X-QosStats" = "{\"ApiId\":0,\"ResultType\":2,\"SourcePropertyId\":0,\"TargetPropertyId\":42}"; "X-ThrowSite" = "4e1b.c093"; } } And here's how my request looks: { Authorization = "EwCAAq1DBAAUGCCXc8wU/zFu9QnLdZXy+YnElFkAAYejThC8LqFmGJx4sT4Wv11wzA6Cj9tleMQ+PM4PGXSV/DAorkfRiVnt+KQnZRI90XL/FIfwTvhWmp6jFhsppM39GgwbQ7it0tSVCSp4cIFCFSphmV783o+MKPeuEsw79mRGL5Kz2lcrVUxQAq12vUZXnhkX4qiJj0RqMSdaFYghfVVmhkcGsJITOwIisFq/JyaRoffgcW7vZCu9/9Q1Jm62f+bcGur82sTo5ucwV4M7QNtl77nVjv3tPElcUDgZnTvCLuhIE6QHY6yHS+9blWVbaXJBBD0ZPjDbUdjIlbexto6VvXtjp+vELL8rMSJMYcGjN4AxbGmBDnjLm9Iy1RIDZgAACALsAIEvRqDnUAFmIs8toBlRzfxctJcm1wxfqY/531QSDMVG9pIISpNCPppHAa/blSV8+LbLO/hW5i/36/3RTLpFAiXkPxzbkI8OJSrVRDfKcXiK1x+kTNFtcxXLBlJSWYlMY9OcwT+v/JTQnoGD1z6L56zOX53Gt7SBZQ0of7e3QecxHLX7w9lqs0jBmRvwL9I/n0+r9r6CI3tTEnFODFyED9ToBCRwwjLLD8P4qWRXWC1BUL+20v2QCQYRKzSDxZkYa3WrPLA4PIEFdFp58/limBzDrGW4MaWi1UgaI/QF8gN5n+JLNE4YcZL8KaXFZ76zNWNhJFsg4Lctsu95l7oD9MkezDvpA8bhkoNp39rEvPjBEurrFkdHviv73Z/C1W+IoA4ww3ZAYtIt3THtvPE4wq2fUEcb+MhOIG7abZtu4P07+5Zy2UO1rGlChE/pvmtV4XXrrg3TLG5zAQ=="; "BITS-Packet-Type" = "Create-Session"; "BITS-Supported-Protocols" = "{7df0354d-249b-430f-820d-3d2a9bef4931}"; "X-Http-Method-Override" = "BITS_POST"; } (I have omitted code used to open session because it's pretty large). OK, the first thing that comes to my mind is that access token has got outdated and I need to renew it somehow. BUT! Just before I perform request to retrieve user Id using the same access token: - (void)retrieveUserId { NSString *urlString = [NSString stringWithFormat:@"https://apis.live.net/v5.0/me?access_token=%@", commonAccessToken]; NSURL *url = [NSURL URLWithString:urlString]; NSURLSessionConfiguration *sessionConfiguration = [NSURLSessionConfiguration defaultSessionConfiguration]; NSURLSession *session = [NSURLSession sessionWithConfiguration:sessionConfiguration]; NSURLSessionDataTask *task = [session dataTaskWithURL:url completionHandler:^(NSData *data, NSURLResponse *response, NSError *error){ NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response; if (httpResponse.statusCode == 200) { NSLog(@"Response retrieving user id %@", httpResponse); NSError *parsingError = nil; NSDictionary *parsedDictionary = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:&parsingError]; if (!parsingError) { commonUserId = parsedDictionary[@"id"]; [self createUploadRequest]; } else { dispatch_async(dispatch_get_main_queue(), ^{ [self.delegate bitsClient:self didFailWithError:parsingError]; }); } } else { dispatch_async(dispatch_get_main_queue(), ^{ [self.delegate bitsClient:self didFailWithError:error]; }); } }]; [task resume]; } And it works. This access token is OK when I get the user Id. But you can see that here unlike when trying to open a session the access token is put as a part of URL, not as one of header fields. I'm not sure if it matters or not. By now I can't explain such a behaviour. If I logout and login again then it's OK again, I don't receive the 401 error any more, so probably I really should renew the token, but how can it be done? One more thing for you to know - when I get the access token from `LiveConnectSession` I check if this session is expired and it's not. Its `expires` property is later than `[NSDate date]`. Also one more thing for you to know - despite I'm not able to open session and my request is being rejected with 401 error if I try to upload files by using `Live SDK`'s `LiveOperation` the files are uploaded without any error. I want to resume: After a certain period (seems like it is 24 hours but I'm not sure) of being logged in as OneDrive user I become unable to upload files using BITS protocol because I receive 401 error. At the same time the session seems to be not expired and I can still upload files by using `LiveOperation`. Also I can easily get user id using the same access token which is used when opening an upload session. If I logout and login again then again everything works like charm and I'm able to create session and upload files.
Uploading files to OneDrive results in a 401 error
ok if i have this right, you have some div's in your main page body and would like to know when they scroll into view so that you can perform some action i believe this does the trick <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-js --> window.onload=function(){ var wy = window.scrollY; var wh = window.innerHeight; var ids = ['sec1','sec2','sec3']; var status = {}; ids.forEach(chk); document.onscroll = e=>{ wy = window.scrollY; ids.forEach(chk.scroll); }//onscroll function chk(el){ var node = document.querySelector('#'+el); var y = node.offsetTop; var h = node.offsetHeight; if(y>=wy && y<=wy+wh){ console.log(el+' start',y,h,wy,wh); status[el] = true; } }//chk chk.scroll=function(el){ var node = document.querySelector('#'+el); var y = node.offsetTop; var h = node.offsetHeight; if((y>=wy && y<=wy+wh) || (y+h>=wy && y+h<=wy+wh) || (y<=wy && y+h>=wy+wh)){ if(!status[el]){ console.log(el+' start',y,h,wy,wh); status[el] = true; } }else{ if(status[el]){ console.log(el+' end',y,h,wy,wh); status[el] = false; } } }//scroll } <!-- language: lang-css --> #sec1 { height:500px; background:lightgreen; } #sec2 { height:1000px; background:yellow; } #sec3 { height:2000px; background:lightblue; } <!-- language: lang-html --> <div id=sec1></div> <div id=sec2></div> <div id=sec3></div> <!-- end snippet --> it is designed to work in the body of a webpage, it appears to still work in stackoverflow snippet output iframe but that is an unusual environment in that it has a console built into the webpage body it uses to display the results, that said it does still appear to work ive also tried to keep this as simple as possible, if you do find shortcomings with it, come find me in the [stackoverflow javascript chat][1] and i'll update it also note that the onscroll event is a fairly coarse event [1]: https://chat.stackoverflow.com/rooms/17/javascript