SlideShare a Scribd company logo
Ring Documentation, Release 1.10
53.25 Application Class
Method Parameters Description
DecodeString cString Decode request parameters
Decode cString Decode multipart/form-data
GetFileName aArray,cVar Get File Name in aArray using cVar
SetCookie name,value,expires,path,domain,secure Set Cookie
Cookie name,value Set Cookie using name and value only
GetCookies None Get Cookies
URLEncode cString URL Encode
ScriptLibs None Add JavaScript Libraries like BootStrap
Print None Print Page Content
Style cStyle Add cStyle to page CSS content
StartHTML None Add HTTP Header to page content
The method DecodeString is used to get HTTP request parameters.
The methods Decode and GetFileName are used for uploading files.
The methods SetCookie, Cookie & GetCookies are used for adding and reading cookies.
The methods StartHTML, ScriptsLibs, Style & Print are used for page structure and JS/CSS support.
The method URLEncode is used to encode a URL to be used in HTML pages.
53.26 Page Class
Method Parameters Description
text x add HTMLSpecialChars(x) to page content (accept strings and numbers)
html cString add html code to page content
h1 x add x to page content between <h1> and </h1>
h2 x add x to page content between <h2> and </h2>
h3 x add x to page content between <h3> and </h3>
h4 x add x to page content between <h4> and </h4>
h5 x add x to page content between <h5> and </h5>
h6 x add x to page content between <h6> and </h6>
p aPara HTML <p> </p>, uses aPara List as Hash to get attributes
NewLine None add <br /> to page content
AddAttributes aPara Convert aPara list as hash to HTML element attributes
Link aPara HTML <a href> and </a>, uses aPara List as Hash to get attributes
Image aPara HTML <img>, uses aPara List as Hash to get attributes
Button aPara HTML <input type=”button”>, uses aPara List as Hash to get attributes
ButtonLink aPara HTML <input type=”button”>, uses link attribute to navigate to link
Textbox aPara HTML <input type=”text”>, uses aPara List as Hash to get attributes
Editbox aPara HTML <textarea> and </textarea>, uses aPara to get attributes
Combobox aPara HTML <select>, uses items attribute as list for <option>
Listbox aPara HTML <select multiple=’multiple’>, uses items attribute for <option>
ulstart aPara HTML <ul>
ulend aPara HTML </ul>
listart aPara HTML <li>
liend aPara HTML </li>
Continued on next page
53.25. Application Class 508
Ring Documentation, Release 1.10
Table 53.2 – continued from previous page
Method Parameters Description
List2UL aList Generate HTML <ul> including items from Ring List items
DivStart aPara HTML <div>, uses aPara List as Hash to get attributes
NavStart aPara HTML <nav>, uses aPara List as Hash to get attributes
SpanStart aPara HTML <span>, uses aPara List as Hash to get attributes
BoxStart None Generate Div with black background to be used as page header
DivEnd None HTML </div>
NavEnd None HTML </nav>
SpanEnd None HTML </span>
BoxEnd None HTML </div>, the same as divend()
FormStart cAction HTML <form>, with cAction as the action attribute or an empty value
FormPost cAction HTML <form method=”post”> , with cAction as the action attribute
FormEnd None HTML </form>
Submit aPara HTML <input type=”submit”>
Hidden cName,cValue HTML <input type=”hidden”>
FormUpload x HTML Form, method=”post” enctype=”multipart/form-data” and x = action
UploadFile x HTML <input type=”file”> and name = x
Video aPara HTML <video>
Audio aPara HTML <audio>
GetColor aPara Select Color
Radio aPara HTML <input type=”radio”>
Checkbox aPara HTML <input type=”checkbox”>
Spinner aPara HTML <input type=”number”>
Slider aPara HTML <input type=”range”>
TableStart aPara HTML <table>
TableEnd None HTML </table>
RowStart aPara HTML <tr>
RowEnd None HTML </tr>
CellStart aPara HTML <td>
CellEnd None HTML </td>
HeaderStart aPara HTML <th>
HeaderEnd None HTML </th>
aPara in the page methods is a list contains attributes and values. Using aPara we can set values for the next attributes
classname id name align style dir value onclick oncontextmenu ondblclick
onmousedown onmouseenter onmouseleave onmousemove onmouseover onmouseout
onmouseup onkeydown onkeypress onkeyup onabort onbeforeunload onerror
onhashchange onload onpageshow onpagehide onresize onscroll onunload
onblur onchange onfocus onfocusin onfocusout oninput oninvalid onreset
onsearch onselect onsubmit ondrag ondragend ondragenter ondragleave
ondragover ondragstart ondrop oncopy oncut onpaste onafterprint
onbeforeprint oncanplay oncanplaythrough ondurationchange onemptied
onended onloadeddata onloadedmetadata onloadstart onpause onplay
onplaying onprogress onratechange onseeked onseeking onstalled onsuspend
ontimeupdate onvolumechange onwaiting animationend animationiteration
animationstart transitionend onmessage onopen onmousewheel ononline
onoffline onpostate onshow onstorage ontoggle onwheel ontouchcancel
ontouchend ontouchmove ontouchstart color opacity background backgroundattachment
backgroundcolor backgroundimage backgroundposition backgroundrepeat backgroundclip
backgroundorigin backgroundsize border borderbottom borderbottomcolor
borderbottomleftradius borderbottomrightradius borderbottomstyle borderbottomwidth
bordercolor borderimage borderimageoutset borderimagerepeat borderimageslice
53.26. Page Class 509
Ring Documentation, Release 1.10
borderimagesource borderimagewidth borderleft borderleftcolor borderleftstyle
borderleftwidth borderradius borderright borderrightcolor borderrightstyle
borderrightwidth borderstyle bordertop bordertopcolor bordertopleftradius
bordertoprightradius bordertopstyle bordertopwidth borderwidth boxdecorationbreak
boxshadow bottom clear clip display float height left margin marginbottom marginleft
marginright margintop maxheight maxwidth minheight minwidth overflow overflowx
overflowy padding paddingbottom paddingleft paddingright paddingtop position
right top visibility width verticalalign zindex aligncontent alignitems alignself
flex flexbasis flexdirection flexflow flexgrow flexshrink flexwrap justifycontent
order hangingpunctuation hyphens letterspacing linebreak lineheight overflowwrap
tabsize textalign textalignlast textcombineupright textindent textjustify
texttransform whitespace wordbreak wordspacing wordwrap textdecoration
textdecorationcolor textdecorationline textdecorationstyle textshadow
textunderlineposition @fontface @fontfeaturevalues font fontfamily fontfeaturesettings
fontkerning fontlanguageoverride fontsize fontsizeadjust fontstretch fontstyle
fontsynthesis fontvariant fontvariantalternates fontvariantcaps fontvarianteastasian
fontvariantligatures fontvariantnumeric fontvariantposition fontweight direction
textorientation unicodebidi writingmode bordercollapse borderspacing captionside
emptycells tablelayout counterincrement counterreset liststyle liststyleimage
liststyleposition liststyletype @keyframes animation animationdelay animationdirection
animationduration animationfillmode animationiterationcount animationname
animationplaystate animationtimingfunction backfacevisibility perspective
perspectiveorigin transform transformorigin transformstyle transition
transitionproperty transitionduration transitiontimingfunction transitiondelay
boxsizing content cursor imemode navdown navindex navleft navright navup
outline outlinecolor outlineoffset outlinestyle outlinewidth resize textoverflow
breakafter breakbefore breakinside columncount columnfill columngap columnrule
columnrulecolor columnrulestyle columnrulewidth columnspan columnwidth columns
widows orphans pagebreakafter pagebreakbefore pagebreakinside marks quotes
filter imageorientation imagerendering imageresolution objectfit objectposition
mask masktype mark markafter markbefore phonemes rest restafter restbefore
voicebalance voiceduration voicepitch voicepitchrange voicerate voicestress
voicevolume marqueedirection marqueeplaycount marqueespeed marqueestyle datatoggle
dataride datatarget dataslideto dataslide datadismiss dataplacement datacontent
datatrigger dataspy dataoffset dataoffsettop
53.27 ScriptFunctions Class
This class contains methods for adding JavaScript code to the generated web page.
The class methods are merged to the Page class, so we can use the next methods with page objects directly.
Method Parameters Description
Script cCode Add cCode string between <script> and </script>
ScriptRedirec-
tion
cURL set window.location to cURL
ScriptFunc cFuncName,cCode Define function cFuncName that contains cCode
ScriptFuncAlert cFuncName,cMsg Define function cFuncName that uses alert() to print
cMsg
ScriptFuncAjax cFuncName,cLink,cDiv Define function cFuncName that load cLink in cDiv
ScriptFuncClean cFuncName,cDiv Define function cFuncName that clear the cDiv
ScriptFuncSe-
lect
cF,aL,cD,cR,cGR,cFC,nTO,cL1,cL2 Used to Edit/Delete Grid Record
ScriptScroll-
Fixed
cDiv,nSize Set cDiv as Fixed Div with Size = nSize
53.27. ScriptFunctions Class 510
Ring Documentation, Release 1.10
53.28 StyleFunctions Class
This class contains methods for adding CSS to the generated web page.
Like ScriptFunctions Class, The StyleFunctions class methods are merged to the Page class, so we can use the next
methods with page objects directly.
Method Parameters Description
StyleFloatLeft None Return float: left ;
StyleFloatRight None Return float: right ;
StyleSizeFull None Return width: 100% ; height: 100% ;
Stylecolor x Return ” color: ” + x + ” ; “
Stylebackcolor x Return ” background-color: ” + x + ” ;”
StyleTextCenter None Return “text-align: center ;”
StyleTextRight None Return “text-align: right ;”
StyleTextLeft None Return “text-align: left ;”
StyleSize x,y Return ” width: ” + x + ” ; height: ” + y + ” ;”
StyleWidth x Return ” width: ” + x + ” ;”
StyleHeight x Return ” height: ” + x + ” ;”
StyleTop x Return ” top: ” + x + ” ;”
StyleLeft x Return ” Left: ” + x + ” ;”
StylePos x,y Return ” top: ” + x + ” ;” + ” Left: ” + y + ” ;”
StyleHorizontalCenter None Return ” margin-right:auto ; margin-left:auto; “
StyleMarginTop x Return ” margin-top: ” + x + ” ;”
StyleMarginRight x Return ” margin-right: ” + x + ” ;”
StyleMarginLeft x Return ” margin-left: ” + x + ” ;”
StyleDivCenter nWidth,nHeight Create Div in the center of the page
StyleAbsolute None Return ” position:absolute ;”
StyleFixed None Return ” position:fixed ;”
StyleZIndex x Return ” z-index: ” + x + ” ;”
StyleFontSize x Return ” font-size: ” + x + ” ;”
StyleGradient x Generate Gradient (x values from 1 to 60)
StyleTable None Set table properties
StyleTableRows id Set different color to even and odd rows in the table
StyleTableNoBorder None Return ” border-style: none;”
53.29 WebPage Class
We use braces to access the active WebPage object attributes
Each one of these attribute will return a new object to access again using braces.
53.28. StyleFunctions Class 511
Ring Documentation, Release 1.10
Attribute Description
H1 Wraps HTML H1.
H2 Wraps HTML H2.
H3 Wraps HTML H3.
H4 Wraps HTML H4.
H5 Wraps HTML H5.
H6 Wraps HTML H6.
P Wraps HTML P.
Link Wraps HTML link.
NewLine Wraps HTML NewLine.
Div Wraps HTML Div.
Form Wraps HTML Form.
Input Wraps HTML Input.
TextArea Wraps HTML TextArea.
Select Wraps HTML Select.
Option Wraps HTML Option.
Image Wraps HTML Image.
UL Wraps HTML UL.
LI Wraps HTML LI.
Table Wraps HTML Table.
TR Wraps HTML TR.
TD Wraps HTML TD.
TH Wraps HTML TH.
Audio Wraps HTML Audio.
Video Wraps HTML Video.
Nav Wraps HTML Nav.
Span Wraps HTML Span.
Button Wraps HTML Button.
53.30 HtmlPage Class
The same as the WebPage class with the next changes
1. No output to the stdout
2. Provide the Output Method to get the output
Syntax:
output() ---> The output as string
53.30. HtmlPage Class 512
CHAPTER
FIFTYFOUR
DEPLOYING WEB APPLICATIONS IN THE CLOUD
In this chapter we will learn about deploying Ring Web Applications in the Cloud using Heroku
54.1 Introduction
We created a new project and tutorial to explain how to deploy Ring web applications in the Cloud using Heroku
Demo : http://testring.herokuapp.com/
Project : https://github.com/ring-lang/RingWebAppOnHeroku
Heroku Website : https://www.heroku.com/
54.2 Usage
To use this project and deploy it on Heroku
513
Ring Documentation, Release 1.10
1. Create Heroku account
2. Open your Heroku account and create new application
Example : testring
Note (You have to select a unique name for your application)
3. Open the command prompt, Create new folder : MyApp
md MyApp
4. Open the application folder
cd MyApp
5. Clone this projet using Git (Don’t forget the dot in the end to clone in the current directory)
git clone https://github.com/ring-lang/RingWebAppOnHeroku .
6. Login to Heroku (Enter your Email and Password)
heroku login
7. Add heroku (remote) to your Git project
change testring to your application name
heroku git:remote -a testring
8. Set the buildpacks (So Heroku can know how to support your project)
heroku buildpacks:add --index 1 https://github.com/ring-lang/heroku-buildpack-apt
heroku buildpacks:add --index 2 https://github.com/ring-lang/heroku-buildpack-ring
9. Now build your project and deploy it
git push heroku master
10. Test your project (In the browser)
heroku open
54.3 Ring source code files and permissions
To be able to run your new Ring scripts, Set the permission of the file to be executable using Git
For example, if you created a file : myscript.ring
git update-index --chmod=+x myscript.ring
git commit -m "Update file permission"
If you are using TortoiseGit, From windows explorer, select the file
Right click —> Properties —> Git —> Executable (+x)
Then commit and deploy!
54.3. Ring source code files and permissions 514
Ring Documentation, Release 1.10
54.4 Hello World program
file : ringapp/helloworld.ring
To run it : http://testring.herokuapp.com/ringapp/helloworld.ring
#!/app/runring.sh -cgi
see "content-type: text/html" +nl+nl
see "Hello, World!" + nl
file : ringapp/helloworld2.ring
To run it : http://testring.herokuapp.com/ringapp/helloworld2.ring
#!/app/runring.sh -cgi
load "weblib.ring"
import System.Web
new page {
text("Hello, World!")
}
54.5 Application Database
When you depoly the application, Everything will works directly!
No change is required, but in practice, You will need to update the next files to use your database
There are two scripts to interact with the database (We are using PostgreSQL in the cloud)
You will need to update the connection string in these files if you will use another database
• file: ringapp/database/newdb.ring (We run it using the browser for one time to create the tables)
• file: ringapp/datalib.ring (Class: Database)
In your practical projects, You can write better code (To be able to change the database)
Also you can create configuration file (To write the connection string in one place)
Database service : https://www.heroku.com/postgres
54.6 Deploying after updates
Just use Git and commit then push to heroku
file: build.bat contains the next commands for quick tests
git add .
git commit -m "Update RingWebAppOnHeroku"
git push heroku master
heroku open
54.4. Hello World program 515
Ring Documentation, Release 1.10
54.7 Local Tests
Local tests using Ring Notepad on Windows (Using local Apache Web Server)
Replace the first line in the file : ringapp/index.ring with
#!ring -cgi
Then run it from Ring Notepad (Ctrl+F6)
54.7. Local Tests 516
CHAPTER
FIFTYFIVE
USING RINGLIBCURL
In this chapter we will learn about using RingLibCurl
55.1 Get Request
Example:
load "libcurl.ring"
curl = curl_easy_init()
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1)
curl_easy_setopt(curl, CURLOPT_URL, "http://ring-lang.sf.net")
curl_easy_perform(curl)
curl_easy_cleanup(curl)
55.2 Post Request
Example:
load "libcurl.ring"
curl = curl_easy_init()
cPostThis = "page=4&Number1=4&Number2=5"
curl_easy_setopt(curl, CURLOPT_URL, "http://localhost/ringapp/index.ring?page=3")
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, cPostThis)
curl_easy_perform(curl)
curl_easy_cleanup(curl)
55.3 Facebook Login
Example:
517

