LiveCode for Web3 Development

I have been using LiveCode to develop numerous desktop and mobile APPs over the years. LiveCode has never failed me and always gets the job done with less time and effort.

In 2022, I started Web3, blockchain, crypto currency, and NFT related development work. On top of many new things to learn, I am using LiveCode in a different way to develop over a dozen Web3 services delivered via web pages. This is a big challenge for me since I am not using “LiveCode Web” deployment (which may change when LiveCode 10 is released). I am only using LiveCode for the backend server side and use CSS/Javascript for the frontend client side. Still, I find LiveCode can help me get the job done as before.

Web3 services are built with blockchain, crypto currency, and NFT

Below are what I’ve learned from this new development experience:

  1. Using LiveCode to interface with any 3rd party APIs including blockchain, crypto currency, and NFT APIs is a breeze no matter if they are GET, POST, or PUT. The only drawback I found is I can’t find the sample code for LiveCode to use the APIs from these 3rd party sites. Sample code is needed for programming languages that are difficult to learn and use. It is not a problem for LiveCode since it can get the job done more straightforward with less code (normally 1 to 10 lines of code) than other languages so there is really no need for sample code.
    📍Example Code: 5 lines of code to get Bitcoin to USD exchange data
       set the HTTPHeaders to "CB-VERSION", "2018-01-01" 
    put url ("https://api.coinbase.com/v2/exchange-rates?currency=BTC") into tdata
    put jsonToArray(tdata) into tdataA
    put tdataA["data"]["rates"]["USD"] into tusd
    set the HTTPHeaders to ""
  2. Using LiveCode on the server side can fill all my needs without resorting to other languages such as PHP, JSP, ASP, Perl, Python, Ruby, JAVA… I can even set up CRON jobs to run LiveCode scripts (e.g., making API calls to gather specific data) to handle routine work at any given time intervals!
    📍Example Code: 1 line of code to set up news crawler CRON job
       curl https://hhott.com/news/crawler.lc
  3. Embedding LiveCode in web pages mixed with HTML, CSS, and Javascript to provide backend data and support for these pages is not a problem. There are simple ways to exchange data between LiveCode and Javascript so there is no limit on what I can do to integrate backend and frontend data.
    📍Example Code: 1 line of code to save a LiveCode variable value in a document object to use in Javascript
       put "<span id='mid'>" & tmid & "</span>"
  4. I can create my own backend APIs in LiveCode and call these APIs from Javascript in the frontend web pages. This seamless integration between backend LiveCode and frontend Javascript helps me realize any features I need and I can imagine.
    📍Example Code: 19-line LiveCode AddFavNews API to add/remove a favored news
       put $_POST_RAW into tRequest
    put jsonToArray(tRequest) into tRequestA
    put tRequestA["tid"] into tfid
    put tRequestA["mid"] into tmid
    put revOpenDatabase("MySQL", tDatabaseAddress, tDatabaseName, tDatabaseUser, tDatabasePassword) into tResult
    if tResult is a number then
    put tResult into gConnectionID
    put "SELECT tid FROM favnews WHERE memid=" & tmid & " and fid=" & tfid into tSQL
    put revDataFromQuery(tab, cr, gConnectionID, tSQL) into tdata
    if tdata = "" then
    put "memid, fid" into tFields
    put "INSERT INTO favnews (" & tFields & ") VALUES (:1, :2)" into tSQL
    revExecuteSQL gConnectionID, tSQL, "tmid", "tfid"
    else
    put "delete from favnews WHERE memid=" & tmid & " and fid=" & tfid into tSQL
    revExecuteSQL gConnectionID, tSQL
    end if
    revCloseDatabase gConnectionID
    end if

    📍Example Code: 15 lines of Javascript code to call LiveCode AddFavNews API (LiveCode variable values stored in document objects are used in Javascript)
    async function addfavnews() {
    var x=document.getElementById("tid").innerHTML;
    var y=document.getElementById("mid").innerHTML;
    let url = 'https://hhott.com/addfavnews.lc';
    let res = await fetch(url, {
    method: 'POST',
    headers: {
    'Content-Type': 'application/json',
    },
    body: JSON.stringify({
    tid:x,
    mid:y,
    }),
    });
    }

