Check If a Directory Exists in Python
import os
os.path.isdir('./final_data_folder')
References
https://careerkarma.com/blog/python-check-if-file-exists
import os
os.path.isdir('./final_data_folder')
References
https://careerkarma.com/blog/python-check-if-file-exists
from pathlib import Path home = str(Path.home())
C:\Users\Mahmood
References
https://stackoverflow.com/questions/4028904/how-to-get-the-home-directory-in-python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from PyQt4 import QtGui, QtCore
import sys
class Second(QtGui.QMainWindow):
def __init__(self, parent=None):
super(Second, self).__init__(parent)
class First(QtGui.QMainWindow):
def __init__(self, parent=None):
super(First, self).__init__(parent)
self.pushButton = QtGui.QPushButton("click me")
self.setCentralWidget(self.pushButton)
self.pushButton.clicked.connect(self.on_pushButton_clicked)
self.dialog = Second(self)
def on_pushButton_clicked(self):
self.dialog.show()
def main():
app = QtGui.QApplication(sys.argv)
main = First()
main.show()
sys.exit(app.exec_())
if __name__ == '__main__':
main()
References
https://stackoverflow.com/questions/36768033/pyqt-how-to-open-new-window
self.listwidget = QtGui.QListWidget(Dialog) entries = ['one','two', 'three'] self.listwidget.addItems(entries) self.gridLayout.addWidget(self.listwidget, 1, 0, 1, 2)
References
https://stackoverflow.com/questions/49385525/adding-items-to-qlistview
Start adb daemon on remote device
adb devices
$ adb devices * daemon not running. starting it now on port 5037 * * daemon started successfully * List of devices attached 5200fe4259bcc000 device
do client to server port forwarding using ssh on port 5037
References
https://dontbelievethebyte.github.io/articles/2015/01/15/debug-remotely-on-android-via-ssh-tunnel/
https://developer.android.com/studio/command-line/adb
https://stackoverflow.com/questions/2604727/how-can-i-connect-to-android-with-adb-over-tcp
pyinstaller.exe --onefile --add-data="visu.ui;." visu.py
References
https://stackoverflow.com/questions/60509042/python-include-ui-file-in-executable-using-pyinstaller
// find each person with a last name matching 'Ghost'
var query = Person.findOne({ 'name.last': 'Ghost' });
// selecting the `name` and `occupation` fields
query.select('name occupation');
// execute the query at a later time
query.exec(function (err, person) {
if (err) return handleError(err);
// Prints "Space Ghost is a talk show host."
console.log('%s %s is a %s.', person.name.first, person.name.last,
person.occupation);
});
References
https://mongoosejs.com/docs/queries.html
export interface IUser extends mongoose.Document {
name: string;
somethingElse?: number;
};
export const UserSchema = new mongoose.Schema({
name: {type:String, required: true},
somethingElse: Number,
});
const User = mongoose.model<IUser>('User', UserSchema);
export default User;
References
https://stackoverflow.com/questions/34482136/mongoose-the-typescript-way
npm install typescript -s
Inside our package.json we will put a script called tsc:
"scripts": {
"tsc": "tsc"
},
npm run tsc -- --init
Press Alt+F11 then Insert>Module :
Function removeSpecialCharacters(sInput As String) As String
Dim s As String, temp As String, i As Long
Dim C As String
s = sInput
If s = "" Then Exit Function
temp = ""
For i = 1 To Len(s)
C = Mid(s, i, 1)
If AscW(C) > 31 And AscW(C) < 127 Then
temp = temp & C
End If
Next i
removeSpecialCharacters = temp
End Function