数学の恋人
just merge the lines
klimi
Thats cool
klimi
Like from
5
10
To 5+10 right
数学の恋人
yes
数学の恋人
that -d flag adds +
klimi
Neat
Alex
awk '{sum += $2}END{print sum}'
klimi
I need to learn more of awk.. That looks superb
Anonymous
awk is awkward, but useful
Alex
why awkward? is good
klimi
Alex
Mind explaining?
its pretty simple. awk reads file line by line(you should pass file name as second argument). second column is $2
Anonymous
数学の恋人
no initial value
Anonymous
every awk variable is initialized to 0
klimi
klimi
What is that END section?
Anonymous
gets executed at the end of the file, after all lines have been read
klimi
Damn that genious
klimi
I dont need python anymore
数学の恋人
klimi
Anonymous
How does it relate to c++?
Alex
no. just use standalone awk, without cut
数学の恋人
Alex
awk '{}' <filename>
数学の恋人
yeah
klimi
Anonymous
Again
klimi
Again
Reverse enginnering, hacking and related topics are allowed, but asking to hack facebook, instagram, etc. is NOT allowed. Also if you ask "how to become a hacker" and obviously have zero knowledge on anything related to that you may get warned or banned.
Anonymous
How does it relate to C++?
Anonymous
Anonymous
An awk interpreter can be written in C and C++, there's the (granted, distant), relation
数学の恋人
数学の恋人
it's awk
Vinícius
Can someone help me?
I'm trying to normalize a vector2<float>, in a game I'm creating in SFML,
When my player moves to the right the velocity is 30.0f, when it moves to the top the velocity is 30.0f, but when this two things happens together, the player moves faster, how can make it equal the the others?
I try this:
d * sqrt(2) = 30 (player's velocity)
But the player moves too slow.
Vinícius
(sorry for the large msg)
Artöm
You need to calculate horizontal and vertical components of speed and velocity separately
Vinícius
How so?
piggyho
x and y vector.
hypotenuse from x ° y angle
Martin
We
Martin
well, that's normalization does.
Đỗ
u can boost the player's speed in every way u design
Đỗ
try tinkle it in some test/ dump case first
Robert
Hey guys, how can I paste the text copied from Windows into the text file in the remote Linux?
Robert
Just by command line
Artöm
I meant projection of speed on 2d plain
Vinícius
Thanks, I try to implement that.
Vinícius
I'll try*
Artöm
Sorry I should have said velocity
@unchanted
Right now i was studing critical section problem in OS, where we have to synchronize the critical section code to resolved the issue of share "resources". What are these resources and how can i access these resources in c/c++ program?
olli
@unchanted
For example?
@unchanted
And how can i access them?
@unchanted
Is a global variable is stored in stack
olli
doesn't matter where they are stored
@unchanted
Stack memory is cleaned after the code is executed
@unchanted
So it would never be counted in mutual exclusion as it would never be causing an issue to another code..
Anonymous
olli
yes, but it doesn't matter in that case (btw, in the C++ standard there is no such concept as stack and heap, it's just how it's implemented)
@unchanted
olli
@unchanted
This seems confusing 😅
@unchanted
U mean we cannot use stack and heap in standard c++ compiler?
olli
again, my point being, when talking about Critical Sections and race conditions it does not matter whether you're accessing heap or stack memory
Anonymous
Anonymous
Compiler only knows the return type and the argument type for malloc
Anonymous
malloc can be anything
Anonymous
It could even be a macro
@unchanted
Anonymous
And depending on runtime
Anonymous
Malloc can change significantly
@unchanted