To complete my Web3 services, I did spend a lot of time learning CSS and Javascript for the frontend web pages. I hope I can leave HTML, CSS, and Javascript all behind and leapfrog to LiveCode 10 Web deployment when it becomes available. I can’t wait for that to happen since I can get a lot more work done with a lot less effort. More importantly, a lot of work I’ve done in LiveCode in the past can be put directly on the web! Whenever I think about this, I got really excited!

OK. Don’t just take my words for it. You can check out the work I’ve done from the links below to experience it yourself. Everything you see is all done by myself. YES, one person does all the coding and even the (not too professional) graphic work! I don’t think it is possible for me to do all these work alone with any other languages.

The following is to share the insights and thoughts I have gathered in the past year from developing Web3 services, and my plan for 2023. You can also find out what makes up a Web3 service.

📍 Reflecting on 2022, Anticipating 2023 (inspired by Heather)
🔗 https://hhott.com/en/reflecting-on-2022-anticipating-2023/

Also, my first Web3 news reader game “HHOTT News” has been completed and I would like to invite everyone to test and experience it. HHOTT News is one of the first 10 Web3 services I plan to release in 2023. It is the easiest one so it got released first. The coding part of all other services is mostly done. I just need to do more testing and complete the documentation. (And I would appreciate very much if someone can help.)

Click to read the free HHOTT News

📍 Promote HHOTT News to the world
🔗 https://hhott.com/freenewsen.lc (mainly US news)
🔗 https://hhott.com/en/promote-hhott-news-to-the-world/ (more info)

📍 First 10 Web3 services to release in 2023
🔗 https://hhott.com/en/introduction/

Last but not least, LiveCode’s unicode support works really great for i18n (internationalization) development. Below is HHOTT News in traditional Chinese. The news sources I collected can support more than 50 countries and languages. Let me know if you are interested in developing a version for your country and language. It could be as simple as changing the two-letter country code.

📍 向全世界推廣熱透頭條 (繁體中文版)
🔗 https://hhott.com/freenewstc.lc (mainly Taiwan news)
🔗 https://hhott.com/tc/向全世界推廣熱透頭條/ (more info)

By combining creativity and the latest blockchain and NFT technology, I am very confident I can build outstanding Web3 services using LiveCode. And I truly believe LiveCode is the best tool to build world-class Web3 services.

Finally, I would like to conclude this blog with an invitation to like-minded friends to join me and work as a team for the better future of Web3 and LiveCode in 2023 and beyond. You can be a developer, a marketer, a promoter, an evangelist, or whatever role you would like to play. Please hit me up if you are interested. Maybe we can all be part of “LiveCode DAO”. I am looking forward to hearing from you.

Join us for the better future of Web3

HHOTT Founder
Andy Parng

#LiveCode #Web3 #Blockchain #NFT

LiveCode和Python的比較分析

Python是一個非常熱門的編程語言,最近還被列入中國計算機等級考試以及高中會考科目。所以大家一定會好奇想要知道LiveCode和Python的有什麼不同?為什麼要學習LiveCode而不學習Python呢

其實如果你想要成為一個專業的程序員,學習的Python應該是錯不了的。但是並不是每一位有興趣學習編程的人都想要成為一個專業的程序員。如果你學習編程的動機與目的是要找到一個最簡單易學的工具來實現你的創意,那麼LiveCode將是你最好的選擇。每個人都有不同的想法與創意,但是在實現你的想法和創意之前都需要跨過一道鴻溝。使用LiveCode可以讓這道鴻溝變的窄和淺讓你很容易的跨過它把你的想法與創意變成真實。

以下就是基於這個考量來比較LiveCode和Python的。首先許多的Python的特點例如省卻編譯連結的步驟,省卻變數類型宣告的動作,自動化的記憶體管理,內建許多高階而實用的資料型態,輕易結合網路程式模組,物件導向式語言架構,跨平台與圖形介面延伸等等,LiveCode也都具備。

