Tutorial by Examples: ces

In classes, super.foo() will look in superclasses only. If you want to call a default implementation from a superinterface, you need to qualify super with the interface name: Fooable.super.foo(). public interface Fooable { default int foo() {return 3;} } public class A extends Object impl...
SQL Server 2008 WITH XMLNAMESPACES ( DEFAULT 'http://www.w3.org/2000/svg', 'http://www.w3.org/1999/xlink' AS xlink ) SELECT 'example.jpg' AS 'image/@xlink:href', '50px' AS 'image/@width', '50px' AS 'image/@height' FOR XML PATH('svg') <svg xmlns:xlink="http:...
if [[ -r $filename ]]; then echo "$filename is a readable file" fi if [[ -w $filename ]]; then echo "$filename is a writable file" fi if [[ -x $filename ]]; then echo "$filename is an executable file" fi These tests take permissions and ownership into a...
We can illustrate this problem with the following pseudo-code function foo() { global $bob; $bob->doSomething(); } Your first question here is an obvious one Where did $bob come from? Are you confused? Good. You've just learned why globals are confusing and considered a bad p...
NSArray *myColors = @[@"Red", @"Green", @"Blue", @"Yellow"]; // Preceding is the preferred equivalent to [NSArray arrayWithObjects:...] Getting a single item The objectAtIndex: method provides a single object. The first object in an NSArray is index 0. Si...
Subpatterns can be referenced with their relative group number: (?-1) will recurse into the previous group (?+1) will recurse into the next group Also usable with the \g<N> syntax.
Generators can be used to represent infinite sequences: def integers_starting_from(n): while True: yield n n += 1 natural_numbers = integers_starting_from(1) Infinite sequence of numbers as above can also be generated with the help of itertools.count. The above code cou...
A reference cycle (or retain cycle) is so named because it indicates a cycle in the object graph: Each arrow indicates one object retaining another (a strong reference). Unless the cycle is broken, the memory for these objects will never be freed. A retain cycle is created when two instances of ...
Mark your UIView subclass as an accessible element so that it is visible to VoiceOver. myView.isAccessibilityElement = YES; Ensure that the view speaks a meaningful label, value, and hint. Apple provides more details on how to choose good descriptions in the Accessibility Programming Guide.
The accessibility frame is used by VoiceOver for hit testing touches, drawing the VoiceOver cursor, and calculating where in the focused element to simulate a tap when the user double-taps the screen. Note that the frame is in screen coordinates! myElement.accessibilityFrame = frameInScreenCoordina...
VoiceOver can navigate many apps on iOS because most UIKit classes implement UIAccessibilityProtocol. Features that don’t represent onscreen elements using UIView, including apps that leverage Core Graphics or Metal to perform drawing, must describe these elements for accessibility. As of iOS 8.0, t...
The getAll() method retrieves all values from the preferences. We can use it, for instance, to log the current content of the SharedPreferences: private static final String PREFS_FILE = "MyPrefs"; public static void logSharedPreferences(final Context context) { SharedPreferences s...
Introduction Interfaces are definitions of the public APIs classes must implement to satisfy the interface. They work as "contracts", specifying what a set of subclasses does, but not how they do it. Interface definition is much alike class definition, changing the keyword class to inter...
To access tuple elements use Item1-Item8 properties. Only the properties with index number less or equal to tuple size are going to be available (i.e. one cannot access Item3 property in Tuple<T1,T2>). var tuple = new Tuple<string, int, bool, MyClass>("foo", 123, true, new MyC...
In Python 2, range function returns a list while xrange creates a special xrange object, which is an immutable sequence, which unlike other built-in sequence types, doesn't support slicing and has neither index nor count methods: Python 2.x2.3 print(range(1, 10)) # Out: [1, 2, 3, 4, 5, 6, 7, 8, 9...
The Dim statement should be reserved for local variables. At module-level, prefer explicit access modifiers: Private for private fields, which can only be accessed within the module they're declared in. Public for public fields and global variables, which can be accessed by any calling code. Fr...
You can open the VB editor in any of the Microsoft Office applications by pressing Alt+F11 or going to the Developer tab and clicking on the "Visual Basic" button. If you don't see the Developer tab in the Ribbon, check if this is enabled. By default the Developer tab is disabled. To enab...
Different flavors of application builds can contain different resources. To create a flavor-specific resource make a directory with the lower-case name of your flavor in the src directory and add your resources in the same way you would normally. For example, if you had a flavour Development and w...
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...

Page 5 of 40