The Power of Bit Manipulation - How to Solve Problems Efficiently
https://www.anurag629.club/posts/the-power-of-bit-manipulation-how-to-solve-problems-efficiently
/r/Python
https://redd.it/13jy2x8
https://www.anurag629.club/posts/the-power-of-bit-manipulation-how-to-solve-problems-efficiently
/r/Python
https://redd.it/13jy2x8
Reverse django migrations
There is a way to reverse a migrations in django? i've seen this feature in other frameworks but i have never listen to something like that in django. I always forget to put an attribute in models and i need to delete or modify in the database, especially when it is the uuid
/r/djangolearning
https://redd.it/13kault
There is a way to reverse a migrations in django? i've seen this feature in other frameworks but i have never listen to something like that in django. I always forget to put an attribute in models and i need to delete or modify in the database, especially when it is the uuid
/r/djangolearning
https://redd.it/13kault
Reddit
r/djangolearning on Reddit: Reverse django migrations
Posted by u/tgoofarias - No votes and 1 comment
Tutorial: Django Form Validation Guide
Form validation is an important feature for web applications, and there are many ways to do it.
In this tutorial, I will talk about some different ways to do form validation in Django, and compare them to help you choose the best way in your project.
After reading this article, you will learn:
1. What is Built-in Form Validation in HTML
2. How to use Javascript to do client form validation
3. How to use
4. How to use
5. How to use Django Form to do server form validation
6. How to use Django Rest Framework to do server form validation
Here is the link: Django Form Validation Guide
/r/django
https://redd.it/13k3ktq
Form validation is an important feature for web applications, and there are many ways to do it.
In this tutorial, I will talk about some different ways to do form validation in Django, and compare them to help you choose the best way in your project.
After reading this article, you will learn:
1. What is Built-in Form Validation in HTML
2. How to use Javascript to do client form validation
3. How to use
jQuery Validation or Parsley to do client form validation, and how they work4. How to use
Yup to do client form validation5. How to use Django Form to do server form validation
6. How to use Django Rest Framework to do server form validation
Here is the link: Django Form Validation Guide
/r/django
https://redd.it/13k3ktq
Saashammer
Django Form Validation Guide
In this tutorial, I will talk about some ways to do form validation in Django, and compare them to help you choose the best way in your project.
R Language Models Don't Always Say What They Think: Unfaithful Explanations in Chain-of-Thought Prompting
Large Language Models (LLMs) can achieve strong performance on many tasks by producing step-by-step reasoning before giving a final output, often referred to as chain-of-thought reasoning (CoT). It is tempting to interpret these CoT explanations as the LLM's process for solving a task. However, we find that CoT explanations can systematically misrepresent the true reason for a model's prediction. We demonstrate that CoT explanations can be heavily influenced by adding biasing features to model inputs -- e.g., by reordering the multiple-choice options in a few-shot prompt to make the answer always "(A)" -- which models systematically fail to mention in their explanations. When we bias models toward incorrect answers, they frequently generate CoT explanations supporting those answers. This causes accuracy to drop by as much as 36% on a suite of 13 tasks from BIG-Bench Hard, when testing with GPT-3.5 from OpenAI and Claude 1.0 from Anthropic. On a social-bias task, model explanations justify giving answers in line with stereotypes without mentioning the influence of these social biases. Our findings indicate that CoT explanations can be plausible yet misleading, which risks increasing our trust in LLMs without guaranteeing their safety. CoT is promising for explainability, but our results highlight the
/r/MachineLearning
https://redd.it/13k1ay3
Large Language Models (LLMs) can achieve strong performance on many tasks by producing step-by-step reasoning before giving a final output, often referred to as chain-of-thought reasoning (CoT). It is tempting to interpret these CoT explanations as the LLM's process for solving a task. However, we find that CoT explanations can systematically misrepresent the true reason for a model's prediction. We demonstrate that CoT explanations can be heavily influenced by adding biasing features to model inputs -- e.g., by reordering the multiple-choice options in a few-shot prompt to make the answer always "(A)" -- which models systematically fail to mention in their explanations. When we bias models toward incorrect answers, they frequently generate CoT explanations supporting those answers. This causes accuracy to drop by as much as 36% on a suite of 13 tasks from BIG-Bench Hard, when testing with GPT-3.5 from OpenAI and Claude 1.0 from Anthropic. On a social-bias task, model explanations justify giving answers in line with stereotypes without mentioning the influence of these social biases. Our findings indicate that CoT explanations can be plausible yet misleading, which risks increasing our trust in LLMs without guaranteeing their safety. CoT is promising for explainability, but our results highlight the
/r/MachineLearning
https://redd.it/13k1ay3
Reddit
r/MachineLearning on Reddit: [R] Language Models Don't Always Say What They Think: Unfaithful Explanations in Chain-of-Thought…
Posted by u/saintshing - 116 votes and 23 comments
Are there any large Jupyter notebooks that use widgets that I can look at?
Does anyone know of Jupyter notebooks I can look at which use a large number of widgets? I'd like to see how others are organizing their code.
I'm trying to teach some encryption concepts using Jupyter and Jupyter widgets, but the more widgets I add the larger the build up of distracting widget-related code in the notebook. I imagine I can just move all this code to Python modules, but I'd still like to have it organized well so that students can dig in to tweak things.
​
Thanks!
/r/IPython
https://redd.it/13k9g83
Does anyone know of Jupyter notebooks I can look at which use a large number of widgets? I'd like to see how others are organizing their code.
I'm trying to teach some encryption concepts using Jupyter and Jupyter widgets, but the more widgets I add the larger the build up of distracting widget-related code in the notebook. I imagine I can just move all this code to Python modules, but I'd still like to have it organized well so that students can dig in to tweak things.
​
Thanks!
/r/IPython
https://redd.it/13k9g83
Reddit
r/IPython on Reddit: Are there any large Jupyter notebooks that use widgets that I can look at?
Posted by u/NotAnArdvark - 1 vote and 1 comment
I am using stripe. I discovered that metadata can pass on information. The reason I am using metadata is because I want to pass on the email variable from the payment db to a email that will be sent in the 'order/success' route. How do I get the email from metadata?
​
Here is the link where I found out about metadata.
[https://stackoverflow.com/questions/64405557/how-do-you-carry-a-variable-like-userid-through-the-stripe-checkout-process-in-f](https://stackoverflow.com/questions/64405557/how-do-you-carry-a-variable-like-userid-through-the-stripe-checkout-process-in-f)
​
​
FYI I did not include the email. Any advice?
​
As you can see in the code I tried but all it flashes is the word 'testing'.
What am I doing wrong?
​
donation_prices = data['payment_donation_price']
flash("Testing",donation_prices)
​
​
from flask import Blueprint , render_template, redirect, url_for, request, abort, flash
from app.payment.forms import EmptyForm, EmailForm
import stripe
# might need to adjust templates
payment = Blueprint('payment', __name__, template_folder='templates')
from flask_login import current_user
# import db from flaskblog folder in __init__.py.
from app import db
from app.models import User, Payments
from redmail import outlook
import os
@payment.route('/donations', methods = ['POST', 'GET'])
def donations():
/r/flask
https://redd.it/13khh0m
​
Here is the link where I found out about metadata.
[https://stackoverflow.com/questions/64405557/how-do-you-carry-a-variable-like-userid-through-the-stripe-checkout-process-in-f](https://stackoverflow.com/questions/64405557/how-do-you-carry-a-variable-like-userid-through-the-stripe-checkout-process-in-f)
​
​
FYI I did not include the email. Any advice?
​
As you can see in the code I tried but all it flashes is the word 'testing'.
What am I doing wrong?
​
donation_prices = data['payment_donation_price']
flash("Testing",donation_prices)
​
​
from flask import Blueprint , render_template, redirect, url_for, request, abort, flash
from app.payment.forms import EmptyForm, EmailForm
import stripe
# might need to adjust templates
payment = Blueprint('payment', __name__, template_folder='templates')
from flask_login import current_user
# import db from flaskblog folder in __init__.py.
from app import db
from app.models import User, Payments
from redmail import outlook
import os
@payment.route('/donations', methods = ['POST', 'GET'])
def donations():
/r/flask
https://redd.it/13khh0m
Stack Overflow
How do you carry a variable like userID through the Stripe Checkout process in Flask?
I have a simple flask site that is connected to a dial script in python. It will call the phone number you enter in on the home page and connect to your phone number along with some other things. ...
Thursday Daily Thread: Python Careers, Courses, and Furthering Education!
Discussion of using Python in a professional environment, getting jobs in Python as well as ask questions about courses to further your python education!
This thread is not for recruitment, please see r/PythonJobs or the thread in the sidebar for that.
/r/Python
https://redd.it/13kiiw7
Discussion of using Python in a professional environment, getting jobs in Python as well as ask questions about courses to further your python education!
This thread is not for recruitment, please see r/PythonJobs or the thread in the sidebar for that.
/r/Python
https://redd.it/13kiiw7
Reddit
r/Python on Reddit: Thursday Daily Thread: Python Careers, Courses, and Furthering Education!
Posted by u/Im__Joseph - 1 vote and no comments
Django password form not working
I am trying to modify the default django sing in form. I made the following files:
The forms.py file:
class CrateUserForm(UserCreationForm):
class Meta:
model = User
fields= 'username', 'email', 'password1', 'password2',
widgets = {
'username': forms.TextInput(attrs={
'class': 'w-100 p-3 rounded-4 border border-success shadow',
'placeholder': 'Exemplu1234',
}),
'email': forms.EmailInput(attrs={
'class': 'w-100 p-3 rounded-4 border border-success shadow',
/r/djangolearning
https://redd.it/13k2i7t
I am trying to modify the default django sing in form. I made the following files:
The forms.py file:
class CrateUserForm(UserCreationForm):
class Meta:
model = User
fields= 'username', 'email', 'password1', 'password2',
widgets = {
'username': forms.TextInput(attrs={
'class': 'w-100 p-3 rounded-4 border border-success shadow',
'placeholder': 'Exemplu1234',
}),
'email': forms.EmailInput(attrs={
'class': 'w-100 p-3 rounded-4 border border-success shadow',
/r/djangolearning
https://redd.it/13k2i7t
Reddit
r/djangolearning on Reddit: Django password form not working
Posted by u/Fit-Refrigerator495 - 1 vote and 6 comments
HTMX/Ajax polling in flask app
Hey all,
I'm working on a server side flask app where multiple people are performing writes to a database.
​
So far everything works - but I'm confused as how to update the view for each user every time a write is made.
​
I briefly looked into HTMX Polling (https://htmx.org/docs/#polling) and was able to quickly get a
demo up and running just doing basic ajaxpolling once every 2 sec but that seems fairly ineffiecent to me.
​
The database is basically being rendered into a table where others can add / remove from it and I plan
on having many of these per user.
​
Is HTMX/Ajax polling the best solution for this? I haven't tested this out yet but eventually I feel
like I'd hit a bottle neck with all the polling requests being made to the server!
/r/flask
https://redd.it/13kjfmj
Hey all,
I'm working on a server side flask app where multiple people are performing writes to a database.
​
So far everything works - but I'm confused as how to update the view for each user every time a write is made.
​
I briefly looked into HTMX Polling (https://htmx.org/docs/#polling) and was able to quickly get a
demo up and running just doing basic ajaxpolling once every 2 sec but that seems fairly ineffiecent to me.
​
The database is basically being rendered into a table where others can add / remove from it and I plan
on having many of these per user.
​
Is HTMX/Ajax polling the best solution for this? I haven't tested this out yet but eventually I feel
like I'd hit a bottle neck with all the polling requests being made to the server!
/r/flask
https://redd.it/13kjfmj
Reddit
r/flask on Reddit: HTMX/Ajax polling in flask app
Posted by u/user2m - 3 votes and 2 comments
Python for Network Engineers
I apologize for my ignorance if this questions have been asked before, I want to know where is the best place to start to learn python for network engineers. Unfortunately I have no programming experience and I've been rejected multiple job offers due to lack of knowledge in network automation. I've been told "Automate the boring stuff" is a good place to start, but it does get challenging at times.
/r/Python
https://redd.it/13k7djn
I apologize for my ignorance if this questions have been asked before, I want to know where is the best place to start to learn python for network engineers. Unfortunately I have no programming experience and I've been rejected multiple job offers due to lack of knowledge in network automation. I've been told "Automate the boring stuff" is a good place to start, but it does get challenging at times.
/r/Python
https://redd.it/13k7djn
Reddit
r/Python on Reddit: Python for Network Engineers
Posted by u/Borealis_761 - 19 votes and 16 comments
GitHub - Crunch-io/lazycsv - lazycsv is a C implementation of a csv parser for python.
https://github.com/Crunch-io/lazycsv
/r/Python
https://redd.it/13kt6vd
https://github.com/Crunch-io/lazycsv
/r/Python
https://redd.it/13kt6vd
GitHub
GitHub - Crunch-io/lazycsv
Contribute to Crunch-io/lazycsv development by creating an account on GitHub.
lablup/rraft-py: Unofficial Python Binding of the tikv/raft-rs
https://github.com/lablup/rraft-py
/r/Python
https://redd.it/13kvae4
https://github.com/lablup/rraft-py
/r/Python
https://redd.it/13kvae4
GitHub
GitHub - lablup/rraft-py: Unofficial Python Binding of the tikv/raft-rs
Unofficial Python Binding of the tikv/raft-rs. Contribute to lablup/rraft-py development by creating an account on GitHub.
What does a backend developer's portfolio look like? If you've been in the industry for a while, can you please share your portfolio URL.
/r/django
https://redd.it/13kyrxn
/r/django
https://redd.it/13kyrxn
Reddit
r/django on Reddit: What does a backend developer's portfolio look like? If you've been in the industry for a while, can you please…
Posted by u/_BigOle - No votes and 2 comments
I published a Python Plotly Data Visualization Course on Youtube
Hello everyone, I am excited to share my new Python Plotly course. In this course I covered a lot of data visualization types including line plot, scatter plot, error bar, bubble chart, bar chart (horizontal - vertical - stacked), histogram, pie chart, box plot, heat map 3D visualization and sunburst chart. I uploaded my course to the Youtube. I am leaving the link, have a great day!
https://www.youtube.com/watch?v=W\_qQTKupZpY
/r/Python
https://redd.it/13kr079
Hello everyone, I am excited to share my new Python Plotly course. In this course I covered a lot of data visualization types including line plot, scatter plot, error bar, bubble chart, bar chart (horizontal - vertical - stacked), histogram, pie chart, box plot, heat map 3D visualization and sunburst chart. I uploaded my course to the Youtube. I am leaving the link, have a great day!
https://www.youtube.com/watch?v=W\_qQTKupZpY
/r/Python
https://redd.it/13kr079
YouTube
Python Plotly Course: Learn Data Visualization in Python
Welcome to Python Plotly Course! If you're looking to master the art of data visualization using Python, this course is perfect for you. With Plotly, a powerful graphing library, you'll learn how to create stunning and interactive visualizations that bring…
Anyone interested in how to automate Tableau Server flow execution in Python without add-ons?
Hi there, I have released an instructional course on Udemy on how to implement a Python implementation of how to schedule flows on Tableau Server without add-ons, but unfortunately it didn't catch anyone's attention. I'll post a free coupon here so that someone can review it. By the way, I do not speak English, so I rely on translation software to post it. The course was for Japanese, but now I have added English subtitles. 17 out of 37 have been added, and the rest will be added within this month.
Udemy Link (Free Coupon)
https://www.udemy.com/course/tag-flow-conductor/?couponCode=TAG\_FLOW\_CONDUCTOR
The final product we will make in this course is available on Youtube. Sorry, this one is not subtitled yet, but if you watch 3:20-5:00 you can see what it looks like.
https://www.youtube.com/watch?v=gEw5oXFwlI0
The full source code for this application is available in the Udemy resources.
In addition to automatically executing specified flows in parallel at specified times, the application can easily be controlled synchronously, such as waiting for one flow to complete execution before automatically executing the next flow.
If you have any questions, please ask me.
Thank you.
/r/Python
https://redd.it/13l1k8s
Hi there, I have released an instructional course on Udemy on how to implement a Python implementation of how to schedule flows on Tableau Server without add-ons, but unfortunately it didn't catch anyone's attention. I'll post a free coupon here so that someone can review it. By the way, I do not speak English, so I rely on translation software to post it. The course was for Japanese, but now I have added English subtitles. 17 out of 37 have been added, and the rest will be added within this month.
Udemy Link (Free Coupon)
https://www.udemy.com/course/tag-flow-conductor/?couponCode=TAG\_FLOW\_CONDUCTOR
The final product we will make in this course is available on Youtube. Sorry, this one is not subtitled yet, but if you watch 3:20-5:00 you can see what it looks like.
https://www.youtube.com/watch?v=gEw5oXFwlI0
The full source code for this application is available in the Udemy resources.
In addition to automatically executing specified flows in parallel at specified times, the application can easily be controlled synchronously, such as waiting for one flow to complete execution before automatically executing the next flow.
If you have any questions, please ask me.
Thank you.
/r/Python
https://redd.it/13l1k8s
Udemy
How to run a flow on Tableau Server automatically in Python
PythonでTableau Server上のフローを自動実行させる方法を及び、 PySimpleGUI の基礎も学べます。English subtitles fully supported!
Accessing Django admin site from browser says refused to connect
I run my app in vscode debug. The debug config is as follows:
{
"name": "bodhitree",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/manage.py",
"args":
"runserver",
"--noreload",
"0.0.0.0:3000"
,
"django": true,
"justMyCode": false
}
This simply seem to run
/r/djangolearning
https://redd.it/13l6qmz
I run my app in vscode debug. The debug config is as follows:
{
"name": "bodhitree",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/manage.py",
"args":
"runserver",
"--noreload",
"0.0.0.0:3000"
,
"django": true,
"justMyCode": false
}
This simply seem to run
runserver 0.0.0.0:3000. Earlier I was able to access django admin site. But now I am not/r/djangolearning
https://redd.it/13l6qmz
Reddit
From the djangolearning community on Reddit
Explore this post and more from the djangolearning community
Ajax Not Working on Live Server
I am moving a Django project onto a PythonAnywhere server and am experiencing a few hiccups (as expected). But there is one particular problem I can't figure out. I have a view that display a bunch of different form data. Within each form is a button, where when pressed, there is AJAX code that triggers to post it to another view that saves it my database.
When I do it on a local server I don't have any issues, but when trying it on the live server, nothing happens. I checked the error and server logs on PA, but don't see anything to indicate what is happening. Any idea of what could be causing this or where to look to resolve it?
/r/djangolearning
https://redd.it/13l30rq
I am moving a Django project onto a PythonAnywhere server and am experiencing a few hiccups (as expected). But there is one particular problem I can't figure out. I have a view that display a bunch of different form data. Within each form is a button, where when pressed, there is AJAX code that triggers to post it to another view that saves it my database.
When I do it on a local server I don't have any issues, but when trying it on the live server, nothing happens. I checked the error and server logs on PA, but don't see anything to indicate what is happening. Any idea of what could be causing this or where to look to resolve it?
/r/djangolearning
https://redd.it/13l30rq
Reddit
r/djangolearning on Reddit: Ajax Not Working on Live Server
Posted by u/nalbright36 - 1 vote and 4 comments
Importing lot of data to Django
Hi guys !
I am being given the task of planning a data migration from legacy system consisting of a SQL server database and an IBM db2 database to the new ERP database which is a PostGres database serving a Django app (the ERP).
The fact is that the ORM nature of Django makes me wonder if I use Django to operate the data migration or to use classic tools such as ETL or SQL/Python scripts to interact directly with the db ?
What the general community point of view and strategy to import huge quantity of data to a Django app ?
Thanks in advance !
/r/django
https://redd.it/13l25fa
Hi guys !
I am being given the task of planning a data migration from legacy system consisting of a SQL server database and an IBM db2 database to the new ERP database which is a PostGres database serving a Django app (the ERP).
The fact is that the ORM nature of Django makes me wonder if I use Django to operate the data migration or to use classic tools such as ETL or SQL/Python scripts to interact directly with the db ?
What the general community point of view and strategy to import huge quantity of data to a Django app ?
Thanks in advance !
/r/django
https://redd.it/13l25fa
Reddit
r/django on Reddit: Importing lot of data to Django
Posted by u/Ok_Smile8316 - 4 votes and 3 comments
I created a app to manage Feature Flags with Django + Vue, feedback appreciated!
Hello I created a small app to quickly create feature flags.
I'd appreciate any feedback on it :)
You can check it out on https://flagly.dev/
/r/django
https://redd.it/13l0cv6
Hello I created a small app to quickly create feature flags.
I'd appreciate any feedback on it :)
You can check it out on https://flagly.dev/
/r/django
https://redd.it/13l0cv6
flagly.dev
flagly - Easy Feature Flags
The easiest place to create Feature Flags