What is new in Ring 1.14?
In this chapter we will learn about the changes and new features in Ring 1.14 release.
List of changes and new features
Ring 1.14 comes with the next features!
MyCoffee (Web Application)
Web Development Samples
More Samples
Erlang B Formula
Customers Form
RingTilengine Extension
RingLibui Extension
RingSockets Extension
RingThreads Extension
Better RingOpenSSL
More Functions
Better Functions
Better Performance For Strings
Better Handling For Numbers
Using CLOC (Count Lines of Code)
More Improvements
MyCoffee (Web Application)
A web application that uses the WebLib library and PostgreSQL database
Screen Shots:
MyCoffee1 MyCoffee2 MyCoffee3
Web Development Samples
Starting from lesson 301, the Hassouna Course provides lessons about web development.
These lessons uses the WebLib library for Back-end web development.
Special YouTube playlist for these lessons:
https://www.youtube.com/watch?v=a3ZYjssAvbI&list=PLHIfW1KZRIfn1cs2BupsdJ7dzCQ7wmHFk
The samples are added to this folder:
https://github.com/ring-lang/ring/tree/master/samples/UsingArabic/HassounaCourse/WebDevelopment
Screen Shot:
Calculator Sample
Web Sample 1
More Samples
The next samples are added to the samples folder
ring/samples/UsingQML/sample12 folder
ring/samples/General/TimeServer folder
ring/samples/General/BinarokuGame folder
ring/samples/Language/EnumGenerator folder
ring/samples/Language/DynamicObject folder
ring/samples/Drawing/MatrixMultiply3DRotationCube
Screen Shots:
Matrix Multiplication Qt Quick 3D
Erlang B Formula
An application that uses the Erlang B Formula (Circuit Switching Systems)
erlangb
Customers Form
An application that uses SQLite and TableWidget
The Use Interface is provided in Arabic, English & French
erlangb
RingTilengine Extension
This extension provides support for Tilengine - The 2D retro graphics engine with raster effects
Example:
load "tilengine.ring"
TLN_Init(400, 240, 1, 0, 0)
TLN_SetLoadPath("assetssonic")
foreground = TLN_LoadTilemap ("Sonic_md_fg1.tmx", NULL)
TLN_SetLayerTilemap(0, foreground)
TLN_CreateWindow(NULL, 0)
while TLN_ProcessWindow()
TLN_DrawFrame(0)
end
TLN_DeleteTilemap(foreground)
TLN_Deinit()
Screen Shots:
tilengine tilengine tilengine tilengine
RingLibui Extension
This extension provides complete support for Libui
Using this extension we can develop and distribute lightweight GUI Applications using Ring (Less than 1 MB)
Runtime files and their size
Ring.dll (448 KB)
Libui.dll (210 KB)
Ring_Libui.dll (633 KB)
Total : 1,291 KB without compressing the files
After compressing the files (To ZIP file) - Total : 504 KB
Example:
load "libui.ring"
oWindow = uiNewWindow( "Say Hello", 500, 80, True)
uiWindowOnClosing(oWindow,"closeApp()")
lbl1 = uiNewLabel("Name: ")
text1 = uiNewEntry()
btn1 = uiNewButton("SayHello")
uiButtonOnClicked(btn1,"sayHello()")
btn2 = uiNewButton("Close")
uiButtonOnClicked(btn2,"closeApp()")
lbl2 = uiNewLabel("")
g = uiNewGrid() uiGridSetPadded(g, 1) uiWindowSetChild(oWindow, g)
uiGridAppend(g, lbl1, 0, 0, 2, 1, 1, uiAlignCenter, 0, uiAlignCenter)
uiGridAppend(g, text1, 1, 0, 2, 1, 1, uiAlignFill, 0, uiAlignFill)
uiGridAppend(g, btn1, 0, 1, 1, 2, 1, uiAlignFill, 0, uiAlignFill)
uiGridAppend(g, btn2, 2, 1, 1, 1, 1, uiAlignFill, 0, uiAlignFill)
uiGridAppend(g, lbl2, 0, 3, 2, 1, 1, uiAlignCenter, 0, uiAlignCenter)
uiControlShow( oWindow )
uiMain()
func sayHello
uiLabelSetText(lbl2,"Hello " + uiEntryText(text1))
func closeApp
uiQuit()
Screen Shots:
RingLibui Screen Shot RingLibui Screen Shot RingLibui Screen Shot RingLibui Screen Shot
RingSockets Extension
In Ring, We have sockets using different extensions like RingQt, RingLibuv and RingLibSDL
In this release we provide a special extension for sockets
This will be useful if your application doesn’t use the previous libraries
Example (Server Code)
# TCP SERVER
load "sockets.ring"
sock = socket(AF_INET,SOCK_STREAM,0)
bind(sock,"127.0.0.1",5050)
listen(sock,5)
ns = accept(sock)
send(ns,"Hello Client")
msg = recv(ns,1024)
? "Client Say >> " + msg
close(sock)
? "Socket connection closed"
Example (Client Code)
# TCP Client
load "sockets.ring"
sock = socket(AF_INET,SOCK_STREAM)
connect(sock,"127.0.0.1",5050)
send(sock,"Hello Server")
msg = recv(sock,1024)
? "Server Say >> " + msg
close(sock)
? "Socket connection closed"
RingThreads Extension
In Ring, We have threads using different extensions like RingQt, RingLibuv and RingAllegro
In this release we provide a special extension for threads
This will be useful if your application doesn’t use the previous libraries
Example:
load "threads.ring"
func main
nThreads = 2
aList = list(nThreads)
for x=1 to nThreads
aList[x] = new_thrd_t()
thrd_create(aList[x],"Hello("+x+")")
next
for x=1 to nThreads
res= 0
thrd_join(aList[x],:res)
next
? :Done
shutdown()
func Hello x
for r=1 to 100
? "Message from the Hello("+x+") function"
next
Better RingOpenSSL
The next functions are added to the RingOpenSSL extension
These functions compute the hash of large files/data without the need to load all of the content in a single string.
md5init() -> MD5_CTX
md5update (MD5_CTX, string) -> 1 for success or 0 for failure
md5final (MD5_CTX) -> string
sha1init() -> SHA_CTX
sha1update (SHA_CTX, string) -> 1 for success or 0 for failure
sha1final (SHA_CTX) -> string
sha224init() -> SHA224_CTX
sha224update (SHA224_CTX, string) -> 1 for success or 0 for failure
sha224final (SHA224_CTX) -> string
sha256init() -> SHA256_CTX
sha256update (SHA256_CTX, string) -> 1 for success or 0 for failure
sha256final (SHA256_CTX) -> string
sha384init() -> SHA384_CTX
sha384update (SHA384_CTX, string) -> 1 for success or 0 for failure
sha384final (SHA384_CTX) -> string
sha512init() -> SHA512_CTX
sha512update (SHA512_CTX, string) -> 1 for success or 0 for failure
sha512final (SHA512_CTX) -> string
More Functions
DirExists() Function
DirExists(cDirPath) ---> returns 1 if the directory exists
GetPathType() Function
GetPathType(cPath) ---> 0 if the path doesn't exists
1 if it corresponds to existing file
2 if it corresponds to existing directory
-1 if the path exists but has
an unknown type (e.g. a pipe)
SysSet() Function
We can set environment variables using the SysSet() function
SysSet(cVariable, cValue) ---> Returns 1 for success and return 0 for failure
SysUnset() Function
We can delete an environment variables using the SysUnset() function
SysUnset(cVariable) ---> Returns 1 for success and return 0 for failure
GetArch() Function
We can detect the architecture of the Ring executable using the GetArch() function
Syntax:
GetArch() ---> cString (The name of the architecture of the Ring executable)
Example:
switch getarch()
on "x86"
? "x86 32bit architecture"
on "x64"
? "x64 64bit architecture"
on "arm64"
? "ARM64 64bit architecture"
on "arm"
? "ARM 32bit architecture"
other
? "Unknown architecture"
off
NofProcessors() Function
We can detect the number of processors using the NofProcessors() Function
Syntax:
NofProcessors() ---> nProcessors
Example:
? NofProcessors()
Better Functions
Log() Function
The functions is updated to support calculating the logarithm to any base
Syntax:
Log(nNumber) --> logarithm of nNumber to the base of e
Log(nNumber,nBase) --> logarithm of nNumber to the base of nBase
Example:
? log(10) # 2.30
? log(2) # 0.69
? log(10,10) # 1
? log(2,2)
- Naccache, a Lebanese former guerrilla fighter who was part of the team led by Carlos the Jackal that kidnapped oil ministers in 1975
- If you want to visit this monument then remember Friday is Taj Mahal Closing Day.
- PL-900 Exam, PL-900 questions, PL-900 practice test, PL-900 practice exam, PL-900 dumps, PL-900 Exam Dumps, PL-900 exam questions,