This document provides information about lists, numbers, strings, and objects in the Ring programming language. Key points include:
- Lists can contain arrays of a single data type, mixed data types, or nested arrays. Strings can also be indexed like dictionaries.
- Numbers can represent integer, double, and boolean (true/false) values. Strings can store single characters, text, binary data, dates, times, and null values.
- Ring supports object-oriented programming with operator overloading, allowing programmers to define custom data types.
- The boolean type is represented by 1 for true and 0 for false when printing values, but internally Ring only has 4 basic types: number, string, list
The Ring programming language version 1.10 book - Part 100 of 212Mahmoud Samir Fayed
The document describes the different types in Ring: Number, String, and List. It explains that objects can be instances of Ring classes or C pointers. The goal of the main function is to provide local scoping of variables to avoid conflicts with global variables. Methods are collected dynamically from an object's class so new methods can be added and used with all class instances.
The Ring programming language version 1.5.3 book - Part 187 of 194Mahmoud Samir Fayed
This document summarizes key aspects of Ring programming language functions and objects. It explains that when a new object is created, the class region code is executed to initialize attributes. Methods are collected from the class and its parents. Attributes can be accessed directly or via getter/setter methods. Global names are searched when defining class attributes to allow flexibility, though this could cause conflicts. The document provides examples of optional and default parameters in functions using a list, and how to print only keys or values from a list. It also explains newline printing behavior with lists.
The Ring programming language version 1.3 book - Part 82 of 88Mahmoud Samir Fayed
The Ring documentation describes the different data types that can be used to represent values in Ring programs. The main types are Number, String, and List. Number can represent numeric values like integers and doubles. String represents textual data like characters, dates, and times. List represents arrays and collections like dictionaries and trees that can contain multiple data types. Objects in Ring can be instances of Ring classes or C/C++ pointers. Ring aims to provide simple constructs that allow programmers to do anything while also allowing customization through new classes.
The Ring programming language version 1.4.1 book - Part 29 of 31Mahmoud Samir Fayed
This document provides documentation for Ring version 1.4.1. It discusses why list indexes start at 1 in Ring rather than 0 as in some other languages. It also covers topics like constructors, what happens when an object is created, using getter and setter methods, and including multiple source files in a project. Various code examples are provided to illustrate concepts around classes, objects, functions, and other Ring features.
This document provides an overview of Java arrays, strings, and collections. It discusses single and multi-dimensional arrays, parsing command line arguments, and the advantages and disadvantages of arrays. It also covers the ArrayList class, iterating with iterators and list iterators, and common collection methods. Finally, it summarizes working with dates, the String class, and StringBuilder.
This document discusses Python data types and handling data in Python. It covers the different types of numbers in Python including integers, floating point numbers, and complex numbers. It also discusses Boolean, string, and tuple data types. Methods for accessing and slicing strings are provided along with examples. Mutable and immutable objects are defined, with lists and tuples given as examples. Operator precedence in Python is also discussed.
Python-04| Fundamental data types vs immutabilityMohd Sajjad
Fundamental data types like integers, floats, booleans and strings are immutable in Python. Immutable means the object cannot be changed once created. For integers from 0 to 256, Python reuses the same integer objects to save memory. It also reuses the two boolean objects for True and False. For strings, a new object is created each time due to the large number of possible string values. Floats and complexes are also immutable and do not reuse objects. Immutability helps improve performance and memory usage in Python.
James Jesus Bermas on Crash Course on PythonCP-Union
This document provides an overview of the Python programming language. It introduces Python, discusses its uses in industries like Google and Industrial Light & Magic, and covers key Python concepts like data types, functions, object-oriented programming, modules, and tools. The document is intended to explain what Python is and give an introduction to programming in Python.
The Ring programming language version 1.10 book - Part 100 of 212Mahmoud Samir Fayed
The document describes the different types in Ring: Number, String, and List. It explains that objects can be instances of Ring classes or C pointers. The goal of the main function is to provide local scoping of variables to avoid conflicts with global variables. Methods are collected dynamically from an object's class so new methods can be added and used with all class instances.
The Ring programming language version 1.5.3 book - Part 187 of 194Mahmoud Samir Fayed
This document summarizes key aspects of Ring programming language functions and objects. It explains that when a new object is created, the class region code is executed to initialize attributes. Methods are collected from the class and its parents. Attributes can be accessed directly or via getter/setter methods. Global names are searched when defining class attributes to allow flexibility, though this could cause conflicts. The document provides examples of optional and default parameters in functions using a list, and how to print only keys or values from a list. It also explains newline printing behavior with lists.
The Ring programming language version 1.3 book - Part 82 of 88Mahmoud Samir Fayed
The Ring documentation describes the different data types that can be used to represent values in Ring programs. The main types are Number, String, and List. Number can represent numeric values like integers and doubles. String represents textual data like characters, dates, and times. List represents arrays and collections like dictionaries and trees that can contain multiple data types. Objects in Ring can be instances of Ring classes or C/C++ pointers. Ring aims to provide simple constructs that allow programmers to do anything while also allowing customization through new classes.
The Ring programming language version 1.4.1 book - Part 29 of 31Mahmoud Samir Fayed
This document provides documentation for Ring version 1.4.1. It discusses why list indexes start at 1 in Ring rather than 0 as in some other languages. It also covers topics like constructors, what happens when an object is created, using getter and setter methods, and including multiple source files in a project. Various code examples are provided to illustrate concepts around classes, objects, functions, and other Ring features.
This document provides an overview of Java arrays, strings, and collections. It discusses single and multi-dimensional arrays, parsing command line arguments, and the advantages and disadvantages of arrays. It also covers the ArrayList class, iterating with iterators and list iterators, and common collection methods. Finally, it summarizes working with dates, the String class, and StringBuilder.
This document discusses Python data types and handling data in Python. It covers the different types of numbers in Python including integers, floating point numbers, and complex numbers. It also discusses Boolean, string, and tuple data types. Methods for accessing and slicing strings are provided along with examples. Mutable and immutable objects are defined, with lists and tuples given as examples. Operator precedence in Python is also discussed.
Python-04| Fundamental data types vs immutabilityMohd Sajjad
Fundamental data types like integers, floats, booleans and strings are immutable in Python. Immutable means the object cannot be changed once created. For integers from 0 to 256, Python reuses the same integer objects to save memory. It also reuses the two boolean objects for True and False. For strings, a new object is created each time due to the large number of possible string values. Floats and complexes are also immutable and do not reuse objects. Immutability helps improve performance and memory usage in Python.
James Jesus Bermas on Crash Course on PythonCP-Union
This document provides an overview of the Python programming language. It introduces Python, discusses its uses in industries like Google and Industrial Light & Magic, and covers key Python concepts like data types, functions, object-oriented programming, modules, and tools. The document is intended to explain what Python is and give an introduction to programming in Python.
This document provides an introduction to Python fundamentals. It discusses Python's character set, tokens or lexical units including keywords, identifiers, literals, operators, and punctuators. It also covers Python programming concepts such as variables and assignments, functions, comments, statements, and programming conventions regarding whitespace, maximum line length, and case sensitivity. The document aims to explain the basic building blocks of the Python language to learn Python programming.
After the end of lesson you will be able to learn Python basics-What Python is? Its releases. Where we can use Python? Python Features. Tokens, comments variables etc... In out next PPT you will learn how to input and get output in Python
The Ring programming language version 1.2 book - Part 78 of 84Mahmoud Samir Fayed
Ring allows defining classes with attributes and methods. When a new object is created:
1. The class region code is executed to initialize the object's attributes.
2. Methods are collected from the class and parent classes to be called on the object.
3. Attributes can be accessed directly or via getter/setter methods, which are called automatically.
Global names are searched when defining attributes to allow dynamic attribute definition based on global state. However, this could cause conflicts that the programmer must avoid, such as by prepending names with $ or self..
This document provides an overview of key concepts in Python including:
- Python is a dynamically typed language where variables are not explicitly defined and can change type.
- Names and identifiers in Python are case sensitive and follow specific conventions.
- Python uses indentation rather than brackets to define blocks of code.
- Core data types in Python include numeric, string, list, tuple, dictionary, set, boolean and file types. Each has specific characteristics and operators.
Robin Milner made three major contributions to computer science: developing LCF for automated theorem proving, creating ML which was the first language with polymorphic type inference and type-safe exception handling, and developing frameworks for analyzing concurrent systems like CCS and the pi-calculus. The lecture discusses polymorphism, with control abstraction through higher-order functions and polymorphic type systems covered. Polymorphism allows values of different types to be handled through a uniform interface.
The document summarizes the String class and its methods in Java. It discusses that String is an immutable sequence of characters represented by the String class. It lists some key methods of the String class like length(), charAt(), equals() for comparing Strings. It also covers String constructors and how to initialize Strings.
Best Data Science Ppt using Python
Data science is an inter-disciplinary field that uses scientific methods, processes, algorithms and systems to extract knowledge and insights from many structural and unstructured data. Data science is related to data mining, machine learning and big data.
This document discusses text and numbers in programming. It covers defining and manipulating text strings using single or double quotes. Escape characters can be used inside strings. Text can be validated and formatted using various string functions like trim(), strlen(), strtoupper(), substr(), and str_replace(). Numbers can be integers or floats. Variables hold data and can be operated on with arithmetic and assignment operators like +, -, *, /, %, and .=. Variables can also be incremented, decremented, and placed inside strings.
This document discusses strings and regular expressions in .NET. It provides details on the System.String class and how strings are immutable. The StringBuilder class is introduced as a mutable alternative for string manipulation. Various string formatting options like standard numeric and custom format strings are covered. Finally, an overview of regular expressions is given, explaining how they provide a powerful way to parse and process text using pattern matching.
The document discusses new features in .NET 3.5 including automatic properties, extension methods, object initialization, anonymous types, partial methods, type inference, LINQ, lambda expressions, and query expressions. It explains that these language enhancements combined with query expressions enable LINQ by providing a unified way to query and manipulate data from various sources.
The document provides an overview of Strings and StringBuilders in Java. It discusses Strings as immutable objects and how StringBuilders can be more efficient for modifying strings. It also covers common String and StringBuilder methods, when to use each, and exceptions in Java using try/catch blocks.
The document discusses the eight primitive data types in Java - boolean, char, byte, short, int, long, float, and double. It explains what each type is used for, their possible value ranges, and when to use each type. Key points covered include int being the preferred integer type, double the preferred real number type, and the importance of declaring variables before use and giving them initial values.
Wrapper classes allow primitive data types to be used as objects. The eight primitive types (boolean, byte, char, short, int, long, float, double) each have a corresponding wrapper class (Boolean, Byte, Character, Short, Integer, Long, Float, Double). Wrapper classes make primitive types act like objects and allow them to be stored in collections. Common methods include parse, valueOf, toString.
This document discusses string handling in Java. It begins by explaining that strings are immutable objects of type String. It then discusses why strings are immutable and the security implications if they were mutable. The document also introduces the main string classes in Java and some common string operations like concatenation, comparison, searching and modifying strings. It provides examples for many string methods like length(), charAt(), equals(), indexOf() etc.
The document provides an introduction to programming in Python. It discusses how Python can be used for web development, desktop applications, data science, machine learning, and more. It also covers executing Python programs, reading keyboard input, decision making and loops in Python, standard data types like numbers, strings, lists, tuples and dictionaries. Additionally, it describes functions, opening and reading/writing files, regular expressions, and provides examples of SQLite database connections in Python projects.
Wrapper classes allow primitive data types to be used as objects. Wrapper classes include Integer, Double, Boolean etc. Strings in Java are immutable - their values cannot be changed once created. StringBuffer and StringBuilder can be used to create mutable strings that can be modified. StringTokenizer can split a string into tokens based on a specified delimiter.
Here are the answers to the exercises:
1. The len() method is used to find the length of a string.
2. To get the first character of the string txt, it would be:
txt="hello"
x=txt[0]
3. The strip() method removes any whitespace from the beginning or the end of a string.
The Ring programming language version 1.7 book - Part 90 of 196Mahmoud Samir Fayed
The Ring documentation describes the basic data types in Ring. The main types are Number, String, and List. Number represents numeric values like integers and doubles. String represents character strings and text. List represents arrays that can hold values of one type or multiple types, as well as more complex data structures like dictionaries and trees. Objects in Ring can be instances of Ring classes or C/C++ pointers. Ring aims to provide simple constructs that allow programmers to do anything, while also allowing customization through user-defined classes.
The Ring programming language version 1.5.4 book - Part 178 of 185Mahmoud Samir Fayed
The document contains responses to questions about the Ring programming language. Some key points:
- Ring allows defining custom languages using classes, making statements without parsing.
- Breaking multiple loops from subfunctions can be useful for small programs, though not always best practice. Flexibility is provided but not encouraged.
- Keywords like "See", "Give", "But", and "Ok" were chosen for quick writing and understandability over tradition. Alternatives are also supported.
- Ring keeps data types simple with Numbers, Strings, Lists, and Objects, allowing flexibility through operator overloading and OOP to represent different domains. This balances simplicity with power.
This document provides an introduction to Python fundamentals. It discusses Python's character set, tokens or lexical units including keywords, identifiers, literals, operators, and punctuators. It also covers Python programming concepts such as variables and assignments, functions, comments, statements, and programming conventions regarding whitespace, maximum line length, and case sensitivity. The document aims to explain the basic building blocks of the Python language to learn Python programming.
After the end of lesson you will be able to learn Python basics-What Python is? Its releases. Where we can use Python? Python Features. Tokens, comments variables etc... In out next PPT you will learn how to input and get output in Python
The Ring programming language version 1.2 book - Part 78 of 84Mahmoud Samir Fayed
Ring allows defining classes with attributes and methods. When a new object is created:
1. The class region code is executed to initialize the object's attributes.
2. Methods are collected from the class and parent classes to be called on the object.
3. Attributes can be accessed directly or via getter/setter methods, which are called automatically.
Global names are searched when defining attributes to allow dynamic attribute definition based on global state. However, this could cause conflicts that the programmer must avoid, such as by prepending names with $ or self..
This document provides an overview of key concepts in Python including:
- Python is a dynamically typed language where variables are not explicitly defined and can change type.
- Names and identifiers in Python are case sensitive and follow specific conventions.
- Python uses indentation rather than brackets to define blocks of code.
- Core data types in Python include numeric, string, list, tuple, dictionary, set, boolean and file types. Each has specific characteristics and operators.
Robin Milner made three major contributions to computer science: developing LCF for automated theorem proving, creating ML which was the first language with polymorphic type inference and type-safe exception handling, and developing frameworks for analyzing concurrent systems like CCS and the pi-calculus. The lecture discusses polymorphism, with control abstraction through higher-order functions and polymorphic type systems covered. Polymorphism allows values of different types to be handled through a uniform interface.
The document summarizes the String class and its methods in Java. It discusses that String is an immutable sequence of characters represented by the String class. It lists some key methods of the String class like length(), charAt(), equals() for comparing Strings. It also covers String constructors and how to initialize Strings.
Best Data Science Ppt using Python
Data science is an inter-disciplinary field that uses scientific methods, processes, algorithms and systems to extract knowledge and insights from many structural and unstructured data. Data science is related to data mining, machine learning and big data.
This document discusses text and numbers in programming. It covers defining and manipulating text strings using single or double quotes. Escape characters can be used inside strings. Text can be validated and formatted using various string functions like trim(), strlen(), strtoupper(), substr(), and str_replace(). Numbers can be integers or floats. Variables hold data and can be operated on with arithmetic and assignment operators like +, -, *, /, %, and .=. Variables can also be incremented, decremented, and placed inside strings.
This document discusses strings and regular expressions in .NET. It provides details on the System.String class and how strings are immutable. The StringBuilder class is introduced as a mutable alternative for string manipulation. Various string formatting options like standard numeric and custom format strings are covered. Finally, an overview of regular expressions is given, explaining how they provide a powerful way to parse and process text using pattern matching.
The document discusses new features in .NET 3.5 including automatic properties, extension methods, object initialization, anonymous types, partial methods, type inference, LINQ, lambda expressions, and query expressions. It explains that these language enhancements combined with query expressions enable LINQ by providing a unified way to query and manipulate data from various sources.
The document provides an overview of Strings and StringBuilders in Java. It discusses Strings as immutable objects and how StringBuilders can be more efficient for modifying strings. It also covers common String and StringBuilder methods, when to use each, and exceptions in Java using try/catch blocks.
The document discusses the eight primitive data types in Java - boolean, char, byte, short, int, long, float, and double. It explains what each type is used for, their possible value ranges, and when to use each type. Key points covered include int being the preferred integer type, double the preferred real number type, and the importance of declaring variables before use and giving them initial values.
Wrapper classes allow primitive data types to be used as objects. The eight primitive types (boolean, byte, char, short, int, long, float, double) each have a corresponding wrapper class (Boolean, Byte, Character, Short, Integer, Long, Float, Double). Wrapper classes make primitive types act like objects and allow them to be stored in collections. Common methods include parse, valueOf, toString.
This document discusses string handling in Java. It begins by explaining that strings are immutable objects of type String. It then discusses why strings are immutable and the security implications if they were mutable. The document also introduces the main string classes in Java and some common string operations like concatenation, comparison, searching and modifying strings. It provides examples for many string methods like length(), charAt(), equals(), indexOf() etc.
The document provides an introduction to programming in Python. It discusses how Python can be used for web development, desktop applications, data science, machine learning, and more. It also covers executing Python programs, reading keyboard input, decision making and loops in Python, standard data types like numbers, strings, lists, tuples and dictionaries. Additionally, it describes functions, opening and reading/writing files, regular expressions, and provides examples of SQLite database connections in Python projects.
Wrapper classes allow primitive data types to be used as objects. Wrapper classes include Integer, Double, Boolean etc. Strings in Java are immutable - their values cannot be changed once created. StringBuffer and StringBuilder can be used to create mutable strings that can be modified. StringTokenizer can split a string into tokens based on a specified delimiter.
Here are the answers to the exercises:
1. The len() method is used to find the length of a string.
2. To get the first character of the string txt, it would be:
txt="hello"
x=txt[0]
3. The strip() method removes any whitespace from the beginning or the end of a string.
The Ring programming language version 1.7 book - Part 90 of 196Mahmoud Samir Fayed
The Ring documentation describes the basic data types in Ring. The main types are Number, String, and List. Number represents numeric values like integers and doubles. String represents character strings and text. List represents arrays that can hold values of one type or multiple types, as well as more complex data structures like dictionaries and trees. Objects in Ring can be instances of Ring classes or C/C++ pointers. Ring aims to provide simple constructs that allow programmers to do anything, while also allowing customization through user-defined classes.
The Ring programming language version 1.5.4 book - Part 178 of 185Mahmoud Samir Fayed
The document contains responses to questions about the Ring programming language. Some key points:
- Ring allows defining custom languages using classes, making statements without parsing.
- Breaking multiple loops from subfunctions can be useful for small programs, though not always best practice. Flexibility is provided but not encouraged.
- Keywords like "See", "Give", "But", and "Ok" were chosen for quick writing and understandability over tradition. Alternatives are also supported.
- Ring keeps data types simple with Numbers, Strings, Lists, and Objects, allowing flexibility through operator overloading and OOP to represent different domains. This balances simplicity with power.
The Ring programming language version 1.5.2 book - Part 174 of 181Mahmoud Samir Fayed
The document contains responses to frequently asked questions about the Ring programming language. Some key points:
- Ring allows users to define their own domain-specific languages for writing natural statements without needing to learn parsing syntax.
- Features like breaking multiple loops are included to support both small and large programs, while preventing errors without reducing flexibility.
- The design of Ring aims to keep the basic language constructs small and simple while enabling flexibility and extensibility through object-oriented programming.
- Data types in Ring are kept minimal (number, string, list, object) for simplicity, but can represent various values and be extended as needed through classes and operator overloading.
The Ring programming language version 1.9 book - Part 98 of 210Mahmoud Samir Fayed
Ring provides constructor methods when creating new objects. When a new object is created:
1. Memory is allocated for the object's attributes
2. The current scope is changed to the new object
3. Code in the class region is executed to initialize the object
4. Attributes added in the class region are dynamic
The Ring programming language version 1.8 book - Part 93 of 202Mahmoud Samir Fayed
Ring is designed to be a simple yet powerful programming language. It uses lists, strings, numbers, and objects as its core data types. Lists can represent arrays, dictionaries, and trees. Numbers can represent integers, floats, and Booleans. Strings can represent various data types. The goals of Ring's design are to keep the core concepts small and flexible while also being extensible through object-oriented programming. Some key features of Ring discussed in the document include its support for functional programming without closures, defining custom domain-specific languages, breaking multiple loops, and using natural language-inspired keywords.
The Ring programming language version 1.5.1 book - Part 174 of 180 Mahmoud Samir Fayed
When creating a new object in Ring, several things happen:
1. Ring allocates dynamic memory for the object's attributes.
2. Ring changes the current scope to the new object.
3. Ring executes any code in the class region to initialize the object.
4. The object's attributes are determined by the code in the class region.
The Ring programming language version 1.5.4 book - Part 6 of 185Mahmoud Samir Fayed
This document provides an overview of the Ring programming language. Key features include native object-oriented support with encapsulation, inheritance, polymorphism and composition. It also supports reflection, exception handling, runtime code evaluation, I/O, math functions, strings, lists, files, databases, security, internet, zip, and CGI functionality. The language aims to have clear structure, be compact, encourage organization, and support both procedural and object-oriented paradigms. It can be used to create applications, libraries, games and more.
The Ring programming language version 1.8 book - Part 7 of 202Mahmoud Samir Fayed
Ring 1.8 includes several new features and improvements such as better performance, new applications like Find in Files and String2Constant, more 3D samples, compiling on Manjaro Linux, updated libraries, and notes for extension creators. Key updates include 10-100% faster performance, a Find in Files application, a String2Constant tool to convert code to use constants, a StopWatch application, improved Form Designer, RingQt, and code generator for extensions. The release provides better compiler, virtual machine, and overall performance.
C++ Notes by Hisham Ahmed Rizvi for Class 12th Board Examshishamrizvi
The document provides an overview of key concepts in C++ including:
- Data types like int, char, float, and double
- Variables, constants, and escape sequences
- Operators like assignment, arithmetic, relational, and logical operators
- Control structures like if/else, switch, for, while, and do-while loops
- Functions like main(), exit(), get(), put(), and getline()
- Input/output streams like cin, cout, and file streams
The document covers fundamental C++ concepts to help prepare for board exams.
The Ring programming language version 1.10 book - Part 7 of 212Mahmoud Samir Fayed
The document summarizes the key features and capabilities of the Ring programming language. Some of the main features included are:
- Support for procedures, functions, recursion, object-oriented programming features like encapsulation and inheritance.
- First-class support for variables, lists, objects and functions. Lists and objects can be passed by reference.
- Built-in support for math, string, list, file processing and database functions.
- Ability to create graphical user interfaces, 2D games, embed the language in C/C++, and develop web applications.
- Support for packages, modules, reflection, exception handling and debugging tools.
- Aimed to have a simple and natural
The Ring programming language version 1.5.3 book - Part 6 of 184Mahmoud Samir Fayed
- Ring is a simple, dynamically typed scripting language designed for productivity. It aims to have clear program structure and encourage organization.
- Key features include object-oriented support, reflection, exception handling, math/string/file functions, and embedding capabilities. It can be used to create applications, games, and declarative domain-specific languages.
- The language focuses on transparency - its implementation and each compiler stage can be clearly seen. It also aims to have natural, minimal syntax and encourage nesting and organization of code.
The Ring programming language version 1.5.1 book - Part 5 of 180Mahmoud Samir Fayed
The document describes the Ring programming language. Key features include:
- Native object-oriented support including classes, inheritance, and polymorphism.
- Reflection and meta-programming capabilities.
- Clear program structure with statements first, then functions, packages, and classes.
- Support for exception handling, runtime code evaluation, I/O, math, strings, lists, files, databases, security, internet, zip files, and CGI.
- Ability to create GUI, game, and web applications via embedded libraries.
- Simple, natural syntax that encourages organization and readability.
The Ring programming language version 1.9 book - Part 85 of 210Mahmoud Samir Fayed
The document discusses Ring's scope rules and provides examples. Some key points:
1. Ring has three scopes - local, object, and global. Variables are searched for in local scope first, then object scope, then global scope.
2. The 'self' reference inside methods changes based on nested object scopes defined with curly braces.
3. Variables defined in a class region become attributes accessible via the object scope. Using 'self.attribute' in the class region avoids conflicts with the global scope.
The Ring programming language version 1.10 book - Part 86 of 212Mahmoud Samir Fayed
- When calling a function or method in Ring, it will search scopes in this order: methods, user-defined functions, standard/C functions.
- This avoids conflicts between functions and methods with the same name.
- Functions can be replaced by other functions or methods.
- The self.method() syntax is not necessary but this.method() can escape the current object scope.
The Ring programming language version 1.5.1 book - Part 13 of 180Mahmoud Samir Fayed
Ring 1.1 includes several new features and improvements:
1) Better support for natural language programming including calling methods when expressions are evaluated.
2) The ability to generate and execute Ring object files for easier application distribution without source code.
3) Increased syntax flexibility including different styles for input/output and control structures.
4) Many new functions and classes added to the standard library written in Ring itself.
The Ring programming language version 1.9 book - Part 7 of 210Mahmoud Samir Fayed
This document provides an overview of the Ring programming language design. Some key points:
- Ring aims to be a simple, natural language that encourages organization and productivity.
- It uses dynamic typing, lexical scoping, and transparent implementation via a visual programming tool.
- The language design emphasizes clarity, compact syntax, flexibility, and enabling declarative domain-specific languages.
- Ring supports multiple paradigms and has a smart garbage collector to manage memory.
Python is an interpreted, object-oriented programming language that uses indentation to identify blocks of code. It is dynamically typed and strongly typed, with objects determining types at runtime rather than requiring explicit type declaration. Common data types include mutable types like lists and dictionaries as well as immutable types like strings and tuples.
The document discusses Python interview questions and answers related to Python fundamentals like data types, variables, functions, objects and classes. Some key points include:
- Python is an interpreted, interactive and object-oriented programming language. It uses indentation to identify code blocks rather than brackets.
- Python supports dynamic typing where the type is determined at runtime. It is strongly typed meaning operations inappropriate for a type will fail with an exception.
- Common data types include lists (mutable), tuples (immutable), dictionaries, strings and numbers.
- Functions use def, parameters are passed by reference, and variables can be local or global scope.
- Classes use inheritance, polymorphism and encapsulation to create
The Ring programming language version 1.7 book - Part 17 of 196Mahmoud Samir Fayed
Ring 1.1 includes several new features and improvements such as better natural language programming support, the ability to generate and execute Ring object files, and more flexible input/output and control structure syntax. It also includes new functions, classes written in Ring for the StdLib, support for SQLite databases, and improvements to areas like code generation for extensions and documentation.
Here are three classes that meet the requirements outlined in the homework:
1. Employee class with get/set methods for name, salary, and method to calculate yearly salary with a raise.
2. Invoice class with get/set methods for part number, description, quantity, price, and method to calculate invoice amount.
3. Date class with get/set methods for month, day, year, and method to display date in MM/DD/YYYY format.
Similar to The Ring programming language version 1.6 book - Part 182 of 189 (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.
Microservice Teams - How the cloud changes the way we workSven Peters
A lot of technical challenges and complexity come with building a cloud-native and distributed architecture. The way we develop backend software has fundamentally changed in the last ten years. Managing a microservices architecture demands a lot of us to ensure observability and operational resiliency. But did you also change the way you run your development teams?
Sven will talk about Atlassian’s journey from a monolith to a multi-tenanted architecture and how it affected the way the engineering teams work. You will learn how we shifted to service ownership, moved to more autonomous teams (and its challenges), and established platform and enablement teams.
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsPeter Muessig
The UI5 tooling is the development and build tooling of UI5. It is built in a modular and extensible way so that it can be easily extended by your needs. This session will showcase various tooling extensions which can boost your development experience by far so that you can really work offline, transpile your code in your project to use even newer versions of EcmaScript (than 2022 which is supported right now by the UI5 tooling), consume any npm package of your choice in your project, using different kind of proxies, and even stitching UI5 projects during development together to mimic your target environment.
WWDC 2024 Keynote Review: For CocoaCoders AustinPatrick Weigel
Overview of WWDC 2024 Keynote Address.
Covers: Apple Intelligence, iOS18, macOS Sequoia, iPadOS, watchOS, visionOS, and Apple TV+.
Understandable dialogue on Apple TV+
On-device app controlling AI.
Access to ChatGPT with a guest appearance by Chief Data Thief Sam Altman!
App Locking! iPhone Mirroring! And a Calculator!!
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/
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
How Can Hiring A Mobile App Development Company Help Your Business Grow?ToXSL Technologies
ToXSL Technologies is an award-winning Mobile App Development Company in Dubai that helps businesses reshape their digital possibilities with custom app services. As a top app development company in Dubai, we offer highly engaging iOS & Android app solutions. https://rb.gy/necdnt
Preparing Non - Technical Founders for Engaging a Tech AgencyISH Technologies
Preparing non-technical founders before engaging a tech agency is crucial for the success of their projects. It starts with clearly defining their vision and goals, conducting thorough market research, and gaining a basic understanding of relevant technologies. Setting realistic expectations and preparing a detailed project brief are essential steps. Founders should select a tech agency with a proven track record and establish clear communication channels. Additionally, addressing legal and contractual considerations and planning for post-launch support are vital to ensure a smooth and successful collaboration. This preparation empowers non-technical founders to effectively communicate their needs and work seamlessly with their chosen tech agency.Visit our site to get more details about this. Contact us today www.ishtechnologies.com.au
Using Query Store in Azure PostgreSQL to Understand Query PerformanceGrant Fritchey
Microsoft has added an excellent new extension in PostgreSQL on their Azure Platform. This session, presented at Posette 2024, covers what Query Store is and the types of information you can get out of it.
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian CompaniesQuickdice ERP
Explore the seamless transition to e-invoicing with this comprehensive guide tailored for Saudi Arabian businesses. Navigate the process effortlessly with step-by-step instructions designed to streamline implementation and enhance efficiency.
Hand Rolled Applicative User ValidationCode KataPhilip Schwarz
Could you use a simple piece of Scala validation code (granted, a very simplistic one too!) that you can rewrite, now and again, to refresh your basic understanding of Applicative operators <*>, <*, *>?
The goal is not to write perfect code showcasing validation, but rather, to provide a small, rough-and ready exercise to reinforce your muscle-memory.
Despite its grandiose-sounding title, this deck consists of just three slides showing the Scala 3 code to be rewritten whenever the details of the operators begin to fade away.
The code is my rough and ready translation of a Haskell user-validation program found in a book called Finding Success (and Failure) in Haskell - Fall in love with applicative functors.
Malibou Pitch Deck For Its €3M Seed Roundsjcobrien
French start-up Malibou raised a €3 million Seed Round to develop its payroll and human resources
management platform for VSEs and SMEs. The financing round was led by investors Breega, Y Combinator, and FCVC.
Measures in SQL (SIGMOD 2024, Santiago, Chile)Julian Hyde
SQL has attained widespread adoption, but Business Intelligence tools still use their own higher level languages based upon a multidimensional paradigm. Composable calculations are what is missing from SQL, and we propose a new kind of column, called a measure, that attaches a calculation to a table. Like regular tables, tables with measures are composable and closed when used in queries.
SQL-with-measures has the power, conciseness and reusability of multidimensional languages but retains SQL semantics. Measure invocations can be expanded in place to simple, clear SQL.
To define the evaluation semantics for measures, we introduce context-sensitive expressions (a way to evaluate multidimensional expressions that is consistent with existing SQL semantics), a concept called evaluation context, and several operations for setting and modifying the evaluation context.
A talk at SIGMOD, June 9–15, 2024, Santiago, Chile
Authors: Julian Hyde (Google) and John Fremlin (Google)
https://doi.org/10.1145/3626246.3653374
8 Best Automated Android App Testing Tool and Framework in 2024.pdfkalichargn70th171
Regarding mobile operating systems, two major players dominate our thoughts: Android and iPhone. With Android leading the market, software development companies are focused on delivering apps compatible with this OS. Ensuring an app's functionality across various Android devices, OS versions, and hardware specifications is critical, making Android app testing essential.
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
The Ring programming language version 1.6 book - Part 182 of 189
1. Ring Documentation, Release 1.6
Using Lists in Ring you can
• Create Arrays (one data type)
• Create Lists (Mix of data types)
• Create Tree (Nested arrays)
• Use String Index (Looks like Dictionary/Hash Table)
The same principle is applied to Numbers
• You can use the number for int value
• You can use the number for double value
• You can use the number for Boolean value (True/False)
The sample principle is applied for Strings
• You can use the string for storing one character
• You can use the string for storing text (one or many lines)
• You can use the string for storing binary data
• You can use the string for storing date
• You can use the string for storing time
• You can use the string for storing NULL values (empty strings)
And we have Object Oriented Support + Operator Overloading where the programmer can define new data types and
use them as default types defined by the language
So We have
• A small and simple language that someone can pick in little days
• A fast language that provide primitive types (String ? Number ? List ? Object)
• A flexible language that can be extended using OOP to add new types according to the application domain
100.16 What about the Boolean values in Ring?
You can use true for 1 and false for 0
when you test the result of Boolean expressions in your code.
Just when you print the value using the see command you will see 1 for (true) and 0 for (false)
Why ?
Because Ring contains only 4 types of variables
1. Number
2. String
3. List
4. Object
The first type (Number) is used to represent int, double and Boolean values.
The second type (String) is used to represent char, array of characters, date and time.
100.16. What about the Boolean values in Ring? 1783
2. Ring Documentation, Release 1.6
The third type (List) is used to represent Arrays of one type, Arrays of more than one type, Hash (Dictionary), Tree,
etc.
The object can be an object created from a Ring class (Any Class) or just a C Pointer that we get from calling a C/C++
function/method.
Why ?
The Ring is designed to give the programmer/developer the most simple constructs that can be used to do everything.
The programmer/developer can customize the language by creating new classes (and use operator overloading) to get
more types that he care about according to the problem domain.
Why ?
Because simple is better, and easy to learn and remember! And this provide flexibility to convert between high level
types that can be represented using the same basic type
100.17 What is the goal of including the “Main” function in Ring?
The main function is very important, you need it when you want to write statements that uses local variables instead
of the Global scope.
Example:
x = 10
myfunc()
See "X value = " + X # here I expect that x will be (10)
# but I will get another value (6) because myfunc() uses x !
Func myfunc
for x = 1 to 5
See x + nl
next
Output:
1
2
3
4
5
X value = 6
Now using the Main function
Func Main
x = 10
myfunc()
See "X value = " + X
Func myfunc
for x = 1 to 5
See x + nl
next
Output
1
2
3
100.17. What is the goal of including the “Main” function in Ring? 1784
3. Ring Documentation, Release 1.6
4
5
X value = 10
100.18 Why the list index start from 1 in Ring?
It’s about how we count in the real world, when we have three apples in our hand
we say 1 2 3
We don’t start from 0
The question must be why the other languages start from 0 ?
The answer is, because this is related to the machine and how we deal with values and memory address.
Example
we have array called myarray[5]
In memory : myarray will have an address
The first item will be stored in that address
The second item will come after that address and so on
Now when we need to point to the first item we need the address of myarray
So we type myarray[0] because myarray + 0 result will still point to the first item
for the second item myarray[1] because myarray + 1 result will point to the second item and so on
In Low Level languages or languages near to the machine it’s good to be like this
But for high level language designed for applications it’s better to be natural
Example
mylist = [1,2,3,4,5]
for x = 1 to len(mylist)
see x + nl
next
In the previous example we start from 1 to the length of the array if the index starts from 0 we will write
for x = 0 to len(mylist)-1
or remember the for loop in other languages
for(x=0 ; x<nMax ; x++ )
You will use the < operator !
100.19 Why Ring is not case-sensitive?
1. To be more human-friendly
2. Like Ada, SQL, Pascal, Delphi, Visual Basic, Visual FoxPro, etc.
3. To help in supporting Natural Language Programming.
100.18. Why the list index start from 1 in Ring? 1785
4. Ring Documentation, Release 1.6
4. To be able to select your favorite style when writing the language keywords
see "lower case!"
SEE "UPPER case!"
See "First Letter is UPPER case!"
5. To avoid getting error message when writing quick tests then type “variable” instead of “Variable”.
6. To avoid getting error message when you type “Dosomething()” instead of “doSomething()”
7. In Ring, No conflict between Variables, Method Names & Classes Names
We can write person as variable name and Person as class name.
person = new Person
class Person
name address phone
100.20 Why the Assignment operator uses Deep Copy?
“Because it’s a poor tradeoff to add complexity for dubious performance gains, a good approach to deep vs. shallow
copies is to prefer deep copies until proven otherwise.”
, Steve McConnell, Code Complete
1. It’s more natural, When you use the assignment operator, You expect a deep copy.
2. If you don’t need a deep copy, Just don’t use it!
3. The Ring language is designed to reduce references usage as much as possible.
4. The Ring language is designed to make using references simple and possible in special cases where this make
sense.
5. We have references when this is natural, like passing lists and objects to functions, creating objects (Like
GUI Objects) from a C/C++ library, returning an object stored inside a list.
6. It is a feature, We can use it to create pure functions. The Value() function in the stdlib uses this feature to
pass lists & objects by value when we need this.
7. When we need references, It’s recommended to create a class that manage sharing lists and objects.
8. It’s more safe at the application level to avoid many logical errors.
9. In Ring, we start without thinking about the little details and concentrate on the application, You don’t
have to write the type (Dynamic Typing), You don’t have to write explicit conversions between numbers
and strings (Weakly Typed) and you don’t have to select between using values or references, You don’t
have to write the scope (Lexical Scoping).
10. In Ring, we have smart garbage collector (Simple & Fast), We can delete the memory directly at any
time using the Assignment operator too. Reducing references usage or using them through managers
helps a lot to achieve this goal. by doing this we have full control.
11. If you want to create references and avoid creating a manager, You can use Object2Pointer() and Pointer2Object() functio
But It’s not the Ring way “Sprite” to do things.
100.20. Why the Assignment operator uses Deep Copy? 1786
5. Ring Documentation, Release 1.6
100.21 Is there constructor methods in Ring?
When you create new object for example
new point
1 - Ring will allocate dynamic memory space to be used for the new object attributes that Ring doesn’t know anything
about them.
2 - Ring will change the current local scope and the current object scope to use the object state created in step (1)
3 - Ring will move the execution to the class Region (After the class name and before any methods)
4 - Any Instructions/Code in the class region will be executed as any Ring code
5 - Control is moved from the class region to the location of (new point) once we reach the end of the class region or
we uses a Return command.
So All attributes that added to the object are dynamic attributes, this mean that you can control what attributes will be
added through the runtime.
Example:
$3D = False
see new point
$3D = True
see new point
class point
x y
if not $3D return ok
z
Output:
x: NULL
y: NULL
x: NULL
y: NULL
z: NULL
You have an option to call init() method directly when you create a new object
This method can do anything with the object attributes as it will be called after creating the object and executing the
class region code.
p1 = new point3d(100,200,300)
see p1
class point3d
x y z
func init p1,p2,p3
x=p1 y=p2 z=p3
100.22 What happens when we create a new object?
1- When you create an object, the class region code will be executed and you will have the object attributes based on
the code in that region
100.21. Is there constructor methods in Ring? 1787
6. Ring Documentation, Release 1.6
2- Ring don’t care about the object methods until you start calling a method
3- When you call a method, Ring will check the object class and the class parent (if you are using inheritance) and
will collect the methods for you to be used now or later from any object that belong to the same class.
4- Since methods are dynamic and each object get the method from the class, you can after creating objects, add new
methods and use it with the object or any object created or will be created from the same class.
Example:
o1 = new point {x=10 y=20 z=30}
o2 = new point {x=100 y=200 z =300}
addmethod(o1,"print", func { see x + nl + y + nl + z + nl } )
o1.print()
o2.print()
class point x y z
Output:
10
20
30
100
200
300
100.23 Can we use the attributes by accessing the Getter and Setter
methods?
Yes we can, The setter/getter methods are called automatically when you start using the attributes from outside the
class Also you can call the methods instead of using the attributes. It’s your choice.
Example:
o1 = new Developer
o1.name = "Mahmoud" see o1.name + nl
o1 { name = "Gal" see name }
o1 { name = "Bert" see name }
o1.setname("Marino")
see o1.getname()
Class Developer
name language = "Ring Programming Language"
func setname value
see "Message from SetName() Function!" + nl
name = value + " - " + language
func getname
see "Message from GetName() Function!" + nl + nl
return "Mr. " + name + nl
Output
100.23. Can we use the attributes by accessing the Getter and Setter methods? 1788
7. Ring Documentation, Release 1.6
Message from SetName() Function!
Message from GetName() Function!
Mr. Mahmoud - Ring Programming Language
Message from SetName() Function!
Message from GetName() Function!
Mr. Gal - Ring Programming Language
Message from SetName() Function!
Message from GetName() Function!
Mr. Bert - Ring Programming Language
Message from SetName() Function!
Message from GetName() Function!
Mr. Marino - Ring Programming Language
100.24 Why should a search of global names be made while defining
the class attributes?
The question is why we don’t avoid conflicts with global variable names when we define the class attributes ?
At first remember that using the optional $ mark in the global variables names solve the problem. Also using the Main
function and avoiding global variables may help.
The Answer:
Ring is a dynamic language
We can in the run-time determine the class attributes (Add/Remove)
We can execute (any code) while defining the class attributes
Example (1)
oPerson = new Person
Class Person
See "Welcome to the Ring language"
Example (2)
Customize attributes based on global variable value
$debug = true
oPerson = new Person
see oPerson
Class Person
if $debug date=date() time=time() ok
In the previous example when we have the $debug flag set to true, we will add the Date and Time attributes to the
object state.
Example (3)
Store the object index based on global variable
100.24. Why should a search of global names be made while defining the class attributes? 1789
8. Ring Documentation, Release 1.6
$ObjectsCount = 0
oPerson = new Person
see oPerson
oPerson2 = new Person
see oPerson2
Class Person
$ObjectsCount++
nIndex = $ObjectsCount
Output:
nindex: 1.000000
nindex: 2.000000
Common Example:
• Connect to the database then get table columns (Using global Variable/Object).
• Create class attributes based on the column names.
• Later when you modify the database - you may don’t need to modify your code.
It’s flexibility but remember that power comes with great responsibility.
100.25 Why Ring doesn’t avoid the conflict between Global Variables
and Class Attributes Names?
In this use case we have
1 - Global Variable defined without a special mark like $
2 - Class contains Attributes defined using a special syntax (where we type the attribute name directly after the class)
3 - The Attributes are defined in the class region that allows writing code and using global variables
If I will accepted your proposal about changing how Ring find variables in the class region I must break one of the
previous three features which will lead to more problems that are more important than this problem.
I don’t like changing the feature number (1) because I would like to keep Ring code more clean and let the programmer
decide when to use $ or not.
I don’t like changing the feature number (2) because I like this feature and I don’t like forcing the programmer to type
self.attribute
I don’t like changing the feature number (3) because it’s very important in many applications to access global variables
in the class region.
So what was my decision ?
I decided to leave this case for the programmer who will decide what to do to avoid this special case
1 - The programmer can avoid using global variables (Better) and can use the Main function (Optional)
2 - The programmer can use $ before the variable name or any mark like global_ or g_
3 - The programmer can use self.attribute after the class name to define the attributes
In general, for small programs you can use global variables and functions. For large programs, use classes and objects
and small number of global variables or avoid them at all.
100.25. Why Ring doesn’t avoid the conflict between Global Variables and Class Attributes
Names?
1790
9. Ring Documentation, Release 1.6
100.26 Where can I write a program and execute it?
Run the Ring Notepad where you can write/execute programs.
If you want to run programs using the command line
Add Ring/bin folder to the path then
100.27 How to get the file size using ftell() and fseek() functions?
The next function can be used to get the file size without reading the file!
func getFileSize fp
C_FILESTART = 0
C_FILEEND = 2
fseek(fp,0,C_FILEEND)
nFileSize = ftell(fp)
fseek(fp,0,C_FILESTART)
return nFileSize
Note: The previous function take the fp (file pointer) as parameter, We can get the fp from opening the file using
fopen() function.
fp = fopen("filename","r")
see "File Size : " + getFileSize(fp) + nl
Another solution (Read the file)
see len(read("filename"))
100.28 How to get the current source file path?
We can use the next function to get the current source file path then we can add the path variable to the file name
cPath = CurrentPath()
func currentpath
cFileName = filename()
for x = len(cFileName) to 1 step -1
if cFileName[x] = "/"
return left(cFileName,x-1)
ok
next
return cFileName
100.29 What about predefined parameters or optional parameters in
functions?
if you want to use predefined parameters or optional parameters Just accept a list that works like hash/dictionary
Example
100.26. Where can I write a program and execute it? 1791
10. Ring Documentation, Release 1.6
sum([ :a = 1, :b = 2])
sum([ :a = 1 ])
sum([ :b = 2 ])
func sum pList
if plist[:a] = NULL pList[:a] = 4 ok
if plist[:b] = NULL pList[:b] = 5 ok
see pList[:a] + pList[:b] + nl
Output
3
6
6
100.30 How to print keys or values only in List/Dictionary?
If you want to print keys only or values only just select the index of the item (one or two).
Example
C_COUNTRY = 1
C_CITY = 2
mylist = [
:KSA = "Riyadh" ,
:Egypt = "Cairo"
]
for x in mylist
see x[C_COUNTRY] + nl
next
for x in mylist
see x[C_CITY] + nl
next
Output
ksa
egypt
Riyadh
Cairo
100.31 Why I get a strange result when printing nl with lists?
In the next code
list = 1:5 # list = [1,2,3,4,5]
see list + nl
New Line will be added to the list then the list will be printed, the default print of the lists will print a newline at the
end, You added new newline and You have now 2 newlines to be printed.
See <Expr>
The see command just print the final result of the expression, the expression will be evaluated as it
100.30. How to print keys or values only in List/Dictionary? 1792