More Related Content

Similar to The Ring programming language version 1.10 book - Part 55 of 212 (20)

PDF
The Ring programming language version 1.5.3 book - Part 55 of 184
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.4 book - Part 13 of 30
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.5.4 book - Part 45 of 185
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.5.2 book - Part 44 of 181
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.5.1 book - Part 43 of 180
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.7 book - Part 49 of 196
Mahmoud Samir Fayed
 
PPTX
Html
Nidhi mishra
 
PPTX
HTML Tutorials
Arvind Kumar
 
PDF
Front End Ui with React online training | Front End Ui with React training | ...
Selfpaced
 
PPTX
Razor into the Razor'verse
Ed Charbeneau
 
PDF
Front end UI with React online training | Front end UI with React training | ...
Selfpaced
 
PPT
Data controls ppt
Iblesoft
 
PPTX
Introduction to Cascading Style Sheets .
monishedustu07
 
PPTX
WEB DEVELOPMENT
Gourav Kaushik
 
PDF
GDI Seattle Intermediate HTML and CSS Class 1
Heather Rock
 
PPTX
The Django Web Application Framework 2
fishwarter
 
PPTX
The Django Web Application Framework 2
fishwarter
 
PDF
Css
actacademy
 
DOCX
Css
actacademy
 
PPTX
The Django Web Application Framework 2
fishwarter
 
