Tutorial by Examples: c

In following example we will create table movies with AWS Ruby SDK v2. Here, each Movie as one unique Partition Key as id, and Range Key year. Apart from this we want to be able to query movies with their name, hence we will create a Global Secondary Index (GSI) name-year-index with name as Hash Ke...
function noOfLooping(m,n) { if(m > n) { smallestValue = n; } else { smallestValue = m; } if(smallestValue % 2 == 0) { return smallestValue/2; } else { return (smallestValue+1)/2; } } function squarePrint(m,n) { v...
So the good news is that Apple kindly includes a Ruby interpreter. Unfortunately, it tends not to be a recent version: $ /usr/bin/ruby -v ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin16] If you have Homebrew installed, you can get the latest Ruby with: $ brew install ruby...
import core.thread, std.stdio, std.datetime; void some_operation() { // Sleep for two sixtieths (2/60) of a second. Thread.sleep(2.seconds / 60); // Sleep for 100 microseconds. Thread.sleep(100.usecs); } void main() { MonoTime t0 = MonoTime.currTime(); some_opera...
This example show you how you add new sounds to your MOD and play them. First of all you need a sound file which has the format *.ogg. Any other format is not allowed by the Minecraft application and will be rejected. The soundfile has the name: sound1.ogg Put the sound file under the following pa...
Integration to open database using password. -(void)checkAndOpenDB{ sqlite3 *db; NSString *strPassword = @"password"; if (sqlite3_open_v2([[databaseURL path] UTF8String], &db, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL) == SQLITE_OK) { const cha...
(function(){ var hashMap = {}; function isAnagram (str1, str2) { if(str1.length !== str2.length){ return false; } // Create hash map of str1 character and increase value one (+1). createStr1HashMap(str1); /...
You get this exception mostly with form submissions. Laravel protects application from CSRF and validates every request and ensures the request originated from within the application. This validation is done using a token. If this token mismatches this exception is generated. Quick Fix Add this wi...
Solves problem of: access denied for user root using password YES Stop mySQL: sudo systemctl stop mysql Restart mySQL, skipping grant tables: sudo mysqld_safe --skip-grant-tables Login: mysql -u root In SQL shell, look if users exist: select User, password,plugin FROM mysql.user ; U...
CREATE INDEX first_name_idx ON user_data (UPPER(first_name)); SELECT * FROM user_data WHERE UPPER(first_name) = 'JOHN2'; Function based index means, creating index based on a function. If in search (where clause), frequently any function is used, it's better to create index based on ...
var MongoClient = require('mongodb').MongoClient; //connection with mongoDB MongoClient.connect("mongodb://localhost:27017/MyDb", function (err, db) { //check the connection if(err){ console.log("connection failed."); }else{ ...
The NamedParameterJdbcTemplate class adds support for programming JDBC statements using named parameters, as opposed to programming JDBC statements using only classic placeholder ( '?') arguments. The NamedParameterJdbcTemplate class wraps a JdbcTemplate, and delegates to the wrapped JdbcTempl...
Any @Component or @Configuration could be marked with @Profile annotation @Configuration @Profile("production") public class ProductionConfiguration { // ... } The same in XML config <beans profile="dev"> <bean id="dataSource" class="&l...
Protractor Installation and Setup Step 1: Download and install NodeJS from here. Make sure you have latest version of node. Here, I am using node v7.8.0. You will need to have the Java Development Kit(JDK) installed to run selenium. Step 2: Open your terminal and type in the following command to i...
Suppose you need to work on three different projects project A, project B and project C. project A and project B need python 3 and some required libraries. But for project C you need python 2.7 and dependent libraries. So best practice for this is to separate those project environments. To create v...
In order to chain asynchronous operations and avoid a callback hell, Vala supports the yield statement. Used with an asynchronous invocation, it will pause the current coroutine until the call is completed and extract the result. Used alone, yield pause the current coroutine until it's being woken...
class ConversationsTableViewController: UITableViewController, NSFetchedResultsControllerDelegate { private var fetchedResultsController: NSFetchedResultsController<Conversation>! override func viewDidLoad() { super.viewDidLoad() initializeFetchedResultsController() } private...
Two definitions of Machine Learning are offered. Arthur Samuel described it as: the field of study that gives computers the ability to learn without being explicitly programmed. This is an older, informal definition. Tom Mitchell provides a more modern definition: A computer program is sa...
To get started, create a new Maven webapp (how to do this is outside the scope of this example). In your pom.xml, add the following two dependencies <dependency> <groupId>org.glassfish.jersey.containers</groupId> <artifactId>jersey-container-servlet</artifactId&...
If you want to use a podfile in more than one target, you can do like this. You can choose the download address when you pod this lib. def testpods pod 'YSDPush', :git => 'https://github.com/youshaoduo/YSDPush.git' end target 'One' do testpods end target 'Two' do testpods ...

Page 775 of 826