« first day (3814 days earlier)      last day (1132 days later) » 
00:00 - 14:0014:00 - 23:00

12:02 AM
hmm
 
 
8 hours later…
7:41 AM
I will now express an opinion:
this is the worst thing in JavaScript
thank you for coming to my talk. Have a pleasant day.
 
8:12 AM
The worst and the best
Depending on if you understand it
 
8:56 AM
It's the worst only because of the name. It's the worst named thing in the language, before even the language. At least it's easier for people to come to terms that JavaScript is not Java. But there are huge misunderstandings about how this operates. And I keep seeing questions that go "I understand this is not static but <points out situation which is down to this not being static>"
this is just another parameter to a function at the end of the day.
The way you pass it supply it is different because it's implicit but ultimately acts as a parameter.
It's just not treated as such because of the name.
And who can really blame the people for misunderstanding it? Asking "what does this refer to" in something like function foo(x) { return this.bar + x; } makes as much sense as asking what x is.
 
9:28 AM
Well, I like that it has one cover-all answer
"Depends on the context"
My work here is done :D
 
*claps*
 
9:46 AM
@VLAZ Java has this as well, just a more simple one: the current instance
 
@KarelG that's the problem. JS was modelled to look like Java, hence having this. But it doesn't work remotely like it.
 
that "look like java" was an idea somewhere in the middle of the process
 
Marketing.
 
9:59 AM
meanwhile, Kotlin, also based on Java, also has this... but might be even more complex than Javascript's
this refers to one or more of the following
- the instance of the type (in a type method)
- the value of the extension parameter (in extension methods)
- the argument of an extension lambda (in extension lambdas)
keeping in mind, each of these can be active multiple times at the same moment
then this refers to whatever is most suitable
 
not much different to js
 
class ThisExample1
{
	val example1: String
		get() = "example1"

	fun ThisExample2.foo() =
		wrapped {
			println(example1)
			println(example2)
			println(example3)

			println(this@ThisExample1 is ThisExample1)
			println(this@foo is ThisExample2)
			println(this is ThisExample3)
		}

	private fun wrapped(body: ThisExample3.() -> Unit) =
		body(ThisExample3())
}

class ThisExample2
{
	val example2: String
		get() = "example2"
}

class ThisExample3
{
	val example3: String
		get() = "example3"
}
the use of `this` in Kotlin is mostly that it can be omitted...
but still, having multipe of them is something that JS probably wont accept
in JS, they would just shadow the outer one
 
10:39 AM
anyone?
 
everyone?
 
|| learn tumbleweed i.gifer.com/A1xE.gif
 
@KarelG Command with that shortcut already exists
 
|| unlearn tumbleweed
 
You do not have permission to remove this command.
 
10:51 AM
QQ
7 messages moved to Sandbox
@JBis the manual for unlearn says that I should be able to issue that, yet I cannot
 
11:29 AM
hey a question.

when I have two buttons and they have a :hover style
on the phone, when user put 1 finger on btn1 and the other on btn2 simultaneously
at the moment only the first btn shows :hover.. how can I get multitouch for :hover?
 
Trying to support ios and safari is like trying to support IE with touchscreen methods
As for your issue
Try using :focus and :active
they behave a little differently on ios (safari atleast)
and I think that might be what you want
When it comes to a production website, I always get too exhausted trying to debug safari issues, so I use styling frameworks or something else
Or I take it too seriously, and make like a million media queries + javascript feature detection
 
@MisterSirCode yeah I miss the times when Flash worked on every device the same.
I miss the times when you could really create crazy nice websites
and yes I hate steve jobs that he killed flash
and no :focus does not work (it does even not work for 1 btn)
:active works.. but exactly the same like :hover only for 1 btn at time
what I tried is also to add an on touch listener to the buttons and then make this.focus()
*$(this).focus()... yes yes I still use jquey and I love it..
aand I solved it with js now:
            $(".knob").on("touchstart", function () {
                $(this).addClass('hover');
    })

            $(".knob").on("touchend", function () {
                $(this).removeClass('hover');
    })
 
