Sign in

i like programming :) Website: https://ryanchou-dev.github.io/ryan/

No experience required!

Photo by Boitumelo Phetla on Unsplash

Today we will learn how to send desktop notifications with Python. For this we will just need a computer with Python installed.

Packages and Setup

You’ll need Plyer’s notification for this project:

# In CMD or terminalpip install plyer# In projectfrom plyer import notification

You can send notifications by calling the notify() function from notification.

It takes four parameters:

title The large header text at the top of a notification.

message The longer, smaller text where you put more detailed information.

app_icon The image that appears next to the title and message.

timeout How long the message should show…


In under 5 minutes!

Photo by Tim Bennett on Unsplash

What you will learn:

  • How to use Pyinstaller to create executable files.
  • What you can do with executable files.

Prerequisites:

  • Nothing

Downloading Pyinstaller

You can use Python’s package index to install the module we’ll use. Just run in your terminal or command line:

pip install pyinstaller

Converting your file

You first have to go to the location where your file is, so you can type cd and then the path name to get there in your terminal.

Example:
cd C:\Users\Ryan\Downloads\Projects

Now instead of

C:\Users\Ryan>

it will be

C:\Users\Ryan\Downloads\Projects>

Alright, you can now call Pyinstaller and build your file.

(If you have multiple files, you just…


Algorithms are a key part of programming, and it’s important that you learn how to implement them into your code.

Photo by Christopher Gower on Unsplash

Algorithms are a key part of programming, and it’s important that you learn how to implement them into your code. Today, we’re going to solve basic algorithmic problems from HackerRank.

Recommended:

  • Basic understanding of a programming language

FYI: The code stubs will be written in Python, but you can follow along in any language you like!

Day of the Programmer

Follow along here!

Problem (from HackerRank):

Marie invented a Time Machine and wants to test it by time-traveling to visit Russia on the Day of the Programmer (the 256th day of the year) during a year in the inclusive range from 1700 to 2700.

From 1700 to…


A beginner’s guide

Photo by Brett Jordan on Unsplash

SQL is one of the most used systems for managing and storing data, so it’s a great skill to have. Today, we’re going to look at 10 of the most used commands.

1. Create a database and table!

All databases contain one or more tables, so it’s necessary to know how to create one.

Database:

You can create a database with this SQL command:

CREATE DATABASE database_name;

It’s also recommended you use IF NOT EXISTS, so SQL doesn’t return an error if a database already exists with that name.

CREATE DATABASE IF NOT EXISTS database_name;

Table:

You can create a table with basically the same syntax from before.


Hello! I have more social media links, where you can find out more about what I do!

Website: https://ryanchou-dev.github.io/ryan/

Kaggle: https://www.kaggle.com/ryanchoudev

Tableau: https://public.tableau.com/profile/ryan.chou

Thank you so much for your support!


With no previous fan following!

Photo by Markus Winkler on Unsplash

I started my Medium account with the goal to write more. One month later, with 3750+ views, 1550+ reads, 162+ fans, and 63 followers, I’ve learned so many important lessons. Here are 5 things I learned in my first month.

0. Stats Breakdown

Here are my stats.


In three lines of code!

Photo by Markus Winkler on Unsplash

Packages and Setup

Install Pillow

pip install Pillow

And PyZBar.

pip install pyzbar

Then import them both.

from PIL import Imagefrom pyzbar import pyzbar

Read and Decode

Let’s open up our QR code with Pillow’s Image package

img = Image.open('____.png')

And decode it with PyZBar’s decode.

output = pyzbar.decode(img)

Now we can print the output.

print(output)

If we run it, you should get this output.

[Decoded(data=b'https://ryanchou-dev.github.io/ryan/', type='QRCODE', rect=Rect(left=__, top=__, width=__, height=__), polygon=[Point(x=_, y=_), Point(x=_, y=_), Point(x=_, y=_), Point(x=_, y=_)])]

As you can see, our link is in the part that says data=.

data=b'https://ryanchou-dev.github.io/ryan/'

Finished code:

Conclusion

Thanks!

I hope you enjoyed reading this, and that…


Save entries and data without a server!

Photo by Jan Antonin Kolar on Unsplash

What you will learn:

  • How to create an SQLite database.
  • How to execute SQL commands to your database.

What you will need:

  • Computer with Python installed.

Packages and Setup

SQLite comes pre-installed on Python versions 2.5 and up, so you can just import it.

import sqlite3

We can create and connect to the database with this line.

# 'database' can changed with any valid stringconnect = sqlite3.connect('database.db')

The database should be created!


Generate QR codes in just two lines of code!

Photo by Mitya Ivanov on Unsplash

What you will learn:

  • How to generate QR codes using Python.

What you will need:

  • A computer with Python installed.

Packages and Setup

We’ll be utilizing the library pyqrcode:

# In terminal
pip install pyqrcode
# In project
import pyqrcode

Create the code!

We can just call the create function in the library. Set the string to whichever website you want. Remember to assign a variable to it so that you can save the generated key.

url = pyqrcode.create('https://ryanchou-dev.github.io/ryan/')

You can save it as a .svg file by calling .svg() within the variable with the QR code.

url.svg('websiteqrcode.svg', scale=8)

Running it will create a new…


which users can install using pip!

Photo by Curology on Unsplash

Packages on Pypi are extremely versatile and easy to implement into your code, which is why people often want to upload their projects to the platform.

Today, I’ll teach you how to prepare and publish your package there, without the hassle of confusing documentation.

What you will learn:

  • How to make a Python package from scratch.

What you need:

  • Computer with Python installed.

Setup

Let’s make a folder, with an __init__.py so that Python knows it's a package.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store