Tutorial by Examples: st

A destructor is a function without arguments that is called when a user-defined object is about to be destroyed. It is named after the type it destructs with a ~ prefix. class C{ int* is; string s; public: C() : is( new int[10] ){ } ~C(){ // destructor definition ...
You can add subscripting to your own classes by implementing the required methods. For indexed subscripting (like arrays): - (id)objectAtIndexedSubscript:(NSUInteger)idx - (void)setObject:(id)obj atIndexedSubscript:(NSUInteger)idx For keyed subscripting (like dictionaries): - (id)objectForKey...
Prerequisite steps: Install Java at your machine Visit neo4j website and click the link "Download Community Edition" or visit directly the download link. Unzip the .tar downloaded file in your home directory Start Neo4j from console (headless, without web server) Visit the sub-d...
C++14 Those following complex user literals are declared in the namespace std::literals::complex_literals, where both literals and complex_literals are inline namespaces. Access to these operators can be gained with using namespace std::literals, using namespace std::complex_literals, and using nam...
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...
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...
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...
My first Wicket setup, app showing Hello World on home screen: import org.apache.wicket.protocol.http.WebApplication; public class HelloWorldApplication extends WebApplication { public HelloWorldApplication() { } @Override public Class getHomePage() { retur...
In Ruby, a string is just a sequence of bytes along with the name of an encoding (such as UTF-8, US-ASCII, ASCII-8BIT) that specifies how you might interpret those bytes as characters. Ruby strings can be used to hold text (basically a sequence of characters), in which case the UTF-8 encoding is us...
class MyDataObject extends DataObject { private static $db = array( 'Name' => 'Varchar' ); private static $has_one = array( 'OtherDataObject' => 'OtherDataObject' ); private static $summary_fields = array( 'Name', 'OtherDat...
Sometimes we want to prepare a context for each test to be run under. The setUp method is run prior to each test in the class. tearDown is run at the end of every test. These methods are optional. Remember that TestCases are often used in cooperative multiple inheritance so you should be careful to...
Strings in a Series can be sliced using .str.slice() method, or more conveniently, using brackets (.str[]). In [1]: ser = pd.Series(['Lorem ipsum', 'dolor sit amet', 'consectetur adipiscing elit']) In [2]: ser Out[2]: 0 Lorem ipsum 1 dolor sit amet 2 cons...
str.contains() method can be used to check if a pattern occurs in each string of a Series. str.startswith() and str.endswith() methods can also be used as more specialized versions. In [1]: animals = pd.Series(['cat', 'dog', 'bear', 'cow', 'bird', 'owl', 'rabbit', 'snake']) Check if strings con...
In [1]: ser = pd.Series(['lORem ipSuM', 'Dolor sit amet', 'Consectetur Adipiscing Elit']) Convert all to uppercase: In [2]: ser.str.upper() Out[2]: 0 LOREM IPSUM 1 DOLOR SIT AMET 2 CONSECTETUR ADIPISCING ELIT dtype: object All lowercase: In [3]: ser...
The Windows.Forms.Timer component can be used to provide the user information that is not time critical. Create a form with one button, one label, and a Timer component. For example it could be used to show the user the time of day periodically. 'can be permanently set ' Tools / Options / Projec...
Setting Up the database public class DatabaseHelper extends SQLiteOpenHelper { // Database Version private static final int DATABASE_VERSION = 1; // Database Name private static final String DATABASE_NAME = "database_name"; // Table Names private static...
Hadoop Distributed File System (HDFS) is a Java-based file system that provides scalable and reliable data storage that is designed to span large clusters of commodity servers. HDFS, MapReduce, and YARN form the core of Apache™ Hadoop®. HDFS is designed to be highly fault-tolerant, which is achieve...
You can combine the results of two identically structured queries with the UNION keyword. For example, if you wanted a list of all contact info from two separate tables, authors and editors, for instance, you could use the UNION keyword like so: select name, email, phone_number from authors u...
The remainder operator in Julia is the % operator. This operator behaves similarly to the % in languages such as C and C++. a % b is the signed remainder left over after dividing a by b. This operator is very useful for implementing certain algorithms, such as the following implementation of the Si...

Page 141 of 369