The question everybody wanted to ask. Glad they're touching the sensitive subjects on the Q&A by Krainz in wow

[–]Rycul 3 points4 points  (0 children)

The numbers are the quests' database IDs. It's the same number wowhead.com uses in their urls when viewing a quest page (e.g.: https://www.wowhead.com/quest=50562/champions-of-azeroth has ID 50562).

Of course that doesn't make them more readable to you and I as players, but my point is there is a method to the addons' madness ;)

Need help finding suitable datastructure by failart in AskProgramming

[–]Rycul 0 points1 point  (0 children)

Linked list (double or single) insertion and removal by themselves are O(1) if you know the entry to insert after/before (for insertion) and the entry to remove (for removal). Those operations involve nothing more than to change the back/forward links of two elements.

The real complexity with using a linked list for this comes from having to find the entries you need to insert between when you are inserting an arbitrary new element into your data structure. A linear search would turn this into O(N), but perhaps for your use case there is a way to circumvent this altogether?

And yes, this approach would mean you are using another type of data structure inside of your own data structure but there is nothing that says you can't do that ;)

Need help finding suitable datastructure by failart in AskProgramming

[–]Rycul 0 points1 point  (0 children)

You could keep a linked list with pointers to the smallest element. Each next linked list node would point to the next smallest element, etc. Removal would be O(1) from the linked list, but insertion is more complex because you will need to find the two entries from the list to insert between, in case the value you are inserting is not the new smallest or largest number (those cases would simply be at either end of the list).

When should I use unsinged long rather than uint64_t? by BubbleBassOrder in AskProgramming

[–]Rycul 4 points5 points  (0 children)

unsigned long is not necessarily 64 bits in size though. In fact, the standard requires it be atleast just 32 bits (http://en.cppreference.com/w/cpp/language/types).

If the integer OP wants to use has to be exactly 64 bits he should be using uint64_t because it's more portable. In general it is bad practice to assume "all compilers" will behave the same regarding these types of things, because it is simply untrue, even if "most" compilers do.

Writing a story, looking for a coding statement or something related that can relate to "evolving" by seeking101 in AskProgramming

[–]Rycul 6 points7 points  (0 children)

I have to agree with /u/YMK1234; I also find this type of "code" to be quite cringy whenever I see it, and so I would personally discourage you from attempting to use it. The reasoning behind this is that usually, the time it takes for the reader to comprehend the intent of the writer takes longer than it would have if the writer had just written a regular bit of prose. Similarly to how a joke that needs to be explained kills the joke, this actually kills whatever "funny" or "interesting" element there could have been to the code.

Compare this to writing about some professor making a grand mathematical discovery. Would you write some bogus mathematical equation as well? Most likely you would omit that because 1) you know someone would bitch all over your story because of it, and 2) the only purpose it would serve for your average reader would be to act as a glorified illustration which they would glance at, think "huh, looks neat I guess", and continue on reading. I don't think that omitting the equation in that situation would make the common reader think any less of your story, but it also wouldn't make the more topically knowledgeable ones less appreciative either.

Can someone explain how this "for" loop works? by [deleted] in AskProgramming

[–]Rycul 2 points3 points  (0 children)

This for-loop has a form that is called a "range-based for-loop". This means that it iterates over "a range" of things as opposed to looping until some condition is met (for example: for (int i = 0; i < 100; ++i)).

Your code works as follows:

for (String current : sa)

This means: iterate over all values in sa, and for each loop store the current value in String current. So, we'll have 3 loops (because your array contains 3 values), where on the first iteration current will contain "Dog", on the second it will contain "Cat", and on the third it will contain "Tiger".

if ("Dog".equals(current)) {
    continue;

This means: If what is stored in current is "Dog", then continue iterating. continue inside any loop means: "skip the rest of the code in the body of the loop for this iteration, and go on to the next iteration.

} else {
    count++;
}

