2024/01/05

WINDOWS複製資料夾 包含權限

 如果要把A資料夾整個完整複製,包含裡面的權限跟所有資料,然後名稱變成B資料夾。

而且B資料夾本身的權限必須跟A資料夾相同,可以使用robocopy這個內建指令。

執行指令前要確認B資料夾不存在,再執行指令。

指令: robocopy D:\A D:\B /E /COPYALL



If you want to completely copy the entire A folder, including its permissions and all data inside, and rename it to B folder, you can use the built-in command robocopy.

Ensure that the B folder does not exist before executing the command.

Command: robocopy D:\A D:\B /E /COPYALL

2024/01/03

WINDOWS 檔案總管內點選檔案時速度很慢

使用者反應,他在檔案總管裡,開啟一個pdf檔案時很正常,然後再點其他pdf檔案後,檔案不會馬上開啟,要等個幾十秒,他認為是程式有問題。

把程式重新安裝後,還是一樣,後來發現在檔案總管內,是有開啟預覽窗格的功能,如果這個功能關閉,連續開啟不同檔案時,就不會有緩慢的問題了。




User feedback indicates that when he opens a PDF file in File Explorer, it works fine. However, when he tries to open another PDF file after that, the file doesn't open immediately; instead, it takes several seconds. He believes there is an issue with the program.

Even after reinstalling the program, the problem persists. Later, it was discovered that within File Explorer, there is a feature to open a preview pane. When this feature is disabled, there is no longer a delay issue when opening different files consecutively.

2024/01/02

python py轉exe後執行失敗

 最近在更新一個python檔案,更新完要透過pyinstaller轉成exe,會用到pandas跟openpyxl兩個套件。

轉出來後卻無法執行,錯誤訊息是說numpy有問題(Error importing numpy: you should not try to import numpy from....)

這個是在裝pandas時自動裝進來的,研究到最後就是python的版本太新(3.9.x),重新建一個虛擬環境,降到3.6就排除這個問題了。

但卻產生另一個錯誤(ImportError: Missing optional dependency 'xlrd'. Install xlrd >= 1.0.0 for Excel support Use pip or conda to install xlrd)

查到最後也是版本的問題,最快的方法就是重做一個虛擬環境,python是3.8.1,然後pip install pandas跟openpyxl,xlrd跟numpy的問題就沒了。



I have been updating a Python file recently, and after the updates, I need to convert it to an executable using pyinstaller. The script relies on two packages, pandas and openpyxl.

However, after the conversion, the executable cannot run, and the error message indicates an issue with numpy (Error importing numpy: you should not try to import numpy from....). It turns out that this issue arose because of the version of Python being too new (3.9.x) when installing pandas. I resolved this by creating a new virtual environment and downgrading to Python 3.6.

However, this led to another error (ImportError: Missing optional dependency 'xlrd'. Install xlrd >= 1.0.0 for Excel support. Use pip or conda to install xlrd). After investigation, I found that this was also a version-related problem. The quickest solution was to create a new virtual environment with Python 3.8.1 and then install pandas and openpyxl using pip. This resolved the issues with xlrd and numpy.

2023/12/26

solidworks 2015 無法點兩下檔案直接開啟 swshellfilelauncher 嘗試開啟您的檔案時發生錯誤

 solidworks 2015 安裝好之後,程式可正常開啟,開啟舊檔/新檔都正常。

但是如果在資料夾內對著檔案直接連點兩下開啟時,solidworks有啟動,但會跳出一個swshellfilelauncher 的錯誤視窗,內容是嘗試開啟您的檔案時發生錯誤


解法就是對著檔案按右鍵,選擇用"solidworks launcher"開啟檔案。
如果還是不行,一樣是對著檔案按右鍵,選擇預設程式,然後到solidworks的安裝目錄中找到swshellfilelauncher ,設定用該程式來開啟圖檔,就可以了。




After installing SolidWorks 2015, the program opens successfully, and both opening existing files and creating new files work as expected. However, if you double-click a file directly within a folder, SolidWorks launches but displays an error window titled "swshellfilelauncher," stating that an error occurred while trying to open your file.

The solution is to right-click on the file, choose "Open with SolidWorks Launcher." If this doesn't resolve the issue, right-click on the file again, select "Open with," and navigate to the SolidWorks installation directory to find swshellfilelauncher . Set it as the default program for opening image files, and the problem should be resolved.






2023/12/21

Shioaji 觸價停損

 Shioaji的官網上有提到怎麼做觸價停損: https://sinotrade.github.io/zh_TW/tutor/advanced/quote_binding/#_3

但我連callback都不懂的人,裡面寫的我實在無法理解,所以就想了另一個解法。

