Tiobe 發佈了 2022年五月份程式語言排行榜,值得一題的是delphi依舊在20名內。
另一個是c#已跑到五名內,也就是接下來往前三名了

行動開發.APP開發教學.PHP Laravel開發..net core C# 開發.架構師之路.Delphi開發.資料庫程式.進銷存.餐飲POS系統
過年期間新竹的地震頻繁,因為有裝地牛Wake Up!這個電腦版的程式,所以可以第一時間預測得知地震的訊息以及地震震央、地震深度、地震震度等資料。
在它的設定裡面發現可以使用程式做連動,於是結合上次曾經Delphi拿Line Notify來當通知程式。
然後就可以收到像以下的地震即時訊息透過line了。
最近安裝完Delphi 11後,一開啟IDE就跳出一個 Socket Error #10038. Socket operation on non-socket的錯誤,接著就無法開啟IDE惹。
感謝捷康的eddie幫忙,處理掉問題,處理的方式是到 regedit 登錄檔編輯器中。依序進入 HKEY_CURRENT_USER \ SOFTWARE \ Embarcadero \ BDS \ 22.0 \ Known IDE Packages ,然後在列表裡找到一個 $ (BDS) \ Bin \ LivePreview280.bpl 接著點二下進入編輯,在名字前面加上二個底線”__” 變成 “__Embarcadero FireUI Live Preview Package”就可以了!終於可以順利操作Delphi 11了 🙂
相關連結:
Delphi 10.4.1 Socket Error on IDE Start
https://en.delphipraxis.net/topic/4535-delphi-1041-socket-error-on-ide-start/
2000年從商業經營科系轉至勤益的資訊管理科二專部後,就開始接觸Delphi5這門程式語言,記得當初使用QB/VB都覺得不到位,遇到Delphi後覺得這開發工具真的很強大,於是努力學習精進。
這門語言,也讓我得到了在國泰電腦的第一份軟體業工讀生工作後,甚至讓我進入海軍陸戰隊服役時,因為對資料庫程式的特別專長,也參與了兵棋、陸戰隊進銷存等專案開發。退伍後,也陸續進入公司開發過中醫醫療軟體、檢驗儀器系統連線、會計、人事薪資、票據、餐飲POS等系統,客戶也從中醫診所、檢驗室、檢驗所到流通業、百貨業甚至超市業。
毫無疑問的,Delphi是近25年來我覺得唯一也是擁有絕對地位的Windows資料庫應用程式開發工具王者,從幹掉VB、Powerbuilder的工具來看,近幾年也著重在APP的開發上,但也許因為有不少開源的開發語言(如:Cordova、Xamarin、NativeScript、React Native、Electron、Flutter) 導致優勢不再。連近期公司的走向也是主要以雲端開發為主了!
雖然還不致於正式跟它Say Goodbye~不過使用它的頻率真的減少許多就是
進到網站 https://notify-bot.line.me/zh_TW/ ,右上角有一個登入,登入後選個人頁面
往下拉可以看到一個發行存取權杖(TOKEN),按發行權杖功能。按照步驟就可以取得權杖
複製權杖下來備用。
接下來在安裝ipwork的Delphi上,加入ipwhhtp的元件後,呼叫LINE NOTIFY的程式如下:
2021.06.12 更新 Delphi 版本 ipwork試用連結(官網)
https://www.nsoftware.com/download/download.aspx?sku=IPDF-A&type=demo
七行程式就可以了!
ipwhttp1.Config(‘CodePage=65001’);
ipwhttp1.Timeout := 10;
ipwhttp1.ResetHeaders;
ipwhttp1.OtherHeaders := ‘Authorization: Bearer +’這裡改成剛才的權杖';
ipwhttp1.ContentType := ‘application/x-www-form-urlencoded;’;
ipwhttp1.PostData:= ‘message=’+’這裡改成你要通知的內容';
ipwhttp1.Post(‘https://notify-api.line.me/api/notify’);
2018年12月6日,微軟宣布Microsoft Edge未來將基於Chromium開發後,微軟在新的作業系統中已逐步移除存在已久的IE瀏覽器,取而代之預設為Edge瀏覽器。
10.4也新增了以Edge瀏覽器為主的webbrowser元件來處理,並取代了早先的TWebBrowser。不過,TWebBrowser仍然保留在VCL元件中,但新增了SelectedEngine可以選取Edge的WebView2瀏覽器。
而新增的Edge使用方式也與先前相同
EdgeBrowser1.Navigate('http://superlevin.ifengyuan.tw/');
Delphi內建的mediaplayer似乎無法播放MP4的影片!只好透過系統內的mediaplayer來實作了~
一、Component→Import Component然後選擇ActiveX Control
二、搜尋media,找到Windows Meida Player
三、原則上就是下一步安裝完成就好
接下來程式的部份
在畫面上放上WindowsMediaPlayer1、Button、Timer、OpenDialog、ProgressBar1。
程式碼如下:
一、
procedure TForm1.FormCreate(Sender: TObject);
begin
WindowsMediaplayer1.uiMode := ‘none’; //不顯示按鈕
end;
二、
procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
WindowsMediaPlayer1.controls.stop;
end;
三、
procedure TForm1.Button1Click(Sender: TObject);
begin
if opendialog1.Execute then begin
WindowsMediaPlayer1.URL := ‘file://’+opendialog1.FileName;
WindowsMediaplayer1.uiMode := ‘none’;
WindowsMediaPlayer1.controls.play;
end;
end;
四、
procedure TForm1.WindowsMediaPlayer1PlayStateChange(ASender: TObject;
NewState: Integer);
begin
case NewState of
wmppsPlaying: begin
Timer1.Enabled := True;
end;
wmppsStopped,
wmppsPaused: begin
Timer1.Enabled := False;
end;
end;
end;
五、
procedure TForm1.Timer1Timer(Sender: TObject);
var
Duration: double;
Position: double;
begin
Form1.Caption := WindowsMediaPlayer1.controls.currentPositionString
+ ‘ of ‘
+ WindowsMediaPlayer1.currentMedia.durationString;
Duration := WindowsMediaPlayer1.currentMedia.duration;
Position := WindowsMediaPlayer1.controls.currentPosition;
ProgressBar1.Position := Trunc( Position*(Duration/ProgressBar1.Max) );
end;
一、Firebase新增專案(網址: https://console.firebase.google.com )
二、專案名稱可自訂,訂定後按建立專案
三、建立完專案後,點選中間android的連結
四、這邊很重要! Android的套件名稱要跟你要開發的名稱一致,這邊我輸入 com.linshoushan.FirebaseCloudMessaging,按註冊應用程式
五、設定完後,進入Cloud Messagin頁面中,把寄件者ID記下來。就完成了Firebase基本的設定了
六、開啟Delphi 10.3 RIO,建立一個新的Multi-Device Application
七、在畫面上拖拉出Layout、Button、Memo
八、將Target Platforms切換成Android
九、專案的Options中,在 Entitlement List中,把Receive push notifications 設為true
十、Version Info中,package的名稱記得改成在firebase中的設定
十一、修改AndroidManifest.template.xml,最後一行加上
(一開始會找不到這個檔案,壽山是先把專案存檔後,先做一次的build,然後檔案就出現了)
十二、加上相關程式碼
unit Unit1; interface // 1 新增use // System.Notification, System.PushNotification, FMX.PushNotification.Android uses System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants, FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.StdCtrls, FMX.Controls.Presentation, FMX.ScrollBox, FMX.Memo, FMX.Layouts, System.Notification, System.PushNotification, FMX.PushNotification.Android; type TForm1 = class(TForm) Layout1: TLayout; Memo1: TMemo; Button1: TButton; procedure FormCreate(Sender: TObject); procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } // 2 宣告相關的變數以及事件 PushService: TPushService; ServiceConnection: TPushServiceConnection; DeviceId: string; DeviceToken: string; procedure DoServiceConnectionChange(Sender: TObject; PushChanges: TPushService.TChanges); procedure DoReceiveNotificationEvent(Sender: TObject; const ServiceNotification: TPushServiceNotification); end; var Form1: TForm1; implementation {$R *.fmx} procedure TForm1.Button1Click(Sender: TObject); begin // 按下按鈕時打開 ServiceConnection ServiceConnection.Active := True; end; procedure TForm1.DoReceiveNotificationEvent(Sender: TObject; const ServiceNotification: TPushServiceNotification); var MessageText: string; NotificationCenter: TNotificationCenter; Notification: TNotification; begin // 取得通知的內容 // 全部內容可以透過 ServiceNotification.DataObject.ToString看到 MessageText := ServiceNotification.DataObject.GetValue('gcm.notification.body').Value; NotificationCenter := TNotificationCenter.Create(nil); try Notification := NotificationCenter.CreateNotification; try Notification.Name := MessageText; Notification.AlertBody := MessageText; Notification.Title := MessageText; Notification.EnableSound := False; NotificationCenter.PresentNotification(Notification); finally Notification.DisposeOf; end; finally NotificationCenter.DisposeOf; end; end; procedure TForm1.DoServiceConnectionChange(Sender: TObject; PushChanges: TPushService.TChanges); begin // 取得裝置的ID跟TOKEN if TPushService.TChange.DeviceToken in PushChanges then begin DeviceId := PushService.DeviceIDValue[TPushService.TDeviceIDNames.DeviceId]; DeviceToken := PushService.DeviceTokenValue[TPushService.TDeviceTokenNames.DeviceToken]; Memo1.Lines.Add('設備ID = ' + DeviceId); Memo1.Lines.Add('設備TOKEN = ' + DeviceToken); end; end; procedure TForm1.FormCreate(Sender: TObject); begin // 注意要把GCMAppID改成自己的 PushService := TPushServiceManager.Instance.GetServiceByName(TPushService.TServiceNames.GCM); PushService.AppProps[TPushService.TAppPropNames.GCMAppID] := '220657168616'; ServiceConnection := TPushServiceConnection.Create(PushService); ServiceConnection.OnChange := DoServiceConnectionChange; ServiceConnection.OnReceiveNotification := DoReceiveNotificationEvent; end; end.
十四、記下TOKEN,回到Firebase中,選擇左邊功能列的Cloud Messageing,然後新增一筆測試訊息,將TOKEN值加入後按測試,就會收到推播訊息了。
RAD Studio 10.3 代號Rio,能開發在Windows、macOS、iOS、Android和Linux Server的應用程式。
在C++的部份,加上了C++ 17 Win32支持;Delphi 的話則加上了inline variable declaration, type inference。