2026年7月2日 星期四

2048 - Created by Claude

2048

 用AI(Claude - sonnet4.6)寫個小遊戲,雖然很快但是Debug起來有點費力!

 

🏆 今日最高 -- / 0 分
分數
0
最高方塊
0

遊戲結束

🎉 恭喜破今日紀錄!請輸入名字
方向鍵操作 / 手機請在棋盤上滑動

遊戲玩法

  • 方塊往你選擇的方向移動,數字相同的相鄰方塊會合併成兩倍。
  • 每次移動後,棋盤隨機出現一個新的 2 或 4。
  • 合併出 2048 即達成目標,仍可繼續刷新分數。
  • 棋盤填滿且無法再移動時,遊戲結束。
  • 每日午夜自動重置今日最高分紀錄。

操作方式

  • 電腦:鍵盤 ↑ ↓ ← → 方向鍵。
  • 手機:在棋盤上上下左右滑動。

2022年9月29日 星期四

Meta quest2 APP 一直顯示未安裝

可能是用到沒電造成,重新充飽電後可以開機但桌球APP卻一直停在未安裝狀態,連續點選安裝幾次都沒有成功,對於不熟悉的裝置一時之間還真無助。最後真沒辦法想到曾經重新啟用quest2成功拿到被推薦獎金,這次再重置quest2看看沒想到問題竟然解決了。所幸只有安裝3-4個APP,重新安裝完連紀錄都在。



2022年3月15日 星期二

HTC 不斷重新開機 - Google Play 服務的死亡之吻

前幾天舊手機HTC One X9突然一直不斷重新開機,本來以為電池是該掛了,上網查到低階重置的方法,重置了手機,死馬當活馬醫竟然可以開機了。

確定不是硬體或是電池的問題後,花了一些時間重新登入帳號安裝完該裝的軟體,還來不及高興又開始不斷重新開機⋯

再來一次低階重置問題仍然存在,不過一切問題的發生好像是在上網之後,經過一些嘗試發現在不斷重開機的秒差之間,點選飛航模式就可以阻止重開機。

在飛航模式下終於發現原兇是Google Play 服務,對就是你,在沒有經過我同意的情形下把我從快樂如天堂的版本12.6.85改成死機的地獄版本22.02.21!(有圖有真相)


在改回12.6.85後我的HTC只能活在飛航模式下,才能躲過你Google Play 服務的死亡之吻。





2022年2月11日 星期五

從零開始 - Reset to Android

 Android App 多如過江之鯽, 而自己真正用得到的卻是屈指可數, 但是就缺那麼一個. 為了能使用現役手機能完成這個簡單需求, 費了九牛二虎之力, 從零開始, 蹣跚學步, 終於在過完農曆年後得以啼聲初試: 

管傢伙 - FindMyGoods


2019年11月11日 星期一

Macbook air 2013中 128G 換 Kingston A2000 1T 眉角

1.macOS High Sierra–10.13(含)或以後版本: macOS Mojave–10.14, macOS Catalina–10.15才有支援nvme SSD驅動程式.
2.必須用原廠內建SSD升級macOS,如用外接USB升級會有:missing a firmware partition 問題.
3.內建SSD升級完OS就可以安裝到外接USB以便換掉內建SSD後開機用.
4.用USB開機(新版OS才可找到nvme SSD)安裝OS到nvme SSD.
(如果不裝雙系統, 到此可以收工)
5.用bootcamp 安裝windows10如遇 “ 電腦意外地重新啟動貨發生意外的錯誤。Windows 無法進行安裝。......”
出現錯誤畫面時,按 SHIFT+F10 然後黑框內(DOS)輸入regedit 開啟登錄檔下面路徑
HKLocal machine/SYSTEM/SETUP/STATUS/ChildCompletion 修改 “setup.exe”將1 改成 3.
6.安裝好windows10插著電源,開機後到USB的bootcamp目錄下執行SETUP安裝MACBook的windows驅動.
7.拔電源前須到windows控制台->電源選項->建立電源計劃選"高效能".

配備:
1. Macbook air 2013中 128G
2. Kingston A2000 1T
3. SSD 轉接卡 M.2 NGFF轉MAC 2014/15 Mac AIR A1465/1466 NVME
4. 五星起子1.2mm可以拆電腦背蓋
5. 六星起子T5轉開 SSD 的螺絲

