Python Programming & other inferior programming languages thread

Discussion in 'The Mainboard' started by Walt Disney, Jul 15, 2015.

  1. kentucky_dawg

    kentucky_dawg Fan of: Georgia
    Donor
    Georgia Bulldogs

    Walt Disney likes this.
  2. broXcore

    broXcore cat
    Donor
    Kansas State WildcatsNew York KnicksKansas City ChiefsSporting Kansas CityTottenham HotspurFormula 1

    is there one that you would suggest over another? i would assume java, right?
     
  3. kentucky_dawg

    kentucky_dawg Fan of: Georgia
    Donor
    Georgia Bulldogs

    Just depends on what you want to get into. JavaScript is more how websites work for the people using them (how certain objects on the screen will animate or move around). Its really what you see when you visit a website and interact with it. Java, however, is more back-end programming which is typically something the person visiting a website will never know exists (or shouldn't). It's more about security, data, and how the website operates as a whole.
     
    clemsontyger04 and broXcore like this.
  4. broXcore

    broXcore cat
    Donor
    Kansas State WildcatsNew York KnicksKansas City ChiefsSporting Kansas CityTottenham HotspurFormula 1

    awesome, thanks for the info. thinking i might just start with python and build from there instead, since i'm learning just to learn right now.
     
    kentucky_dawg and Walt Disney like this.
  5. Pile Driving Miss Daisy

    Pile Driving Miss Daisy It angries up the blood
    Donor
    Texas LonghornsAtlanta BravesAtlanta HawksAtlanta FalconsAtlanta UnitedGeorgia Southern Eagles

    Yeah Java and JavaScript are worlds apart despite similar names.
     
    leroi likes this.
  6. Name P. Redacted

    Name P. Redacted I have no money and I'm also gay
    Donor
    Kansas State WildcatsSeattle Kraken

    what about loops is inherently confusing?
     
  7. kentucky_dawg

    kentucky_dawg Fan of: Georgia
    Donor
    Georgia Bulldogs

    Nothing really, now looking back on it. I think I just had trouble with the fact that it wasn't always a linear progression and just overcoming the initial way of learning how they work. There are definitely way more advanced concepts, to be sure, but I think when you are first starting out they are the hardest concept to overcome, imo.
     
  8. Walt Disney

    Walt Disney #Dawgzy
    Donor TMB OG
    Georgia BulldogsManchester City

    for me it was just understanding how to do something with a loop besides printing, like in my example

    idk why it was so hard, I got it to work now so I think I understand
     
  9. fsck~

    fsck~ ~
    Staff TMB OG

    I would avoid javascript to start unless you just want to learn website stuff. It doesn't closely relate to other languages.
     
    leroi and broXcore like this.
  10. kennypowers

    kennypowers Big shit like a dinosaur did it
    Donor TMB OG
    UCF KnightsAtlanta BravesJacksonville Jaguars

    Compared to Python there are like no intrinsic functions in fortran so I have to loop like crazy. When I get about four nested loops deep I usually have to start putting comments before my end blocks to know which ones I'm closing.
     
  11. Walt Disney

    Walt Disney #Dawgzy
    Donor TMB OG
    Georgia BulldogsManchester City

    lol now that I know this while loop I could could overflow friends emails if I wanted

    or create a fake gmail and run the script :loldog:
     
    Where Eagles Dare likes this.
  12. Joe_Pesci

    Joe_Pesci lying dog-faced pony soldier
    Donor
    Wolfsburg

    something tells me google has thought of that one
     
    derfish, Walt Disney and nofatchix like this.
  13. Walt Disney

    Walt Disney #Dawgzy
    Donor TMB OG
    Georgia BulldogsManchester City

    Yeah I'm sure there is a cap
     
  14. kennypowers

    kennypowers Big shit like a dinosaur did it
    Donor TMB OG
    UCF KnightsAtlanta BravesJacksonville Jaguars

    Guy at our company created his own send_email.py class that uses the email and MIME packages. He wrapped it into a simulation monitor that gives us email updates on our ongoing simulations and is really handy. I would post it but it's not my code :/. Here is some more info though https://docs.python.org/2/library/email.html
     
  15. fsck~

    fsck~ ~
    Staff TMB OG

    Yeah quick way to get blocked or at least marked as spam.
     
  16. fsck~

    fsck~ ~
    Staff TMB OG

    Okay my AI fantasy football league simulator is open for business if anyone wants to check it out: https://github.com/colin725/rff

    There is a readme to help get started and it shouldn't be intimidating for anyone here if anyone else wants to join. Here is the sample you would need to expand on before the first game of the season:

    Code:
    def draft_player(available_players, team):
        global current_year
        for i in range(0, len(available_players)):
    
            # Access the players projections as well as past yearly and weekly stats to make your decision
            player = player_history[available_players[i]]
            projection = player.yearly_data["Projected"].season_totals
            last_season = player.yearly_data[current_year - 1].season_totals
    
            # Replace this logic with your own
            if team.is_position_open(player.position):
                return available_players[i]
    And there is a bunch more info in the readme from the link.
     
    Krieger likes this.
  17. Where Eagles Dare

    Where Eagles Dare The Specialist Show On Earth
    Donor
    Auburn TigersAtlanta BravesWashington Football TeamAtlanta United

    I just wrote a bad ass loop that gives me the Max and min of any list. :smug:

    Get in my level.
     
  18. leroi

    leroi -
    Donor
    South Carolina GamecocksGrateful Dead

    Javascript runs inside the browser. That is to say, each browser (IE, Firefox, Chrome) processes JS code itself, and each has a slightly different way of interpreting JS code. That's the most important thing to know about it.

    Java, Python, C++, C#, etc., do not run inside the browser, they run only on your OS (i.e. windows, linux, etc)

    this of course has major implications for what Javascript can do, and explains why it is so popular despite being such a miserable language to code in. Most people use Javascript through API's, like jQuery or d3 or Google Maps API

    http://jqueryui.com/draggable/
    https://github.com/mbostock/d3/wiki/Gallery
     
    Name P. Redacted likes this.
  19. Name P. Redacted

    Name P. Redacted I have no money and I'm also gay
    Donor
    Kansas State WildcatsSeattle Kraken

    I've been trying to do this in google sheets and it is annoying as fuck. i want to highlight the max in a range.
     
  20. Where Eagles Dare

    Where Eagles Dare The Specialist Show On Earth
    Donor
    Auburn TigersAtlanta BravesWashington Football TeamAtlanta United

    That is pretty easy in excel, but not sure how it works in Google's dumbed down version of excel
     
  21. Where Eagles Dare

    Where Eagles Dare The Specialist Show On Earth
    Donor
    Auburn TigersAtlanta BravesWashington Football TeamAtlanta United

    Gotch you my bro.

    Format, conditional formatting,

    Select your range.

    Format cells drop down as Greater than.
    In box below do =Max(range)-1

    Booosh.
     
    Walt Disney and Name P. Redacted like this.
  22. Walt Disney

    Walt Disney #Dawgzy
    Donor TMB OG
    Georgia BulldogsManchester City

    this post is from python

    jk I'm too dumb to do that
     
    Name P. Redacted likes this.
  23. Walt Disney

    Walt Disney #Dawgzy
    Donor TMB OG
    Georgia BulldogsManchester City

    upload_2015-7-23_14-28-22.png

    kewl I made that in python (well the graph isn't cool but the twitter mining was)
     
    #174 Walt Disney, Jul 23, 2015
    Last edited: Jul 23, 2015
  24. Pile Driving Miss Daisy

    Pile Driving Miss Daisy It angries up the blood
    Donor
    Texas LonghornsAtlanta BravesAtlanta HawksAtlanta FalconsAtlanta UnitedGeorgia Southern Eagles

    Not super related, but even though I'm more of a .NET developer at work (doing web stuff mostly), I just went to a Node.JS class offered here in Austin that was fucking tits. Ready to maybe run it to host some sort of simple webapp on my Raspberry Pi (ashamed to say that I haven't run anything on it since I bought it a couple months ago).
     
  25. Aaron Hernandez

    Aaron Hernandez LikeMyPostCampaign: https://bit.ly/2kKJpot
    Donor
    Liberty Flames

    Learning oop in my coursera class was kicking my ass for a little while but now I'm starting to make headway and it's pretty fun. Making blackjack game with a card, hand, and deck class.
     
  26. fattus

    fattus Well-Known Member
    Donor
    Colorado RockiesDenver NuggetsDallas CowboysColorado AvalanceBoise State Broncos

    A programmer's wife tells him, "Run to the store and buy a loaf of bread. If they have eggs, get a dozen."

    He comes home with 12 loaves of bread.
     
    MA, clemsontyger04, broXcore and 6 others like this.
  27. Walt Disney

    Walt Disney #Dawgzy
    Donor TMB OG
    Georgia BulldogsManchester City

  28. nofatchildren - cissp

    nofatchildren - cissp Free Da Guys
    Donor TMB OG
    Tiger Woods

    There are only 10 types of people in this world.

    Those who know binary and those who don't.
     
  29. Name P. Redacted

    Name P. Redacted I have no money and I'm also gay
    Donor
    Kansas State WildcatsSeattle Kraken

    god please no
     
    MA, og543ss, Room 15 and 6 others like this.
  30. Joe_Pesci

    Joe_Pesci lying dog-faced pony soldier
    Donor
    Wolfsburg

    have you heard the one about the PEBKAC error? hue hue
     
  31. Walt Disney

    Walt Disney #Dawgzy
    Donor TMB OG
    Georgia BulldogsManchester City

  32. Name P. Redacted

    Name P. Redacted I have no money and I'm also gay
    Donor
    Kansas State WildcatsSeattle Kraken

    Code:
    def build_source_device(input_data, template_variables=None, sel2032_name=None, ww_opc_client=None, ww_opc_scan=None):
        device = create_device(input_data, template_variables, sel2032_name=sel2032_name, ww_opc_client=ww_opc_client,
                               ww_opc_scan=ww_opc_scan)
        worksheets = input_data.get_worksheet_names()
        for worksheet in worksheets:
            if worksheet == 'Binary-Inputs':
                for binary_input in binary_data(input_data.get_rows('Binary-Inputs', 'Binary_Inputs'), template_variables):
                    device.add_binary_input(
                        binary_input['binary_input'],
                        binary_input['description'],
                        binary_input['slave_data']
                    )
            elif worksheet == 'Binary-Controls':
                for binary_control in control_data(input_data.get_rows('Binary-Controls', 'Binary_Outputs'),
                                                   template_variables):
                    device.add_control_output(
                        binary_control['control_output'],
                        binary_control['description'],
                        binary_control['slave_data'])
            elif worksheet == 'Analog-Inputs':
                for analog_input in analog_data(input_data.get_rows('Analog-Inputs', 'Analog_Inputs'), template_variables):
                    device.add_analog_input(
                        analog_input['analog_input'],
                        analog_input['description'],
                        analog_input['slave_data']
                    )
            elif worksheet == 'Counter-Inputs':
                for counter_input in counter_data(
                        input_data.get_rows('Counter-Inputs', 'Counter_Inputs'),
                        template_variables):
                    device.add_counter_input(
                        counter_input[0], counter_input[1], counter_input[2])
            elif worksheet == 'Analog-Outputs':
                for analog_output in setpoint_data(
                        input_data.get_rows('Analog-Outputs', 'Analog_Outputs'),
                        template_variables):
                    device.add_analog_output(
                        analog_output['analog_output'],
                        analog_output['description'],
                        analog_output['slave_data']
                    )
        device.sort_data()
        return device
     
    Walt Disney likes this.
  33. kentucky_dawg

    kentucky_dawg Fan of: Georgia
    Donor
    Georgia Bulldogs

    Are there no switch statements in Python?
     
  34. Name P. Redacted

    Name P. Redacted I have no money and I'm also gay
    Donor
    Kansas State WildcatsSeattle Kraken

    i think there are. they would be a lot more appropriate in that example than what is used
     
  35. kennypowers

    kennypowers Big shit like a dinosaur did it
    Donor TMB OG
    UCF KnightsAtlanta BravesJacksonville Jaguars

    Went in today thinking I'm going to add a tiny little snippet to a program that our genius asian developer made that will make my life so much easier. Checkout the source, remind myself of how much C++ sucks, start flowing through it ok. Then get to the bones of it and realize there are like 100 included functions with dozens of buried functions in those. I'm just going to start from scratch.

    [​IMG]
     
  36. fsck~

    fsck~ ~
    Staff TMB OG

    There aren't. There are some hacky ways to use dictionary and act as one, or just use if statements.
     
  37. Pile Driving Miss Daisy

    Pile Driving Miss Daisy It angries up the blood
    Donor
    Texas LonghornsAtlanta BravesAtlanta HawksAtlanta FalconsAtlanta UnitedGeorgia Southern Eagles

    Yeah I hate using long chains of 'if else' but a switch statement is basically the same thing and is less object oriented according to some people. Looks much cleaner though.
     
  38. Walt Disney

    Walt Disney #Dawgzy
    Donor TMB OG
    Georgia BulldogsManchester City

    more play data for anyone. I'm doing some stat learning with python, so I'm going to use this dataset.

    this guy is pretty popular so some might have seen this. But it has all the data from every season in MLB history

    http://www.seanlahman.com/baseball-archive/statistics/
     
    UnicornDickslam likes this.
  39. hood b. goode

    hood b. goode thats what i love about these HS chicks, man
    Donor
    Michigan WolverinesNew Orleans PelicansNew Orleans SaintsArsenal2pac

    Is this the official programming thread?

    Bookmarked

    [​IMG]
     
    Walt Disney likes this.
  40. Good stuff, this is right up my alley. Wish I could find something like that for college football, been wanting to do a KenPom style football stat thing for a while and see where it goes.

    Wish I would have taken more programming classes in college, along with my Econ classes teaching me R and VBA instead of STATA.
     
  41. Walt Disney

    Walt Disney #Dawgzy
    Donor TMB OG
    Georgia BulldogsManchester City

    The Python Broz could pitch in for this

    http://coachesbythenumbers.com/sportsource-college-football-data-packages/
     
    UnicornDickslam likes this.
  42. Walt Disney

    Walt Disney #Dawgzy
    Donor TMB OG
    Georgia BulldogsManchester City

    I have CFB data from somewhere, I'll post the link when I get home

    it's from like 2002-2013
     
  43. Game by game has been very hard to find without a ton of manual work. Found one but forgot to bookmark it. Would like to have the game summary statistics and a function to index another dataset and apply the values.
     
  44. fsck~

    fsck~ ~
    Staff TMB OG

  45. Room 15

    Room 15 Mi equipo esta Los Tigres
    Donor
    Auburn TigersAtlanta BravesAtlanta FalconsUnited States Men's National Soccer Team

    Semi on topic question. We have a partner that gave us an "ftp site" where we can download files from but it's actually more like a shared drive where you have to login via web portal. So not ftp.

    Trying to figure out how to automate that log in and download. What technology should I even be looking at to do that sort of thing?
     
  46. BellottiBold

    Donor
    Oregon Ducks

    Tell (us) more about the actual workflow you are using right now
     
  47. nofatchildren - cissp

    nofatchildren - cissp Free Da Guys
    Donor TMB OG
    Tiger Woods

    There are a bunch of web macros out there. Something like iMacros, which is just a chrome add-on, can probably do this.
     
  48. Walt Disney likes this.