因為我只當沖小台,所以就一直snapshot小台目前的價格,每0.5秒一次,並不會超過流量限制。

如果價格有到我的停利或停損價,就馬上執行市價平倉單,來達到觸價停損的機制。

因為市價單必須是IOC,所以要馬上檢查庫存還有沒有單,確認是否已平倉,如果沒有,就繼續下市價平倉單,以確保我有把單平掉。

這就是個人一個簡單的觸價停損作法。

另外就是有發現一個問題,如果我平倉是掛當下限價單,用當下snapshot抓到的小台價格,幾乎不會馬上成交,我就要重新抓小台價格,把下單價格在更新重下,大概都要等個30秒才會成交,就會滑價。但改用市價單就直接成交,出場滑價的機會就會比較小,這也是用市價單的好處。


2023/12/08

廣告回復了 但流量好像變少了

自從廣告功能回來後,每日瀏覽量感覺有在下降。
不知是不是剛好也沒什麼新的文章。
要靠廣告賺錢還真是好難啊。

2023/11/29

我的blogger廣告回來了

 大概三四個月前發現google adsense一直沒收入,雖然收入本來就超少,但完全是零也蠻怪的。

後來在google adsense後台發現有找不到ads.txt的錯誤訊息。

這個也很怪,我直接在網址列去輸入,都能正常顯示ads.txt,但google adsense卻一直說找不到。

後來就是在帳戶設定裡重新驗證商家網域,google adsense就顯示ads.txt正常了。

但沒多久google adsense又說找不到ads.txt了。就一樣的方式重新驗證。

重覆發生了三四次,最後卻說我太久沒有廣告登入,要重新申請審查,所以就又重新申請審查,等了兩三個星期終於通過了。

然後又等了兩三個星期,就在今天看到有廣告了.......想要賺點小錢真的好難。

2023/11/28

無法使用IP連線共用資料夾 錯誤訊息 0x80004005

 某台win2012的電腦使用本機登入,要連到一個共用資料夾。

使用 \\電腦名稱\ 連線,會跳出帳號密碼驗證,接著輸入 網域\使用者帳號 做登入,沒問題。

但使用 \\IP\ 連線,會跳出帳號密碼驗證,接著輸入 網域\使用者帳號 做登入,會跳錯誤,代碼是 0x80004005。

查了網路上一些方法,改機碼,改gpedit安全性都沒用。

後來是會跳出帳號密碼驗證時,輸入 使用者帳號@網域,就成功了,很特別的狀況。


A Windows 2012 computer logged in locally attempts to connect to a shared folder.

When connecting to \\HostName\, a username and password prompt appears. Entering Domain\Username works without issue.

However, when connecting to \\IP\, a username and password prompt appears. Entering Domain\Username results in an error code of 0x80004005.

After trying some methods found online, such as changing registry keys and Group Policy security, the issue was not resolved.

Finally, entering Username@Domain at the username and password prompt resolved the issue.


2023/11/27

centos執行指令出現錯誤 cannot execute binary file

 在centos上安裝好不斷電系統的agent後,執行程式時,會出現 cannot execute binary file的錯誤訊息。

但這個agent在其他台linux系統安裝都沒問題。

後來查發現是系統架構不同。

先執行uname -m,查到系統是i686的。

接著執行 file 執行檔名稱,結果該檔案是x86-64,所以不相容,只好放棄。


After installing the uninterruptible power supply (UPS) system agent on CentOS, an error message "cannot execute binary file" is encountered when attempting to run the program.

It was later discovered that the issue arises from a different system architecture. When executing uname -m, it was found that the system is i686. Subsequently, running the file command on the executable revealed that the file is x86-64, indicating an incompatibility issue. As a result, the execution had to be abandoned.

2023/11/21

Edge用IE模式開網頁出現錯誤訊息 "Internet Explorer 已修改這網頁以協助防止跨網站指令碼攻擊"

 



在透過Edge的IE模式開啟某個內部網頁時,無法正常顯示內容,下方出現"Internet Explorer 已修改這網頁以協助防止跨網站指令碼攻擊"的錯誤訊息。
這時就到控制台裡的網際網路選項,在安全性裡面,找到這個網頁所屬的區域,開啟自訂層級,在裡面找到啟用xss篩選器,把它停用就行了。



When opening an internal web page in IE mode of Edge, the content cannot be displayed normally. The error message "Internet Explorer has modified this page to help prevent cross-site scripting attacks" appears below.

At this time, go to the Internet Options in Control Panel, find the area to which this page belongs in Security, open the Custom Level, find Enable XSS Filter, and disable it.