參考資料:
1. https://macuknow.com/2019/09/02/2919/macbook-pro-ssd-nvme/
2. https://www.itread01.com/p/884233.html
3. 控制台->電源選項->建立電源計劃
4. https://forums.macrumors.com/threads/upgrading-2013-2014-macbook-pro-ssd-to-m-2-nvme.2034976/

2017年1月16日 星期一

Paradox DB connection string sample

        Dim ConnectionString As String = ""
        ConnectionString = "Driver={Microsoft Paradox Driver (*.db )};DriverID=538;Fil=Paradox 5.X;DefaultDir=C:\MY_DB;Dbq=C:\MY_DB;CollatingSequence=ASCII;"
        Dim ParadoxConn As New System.Data.Odbc.OdbcConnection(ConnectionString)
        ParadoxConn.Open()

        Dim da As New System.Data.Odbc.OdbcDataAdapter("Select * from my_table", ParadoxConn)
        Dim ds As New DataSet
        da.Fill(ds, "ParadoxTable")
        ParadoxConn.Close()

        DataGridView1.DataSource = ds.Tables(0)

2015年5月6日 星期三

Turn auto-sync on or off for your Nexus phone

On devices running Android 5.0 and up
On your mobile device, open Settings .
Under "Personal," touch Accounts.
In the top-right corner, touch menu Menu.
Check or uncheck Auto-sync data.

On devices running Android 4.4. and below
On your mobile device, open Settings .
Under "Wireless & networks," touch Data usage.
In the top-right corner, touch menu Menu.
Check or uncheck Auto-sync data. 

資料來源:
https://support.google.com/nexus/answer/2840875?hl=en

2014年10月15日 星期三

jQuery Autocomplete - ASP.NET ashx datasource

 

1. autocomplete.aspx

2. handler1.ashx

Sample Code:

1. autocomplete.aspx:

<html lang="en">
<head>
  <meta charset="utf-8">
  <title>jQuery UI Autocomplete - ASP.NET ASHX datasource</title>
  <link rel="stylesheet" href="//code.jquery.com/ui/1.11.1/themes/smoothness/jquery-ui.css">
  <script src="//code.jquery.com/jquery-1.10.2.js"></script>
  <script src="//code.jquery.com/ui/1.11.1/jquery-ui.js"></script>
  <style type="text/css">
    body {
       font-family: "Trebuchet MS", "Helvetica", "Arial",  "Verdana", "sans-serif";
       font-size: 62.5%;
    }
    .ui-autocomplete-loading {
       background: white url("images/ui-anim_basic_16x16.gif") right center no-repeat;
    }
  </style>
  <script type ="text/javascript" >
        $(function () {
            $("#txtInput").autocomplete({
                source: "handler1.ashx",
                minLength: 1,
                select: function (event, ui) {
                    alert(ui.item.value);
                },
                change: function(event, ui) { 
                    alert("changed!");
                }
            });
        });
  </script>
</head>
<body>

<div class="ui-widget">
  <label for="Sample">Your list: </label>
  <input id="txtInput">
</div>

‘-----------------------------------------------------

2. handler1.ashx:

Public Class Handler1
    Implements System.Web.IHttpHandler

    Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest

    'context.Response.ContentType = "text/plain"
    'context.Response.Write("Hello World!")
    'query string
    Dim prefixText As String = context.Request.QueryString("term")

    'suggestion list
    Dim v_ret As String = "[]"

    'TODO: SQL data searching...

    'Sample list:
    v_ret = "[{""id"":""A"",""label"":""AAA"",""value"":""AA""},
          {""id"":""B"",""label"":""BBB"",""value"":""BB""}]"

    context.Response.ContentType = "text/plain"
    context.Response.Write(v_ret)

    End Sub

    ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable
        Get
            Return False
        End Get
    End Property

End Class

‘---------------------------------------------------------

Ref: www.jqueryui.com

2014年5月1日 星期四

MySQL ASP.NET 中文亂碼

用notepad++(MS notepad 會自動轉碼)開啟
C:\ProgramData\MySQLMySQL Server 5.7\my.ini 

找到 [client] 區塊

加入

default-character-set=utf8

找到 [mysqld] 區塊

加入

character-set-server=utf8

collation-server=utf8_general_ci 

原來除了MySQL本身資料編碼設定外

在ASP.NET中ODBC版本也有絕對的影響:

MySQL ODBC 3.51 Driver 只能顯示big5繁體中文
MySQL ODBC 5.1 Driver 能同時顯示utf8簡體繁體中文

web.config中連結字串差別:

