Tutorial by Examples: c

Here is an example of usage with a database. On the page where the CAPTCHA will be shown you'll have something like this: $this->load->helper('captcha'); $vals = array( 'img_path' => './captcha/', 'img_url' => 'http://example.com/captcha/' ); $cap = create_captc...
It's a common request to be able to handle a double-click on a row in a RadGridView. The solution proposed by Telerik (http://demos.telerik.com/silverlight/#GridView/ClickEvents ) is based around code behind: this.grid.AddHandler(GridViewCellBase.CellDoubleClickEvent, new EventHandler<RadRouted...
from sklearn import svm X = [[1, 2], [3, 4]] #Training Samples y = [1, 2] #Class labels model = svm.SVC() #Making a support vector classifier model model.fit(X, y) #Fitting the data clf.predict([[2, 3]]) #After fitting, new data can be classified by using predict()
These three map functions are equivalent, so use the variation that your team finds most readable. val numberNames = Map(1 -> "One", 2 -> "Two", 3 -> "Three") // 1. No extraction numberNames.map(it => s"${it._1} is written ${it._2}" ) // 2....
Suppose we have an array: +-------+-----+-----+-----+-----+-----+-----+ | Index | 0 | 1 | 2 | 3 | 4 | 5 | +-------+-----+-----+-----+-----+-----+-----+ | Value | -1 | 3 | 4 | 0 | 2 | 1 | +-------+-----+-----+-----+-----+-----+-----+ We want to perform some query on thi...
Import libraries (language dependency: python 2.7) import tensorflow as tf import numpy as np from sklearn.datasets import fetch_mldata from sklearn.model_selection import train_test_split load data, prepare data mnist = fetch_mldata('MNIST original', data_home='./') print "MNIST data,...
Collection Operators can be used in a KVC key path to perform an operation on a “collection-type” property (i.e. NSArray, NSSet and similar). For example, a common operation to perform is to count the objects in a collection. To achieve this, you use the @count collection operator: self.array = @[@...
Most of the time we like to get the total number of occurrence of a column value in a table for example: TABLE NAME : REPORTS ReportNameReportPriceTest10.00 $Test10.00 $Test10.00 $Test 211.00 $Test10.00 $Test 314.00 $Test 314.00 $Test 4100.00 $ SELECT ReportName AS REPORT ...
int[string] numbers = ["a" : 10, "b" : 20]; assert("a" in numbers); assert("b" in numbers); assert("c" in numbers);
In C++, code must be declared or defined before usage. For example, the following produces a compile time error: int main() { foo(2); // error: foo is called, but has not yet been declared } void foo(int x) // this later definition is not known in main { } There are two ways to resolve...
This example will guide you how to get playlist data using the YouTube Data API on Android. SHA-1 fingerprint First you need to get an SHA-1 fingerprint for your machine. There are various methods for retrieving it. You can choose any method provided in this Q&A. Google API console and YouTub...
Here a Turtle Graphics Ninja Twist: import turtle ninja = turtle.Turtle() ninja.speed(10) for i in range(180): ninja.forward(100) ninja.right(30) ninja.forward(20) ninja.left(60) ninja.forward(50) ninja.right(30) ninja.penup() ninja.setposit...
The following Codes can be found from Weka course Given iris.arff is loaded in weka, inside Weka Explorer's R console or Weka KnowledgeFlow's R Scripting, you can play with the following codes to make beautiful plots: library(ggplot2) ggplot(rdata, aes(x = petallength)) + geom_density() ...
Implement ICloneable in a class with a twist. Expose a public type safe Clone() and implement object Clone() privately. public class Person : ICloneable { // Contents of class public string Name { get; set; } public int Age { get; set; } // Constructor public Person(string...
The implementation of ICloneable for a struct is not generally needed because structs do a memberwise copy with the assignment operator =. But the design might require the implementation of another interface that inherits from ICloneable. Another reason would be if the struct contains a reference t...
type Props = { posts: Array<Article>, dispatch: Function, children: ReactElement } const AppContainer = ({ posts, dispatch, children }: Props) => ( <div className="main-app"> <Header {...{ posts, dispatch }} /> {children} </...
Go to Explorer, Open iris.arff data, then go to CPython Scripting, Copy and Paste the following lines of codes into Python Scripts: hi = "Hello, CPython of Weka!" hello = hi.upper() iris = py_data info = iris.describe() To see output, go to Python Variables, select hi, for exa...
Files written to with the w command are created/truncated before any commands are run. $ sed 'w created-file' < /dev/null && ls created-file && rm created-file created-file From the standard: Each wfile shall be created before processing begins. Implementations shall suppo...
Up navigation is done in android by adding android:parentActivityName="" in Manifest.xml to the activity tag. Basically with this tag you tell the system about the parent activity of a activity. How is it done? <uses-permission android:name="android.permission.INTERNET" ...
The following example is tested on Windows 8 pro 64-bit operating system with python 2.7 and scrapy v 1.2. Let assume that we have already installed the scrapy framework. MySQL database that we will use in the following tutorial CREATE TABLE IF NOT EXISTS `scrapy_items` ( `id` bigint(20) UNSIGN...

Page 642 of 826