|
Yarn's benefits are minor: workspaces (want to make a monorepo?) and package dependency support.
|
# ? Jan 27, 2020 16:01 |
|
|
# ? May 16, 2024 12:03 |
|
what is this dev.to site is it just medium for even bigger dorks?
|
# ? Jan 27, 2020 19:12 |
|
Yes
|
# ? Jan 27, 2020 20:47 |
|
I have a table with many rows. i want to be able to input a row number and it grabs that row and moves it a couple of rows to the top or bottom. I'm not clicking on the row itself; I would like to enter a rownumber and the number of spaces to the top or bottom and then the row moves. I know how to make input boxes and use javascript to grab the value, but i'm not understanding how to use that number to select the row and move it. There are so many ways to grab the table row that i'm not sure which is correct Any help is appreciated.
|
# ? Jan 27, 2020 23:55 |
|
Edit: Nevermind
|
# ? Jan 28, 2020 00:22 |
|
stoops posted:I have a table with many rows. i want to be able to input a row number and it grabs that row and moves it a couple of rows to the top or bottom. code:
Of course, this is just one possible idea. There are other ways to skin this cat.
|
# ? Jan 28, 2020 00:39 |
Volguus posted:
1. you don't use a # in the string if you're using getElementById, as it's implicitly an ID 2. children is a read-only live collection, which might or might not lead to some weirdness compared to grabbing a static nodelist if other things are happening on the page. why chance it? code:
edit: oh poo poo well i just realized re-reading the original post and you probably wanted to just move it up or down the specified number of spaces, huh. not make it appear that number of spaces from the top. fortunately you just have to change the first splice call to code:
Jazerus fucked around with this message at 03:51 on Jan 28, 2020 |
|
# ? Jan 28, 2020 01:52 |
|
This is good. Ugly as hell, but good.
|
# ? Jan 28, 2020 03:01 |
Volguus posted:This is good. Ugly as hell, but good. yeah i'm assuming they don't need this for any kind of fancy or job-related purpose. please do not put my code into production.
|
|
# ? Jan 28, 2020 03:12 |
|
Jazerus posted:yeah i'm assuming they don't need this for any kind of fancy or job-related purpose. please do not put my code into production. It's already powering 12,874 e-commerce sites.
|
# ? Jan 28, 2020 03:16 |
|
Volguus posted:This is good. Ugly as hell, but good. New thread title IMO
|
# ? Jan 28, 2020 15:16 |
|
Lumpy posted:It's already powering 12,874 e-commerce sites. New thread title
|
# ? Jan 28, 2020 15:33 |
|
Lumpy posted:It's already powering 12,874 e-commerce sites. It needs its own GitHub repo with 50 releases that each just update the Prettier/ESLint rules and a dozen open issues arguing about the tests and the code of conduct.
|
# ? Jan 28, 2020 15:37 |
Volguus posted:This is good. Ugly as hell, but good. Lumpy posted:It's already powering 12,874 e-commerce sites. Jazerus posted:please do not put my code into production. Honestly all three of these are great
|
|
# ? Jan 28, 2020 15:41 |
|
Removing all the rows, reordering them, and then adding them back seems unnecessary, doesn't it? Why not just take the row in question and use insertBefore to move it in it's new location? Something like this SO answer: https://stackoverflow.com/questions/39038113/javascript-insert-row-into-table-after-row-with-certain-id Edit: Jazerus posted:2. children is a read-only live collection, which might or might not lead to some weirdness compared to grabbing a static nodelist if other things are happening on the page. why chance it? What's the concern here? Children is live, but there won't be anything else editing the DOM while you're in your function moving the row (unless there's some sort of iframe fuckery?) HappyHippo fucked around with this message at 17:11 on Jan 28, 2020 |
# ? Jan 28, 2020 17:01 |
honestly? i forgot that insertBefore and before existed. that's a much more efficient way to do it. using children is probably fine too, I tend to just avoid the live collections in the DOM unless they're obviously the best choice Jazerus fucked around with this message at 23:30 on Jan 28, 2020 |
|
# ? Jan 28, 2020 17:50 |
|
i have a helper function i use for this https://github.com/magcius/noclip.website/blob/master/src/ui.ts#L55-L80
|
# ? Jan 28, 2020 20:51 |
|
I appreciate everyone's replies. I actually learned a lot from your posts and links. I ended up going with something like this: code:
|
# ? Jan 28, 2020 23:24 |
|
Date / Time library recommendation time! We were using Spacetime, which works great... except for the fact that it fails one of the most important requirements we have: displaying DST / timezone "correct" times to users. Spacetime only properly handles a single year, and fudges it for the rest, which is a decent trade-off, and works for most people I guess. That said, we now need to replace Spacetime with something before March 8, so who is using something that doesn't suck* for dates and times? Our single big requirement is handling DST boundaries and timezones. This spacetime example is effectively what we need: JavaScript code:
Being "fast" is also good, as we render the converted timezone times in graph tooltips, but obviously "fast" is subjective and may not be any bottleneck at all.
|
# ? Feb 4, 2020 16:21 |
|
Does anyone know why a call using "withCredentials" is failing on one specific machine? We have some code that looks like this JavaScript code:
We recently had one person who is getting 401 errors, which happens when you omit withCredentials, so that the user's cookie information isn't passed on, and the authEndpoint registers them as logged out, like if you had opened the endpoint in an incognito window or something. If they manually hit the authEndpoint, they're able to get their token/credentials, and not see a 401 error. If they try to access that endpoint programmatically in any way (I had them copy and paste a similar request to the authEndpoint using XmlHTTPRequest + withCredentials), the endpoint doesn't pickup the credentials and returns a 401. This is happening across multiple browsers for the user, and they are on the same network as the rest of us, so it can't be a network issue. If they use their phone, they are able to access the site fine and the request to the authEndpoint goes through, which leads me to think there's something funky going on with their machine. Does anyone know what could possibly be causing this? Is there some sort of weird IT setting to prevent XSS or something that doesn't allow cookies to be sent through?
|
# ? Feb 4, 2020 20:16 |
|
Lumpy posted:Date / Time library recommendation time! We were using Spacetime, which works great... except for the fact that it fails one of the most important requirements we have: displaying DST / timezone "correct" times to users. Spacetime only properly handles a single year, and fudges it for the rest, which is a decent trade-off, and works for most people I guess. I like Luxon because it uses the browser's Intl library for timezone support, which means it's also on the smaller side compared to MomentJS with its timezone support. Luxon should work in most modern browsers and Node, if MDN is to be believed.
|
# ? Feb 4, 2020 22:45 |
|
The Dark Wind posted:Does anyone know why a call using "withCredentials" is failing on one specific machine?
|
# ? Feb 5, 2020 01:46 |
|
I'm using this library to upload files via ajax: https://github.com/blueimp/jQuery-File-Upload It works fine, but I'm noticing that it's turning my periods into hyphens (it doesn't turn the period extension). so, for example, mwr_PJ13456789_m08.1_2.7x2.00.atm.txt becomes mwr_PJ13456789_m08-1_2-7x2-00-atm.txt I think the blueimp libary is doing this, but i'm not sure a way around it besides converting the hyphens back to periods, which may make it harder if a file already has hyphens alongside periods. Is there a security reason or something that it would force the periods into hyphens?
|
# ? Feb 6, 2020 22:11 |
|
The Dark Wind posted:Does anyone know what could possibly be causing this? Is there some sort of weird IT setting to prevent XSS or something that doesn't allow cookies to be sent through?
|
# ? Feb 8, 2020 15:38 |
|
I'm having a weird problem. I'm running a website that uses NodeJS with an ExpressJS backend, and communicating through SocketIO. When the user logs in, the login function creates a unique session ID and stores both that and the logged in user's name (which the site requires for really dumb legacy reasons that are not my fault) in sessionStorage, simply with window.sessionStorage.setItem('token', tokenValue) and window.sessionStorage.setItem('username', username). That works fine. The keys get set, and using Chrome's dev tools I can see that they are in my sessionStorage just fine. However, when I load any other page on the website, the token key in sessionStorage becomes undefined. The username key persists through page changes and reloads. Both keys are retrieved using window.sessionStorage.getItem(), but for one thing that shouldn't set the value of a key to undefined, and even if it did, the username value remains set. Can anyone think of anything that might be causing this? E: never mind, I figured it out. The problem is this loving hellscape of a mess of socketIO calls with identical names but different implementations flying out of various classes back and forth. I want to strangle the guy who made this website originally. Shaman Tank Spec fucked around with this message at 15:57 on Feb 12, 2020 |
# ? Feb 12, 2020 15:52 |
|
Something approaching 100% of Dev time is spent on the "why the heck was this built like that"problem. The longer I'm in the industry especially around web development the more pronounced this problem is. I'm less and less able to imagine the vast sums of money companies could save by just hiring good devs as opposed to thousands of bad ones constantly.
|
# ? Feb 19, 2020 16:35 |
|
Nolgthorn posted:Something approaching 100% of Dev time is spent on the "why the heck was this built like that"problem. The longer I'm in the industry especially around web development the more pronounced this problem is. I'm less and less able to imagine the vast sums of money companies could save by just hiring good devs as opposed to thousands of bad ones constantly. Good devs want more money than bad devs, and you gotta keep budget down so you get a bonus. Plus, good devs always seem to want to take slightly longer than bad devs to finish the first version of something, which doesn't make any sense. If they were good, they'd be faster, right?
|
# ? Feb 19, 2020 17:21 |
|
I've worked at several shops that had too many devs and very little was getting done because everyone was being careful not to knock over the house of cards. It wasn't a particularly complex project. Two good devs could have re written the entire thing from scratch in a couple of months, but that would have cut into the push for more features so I understand why they couldn't do it.
|
# ? Feb 19, 2020 17:39 |
|
Nolgthorn posted:The longer I'm in the industry especially around web development the more pronounced this problem is. This is because you're better able to see the problems the more experienced you are. It's particularly prevalent in web development because The Webs are most often the interface between a business and it's customers and thus there are more stakeholders who don't have the technical background to understand the costs of implementing Feature X rather than spending a month on refactoring or whatever else...from the CEO to marketing. On the other hand, adding features may be what allows the business to survive. Developers are often kind of siloed off from having to worry about any of this boring stuff that makes a business survive.
|
# ? Feb 19, 2020 19:19 |
|
It demonstrates though that nobody really has to be very good or get a lot done in order to succeed in the industry. As evidenced by the slow pace of development in many of these shops being apparently remedied by hiring more developers. A business would be able to get a lot more done a lot faster, including the implementation of new features if it were possible to cut down on developers dramatically and focus on the architecture of the software first and foremost. Isn't that true? And if so why aren't there any mechanisms in place even to this day that address it? Companies will spend loads of money hiring experts in things like Agile methodologies. So why not software architects? Is it a lack of skilled developers in management roles?
|
# ? Feb 19, 2020 19:45 |
|
Nolgthorn posted:It demonstrates though that nobody really has to be very good or get a lot done in order to succeed in the industry. Yes, us software developers tend to over-value what we do...just like everyone. Nolgthorn posted:As evidenced by the slow pace of development in many of these shops being apparently remedied by hiring more developers. A business would be able to get a lot more done a lot faster, including the implementation of new features if it were possible to cut down on developers dramatically and focus on the architecture of the software first and foremost. Isn't that true? And if so why aren't there any mechanisms in place even to this day that address it? At the risk of over-valuing what we do...I think a lot of it is that it's hard to communicate what we do to non-developers. The best we can often do is flawed analogies. A good test of this would be if technology companies that promote engineers from within to executive roles are better able to dedicate time to writing tests, building good foundations, refactoring, etc. All the stuff that doesn't seem to directly "add value".
|
# ? Feb 19, 2020 23:17 |
|
Thermopyle posted:On the other hand, adding features may be what allows the business to survive. True, but it doesn't have to be an either/or thing.
|
# ? Feb 26, 2020 05:39 |
|
Thermopyle posted:On the other hand, adding features may be what allows the business to survive. I suppose it's also possible that lovely bugs that should have been caught by tests sometimes benefits a business, but that seems less likely than a new feature being detrimental.
|
# ? Feb 26, 2020 06:16 |
|
roomforthetuna posted:There's also the thing where the designers and managers who pushed that feature will always push that story, but we don't actually have insight into a parallel universe where that feature wasn't added, so we don't actually ever know if a business did better or worse because of adding a feature (unless that feature is something unusually measurable like specifically monetization of a previously unmonetized product or something). A/B testing can be used to test features, whether by making the feature a component of the view that just doesn't get included sometime, or using feature flags. It's already used to check engagement with say, different layouts on a page, but nothing's stopping you from a/b testing features as well. Serve half the users with feature enabled, half with feature disabled, and check metrics like how long people stay on the page, page load performance, average cart value etc. Granted if what you're working on isn't very web-like or e-commerce-like (despite using js), or you don't have a significant number of users, or if you don't have metrics on what would make your application useful, then the technique won't work - but then that also indicates you have bigger problems than quantifying what features are useful.
|
# ? Feb 26, 2020 19:33 |
|
roomforthetuna posted:There's also the thing where the designers and managers who pushed that feature will always push that story, but we don't actually have insight into a parallel universe where that feature wasn't added, so we don't actually ever know if a business did better or worse because of adding a feature (unless that feature is something unusually measurable like specifically monetization of a previously unmonetized product or something). As is usually the case, the actual evidence for or against doesn't really matter. What matters is what the stakeholders believe is the case. Part of the thing that some people believe is that it's often not any single issue that makes or breaks a business, it's a culture of continual feature adding that causes potential new customers to hear about your product and what to use it. It's not usually an explicit belief, but just a general feature of how they feel about the product should be "progressing". Also, as BF mentions people measure new features all the time with A/B testing or just comparing traffic/signups/income/whatever pre/post new feature introduction. That second method is more fraught and hard to do correctly, but most people aren't really interested in reality, they're just interested in confirming things they already believe!
|
# ? Feb 26, 2020 21:47 |
|
Thermopyle posted:That second method is more fraught and hard to do correctly, but most people aren't really interested in reality, they're just interested in confirming things they already believe! (And the eponymous app thing, where annoying notifications inevitably measurably increase usage in the short term, and you don't have access to metrics on "number of people who blocked all notifications from your app forever" so you don't get to measure the downside.)
|
# ? Feb 26, 2020 23:15 |
|
roomforthetuna posted:Yeah, a lot of the A/B testing metrics aren't measuring what they think they are. Like is more engagement/more clicks actually a good thing? Not if your app has turned one page with all the information into three pages you have to click between, you've actually just increased user frustration, but it looks good in the engagement metrics. Made 25% more ad money? Great! Except not so much if you also convinced half your users to never come back because the experience sucked now. The big problem with feature development is that you may not necessarily be able to trust users or stakeholders in determining what features are useful. When Microsoft started instrumenting applications such as Word with metrics on whether or not a feature is used or not, it found that the vast majority of features in its applications go nearly completely unused. Customers will often request features and not use them at all. Everyone hates bloated software, but when you hire people such as product owners and stakeowners and their job is to come up with features, you can run into the situation where everyone involved is bloating the product - engineering wants to work for a living, the product owners add more features because it's very easy to look at a spreadsheet and be like "I designed and requested x y and z feature," and marketing likes to have data sheets indicating that they have more features than the competitor. This can lead to a situation where the product becomes bloated - development and testing time starts taking much longer for the features that actually matter as so much effort needs to be devoted to features that are ultimately irrelevant. While it's true that A/B test metrics may not necessarily in and of themselves reflect the value of the feature, developing metrics for determining whether a feature is useful and/or adds value is of paramount performance, as oftentimes, a product can be just "good enough" without needing an entire team of people to gently caress with it and make it worse over the course of years - let those people work on new projects and develop new business. Bruegels Fuckbooks fucked around with this message at 05:24 on Feb 27, 2020 |
# ? Feb 26, 2020 23:57 |
|
Bruegels Fuckbooks posted:I guess, but the big problem with feature development is that you may not necessarily be able to trust users or stakeholders in determining what features are useful. When Microsoft started instrumenting applications such as Word with metrics on whether or not a feature is used or not, it found that the vast majority of features in its applications go nearly completely unused. Customers will often request features and even not use them at all. Everyone hates bloated software, but when you hire people such as product owners and stakeowners and their job is to come up with features, you can run into the situation where everyone involved is bloating the product - engineering wants to work for a living the product owners add more features because it's very easy to look at a spreadsheet and be like "I designed and requested x y and z feature," and marketing likes to have data sheets indicating that they have more features than the competitor. This situation can lead to a situation where the product becomes bloated, development and testing time starts taking much longer for the features that actually matter as so much effort needs to be devoted to features that are ultimately irrelevant. While it's true that the A/B test metrics may not necessarily in and of themselves reflect the value of the feature, developing metrics for determining whether a feature is useful and/or ads value is of paramount performance, as oftentimes, a product can be just "good enough" without needing an entire team of people to gently caress with it and make it worse over the course of years - let those people work on new projects and develop new business. (Though also not always as a reason for not doing a thing - "fewer than 1% of people use emergency ambulance services so we might as well not bother having them!" Sometimes a rarely-used feature is still a good and valuable feature. And sometimes an often-used feature is just used because some fucker shoved it in the way between the startup screen and what I actually want to do.)
|
# ? Feb 27, 2020 00:06 |
|
I'm looking for an acceptable method to compute the SHA-256 hash of a binary file. This is what I've cobbled together :JavaScript code:
code:
ynohtna posted:Looks to me like your call to .padStart is wrong. This works with my test files so it will do for now. Thanks ! unpacked robinhood fucked around with this message at 16:13 on Feb 27, 2020 |
# ? Feb 27, 2020 15:06 |
|
|
# ? May 16, 2024 12:03 |
|
Looks to me like your call to .padStart is wrong. It's expecting to pad just a single byte at a time, thus the targetLength parameter of 2 hex characters, but the loop it's in is processing 4 bytes (Uint32) at a time so the target length should be 8.
|
# ? Feb 27, 2020 15:21 |