• Member Avatar for John_191
    John_191

    Replied To a Post in I failed this code challenge design

    It's pretty vague. Can you give examples of other kinds of "operators" and "iteration patterns"?
  • Member Avatar for John_191
    John_191

    Began Watching I failed this code challenge design

    I failed this coding challenge because my solution "does not scale for new divisors and iterations" I think it is actually a design (pattern) question, and would very much appreciate …
  • Member Avatar for John_191
    John_191

    Replied To a Post in C++ prog

    A c++ program that prompts the user to input high or low, if the person inputs high it prompts the user to input red or black. If the user inputs …
  • Member Avatar for John_191
    John_191

    Began Watching C++ prog

    A c++ program that prompts the user to input east or west, if the person inputs east, it prompts the user to input Northeast or Southeast. If the user inputs …
  • Member Avatar for John_191
    John_191

    Replied To a Post in Memory leak in Observer pattern

    How does it know you're "on the second user"? When you notifyObservers, all registered observers are notified. During the iteration for the second user, the first user has already been …
  • Member Avatar for John_191
    John_191

    Replied To a Post in Memory leak in Observer pattern

    I don't believe that you ever really meant this: for(Observer user : users){ for(Product currentProduct : products){ currentProduct.addObserver(user); currentProduct.setAvailable(true); } } You meant this: for(Product currentProduct : products){ for(Observer user …
  • Member Avatar for John_191
    John_191

    Began Watching Memory leak in Observer pattern

    HI guys, as I was playing with observers today I came across something interesting. I have a program which keeps a list of users (Observers) and products (Observables) and the …
  • Member Avatar for John_191
    John_191

    Replied To a Post in an initialized variable in for loop

    Take a close look at your swap. There's an error there! Your loop condition should be < instead of <=. And you can just say `half = DIM / 2;`
  • Member Avatar for John_191
    John_191

    Began Watching an initialized variable in for loop

    hello coders, i hope you all are going well, one thing blows my mind today in c i can't explain it this is why title is akward, so the thing …
  • Member Avatar for John_191
    John_191

    Replied To a Post in Encrypted USB Drive File Providing Access to a Password-Protected Webpage

    As long as there is a password I don't see the problem with revealing the address. I forgot to mention making the USB drive uncopyable. There are supposedly some schemes …
  • Member Avatar for John_191
    John_191

    Replied To a Post in Encrypted USB Drive File Providing Access to a Password-Protected Webpage

    Just an idea, and not a complete one at that. On the USB stick, install the chrome browser and also chromedriver, a program that automates the browser, so I'm assuming …
  • Member Avatar for John_191
    John_191

    Began Watching Encrypted USB Drive File Providing Access to a Password-Protected Webpage

    I'm trying to just do something fun for the kids in my class. I want to give the top students a USB Drive as a prize that has a link …
  • Member Avatar for John_191
    John_191

    Replied To a Post in shell script to remove controlM character from all the files in a directory

    You could add some protection against stripcr mangling binary files by searching for byte values above 127 (and 0 byte values). Too bad he couldn't use GNU sed: sed -i …
  • Member Avatar for John_191
    John_191

    Replied To a Post in shell script to remove controlM character from all the files in a directory

    In that case, you shouldn't be transferring them with FTP in binary mode! Use text mode and it will automatically fix the line endings for you. Also, that one-liner should …
  • Member Avatar for John_191
    John_191

    Replied To a Post in shell script to remove controlM character from all the files in a directory

    What do you mean by "shell script" then? What environment are you working in? Can you run bash? If so, you could run the following one-liner in the directory with …
  • Member Avatar for John_191
    John_191

    Replied To a Post in how to add check mate in my code.

    It's somewhat involved to test for checkmate. Testing for check is pretty easy. Can you write a function that tests if the king is in check? To test for checkmate …
  • Member Avatar for John_191
    John_191

    Began Watching how to add check mate in my code.

    #include <SFML/Graphics.hpp> #include <time.h> #include "Connector.hpp" using namespace sf; int size = 56; Vector2f offset(28,28); Sprite f[32]; std::string position=""; int board[8][8] = {-1,-2,-3,-4,-5,-3,-2,-1, -6,-6,-6,-6,-6,-6,-6,-6, 0, 0, 0, 0, 0, 0, …
  • Member Avatar for John_191
    John_191

    Replied To a Post in shell script to remove controlM character from all the files in a directory

    You can use **dos2unix**. Just run `dos2unix *.cpp` (or whatever the suffix is).
  • Member Avatar for John_191
    John_191

    Began Watching shell script to remove controlM character from all the files in a directory

    Anyone have a shell script to remove controlM character from all the files in a directory
  • Member Avatar for John_191
    John_191

    Replied To a Post in Checking for array value in another array

    What about the set intersection operator & [1, 3, 5, 7] & [0, 1, 4, 6, 7, 8] #=> [1, 7]
  • Member Avatar for John_191
    John_191

    Began Watching Checking for array value in another array

    Hello, I'm just starting off with Ruby, but I have a task that landed on my desk that I need a quick answer for, and haven't been able to find …
  • Member Avatar for John_191
    John_191

    Replied To a Post in Storing in different memory locations while looping

    In that case all I can think of is the following. I've only coded it for 4 digits maximum but you may want to expand it to 16 (or how …
  • Member Avatar for John_191
    John_191

    Replied To a Post in Storing in different memory locations while looping

    You could use the stack. Push the digits as you generate them. Then in a second loop, pop the digits and print them. You need to know when you've popped …
  • Member Avatar for John_191
    John_191

    Began Watching Storing in different memory locations while looping

    Hi guys. My task is to write a wombat 1 machine language program in CPUSIM that outputs the radix(only base 2 to 8 inclusive) reperesentation of a number. We have …