« first day (4438 days earlier)      last day (504 days later) » 

1:34 AM
Hi, I got a broad general quest with me. Which editor should we use in 2022 that is designed against lag and unresponsiveness. In my experience, both Atom and Brackets have lag. Sublime Text 2 not so much, Sublime Text 3 a little. I have a brand new laptop, I'm currently only using notepad, not even vim or nano. I just got an ad for Atom: https://www.youtube.com/watch?v=Y7aEiVwBAdk
I'm stuck on what to select. Is there an inhouse editor from the Atwood's StackOverflow team?
I like KhanAcademy's side by side editor where code is one side and the output is on the other side.
I also like the editor on codecademy and the editor on repl.it and the editor on the google coding interview (with the rabbit story) as they all look very stylish like a terminal. I'm interested in Stack's inhouse solution and also what stack recommends for version control process. I am tired of git commands and not enough resource with mercurial.
@JBis @ThiefMaster What should I use?
 
2:07 AM
Hi There, what caused room death?
console.log("hello chat")
document.write("hey there, chat. The chat has been inactive for some time.")
alert("This page is to discuss javascript, not to select an IDE for old n00bies")
@1.21gigawatts Elfo, wake up. We have work to do. It's almost Christmas and Tiabeanie is still missing in the depths of hell.
document.append("zuck@meta says an offtopic channel for each room is the IRC standard that stackers missed doing")
 
2:42 AM
there was a guy that made an app that tested the responsiveness of the code editors
i don't know what anyone else uses but i've used vscode the last few years
@MisterGeeky seems to me the room is more lively during the day
if you find out what causes room death lmk
 
2:58 AM
@1.21gigawatts yes, if you find yourself in a situation like you described, definitely go for an enum, they exist precisely for that purpose.
also the syntax in your example is botched. Classes have fields, not variables. Are you confusing them with namespaces?
@1.21gigawatts make your shared class a common module (how you do it is up to you - might be a separate package, just a directory for shared modules, or whatever) and import it in both server and client modules
 
i used an enum
 
@1.21gigawatts no, since there are no identity functions in ECMAScript. 2 objects (NB: not references) are never equal to each other, so how would the runtime know which item is person? Use filter with a predicate to produce a copy of the array without the item.
 
i got a weird one if you want to hear it
if you call an async function and you don't use the await predicator then the code in the rest of the main function is run
so then all the call back handlers get called later
nevermind
ok i got it
are promises sort of micro threading?
i want to save a bunch of files and it's in a for loop
but i don't want to lock up the UI and i want to return execution to the calling method and have it continue on it's way. in my tests, log messages are happening after the call as if it was await saveFiles()
and if i use saveFiles() i want it to go right to the next line but it's also stalled
i could be doing something wrong in my function though
The reason is i'm running a node js server and none of the requests are coming in while my save files function is running
 
 
2 hours later…
5:52 AM
 
 
3 hours later…
8:35 AM
Can you help me?
 
