|
LLSix posted:I recently started a new job working on a browser-based application and am still learning the finer points of Javascript. I've got a question about what a JS interpreter following the spec should do with the following code snippet. .item() isn't a 'property getter' as I would understand the term, but rather just a method on an object. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get is probably what that quote means by 'property getter'. Given that, NodeListFoo[4] is just getting property '4' from the object NodeListFoo and, since the NodeList behaves like an array (sometimes 😒) or vanilla object, I would expect that to evaluate to undefined rather than null. I think .item() returns null because returning undefined would be just pretty fuckin weird since methods don't generally do that sort of thing whereas accessing properties that don't exist generally do.
|
# ? Sep 21, 2018 15:43 |
|
|
# ? May 10, 2024 09:32 |
|
Does anyone have any suggestions for HTTP request interceptor software for Mac OS? I'd like to be able to set breakpoints and edit both HTTP requests and responses
|
# ? Sep 25, 2018 14:19 |
|
Grump posted:Does anyone have any suggestions for HTTP request interceptor software for Mac OS? fiddler runs on mac now. https://www.telerik.com/fiddler
|
# ? Sep 25, 2018 14:23 |
|
Isn't that what Postman is for?
|
# ? Sep 26, 2018 19:31 |
|
Not really. I want to gently caress with responses in the browser so I can test how UI renders. I ended up buying a subscription to Charles. Fiddler’s Mac OS port sucks mongo dick
|
# ? Sep 26, 2018 19:50 |
|
I have an ID that is getting a whole lot of poo poo in it. Like 15-20 lines. I feel like that might be hard to read. So I have two options here: break it into multiple parts, or just add spacing. You can't use multiple IDs on a single element in HTML. Is there a way to sort of encapsulate two IDs in one so I can break it out like I would functions in a C-based language, or should I just use spacing in the huge ID to fix it? These are both unique styles to the element, so I feel like using classes wouldn't be a good practice. Disclosure: This is the first thing I've done outside of projects in Lynda courses.
|
# ? Sep 27, 2018 19:48 |
|
Do you mean that the element's ID is 20 lines long? Why?
|
# ? Sep 27, 2018 20:33 |
|
22 Eargesplitten posted:I have an ID that is getting a whole lot of poo poo in it. Like 15-20 lines. I feel like that might be hard to read. So I have two options here: break it into multiple parts, or just add spacing. You can't use multiple IDs on a single element in HTML. Is there a way to sort of encapsulate two IDs in one so I can break it out like I would functions in a C-based language, or should I just use spacing in the huge ID to fix it? These are both unique styles to the element, so I feel like using classes wouldn't be a good practice. I think the actual issue here is what you think an ID is for in HTML. Tell us what you are trying to accomplish, as an ID that's more an a single short string is not a thing that should be happening.
|
# ? Sep 27, 2018 21:04 |
|
You should probably be using data-* attributes.HTML code:
|
# ? Sep 27, 2018 22:15 |
|
I meant the body of the ID is 20 lines long. I ended up having to turn it into two elements anyway, couldn't get one to do both. So I split it into two IDs and one's on a child element now. My impression was that IDs were good to use where you could use a class but it's a one-off, so you won't have to re-use it. Is that not right? It's entirely possible I misunderstood those videos. Not sure what's going on with the data-* attribute stuff. The Lynda courses didn't cover that yet Or it did and I forgot it because my memory is absolute poo poo. I was doing an image with text over it, but I needed it to follow the standard flow while still having the text centered both vertically and horizontally. So I used display: table-cell, but then I couldn't get it to align without a bunch of manual adjustments and since my wife is going to be using this as a template for her other stuff in the future I want to keep it as simple as possible. She cargo cult self-taught herself over the past 10+ years, and it shows. Who the gently caress still uses <center>? There were also a ton of overrides where she would define stuff like height twice in the CSS, and then define it again in the HTML. Don't get me wrong, as you can tell I know next to nothing about HTML/CSS/Javascript, but I've got a C++/Java/C# background from school so I get why stuff is bad. I just don't know how to make it better without a lot of work. I think it might actually be best to just set up a flexbox layout from scratch rather than trying to fix her code. OTOH, she doesn't know flexbox at all so that might be confusing for her.
|
# ? Sep 28, 2018 01:48 |
|
22 Eargesplitten posted:I meant the body of the ID is 20 lines long. I ended up having to turn it into two elements anyway, couldn't get one to do both. So I split it into two IDs and one's on a child element now. My impression was that IDs were good to use where you could use a class but it's a one-off, so you won't have to re-use it. Is that not right? It's entirely possible I misunderstood those videos. Wow there's a lot going on here. Could you just post your code and what you're trying to accomplish? Maybe drag another loved one in that post too.
|
# ? Sep 28, 2018 02:27 |
|
FWIW in most cases front end devs use classes for visual styles and IDs for JS as it keeps things nice and orderly. IDs are generally only used for styles in very specific cases. That doesn’t mean you can’t or shouldn’t use IDs for styles, it’s just not that common anymore these days.
|
# ? Sep 28, 2018 08:41 |
|
I learned ASM before I learned C, so maybe I can help. ID's are unique, and like all in HTML, are supposed to be human readable. Something like id="ADF00-0111-4544-3455-FEFE" even if is valid (don't make me check if "-" is valid for ids, I think it is) is not a good ID, because it says nothing about the intention of the ID. What you should do, and must do, is make valid clear concise id's that are unique. id="potato_bottle" You would not use ADF00-0111-4544-3455-FEFE has a variable in C. Id's are not data, are code to be read by humans. Somebody told you about using data-* attributes. That is a good way to add extra information to a tag withouth overloading existing attributes with more payload that is intended by the language design. we want to see your code
|
# ? Sep 28, 2018 10:45 |
Seriously, im like here
|
|
# ? Sep 28, 2018 13:29 |
|
Data Graham posted:Seriously, im like here This with a large side of
|
# ? Sep 28, 2018 13:53 |
|
I once inherited a templating system that just shoved the whole page and metadata into the IDs of DIVs in a pipe delimited format, so the code that showed the 'page' with a server-side ID of 123456 would work likeJavaScript code:
"It's kinda slow on phones, but it works" - in TYOOLS 2011
|
# ? Sep 28, 2018 14:21 |
|
My personal dream is to create something like a "Code Zoo" website where weird code and weird ideas would be show to scare/amaze/craze people. Every year I feel the urge to put time on that, but them a new videogame is released that capture all my free time. I miss when I was teenager and it was possible for me to write code until 2:45 am, then do whatever society require from me the next day, no problem. https://www.youtube.com/watch?v=2LhaXf3iTHo
|
# ? Sep 28, 2018 15:38 |
|
Tei posted:My personal dream is to create something like a "Code Zoo" website where weird code and weird ideas would be show to scare/amaze/craze people. This already exists though.
|
# ? Sep 28, 2018 15:56 |
|
Lumpy posted:This already exists though. Github is more like a safari park. The good mixed with the bad. Please don't abandon the safety of your vehicles. Seriusly, Github is just another forum. If what you find there is wrong and you still use it, is your fault. No difference from a Stackoverflow discussion where the correct answers are near the bottom of the page, and the top answer is from a guy that know how to game the system. What I am saying is Github is not has bad has you imply. Tei fucked around with this message at 16:33 on Sep 28, 2018 |
# ? Sep 28, 2018 16:13 |
|
kedo posted:FWIW in most cases front end devs use classes for visual styles and IDs for JS as it keeps things nice and orderly. IDs are generally only used for styles in very specific cases. Ah, okay. I’ll switch to doing it that way. I didn’t expect this strong of a reaction from everyone else. I guess it is pretty weird. For what it’s worth, I’m not trying to poo poo on my wife. She’s not a programmer, she has no interest in programming. She’s an artist, and just puts stuff together to make layouts show up on community webpages. Once I have access to the jsfiddle I can copy it in so you see what I started with. I think probably the best idea is to start from scratch so I don’t get tripped up with weird stuff.
|
# ? Sep 29, 2018 06:05 |
|
Tei posted:Github is more like a safari park. The good mixed with the bad. Please don't abandon the safety of your vehicles. Ah, now eventually you do plan to have good code on your, on your code tour, right? Hello?
|
# ? Sep 30, 2018 01:54 |
|
Is only a dream, and will never be a real thing.
Tei fucked around with this message at 14:13 on Oct 1, 2018 |
# ? Sep 30, 2018 07:41 |
Must code faster. Must code faster
|
|
# ? Sep 30, 2018 17:47 |
|
If I may... Um, I'll tell you the problem with copying and pasting code from Stack Overflow, it doesn't require any discipline to attain it. You read what others had done and you took the next step. You didn't earn the knowledge for yourselves, so you don't take any responsibility for it. You stood on the shoulders of geniuses to accomplish something as fast as you could, and before you even knew what you had, you patented it, and packaged it, and slapped it on a plastic lunchbox, and now [bangs on table] you're selling it, you wanna sell it.
|
# ? Oct 1, 2018 10:54 |
|
kedo posted:If I may... Um, I'll tell you the problem with copying and pasting code from Stack Overflow, it doesn't require any discipline to attain it. You read what others had done and you took the next step. You didn't earn the knowledge for yourselves, so you don't take any responsibility for it. You stood on the shoulders of geniuses to accomplish something as fast as you could, and before you even knew what you had, you patented it, and packaged it, and slapped it on a plastic lunchbox, and now [bangs on table] you're selling it, you wanna sell it. When I find a error message and I don't know what to do, I put it on the google box, then that sometimes end in Stackoverflow where I can see I am not the only one with the error. What others have tried. What have worked. Thats a lot, really. When you are doing something pretty new, fresh or different, and you have a problem and you google, and absolutely nobody is talking about it, you are hosed. The lack of good public debate about bugs is a reason to not buy closed source products, even if they looks like have a lot of support and quality. Tei fucked around with this message at 14:21 on Oct 1, 2018 |
# ? Oct 1, 2018 14:17 |
|
There’s nothing wrong with googling an error, finding out the cause, and typing out the solution yourself. Highlighting solutions and copy/pasting them is a sign you’re not interested in really understanding the solution.
|
# ? Oct 1, 2018 14:20 |
|
The Dave posted:There’s nothing wrong with googling an error, finding out the cause, and typing out the solution yourself. The act of copying and pasting, I think theres nothing wrong with it. Is failing to achieve "good practices" that is bad, IMHO, like adding unnecesary dependencies, changing the code style, or (the important one) adding code you yourself don't understand.
|
# ? Oct 1, 2018 14:27 |
|
As long as you read and understand what the solution is doing, the mechanics of getting it into your own code are irrelevant. Typing it manually may help you ensure you actually understand what's going on, but there are other ways to do that too.
|
# ? Oct 1, 2018 18:34 |
|
Tei posted:My personal dream is to create something like a "Code Zoo" website where weird code and weird ideas would be show to scare/amaze/craze people. Do it. I'll read it. http://thedailywtf.com/ has some great reads but doesn't cover only web design. Pairs well with my morning coffee. I'm also interested in this HTML ID business, though. I need closure.
|
# ? Oct 1, 2018 19:58 |
|
So I'm working on an ASP.NET MVC application that just uses jquery and the KendoUI controls. I have a table with two dozen rows, and 4 columns per row. The first column is just some label text and then the next 3 columns are textboxes. When you press Tab, the control focus moves down to the next row but stays in whatever column you're in. A user reported a bug yesterday that pressing the Enter key moves focus horizontally, rather than vertically, which is not what we want. I didn't even know you could press Enter to change focus I've tried Googling around to figure out this issue, but unfortunately searching for things like "enter changes focus" just gives me results for people who want to make it so that when you press Enter it will change tab focus. My software's already doing this, but it doesn't respect the tab order. Here's one row from the .cshtml file: code:
All I could find in Kendo's documentation was this tiny section about keyboard navigation but I don't know how to fix my issue. So, anyone know why the Enter key doesn't respect tab index?
|
# ? Oct 2, 2018 12:53 |
|
That's not the browser doing it, browsers treat an enter key press as a form submission. I'd check the KendoUI settings. Or all your inputs have the required attribute and the browser is just putting focus on the first empty one it finds.
|
# ? Oct 12, 2018 16:26 |
|
I am building an application that generates an html report by connecting to an appliance on a network. The connection is made through a JSON web service, but the appliance is not exposed publically over the internet. So the original idea was to deploy a Java JAR file that users double click, it prompts them for the IP of the appliance and a user/pass, then it generates the report and displays it in a browser. This works but it requires distributing this JAR file which is annoying. I would love to just deploy this code on a regular server, but the server can't reach the appliances. So my question: Can I extract the code that makes the api call to client side javascript, and just forward that data to the report generator on the server through a form submit or something? It would basically use the user's browser as a proxy to talk to the appliance and then send the data to the server. I don't see why this wouldn't work unless there is some sort of restriction on the client side javascript.. is this easier than I am expecting? EDIT: Let me complicate things and mention that the JAR file has a self signing cert to get around any SSL connection issues. So the client side JS would need to do that too. FateFree fucked around with this message at 12:15 on Oct 16, 2018 |
# ? Oct 16, 2018 12:11 |
|
FateFree posted:I am building an application that generates an html report by connecting to an appliance on a network. The connection is made through a JSON web service, but the appliance is not exposed publically over the internet. So the original idea was to deploy a Java JAR file that users double click, it prompts them for the IP of the appliance and a user/pass, then it generates the report and displays it in a browser. This works but it requires distributing this JAR file which is annoying. I would love to just deploy this code on a regular server, but the server can't reach the appliances.
|
# ? Oct 16, 2018 12:53 |
|
Ajax calls to random servers are nasty and may need the served provide custom headers (cors?) or to the request to originate from the machine that is asking (the html is hosted by the apliance). This limitations exist because among other things, malware guys where abusing crappy routers by uploading a custom firmware or change the dns settings or other evil things. Using the browser has proxy have big problems if you dont control all parts. https://stackoverflow.com/questions/5750696/how-to-get-a-cross-origin-resource-sharing-cors-post-request-working If you can host html in the appliance, everything is much easier. That html can query the appliance (same host, so no problem), then send the information to your server with whatever way you want. Tei fucked around with this message at 13:17 on Oct 16, 2018 |
# ? Oct 16, 2018 13:11 |
|
Two of my coworkers are claiming that a recent change to IE's implementation of document.querySelector & element.querySelector for Javascript (JScript\ECMA) is causing issues. Does Microsoft maintain a public changelog of their implementation or anything else I can check to see if there has actually been a change there? On the off chance this is real and someone else has run into it, they're claiming that changing from code:
code:
|
# ? Oct 17, 2018 15:54 |
|
LLSix posted:Two of my coworkers are claiming that a recent change to IE's implementation of document.querySelector & element.querySelector for Javascript (JScript\ECMA) is causing issues. Does Microsoft maintain a public changelog of their implementation or anything else I can check to see if there has actually been a change there? https://developer.microsoft.com/en-us/microsoft-edge/platform/changelog/ maybe?
|
# ? Oct 17, 2018 15:57 |
|
LLSix posted:got IE to start returning <textarea id='notetext' ... >...</textarea> again after it mysteriously started returning NULL. are they sure id="notetext" is not duplicated? maybe they have not changed the method normal operation, but changed how it behave with a malformed document
|
# ? Oct 17, 2018 16:04 |
|
I posted this in the JavaScript thread, but this might be a more appropriate place: I'm new to programming and for my class we're using Moment.js and Firebase to create a train scheduler (seems to be a fairly common project). The user is supposed to enter data on when the first train departs and the frequency of the train's arrival and Moment.js should calculate when the next train will arrive and how many minutes away it is. My code isn't working however. The calculated data isn't appending properly into the table. Can anyone take a look and see what the problem is for me? It would be much appreciated. Link to the GitHub repository: https://github.com/PaulKlein22/train-schedule Many thanks in advance.
|
# ? Oct 18, 2018 03:41 |
|
Rand Ecliptic posted:I posted this in the JavaScript thread, but this might be a more appropriate place: What does the error console say when you run the code? Breakpoint things and see if variables are what you think they are. At first quick glance, it looks like you are using some undefined variables in your firebase new child listener.
|
# ? Oct 18, 2018 03:56 |
|
|
# ? May 10, 2024 09:32 |
|
Thanks for looking! When I open the console I don't get any errors. The only variable that seems to be undefined is currentTime, but I'm not sure what I should be doing with it. I have it set to moment(), which is being used elsewhere. The issues I'm seeing are that minutesAway is coming back as NaN and nextTrain looks like it's just displaying the current time. It should be calculating when the next train to arrive will be, based on the current time, the time of the first train, and the frequency of the arrivals.
|
# ? Oct 18, 2018 04:05 |