Welcome to Code Forum!

Join a community that supports you and your coding journey from day one. We strive to be a friendly, supportive community that empowers everyone to be better developers. By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Recent content by John Weiss

  1. John Weiss

    Bit Masking

    i think you're right, << is bit shift. So x must be the byte we're evaluating. I don't get why we say !=0 instead of =1.
  2. John Weiss

    Bit Masking

    I'm trying to understand the code here View: https://www.youtube.com/watch?v=NLKQEOgBAnw&t=443s I don't understand this notation: (x&(1<<i)) != 0 I understand we want to AND the bit at i position with 1, and see if it's equal to 1. So i assume that's what the formula is doing. Is this C...
  3. John Weiss

    Python Receive Input on Same Terminal Line?

    I just learned the following: both blessed and urwid are wrappers around the ncurses library blessed is a bit lower-level, best for making interactive games, like the example worms.py program or custom user interfaces like cursewords urwid is a widget library, for making "windows" and dialog...
  4. John Weiss

    Python Receive Input on Same Terminal Line?

    What do you mean, only in CMD? You mean, it won't work in vscode terminal? I'm not getting desired result in vscode terminal or separate command prompt. Enter: 8 Enter: 6 Enter: 5 Enter: 3 You entered a valid option: 3
  5. John Weiss

    Python Receive Input on Same Terminal Line?

    @cbreemer Just doing what i described. curses/ncurses can be used to control a terminal in free-form ways, without being restricted to basic line-entry. ncurses has been around since 1982. Is that old fashioned? curses is available for python, but I'm hoping there's a way to do the simple...
  6. John Weiss

    Python Receive Input on Same Terminal Line?

    @cbreemer Consider a textbox on a website. If you enter wrong info, they don't display another textbox underneath, and then another and another, until you get it right. They give you an alert, yes, but they keep re-using the same textbox.
  7. John Weiss

    Python Receive Input on Same Terminal Line?

    How to receive input on the same line, without clearing the rest of the terminal? The following prints a new "Enter" line for every bad entry. while not entry in menu: entry = input('Enter: ') (also asked on thecodingforums, freecodecamp, python-forum.io)
  8. John Weiss

    HTML & CSS Clicking Hidden Radio Button

    The user only has to click the image. The radio button click area occupies the entire image range. The user doesn't know they're clicking a radio button, they only know they're clicking an image. More info: https://css-tricks.com/the-checkbox-hack/
  9. John Weiss

    HTML & CSS Clicking Hidden Radio Button

    Trying to click a hidden radio button, but it's making the image go all wonky. How to fix? Everything seems normal until you click. Then the image remains wonky even after you move the mouse pointer away. The img-clip div constrains the size of the image. The radio-button click area is meant to...
  10. John Weiss

    JavaScript Reg Exp Not Working With matchAll

    For extra credit: How to exclude the surrounding braces from the output?
  11. John Weiss

    JavaScript Reg Exp Not Working With matchAll

    Solution is to use `.match` instead of `.matchAll`. .match gives an array. .matchAll can give an iterable by using the spreader const iter = [...templateFields]
  12. John Weiss

    JavaScript Reg Exp Not Working With matchAll

    Trying to get all delimited items in a string. Here's the code: const myString = "abc{{HELLO}}defg{{WORLD}}" const templateFieldsRegex = /\{\{\w+\}\}/g const templateFields = myString.matchAll (templateFieldsRegex) I expect to get array ["{{HELLO}}", "{{WORLD}}"] Not getting any results. also...
Back
Top Bottom