Tutorial by Examples: c

View tables ActiveRecord::Base.connection.tables Delete any table. ActiveRecord::Base.connection.drop_table("users") ------------OR---------------------- ActiveRecord::Migration.drop_table(:users) ------------OR--------------------- ActiveRecord::Base.connect...
Most examples of a function returning a value involve providing a pointer as one of the arguments to allow the function to modify the value pointed to, similar to the following. The actual return value of the function is usually some type such as an int to indicate the status of the result, whether ...
Debugging by raising exceptions is far easier than squinting through print log statements, and for most bugs, its generally much faster than opening up an irb debugger like pry or byebug. Those tools should not be your first step. Debugging Ruby/Rails Quickly: 1. Fast Method: Raise an Exceptio...
UIDevice *deviceInfo = [UIDevice currentDevice]; NSLog(@"Device Name %@", deviceInfo.name); //Ex: myIphone6s NSLog(@"System Name %@", deviceInfo.systemName); //Device Name iPhone OS NSLog(@"System Version %@", deviceInfo.systemVersion); //System Version 9.3...
UIDevice *deviceInfo = [UIDevice currentDevice]; int d = deviceInfo.orientation; deviceInfo.orientation returns an UIDeviceOrientation value which is shown as below: UIDeviceOrientationUnknown 0 UIDeviceOrientationPortrait 1 UIDeviceOrientationPortraitUpsideDown 2 UIDeviceOrientationLandscap...
//Get permission for Battery Monitoring [[UIDevice currentDevice] setBatteryMonitoringEnabled:YES]; UIDevice *myDevice = [UIDevice currentDevice]; [myDevice setBatteryMonitoringEnabled:YES]; double batLeft = (float)[myDevice batteryLevel] * 100; NSLog(@"%.f",batLeft); int d = myD...
String to immutable ubyte[] string s = "unogatto"; immutable(ubyte[]) ustr = cast(immutable(ubyte)[])s; assert(typeof(ustr).stringof == "immutable(ubyte[])"); assert(ustr.length == 8); assert(ustr[0] == 0x75); //u assert(ustr[1] == 0x6e); //n assert(ustr[2] == 0x6f); //o...
The Google Analytics APIs allow you to access data within Google Analytics. It should not be confused with the measurement protocol which is used for inserting data into Google Analytics. The Google Analytics API is split into serval parts. Google Analytics Reporting APIs The Google Analytic...
This example uses the official Google .net Client library. PM> Install-Package Google.Apis.AnalyticsReporting.v4 Authorization Requires one of the following OAuth scopes: https://www.googleapis.com/auth/analytics.readonly https://www.googleapis.com/auth/analytics Oauth2 // The...
Create a folder in your project folder, and add your fonts to it. Example: Example: Here we added a folder in root called "mystuff", then "fonts", and inside it we placed our fonts: Add the below code in package.json. { ... "rnpm":...
Inside a Project configuration, you can Create build configuration: Manually Provide a Name and a Description. The Build Configuration ID is generated from the ProjectName, and the Build Configuration Name's. Once your configuraion is Saved, you can specify a Version Control Settings. This will ...
bool is a datatype defined in C99. Boolean values are used in conditionals, such as if or while statements, to conditionally perform logic or repeat execution. When evaluating a conditional statement, the value 0 is considered “false”, while any other value is considered “true”. Because NULL ...
Example uses the Google APIs Dotnet client library. PM> Install-Package Google.Apis.AnalyticsReporting.v4 /// <summary> /// This method requests Authentcation from a user using Oauth2. /// Credentials are stored in System.Environment.SpecialFolder.Personal /// Do...
Usually when generating random numbers it is useful to generate integers within a range, or a p value between 0.0 and 1.0. Whilst modulus operation can be used to reduce the seed to a low integer this uses the low bits, which often go through a short cycle, resulting in a slight skewing of distribut...
The backup menu is in the Administration Panel. And in the Left menu, inside the Server Administration, go on Backup. TeamCity (as of v10) does not automatically backup, but you can get TeamCity to back itself up on a daily basis by scheduling a task to hit the REST api. Typically you would also n...
// Let's take an arbitrary piece of data, a 4-byte integer in this case let some_data: u32 = 14; // Create a constant raw pointer pointing to the data above let data_ptr: *const u32 = &some_data as *const u32; // Note: creating a raw pointer is totally safe but dereferencing a raw pointe...
// Let's take a mutable piece of data, a 4-byte integer in this case let mut some_data: u32 = 14; // Create a mutable raw pointer pointing to the data above let data_ptr: *mut u32 = &mut some_data as *mut u32; // Note: creating a raw pointer is totally safe but dereferencing a raw pointe...
Just like in C, Rust raw pointers can point to other raw pointers (which in turn may point to further raw pointers). // Take a regular string slice let planet: &str = "Earth"; // Create a constant pointer pointing to our string slice let planet_ptr: *const &str = &planet ...
It's possible to navigate the browser directly, like using the standard toolbar commands available on all browsers: You can create a navigation object by calling Navigate() on the driver: IWebDriver driver INavigation navigation = driver.Navigate(); A navigation object allows you to perform ...
Objective-C UIGraphicsBeginImageContext(self.view.frame.size); [[UIImage imageNamed:@"image.png"] drawInRect:self.view.bounds]; UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); self.view.backgroundColor = [UIColor colorWithPatternIma...

Page 604 of 826