[R] Summary of DataScience Summer School at Polytechnique, with Bengio et al.
https://gmarti.gitlab.io/ml/2017/09/02/ds3-datascience-polytechnique.html
/r/MachineLearning
https://redd.it/6xt4ou
https://gmarti.gitlab.io/ml/2017/09/02/ds3-datascience-polytechnique.html
/r/MachineLearning
https://redd.it/6xt4ou
gmarti.gitlab.io
[Field report] Data Science Summer School at Ecole Polytechnique (with Bengio, Russell, Bousquet, Archambeau and others)
A small field report with personal viewpoint about the Data Science Summer School (Ecole Polytechnique) Monday, Aug. 28 – Friday, Sept. 1, 2017.
Do not reload all Flask apps
Hi There,
I'm using flask blueprints just as written here:
http://flask.pocoo.org/docs/0.12/patterns/appdispatch/
Specifically, I'm running the following piece of code:
from werkzeug.wsgi import DispatcherMiddleware
from frontend_app import application as frontend
from backend_app import application as backend
application = DispatcherMiddleware(frontend, {
'/backend': backend
})
Flask has an awesome feature of reloading application as it detects change in code. However, in my case it is not desirable for both apps: backend app is too heavy to be reloaded every few minutes. When I reload fronend, backend gets reloaded as well and it takes too long. Is there any way to reload only app that was changed?
I realize it might be difficult, because as far as I understand at this point
application = DispatcherMiddleware(frontend, {
'/backend': backend
})
applications are merged into a single one and they are not separate anymore.
Anyway, maybe there is a different way to achieve what I want?
Thanks.
/r/flask
https://redd.it/6xsh81
Hi There,
I'm using flask blueprints just as written here:
http://flask.pocoo.org/docs/0.12/patterns/appdispatch/
Specifically, I'm running the following piece of code:
from werkzeug.wsgi import DispatcherMiddleware
from frontend_app import application as frontend
from backend_app import application as backend
application = DispatcherMiddleware(frontend, {
'/backend': backend
})
Flask has an awesome feature of reloading application as it detects change in code. However, in my case it is not desirable for both apps: backend app is too heavy to be reloaded every few minutes. When I reload fronend, backend gets reloaded as well and it takes too long. Is there any way to reload only app that was changed?
I realize it might be difficult, because as far as I understand at this point
application = DispatcherMiddleware(frontend, {
'/backend': backend
})
applications are merged into a single one and they are not separate anymore.
Anyway, maybe there is a different way to achieve what I want?
Thanks.
/r/flask
https://redd.it/6xsh81
reddit
Do not reload all Flask apps • r/flask
Hi There, I'm using flask blueprints just as written here: http://flask.pocoo.org/docs/0.12/patterns/appdispatch/ Specifically, I'm running the...
I made a Pinterest clone for practice
Hey guys,
I made this week this [Pinterest](https://pinclone-django.herokuapp.com/) clone to practice my skill with Django, you can tell me everything wrong with it and I wll try to improve it, also I'll try to create a new app this week, maybe a hacker news clone to keep practicing
[github repo](https://github.com/iKenshu/pinclone)
/r/django
https://redd.it/6xu9em
Hey guys,
I made this week this [Pinterest](https://pinclone-django.herokuapp.com/) clone to practice my skill with Django, you can tell me everything wrong with it and I wll try to improve it, also I'll try to create a new app this week, maybe a hacker news clone to keep practicing
[github repo](https://github.com/iKenshu/pinclone)
/r/django
https://redd.it/6xu9em
[AF] How to separate individual form from others in for loop and then do ajax post?
I'm having trouble with submitting a certain form if they are all identical(for loop). Only the first one is submitted. I want to be able to enter the credentials into a form 2-10 and have that one submit instead of the first. Here is the code: https://gist.github.com/anonymous/f5a34a14c79d5de59d28b37c85daacdf
screenshots: http://imgur.com/a/Ndequ
In the first image, the program works fine because the two fields are filled out for the first form.
In the second image it doesn't work because the second field of the first form is not filled out.
The third image shows that only the first form is being submitted.
/r/flask
https://redd.it/6xvhr1
I'm having trouble with submitting a certain form if they are all identical(for loop). Only the first one is submitted. I want to be able to enter the credentials into a form 2-10 and have that one submit instead of the first. Here is the code: https://gist.github.com/anonymous/f5a34a14c79d5de59d28b37c85daacdf
screenshots: http://imgur.com/a/Ndequ
In the first image, the program works fine because the two fields are filled out for the first form.
In the second image it doesn't work because the second field of the first form is not filled out.
The third image shows that only the first form is being submitted.
/r/flask
https://redd.it/6xvhr1
Gist
ajax multiple submissions
[P] Word Ordering: Can Neural Networks Put a Scramble of Words in Correct Order?
https://github.com/Kyubyong/word_ordering
/r/MachineLearning
https://redd.it/6xtivu
https://github.com/Kyubyong/word_ordering
/r/MachineLearning
https://redd.it/6xtivu
GitHub
GitHub - Kyubyong/word_ordering: Can neural networks order a scramble of words correctly?
Can neural networks order a scramble of words correctly? - GitHub - Kyubyong/word_ordering: Can neural networks order a scramble of words correctly?
Seeking Django Tutor
Hi, I'm seeking a Django tutor, where might I be able to find one?
/r/django
https://redd.it/6xvenm
Hi, I'm seeking a Django tutor, where might I be able to find one?
/r/django
https://redd.it/6xvenm
reddit
Seeking Django Tutor • r/django
Hi, I'm seeking a Django tutor, where might I be able to find one?
Alexa Brower Client – Talk to Alexa through your browser (pluggable Django Channels App)
https://richardtier.com/2017/09/03/alexa-brower-client-talk-to-alexa-from-your-desktop-phone-or-tablet-browser/
/r/django
https://redd.it/6xw462
https://richardtier.com/2017/09/03/alexa-brower-client-talk-to-alexa-from-your-desktop-phone-or-tablet-browser/
/r/django
https://redd.it/6xw462
Richard Tier
Alexa Brower Client – Talk to Alexa from your desktop, phone, or tablet browser.
I made a pluggable Django app that allows you to talk to Alexa through your browser: Add alexa_browser_client to your INSTALLED_APPS Run the Django app ./manage.py runserver Go to Say somethin…
Python overtakes R, becomes the leader in Data Science, Machine Learning platforms
http://www.kdnuggets.com/2017/08/python-overtakes-r-leader-analytics-data-science.html
/r/Python
https://redd.it/6xtb87
http://www.kdnuggets.com/2017/08/python-overtakes-r-leader-analytics-data-science.html
/r/Python
https://redd.it/6xtb87
reddit
Python overtakes R, becomes the leader in Data Science,... • r/Python
798 points and 69 comments so far on reddit
What's the best way to redirect to a different view in the case of an exception?
Hi there,
I'm implementing a payment system on my site and I'm wondering what the best practice way to handle exceptions would be. The exception handling for CC processing is built into the payment processor (Stripe), so that part's not a problem. What I'm trying to determine is what's the best way for me to handle an exception if one is caught, for example a card processing error (e.g. credit card was declined).
In the view that processes the card, it takes a token returned by Stripe, tries to create a customer, assign them to a subscription, and if it fails there are a number of exceptions thrown like CardError, AuthenticationError, InvalidRequestError, etc. In those exceptions I am able to trap the error message easily (e.g. "your credit card was declined") and then return a different template, like subscribe_error.html, which can show the error as a template variable. No problem. The only problem there is that the URL still shows the thank you URL. So I really need to redirect to the error url (e.g. /subscribeerror or whatever), but keep the error message. So what's the best practice way to do this?
Basically, the error handling works, but I just don't know if I am doing it the best way I can. Here's some code:
def pro_annual_thanks(request):
token = request.POST.get('stripeToken')
email = request.POST.get('stripeEmail')
name = request.POST.get('stripeName')
customer_data = {
'description': name,
'card': token,
'email': email
}
try:
stripe.api_key = settings.STRIPE_TEST_SECRET_KEY
customer = stripe.Customer.create(**customer_data)
subscription = customer.subscriptions.create(plan="annual_pro")
except stripe.error.CardError as e:
# Since it's a decline, stripe.error.CardError will be caught
body = e.json_body
err = body.get('error', {})
print "Status is: %s" % e.http_status
print "Type is: %s" % err.get('type')
print "Code is: %s" % err.get('code')
# param is '' in this case
print "Param is: %s" % err.get('param')
print "Message is: %s" % err.get('message')
### SHOULD I REDIRECT HERE INSTEAD? ###
### HOW DO I KEEP THE ERROR MESSAGE? ###
### I HAVE A URL FOR SUBSCRIBE ERRORS IF NEEDED ###
### AND ALSO A subscribe_error(request, error) VIEW ###
template = 'subscribe_error.html'
context = {
'error' : err.get('message')
}
return render(request, template, context)
context = {
'plan' : 'Annual Pro',
'custName' : name,
'custEmail' : email
}
template = 'pro_annual_thanks.html'
return render(request, template, context)
I know a few different ways to do this, for example I could store the context in the session and then pull it from the subscribe_error() view. I could also use redirect() or HttpResponseRedirect() but I'm not sure which, or what the best practice would be.
Any tips? Thanks!
/r/django
https://redd.it/6xxoeo
Hi there,
I'm implementing a payment system on my site and I'm wondering what the best practice way to handle exceptions would be. The exception handling for CC processing is built into the payment processor (Stripe), so that part's not a problem. What I'm trying to determine is what's the best way for me to handle an exception if one is caught, for example a card processing error (e.g. credit card was declined).
In the view that processes the card, it takes a token returned by Stripe, tries to create a customer, assign them to a subscription, and if it fails there are a number of exceptions thrown like CardError, AuthenticationError, InvalidRequestError, etc. In those exceptions I am able to trap the error message easily (e.g. "your credit card was declined") and then return a different template, like subscribe_error.html, which can show the error as a template variable. No problem. The only problem there is that the URL still shows the thank you URL. So I really need to redirect to the error url (e.g. /subscribeerror or whatever), but keep the error message. So what's the best practice way to do this?
Basically, the error handling works, but I just don't know if I am doing it the best way I can. Here's some code:
def pro_annual_thanks(request):
token = request.POST.get('stripeToken')
email = request.POST.get('stripeEmail')
name = request.POST.get('stripeName')
customer_data = {
'description': name,
'card': token,
'email': email
}
try:
stripe.api_key = settings.STRIPE_TEST_SECRET_KEY
customer = stripe.Customer.create(**customer_data)
subscription = customer.subscriptions.create(plan="annual_pro")
except stripe.error.CardError as e:
# Since it's a decline, stripe.error.CardError will be caught
body = e.json_body
err = body.get('error', {})
print "Status is: %s" % e.http_status
print "Type is: %s" % err.get('type')
print "Code is: %s" % err.get('code')
# param is '' in this case
print "Param is: %s" % err.get('param')
print "Message is: %s" % err.get('message')
### SHOULD I REDIRECT HERE INSTEAD? ###
### HOW DO I KEEP THE ERROR MESSAGE? ###
### I HAVE A URL FOR SUBSCRIBE ERRORS IF NEEDED ###
### AND ALSO A subscribe_error(request, error) VIEW ###
template = 'subscribe_error.html'
context = {
'error' : err.get('message')
}
return render(request, template, context)
context = {
'plan' : 'Annual Pro',
'custName' : name,
'custEmail' : email
}
template = 'pro_annual_thanks.html'
return render(request, template, context)
I know a few different ways to do this, for example I could store the context in the session and then pull it from the subscribe_error() view. I could also use redirect() or HttpResponseRedirect() but I'm not sure which, or what the best practice would be.
Any tips? Thanks!
/r/django
https://redd.it/6xxoeo
reddit
What's the best way to redirect to a different view in... • r/django
Hi there, I'm implementing a payment system on my site and I'm wondering what the best practice way to handle exceptions would be. The exception...
[D] My Neural Network isn't working! What should I do? - A list of common mistakes made by newcomers to neural networks.
http://theorangeduck.com/page/neural-network-not-working
/r/MachineLearning
https://redd.it/6xvnwo
http://theorangeduck.com/page/neural-network-not-working
/r/MachineLearning
https://redd.it/6xvnwo
Theorangeduck
My Neural Network isn't working! What should I do?
Computer Science, Machine Learning, Programming, Art, Mathematics, Philosophy, and Short Fiction
Django's cache clear function does not work on view cache?
I am using the view cache for Django 1.10. But I am having problems clearing the cache.
@cache_page(60 * 30, cache="container_table")
def container_table(request, dataset):
# determine container_list by a query to the database
return render(request, 'container_table.html',{"container_list":container_list})
Then container_table.html creates a table involving container_list and each row has an element of container_list along with a little checkbox. When the checkbox is checked, I want the cache to clear. So essentially when the checkbox is checked, an ajax call is made to a view that does caches["container_table"].clear(). From the django docs, this should clear ALL keys in that cache, but it is not working because when I refresh the page for container_table.html it is still using a cache. Am I misunderstanding the usage of caches["container_table"].clear()? I thought it would clear everything!
/r/django
https://redd.it/6xv7a5
I am using the view cache for Django 1.10. But I am having problems clearing the cache.
@cache_page(60 * 30, cache="container_table")
def container_table(request, dataset):
# determine container_list by a query to the database
return render(request, 'container_table.html',{"container_list":container_list})
Then container_table.html creates a table involving container_list and each row has an element of container_list along with a little checkbox. When the checkbox is checked, I want the cache to clear. So essentially when the checkbox is checked, an ajax call is made to a view that does caches["container_table"].clear(). From the django docs, this should clear ALL keys in that cache, but it is not working because when I refresh the page for container_table.html it is still using a cache. Am I misunderstanding the usage of caches["container_table"].clear()? I thought it would clear everything!
/r/django
https://redd.it/6xv7a5
reddit
Django's cache clear function does not work on view cache? • r/django
I am using the view cache for Django 1.10. But I am having problems clearing the cache. @cache_page(60 * 30, cache="container_table") def...
Universities finally realize that Java is a bad introductory programming language
https://thenextweb.com/dd/2017/04/24/universities-finally-realize-java-bad-introductory-programming-language/#.tnw_PLAz3rbJ
/r/Python
https://redd.it/6xy6ld
https://thenextweb.com/dd/2017/04/24/universities-finally-realize-java-bad-introductory-programming-language/#.tnw_PLAz3rbJ
/r/Python
https://redd.it/6xy6ld
The Next Web
Universities finally realize that Java is a bad introductory programming language
What's this "public static void" crap?
Trouble with def+vuejs+axios (Can't set auth paramerters/headers).
I am using axios with vue to get/post data from my local api using DRF. The get requests seem to be working fine(since they don't need authentication) but having trouble with post requests(require basic auth).
I have configured for cors requests using django-cors-headers package as follows (cors package is added to apps, middelware properly):
CORS_ORIGIN_ALLOW_ALL = True
REST_FRAMEWORK = {
'DEFAULT_PERMISSION_CLASSES': [
'rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly'
]
}
The error I am getting is 403 Forbidden(authentication credentials were not provided).
[Network tab of chrome](http://imgur.com/a/aK74s)
[Vue file](https://gist.github.com/Attila03/3398c4a3c55a9812211274d2cb61b761)
Also, sending similar requests from Postman client seems to be working fine.
/r/django
https://redd.it/6xzdbw
I am using axios with vue to get/post data from my local api using DRF. The get requests seem to be working fine(since they don't need authentication) but having trouble with post requests(require basic auth).
I have configured for cors requests using django-cors-headers package as follows (cors package is added to apps, middelware properly):
CORS_ORIGIN_ALLOW_ALL = True
REST_FRAMEWORK = {
'DEFAULT_PERMISSION_CLASSES': [
'rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly'
]
}
The error I am getting is 403 Forbidden(authentication credentials were not provided).
[Network tab of chrome](http://imgur.com/a/aK74s)
[Vue file](https://gist.github.com/Attila03/3398c4a3c55a9812211274d2cb61b761)
Also, sending similar requests from Postman client seems to be working fine.
/r/django
https://redd.it/6xzdbw
Imgur
Imgur: The most awesome images on the Internet
Imgur: The most awesome images on the Internet.
I'm too stupid for AsyncIO (x-post from hackernews)
https://whatisjasongoldstein.com/writing/im-too-stupid-for-asyncio/
/r/Python
https://redd.it/6xxy2q
https://whatisjasongoldstein.com/writing/im-too-stupid-for-asyncio/
/r/Python
https://redd.it/6xxy2q
Do you even log? Questions about your logging habbits considering web apps...
Hey Flask Users,
I am interested in what you are logging in your web apps.
E.g.
+ User activities
+ Http Headers
+ Authentications
+ Errors/Warnings
+ ...
How do you log these things:
+ In a database
+ Files
+ Mails
+ Do you summarize your logs automatically?
And which technology/place you use:
+ Flask
+ Webserver
+ Frontend/js
At the moment I am just logging Python and Flask errors and warnings in a text file using Flask. Additionaly I use the standard logs of Apache Webserver (basic information about single requests and web server errors). But as I am planning to make one of my apps public I probably increase and improve my logging habbits to ensure a stable and safe service for my users...
/r/flask
https://redd.it/6xyxyk
Hey Flask Users,
I am interested in what you are logging in your web apps.
E.g.
+ User activities
+ Http Headers
+ Authentications
+ Errors/Warnings
+ ...
How do you log these things:
+ In a database
+ Files
+ Mails
+ Do you summarize your logs automatically?
And which technology/place you use:
+ Flask
+ Webserver
+ Frontend/js
At the moment I am just logging Python and Flask errors and warnings in a text file using Flask. Additionaly I use the standard logs of Apache Webserver (basic information about single requests and web server errors). But as I am planning to make one of my apps public I probably increase and improve my logging habbits to ensure a stable and safe service for my users...
/r/flask
https://redd.it/6xyxyk
reddit
Do you even log? Questions about your logging habbits... • r/flask
Hey Flask Users, I am interested in what you are logging in your web apps. E.g. + User activities + Http Headers + Authentications +...
mypy infrastructure PR has been merged into pip
https://github.com/pypa/pip/pull/4545
/r/Python
https://redd.it/6y02tj
https://github.com/pypa/pip/pull/4545
/r/Python
https://redd.it/6y02tj
GitHub
Add infrastructure support for static type-checking using mypy by pradyunsg · Pull Request #4545 · pypa/pip
mypy type-checking would be a useful addition.
Ref: #4021
Quick summary of the changes in the PR (as on 2nd Sept 2017):
Add a new CI job that runs mypy checks
Add .pyi stubs for the vendored modu...
Ref: #4021
Quick summary of the changes in the PR (as on 2nd Sept 2017):
Add a new CI job that runs mypy checks
Add .pyi stubs for the vendored modu...
Spiral Barcode Generator: Rick and Morty Episode 101
https://imgur.com/a/nYeDB
/r/Python
https://redd.it/6y56v3
https://imgur.com/a/nYeDB
/r/Python
https://redd.it/6y56v3
Imgur
Rick and Morty Story Circle and Barcodes for episode 101
Imgur: The most awesome images on the Internet.