之前發布有關LiveCode的4大功能:所見即所得的開發環境,自然語言式的腳本語言,強大的跨平台開發與部署系統,和免費的開源版本與Python的相比較,除了兩者皆免費打平之外,其它3項LiveCode都優於PythonPython主要是用於後台與算法的編程,而LiveCode主要是用於UI的建構和創建實用的APP,因此LiveCode的所見即所得的開發環境是Python的望塵莫及的。雖然Python中相較於其它流行的編程語言有了更多的自然語言的成分,但是LiveCode的編程語言更接近英文的自然語言,因此也更適合初學者學習LiveCode強大的跨平台開發與部署系統更勝過Python中,尤其是在創建行動端應用以及結合物聯網與人工智能創建科普應用的部分。另外與其他流行的跨平台開發工具相比包括的Python,LiveCode在工作效率的提升以及投資回報率都是最高幾乎是無與倫比的。

當然Python中也有它的優勢,例如龐大的用戶基礎與社區支援,廣泛的教程和眾多科學計算,數據挖掘,機器學習,人工智能的資料庫,容易在大公司找到高薪程序員的職位等。但是如果你的目標不只是在一個巨大的機器裡當一個小螺絲而是靠你自己的努力就有足夠的能力成為一個能夠獨當一面的全棧開發者來實現你的創意,那麼LiveCode將是你最好與最聰明的選擇。

LiveCode是一個隱藏最好的秘密編程工具,所以非主流編程語言是它最大的弱點。但是我們現在要盡最大的努力借由LIVECODER的平台與APP把這個寶藏挖掘出來使它成為一個主流的編程語言讓更多人能夠學習它並且享受它的強大功能來實現每個人的想法與創意

用五行LiveCode代碼創建一個計算器

計算器在PC和行動設備裡都是標配的應用。如果你學過其它的編程語言,請想想你是否用過這些語言創建過一個計算器的應用?如果有,那麼你又花了多少的時間以及寫了多少行的代碼來完成這個應用?

如果我告訴你創建一個基本的計算器應用只需要5行的LiveCode代碼以及5分鐘的時間你相信嗎?如果你好奇這是怎麼完成的,請繼續讀下去。

首先我們需要在LiveCode的圖形化所見即所得的集成開發環境裡用簡單的拖拉方法把計算器裡需要的按鍵以及顯示計算公式與結果的欄位設置好。我們把這些按鍵分成五類並且用不同的顏色來區分它們。每一類也只需要1行代碼來處理它們。

第一類是使用紅色背景顏色的“=”按鍵。第一行的代碼直接可以翻譯為:“如果被點擊的物件名稱是‘=’,並且計算字段的最後一個字符是數字,那麼就把輸入的公式進行計算。”
if short name of target is “=” and last char of field 1 is a number then do “put” && field 1 && “into field 1”

第二類是使用灰色背景顏色的“c”按鍵。第二行的代碼直接可以翻譯為:“否則,如果被點擊的物件名稱是‘c’,則將顯示計算公式與結果的欄位置空。”
else if short name of target is “c” then put empty into field 1

第三類是使用黑色背景顏色的“<-”按鍵。第三行的代碼直接可以翻譯為:“否則,如果被點擊的物件名稱是‘<- ’,則刪除顯示計算公式與結果欄位的最後一個字符。”
else if short name of target is “<-” then delete last char of field 1

第四類是使用藍色背景顏色與數字相關的按鍵包括0到9。第四行的代碼直接可以翻譯為:“否則,如果被點擊的物件名稱是一個數字的話,則把這個物件的名稱放在顯示計算公式與結果欄位之後。”
else if short name of target is a number then put short name of target after field 1

第五類是使用綠色背景顏色的+ – * /計算符號和小數點。第五行的代碼直接可以翻譯為:“否則,如果顯示計算公式與結果欄位不是空的而且它的最後一個字符是一個數字的話,則把這個物件的名稱放在顯示計算公式與結果欄位之後。”
else if field 1 is not empty and last char of field 1 is a number then put short name of target after field 1

把這5行代碼放在一起就可以完成這個計算器應用了!看看這些代碼是不是非常像英文的自然語言?一邊學英文一邊學編程是不是一舉兩得?LiveCode是不是可以向全世界挑戰看看是否有任何其它語言可以用少於5行代碼來完成一個可以在PC端的Mac、Windows、Linux、行動端的iOS、Android, 以及網頁的HTML5都可以獨立運行的計算器應用呢?

