|
I am looking to build a simple website. I am a new PhD student and I would like a place to share my publications, working papers, and perhaps eventually some d3.js or bokeh outputs. A newsfeed for updates would also be nice. I use Python in my research but don't know much about flask, django and other frameworks. There is also definitely a ceiling to how much I want to learn about web dev: I am just looking to make a simple but nice site to better connect with colleagues in my field. What's a good tutorial to get this kind of thing up and running quickly?
|
# ? Oct 28, 2015 15:58 |
|
|
# ? May 8, 2024 07:03 |
|
floppo posted:I am looking to build a simple website. I am a new PhD student and I would like a place to share my publications, working papers, and perhaps eventually some d3.js or bokeh outputs. A newsfeed for updates would also be nice. It sounds like you don't need Python at all, just write HTML+CSS or use something like Squarespace (squarespace is really good). If you really want to use Python, there's a bunch of static site generators, though I can't really recommend one over the other as I haven't used them much. Google "python static site generator".
|
# ? Oct 28, 2015 17:32 |
|
Seconding a service like Squarespace. Python web frameworks take lots of time and effort to learn.
|
# ? Oct 28, 2015 18:04 |
|
I'm completely new to python as of this afternoon. I downloaded python for windows and am attempting this example (http://docs.python-guide.org/en/latest/scenarios/scrape/) to scrape a webpage. I attempt to install the lxml library and get an error and I'm not sure if it's due to a newer python version, privileges, whatever. Can anyone point me in the right direction? code:
|
# ? Oct 28, 2015 18:57 |
|
You're going to have trouble compiling packages on Windows, just use Anaconda. It will solve this and many, many other problems you will encounter running Python on Windows.
|
# ? Oct 28, 2015 19:09 |
|
Yeah, Anaconda is the gold standard in self-contained Python package environments and it makes the entire "Python in Windows" experience waaaaaaay better.
|
# ? Oct 28, 2015 19:30 |
|
Ok thanks guys, I downloaded it and I'm messing about as we speak.
|
# ? Oct 28, 2015 20:34 |
|
Success! It ain't pretty, but I have it scraping amazon's website and logging the best seller ranking for my sister's book she just released (as well as an older one) and logging it to a file. Tomorrow I'm going to try and get it to write the results to a database via ODBC maybe and see if I can setup the multiple products in an array to run it looped in one script.
|
# ? Oct 28, 2015 21:35 |
|
I'm teaching a Python class this semester.
|
# ? Oct 28, 2015 21:44 |
|
Hammerite posted:This is an example of what I was talking about where whatever these object types are have had the behaviour of & customised to do something the library creator thought would be useful. Now, I don't know anything about this library, but it strikes me as bad. I would prefer to see code that relies less on the reader being intimately familiar with how the & and >= operators are implemented for this library's data types, at the cost of most likely being more verbose. Matrices and vectors are pretty much the canonical example of the place where operator overloading makes sense.
|
# ? Oct 28, 2015 21:45 |
|
Nippashish posted:Matrices and vectors are pretty much the canonical example of the place where operator overloading makes sense. yeah, that's a good one. I also really like them in ORMs, e.g. for doing Q operations in Django. (https://docs.djangoproject.com/en/1.8/topics/db/queries/#complex-lookups-with-q-objects) Other than for very obvious thinigs like this though, I'm also in the "loathes overloaded operators" camp. edit: Now that I think about, both examples are cases where overloaded operators are used in a closed system. That is, *all* possible operators on these objects are overloaded to have a similar mode of behavior.
|
# ? Oct 28, 2015 22:09 |
|
dreesemonkey posted:Tomorrow I'm going to try and get it to write the results to a database via ODBC maybe and see if I can setup the multiple products in an array to run it looped in one script. Consider using https://docs.python.org/3.5/library/sqlite3.html It's a great starter database for small to medium sized applications and it comes with Python.
|
# ? Oct 28, 2015 22:13 |
|
Munkeymon posted:Consider using https://docs.python.org/3.5/library/sqlite3.html It's a great starter database for small to medium sized applications and it comes with Python. I have an existing database platform that is my day job and it would make it super easy for me to manipulate the data/create reports/charts/etc. But I'll keep it in mind.
|
# ? Oct 29, 2015 00:16 |
|
Is it possible to remove the leading zero when string formatting a float guaranteed to be between -1 and 1? I always look into this when I'm annotating correlations, and I always give up and do it in two steps. Now, though, I'm using a library that has you pass in the formatting string... so am I out of luck?
|
# ? Oct 29, 2015 06:32 |
|
SurgicalOntologist posted:Is it possible to remove the leading zero when string formatting a float guaranteed to be between -1 and 1? I always look into this when I'm annotating correlations, and I always give up and do it in two steps. Now, though, I'm using a library that has you pass in the formatting string... so am I out of luck? http://stackoverflow.com/questions/10303797/print-floating-point-values-without-leading-zero Looking over the solutions posted there, it looks like you might be out of luck. Ask your library author/vendor.
|
# ? Oct 29, 2015 10:41 |
|
dreesemonkey posted:I have an existing database platform that is my day job and it would make it super easy for me to manipulate the data/create reports/charts/etc. But I'll keep it in mind. You're probably good, then. I thought maybe you were talking about using ODBC with Access and figured I'd point out a good alternative.
|
# ? Oct 29, 2015 14:28 |
|
SurgicalOntologist posted:Is it possible to remove the leading zero when string formatting a float guaranteed to be between -1 and 1? I always look into this when I'm annotating correlations, and I always give up and do it in two steps. Now, though, I'm using a library that has you pass in the formatting string... so am I out of luck? When all else fails, regex. Python code:
|
# ? Oct 30, 2015 05:57 |
|
Stupid question, Im new to Python and programming so please bear with me. I'm using Anaconda with the Spyder IDE that came with it. When I type something that has a paranthesis, frequently it autofills in the closing paranthesis. However, when Im typing once I get to that paranthesis, I can't just hit space or enter to move past it, I have to reach across my keyboard and use the arrow buttons. Is there some sort of shortcut (like alt or tab or something) where it lets me skip the word? In addition, is there another keyboard shortcut that lets me highlight a word or a variable? like say I have something like data['USFREQMOC'], and I want to just be able to select all of 'USFREQMOC' and delete it, so I can type something else in, instead of highlighting it or backspace or delete buttoning it. I'm sorry this is really stupid but I feel like these little things are slowing me down a lot.
|
# ? Oct 30, 2015 18:30 |
|
currently none of those features exist in spyder ide to the best of my knowledge. the ability to highlight and delete a segment should be in the 2.4 milestone release though. https://github.com/spyder-ide/spyder/issues/729 lord of the files fucked around with this message at 18:45 on Oct 30, 2015 |
# ? Oct 30, 2015 18:42 |
|
Melian Dialogue posted:I have to reach across my keyboard and use the arrow buttons
|
# ? Oct 30, 2015 18:44 |
|
Melian Dialogue posted:When I type something that has a paranthesis, frequently it autofills in the closing paranthesis. However, when Im typing once I get to that paranthesis, I can't just hit space or enter to move past it, I have to reach across my keyboard and use the arrow buttons. Is there some sort of shortcut (like alt or tab or something) where it lets me skip the word? Sometimes editors that do that will skip the auto-generated right-paren with... right-paren. What's the point? Dunno! That's why I usually turn that useless bullshit off.
|
# ? Oct 30, 2015 18:47 |
|
Cingulate posted:Do you have really tiny hands/only one hand? No? Just that, on a regular QWERTY keyboard my hands are positioned perfectly not needing to move on the left-most part of the keyboard. Instead of being able to press something like TAB with my pinky, I have to move my entire hand out of position to press the Right Arrow button. My fingers rest on ASDF and JKL; naturally as a home position. I'm a relatively okay typer (80-90WPM), so I hate having to slow down completely because of a dumb little thing. Can I maybe map it to Alt or some other button I don't use ever on its own in Spyder? Or should I just turn off that auto-generate close parenthesis thing? I mean its useful for typing things in sometimes, other times its not useful.
|
# ? Oct 30, 2015 21:01 |
|
Melian Dialogue posted:No? Just that, on a regular QWERTY keyboard my hands are positioned perfectly not needing to move on the left-most part of the keyboard. Instead of being able to press something like TAB with my pinky, I have to move my entire hand out of position to press the Right Arrow button. My fingers rest on ASDF and JKL; naturally as a home position. You don't have to use the arrow key to go around it, you can just type ")" when you reach the closing parenthesis. That'll move your cursor to the other side of the auto-generated closing parenthesis.
|
# ? Oct 30, 2015 23:57 |
|
Melian Dialogue posted:In addition, is there another keyboard shortcut that lets me highlight a word or a variable? like say I have something like data['USFREQMOC'], and I want to just be able to select all of 'USFREQMOC' and delete it, so I can type something else in, instead of highlighting it or backspace or delete buttoning it. Try ctrl-shift-arrow, or double-clicking the word if you'd rather use a mouse
|
# ? Oct 31, 2015 00:00 |
|
QuarkJets posted:You don't have to use the arrow key to go around it, you can just type ")" when you reach the closing parenthesis. That'll move your cursor to the other side of the auto-generated closing parenthesis. Duh, Thats pretty obvious. Thanks, Im still pretty new to this. QuarkJets posted:Try ctrl-shift-arrow, or double-clicking the word if you'd rather use a mouse Thanks! This sounds like what I need
|
# ? Oct 31, 2015 07:04 |
|
I know iterating over dict.values(), keys() or items() is not guaranteed to result in any specific order, and I assume the order may change if I change the keys of the dict. But is the order guaranteed to stay the same when I iterate over any of these multiple times? Potentially 1. iterating over different things (e.g. once over keys, once over items), 2. change values in between?
|
# ? Nov 2, 2015 13:38 |
|
Cingulate posted:I know iterating over dict.values(), keys() or items() is not guaranteed to result in any specific order, and I assume the order may change if I change the keys of the dict. Why do you feel that you might need it to stay in the same order? What are you trying to do? I don't know whether the order will be the same every time (assuming no changes to the keys of the dictionary). I suspect that the answer to that question will turn out to be "it happens that in CPython it will be the same every time, but nothing guarantees that that won't change in the future". If it is the same every time, then I would have thought changing the values should make no difference to that. The order is probably related somehow to the hash values of the keys. You're presumably aware that if you create the same dictionary in two different Python sessions, the order in which items are iterated will be different, because hashes are influenced by a random element that is per-session.
|
# ? Nov 2, 2015 14:16 |
|
Cingulate posted:I know iterating over dict.values(), keys() or items() is not guaranteed to result in any specific order, and I assume the order may change if I change the keys of the dict. Generally worrying about order in a dict is a code smell for something that needs to be refactored. That said, if you really need it Python code:
|
# ? Nov 2, 2015 14:26 |
|
Hey I'm messing around with some twisted perspective broker examples and I've come to a point where I have 3 basic pbs - one "client", one "server", and one "resource server". The "server" makes async remote calls on the resource server for itself and on behalf of the client. In this kind of situation, should I be doing a reactor.connectTCP("localhost", 8801, self.factory) type thing only once during construction of the pb object or am i supposed to be just throwing that poo poo around nilly willy (like anytime a remote method is called)?
|
# ? Nov 3, 2015 01:25 |
|
I'm starting to use BeautifulSoup a little bit, and am stumped on a certain query. I'm trying to count the number of dropdowns in a select tag:code:
*Here is the page I'm scraping: http://www.imdb.com/title/tt1826940/episodes?season=3 Hughmoris fucked around with this message at 04:12 on Nov 3, 2015 |
# ? Nov 3, 2015 04:10 |
|
Hughmoris posted:I'm starting to use BeautifulSoup a little bit, and am stumped on a certain query. I'm trying to count the number of dropdowns in a select tag: You can just use a method that returns a collection of the select's child elements, and then count that. code:
|
# ? Nov 3, 2015 04:43 |
|
Hargrimm posted:You can just use a method that returns a collection of the select's child elements, and then count that. I'll give this a try, thanks!
|
# ? Nov 3, 2015 05:28 |
|
Feral Integral posted:Hey I'm messing around with some twisted perspective broker examples and I've come to a point where I have 3 basic pbs - one "client", one "server", and one "resource server". The "server" makes async remote calls on the resource server for itself and on behalf of the client. In this kind of situation, should I be doing a reactor.connectTCP("localhost", 8801, self.factory) type thing only once during construction of the pb object or am i supposed to be just throwing that poo poo around nilly willy (like anytime a remote method is called)? you should be able to open the connection once and it will be running in the background, like so: code:
|
# ? Nov 3, 2015 09:15 |
|
I have a simulation where I run multiple replications of a given policy (the input parameters that define the policy are fixed, but the replications have different results due to the randomness in the simulation). Currently I run the simulation replications in serial, one after the other. However, I would like to take advantage of the fact that the replications are independent and that I have multiple CPUs on my computer. To do this, I am trying to use the "Embarrassingly parallel for loops" part of the joblib lirbrary, which itself uses the multiprocessing library. The overall structure of my code is the following: Python code:
Python code:
Python code:
code:
|
# ? Nov 3, 2015 20:37 |
|
Jose Cuervo posted:inside the single_simulation_replication function. My interpretation of this error is that the parallel process does not KNOW that const.SCENARIO_SETTING (although initialized as None) was already set to 2 in main(). Is this what is happening, and if so, why? Second, what can I do to overcome this issue? It doesn't know about the changes to const because its running in a different process and the parameters were never set in that process. The solution is to pass the constants as a function arguments instead of having it pull them in from the ambient environment. I think you can pass the const module, but really you should put the parameters in a dict and pass that because global variables are bad mojo. e: it works with 1 job because joblib doesn't use multiple processes unless you request more than one.
|
# ? Nov 3, 2015 21:18 |
|
Nippashish posted:It doesn't know about the changes to const because its running in a different process and the parameters were never set in that process. The solution is to pass the constants as a function arguments instead of having it pull them in from the ambient environment. I think you can pass the const module, but really you should put the parameters in a dict and pass that because global variables are bad mojo. Yeah I knew using global variables was not good practice and it has come to bite me in the butt now. Thanks for the help and solution to overcome the issue.
|
# ? Nov 3, 2015 23:01 |
|
https://www.continuum.io/blog/company-blog/anaconda-24-release PyCharm 5 was released this week as well. It's like Christmas
|
# ? Nov 4, 2015 16:31 |
|
flosofl posted:https://www.continuum.io/blog/company-blog/anaconda-24-release
|
# ? Nov 4, 2015 23:51 |
|
What exactly does it mean by 3.5 support? I've been making 3.5 environments for awhile now...
|
# ? Nov 4, 2015 23:57 |
|
|
# ? May 8, 2024 07:03 |
|
Native; non virtual.
|
# ? Nov 5, 2015 00:00 |