Tutorial by Examples: ect

One of the more useful things about const correctness is that it serves as a way of documenting code, providing certain guarantees to the programmer and other users. These guarantees are enforced by the compiler due to constness, with a lack of constness in turn indicating that code doesn't provide...
No Java variable represents an object. String foo; // NOT AN OBJECT Neither does any Java array contain objects. String bar[] = new String[100]; // No member is an object. If you mistakenly think of variables as objects, the actual behavior of the Java language will surprise you. For...
Here is a simple Sprite-Kit GameScene.swift. Create a new, empty SpriteKit project and replace the GameScene.swift with this. Then build and run. Click on any of the objects on screen to give make them move. Check the logs and the comments to see which ones collide and which ones make contact. // ...
Uses C standard format codes. from datetime import datetime datetime_string = 'Oct 1 2016, 00:00:00' datetime_string_format = '%b %d %Y, %H:%M:%S' datetime.strptime(datetime_string, datetime_string_format) # datetime.datetime(2016, 10, 1, 0, 0)
Uses C standard format codes. from datetime import datetime datetime_for_string = datetime(2016,10,1,0,0) datetime_string_format = '%b %d %Y, %H:%M:%S' datetime.strftime(datetime_for_string,datetime_string_format) # Oct 01 2016, 00:00:00
Consider the following Java classes: class Foo { private Bar bar; public void foo() { bar.baz(); } } As can be seen, the class Foo needs to call the method baz on an instance of another class Bar for its method foo to work successfully. Bar is said to be a dependency for Foo sin...
The same examples as shown above with XML configuration can be re-written with Java configuration as follows. Constructor injection @Configuration class AppConfig { @Bean public Bar bar() { return new Bar(); } @Bean public Foo foo() { return new Foo(bar()); } } Property in...
Objective-C Import the following to your ViewController #import <CoreImage/CoreImage.h> #import <CoreImage/CoreImage.h> #import <QuartzCore/QuartzCore.h> Call the function [self faceDetector]; Function definition: -(void)faceDetector { // Load the picture for face...
Processing provides method rect() to draw a rectangle. This code draws a white 50 X 50 rectangle on black background. void setup() { size(500, 500); background(0); fill(255); noStroke(); } void draw() { rect(225, 225, 50, 50); } The signature of method rect() is thi...
If you're creating an image, decoding an image, or resizing an image to fit the large notification image area, you can get the correct pixel dimensions like so: Resources resources = context.getResources(); int width = resources.getDimensionPixelSize(android.R.dimen.notification_large_icon_width)...
Selecting data with condition $query = $this->db->select('*') ->from('table_name') ->where('column_name', $value) // Condition ->get(); return $query->result(); Selecting data with multiple conditions $conditions =...
USER_SOURCE describes the text source of the stored objects owned by the current user. This view does not display the OWNER column. select * from user_source where type='TRIGGER' and lower(text) like '%order%' ALL_SOURCE describes the text source of the stored objects accessible to the current ...
ObservableCollection is a collection of type T like List<T> which means that it holds objects of type T. From documentation we read that : ObservableCollectionrepresents a dynamic data collection that provides notifications when items get added, removed, or when the entire list is refres...
To do anything with an IMAP account you need to connect to it first. To do this you need to specify some required parameters: The server name or IP address of the mail server The port you wish to connect on IMAP is 143 or 993 (secure) POP is 110 or 995 (secure) SMTP is 25 or 465 (secure) N...
Objective-C //Checking for 3-D Touch availability if ([self.traitCollection respondsToSelector:@selector(forceTouchCapability)] && (self.traitCollection.forceTouchCapability == UIForceTouchCapabilityAvailable)) { [self registerForPreviewingWithDelegate:self sourceVie...
Each control has a property DataBindings which is a list of System.Windows.Forms.Binding objects. The Add()-method has some overloads which enables you easily binding to the property of an object: textBox.DataBindings.Add( "Text", dataObj, "MyProperty" ); Note, that binding b...
// myString is "hi" NSMutableString *reversedString = [NSMutableString string]; NSInteger charIndex = [myString length]; while (charIndex > 0) { charIndex--; NSRange subStrRange = NSMakeRange(charIndex, 1); [reversedString appendString:[myString substringWithRange:subS...
There are many reasons a write operation may fail. A frequent one is because your security rules reject the operation, for example because you're not authenticated (by default a database can only be accessed by an authenticated user). You can see these security rule violations in the console output...
To connect to a server we must use SSH on the client as follows, # ssh -p port user@server-address port - The listening ssh port of the server (default port 22). user - Must be an existing user on the server with SSH privileges. server address - The IP/Domain of the server. For a real wor...

Page 74 of 99