根據先前的報導,LiveCode可以節省大約90%的代碼編寫量,使工作效率提高10倍以上。如果你之前用過其它的語言創建過一個計算器的應用,你是不是寫了超過10倍以上的代碼和花了超過10倍以上的時間呢?

附記1:LG手機標配的計算器應用有兩行的顯示欄位,一行顯示計算公式另外一行顯示計算結果。如果把以上描述的一行欄位基本計算器改為像LG計算器一樣的兩行欄位計算器需要添加多少行的代碼呢?答案是15行。是的總共只需要20行的代碼就可以完成一個類似LG的計算器應用。如果你好奇這是如何完成的,請報名參加LiveCode的編程培訓課程吧。

附記2:加20行的代碼就可以完成一個會說話的計算器(Talking Calculator)APP。同學們可以用英文和中文錄下每一個按鍵的發音讓這個計算器發聲。另外再加3行的代碼就可以點擊背景更換背景顏色。點擊以下的鏈結即可下載這個Talking Calculator應用。是的,總共不到50行的代碼就可以完成一個可以在PC端的Mac、Windows、Linux、行動端的iOS、Android, 以及網頁的HTML5獨立運行會變色和發聲的計算器應用。如果你好奇這是如何完成的,請報名參加LiveCode的編程培訓課程吧。我們保證教會每一位同學並且讓他們在各大應用商店發佈他們自己創作的APP。

附記3:蘋果下載需要注意兩件事。第一是操作系統需要更新到最新版。第二是必須在Safari瀏覽器裡下載。下載安裝iOS版的APP時,請記得在瀏覽器輸入以上的下載網址,等待“打開此網頁”的對話框的出現,點擊“打開”後再等待幾秒鐘直到安裝的對話框出現,然後點擊“安裝”後就可以回到桌面等待APP完成下載。如果你點擊APP的圖標,你會看到“尚未信任”的對話框。你需要打開”設定” -> “一般” -> “裝置管理”然後信任這個由SPECIALDEALS.COM INC開發的APP以後,你就可以開啟這個APP了。你只需要信任一次,以後發布的APP與更新就可以開啟而不需要做這個信任的設置了。

LiveCode讓每個人都能開發APP

LiveCode是一款強大易用的開發環境,開發者可以通過拖拽來實現應用界面的設計和佈局,並可以通過一種類似於英語的自然語言腳本來編寫應用程序的功能,最後可以通過LiveCode強大的部署工具來生成可運行於各種平台(比如雲端的服務器、PC端的Mac、Windows、Linux、行動端的iOS、Android, 以及網頁的HTML5)的應用程序。其強大之處在於可以讓一個不會編程的人在很短的時間內就能開發出原生的、能夠運行於PC、服務器、瀏覽器、行動設備上的各種應用程序

LiveCode的强大功能

1. 所見即所得的開發環境

LiveCode擁有一個強大的圖形化開發環境和所見即所得的集成開發環境IDE(Integrated Development Environment)讓開發者可以很方便地將控件從它的工具箱拖拽到窗體中,並通過屬性面闆對控件的樣式、內容進行設置。除了現有的控件外,開發者還可以導入或者通過工具箱的繪圖工具來設計豐富多彩的、個性化的界面。此外,LiveCode的測試環境、用戶界面構建環境、和編碼環境都是同一個,開發者無需在各個環境中來回切換即可完成應用的設計、編碼、和測試工作,大大縮短了開發週期與時間。

2. 自然語言式的腳本語言

設計好界面後,接下來就需要編寫應用程序的功能。 LiveCode採用一種基於英語的自然開發語言來編寫腳本,語法結構和自然語言非常接近,可以大大提升代碼的可讀性和可維護性,非常適合編程初學者掌握。對於有經驗的開發者,從其他IDE轉到LiveCode的成本也很小。