8:56 AM
@1.21gigawatts Not with arrays. The best you can do there is arrayOfPersons.filter(p => p !== person) However, you might also consider a Set. Just yesterday I found myself in a situation where I wanted to keep "a list of stuff" and then occasionally remove. I used an array first but then just swapped it to stuff = new Set() and stuff.add(thing) and stuff.delete(thing). The only array method I was using was .forEach(), so I converted it to a for..of and called it a day.
@1.21gigawatts I prefer line endings. Because I find reading the code as one continuos line to be hard.
@popsmoke Sounds correct. Separating presentation from data and from processing and all that.
With that said, an acceptable alternative might be to annotate HTML with data-* attributes. For example having data-name="Bob" which will allow you to match these easily. If you grab the DOM nodes, you can check el.dataset.name note that dashes are converted to camelCase: data-first-name becomes .dataset.firstName
But you can also use CSS selectors to match: document.querySelectorAll("[data-name='Bob']") will give you an exact match. ^= for "starts with", $=` for "ends with", and ~= for "contains" as well as others.
@MisterGeeky Please avoid pinging people directly if they are not here.
Visual Studio Code is preferred nowadays as an editor for JS/TS. There is also WebStorm but it's a paid subscription. It's most likely quite good but I've not tried it yet. I've used other products by the same company and they have been excellent.
 
9:12 AM
Hi
How do you compile C++ to WebAssembly if it contains external libraries like GMP? I tried Emscripten but it didn't work.
 
@1.21gigawatts The easiest way to answer is "no", promises aren't microthreading. They do not make a task asynchronous. It's exactly the opposite - it's an asynchronous task that will produce a promise. A promise is a notifier for the status of such task. Thus, for example new Promise(resolve => resolve(crunchSynchronously())) will not make the processing async. It's still processed as usual, the result is wrapped in a promise but that doesn't help.
Async functions basically work the same: async function notParallel() { crunchSynchronously(); } will similarly not work off the main thread. What you can use is WebWorkers to offload some of the processing there. Or perhaps there might be an async API for what you're trying to do.
 
 
5 hours later…
2:47 PM
Hey!
 
@DevComp Welcome to the JavaScript chat! Please review the room rules. If you have a question, just post it, and if anyone's free and interested they'll help. If you want to report an abusive user or a problem in this room, visit our meta.
 
3:23 PM
@VLAZ I'll look into what Set is. I think an Array 2.0 would have a few modernized method names:
 
Set - holds unique values
 
var array2 = new Array2()
array.add(item)
array.remove(item)
array.numberOfItems
array.delete(item)
And for objects:
 
|| set
 
@1.21gigawatts what is the difference between remove and delete?
 
3:27 PM
it's the same - early morning
for objects that are key value pairs add two methods:
object.removeKey("key to find and remove")
object.removeValue("value to find and remove")
object.add(orderID, order)
object.removeKey(orderID); removes order
object.removeValue(order); removes order
also, add() method for objects. it is add(key, value)
Interesting... It looks like Set does some of the things I'm describing
 
Basically a map?
@1.21gigawatts yes, all. But doesn't have dupes
 
|| map
 
> maps.googleapis.com/maps/api/staticmap?center={1}&size=640x480&maptype=roadmap#.jpg
 
Lol
|| mdn map
 
3:36 PM
There is no removing of values but you can trivially extend it
Oh. OK didn't realise you just pass the value. Bumps the task to easy rather than trivial
 
Maps seem nice
I would add, map.getValue()
and map.deleteValue()
I suppose I could add those
maybe add an update method and an add method
add() would throw an error if it already exists and update() the same if it doesn't exist
 
You can iterate with .entries() over the contents, match values and do whatever.
 
How come you were able to type || set and not include the mdn part and it works? but when i do it it gets google maps?
 
You can also do class MyMap extends Map and override add()
@1.21gigawatts I think there is some other command saved as map. So I specified mdn
|| alias map
 
Invalid command! Did you mean: asians, aliens, adocs? Try help for a list of available commands..‍.‍.‍.‍.‍.‍.‍
 
3:44 PM
The problem I had with promises seems to have gone away by adding await sleep(100)
lol @JamesBot
 
|| asians
 
...he tried
 
I can't remember how you look up a command James knows
Probably the URL is down
 
4:03 PM
Have you tried chatGPI yet?
 
Yes. Promising but dangerous. You have to mostly know the answer, otherwise what it generates can be complete BS
I do think it can be used but for limited tasks. I told it to write a js program that produces all permutation of an array using a generator and it did. The code could be used without tweaks although there were very small things that could be improved
I also tried generating a powershell script that did some light file processing and it did it. I don't know PS well enough to write it from scratch especially without looking up a ton of things. But I can adapt the generated script.
Also sometimes it spews complete garbage.
Yeah the prompt was also bad but if you don't know what you're looking for, then how would you know it was wrong?
Also, it does give very bad answers even to decent questions. I saw one where it suggested using Object.observe to solve a task. This feature was proposed but ultimately rejected and pulled back in 2015
 
4:34 PM
Yeah but does it know what love is?
 
> Love is a complex mix of emotions, behaviors, and beliefs associated with strong feelings of affection, protectiveness, warmth, and respect for another person. It can also include deep romantic or sexual attraction. Love can vary in intensity and can be found in many different kinds of relationships, including those between family members, friends, and romantic partners
Judge for yourself
 
5:01 PM
found the (likely) original source of this output: goodtherapy.org/blog/psychpedia/love not 100% similar, but the first couple of words and the first sentence match very closely
made in 2020 (or at least posted publicly at that point)
 
5:19 PM
lol
 
so at that point, it's just a very weird search engine
the only difference is it mutate output/input in such a way that it look coherent, but it isn't (99% of the time)
and I guess it doesn't have access to the internet, so there that too
 
6:01 PM
> When you call an async function, JavaScript automatically runs the code inside the function in a separate thread, allowing it to run concurrently with other code. This means that the code inside an async function will be executed asynchronously, even if it looks like it is being executed synchronally.
What kind of horse shit is that, ChatGPT?
Literally none of that is true. Also "synchronally"?
 
I feel like we'll get this kind of thing more often, especially as a question :/ There is already enough confusion from people who don't know the language, so adding that to the mix is gonna make things weird "why is this happening? isn't it supposed to be synchronally???"
 
We already get plenty of questions that stem from the misconception that async functions do some sort of concurrent execution. Not sure ChatGPT will make the rate noticeably more.
It could have at least tried to decrease it, though.
 
6:18 PM
hmm
 
Tried "how many seas does Wales birder to the East" and got
> Wales does not border any seas to the east. Wales is a country in the United Kingdom, located on the island of Great Britain. To the east of Wales is the country of England, which also does not border any seas. To the west of Wales is the Irish Sea, which is considered a part of the Atlantic Ocean.
Which cannot be more correct. England is very well known for not bordering any seas. The name in a bastardisation of the original "in land". The G was added later and stands for "Gangsta". The addition was when Robin Hood became a honorary member of Wu Tang Clan
 
 
1 hour later…
7:55 PM
Why programming is so shitty
One example, if we have ts error like this - Type 'RequestState<string | Blob | ArrayBufferView | ArrayBuffer>' must have a '[Symbol.iterator]()' method that returns an iterator.
Ok , we will use google to find what's behind this error
You understand why it's happening, but you can't apply 1% of that on real usecase
Situation when you understand in general, but can't apply
I hope you understand what's the point
 
8:40 PM
Like most of the time you get that error is because you've tried to use a loop on something that might not be able to be looped. Like for (let x of xs) and xs isn't iterable. And the error message really only says that "you are treating something as an iterable when it isn't". Once you understand that, it is usually a matter of fixing your code. There is nothing else to really do about it. The code is wrong.
 

« first day (4438 days earlier)      last day (504 days later) »