Tutorial by Examples: ti

ABAP Classes can be declared Globally or Locally. A global class can be used by any object within the ABAP repository. By contrast, a local class can only be used within the scope it is declared. CLASS lcl_abap_class DEFINITION. PUBLIC SECTION. PROTECTED SECTION. PRIVATE SECTION. ENDCLASS...
Class implementation: CLASS lcl_abap_class DEFINITION. PRIVATE SECTION. METHODS method1 IMPORTING iv_string TYPE string CHANGING cv_string TYPE string EXPORTING ev_string TYPE string. ENDCLASS. CLASS lcl_abap_class IMPLEMENTATION. METHOD m...
Type type = obj.GetType(); //To restrict return properties. If all properties are required don't provide flag. BindingFlags flags = BindingFlags.Public | BindingFlags.Instance; PropertyInfo[] properties = type.GetProperties(flags); foreach (PropertyInfo property in properties) { Console...
You can add an interpreter directive (shebang) to your script. Create a file called hello_world.rb which contains: #!/usr/bin/env ruby puts 'Hello World!' Give the script executable permissions. Here's how to do that in Unix: $ chmod u+x hello_world.rb Now you do not need to call the Ru...
To document a function, it is often helpful to have an example script which uses your function. The publish function in Matlab can then be used to generate a help file with embedded pictures, code, links, etc. The syntax for documenting your code can be found here. The Function This function uses ...
These are the most common ways to create an instance of Guid: Creating an empty guid (00000000-0000-0000-0000-000000000000): Guid g = Guid.Empty; Guid g2 = new Guid(); Creating a new (pseudorandom) Guid: Guid g = Guid.NewGuid(); Creating Guids with a specific value: Guid g = n...
Prerequisite: Installing Gradle Once you have Gradle installed, you can setup a new or existing project by running cd $PROJECT_DIR gradle init --type=java-library Note that there are other project types like Scala you can get started with, but we'll use Java for this example. You will end up ...
let x = true match x with | true -> printfn "x is true" yields a warning C:\Program Files (x86)\Microsoft VS Code\Untitled-1(2,7): warning FS0025: Incomplete pattern matches on this expression. For example, the value 'false' may indicate a case not covered by the pattern(s). ...
type Person = { Age : int PassedDriversTest : bool } let someone = { Age = 19; PassedDriversTest = true } match someone.PassedDriversTest with | true when someone.Age >= 16 -> printfn "congrats" | true -> printfn "wait until you are 16" | false -> p...
>>> code = """for i in range(5):\n print('Hello world!')""" >>> exec(code) Hello world! Hello world! Hello world! Hello world! Hello world!
>>> expression = '5 + 3 * a' >>> a = 5 >>> result = eval(expression) >>> result 20
compile built-in function can be used to precompile an expression to a code object; this code object can then be passed to eval. This will speed up the repeated executions of the evaluated code. The 3rd parameter to compile needs to be the string 'eval'. >>> code = compile('a * b + c', '&l...
>>> variables = {'a': 6, 'b': 7} >>> eval('a * b', globals=variables) 42 As a plus, with this the code cannot accidentally refer to the names defined outside: >>> eval('variables') {'a': 6, 'b': 7} >>> eval('variables', globals=variables) Traceback (most ...
You can fetch the current properties of the Annotation by using Reflection to fetch the Method or Field or Class which has an Annotation applied to it, and then fetching the desired properties. @Retention(RetentionPolicy.RUNTIME) @interface MyAnnotation { String key() default "foo";...
As the static keyword is used for accessing fields and methods without an instantiated class, it can be used to declare constants for use in other classes. These variables will remain constant across every instantiation of the class. By convention, static variables are always ALL_CAPS and use unders...
Static gives a method or variable storage that is not allocated for each instance of the class. Rather, the static variable is shared among all class members. Incidentally, trying to treat the static variable like a member of the class instance will result in a warning: public class Apple { pu...
It is possible to create a QtQuick view directly from C++ and to expose to QML C++ defined properties. In the code below the C++ program creates a QtQuick view and exposes to QML the height and width of the view as properties. main.cpp #include <QApplication> #include <QQmlContext> #...
If you want to mock AR that doesn't try to connect to database you can do it in the following way (if using PHPUnit): $post = $this->getMockBuilder('\app\model\Post') ->setMethods(['save', 'attributes']) ->getMock(); $post->method('save')->willReturn(true); $post->meth...
The Application directive defines application-specific attributes. It is provided at the top of the global.aspx file. The basic syntax of Application directive is: <%@ Application Language="C#" %> The attributes of the Application directive are: AttributesDescriptionInheritsThe...
The control directive is used with the user controls and appears in the user control (.ascx) files. The basic syntax of Control directive is: <%@ Control Language="C#" EnableViewState="false" %> The attributes of the Control directive are: AttributesDescriptionAutoEv...

Page 108 of 505