instruction
stringlengths
0
30k
|php|wordpress|plugins|
null
dependencies { implementation("com.github.bumptech.glide:glide:4.16.0") } Right Click or alt+enter -> Replace with new new library CatLog declaration. Then you will see like that implementation(libs.glide) and Sync Now
I'm using System.IO.Ports.SerialPort to read data from a barcode scanner by USB COM port. But I read wrong data very often, I've checked parameters and I am very sure that they're correct. Need some help here. Code: ``` using System.IO.Ports; using System.Text; namespace SerialPortTestProject { public partial class Form1: Form { public Form1() { InitializeComponent(); SerialPort sp = new("COM3", 9600, Parity.None, 8, StopBits.One); sp.DataReceived += DataReceived1; sp.Open(); } void DataReceived1(object sender, SerialDataReceivedEventArgs e) { Thread.Sleep(500); SerialPort sp = (SerialPort) sender; byte[] data = new byte[sp.BytesToRead]; sp.Read(data, 0, sp.BytesToRead); string result = Encoding.ASCII.GetString(data); WriteResult($"DataReceived1: {string.Join("-", data)} => {result}\r\n"); } void WriteResult(String str) { BeginInvoke(new(() => { textBox1.AppendText(str); })); } } ``` And I tried to scaner a barcode which data is 'PARTS-00010', and I got this: [![data log][1]][1] Just want to know what did I miss? I really need help here, this work is very urgent. Thanks. [1]: https://i.stack.imgur.com/6etMp.png
ASP.NET Core 8 Web API with Swagger not running as localhost web app
|c#|asp.net-core-webapi|.net-8.0|
Below is my code to get a response from the service. Here, I am getting a list of employees. I need to bind form controls dynamically based on the response of service, my service returning more fields (EmployeeId, Name, Department etc.) than the form has controls. How to skip those which are not used in form control? <!-- language: lang-ts --> this._employeeService.getEmployeeById(this.employeeId).subscribe((res: Response) => { this.employeeForm.get('FileUploader').setValue(null); for (const field in res) { this.employeeForm.controls[field].setValue(res[field]); } }); this.employeeForm = this._fb.group({ EmployeeId: 0, Name: '' });
How to check if a control exist in form
null
Below is my code to get a response from the service. Here, I am getting a list of employees. I need to bind form controls dynamically based on the response of service. However, my service is returning more fields (EmployeeId, Name, Department etc.) than the form has controls. How do I skip those fields which are not used in the form control? <!-- language: lang-ts --> this._employeeService.getEmployeeById(this.employeeId).subscribe((res: Response) => { this.employeeForm.get('FileUploader').setValue(null); for (const field in res) { this.employeeForm.controls[field].setValue(res[field]); } }); this.employeeForm = this._fb.group({ EmployeeId: 0, Name: '' });
Im trying to build a docker image and I'm running into a compatibility issue when building the Docker file. The Docker file below leads to a successful build. But when I add "tensorflow-gpu" it fails with a requirements error. Im not sure how to isolate this issue, so any guidance will be appreciated! `Dockerfile`: ``` FROM mcr.microsoft.com/azureml/openmpi4.1.0-cuda11.2-cudnn8-ubuntu20.04:20230530.v1 ENV AZUREML_CONDA_ENVIRONMENT_PATH /azureml-envs/tensorflow-2.7 # Create conda environment RUN conda create -p $AZUREML_CONDA_ENVIRONMENT_PATH \ python=3.8 pip=20.2.4 # Prepend path to AzureML conda environment ENV PATH $AZUREML_CONDA_ENVIRONMENT_PATH/bin:$PATH # Install pip dependencies RUN HOROVOD_WITH_TENSORFLOW=1 pip install 'matplotlib' \ 'psutil' \ 'tqdm' \ 'pandas' \ 'scipy' \ 'numpy' \ 'ipykernel' \ 'azureml-core' \ 'azureml-defaults' \ 'azureml-mlflow' \ 'azureml-telemetry' \ 'tensorboard' # This is needed for mpi to locate libpython ENV LD_LIBRARY_PATH $AZUREML_CONDA_ENVIRONMENT_PATH/lib:$LD_LIBRARY_PATH ``` Error: 2024-03-29T03:05:42: ---> Running in bec9494787c1 2024-03-29T03:05:43: Collecting matplotlib~=3.5.0 2024-03-29T03:05:43: Downloading matplotlib-3.5.3-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl (11.3 MB) 2024-03-29T03:05:44: Collecting psutil~=5.8.0 2024-03-29T03:05:44: Downloading psutil-5.8.0-cp38-cp38-manylinux2010_x86_64.whl (296 kB) 2024-03-29T03:05:44: Collecting tqdm~=4.62.0 2024-03-29T03:05:44: Downloading tqdm-4.62.3-py2.py3-none-any.whl (76 kB) 2024-03-29T03:05:45: Collecting pandas~=1.3.0 2024-03-29T03:05:45: Downloading pandas-1.3.5-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (11.5 MB) 2024-03-29T03:05:45: Collecting scipy~=1.7.0 2024-03-29T03:05:45: Downloading scipy-1.7.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (39.3 MB) 2024-03-29T03:05:47: Collecting numpy~=1.21.0 2024-03-29T03:05:47: Downloading numpy-1.21.6-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (15.7 MB) 2024-03-29T03:05:47: Collecting ipykernel~=6.0 2024-03-29T03:05:47: Downloading ipykernel-6.29.4-py3-none-any.whl (117 kB) 2024-03-29T03:05:47: Collecting azureml-core==1.51.0 2024-03-29T03:05:47: Downloading azureml_core-1.51.0-py3-none-any.whl (3.3 MB) 2024-03-29T03:05:47: Collecting azureml-defaults==1.51.0 2024-03-29T03:05:47: Downloading azureml_defaults-1.51.0-py3-none-any.whl (2.0 kB) 2024-03-29T03:05:47: Collecting azureml-mlflow==1.51.0 2024-03-29T03:05:47: Downloading azureml_mlflow-1.51.0-py3-none-any.whl (814 kB) 2024-03-29T03:05:47: Collecting azureml-telemetry==1.51.0 2024-03-29T03:05:47: Downloading azureml_telemetry-1.51.0-py3-none-any.whl (30 kB) 2024-03-29T03:05:47: [91mERROR: Could not find a version that satisfies the requirement tensorboard~=2.15.0 (from versions: 1.6.0rc0, 1.6.0, 1.7.0, 1.8.0, 1.9.0, 1.10.0, 1.11.0, 1.12.0, 1.12.1, 1.12.2, 1.13.0, 1.13.1, 1.14.0, 1.15.0, 2.0.0, 2.0.1, 2.0.2, 2.1.0, 2.1.1, 2.2.0, 2.2.1, 2.2.2, 2.3.0, 2.4.0, 2.4.1, 2.5.0, 2.6.0, 2.7.0, 2.8.0, 2.9.0, 2.9.1, 2.10.0, 2.10.1, 2.11.0, 2.11.1, 2.11.2, 2.12.0, 2.12.1, 2.12.2, 2.12.3, 2.13.0, 2.14.0) 2024-03-29T03:05:47: ERROR: No matching distribution found for tensorboard~=2.15.0 2024-03-29T03:05:48: The command '/bin/sh -c HOROVOD_WITH_TENSORFLOW=1 pip install 'matplotlib~=3.5.0' 'psutil~=5.8.0' 'tqdm~=4.62.0' 'pandas~=1.3.0' 'scipy~=1.7.0' 'numpy~=1.21.0' 'ipykernel~=6.0' 'azureml-core==1.51.0' 'azureml-defaults==1.51.0' 'azureml-mlflow==1.51.0' 'azureml-telemetry==1.51.0' 'tensorboard~=2.15.0'' returned a non-zero code: 1 2024-03-29T03:05:48: [0m 2024-03-29T03:05:48: CalledProcessError(1, ['docker', 'build', '-f', 'Dockerfile', '.', '-t', 'e91555eeb3224b08b13539c983a2c3f8.azurecr.io/azureml/azureml_50f64810c9ea1320c2b49770067c34d2', '-t', 'e91555eeb3224b08b13539c983a2c3f8.azurecr.io/azureml/azureml_50f64810c9ea1320c2b49770067c34d2:1']) 2024-03-29T03:05:48: Building docker image failed with exit code: 1
You asked: >i dont understand it so if it could be provided with proper explanation ## Arrays As shown in [The Java Tutorials][1] by Oracle Corp, a `for` loop has three parts: ```java for ( initialization ; termination ; increment ) { statement(s) } ``` Take for example an array `{ "alpha" , "beta" , "gamma" }`: ```java for ( int index = 0 ; index < myArray.length ; index ++ ) { System.out.println( "Index: " + index + ", value: " + myArray[ index ] ); } ``` See this [code run at Ideone.com][2]. ```none ------| Ascending |---------- Index: 0, Value: alpha Index: 1, Value: beta Index: 2, Value: gamma ``` To reverse the direction: - The first part, ***initialization***, can start at the *last* index of the array rather than at the *first* index (zero). Ex: `int index = ( myArray.length - 1 )`. (Parentheses optional there.) - The second part, ***termination***, can test for going past the first index (zero), into negative numbers: `index > -1` (or `index >= 0`). - The third part, ***increment***, can go downwards (negative) rather than upwards (positive): `index --`. ```java for ( int index = ( myArray.length - 1 ) ; index > -1 ; index -- ) { System.out.println( "Index: " + index + ", value: " + myArray[ index ] ); } ``` See this [code run at Ideone.com][2]. ```none ------| Descending |---------- Index: 2, value: gamma Index: 1, value: beta Index: 0, value: alpha ``` ## Collections The code above certainly works. And, on the upside, arrays tend to use less memory while executing faster. But, on the downside, working with arrays is limiting, cumbersome, and somewhat error-prone. More commonly in Java, we use the [*Java Collections Framework*][3]. In collections, the appropriate replacement for an array is a [`SequencedCollection`][4] such as [`ArrayList`][5] (a [`List`][6]) or [`TreeSet`][7] (a [`NavigableSet`][8]). We can easily make an [unmodifiable][9] `List` of our array by calling [`List.of`][10]. (The concrete actually used under-the-covers is unspecified.) The `List.of` method performs a *shallow copy*. This means the content of the elements is *not* duplicated — the same three `String` object are in both the original array *and* in the new `List`. Every `List` is also a `SequencedCollection`. This means we can call the [`reversed`][11] method. This method is quite efficient in that it does *not* really create another collection. Instead the `reversed` method creates a *view* upon the original collection that presents its elements in a reversed encounter order. ```java String[] myArray = { "alpha" , "beta" , "gamma" }; SequencedCollection < String > strings = List.of( myArray ); System.out.println( "strings.toString() = " + strings ); System.out.println( "strings.reversed().toString() = " + strings.reversed().toString() ); ``` When run: ```none strings.toString() = [alpha, beta, gamma] strings.reversed().toString() = [gamma, beta, alpha] ``` [1]: https://docs.oracle.com/javase/tutorial/java/nutsandbolts/for.html [2]: https://ideone.com/EsDnUk [3]: https://en.wikipedia.org/wiki/Java_collections_framework [4]: https://docs.oracle.com/en%2Fjava%2Fjavase%2F22%2Fdocs%2Fapi%2F%2F/java.base/java/util/SequencedCollection.html [5]: https://docs.oracle.com/en%2Fjava%2Fjavase%2F22%2Fdocs%2Fapi%2F%2F/java.base/java/util/ArrayList.html [6]: https://docs.oracle.com/en%2Fjava%2Fjavase%2F22%2Fdocs%2Fapi%2F%2F/java.base/java/util/List.html [7]: https://docs.oracle.com/en%2Fjava%2Fjavase%2F22%2Fdocs%2Fapi%2F%2F/java.base/java/util/TreeSet.html [8]: https://docs.oracle.com/en%2Fjava%2Fjavase%2F22%2Fdocs%2Fapi%2F%2F/java.base/java/util/NavigableSet.html [9]: https://docs.oracle.com/en%2Fjava%2Fjavase%2F22%2Fdocs%2Fapi%2F%2F/java.base/java/util/List.html#unmodifiable [10]: https://docs.oracle.com/en%2Fjava%2Fjavase%2F22%2Fdocs%2Fapi%2F%2F/java.base/java/util/List.html#of(java.lang.Object[]) [11]: https://docs.oracle.com/en%2Fjava%2Fjavase%2F22%2Fdocs%2Fapi%2F%2F/java.base/java/util/SequencedCollection.html#reversed()
According to my knowledge, till now (2024 March 29), ollama doesn't support parallelization. Since you have two GPUs, you could try running two or more (not recommended) ollama containers at different ports. Here is an [example][1]. [1]: https://github.com/ParisNeo/ollama_proxy_server OK, I shall make my answer self-contained. Here are certain steps for u: 1. Pull the offical ollama image from dockerhub: `docker pull ollama/ollama:latest` 2. Run the 1st docker container using ```shell docker run -d \ --gpus=0 \ -v {the_dir_u_save_models}:/root/.ollama \ -p {port1}:11434 \ --name ollama \ ollama/ollama ``` 3. Run the 2nd docker container using ```shell docker run -d \ --gpus=1 \ -v {the_dir_u_save_models}:/root/.ollama \ -p {port2}:11434 \ --name ollama \ ollama/ollama ``` Watch out the difference in `--gpus=` and `-p` parameters. 4. use async to manage your parallelization logic in Python or other languages. Here are some pesudo-code describing the process: ```javascript function processQuestionsAsync(questions) { // Sort questions based on a specific criterion, e.g., LLM questions.sort((a, b) => { // Example: sorting by 'LLM'. Adjust comparison logic as needed. return a.LLM.localeCompare(b.LLM); }); // Divide questions into two batches let batch1 = questions.slice(0, questions.length / 2); let batch2 = questions.slice(questions.length / 2); // Initialize an array to collect responses let responses = []; // Function to send questions to a server asynchronously async function sendToServer(batch, serverURL) { for (let question of batch) { let response = await sendQuestionToServer(question, serverURL); // Once a response is received, send it to the front-end sendResponseToFrontEnd(response); // Store response in the responses array responses.push(response); } } // Define server URLs for each batch let serverURL1 = "http://server1.com/api"; let serverURL2 = "http://server2.com/api"; // Use Promise.all to handle both batches in parallel Promise.all([ sendToServer(batch1, serverURL1), sendToServer(batch2, serverURL2) ]).then(() => { // All questions have been processed, and all responses have been sent to the front-end console.log("All questions processed"); }).catch(error => { // Handle errors console.error("An error occurred:", error); }); } // Function to simulate sending a question to a server async function sendQuestionToServer(question, serverURL) { // Simulate network request let response = await fetch(serverURL, { method: 'POST', body: JSON.stringify(question), headers: { 'Content-Type': 'application/json' }, }); // Return the response data return await response.json(); } // Function to simulate sending a response back to the front-end function sendResponseToFrontEnd(response) { console.log("Sending response to front-end:", response); } // Example usage with questions as objects including 'contentType' let questions = [ { question: "What is 2+2?", contentType: "Math", LLM: "GPT-3" }, { question: "What is the capital of France?", contentType: "Geography", LLM: "GPT-3" }, { question: "What is the largest ocean?", contentType: "Geography", LLM: "GPT-4" }, { question: "What is the speed of light?", contentType: "Physics", LLM: "GPT-3" } ]; processQuestionsAsync(questions); ``` The pesudo-code above doesn't matter. The most important thing is that u may receive requests from front-end asking for different LLMs, and one ollama instance has to onload and offload between them. Try to avoid this as far as possible. By the way, based on my own experience with ollama on A100, parallelization may not be a good choice. VRAM is abundant for sure, but the computing capacity is always limited.
When using Playwright (version 1.42.1) to test services hosted on the local machine using localhost or 127.0.0.1 with Chrome 108 and Chromium 100 browsers on Windows 7 Professional, the testing process is fast. However, when testing services hosted on the local machine's IP address (e.g., 10.132.xxx.xxx) or other IP addresses within the same intranet, the testing process becomes significantly slower. my code: import { test, expect } from '@playwright/test'; test('test', async ({page }) => { await page.goto('http://10.13.xxx.xxx:8080/test'); await page.getByRole('button', {name: "Login"}).click() await page.waitForTimeout(5000); }); Services can be any web project, such as a simple project containing multiple JavaScript files, Vue projects, etc Environment: Playwright Version: 1.42.1 Operating System: Windows 7 Professional Browsers: Chrome 108, Chromium 100 Network Condition: Intranet environment Playwright should be able to test services within the same intranet environment, including those hosted on the local machine's IP address, with similar performance as testing services using localhost or 127.0.0.1.
You can try a parameter to .tabViewStyle: ``` TabView(selection: $selectedPage) { Text("1").tag(0) Text("2").tag(1) } .tabViewStyle(.page(indexDisplayMode: .never)) ``` This way you don't change the appearance of all UIPageControl's in the app.
{"Voters":[{"Id":4685471,"DisplayName":"desertnaut"},{"Id":354577,"DisplayName":"Chris"},{"Id":9455518,"DisplayName":"Hamed"}],"SiteSpecificCloseReasonIds":[16]}
You should try to use `LauncherActivity` instead of `MainActivity`. The package name of the LauncherActivity is also a little bit different. To sum up, the following command will start Instagram app from the terminal: adb -s 077743323A102985 shell am start -n com.instagram.android/com.instagram.mainactivity.LauncherActivity In order to know which Activity to use to start an app you can follow these steps: 1. get the apk of the app 2. extract the `AndroidManifest.xml` file 3. search for `<action android:name="android.intent.action.MAIN"/>` and `<category android:name="android.intent.category.LAUNCHER"/>` intent filters 4. get the activity by looking at the `android:targetActivity` attribute You can apply these steps to all apps not only Instagram.
I have an index.css that have some styles in it and it is imported here: ``` import React from 'react' import ReactDOM from 'react-dom/client' import App from './App.tsx' import './index.css' ReactDOM.createRoot(document.getElementById('root')!).render( <React.StrictMode> <App /> </React.StrictMode>, ) ``` I just want it to affect this part : ``` // global.tsx import React from "react"; import { BrowserRouter as Router, Route, Routes } from "react-router-dom"; import LoginPage from "../../pages/Authentication/Login"; import SignupPage from "../../pages/Authentication/Signup"; import '../../index.css' const Global = () => { return ( <Router> <Routes> <Route path="/" element={<LoginPage />} /> <Route path="/signup" element={<SignupPage />}></Route> </Routes> </Router> ); }; export default Global; ``` so as you can see i moved the import only to this part instead of being imported in the main.tsx . but still the css file affects the other pages and components I hope someone helps me
Is there a way to affect some react components without affecting the other components or pages?
|reactjs|react-hooks|frontend|
null
*Note:* This answer addresses the original problem of summing over a well-defined input of consecutive integers starting at 1. It does not consider the later added question about arbitrary inputs. The natural solution is a trivial loop passing over the sequence in order and a counter that increments every time the next number exceeds the bracket size. And the naive query in SQL mimics that patterns with a straightforward recursive query. This approach works by generating a narrow list of possible consecutive series of maximal length at least two and then chaining them together recursively. The single value series are appended at the end. This query was also created with efficiency in mind and minimizing the recursion depth. It appears to work well with relatively large inputs. The bracketing size (which is 20 in the example) is really the only factor in the size of the search space. With many input combinations there will be a lot of single-value ranges ("degenerate" values) padding out the list. Generating a full, lengthy list of unnecessary search values slows down the operation by orders of magnitude. It eliminates that problem by only looking at those numbers that can combine with other numbers in a useful, "non-degenerate" way. I'll see if there are any further optimizations and come back to this again. Where you see the literal values of 20 and 100 in the query those can be replaced by variables. The formula `n * (n + 1) / 2` evaluates to the nth triangular number while the one involving a square root determines the index of the largest triangular number less than or equal to the input. The Nth triangular number is one formed by added up the integers from 1 to N. The sum of *any* set of consecutive numbers can be visualized as a triangular number plus a rectangular number. In the diagram below it's easy to see that incrementing the start of the range will increase the total by N (4 in this case.) This will be useful for determining the range of values with a length of N that could fill the groupings/slots: 1-4 2-5 3-6 4-7 5-8 * * * * ** * *** * **** ** ** * ** ** ** *** ** **** *** *** * *** ** *** *** *** **** **** **** * **** ** **** *** **** **** The very first grouping is easy to calculate as the largest triangular number less than the size of the maximum bracket. It must also be longer than any other grouping. The formula involving `floor()` and `sqrt()` can be found in references elsewhere but it simply calculates that N. The second grouping then must obviously connect to the first one so there's no point in considering lengths less than the maximal length but starting before the ending of the first one. The first basically computes the Nth triangular number and determines how far you can slide a set of numbers with that length before overflowing the bracket size. The second CTE just explodes that data into what are effectively `(length, offset)` candidate pairs and applies some of the culling mentioned in the last paragraph. The final complex filter is worth more explanation when I can come back but it looks to make sure that a candidate is filling as much space as possible For instance, there's no point in adding `{ 4, 5 }` when `{ 4, 5, 6 }` also fits within the total of 20. with recursive data as ( select n as len, (20 - n * (n + 1) / 2) / n + 1 as range, floor((sqrt(8 * 20 + 1) - 1) / 2)::int as maxlen from generate_series(2, floor((sqrt(8 * 20 + 1) - 1) / 2)::int) n ), candidates as ( select ofs + 1 s, ofs + len e, row_number() over (partition by ofs order by len desc) as rnk from data cross join generate_series(0, (select max(range) - 1 from data)) ofs where ofs < range and (len = maxlen or ofs >= maxlen) and 20 - (ofs + 1 + (len - 1) / 2::float) * len < ofs + len + 1 ), chain as ( select * from candidates where s = 1 union all select rc.* from chain c inner join candidates rc on rc.s = c.e + 1 ) select s, least(e, 100) as e from chain where s <= 100 union all select n, n from generate_series((select max(e) + 1 from chain), 100) n order by s; Sample execution: https://dbfiddle.uk/1j0A2LWA For a comparison of query plans (~1000 times faster than accepted answer): https://dbfiddle.uk/s5hQKcKV
{"Voters":[{"Id":2359687,"DisplayName":"devlin carnate"},{"Id":354577,"DisplayName":"Chris"},{"Id":9455518,"DisplayName":"Hamed"}],"SiteSpecificCloseReasonIds":[18]}
I think a possible solution is saving an instance of the table in an object and when the user clicks on the button you iterate through the new table and check whether the values are the same if not send a request to backend. this way i don't think a checkbox input would be needed.
I've got an HStack with a Menu and a Link buttons, which are part of a card that pops up when the user clicks on the card's title. Every time the card expands fully, the Menu button is higher than the Link button. Once clicked, the Menu button goes down to its proper position. Any ideas what I'm doing wrong? ```swift struct ItemButtonRow: View { var item: ItemEntity var bottomPadding: CGFloat = 10 @Binding var showShareSheet: Bool var body: some View { HStack(alignment: .center) { Menu( content: { Button { showShareSheet.toggle() } label: { Text("as image") Image(systemName: "photo") } ShareLink(item: item.title, message: Text(item.summary)) { Text("as text") Image(systemName: "text.justify.left") } }, label: { HStack { Image(systemName: "square.and.arrow.up") Text("Share") } .padding(10) .background(RoundedRectangle(cornerRadius: 10).fill(Color("whitesand"))) .tint(Color(.secondaryLabel)) } ) Spacer() Link(destination: URL(string: "\(item.link)?utm_source=items&utm_medium=ios_app")!) { Image(systemName: "book") Text("Read more") } .padding(10) .background(RoundedRectangle(cornerRadius: 10).fill(Color("vpurple"))) .tint(Color(.white)) } .frame(height: 60) .padding(.bottom, bottomPadding) } } struct DailyItemView: View { @Environment(\.scenePhase) private var scenePhase @EnvironmentObject var am: ItemModel @EnvironmentObject var um: UnsplashModel @State private var cardPosition: BottomSheetPosition = .dynamicBottom @State private var showAboutScreen = false @State private var showShareSheet = false @State private var refreshImage = false private let haptics = UINotificationFeedbackGenerator() private let iPad = UIDevice.current.userInterfaceIdiom == .pad // MARK: - BODY var body: some View { let topCardPosition: BottomSheetPosition = iPad ? .relative(0.6) : .relative(0.8) ZStack { GeometryReader { proxy in DailyItemCoverImage(imageUrl: am.dailyItemCoverImageUrl, blurHash: am.dailyItemImageBlurHash) } .ignoresSafeArea() .bottomSheet( bottomSheetPosition: $cardPosition, switchablePositions: [.dynamicBottom, topCardPosition], headerContent: { ItemTitle(item: am.dailyItem, showDate: false, alignment: .center) .padding(.top, 20) .padding(.horizontal, 25) .padding(.horizontal, iPad ? 200 : 0) .onTapGesture { self.haptics.notificationOccurred(.success) if cardPosition == .dynamicBottom { cardPosition = topCardPosition } else { cardPosition = .dynamicBottom } } }, mainContent: { VStack { ItemContentBox(item: am.dailyItem, scroll: true) ItemButtonRow(item: am.dailyItem, bottomPadding: 10, showShareSheet: $showShareSheet) } .padding(.top, 10) .padding(.horizontal, 25) .padding(.horizontal, iPad ? 200 : 0) } ) .enableBackgroundBlur(cardPosition == topCardPosition ? true : false) .backgroundBlurMaterial(.dark(.thick)) .showDragIndicator(true) .enableFlickThrough(false) .customBackground( HStack { Spacer(minLength: iPad ? 150 : 0) Color("background") .opacity(0.95) .cornerRadius(30, corners: [.topLeft, .topRight]) .shadow(color: .black.opacity(0.1), radius: 10, x:0, y: -2) Spacer(minLength: iPad ? 150 : 0) } ) .enableFloatingIPadSheet(false) .sheetWidth(iPad ? BottomSheetWidth.relative(1) : BottomSheetWidth.platformDefault) } .overlay(Color.black.opacity(showShareSheet ? 0.8 : 0)) .animation(.easeInOut(duration: 0.2), value: showShareSheet) .sheet(isPresented: $showShareSheet) { ItemShare(item: am.dailyItem) .presentationDetents([.height(650)]) } .toastDimmedBackground(true) // Refresh view when moving from a different screen .onAppear { print("DailyItemView: onAppear") am.getDailyItem() } // Refresh view when restoring from background .onChange(of: scenePhase) { newScene in switch newScene { case .active: print("Active scene") am.getDailyItem() case .inactive: print("Inactive scene") am.getDailyItem() case .background: print("Background scene") @unknown default: print("Unknown scene") } } } } ``` [![Card expanded, Menu not clicked][1]][1] [![Menu clicked][2]][2] [1]: https://i.stack.imgur.com/HibDE.jpg [2]: https://i.stack.imgur.com/qrc2t.jpg
Could anybody tell me how I can change the default log directory `./log/` to something else? Is there any variable I can set in .env? Thanks for your help. E.
DevilBox change ./log/
|logging|devilbox|
I would like to configure my GitHub Actions workflow to run based on one of two conditions: - A source file has changed - A configuration file has changed Conditions should be evaluated on `OR`. To solve the first issue I configured the action by using the `paths` parameter: ``` on: push: branches: - main paths: - 'src/**' ``` This works and run the action on every push if at least one file in the `src` folder and its subfolders has changed. I have then added the following (inspired by [this](https://stackoverflow.com/a/76975099/23137927)) ``` on: push: branches: - main paths: - 'src/**' - 'myconfigurationfile.json' ``` But it does not work as expected.
Run workflow when a configuration file has changed or source code has changed
I hope this message finds you well. I am reaching out for assistance regarding the implementation of WebSocket.io with Adonis 6. In the past, I successfully implemented WebSocket.io with Adonis 5 by following this [documentation][1]. However, I am facing challenges in replicating the same implementation with Adonis 6. After some investigation, I suspect that the issue may be related to the import statement: ``` import { AdonisServer } from '@adonisjs/core/app' ``` With my limited experience, I believe that this import statement might not be compatible with Adonis 6, leading to the difficulties I am encountering. I would greatly appreciate any guidance or suggestions you can provide to resolve this issue and successfully implement WebSocket.io with Adonis 6. Thank you very much for your time and assistance. Best regards, After some investigation, I suspect that the issue may be related to the import statement: ``` import { AdonisServer } from '@adonisjs/core/app' ``` [source][1] [1]: https://v5-docs.adonisjs.com/cookbooks/socketio-with-adonisjs
null
I need assistance with the implementation of WebSocket.io with Adonis 6. In the past, I successfully implemented WebSocket.io with Adonis 5 by following this [documentation][1]. However, I am facing challenges in replicating the same implementation with Adonis 6. After some investigation, I suspect that the issue may be related to the import statement: ``` import { AdonisServer } from '@adonisjs/core/app' ``` With my limited experience, I believe that this import statement might not be compatible with Adonis 6, leading to the difficulties I am encountering. I would greatly appreciate any guidance or suggestions you can provide to resolve this issue and successfully implement WebSocket.io with Adonis 6. Thank you very much for your time and assistance. Best regards, After some investigation, I suspect that the issue may be related to the import statement: ``` import { AdonisServer } from '@adonisjs/core/app' ``` [source][1] [1]: https://v5-docs.adonisjs.com/cookbooks/socketio-with-adonisjs
We can also use the concept for variable groups like below variables: - group: my-variable-group We can also use both individual variables and variable groups together: variables: - group: my-variable-group - name: my-bare-variable value: 'value of my-bare-variable'
** My question is with travesing. In my problem the sequence of the traversal is not following as it should. I am using the general logic for the inorder, preorderand the postorder traversal but it is giving in the wrong sequence.** My problem is my code is not traversing like my expected output. The expected output should look like this: Initially, how many integers you want: 5 Enter the integers: 7 9 1 2 10 Press 1 for inorder traverse, 2 for preorder traverse, 3 for postorder traverse, 4 for inserting new item, 5 for deleting an item, or 6 for exit the program: 4 Enter the item for insert: 2 This item already exists. Press 1 for inorder traverse, 2 for preorder traverse, 3 for postorder traverse, 4 for inserting new item, 5 for deleting an item, or 6 for exit the program: 4 Enter the item for insert: 8 This item is inserted. Press 1 for inorder traverse, 2 for preorder traverse, 3 for postorder traverse, 4 for inserting new item, 5 for deleting an item, or 6 for exit the program: 5 Enter the item for delete: 12 This item not found. Press 1 for inorder traverse, 2 for preorder traverse, 3 for postorder traverse, 4 for inserting new item, 5 for deleting an item, or 6 for exit the program: 5 Enter the item for delete: 7 This item is deleted. Press 1 for inorder traverse, 2 for preorder traverse, 3 for postorder traverse, 4 for inserting new item, 5 for deleting an item, or 6 for exit the program: 1 **Inorder Traverse: 1 2 8 9 10** Press 1 for inorder traverse, 2 for preorder traverse, 3 for postorder traverse, 4 for inserting new item, 5 for deleting an item, or 6 for exit the program: 2 **Preorder Traverse: 2 1 9 8 10** Press 1 for inorder traverse, 2 for preorder traverse, 3 for postorder traverse, 4 for inserting new item, 5 for deleting an item, or 6 for exit the program: 3 **Postorder Traverse: 1 8 10 9 2** Press 1 for inorder traverse, 2 for preorder traverse, 3 for postorder traverse, 4 for inserting new item, 5 for deleting an item, or 6 for exit the program: 6 Program terminated But my output is showing the traversal like this: **Inorder Traverse: 1 2 8 9 10 Preorder Traverse: 8 1 2 9 10 Postorder Traverse: 2 1 10 9 8** My code is given below: ``` #include <iostream> using namespace std; struct Node { int data; Node *left; Node *right; Node(int value) : data(value), left(nullptr), right(nullptr) {} }; class BST { private: Node *root; Node *insertRecursive(Node *root, int value) { if (root == nullptr) { return new Node(value); } if (value < root->data) { root->left = insertRecursive(root->left, value); } else if (value > root->data) { root->right = insertRecursive(root->right, value); } else { cout << "This item already exists." << endl; } return root; } Node *findMin(Node *root) { while (root->left != nullptr) { root = root->left; } return root; } Node *deleteRecursive(Node *root, int value) { if (root == nullptr) { cout << "Item not found." << endl; return nullptr; } if (value < root->data) { root->left = deleteRecursive(root->left, value); } else if (value > root->data) { root->right = deleteRecursive(root->right, value); } else { if (root->left == nullptr) { Node *temp = root->right; delete root; return temp; } else if (root->right == nullptr) { Node *temp = root->left; delete root; return temp; } Node *temp = findMin(root->right); root->data = temp->data; root->right = deleteRecursive(root->right, temp->data); } return root; } void inorderTraversal(Node *root) { if (root == nullptr) { return; } inorderTraversal(root->left); cout << root->data << " "; inorderTraversal(root->right); } void preorderTraversal(Node *root) { if (root == nullptr) { return; } cout << root->data << " "; preorderTraversal(root->left); preorderTraversal(root->right); } void postorderTraversal(Node *root) { if (root == nullptr) { return; } postorderTraversal(root->left); postorderTraversal(root->right); cout << root->data << " "; } bool searchRecursive(Node *root, int value) { if (root == nullptr) { return false; } if (value < root->data) { return searchRecursive(root->left, value); } else if (value > root->data) { return searchRecursive(root->right, value); } else { return true; } } public: BST() : root(nullptr) {} void insert(int value) { root = insertRecursive(root, value); } void remove(int value) { root = deleteRecursive(root, value); } bool search(int value) { return searchRecursive(root, value); } void inorder() { cout << "Inorder Traverse: "; inorderTraversal(root); cout << endl; } void preorder() { cout << "Preorder Traverse: "; preorderTraversal(root); cout << endl; } void postorder() { cout << "Postorder Traverse: "; postorderTraversal(root); cout << endl; } }; int main() { BST bst; int n, choice, item; cout << "Initially, how many integers do you want: "; cin >> n; cout << "Enter the integers: "; for (int i = 0; i < n; i++) { cin >> item; bst.insert(item); } cout << endl; while (true) { cout << "Press 1 for inorder traverse, 2 for preorder traverse, " << "3 for postorder traverse, 4 for inserting new item, " << "5 for deleting an item, or 6 for exit the program: " << endl; cin >> choice; switch (choice) { case 1: bst.inorder(); cout << endl; break; case 2: bst.preorder(); cout << endl; break; case 3: bst.postorder(); cout << endl; break; case 4: cout << "Enter the item for insert: " << endl; cin >> item; bst.insert(item); cout << endl; break; case 5: cout << "Enter the item for delete: "; cin >> item; bst.remove(item); cout << endl; break; case 6: cout << "Program terminated." << endl; return 0; default: cout << "Invalid choice. Please try again." << endl; } } return 0; } ```
Why is my traversing in BST not showing the results like the sample output?
|binary-search-tree|traversal|tree-traversal|
null
The example seems to be adopted from https://stackoverflow.com/questions/58119428/how-to-set-default-value-for-row-labels-in-pivot-table-using-poi/58137844#58137844. There my answer explains the basics. The difference is that the example there uses text items to filter. Your example needs numeric items to filter. For text items `sharedItems` in `pivotCacheDefinition` - `cacheFields` - `cacheField` are `s`-items. For numeric items `sharedItems` in `pivotCacheDefinition` - `cacheFields` - `cacheField` are `n`-items. But while `sharedItems` having `s`-items don't need furthrt settings, `sharedItems` having `n`-items need further settings about the number type. For example: <sharedItems containsSemiMixedTypes="false" containsString="false" containsNumber="true" containsInteger="true"> <n v="1"/> <n v="2"/> <n v="3"/> </sharedItems> Code differences: For text items: for (String item : uniqueItems) { ... pivotTable.getPivotCacheDefinition().getCTPivotCacheDefinition().getCacheFields().getCacheFieldArray(0) .getSharedItems().addNewS().setV(item); ... } For numeric items: for (Integer item : uniqueItems) { ... pivotTable.getPivotCacheDefinition().getCTPivotCacheDefinition().getCacheFields().getCacheFieldArray(1).getSharedItems() .setContainsSemiMixedTypes(false); pivotTable.getPivotCacheDefinition().getCTPivotCacheDefinition().getCacheFields().getCacheFieldArray(1).getSharedItems() .setContainsString(false); pivotTable.getPivotCacheDefinition().getCTPivotCacheDefinition().getCacheFields().getCacheFieldArray(1).getSharedItems() .setContainsNumber(true); pivotTable.getPivotCacheDefinition().getCTPivotCacheDefinition().getCacheFields().getCacheFieldArray(1).getSharedItems() .setContainsInteger(true); pivotTable.getPivotCacheDefinition().getCTPivotCacheDefinition().getCacheFields().getCacheFieldArray(1).getSharedItems() .addNewN().setV(item); ... } Complete example: import java.io.FileOutputStream; import org.apache.poi.ss.*; import org.apache.poi.ss.usermodel.*; import org.apache.poi.ss.util.*; import org.apache.poi.xssf.usermodel.*; class PivotIntegerFilter { public static void main(String[] args) throws Exception { try (Workbook workbook = new XSSFWorkbook(); FileOutputStream fileout = new FileOutputStream("./pivottable.xlsx")) { Sheet pivotSheet = workbook.createSheet("Pivot"); Sheet dataSheet = workbook.createSheet("Data"); setCellData(dataSheet, workbook); AreaReference areaReference = new AreaReference("A1:E5", SpreadsheetVersion.EXCEL2007); XSSFPivotTable pivotTable = ((XSSFSheet) pivotSheet).createPivotTable(areaReference, new CellReference("A4"), dataSheet); pivotTable.addRowLabel(0); pivotTable.addReportFilter(1); pivotTable.addColumnLabel(DataConsolidateFunction.SUM, 2); java.util.TreeSet<Integer> uniqueItems = new java.util.TreeSet<Integer>(); for (int r = areaReference.getFirstCell().getRow() + 1; r < areaReference.getLastCell().getRow() + 1; r++) { uniqueItems.add((int) dataSheet.getRow(r).getCell(1).getNumericCellValue()); } int i = 0; for (Integer item : uniqueItems) { pivotTable.getCTPivotTableDefinition().getPivotFields().getPivotFieldArray(1).getItems().getItemArray(i).unsetT(); pivotTable.getCTPivotTableDefinition().getPivotFields().getPivotFieldArray(1).getItems().getItemArray(i).setX((long) i); pivotTable.getPivotCacheDefinition().getCTPivotCacheDefinition().getCacheFields().getCacheFieldArray(1).getSharedItems() .setContainsSemiMixedTypes(false); pivotTable.getPivotCacheDefinition().getCTPivotCacheDefinition().getCacheFields().getCacheFieldArray(1).getSharedItems() .setContainsString(false); pivotTable.getPivotCacheDefinition().getCTPivotCacheDefinition().getCacheFields().getCacheFieldArray(1).getSharedItems() .setContainsNumber(true); pivotTable.getPivotCacheDefinition().getCTPivotCacheDefinition().getCacheFields().getCacheFieldArray(1).getSharedItems() .setContainsInteger(true); pivotTable.getPivotCacheDefinition().getCTPivotCacheDefinition().getCacheFields().getCacheFieldArray(1).getSharedItems() .addNewN().setV(item); if (!(item == 3)) { pivotTable.getCTPivotTableDefinition().getPivotFields().getPivotFieldArray(1).getItems().getItemArray(i).setH(true); } i++; } pivotTable.getCTPivotTableDefinition().getPivotFields().getPivotFieldArray(1).setMultipleItemSelectionAllowed(true); workbook.write(fileout); } } static void setCellData(Sheet sheet, Workbook workbook) { Row row; Cell cell; Object[][] data = new Object[][]{ new Object[]{"PARTY", "SNO", "VOTES", "Total Count", "Total Absent"}, new Object[]{"REPUBLICAN", 1, 10d, "?", "?"}, new Object[]{"DEMOCRAT", 3, 5d, "?", "?"}, new Object[]{"AMERICAN INDEP", 3, 10d, "?", "?"}, new Object[]{"DECLINED", 2, 10d, "?", "?"} }; for (int r = 0; r < data.length; r++) { row = sheet.createRow(r); Object[] rowData = data[r]; for (int c = 0; c < rowData.length; c++) { cell = row.createCell(c); if (rowData[c] instanceof String) { cell.setCellValue((String) rowData[c]); } else if (rowData[c] instanceof Double) { cell.setCellValue((Double) rowData[c]); } else if (rowData[c] instanceof Integer) { cell.setCellValue((Integer) rowData[c]); DataFormat format = workbook.createDataFormat(); CellStyle integerCellStyle = workbook.createCellStyle(); integerCellStyle.setDataFormat(format.getFormat("0")); cell.setCellStyle(integerCellStyle); } } } } }
I'm dealing with an older application that we recently updated from Java 8 to Java 11. In one part of the application, I have several XML files (XSDs) that are converted into Java classes using the Jaxb2 Maven plugin. It worked fine with Java 8, but after switching to Java 11, I encountered an error: 'code too large'. I know that in Java, a method or function can't exceed 65536 bytes in size. But it's puzzling why it worked with Java 8 and not with Java 11. I've spent two weeks on this issue, and I still don't understand why it worked before. The problem is, I can't split the code into smaller parts because of some limitations. I tried using another plugin called Castor, hoping it would solve the issue, but it also ran into the same problem. I experimented with different versions of both plugins, but none of them worked with Java 11. The rest of the application runs smoothly with Java 11. It's only when I change the Java version in the Maven plugin that I encounter this compilation error. Please help to get me out of this issue as I already have spent time alot. Thanks in advance. ``` <configuration> <release>8</release> <!-- working fine --> <release>11</release> <!-- problem --> <!--<compilerArgs><arg>-J-Xmx512m</arg></compilerArgs>--> </configuration> ``` This is the code for plugin Jaxb2 (Dependencies I added and plugin) # **pom.xml** ``` <dependency> <groupId>jakarta.xml.bind</groupId> <artifactId>jakarta.xml.bind-api</artifactId> <version>4.0.0</version> </dependency> <dependency> <groupId>com.sun.xml.bind</groupId> <artifactId>jaxb-impl</artifactId> <version>4.0.0</version> <scope>runtime</scope> </dependency> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.8.1</version> <configuration> <release>11</release> <!--<compilerArgs><arg>-J-Xmx512m</arg></compilerArgs>--> </configuration> </plugin> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>jaxb2-maven-plugin</artifactId> <version>3.1.0</version> <executions> <execution> <goals> <goal>xjc</goal> </goals> </execution> </executions> <configuration> <!-- The schema directory or xsd files. --> <!--<arguments> <arg>-XautoNameResolution</arg> </arguments>--> <sources> <source>src/main/resources/xsds</source> </sources> <xjbSources> <xjbSource>src/main/resources/xsds/bindings.xjb</xjbSource> </xjbSources> <!-- The package in which the source files will be generated. --> <packageName>com.example.java</packageName> <!-- The working directory to create the generated java source files. --> <outputDirectory>${project.build.directory}/generated-sources/jaxb/</outputDirectory> </configuration> </plugin> ``` **bindings.jxb** ``` <?xml version="1.0"?> <jaxb:bindings xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:jaxb="https://jakarta.ee/xml/ns/jaxb" xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc" xmlns:inheritance="http://jaxb2-commons.dev.java.net/basic/inheritance" jaxb:extensionBindingPrefixes="xjc" version="3.0"> <jaxb:bindings schemaLocation="../xml/afd/code.xsd" node="/xs:schema"> <jaxb:globalBindings typesafeEnumMemberName="generateName" typesafeEnumMaxMembers="4300"> <jaxb:serializable uid="1"/> </jaxb:globalBindings> </jaxb:bindings> </jaxb:bindings> ``` This is the configuration, I did for **Castor** plugin ``` <dependency> <groupId>org.codehaus.mojo</groupId> <artifactId>castor-maven-plugin</artifactId> <version>2.1</version> </dependency> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <!--<version>3.8.1</version>--> <configuration> <release>11</release> <!--<compilerArgs><arg>-J-Xmx512m</arg></compilerArgs>--> </configuration> </plugin> <!-- JAXB xjc plugin that invokes the xjc compiler to compile XML schema into Java classes.--> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>castor-maven-plugin</artifactId> <version>2.1</version> <executions> <execution> <id>generate-main-java-classes</id> <phase>generate-sources</phase> <goals> <goal>generate</goal> </goals> <configuration> <schemaDirectory>src/main/resources/xsds</schemaDirectory> <!--<bindingfile>src/main/resources/xsds/binding.xml</bindingfile>--> <packaging>com.example</packaging> <generateImportedSchemas>true</generateImportedSchemas> <descriptors>false</descriptors> <generateMappings>true</generateMappings> <dest>${project.build.directory}/generated-sources/jaxb/</dest> </configuration> </execution> </executions> </plugin> ``` I have simpletype in xsd as follow ``` <xs:simpleType name="CODES" > <!--<xs:annotation><xs:appinfo> <jaxb:globalBindings typesafeEnumMaxMembers="0" /> </xs:appinfo></xs:annotation>--> <xs:restriction base="fm:AN__5"> <xs:enumeration value="1000"/> <xs:enumeration value="1001"/> <xs:enumeration value="1002"/> <xs:enumeration value="1003"/> .... up to more than 4000 lines </xs:restriction> </xs:simpleType> ```
[devtools screenshot][1]I'm not a developer but working with one to try and get a fix for my web application. This specific issue is not happening on any desktop computer but appears to be happening on my MacBook Pro when using Safari (not Chrome) and my 5th Gen iPad in both Safari and Chrome. When I access a specific section of the program, it begins to 'tab' through every field on that page endlessly. When I check the network log it states 'PerformValidationActions' appears to be in a loop cycling through 'text1_enter' 'text1_leave' 'text2_enter' 'text2_leave' 'text3_enter' 'text3_leave' etc. It EVENTUALLY ends but then when you try to log out you get the error > Object reference not set to an instance of an object. Any help would be GREATLY appreciated! [1]: https://i.stack.imgur.com/POyPs.png
ASP.NET MVC web app looping between fields only on some devices
|html|typescript|asp.net-mvc|safari|
[enter image description here][1]When using Playwright (version 1.42.1) to test services hosted on the local machine using localhost or 127.0.0.1 with Chrome 108 and Chromium 100 browsers on Windows 7 Professional, the testing process is fast. However, when testing services hosted on the local machine's IP address (e.g., 10.132.xxx.xxx) or other IP addresses within the same intranet, the testing process becomes significantly slower. my code: import { test, expect } from '@playwright/test'; test('test', async ({page }) => { await page.goto('http://10.13.xxx.xxx:8080/test'); await page.getByRole('button', {name: "Login"}).click() await page.waitForTimeout(5000); }); Services can be any web project, such as a simple project containing multiple JavaScript files, Vue projects, etc Environment: Playwright Version: 1.42.1 Operating System: Windows 7 Professional Browsers: Chrome 108, Chromium 100 Network Condition: Intranet environment Playwright should be able to test services within the same intranet environment, including those hosted on the local machine's IP address, with similar performance as testing services using localhost or 127.0.0.1. [1]: https://i.stack.imgur.com/HClAr.png
My app exe file looses it's admin rights after inno tool installation. I implemented a python based app, which requires windows admin privileges when it is running. If I create my app bundle and configure the exe file with admin privilege  (`right click exe` > `properties` > `compatibility` > `change settings for all users` > `run this program as administrator`). Everything works fine, so if I execute the exe, it is started with admin rights. But if I configure the exe with admin rights (as I mentioned above) and generate a setup.exe via Inno Tool, the exe file looses its admin configuration after installation. So the app exe has always normal user privileges after execution. The check **"run this program as administrator"** is gone. Sure, the users can set **"run this program as administrator"** configuration manually, but it is really unprofessional. Does anyone know where I am making mistake or it is there any other method to do that? Note: 1. My Inno setup exe has also admin rights. 2. This is my inno configuration: Relevant Code part: ```ini ; Script generated by the Inno Setup Script Wizard. ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! PrivilegesRequired=admin [Registry] Root: HKA; Subkey: "Software\Classes\{#MyAppAssocExt}\OpenWithProgids"; ValueType: string; ValueName: "{#MyAppAssocKey}"; ValueData: ""; Flags: uninsdeletevalue Root: HKA; Subkey: "Software\Classes\{#MyAppAssocKey}"; ValueType: string; ValueName: ""; ValueData: "{#MyAppAssocName}"; Flags: uninsdeletekey Root: HKA; Subkey: "Software\Classes\{#MyAppAssocKey}\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\{#MyAppExeName},0" Root: HKA; Subkey: "Software\Classes\{#MyAppAssocKey}\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\{#MyAppExeName}"" ""%1""" Root: HKA; Subkey: "Software\Classes\Applications\{#MyAppExeName}\SupportedTypes"; ValueType: string; ValueName: ".myp"; ValueData: "" Root: "HKLM"; Subkey: "SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers"; ValueType: String; ValueName: "{app}\{#MyAppExeName}"; \ ValueData: "~RUNASADMIN"; Flags: uninsdeletekey noerror ```
SwiftUI Menu item misaligned vertically in an HStack
|swiftui|hstack|
I'm working on a Python program that reverses a linked list using recursion. I've implemented the reversal function and added print statements to help me understand the process. However, when I include certain print statements, the program hangs and doesn't complete. The reversal seems to work fine without those print statements. ```python class ListNode: def __init__(self, val=0, next=None): self.val = val self.next = next def __repr__(self): next = self.next val = self.val out = f"ListNode({val}, " count_paren = 1 while next is not None: val = next.val out += f"ListNode({val}, " next = next.next count_paren += 1 out += f"{next}" out += count_paren * ")" return out def reverse(head): if not head or not head.next: return head print("1 HEAD", head) new_head = reverse(head.next) print("2 NEW_HEAD", new_head) head.next.next = head print("3 HEAD", head) print("4 NEW_HEAD", new_head) head.next = None print("5 HEAD", head) print("6 NEW_HEAD", new_head) return new_head lst = ListNode(1, ListNode(2, ListNode(3, ListNode(4, ListNode(5))))) print(lst) print(reverse(lst)) ``` Without the print statements: ``` print("3 HEAD", head) print("4 NEW_HEAD", new_head) ``` the reversal works fine. However, if I uncomment those lines, the program hangs. I would appreciate any insights into why this is happening and how I can modify the print statements to understand the process better without causing the hang. I am using python version of `3.11.2`.
Recursive Linked List Reversal Hangs with Print Statements
|python|recursion|linked-list|
{"Voters":[{"Id":14732669,"DisplayName":"ray"},{"Id":16217248,"DisplayName":"CPlus"},{"Id":9455518,"DisplayName":"Hamed"}]}
You could pass a function to the `key` parameter to [the `.sort` method](https://docs.python.org/3/library/stdtypes.html#list.sort). With this, the system will sort by int(x) instead of x. list1.sort(key=int) ---- BTW, to convert the list to integers permanently, use [the `map` function](http://docs.python.org/library/functions.html#map) list1 = list(map(int, list1)) # you don't need to call list() in Python 2.x or list comprehension list1 = [int(x) for x in list1]
while creating exposure I am getting the below error. The logs just show DBNullConstraintException, so I could not find which entity or column is causing the issue. I am not sure how can i do analysis on this issue? Log details: ERROR Displaying to the user an exception message that is not a UserDisplayableException in context ID 'NewExposure' com.guidewire.pl.system.exception.DBNullConstraintException: at com.guidewire.pl.system.database.entitywriter.DatabaseEntityWriterImpl.checkForNullConstraintViolation(DatabaseEntityWriterImpl.java:227) ~[pl-10.101.0.jar:?] at
**Add this Bean to your Main Application** @Bean AuditorAware<String> auditorProvider() { // override getCurrentAuditor method to provide the current user return () -> Optional.of(SecurityContextHolder.getContext().getAuthentication().getName()); }
I have a `FloatingActionButton` that changes its icon to a pause icon when clicked. How can I toggle the icon back to the play icon when the button is clicked again? **Here's the relevant part of my code:** AnimatedBuilder( animation: controller, builder: (context, child) { return FloatingActionButton.extended( onPressed: () { if (controller.isAnimating) { controller.stop(); } else { controller.reverse( from: controller.value == 0.0 ? 1.0 : controller.value); } }, icon: Icon( controller.isAnimating ? Icons.pause : Icons.play_arrow, color: Color(0xffF2F2F2), ), label: Text(controller.isAnimating ? "Pause" : "Play"), ); } ), **Explanation:** I want to be able to switch seamlessly between a play icon (`Icons.play_arrow`) and a pause icon (`Icons.pause`) on my button with each click.
How to toggle between play and pause icons in Flutter button?
|flutter|dart|user-interface|floating-action-button|iconbutton|
If you want exact matches for the commands to be ignored: `$export HISTIGNORE="history:exit"` Put the above shell variable export in your `.bashrc` file so that the next time you login to bash the earlier `HISTIGNORE` setting continues to be effective. If you don't want any lines beginning with the `history` command, like `history -a` then put this into your `.bashrc` file: `$export HISTIGNORE="history*:exit"` If you don't want any commands to be saved into the history, put: `$export HISTIGNORE="*"` Check your `HISTIGNORE` setting: `$echo "$HISTIGNORE"` From `man bash`: Each colon-separated list of patterns is anchored at the beginning of the line and must match the complete line. (no implicit '*' is appended). Each pattern is tested against the line after the checks specified by `HISTCONTROL` are applied.
I think your approach and query are almost correct with only a few mistakes. Below is the revised version of your query that may work: DELETE FROM BIGQUERY_TABLE WHERE STRUCT(Timestamp, column_1, column_2, column_3, column_4) IN ( SELECT AS STRUCT Timestamp, column_1, column_2, column_3, column_4 FROM ( SELECT *, ROW_NUMBER() OVER(PARTITION BY Timestamp, column_1, column_2, column_3, column_4 ORDER BY Timestamp) as rn FROM BIGQUERY_TABLE WHERE Timestamp > 1709424000000 AND Timestamp < 1709510400000 ) WHERE rn > 1 );
To disable precaching in case of **injectManifest** you can simply do this in sw.js file . Do remember self.__WB_MANIFEST can have only one instance in the file. sometime commented code can also give error. <!-- begin snippet: js hide: false console: false babel: false --> <!-- language: lang-js --> // eslint-disable-next-line no-restricted-globals const ignored = self.__WB_MANIFEST; // Your custom service worker code goes here. <!-- end snippet --> [Reference : https://create-react-app.dev/docs/making-a-progressive-web-app/#customization][1] [1]: https://create-react-app.dev/docs/making-a-progressive-web-app/#customization
**About** I am trying to post Listing in Ebay Trading API. As we can see that there is brand info mentioned as per the Ebay API documentation here: https://developer.ebay.com/devzone/xml/docs/Reference/eBay/AddItem.html#Input but still it gives below error. Am I missing anything in the XML? **Error details** > The item specific Brand is missing. Add Brand to this listing, enter a > valid value, and then try again. **XML** <!-- begin snippet: js hide: false console: true babel: false --> <?xml version="1.0" encoding="utf-8"?> <AddItemRequest xmlns="urn:ebay:apis:eBLBaseComponents"> <RequesterCredentials> <eBayAuthToken>authToken</eBayAuthToken> </RequesterCredentials> <Item> <Brand>Furhaven</Brand> <BuyerProtection>ItemIneligible</BuyerProtection> <ConditionID>1000</ConditionID> <Title>Apple iPhone 12 Pro Max 256GB Pacific Blue Unlocked - Excellent Condition</Title> <Description>This listing is for a gently used Apple iPhone 12 Pro Max in the Pacific Blue color variant. The phone is unlocked and has a storage capacity of 256GB, providing ample space for your apps, photos, and videos.The phone has been well-maintained and is in excellent condition with minimal signs of wear. It has been tested and verified to be fully functional. The screen is free of scratches or cracks, and the body of the phone may have minor cosmetic imperfections consistent with normal use.Included with the phone are the original box and accessories, including the charging cable and adapter. The phone will be securely packaged for shipping.</Description> <PictureDetails> <GalleryType>Gallery</GalleryType> <PhotoDisplay>PicturePack</PhotoDisplay> <PictureURL>https://www.pexels.com/photo/bridge-near-waterfall-358457/</PictureURL> <ExternalPictureURL>https://www.pexels.com/photo/bridge-near-waterfall-358457/</ExternalPictureURL> </PictureDetails> <ReturnPolicy> <ReturnsAcceptedOption>ReturnsAccepted</ReturnsAcceptedOption> <RefundOption>MoneyBack</RefundOption> <ReturnsWithinOption>Days_30</ReturnsWithinOption> <ShippingCostPaidByOption>Buyer</ShippingCostPaidByOption> </ReturnPolicy> <PostalCode>33181</PostalCode> <ShippingDetails> <CalculatedShippingRate> <OriginatingPostalCode>33181</OriginatingPostalCode> <PackagingHandlingCosts currencyID="USD">0.0</PackagingHandlingCosts> </CalculatedShippingRate> <ShippingServiceOptions> <ShippingService>UPSGround</ShippingService> <ShippingServicePriority>2</ShippingServicePriority> </ShippingServiceOptions> </ShippingDetails> <ProductListingDetails> <BrandMPN> <Brand>iPhone 12 Pro Max</Brand> <MPN>MGDC3LL/A</MPN> </BrandMPN> <IncludeeBayProductDetails>true</IncludeeBayProductDetails> </ProductListingDetails> <ShippingPackageDetails> <ShippingPackage>USPSLargePack</ShippingPackage> <WeightMajor unit="lbs">6</WeightMajor> <WeightMinor unit="oz">0</WeightMinor> </ShippingPackageDetails> <Location>San Jose</Location> <PrimaryCategory> <CategoryID>137865</CategoryID> </PrimaryCategory> <StartPrice>10.00</StartPrice> <Currency>USD</Currency> <Country>US</Country> <DispatchTimeMax>3</DispatchTimeMax> <ListingDuration>Days_7</ListingDuration> </Item> </AddItemRequest> <!-- end snippet --> **Updated XML** <?xml version="1.0" encoding="utf-8"?> <AddItemRequest xmlns="urn:ebay:apis:eBLBaseComponents"> <RequesterCredentials> <eBayAuthToken>authToken</eBayAuthToken> </RequesterCredentials> <Item> <BrandMPN> <Brand>iPhone 12 Pro Max</Brand> <MPN>MGDC3LL/A</MPN> </BrandMPN> <Brand>iPhone 12 Pro Max</Brand> <BuyerProtection>ItemIneligible</BuyerProtection> <ConditionID>1000</ConditionID> <Title>Apple iPhone 12 Pro Max 256GB Pacific Blue Unlocked - Excellent Condition</Title> <Description>This listing is for a gently used Apple iPhone 12 Pro Max in the Pacific Blue color variant. The phone is unlocked and has a storage capacity of 256GB, providing ample space for your apps, photos, and videos.The phone has been well-maintained and is in excellent condition with minimal signs of wear. It has been tested and verified to be fully functional. The screen is free of scratches or cracks, and the body of the phone may have minor cosmetic imperfections consistent with normal use.Included with the phone are the original box and accessories, including the charging cable and adapter. The phone will be securely packaged for shipping.</Description> <PictureDetails> <GalleryType>Gallery</GalleryType> <PhotoDisplay>PicturePack</PhotoDisplay> <PictureURL>https://www.pexels.com/photo/bridge-near-waterfall-358457/</PictureURL> <ExternalPictureURL>https://www.pexels.com/photo/bridge-near-waterfall-358457/</ExternalPictureURL> </PictureDetails> <ReturnPolicy> <ReturnsAcceptedOption>ReturnsAccepted</ReturnsAcceptedOption> <RefundOption>MoneyBack</RefundOption> <ReturnsWithinOption>Days_30</ReturnsWithinOption> <ShippingCostPaidByOption>Buyer</ShippingCostPaidByOption> </ReturnPolicy> <PostalCode>33181</PostalCode> <ShippingDetails> <CalculatedShippingRate> <OriginatingPostalCode>33181</OriginatingPostalCode> <PackagingHandlingCosts currencyID="USD">0.0</PackagingHandlingCosts> </CalculatedShippingRate> <ShippingServiceOptions> <ShippingService>UPSGround</ShippingService> <ShippingServicePriority>2</ShippingServicePriority> </ShippingServiceOptions> </ShippingDetails> <ProductListingDetails> <BrandMPN> <Brand>iPhone 12 Pro Max</Brand> <MPN>MGDC3LL/A</MPN> </BrandMPN> <IncludeeBayProductDetails>true</IncludeeBayProductDetails> </ProductListingDetails> <ShippingPackageDetails> <ShippingPackage>USPSLargePack</ShippingPackage> <WeightMajor unit="lbs">6</WeightMajor> <WeightMinor unit="oz">0</WeightMinor> </ShippingPackageDetails> <Location>San Jose</Location> <PrimaryCategory> <CategoryID>137865</CategoryID> </PrimaryCategory> <StartPrice>10.00</StartPrice> <Currency>USD</Currency> <Country>US</Country> <DispatchTimeMax>3</DispatchTimeMax> <ListingDuration>Days_7</ListingDuration> </Item> </AddItemRequest> **Error Details** <Errors> <ShortMessage>The item specific Brand is missing.</ShortMessage> <LongMessage>The item specific Brand is missing. Add Brand to this listing, enter a valid value, and then try again.</LongMessage> <ErrorCode>21919303</ErrorCode> <SeverityCode>Error</SeverityCode> <ErrorParameters ParamID="0"> <Value>The item specific Brand is missing.</Value> </ErrorParameters> <ErrorParameters ParamID="1"> <Value>The item specific Brand is missing. Add Brand to this listing, enter a valid value, and then try again.</Value> </ErrorParameters> <ErrorParameters ParamID="2"> <Value>Brand</Value> </ErrorParameters> <ErrorClassification>RequestError</ErrorClassification> </Errors> <Version>1353 </Vers
[network logs][1]When using Playwright (version 1.42.1) to test services hosted on the local machine using localhost or 127.0.0.1 with Chrome 108 and Chromium 100 browsers on Windows 7 Professional, the testing process is fast. However, when testing services hosted on the local machine's IP address (e.g., 10.132.xxx.xxx) or other IP addresses within the same intranet, the testing process becomes significantly slower. my code: import { test, expect } from '@playwright/test'; test('test', async ({page }) => { await page.goto('http://10.13.xxx.xxx:8080/test'); await page.getByRole('button', {name: "Login"}).click() await page.waitForTimeout(5000); }); Services can be any web project, such as a simple project containing multiple JavaScript files, Vue projects, etc Environment: Playwright Version: 1.42.1 Operating System: Windows 7 Professional Browsers: Chrome 108, Chromium 100 Network Condition: Intranet environment Playwright should be able to test services within the same intranet environment, including those hosted on the local machine's IP address, with similar performance as testing services using localhost or 127.0.0.1. [1]: https://i.stack.imgur.com/HClAr.png
My app exe file looses it's admin rights after inno tool installation. I implemented a python based app, which requires windows admin privileges when it is running. If I create my app bundle and configure the exe file with admin privilege  (`right click exe` > `properties` > `compatibility` > `change settings for all users` > `run this program as administrator`). Everything works fine, so if I execute the exe, it is started with admin rights. But if I configure the exe with admin rights (as I mentioned above) and generate a setup.exe via Inno Tool, the exe file looses its admin configuration after installation. So the app exe has always normal user privileges after execution. The check **"run this program as administrator"** is gone. Sure, the users can set **"run this program as administrator"** configuration manually, but it is really unprofessional. Does anyone know where I am making mistake or it is there any other method to do that? Note: 1. My Inno setup exe has also admin rights. 2. This is my inno configuration: Relevant Code part: ```ini ; Script generated by the Inno Setup Script Wizard. ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! PrivilegesRequired=admin [Registry] Root: "HKLM"; Subkey: "SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers"; ValueType: String; ValueName: "{app}\{#MyAppExeName}"; \ ValueData: "~RUNASADMIN"; Flags: uninsdeletekey noerror ```
[image:network logs ][1]When using Playwright (version 1.42.1) to test services hosted on the local machine using localhost or 127.0.0.1 with Chrome 108 and Chromium 100 browsers on Windows 7 Professional, the testing process is fast. However, when testing services hosted on the local machine's IP address (e.g., 10.132.xxx.xxx) or other IP addresses within the same intranet, the testing process becomes significantly slower. my code: import { test, expect } from '@playwright/test'; test('test', async ({page }) => { await page.goto('http://10.13.xxx.xxx:8080/test'); await page.getByRole('button', {name: "Login"}).click() await page.waitForTimeout(5000); }); Services can be any web project, such as a simple project containing multiple JavaScript files, Vue projects, etc Environment: Playwright Version: 1.42.1 Operating System: Windows 7 Professional Browsers: Chrome 108, Chromium 100 Network Condition: Intranet environment Playwright should be able to test services within the same intranet environment, including those hosted on the local machine's IP address, with similar performance as testing services using localhost or 127.0.0.1. [1]: https://i.stack.imgur.com/HClAr.png
{"Voters":[{"Id":49849,"DisplayName":"user1686"}]}
{"Voters":[{"Id":209103,"DisplayName":"Frank van Puffelen"},{"Id":12265927,"DisplayName":"Puteri"},{"Id":9455518,"DisplayName":"Hamed"}]}
{"Voters":[{"Id":1016004,"DisplayName":"Robin De Schepper"},{"Id":354577,"DisplayName":"Chris"},{"Id":9455518,"DisplayName":"Hamed"}]}
I installed FreeRadius on Ubunto and I'm trying to understand how configure it to authenticate against Active Directory. I'm kinda new to linux so I followed the user guides and some forums thread to configure Samba, MSCHAP and ntlm_auth. When I try to test it using the command: "radtest -t mschap testing password localhost 0 testing123" I get the error: (0) mschap: ERROR: Program returned code (2) and output 'Failed to execute "/etc/freeradius/3.0/mods-enabled/ntlm_auth": Permission denied' (0) mschap: External script failed (0) mschap: ERROR: External script says: Failed to execute "/etc/freeradius/3.0/mods-enabled/ntlm_auth": Permission denied (0) mschap: ERROR: MS-CHAP2-Response is incorrect I don't understand what am I missing in the configuration. would appreciate some help I tried setting explicit permissions manually on ntlm_auth but that didn't help. I got another error: (0) mschap: ERROR: Program returned code (2) and output 'Failed to execute "/etc/freeradius/3.0/mods-enabled/ntlm_auth": Exec format error' (0) mschap: External script failed (0) mschap: ERROR: External script says: Failed to execute "/etc/freeradius/3.0/mods-enabled/ntlm_auth": Exec format error (0) mschap: ERROR: MS-CHAP2-Response is incorrect Thanks
FreeRadius "failed to execute ntlm_auth: permission denied"
|freeradius|
null
I have this problem from school, (below is my code), i can turn the characters into uppeercase, but i dont know how to stop getting input, normally my teacher would give something like "the input ends when it encounter '1'", but this time his test case is just normal text: **the problem:** Description Given a TEXT, write a program that converts the TEXT to upper-case. Example Input Hello John, How are you? Bye, Output HELLO JOHN, HOW ARE YOU? BYE, **my code:** ``` #include <stdio.h> int main(){ char c; while(1){ scanf("%c", &c); if(c == EOF) break; else{ c = toupper(c); printf("%c", c); } } return 0; } ``` my code proccesses uppercase request fine, but it never ends. Can you help me, thank you very much!
Turning words into uppercase in C
|c|
{"Voters":[{"Id":3225495,"DisplayName":"BJ Myers"},{"Id":354577,"DisplayName":"Chris"},{"Id":9455518,"DisplayName":"Hamed"}]}
{"Voters":[{"Id":20287183,"DisplayName":"HangarRash"},{"Id":354577,"DisplayName":"Chris"},{"Id":9455518,"DisplayName":"Hamed"}]}
I would say, 1) to remove `unique=True` and use a DB constrain to keep the uniqueness and allow empty values. If you really want to use `CharField` for this. Or 2) Use `EmailField` and removed `unique=True`. Which is more convenient, suitable and **which is build for this**. ___ And make sure to delete old DB migrations and run makemigrations and migrate. Thanks.
You can create it by setting pageCount to Int.MAX_VALUE and getting modulus of current page to get index for your list of items. @Preview @Composable private fun Test() { val pageCount = Int.MAX_VALUE val items = listOf("A", "B", "C") val pagerState = rememberPagerState( initialPage = pageCount / 2 ) HorizontalPager( modifier = Modifier.fillMaxWidth(), pageCount = pageCount, state = pagerState ) { Text(text = items[it % 3]) } } <h2>Edit</h2> As of Compose version 1.6.0 `Int.MAX_VALUE(2147483647)` causes pager to have ANR, to prevent this add a big number but smaller than 2147483647 that user won't bother to scroll that far. @Preview @Composable private fun InfinitePagerSample() { Column( modifier = Modifier .fillMaxSize() .padding(16.dp) .border(2.dp, Color.Red) ) { val items = remember { listOf("A", "B", "C") } val pageCount = items.size * 400 val pagerState = rememberPagerState( initialPage = pageCount / 2, pageCount = { pageCount } ) HorizontalPager( modifier = Modifier.fillMaxWidth(), state = pagerState, beyondBoundsPageCount = 1 ) { val color = if (it % items.size == 0) { Color.Red } else if (it % items.size != 1) { Color.Yellow } else Color.Green Column(modifier = Modifier.fillMaxSize().background(color)) { SideEffect { println("Page $it, composing...") } Text(text = items[it % 3], modifier = Modifier.fillMaxSize(), fontSize = 70.sp) } } } }
null
null
The issue is simple: you're confusing the `datasets` library with PyTorch's `Dataset` class. Your import statement should target PyTorch's dataset-handling facilities, not another library. Ensure you're using `from torch.utils.data import Dataset` to get the correct base class for your custom dataset. In your `CustomDataset` class, your approach to loading and indexing data is conceptually correct but misplaced in the context of PyTorch's ecosystem. Your dataset should return data in PyTorch tensors, not raw values from a pandas DataFrame. Convert your DataFrame columns to tensors within the `__getitem__` method, ideally, to ensure compatibility with PyTorch's data loaders and model expectations. The AttributeError you're facing is because the `datasets` library expects a different structure for dataset objects, including metadata attributes like `_info`, which are irrelevant to your use case. Stick to PyTorch's `Dataset` class, and you'll be set.
|swift|
INotifyDataErrorInfo - Red border doesn't disappear when error is cleared
I've been working on a DBO that requires a new code going through. I have to manually add a specific code to my requirements in a column that has thousands of rows. The issue is, some are already populated and I need to add them into the next available empty column. its currently in this format: [current data](https://i.stack.imgur.com/pG96Y.png) I need to add Code Z987 to the first NULL of each ID
You can use `ggplot2::after_stat()` to set the `color` after the statistical transformation has been applied. ``` r library(dplyr) library(ggplot2) library(ggdist) # Example data (replace this with your actual data) set.seed(123) data <- data.frame( variable = rep(c("Variable1", "Variable2", "Variable3"), each = 300), correlation = c(rnorm(300, 0.2, 0.1), rnorm(300, 0.4, 0.1), rnorm(300, 0.6, 0.1)) ) ggplot(data, aes(x = variable, y = correlation)) + stat_dots( aes(color = after_stat( case_when( abs(y) < 0.3 ~ "Small", abs(y) >= 0.3 & abs(y) < 0.5 ~ "Medium", abs(y) >= 0.5 ~ "Strong" ) )), quantiles = 50, position = position_dodge(width = 0.8) ) + scale_color_manual( values = c("Small" = "blue", "Medium" = "green", "Strong" = "red") ) + theme_minimal() + labs( title = "Posterior Draws of Correlation Coefficients", subtitle = "Dots colored by correlation strength", x = "Variable", y = "Correlation Coefficient", color = "Correlation Strength" ) ``` ![](https://i.imgur.com/UwXCjSl.png)<!-- -->
null
Error Required Param value not set Code: SELECT id_vst, CASE WHEN id_sys = 155 THEN CAST('Вид' AS varchar(80)) ELSE CAST(' ' AS varchar(80)) END AS result FROM DOC_ACC_CNT
Work in FastReport send SQL code and error Required Param value not set
I have solved the problem, below is my implementation. ```javascript { accessorKey: "apps", header: ({ column }) => ( <Button variant="ghost" onClick={() => column.toggleSorting(column.getIsSorted() === "asc")} > App Names <ArrowUpDown className="ml-2 h-4 w-4" /> </Button> ), cell: ({ row }) => { const apps: AppsType[] = row.getValue("apps"); return apps.map((app, index) => <div key={index}>{app.name}</div>); }, filterFn: ( row: Row<MainCampaign>, _cloumnId: string, filterValue: string ) => { const apps: AppsType[] = row.getValue("apps"); return apps.some((app) => app.name.toLowerCase().includes(filterValue.toLowerCase()) ); }, }, ``` And then this is my data-table ```javascript const table = useReactTable({ data, columns, getCoreRowModel: getCoreRowModel(), getPaginationRowModel: getPaginationRowModel(), onSortingChange: setSorting, getSortedRowModel: getSortedRowModel(), onColumnFiltersChange: setColumnFilters, getFilteredRowModel: getFilteredRowModel(), onPaginationChange: setPagination, filterFns: { apps: (row, _columnId, value) => { const apps: AppsType[] = row.getValue("apps"); const appsNameArr: string[] = apps.map((app) => app.name.toLowerCase()); return appsNameArr.some((name) => name.toLowerCase().includes(value)); }, }, state: { sorting, columnFilters, pagination, }, }); ``` I did a bit of cleanup, extracted my filter function in util.ts so it would be like this. ```javascript { accessorKey: "apps", header: ({ column }) => ( ... ), cell: ({ row }) => { ... }, filterFn: customFilterFn, }, ``` ```javascript // data-table.tsx const table = useReactTable({ data, ... filterFns: { apps: customFilterFn, }, state: { ... }, }); ```
I am currently finding a solution to solve the data importing issue. When I imported the records over 2000 with Excel file, the web going down. Then I searched error log in the server found out the following. Web servers using `nginx` and database is `mysql`. The web is with Python. Could any one suggest what I am missing? Log: 2024/03/10 13:47:34 [error] 431467#431467: *5870 upstream prematurely closed connection while reading response header from upstream, client: 172.70.116.166, server: xxxxxx.com, request: "POST /upload_excelData/ HTTP/1.1", upstream: "http://unix:/xxxxx.sock:/upload_excelData/", host: "www.xxxxx.com", referrer: "https://www.xxxxxx.com/doe_upload/" I tried to edit the `Nginx` proxy connection timeout setting but not work. I am expecting to import large Excel data which may be 10,000 or more.
You can use `fontWeight : "bold"` or `fontWeight : "bolder"`
Well, you can try to do form validation using Yup with validationSchema. And also you should use ```useFormik``` hook instead of ```Formik``` component. Then you may reach the correct response. For example ``` const formik = useFormik({ initialValues, validationSchema: registrationSchema, ... the code that you want ``` ``` const registrationSchema = Yup.object().shape({ fieldName: Yup.string() .oneOf([Yup.ref('')], "example commit"), ``` Maybe, you will get success.
I am using `differential_evolution` from `scipy` with `workers` to parallel the calculations. And I switch to `pytorch` from `numpy` to speed up the code. ``` from torch.multiprocessing import set_start_method,Pool if __name__ == '__main__': #device = get_device() device = torch.device('cpu') # testing with cpu num_workers=int(sys.argv[1]) set_start_method("spawn",force=True) pool=Pool(num_workers) results = differential_evolution(likelihood, seed=np.random.seed(0),workers=pool.map, callback=print_de, bounds=bounds, maxiter=1500, disp=True,recombination=0.1,mutation=(0.9,1), constraints=NonlinearConstraint(positive_definite, lb=0, ub=np.inf), popsize=25, polish=False ) ``` In my own laptop this works fine either using `torch.multiprocessing` or `multiprocessing` (simply set `workers=int(sys.argv[1])`). When I test this in HPC with 256 cores in 1 node, it slows down a lot. Using `torch.multiprocessing` is faster than `multiprocessing`, but still one iteration is much slower than when I don't do parallel. When I use `top`, I can see the correct number of `python` instances are running, but the cpu usage is more than 100%, some even with 1000% per `python`, can this be the problem? When I use `numpy` the cpu usage is almost 100%. How can I solve the problem?
multiprocessing slow down in HPC when using torch
|python-3.x|numpy|pytorch|scipy|multiprocessing|
although not perfect, if you type "warning: Hello" you will see it in the log as a warning echo "warning: Hello"
You try this code to solve your issue: <a href="{% url 'download_wav' filename='your_wav_filename.wav' %}">Download .wav File</a>
Referencing method within the child of the wrapper class project
How to send click to minimized window with ahk library in python I want to send a click event on a window without having to pop it up. I have tried many ways but have not found the best and most concise way. Thanks everyone.
How to send click to minimized window with ahk library in python