2022年4月18日 星期一

"Unexpected beginning of statement mysql" when coping excel content to phpmyadmin

 There are quite many reference in Google that "Unexpected beginning of statement mysql" is casued by various careless mistake.


However, I experienced a situation that when I export a CSV from phpmyadmin, and do some equation in excel, when I try to paste the SQL statement into phpmyadmin, it shows "Unexpected beginning of statement mysql" .

 ERROR existed in my SQL statement over 70 times, and there's no careless mistake in my statement.

When I retype the SQL statement , it success, means that there's no error in my SQL statment.


The problem is because the "SPACE" character in the excel, after retype all " " (space) in my equation, the SQL statement success to run in phpmyadmin.

 

 

Eliminating Double Quotes When Copying Multiline Cells in Excel



Have you ever encountered an issue where Excel adds double quotes when copying a cell containing multiple lines of text? For example, when you copy the following cell content:

Hi,
I am a boy

Excel pastes it as:

"Hi,
I am a boy"

This can be frustrating, especially if you want to retain the original formatting without the added double quotes. In this blog post, we will guide you on how to use Visual Basic for Applications (VBA) to eliminate these unwanted double quotes when copying cells in Excel.

## Using VBA to Remove Double Quotes


To solve this problem, we will create a VBA macro that removes double quotes after copying a cell. Follow these simple steps:

1. Open Excel and press `Alt + F11` to open the Visual Basic for Applications (VBA) editor.

2. In the VBA editor, click on `Insert` in the toolbar and select `Module` from the dropdown menu. This will create a new module in your Excel workbook.

3. Copy and paste the following VBA code into the newly created module:

```vba
Sub CopyWithoutQuotes()
    Dim OriginalClipboard As DataObject
    Dim ModifiedClipboard As DataObject
    Dim OriginalText As String
    
    Set OriginalClipboard = New DataObject
    Set ModifiedClipboard = New DataObject
    
    ' Save the original clipboard content.
    OriginalClipboard.GetFromClipboard
    
    ' Get the copied text from the clipboard.
    OriginalText = OriginalClipboard.GetText
    
    ' Remove double quotes from the text.
    OriginalText = Replace(OriginalText, Chr(34), "")
    
    ' Set the modified text to the clipboard.
    ModifiedClipboard.SetText OriginalText
    ModifiedClipboard.PutInClipboard
End Sub

```

4. Close the VBA editor and return to your Excel workbook.

5. To run the macro, press `Alt + F8` to open the "Macro" dialog. Select `CopyWithoutQuotes` from the list and click "Run."

Now, whenever you copy a cell with multiple lines of text, run this macro before pasting the content. The pasted text will no longer include double quotes.

## Conclusion


By using this VBA macro, you can easily remove any unwanted double quotes that Excel may add when copying cells containing multiline text. This method ensures that your copied content remains true to its original format.

Keep in mind that this macro is a workaround and may require you to run it every time you copy multiline cells. However, it provides a convenient solution to a common Excel issue.

**References:**


- [How to avoid extra double quotes in Excel](https://www.peelonion.com/2017/03/how-to-avoid-extra-double-quotes-excel.html)
- [Why is Excel adding quotes when I copy a cell with multiple lines?](https://answers.microsoft.com/en-us/msoffice/forum/all/why-is-excel-adding-quotes-when-i-copy-a-cell-with/28e23792-4b66-4d6b-94f9-4720c238659a)


2022年4月11日 星期一

Install TA-Lib in Windows 11

1. Install Visual Studio and Install VS2015 x64 C++

 

2. Download   ta-lib-0.4.0-msvc.zip from

https://sourceforge.net/projects/ta-lib/

 

3. Unzip into C:\

 

4. Run VS2015 x64 Native Tool

cd C:\ta-lib\c\make\cdr\win32\msvc

nmake

 

5. Go Back PowerShell

pip install ta-lib

 


2022年4月7日 星期四

[三分鐘教學] Mac 掛載 SFTP 成檔案系統

 自己建立伺服器進行各項服務,並SSH連線以控制及傳輸檔案(SFTP),本篇介紹如何透過Mac 連接 SFTP 並掛載成檔案系統一部份。


步驟:

1.下載及安裝 MacFuse

 

 
 
 
 
出現 System Extension Blocked 解決方法:
1.1 「Open Security Preferences」 
 
 
1.2. 按鎖圖示解鎖

1.3 輸入密碼按 Unlock

 
 1.4 按 Allow
 
2. 下載及安裝 sshfs

 
 
 
 
 
Agree
 
 
 
3. Open Terminal
sshfs -p PORT USERNAME@HOSTNAME:/REMOTEPATH /LOCALPATH -ovolname=sftp
 (Example: sshfs -p 555 user@myhost.local:/mnt/d ~/d -ovolname=sftp)
 
Spotlight -> Terminal
Spotlight 
 



 
 

 
 
 
 
 
 

我的白蝕治療之路:從發現到自我管理

  大家好,想和大家分享我與白蝕, 白癜風(vitiligo)抗爭的經歷, 這抗爭於今天開始, 立此Blog 以作紀錄。   2024-08-14 這個故事開始於三年前, 三年前,也就是新冠肺炎初期,當時我剛買了新車,在駕駛過程中突然發現了手上皮膚的異常。我注意到了皮膚的出現了...