|
Dominoes posted:Thanks dudes! I'm asking because I set up a simple website to help out at work, that only consists of a set of links and a roster of names/contact info. To view the roster, you need to be logged in to a verified account, and a few people will be able to edit the roster and links. This seemed like Flask territory, but the db, admin and auth system are already taking away some of the simplicity. Do yourself a favor and just go ahead and do it in Django. These projects always balloon and you're not gaining that much simplicity from using Flask. The real use case for Flask is apps that live behind an http server, but are not websites. Anything that might use html, css or JavaScript should probably just be done in Django imo.
|
# ? Sep 7, 2015 13:29 |
|
|
# ? May 8, 2024 05:42 |
|
I never understand these arguments to use Flask for small projects because Django comes with more than you need. Just don't use the parts you don't need!
|
# ? Sep 7, 2015 14:16 |
|
flosofl posted:If you're willing to spend money, I like Team Treehouse. ($25/mo. or $199/yr) You get access to all the training, so not just Python. Any suggestions for poorer/cheaper folk? I've done a little codeingame, but it doesn't really require any particular quality of code. I've considered translating some of my C++ projects from school; would this be a decent way to get more familiar with Python's classes?
|
# ? Sep 7, 2015 14:18 |
|
I want to make a dynamic visualisation for a set of data. On a website, visitors should be able to type in (or select from a pulldown menu) a title and get a scatterplot with the corresponding values. I have the static image ready - it's just a pandas dataframe visualised with seaborn and a bit of custom matplotlib. What's the recommended framework here?
|
# ? Sep 7, 2015 14:43 |
|
Is there another site as good as stack overflow for programming questions? Our work content filter is set up to block access to it right now as "Social Media". Gonna talk to the boss about seeing if networking will allow an exemption to it but it's annoying as poo poo to try to learn crap on my downtime.
|
# ? Sep 7, 2015 15:12 |
|
Cingulate posted:I want to make a dynamic visualisation for a set of data. On a website, visitors should be able to type in (or select from a pulldown menu) a title and get a scatterplot with the corresponding values.
|
# ? Sep 7, 2015 16:12 |
|
Ghost of Reagan Past posted:I just did this kind of thing with Flask and JQuery. The site just acts as a little frontend to the processing application, basically. Django would be complete overkill unless you have some weird requirements.
|
# ? Sep 7, 2015 16:18 |
|
Cingulate posted:You vastly overestimate my programming skills and how much time I can afford on learning a web framework. I was thinking about something like booked or mpld3. Python code:
code:
I don't know anything about booked or mpld3, but if you say you're generating static images this should work fine (MPLD3 looks like it's for making things more interactive than it sounds like you're going for, but if interactivity is your goal, that might be the faster route). Ghost of Reagan Past fucked around with this message at 16:49 on Sep 7, 2015 |
# ? Sep 7, 2015 16:46 |
|
Sorry, what I wrote about the static image was confusing - I meant, I have done a static representation of what I want to do dynamically online. What you wrote seems nice and all, but I'm really wondering about what interactive data visualization suite to choose
|
# ? Sep 7, 2015 16:51 |
|
Cingulate posted:I want to make a dynamic visualisation for a set of data. On a website, visitors should be able to type in (or select from a pulldown menu) a title and get a scatterplot with the corresponding values. Shiny is made for exactly this, though it's R not Python
|
# ? Sep 7, 2015 19:52 |
|
Emacs Headroom posted:Shiny is made for exactly this, though it's R not Python
|
# ? Sep 7, 2015 19:58 |
|
You want the visualization itself to be dynamic? Bokeh will do that for you. There is also spyre which is more of a web framework specifically for data visualization if you are looking for a wrapper around web framework and templating libraries to make that part of your life easier.
|
# ? Sep 7, 2015 20:00 |
|
hooah posted:Any suggestions for poorer/cheaper folk? I've done a little codeingame, but it doesn't really require any particular quality of code. I've considered translating some of my C++ projects from school; would this be a decent way to get more familiar with Python's classes? There's this: http://www.diveintopython3.net or this: http://www.python-course.eu/python3_course.php Gothmog1065 posted:Is there another site as good as stack overflow for programming questions? Our work content filter is set up to block access to it right now as "Social Media". Gonna talk to the boss about seeing if networking will allow an exemption to it but it's annoying as poo poo to try to learn crap on my downtime. I'm going to lean toward no. Whenever I google for a coding issue or clarification on an run error usually the 1st page of results is almost all Stack Overflow. The quality of the results taper off sharply after the Stack Overflow. Get them to allow Stack Exchange sites in general ASAP. Proteus Jones fucked around with this message at 21:16 on Sep 7, 2015 |
# ? Sep 7, 2015 21:09 |
|
Cingulate posted:I know, I was wondering about the Shiny of Python. Bokeh is part-way there, and we are working on much more. Edit: Possibly useful: http://bokeh.pydata.org/en/latest/docs/user_guide/interaction.html#defining-callbacks You can do alot with our recent "JS callbacks" and there is an in-flight PR to allow writing those in python to be transpiled to JS (currently only for python 3 due to the underlying library supporting only py3 currently)
|
# ? Sep 7, 2015 21:58 |
|
Okay I think I want something very simple, I'm just bad at computers. Based on the recommendations, I've set up a bokeh notebook. I want a dropdown list (actually, a select widget). On a selection, I want to pass the selected value to another function that updates the plot. I can't figure out how to access the last value selected on the widget (select.value always returns the default), or how to trigger anything on the callback. The documentation is frankly said overwhelming - I've never used Javascript in my life, I just want to make a scatterplot! Edit: code:
Cingulate fucked around with this message at 22:54 on Sep 7, 2015 |
# ? Sep 7, 2015 22:51 |
|
Let's talk VCS. Here's my situation. It's just me and all my projects are local. They're mostly network automation to do same task or tasks thousands of times given a csv file or files of system information. I develop my utilities on a rMBP using PyCharm and I'm using anaconda (python 3.4.3). As background I've just taken a look at one of the first network utilities I've made and I've decided to do a major update to it to make it more flexible and easier on the eyes. What I have been doing is create a new project directory, copying over the old files, and opening the new directory in PyCharm. PyCharm itself tracks a very tiny amount of changes, which has served me OK so far, but if I wander down a wrong path for too long, I realized I have no real recourse other than doing a "poor mans" VCS. i.e. Each time I do a change (other than fixing syntax) I put a version number on the file. This is getting out of control for me. So... what's the recommended method? GitHub is out for now, since I don't want to pay to have "private" projects and there's some stuff that could get me fired if I put it in a public one. But I do have git installed from when I was looking at GitHub. I can also probably get mercurial or others on my box via homebrew if necessary. As an addendum to that question, are there any good tutorials on getting up to speed on VCS? I've never used any before as I'm not really a programmer, but I've started writing more and more Python as part of an automation push that's basically my 20% project at work.
|
# ? Sep 8, 2015 03:41 |
|
You don't need GitHub, you can use Git locally. It sounds like it would pretty much cover your needs with a simple local repository. With a single user, it's surprisingly easy to get everything set up. If you want remote code hosting, try Bitbucket.org, which is free for up to five users for a private repo. You can get started here: https://git-scm.com/book/en/v1/Git-Basics-Getting-a-Git-Repository
|
# ? Sep 8, 2015 05:15 |
|
Fergus Mac Roich posted:You don't need GitHub, you can use Git locally. It sounds like it would pretty much cover your needs with a simple local repository. With a single user, it's surprisingly easy to get everything set up. If you want remote code hosting, try Bitbucket.org, which is free for up to five users for a private repo. Thanks!
|
# ? Sep 8, 2015 05:17 |
|
Yeah I've never actually used GitHub; git is a great tool, though!
|
# ? Sep 8, 2015 06:56 |
|
QuarkJets posted:Yeah I've never actually used GitHub; git is a great tool, though! Indeed, before Github came along I used to push to my local server using mapped network drives - I really like the way that git is reasonably uncaring about your transfer protocol.
|
# ? Sep 8, 2015 06:59 |
|
Okay, I need some help, namely with the error that's being thrown. Basically link_list is a list of tuple pairs ( ex: list = [(1,2),(2,3)...] ), but I'm having issues removing them at the end. Here's my lovely code. I'm working through this myself, so I'm hoping to get that specific part working before I move on (then I'll get advice on how to be less stupid with my code). **EDITED CODE** Python code:
code:
Gothmog1065 fucked around with this message at 02:22 on Sep 9, 2015 |
# ? Sep 8, 2015 20:41 |
|
Gothmog1065 posted:Okay, I need some help, namely with the error that's being thrown. Basically link_list is a list of tuple pairs ( ex: list = [(1,2),(2,3)...] ), but I'm having issues removing them at the end. Here's my lovely code. I'm working through this myself, so I'm hoping to get that specific part working before I move on (then I'll get advice on how to be less stupid with my code). Indentation error technically, but really a scope problem. You define "disconnect" at a level lower (inside the for loop) than what you are calling (inside the while loop).
|
# ? Sep 8, 2015 20:48 |
|
flosofl posted:PyCharm itself tracks a very tiny amount of changes, which has served me OK so far, but if I wander down a wrong path for too long, I realized I have no real recourse other than doing a "poor mans" VCS. i.e. Each time I do a change (other than fixing syntax) I put a version number on the file. This is getting out of control for me. PyCharm has Git integration so you get a nice UI and tools right in the IDE https://www.jetbrains.com/pycharm/help/using-git-integration.html It doesn't handle everything (I've had to crack open the command line to stop it tracking a previously tracked file) but for your general day-to-day version control it's great
|
# ? Sep 8, 2015 20:55 |
|
vikingstrike posted:Indentation error technically, but really a scope problem. You define "disconnect" at a level lower (inside the for loop) than what you are calling (inside the while loop). Do I have to do something more than defining it outside the for loop (Adding it the line above?). That doesn't seem to be fixing anything (even setting the variable outside the while loop), nor does putting the removal into the for loop (which doesn't really do what I want). print(disconnect) directly above that line and it outputs [(x,y)], print(disconnect[0]) gives just (x,y) (Which seems to be what I want), but link_list.remove(disconnect[0]) throws an out of range area. Am I moving the wrong direction?
|
# ? Sep 8, 2015 22:00 |
|
baka kaba posted:PyCharm has Git integration so you get a nice UI and tools right in the IDE I already got it up and running with PyCharm. It's pretty drat pain-free so far. I use time machine so poo poo is backed up, but they all live on a directory mapped to a cloud drive, so I can offload having to worry about both my machine and my local backup being destroyed by catastrophe. Of course, if some happens at that level, I'm sure my utility scripts will be the last thing on my mind. Proteus Jones fucked around with this message at 22:37 on Sep 8, 2015 |
# ? Sep 8, 2015 22:33 |
|
Gothmog1065 posted:Do I have to do something more than defining it outside the for loop (Adding it the line above?). That doesn't seem to be fixing anything (even setting the variable outside the while loop), nor does putting the removal into the for loop (which doesn't really do what I want). Put break points in and step through the code to where the value goes wonky. I'd probably set a break point every time disconnect should receive a value and validate it's an expected value. Also stop right before everything blows up and look at what things are vs. what you expect. code:
Actually, I'd probably put all my list initializations at the start of the function. But definitely run it through a debugger. Sorry I misread, you're removing the value of disconnect from link_list. What you're doing is trying to remove a list of tuples from link_list instead of the tuple itself. That will break because link_list[x] is not equal to disconnect. Disconnect is a list of one tuple, so you need to give disconnect the index of that tuple. In this case: [0] try: code:
Proteus Jones fucked around with this message at 23:23 on Sep 8, 2015 |
# ? Sep 8, 2015 22:50 |
|
flosofl posted:try: Gothmog1065 posted:print(disconnect) directly above that line and it outputs [(x,y)], print(disconnect[0]) gives just (x,y) (Which seems to be what I want), but link_list.remove(disconnect[0]) throws an out of range area. Am I moving the wrong direction? Yeah, I already tried that and am getting an "out of range error." I had to leave work so I didn't poke it anymore at that time. I'll see if I can poke it more tomorrow.
|
# ? Sep 9, 2015 00:39 |
|
vikingstrike posted:Indentation error technically, but really a scope problem. You define "disconnect" at a level lower (inside the for loop) than what you are calling (inside the while loop). I feel like I'm going crazy, I thought control blocks in Python don't make a new scope? Gothmog, you need a debugger. I'm not a very knowledgeable programmer so I'm sorry if this is wrong, but I'm pretty sure the else code path can't fail unless link_list is empty(as long as you do disconnect[0] to get the tuple and not the list of one tuple), so if the other code paths are failing, you need to use the debugger to determine why link_list doesn't contain the values that you expect.
|
# ? Sep 9, 2015 01:54 |
|
Gothmog1065 posted:Yeah, I already tried that and am getting an "out of range error." I had to leave work so I didn't poke it anymore at that time. I'll see if I can poke it more tomorrow. I'm not entirely sure what you're doing, but your first piece of code looks like it iterates over link_list, examines a bunch of 2-tuples, then sets disconnect to a 2-tuple. It resets this over and over until it finishes with the list, then once it leaves the loop, it calls link_list.remove() with whatever disconnect was last set to. Which should be whatever the result is for the last tuple in the list? You probably don't want to do that I'm guessing, and the remove call is meant to happen for each tuple in the list, after you've determined what to do with it The other thing I noticed is your second case checks if the tuple is (gateway, enemy), but then it sets disconnect to (enemy, gateway), which is a different tuple and won't match the remove call, if that's what's meant to be happening. Your last case sets disconnect to the last element of the list, so you're removing elements from the end (is that what you want?), and if you do it in the loop you'll be modifying the list you're iterating over, which isn't usually a good idea (you'd generally iterate over a copy and modify the original) Personally I'd stick a breakpoint on the problem line and run a debugger on it, see what the state of disconnect and link_list is when it falls over
|
# ? Sep 9, 2015 01:55 |
|
I think the biggest problem with a debugger is the while loop and the fact that codingame is what breaks the loop, and I'd probably make it worse by trying to escape the while loop (Even though it's probably a timer or something else that breaks it). It's hard to shove that code into a debugger when there's so much external data going into it. Let me try to rework it some. Here is a link to the actual game (You can "continue without an account" in the upper right). That way you can see what I'm doing. Just remember, I'm not even close to finished yet and I'm still thinking about some of the final cases. I'll go back and edit in the modified code. What it's SUPPOSED to be doing is a multi step process. I'll make better comments in the code too. There is an enemy on the board who has to follow the links to get to a gateway. The first two for loops are simply setting up the links and the gateways. My job is to 'break' the links so the enemy can't travel down them, and break all links so the enemy can't get to the gateway. each tuple is x,y for the psuedocode: code:
- Attempt to see if there is a "closest path" to the gateway, which is going to be fun - Check to see which way the enemy is going in case of multiple gateways. possible problems: If somehow I get the link numbers reversed as x is not always < y. Now, theoretically condition A and B should always allow me to win, but I've got to get the enemy close enough to a gateway to do those conditions. I've probably got some other things to look at adding in, but I'm trying to do this a bit at a time, by breaking it down into smaller puzzles (Basically each test if you want to see visually what the links look like). I guess that's my thought patterns on how I'm tackling the code as well. e: I updated the code here in the previous post and the error, as not to keep spamming this page. If I keep editing, I'll get a github link. e2: I'm downloading Pycharm to debug with, I'll post a github of that when I get it built. Gothmog1065 fucked around with this message at 02:25 on Sep 9, 2015 |
# ? Sep 9, 2015 02:19 |
|
Cingulate posted:Okay I think I want something very simple, I'm just bad at computers. Speaking of the server re-write, an interview I did for podcast.__init__ last month just went up, and I speak about the plans quite a bit towards the end: http://ow.ly/RVWLq EDIT: Also FYI you'll have to run the linked notebook locally. GitHub scrubs all Javascript from it's notebook previews, so things like Bokeh plots and IPython interactors don't show up, and in any case you actually want python to execute in response to the dropdown so that requires a real IPython kernel running. BigRedDot fucked around with this message at 03:40 on Sep 9, 2015 |
# ? Sep 9, 2015 03:30 |
|
Gothmog1065 posted:STUFF I thought I was going cross-eyed, but I think I found your error. First off I was wrong. The remove is definitely: Python code:
Here's the working if, elif, else: Python code:
|
# ? Sep 9, 2015 04:28 |
|
BigRedDot posted:Well, you don't just want a scatter plot. If that's all you want it's about three three lines of python code (including imports). You want a scatter plot with computations and updates all nicely linked to interactive UI. There's lots of potential use-cases, and JS callbacks is one just option, but there is a PR in-flight to allow writing the callbacks in python to be compiled to JS automatically, which will be great. That said, if you want widgets in a just in an IPython notebook, I'd recommend using IPython interactors for now. Those are dead simple and work great, here's an example: https://github.com/bokeh/bokeh/blob/master/examples/plotting/notebook/interact_basic.ipynb Bokeh widgets like the ones you are trying to use require a Bokeh server, and I would say hold off on that a month or two since we are in the process of re-writing the thing entirely to make it much better and simpler to use.
|
# ? Sep 9, 2015 10:56 |
|
flosofl posted:I thought I was going cross-eyed, but I think I found your error. I found the problem! Here's a gist of all the code, all of my outputs via the prints in the game, and see if you can spot the problem! It was in disconnect, but it was strange. Plus the out of range error was a stupid on my part, I forgot that basically a list with the value of [(x,y)] is actually a matrix, so the final print was wrong (corrected it, though I could have just done tuple(disconnect) to resolve it possibly). Gist here! Hint because I'm an rear end I wasn't setting disconnect as a matrix [(x,y)] in the if/elif, only as a tuple (x,y), so it was breaking poo poo below. I did end up adding in a 'reverse' function to reverse the x,y because sometimes the link will be one way, and other times it will be another. Just a simple "if the disconnect isn't in link_list, set disconnect as (y,x)". It ran without problems. Could probably be a shitload more efficient, but I guess I did the bare minimum required to solve the problem. Gothmog1065 fucked around with this message at 15:03 on Sep 9, 2015 |
# ? Sep 9, 2015 14:50 |
|
I don't know how codingame works but my takeaway would be that it's a lot easier to track this stuff down if you can code it so that you can use a debugger(mocking the external data)
|
# ? Sep 9, 2015 20:54 |
|
Fergus Mac Roich posted:I don't know how codingame works but my takeaway would be that it's a lot easier to track this stuff down if you can code it so that you can use a debugger(mocking the external data) The only feedback you get from their UI is the output of an assert like 'Error: expected "a" but found "b"' but you can do the equivalent of good old printf debugging, though they'll truncate output It's really frustrating when you pass all the sample test cases but fail submission cases, which are intentionally different to prevent you from cheating.
|
# ? Sep 9, 2015 21:32 |
|
Fergus Mac Roich posted:I don't know how codingame works but my takeaway would be that it's a lot easier to track this stuff down if you can code it so that you can use a debugger(mocking the external data) It's a pain in the rear end, that's why I end up using so many print(x,file=sys.stderr) statements so I can make sure the data feed is correct through their UI. That's how I ended up finding the problem I was having (noticing that some of the disconnect data was being saved as (x,y) and some as [(x,y)] ). I have used an external editor and feed (just IDLE), but I've got PyCharm at the house now (may download it here too) and start forcing the errors outside of their environment.
|
# ? Sep 9, 2015 21:43 |
|
Stringent posted:Do yourself a favor and just go ahead and do it in Django. These projects always balloon and you're not gaining that much simplicity from using Flask.
|
# ? Sep 9, 2015 22:14 |
|
Cingulate posted:Thanks. To be honest, right now I feel the best solution for me would be to actually go to Shiny for now and only recommend to my usual practice of near-exclusively working with continuum-provided stuff when the dust has settled. Well let's not overstate things: there are lots of use-cases besides yours, that don't involve running python in response to browser UI happenings, for which I would unreservedly recommend Bokeh.
|
# ? Sep 11, 2015 02:56 |
|
|
# ? May 8, 2024 05:42 |
|
BigRedDot posted:Well let's not overstate things: there are lots of use-cases besides yours, that don't involve running python in response to browser UI happenings, for which I would unreservedly recommend Bokeh.
|
# ? Sep 12, 2015 13:02 |