@Suisse Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. You have 25 seconds to edit and format your message properly before it will be removed. Please separate code blocks from your actual question. Put your question in 1 message and then your code in a 2nd and format it.
 
instead :hover .. use new class .hover
 
@Suisse actually, hover is not what you should use on phones
you need to look at touches
 
11:43 AM
yeaH i know.. no mouse and so
 
I just saw your snippet
 
its working :)
I hope it is not against some js-fatiqueness-law
or do I have to use react-fiber-angular
I am tired. hehe
 
iOS is annoying
 
@KarelG you need to have created the command or be a hard coded admin. I'll change the description.
 
11:59 AM
@JBis then make the room admins hard coded admins :3
easy solution
or, just allow room owners to control the bot?
 
Hello
 
Like, JBis, take for example, my discord bot. If I set my discord bot to require administrator priviledges, so that it could remove / write data and comments on servers, then that means Im basically making the bot an admin...

However, if the owner / admins of that server do not have control over the bots settings for that server, then its basically like having an uncontrollable moderator / admin.

Make sense?
so, naturally, any person who has the "ADMINISTRATOR" tag or "MANAGE GUILD" tag in discord, has full rights and control over my bot (For that specific server's settings, they cant interfere with settings for other servers)
Same should apply here :)
 
@MisterSirCode RO is a different role, they have certain permission to control the bot
 
@JBis Oh, I thought there was just 1 role per chatroom
Room Owner, or Not a Room Owner (Member)
and, IIRC, KarelG is a RO
 
|| function* foo() { yield 1; yield 2; yield 3; }; const it = foo(); const [x] = it; console.log(x)
 
12:07 PM
undefined Logged: `` Took: 0ms
 
However, RO's should be able to remove learned comamnd's github.com/jbis9051/JamesSOBot/blob/master/packages/plugins/src/…
 
undefined Logged: 1 Took: 0ms
 
but there is a bug
 
Ah, so its an actual issue with the bot atm
alright I see
@VLAZ What in the world are you trying to do..
 
Just testing something.
|| function* foo() { yield 1; yield 2; yield 3; }; const it = foo(); const [x] = it; console.log(x); console.log(it.next());
 
12:09 PM
undefined Logged: 1, {"done":true} Took: 1ms
 
"done"? Whered that come from?
 
The iterator is complete
 
huh
alright
and what are the yields for
(ive never used em before)
 
It's a generator function. You can essentially pause it and each yield is sort of like a return. But the next time you continue from there.
|| mdn function*
 
12:10 PM
im not a fan of generators
 
I remember reading up on generators like.... a year ago
 
|| shrug
 
and never used em for anything
 
¯\_(ツ)_/¯
 
couldnt find a good use for em with what I do
and I do a lot of different things
so idk
 
12:12 PM
|| console.log(5);
 
undefined Logged: 5 Took: 1ms
 
|| typeof NaN
 
:D
||> typeof NaN
 
@VLAZ "number" Logged: `` Took: 0ms
 
12:13 PM
Thats so cursed
why
why is it a number
 
Which explanation you want?
||> Number("apple")
 
I mean this is even worse:
 
@VLAZ null Logged: `` Took: 0ms
 
wait, what?
 
||> NaN === NaN
 
12:14 PM
@MisterSirCode false Logged: `` Took: 0ms
 
Why is it null?
 
that doesnt make sense
but does at the same time
 
No, your code makes perfect sense
I was going to demonstrate Number("apple") === Number("orange")
You cannot claim they are equal.
But why does Number("apple") produce null?
||> parseInt("apple")
 
@VLAZ null Logged: `` Took: 0ms
 
12:16 PM
umm...
||> Number("apple") === Number("orange")
 
@VLAZ false Logged: `` Took: 0ms
 
I wonder if thisll work
||> '10 13 21 48 52'.replace(/d+/g, function(match) { return parseInt(match) < 30 ? '*' : match; })
 
