Quantcast
Channel: User Dorki - Stack Overflow
Browsing latest articles
Browse All 32 View Live

Comment by Dorki on List and edit all class declaration usages

The question is if there are pythonic ways to do so and not just a regex which makes the problem a bit more harder (need to take into consideration multi-line, comments and so on..)

View Article



Comment by Dorki on List and edit all class declaration usages

@Copperfield The problem is that there are thousands of UniqueException instances, how can I make a consistent random id for each one of them? by consistent I mean tomorrow I'll have an exception I...

View Article

Comment by Dorki on List and edit all class declaration usages

First of all thanks for your effort! I was thinking about a traceback as a unique ID, but the problem is whenever I'll make a changes in my code, e.g. deepen the traceback or change function names, it...

View Article

Comment by Dorki on How to avoid irresponsible app by rendering time...

@super How would I know if it has finished to load? I guess as ivanatias said I could use React.lazy

View Article

Comment by Dorki on Parse and manipulate date times with micro seconds

Hi Matthew, in date format just because the diff could be not only in ms, but it could be greater (e.g. totalDays could be >0)

View Article


Comment by Dorki on Changing React state after some other state has changed...

Thank you nullptr for the answer and Arkellys for the source! it's exactly what I needed and they use the same example idea as I just described! Please make an answer so I could accept it :-)

View Article

Comment by Dorki on Override the __str__ of ExceptionGroup to include the...

@ShadowRanger but then the traceback would be different, I want both str and the traceback to have the same string pattern, is there a way to retrieve the traceback string?

View Article

React js reset state of a component if the parent component has re-rendered

So I have that situation:I have a MovieList component that loop through Movie components,and In each Movie Component there is Text component that has a state to "ShowFullText" or not ( the default is...

View Article


react route direct to the same route not updating

So this is my situation:I have App.jsx that renders this:<BrowserRouter><Switch><Route path="/" exact component={MovieList} /><Route path="/search/:search" component={MovieList}...

View Article


Using React + D3 drag

I couldn't find a single example but this,D3-Drag: https://github.com/d3/d3-dragI want to use for example custom SVG, and be able to drag it with ReactI found this example to use only...

View Article

React component functionality

I found a nice draggable svg component here:https://gist.github.com/hashrock/0e8f10d9a233127c5e33b09ca6883ff4It's basically a Circle component with the ability to be draggable.But, I would like to add...

View Article

React JS inherit functionally to several components

I have a component with functionally, let's say if you click on it, it does: alert("Hello World");But now, let's say I want several components to have the same functionality, and these components can...

View Article

React default create-react-app App component rendered twice

I started new React project via the command:npx create-react-app my-app --template typescriptThen, I changed the App component to look like that:import * as React from 'react';export default class App...

View Article


Typescript access hashmap with string variable

I made this simple code:const testHashMap = { hello: "Hi", test: "Hey", blabla: "Halo"}const inputFromField : string = "hello";alert(testHashMap[inputFromField]);But the last line doesn't work because...

View Article

React / JS how to detect if component is being clicked but not anything inside

Not sure if this problem matches React or vanilla JS.but if I have this code:<div><span>Test</Span></div>I want to detect if someone clicked on the div element, but not on the...

View Article


Javascript how to check if my mouse is out of an element and everything...

Let's say I have this code:<div id="check-div"><span><!-- Can be some inside elements here too --></span><!-- Can be more elements here as well ... --></div>How can...

View Article

Answer by Dorki for React loop through map and display components

You guys gave great answers, but I found the simplest syntax:Array.from(myHashMap.entries()).map((entry) => { const [key, value] = entry; return (<MyComponent myKey={key} myValue={value} />);}

View Article


React loop through map and display components

So I have a unique situation,in my States I don't have a regular list that I can do map and then in each iteration to display a component, for example:list.map(shape => <Shape {...shape}...

View Article

React.js check if component exists

I have a list of components, and in real-time I want to whether components exists or not.For example I have a list of shapes ( they are components ): Circle, Square and more..And I want that the user...

View Article

Flexible pane exceed 100% height

It's basically CSS question, but since it's wrapped inside React, I tagged it as React as well.Demo to my problem: https://codesandbox.io/s/compassionate-bartik-z9lev(Those who don't know React, just...

View Article

How to clean canvas and re-draw again

So I made a simple example that if u click on a canvas, it keep drawing random lines,and it also pushes the current state into _history variable, and once you clicked on a "get previous" button, it pop...

View Article


How to run javascript code from string in safe way

I found some answers, but very old one and I wondered how can it be done?I've seen that eval() function isn't safe:Alternate for eval() to execute auto-generated JS code from the serverSo what are my...

View Article


JS question I got using async/sync/timings

I received a js interview question that I don't know how to solve, hopefully you guys could help me, so it goes like that:A company made this code:(note: goo() cannot return 0, both foo and goo return...

View Article

Understanding the event loop and partitioning in Node.js

I've read this nice doc guide: https://nodejs.org/en/docs/guides/dont-block-the-event-loop/And in some part of that article it's being said regarding to complex calculations without blocking the Event...

View Article

Fit canvas to screen in React

So I have this code base:import React, { useEffect, useRef, useState } from 'react';function App() { const container = useRef(null); const canvas = useRef(null); const [ctx, setCtx] =...

View Article


Visual Studio Code React not showing error even after adding jsconfig

So I am building a REACT JS project, and after a while I noticed that it doesn't underline undefined functions nor wrong imports, for example if I does that:import React, { useState } from...

View Article

Error: ValueWarning: A date index has been provided, but it has no associated...

So I have a CSV file with two columns: date and price, but when I tried to use ARIMA on that time series I encountered this error:ValueWarning: A date index has been provided, but it has no...

View Article

How to format selection with eslint

I found out that if I write in my settings.json that:"eslint.format.enable": true,"[javascriptreact]": {"editor.defaultFormatter": "dbaeumer.vscode-eslint", }Then I can format the whole page using ALT...

View Article

How to avoid td width expanding when it wrapped with enabled overflow and big...

I have a table with 2 columns, the first one should be 25% wide width and and 2nd one should be 75% wide.In the 2nd column, sometimes there's big content, therefore, I made a div inside with overflow:...

View Article



Login request redirects to Account/Login?ReturnUrl

So basically I have this simple form in my index page:using (Html.BeginForm("ChangeUserName", "Manage", FormMethod.Post)){ @Html.AntiForgeryToken()<input name="newUserName"...

View Article

100% height on ::before element that his parent has overflow scroll attribute

I have a div with overflow scroll attribute and i want to see its background in a ::before (since backdrop-filter doesn't work with multiple divs otherwise)So my issue is to extend the ::before height...

View Article

How can I make a VS Code keybinding only apply when a specific View is...

I'm coming from other IDEs in which when you globally search for some content across your project (in Visual studio code it's done by pressing CMD+SHIT+F) and then want to move between the founded...

View Article
Browsing latest articles
Browse All 32 View Live




Latest Images