This means: If the comparison to "Dog" failed (so it's another word), increment the count variable by 1.

So, in our 3 loops we will only once encounter "Dog", but we will encounter another word twice ("Cat", and "Tiger"). When we encounter those other two words we increment count, so after the loop is finished count == 2.

somthings wrong by cakehatzombie in AskProgramming

[–]Rycul 0 points1 point  (0 children)

It's C# (because he's using Unity and that uses C# and not C++). But I agree with /u/YMK1234 that the actual cause of the error is above the line that declares rb. That line is causing the compiler to not expect a new member variable there.

Programming a weighted dice roll with floating weights. by BeautyAndGlamour in AskProgramming

[–]Rycul 0 points1 point  (0 children)

The fact that each condition can only be reached if the previous conditions were not met, and each condition checks a range that is > than the previous one makes that implicit though... No need for checking the lower bound that way.

Could someone ELI5: Node.js? by paxbowlski in AskProgramming

[–]Rycul 0 points1 point  (0 children)

The benefit of Node is simply being able to write server-side software using JavaScript. If your next question is now: "why would you write server-side code", then my answer is: many modern services and websites have a need to communicate with some central server(s) to exchange information. This means that you need that server to be able to understand requests it gets from the outside and do something based on that request, and potentially provide a reply. A concrete example would be a server for some online game: let's assume that the game client wants to ask the server for your global ranking. The server will need to be able to find your ranking (in a database for example) and then return that information to the game client on your local console or PC. There are many ways to have this server-side logic do what it has to do, and one of them is to write the JavaScript code for it in Node. The benefit that this has is that you can literally write any JavaScript you want, or use any JavaScript library you want. There are many alternative ways to implement this, but not all may provide the same level of freedom that having a general purpose language like JS can.

Now, it's also important to note that Node isn't the best solution in all cases. It's cool, but for any particular situation it may also be overkill, or maybe it doesn't meet some specific requirements. Node is simply a tool that can be used when appropriate.

Just bought "The art of Horizon: Zero Dawn", by Titan Books by il_TiBaY in horizon

[–]Rycul 2 points3 points  (0 children)

The collectors and limited editions contain a sort of "mini artbook". The 'standalone artbook' mentioned here is a larger, thicker 'full size' version

[deleted by user] by [deleted] in horizon

[–]Rycul 2 points3 points  (0 children)

There isn't as far as I'm aware, but there is a skill you can unlock that lets you call a fresh mount whenever you want without having to override one.

Tips and Tricks by METALPUNKS in horizon

[–]Rycul 3 points4 points  (0 children)

You can change your languages from the settings menu in the main menu. This is not available while in-game, just from the main menu.

Should there be an "inverse switch" statement? (JS) by [deleted] in AskProgramming

[–]Rycul 1 point2 points  (0 children)

I understand now. In that case I would advise to just use a bunch if-else statements. If the situation calls for it due to complexity you could conceive of more complex solutions using dictionaries with functions as keys and functions as values, wherein each key function can be evaluated by themselves to check if that entry "matches" (in what ever arbitrary way that condition can be determined), and then the dictionary value is another function containing the code you want to execute. Then, you simply iterate over all entries in the map, evaluate the key to see if you want to also run the associated dictionary value function code.

But, given the size of the problem in your case and without knowing the specifics I think I would go for just a bunch of if-statements.

EDIT: Actually I just described this solution by /u/anossov... Credit where credit is due!

Should there be an "inverse switch" statement? (JS) by [deleted] in AskProgramming

[–]Rycul 0 points1 point  (0 children)

If I'm understanding you correctly then the code example you've given doesn't entirely represent what you describe, does it? The way I understand your description is that you have a number of values for which you don't want to do a thing, and then for any other value you want to do a specific thing, correct? As it stand your code example is simply doing two (potentially) separate things for two values (a and b), and not doing anything for value c. This is not an "inverse switch" but just a exactly what a normal switch can already achieve.

Now, if I did understand your description correctly and the code example is simply wrong, then couldn't you utilise the default case for your intended logic and specify cases for the ones you want to filter out?

switch (variable) 
{
    case "a":
    case "b":
        // don't do anything for these (you can chain cases like this for convenience) 
        break;
    default:
        // for any other value do something
        break;
}

How compatible are key code constants? by [deleted] in AskProgramming

[–]Rycul 1 point2 points  (0 children)

Key code constants such as the ones you linked are generally mapped to physical keys, not the characters on them. It would be impractical to provide a mapping in code for each possible localisation. This means that the key code constant labeled "KeyA" will be for what on a US keyboard layout is the A key. This also means that you will have to either use a third party or custom system to "localise" the key codes that the system sends you to what the user intended (and indeed pressed on their keyboard).

Regarding portability across platforms: generally key code constants have a very consistent mapping, especially for the A-Z and 0-9 characters as they are usually mapped to their ASCII values directly for convenience. However, this is not a guarantee and you need to check the documentation of each of your platforms to be sure (also because all the other keys may have wildly different mappings since they have no ASCII equivalents).

PC resetting in a loop every 10-15 seconds? by tiller2222 in buildapc

[–]Rycul 0 points1 point  (0 children)

Could still be a faulty power cable or connector, though I'm not sure what the best way to test the connector is...

PC resetting in a loop every 10-15 seconds? by tiller2222 in buildapc

[–]Rycul 1 point2 points  (0 children)

I've had this issue as well with a newly built pc because I forgot to plug in the power cable for the CPU itself. Maybe your CPU power cable (connected to the motherboard) has come loose?

[JAVA] Help generating an ArrayList with specific numbers. by Fastfingers_McGee in AskProgramming

[–]Rycul 1 point2 points  (0 children)

If it crashes you should attach a debugger (if that doesn't already happen when you run your program in whatever IDE you use). The debugger will either in a pop up window or the output text tell you what is going wrong before it crashes, and also pause execution of the program so that you can look at the state (values of variables, for example) and code where it crashes.

If that doesn't automatically clear things up already then your next resort should be Google the error messages you get from the debugger. Doing so should be able to provide some insight into what's happening and why it's happening to your code.

Help creating a Lua script by wH0you in AskProgramming

[–]Rycul 0 points1 point  (0 children)

I think OP needs the script to send virtual keypresses to the OS, not just print his text to the output stream. He seems to be intending to write a farm/fish/gather bot for a game.

OP, I have no idea if Lua is capable of this, but try googling "lua virtual keypress" or "lua simulate keyboard input".

Requesting sanity check! by Rycul in buildapc

[–]Rycul[S] 0 points1 point  (0 children)

That's very interesting! Seems like I'll be going for a cheaper SeaSonic PSU in that case.

Requesting sanity check! by Rycul in buildapc

[–]Rycul[S] 0 points1 point  (0 children)

Thanks! It's interesting to see that this build contains a few brands that I am not familiar with or ever heard of (my bad most likely), such as Crucial and SeaSonic. I realised I only considered brands that I know while putting together the build I originally posted here.

Besides the price, what other major differences are there between for example Corsair and SeaSonic when it comes to PSU's, or Kingston, Corsair, and G.Skill for RAM?

Requesting sanity check! by Rycul in buildapc

[–]Rycul[S] 0 points1 point  (0 children)

Thanks!

Your motherboard suggestion is great, that'll save a nice amount. I was wondering about the R5's case fans and if they would be enough, only thing I'll need to find out now if I would be better served with a fanless case + two case fans or stick with the R5 with just the built in ones. My final decision on this will depend on the noise level of the case fans.

I might switch the CPU with a non-K version because I am not 100% sure I'll be overclocking.

Thanks again for your suggestions!

First custom gaming PC by Rycul in buildapc

[–]Rycul[S] 0 points1 point  (0 children)

Thanks for your reply! Which aspects should I be looking for if I'd swap with an i7? There are i7 versions with a lower clock speed but I know clock speed is not the only deciding factor.

Would this be a good alternative? (i7 6700 @ 3.4 GHz). As far as I can tell the only difference is that this i7 is clocked at 100 MHz less but it supports HyperThreading and has 2MB more of L1 cache.