@MisterSirCode "10 13 21 48 52" Logged: `` Took: 1ms
 
so, it logs null but it's actually NaN
||> NaN
 
@VLAZ null Logged: `` Took: 0ms
 
12:17 PM
Probably just an issue with the parser
 
thanks, James. For lying to my face.
 
NaN and Null are probably accepted as the same object (null)
Or NaN just isnt recognized
/shrug
 
BTW, you're missing an escape in your code
||> '10 13 21 48 52'.replace(/\d+/g, function(match) { return parseInt(match) < 30 ? '*' : match; })
 
@VLAZ "* * * 48 52" Logged: `` Took: 1ms
 
Ah
||> setTimeout(function() { console.log("just a test"); }, 10000)
 
12:19 PM
@MisterSirCode "ReferenceError: setTimeout is not defined" Logged: `` Took: 0ms
 
Anyway, NaN is specified by IEEE 754 floating point standard. Some operations in JS leave you with a number and only a number. Like converting a string. Since not all objects convert to a number, you have a standin numeric value that represents that.
 
||> [typeof Number.NaN, typeof NaN]
 
@KarelG ["number","number"] Logged: `` Took: 0ms
 
And since you don't know what it was that got converted to a number, you cannot assert that two NaNs are equal.
Hence the Number("apple") === Number("orange")
 
12:21 PM
TIL that undefined isnt reserved... so you can set it to a value and break every == undefined check in a script
:3
 
...yeah
 
thats strange though
id expect it to be reserved
I wonder why it isnt
 
||> f = undefinded => undefined + 1; f(41)
 
@VLAZ null Logged: `` Took: 1ms
 
null?
ah, it's actually NaN
..because I cannot spell undefinded
 
12:23 PM
NaN is not recognized by James
 
||> f = undefined => undefined + 1; f(41)
 
@VLAZ 42 Logged: `` Took: 1ms
 
NaN = NaN is null
A recursive acronym there.
 
||> NaN == null
 
@Wietlol false Logged: `` Took: 0ms
 
12:25 PM
It's just the logging that shows null, it's still treated as NaN
 
||> f = () => return NaN; if (f() == NaN) return "NaN";
 
@MisterSirCode "SyntaxError: Unexpected token 'return'" Logged: `` Took: 0ms
 
oh wells
 
||> [1, 2, NaN, 4].indexOf(NaN);
 
@VLAZ -1 Logged: `` Took: 0ms
 
12:25 PM
||> NaN == NaN
 
@Wietlol false Logged: `` Took: 0ms
 
||> [1, 2, NaN, 4].includes(NaN);
 
@VLAZ true Logged: `` Took: 0ms
 
Thank you for coming to my talk.
 
12:25 PM
guys, if you are going to experiment a lot with the bot,can you go to the sandbox please?
 
But that place is boring
 
@KarelG we dont want to defile the sandbox with Javascript heresy
 
@KarelG sorry, about this.
 
12:30 PM
At any rate, for undefined being assignable - I can't remember why it is. I mean, the reason is probably stupid, but there is a reason beyond "it's not reserved".
It's probably something like "we sort of forgot it in the earlier specs and had to stick with it".
Fun fact, that's why typeof null === "object". It was a bug in the initial implementation and then they decided to leave it in because some code already depended on it.
 
uhm ... it cannot be assigned
you can use it as a variable name within a function scope though
 
Ah yes, the typical "oh yeah its been there for too long and were too lazy to recieve backlash for changing something so were keeping it"
||> undefined = "hello world"; console.log(undefined);
 
@MisterSirCode undefined Logged: `` Took: 0ms
 
It's partly fixed because now it's disallowed to assign to it. Used to be allowed, though. It's actually a window property, so you could window.undefined = 42. Or just undefined = 42.
 
hmm, yeah, it just breaks undefined, but you cant actually give it a value
 
12:33 PM
it does not break it
undefined = 'voodoo';
log(undefined) // still undefined
 
@KarelG If you assign to it, and then check if another variable is equal to undefined, it doesnt return the same result
 
