This document discusses the architecture of a game engine project for 2D games created using Ring. The project contains layers for games, game engine classes, an interface to graphics libraries, and graphics library bindings. The interface layer hides differences between RingAllegro and RingLibSDL graphics libraries. Game engine classes include GameBase, Resources, Game, GameObject, Sprite, Text, Animate, Sound, and Map. Games are created declaratively using these classes. The document provides details on attributes and methods for the Game and GameObject base classes and derived Sprite, Text, Animate, Sound, and Map classes.
The Ring programming language version 1.8 book - Part 54 of 202Mahmoud Samir Fayed
This document discusses using different programming paradigms in a game engine project for 2D games. It describes the following layers:
1. Games Layer - Uses declarative programming to create games using the engine classes.
2. Game Engine Classes - Uses object-oriented programming to create classes like Game, Sprite, etc. that make up the engine.
3. Interface to Graphics Library - Uses procedural programming to provide a common interface to graphics libraries like Allegro and SDL.
4. Graphics Library Bindings - Includes RingAllegro and RingLibSDL which are C extensions generated from configuration files to interface with Allegro and SDL.
It provides examples of games that can be created like Stars F
Presentación de la charla impartida en el meetup de Python Madrid sobre Asincronía en Python https://www.meetup.com/es-ES/python-madrid/events/268111847/
MongoDB is the trusted document store we turn to when we have tough data store problems to solve. For this talk we are going to go a little bit off the path and explore what other roles we can fit MongoDB into. Others have discussed how to turn MongoDB’s capped collections into a publish/subscribe server. We stretch that a little further and turn MongoDB into a full fledged broker with both publish/subscribe and queue semantics, and a the ability to mix them. We will provide code and a running demo of the queue producers and consumers. Next we will turn to coordination services: We will explore the fundamental features and show how to implement them using MongoDB as the storage engine. Again we will show the code and demo the coordination of multiple applications.
- Python allows programmers to write multi-threaded programs using its threading module. This allows running multiple threads concurrently to perform asynchronous tasks or operations in parallel.
- The threading module provides Thread class which represents a thread of execution. New threads can be created by subclassing Thread and overriding its run method. start() method launches the execution of the thread.
- Synchronization between threads is important to prevent race conditions. The threading module provides Lock objects to synchronize access to shared resources.
The document discusses Node.js and provides instructions for installing Node.js via different methods:
1) Homebrew can be used to install Node.js on OSX by running "brew install node.js".
2) nDistro allows creating and installing Node.js distributions within seconds by specifying module and Node binary version dependencies in a .ndistro file.
3) Node.js can be compiled from source by cloning the Node.js repository via git or downloading the source, running configuration, make, and make install commands.
The document discusses advanced Android threading concepts including:
1. The main thread is responsible for UI rendering and user interactions. Blocking it can cause app jank and ANRs.
2. Additional threads can be created using Thread or Runnable classes and started to offload work.
3. The Handler, Looper, and MessageQueue classes provide an asynchronous messaging system for communication between threads without blocking. A Looper dispatches messages that are sent via a Handler.
The Ring programming language version 1.10 book - Part 13 of 212Mahmoud Samir Fayed
Ring 1.6 includes several new features such as a new Ring2EXE tool to distribute applications, improved support for Android development using RingQt, and a Folder2qrc tool to simplify adding resources. Other enhancements include updated build scripts, new extensions for console colors and hashing, and various improvements to components like the standard library, Ring Notepad, and RingQt.
The Ring programming language version 1.8 book - Part 54 of 202Mahmoud Samir Fayed
This document discusses using different programming paradigms in a game engine project for 2D games. It describes the following layers:
1. Games Layer - Uses declarative programming to create games using the engine classes.
2. Game Engine Classes - Uses object-oriented programming to create classes like Game, Sprite, etc. that make up the engine.
3. Interface to Graphics Library - Uses procedural programming to provide a common interface to graphics libraries like Allegro and SDL.
4. Graphics Library Bindings - Includes RingAllegro and RingLibSDL which are C extensions generated from configuration files to interface with Allegro and SDL.
It provides examples of games that can be created like Stars F
Presentación de la charla impartida en el meetup de Python Madrid sobre Asincronía en Python https://www.meetup.com/es-ES/python-madrid/events/268111847/
MongoDB is the trusted document store we turn to when we have tough data store problems to solve. For this talk we are going to go a little bit off the path and explore what other roles we can fit MongoDB into. Others have discussed how to turn MongoDB’s capped collections into a publish/subscribe server. We stretch that a little further and turn MongoDB into a full fledged broker with both publish/subscribe and queue semantics, and a the ability to mix them. We will provide code and a running demo of the queue producers and consumers. Next we will turn to coordination services: We will explore the fundamental features and show how to implement them using MongoDB as the storage engine. Again we will show the code and demo the coordination of multiple applications.
- Python allows programmers to write multi-threaded programs using its threading module. This allows running multiple threads concurrently to perform asynchronous tasks or operations in parallel.
- The threading module provides Thread class which represents a thread of execution. New threads can be created by subclassing Thread and overriding its run method. start() method launches the execution of the thread.
- Synchronization between threads is important to prevent race conditions. The threading module provides Lock objects to synchronize access to shared resources.
The document discusses Node.js and provides instructions for installing Node.js via different methods:
1) Homebrew can be used to install Node.js on OSX by running "brew install node.js".
2) nDistro allows creating and installing Node.js distributions within seconds by specifying module and Node binary version dependencies in a .ndistro file.
3) Node.js can be compiled from source by cloning the Node.js repository via git or downloading the source, running configuration, make, and make install commands.
The document discusses advanced Android threading concepts including:
1. The main thread is responsible for UI rendering and user interactions. Blocking it can cause app jank and ANRs.
2. Additional threads can be created using Thread or Runnable classes and started to offload work.
3. The Handler, Looper, and MessageQueue classes provide an asynchronous messaging system for communication between threads without blocking. A Looper dispatches messages that are sent via a Handler.
The Ring programming language version 1.10 book - Part 13 of 212Mahmoud Samir Fayed
Ring 1.6 includes several new features such as a new Ring2EXE tool to distribute applications, improved support for Android development using RingQt, and a Folder2qrc tool to simplify adding resources. Other enhancements include updated build scripts, new extensions for console colors and hashing, and various improvements to components like the standard library, Ring Notepad, and RingQt.
- Python allows programmers to write multithreaded programs that run multiple threads concurrently for more efficient use of resources and responsiveness.
- The main benefits of multithreading over multiple processes are that threads within a process can share data and resources more easily. Threads also have less memory overhead than processes.
- There are two main modules for multithreading in Python - the older thread module and the newer threading module, which provides more powerful features and methods for managing threads.
There is hardly a Senior Java developer who has never heard of sun.misc.Unsafe. Though it has always been a private API intended for JDK internal use only, the popularity of Unsafe has grown too fast, and now it is used in many open-source projects. OK.RU is not an exception: its software also heavily relies on Unsafe APIs.
During this session we'll try to understand what is so attractive about Unsafe. Why do people keep using it regardless the warnings of removal from future JDK releases? Are there any safe alternatives to private API or is it absolutely vital? We will review the typical cases when Java developers prefer to go unsafe and discuss major benefits and the drawbacks of it. The report will be supported by the real examples from OK.RU experience.
The Ring programming language version 1.5.1 book - Part 44 of 180Mahmoud Samir Fayed
This chapter discusses using the Allegro game programming library in Ring applications. It shows how to load the Allegro library, initialize it, and create a display. Examples are provided for drawing objects, animating their movement, and getting input from the keyboard and mouse. Key functions covered include al_init(), al_create_display(), al_draw_bitmap(), al_flip_display(), al_rest(), al_load_bitmap(), al_register_event_source(), al_wait_for_event(), and checking keyboard and mouse input. The chapter also discusses using classes for graphics and games programming with Allegro in Ring.
The document summarizes the current state of coroutines in Kotlin. Coroutines allow writing asynchronous, non-blocking code in a sequential style by suspending execution until operations complete. Key features include launch and async for starting coroutines, channels for communication, actors for message processing, and integration with frameworks like RxJava. Coroutines are ready for production use but still experimental to allow API changes in future versions.
The Ring programming language version 1.5.2 book - Part 39 of 181Mahmoud Samir Fayed
The document describes how to create web applications using the Ring programming language and CGI library. It provides examples of:
1. Configuring the Apache web server to support Ring CGI scripts with the .ring extension.
2. A simple "Hello World" CGI program written in Ring that outputs HTML.
3. Using the Web library to simplify CGI development with features like generating HTML, handling HTTP requests, and templates.
4. An example that builds a web form for collecting user data and handles HTTP GET requests. It demonstrates various HTML form elements like textboxes, listboxes, and edit boxes.
Distributed systems have several advantages including resource sharing, increased computation speed through parallel processing, and reliability through independent memory in each processor. There are different types of distributed operating systems based on how data, computations, or processes are transferred between sites. Mutual exclusion in distributed systems aims to ensure that only one process executes in the critical section at a time, while still allowing every request to enter and exit to eventually be granted. This can be achieved through centralized, distributed, or token passing approaches.
A multithreaded program allows two or more parts of the same program, called threads, to run concurrently. Each thread defines a separate path of execution and threads are lightweight processes that can run independently and share resources such as memory. The document discusses thread creation in Java using the Thread class and Runnable interface, thread life cycle and states, thread priorities, synchronization, and interthread communication using wait(), notify(), and notifyAll() methods.
The document provides an overview of Groovy and Java code examples for performing common tasks like printing "Hello World", reading files, making web requests, using strings, importing packages, and using Swing/SwingBuilder for GUIs. It also shows examples of using Groovy with Java libraries for Excel files, Ant, and JSON. Additional sections cover parallel processing with GPars, contract programming with GContracts, method chaining, Grails basics, and Gaelyk controllers and views.
JCConf 2015 - 輕鬆學google的雲端開發 - Google App Engine入門(上)Simon Su
The document discusses Google App Engine and provides an introduction to developing cloud applications on Google App Engine. It covers topics like the Google App Engine development environment, data storage using Datastore, querying data, task queues, cron jobs, and other Google Cloud Platform services like Cloud SQL, Cloud Storage, and authentication. Code examples are provided to demonstrate common operations in Google App Engine like storing, querying and retrieving entity data from Datastore.
The Ring programming language version 1.9 book - Part 11 of 210Mahmoud Samir Fayed
The document outlines the new features in Ring 1.9, including a new Load Package command to load libraries in new scopes, improved ringvm_see() and ringvm_give() functions, better trace library and debugging support, updated RingQt classes, and a new RingLibuv extension for multi-platform asynchronous I/O.
In this talk I presented three important topics in Kotlin Standard Library: Scope Functions (let, apply, also, run and with); Annotations (Deprecated, Experimental, Jvm*, DslMarker); and Delegates (lazy, vetoable, observable)
The Ring programming language version 1.8 book - Part 9 of 202Mahmoud Samir Fayed
Ring Documentation, Release 1.8 details the new features and changes in Ring 1.8, including a new Load Package command to load libraries in new global scopes, improved ringvm_see() and ringvm_give() functions, better trace library and debugging support, and a new RingLibuv extension for multi-platform asynchronous I/O.
Understanding Source Code Differences by Separating Refactoring EffectsShinpei Hayashi
The document discusses separating refactoring effects from source code differences by describing refactoring changes that were made between versions of code. It provides an example of refactoring changes made between two versions of code, including renaming a class and parameters, deleting a for-loop, commenting out code, and renaming a method. The example highlights how refactoring can introduce differences that are not actual behavior changes.
The Ring programming language version 1.5.2 book - Part 13 of 181Mahmoud Samir Fayed
Ring 1.5.2 introduces new features for using operators like '<' and ':' as the 'from' keyword in class definitions. It also provides functions for embedding Ring code in Ring programs without sharing state between instances, allowing Ring code to be executed safely and with isolated environments. The documentation also describes the RingZip library for working with zip files, and the Form Designer tool for building GUI applications visually.
This document discusses several popular Java libraries including:
- Dependency injection frameworks like Guice and Spring
- Logging with SLF4J
- Collections and utilities with Guava
- HTTP clients like OkHttp
- Reactive programming with RxJava
- REST with Retrofit
- Asynchronous programming with JDeferred
- Event handling with MBassador
- Code generation with Lombok and ByteBuddy
- Testing utilities like JUnitParams, Mockito, Jukito, and Spock
- Waiting assertions with Awaitility and REST testing with Rest-assured.
Magic Clusters and Where to Find Them 2.0 - Eugene Pirogov Elixir Club
The document discusses clustering in Erlang and Elixir. It defines a cluster as a set of connected computers that work together. It describes different types of clusters and how to start nodes, connect nodes, send messages between nodes, and call functions remotely. It provides examples of monitoring nodes, pinging nodes, and getting node names. Distributed nodes running on different hosts can be connected by configuring /etc/hosts and ~/.hosts.erlang. Libraries like bitwalker/swarm and bitwalker/libcluster can help with clustering worker processes.
This document contains Swift code for testing a HTTP request to an API using the Alamofire and Mockingjay libraries. It defines a test spec class with a describe block for "hoge" and a context block for "fuga". Within the "fuga" context, a beforeEach stub is set up to mock API responses from the "hogefugapiyo.com" domain. The single "piyo" test makes a request, asserts the response is not nil, and prints the results.
The Ring programming language version 1.5.3 book - Part 85 of 184Mahmoud Samir Fayed
The document describes various command line options in Ring for printing tokens, grammar rules, intermediate byte code, final byte code, and more. It provides an example of using the "-tokens" option to print all tokens in a Ring source code file without executing the code.
Everyone knows Python's basic datatypes and their most common containers (list, tuple, dict and set).
However, few people know that they should use a deque to implement a queue, that using defaultdict their code would be cleaner and that they could be a bit more efficient using namedtuples instead of creating new classes.
This talk will review the data structures of Python's "collections" module of the standard library (namedtuple, deque, Counter, defaultdict and OrderedDict) and we will also compare them with the built-in basic datatypes.
The Ring programming language version 1.7 book - Part 52 of 196Mahmoud Samir Fayed
This chapter discusses using different programming paradigms together in a game engine project for 2D games. The project layers include a games layer using declarative programming, game engine classes using object-oriented programming, a graphics library interface using procedural programming, and graphics library bindings. It mentions the RingAllegro and RingLibSDL libraries that provide bindings to the Allegro and SDL graphics libraries by generating over 10,000 lines of C code from configuration files. This allows accessing the libraries' functions from Ring code in a similar way to C.
The Ring programming language version 1.10 book - Part 102 of 212Mahmoud Samir Fayed
This document discusses Ring's architecture and memory management.
Ring applications are written in Ring and use Ring libraries and extensions. Ring libraries are written in Ring, while extensions are dynamic libraries written in C/C++ that interface with the Ring Virtual Machine (VM). The VM is written in C and runs on the host operating system.
Ring uses scope-based memory management. When a function is called, a new scope is created. Variables declared within the function exist only within this scope and are destroyed when the function exits. Ring also uses reference counting for memory management of objects.
- Python allows programmers to write multithreaded programs that run multiple threads concurrently for more efficient use of resources and responsiveness.
- The main benefits of multithreading over multiple processes are that threads within a process can share data and resources more easily. Threads also have less memory overhead than processes.
- There are two main modules for multithreading in Python - the older thread module and the newer threading module, which provides more powerful features and methods for managing threads.
There is hardly a Senior Java developer who has never heard of sun.misc.Unsafe. Though it has always been a private API intended for JDK internal use only, the popularity of Unsafe has grown too fast, and now it is used in many open-source projects. OK.RU is not an exception: its software also heavily relies on Unsafe APIs.
During this session we'll try to understand what is so attractive about Unsafe. Why do people keep using it regardless the warnings of removal from future JDK releases? Are there any safe alternatives to private API or is it absolutely vital? We will review the typical cases when Java developers prefer to go unsafe and discuss major benefits and the drawbacks of it. The report will be supported by the real examples from OK.RU experience.
The Ring programming language version 1.5.1 book - Part 44 of 180Mahmoud Samir Fayed
This chapter discusses using the Allegro game programming library in Ring applications. It shows how to load the Allegro library, initialize it, and create a display. Examples are provided for drawing objects, animating their movement, and getting input from the keyboard and mouse. Key functions covered include al_init(), al_create_display(), al_draw_bitmap(), al_flip_display(), al_rest(), al_load_bitmap(), al_register_event_source(), al_wait_for_event(), and checking keyboard and mouse input. The chapter also discusses using classes for graphics and games programming with Allegro in Ring.
The document summarizes the current state of coroutines in Kotlin. Coroutines allow writing asynchronous, non-blocking code in a sequential style by suspending execution until operations complete. Key features include launch and async for starting coroutines, channels for communication, actors for message processing, and integration with frameworks like RxJava. Coroutines are ready for production use but still experimental to allow API changes in future versions.
The Ring programming language version 1.5.2 book - Part 39 of 181Mahmoud Samir Fayed
The document describes how to create web applications using the Ring programming language and CGI library. It provides examples of:
1. Configuring the Apache web server to support Ring CGI scripts with the .ring extension.
2. A simple "Hello World" CGI program written in Ring that outputs HTML.
3. Using the Web library to simplify CGI development with features like generating HTML, handling HTTP requests, and templates.
4. An example that builds a web form for collecting user data and handles HTTP GET requests. It demonstrates various HTML form elements like textboxes, listboxes, and edit boxes.
Distributed systems have several advantages including resource sharing, increased computation speed through parallel processing, and reliability through independent memory in each processor. There are different types of distributed operating systems based on how data, computations, or processes are transferred between sites. Mutual exclusion in distributed systems aims to ensure that only one process executes in the critical section at a time, while still allowing every request to enter and exit to eventually be granted. This can be achieved through centralized, distributed, or token passing approaches.
A multithreaded program allows two or more parts of the same program, called threads, to run concurrently. Each thread defines a separate path of execution and threads are lightweight processes that can run independently and share resources such as memory. The document discusses thread creation in Java using the Thread class and Runnable interface, thread life cycle and states, thread priorities, synchronization, and interthread communication using wait(), notify(), and notifyAll() methods.
The document provides an overview of Groovy and Java code examples for performing common tasks like printing "Hello World", reading files, making web requests, using strings, importing packages, and using Swing/SwingBuilder for GUIs. It also shows examples of using Groovy with Java libraries for Excel files, Ant, and JSON. Additional sections cover parallel processing with GPars, contract programming with GContracts, method chaining, Grails basics, and Gaelyk controllers and views.
JCConf 2015 - 輕鬆學google的雲端開發 - Google App Engine入門(上)Simon Su
The document discusses Google App Engine and provides an introduction to developing cloud applications on Google App Engine. It covers topics like the Google App Engine development environment, data storage using Datastore, querying data, task queues, cron jobs, and other Google Cloud Platform services like Cloud SQL, Cloud Storage, and authentication. Code examples are provided to demonstrate common operations in Google App Engine like storing, querying and retrieving entity data from Datastore.
The Ring programming language version 1.9 book - Part 11 of 210Mahmoud Samir Fayed
The document outlines the new features in Ring 1.9, including a new Load Package command to load libraries in new scopes, improved ringvm_see() and ringvm_give() functions, better trace library and debugging support, updated RingQt classes, and a new RingLibuv extension for multi-platform asynchronous I/O.
In this talk I presented three important topics in Kotlin Standard Library: Scope Functions (let, apply, also, run and with); Annotations (Deprecated, Experimental, Jvm*, DslMarker); and Delegates (lazy, vetoable, observable)
The Ring programming language version 1.8 book - Part 9 of 202Mahmoud Samir Fayed
Ring Documentation, Release 1.8 details the new features and changes in Ring 1.8, including a new Load Package command to load libraries in new global scopes, improved ringvm_see() and ringvm_give() functions, better trace library and debugging support, and a new RingLibuv extension for multi-platform asynchronous I/O.
Understanding Source Code Differences by Separating Refactoring EffectsShinpei Hayashi
The document discusses separating refactoring effects from source code differences by describing refactoring changes that were made between versions of code. It provides an example of refactoring changes made between two versions of code, including renaming a class and parameters, deleting a for-loop, commenting out code, and renaming a method. The example highlights how refactoring can introduce differences that are not actual behavior changes.
The Ring programming language version 1.5.2 book - Part 13 of 181Mahmoud Samir Fayed
Ring 1.5.2 introduces new features for using operators like '<' and ':' as the 'from' keyword in class definitions. It also provides functions for embedding Ring code in Ring programs without sharing state between instances, allowing Ring code to be executed safely and with isolated environments. The documentation also describes the RingZip library for working with zip files, and the Form Designer tool for building GUI applications visually.
This document discusses several popular Java libraries including:
- Dependency injection frameworks like Guice and Spring
- Logging with SLF4J
- Collections and utilities with Guava
- HTTP clients like OkHttp
- Reactive programming with RxJava
- REST with Retrofit
- Asynchronous programming with JDeferred
- Event handling with MBassador
- Code generation with Lombok and ByteBuddy
- Testing utilities like JUnitParams, Mockito, Jukito, and Spock
- Waiting assertions with Awaitility and REST testing with Rest-assured.
Magic Clusters and Where to Find Them 2.0 - Eugene Pirogov Elixir Club
The document discusses clustering in Erlang and Elixir. It defines a cluster as a set of connected computers that work together. It describes different types of clusters and how to start nodes, connect nodes, send messages between nodes, and call functions remotely. It provides examples of monitoring nodes, pinging nodes, and getting node names. Distributed nodes running on different hosts can be connected by configuring /etc/hosts and ~/.hosts.erlang. Libraries like bitwalker/swarm and bitwalker/libcluster can help with clustering worker processes.
This document contains Swift code for testing a HTTP request to an API using the Alamofire and Mockingjay libraries. It defines a test spec class with a describe block for "hoge" and a context block for "fuga". Within the "fuga" context, a beforeEach stub is set up to mock API responses from the "hogefugapiyo.com" domain. The single "piyo" test makes a request, asserts the response is not nil, and prints the results.
The Ring programming language version 1.5.3 book - Part 85 of 184Mahmoud Samir Fayed
The document describes various command line options in Ring for printing tokens, grammar rules, intermediate byte code, final byte code, and more. It provides an example of using the "-tokens" option to print all tokens in a Ring source code file without executing the code.
Everyone knows Python's basic datatypes and their most common containers (list, tuple, dict and set).
However, few people know that they should use a deque to implement a queue, that using defaultdict their code would be cleaner and that they could be a bit more efficient using namedtuples instead of creating new classes.
This talk will review the data structures of Python's "collections" module of the standard library (namedtuple, deque, Counter, defaultdict and OrderedDict) and we will also compare them with the built-in basic datatypes.
The Ring programming language version 1.7 book - Part 52 of 196Mahmoud Samir Fayed
This chapter discusses using different programming paradigms together in a game engine project for 2D games. The project layers include a games layer using declarative programming, game engine classes using object-oriented programming, a graphics library interface using procedural programming, and graphics library bindings. It mentions the RingAllegro and RingLibSDL libraries that provide bindings to the Allegro and SDL graphics libraries by generating over 10,000 lines of C code from configuration files. This allows accessing the libraries' functions from Ring code in a similar way to C.
The Ring programming language version 1.10 book - Part 102 of 212Mahmoud Samir Fayed
This document discusses Ring's architecture and memory management.
Ring applications are written in Ring and use Ring libraries and extensions. Ring libraries are written in Ring, while extensions are dynamic libraries written in C/C++ that interface with the Ring Virtual Machine (VM). The VM is written in C and runs on the host operating system.
Ring uses scope-based memory management. When a function is called, a new scope is created. Variables declared within the function exist only within this scope and are destroyed when the function exits. Ring also uses reference counting for memory management of objects.
The Ring programming language version 1.9 book - Part 57 of 210Mahmoud Samir Fayed
The document describes using the RingLibuv library to create a server-client application in Ring. It shows how to initialize the event loop, set up a TCP server that listens for connections and handles reading and writing of data. Client code is also provided that connects to the server and exchanges messages. The example is refactored using classes to organize the server code.
The Ring programming language version 1.7 book - Part 92 of 196Mahmoud Samir Fayed
The document provides information about the Ring programming language including language keywords, functions, compiler errors, runtime errors, and environment errors.
It lists the 49 keywords used in Ring such as class, def, else, func, if, new, etc. It also lists 199 language functions organized alphabetically from add() to ring_state_setvar().
26 potential compiler errors are described that may occur during compilation such as errors in parameters, class names, missing brackets or parentheses. 15 runtime errors are also listed that could happen during execution like divide by zero, out of bounds array access, or calling undefined functions.
The document serves as a reference for the core components of the Ring language specification including the syntax rules
The Ring programming language version 1.5.2 book - Part 10 of 181Mahmoud Samir Fayed
The Natural Library allows defining languages that contain natural language commands in a text file. It parses the text file to understand commands written in English, Arabic, or other languages. This enables "natural programming" where programs can be written and understood using natural languages. For example, commands like "say hello" or "count from 1 to 5" in a text file can be parsed and executed by a program written in Ring using this library. The goal of natural languages for programming has existed, and Ring provides an innovative solution through the Natural Library.
The Ring programming language version 1.10 book - Part 90 of 212Mahmoud Samir Fayed
This document discusses how to distribute Ring applications using Ring2EXE, a tool for compiling Ring code into executable applications.
Ring2EXE takes a Ring source file as input and generates executable files for Windows, Linux, macOS, and mobile platforms. It works by first compiling the Ring code to an object file, embedding that into a C source file, and then using a C compiler to build an executable.
The document provides examples of using Ring2EXE to distribute simple console and GUI applications using Ring libraries like Allegro and Qt. It also describes options for controlling library inclusion, compiler selection, and preparing mobile projects.
The Ring programming language version 1.5.3 book - Part 189 of 194Mahmoud Samir Fayed
This document provides information about the Ring programming language including its keywords, built-in functions, compiler errors, runtime errors, and language grammar.
It lists 49 keywords used in the Ring language. It also lists 197 built-in functions included in Ring for working with strings, files, math, dates, objects and more.
26 possible compiler errors are described that may occur during compilation. 21 runtime errors that can happen during execution are also detailed.
The document concludes by mentioning the language follows certain grammar rules and the virtual machine uses specific instructions to run Ring code.
The Ring programming language version 1.5.4 book - Part 14 of 185Mahmoud Samir Fayed
Ring 1.2 includes several new features and improvements, such as new functions, better support for natural language programming, improved RingQt and RingNotepad functionality, and the ability to generate and execute Ring object files. Some key changes include new comparison and list functions, enhanced GUI library support, improved syntax flexibility, and overall better quality and stability.
The Ring programming language version 1.5.4 book - Part 15 of 185Mahmoud Samir Fayed
1. Clone the Ring source code repository from GitHub.
2. Run build scripts to compile the Ring compiler/VM and extensions like RingODBC, RingMySQL, etc.
3. Generate and build code for extensions that interface with external libraries like RingQt and RingAllegro.
4. Add the Ring bin directory to the system PATH so Ring can be run from any location.
5. Run a sample Ring application like the Ring Notepad to test the build.
The Ring programming language version 1.3 book - Part 8 of 88Mahmoud Samir Fayed
This document provides instructions for building Ring from source code on different platforms, including Windows, Linux, and macOS. It describes how to obtain the Ring source code from GitHub, install any required libraries, generate code for Ring extensions, and build the Ring compiler and virtual machine. The document also notes that Ring is open source under the MIT license and welcomes community contributions in areas like documentation, testing, samples, applications, editor support, libraries, and the compiler/VM code itself.
The Ring programming language version 1.5.3 book - Part 14 of 184Mahmoud Samir Fayed
Ring 1.1 includes several new features and improvements such as better support for natural language programming, the ability to generate and execute Ring object files, more flexible syntax options for input/output and control structures, new functions in the standard library, and demo projects for game development. It also improves the code generator for extensions and allows attributes to be defined within class regions and method braces. The documentation is also improved.
The Ring programming language version 1.5.2 book - Part 176 of 181Mahmoud Samir Fayed
This document provides code examples for connecting to different database file types like dBase (.dbf) files and Visual FoxPro databases using the ODBC interface in Ring. It shows how to initialize an ODBC connection, execute queries to select data, fetch rows and retrieve column values. It also discusses how Ring supports multiple programming paradigms and why method calls can't be used directly in event handlers like setClickEvent().
The Ring programming language version 1.4 book - Part 3 of 30Mahmoud Samir Fayed
This document summarizes the new features and changes in Ring 1.4. It describes improvements to the Ring Notepad including using QPlainTextEdit, displaying line numbers, and auto-complete functions. It also discusses new features for the Emacs editor, updated standard library functions, changes to the Loop|Exit command, and new functions like PackageName() and Swap(). Additional sections cover classes returning by reference, using < and : operators as 'from', embedding Ring code without shared state, the new RingZip library, and the included Form Designer.
The Ring programming language version 1.7 book - Part 8 of 196Mahmoud Samir Fayed
Ring 1.6 includes many new features and improvements, including:
1. A new Employee application example.
2. An updated Ring2EXE tool to distribute applications without a C/C++ compiler.
3. Improved support for RingQt Android applications using a single .ringo file rather than multiple .ring files.
4. A new Folder2qrc tool to automatically add files to Android resource files for RingQt mobile applications.
5. Updated build scripts supporting more platforms like Windows, Linux, and macOS.
6. New extensions for console colors and MurmurHash.
7. Enhancements to the Ring Notepad, VM, REPL, and standard libraries.
The Ring programming language version 1.8 book - Part 18 of 202Mahmoud Samir Fayed
Ring 1.1 includes several new features and improvements:
1) It adds better support for natural language programming by allowing methods to be called when expressions are evaluated.
2) It enables generating and executing Ring object files (.ringo) for distributing applications without source code.
3) It provides more flexibility in syntax, including optional styles for I/O, control structures, and language keywords/operators.
4) New functions and changes include stdlib functions written in Ring, RingLibSDL game engine demo, and RingSQLite.
5) Improvements to code generation for extensions, class attributes, nested method attributes, and documentation.
The Ring programming language version 1.5.4 book - Part 180 of 185Mahmoud Samir Fayed
This document provides code examples for connecting to different database file formats like dBase (.dbf) files and Visual FoxPro databases using the ODBC interface in Ring. It shows how to initialize an ODBC connection, execute queries to select data, fetch rows and retrieve column values. It also discusses how Ring supports multiple programming paradigms and why method calls may require a string of code rather than direct invocation. Additional examples demonstrate how to properly define functions and classes to avoid "function without definition" errors.
The Ring programming language version 1.6 book - Part 7 of 189Mahmoud Samir Fayed
Ring 1.6 includes several new features and improvements, such as an employee application, a new tool called Ring2EXE for distributing Ring applications, and better support for Ring on Android and mobile devices using RingQt. It also includes new tools like Folder2qrc for adding files to Qt resource files, extensions like RingConsoleColors and RingMurmurHash, and various improvements to the standard library, virtual machine, REPL, and build scripts.
The Ring programming language version 1.10 book - Part 12 of 212Mahmoud Samir Fayed
The document summarizes the changes and new features in Ring 1.10. Key points include:
1. Better behavior for displaying window properties when changing selected objects.
2. New buttons added to move and resize multiple selections.
3. Added button to select layouts in window properties.
4. Opening forms and switching files is faster.
The Ring programming language version 1.3 book - Part 7 of 88Mahmoud Samir Fayed
Ring 1.3 includes improvements to RingQt classes, the Objects library, LibCurl, and other features. Better RingQt classes allow getting event information and enabling/disabling events. The updated Objects library manages GUI objects and provides a natural API for creating windows from classes. RingLibCurl adds functions wrapping LibCurl. Other enhancements include better support for calling methods from object attributes, displaying compiler warnings, and code quality improvements.
The Ring programming language version 1.9 book - Part 20 of 210Mahmoud Samir Fayed
Ring 1.1 includes several new features and changes that improve the language. It introduces better support for natural language programming, the ability to generate and execute Ring object files, more flexible syntax options for I/O and control structures, new functions in the standard library, and libraries like RingLibSDL and RingSQLite. The documentation is also improved. Key updates include generating executable files without source code, calling methods from expressions, alternative syntax styles, and functions/classes written directly in Ring.
Similar to The Ring programming language version 1.10 book - Part 59 of 212 (20)
The Ring programming language version 1.10 book - Part 212 of 212Mahmoud Samir Fayed
This document summarizes new features and changes in different versions of the Ring programming language and library. It discusses various topics including using different syntax styles and code editors, developing graphical desktop and mobile applications using RingQt, and using Ring for 3D graphics and games development. The document also provides overviews of the core Ring libraries and language features.
The Ring programming language version 1.10 book - Part 211 of 212Mahmoud Samir Fayed
This document provides documentation for the Ring programming language and various Ring extensions and libraries. It includes sections on Ring mode for Emacs editor, the Ring Notepad IDE, the Ring Package Manager (RingPM), embedding Ring code in C/C++ programs, and references for the functions and classes of various Ring extensions for areas like 2D/3D graphics, networking, multimedia and more.
The Ring programming language version 1.10 book - Part 210 of 212Mahmoud Samir Fayed
This document contains summaries of various Ring classes, functions and concepts:
- It describes Ring classes like the Map, Math, MySQL, and PostgreSQL classes.
- It lists and briefly explains Ring standard library functions such as map(), random(), newlist(), and print().
- It covers Ring concepts and features like object oriented programming, operators, files and I/O, GUI programming, and web development.
The Ring programming language version 1.10 book - Part 208 of 212Mahmoud Samir Fayed
This document provides a summary of functions in the Ring documentation for Release 1.10. It lists functions for drawing quadrics, normals, orientation, and textures. It also lists functions for scaling images, drawing spheres, starting and ending contours and polygons for tessellation, setting tessellation normals and properties, adding tessellation vertices, and unprojecting coordinates. The document also provides resources for the Ring language like the website, source code repository, contact information, and lists Arabic language resources.
The Ring programming language version 1.10 book - Part 207 of 212Mahmoud Samir Fayed
This document contains listings of over 100 OpenGL functions related to lighting, materials, textures, and rendering. The functions listed specify parameters for lights, materials, texture coordinates, and rendering operations like clearing buffers and drawing primitives.
The Ring programming language version 1.10 book - Part 205 of 212Mahmoud Samir Fayed
This document lists numerous OpenGL constants and enumerations related to textures, blending, shaders, buffers, and other graphics features. It includes constants for texture types and formats, shader variable types, buffer bindings and usages, and more. The listing contains over 200 individual constants and enumerations without descriptions.
The Ring programming language version 1.10 book - Part 206 of 212Mahmoud Samir Fayed
The document lists OpenGL functions and constants added in version 1.10 of the OpenGL specification. It includes over 100 functions and constants for features such as unsigned integer textures, texture buffers, geometry shaders, transform feedback, and more robust context handling.
The Ring programming language version 1.10 book - Part 203 of 212Mahmoud Samir Fayed
The document contains a list of functions and constants related to OpenGL graphics functionality. It includes functions for vertex specification, texture mapping, tessellation, nurbs modeling, quadric surfaces, and more. It also includes constants for OpenGL states, modes, and error codes.
The Ring programming language version 1.10 book - Part 202 of 212Mahmoud Samir Fayed
The document lists over 100 OpenGL functions for querying and retrieving information about OpenGL objects, state, and errors. Some of the functions listed include glGetError() to retrieve OpenGL error codes, glGetUniformLocation() to retrieve the location of a uniform variable in a program, and glGetString() to retrieve version and extension information.
The Ring programming language version 1.10 book - Part 201 of 212Mahmoud Samir Fayed
The document lists various OpenGL constants and functions related to OpenGL graphics functionality. It includes constants for texture and color formats, clipping planes, buffer objects, shader operations, and more. It also lists over 100 OpenGL function declarations for operations like drawing, clearing, texture handling, blending, and shader manipulation.
The Ring programming language version 1.10 book - Part 200 of 212Mahmoud Samir Fayed
This document lists numerous OpenGL constants related to graphics hardware capabilities, state variables, and functions. It includes constants for vertex arrays, texture mapping, blending, multisampling, shader types, and more. The constants are used to query and set the state and capabilities of the OpenGL graphics processing context.
The Ring programming language version 1.10 book - Part 199 of 212Mahmoud Samir Fayed
The document lists over 200 OpenGL constants related to graphics rendering features such as fog, depth testing, blending, textures, and more. It provides the names of constants for configuring various graphics pipeline states and settings in OpenGL.
The Ring programming language version 1.10 book - Part 198 of 212Mahmoud Samir Fayed
The document contains listings of over 100 OpenGL and GLU function declarations related to texture coordinates, uniforms, vertex specification, and tessellation. It provides the function name, return type if any, and parameters for each function for specifying texture coordinates, uniforms, vertices and performing tessellation in OpenGL and GLU.
The Ring programming language version 1.10 book - Part 197 of 212Mahmoud Samir Fayed
The document contains documentation for over 100 OpenGL functions related to rendering, textures, shaders, and more. It lists each function name and its parameters. The functions allow specifying colors, textures, shader programs, and various rendering states and operations in OpenGL.
The Ring programming language version 1.10 book - Part 196 of 212Mahmoud Samir Fayed
This document lists OpenGL constants and functions related to graphics rendering. It includes constants for buffer types, shader data types, texture types, and more. It also lists function prototypes for common OpenGL operations like drawing, clearing, binding textures and buffers, and setting shader uniforms.
The Ring programming language version 1.10 book - Part 195 of 212Mahmoud Samir Fayed
The document lists over 200 OpenGL constants related to textures, vertex arrays, blending, and buffer objects. It provides reference documentation for OpenGL version 1.10 including constants for texture formats and parameters, vertex attribute types, blending functions, and buffer usage flags.
The Ring programming language version 1.10 book - Part 194 of 212Mahmoud Samir Fayed
The document lists various constants used in OpenGL such as GL_FOG_BIT, GL_DEPTH_BUFFER_BIT, GL_ACCUM, and others related to OpenGL rendering, blending, textures, lighting, and more. It provides definitions for OpenGL enums and related values.
The Ring programming language version 1.10 book - Part 193 of 212Mahmoud Samir Fayed
This document lists over 100 OpenGL functions for specifying textures, lighting, shaders, and other graphics operations. The functions include glMultiTexCoord2iv() for specifying texture coordinates, glNormal3f() for specifying normals, and glUniform1f() for specifying shader uniforms.
The Ring programming language version 1.10 book - Part 192 of 212Mahmoud Samir Fayed
This document lists OpenGL functions and constants that were added or changed in OpenGL version 1.10. It includes over 150 new OpenGL constants for features such as geometry shaders, transform feedback, cube map arrays, and more. It also lists over 80 OpenGL functions, providing their parameters and types.
What to do when you have a perfect model for your software but you are constrained by an imperfect business model?
This talk explores the challenges of bringing modelling rigour to the business and strategy levels, and talking to your non-technical counterparts in the process.
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...kalichargn70th171
In today's fiercely competitive mobile app market, the role of the QA team is pivotal for continuous improvement and sustained success. Effective testing strategies are essential to navigate the challenges confidently and precisely. Ensuring the perfection of mobile apps before they reach end-users requires thoughtful decisions in the testing plan.
Superpower Your Apache Kafka Applications Development with Complementary Open...Paul Brebner
Kafka Summit talk (Bangalore, India, May 2, 2024, https://events.bizzabo.com/573863/agenda/session/1300469 )
Many Apache Kafka use cases take advantage of Kafka’s ability to integrate multiple heterogeneous systems for stream processing and real-time machine learning scenarios. But Kafka also exists in a rich ecosystem of related but complementary stream processing technologies and tools, particularly from the open-source community. In this talk, we’ll take you on a tour of a selection of complementary tools that can make Kafka even more powerful. We’ll focus on tools for stream processing and querying, streaming machine learning, stream visibility and observation, stream meta-data, stream visualisation, stream development including testing and the use of Generative AI and LLMs, and stream performance and scalability. By the end you will have a good idea of the types of Kafka “superhero” tools that exist, which are my favourites (and what superpowers they have), and how they combine to save your Kafka applications development universe from swamploads of data stagnation monsters!
The Power of Visual Regression Testing_ Why It Is Critical for Enterprise App...kalichargn70th171
Visual testing plays a vital role in ensuring that software products meet the aesthetic requirements specified by clients in functional and non-functional specifications. In today's highly competitive digital landscape, users expect a seamless and visually appealing online experience. Visual testing, also known as automated UI testing or visual regression testing, verifies the accuracy of the visual elements that users interact with.
Consistent toolbox talks are critical for maintaining workplace safety, as they provide regular opportunities to address specific hazards and reinforce safe practices.
These brief, focused sessions ensure that safety is a continual conversation rather than a one-time event, which helps keep safety protocols fresh in employees' minds. Studies have shown that shorter, more frequent training sessions are more effective for retention and behavior change compared to longer, infrequent sessions.
Engaging workers regularly, toolbox talks promote a culture of safety, empower employees to voice concerns, and ultimately reduce the likelihood of accidents and injuries on site.
The traditional method of conducting safety talks with paper documents and lengthy meetings is not only time-consuming but also less effective. Manual tracking of attendance and compliance is prone to errors and inconsistencies, leading to gaps in safety communication and potential non-compliance with OSHA regulations. Switching to a digital solution like Safelyio offers significant advantages.
Safelyio automates the delivery and documentation of safety talks, ensuring consistency and accessibility. The microlearning approach breaks down complex safety protocols into manageable, bite-sized pieces, making it easier for employees to absorb and retain information.
This method minimizes disruptions to work schedules, eliminates the hassle of paperwork, and ensures that all safety communications are tracked and recorded accurately. Ultimately, using a digital platform like Safelyio enhances engagement, compliance, and overall safety performance on site. https://safelyio.com/
Ensuring Efficiency and Speed with Practical Solutions for Clinical OperationsOnePlan Solutions
Clinical operations professionals encounter unique challenges. Balancing regulatory requirements, tight timelines, and the need for cross-functional collaboration can create significant internal pressures. Our upcoming webinar will introduce key strategies and tools to streamline and enhance clinical development processes, helping you overcome these challenges.
Building API data products on top of your real-time data infrastructureconfluent
This talk and live demonstration will examine how Confluent and Gravitee.io integrate to unlock value from streaming data through API products.
You will learn how data owners and API providers can document, secure data products on top of Confluent brokers, including schema validation, topic routing and message filtering.
You will also see how data and API consumers can discover and subscribe to products in a developer portal, as well as how they can integrate with Confluent topics through protocols like REST, Websockets, Server-sent Events and Webhooks.
Whether you want to monetize your real-time data, enable new integrations with partners, or provide self-service access to topics through various protocols, this webinar is for you!
Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...Paul Brebner
Closing talk for the Performance Engineering track at Community Over Code EU (Bratislava, Slovakia, June 5 2024) https://eu.communityovercode.org/sessions/2024/why-apache-kafka-clusters-are-like-galaxies-and-other-cosmic-kafka-quandaries-explored/ Instaclustr (now part of NetApp) manages 100s of Apache Kafka clusters of many different sizes, for a variety of use cases and customers. For the last 7 years I’ve been focused outwardly on exploring Kafka application development challenges, but recently I decided to look inward and see what I could discover about the performance, scalability and resource characteristics of the Kafka clusters themselves. Using a suite of Performance Engineering techniques, I will reveal some surprising discoveries about cosmic Kafka mysteries in our data centres, related to: cluster sizes and distribution (using Zipf’s Law), horizontal vs. vertical scalability, and predicting Kafka performance using metrics, modelling and regression techniques. These insights are relevant to Kafka developers and operators.
Mobile App Development Company In Noida | Drona InfotechDrona Infotech
React.js, a JavaScript library developed by Facebook, has gained immense popularity for building user interfaces, especially for single-page applications. Over the years, React has evolved and expanded its capabilities, becoming a preferred choice for mobile app development. This article will explore why React.js is an excellent choice for the Best Mobile App development company in Noida.
Visit Us For Information: https://www.linkedin.com/pulse/what-makes-reactjs-stand-out-mobile-app-development-rajesh-rai-pihvf/
14 th Edition of International conference on computer visionShulagnaSarkar2
About the event
14th Edition of International conference on computer vision
Computer conferences organized by ScienceFather group. ScienceFather takes the privilege to invite speakers participants students delegates and exhibitors from across the globe to its International Conference on computer conferences to be held in the Various Beautiful cites of the world. computer conferences are a discussion of common Inventions-related issues and additionally trade information share proof thoughts and insight into advanced developments in the science inventions service system. New technology may create many materials and devices with a vast range of applications such as in Science medicine electronics biomaterials energy production and consumer products.
Nomination are Open!! Don't Miss it
Visit: computer.scifat.com
Award Nomination: https://x-i.me/ishnom
Conference Submission: https://x-i.me/anicon
For Enquiry: Computer@scifat.com
Streamlining End-to-End Testing Automation with Azure DevOps Build & Release Pipelines
Automating end-to-end (e2e) test for Android and iOS native apps, and web apps, within Azure build and release pipelines, poses several challenges. This session dives into the key challenges and the repeatable solutions implemented across multiple teams at a leading Indian telecom disruptor, renowned for its affordable 4G/5G services, digital platforms, and broadband connectivity.
Challenge #1. Ensuring Test Environment Consistency: Establishing a standardized test execution environment across hundreds of Azure DevOps agents is crucial for achieving dependable testing results. This uniformity must seamlessly span from Build pipelines to various stages of the Release pipeline.
Challenge #2. Coordinated Test Execution Across Environments: Executing distinct subsets of tests using the same automation framework across diverse environments, such as the build pipeline and specific stages of the Release Pipeline, demands flexible and cohesive approaches.
Challenge #3. Testing on Linux-based Azure DevOps Agents: Conducting tests, particularly for web and native apps, on Azure DevOps Linux agents lacking browser or device connectivity presents specific challenges in attaining thorough testing coverage.
This session delves into how these challenges were addressed through:
1. Automate the setup of essential dependencies to ensure a consistent testing environment.
2. Create standardized templates for executing API tests, API workflow tests, and end-to-end tests in the Build pipeline, streamlining the testing process.
3. Implement task groups in Release pipeline stages to facilitate the execution of tests, ensuring consistency and efficiency across deployment phases.
4. Deploy browsers within Docker containers for web application testing, enhancing portability and scalability of testing environments.
5. Leverage diverse device farms dedicated to Android, iOS, and browser testing to cover a wide range of platforms and devices.
6. Integrate AI technology, such as Applitools Visual AI and Ultrafast Grid, to automate test execution and validation, improving accuracy and efficiency.
7. Utilize AI/ML-powered central test automation reporting server through platforms like reportportal.io, providing consolidated and real-time insights into test performance and issues.
These solutions not only facilitate comprehensive testing across platforms but also promote the principles of shift-left testing, enabling early feedback, implementing quality gates, and ensuring repeatability. By adopting these techniques, teams can effectively automate and execute tests, accelerating software delivery while upholding high-quality standards across Android, iOS, and web applications.
Alluxio Webinar | 10x Faster Trino Queries on Your Data PlatformAlluxio, Inc.
Alluxio Webinar
June. 18, 2024
For more Alluxio Events: https://www.alluxio.io/events/
Speaker:
- Jianjian Xie (Staff Software Engineer, Alluxio)
As Trino users increasingly rely on cloud object storage for retrieving data, speed and cloud cost have become major challenges. The separation of compute and storage creates latency challenges when querying datasets; scanning data between storage and compute tiers becomes I/O bound. On the other hand, cloud API costs related to GET/LIST operations and cross-region data transfer add up quickly.
The newly introduced Trino file system cache by Alluxio aims to overcome the above challenges. In this session, Jianjian will dive into Trino data caching strategies, the latest test results, and discuss the multi-level caching architecture. This architecture makes Trino 10x faster for data lakes of any scale, from GB to EB.
What you will learn:
- Challenges relating to the speed and costs of running Trino in the cloud
- The new Trino file system cache feature overview, including the latest development status and test results
- A multi-level cache framework for maximized speed, including Trino file system cache and Alluxio distributed cache
- Real-world cases, including a large online payment firm and a top ridesharing company
- The future roadmap of Trino file system cache and Trino-Alluxio integration
Transforming Product Development using OnePlan To Boost Efficiency and Innova...OnePlan Solutions
Ready to overcome challenges and drive innovation in your organization? Join us in our upcoming webinar where we discuss how to combat resource limitations, scope creep, and the difficulties of aligning your projects with strategic goals. Discover how OnePlan can revolutionize your product development processes, helping your team to innovate faster, manage resources more effectively, and deliver exceptional results.
2. Ring Documentation, Release 1.10
We will run the client after the server
Testing RingLibuv - Client Side
Client: Start Connection
hello from the client
message from the server to the client
59.5 Server Example Using Classes
Example:
load "libuv.ring"
load "objectslib.ring"
? "Testing RingLibuv - Server Side - Using Classes"
open_object(:MyServer)
class MyServer from ObjectControllerParent
DEFAULT_PORT = 13370
DEFAULT_BACKLOG = 1024
addr = new_sockaddr_in()
server = NULL
client = NULL
myloop = NULL
func start
myloop = uv_default_loop()
server = new_uv_tcp_t()
uv_tcp_init(myloop, server)
uv_ip4_addr("127.0.0.1", DEFAULT_PORT, addr)
uv_tcp_bind(server, addr, 0)
r = uv_listen(server, DEFAULT_BACKLOG, Method(:newconnection) )
if r
? "Listen error " + uv_strerror(r)
return 1
ok
uv_run(myloop, UV_RUN_DEFAULT)
destroy_uv_tcp_t(server)
destroy_uv_sockaddr_in(addr)
func newconnection
? "New Connection"
aPara = uv_Eventpara(server,:connect)
nStatus = aPara[2]
if nStatus < 0
? "New connection error : " + nStatus
return
ok
client = new_uv_tcp_t()
uv_tcp_init(myloop, client)
if uv_accept(server, client) = 0
uv_read_start(client, uv_myalloccallback(),
Method(:echo_read))
ok
59.5. Server Example Using Classes 549
3. Ring Documentation, Release 1.10
func echo_read
aPara = uv_Eventpara(client,:read)
nRead = aPara[2]
buf = aPara[3]
if nRead > 0
req = new_uv_write_t()
wrbuf = uv_buf_init(get_uv_buf_t_base(buf), nread)
uv_write(req, client, wrbuf, 1, Method(:echo_write))
? uv_buf2str(wrbuf)
message = "message from the server to the client"
buf = new_uv_buf_t()
set_uv_buf_t_len(buf,len(message))
set_uv_buf_t_base(buf,varptr("message","char *"))
uv_write(req, client, buf, 1, Method(:echo_write))
ok
func echo_write
aPara = uv_Eventpara(client,:read)
req = aPara[1]
Output:
When we run the client, We will see the message “New Connection”
Then the message “hello from the client”
Testing RingLibuv - Server Side - Using Classes
New Connection
hello from the client
59.6 Client Example Using Classes
Example:
load "libuv.ring"
load "objectslib.ring"
? "Testing RingLibuv - Client Side - Using Classes"
open_object(:MyClient)
Class MyClient from ObjectControllerParent
DEFAULT_PORT = 13370
DEFAULT_BACKLOG = 1024
addr = new_sockaddr_in()
connect = NULL
buffer = null
socket = null
func start
myloop = uv_default_loop()
Socket = new_uv_tcp_t()
connect = new_uv_connect_t()
uv_tcp_init(myloop, Socket)
uv_ip4_addr("127.0.0.1", DEFAULT_PORT, addr)
59.6. Client Example Using Classes 550
4. Ring Documentation, Release 1.10
uv_tcp_connect(connect,Socket, addr, Method(:connect))
uv_run(myloop, UV_RUN_DEFAULT)
destroy_uv_tcp_t(socket)
destroy_uv_connect_t(connect)
func connect
? "Client: Start Connection"
aPara = uv_Eventpara(connect,:connect)
req = aPara[1]
nStatus = aPara[2]
if nStatus = -1
? "Error : on_write_end "
return
ok
buf = new_uv_buf_t()
message = "hello from the client"
set_uv_buf_t_len(buf,len(message))
set_uv_buf_t_base(buf,varptr("message","char *"))
tcp = get_uv_connect_t_handle(req)
write_req = new_uv_write_t()
buf_count = 1
uv_write(write_req, tcp, buf, buf_count, Method(:on_write_end))
func on_write_end
uv_read_start(socket, uv_myalloccallback(), Method(:echo_read))
func echo_read
aPara = uv_Eventpara(socket,:read)
nRead = aPara[2]
buf = aPara[3]
if nRead > 0
wrbuf = uv_buf_init(get_uv_buf_t_base(buf), nread);
? uv_buf2str(wrbuf)
ok
Output:
We will run the client after the server
Testing RingLibuv - Client Side - Using Classes
Client: Start Connection
hello from the client
message from the server to the client
59.7 Threads Example
Example:
load "libuv.ring"
? "Testing RingLibuv - Threads"
func main
one_id = new_uv_thread_t()
two_id = new_uv_thread_t()
uv_thread_create(one_id, "one()")
uv_thread_create(two_id, "two()")
59.7. Threads Example 551
5. Ring Documentation, Release 1.10
uv_thread_join(one_id)
uv_thread_join(two_id)
destroy_uv_thread_t(one_id)
destroy_uv_thread_t(two_id)
func one
? "Message from the First Thread!"
func two
? "Message from the Second Thread!"
Output:
Testing RingLibuv - Threads
Message from the First Thread!
Message from the Second Thread!
59.8 Threads Example - Using Classes
Example:
load "libuv.ring"
load "objectslib.ring"
? "Testing RingLibuv - Threads - Using Classes"
open_object(:MyThreads)
class MyThreads from ObjectControllerParent
func Start
one_id = new_uv_thread_t()
two_id = new_uv_thread_t()
uv_thread_create(one_id, Method(:One))
uv_thread_create(two_id, Method(:Two))
uv_thread_join(one_id)
uv_thread_join(two_id)
destroy_uv_thread_t(one_id)
destroy_uv_thread_t(two_id)
func one
? "Message from the First Thread!"
func Two
? "Message from the Second Thread!"
Output:
Testing RingLibuv - Threads - Using Classes
Message from the First Thread!
Message from the Second Thread!
59.8. Threads Example - Using Classes 552
6. CHAPTER
SIXTY
DEMO PROJECT - GAME ENGINE FOR 2D GAMES
In this chapter we will learn about using the different programming paradigms in the same project.
We will create a simple Game Engine for 2D Games.
You can use the Engine directly to create 2D Games for Desktop or Mobile.
60.1 Project Layers
The project contains the next layers
• Games Layer (Here we will use declarative programming)
• Game Engine Classes (Here we will use the Object-Oriented Programming paradigm)
• Interface to graphics library (Here we will use procedural programming)
• Graphics Library bindings (Here we have RingAllegro and RingLibSDL)
60.2 Graphics Library bindings
We already have RingAllegro to use the Allegro game programming library and we have RingLibSDL to use the
LibSDL game programming library.
Both of RingAllegro and RingLibSDL are created using the C language with the help of the Ring code generator for
extensions.
Each of them is over 10,000 lines of C code which is generated after writing simple configuration files (That are
processed by the code generator).
Each configuration file determines the functions names, structures information and constants then the generator process
this configuration file to produce the C code and the library that can be loaded from Ring code.
Using RingAllegro and RingLibSDL is very similar to using Allegro and LibSDL from C code where you have the
same functions but we can build on that using the Ring language features
• RingAllegro Source Code : https://github.com/ring-lang/ring/tree/master/extensions/ringallegro
• RingLibSDL Source Code : https://github.com/ring-lang/ring/tree/master/extensions/ringsdl
553
7. Ring Documentation, Release 1.10
60.3 Interface to graphics library
In this layer we have gl_allegro.ring and gl_libsdl.ring
Each library provides the same functions to be used with interacting with the Graphics Library.
This layer hides the details and the difference between RingAllegro and RingLibSDL.
You have the same functions, Just use it and you can switch between Allegro and LibSDL at anytime.
Why ?
Allegro is very simple, we can use it to quickly create 2D games for Windows, Linux and MacOS X.
In Ring 1.0 we started by supporting Allegro.
Also LibSDL is very powerful and popular, very easy to use for Mobile Development.
Ring 1.1 comes with support for LibSDL so we can quickly create games for Mobile.
Note: We can use just one library for Desktop and Mobile development.
• gl_allegro.ring source code : https://github.com/ring-lang/ring/blob/master/ringlibs/gameengine/gl_allegro.ring
• gl_libsdl.ring source code : https://github.com/ring-lang/ring/blob/master/ringlibs/gameengine/gl_libsdl.ring
60.4 Game Engine Classes
The Engine comes with the next classes
• GameBase class
• Resources class
• Game class
• GameObject class
• Sprite class
• Text class
• Animate class
• Sound class
• Map class
• Source Code : https://github.com/ring-lang/ring/blob/master/ringlibs/gameengine/gameengine.ring
60.5 Games Layer
In this layer we create our games using the Game Engine classes
The classes are designed to be used through Declarative Programming.
In our games we will use the next classes
• Game class
• Sprite class
60.3. Interface to graphics library 554
8. Ring Documentation, Release 1.10
• Text class
• Animate class
• Sound class
• Map class
Note: Other classes in the engine are for internal use by the engine.
We will introduce some examples and three simple games :-
• Stars Fighter Game
• Flappy Bird 3000 Game
• Super Man 2016 Game
60.6 Game Class
The next table present the class attributes.
Attributes Description
FPS Number determines how many times the draw() method will be called per second.
FixedFPS Number determines how many times the animate() method will be called per second.
Title String determines the window title of the game.
aObjects List contains all objects in the game
shutdown True/False value to end the game loop
The next table present the class methods.
Method Description
refresh() Delete objects.
settitle(cTitle) Set the window title using a string parameter.
shutdown() Close the application.
The next table present a group of keywords defined by the class.
Keyword Description
sprite Create new Sprite object and add it to the game objects.
text Create new Text object and add it to the game objects.
animate Create new Animate object and add it to the game objects.
sound Create new Sound object and add it to the game objects.
map Create new Map object and add it ot the game objects.
60.7 GameObject Class
The next table present the class attributes.
60.6. Game Class 555
9. Ring Documentation, Release 1.10
Attributes Description
enabled True/False determine the state of the object (Active/Not Active)
x Number determine the x position of the object.
y Number determine the y position of the object.
width Number determine the width of the object.
height Number determine the height of the object.
nIndex Number determine the index of the object in objects list.
animate True/False to animate the object or not.
move True/False to move the object using the keyboard or not.
Scaled True/False to scale the object image or not.
draw Function to be called when drawing the object.
state Function to be called for object animation.
keypress Function to be called when a key is pressed.
mouse Function to be called when a mouse event happens.
The next table present the class methods.
Method Description
keyboard(oGame,nkey) Check Keyboard Events
mouse(oGame,nType,aMouseList) Check Mouse Events
rgb(r,g,b) Return new color using the RGB (Red, Green and Blue) Values.
60.8 Sprite Class
Parent Class : GameObject Class
The next table present the class attributes.
Attributes Description
image String determine the image file name.
point Number determine the limit of automatic movement of the object.
direction Number determine the direction of movement.
nstep Number determine the increment/decrement during movement.
type Number determine the object type in the game (Optional).
transparent True/False value determine if the image is transparent.
The next table present the class methods.
Method Description
Draw(oGame) Draw the object
60.9 Text Class
Parent Class : Sprite Class
The next table present the class attributes.
Attributes Description
size Number determine the font size
font String determine the font file name
text String determine the text to be displayed
color Number determine the color
The next table present the class methods.
60.8. Sprite Class 556
10. Ring Documentation, Release 1.10
Method Description
Draw(oGame) Draw the object
60.10 Animate Class
Parent Class : Sprite Class
The next table present the class attributes.
Attributes Description
frames Number determine the number of frames
frame Number determine the active frame
framewidth Number determine the frame width.
animate True/False determine using animate or not.
scaled True/False determine scaling image or not.
The next table present the class methods.
Method Description
Draw(oGame) Draw the object
60.11 Sound Class
Parent Class : GameObject Class
The next table present the class attributes.
Attributes Description
file String determine the sound file name.
once True/False determine to play the file one time or not (loop).
The next table present the class methods.
Method Description
playsound() Play the sound file
60.12 Map Class
Parent Class : Sprite Class
The next table present the class attributes.
Attributes Description
aMap List determine the map content using numbers.
aImages List determine the image used for each number in the map.
BlockWidth Number determine the block width (default = 32).
BlockHeight Number determine the block height (default = 32).
Animate True/False determine the animation status.
The next table present the class methods.
Method Description
getvalue(x,y) Return the item value in the Map according to the visible part
60.10. Animate Class 557