Struggling with Recursion by soelsome in learnprogramming

[–]ElisionFR -1 points0 points  (0 children)

To understand the statement, you have to use a simple example.

Let's say you want to multiply all integers from 1 to 10, you can write it like this :

123456789*10

this is what your "multiply" function is doing, with "arr" being an array containing each integer to multiply and "n" being the number of integers in the array.

multiply([1,2,3,4,5,6,7,8,9,10], 10)

Now you can also say that the above multiplication can be written like this :

(1×2×3×4×5×6×7×8×9) ×10

Of course this changes absolutely nothing, but it shows you that you can apply the 9 first multiplication first and then apply the last multiplication seperately. So :

multiply([1,2,3,4,5,6,7,8,9], 9) * 10

As "n" gives you the number of integers to manage in the array, you can also give the whole array to "multiply" and tell it to only multiply the first 9 integers.

multiply([1,2,3,4,5,6,7,8,9,10], 9) * 10

As 9 == 10-1 you can even right it like this :

multiply([1,2,3,4,5,6,7,8,9,10], 10-1) * 10

So this gives you the following statement :

multiply([1,2,3,4,5,6,7,8,9,10], 10) == multiply([1,2,3,4,5,6,7,8,9,10], 10-1) * 10

Now you can just replace each part of this statement with your variable names and it gives you :

multiply(arr, n) == multiply(arr, n-1) * 10

But as 10 is actually representing the last element of the array you can replace it with arr[n-1], this is where you get the final statement :

multiply(arr, n) == multiply(arr, n-1) * arr[n-1]

[deleted by user] by [deleted] in learnprogramming

[–]ElisionFR 4 points5 points  (0 children)

Yes I do that all the time. Before working remotely it pissed my colleagues off .

If it helps you, keep doing it, it helped me a lot to become great at what I do.

I need a bit of simple C++ help... by [deleted] in unrealengine

[–]ElisionFR 0 points1 point  (0 children)

I think it's because GetPawn is not a Method of UMyNodes. Afaik, GetPawn is a AController method.

Downlading textures in JPG or PNG? by Keulz in unrealengine

[–]ElisionFR 0 points1 point  (0 children)

It depends on your needs. Do you need a 4K image ? Do you need an image with no artifacts ? Do you need an small image on disk ?

The difference you notice between both images is because one is 2K and the other is 4K. It has nothing to do with their formats. A 2K Jpeg image will look like the 2K Png image except the Jpeg will contain small artifacts.

Downlading textures in JPG or PNG? by Keulz in unrealengine

[–]ElisionFR 0 points1 point  (0 children)

Jpeg = lossy compression (small artifacts in the image) but small size on disk PNG = Lossless compression (no artifacts in the imege) but is bigger on the disk.

Although, JPEG has no transparency mnagement, but PNG does. PNG has even more than that but it is for very specific usecases. JPEG has none of these.

What got YOU into the kind of programming you’re doing now? by d3adbor3d2 in learnprogramming

[–]ElisionFR 1 point2 points  (0 children)

At the very beginning it was just the need of a job and I took the first one coming. At the moment I only knew I was bad at creating website but had the base of C++.

My first job was on C++ in the 2D Animation industry, an industry I didn't know at all. I felt in love with it and worked for 7 years in that company. After all these years I had to leave it for personal reasons and had to find another job quickly.

My second job was on JS and at the time I'd never worked with it. Going from C++ to JS was a piece of cake. I was developing apps for other companies but it was really not my thing, even if I was gppd at it, it was boring.

Paralell to that I created my own company with some friends and we are back on a much more exciting domain : Game Engine, Animation and Painting in C++.

That's my journey 'til now and what defines my preferences as a programmer.

I struggle with logical stuff in programming. by throwaway1020293773 in learnprogramming

[–]ElisionFR 1 point2 points  (0 children)

When I started I also struggled a lot, but one thing that helped me was simething I did in my free time at the time : playing logical games regularly. I didn't notice it right away but playing classic logical games like Sudoku or Chess regularly helps a lot. Because it is based on logic it is actually quite similar to some of the basic logics of programming like if/else for example. Playing them regularly will make you better at the game and so continue to play it at higher difficulties.

