2016年8月26日 星期五

python sqlite interface

1.  Connection to DB and import many records



import sqlite3
conn = sqlite3.connect('C:\\sqlite\\IE11.sqlite')
c = conn.cursor()
c.executemany('INSERT INTO PCInfo(log,ip,pcname,IE,home) VALUES (?,?,?,?,?)', records)
conn.commit()



REF
official sqlite3

sqlite install in windows 64bits

1. Download from sqlite  https://sqlite.org/download.html

sqlite-dll-win64-x64-3140100.zip
sqlite-tools-win32-x86-3140100.zip


2. Create Folder and unzip 

.mkdir  in C:\sqlite
.unzip above  two zip











3. launch the sqlite 

cd c:\sqlite
sqlite3.exe

SQLite version 3.14.1 2016-08-11 18:53:32
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.


4. How to use 

.open test.sqlite
CREATE TABLE users (id integer primary key autoincrement, name text not null);
insert into users (name) values('jon');
insert into users (name) values('paul');
sqlite> select * from users;
1|john
2|paul

the .open is the command for create/connection database
other .tables or .drop



Reference :
First_Installing-and-Using-SQLite-on-Windows
Appropriate Uses For SQLite
SQLite vs MySQL


Python 3.5 windows install

1. Download site  https://www.python.org/downloads/

2.  Install it and will in the
C:\Users\andychung\AppData\Local\Programs\Python\Python35-32

3. default python will launch by py
cmd
py some_script

InstallREference GOOD
https://docs.python.org/3/using/windows.html
https://docs.python.org/3.3/using/windows.html




2016年8月10日 星期三

windows Regedit File Command add / delete



Using the reg command
Action: add, delete

If delete:

reg delete "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /f




From REF
修改(包括新增)登錄檔。範例:
reg add "HKCU\Keyboard Layout\Toggle" /v "Layout Hotkey" /d "2" /t REG_SZ /f
HKCU 是 HKEY_CURRENT_USER 的縮寫。
/v 後面寫:regedit 登錄編輯程式右半邊視窗登錄檔條目的名稱。
/d 後面寫:regedit 登錄編輯程式右半邊視窗登錄檔條目的數值。
/t 後面寫:regedit 登錄編輯程式右半邊視窗登錄檔條目的類型。如果你不知道你要修改的登錄檔是什麼類型,就到登錄編輯程式右半邊視窗那裡看一下,常見的有 REG_SZ、REG_DWORD。