<add name="MySQLConnStr" connectionString="DRIVER={MySQL ODBC 5.1 Driver};Database=[strDatabaseName];Server=[strServerName];UID=[strUserName];PWD=[strPassword];charset=utf8"/>

dotNetFramework1.1:

<add key="MySQLConnStr" value="DRIVER={MySQL ODBC 3.51 Driver};Database=[strDatabaseName];Server=[strServerName];UID=[strUserName];PWD=[strPassword];OPTION=3;CharSet=big5;"/>


2013年11月14日 星期四

MTP USB 無法辨識

 

很久沒有用PC(Win7, 64bit)連接手機Nexus 4,

記得之前一接上去充電, 手機有時會一直被喚醒,

但至少我的電腦內有顯示Nexus 4而且可讀取內容檔案.

如今卻只在右下方顯示MTP USB裝置   X失敗,

而裝置管理員也出現MTP USB (黃色三角型),

用了很多方法, 最後只有改註冊表這招有效:

unplug phone
open up the registry editor
regedit
navigate to
HKEY_LOCAL_MACHINE > SYSTEM > CurrentControlSet > Control > Class > {EEC5AD98-8080-425F-922A-DABF3DE3F69A}
if you see a string called Upperfilters
right click on {EEC5AD98-8080-425F-922A-DABF3DE3F69A} on the left side and export if (so you have a backup)
delete the Upperfilters string
plug phone back in

重新掃描硬體變更. 解決!

2013年5月8日 星期三

CD to MP3

CD 要轉存到電腦媒體檔案可以用 Windows Media Play 轉換:
1. 執行Windows Media Play在中間按右鍵選擇: 其他選項
001
2. 開啟選項視窗後可以選擇擷取到那裡, 格式及音訊品質.


3. 回到現在播放視窗點選右上角的: 切換到媒體櫃:


4. 放入CD, 點選左方CD片名, 勾選要擷取的標題再按[擷取CD]即可.

2012年11月15日 星期四

列印QR Code貼紙

Imports ThoughtWorks.QRCode.Codec
Imports ThoughtWorks.QRCode.Codec.Data
Imports ThoughtWorks.QRCode.Codec.Util

......

    Private Sub print_qr()
        Dim reportDoc As New ReportDocument

        Dim rpt_ds As DataSet = GetDS("")
        If rpt_ds.Tables(0) Is Nothing Then
            lblDBErrorMessage.Text = "No Data!"
            Exit Sub
        End If
        If rpt_ds.Tables(0).Rows.Count <= 0 Then
            lblDBErrorMessage.Text = "No Data!"
            Exit Sub
        End If

        reportDoc.Load(Server.MapPath("./rpt/QRC_print.rpt"))
        reportDoc.SetDataSource(rpt_ds)

'印到PDF -------------

        Dim objFile As New DiskFileDestinationOptions
        reportDoc.ExportOptions.DestinationOptions = objFile
        objFile.DiskFileName = Server.MapPath("./printemp/QRC_print.pdf")
        With reportDoc.ExportOptions
            .ExportDestinationType = ExportDestinationType.DiskFile
            .ExportFormatType = ExportFormatType.PortableDocFormat
            .DestinationOptions = objFile
        End With
        reportDoc.Export()
        Dim xlsurl As String = "./printemp/QRC_print.pdf"
        Response.Redirect(xlsurl)
        Exit Sub

'OR 直接列印 ---------------      
            Try
                reportDoc.PrintOptions.PrinterName = strpath
                reportDoc.PrintToPrinter(1, True, 0, 0)
                'Response.Redirect(strRturnTo)
            Catch
                lblDBErrorMessage.Text = "找不到指定的印表機!"
            End Try
    End Sub

    Function GetDS(ByVal vd_no) As DataSet
        Dim strSQL As String
        Dim ds As DS_QRC = New DS_QRC
