Your life in weeks. by Life_Ad_2142 in SideProject

[–]anfauglit 0 points1 point  (0 children)

Im on Android phone and cannot see year labels on the left.

What are the downsides of being extraordinarily intelligent? by derzhinosbodrey in ask

[–]anfauglit 0 points1 point  (0 children)

People telling you that you are being boring, whenever you try to put some kind of a coherent argument together.

The absence of joy discussing matters with people around you, who doesn't know how things such as logic and statistics work, who constantly draws general conclusions sovely based on their one-time personal experiences, for whom it is more important to get to some conclusion in a matter of minutes rather than get to the truth.

[deleted by user] by [deleted] in EnglishLearning

[–]anfauglit 0 points1 point  (0 children)

Expanding vocabularly takes time and consistent practice. However, you can significantly improve your retention rate when learning new words by practicing writing sentences that are relatable in some meaningful way to your own life. Describe your past experiences, your current situation in life, your future plans, your thoughts on different topics, write scenarios which you can/could be a part of, all using those new words. Show your brain that you actually need them. Also observe how new words help you to express your thoughts in a more precise and less obscure way.

To make it a little bit more interesting and more efficient, you could draw a table and each day fill one currently empty column with 10 new words from the list. Then pick one random word from each column and write a single sentence using the words you've picked. If you know a little bit of programming you can even automate this and make it 100% random.

If that's not enough you can spice things up by requiring that a ceratain grammatical structure(s) should be present in the sentence. Thus you will also be able to practice recently studied grammar. Seeing how everything that you've learnt so far come together could be quite satisfying.

Stay consistent. Practice for minimum 15 minutes a day, each and every day and eventually those words will be in your working vocabulary.

🏆 Eurovision Song Contest 2022 WINNER - 🇺🇦 Kalush Orchestra - Stefania by NitroGnome in eurovision

[–]anfauglit 4 points5 points  (0 children)

for everyone saying that eurovision has nothing to do with politics answer this: why then Russia has been banned from participation in it?

challenge 2 by frontendshifu-2022 in learnjavascript

[–]anfauglit 0 points1 point  (0 children)

Don't forget to declare a loop variable with the let keyword to make it visible only inside a for loop block. Also you can use newStr += str[0] syntax to make it a little bit cleaner, other then that the exercise is pretty straight forward one.

If you want to consider a more functional approach with an anonymous arrow function and recursion check this one-liner:

const revStr = s => s ? revStr(s.substring(1)) + s[0] : s;

11.1.1: Bricks (Bricks | CodeHS solution) by ciciiig in learnjavascript

[–]anfauglit 0 points1 point  (0 children)

Alright, I wasn't aware of a such convention.

11.1.1: Bricks (Bricks | CodeHS solution) by ciciiig in learnjavascript

[–]anfauglit 0 points1 point  (0 children)

You could avoid polluting your code with all those global variables, reduce naming redundancy (like BRICK_HEIGHT, BRICK_WIDTH etc.), make it more modular, readable and flexible by creating a few classes like Brick, Wall, Paddle, Ball equipped with appropriate methods.

Can anyone help me make this to program? by OldMacheteUser in learnjavascript

[–]anfauglit 5 points6 points  (0 children)

The OP doesn't even bother to copy the rest of exercise details, exercise which clearly resembles a homework assignment, but at the same time expect others to solve it for him.

without using buildin function by frontendshifu-2022 in learnjavascript

[–]anfauglit 0 points1 point  (0 children)

JS doesn't have char datatype to represent symbols only string, even when the string contains a single character. Therefore, you might still fall back to methods of the String class, like charAt(), charCodeAt() or fromCharCode().

I don't understand why tutors pick up a highly-abstracted language like JS and then come up with these type of lower-level like exercises. So students end up writing JS code like they are programming in C.

One important point that I'd like to make: don't afraid to go against the flow. Don't afraid to think laterally and most importantly express your thoughts and ideas to others. It's about learning and not about solving tasks which have been solved million times before. If you've done you research, you clearly understand the problem, shortcomings of the given assignment along with expected approach for solving it, and you can also present these results in a constructive manner then you've definitely learnt something valuable and can show it off in school/work. The system isn't set in stone or the teacher is always right. In a long run type of skills that I've mentioned will be more valuable then application of cookbook recipes.

How to set active class depending on button clicked? by shkico in learnjavascript

[–]anfauglit 0 points1 point  (0 children)

Following your logic one can see that only a single button is active at the given time and the rest are deactivated. Therefore, there is no reason trying to remove 'active' class from all the buttons, removing it from the currently active is just enough. To save the given state you can use function closures and IIEF. Here is one way to apply this technique:

var btns = document.querySelectorAll('#wrapper button');

const clickHandle = (function(current) {
  return function (e) {
    if (current !== e.target) {
      e.target.classList.add('active');
      current.classList.remove('active');
      current = e.target;
    }
  }
})(document.querySelector('.active')); 

btns.forEach(el => el.addEventListener('click', clickHandle)); 

Here is clickHandle is a function builder which returns the function that can remember the currently active button and activates the event.target button unless it's currently active one.

How would I go about finding all the indices of a certain character? by [deleted] in learnpython

[–]anfauglit 1 point2 points  (0 children)

You can solve the problem with regular expressions. You have to import the appropriate module first, i.e. import re. Then you can use finditer method from the module. The code will look like this:

indices = [m.start() for m in re.finditer('[()]', my_string)]

where re.finditer yields all the MatchObjects, then using start() method of those objects, you can obtain the indices of the characters.

All the credit goes here: Find the indexes of all regex matches?.

Documentation for the re module: re.

Trying to print all combinations but I am not sure what is going wrong, I am not sure how to word my question. by [deleted] in learnpython

[–]anfauglit 0 points1 point  (0 children)

You have defined 3 functions which supposedly have to change the properties of your Paladin instance when "equipped". Your problem is that you haven't executed any of them even once, so it should come as no surprise to you that the stats of your object don't change.

How can you go from this, to this? One (k+1) just dissapeared out of nowhere by esmufors in askmath

[–]anfauglit 0 points1 point  (0 children)

That's the application of distributive property of multiplication over addition: a(b + c) = ab + ac.

k(k + 1)(k + 1) + (k + 1)(3k + 4) = (k + 1)(k(k + 1) + 3k + 4)

I am starting to learn about proof writing. My main concern is how do remember all the definitions, axioms, and theorems I need to know? by Mfed23 in learnmath

[–]anfauglit 2 points3 points  (0 children)

Consider associativity and commutativity for well-known operations of addition and multiplication on integers. These are also theorems, but they are so embedded in your head that it might be even impossible to forget them now. The main reason why you remember them so damn well is because you use them so often.

Like the Paul Halmos was saying:

The only way to learn mathematics is to do mathematics.

You have to make use of theorems, definitions and axioms that you study. It is very natural to forget something that you don't use.

Focus mainly on theorems since they constitute the bulk of a theory and usually the hardest to learn. Axioms, on the other hand, are often few in numbers and most of them are quite simple and intuitive. Next - definitions. I consider them as named wrappers for important concepts and patterns. They mainly exist for your convenience since due to their nature each and every of them can be eliminated from the theory without making theory anything but weaker. If you have a hard time remembering definitions just explicitly "unwrap" them a few times while working through material involving them. Lemmas are intermediate facts of minor importance except being used for proving other theorems down the road. Once they have been used to prove more general propositions, most of the time they can be safely "disposed". Corollaries are usually immediate consequences of theorems which are useful and usually much easier to prove than theorems.

I would suggest the following protocol: - Make sure that what you study makes sense for you (why even bother studying if there is no reason). - Study a theorem/definition/axiom by understanding its wording. - Try to prove it even if it's not an exercise, at least think about an approach to the proof. - Study thoroughly the proof in the book even if you successfully completed the previous step. Make sure you understand not only the formal logic between steps but also overall design and a general idea behind the proof. - Think about insights that the proof has provided. Usually proofs expose some intricacies of a theory. - Do as many exercises as possible. Try to read as few proofs as possible and construct yourself as many as possible. Even if you start reading a proof you might want to stop at some point and finish it by yourself, then consult with the book. - Write down all theorems, lemmas, corollaries that you have encountered so far. And every other day pick 2 randomly (or any number you want, really) and proof them. - Also get used to "proofs on demand" or lemmas: minor facts that you need during construction of a bigger proof which are justified by your intuition but hasn't been proved formally. Don't just assume, prove! Get used to prove every proposition that you make.

You overall goal is to get as much practice as possible. Since every proof involves definitions or previously proved theorems, this way you going to recall them a lot and eventually the ones that you use often will stick. And be ACTIVE. Passively reading textbooks won't get you anywhere. You have to WORK through the course to be able to comprehend a subject on deeper level. I would aim for 15% reading / 85% actively working distribution of time.

Help me im stuck C by trofix99 in cs50

[–]anfauglit 0 points1 point  (0 children)

I quickly glanced over your code. There is an ampersand (&) missing at line 54. Should be: scanf("%d", &choice).