The Ring programming language version 1.5.3 book - Part 55 of 184
Mahmoud Samir Fayed
 
The Ring programming language version 1.4 book - Part 13 of 30
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.4 book - Part 45 of 185
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.2 book - Part 44 of 181
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.1 book - Part 43 of 180
Mahmoud Samir Fayed
 
The Ring programming language version 1.7 book - Part 49 of 196
Mahmoud Samir Fayed
 
HTML Tutorials
Arvind Kumar
 
Front End Ui with React online training | Front End Ui with React training | ...
Selfpaced
 
Razor into the Razor'verse
Ed Charbeneau
 
Front end UI with React online training | Front end UI with React training | ...
Selfpaced
 
Data controls ppt
Iblesoft
 
Introduction to Cascading Style Sheets .
monishedustu07
 
WEB DEVELOPMENT
Gourav Kaushik
 
GDI Seattle Intermediate HTML and CSS Class 1
Heather Rock
 
The Django Web Application Framework 2
fishwarter
 
The Django Web Application Framework 2
fishwarter
 
The Django Web Application Framework 2
fishwarter
 

More from Mahmoud Samir Fayed (20)

PDF
The Ring programming language version 1.10 book - Part 212 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 211 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 210 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 208 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 207 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 205 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 206 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 204 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 203 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 202 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 201 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 200 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 199 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 198 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 197 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 196 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 195 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 194 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 193 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 192 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 212 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 211 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 210 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 208 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 207 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 205 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 206 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 204 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 203 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 202 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 201 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 200 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 199 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 198 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 197 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 196 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 195 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 194 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 193 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 192 of 212
Mahmoud Samir Fayed
 
