Tutorial by Examples: c

project('Vala Project') glib_dep = dependency('glib-2.0') gobject_dep = dependency('gobject-2.0') executable('foo', 'foo.vala', dependencies: [glib_dep, gobject_dep]) Note: both glib-2.0 and gobject-2.0 dependencies are required unless --nostdpkg is explicitly given.
project('Posix-based Project', 'vala') add_project_arguments(['--nostdpkg'], language: 'vala') posix_dep = meson.get_compiler('vala').find_library('posix') executable('foo', 'foo.vala', dependencies: [posix_dep])
project('Mixed sources Project', 'vala') glib_dep = dependency('glib-2.0') gobject_dep = dependency('gobject-2.0') executable('foo', 'foo.vala', 'bar.c', dependencies: [glib_dep, gobject_dep]) In foo.vala: namespace Foo { public extern int bar (); public int main (string[] arg...
<?php $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://api.dropboxapi.com/2/files/list_folder"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CAINFO, "cacert.pem"); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOP...
public class Foo : Object { public string prop { construct; get; } } It is meant for interospectable API using GObject Introspection. This is the recommended way for declaring classes.
public class Foo { public string prop { construct; get; } } Pure-Vala and lightweight class. This is useful if you need a compromise between efficiency of a struct and the feature of a full blown GObject class.
[Compact] public class Foo { public string prop; } It is mainly used for writing bindings with specific memory management.
import javax.inject.Singleton; import dagger.Module; import dagger.Provides; @Module public class VehicleModule { @Provides @Singleton Motor provideMotor(){ return new Motor(); } @Provides @Singleton Vehicle provideVehicle(){ return new Vehicle(...
Now that you have the providers for your different models, you need to request them. Just as Vehicle needs Motor, you have to add the @Inject annotation in the Vehicle constructor as follows: @Inject public Vehicle(Motor motor){ this.motor = motor; } You can use the @Inject annotation to ...
The connection between the provider of dependencies, @Module, and the classes requesting them through @Inject is made using @Component, which is an interface: import javax.inject.Singleton; import dagger.Component; @Singleton @Component(modules = {VehicleModule.class}) public interface Vehicl...
Now that you have every connection ready, you have to obtain an instance of this interface and invoke its methods to obtain the object you need: VehicleComponent component = Dagger_VehicleComponent.builder().vehicleModule(new VehicleModule()).build(); vehicle = component.provideVehicle(); Toast.m...
Arrays can be passed to proceedures by putting () after the name of the array variable. Function countElements(ByRef arr() As Double) As Long countElements = UBound(arr) - LBound(arr) + 1 End Function Arrays must be passed by reference. If no passing mechanism is specified, e.g. myFunction...
# Getting started First, let’s generate a new Ruby on Rails application: rails new ModularTodo The next step is to generate an engine! cd ModularTodo && rails plugin new todo --mountable We will also create an ‘engines’ folder to store the engines (even if we just have one!). mk...
There are several ways interact with an Xml file. Xml Document XDocument XmlReader/XmlWriter Before LINQ to XML we were used XMLDocument for manipulations in XML like adding attributes, elements and so on. Now LINQ to XML uses XDocument for the same kind of thing. Syntaxes are much easie...
Django REST Framework has some authentication methods already built in, one of them is Token based, so first thing to do is to tell our project we’re going to use rest framework’s authentication. Open settings.py file and add the highlighted line. INSTALLED_APPS = ( 'django.contrib.admin', ...
If a curl would be run against this endpoint curl http://localhost:8000/auth/ op : {"detail": "Authentication credentials were not provided."}% would return a 401 error UNAUTHORIZED but in case we get a token before: curl -X POST -d "user=Pepe&password=aaaa&qu...
Components let you split the UI into independent, reusable pieces. This is the beauty of React; we can separate a page into many small reusable components. Prior to React v14 we could create a stateful React component using React.Component (in ES6), or React.createClass (in ES5), irrespective of wh...
Access modifiers are used to control the access to an object or to a function/method. This is a main part of the concept of Abstraction. Different programming languages use different access modifiers. Here are some examples: Java Java has 4 access modifiers. private - These attributes can ...
use Time::HiRes qw( time ); my $start = time(); #Code for which execution time is calculated sleep(1.2); my $end = time(); printf("Execution Time: %0.02f s\n", $end - $start); This will print execution time of Code in seconds
<div class="row"> <div class="col-sm-9"> Level 1: .col-sm-9 <div class="row"> <div class="col-xs-8 col-sm-6"> Level 2: .col-xs-8 .col-sm-6 </div> <div class="col-xs-4 col-sm-6&quo...

Page 709 of 826