例如,要實現點擊按鈕後,在文本框中顯示文字,只需選中窗體中的按鈕,然後點擊菜單欄中的【Code】圖標,在代碼編輯窗口中的mouseUp事件中輸入如圖所示代碼在LiveCode中,每個對像都對應一個腳本,這個腳本中包含了用來描述對象特徵和行為的代碼,除了可以直接在屬性面板中設置對象的屬性外,還可以通過set命令來設置。在LiveCode內部,腳本被編譯成字節碼形式來執行。 LiveCode腳本語言結合了編譯型語言的速度和解釋型語言的靈活性,可以帶給開發者更好的開發體驗。

LiveCode支持多國語言包括中文的UNICODE來開發與發布多國語言的應用。除了英文之外,開發者還可以使用中文編寫代碼,大大降低了編程領域的進入門檻,真正做到每個人都能編程,都能開發應用。

3. 強大的跨平台開發與部署系統

LiveCode擁有強大的跨平台開發與部署系統,開發者可以在Mac、Windows、或者Linux電腦裡使用幾乎雷同的LiveCode IDE來開發應用。在不同電腦開發的應用檔案也無需轉換即可在任何其它電腦裡打開繼續開發測試。開發者只需要通過簡單的設置,就可以很方便地將應用部署到各個平台,包括雲端的服務器,PC端的Mac、Windows、Linux,行動端的iOS、Android, 以及網頁的HTML5等。真正做到“一次編寫,到處都可以運行!”。

針對行動平台,LiveCode可以將應用程序的尺寸自動進行擴展,以適應各種不同的行動設備的屏幕大小。 LiveCode最終生成的是原生應用,並且支持原生UI的特性,比如多點觸摸、搖動等

4. 免費的開源版本

LiveCode針對不同的用戶和用途提供了不同的版本,包括商業版、獨立開發版、社區➕版本、和社區版本。其中社區版本採用GPLv3協議,允許在GPLv3協議許可範疇內創建個人和非商業用途的應用開發。 LiveCode免費的Mac、Windows、Linux開源社區版本讓任何人不需要投資一分錢即可用自己喜歡的電腦來自我學習使用LiveCode隨心所欲地開發出想要的應用。

LiveCode提升開發效率

對於有經驗的開發者,LiveCode可以使你的開發效率成倍提升,因為僅需要簡單的拖拽和屬性設置就可以完成窗體或表單的設計和佈局,另外還有大量易於掌握的API文檔,可以讓你在幾個小時內掌握LiveCode腳本的編寫。初步估計通過LiveCode可以節省大約90%的代碼編寫量,使工作效率提高10倍以上。

LiveCode的成功案例

LiveCode的易用性和低門檻,使得開發者可以將工作重心放在應用的概念和創意上,目前已經擁有了龐大的用戶基數,在全世界超過40個國家中都有廣泛的應用,用戶涵蓋中小型企業、獨立開發者、知名大學和學術機構等,甚至還有跨國公司。

但是如果你認為LiveCode只能創建一些小型應用,那你就大錯特錯了。據悉,著名HALO(光環)遊戲的創造者Industrial Toys使用LiveCode製作了一款在蘋果應用商店全球排前5名的Midnight Rises的遊戲,One Billion使用LiveCode製作了蘋果應用商店排名第1的暢銷教育APP,荷蘭航空公司使用LiveCode構建每年兩千八百萬乘客使用的航空訂票系統,美國地址調查局使用LiveCode來構建Landsat 7衛星的操控系統。點擊這裡還可以看到更多使用LiveCode成功開發應用的案例。無論你是想要開發遊戲應用、教育應用、商業應用、科技應用,還是其它任何應用,LiveCode都可以幫助你完成你的願望成功地開發出你想要的應用。

人人都能編程

蘋果的喬布斯曾說過,每個人都應該學習如何編程,因為它教你如何去思考。最近的一則公益公告中,微軟創始人比爾·蓋茨、Facebook創始人扎克伯格、Twitter創始人傑克·多西等IT巨頭以及美國前總統奧巴馬、NBA球星波什都在呼籲學校重視並鼓勵學生學習計算機編程。而LiveCode正致力於將這一過程變得簡單,這也是英國LiveCode公司20多年來努力不懈開發LiveCode這一工具的初衷。