Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

AnotherMax

Member
  • Content Count

    12
  • Joined

  • Last visited


Reputation Activity

  1. Like
    AnotherMax got a reaction from IAmAndre in Jquery: change multiple img sources with equation   
    I don't really know any JQuery any more but if you want to programmtically add/remove something based on a boolean value it should be quite straight forward like so: This uses formated strings, so you can kinda add variables into strings using `${variable_name}` or a ternary operater which are really nice to use: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Conditional_Operator
    function get_image_name(filename, is_checked) { // Returns the file name with 'F' attached if is_checked is true, // otherwise just the filename with '.png' appeneded. return `${filename}${(is_checked) ? 'F' : ''}.png` // Backticks allow for formatted strings } x = get_image_name("picture_1", true) // Returns --> picture_1F.png y = get_image_name("picture_1", false) // Returns --> picture_1.png You can ofcouse modify the 'F' to be what you want etc or even add it as an extra parameter.
    Though thinking about it, this may or may not work depending on how you get the 'current' filename. As if you get it from the 'src' you'd need ot strip out the 'F.png', To do that you'd want to first remove the '.png' as thats consitent could use: str.replace(".png", "") -> returns new string without '.png', then add a check to see if the magical 'F' is the last index in the string, if it is then you can replace that then you'll have the original file name without the prefix.
     
  2. Informative
    AnotherMax got a reaction from Hi P in Programming - Development Questions   
    Yeah, it seems to be whats happening, you can still get just backend dev jobs but they are just harder to find. You can however in python use templating to generate static html pages like: Jinja or check out this: https://wiki.python.org/moin/Templating
    I was hired doing just backend but started doing frontend, not that I super wanted to but it has grown on me. (we use VueJS which is picking up traction)
  3. Informative
    AnotherMax got a reaction from Hi P in Programming - Development Questions   
    At work we use Python 3 with connexion and swagger to create endpoints for our frontend tools. I'd say to mess around with that, make a few things etc put on GitHub or something. Full-stack is much more desirable to employers.
  4. Like
    AnotherMax got a reaction from MladenM in import .py project to another project   
    Assuming all '.py' files are in the same directory, and 'file_to_import.py' is simply made up of a bunch of function I'd do:
    from file_to_import import function_name_1, function_name_2 from file_to_import import * # Imports all functions from 'file_to_import' I wouldn't do the import with the ` * ` as it's a bit ambiguous.
     
    If you have a directory structure like:
    - main.py - utils \ - thingy.py If you want to import 'thingy.py' functions into the 'main.py' you can do:
    from utils.thingy import function_name_1, function_name_2
  5. Like
    AnotherMax got a reaction from Zuccers in import .py project to another project   
    Assuming all '.py' files are in the same directory, and 'file_to_import.py' is simply made up of a bunch of function I'd do:
    from file_to_import import function_name_1, function_name_2 from file_to_import import * # Imports all functions from 'file_to_import' I wouldn't do the import with the ` * ` as it's a bit ambiguous.
     
    If you have a directory structure like:
    - main.py - utils \ - thingy.py If you want to import 'thingy.py' functions into the 'main.py' you can do:
    from utils.thingy import function_name_1, function_name_2
×