......
            Dim data As String = "Your TEXT here"
            Dim v_copy As Integer = 1     ' 列印份數
            Dim qrCodeEncoder As QRCodeEncoder = New QRCodeEncoder
            qrCodeEncoder.QRCodeEncodeMode = qrCodeEncoder.ENCODE_MODE.ALPHA_NUMERIC
            qrCodeEncoder.QRCodeScale = 6
            qrCodeEncoder.QRCodeVersion = 2
            qrCodeEncoder.QRCodeErrorCorrect = qrCodeEncoder.ERROR_CORRECTION.L
            Dim image As Image
            image = qrCodeEncoder.Encode(data)
            Dim ms As MemoryStream = New MemoryStream
            image.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg)

            Dim ImageSize As Integer = ms.Length
            Dim ImageContent() As Byte = ms.GetBuffer
            ms.Close()
            image.Dispose()
            Dim j As Integer
            For j = 1 To v_copy
                MyNewRow = ds.Tables("T_QRCode").NewRow
                MyNewRow("QR_pno") = v_sname
                MyNewRow("QR_sno1") = v_ss
                MyNewRow("QR_sno2") = v_ee
                MyNewRow("QR_img") = ImageContent
                MyNewRow("QR_supname") = v_supname
                MyNewRow("QR_mno") = v_mno
                If ii = v_boxs Then
                    MyNewRow("QR_qty") = v_pqtyp
                Else
                    MyNewRow("QR_qty") = v_pqty
                End If
                ds.Tables("T_QRCode").Rows.Add(MyNewRow)
            Next
......
        Return ds
    End Function

qr1

qr2

註:

ThoughtWorks.QRCode.dll - ThoughtWorks QRCode .NET Library is download available from CodeProject.com.

2012年2月12日 星期日

N95安裝 Slide Helper

1. 下載Slide Helper for N95 軟體:

http://s60soft.ru/eng/slide-helper.html

2. 在手機鍵盤上輸入*#06#,IMEI號碼就會顯示在手機螢幕.

3. 到NOKIA Developer 網站註冊一個帳號.

https://www.symbiansigned.com/signedui/welcome

並在下面畫面加入手機IMEI碼:

symbian001

在右方上傳sis檔案後即可下載PrivateKey_And_Certificate二個檔案.

4. 到下面網站下載 SignSIS-GUI_v1.1.exe執行檔

http://www.gosymbian.com/SSIS_download.html

並如該網站所示執行並選取cer,key及sis檔, 並按SignSiS!鈕.

5. 將Output產生的sis檔copy到手機或用Nokia電腦端套件安裝.

2011年10月4日 星期二

VS2008 ftp file DOWNLOAD and DELETE

Private Function GetOnlyDirectories(ByVal v_server As String, ByVal v_user As String, ByVal v_pw As String) As String
    Dim TheShortList As String = FTPListDirectory(v_server, v_user, v_pw, True)
    Dim theDirectories As String = ""
    If TheShortList <> "" Then
        Dim TheLists() As String = Split(TheShortList.Trim, vbCrLf)
        For Each thelist As String In TheLists
            If thelist.Trim.ToLower.EndsWith(".xml") Then
                Dim v_ffile As String = v_server + thelist.Trim.ToLower
                Dim v_tfile As String = "../temp.xml"
                If ftpDownload(v_ffile, v_tfile, v_user, v_pw) Then
                    ftpDelete(v_ffile, v_user, v_pw)
                End If
            End If
            theDirectories &= vbCrLf & thelist.Trim
            theDirectories = theDirectories.Trim
        Next
    End If
    Return theDirectories
End Function

Public Shared Function ftpDownload(ByVal source As String, ByVal target As String, ByVal v_fuser As String, ByVal v_fpw As String) As Boolean
    Dim v_ret As Boolean = True
    Dim credential As New NetworkCredential(v_fuser, v_fpw)

    Dim clsrequest As FtpWebRequest = _
  DirectCast(WebRequest.Create(source), FtpWebRequest)
    clsrequest.Method = WebRequestMethods.Ftp.DownloadFile
    clsrequest.Credentials = credential

    Dim response As FtpWebResponse = _
          DirectCast(clsrequest.GetResponse, FtpWebResponse)
    Dim stream As Stream = response.GetResponseStream

    Dim reader As New StreamReader(stream)
    Dim v_cont As String = reader.ReadToEnd()

    If (File.Exists(target)) Then
        File.Delete(target)
    End If

    Dim FS As FileStream = New FileStream(target, FileMode.CreateNew, FileAccess.Write)
    Dim SW As StreamWriter = New StreamWriter(FS, Encoding.GetEncoding("utf-8"))
    SW.WriteLine(v_cont)

    SW.Flush()
    FS.Close()
    reader.Close()
    response.Close()

 

    'Read to dataset

Dim ds As DataSet = New DataSet
    Dim FSr As FileStream
    FSr = New FileStream(target, FileMode.Open)
    Dim XmlRead As New XmlTextReader(FSr)
    ds.ReadXml(XmlRead)
    FSr.Close()
    XmlRead.Close()

    'do process of dataset ……

    ds.Dispose()
    Return v_ret