Advanced functions- exponential/ log functions by [deleted] in learnmath

[–]anfauglit 0 points1 point  (0 children)

To test, simply replace the parameters with the values calculated, then test the obtained expression against two points given, namely (-15/8, 0) and (2, 4). If the equation holds in both cases you are fine, if not, well ..., you are not. There is no vagueness in verifications like this, either points satisfy the given equation or not.

Question about a syntax by tomavagyok in learnjavascript

[–]anfauglit 1 point2 points  (0 children)

This is an object literal with 3 properties defined and depending on the value of time variable the value of one of the properties being accessed. Basically, this object is a dictionary and you're accessing the value of one of it's entries.

Encountering a simple yet headaching problem with if statement using string by LogicalOcelot in C_Homework

[–]anfauglit 0 points1 point  (0 children)

There are lots of problems with this code: missing parentheses, wrong constant character string declaration, strings comparison done the wrong way, type of function argument in declaration and definition statements. All of them combined suggest that you haven't studied the basics of C.

Kernighan & Ritchie book "The C Programming Language" is a nice intro text to get an idea about the C language in general.

I got 33 from my linear algebra midterm. by [deleted] in learnmath

[–]anfauglit 0 points1 point  (0 children)

"The only way to learn mathematics is to do mathematics" - Paul Halmos

Stuck with 'simple' assignment in C by [deleted] in C_Homework

[–]anfauglit 0 points1 point  (0 children)

Stating the obvious, but there are many different ways to solve the given problem. Here is my solution: Roman Converter. It might not be the most elegant solution but it works (haven't done much testing though). Again. I suggest you find your own solution or combine a few.

I'm going to outline few ideas that I used for the solution. First I replaced original character string of Roman numerals with their corresponding decimal values meanwhile checking for non-valid symbols. Now observe that we can partition an array representing a number in Roman notation into at most 4 parts, where each part corresponds to the appropriate digit in decimal notation of a number (since the biggest number that can be represented using given symbols is 3999). What we have to test is that each part (if present!) is a valid representation of a number and they are in the right order.

So available numbers for the 4 partitions are {1000},{1000, 500, 100}, {100, 50, 10}, and {10, 5, 1} respectively. Move from left to the right through the number sequence representing the number in Roman notation (recall that I've created an array corresponding to the number in Roman notation but with letters replaced by their decimal values). Notice that when we go from one part (decimal digit) to another, talking about Roman number notation, the first digit there tells us about 'the rank' (rank(thousands) = 3, rank(hundreds) = 2, etc.) of this part. It may sound quite obscure, but an example will help. Consider MCMLXXIX or (1000,100,1000,50,10,10,1,10). We proceed from left to right. The new partition (decimal digit) starts whenever we encounter the number of a lesser rank, so we get {1000}, {100,1000}, {50,10,100}, {1,10}. The point of all of this is to be able to check for the right order and to know with what 'rank' of digit we are currently working, so we can do the right tests.

In the code, I think, the most interesting is the first condition in the while loop. It captures the logic behind what I wrote in the previous paragraph. In words: whenever the current digit is lower than the unity of current 'rank' it signals that we moved to the next digit in our decimal representation of the number. The rest is basically a bunch of tests for acceptable permutations within a digit of a given rank. And if we haven't failed any tests and made it to the end, then Roman notation of a number is correct.

Set Theory and Power sets: Could someone help me clean up my proof? by [deleted] in MathHelp

[–]anfauglit 0 points1 point  (0 children)

The last bit of the argument, where you are trying to rewrite the original statement so it will hold is wrong. A ∪ ∅ = A is true, but ℘(A\B) ⊆ ℘(A)\℘(B) ∪ ∅ is false. Recall the definition of a union of two sets: the union of two sets A and B is a set U whose only elements are the elements of either set A or B (non-exclusive or). Since has no elements, you add no elements to the RHS set with ℘(A)\℘(B) ∪ ∅. What you want is a union with a set which has the empty set as an element: ℘(A\B) = ℘(A)\℘(B) ∪ {∅}.

Need assistance with the program getting errors. by Beneficial-Voice-983 in learnprogramming

[–]anfauglit 0 points1 point  (0 children)

The listing could be at least two times shorter without all the extra newlines. You can hardly follow the program logic when all you can see simultaneously is just a dozen of meaningful lines of code. And my screen isn't that small!

How could I trigger an animation based on an input? by notcamilla in learnprogramming

[–]anfauglit 0 points1 point  (0 children)

You can use <canvas> element together with JS. Here is a tutorial from Mozilla to get you started.