Search results

  1. S

    How do I learn programming?

    For eg: Currently I am trying to learn bash shell scripting, text processing using bash etc. But the problem is I don't think I can learn it. Why? Because I don't know programming. In particular, problem solving. I don't know problem solving at all. I try my best but I fail. In the past, I tried...
  2. S

    C++ How does changes in user defined function gets reflected in main function in call by address?

    I've got it. int main( void ) { int x, y; // two variables, allocated on the stack, say at locations 0x4 and 0x8, values undefined change( &x, &y ); // receives 0x4 and 0x8 return x + y; // accesses memory at 0x4 and 0x8, returning the sum of the values stored there } void change(...
  3. S

    C++ How does changes in user defined function gets reflected in main function in call by address?

    the common reason i'm reading is "address gets passed so". but I'm failing to realize it mathematically like above.
  4. S

    C++ How does changes in user defined function gets reflected in main function in call by address?

    I've asked my question in the figure below as picture speaks 1000 words. My question in short is same as title. Code: #include<iostream> using namespace std; void change(int*,int*); int main() { int x,y; cout<<"Enter values of x and y"<<endl; cin>>x>>y; change(&x,&y)...
  5. S

    What should I do Before I give up programming?

    can you suggest a micro level roadmap on what should I do now in order to learn programming?
  6. S

    JavaScript What does the x and y value mean here? Can you show in a figure?

    function checkBoundaryCollision() { if (x - ballRadius <= 0 || x + ballRadius >= canvasWidth) { dx = -dx; } if (y - ballRadius <= 0 || y + ballRadius >= canvasHeight) { dy = -dy; } } Full code here: https://codepen.io/pelko/pen/gOjXdaq
  7. S

    What should I do Before I give up programming?

    I'm in the verge of giving up programming and wondering what could I do before I give up to make sure I did what everyone did. I've a bachelors degree in computer science. I didn't do it as well as I'd have liked to do, but that degree has gave me familiarity with most terms used in basic...
  8. S

    JavaScript How to reflect the ball at an angle?

    Here's the full code: https://codepen.io/pelko/pen/MWBpNmL When a ball collides with bat or walls, I want the ball to be reflected with an angle, how do I do it? I suspect there's lots of physics to it. So, should I stop this project here? I'd have to probably build a part of game engine…Can...
  9. S

    JavaScript How to paint an element in screen using javascript?

    <div class="body"> <div id="board"> <div id="bat" class="bat"></div> <div id="ball" class="ball"></div> </div> </div> This is my HTML. I've done CSS For all of them and generated this: Now, I want the bat to move left and right when I press arrow keys...
  10. S

    JavaScript input Direction confusion in snake game javascript?

    My confusion is cleared. arrSnake=[{x:0,y:1}] inputDir={x:0,y:1} are 2 different object names. It doesn't matter if we use same key name for both of them.
  11. S

    JavaScript input Direction confusion in snake game javascript?

    I must tell why my confusion came here: Earlier in the code, we’ve done this: //head of snake let snakeArr = [ { x: 13, y: 15 } ] Here x,y means the grid row 13, grid column 15. That is why I’m confused. We’re using same variable names in 2 places with different meanings. In this...
  12. S

    JavaScript input Direction confusion in snake game javascript?

    Here's the full code: https://codepen.io/pelko/pen/jOpBmPN This is the code that I'm interested in: window.addEventListener("keydown", e => { inputDir = { x: 0, y: 1 }; moveSound.play(); switch (e.key) { case "ArrowUp": inputDir.x = 0; inputDir.y = -1; break...
  13. S

    JavaScript Why will the if condition be executed in this recursive snake game?

    I'm currently watching tutorials to build projects as I'm still not in a phase where I can carve a project that I want all on my own. Currently, working on a snake game. let speed = 2; let lastPaintTime = 0; //Game functions function main(ctime) { window.requestAnimationFrame(main); if...
  14. S

    JavaScript How does props program flow work in react js?

    1) Start with App.js 2) It returns Users component. 3) Inside Users component we pass properties name and job. 4) Inside Users.js we access it using props.name and props.job. A figure that helped me
  15. S

    JavaScript How does props program flow work in react js?

    App.js: import React from 'react' import Helloworld from './components/HelloWorld'; import Users from "./components/Users"; const App = () => { return ( <div> <h1>List of Users</h1> <Users name="Zino Emi" job="Developer" /> <Users name="Lionel Messi" job="Web Developer"...
  16. S

    Date not passed via props in react js

    FIXED: date.toISOString should be date.toISOString()
  17. S

    Date not passed via props in react js

    App.js import './App.css'; import Subscription from './components/Subscription'; // import Myroutes from "./Myroutes.js"; function App() { let subscriptions = [{ id: "1", date: new Date("2021", "3", "23"), title: "Monthly Subscription", amount: "125.60" }, { id: "2", date: new Date("2020"...
  18. S

    CSS Bring navbar at center CSS

    any better ways to target that element? ul will be horrendous way of targetting it. I'll have other uls later that's why.
  19. S

    CSS Bring navbar at center CSS

    I want to do it using flex.
  20. S

    CSS Bring navbar at center CSS

    https://demo.w3layouts.com/demos_new/template_demo/28-07-2021/biodata-liberty-demo_Free/2002651968/web/index.html This is the website that I am trying to build. This is my current navbar. This is what I want to build. My focus is on "Home" to "Contact". I want to put it at the center of the...
Top Bottom