What do you want to save?
Add Code snippet
New code examples
-
SQL 2021-11-14 20:28:27
check psql validity function
CREATE OR REPLACE FUNCTION is_sql(sql text) returns boolean language plpgsql AS $$ DECLARE exception_message text; exception_context text; BEGIN BEGIN EXECUTE E'DO $IS_SQL$ BEGIN\nRETURN;\n' || trim(trailing E'; \r\n' from sql) || ... Add solution -
Python 2021-11-14 02:21:13
sqlite3 with flask web application CRUD pdf
# app/models.py from flask_login import UserMixin from werkzeug.security import generate_password_hash, check_password_hash from app import db, login_manager class Employee(UserMixin, db.Model): """ Create an Employee table &... Add solution -
Python 2021-11-13 20:26:14
python multiple items in with statment
# It is possible in Python 3 since v3.1 and Python 2.7. The # new with syntax supports multiple context managers: with A() as a, B() as b, C() as c: doSomething(a,b,c) # Unlike the contextlib.nested, # this guarantees that a and b will have their __ex... Add solution -
Python 2021-11-12 03:58:10
opencv webcam python
import cv2 cap = cv2.VideoCapture(0) # Check if the webcam is opened correctly if not cap.isOpened(): raise IOError("Cannot open webcam") while True: ret, frame = cap.read() frame = cv2.resize(frame, None, fx=0.5, fy=0.5, interpol... Add solution -
Python 2021-11-11 22:17:09
python copy paste file
#shutil module has many methods you can use from shutil import copyfile copyfile(source, destination) # Copy the contents of the file named src to a file named dst. Both src and dst need to be the entire filename of the files, including path. # The destin... Add solution -
Python 2021-11-10 22:15:24
Random int without random module
def randint(a, b): "Return random integer in range [a, b], including both end points." return a + randbelow(b - a + 1) def randbelow(n): "Return a random int in the range [0,n). Raises ValueError if n<=0." k = n.bi... Add solution -
SQL 2021-11-10 19:59:23
cursor procedure with python mssql get result
#********************************************************************** # FILENAME : CallSPMultiResultSet.py # # DESCRIPTION : # Simple ODBC (pyodbc) example to SELECT data from two tables # via a stored procedure, returning... Add solution -
Python 2021-11-10 02:52:15
how to split channels wav python
import wave import numpy as np def save_wav_channel(fn, wav, channel): ''' Take Wave_read object as an input and save one of its channels into a separate .wav file. ''' # Read data nch = wav.getnchannels() depth = wav.getsam... Add solution