Jump to content

fizzlesticks

Member
  • Posts

    1,196
  • Joined

Everything posted by fizzlesticks

  1. You declared length() as a member function but you're trying to assign to it as if it were a variable.
  2. Can't tell from just what you posted. Please use code tags to post you entire class definition and copy/paste the exact error message.
  3. graph[node] returns a std::map<string, int>& which you can loop over to add the nodes to your DFS/BFS stack/queue/whatever.
  4. OrderedDict is. You could also make an OrderedCounter with just a bit of multi inheritance. class OrderedCounter(Counter, OrderedDict): pass
  5. The line char is never going to raise an exception since you define it as the loop variable. Which means you never create an instance of your class and inside the else clause 'char' is type 'str' not 'chars' like you expect. Strings have a built-in count function so doing 'char.count += 1' is trying to add a built-in function and an int just like error says.
  6. So char.count is a function? And you want to add 1 to what char.count() returns? Would be a lot easier to help if you posted your code.
  7. What's wrong with object.attribute += 1?
  8. If you only want to do iOS use Swift, if you want to do both iOS and Android use C#. For Swift and basic iOS devery watch the Stanford iOS 10 course on iTunesU. It assumes you already have programming knowledge tho, so you'll need to learn the basics first.
  9. You lose duck typing, which is a huge part of Python.
  10. Yes, the rest is already being done inside the loop.
  11. You don't need to check the item, only the count and you can get the item by using vector.back().
  12. Python is strongly typed though. Are you thinking of statically typed?
  13. In the line splits = os.listdir(args.fold_A) yes that works fine because "/Users/rexlee/Desktop/A" is a folder. Inside the loop when you do img_fold_A = os.path.join(args.fold_A, sp) img_fold_B = os.path.join(args.fold_B, sp) img_list = os.listdir(img_fold_A) args.fold_A = "/Users/rexlee/Desktop/A" sp = ".DS_Store" which makes img_fold_A = "/Users/rexlee/Desktop/A/.DS_Store" which is a file.
  14. Use loops just like you would with a 2d array but translate the x and y into the 1d index to access the array.
  15. .ds_store is a file, not a folder. You're calling the line img_list = os.listdir(img_fold_A) for everything in the folder, which of course causes an error when you call it with a file. You could either delete the .ds_store file at the start or add a check to skip files.
  16. He's using c++14(11?) features, if using g++ or Clang you'll need to compile with the -std=c++14 flag.
  17. In your original code and the code mathijs posted, once you get to the end of the loop you don't check the last value for having more occurrences. So for example if the vector only has 1 element, you go into the loop, add 1 to the count then exit the loop without checking if 1 > max_cnt. To fix that you'd need to add another identical check after the loop to do the final test. Or change the design into something like Unimportants.
  18. That and it doesn't test the last value of elements in the vector, you'd need an extra check after the loop.
  19. Fair, but I will get angry at you for the text color and missing the edge cases.
  20. Assuming it's correctly getting the "ScreenWidth" and "ScreenHeight", the problem would be whatever "SCALE()" is. Try removing all the * SCALE()s.
  21. The paths to your textures are wrong, try using the full path to make sure it works then you'll need to figure out where xcode starts your project and figure out a relative path that will work with both (or change the start in directory in xcode.)
  22. Which every C++ designer / implementer I've ever heard talk about it called a huge mistake. Don't make the same mistake. Vote Signed.
×