Skip to main content

Posts

Bundle .js and .css dependecies from package.json with gulp

I'm trying to convert an old project that uses Bower + gulp (+ npm) into something similar, which doesn't use Bower but keeps most of Gulp. I'm stuck with reproducing the equivalent of wiredep, ie, picking all the relevant .js and .css from third party dependencies (which now are moved from Bower to package.json ), to use them for either HTML injection or bundling all .js/.css into a single file. Before, it was doing this, using a mix of wiredep and inject: gulp.task('inject-html', ['compile-styles'], function () { $.util.log('injecting JavaScript and CSS into the html files'); var injectStyles = gulp.src(config.outputCss, { read: false }); var injectScripts = gulp.src(config.js, { read: false }); var wiredepOptions = config.getWiredepDefaultOptions(); var injectOptions = { ignorePath: ['src', '.tmp'], addRootSlash: false, }; var wiredep = require('wiredep').stream; return gulp.src(config.html)

How can I identify a ROI that is formed by many contours (canny image)? (OpenCV and Python)

I'm newbie with OpenCV, but I'm tring to do a solution to identify flaws in a machining process in a specific Region of Interrest (ROI). I wrote a code that can 'identify' this ROI and ignores the rest of the part, however I don't know how to create a filter in that region, because my Canny image is formed by a lot of small areas, and not by a single area. What I want to do, is find a way to get ROI's bounding box (x,y,w,h) coordinates for after filter my input (webcam) image with this ROI and apply again the Canny method to identify this machining flaws I put my code and a image from the metal part and the Canny image showing the ROI. I've never use computer vision so I'd be very grateful if someone helps me. def getContours(img): contours, Hierarchy = cv2.findContours(img, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_NONE) for i in contours: area = cv2.contourArea(i) # print(area) if area>500: cv2.drawContours(img, i, -1, (255, 0, 0),

Terms and Conditions modal read-detection - Plain Javascript (No libraries)

I'm trying to figure out a way to create a scrollable modal that detects when the reader has scrolled to the bottom before enabling the 'Agree' button. This is for a Terms and Conditions type of box. I am also trying to create this with nothing more than plain html, css, and javascript. This is what I have so far. var termsModal = document.getElementById("terms-modal"); // Get the button that opens the modal var agreeCheckbox = document.getElementById("agree-checkbox"); // Get the <span> element that closes the modal var closeModal = document.getElementsByClassName("close")[0]; var modalContent = document.getElementsByClassName("modal-content"); var agreeButton = document.getElementById("agreeBtn"); var agreementContainer = document.getElementById("agreement"); // Enables agree button when user scrolls all the way down // modalContent.scroll(function() { // var disable = (((agreementContainer.he

comparing Pandas dataframes by header uring regex

I have two dataframes let's call them df1 and df2, which columns with slightly different headers which I need to compare. For example df1 = pd.Dataframe('0001_baseline':[1,2,3], '0002_baseline':[1,2,3]) df1 = pd.Dataframe('0001_w2':[1,2,3], '0002_w2':[1,2,3]) I need to do the ratio of 0001_baseline/0001_w2. if the names were identical I would have intersec = set(df1.columns).intersection(set(df2.columns)) and then do the ratio according to the intersections, but the column names are different. Is there a way to perform the intersection according to column name using regex? Or alternatively, knowing that I know how long are the characters, replace the names with a shorter version which won't cause a problem? source https://stackoverflow.com/questions/72353661/comparing-pandas-dataframes-by-header-uring-regex

Wordpress builder button disabled

Hi i am new to wordpress so i tried to make my first website, and when i tried using the builder there is a green button on top left corner so i could add text but the button is disabled. You can see in the image below which button i am asking for. I tried things like making a static page but it did not fixed the problem, also i updated all of the available updates. How to make the button enabled ? Via Active questions tagged javascript - Stack Overflow https://ift.tt/4KIFwbN

header in csv file printing every other line

I've been working this problem way too long, please explain to me why the header keeps repeating in my output csv. I have an input csv with this data: name,house "Abbott, Hannah",Hufflepuff "Bell, Katie",Gryffindor "Bones, Susan",Hufflepuff "Boot, Terry",Ravenclaw The problem requires reversing last and first name, separate name into two columns, and make a new header with 3 columns for the output csv. Here's what I have: while True: try: # open file with open(sys.argv[1]) as file: # make reader reader = csv.reader(file) # skip first line (header row) next(reader) # for each row for row in reader: # identify name name = row[0] # split at , name = name.split(", ") # create var last and first,

Cannot resolve symbol 'useTransition' in new react 18

I just upgrade my project to react 18.1.0 and try to check the new hook useTransition but I get this error Cannot resolve symbol 'useTransition' and I don't know why This is my package.json : "dependencies": { "@date-io/core": "^2.10.7", "@date-io/date-fns": "^1.3.13", "@emotion/react": "^11.7.1", "@emotion/styled": "^11.6.0", "@mui/base": "^5.0.0-alpha.64", "@mui/lab": "^5.0.0-alpha.76", "@mui/material": "^5.2.7", "@mui/styles": "^5.2.3", "@mui/x-data-grid": "^5.2.1", "@testing-library/dom": "4.2.0", "autosuggest-highlight": "^3.1.1", "autosuggest-highlight-with-opts": "^3.1.2", "axios": "^0.24.0", "cookie": "^0.4.1", "co