Ad

Recently uploaded (20)

PPTX
In From the Cold: Open Source as Part of Mainstream Software Asset Management
Shane Coughlan
 
PDF
4K Video Downloader Plus Pro Crack for MacOS New Download 2025
bashirkhan333g
 
PDF
Empower Your Tech Vision- Why Businesses Prefer to Hire Remote Developers fro...
logixshapers59
 
PPTX
Milwaukee Marketo User Group - Summer Road Trip: Mapping and Personalizing Yo...
bbedford2
 
PDF
How to Hire AI Developers_ Step-by-Step Guide in 2025.pdf
DianApps Technologies
 
PDF
Driver Easy Pro 6.1.1 Crack Licensce key 2025 FREE
utfefguu
 
PDF
AI + DevOps = Smart Automation with devseccops.ai.pdf
Devseccops.ai
 
PDF
Top Agile Project Management Tools for Teams in 2025
Orangescrum
 
PDF
AOMEI Partition Assistant Crack 10.8.2 + WinPE Free Downlaod New Version 2025
bashirkhan333g
 
PDF
유니티에서 Burst Compiler+ThreadedJobs+SIMD 적용사례
Seongdae Kim
 
PDF
Technical-Careers-Roadmap-in-Software-Market.pdf
Hussein Ali
 
