This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sqlite3 | |
from sqlite3 import Error | |
def create_connection(db_file): | |
""" create a database connection to the SQLite database | |
specified by db_file | |
:param db_file: database file | |
:return: Connection object or None | |
""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sqlite3 | |
from sqlite3 import Error | |
def create_connection(db_file): | |
""" create a database connection to a SQLite database """ | |
conn = None | |
try: | |
conn = sqlite3.connect(db_file) | |
print(sqlite3.version) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pip install opencv-python | |
pip install opencv-python-headless | |
pip install opencv-contrib-python |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cv2 | |
import numpy as np | |
import sqlite3 | |
#faceDetect=cv2.CascadeClassifier('haarcascade_frontalface_default.xml'); | |
faceDetect = cv2.CascadeClassifier(cv2.data.haarcascades + 'haarcascade_frontalface_default.xml') | |
cam=cv2.VideoCapture(0); | |
def insertOrUpdate(Id,Name,Age,Gen,CR): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//To check if a module is already installed | |
val installedModules: Set<String> = splitInstallManager.installedModules | |
//To Uninstall modules | |
splitInstallManager.deferredUninstall(listOf("pictureMessages", "promotionalFilters")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Generate a new context as soon as a request for a new module | |
// reports as INSTALLED. | |
override fun onStateUpdate(state: SplitInstallSessionState ) { | |
if (state.sessionId() == mySessionId) { | |
when (state.status()) { | |
... | |
SplitInstallSessionStatus.INSTALLED -> { | |
val newContext = context.createPackageContext(context.packageName, 0) | |
// If you use AssetManager to access your app’s raw asset files, you’ll need | |
// to generate a new AssetManager instance from the updated context. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyApplication : SplitCompatApplication() { | |
... | |
} | |
override fun attachBaseContext(base: Context) { | |
super.attachBaseContext(base) | |
// Emulates installation of future on demand modules using SplitCompat. | |
SplitCompat.install(this) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<application | |
... | |
android:name="com.google.android.play.core.splitcompat.SplitCompatApplication"> | |
</application> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SplitInstallManager | |
// Cancels the request for the given session ID. | |
.cancelInstall(mySessionId) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override fun onSessionStateUpdate(state: SplitInstallSessionState) { | |
if (state.status() == SplitInstallSessionStatus.REQUIRES_USER_CONFIRMATION) { | |
// Displays a dialog for the user to either “Download” | |
// or “Cancel” the request. | |
splitInstallManager.startConfirmationDialogForResult( | |
state, | |
/* activity = */ this, | |
// You use this request code to later retrieve the user's decision. | |
/* requestCode = */ MY_REQUEST_CODE) | |
} |