Now try this in IE8
 
@MisterSirCode it does not - i mean the behavior is not changed
IE does not count :P
 
:51864041
undefined = "I'm not undefined!";
var someVar;
alert(someVar == undefined); //evaluates false!
Thats the code I keep finding as an example
 
That's IE code.
As in, something that was a problem in IE
You can also tell it's old by the alert
 
12:36 PM
@MisterSirCode did you have tried it?
will give you true
I AM SURE
 
|| let undefined = 41; undefined + 1
 
"ReferenceError: Cannot access 'undefined' before initialization" Logged: `` Took: 0ms
 
umm?
||> f = x => { let undefined = 1; return x + undefined} ; f(42)
 
@VLAZ 43 Logged: `` Took: 0ms
 
You can use let/const to shadow undefined in addition to parameters but cannot assign the global one.
I think you also need to be in function context for this to work.
 
12:39 PM
did I not say that? :P
7 mins ago, by KarelG
you can use it as a variable name within a function scope though
 
You did, true
 
but hey, bad practices man
I love some js nifties
 
@JBis why? I'm actually a fan of generators but in the last years I barely had a use case for them.. or at least none that would justify generators overhead/complexity.
 
with can go die in hell
 
javascript has with? o_O
 
12:41 PM
there was a frequent user here, Zirak, (owner of the caprica bot) that knows a lot js things that should be covered with a huge concrete layer
Learned a lot from him when I am new to js
and eventually started to seek out for little javascript hacks/tricks/obscurities
 
@makadev it does. If you immediately forget this information, it's going to be best for your sanity.
 
Taylor has used that a lot back then
eventually he quit using it, so that's great
but ... I admit that it has its uses. Yet ... there is a lot mis-use of that :P
 
