I am using a raspian OS for my python projects, and most of the cases I run the scripts directly using a virtual environment. For the cases that i need to use a compiler like Python IDLE a way to open it from within the virtual environment is by running the following command, after you enable it of course.
The below snippet allows you to create an sqlite3 database and then import data to it.
#this connects and creates the database.db file, in the same location where the script exists
conn = sqlite3.connect(database.db)
c = conn.cursor()
#execute the create table
c.execute('''CREATE TABLE IF NOT EXISTS mytable
#this is the dataset i will save to database as a python list:
data=['firstfile.mov','en','2018','This is a short summary of the video','3.8']
#get the data in the database
c.execute('INSERT INTO mytable VALUES (?,?,?,?,?)', data)
#close the connection
Since you are editing text in Notepad ++, and you have already used Quick Tip #1 to mark specific lines of code, say containg <span> you might need to break the whole line in two lines so that a new line break forms after the <span> part of the code.
More Html Code here <span>Santa is Coming</span> More Html Code here
More Html Code here <span>
Santa is Coming
</span> More Html Code here
An easy way to do this by using the search and replace menu of notepad ++ . You need to seach for a part of the code where you want the break to occur, and then replace for the same part adding the escape sequence of the line break “\n” at the end. Make sure you have enabled “Extended Search Mode” at the bottom of the search window.
Additional Espace Sequences can be used in the same way:
Notepad ++ is my preferred text/ php/html/python editor, and, since some time i have been discovering all the nice things and automations you can do with it. I will be posting updates for notepad ++ automation and tricks, primary because its so hard for me to remember all of them. 🙂
Here it goes:
I some times need to scrape html code to specific tags or image urls. I found that this can be easily done using the search option of the Notepad++ and the “Mark” tab.
“Mark” basically bookmarks any line that has the search term in it. After you bookmark all the lines with “<span>” for example, then you can go to Search> Bookmark>Remove Unmarked Lines to remove all the parts of the code that do not contain the search term and of course are not needed. Nice?
After having used one of my SD cards, in raspberry PI to host the operating system, i tried multiple times to restore it to its original size. It Only showed 125Mb of space while it should normally be around 4gb. Many utilities did not work, throwing errors. Disk part worked.
Open CMD in windows and type
This lists all the drives registered in the system at the time and their original size (no partitions)
Select the drive (SD card) you want to reclaim space for.
Type : Select Drive #
Select Disk and the number of the drive, for me it was drive 2.
Then navigate to windows disk manager, format the SD card with the file system you want FAT, FAT32 and assign it a drive letter.
Update, below a complete set of commands since only clean does not seem to work always. Creating the primary partition and formating is needed after that.
SELECT DISK 1 CLEAN CREATE PARTITION PRIMARY SELECT PARTITION 1 ASSIGN FORMAT FS=NTFS EXIT