Tutorial by Examples: e

The simplest way to get an event handler called on a key press is to connect the handler to the key-press-event signal. In this example, we register for the event for the whole window, but you can also register for individual widgets too. The most important part is the connection of the handler to ...
UIView *view = [[UIView alloc] init]; [self.view addSubview:view]; //Use the function if you want to use height as constraint [self addView:view onParentView:self.view withHeight:200.f]; //Use this function if you want to add view with respect to parent and should resize with it [self a...
Could be even more basic, but this showcases some of the features the Vala language. The code using Gtk; int main (string[] args) { Gtk.init (ref args); var window = new Window (); window.title = "First GTK+ Program"; window.border_width = 10; window.window_...
Angular Forms and Inputs have various states that are useful when validating content Input States StateDescription$touchedField has been touched$untouchedField has not been touched$pristineField has not been modified$dirtyField has been modified$validField content is valid$invalidField content is ...
Angular also provides some CSS classes for forms and inputs depending on their state ClassDescriptionng-touchedField has been touchedng-untouchedField has not been touchedng-pristineField has not been modifiedng-dirtyField has been modifiedng-validField is validng-invalidField is invalid You can u...
To help you find and count characters in a string, CharMatcher provides the following methods: int indexIn(CharSequence sequence) Returns the index of the first character that matches the CharMatcher instance. Returns -­1 if no character matches. int indexIn(CharSequence sequence, int sta...
var source = new AutoCompleteStringCollection(); // Add your collection of strings. source.AddRange(new[] { "Guybrush Threepwood", "LeChuck" }); var textBox = new TextBox { AutoCompleteCustomSource = source, AutoCompleteMode = AutoCompleteMode.SuggestAppend, ...
textBox.KeyPress += (sender, e) => e.Handled = !char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar); This will only permit the use of digits and control characters in the TextBox, other combinations are possible using the same approach of setting the Handle property to true to block ...
textBox.SelectionStart = textBox.TextLength; textBox.ScrollToCaret(); Applying the same principle, SelectionStart can be set to 0 to scroll to the top or to a specific number to go to a specific character.
// initialize a LinkedList of integers LinkedList list = new LinkedList<int>(); // add some numbers to our list. list.AddLast(3); list.AddLast(5); list.AddLast(8); // the list currently is 3, 5, 8 list.AddFirst(2); // the list now is 2, 3, 5, 8 list.RemoveFirst(); // the list...
A StringBuilder represents a series of characters, which unlike a normal string, are mutable. Often times there is a need to modify strings that we've already made, but the standard string object is not mutable. This means that each time a string is modified, a new string object needs to be created,...
Type Annotations // There should be one space after the colon of the type // annotation. This rule applies in variable declarations, // struct fields, functions and methods. // GOOD: let mut buffer: String = String::new(); // BAD: let mut buffer:String = String::new(); let mut buffer : Str...
Sometimes we want the model to give more weight to some data points or examples than others. This is possible by specifying the weight for the input data while learning the model. There are generally two kinds of scenarios where we might use non-uniform weights over the examples: Analytic Weights...
Short circuiting is a functionality that skips evaluating parts of a (if/while/...) condition when able. In case of a logical operation on two operands, the first operand is evaluated (to true or false) and if there is a verdict (i.e first operand is false when using &&, first operand is tr...
If you are using Leiningen and your tests are located in the test directory in your project root then you can run your tests using lein test
OSX Implement the contract of the role-specific protocol (NSAccessibilityButton, NSAccessibilityImage, NSAccessibilityGroup, etc) within the NSAccessibility protocol that best matches the behavior of the GUI element being rendered. Linux / BSD For GNOME applications, the GNOME Accessibility Impl...
Eager loading lets you load all your needed entities at once. If you prefer to get all your entities to work on in one database call, then Eager loading is the way to go. It also lets you load multiple levels. You have two options to load related entities, you can choose either strongly typed or st...
After turning Lazy loading off you can lazily load entities by explicitly calling Load method for entries. Reference is used to load single navigation properties, whereas Collection is used to get collections. Company company = context.Companies.FirstOrDefault(); // Load founder context.Entry(com...
The most common way is to apply the extension via Config. Example: # File: mysite/_config/config.yml Member: extensions: - MyMemberExtension The extensions config variable is of type "array", so you can add multiple extensions like this: # File: mysite/_config/config.yml Mem...
Some procedures have optional arguments. Optional arguments always come after required arguments, but the procedure can be called without them. For example, if the function, ProcedureName were to have two required arguments (argument1, argument2), and one optional argument, optArgument3, it could b...

Page 564 of 1191