Jump to content

fizzlesticks

Member
  • Posts

    1,196
  • Joined

Reputation Activity

  1. Agree
    fizzlesticks got a reaction from Shiv78 in why am i getting this error in PYTHON 3   
    You're missing a ).
  2. Informative
    fizzlesticks got a reaction from Rakanoth in Websites which knows your new password is similar to your old one   
    Hashed, not encrypted.
     
    It could be encrypted, though that's almost as bad as plain text.
     
    Yes, many website store your last X passwords so you can't reuse them. They're still hashed and if they're not your current password that shouldn't be a problem.
  3. Agree
    fizzlesticks got a reaction from wONKEyeYEs in Websites which knows your new password is similar to your old one   
    Hashed, not encrypted.
     
    It could be encrypted, though that's almost as bad as plain text.
     
    Yes, many website store your last X passwords so you can't reuse them. They're still hashed and if they're not your current password that shouldn't be a problem.
  4. Funny
    fizzlesticks got a reaction from straight_stewie in Function   
    You use things that don't need indenting. For example here's elpiops answer in 1 line:
    print(dict((lambda d: (d, [d[name].add(item) for name, item in [("Thomas", "pen"), ("Mike", "pencilcase"), ("Thomas", "rubber"), ("Tom", "scissors")]])[0])(__import__('collections').defaultdict(set))))  
  5. Agree
    fizzlesticks got a reaction from 0x21 in Function   
    You use things that don't need indenting. For example here's elpiops answer in 1 line:
    print(dict((lambda d: (d, [d[name].add(item) for name, item in [("Thomas", "pen"), ("Mike", "pencilcase"), ("Thomas", "rubber"), ("Tom", "scissors")]])[0])(__import__('collections').defaultdict(set))))  
  6. Like
    fizzlesticks got a reaction from loganryan in Websites which knows your new password is similar to your old one   
    Hashed, not encrypted.
     
    It could be encrypted, though that's almost as bad as plain text.
     
    Yes, many website store your last X passwords so you can't reuse them. They're still hashed and if they're not your current password that shouldn't be a problem.
  7. Informative
    fizzlesticks got a reaction from vorticalbox in Python   
    list(set(s) ^ set(t))  
  8. Agree
    fizzlesticks reacted to vorticalbox in Recommendation for Portable Scripting Language   
    Care to define What these normal problems are?
  9. Informative
    fizzlesticks got a reaction from vorticalbox in Python input is the command prompt output from a seperate software   
    You could either pipe the output from the program to a python script or use the subprocess module to run the program from the python script and capture the output that way.
     
    To pipe the output, from the command line you would run
     
    BarcodeReader.exe | py my_python_script.py
     
    where my_python_script.py is using the input() function to get input.
     
    Or using the subprocess module make a script that does something like:
    import subprocess as sp proc = sp.Popen(['path/to/barcodereader.exe'], stdout=sp.PIPE) out = proc.stdout.read() print(out)  
  10. Like
    fizzlesticks got a reaction from ZacoAttaco in Don't know what's wrong with tip calculator. (Python)   
    You need to import time. If you open a command window / terminal and run it from there the window will stay open and you can see what error you're getting.
  11. Like
    fizzlesticks got a reaction from ZacoAttaco in Python: Merge Sort Error   
    The sample code is written in Python 2 where '/' is integer division. To accomplish the same thing in Python 3 you can use '//'.
  12. Informative
    fizzlesticks got a reaction from Sauron in Python: Merge Sort Error   
    The sample code is written in Python 2 where '/' is integer division. To accomplish the same thing in Python 3 you can use '//'.
  13. Informative
    fizzlesticks reacted to Unimportant in Python or C++   
    Many seem to think that simply squeezing Python code trough a C compiler will magically bring it up to speed. That naive view overlooks the true reason C and C++ can produce such fast code: undefined behavior.
     
    The C and C++ standards leave a lot of things undefined. There are some things you should not do, like going out of bounds on a array, and if you do - all bets are off.
    Many other languages, including Python, define almost everything. Going out of bounds on a array in Python results in a IndexError exception, I believe.
     
    That makes the Python code a lot safer and easier to debug (*), but it also means the implementation has to include all kinds of checks and tests in the code behind your back to be able to adhere to this standard. Accessing a array with a index that is computed at runtime ? (and thus, no clever compiler/interpreter can check index validity at compile time/beforehand) then the runtime code HAS to check the validity of the index every time the array is accessed, the language standard demands it. Such a check typically takes more time then the actual access, so it can slow things down a lot. And somehow converting the Python code to C/C++ does not help. If the converted application still has to adhere to the Python standard then all those checks and tests have to be added to the C/C++ code as well.
     
    The array access is just one example, there's many more behaviors that requires extra overhead if it has to be defined, some might find this article interesting:
    https://blog.regehr.org/archives/213
     
    (*) Al tough there's a lot of tools and programming paradigms these days to write very safe code in C++.
     
  14. Agree
    fizzlesticks got a reaction from Unimportant in C Program Compiles but Segfaults [Commented Code]   
    int limit = (int)argv[1]; argv is an array of "strings", you can't just use a cast to get the int value.
  15. Informative
    fizzlesticks got a reaction from vorticalbox in Using python to access a specific value in JSON   
    The requests library has a built in JSON thingy.
    a=requests.get(url) print(a.json())  
  16. Agree
    fizzlesticks got a reaction from Dat Guy in Incorrect program run time C   
    Please post the code as text, not a screen shot. It makes it much easier to help.
  17. Like
    fizzlesticks got a reaction from madknight3 in It's advent time again   
    Advent of Code
     
    A new programming challenge every day from now until Christmas. 
  18. Agree
    fizzlesticks got a reaction from codesidian in What should I learn first?   
    Find out what language your school uses for their beginner classes and start learning that.
  19. Agree
    fizzlesticks reacted to Unimportant in Always returning 0 in C   
    For starters, 'fracBitIsolate' and 'expBitIsolate' are never assigned a value before you use them as parameters to call those functions.
     
    Also, you're doing questionable things like dual bitshifts on a sigle line:
    int fracIsolate = hex << (32 - fracBits) >> (32 - fracBits); Is this shifting 'hex' (32 - fracbits) to the left and then shifting the result of that (32 - fracbits) to the right ?
    Or is it shifting (32 - fracbits) (32 - fracbits) to the right and then shifting 'hex' to the left with the resulting amount of bits? Why not split such things up into multiple lines and give the programmers that come after you some headache relief.
  20. Agree
    fizzlesticks got a reaction from Pcgeekbrain in IDE for Python??   
    PyCharm or Visual Studio.
  21. Agree
    fizzlesticks got a reaction from Nuluvius in IDE for Python??   
    PyCharm or Visual Studio.
  22. Informative
    fizzlesticks got a reaction from Alpha_Krk in IDE for Python??   
    PyCharm or Visual Studio.
  23. Agree
    fizzlesticks got a reaction from Unimportant in c++ how to remove spaces in a string??   
    Using "std::cin >> " will only read up to the first whitespace character. To read an entire line you should use std::getline(cin, string) which will by default read up to a newline character but you can also set whatever delimiter you want.
  24. Like
    fizzlesticks reacted to Tech N Gamer in Prints a char normally, but full string when debugged.   
    Sorry for the long wait, probably also breaking a forum rule here, but I wanted to inform you that after building the program, it doesn't do that single char thing, however, it does make a double progress bar 1 time. However, that did seem to be a one-time thing.
  25. Like
    fizzlesticks got a reaction from vorticalbox in Python, dics and lambda   
    The first one just returns a function object, the second one actually calls that function object. 
    But since you don't use the arguments at all you should just do
     
    strat_map = { '1': lambda: print('One'), '2': lambda: print('Two') } strat_map['1']() strat_map['2']()  
×