Tutorial by Examples: c

Using a new List List<String> list = new ArrayList<String>(listOfElements); Using List.addAll() method Set<String> set = new HashSet<String>(); set.add("foo"); set.add("boo"); List<String> list = new ArrayList<String&...
The format of the struct statement is this: struct [structure tag] { member definition; member definition; ... member definition; } [one or more structure variables]; Example: declare the ThreeFloats structure: typedef struct { float x, y, z; } ThreeFloats; @inter...
The common error using ssh is to see the error like @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY! Someone c...
Class Car Private wheels_ Private distances_ ' Property getter Public Property Get Wheels() Wheels = wheels_ End Property ' Property setter Public Property Let Wheels(v) wheels_ = v End Property ' Parameterless Constructo...
' Initialize the object Dim myCar Set myCar = new Car ' Setting a property myCar.Wheels = 4 ' Getting a property value wscript.echo myCar.Wheels ' Using a subroutine in a class myCar.Drive 10 myCar.Drive 12 ' Using a function in a class wscript.echo myCar.GetTotalDistance() ' r...
' Making a factory with parameter to the class Public Function new_Car(wheels) Set new_Car = New Car new_Car.Wheels = wheels End Function ' Creating a car through a factory Dim semiTrailer Set semiTrailer = new_Car(18)
Conversion SpecifierType of ArgumentDescriptioni, dintprints decimaluunsigned intprints decimalounsigned intprints octalxunsigned intprints hexadecimal, lower-caseXunsigned intprints hexadecimal, upper-casefdoubleprints float with a default precision of 6, if no precision is given (lower-case used f...
Useful information The very beginning of the text field text: let startPosition: UITextPosition = textView.beginningOfDocument The very end of the text field text: let endPosition: UITextPosition = textView.endOfDocument The currently selected range: let selectedRange: UITextRange? = textV...
The example below shows how to add a navigation bar button (called a UIBarButtonItem) in the Interface Builder. Add a Navigation Controller to your Storyboard Select your View Controller and then in the Xcode menu choose Editor > Embed In > Navigation Controller. Alternatively, you could ...
Below is an example of a pure Xamarin Forms custom control. No custom rendering is being done for this but could easily be implemented, in fact, in my own code, I use this very same control along with a custom renderer for both the Label and Entry. The custom control is a ContentView with a Label, ...
There are a couple of default recognizers available in Xamarin.Forms, one of them is the TapGestureRecognizer. You can add them to virtually any visual element. Have a look at a simple implementation which binds to an Image. Here is how to do it in code. var tappedCommand = new Command(() => {...
In order to make an Image (or any other visual element) zoomable we have to add a PinchGestureRecognizer to it. Here is how to do it in code: var pinchGesture = new PinchGestureRecognizer(); pinchGesture.PinchUpdated += (s, e) => { // Handle the pinch }; image.GestureRecognizers.Add(pi...
When you have a zoomed Image (or other content) you may want to drag around the Image to show all of its content in the zoomed in state. This can be achieved by implementing the PanGestureRecognizer. From code this looks like so: var panGesture = new PanGestureRecognizer(); panGesture.PanUpdated...
EntryPage.xaml: <?xml version="1.0" encoding="utf-8" ?> <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:vm="clr-namespace:MyAssembly.ViewModel;a...
For clarity and maintainability, it is often recommended to develop a system or schema for naming your Redis keys. Here are some examples of common and maintainable systems for naming your keys: user:10134 user:10134:favorites user:10134:friends user:10134:friends-of-friends user:10134 user:...
The System.String.Trim method can be used to remove all leading and trailing white-space characters from a string: string s = " String with spaces at both ends "; s = s.Trim(); // s = "String with spaces at both ends" In addition: To remove white-space only fro...
Using the System.String.Replace method, you can replace part of a string with another string. string s = "Hello World"; s = s.Replace("World", "Universe"); // s = "Hello Universe" All the occurrences of the search string are replaced: string s = "He...
The System.String.Join method allows to concatenate all elements in a string array, using a specified separator between each element: string[] words = {"One", "Two", "Three", "Four"}; string singleString = String.Join(",", words); // singleString =...
String Concatenation can be done by using the System.String.Concat method, or (much easier) using the + operator: string first = "Hello "; string second = "World"; string concat = first + second; // concat = "Hello World" concat = String.Concat(first, second); // ...
In some cases we need to apply functions to a set of ND-arrays. Let's look at this simple example. A(:,:,1) = [1 2; 4 5]; A(:,:,2) = [11 22; 44 55]; B(:,:,1) = [7 8; 1 2]; B(:,:,2) = [77 88; 11 22]; A = ans(:,:,1) = 1 2 4 5 ans(:,:,2) = 11 22 44 55 >&...

Page 326 of 826