@makadev i think they are confusing. Maybe I am not use to them, but it reminds of goto (not that they are similar, but it's confusing control flow).
 
thing with generator is that you do not know the loop context.
you have to check the function yourself
meh
give a array lol
 
I've seen exactly one somewhat sensible usage of with. It's in knockout when you start having nested bindings. Internally it nests everything using with to simplify you having to write x instead of foo[i].bar.baz.x
 
12:46 PM
one of the "should-be-used-after-reconsideration" javascript functions
that is an abuse :D
 
i don't really understand why with is discouraged but use isn't
 
Even then, KO leads to some confusing binding issues when you start stacking stuff.
@JBis the C# one?
 
@VLAZ hmm.. I remember with being useful in most languages which have records/structs.. but the JS with looks like a nice construct to annoy your fellow programmers or the poor soul that one day needs to modify your code
 
Doesn't that also clean up after you?
 
@VLAZ or the 10 other langauges that have similar thing
 
12:47 PM
hehe.. I should use it
 
what is this with?
the only languages I know that have with are VisualFriggingBasic, Groovy and Kotlin
 
||> obj = {foo: "hello"}; with (obj) { console.log(foo) }
 
@VLAZ undefined Logged: "hello" Took: 0ms
 
ah
 
Now, challenge, what happens if you have with(person) { firstName = "Fred" }? Answer is who the fuck knows.
 
12:49 PM
how is that different than use?
 
in that case, I also wonder why it is hated
 
@JBis Ye, the interleaved control flow can be confusing. But they can help alot cleaning up the code in interleaved producer/consumer cases
@Wietlol afair python? Pascal.. uhm.. I'm sure there are more
 
Wietlol does not know a lot languages besides Java(script) and Kotlin (which is Java), so probably he's limited 😮
 
> Kotlin (which is Java)
 
@JBis probably depends on language, but most I know use use for namespace resolution, practically saying "this code runs in this namespace so namespace lookups are done against that first", but with imports stuff into the current scope
 
12:55 PM
No guesses about poor Fred? Well, here's the thing - if person does have a firstName, then you assign to it. If it doesn't, you assign to a binding of the same name. If no binding exists, to the global object. Of course person could also be null, or undefined or any other value - with will be perfectly happy to do this for you and you'd not get any warning that your context might not be what you think it is.
strict mode directly disables with - it throws an error if it's used.
 
I find it weird that the many of the same people who hate JS love Python
 
and what about both?
I like py as well
 
ye python is pretty cool
 
It is :D
 
it's my swiss knife now, especially with database management
 
12:58 PM
And it's weird as fuck
 
you can like both, but how can you hate one and not the other?
 
idk
 
Hating a programming language just means you don't understand the language... Unless it's PHP. PHP sucks.
10
 
and best of all: I can supply a python code within a self-executable if someone has a custom request. It generates an export in xml by his choice. No adjustment required in CRM, he can select his own timeframe ect
 
I also feel like Python can be a bit redundant if you know js.
 
12:59 PM
a tailor suited program!
 
@Cerbrus lol
 
they have similar usecase
 
how are you going to make it an executable? :P
throwing in electron?
man that platform still annoys me. People should stop with Electron
 
@KarelG Install node.js then write a bash script starting with #!/bin/node
 
1:01 PM
until google gets their shit sorted out
 
:P
 
there is not much alternative to electron or not?
 
@VLAZ Classic xD
 
@KarelG No one in the world likes electron. It's a response for being in 2021 with no way to make cross platform native apps in any language besides C++.
 
tell that to Valve
or some tools I'm using for moding games, like "Vortex" (Fallout4 / Skyrim ) ... eventually decided to go to use different tools.
 
1:03 PM
it's a pretty sad state of tech tbh
 
man, I even warned Nexus that it's an incredible stupid idea. But whatever
 
and it's why no one makes native apps anymore
 
@makadev Qt, Flutter and with some effort, ASP.NET
 
I think flutter is tying to
Qt <- nohohohoho
I rather take electron
 
Qt == Cpp
i thought people like Qt tho
 
1:05 PM
people has some issues with c++ programming
like ok, it's difficult, but what it produces is awesome?
 
Anybody know what GOG use for their client? I know it's running some Python but no idea what the UI is in.
 
swift is a horror when comparing to c++ and people still stick to that 😂
 
also from a business perspective, "We spent $1 million to create a website. We can either spend $100 for a dev to create an electron app or spend another couple thousand dollars + ongoing dev fees to create a native CPP app."
 
it's cheaper yes. Sadly. Quality should mean something
 
electron usually looks better
bad example but Zoom is native and it looks like trash
Teams is electron and looks pretty good
 
1:08 PM
that depends on the effort the dev team is willing to take
 
QT has bindings for many languages, so C++ is probably not the only one. Also you can write Apps and Desktop stuff.. thats a Plus for QT.. but thats practically all.
 
VSCode is also Electron, right?
 
yea
@VLAZ no clue, but you can check for some trails in AppData folder
 
i wonder how jetbrains repos are setup
must be a pain to manage all the common code between all their apps and extensions
 
They probably have libraries for common stuff
 
1:22 PM
@makadev I have never used pascal... and python only just enough to realize I had no intention of looking at it further :)
 
@KarelG is electron still so bad? I mean the last years a lot of companies invested in that platform, before that it was a security havoc and all sure.. but so was nodejs and npm (well.. npm still is lol)
 
@JBis I think they just have one code base for "the editor" and the rest is extensions.
 
well the extension API must be insane. Some languages have completely new concepts.
 
You should see other Java editors. Eclipse is an entire platform by itself.
JetBrains have a similar concept but actually more subdued.
 
I tried both eclipse and intellij recently, to fix a bug in a minecraft mod
Intellij just worked...
Eclipse didn't
wouldn't
couldn't
 
1:27 PM
@Wietlol I didn't have many options.. (turbo) pascal was the first IDE+Compiler I had and it stuck.. did a lot of programming with FPC (FreePascal Compiler) which is the modernized variant and actually not half as bad. Python was mandatory too since I needed to use it for a project in University BUUT.. I realy learned to love pythons documentation.
 
So yay jetbrains
 
