If you want the Value Types vs Reference Types in methods example to work properly, use the ref keyword in your method signature for the parameter you want to pass by reference, as well as when you call the method.
public static void Main(string[] args)
{
...
DoubleNumber(ref number); ...
// Example of std::vector as an expanding dynamic size array.
#include <algorithm> // std::sort
#include <iostream>
#include <vector> // std::vector
using namespace std;
int int_from( std::istream& in ) { int x = 0; in >> x; return x; }
...
To create a new Rails 5 API, open a terminal and run the following command:
rails new app_name --api
The following file structure will be created:
create
create README.rdoc
create Rakefile
create config.ru
create .gitignore
create Gemfile
create app
create app/as...
RVM is a great tool to manage your ruby versions and set up your working environment.
Assuming you already have RVM installed, to get the latest version of ruby, which is needed for these examples, open a terminal and run:
$ rvm get stable
$ rvm install ruby --latest
Check your ruby version by...
Dim sites() As String = {"Stack Overflow",
"Super User",
"Ask Ubuntu",
"Hardware Recommendations"}
Dim query = From x In sites Select x.Length
' result = 14, 10, 10, 24
Query...
A HAVING clause filters the results of a GROUP BY expression. Note: The following examples are using the Library example database.
Examples:
Return all authors that wrote more than one book (live example).
SELECT
a.Id,
a.Name,
COUNT(*) BooksWritten
FROM BooksAuthors ba
INNER JOIN Aut...
We can use 1,2,3.. to determine the type of order:
SELECT * FROM DEPT
ORDER BY
CASE DEPARTMENT
WHEN 'MARKETING' THEN 1
WHEN 'SALES' THEN 2
WHEN 'RESEARCH' THEN 3
WHEN 'INNOVATION' THEN 4
ELSE 5
END,
CITY
IDREGIONCITYDEPARTMENTEMPLOYEES_N...
In C, all function parameters are passed by value, so modifying what is passed in callee functions won't affect caller functions' local variables.
#include <stdio.h>
void modify(int v) {
printf("modify 1: %d\n", v); /* 0 is printed */
v = 42;
printf("modify 2:...
The key in vectorizing R code, is to reduce or eliminate "by row operations" or method dispatching of R functions.
That means that when approaching a problem that at first glance requires "by row operations", such as calculating the means of each row, one needs to ask themselves...
$ mkdir 20{09..11}-{01..12}
Entering the ls command will show that the following directories were created:
2009-01 2009-04 2009-07 2009-10 2010-01 2010-04 2010-07 2010-10 2011-01 2011-04 2011-07 2011-10
2009-02 2009-05 2009-08 2009-11 2010-02 2010-05 2010-08 2010-11 2011-02 2011-05 2011-08 2011...
// Remember to initialize your client as described in the Remarks section
Awareness.SnapshotApi.getPlaces(client)
.setResultCallback(new ResultCallback<PlacesResult>() {
@Override
public void onResult(@NonNull PlacesResult placesResult) {
List<PlaceLike...