Tutorial by Examples: ce

In this example, we will look at a method for returning the last non-empty row in a column for a data set. This method will work regardless of empty regions within the data set. However caution should be used if merged cells are involved, as the End method will be "stopped" against a mer...
Another neat feature using slices is slice assignment. Python allows you to assign new slices to replace old slices of a list in a single operation. This means that if you have a list, you can replace multiple members in a single assignment: lst = [1, 2, 3] lst[1:3] = [4, 5] print(lst) # Out: [1...
All Java exceptions are instances of classes in the Exception class hierarchy. This can be represented as follows: java.lang.Throwable - This is the base class for all exception classes. Its methods and constructors implement a range of functionality common to all exceptions. java.lang.Excep...
To raise an exception use Kernel#raise passing the exception class and/or message: raise StandardError # raises a StandardError.new raise StandardError, "An error" # raises a StandardError.new("An error") You can also simply pass an error message. In this case, the message i...
A custom exception is any class that extends Exception or a subclass of Exception. In general, you should always extend StandardError or a descendant. The Exception family are usually for virtual-machine or system errors, rescuing them can prevent a forced interruption from working as expected. # ...
Use the begin/rescue block to catch (rescue) an exception and handle it: begin # an execution that may fail rescue # something to execute in case of failure end A rescue clause is analogous to a catch block in a curly brace language like C# or Java. A bare rescue like this rescues Stand...
You can handle multiple errors in the same rescue declaration: begin # an execution that may fail rescue FirstError, SecondError => e # do something if a FirstError or SecondError occurs end You can also add multiple rescue declarations: begin # an execution that may fail rescue ...
Today Fortran is mainly used for numerical computation. This very simple example illustrates the basic program structure to solve quadratic equations: program quadratic !a comment !should be present in every separate program unit implicit none real :: a, b, c real :: discriminant...
File f = new File(path); String content = new Scanner(f).useDelimiter("\\Z").next(); \Z is the EOF (End of File) Symbol. When set as delimiter the Scanner will read the fill until the EOF Flag is reached.
SharedPreferences sharedPreferences = ...; sharedPreferences.registerOnSharedPreferenceChangeListener(mOnSharedPreferenceChangeListener); private final SharedPreferences.OnSharedPreferenceChangeListener mOnSharedPreferenceChangeListener = new SharedPreferences.OnSharedPreferenceChangeListener(...
Here is some sample XML against which example XPaths can be written: <r> <e a="1"/> <f a="2" b="1">Text 1</f> <f/> <g> <i c="2">Text 2</i> Text 3 <j>Text 4</j> </g&gt...
Multiple inheritance is a feature that allows one class to inherit from multiple classes(i.e., more than one parent). Ruby does not support multiple inheritance. It only supports single-inheritance (i.e. class can have only one parent), but you can use composition to build more complex classes using...
slice1 := []string{"!"} slice2 := []string{"Hello", "world"} slice := append(slice1, slice2...) Run in the Go Playground
A namespace declaration can look as follows: namespace MyProject; - Declare the namespace MyProject namespace MyProject\Security\Cryptography; - Declare a nested namespace namespace MyProject { ... } - Declare a namespace with enclosing brackets. It is recommended to only declare a single na...
As shown in Declaring Namespaces, we can define a class in a namespace as follows: namespace MyProject\Shapes; class Rectangle { ... } To reference this class the full path (including the namespace) needs to be used: $rectangle = new MyProject\Shapes\Rectangle(); This can be shortened by ...
.htaccess files (or "distributed configuration files") provide a way to make configuration changes on a per-directory basis. A file, containing one or more configuration directives, is placed in a particular document directory, and the directives apply to that directory, and all su...
PrimeFaces can be used in all web applications based on Java Server Faces (version 2.x) which are run on Servlet Containers (e.g. Wildlfy or Tomcat or GlassFish). There are several ways you can add PrimeFaces to your application. Manually Download the primefaces-{version}.jar and add it to you cl...
To access member variables and member functions of an object of a class, the . operator is used: struct SomeStruct { int a; int b; void foo() {} }; SomeStruct var; // Accessing member variable a in var. std::cout << var.a << std::endl; // Assigning member variable b in v...
To get a verbose list of all devices connected to adb, write the following command in your terminal: adb devices -l Example Output List of devices attached ZX1G425DC6 device usb:336592896X product:shamu model:Nexus_6 device:shamu 013e4e127e59a868 device usb:337641472X produc...
Write the following command in your terminal: adb shell getprop This will print all available information in the form of key/value pairs. You can just read specific information by appending the name of a specific key to the command. For example: adb shell getprop ro.product.model Here are a...

Page 13 of 134