Skip to content
Sign UpLog In
Profile icon

xxpertHacker

@xxpertHacker
In the process of being deleted
Repls
Community
xxpertHacker
xxpertHacker
shared a Post
2 years ago
C++ Renaming base class members upon inheriting
While you're on, @DynamicSquid, are you interested in looking into this? Consider a class such as std::string, which has ::length(), and ::size(), wh
DynamicSquid
DynamicSquid
My first thought was function pointers, but they may not be the best option. Then I found this SO answer, but I don't think it's what you need. What do you need the alias for anyway? If you want to create two functionally equivalent functions, then just have one function call the other function2 years ago
xxpertHacker
xxpertHacker
shared a Post
2 years ago
JavaScript's undefined is it's own type, it doesn't have an object wrapper class, so we can't do "object" === typeof new Undefined, but, if you run th
SixBeeps
SixBeeps
According to the specs, undefined is one of the primitive data types, which is obvious, but it does mean that it is a type. It's possible that the browser handles undefined as a special internal type to make things easier to work with, but is inaccessible to the standard programmer. I don't have much time, but take a look through that specification and see if you find anything interesting.2 years ago
InvisibleOne
InvisibleOne
I'm no JavaScript expert, so maybe this might help: https://dmitripavlutin.com/7-tips-to-handle-undefined-in-javascript/2 years ago
xxpertHacker
xxpertHacker
shared a Post
2 years ago
I'm trying to figure out what type u'0' and u"0" are, but std::char8_t doesn't exist, so is it an un-named type? Ahh, these don't even compare! https
xxpertHacker
xxpertHacker
@DynamicSquid @CSharpIsGud I need help, do either of you have any time to check out this nonsense?2 years ago
Baconman321
Baconman321
wait wut u can declare operators? kewl! Oh, wait... I read it wrong :/2 years ago
xxpertHacker
xxpertHacker
shared a Post
2 years ago
I've never used Rust's package manager at all, so I'm 100% noob when using it. I've tried searching up stuff about it and using it, but I still can't
Wumi4
Wumi4
I have use cargo before, so I can't help you the problem you have but at least I can help you to use cargo at the basic level. To install an executable crate, use cargo install To run your project, use cargo run on the root directory of it. To build your project into an executable, use cargo build in the root directory, then cd to target/debug/ and you should see your executable with some other stuff in there. To initialize a new crate, use cargo init To know more about a crate, check out crat2 years ago
xxpertHacker
xxpertHacker
shared a Post
2 years ago
I'm looking for a convoluted, contrived example of why decade old JavaScript isn't used anymore, specificially, an example of abusing weird JS semanti
19wintersp
19wintersp
Here's some old ones: Oracle client-side JavaScript guide from 1999 JavaScript guide, year unknown (the website's source code is even better) "Definitive" guide to JavaScript, 1997 JavaScript and forms, 1996 A "JavaScript Bible" from 2001 JavaScript tutorial; looks new, but the content seems old 1998 dropdown I don't know if any of them have bad JS. Surprisingly, they look quite similar to most modern JavaScript. The most noticeable differences for me are the captialised HTML tags. You might b2 years ago
tussiez
tussiez
I have a really good example, but it mentions my name in it a lot for some reason? It was a clicker game. For every upgrade, there were two separate functions for each, and that was quite a bit (800 lines). There's a much simpler way to do this using arrays. Luckily, that was my first webpage with JavaScript, ever Was a big hit at school though! :> 2 years ago
xxpertHacker
xxpertHacker
shared a Post
2 years ago
I declare two variables, a and b, and then try to destructure an array into them. Why isn't this allowed? Update, Rust doesn't allow this either, so
Baconman321
Baconman321
https://stackoverflow.com/questions/20276494/error-expected-body-of-lambda-expression-what-is-lambda IDK why then, I think it's expecting an expression or smthing... Have you tried randomly deleting and adding things? Doing the above I found out that deleting the arrays makes that error go away but instead now it doesn't like the array-type (type-error). Ok I really wanted to know something that you didn't, but I'm out of ideas as to why this is happening at this point2 years ago
xxpertHacker
xxpertHacker
shared a Post
2 years ago
In my makefile at ./backend/makefile, I compiled with Clang's undefined behavior sanitizers. Now, most of the time, Clang dies upon attempting to com
CodePoint
Bash
xxpertHacker
xxpertHacker
shared a Post
2 years ago
So, I can easily write install-pkg clang-10, and get an updated C++ compiler, but the standard library is decoupled from the compiler. Does anyone kn
programmeruser
programmeruser
install-pkg, or obtain the deb file and extract it.2 years ago
xxpertHacker
xxpertHacker
@Coder100 I barely tried to search for this; but do you know anything about this?2 years ago
xxpertHacker
xxpertHacker
shared a Post
2 years ago
I made a simple overload for std::ostream, so that it can format arrays (T(&)[N]), but it's not taking effect for T(&)[0]. I'm not sure why it's taki
xxpertHacker
xxpertHacker
shared a Post
2 years ago
I'm using a variardic folding expression to output stuff to a std::ostream using std::operator""sv; template [[noreturn]] inline auto error(T... arg
programmeruser
programmeruser
What is the value of sv here?2 years ago
xxpertHacker
xxpertHacker
shared a Post
2 years ago
self.addEventListener( "load", { handleEvent(event) { console.log("Loaded!"); } }, { passive: true, once: true } ); All documentation t
tussiez
tussiez
You can check the MDN web docs on addEventListener EDIT: https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener 2 years ago
19wintersp
19wintersp
Spec2 years ago
xxpertHacker
xxpertHacker
shared a Post
2 years ago
Let's say that I have three functions: firstIndexOf indexOf lastIndexOf firstIndexOf just finds the first index of a number in an array. lastIndexOf
xxpertHacker
xxpertHacker
@EpicGamer007 @Coder100 Updated post; should provide more info about my problem.2 years ago
EpicGamer007
EpicGamer007
i mean, you can try binary search but it will only work on a sorted array. if the array is sorted, there are many methods to search for a value fast, otherwise, you would have to traverse through the array and get a runtime of O(n)2 years ago
Coder100
Coder100
isn't indexof just an array search?2 years ago
xxpertHacker
xxpertHacker
shared a Post
2 years ago
The MDN article about the builtin TypedArray abstract class claims the following: > The %TypedArray% constructor on its own is not particularly useful
xxpertHacker
xxpertHacker
shared a Post
2 years ago
I don't even know what to call it, but here I go. Let's take a language like C++, C++ has a "type system" this allows it to be efficiently compiled t
19wintersp
19wintersp
I think you might just be thinking of void/null safety.2 years ago
xxpertHacker
xxpertHacker
@fuzzyastrocat Thinking that you might have some ideas?2 years ago
xxpertHacker
xxpertHacker
shared a Post
2 years ago
I was looking at cppreference.com for all of the different std::string constructor overloads. I want to give the size up-front, so I believe that I w
Highwayman
Highwayman
Why not just use the normal string overload? std::string(12,'c'); should work just fine...2 years ago
xxpertHacker
xxpertHacker
shared a Post
2 years ago
I've been looking for a good networking library for C++ when someone had recommended cpp-httplib. It seems great! It has GZIP support, compression,
programmeruser
programmeruser
It means that the http requests are synchronous and not async. 2 years ago
CSharpIsGud
CSharpIsGud
I am quite sure that it is referring to the fact that it is synchronous. So when you make a request the current thread will hang until it receives a response or errors.2 years ago
xxpertHacker
xxpertHacker
@programmeruser Pinging you because you're the only person on Repl who might understand this.2 years ago
xxpertHacker
xxpertHacker
shared a Post
2 years ago
The title says it all. JavaScript has what are known as labels, their syntax: label_name: { break label_name; } an identifier before a block sco
DynamicSquid
DynamicSquid
I think the only thing similar are goto statements.2 years ago
xxpertHacker
xxpertHacker
shared a Post
2 years ago
I'm not asking how this can be done, since I know that it can be done. How can one disconnect a CSS pseudo-element from its actual element? By "disc
block pseudo-element disconnect fail
HTML, CSS, JS
fuzzyastrocat
fuzzyastrocat
Are you looking for all: initial (which would set everything to their initial values) or all: unset (which would un-inherit all default-inherited CSS values)? So you would do section::before { all: initial; /* or unset, depending on what you want */ /* put the rest of your css here */ } `2 years ago
Coder100
Coder100
section::before:hover?2 years ago
realTronsi
realTronsi
I guess pseudo elements behave kind of like a child, so I'm guessing the styling is also being applied on to it. I guess you could always just apply styling to the pseudo element yourself section::before { display: block; content: "This is a pseudo-element, which shouldn't be tied to the actual element."; color: black; background: white; } > I'm not asking how this can be done, since I know that it can be done. This is where you're confusing me, you say you know it is possible, so wha2 years ago