PDF
TheFutureIsDynamic-BoxLang witch Luis Majano.pdf
Ortus Solutions, Corp
 
PDF
IDM Crack with Internet Download Manager 6.42 Build 43 with Patch Latest 2025
bashirkhan333g
 
PDF
SciPy 2025 - Packaging a Scientific Python Project
Henry Schreiner
 
PDF
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
PDF
MiniTool Partition Wizard Free Crack + Full Free Download 2025
bashirkhan333g
 
PPTX
AEM User Group: India Chapter Kickoff Meeting
jennaf3
 
PPTX
Customise Your Correlation Table in IBM SPSS Statistics.pptx
Version 1 Analytics
 
PPTX
Help for Correlations in IBM SPSS Statistics.pptx
Version 1 Analytics
 
PPTX
Hardware(Central Processing Unit ) CU and ALU
RizwanaKalsoom2
 
In From the Cold: Open Source as Part of Mainstream Software Asset Management
Shane Coughlan
 
4K Video Downloader Plus Pro Crack for MacOS New Download 2025
bashirkhan333g
 
Empower Your Tech Vision- Why Businesses Prefer to Hire Remote Developers fro...
logixshapers59
 
Milwaukee Marketo User Group - Summer Road Trip: Mapping and Personalizing Yo...
bbedford2
 
How to Hire AI Developers_ Step-by-Step Guide in 2025.pdf
DianApps Technologies
 
Driver Easy Pro 6.1.1 Crack Licensce key 2025 FREE
utfefguu
 
AI + DevOps = Smart Automation with devseccops.ai.pdf
Devseccops.ai
 
Top Agile Project Management Tools for Teams in 2025
Orangescrum
 
AOMEI Partition Assistant Crack 10.8.2 + WinPE Free Downlaod New Version 2025
bashirkhan333g
 
유니티에서 Burst Compiler+ThreadedJobs+SIMD 적용사례
Seongdae Kim
 
Technical-Careers-Roadmap-in-Software-Market.pdf
Hussein Ali
 
TheFutureIsDynamic-BoxLang witch Luis Majano.pdf
Ortus Solutions, Corp
 
IDM Crack with Internet Download Manager 6.42 Build 43 with Patch Latest 2025
bashirkhan333g
 
SciPy 2025 - Packaging a Scientific Python Project
Henry Schreiner
 
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
MiniTool Partition Wizard Free Crack + Full Free Download 2025
bashirkhan333g
 
AEM User Group: India Chapter Kickoff Meeting
jennaf3
 
Customise Your Correlation Table in IBM SPSS Statistics.pptx
Version 1 Analytics
 
Help for Correlations in IBM SPSS Statistics.pptx
Version 1 Analytics
 
Hardware(Central Processing Unit ) CU and ALU
RizwanaKalsoom2
 
Ad