Look, the shortest and most accurate description of Eclipse I have is the following: "All you need to know about Eclipse is that it has a restart button as a core feature"
 
xD
 
I'm paraphrasing a guy I worked with.
 
@makadev is python's documentation special?
 
1:29 PM
Also, keep in mind that I've found Eclipse vastly superior to NetBeans.
 
@VLAZ this is how I used to describe Visual Studio :D
 
@Wietlol Ye kinda, it's very complete for the core libraries. And well documented which stuff was introduced in which version which helped a lot to handle the Python 2.6/2.7 and 3.x problems I often run into.
also.. most of the times there are examples
 
examples are very useful, I agree
but I cant remember when I last looked at documentation
my current tech stack is primarily based on "it just works"
 
@Cerbrus intellij IDEA ultimade is still my favorite java IDE atm
 
From my limited experience, it was rock-solid :D
 
1:34 PM
Eclipse is meh
 
@Wietlol hmm.. just noticed that was around 2009-2015.. my tech stack doesn't have python either since then
 
and ... during my student years, I had to use an IDE for our java programming classes which is meh ... I believe it's named netbeans?
 
still, Javascript and C# for example heavily rely on you looking at the documentation
 
my experiences with that ... nah
 
@KarelG filthy capitalist. Oppressing us Community Edition users.
(that's a joke)
 
1:35 PM
😉
 
I use the Community Edition. I can get the Ultimate from work but it's just not worth it for work. And I don't tend to write Java at home.
 
@KarelG netbeans was cool.. it still worked on projects where Eclipse simply died after filling up the RAM
 
we're talking about 12 years ago
it is possible it's better now
did not expect it being better than Eclipse lol
 
@makadev used it in a group project at Uni. It provided a truly cross platform experience because it worked equally bad on all OSes.
 
Well.. I switched from Eclipse to Netbeans, then to VSCode
For WebDev, I think I used some Eclipse Variant for Spring Boot/MVC some years ago..
@VLAZ yes, but the WebDev Plugin for NB could actually resolve CSS while coding.. and I could do PHP too, Eclipse just died of memory exhaustion or was horrible slow on everything
 
1:43 PM
Look, I want to be very clear here - by no means do I endorse Eclipse for non-Java stuff. I hardly endorse it for Java to begin with. I started off writing JavaScript in Eclipse and in retrospect, it was one of the worst dev experiences of my life.
Eclipse would hang every time you write a dot as an accessor, e.g., foo. - it would try to give you suggestions for what you might want to do.
All the suggestions were garbage, of course.
And it might take 10 seconds to show you the list.
YOU CANNOT USE THE ENTIRE IDE IN THE MEAN TIME!
 
hehe.. ye
 
I recently tried tabnine... although it was interesting and worked quite well in detecting what I wanted... it had 2 major problems that made it unusable
1, it had higher priority than native IDE commands
2, it didnt use the correct casing
but I suppose for JS development, it would be less of a pain
considering JS has a lot more camel case and a lot less IDE commands
 
You can also write it in snake_case, if you wish. Just to annoy anybody else who looks at your code.
Or my favourite kebab-case
 
just randomly switch between camelCase, snake_case, kebab-case and PascalCase
not as funny on Go..
 
oR mY fAvOuRiTe: MeMeCaSe
thereisonecasethatisactuallyreallyunderused
java.uses.lowercontinuescase.forpackagenames
 
1:55 PM
uppercase for variables, lowercase for constants
 
C# is just PascalCase everything nowadays
BTW IS THERE ANYONE THAT STILL WRITES SQL IN FULL UPPER CASE?!?!?!
 
Ye, the KEYWORDS at least
 
i see
DataGrip doesnt care if you use upper or lower case, but it autocompletes based on the first character
if must always be either full lower or full upper
 
since it often ends up in strings of another language without syntax highlight, uppercase makes it more readable in my opinion like: SELECT * FROM table WHERE column = "stuff";
 
00:00 - 14:0014:00 - 23:00

« first day (3814 days earlier)      last day (1132 days later) »