Tutorial by Examples: c

This is our buffer: void write_buffer(size_t size, char ** buffer) { char * buf = *buffer; size_t iter; for(iter = 0; iter < size; iter++) { putc(*(buf + iter)); } } The cursor is at [1][1] ([line][col]). Move the cursor to the curl bracket of the for loop...
Quite often you have a file which was edited within DOS or Windows and you are viewing it under UNIX. This can look like the following when you view the file with vi. First line of file^M Next Line^M And another^M If you wish to remove the ^M, it can be that you delete each ^M by hand. Alter...
Download and install the latest Eclipse IDE Install Eclipse one of two ways: Eclipse Installer Download the zip for your favorite package If you don't already have a preferred Eclipse package, Eclipse for JavaScript Developers is recommended Install SuiteCloud IDE plugin Once i...
Timers are used to perform tasks at specific intervals of time (Do X every Y seconds) Below is an example of creating a new instance of a Timer. NOTE: This applies to Timers using WinForms. If using WPF, you may want to look into DispatcherTimer using System.Windows.Forms; //Timers use the Wi...
All actions performed in a timer are handled in the "Tick" event. public partial class Form1 : Form { Timer myTimer = new Timer(); public Form1() { InitializeComponent(); myTimer.Tick += myTimer_Tick; //assign the event handler named "myT...
public partial class Form1 : Form { Timer myTimer = new Timer(); int timeLeft = 10; public Form1() { InitializeComponent(); //set properties for the Timer myTimer.Interval = 1000; myTimer.Enabled = tru...
Parse error: syntax error, unexpected end of file in C:\xampp\htdocs\stack\index.php on line 4 If you get an error like this (or sometimes unexpected $end, depending on PHP version), you will need to make sure that you've matched up all inverted commas, all parentheses, all curly braces, all brac...
If you get an error like this: Fatal error: Call to a member function fetch_assoc() on boolean in C:\xampp\htdocs\stack\index.php on line 7 Other variations include something along the lines of: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given... These errors mean that t...
This will only install PHP. If you wish to serve a PHP file to the web you will also need to install a web-server such as Apache, Nginx, or use PHP's built in web-server (php version 5.4+). If you are in a Ubuntu version below 16.04 and want to use PHP 7 anyway, you can add Ondrej's PPA repo...
You first need to run a Stanford CoreNLP server: java -mx4g -cp "*" edu.stanford.nlp.pipeline.StanfordCoreNLPServer -port 9000 -timeout 50000 Here is a code snippet showing how to pass data to the Stanford CoreNLP server, using the pycorenlp Python package. from pycorenlp import Stanf...
A type class is simply a trait with one or more type parameters: trait Show[A] { def show(a: A): String } Instead of extending a type class, an implicit instance of the type class is provided for each supported type. Placing these implementations in the companion object of the type class all...
class MyDataObject extends DataObject { private static $singular_name = 'My Object'; private static $plural_name = 'My Objects'; ... }
class SortDataObject extends DataObject { private static $db = array( 'Name' => 'Varchar', 'SortOrder' => 'Int' ); private static $default_sort = 'SortOrder DESC'; }
class MyDataObject extends DataObject { private static $db = array( 'Name' => 'Varchar' ); private static $has_one = array( 'OtherDataObject' => 'OtherDataObject' ); private static $summary_fields = array( 'Name', 'OtherDat...
class MyDataObject extends DataObject { private static $db = array( 'Name' => 'Varchar' ); private static $has_one = array( 'OtherDataObject' => 'OtherDataObject' ); private static $summary_fields = array( 'Name', 'OtherDat...
class MyDataObject extends DataObject { ... private static $has_many = array( 'OtherDataObjects' => 'OtherDataObject' ); function getCMSFields() { $fields = parent::getCMSFields(); if ($gridField = $fields->dataFieldByName('OtherDataObject...
Objects that respond to to_proc can be converted to procs with the & operator (which will also allow them to be passed as blocks). The class Symbol defines #to_proc so it tries to call the corresponding method on the object it receives as parameter. p [ 'rabbit', 'grass' ].map( &:upcase ) ...
Numeric represents integers and doubles and is the default mode assigned to vectors of numbers. The function is.numeric() will evaluate whether a vector is numeric. It is important to note that although integers and doubles will pass is.numeric(), the function as.numeric() will always attempt to con...
To check whether a value is a character use the is.character() function. To coerce a variable to a character use the as.character() function. x <- "The quick brown fox jumps over the lazy dog" class(x) [1] "character" is.character(x) [1] TRUE Note that numerics can be ...
There are two sorts of logical operators: those that accept and return vectors of any length (elementwise operators: !, |, &, xor()) and those that only evaluate the first element in each argument (&&, ||). The second sort is primarily used as the cond argument to the if function. Logic...

Page 318 of 826