instruction
stringlengths
0
30k
1. Download new ChromeDriver for you OS from [here][1]. It should be the same version as an installed Chrome. 2. Replace old ChromeDriver file in your project with the new one. [1]: https://chromedriver.chromium.org/downloads
How about: #define SV(str) \ _Generic(&("" str ""), char(*)[sizeof(str)]: sizeof(str) - 1) int printf(char *, ...); int main() { printf("%zu\n", SV("test")); printf("%zu\n", SV("test" "test")); static const char *const s = "hello"; char word[] = "hello"; double a = 0.0f; double *d = &a; printf("%zu\n", SV(NULL)); printf("%zu\n", SV(word)); printf("%zu\n", SV(d)); printf("%zu\n", SV(s)); printf("%zu\n", SV()); printf("%zu\n", SV(/*comment*/)); printf("%zu\n", SV(-)); printf("%zu\n", SV("abc" - "def")); }
You can run the same thing but programmatically create the cases. In your example, you have a short list of colours, but if you have many different categories, you can run something like: SET SESSION group_concat_max_len = 10000; SET @cases = NULL; SELECT GROUP_CONCAT( DISTINCT CONCAT( 0xd0a, "COUNT(CASE WHEN color = '", color, "' THEN 1 END) AS ", color ) SEPARATOR ',' ) INTO @cases FROM table_name t; SET @sql = CONCAT( "SELECT t.keyword,", @cases, "FROM table_name t" ); PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt;
I'm relatively new to using neo4j. I've connected to a database with the py2neo library and populated the database with the faker library to create nodes for Person and Address each with attributes attached to them. I'm interested in creating indexes and testing the performance of different indexes. Before I get to that point, I created some indexes and used the command ``` `graph.run("SHOW INDEXES;")` ``` I was expecting 2 indexes to show but 3 indexes returned. The final one was a Look up type and had some null properties. That attached image shows the output, Why is this index showing up? Thanks. I was expecting only 2 to return, so I'm thinking maybe this is some lack of understanding on my part? I've started reading through the Neo4j documentation on indexes but I'm still unsure. Any help would be appreciated. Thanks!
By windows console. docker run -d -v %cd%:/home/jovyan/work -e GRANT_SUDO=yes --user root -p 8888:8888 jupyter/datascience-notebook:latest Using the docker exec command allows you to obtain a root prompt . docker exec -it youthful_albattani bash
I have a large dataset, with on the order of 2^15 entries, and I calculate the confidence interval of the mean of the entries with [`scipy.stats.bootstrap`][1]. For a dataset this size, this costs about 6 seconds on my laptop. I have a lot of datasets, so I find this takes too long (especially if I just want to do a test run to debug the plotting etc.). By default, SciPy's bootstrapping function resamples the data `n_resamples=9999` times. As I understand it, the resampling and computing the average of the resampled data should be the most time-consuming part of the process. However, when I reduce the number of resamples by roughly three orders of magnitude (`n_resamples=10`), the computational time of the bootstrapping method does not even half. I'm using Python 3 and SciPy 1.9.3. ``` import numpy as np from scipy import stats from time import perf_counter data = np.random.rand(2**15) data = np.array([data]) start = perf_counter() bs = stats.bootstrap(data, np.mean, batch=1, n_resamples=9999) end = perf_counter() print(end-start) start = perf_counter() bs = stats.bootstrap(data, np.mean, batch=1, n_resamples=10) end = perf_counter() print(end-start) start = perf_counter() bs = stats.bootstrap(data, np.mean, n_resamples=10) end = perf_counter() print(end-start) ``` gives ``` 6.021066904067993 3.9989020824432373 30.46708607673645 ``` To speed up bootstrapping, I have set `batch=1`. As I understand it, this is more memory efficient, and prevents swapping the data. Setting a higher batch number increases the time consumption, as you can see above. How can I do faster bootstrapping? [1]: https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.bootstrap.html
|python|scipy|statistics-bootstrap|scipy.stats|
{"Voters":[{"Id":5825294,"DisplayName":"Enlico"}]}
I tried using Django built in views to create a log out route But it doesn't work. It says method not allow I expected it to log out a user but it doesn't. Always getting error with that. But I imported the login view from Django views and it's working but the log out says method not allowed .Wish someone could help me
Log out view in Django not working. It says method not allow
|python|django|
null
An element with "position: fixed" must remain fixed to the viewport. But in the below example, the fixed element moves along with its parent. Can anyone explain why the element isn't fixed to the viewport? ``` <div style="height: 100vh; background-color: lightblue; margin-left: 300px;"> <div style="position: fixed; background-color: tomato; width: 100px; height: 100px;"> </div> </div> ```
CSS "position: fixed" moves along with parent
Is there a way in vscode to after I type Ctrl + . and accept a correction with quick fix, to automatically run the key combo Alt+F8 to move to the next problem without having to? I use a spelling extension and it to correct a word by selecting Ctrl+ . then selecting the correct suggestion. However after this selection I want it to automatically move to the next item in the problem list. Currently it doesn't do this but I have to Press Alt+F8 which is the default to open the next problem. Then I click Ctrl + . again to select which correction applies. I am not sure why vscode doesn't have option to move automatically to the next problem after fixing the first. I looked at the settings and there isn't such an option. [![enter image description here][1]][1] After correction with Ctrl+. it says on the corrected word without moving to the next like it should [![enter image description here][2]][2] [1]: https://i.stack.imgur.com/OdCXY.png [2]: https://i.stack.imgur.com/mcWSp.png
Just Add this code to controller: ViewData("SomeRole") = "hidden"/"visible" apply this to your html: <li style="visibility: @ViewBag.SomeRole">@Html.ActionLink("Tenant", "Index", "{controller}", New With {.area = ""}, Nothing)</li>
I'm following a previous answered question [here][1] about how to implement an all reduce in cuda, which links to a slide deck from nvidia. What I have works majority of the time (when the input size is a nice power of 2), but some input sizes results in answers which seems to be off by 2. In the reduction, once there is <= 32 elements to reduce, the last warp simply unrolls. The final reduce will sum `partial_sum[0] + partial_sum[1]`. In the example below, I print out the stored values before and after the final partial sum to see where the calculation is deviating. Here is the output of the program: ``` threadIdx 0, partial_sum[0] 14710790.000000 threadIdx 1, partial_sum[1] 18872320.000000 threadIdx 0, partial_sum[0] 33583112.000000 threadIdx 1, partial_sum[1] 33059334.000000 expected 33583110, result 33583112 ``` The first two lines are the stored partial sums. The correct result is `14710790 + 18872320 = 33583110` which should then be stored in `partial_sum[0]` on line 3. The stored results on the first 2 lines are correct, but the result on line 3 of the final addition is not. Here is the full working example, compiling with `nvcc test.cu`. Any guidance would be appreciated! ```cpp #include <iostream> #include <numeric> #include <vector> constexpr unsigned int THREADS_PER_DIM = 512; __global__ void reduce(float *v, float *v_r, std::size_t N, bool print) { // Allocate shared memory volatile __shared__ float partial_sum[THREADS_PER_DIM * 4]; // Load elements AND do first add of reduction // We halved the number of blocks, and reduce first 2 elements into current and what would be the next block unsigned int i = blockIdx.x * (blockDim.x * 2) + threadIdx.x; // Store first partial result instead of just the elements // Set to 0 first to be safe partial_sum[threadIdx.x + blockDim.x] = 0; partial_sum[threadIdx.x] = 0; partial_sum[threadIdx.x] = (i < N ? v[i] : 0) + ((i + blockDim.x) < N ? v[i + blockDim.x] : 0); __syncthreads(); // Start at 1/2 block stride and divide by two each iteration // Stop early (call device function instead) for (unsigned int s = blockDim.x / 2; s > 32; s >>= 1) { // Each thread does work unless it is further than the stride if (threadIdx.x < s) { partial_sum[threadIdx.x] += partial_sum[threadIdx.x + s]; } __syncthreads(); } if (threadIdx.x < 32) { partial_sum[threadIdx.x] += partial_sum[threadIdx.x + 32]; partial_sum[threadIdx.x] += partial_sum[threadIdx.x + 16]; partial_sum[threadIdx.x] += partial_sum[threadIdx.x + 8]; partial_sum[threadIdx.x] += partial_sum[threadIdx.x + 4]; partial_sum[threadIdx.x] += partial_sum[threadIdx.x + 2]; if (threadIdx.x < 2 && blockIdx.x == 0 && print) { printf("threadIdx %d, partial_sum[%d] %f\n", threadIdx.x, threadIdx.x, partial_sum[threadIdx.x]); } partial_sum[threadIdx.x] += partial_sum[threadIdx.x + 1]; if (threadIdx.x < 2 && blockIdx.x == 0 && print) { printf("threadIdx %d, partial_sum[%d] %f\n", threadIdx.x, threadIdx.x, partial_sum[threadIdx.x]); } } // Let the thread 0 for this block write it's result to main memory // Result is inexed by this block if (threadIdx.x == 0) { v_r[blockIdx.x] = partial_sum[0]; } } constexpr std::size_t N = (1 << 13) + 4; int main() { // Init and fill vec std::vector<float> a(N); for (std::size_t i = 0; i < N; ++i) { a[i] = static_cast<float>(i); } // allocate and copy on device std::size_t bytes = N * sizeof(float); float *d_A; float *d_A_reduction; cudaMalloc((void **)&d_A, bytes); cudaMalloc((void **)&d_A_reduction, bytes); cudaMemset(d_A_reduction, 0, bytes); cudaMemcpy(d_A, a.data(), bytes, cudaMemcpyHostToDevice); // 8192 + 4 elements with 512 threads = 16 + 1 blocks // Each block actually considered elements in adjacent block on first add in kernel, so we need 9 blocks auto num_blocks = 9; reduce<<<num_blocks, THREADS_PER_DIM>>>(d_A, d_A_reduction, N, false); cudaMemcpy(d_A, d_A_reduction, bytes, cudaMemcpyDeviceToDevice); reduce<<<1, THREADS_PER_DIM>>>(d_A, d_A_reduction, num_blocks, true); float result = 0; cudaMemcpy(&result, d_A_reduction, sizeof(float), cudaMemcpyDeviceToHost); cudaFree(d_A); cudaFree(d_A_reduction); auto correct_result = std::accumulate(a.begin(), a.end(), 0.0); std::cout << "expected " << static_cast<int>(correct_result) << ", result " << static_cast<int>(result) << std::endl; } ``` [1]: https://stackoverflow.com/questions/22939034/block-reduction-in-cuda
Cuda reduce kernel result off by 2
|c++|cuda|reduction|
Just Add this code to controller: ViewData("SomeRole") = "hidden"/"visible" apply this to your html: '<li style="visibility: @ViewBag.SomeRole">@Html.ActionLink("Tenant", "Index", "{controller}", New With {.area = ""}, Nothing)</li>'
Just Add this code to controller: ViewData("SomeRole") = "hidden"/"visible" apply this to your html: "<li style="visibility: @ViewBag.SomeRole">@Html.ActionLink("Tenant", "Index", "{controller}", New With {.area = ""}, Nothing)</li>"
For me I just changed buildToolsVersion from "31.0.0" to "30.0.3" in my build.gradle(app) file : android { compileSdkVersion 30 buildToolsVersion "30.0.3" ... }
Return a pointer to the `Node` of interest instead of updating the out parameter `head_dest`. The current implementation changes the original list. To create a new list you need to return a pointer to *copy* of the smallest node or NULL. To emphasize that I made the argument constant with `const Node *head`. ``` #include <stdio.h> #include <stdlib.h> typedef struct Node { int val; struct Node *pt_next; } Node; Node *linked_list_new(int val) { Node *n = malloc(sizeof *n); if(!n) { printf("malloc failed\n"); exit(1); } n->val = val; return n; } Node *linked_list_create(size_t n, int *vals) { Node *head = NULL; Node **cur = &head; for(size_t i=0; i < n; i++) { *cur = linked_list_new(vals[i]); if(!head) head = *cur; cur = &(*cur)->pt_next; } *cur = NULL; return head; } void linked_list_print(Node *head) { for(; head; head=head->pt_next) printf("%d->", head->val); printf("NULL\n"); } void linked_list_free(Node *head) { while(head) { Node *tmp = head->pt_next; free(head); head=tmp; } } Node *pairWiseMinimumInNewList_Rec(const Node* head) { Node *tmp; if ( (head && head->pt_next && head->val < head->pt_next->val) || (head && !head->pt_next) ) { tmp = linked_list_new(head->val); tmp->pt_next = pairWiseMinimumInNewList_Rec(head->pt_next ? head->pt_next->pt_next : NULL); } else if (head && head->pt_next) { tmp = linked_list_new(head->pt_next->val); tmp->pt_next = pairWiseMinimumInNewList_Rec(head->pt_next->pt_next); } else tmp = NULL; return tmp; } int main() { Node *head=linked_list_create(7, (int []) {2,1,3,4,5,6,7}); Node* head_dest=pairWiseMinimumInNewList_Rec(head); linked_list_print(head); linked_list_free(head); linked_list_print(head_dest); linked_list_free(head_dest); } ``` You can compress the implementation by observing that in the base case we return NULL, otherwise it's either a copy of the 1st or 2nd node. The recursive call is either two nodes ahead or we are done: ``` Node *pairWiseMinimumInNewList_Rec(const Node* head) { if(!head) return NULL; Node *tmp = linked_list_new( (head->pt_next && head->val < head->pt_next->val) || (!head->pt_next) ? head->val : head->pt_next->val ); tmp->pt_next = pairWiseMinimumInNewList_Rec(head->pt_next ? head->pt_next->pt_next : NULL); return tmp; } ``` This test case exercises the main two code paths: ``` 2->1->3->4->5->6->7->NULL 1->3->5->7->NULL ```
I have a project which is build in Nuxt 3 with a homepage which shows products. On that homepage, you can click on the title of the product and the product details page opens up. I archive this by using `<NuxtLink>` ``` <NuxtLink :to="{ name: 'slug', params: { slug: product.slug }}"> <p>{{ product.title }}</p> </NuxtLink> ``` When the user click on that link, the `[slug].vue` component will show the product details page. So far, so good. However, this leads to the `[slug].vue` component fetching the product data from the API again using its slug like this: ``` const { data } = await useFetch(runtimeConfig.public.api.product.view + `/${slug}`); ``` This behavior is also needed when the user visits the product details page directly from a link he saw on e.g. Facebook etc. But when the user clicks on the `<NuxtLink>` from the homepage, I would like to pass my product object to the `[slug].vue` component, as the homepage already has all needed information about the product the `[slug].vue` component needs to render. If I will be able to pass my product object to the `[slug].vue` component, I could skip the extra API fetch and present the data right away to the user, increasing page speed and user experience. I have already written the necessary code I need within my `[slug].vue` component to determine whether the props are empty and the component needs to fetch them from the API or the component can just use the props being passed and skip the fetch: ``` <script setup lang="ts"> const { slug } = useRoute().params; const runtimeConfig = useRuntimeConfig() const route = useRoute() // Define component props const props = defineProps({ product: null }); // Computed property to determine whether data needs to be fetched const fetchData = computed(() => { return !props.product; // If props.data is not provided, fetch data }); // Data ref to store fetched data const product = ref(null); // Fetch data from the API if fetchData is true if (fetchData.value) { const { data } = await useFetch(runtimeConfig.public.api.product.view + `/${slug}`); product.value = data.value; } </script> ``` However, I am failing at passing my product object from my `<NuxtLink>` to the props of my `[slug].vue` component. How can I archive that? I do not want to pass my product object from my homepage to my `[slug].vue` component using `params`. This will not work as the product object is quite long. I could stringify it with `JSON.stringify()` but I also don't want to pass data via my URL except the slug. Furthermore, the URL would also look very ugly, passing a very long `JSON` string to it. I also do not want to use a storage like Pinia. I want to make use of the available `props` functionality, which was build to pass data between components. If you have any other idea, how I can pass the data to my `[slug].vue` component from the homepage, let me know. Kind regards
Pass dynamic object data via nuxt-link to component
|javascript|vue.js|nuxt.js|vue-router|vue-props|
I wrote some code in Pycharm last year, to loop through VAT numbers entered into the Gov website, to make sure they were still valid. It still works fine on the original laptop, but not on my other laptop, even thought the code is exactly the same (the only adjustment was for the location of the spreadsheet). I have given my code down below. When I try to run it on my other laptop, it comes up with the following error. ``` Traceback (most recent call last): File "C:\Users\neils\Documents\Pycharm Projects\VATChecker\VATChecker.py", line 30, in <module> VAT = web.find_element_by_xpath('//*[@id="target"]') ^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'WebDriver' object has no attribute 'find_element_by_xpath' Process finished with exit code 1 ``` One thing I also notice, is that the import sys and import datetime are both greyed out. I guess that's because it crashed before these imports were used? I should mention, the version of Chrome is the same for both laptops (version 123), and I have the same chromedriver installed for both. Both laptops are windows 64 bit, in case you're thinking that might be the issue. Are you able to advise me what the problem is please? ``` import datetime import sys from selenium import webdriver from openpyxl import workbook, load_workbook from datetime import date web = webdriver.Chrome() wb = load_workbook('C:\\Users\\neils\\Documents\\NSO\\Self Billing agreements\\VATMusiciansCheckerUK.xlsx', data_only=True, read_only=False) ws = wb.active x=2 y=1 current_datetime = datetime.datetime.now() current_datetime.strftime('%x %X') invalid = "" while ws.cell(x,1).value !=None: ws.cell(x,9).value = "" web.get("https://www.tax.service.gov.uk/check-vat-number/enter-vat-details") web.implicitly_wait(10) VatNumber = ws.cell(x,4).value VAT = web.find_element_by_xpath('//*[@id="target"]') VAT.send_keys(VatNumber) VAT.submit() web.implicitly_wait(4) registered = web.find_element_by_xpath('/html/body/div[2]') if (registered.text.find("Invalid")) > 0: ws.cell(x,9).value = "Invalid VAT number" invalid = invalid + str(y) + " " + ws.cell(x,1).value + " " + ws.cell(x,2).value + ", " y=y+1 else: ws.cell(x,9).value = "Valid VAT number" ws.cell(x,6).value = current_datetime x=x+1 if invalid == "": print("All VAT records are correct") else: print("Invalid VAT records are " + invalid) wb.save('C:\\Users\\neils\\Documents\\NSO\\Self Billing agreements\\VATMusiciansCheckerUK.xlsx') ```
I have a NSArray of NSDictionaries, in this array there are several values which I do not want to show in the UITableView, I would like to know how to avoid returning these cells in the `tableView:cellForRowAtIndexPath:`. I have tried to `return nil;` but this has caused me errors. This is what my code looks like - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; CustomInstallCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[CustomInstallCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; } // Configure the cell... cell.selectionStyle = UITableViewCellSelectionStyleGray; currentInstallDictionary = [sortedItemsArray objectAtIndex:indexPath.row]; NSNumber *tempDP = [currentInstallDictionary objectForKey:@"dp"]; NSInteger myInteger = [tempDP integerValue]; if (myInteger == 0) { return cell; } return nil; // gives error }
How to not return a UITableviewCell
it showed indirect effect in the lower triangle and direct effect in the upper triangle. ![enter image description here](https://i.stack.imgur.com/WEueL.jpg) It showed indirect effect in the lower triangle and direct effect in the upper triangle. I just want it to show the reciprocal number in the upper triangle for league table instead of direct effect or what about function for calculating from R I tried this order netleague(net1, net1, seq = netrank(net1), ci = FALSE, backtransf = FALSE) to combine another league table and to show upper triangle as the the reciprocal number but still cannot. I tried to use matrix but still cannot know how to do
null
I am new in ARCore and i create a WebXR application with the help of codelab and it works fine but it placed the rectile towards floor i want this rectile should be on wall. ``` <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Building an augmented reality application with the WebXR Device API</title> <link rel="stylesheet" href="https://unpkg.com/material-components-web@latest/dist/material-components-web.min.css"> <script src="https://unpkg.com/material-components-web@latest/dist/material-components-web.min.js"></script> <!-- three.js --> <script src="https://unpkg.com/three@0.126.0/build/three.js"></script> <script src="https://unpkg.com/three@0.126.0/examples/js/loaders/GLTFLoader.js"></script> <link rel="stylesheet" type="text/css" href="app.css" /> <script src="utils.js"></script> </head> <body> <div id="enter-ar-info" class="mdc-card demo-card"> <h2>Augmented Reality with the WebXR Device API</h2> <p> This is an experiment using augmented reality features with the WebXR Device API. Upon entering AR, you will be surrounded by a world of cubes. Learn more about these features from the <a href="https://codelabs.developers.google.com/codelabs/ar-with-webxr">Building an augmented reality application with the WebXR Device API</a> Code Lab. </p> <!-- Starting an immersive WebXR session requires user interaction. Start the WebXR experience with a simple button. --> <a id="enter-ar" class="mdc-button mdc-button--raised mdc-button--accent"> Start augmented reality </a> </div> <div id="unsupported-info" class="mdc-card demo-card"> <h2>Unsupported Browser</h2> <p> Your browser does not support AR features with WebXR. Learn more about these features from the <a href="https://codelabs.developers.google.com/codelabs/ar-with-webxr">Building an augmented reality application with the WebXR Device API</a> Code Lab. </p> </div> <script src="app.js"></script> <div id="stabilization"></div> </body> </html> ``` ``` /* * Copyright 2017 Google Inc. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the 'License'); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an 'AS IS' BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Query for WebXR support. If there's no support for the `immersive-ar` mode, * show an error. */ (async function() { const isArSessionSupported = navigator.xr && navigator.xr.isSessionSupported && await navigator.xr.isSessionSupported("immersive-ar"); if (isArSessionSupported) { document.getElementById("enter-ar").addEventListener("click", window.app.activateXR) } else { onNoXRDevice(); } })(); /** * Container class to manage connecting to the WebXR Device API * and handle rendering on every frame. */ class App { /** * Run when the Start AR button is pressed. */ activateXR = async () => { try { // Initialize a WebXR session using "immersive-ar". this.xrSession = await navigator.xr.requestSession("immersive-ar", { requiredFeatures: ['hit-test', 'dom-overlay'], domOverlay: { root: document.body } }); // Create the canvas that will contain our camera's background and our virtual scene. this.createXRCanvas(); // With everything set up, start the app. await this.onSessionStarted(); } catch(e) { console.log(e); onNoXRDevice(); } } /** * Add a canvas element and initialize a WebGL context that is compatible with WebXR. */ createXRCanvas() { this.canvas = document.createElement("canvas"); document.body.appendChild(this.canvas); this.gl = this.canvas.getContext("webgl", {xrCompatible: true}); this.xrSession.updateRenderState({ baseLayer: new XRWebGLLayer(this.xrSession, this.gl) }); } /** * Called when the XRSession has begun. Here we set up our three.js * renderer, scene, and camera and attach our XRWebGLLayer to the * XRSession and kick off the render loop. */ onSessionStarted = async () => { // Add the `ar` class to our body, which will hide our 2D components document.body.classList.add('ar'); // To help with working with 3D on the web, we'll use three.js. this.setupThreeJs(); // Setup an XRReferenceSpace using the "local" coordinate system. this.localReferenceSpace = await this.xrSession.requestReferenceSpace('local'); // Create another XRReferenceSpace that has the viewer as the origin. this.viewerSpace = await this.xrSession.requestReferenceSpace('viewer'); // Perform hit testing using the viewer as origin. this.hitTestSource = await this.xrSession.requestHitTestSource({ space: this.viewerSpace }); // Start a rendering loop using this.onXRFrame. this.xrSession.requestAnimationFrame(this.onXRFrame); this.xrSession.addEventListener("select", this.onSelect); } /** Place a sunflower when the screen is tapped. */ onSelect = () => { if (window.sunflower) { const clone = window.sunflower.clone(); clone.position.copy(this.reticle.position); this.scene.add(clone) const shadowMesh = this.scene.children.find(c => c.name === 'shadowMesh'); shadowMesh.position.y = clone.position.y; } } /** * Called on the XRSession's requestAnimationFrame. * Called with the time and XRPresentationFrame. */ onXRFrame = (time, frame) => { // Queue up the next draw request. this.xrSession.requestAnimationFrame(this.onXRFrame); // Bind the graphics framebuffer to the baseLayer's framebuffer. const framebuffer = this.xrSession.renderState.baseLayer.framebuffer this.gl.bindFramebuffer(this.gl.FRAMEBUFFER, framebuffer) this.renderer.setFramebuffer(framebuffer); // Retrieve the pose of the device. // XRFrame.getViewerPose can return null while the session attempts to establish tracking. const pose = frame.getViewerPose(this.localReferenceSpace); if (pose) { // In mobile AR, we only have one view. const view = pose.views[0]; const viewport = this.xrSession.renderState.baseLayer.getViewport(view); this.renderer.setSize(viewport.width, viewport.height) // Use the view's transform matrix and projection matrix to configure the THREE.camera. this.camera.matrix.fromArray(view.transform.matrix) this.camera.projectionMatrix.fromArray(view.projectionMatrix); this.camera.updateMatrixWorld(true); // Conduct hit test. const hitTestResults = frame.getHitTestResults(this.hitTestSource); // If we have results, consider the environment stabilized. if (!this.stabilized && hitTestResults.length > 0) { this.stabilized = true; document.body.classList.add('stabilized'); } if (hitTestResults.length > 0) { const hitPose = hitTestResults[0].getPose(this.localReferenceSpace); // Update the reticle position this.reticle.visible = true; this.reticle.position.set(hitPose.transform.position.x, hitPose.transform.position.y, hitPose.transform.position.z) this.reticle.updateMatrixWorld(true); } // Render the scene with THREE.WebGLRenderer. this.renderer.render(this.scene, this.camera) } } /** * Initialize three.js specific rendering code, including a WebGLRenderer, * a demo scene, and a camera for viewing the 3D content. */ setupThreeJs() { // To help with working with 3D on the web, we'll use three.js. // Set up the WebGLRenderer, which handles rendering to our session's base layer. this.renderer = new THREE.WebGLRenderer({ alpha: true, preserveDrawingBuffer: true, canvas: this.canvas, context: this.gl }); this.renderer.autoClear = false; this.renderer.shadowMap.enabled = true; this.renderer.shadowMap.type = THREE.PCFSoftShadowMap; // Initialize our demo scene. this.scene = DemoUtils.createLitScene(); this.reticle = new Reticle(); this.scene.add(this.reticle); // We'll update the camera matrices directly from API, so // disable matrix auto updates so three.js doesn't attempt // to handle the matrices independently. this.camera = new THREE.PerspectiveCamera(); this.camera.matrixAutoUpdate = false; } }; window.app = new App(); ``` I want to place rectile towards wall not on floor my example work very well on floor but it is not working towards wall. How to place object on wall?
You're assigning a result to `shape`, but declaring it as a `Box<dyn Shape>`. You need to declare `shape` properly: ``` fn get_shape_edges(name: &str) -> Result<u8, &str> { let shape: Result<Box<dyn Shape>, &str> = match name { "triangle" => Ok(Box::new(Triangle {})), "rectangle" => Ok(Box::new(Rectangle {})), _ => Err("bad value") }; shape.map(|b| b.edges()) } ``` Notice that I also removed the early return and used `map` since you need to convert `Result<Box<dyn Shape>, &str>` to `Result<u8, &str>`. ``` println!("triangle: {:?}", get_shape_edges("triangle")); println!("rectangle: {:?}", get_shape_edges("rectangle")); println!("pentagon: {:?}", get_shape_edges("pentagon")); ``` Results in: ``` triangle: Ok(3) rectangle: Ok(4) pentagon: Err("bad value") ``` Another alternative that works the same way is to add an explicit `return` to the last branch of the match instead of a `panic!`: ``` fn get_shape_edges(name: &str) -> Result<u8, &str> { let shape: Box<dyn Shape> = match name { "triangle" => Box::new(Triangle {}), "rectangle" => Box::new(Rectangle {}), _ => return Err("bad value") }; Ok(shape.edges()) } ``` While I prefer the aesthetics of the second approach myself, either of these is better than the repeated casting in the accepted answer.
I use spoon 4.4 and database repository based SQL Server 2008 on Windows 11. JAVA version is 1.8. I can export subdirectory tree to a xml file encoding="UTF-8". The file as follows: ``` <?xml version="1.0" encoding="UTF-8"?> <repository> <transformations> <transformation> <info> <name>导入什么东西</name> <description/> <extended_description>这是说明</extended_description> <trans_version/> <trans_type>Normal</trans_type> <trans_status>0</trans_status> <directory>&#47;某单位20150818&#47;10500--导入分析数据&#47;10500100--历史核算结果</directory> <parameters> </parameters> <log> <trans-log-table><connection/> <schema/> <table/> <size_limit_lines/> <interval/> <timeout_days/> <field><id>ID_BATCH</id><enabled>Y</enabled><name>ID_BATCH</name></field><field><id>CHANNEL_ID</id><enabled>Y</enabled><name>CHANNEL_ID</name></field><field><id>TRANSNAME</id><enabled>Y</enabled><name>TRANSNAME</name></field><field><id>STATUS</id><enabled>Y</enabled><name>STATUS</name></field><field><id>LINES_READ</id><enabled>Y</enabled><name>LINES_READ</name><subject/></field><field><id>LINES_WRITTEN</id><enabled>Y</enabled><name>LINES_WRITTEN</name><subject/></field><field><id>LINES_UPDATED</id><enabled>Y</enabled><name>LINES_UPDATED</name><subject/></field><field><id>LINES_INPUT</id><enabled>Y</enabled><name>LINES_INPUT</name><subject/></field><field><id>LINES_OUTPUT</id><enabled>Y</enabled><name>LINES_OUTPUT</name><subject/></field><field><id>LINES_REJECTED</id><enabled>Y</enabled><name>LINES_REJECTED</name><subject/></field><field><id>ERRORS</id><enabled>Y</enabled><name>ERRORS</name></field><field><id>STARTDATE</id><enabled>Y</enabled><name>STARTDATE</name></field><field><id>ENDDATE</id><enabled>Y</enabled><name>ENDDATE</name></field><field><id>LOGDATE</id><enabled>Y</enabled><name>LOGDATE</name></field><field><id>DEPDATE</id><enabled>Y</enabled><name>DEPDATE</name></field><field><id>REPLAYDATE</id><enabled>Y</enabled><name>REPLAYDATE</name></field><field><id>LOG_FIELD</id><enabled>Y</enabled><name>LOG_FIELD</name></field></trans-log-table> <perf-log-table><connection/> ``` But when I import this XML using Tools -> Repository -> Import Repository, I get errors: ``` java.net.MalformedURLException: unknown protocol: f at java.net.URL.<init>(URL.java:617) at java.net.URL.<init>(URL.java:507) at java.net.URL.<init>(URL.java:456) at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source) at org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source) at org.apache.xerces.jaxp.SAXParserImpl.parse(Unknown Source) at javax.xml.parsers.SAXParser.parse(SAXParser.java:275) at org.pentaho.di.repository.RepositoryExportSaxParser.parse(RepositoryExportSaxParser.java:68) at org.pentaho.di.repository.RepositoryImporter.importAll(RepositoryImporter.java:126) at org.pentaho.di.ui.repository.dialog.RepositoryImportProgressDialog$3.run(RepositoryImportProgressDialog.java:185) at org.eclipse.swt.widgets.RunnableLock.run(Unknown Source) at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Unknown Source) at org.eclipse.swt.widgets.Display.runAsyncMessages(Unknown Source) at org.eclipse.swt.widgets.Display.readAndDispatch(Unknown Source) at org.pentaho.di.ui.repository.dialog.RepositoryImportProgressDialog.open(RepositoryImportProgressDialog.java:190) at org.pentaho.di.ui.spoon.Spoon.importDirectoryToRepository(Spoon.java:4879) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.pentaho.ui.xul.impl.AbstractXulDomContainer.invoke(AbstractXulDomContainer.java:329) at org.pentaho.ui.xul.impl.AbstractXulComponent.invoke(AbstractXulComponent.java:139) at org.pentaho.ui.xul.impl.AbstractXulComponent.invoke(AbstractXulComponent.java:123) at org.pentaho.ui.xul.jface.tags.JfaceMenuitem.access$100(JfaceMenuitem.java:26) at org.pentaho.ui.xul.jface.tags.JfaceMenuitem$1.run(JfaceMenuitem.java:85) at org.eclipse.jface.action.Action.runWithEvent(Action.java:498) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:545) at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:490) at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:402) at org.eclipse.swt.widgets.EventTable.sendEvent(Unknown Source) at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source) at org.eclipse.swt.widgets.Display.runDeferredEvents(Unknown Source) at org.eclipse.swt.widgets.Display.readAndDispatch(Unknown Source) at org.pentaho.di.ui.spoon.Spoon.readAndDispatch(Spoon.java:1221) at org.pentaho.di.ui.spoon.Spoon.waitForDispose(Spoon.java:7044) at org.pentaho.di.ui.spoon.Spoon.start(Spoon.java:8304) at org.pentaho.di.ui.spoon.Spoon.main(Spoon.java:580) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.pentaho.commons.launcher.Launcher.main(Launcher.java:134) ``` What about this? Thank you.
I have been asked in one of the Top company below question and I was not able to answer. Just replied : I need to update myself on this topic **Question :** **If you create a composite indexing on 3 columns (eid , ename , esal ) ?** - If i mention only eid=10 after where clause will the indexing be called ? `select * from emp where eid=10`; - If I mention only eid=10 and ename='Raj' will the indexing be called ? `select * from emp where eid=10 and ename='Raj';` - If I mention in different order like esal=1000 and eid=10 will the indexing be called ? `select * from emp where esal=1000 and eid=1;` - If I mention in reverse order like esal = 1000 and ename = 'Raj' and eid = 10 will the indexing be called ? `select * from emp where esal=1000 and enam='Raj' and eid=10;` Need a solution for this need with detail table representation with data how it does?
{"Voters":[{"Id":14853083,"DisplayName":"Tangentially Perpendicular"},{"Id":2511795,"DisplayName":"0andriy"},{"Id":839601,"DisplayName":"gnat"}]}
I have been asked in one of the Top company below question and I was not able to answer. Just replied : I need to update myself on this topic **Question :** **If you create a composite indexing on 3 columns (eid , ename , esal ) ?** - If i mention only eid=10 after where clause will the indexing be called ? `select * from emp where eid=10`; - If I mention only eid=10 and ename='Raj' will the indexing be called ? `select * from emp where eid=10 and ename='Raj';` - If I mention in different order like esal=1000 and eid=10 will the indexing be called ? `select * from emp where esal=1000 and eid=10;` - If I mention in reverse order like esal = 1000 and ename = 'Raj' and eid = 10 will the indexing be called ? `select * from emp where esal=1000 and enam='Raj' and eid=10;` Need a solution for this need with detail table representation with data how it does?
|powerbi|dax|powerquery|data-analysis|powerbi-desktop|
Aliases don't take effect when I use vim to execute external commands, for example: :! ll I want it to support aliases like normal shells do.
Add a `flex` box in the parent component `.checkbox-wrapper-33` Check this example: .checkbox-wrapper-33 { display: flex; justify-content: start; } This would be your output after adding flexbox in your code: <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-css --> .checkbox-wrapper-33 { display: flex; justify-content: start; } .checkbox-wrapper-33 { --s-xsmall: 0.625em; --s-small: 1.2em; --border-width: 1px; --c-primary: #3a3a3c; --c-primary-20-percent-opacity: rgb(55 55 55 / 20%); --c-primary-10-percent-opacity: rgb(55 55 55 / 10%); --t-base: 0.4s; --t-fast: 0.2s; --e-in: ease-in; --e-out: cubic-bezier(.11, .29, .18, .98); } .checkbox-wrapper-33 .visuallyhidden { border: 0; clip: rect(0 0 0 0); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px; } .checkbox-wrapper-33 .checkbox { display: flex; align-items: center; justify-content: flex-start; } .checkbox-wrapper-33 .checkbox+.checkbox { margin-left: var(--s-small); } .checkbox-wrapper-33 .checkbox__symbol { display: inline-block; display: flex; margin-right: calc(var(--s-small) * 0.7); border: var(--border-width) solid var(--c-primary); position: relative; border-radius: 0.1em; width: 1.5em; height: 1.5em; transition: box-shadow var(--t-base) var(--e-out), background-color var(--t-base); box-shadow: 0 0 0 0 var(--c-primary-10-percent-opacity); } .checkbox-wrapper-33 .checkbox__symbol:after { content: ""; position: absolute; top: 0.5em; left: 0.5em; width: 0.25em; height: 0.25em; background-color: var(--c-primary-20-percent-opacity); opacity: 0; border-radius: 3em; transform: scale(1); transform-origin: 50% 50%; } .checkbox-wrapper-33 .checkbox .icon-checkbox { width: 1em; height: 1em; margin: auto; fill: none; stroke-width: 3; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-miterlimit: 10; color: var(--c-primary); display: inline-block; } .checkbox-wrapper-33 .checkbox .icon-checkbox path { transition: stroke-dashoffset var(--t-fast) var(--e-in); stroke-dasharray: 30px, 31px; stroke-dashoffset: 31px; } .checkbox-wrapper-33 .checkbox__textwrapper { margin: 0; } .checkbox-wrapper-33 .checkbox__trigger:checked+.checkbox__symbol:after { -webkit-animation: ripple-33 1.5s var(--e-out); animation: ripple-33 1.5s var(--e-out); } .checkbox-wrapper-33 .checkbox__trigger:checked+.checkbox__symbol .icon-checkbox path { transition: stroke-dashoffset var(--t-base) var(--e-out); stroke-dashoffset: 0px; } .checkbox-wrapper-33 .checkbox__trigger:focus+.checkbox__symbol { box-shadow: 0 0 0 0.25em var(--c-primary-20-percent-opacity); } @-webkit-keyframes ripple-33 { from { transform: scale(0); opacity: 1; } to { opacity: 0; transform: scale(20); } } @keyframes ripple-33 { from { transform: scale(0); opacity: 1; } to { opacity: 0; transform: scale(20); } } <!-- language: lang-html --> <div class="checkbox-wrapper-33"> <label class="checkbox"> <input class="checkbox__trigger visuallyhidden" name="WAV" type="checkbox" checked /> <span class="checkbox__symbol"> <svg aria-hidden="true" class="icon-checkbox" width="28px" height="28px" viewBox="0 0 28 28" version="1" xmlns="http://www.w3.org/2000/svg"> <path d="M4 14l8 7L24 7"></path> </svg> </span> <p class="checkbox__textwrapper">WAV</p> </label> <label class="checkbox"> <input class="checkbox__trigger visuallyhidden" name="MP3" type="checkbox" /> <span class="checkbox__symbol"> <svg aria-hidden="true" class="icon-checkbox" width="28px" height="28px" viewBox="0 0 28 28" version="1" xmlns="http://www.w3.org/2000/svg"> <path d="M4 14l8 7L24 7"></path> </svg> </span> <p class="checkbox__textwrapper">MP3</p> </label> </div> <!-- end snippet -->
if you want to deal with **base_2** only then i recommend using left shift operator ***<<*** instead of **math library**. sample code : int exp = 16; for(int base_2 = 1; base_2 < (1 << exp); (base_2 <<= 1)){ std::cout << base_2 << std::endl; } sample output : 1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768
navbar, hide and show content on click <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-css --> .section { display: none; } .section:target { display: block; } <!-- language: lang-html --> <nav> <a href="#about">About</a> <a href="#contact">Contact</a> </nav> <div id="about" class="section"> This is the about section. </div> <div id="contact" class="section"> This is the contact section. </div> <!-- end snippet -->
How can I type within a search box and have the letters I type turn bold from suggested words? For example, I type "he" in search bar and it looks like this as I type: **he**lp. Also, if I type in "lp" the text should appear: he**lp**. I have some code written already and I just want to add this functionality to it, but not sure how to do this. Thank you. <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-js --> // List toggle (search bar) const searchBar = document.querySelector('#search-bar'); const searchList = document.querySelector('#search-list'); searchBar.addEventListener('click', () => { searchList.style.display = "block"; }); const updateListState = e => { const targetId = e.target.id; if (targetId !== 'search-bar' && targetId !== 'search-list' && targetId !== 'search-bar-filler' && targetId !== 'search-bar-container' && targetId !== 'search-item-names' && targetId !== 'search-submit' && targetId !== 'search-submit-container') { searchList.style.display = "none"; } } document.addEventListener('mousemove', updateListState); // Letter search (search bar) function search_items() { let input = document.getElementById('search-bar').value input = input.toLowerCase(); let x = document.getElementsByClassName('search-item-names'); for (i = 0; i < x.length; i++) { if (!x[i].innerHTML.toLowerCase().includes(input)) { x[i].style.display = "none"; } else { x[i].style.display = "list-item"; } } } <!-- language: lang-css --> #filler { position: absolute; background-color: red; width: 20px; height: 20px; } #search-list { margin-top: 20px; width: 150px; height: 150px; display: none; } <!-- language: lang-html --> <div id="search-bar-container"> <input id="search-bar" type="text" name="search" onkeyup="search_items()" placeholder="Search items.."> <div id="search-bar-filler"></div> <div id='search-list'> <div id="search-item-names" class="search-item-names">Automotive Degreaser</div> <div id="search-item-names" class="search-item-names">Beats by Dre</div> <div id="search-item-names" class="search-item-names">JBL Partybox</div> <div id="search-item-names" class="search-item-names">Makeup</div> <div id="search-item-names" class="search-item-names">Mr Potato Head</div> <div id="search-item-names" class="search-item-names">Olympus Camera</div> <div id="search-item-names" class="search-item-names">Pillow</div> <div id="search-item-names" class="search-item-names">RC Race Car</div> <div id="search-item-names" class="search-item-names">Simon Rabbit</div> <div id="search-item-names" class="search-item-names">Truth Hoodie</div> </div> </div> <!-- end snippet -->
According to the ngx-countdown documentation, the leftTime parameter must be a number. So if you convert childTimer to number, by instantiating the config variable, it should work correctly.
There has to be a way to remove it? It happens in the code example I provided also. Does anyone on here know what I am referring to? When I tap one of the buttons via mobile, there is a white flash, how do I disable or remove that? That is all I am trying to do in the code. https://jsfiddle.net/xmdq14a2/1/ I am not able to take a screenshot of it because it happens too quickly. To reproduce, tap one of the buttons via a mobile device. Only occurs via mobile not desktop. <button class="linkButtonB btn-primaryC btnC">linkButton</button> <button class="linkButtonB btn-primaryC btnC">linkButton</button> <button class="linkButtonB btn-primaryC btnC">linkButton</button> <button class="linkButtonB btn-primaryC btnC">linkButton</button> I am not sure what is causing it to occur. <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-js --> (function manageLinks() { const linksButton = [{ buttonClass: "linkButton btn-primary btn", title: "Links" } ]; const buttonContainer = document.querySelector(".buttonContainerB"); linksButton.forEach(function (links) { const button = document.createElement("button"); button.className = links.buttonClass; button.textContent = links.title; button.classList.add("linkButton", "btnC", "btn-primaryC"); button.setAttribute("data-destination", "#lb"); // Added this line buttonContainer.appendChild(button); }); })(); (function manageLinkButtonOpen() { function openModal(target) { const modal = document.querySelector(target); modal.classList.add("active"); } function addLinkToButton() { const modalButton = document.querySelector(".linkButton"); modalButton.addEventListener("click", function (event) { //const target = event.currentTarget.dataset.destination; //openModal(target); openModal(event.currentTarget.dataset.destination); }); } addLinkToButton(); }()); (function manageLinkButtonClose() { function closeModal(modal) { modal.classList.remove("active"); } function addCloseEventToModal() { const closeModals = document.querySelectorAll(".modalB"); closeModals.forEach(function (modal) { modal.addEventListener("click", function (event) { //closeModal(event.target.closest(".modalB")); closeModal(document.querySelector(".modalB")); }); }); } addCloseEventToModal(); }()); <!-- language: lang-css --> body { margin: 0; padding: 0; } body { background: #121212; padding: 0 8px 0; } /*body:has(.outer-container:not(.hide)) { padding-top: 0; }*/ body:has(.modal.active) { overflow: hidden; } body:has(.modalB.active) { overflow: hidden; } .outer-container { display: flex; min-height: 100vh; /*justify-content: center; flex-direction: column;*/ } .buttonContainerB { display: flex; flex-wrap: wrap; justify-content: center; align-content: center; max-width: 569px; gap: 10px; } /*.buttonContainerC { display: flex; flex-wrap: wrap; justify-content: center; align-content: center; max-width: 569px; gap: 10px; } */ .buttonContainerC { display: flex; flex-wrap: wrap; justify-content: center; align-content: space-around; max-width: 569px; gap: 10px; } .buttonContainerC:after{ content:""; flex-basis:183px; } .btn-primaryC { color: #2fdcfe; background-color: #000000; border-color: #2fdcfe; } .btnC { display: inline-block; line-height: 1.5; text-align: center; text-decoration: none; vertical-align: middle; cursor: pointer; -webkit-user-select: none; -moz-user-select: none; user-select: none; background-color: #000000; border: 1px solid red; box-sizing: border-box; padding: 6px 12px; font-size: 16px; border-radius: 4px; font-family: "Poppins", sans-serif; font-weight: 500; font-style: normal; } .btn-primaryD { color: #2fdcfe; background-color: #000000; border-color: #2fdcfe; } .btnD { display: inline-block; line-height: 1.5; text-align: center; text-decoration: none; vertical-align: middle; cursor: pointer; -webkit-user-select: none; -moz-user-select: none; user-select: none; background-color: #000000; border: 1px solid #2fdcfe; box-sizing: border-box; padding: 6px 12px; font-size: 16px; border-radius: 4px; font-family: "Poppins", sans-serif; font-weight: 500; font-style: normal; } .linkButtonB { flex-basis: 183px; /* width of each button */ margin: 0; /* spacing between buttons */ cursor: pointer; } .linkButton { flex-basis: 183px; /* width of each button */ margin: 0; /* spacing between buttons */ cursor: pointer; } .containerD.hide { display: none; } .modalB { position: fixed; left: 0; top: 0; right: 0; bottom: 0; display: flex; /*background: rgba(0, 0, 0, 0.4);*/ transition: transform 0.3s ease-out, -webkit-transform 0.3s ease-out; transform: translate(0, -25%); opacity: 0; pointer-events: none; z-index: -99; overflow: auto; border-radius: 50%; } .modalB.active { /* display: flex;*/ opacity: 1; transform: scale(1); z-index: 1000; pointer-events: initial; border-radius: 0; overflow: auto; padding: 8px 8px; } .inner-modalB { position: relative; margin: auto; } .containerC { /*display: flex; flex-wrap: wrap; flex-direction: column;*/ /* added*/ /* min-height: 100%;*/ margin: auto; /* justify-content: center; align-content: center;*/ } .containerC.hide { display: none; } .modal-footer { display: flex; align-items: center; box-sizing: border-box; padding: calc(16px - (8px * 0.5)); background-color: transparent; border-top: 1px solid transparent; border-bottom-right-radius: calc(8px - 1px); border-bottom-left-radius: calc(8px - 1px); } .exitC { transform: translatey(100%); margin: -65px auto 0; inset: 0 0 0 0; width: 47px; height: 47px; background: black; border-radius: 50%; border: 5px solid red; display: flex; align-items: center; justify-content: center; cursor: pointer; } .exitC::before, .exitC::after { content: ""; position: absolute; width: 100%; height: 5px; background: red; transform: rotate(45deg); } .exitC::after { transform: rotate(-45deg); } .closeB { transform: translatey(100%); margin: -65px auto 0; inset: 0 0 0 0; /*margin: auto auto 0;*/ /*margin: 10px auto 0;*/ width: 47px; height: 47px; background: black; border-radius: 50%; border: 5px solid red; display: flex; align-items: center; justify-content: center; /*margin: auto;*/ cursor: pointer; } .closeB::before, .closeB::after { content: ""; position: absolute; width: 100%; height: 5px; background: red; transform: rotate(45deg); } .closeB::after { transform: rotate(-45deg); } <!-- language: lang-html --> <div class="outer-container "> <div class="containerC "> <div class="modal-contentA"> <div class="buttonContainerB"> <button class="linkButtonB btn-primaryC btnC">linkButton</button> <button class="linkButtonB btn-primaryC btnC">linkButton</button> <button class="linkButtonB btn-primaryC btnC">linkButton</button> <button class="linkButtonB btn-primaryC btnC">linkButton</button> <button class="linkButtonB btn-primaryC btnC">linkButton</button> <button class="linkButtonB btn-primaryC btnC">linkButton</button> <button class="linkButtonB btn-primaryC btnC">linkButton</button> <button class="linkButtonB btn-primaryC btnC">linkButton</button> <button class="linkButtonB btn-primaryC btnC">linkButton</button> <button class="linkButtonB btn-primaryC btnC">linkButton</button> <button class="linkButtonB btn-primaryC btnC">linkButton</button> <button class="linkButtonB btn-primaryC btnC">linkButton</button> <button class="linkButtonB btn-primaryC btnC">linkButton</button> <button class="linkButtonB btn-primaryC btnC">linkButton</button> <button class="linkButtonB btn-primaryC btnC">linkButton</button> <button class="linkButtonB btn-primaryC btnC">linkButton</button> <button class="linkButtonB btn-primaryC btnC">linkButton</button> <button class="linkButtonB btn-primaryC btnC">linkButton</button> <button class="linkButtonB btn-primaryC btnC">linkButton</button> <button class="linkButtonB btn-primaryC btnC">linkButton</button> <button class="linkButtonB btn-primaryC btnC">linkButton</button> <button class="linkButtonB btn-primaryC btnC">linkButton</button> <button class="linkButtonB btn-primaryC btnC">linkButton</button> </div> <div class="modal-footer"> <button class="exitC exit" type="button" title="Exit" aria-label="Close"></button> </div> </div> <div id="lb" class="modalB"> <div class="inner-modalB"> <div class="buttonContainerC"> <a href="#" class="linkButton btn-primaryD btnD" target="_blank">some text </a> <a href="#" class="linkButton btn-primaryD btnD" target="_blank">some text </a> <a href="#" class="linkButton btn-primaryD btnD" target="_blank">some text </a> <a href="#" class="linkButton btn-primaryD btnD" target="_blank">some text </a> <a href="#" class="linkButton btn-primaryD btnD" target="_blank">some text </a> <a href="#" class="linkButton btn-primaryD btnD" target="_blank">some text </a> <a href="#" class="linkButton btn-primaryD btnD" target="_blank">some text </a> <a href="#" class="linkButton btn-primaryD btnD" target="_blank">some text </a> <a href="#" class="linkButton btn-primaryD btnD" target="_blank">some text </a> <a href="#" class="linkButton btn-primaryD btnD" target="_blank">some text </a> <a href="#" class="linkButton btn-primaryD btnD" target="_blank">some text </a> <a href="#" class="linkButton btn-primaryD btnD" target="_blank">some text </a> <a href="#" class="linkButton btn-primaryD btnD" target="_blank">some text </a> <a href="#" class="linkButton btn-primaryD btnD" target="_blank">some text </a> <a href="#" class="linkButton btn-primaryD btnD" target="_blank">some text </a> <a href="#" class="linkButton btn-primaryD btnD" target="_blank">some text </a> <a href="#" class="linkButton btn-primaryD btnD" target="_blank">some text </a> <a href="#" class="linkButton btn-primaryD btnD" target="_blank">some text </a> <a href="#" class="linkButton btn-primaryD btnD" target="_blank">some text </a> <a href="#" class="linkButton btn-primaryD btnD" target="_blank">some text </a> <a href="#" class="linkButton btn-primaryD btnD" target="_blank">some text </a> <a href="#" class="linkButton btn-primaryD btnD" target="_blank">some text </a> <a href="#" class="linkButton btn-primaryD btnD" target="_blank">some text </a> </div> <div class="linkButton"></div> <div class="modal-footer"> <button class="closeB exit">&times</button> </div> </div> </div> </div> </div> <!-- end snippet -->
I have an issue with PF on M3. The VPN connects, but there is no internet access. The VPN configuration and VPN list are identical to another computer (M1). There are no errors upon startup.Does anyone have a solution or is there a problem with my code?! ``` scrub-anchor "com.apple/*" nat-anchor "com.apple/*" rdr-anchor "com.apple/*" dummynet-anchor "com.apple/*" anchor "com.apple/*" load anchor "com.apple" from "/etc/pf.anchors/com.apple" # set ruleset-optimization basic set skip on lo0 pass in quick on lo0 all pass out quick on lo0 all wifi=en0 ether=en1 # Interfaces vpn_intf = "{utun0 utun1 utun2 utun3}" # Table with allowed IPs table <allowed_vpn_ips> persist file "/etc/pf.anchors/vpn.list" # Block all outgoing packets block out all # Antispoof protection antispoof for {utun0 utun1 utun2 utun3} block log proto udp to any port 5353 # Allow DHCP. pass quick on { $wifi $ether } proto udp from any port 67:68 # Allow outgoing packets to specified IPs only pass out proto icmp from any to <allowed_vpn_ips> pass out proto {tcp udp} from any to <allowed_vpn_ips> port {1194 1195 5353 8000 24010 25101 32 500 54563 50000 53 80 443 1194 2049 2050 30587 41893 48574 58237} # Allow traffic for VPN interfaces pass out on {utun0 utun1 utun2 utun3} all ``` I tried enabling logging but not figure
|html|css|
``` from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.by import By import time # ------------------- LinkedIn gobs link driver = webdriver.Edge() driver.get("LinkedIn_Gob_Link") # ------------------- Login to LinkedIn driver.find_element(By.LINK_TEXT, 'Sign in').click() driver.find_element(By.ID, 'username').send_keys('My_Username') driver.find_element(By.ID, 'password').send_keys('My_Password') driver.find_element(By.CLASS_NAME, 'from__button--floating').click() # ------------------- Get a_tag in job list and click it jobs_titles_links = driver.find_elements(By.CSS_SELECTOR, '.scaffold-layout__list-container .job-card-list__title--link') for a_tag in jobs_titles_links: a_tag.click() print(a_tag.get_attribute('href')) time.sleep(3000) driver.quit() ``` I want to print a_tag but instead of printing the whole list it has like (23) jobs title links it prints only 7 is it the scrolling thing or else? how can I solve this?
LinkedIn scraping using selenium (problem)
|python|selenium-webdriver|linkedin-api|
null
For Kafka versions `0.8.x` to `later`, the `--replica-assignment` option to modify the number of replicas. For Kafka versions 2.4.0 and later, `kafka-replica-assignment` tool option to modify the number of replicas. ---------- I will recommende to use below Post by confluence https://docs.confluent.io/platform/current/kafka/post-deployment.html#changing-the-replication-factor
The easiest way in any command line: "" > path/to/file/filename.extension
Here is my code. The goal is to insert a record into a table and to use two concatenated numeric values (separated with an underscore) as the primary key. Ultimately, this will be made up of an item_number and the datetime_checked (separated with an underscore), but I have simplified it for this sample code below. ``` from peewee import * db = SqliteDatabase('itemstocheck.sqlite') class PriceCheck(Model): pricecheck_id = PrimaryKeyField() item_number = TextField() price = DecimalField() bids_qty = IntegerField() datetime_checked = TextField() class Meta: database = db db_table = "pricechecks" def main(): print("***** Let's create a price check entry in the DB *****") PriceCheck.create( pricecheck_id = "47_3_1", # the underscores are getting stripped out and the "string" is treated as an integer by peewee, if you preface the leading numeric with a non-numeric, peewee treats it as string item_number = "123456789", price="70.91", bids_qty="4", datetime_checked="987654321" ) if __name__ == "__main__": main() ``` ********************************** Issue: You'll see the `pricecheck = "47_3_1"` on line 20. Peewee is stripping that underscore out and sending the integer `4731` to the database field. If you make that into `pricecheck = "47_3__1"` or "47__3_1", peewee does not strip out the underscores. You can intersperse as many single underscores as you want and it will strip them out. If there are multiple underscores in a row, the whole thing is a treated as a string. And if there are leading or trailing underscores, it is treated as a string. **EDIT: It's definitely treating it as an integer (or, probably, decimal. I tried adding a period later beyond the underscore (i.e. `772_1.2`) and the underscore was stripped out but the decimal point remained. I also tested if a leading zero is left in place or removed. When a single underscore is present (i.e. `077_1` or `077_1.2` for that matter), the leading zero is dropped and the underscore is removed. Which tells me it is treating it as a decimal or integer. But with a double underscore present (`077__1`), the leading zero is not removed.** This behavior happens if you treat the field as `PrimaryKeyField` in the Model. If you treat it as just `TextField`, it does not happen (in other words, the underscore stays even if it is a single underscore between several numbers). One workaround is to not worry about it since SQLite will just store the value however you have it defined in the schema. Another workaround would be to prefix the numberic with an alpha value (i.e. "a_47_3_1"). Another would be to double the underscore, by design. But all of these workarounds feel like bandaids. But the bigger issue for me is that this behavior means I'm not getting to store the value I need in the primary key. AND I'm limited to storing nothing larger than `9223372036854775807` (signed 64-bit integer). **Is this behavior correct and I'm just not aware of it?** **Is the underscore, in a primary key field, some sort of break character?** Why would this happen on the PrimaryKeyField but not on a TextField? I assume that PrimaryKeyField (in the peewee ORM) doesn't care what the contents are so long as the value going in is unique (and really the ORM wouldn't care, only the DB would care).
null
I'm developing a game where my main activity (GameActivity) is hide-and-seek. Then there's a second activity (InventoryActivity) where players can use items that affect their characteristics (number of hit points, for example). I'm able to retrieve the current player's hit points in the second activity, and modify them if he uses an item from his inventory. The problem comes when I finish the 2nd activity: the hit points are not sent to the main activity. I think it's a problem of intent not being properly returned to the main activity. To retrieve the information for my second activity, I did the following in my main activity: ```@Override protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == 1001 && resultCode == RESULT_OK && data != null) { ArrayList<Item> itemsFound = data.getParcelableArrayListExtra("ITEMS_FOUND"); ArrayList<Item> playerInventory = data.getParcelableArrayListExtra("PLAYER_INVENTORY"); int updatedHearts = data.getIntExtra("CURRENT_PLAYER_HEARTS", 0); currentPlayerIndex = data.getIntExtra("CURRENT_PLAYER_INDEX", 0); Player modifiedPlayer = data.getParcelableExtra("CURRENT_PLAYER"); if (modifiedPlayer != null) { for (int i = 0; i < allPlayers.size(); i++) { Player currentPlayer = allPlayers.get(i); if (currentPlayer.getName().equals(modifiedPlayer.getName())) { allPlayers.set(i, modifiedPlayer); updateHeartsDisplay(modifiedPlayer.getHearts()); Log.d("GameActivity", "Joueur mis à jour : " + modifiedPlayer.getName() + ", Points de vie : " + modifiedPlayer.getHearts()); break; } } } } } ``` To launch the inventory activity using intents, I used the following: ```private void launchInventoryActivity(Player currentPlayer) { // Prepare data for inventory activity ArrayList<Item> itemsFound = new ArrayList<>(); Item lastItemAdded = currentPlayer.getLastItemAdded(); if (lastItemAdded != null) { itemsFound.add(lastItemAdded); } ArrayList<Item> playerInventory = new ArrayList<>(); playerInventory.addAll(currentPlayer.getItems()); Intent inventoryIntent = new Intent(GameActivity.this, InventoryActivity.class); inventoryIntent.putParcelableArrayListExtra("ITEMS_FOUND", itemsFound); inventoryIntent.putParcelableArrayListExtra("PLAYER_INVENTORY", playerInventory); inventoryIntent.putExtra("CURRENT_PLAYER", currentPlayer); inventoryLauncher.launch(inventoryIntent); }``` Finally, in my secondary activity, I return the player's information ( with his modified hit points ) to my main activity with this; ```private void finishTurn() { int currentPlayerIndex = getIntent().getIntExtra("CURRENT_PLAYER_INDEX", 0); Intent intent = new Intent(); intent.putExtra("CURRENT_PLAYER_HEARTS", currentPlayer.getHearts()); intent.putExtra("CURRENT_PLAYER_INDEX", currentPlayerIndex + 1); intent.putExtra("CURRENT_PLAYER", currentPlayer); setResult(RESULT_OK, intent); finish(); } ``` Thank you for your help. I saw the new method because of the deprecated api and i did this : ```inventoryActivityResultLauncher = registerForActivityResult( new ActivityResultContracts.StartActivityForResult(), new ActivityResultCallback<ActivityResult>() { @Override public void onActivityResult(ActivityResult result) { if (result.getResultCode() == RESULT_OK) { // Vérifiez si les données de point de vie sont renvoyées Intent data = result.getData(); if (data != null) { int currentPlayerHealth = data.getIntExtra("CURRENT_PLAYER_HEARTS", -1); if (currentPlayerHealth != -1) { Player currentPlayer = data.getParcelableExtra("CURRENT_PLAYER"); if (currentPlayer != null) { currentPlayer.setHearts(currentPlayerHealth); updateTurnInfo(); }``` this is my private void launchInventoryActivity method now : ```private void launchInventoryActivity(Player currentPlayer) { ArrayList<Item> itemsFound = new ArrayList<>(); Item lastItemAdded = currentPlayer.getLastItemAdded(); if (lastItemAdded != null) { itemsFound.add(lastItemAdded); } ArrayList<Item> playerInventory = new ArrayList<>(); playerInventory.addAll(currentPlayer.getItems()); Intent intent = new Intent(GameActivity.this, InventoryActivity.class); intent.putParcelableArrayListExtra("ITEMS_FOUND", itemsFound); intent.putParcelableArrayListExtra("PLAYER_INVENTORY", playerInventory); intent.putExtra("CURRENT_PLAYER", currentPlayer); inventoryActivityResultLauncher.launch(intent); }``` So in my main activity, when i need to call this activity i use launchInventoryActivity(currentPlayer); Finally, in my 2nd activity, when it's time to send back info to my first activity, i use this with, i guess, the correct intents we need to get : ```private void finishTurn() { int currentPlayerIndex = getIntent().getIntExtra("CURRENT_PLAYER_INDEX", 0); Intent intent = new Intent(); intent.putExtra("CURRENT_PLAYER_HEARTS", currentPlayer.getHearts()); intent.putExtra("CURRENT_PLAYER_INDEX", currentPlayerIndex + 1); intent.putExtra("CURRENT_PLAYER", currentPlayer); // Ajoutez le joueur actuel ici setResult(RESULT_OK, intent); finish(); }```
I need to support about add socket in backend to chat realtime First of all, i do the feature in api for mobile app: a automatic reply the message after user send the message to a another person. Queue still working, but it's not a realtime, now i want to add the socket in backend so that the user can receive the automatic message in realtime. ``` use ElephantIO\Client; use ElephantIO\Engine\SocketIO\Version2X; class UserChatbotAuto implements ShouldQueue { use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; /** * Create a new job instance. * * @return void */ protected $request; protected $user; protected $curentUser; protected $token; public function __construct(array $request, $token, $curentUser, $user) { // $this->request = $request; $this->user = $user; $this->curentUser = $curentUser; $this->token = $token; } /** * Execute the job. * * @return void */ public function handle() { // $user = $this->user; $curentUser = $this->curentUser; $request = $this->request; $token = $this->token; try { Log::info('start queue' ); $thread = $user->getThreadWithUser($curentUser); $option = [ // 'handshake' => [ 'auth' => [ 'token' => 'Bearer ' . $token, 'threadWith' => $thread->id ] // ] ]; $yourApiKey = config('services.openai.secret'); $client = OpenAI::client($yourApiKey); $result = $client->chat()->create([ 'model' => 'gpt-4', 'messages' => [ [ "role" => "system", "content" => "You are a mental health adviser, skilled in giving mental health related advice. Please answer in the language after the word question. No yapping" ], ['role' => 'user', 'content' => "give mental health advice for given question. my name is: " . $curentUser->name . ", only give the advice text don't write anything else. question: " . $request['message']], ], ]); $content_response = $result->choices[0]->message->content; Log::info('content_response: ' . $content_response); $message = Message::create([ 'thread_id' => $thread->id, 'user_id' => $user->id, 'body' => $content_response, ]); $client = new Client(new Version2X('http://19.......11:8001', $option)); $client->initialize(); $client->emit('sendMessageToUser', ['userId' => $user->id, 'message' => $content_response]); $client->close(); } catch (\Exception $e) { Log::error($e); } Log::info('done queue' ); } } ``` This is the socket configuration file named server.js, in the mobile still working if a real user chat to a real user and the result is both user chat a realtime ``` require("dotenv").config(); const express = require("express"); const fetch = require("node-fetch"); const app = express(); const server = require("http").createServer(app); const mysql = require("mysql2"); const baseUrl = "http://1........1:8001"; const io = require("socket.io")(server, { cors: { origin: "*", }, }); // Create a connection pool const pool = mysql.createPool({ host: process.env.DB_HOST, user: process.env.DB_USERNAME, password: process.env.DB_PASSWORD, database: process.env.DB_DATABASE, waitForConnections: true, connectionLimit: 10, queueLimit: 0, }); const userConnectionDb = []; const findConnectionIndexById = (socketId) => { const index = userConnectionDb.findIndex( (user) => user.socketId === socketId ); if (index === -1) { return null; } return index; }; const findByUserId = (userId) => { const index = userConnectionDb.findIndex((user) => user.userId === userId); if (index === -1) { return null; } return index; }; const getSocketIdByUserId = (userId) => { const index = userConnectionDb.findIndex((user) => user.userId === userId); if (index !== -1) { return userConnectionDb[index].socketId; } else { return null; } }; const validateUser = async (authToken) => { try { let user = null; //console.lo; const endPoint = baseUrl + "/api/profile/socket-profile"; const options = { method: "GET", headers: { "Content-Type": "application/json", Accept: "application/json", Authorization: authToken, }, }; const response = await fetch(endPoint, options); if (!response.ok) { console.log({ status: response.status }); throw new Error("Network response was not OK"); } const responseData = await response.json(); const userData = { userId: responseData.id, }; user = userData; return { user, error: null }; } catch (error) { console.log(error); return { user: null, error: error }; } }; const sendMessageToServer = async (senderToken, receiver, message) => { try { let user = null; const endPoint = baseUrl + "/api/message/send-socket-message"; const options = { method: "POST", headers: { "Content-Type": "application/json", Accept: "application/json", Authorization: senderToken, }, body: JSON.stringify({ user_id: receiver, message }), }; const response = await fetch(endPoint, options); if (!response.ok) { console.log({ status: response.status }); throw new Error("Network response was not OK"); } const responseData = await response.json(); // console.log("message sent", responseData); return { data: responseData, error: null }; } catch (error) { return { data: null, error }; } }; // Middleware to handle authentication io.use(async (socket, next) => { try { const token = socket.handshake.auth.token; const threadWith = socket.handshake.auth.threadWith; // Perform authentication logic (e.g., verify the token) const { user, error } = await validateUser(token); if (error) throw new Error(error); if (!user) { // Authentication failed, reject the connection return next(new Error({ message: "Authentication failed", code: 401 })); } const userIndex = findByUserId(user.userId); if (userIndex !== null) { userConnectionDb.splice(userIndex, 1); } userConnectionDb.push({ userId: user.userId, socketId: socket.id, threadWith: threadWith || null, token, }); return next(); } catch (error) { console.log(error); return next(new Error({ message: "Server error", code: 500 })); } }); io.on("connection", (socket) => { console.log("New client connected Total users:", userConnectionDb.length); socket.on("message", (message) => { console.log("Received message:", message); }); socket.on("disconnect", () => { const userIndex = findConnectionIndexById(socket.id); if (userIndex !== null) { userConnectionDb.splice(userIndex, 1); } console.log("Client disconnected Total users:", userConnectionDb.length); }); // Handling the client's custom event socket.on("sendMessageToUser", async (data, callback) => { const { userId, message } = data; let callbackData = { success: true, online: false, data: null, }; const socketId = getSocketIdByUserId(userId); if (socketId) { const otherUserIndex = findByUserId(userId); const currentUserIndex = findConnectionIndexById(socket.id); if (otherUserIndex === null || currentUserIndex === null) { callbackData.success = false; callback(callbackData); return; } const currentUserId = userConnectionDb[currentUserIndex].userId; const senderToken = userConnectionDb[currentUserIndex].token; const threadWithId = userConnectionDb[otherUserIndex].threadWith; // console.log({ threadWithId, currentUserId }); if (threadWithId === currentUserId) { const { data, error } = await sendMessageToServer( senderToken, userId, message ); if (error) { console.log(error); return; } io.to(socketId).emit("customMessage", { sendBy: currentUserId, data: data, }); callbackData.online = true; callbackData.success = true; callbackData.data = data; } else { // console.log("Use is not on same thread"); } } else { // console.log(" no user online with this id "); } // Send acknowledgment back to the client callback(callbackData); }); }); const port = 8001; server.listen(port, () => { console.log(`Server is running on port ${port}`); }); ``` I tried calling the api to call the function and execute the queue above but it returned an error `ElephantIO\Exception\ServerConnectionFailureException: An error occurred while trying to establish a connection to the server in C:\xampp\htdocs\Project\tongle_latest\vendor\wisembly\elephant.io\src\Engine\SocketIO\Version1X.php:187` what i can do? Anyone have any solution?
ElephantIO\Exception\ServerConnectionFailureException: An error occurred while trying to establish a connection to the server
|laravel|websocket|
Wondering if there are other codes available to use in an HTML newsletter. I would use cell padding or margins but I'm new to this HTML/CSS thing and I can't find a change that does effect both the Main Title line and the sub-head under it. Being an email I'm hesitant to go mucking around with the CSS to get it just so — since I don't know what email clients don't like in the way of CSS as opposed to inline markup. For context the template I'm using is Mute theme from Mailchimp snip: <!-- language: lang-html --> <table cellspacing="0" cellpadding="0" border="0" align="center" width="626"> <tbody> <tr> <td valign="middle" bgcolor="#546781" height="97" background="images/header-bg.jpg" style="vertical-align: middle;"> <table cellspacing="0" cellpadding="0" border="0" align="center" width="555" height="97"> <tbody> <tr> <td valign="middle" width="160" style="vertical-align:middle; text-align: left;"> <img width="70" height="70" src="http://dl.dropbox.com/…….png" style="margin:0; margin-top: 4px; display: block;" alt="" /> </td> <td valign="middle" style="vertical-align: middle; text-align: left;"> <h1 class="title" style="margin:0; padding:0; font-size:30px; font-weight: normal; color: #192c45 !important;"> <singleline label="Title"><span>Title of Report</span></singleline> </h1> <h1 class="title" style="margin:0; padding:0; font-size:15px; font-weight: normal; color: #192c45 !important;"> <singleline label="Title"><span>Small Subhead</span></singleline> </h1> </td> <td width="55" valign="middle" style="vertical-align:middle; text-align: center;"> <h2 class="date" style="margin:0; padding:0; font-size:13px; font-weight: normal; color: #192c45 !important; text-transform: uppercase; font-weight: bold; line-height:1;"> <currentmonthname />December </h2> <h2 class="date" style="margin:0; padding:0; font-size:23px; font-weight: normal; color: #192c45 !important; font-weight: bold;"> <currentyear />2011 </h2> </td> </tr> </tbody> </table> </td> </tr>
null
I want to implement *getMemberName* function via reflection ``` data class Inner(val prop: String) data class Source( val member: String, val innerMember: Inner ) fun getMemberName(source: Any, member: Any) : String { return "..." } fun main() { val demo = Source("asd", Inner("asd2")) val memberName = getMemberName(demo, demo.member) //result: 'member' val innerMemberName = getMemberName(demo, demo.innerMember.prop) //result: 'innerMember.prop' } ``` Maybe somewere in reflection libs exist any common solution?
This is because the `key` (first arguement of `useSWR`) is tied to the [cache key](https://swr.vercel.app/docs/arguments).<br> If any value in this array is updated, a new http request will be triggered. In your example, the key is `[SERVICESADDR.EVENT, dataToRequest]` and `dataToRequest` is recreated at each render (you create a new FormData object), that's why you get an infinite service call. You can pass the `token` and the `id` to key and create the `FormData` object in the `fetcher` function ``` const EventDetail = ({ params }: { params: { id: string } }) => { const id: string = params.id; const [cookies] = useCookies(["token"]); const token = cookies.token; const { data, error, isLoading } = useSWR( [SERVICESADDR.EVENT, token, id], fetcher, ); return <div>{id}</div>; }; ``` ``` export const fetcher = ([url, token, id]: [ url: string, token: string, id: string ]) => { const formData = new FormData(); formData.append("id", id); return fetch(url, { method: "POST", body: formData, headers: { Authorization: `Bearer ${token}`, "Accept-Language": "pt", Accept: "/*", }, }).then((res) => res.text()); } ```
There has to be a way to remove it? It happens in the code example I provided also. I can see it when the buttons are clicked via mobile. Does anyone on here know what I am referring to? When I tap one of the buttons via mobile, there is a white flash, how do I disable or remove that? That is all I am trying to do in the code. https://jsfiddle.net/xmdq14a2/1/ I am not able to take a screenshot of it because it happens too quickly. To reproduce, tap one of the buttons via a mobile device. Only occurs via mobile not desktop. <button class="linkButtonB btn-primaryC btnC">linkButton</button> <button class="linkButtonB btn-primaryC btnC">linkButton</button> <button class="linkButtonB btn-primaryC btnC">linkButton</button> <button class="linkButtonB btn-primaryC btnC">linkButton</button> I am not sure what is causing it to occur. <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-js --> (function manageLinks() { const linksButton = [{ buttonClass: "linkButton btn-primary btn", title: "Links" } ]; const buttonContainer = document.querySelector(".buttonContainerB"); linksButton.forEach(function (links) { const button = document.createElement("button"); button.className = links.buttonClass; button.textContent = links.title; button.classList.add("linkButton", "btnC", "btn-primaryC"); button.setAttribute("data-destination", "#lb"); // Added this line buttonContainer.appendChild(button); }); })(); (function manageLinkButtonOpen() { function openModal(target) { const modal = document.querySelector(target); modal.classList.add("active"); } function addLinkToButton() { const modalButton = document.querySelector(".linkButton"); modalButton.addEventListener("click", function (event) { //const target = event.currentTarget.dataset.destination; //openModal(target); openModal(event.currentTarget.dataset.destination); }); } addLinkToButton(); }()); (function manageLinkButtonClose() { function closeModal(modal) { modal.classList.remove("active"); } function addCloseEventToModal() { const closeModals = document.querySelectorAll(".modalB"); closeModals.forEach(function (modal) { modal.addEventListener("click", function (event) { //closeModal(event.target.closest(".modalB")); closeModal(document.querySelector(".modalB")); }); }); } addCloseEventToModal(); }()); <!-- language: lang-css --> body { margin: 0; padding: 0; } body { background: #121212; padding: 0 8px 0; } /*body:has(.outer-container:not(.hide)) { padding-top: 0; }*/ body:has(.modal.active) { overflow: hidden; } body:has(.modalB.active) { overflow: hidden; } .outer-container { display: flex; min-height: 100vh; /*justify-content: center; flex-direction: column;*/ } .buttonContainerB { display: flex; flex-wrap: wrap; justify-content: center; align-content: center; max-width: 569px; gap: 10px; } /*.buttonContainerC { display: flex; flex-wrap: wrap; justify-content: center; align-content: center; max-width: 569px; gap: 10px; } */ .buttonContainerC { display: flex; flex-wrap: wrap; justify-content: center; align-content: space-around; max-width: 569px; gap: 10px; } .buttonContainerC:after{ content:""; flex-basis:183px; } .btn-primaryC { color: #2fdcfe; background-color: #000000; border-color: #2fdcfe; } .btnC { display: inline-block; line-height: 1.5; text-align: center; text-decoration: none; vertical-align: middle; cursor: pointer; -webkit-user-select: none; -moz-user-select: none; user-select: none; background-color: #000000; border: 1px solid red; box-sizing: border-box; padding: 6px 12px; font-size: 16px; border-radius: 4px; font-family: "Poppins", sans-serif; font-weight: 500; font-style: normal; } .btn-primaryD { color: #2fdcfe; background-color: #000000; border-color: #2fdcfe; } .btnD { display: inline-block; line-height: 1.5; text-align: center; text-decoration: none; vertical-align: middle; cursor: pointer; -webkit-user-select: none; -moz-user-select: none; user-select: none; background-color: #000000; border: 1px solid #2fdcfe; box-sizing: border-box; padding: 6px 12px; font-size: 16px; border-radius: 4px; font-family: "Poppins", sans-serif; font-weight: 500; font-style: normal; } .linkButtonB { flex-basis: 183px; /* width of each button */ margin: 0; /* spacing between buttons */ cursor: pointer; } .linkButton { flex-basis: 183px; /* width of each button */ margin: 0; /* spacing between buttons */ cursor: pointer; } .containerD.hide { display: none; } .modalB { position: fixed; left: 0; top: 0; right: 0; bottom: 0; display: flex; /*background: rgba(0, 0, 0, 0.4);*/ transition: transform 0.3s ease-out, -webkit-transform 0.3s ease-out; transform: translate(0, -25%); opacity: 0; pointer-events: none; z-index: -99; overflow: auto; border-radius: 50%; } .modalB.active { /* display: flex;*/ opacity: 1; transform: scale(1); z-index: 1000; pointer-events: initial; border-radius: 0; overflow: auto; padding: 8px 8px; } .inner-modalB { position: relative; margin: auto; } .containerC { /*display: flex; flex-wrap: wrap; flex-direction: column;*/ /* added*/ /* min-height: 100%;*/ margin: auto; /* justify-content: center; align-content: center;*/ } .containerC.hide { display: none; } .modal-footer { display: flex; align-items: center; box-sizing: border-box; padding: calc(16px - (8px * 0.5)); background-color: transparent; border-top: 1px solid transparent; border-bottom-right-radius: calc(8px - 1px); border-bottom-left-radius: calc(8px - 1px); } .exitC { transform: translatey(100%); margin: -65px auto 0; inset: 0 0 0 0; width: 47px; height: 47px; background: black; border-radius: 50%; border: 5px solid red; display: flex; align-items: center; justify-content: center; cursor: pointer; } .exitC::before, .exitC::after { content: ""; position: absolute; width: 100%; height: 5px; background: red; transform: rotate(45deg); } .exitC::after { transform: rotate(-45deg); } .closeB { transform: translatey(100%); margin: -65px auto 0; inset: 0 0 0 0; /*margin: auto auto 0;*/ /*margin: 10px auto 0;*/ width: 47px; height: 47px; background: black; border-radius: 50%; border: 5px solid red; display: flex; align-items: center; justify-content: center; /*margin: auto;*/ cursor: pointer; } .closeB::before, .closeB::after { content: ""; position: absolute; width: 100%; height: 5px; background: red; transform: rotate(45deg); } .closeB::after { transform: rotate(-45deg); } <!-- language: lang-html --> <div class="outer-container "> <div class="containerC "> <div class="modal-contentA"> <div class="buttonContainerB"> <button class="linkButtonB btn-primaryC btnC">linkButton</button> <button class="linkButtonB btn-primaryC btnC">linkButton</button> <button class="linkButtonB btn-primaryC btnC">linkButton</button> <button class="linkButtonB btn-primaryC btnC">linkButton</button> <button class="linkButtonB btn-primaryC btnC">linkButton</button> <button class="linkButtonB btn-primaryC btnC">linkButton</button> <button class="linkButtonB btn-primaryC btnC">linkButton</button> <button class="linkButtonB btn-primaryC btnC">linkButton</button> <button class="linkButtonB btn-primaryC btnC">linkButton</button> <button class="linkButtonB btn-primaryC btnC">linkButton</button> <button class="linkButtonB btn-primaryC btnC">linkButton</button> <button class="linkButtonB btn-primaryC btnC">linkButton</button> <button class="linkButtonB btn-primaryC btnC">linkButton</button> <button class="linkButtonB btn-primaryC btnC">linkButton</button> <button class="linkButtonB btn-primaryC btnC">linkButton</button> <button class="linkButtonB btn-primaryC btnC">linkButton</button> <button class="linkButtonB btn-primaryC btnC">linkButton</button> <button class="linkButtonB btn-primaryC btnC">linkButton</button> <button class="linkButtonB btn-primaryC btnC">linkButton</button> <button class="linkButtonB btn-primaryC btnC">linkButton</button> <button class="linkButtonB btn-primaryC btnC">linkButton</button> <button class="linkButtonB btn-primaryC btnC">linkButton</button> <button class="linkButtonB btn-primaryC btnC">linkButton</button> </div> <div class="modal-footer"> <button class="exitC exit" type="button" title="Exit" aria-label="Close"></button> </div> </div> <div id="lb" class="modalB"> <div class="inner-modalB"> <div class="buttonContainerC"> <a href="#" class="linkButton btn-primaryD btnD" target="_blank">some text </a> <a href="#" class="linkButton btn-primaryD btnD" target="_blank">some text </a> <a href="#" class="linkButton btn-primaryD btnD" target="_blank">some text </a> <a href="#" class="linkButton btn-primaryD btnD" target="_blank">some text </a> <a href="#" class="linkButton btn-primaryD btnD" target="_blank">some text </a> <a href="#" class="linkButton btn-primaryD btnD" target="_blank">some text </a> <a href="#" class="linkButton btn-primaryD btnD" target="_blank">some text </a> <a href="#" class="linkButton btn-primaryD btnD" target="_blank">some text </a> <a href="#" class="linkButton btn-primaryD btnD" target="_blank">some text </a> <a href="#" class="linkButton btn-primaryD btnD" target="_blank">some text </a> <a href="#" class="linkButton btn-primaryD btnD" target="_blank">some text </a> <a href="#" class="linkButton btn-primaryD btnD" target="_blank">some text </a> <a href="#" class="linkButton btn-primaryD btnD" target="_blank">some text </a> <a href="#" class="linkButton btn-primaryD btnD" target="_blank">some text </a> <a href="#" class="linkButton btn-primaryD btnD" target="_blank">some text </a> <a href="#" class="linkButton btn-primaryD btnD" target="_blank">some text </a> <a href="#" class="linkButton btn-primaryD btnD" target="_blank">some text </a> <a href="#" class="linkButton btn-primaryD btnD" target="_blank">some text </a> <a href="#" class="linkButton btn-primaryD btnD" target="_blank">some text </a> <a href="#" class="linkButton btn-primaryD btnD" target="_blank">some text </a> <a href="#" class="linkButton btn-primaryD btnD" target="_blank">some text </a> <a href="#" class="linkButton btn-primaryD btnD" target="_blank">some text </a> <a href="#" class="linkButton btn-primaryD btnD" target="_blank">some text </a> </div> <div class="linkButton"></div> <div class="modal-footer"> <button class="closeB exit">&times</button> </div> </div> </div> </div> </div> <!-- end snippet -->
There are several pieces to this: either specify `runApp(.., host=, port=)` or shift to using the built-in shiny-server in the parent image. # Fix `runApp` First is that you expose port 8180 but the default of `runApp` may be to randomly assign a port. From [`?runApp`](https://shiny.posit.co/r/reference/shiny/latest/runapp): ``` port: The TCP port that the application should listen on. If the ‘port’ is not specified, and the ‘shiny.port’ option is set (with ‘options(shiny.port = XX)’), then that port will be used. Otherwise, use a random port between 3000:8000, excluding ports that are blocked by Google Chrome for being considered unsafe: 3659, 4045, 5060, 5061, 6000, 6566, 6665:6669 and 6697. Up to twenty random ports will be tried. ``` My guess is that it does not randomly choose 8180, at least not reliably enough for you to count on that. The second problem is that network port-forwarding using docker's `-p` forwards to the container host, but not to the container's `localhost` (`127.0.0.1`). So we also should assign a host to your call to `runApp`. The magic `'0.0.0.0'` in TCP/IP networking means "all applicable network interfaces", which will include those that you don't know about before hand (i.e., the default routing network interface within the docker container). Thus, ``` CMD ["R", "-e", "shiny::runApp('/home/shiny-app',host='0.0.0.0',port=8180)"] ``` When I do that, I'm able to run the container and connect to `http://localhost:8180` and that shiny app works. (Granted, I modified the shiny code _a little_ since I don't have your data, but that's tangential.) FYI, if you base your image on `FROM rocker/shiny-verse` instead of `FROM rocker/shiny`, you don't need to `install.packages('tidyverse')`, which can be a large savings. Also, with both `rocker/shiny` and `rocker/shiny-verse`, you don't need to `install.packages('shiny')` since it is already included. Two packages saved. # Use the built-in shiny-server The recommended way to use `rocker/shiny-verse` is to put your app in `/srv/shiny-server/appnamegoeshere`, and use the already-functional shiny-server baked in to the docker image. Two benefits, one consequence: - Benefit #1: you can deploy and serve multiple apps in one docker image; - Benefit #2: if/when the shiny fails or exits, the built-in shiny-server will automatically restart it; when `runApp(.)` fails, it stops. (Granted, this is governed by restart logic of shiny in the presence of clear errors in the code.) - Consequence: your local browser must include the app name in the URL, as in `http://localhost:8180/appnamegoeshere`. The `http://localhost:8180` page is a mostly-static landing page to say that shiny-server is working, and it does not by default list all of the apps that are being served by the server. This means that your `Dockerfile` could instead be this: ```docker # Base image FROM rocker/shiny-verse # Install dependencies (tidyverse and shiny are already included) RUN R -e "install.packages(c('shinydashboard', 'DT'))" # Make a directory in the container RUN mkdir /srv/shiny-server/myapp COPY . /srv/shiny-server/myapp ``` That's it, nothing more required to get everything you need since `CMD` is already defined in the parent image. Because shiny-server defaults to port 3838, your run command is now ```bash docker run -p 3838:3838 deploy_test ``` and your local browser uses `http://localhost:3838/myapp` for browsing. (FYI, the order of `RUN` and other commands in a `Dockerfile` can be influential. If, for instance, you change anything _before_ the `install.packages(.)`, then when you re-build the image it will have to reinstall those packages. Since we're no longer needing to (re)install `"tidyverse"` this should be rather minor, but if you stick with `rocker/shiny` and you have to `install.packages("tidyverse")`, then this can be substantial savings. By putting the `RUN` and `COPY` commands for this app _after_ `install.packages(..)`, then if we rename the app and/or add more docker commands later, then that `install.packages` step is cached/preserved and does not need to be rerun.)
null
I'm trying to find a way to get a signal-point on the chart everytime the bar is a new 15-days low. Thanks for help! ``` //@version=5 indicator('15-Days-Low', overlay=true) bars_back = input(15) ll = ta.lowest(bars_back) //15-d-low tl = ta.lowest(source=low, length=1) //lowest bar since when? lb = ta.lowestbars(bars_back) // returns a negative offset number plotchar(tl < ll, char='•', color=color.fuchsia, size=size.tiny, location=location.belowbar) ``` I tried to find the lowest low of the last 15 days, compare it to the low of today, and plot a char if the todays low is the lowest of the last 15 days.
the lowest low of some days
Mutating a column in a dataframe (1) based off a data in dataframe (1) that exist in another dataframe (2)
It's not in the package itself, it's in the lib. Should be: `import { AWSIoTProvider } from '@aws-amplify/pubsub/lib/Providers'`
this is actually normal, as the fetchMode is ignored on requests to fetch multiple entities. I haven't been able to find a reference to this in the new documentation, but this [old documentation](https://docs.jboss.org/hibernate/stable/core.old/reference/en/html/performance.html) states that : > The fetch strategy defined in the mapping document affects: > - retrieval via get() or load() > - retrieval that happens implicitly when an association is navigated > - Criteria queries > - HQL queries if subselect fetching is used The behavior is also mentioned on this more [up-to-date documentation](https://docs.jboss.org/hibernate/orm/6.4/userguide/html_single/Hibernate_User_Guide.html#fetching-direct-vs-query) To resolve your problem, you can use [join fetch](https://docs.jboss.org/hibernate/orm/6.4/userguide/html_single/Hibernate_User_Guide.html#hql-explicit-fetch-join) or [entity graph](https://docs.jboss.org/hibernate/orm/6.4/userguide/html_single/Hibernate_User_Guide.html#fetching-strategies-dynamic-fetching-entity-graph)
I have been asked in one of the Top company below question and I was not able to answer. Just replied : I need to update myself on this topic **Question :** **If you create a composite indexing on 3 columns (eid , ename , esal ) ?** - If i mention only eid=10 after where clause will the indexing be called ? `select * from emp where eid=10`; - If I mention only eid=10 and ename='Raj' will the indexing be called ? `select * from emp where eid=10 and ename='Raj';` - If I mention in different order like esal=1000 and eid=10 will the indexing be called ? `select * from emp where esal=1000 and eid=10;` - If I mention in reverse order like esal = 1000 and ename = 'Raj' and eid = 10 will the indexing be called ? `select * from emp where esal=1000 and enam='Raj' and eid=10;` Need a solution for this need with detail table representation with data how it does?
Dynamic Filtering of Calculated Table Not Working with SELECTEDVALUE(slicer) in Power BI
I want to define several non-inherited object types. I want to know whether I can use similar tags for them in XML. Some objects do not have the common tags. For example, the tag "name" below. ``` <?xml version="1.0" encoding="UTF-8"?> <stuff> <person> <name> John </name> <age> 30 </age> </person> <car> <name> BMW </name> <price> 50000 </price> </car> <book> <name> Harry Potter </name> <author> Rowling </author> </book> <city> <country> USA </country> <population> 5000000 </population> </city> </stuff> ``` Do we encounter any problems? In case of no theoretical error, can it make a "misunderstanding" in a large XML? Can it be problematic when we try to convert this XML to formats like SQL, Excel, Access, MongoDB etc?
Using similar tags for different objects in XML
|xml|
null
I am using the MockMvcResultMathchers to test my async function but it not work properly. Here is my function : ``` @GetMapping( value = "/v1.0/sms-booking/async-handle", produces = {"text/plain"}) @Async public CompletableFuture<ResponseEntity<String>> smsAsyncHandle(@RequestParam("moLogID ") Integer moLogID ) { CompletableFuture.runAsync(...); return CompletableFuture.completedFuture( ResponseEntity.ok("New Message Received with moLogID " + moLogID + " !")); } ``` and the test function ``` @Test void smsAsyncHandle_returnMoLogID_whenValidParam() throws Exception { MvcResult mvcResult = mockMvc.perform(get(SMS_ASYNC_HANDLE_PATH) .param("moLogID","1") .andDo(print()).andExpect(request().asyncStarted()) .andReturn(); mockMvc.perform(asyncDispatch(mvcResult)) .andDo(print()) .andExpect(request().asyncResult(instanceOf(ResponseEntity.class))) .andExpect(content().string(containsString("1"))); } ``` and when I run test, this is the result. [enter image description here](https://i.stack.imgur.com/YcQph.png) I want my test function run successfully. I have tried many different ways I found on internet but nothing works. Pls help me to overcome this. Thanks
I'm using google analytics 4 in my test website made with WordPress. I have successfully configured Google Tag and connect GA4 with my website. I have a situation where i have an event tag sent to GA4 account but i cant see anything neither in real-time reports nor in my debug view. Other event such as page_view and User engagement appear like normal. These are the events: [![enter image description here][1]][1] [![enter image description here][3]][3] And they are fired successfully as you can see: [![enter image description here][4]][4] [![enter image description here][5]][5] The measurement ID is correct and the connection is valid and there is no internal filter set. Any ideas? [1]: https://i.stack.imgur.com/RgMIj.png [2]: https://i.stack.imgur.com/ebeVP.png [3]: https://i.stack.imgur.com/LzASY.png [4]: https://i.stack.imgur.com/EgMzg.png [5]: https://i.stack.imgur.com/TKuxm.png
Google Analytics 4 does not show data (realtime/debugview)
|google-analytics|google-tag-manager|google-analytics-4|
I'm using Galaxy S22u with Android 14, and if it matters, OneUI 6.0, and this series of Galaxy has *no slot for an SD card*, however, adb shows my device has /sdcard/... storage, where /sdcard is a link: sdcard -> **/storage/self/primary**. In other words, I can "adb push file.xyz /sdcard/Zyx" where Zyx is a directory on my S22u, in reality, it's a directory at /storage/self/primary/Zyx.
Print Preview Multiple Sheets - **Column** - You need to pass a 1D array without the use of the `Array` function. You can use the late-bound version of the `Transpose` worksheet function to convert the 2D array to a 1D array using the following: Dim wb As Workbook: Set wb = ThisWorkbook Dim MyArray As Variant: MyArray = Application _ .Transpose(wb.Sheets("Admin Sheet").Range("A1:A2").Value) wb.Sheets(MyArray).PrintPreview Here `MyArray` holds a 1D one-based array. **Row** - If you have the sheet names in a row (e.g. `A1:B1`), you need to wrap the right side of the `MyArray = ...` expression in yet another `Application.Transpose()`: MyArray = Application.Transpose(Application. _ .Transpose(wb.Sheets("Admin Sheet").Range("A1:B1").Value)) Here `MyArray` holds a 1D one-based array. **Arrays** - `MyArray = ThisWorkbook.Sheets("Admin Sheet").Range("A1:A2").Value` returns a 2D one-based (single-column) array held by the `MyArray` variable. You can prove it with the following: Debug.Print LBound(MyArray, 1), UBound(MyArray, 1), _ LBound(MyArray, 2), UBound(MyArray, 2) Dim r As Long For r = 1 To UBound(MyArray, 1) Debug.Print MyArray(r, 1) ' !!! Next r - `MyArray = Application.Transpose(wb.Sheets("Admin Sheet").Range("A1:A2").Value)` will return a 1D one-based array held by the `MyArray` variable. You can prove it with the following: Dim n As Long For n = 1 To UBound(MyArray) ' or UBound(MyArray, 1) Debug.Print MyArray(n) ' !!! Next n - `Dim Jag As Variant: Jag = Array(MyArray)` returns the 1D `MyArray` in the first and only element of another 1D (usually) zero-based array held by the `Jag` variable. This structure is called a jagged array or an array of arrays. You can prove it using the following: Debug.Print LBound(Jag), UBound(Jag) Dim j As Long For j = LBound(Jag) To UBound(Jag) For n = LBound(Jag(j)) To UBound(Jag(j)) ' !!! Debug.Print j, n, Jag(j)(n) ' !!! Next r Next j
Using [is_numeric][1] or [intval][2] is likely the best way to validate a number here, but to answer your question you could try using [preg_replace][3] instead. This example removes all non-numeric characters: $output = preg_replace('/[^0-9]/', '', $string); [1]: http://php.net/manual/en/function.is-numeric.php [2]: http://php.net/manual/en/function.intval.php [3]: http://php.net/manual/en/function.preg-replace.php
I have a dataframe like this: ``` solution_id 0 1 2 3 0 26688 NaN NaN NaN NaN 1 26689 NaN NaN NaN NaN 2 26690 NaN NaN NaN NaN 3 26691 NaN NaN NaN NaN 4 26692 NaN NaN NaN NaN ... ... .. .. .. .. 10398 37086 NaN NaN NaN NaN 10399 37087 NaN NaN NaN NaN 10400 37088 NaN NaN NaN NaN 10401 37089 NaN NaN NaN NaN 10402 37090 NaN NaN NaN NaN [10403 rows x 5 columns] ``` I'm going to receive a solution_id and a list of 4 values (let's say [True, False, False, True]). What I need to do is ind the row with the correspondent solution_id and replace the following columns (0, 1, 2, 3) with the list. I have tried using something like: ``` filter_ = (df['solution_id'] == solution_id) df.loc[filter_] = [solution_id] + results ``` Or even: ``` idx = df['solution_id'].loc[df['solution_id'] == solution_id].index[0] df.loc[idx] = [solution_id] + results ``` But both don't work and I'm not sure why. The first runs but doesn't register anything and the second one says the index is empty, so I'm assuming it is not finding anything with the filter. Problem is, I know for sure that every solution_id is in there. So I don't know what to do.
i have a Steam Deck and would like to install GLFW on a Steamdeck, so that VSCode can find the Libary, i use Cmake. I used Cmake on another linux machine with no problems. I think its related to the steam deck and steam os. I a location in with the following files in usr/lib/cmake/glfw3 : - glfw3Targets.cmake, - glfw3Targets-noconfig.cmake, - glfw3ConfigVersion.cmak, - glfw3Config.cmake Also there are two header files in /usr/include/GLFW called: - glfw3.h - glfw3native.h Also i have this so's: - /usr/lib/libglfw.so - /usr/lib/libglfw.so.3 - /usr/lib/libglfw.so.3.3 In the main.cpp file the #include \<GLFW/glfw3.h\> do not work. My Cmake file looks now like this: ``` cmake_minimum_required(VERSION 3.12) project(test) # Add executable add_executable(test src/main.cpp) # Specify the path to GLFW include directory set(GLFW_INCLUDE_DIR "/usr/include" CACHE PATH "Path to GLFW include directory") # Specify the path to GLFW library directory set(GLFW_LIBRARY_DIR "/usr/lib" CACHE PATH "Path to GLFW library directory") # Add GLFW include directory target_include_directories(test PRIVATE ${GLFW_INCLUDE_DIR}) # Link GLFW library to your executable target_link_libraries(test ${GLFW_LIBRARY_DIR}/libglfw.so) ``` Maybe some one with a better understanding of cmake, c and linux can help me. Thank you in advance. I tried different combinations of cmake files with find() and so on. Looked into the internet, and used Chat GPT to find a solution. Reinstalled with ``` sudo pacman -S glfw-x11 ``` glfw again on the steam deck. EDIT: Here is the full error when i start the building: ``` [main] Building folder: game_engine all [build] Starting build [proc] Executing command: /usr/bin/cmake --build /home/deck/Programming/game_engine/build --config Debug --target all -- [build] ninja: error: '/usr/lib/libglfw.so', needed by 'test', missing and no known rule to make it [proc] The command: /usr/bin/cmake --build /home/deck/Programming/game_engine/build --config Debug --target all -- exited with code: 1 [driver] Build completed: 00:00:00.029 [build] Build finished with exit code 1 ``` EDIT2: When i safe the CMakeList.txt i get following message in VSCode: ``` [main] Configuring project: game_engine [proc] Executing command: /usr/bin/cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/gcc -DCMAKE_CXX_COMPILER:FILEPATH=/usr/bin/g++ -S/home/deck/Programming/game_engine -B/home/deck/Programming/game_engine/build -G Ninja [cmake] Not searching for unused variables given on the command line. [cmake] -- Configuring done (0.0s) [cmake] -- Generating done (0.0s) [cmake] -- Build files have been written to: /home/deck/Programming/game_engine/build ``` Permission of usr/lib/libglfw.so: with following command: ```ls -l libglfw.so``` lrwxrwxrwx 1 root root 12 Jul 23 2022 libglfw.so -> libglfw.so.3
|excel|excel-formula|criteria|xlookup|
So basically I'm figuring out how I can set testBuildType to the currently selected build variant. `testBuildType = "currentBuildType"` in Gradle using Kotlin DSL. I have custom build types in my project basically and I want the androidTest to be configured with the current build type.
How to set test build type to current build type in gradle kotlin dsl?
|android|gradle|gradle-kotlin-dsl|
i'm stuck in this error since two days couldn't get some sleep i don't understand what seems the problem since redux and redux toolkit have migrated to a newer version and i seem lost in the code here is the formSlice.js and the fetcForms action ``` ` export const fetchForms = createAsyncThunk('data/fetchAll', async () => { const response = await fetch("http://localhost:5000/autoroute/"); const data = await response.json(); return data; }); const initialState = { data: [], status: 'idle', error: null }; const formSlice = createSlice({ name: 'data', initialState:{}, extraReducers: (builder) => { builder .addCase(fetchForms.fulfilled, (state, action) => { state.data = action.payload; }) }, }); //and this is the home component where i'm trying to display data const dispatch = useDispatch(); const data = useSelector((state) => state.data); console.log(data) useEffect(() => { dispatch(fetchForms()); }, [dispatch]); return ( <div> <h2>Form Data</h2> //and this where the error occurs {data && data.map((form) => ( <div key={form._id}> <p>Type of Accident: {form.accident}</p> <p>Route Type: {form.route}</p> <p>Lane: {form.lane}</p> <p>Number of Fatalities: {form.nbrmort}</p> <p>Number of Injuries: {form.nbrblesse}</p> {/* Other form details */} </div> ))} </div> ); ` ```
i got "TypeError: data.map is not a function" and i can't get the data from backend
|reactjs|express|
null
|excel|excel-formula|google-sheets-formula|
> Is there any easier way to output whole table to HTML markup? Sure. Learn to use **templates**. Just separate your prepared statements from output. To do so, at first collect your data into array: /* fetch values */ $data = array(); while ($row = $stmt->fetch()) { $data[] = $row; } and then include a template with whatever HTML markup you like <table> <?php foreach($data as $row): ?> <tr> <td> <a href="?id=<?= htmlspecialchars($row['id']) ?>"> <?= htmlspecialchars($row['name']) ?> </a> </td> </tr> <?php endforeach ?> </table> The whole problem has nothing to do with prepared statements at all, though.
I have a question about **logDice** association measure for collocational analysis. This is the formula for logDice: **logDice = 14 + log2(2.w1w2/w1+w2)** Where: w1w2 = the frequency of the word x and y w1 = the frequency of the word x (the keyword) w2 = the frequency of the word y (the collocate) And this is the dataframe that I get from the Russian National Corpus ``` df <- structure(list(lex_1 = c("гей", "гей", "гей", "гей", "гей", "гей"), lex_2 = c("лесбиянка", "бисексуал", "-пропаганда", "трансгендер", "-активист", "пропаганда"), w1w2 = c(256L, 56L, 33L, 40L, 22L, 109L ), w1 = c(3035L, 3035L, 3035L, 3035L, 3035L, 3035L), w2 = c(1000L, 214L, 33L, 1125L, 25L, 14989L), dice = c("11.935563044335458", "10.632396335625995", "10.16087357953928", "10.048756281418573", "9.758019438971836", "9.585035580677008"), loglikelihood = c("5257.044796946131", "1149.0014239624418", "NaN", "650.7437731125242", "529.44817318798", "1426.7781683883695"), mi3 = c("22.1740166089487", "19.156318611675747", "19.43925467742511", "16.487339602195437", "18.500491089698897", "16.905211323448984"), tscore = c("15.999754219819755", "7.483202316520131", "5.744540056143745", "6.323855817680788", "4.690394799619232", "10.434660699000974"), agr = c("18.83557314788643", "11.972911417482786", "10.567382701314845", "10.210952867456713", "9.315288895011557", "13.281571601474706")), row.names = c(NA, 6L), class = "data.frame") ``` This is the tibble of df: ``` lex_1 lex_2 w1w2 w1 w2 dice loglikelihood mi3 tscore agr <chr> <chr> <int> <int> <int> <chr> <chr> <chr> <chr> <chr> 1 гей лесбиянка 256 3035 1000 11.935563044335458 5257.044796946131 22.1740166089487 15.999754219819755 18.8355… 2 гей бисексуал 56 3035 214 10.632396335625995 1149.0014239624418 19.156318611675747 7.483202316520131 11.9729… 3 гей -пропаганда 33 3035 33 10.16087357953928 NaN 19.43925467742511 5.744540056143745 10.5673… 4 гей трансгендер 40 3035 1125 10.048756281418573 650.7437731125242 16.487339602195437 6.323855817680788 10.2109… 5 гей -активист 22 3035 25 9.758019438971836 529.44817318798 18.500491089698897 4.690394799619232 9.31528… 6 гей пропаганда 109 3035 14989 9.585035580677008 1426.7781683883695 16.905211323448984 10.434660699000974 13.2815… 7 гей смущать 33 3035 2437 9.582255282724038 472.3465013559598 15.137239185266385 5.742894380148091 9.32370… 8 гей транссексуал 19 3035 294 9.527158922151362 332.24632808876066 15.59597672465279 4.358633704547329 8.24482… 9 гей гей 34 3035 3035 9.508393821122564 473.70304645444645 15.007354424847035 5.82890504455946 9.35288… 10 гей лгбт 32 3035 3453 9.381173487564423 433.62119700658593 14.696448565501338 5.6544538228949675 9.11594… ``` Basically, the dice column stands for logDice value (as per stated in the Russian National Corpus website), and its impossible that this is a Dice coefficient since the formula for Dice coefficient is 2.w1w2/w1+w2 and typically retrieve small number. But as you can see, the dice column is not actually based of the formula above; it does not use log basis 2. It uses ln (natural log). ``` df2 <- df %>% mutate(lndice = 14+log((2*w1w2)/(w1+w2))) %>% select(lndice, dice) ``` And this is the head for df2 ``` dice lndice 1 11.935563044335458 11.935563 2 10.632396335625995 10.632396 3 10.16087357953928 10.160874 4 10.048756281418573 10.048756 5 9.758019438971836 9.758019 6 9.585035580677008 9.585036 ``` This is my attempt to do the calculation of logDice based off the formula, using log to the base of 2: ``` df3 <- df %>% mutate(log2Dice = 14+log2((2*w1w2)/(w1+w2))) %>% select(dice, log2Dice) ``` With the following result: ``` dice log2Dice 1 11.935563044335458 11.021647 2 10.632396335625995 9.141575 3 10.16087357953928 8.461311 4 10.048756281418573 8.299560 5 9.758019438971836 7.880116 6 9.585035580677008 7.630553 ``` It has different values. So, since I am new in R, am I making a mistake in my calculation of logDice? I am trying to be precise, since Rychlý (2008) states that the log in logDice uses the base of 2. But the Russian National Corpus seems to be only using natural log (ln). Or can ln somehow be used in substitution of log2? Sorry if the answer seems trivial, but I am trying to make everything sure.
Whenever I try to run docker-compose up I am getting `PostgreSQL Database directory appears to contain a database; Skipping initialization` I do not want this. I want to completely wipe my postgres database and reinitialize. I've tried deleting every container, volume, and image on the docker client and I've tried `docker-compose down --volumes` . Both times I still get `PostgreSQL Database directory appears to contain a database; Skipping initialization` . This is my compose env: ``` # This is passed into postgres container for compose POSTGRES_PASSWORD=db_pass POSTGRES_USER=db_user POSTGRES_DB=test_db # For heroku DATABASE_URL="postgres://db_user:db_pass@postgres:5432/test_db" ``` This is my compose.yml ``` postgres: image: postgres:16 ports: - 5432:5432 volumes: - ~/apps/postgres:/var/lib/postgresql/data env_file: - .compose.env - .env ```
Springframework test: Async not started
|spring|spring-boot|junit|spring-boot-test|