Tutorial by Examples: bas

Simple form, validation and submission functions to create a "mailing list" feature. This can then be applied to either the basic page or basic block examples. Assumes you have created a table in the drupal database called 'mailing_list' with the fields first name, last name and email ad...
Can be used in conjunction with the custom form example to create a table in the drupal database for a Mailing List feature. This example was made by creating the table directly in my development database, then created the data for hook_schema() using the Schema module. This allows for automatic t...
component file @Component({ selector: 'example-test-compnent', template: '<div> <div>{{user.name}}</div> <div>{{user.fname}}</div> <div>{{user.email}}</div> </div>' }) ex...
@sorted = sort @list; @sorted = sort { $a cmp $b } @list; sub compare { $a cmp $b } @sorted = sort compare @list; The three examples above do exactly the same thing. If you don't supply any comparator function or block, sort assumes you want the list on its right sorted lexically. This is ...
app.component.html <div> <div> <div *ngFor="let user of users"> <button class="btn" [@buttonState]="user.active" (click)="user.changeButtonState()">{{user.firstName}}</button> <...
Parent component : import {Component} from '@angular/core'; @Component({ selector: 'parent-component', templateUrl: './parent-component.html' }) export class ParentComponent { users : Array<User> = []; changeUsersActivation(user : User){ user.changeButtonState(); } ...
Hello friends before start code we have need to declare dependency for access firebase ui component, so here is the dependency which you can put it in your gradel other wise you can add dependency as jar also. compile 'com.firebaseui:firebase-ui-database:0.4.0' Then after we are querying in fire...
Create your new project folder and open in windows-command prompt with the location of project folder. Type "dotnet new -t web" and hit. This is for creating new mvc template. Once complete. GO to the project location and see basic mvc project has been created. The...
A simple GET request. Let's assume the Model from the example above is in the file ./db/models/Article.js. const express = require('express'); const Articles = require('./db/models/Article'); module.exports = function (app) { const routes = express.Router(); routes.get('/articles', (r...
Let's say we want to use libc's ntohl function. First, we must load libc.so: >>> from ctypes import * >>> libc = cdll.LoadLibrary('libc.so.6') >>> libc <CDLL 'libc.so.6', handle baadf00d at 0xdeadbeef> Then, we get the function object: >>> ntohl = l...
The most basic object is an int: >>> obj = ctypes.c_int(12) >>> obj c_long(12) Now, obj refers to a chunk of memory containing the value 12. That value can be accessed directly, and even modified: >>> obj.value 12 >>> obj.value = 13 >>> obj c_...
Shows a very basic schema. Note: by convention elementFormDefault is set to 'qualified', in the really world you will be hard pressed to find a schema that does not set this (so just include it in your schemas!). <?xml version="1.0" encoding="utf-8" ?> <!--Created wit...
public class Program { public static void Main(string[] args) { Console.WriteLine("\nWhat is your name? "); var name = Console.ReadLine(); var date = DateTime.Now; Console.WriteLine("\nHello, {0}, on {1:d} at {1:t}", name, date); ...
/** * NetSuite will loop through each record in your search * and pass the record type and id for deletion * Try / Catch is useful if you wish to handle potential errors */ function MassDelete(record_type, record_id) { try { nlapiDeleteRecord(record_type, record_id...
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])
Opening a database is database specific, here there are examples for some databases. Sqlite 3 file := "path/to/file" db_, err := sql.Open("sqlite3", file) if err != nil { panic(err) } MySql dsn := "mysql_username:CHANGEME@tcp(localhost:3306)/dbname" db, e...
Objective-C example of swizzling UIView's initWithFrame: method static IMP original_initWithFrame; + (void)swizzleMethods { static BOOL swizzled = NO; if (!swizzled) { swizzled = YES; Method initWithFrameMethod = class_getInstanceMethod([UIView class], ...
Assume we need to add an NSString object to SomeClass (we cant subclass). In this example we not only create an associated object but also wrap it in a computed property in a category for extra neatness #import <objc/runtime.h> @interface SomeClass (MyCategory) // This is the property wr...
We show a plot similar to the showed at Linear regression on the mtcars dataset. First with defaults and the with some customization of the parameters. #help("mtcars") fit <- lm(mpg ~ wt, data = mtcars) bs <- round(coef(fit), 3) lmlab <- paste0("mpg = ", bs[1], ...

Page 56 of 65