Tutorial by Examples

You can retrieve post data as Array. $post_data= $this->request->data; You can retrieve post data for particular key. $this->request->data['field']; Retrieve specific key value $this->request->data('key_name'); Retrieve specific key value of nested array $this->requ...
By default CakePHP loads the related model in the controller. In order to load another model in the controller, use the loadModel() method: $this->loadModel('Articles'); or load on the fly $table = TableRegistry::get('Articles'); $table->find();
Dim fso As New Scripting.FileSystemObject Debug.Print fso.GetBaseName("MyFile.something.txt") Prints MyFile.something Note that the GetBaseName() method already handles multiple periods in a file name.
Dim fso As New Scripting.FileSystemObject Debug.Print fso.GetExtensionName("MyFile.something.txt") Prints txt Note that the GetExtensionName() method already handles multiple periods in a file name.
When inheriting from base Controller class provided by the framework, you can use the convenience method ViewComponent() to return a view component from the action: public IActionResult GetMyComponent() { return ViewComponent("Login", new { param1 = "foo", param2 = 42 }); ...
There are a several different ways of sorting a collection. Sort() The sort method sorts the collection: $collection = collect([5, 3, 1, 2, 4]); $sorted = $collection->sort(); echo $sorted->values()->all(); returns : [1, 2, 3, 4, 5] The sort method also allows for passing in ...
In Ansible, a playbook is is a YAML file containing the definition of how a server should look. In a playbook you define what actions Ansible should take to get the server in the state you want. Only what you define gets done. This is a basic Ansible playbook that installs git on every host belongi...
The format of a playbook is quite straightforward, but strict in terms of spacing and layout. A playbook consists of plays. A play is a combination of targets hosts and the tasks we want to apply on these hosts, so a drawing of a playbook is this: To execute this playbook, we simply run: ansible...
Here’s a simple play: - name: Configure webserver with git hosts: webserver become: true vars: package: git tasks: - name: install git apt: name={{ package }} state=present As we said earlier, every play must contain: A set of hosts to configure A list of t...
To translate strings, you will have to create translation files. To do so, django ships with the management command makemessages. $ django-admin makemessages -l fr processing locale fr The above command will discover all strings marked as translatable within your installed apps and create one l...
Sometimes it is required to display a notification at a specific time, a task that unfortunately is not trivial on the Android system, as there is no method setTime() or similiar for notifications. This example outlines the steps needed to schedule notifications using the AlarmManager: Add a Broa...
Retrieving sensor information from the onboard sensors: public class MainActivity extends Activity implements SensorEventListener { private SensorManager mSensorManager; private Sensor accelerometer; private Sensor gyroscope; float[] accelerometerData = new float[3]; f...
The sensor values returned by Android are with respective to the phone's coordinate system (e.g. +Y points towards the top of the phone). We can transform these sensor values into a world coordinate system (e.g. +Y points towards magnetic North, tangential to the ground) using the sensor managers ro...
You can use the adb backup command to backup your device. adb backup [-f <file>] [-apk|-noapk] [-obb|-noobb] [-shared|-noshared] [-all] [-system|nosystem] [<packages...>] -f <filename> specify filename default: creates backup.ab in the current directory -apk|noapk...
Make sure the following dependency is added to your app's build.gradle file under dependencies: compile 'com.android.support:design:25.3.1' Show the hint from an EditText as a floating label when a value is entered. <android.support.design.widget.TextInputLayout android:layout_width=&qu...
TabLayout provides a horizontal layout to display tabs, and is commonly used in conjunction with a ViewPager. Make sure the following dependency is added to your app's build.gradle file under dependencies: compile 'com.android.support:design:25.3.1' Now you can add items to a TabLayout in your ...
One of the most used attribute for LinearLayout is the weight of its child views. Weight defines how much space a view will consume compared to other views within a LinearLayout. Weight is used when you want to give specific screen space to one component compared to other. Key Properties: wei...
Currency currency = Currency.getInstance("USD"); NumberFormat format = NumberFormat.getCurrencyInstance(); format.setCurrency(currency); format.format(10.00);
Hex Opacity Values ------------------------------ | Alpha(%) | Hex Value | ------------------------------ | 100% | FF | | 95% | F2 | | 90% | E6 | | 85% | D9 | | 80% | ...
<svg> <defs> <linearGradient id='g' y1="100%" x2="100%"> <stop offset='0%' stop-color='yellow' /> <stop offset='100%' stop-color='green' /> </linearGradient> </defs> <rect width=...

Page 441 of 1336