免責聲明

Disclaimer (免責聲明)
繼續閱覽代表您接受以上的免責聲明.
To continue reading means you accept the above disclaimer.

2014年8月28日 星期四

移除 windows 8.1 已安裝的更新

[Q] how to uninstall the installed update on windows 8.1?
[Q] windows8.1 如何解除更新?  (如何移除已安裝的update?)

[try]
0. 先進入Windows Update  [ Control Panel > Windows Update ]

1. 視窗左下角 有一個 Installed Updates 的連結 點下去

2. 視窗改換成顯示已安裝的更新 --> Control Panel > Programs and Features > Installed Updates

3. 選擇想移除的標的,  right-click to uninstall

2014年8月21日 星期四

sqlite3 memo 2014.08.21

//=== examples
sqlite3 ex3.db  "select * from invoice;"  > op1.txt
sqlite3 ex2.db   ip2.sql >  op2.txt
sqlite3 ex1.db  .dump  > ex1.sql


//=== sqlite3 命令列 (sqlite command line shell)

http://www.sqlite.org/cli.html
http://www.sqlite.org/download.html

下載 Precompiled Binaries for Windows
http://www.sqlite.org/2014/sqlite-shell-win32-x86-3080600.zip
解壓縮後得到 sqlite3.exe ,
為了方便, 把 sqlite3.exe 放到 python 的根目錄下



//=== create a new empty database file ex1
先進入 Git Bash
$

$ sqlite3 ex1
SQLite version 3.8.6. ...
Enter ".help" for usage hints.
sqlite> .q

$ ls ex1*
ex1


$ sqlite3 ex2.db
...
sqlite>.q
$ ls ex2*
ex2.db

//=== .q or .quit or .exit to escape sqlite cmd shell


//=== create a new table
$ sqlite3 ex1
sqlite> create table t1 (id Integer, name Text);
sqlite> create table t2 (id int, address text);
sqlite> .tables
t1 t2

sqlite> pragma table_info(t1);
0|id|Integer|0||0
1|name|Text|0||0


//=== insert record
sqlite> insert into t1 values(1, "name1");
sqlite> insert into t1 values(2, "name2");
sqlite> insert into t2 values(1, "addr1");
sqlite> insert into t2 values(2, "addr2");


???
sqlite> commit;
Error: cannot commit - no transaction is active


//=== open a database file
$ sqlite3 db_fname
or

$ sqlite3
sqlite> .open db_fnmae



//=== backup/dump a database or a table to a file
$ sqlite3 db_fname
sqlite> .output db.sql
sqlite> .dump

sqlite> .output t1.sql
sqlite> .dump t1

sqlite> .output t2.sql
sqlite> .dump t2

sqlite> .q
$ ls *.sql



//=== run sql script
$ sqlite3 db_fname "select * from t1;"
$ sqlite3 db_fname "insert into t1 values(3, 'name3');"
$ sqlite3 db_fname "pragma table_info(t1);"
$ sqlite3 db_fname < script_to_run.sql

//=== restore/import from a dump/backup.sql to another db file
 $ sqlite3 -init dbback.sql db_restored_fname


 //=== http://erikej.blogspot.com/2012/08/exporting-sql-server-compact-to-sqlite.html

export/dump/backup
$ sqlite3 ex1.db .dump > ex1_dump.sql

import/load/restore
$ sqlite3 ex1_restored.db < ex1_dump.sql


//=== encoding problem and other notes from erikej.blogspot.com
1. The dump file must be in UTF8 without BOM, i.e. plain utf-8 file

2. ALTER TABLE is limited, so constraints must be included in the CREATE TABLE statement

3. GO separator is not used, all statements must simply end with semicolon ;


???
7. SQLite binary data format: X’FFAABB’

8. not to include rowversion columns in the dump file ...




//===

2014年8月7日 星期四

如何列出 python 模組中可用的方法?

[Q]  how to list methods for a module in python?
[Q]  如何列出python 模組中的方法?

http://stackoverflow.com/questions/139180/listing-all-functions-in-a-python-module

$ dir(modulename)
to see all available methods/attributes


$ import modulename
$ help(modulename)


//=== https://docs.python.org/2/faq/windows.html#is-a-pyd-file-the-same-as-a-dll
pyd 與 dll 的分別

" ... If you have a DLL named foo.pyd, then it must have a function initfoo() ....  "

[例]
extern "C" __declspec(dllexport) void initmyrandom(void) {

Py_InitModule("myrandom", MTPRNGMethods);
}

*** 模組名稱, 檔案名稱, 函數名稱 三者需一致



" ... “import foo” ...
Python will search for foo.pyd (as well as foo.py, foo.pyc) ...
will attempt to call initfoo() to initialize it.
"
*** foo.pyd is not required if  "import foo" is not called

 "... the search path for foo.pyd is  PYTHONPATH,  not the same as the path that Windows uses to search for foo.dll. ..."



???
 " ... In a DLL, linkage is declared in the source code with __declspec(dllexport).
 In a .pyd, linkage is defined in a list of available functions....
"


2014年8月1日 星期五

Skype 帳號一直呈現 online 的狀態

今天突然發現自己另一個 Skype 帳號( B帳號 )一直呈現 online 的狀態,
心想該不會帳號被盜用了, 試著login,  還好還能登入,
趕緊更改密碼, 並將狀態更改為 offline 然後登出;

改用A帳號登入,  沒想到 B帳號還是一直顯示online 的狀態,
難道還有在其他台電腦上裝skype嗎?

網路搜尋  "how to disable multiple login of skype on different computer"

輾轉數折 最後終於找到解法
https://support.skype.com/en/faq/FA10042/what-are-chat-commands-and-roles

" ...
/remotelogout
Sign out all other instances except the current one. This will also stop push notifications on all other instances.
..."

[try]
改以B帳號(不正常顯示者)登入

在發送訊息(message) 的對話盒中 輸入
/showplaces 然後送出(send) 就會顯示目前在那些電腦上有登入 
You have 4 online endpoints:
  {dc4xxxxx-dxxx-bxxxx-xxxx-xxxxxxxxx}) AUTO1 Windows Skype
  {xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx}) localhost Android Skype
  {xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx}) localhost Android Skype
  {xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx}) localhost Android Skype


發送
/remotelogout 則會將本機以外的登入狀態清除掉

再發送一次 /showplaces 來查看
You have 1 online endpoints:
  {dc4xxxxx-dxxx-bxxxx-xxxx-xxxxxxxxxx}) AUTO1 Windows Skype


登出B帳號, 改以A帳號登入  查看B帳號 狀態 
終於正常了!

至於localhost Android Skype 怎麼來的? 
應該是個把月前買的android 電視盒 
裝了skype 才發現沒有麥克風輸入孔 ...