End Function

   Function FTPListDirectory(ByVal Target As String, ByVal UID As String, _
ByVal Pass As String, Optional ByVal Shortlist As Boolean = False) As String
       Try
           Dim clsRequest As System.Net.FtpWebRequest = DirectCast(System.Net.WebRequest.Create(Target),  _
           System.Net.FtpWebRequest)
           clsRequest.Credentials = New System.Net.NetworkCredential(UID, Pass)
           If Shortlist Then
               clsRequest.Method = System.Net.WebRequestMethods.Ftp.ListDirectory
           Else
               clsRequest.Method = System.Net.WebRequestMethods.Ftp.ListDirectoryDetails
           End If
           Dim str As String = GetStringResponse(clsRequest)
           clsRequest.Abort()
           Return str
       Catch ex As Exception
           Throw New Exception("Connection Problem – Error:" & vbCrLf & vbCrLf & ex.Message)
           Return ""
       End Try
   End Function

   Private Function GetStringResponse(ByVal ftp As FtpWebRequest) As String
       Dim result As String = ""
       Using response As FtpWebResponse = CType(ftp.GetResponse, FtpWebResponse)
           Dim size As Long = response.ContentLength
           Using datastream As Stream = response.GetResponseStream
               Using sr As New StreamReader(datastream)
                   result = sr.ReadToEnd()
                   sr.Close()
               End Using
               datastream.Close()
           End Using
           response.Close()
       End Using
       Return result
   End Function

Public Shared Function ftpDelete(ByVal source As String, ByVal v_fuser As String, ByVal v_fpw As String) As Boolean
    Dim v_ret As Boolean = True
    Dim credential As New NetworkCredential(v_fuser, v_fpw)

    Dim clsrequest As FtpWebRequest = _
  DirectCast(WebRequest.Create(source), FtpWebRequest)
    clsrequest.Method = WebRequestMethods.Ftp.DeleteFile
    clsrequest.Credentials = credential

    Dim response As FtpWebResponse = _
          DirectCast(clsrequest.GetResponse, FtpWebResponse)
    Dim v_mmm As String = response.StatusDescription

    response.Close()
    Return v_ret
End Function

2011年7月4日 星期一

Adobe Reader PDF檔出現空白

自從換Windows7 64bit 每次執行Crystal Report

轉PDF檔 總是出現一個空白訊息視窗Adobe Reader

裡面只顯示一個?圖示其他都空白一片, Adobe Reader 9

重新安裝, IE8 更新成 IE9結果都一樣, Google了很久發現

可能是字元集不全的問題,到Adobe的官方網站下載

字元集包
http://www.adobe.com/support/products/enterprise/knowledgecenter/c4230.pdf

執行AsianFontPackYes.reg安裝後到目前為止都可以

正常開啟PDF檔了.

曼陀羅(情花)

20110622888

20110608880

20110622890

紅色殺手-3

20110622885

20110623895

2011年6月22日 星期三

Javascript 數值千分位顯示

function FormatNumber(n) {
    n += "";
    var arr = n.split(".");
    var re = /(\d{1,3})(?=(\d{3})+$)/g;
    return arr[0].replace(re,"$1,") + (arr.length == 2 ? "."+arr[1] : "");
}

//取消千分位:

nn = parseInt(v_p.replace(",",""),10);

//test   
document.write("1234567 -> " + FormatNumber(1234567) + "<br>");
document.write("12345678.12 -> " + FormatNumber("12345678.12") + "<br>");
document.write("123456789.1234 -> " + FormatNumber(123456789.1234) + "<br>");
document.write("-123456.123 ->" + FormatNumber(-123456.123) + "<br>");

引用來源

File MD5 Checksum

    Public Shared Function file_checksum(ByVal file_path As String) As String
        Dim md5 As MD5CryptoServiceProvider = New MD5CryptoServiceProvider
        Dim fs As FileStream = New FileStream(file_path, FileMode.Open, FileAccess.Read, FileShare.Read)
        md5.ComputeHash(fs)

        Dim hash As Byte() = md5.Hash
        Dim buff As StringBuilder = New StringBuilder
        Dim hashByte As Byte
        For Each hashByte In hash
            buff.Append(String.Format("{0:X2}", hashByte))
        Next
        fs.Close()
        Return buff.ToString.Trim
    End Function