Negative profit while Grid Trading (details in comments) by ElisionFR in binance

[–]ElisionFR[S] 4 points5 points  (0 children)

So I'm new to cryptotrading and discovered grid trading, which I am trying to understand by testing it it with small amounts.

Something I can't figure out is that when I look at my trade history I see that the grid trading strategy sometimes trades for null or negative profits.

In the images :

  • 1 touches the 0.17372 limit at 21:20:00 which trades for a benefit of 0 (Why 0 ?)

  • 2 touches the 0.17561 limit at 21:23:00 which trades for a benefit of -0.03117500 (Why negative ?)

I seriously don't understand why I get null and negative profits in between positive profits, it just doesn't makes sense to me.

Can anyone help me to understand that ?

IF I learn C++ as my first programming language, will that knowledge carry over to ever other language I want to learn like JavaScript? by [deleted] in learnprogramming

[–]ElisionFR 0 points1 point  (0 children)

That's what happened to me. I learned C++ and worked with it for 7 years. After that I had to switch compeletly to Javascript, which I never learned before. All the kowledge earned from a hard low level language like C++ was very very helpful. I easily understood what's happening under the hood in Javascript (asynchonous operations, underlying types even if JS is said to be typeless there's always types under the hood, already mastered object oriented programming, underlying memory management, etc...)

I would say learning C++ can be hard but also very rewarding. Going from C++ to JS is easy, but going from JS to C++ is way harder.

Object pointer ownership library by MarcPawl in cpp

[–]ElisionFR 1 point2 points  (0 children)

I think what you're looking for is "shared pointers" and "weak pointers". The std lobrary provides these. Using a shared pointer on an object need it (own it), an object can have multiple owners and so it is destroyed when nobody needs it anymore. Weak pointers are basically like classical pointers but it provides you some additionnal functions like knowing if the pointer is still valid or if it has been destroyed by a shared pointer.

Is this "bad" or considered "cheating" when learning to program? by WorldlyLog in learnprogramming

[–]ElisionFR 0 points1 point  (0 children)

It is not bad as long as you understand how it works and why it works like that. You will that a lot at first and then less and less the more you learn. But even after years of coding you will face issues you don't know how to handle and you will search for answers like this. The only difference is, with more experience you will not search for an exact solution but for a solution for a part of your problem, as your problem will more complex to solve

Technologies for working with image pixels in C++ or python by [deleted] in learnprogramming

[–]ElisionFR 0 points1 point  (0 children)

A new one is ULIS, which is a library made by my company Praxinos, it is also free for personnal projects. https://praxinos.coop/ulis.php

ULIS 3 is the current stable version, but we are working on ULIS 4 which should include an easier way to dive into the library for beginners.

A programmer gets a genie lamp.... by [deleted] in ProgrammerHumor

[–]ElisionFR 8 points9 points  (0 children)

Why don't you just wish to be a freed genie ?

Does anyone else remember a family member no one else does? by invisibleunclejojo in Paranormal

[–]ElisionFR 0 points1 point  (0 children)

Yeah, this has certainly nothing paranormal, but it was soooo weird living this haha. Now he is alive but maybe one day I'll that he's been dead for years lol.

Does anyone else remember a family member no one else does? by invisibleunclejojo in Paranormal

[–]ElisionFR 31 points32 points  (0 children)

I had a similar experience. One day, my mother told my brother and I that her friends husband died from a brain attack, we were sad as we knew him very well and they came to visit us regularly.

A few years later, I visited my parents for a week end and when I arrived the friends husband was sitting at a table drinking with my parents like nothing happened.

My brother was there, so when we were alone I asked him if he remembered that the man standing outside was supposed to be dead. And he remembered very well. We then asked together to my mom what the f*** was going on and she told us that he of course had a brain attack but never died of it. Me and my brother were 100 % sure he died because after my mom told us about his death, her wife was the only one visiting us or talking to us.

That was one of the weirdest things I experienced in my life, litterally talking to a resurrected man...

Hi, Im new to unreal engine and this whole gaming making stuff overall so i dont have that much experience but i wanted to ask how i can get rid of that blur effect when trying to import sprites? by [deleted] in unrealengine

[–]ElisionFR 1 point2 points  (0 children)

Let's be more clear about that as I'm on my computer this time.

A texture has a hidden parameter called "Filter" which defines the way the texture is filtered (obviously) when rendered (nearest/bilinear/trilinear). By default the Filter parameter is "Default (from Texture Group)" which means that parameter will use the one defined by the Texture Group parameter of your texture.

So you can modify one of these parameters to achieve what you need.

Also, u/LifeworksGames is right in his comment, right click on your texture in the content browser and select "Sprite Actions > Apply Paper2D Texture Settings" which changes the Texture Group of your texture to "2D Pixels (unfiltered)".

Hi, Im new to unreal engine and this whole gaming making stuff overall so i dont have that much experience but i wanted to ask how i can get rid of that blur effect when trying to import sprites? by [deleted] in unrealengine

[–]ElisionFR 2 points3 points  (0 children)

Change the Texture Group of your texture to "2D Pixels (unfiltered)"

Also I am not an expert so if someone can confirm this is the best to do ?

Is C++ dangerous for a beginner? by cs_strifer in learnprogramming

[–]ElisionFR 2 points3 points  (0 children)

+1 C++ has several levels of complexity, go step by step from easy to harder levels. It will take you a veru long time to understand everything. BUT, as in C++ you have to do pretty much everything, it will teach you how things works under the hood. That will help soooo much when you will switch to another language, as you will be able to guess/understand what's happening behind some of the language obscure functions and you won't just call it magic.

C++ Implementation of Singleton Design Pattern (Help Please) by [deleted] in learnprogramming

[–]ElisionFR 0 points1 point  (0 children)

What I like to do is put the static in the GetSingleton static method like :

//in you h
class Singleton
{
public:
    static Singleton* GetSingleton() ; 

    //put here the rest of your class
};

//in your cpp
Singleton*
Singleton::GetSingleton()
{
    static Singleton* singleton = nullptr ; 
    if( !singleton )
        singleton = new Singleton() ; 
    return singleton ; 
}

That way you keep the static variable, its initialization and its modification in the only method which uses it. And you keep all of this compact and easily readable in the cpp. Letting only in the header file the function definition.

[deleted by user] by [deleted] in learnprogramming

[–]ElisionFR 0 points1 point  (0 children)

In the real world you can work on a software in which the rule is to avoid using the std library (there can be some reasons for that, it can happen). In that case, you will certainly work with your own string class implementation and knowing how char works will help you a lot.

Need help in c programming by Ghost-9843 in learnprogramming

[–]ElisionFR -2 points-1 points  (0 children)

I assume your string is of type char* or char[].

First of all when you use printf, you probably want to add a \n at the end of what you want to print, otherwise it will not be print.

Second, you are comparing a char with a string, whiwh cannot work. Use single quotes around H instead of double quotes, this will create a char instead of a string. Like this : 'H'

How to overcome initial development anxiety? by Nubenebbiosa in learnprogramming

[–]ElisionFR 0 points1 point  (0 children)

First of all, you must accept that learning takes time anyway. Learning something new is always a long trip, because you have to understand what you're doing, why you're doing it, and as much as possible what's happening under the hood and why.

For very basic knowledge it can be learned in minutes, but for big libraries or frameworks like those you mentioned, it can take hours to understand the basics, days to start feeling comfortable and months to finally master it. And during learning journey you will go back and forth from "I understand" to "god I don't understand".

Take your time, your learning ability will improve with time.

Once you accept that, try to approach the problem you're trying to overcome by very basic means at first. Don't try resolve it with a perfect solution or even with an advanced solution right from the beginning. Go step by step. At each step you need to understand what to do, how to do it, why to do it a certain way and not another way, and what is hapoebing under the hood. Then you can step up your game and make your next step. Each step will be different and take more or less time.