The Ring programming language version 1.10 book - Part 55 of 212

  • 1. Ring Documentation, Release 1.10 53.25 Application Class Method Parameters Description DecodeString cString Decode request parameters Decode cString Decode multipart/form-data GetFileName aArray,cVar Get File Name in aArray using cVar SetCookie name,value,expires,path,domain,secure Set Cookie Cookie name,value Set Cookie using name and value only GetCookies None Get Cookies URLEncode cString URL Encode ScriptLibs None Add JavaScript Libraries like BootStrap Print None Print Page Content Style cStyle Add cStyle to page CSS content StartHTML None Add HTTP Header to page content The method DecodeString is used to get HTTP request parameters. The methods Decode and GetFileName are used for uploading files. The methods SetCookie, Cookie & GetCookies are used for adding and reading cookies. The methods StartHTML, ScriptsLibs, Style & Print are used for page structure and JS/CSS support. The method URLEncode is used to encode a URL to be used in HTML pages. 53.26 Page Class Method Parameters Description text x add HTMLSpecialChars(x) to page content (accept strings and numbers) html cString add html code to page content h1 x add x to page content between <h1> and </h1> h2 x add x to page content between <h2> and </h2> h3 x add x to page content between <h3> and </h3> h4 x add x to page content between <h4> and </h4> h5 x add x to page content between <h5> and </h5> h6 x add x to page content between <h6> and </h6> p aPara HTML <p> </p>, uses aPara List as Hash to get attributes NewLine None add <br /> to page content AddAttributes aPara Convert aPara list as hash to HTML element attributes Link aPara HTML <a href> and </a>, uses aPara List as Hash to get attributes Image aPara HTML <img>, uses aPara List as Hash to get attributes Button aPara HTML <input type=”button”>, uses aPara List as Hash to get attributes ButtonLink aPara HTML <input type=”button”>, uses link attribute to navigate to link Textbox aPara HTML <input type=”text”>, uses aPara List as Hash to get attributes Editbox aPara HTML <textarea> and </textarea>, uses aPara to get attributes Combobox aPara HTML <select>, uses items attribute as list for <option> Listbox aPara HTML <select multiple=’multiple’>, uses items attribute for <option> ulstart aPara HTML <ul> ulend aPara HTML </ul> listart aPara HTML <li> liend aPara HTML </li> Continued on next page 53.25. Application Class 508
  • 2. Ring Documentation, Release 1.10 Table 53.2 – continued from previous page Method Parameters Description List2UL aList Generate HTML <ul> including items from Ring List items DivStart aPara HTML <div>, uses aPara List as Hash to get attributes NavStart aPara HTML <nav>, uses aPara List as Hash to get attributes SpanStart aPara HTML <span>, uses aPara List as Hash to get attributes BoxStart None Generate Div with black background to be used as page header DivEnd None HTML </div> NavEnd None HTML </nav> SpanEnd None HTML </span> BoxEnd None HTML </div>, the same as divend() FormStart cAction HTML <form>, with cAction as the action attribute or an empty value FormPost cAction HTML <form method=”post”> , with cAction as the action attribute FormEnd None HTML </form> Submit aPara HTML <input type=”submit”> Hidden cName,cValue HTML <input type=”hidden”> FormUpload x HTML Form, method=”post” enctype=”multipart/form-data” and x = action UploadFile x HTML <input type=”file”> and name = x Video aPara HTML <video> Audio aPara HTML <audio> GetColor aPara Select Color Radio aPara HTML <input type=”radio”> Checkbox aPara HTML <input type=”checkbox”> Spinner aPara HTML <input type=”number”> Slider aPara HTML <input type=”range”> TableStart aPara HTML <table> TableEnd None HTML </table> RowStart aPara HTML <tr> RowEnd None HTML </tr> CellStart aPara HTML <td> CellEnd None HTML </td> HeaderStart aPara HTML <th> HeaderEnd None HTML </th> aPara in the page methods is a list contains attributes and values. Using aPara we can set values for the next attributes classname id name align style dir value onclick oncontextmenu ondblclick onmousedown onmouseenter onmouseleave onmousemove onmouseover onmouseout onmouseup onkeydown onkeypress onkeyup onabort onbeforeunload onerror onhashchange onload onpageshow onpagehide onresize onscroll onunload onblur onchange onfocus onfocusin onfocusout oninput oninvalid onreset onsearch onselect onsubmit ondrag ondragend ondragenter ondragleave ondragover ondragstart ondrop oncopy oncut onpaste onafterprint onbeforeprint oncanplay oncanplaythrough ondurationchange onemptied onended onloadeddata onloadedmetadata onloadstart onpause onplay onplaying onprogress onratechange onseeked onseeking onstalled onsuspend ontimeupdate onvolumechange onwaiting animationend animationiteration animationstart transitionend onmessage onopen onmousewheel ononline onoffline onpostate onshow onstorage ontoggle onwheel ontouchcancel ontouchend ontouchmove ontouchstart color opacity background backgroundattachment backgroundcolor backgroundimage backgroundposition backgroundrepeat backgroundclip backgroundorigin backgroundsize border borderbottom borderbottomcolor borderbottomleftradius borderbottomrightradius borderbottomstyle borderbottomwidth bordercolor borderimage borderimageoutset borderimagerepeat borderimageslice 53.26. Page Class 509
  • 3. Ring Documentation, Release 1.10 borderimagesource borderimagewidth borderleft borderleftcolor borderleftstyle borderleftwidth borderradius borderright borderrightcolor borderrightstyle borderrightwidth borderstyle bordertop bordertopcolor bordertopleftradius bordertoprightradius bordertopstyle bordertopwidth borderwidth boxdecorationbreak boxshadow bottom clear clip display float height left margin marginbottom marginleft marginright margintop maxheight maxwidth minheight minwidth overflow overflowx overflowy padding paddingbottom paddingleft paddingright paddingtop position right top visibility width verticalalign zindex aligncontent alignitems alignself flex flexbasis flexdirection flexflow flexgrow flexshrink flexwrap justifycontent order hangingpunctuation hyphens letterspacing linebreak lineheight overflowwrap tabsize textalign textalignlast textcombineupright textindent textjustify texttransform whitespace wordbreak wordspacing wordwrap textdecoration textdecorationcolor textdecorationline textdecorationstyle textshadow textunderlineposition @fontface @fontfeaturevalues font fontfamily fontfeaturesettings fontkerning fontlanguageoverride fontsize fontsizeadjust fontstretch fontstyle fontsynthesis fontvariant fontvariantalternates fontvariantcaps fontvarianteastasian fontvariantligatures fontvariantnumeric fontvariantposition fontweight direction textorientation unicodebidi writingmode bordercollapse borderspacing captionside emptycells tablelayout counterincrement counterreset liststyle liststyleimage liststyleposition liststyletype @keyframes animation animationdelay animationdirection animationduration animationfillmode animationiterationcount animationname animationplaystate animationtimingfunction backfacevisibility perspective perspectiveorigin transform transformorigin transformstyle transition transitionproperty transitionduration transitiontimingfunction transitiondelay boxsizing content cursor imemode navdown navindex navleft navright navup outline outlinecolor outlineoffset outlinestyle outlinewidth resize textoverflow breakafter breakbefore breakinside columncount columnfill columngap columnrule columnrulecolor columnrulestyle columnrulewidth columnspan columnwidth columns widows orphans pagebreakafter pagebreakbefore pagebreakinside marks quotes filter imageorientation imagerendering imageresolution objectfit objectposition mask masktype mark markafter markbefore phonemes rest restafter restbefore voicebalance voiceduration voicepitch voicepitchrange voicerate voicestress voicevolume marqueedirection marqueeplaycount marqueespeed marqueestyle datatoggle dataride datatarget dataslideto dataslide datadismiss dataplacement datacontent datatrigger dataspy dataoffset dataoffsettop 53.27 ScriptFunctions Class This class contains methods for adding JavaScript code to the generated web page. The class methods are merged to the Page class, so we can use the next methods with page objects directly. Method Parameters Description Script cCode Add cCode string between <script> and </script> ScriptRedirec- tion cURL set window.location to cURL ScriptFunc cFuncName,cCode Define function cFuncName that contains cCode ScriptFuncAlert cFuncName,cMsg Define function cFuncName that uses alert() to print cMsg ScriptFuncAjax cFuncName,cLink,cDiv Define function cFuncName that load cLink in cDiv ScriptFuncClean cFuncName,cDiv Define function cFuncName that clear the cDiv ScriptFuncSe- lect cF,aL,cD,cR,cGR,cFC,nTO,cL1,cL2 Used to Edit/Delete Grid Record ScriptScroll- Fixed cDiv,nSize Set cDiv as Fixed Div with Size = nSize 53.27. ScriptFunctions Class 510
  • 4. Ring Documentation, Release 1.10 53.28 StyleFunctions Class This class contains methods for adding CSS to the generated web page. Like ScriptFunctions Class, The StyleFunctions class methods are merged to the Page class, so we can use the next methods with page objects directly. Method Parameters Description StyleFloatLeft None Return float: left ; StyleFloatRight None Return float: right ; StyleSizeFull None Return width: 100% ; height: 100% ; Stylecolor x Return ” color: ” + x + ” ; “ Stylebackcolor x Return ” background-color: ” + x + ” ;” StyleTextCenter None Return “text-align: center ;” StyleTextRight None Return “text-align: right ;” StyleTextLeft None Return “text-align: left ;” StyleSize x,y Return ” width: ” + x + ” ; height: ” + y + ” ;” StyleWidth x Return ” width: ” + x + ” ;” StyleHeight x Return ” height: ” + x + ” ;” StyleTop x Return ” top: ” + x + ” ;” StyleLeft x Return ” Left: ” + x + ” ;” StylePos x,y Return ” top: ” + x + ” ;” + ” Left: ” + y + ” ;” StyleHorizontalCenter None Return ” margin-right:auto ; margin-left:auto; “ StyleMarginTop x Return ” margin-top: ” + x + ” ;” StyleMarginRight x Return ” margin-right: ” + x + ” ;” StyleMarginLeft x Return ” margin-left: ” + x + ” ;” StyleDivCenter nWidth,nHeight Create Div in the center of the page StyleAbsolute None Return ” position:absolute ;” StyleFixed None Return ” position:fixed ;” StyleZIndex x Return ” z-index: ” + x + ” ;” StyleFontSize x Return ” font-size: ” + x + ” ;” StyleGradient x Generate Gradient (x values from 1 to 60) StyleTable None Set table properties StyleTableRows id Set different color to even and odd rows in the table StyleTableNoBorder None Return ” border-style: none;” 53.29 WebPage Class We use braces to access the active WebPage object attributes Each one of these attribute will return a new object to access again using braces. 53.28. StyleFunctions Class 511
  • 5. Ring Documentation, Release 1.10 Attribute Description H1 Wraps HTML H1. H2 Wraps HTML H2. H3 Wraps HTML H3. H4 Wraps HTML H4. H5 Wraps HTML H5. H6 Wraps HTML H6. P Wraps HTML P. Link Wraps HTML link. NewLine Wraps HTML NewLine. Div Wraps HTML Div. Form Wraps HTML Form. Input Wraps HTML Input. TextArea Wraps HTML TextArea. Select Wraps HTML Select. Option Wraps HTML Option. Image Wraps HTML Image. UL Wraps HTML UL. LI Wraps HTML LI. Table Wraps HTML Table. TR Wraps HTML TR. TD Wraps HTML TD. TH Wraps HTML TH. Audio Wraps HTML Audio. Video Wraps HTML Video. Nav Wraps HTML Nav. Span Wraps HTML Span. Button Wraps HTML Button. 53.30 HtmlPage Class The same as the WebPage class with the next changes 1. No output to the stdout 2. Provide the Output Method to get the output Syntax: output() ---> The output as string 53.30. HtmlPage Class 512
  • 6. CHAPTER FIFTYFOUR DEPLOYING WEB APPLICATIONS IN THE CLOUD In this chapter we will learn about deploying Ring Web Applications in the Cloud using Heroku 54.1 Introduction We created a new project and tutorial to explain how to deploy Ring web applications in the Cloud using Heroku Demo : http://testring.herokuapp.com/ Project : https://github.com/ring-lang/RingWebAppOnHeroku Heroku Website : https://www.heroku.com/ 54.2 Usage To use this project and deploy it on Heroku 513
  • 7. Ring Documentation, Release 1.10 1. Create Heroku account 2. Open your Heroku account and create new application Example : testring Note (You have to select a unique name for your application) 3. Open the command prompt, Create new folder : MyApp md MyApp 4. Open the application folder cd MyApp 5. Clone this projet using Git (Don’t forget the dot in the end to clone in the current directory) git clone https://github.com/ring-lang/RingWebAppOnHeroku . 6. Login to Heroku (Enter your Email and Password) heroku login 7. Add heroku (remote) to your Git project change testring to your application name heroku git:remote -a testring 8. Set the buildpacks (So Heroku can know how to support your project) heroku buildpacks:add --index 1 https://github.com/ring-lang/heroku-buildpack-apt heroku buildpacks:add --index 2 https://github.com/ring-lang/heroku-buildpack-ring 9. Now build your project and deploy it git push heroku master 10. Test your project (In the browser) heroku open 54.3 Ring source code files and permissions To be able to run your new Ring scripts, Set the permission of the file to be executable using Git For example, if you created a file : myscript.ring git update-index --chmod=+x myscript.ring git commit -m "Update file permission" If you are using TortoiseGit, From windows explorer, select the file Right click —> Properties —> Git —> Executable (+x) Then commit and deploy! 54.3. Ring source code files and permissions 514
  • 8. Ring Documentation, Release 1.10 54.4 Hello World program file : ringapp/helloworld.ring To run it : http://testring.herokuapp.com/ringapp/helloworld.ring #!/app/runring.sh -cgi see "content-type: text/html" +nl+nl see "Hello, World!" + nl file : ringapp/helloworld2.ring To run it : http://testring.herokuapp.com/ringapp/helloworld2.ring #!/app/runring.sh -cgi load "weblib.ring" import System.Web new page { text("Hello, World!") } 54.5 Application Database When you depoly the application, Everything will works directly! No change is required, but in practice, You will need to update the next files to use your database There are two scripts to interact with the database (We are using PostgreSQL in the cloud) You will need to update the connection string in these files if you will use another database • file: ringapp/database/newdb.ring (We run it using the browser for one time to create the tables) • file: ringapp/datalib.ring (Class: Database) In your practical projects, You can write better code (To be able to change the database) Also you can create configuration file (To write the connection string in one place) Database service : https://www.heroku.com/postgres 54.6 Deploying after updates Just use Git and commit then push to heroku file: build.bat contains the next commands for quick tests git add . git commit -m "Update RingWebAppOnHeroku" git push heroku master heroku open 54.4. Hello World program 515
  • 9. Ring Documentation, Release 1.10 54.7 Local Tests Local tests using Ring Notepad on Windows (Using local Apache Web Server) Replace the first line in the file : ringapp/index.ring with #!ring -cgi Then run it from Ring Notepad (Ctrl+F6) 54.7. Local Tests 516
  • 10. CHAPTER FIFTYFIVE USING RINGLIBCURL In this chapter we will learn about using RingLibCurl 55.1 Get Request Example: load "libcurl.ring" curl = curl_easy_init() curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1) curl_easy_setopt(curl, CURLOPT_URL, "http://ring-lang.sf.net") curl_easy_perform(curl) curl_easy_cleanup(curl) 55.2 Post Request Example: load "libcurl.ring" curl = curl_easy_init() cPostThis = "page=4&Number1=4&Number2=5" curl_easy_setopt(curl, CURLOPT_URL, "http://localhost/ringapp/index.ring?page=3") curl_easy_setopt(curl, CURLOPT_POSTFIELDS, cPostThis) curl_easy_perform(curl) curl_easy_cleanup(curl) 55.3 Facebook Login Example: 517