Tutorial by Examples: am

#include <ctype.h> #include <stdio.h> typedef struct { size_t space; size_t alnum; size_t punct; } chartypes; chartypes classify(FILE *f) { chartypes types = { 0, 0, 0 }; int ch; while ((ch = fgetc(f)) != EOF) { types.space += !!isspace(ch); types.al...
When mapping our entities to database table names we rely on a @Table annotation. But if we have a naming convention for our database table names, we can implement a custom physical naming strategy in order to tell hibernate to calculate table names based on the names of the entities, without explic...
from flask import Flask, render_template, redirect, url_for app = Flask(__name__) @app.route('/') def main_page(): return render_template('main.html') @app.route('/main') def go_to_main(): return redirect(url_for('main_page'))
Multiton can be used as a container for singletons. This is Multiton implementation is a combination of Singleton and Pool patterns. This is an example of how common Multiton abstract Pool class can be created: abstract class MultitonPoolAbstract { /** * @var array */ protec...
This pattern can be used to contain a registered Pools of Singletons, each distinguished by unique ID: abstract class MultitonRegistryAbstract { /** * @var array */ protected static $instances = []; /** * @param string $id */ final protected function ...
Xamarin is becoming more and more popular - it is hard to decide when to use Xamarin.Forms and when Xamarin.Platform (so Xamarin.iOS and Xamarin.Android). First of all you should know for what kind of applications you can use Xamarin.Forms: Prototypes - to visualize how your application will l...
You can execute SQL query as different user using AS USER = 'name of database user' EXEC(N'SELECT * FROM product') AS USER = 'dbo' SQL query will be executed under dbo database user. All permission checks applicable to dbo user will be checked on SQL query.
Dynamic queries are SET @sql = N'SELECT COUNT(*) FROM AppUsers WHERE Username = ''' + @user + ''' AND Password = ''' + @pass + '''' EXEC(@sql) If value of user variable is myusername'' OR 1=1 -- the following query will be executed: SELECT COUNT(*) FROM AppUsers WHERE Username = 'myusername...
In order to avoid injection and escaping problems, dynamic SQL queries should be executed with parameters, e.g.: SET @sql = N'SELECT COUNT(*) FROM AppUsers WHERE Username = @user AND Password = @pass EXEC sp_executesql @sql, '@user nvarchar(50), @pass nvarchar(50)', @username, @password Second ...
There are two equivalent ways to calculate the amount of time unit between two LocalTime: (1) through until(Temporal, TemporalUnit) method and through (2) TemporalUnit.between(Temporal, Temporal). import java.time.LocalTime; import java.time.temporal.ChronoUnit; public class AmountOfTime { ...
ContactManager contactManager = Factory.CreateObject("tracking/contactManager", true) as ContactManager; Contact contact = contactManager.LoadContactReadOnly(userName); return contact;
Samtools can be used to convert between sam and bam: -b indicates that the input file will be in BAM format -S indicates that the stdout should be in SAM format samtools view -sB thing.bam > thing.sam And to convert between sam and bam: samtools view thing.sam > thing.bam samtools ...
Create a new text file named HelloWorld.java and paste this code in it: import org.eclipse.swt.*; import org.eclipse.swt.layout.*; import org.eclipse.swt.widgets.*; public class HelloWorld { public static void main(String[] args) { final Display display = new Display(); ...
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="locations"> <list> <value>classpath:ReleaseBundle.properties</value> </list> </bean>
Parameters can be specified in path property of route configuration 'use strict'; const Hapi = require('hapi'); // Create a server with a host and port const server = new Hapi.Server(); server.connection({ host: 'localhost', port: 8000 }); // Add a route path with url par...
Big data is a term for data sets that are so large or complex that traditional data processing applications are inadequate to deal with them. Challenges include analysis, capture, data curation, search, sharing, storage, transfer, visualization, querying, updating and information privacy. A general...
AutomationMetadataProvider automationMetadataProvider = Assert.ResultNotNull(Factory.CreateObject("automation/metadataProvider", true) as AutomationMetadataProvider); var context = AutomationManager.Provider.GetAutomationContext(ID.Parse(contact.ContactId)); co...
The order of execution of parameters is undefined in C programming. Here it may execute from left to right or from right to left. The order depends on the implementation. #include <stdio.h> void function(int a, int b) { printf("%d %d\n", a, b); } int main(void) { ...
The MultiBinding allows binding multiple values to the same property. In the following example multiple values are bound to the Text property of a Textbox and formatted using the StringFormat property. <TextBlock> <TextBlock.Text> <MultiBinding StringFormat="{}{0}...

Page 82 of 129