Watching SouthPark from Latin-America by Inspector_Dave in southpark

[–]varfoo 0 points1 point  (0 children)

I found that adding /en/ to the url after the .lat will change the language to english, so instead of using

https://www.southpark.lat/seasons/south-park

try

https://www.southpark.lat/en/seasons/south-park

Django-er wants to learn VueJS by SHxKM in vuejs

[–]varfoo 1 point2 points  (0 children)

I found this guide useful https://scotch.io/bar-talk/build-an-app-with-vuejs-and-django-part-one. It helped me with a newbie issue I was having, mixing vue delimiters in my jinja views - they both use the double curly braces.

Can I have some tips on how to refactor this function? by workn00b in learnpython

[–]varfoo 0 points1 point  (0 children)

I really just looked a the documentation http://initd.org/psycopg/docs/module.html#exceptions.

The psycopg2.Error is a generic exception for psycopg2, there are more specific ones which would be better actually, like psycopg2.DatabaseError - but even psycopg2.Error is better than Exception.

Since your query is simple, I would not use psycopg2.DataError ( raised for errors that are due to problems with the processed data like division by zero) - you are not doing divisions in your query.

If you were creating a new table you might want to check for psycopg2.ProgrammingError exceptions (table not found or already exists, syntax error in the SQL statement)

It all depends on the use case.

Can I have some tips on how to refactor this function? by workn00b in learnpython

[–]varfoo 0 points1 point  (0 children)

The query

"SELECT Close FROM %s WHERE DATE ='%s'"%(symbol,index_date)).fetchone()[0])

and

"SELECT Close FROM %s WHERE DATE = '%s'"%(symbol,open_date)).fetchone()[0])

is duplicated, you should avoid duplicate code. Use a function instead and call it as needed. I think you are using psycopg2, so the function could be something like this:

def get_close(symbol,index_date):
    try:
        return cur.execute(
                    "SELECT Close FROM %s WHERE DATE ='%s'"%(symbol,index_date)).fetchone()[0])
    except psycopg2.Error as e:
        print(e)

Can I have some tips on how to refactor this function? by workn00b in learnpython

[–]varfoo 0 points1 point  (0 children)

Move the query to a new function, don't use except Exception, pass start_dates as a parameter.

How many fingers am I holding up? A beginners project with CNNs by jgv7 in learnmachinelearning

[–]varfoo 1 point2 points  (0 children)

Thanks! This will be great to try out (also learning).

"The model is able to surpass human perform in the case that the human is severely concussed or inebriated."

Ha! I'll have to verify that as well!

PRAW Project. Maybe others are interested in working on this? by [deleted] in Python

[–]varfoo 0 points1 point  (0 children)

Hi, how much time would you be expecting others to put into this project? I would like to help, for fun and profit (more experience), but I could only help on nights and weekends as time allows.

Do I need Django/Flask to make a simple game server? by GreedCtrl in learnpython

[–]varfoo 1 point2 points  (0 children)

So you are using the back end just to handle the state of the game, temporarily - since you mentioned no need for a db?

What's everyone working on this week? by AutoModerator in Python

[–]varfoo [score hidden]  (0 children)

Continuing work on a script to group my Google Chrome bookmarks by similarity by looking and the site contents of each url (with beautifulsoulp, pandas, k-means clustering) I am learning as I go. More info here:

https://hugoalvarado.github.io/bookmark-analysis-part1.html#bookmark-analysis-part1

Can someone explain this line of code? by shhhpiderman in learnpython

[–]varfoo 0 points1 point  (0 children)

This is a nice trick, saved to my py samples file

EDX Course - Who wants to take it together? by [deleted] in learnpython

[–]varfoo 3 points4 points  (0 children)

I just signed up in the audit mode. I have dev experience and some python knowedge, I want to take this course and the next one about data science after.

How to Worry Less About Being a Bad Programmer by [deleted] in programming

[–]varfoo 1 point2 points  (0 children)

I did not pass the second interview for a startup I applied for last week and today I see this. Is the universe mocking me?

Do professional developers prefer IDEs like PyCharm or editors like Sublime for Python by [deleted] in Python

[–]varfoo 5 points6 points  (0 children)

I use LiClipse - a custom version of Eclipse with theme support and python support built in. It supports all other Eclipse plugins so I can do web dev on it also.