VN:F [1.9.22_1171]
Rating: 9.4/10 (10 votes cast)

Random snippets of all sorts of code, mixed with a selection of help and advice.


19 January 2022 @ 10:40 pm

We use multithread and apparently when we have two threads processing, this error occurs. I've tried to reproduce it locally but of course, without success. Other than that, I haven't found much useful information on why it happens and how to fix it. Does anyone have any ideas? According to the logs, errors happen after the line marked with comment above public async Task ProcessarTransacoes() { _logger.LogInformation("Buscando Transacoes para serem enviadas"); var transacoes = await _transacaoRepository.GetTransacoesARPorStatusAsync(TransacaoStatus.EmCriacao); Parallel.ForEach(transacoes, new ParallelOptions { MaxDegreeOfParallelism = _config.MaximoThreadsProcessamento }, async transacao => { // ----- after this log _logger.LogInformation("Enviando Transacao {0} para a Fila do Rabbit", transacao.IdTransacao); var mensagem = new Mensagem() { IdTransacao = transacao.IdTransacao };

How to create cascade drop down list inside the grid?

19 January 2022 @ 10:40 pm

I tried like this but on click of the column "Product xx" the value disapear also after select the ID apear not the value. <!DOCTYPE html> <html> <head> <base href=""> <style>html { font-size: 14px; font-family: Arial, Helvetica, sans-serif; }</style> <title></title> <link rel="stylesheet" href="" /> <script src=""></script> <script src=""></script> </head> <body> <script src="../content/shared/js/

How to Create Show/Hide button when Looping in React

19 January 2022 @ 10:40 pm

I am working on a development site and am having an issue. The issue is that I am looping over the data file in order to create some project cards. Each project card has a show more/show less button to display/hide card descriptions. My problem is that the current setup is mapping over the data and causing it so that whenever one gets clicked, all three either open or close simultaneously. Please help me to fix this issue. Relevant code is shown below: Data example: { name: "Hot in the Biscuit", id: "3a34", image: "/images/bonnie.jpg", description: "A multi-page front-end business website for a local restaurant in Koh Samui, Thailand. Custom design built with vanilla JavaScript, HTML and CSS.", link: "", date: "2021", github: "" }, Hero file where Showcase Component is rendered:

'Unexpected token, expected ")"' on catch block when adding Typescript to ReactJS project?

19 January 2022 @ 10:40 pm

I'm converting a ReactJS project to use Typescript. When I compile the project, on the catch block in try/catch statements, ... } catch (e: any) { console.log(e); } I get the following error Syntax error: Unexpected token, expected ")" (243:15) 241 | ... 242 | }); > 243 | } catch (e: any) { | ^ 244 | console.log(e); 245 | } 246 | }; This is my tsconfig.json { "compilerOptions": { "target": "ES2017", "lib": ["dom", "dom.iterable", "esnext"], "allowJs": true, "skipLibCheck": true, "esModuleInterop": true, "allowSyntheticDefaultImports": true, "strict": true, "forceConsistentCasingInFileNames": true, "noFallthroughCasesInSwitch&qu

ZSH Shell: source in a sh file

19 January 2022 @ 10:40 pm

I am running ZSH Shell as my default terminal on a Ubuntu 20.04 LTS Desktop. echo $SHELL /bin/zsh When I run the following commands set -a; source .override_dev_env; set +a, the source .override_dev_env occurs smoothly. However, if I put the same command in a sh file, the the .override_dev_env file is not sourced, even with the she-bang (#!/bin/bash or #!/bin/zsh ). Would anyone give a direction on how to source the .override_dev_env in sh file run on zsh terminal? Again, the code bellow will not work either #####################!/bin/bash #!/bin/zsh set -a; source .override_dev_env; set +a

Equation Formula Review/Proof

19 January 2022 @ 10:40 pm

I hope everyone's healthy and happy and enjoying the sun. (if in the Southern Hemisphere) Would somebody mind having a quick check over so the below to know if I'm applying the correct methodology for required application The Question; I've decried to put all our garden sprinkler settings into excel to help calculate usage, costs while trying to optimise watering settings. The general formula I am using is; (I've included a image for an example) Cost=(R/1000)*L L=(Flow*T)*Nodes​ T=Min*D​ D=ROUNDDOWN((End-Start+1)/Interval,0)​ Where; R = Cost Per 1KL L = Total Litres Used T = Total Run Time Cost per 1 Kilolitres= 2.99 Flow = 1.6 (Flow Rate Per/Min of 1x 90° Sprinkler Head) Nodes = Amount of Sprinkler Heads Min = Watering Run Time in Minutes Start = Watering Start Date End = Watering End Date Interval

Selecting value between two dates

19 January 2022 @ 10:39 pm

Here i am trying to calcualte grand total from column H when column E which is date range has date between two dates ( dtst and dtet). For some reason its not working result coming 0. any help here ? Option Explicit Sub Compare() Dim NumberOfValues As Long Dim value3, value4, value5 As Long Dim i As Long Dim dtst, dtet As Date dtst = CDate(3 / 1 / 2022) dtet = CDate(6 / 30 / 2022) NumberOfValues = Sheets("backuplist_PPBAMR301P_2021-12-2").Range("B2").End(xlDown).Row value3 = 0 Application.Calculation = xlManual Application.ScreenUpdating = False For i = 2 To NumberOfValues If Range("C" & i).Value <> "*REPLICATE*" Then If CDate(Range("E" & i).Value) >= dtst And CDate(Range("E" & i).Value) <= dtet Then If Range("M" & i).Value = 1 Or Range("M" & i).Value = 0 Then value3 = value3 + Range("H"

GridView.builder does not fit into the container in flutter. It starts with a padding to return containers

19 January 2022 @ 10:39 pm

I am trying to provide a responsive design for a 6x6 chess board and equal containers adjacent to it. GridView.builder with SliverGridDelegateWithFixedCrossAxisCount does not fit into the middle container of the column in flutter. It starts with a padding/bias/margin to return simple color containers. (the Static.blackSquares is just a list includes integers for index) I have tried to make it scrollable and it's scrolled up as a whole and perfectly fit there. Interesting. an example screen: the height of that green margin changes in different screens class GridViewResponsive extends StatelessWidget { List pieces = [ // [position, piece, color, selected, possible kill] // black pieces [0, 'x', '', '', ''], [1, 'x', '', '', ''], [2, 'x', '', '', ''], [3, 'x', '', '', ''], [4, 'x', '', '', ''], [5, 'x', '', '', ''], [6, 'x', '', '', ''], [7, 'x', '',

Duplicate textfield widgets in the KiviMD dialog

19 January 2022 @ 10:39 pm

Why when clicking change password button opens a dialog with duplicate textfield widgets? The code I wrote entirely in .py codes works fine but was not clear. That's why I transcribed it into .kv language.

Python - Sarima/Sarimax - creation of an output table for multiple predictions

19 January 2022 @ 10:34 pm

I'm currently working on a project and I'm not quite sure how to best implement the next step, so I'd appreciate suggestions and feedback. In my data a certain date can occur several times, because I forecast the sales by zipcode. Example of the data structure The background to this is that I want to add weather to the zipcodes. To check afterwards if different weather parameters make a forecast of my models (SARIMA/SARIMAX) better. Afterwards I would like to have an output in a table, in which to all Zipcodes the RMSE of the Prediction is stored. It would also be good if parameters were selected for this by auto_arima. I would then compare these between SARIMA and SARIMAX, so that I can check how much % of the predictions have become better with external data. Currently the data is in a table with over 60 zipcodes. Does anyone have an idea or a function that I can use to create multiple