You can get it either synchronously:
var docId = Todos.insert({text: 'foo'});
console.log(docId);
Or asynchronously:
Todos.insert({text: 'foo'}, function(error, docId){
console.log(docId);
});
Bounded type parameters allow you to set restrictions on generic type arguments:
class SomeClass {
}
class Demo<T extends SomeClass> {
}
But a type parameter can only bind to a single class type.
An interface type can be bound to a type that already had a binding. This is achieve...
filePath = "file.csv"
data = np.genfromtxt(filePath)
Many options are supported, see official documentation for full list:
data = np.genfromtxt(filePath, dtype='float', delimiter=';', skip_header=1, usecols=(0,1,3) )
When a Java virtual machine starts, it needs to know how big to make the Heap, and the default size for thread stacks. These can be specified using command-line options on the java command. For versions of Java prior to Java 8, you can also specify the size of the PermGen region of the Heap.
Note...
Information about the database connections
SELECT
a.mon$attachment_id as Attachment_ID,
a.mon$server_pid as Server_PID,
case a.mon$state
when 1 then 'active'
when 0 then 'idle'
end as State,
a.mon$attachment_name as Database_Name,
...
Darken
#demo {
@refcolor: #f0b9b8;
background: @refcolor;
border: 1px solid darken(@refcolor, 25%);
}
The above code makes use of the darken() function to set the border color as a shade that is 25% darker than the reference color (which is also the background color).
Less compiler ca...
lessc [options] <source> [destination]
The above command is used to compile Less files in the command line. Options are the various settings that the compiler should use either during compilation or after compilation. Options include -x or --compress for compressing or minifying the output ...
Less allows the usage of the parent selector (&) anywhere in a complex selector and thus allows changing styles when the current element is within another element which gives it a different context:
For example, in the below code the parent selector is placed at the end and thus it actually be...
This example demonstrates how you can respond to a button click by performing some work on a worker thread and then update the user interface to indicate completion
void MyButton_OnClick(object sender, EventArgs args)
{
Task.Run(() => // Schedule work using the thread pool
{
...
Set up some constants for the server and authentication information. Assuming LDAPv3, but it's easy enough to change that.
// Authentication, and the name of the server.
private const string LDAPUser = "cn=example:app:mygroup:accts,ou=Applications,dc=example,dc=com";
private readonly ch...
You can select the last day of month.
SELECT (date_trunc('MONTH', ('201608'||'01')::date) + INTERVAL '1 MONTH - 1 day')::DATE;
201608 is replaceable with a variable.
C#
Maximizing the window
driver.Manage().Window.Maximize();
This is fairly straightforward, ensures that our currently active window is maximized.
Position of the window
driver.Manage().Window.Position = new System.Drawing.Point(1, 1);
Here we essentially move the currently active window t...
You can apply formats within a procedure, e.g. to change the groupings within a proc summary or proc freq.
Grouping SAS dates
data example2 ;
do Date = '01JUN2016'dt to '31AUG2016'dt ;
Days = 1 ;
output ;
end ;
run ;
/* Summarise by year & month */
proc summary data=exampl...
$ fg %2
sleep 600
%2 specifies job no. 2. If fg is used without any arguments if brings the last process put in background to the foreground.
$ fg %?sle
sleep 500
?sle refers to the baground process command containing "sle". If multiple background commands contain the string, it w...
If you know you need a packet <packet>, but you don't know the exact name <packet-exact-name>, instead of searching with Google try with the following:
sudo apt-get update
apt-cache search <packet>
This will return you a list of packets name with a description. Once you have i...
If you are running a command that returns hundreds of lines, but your interest is just on the lines that contains the word <word>, you should definitely use grep! For example try running:
ifconfig -a
Check the output, that could be only a few lines or quite long, if you have a server with ...
A Haskell's Functor allows one to map any type a (an object of Hask) to a type F a and also map a function a -> b (a morphism of Hask) to a function with type F a -> F b. This corresponds to a Category Theory definition in a sense that functor preserves basic category structure.
A monoidal ca...
Modifying the strings returned by the standard functions getenv(), strerror() and setlocale() is undefined. So, implementations may use static storage for these strings.
The getenv() function, C11, §7.22.4.7, 4, says:
The getenv function returns a pointer to a string associated with the
matched...
\m : Beginning of a word.
\M : End of a word.
\y : Word boundary.
\Y : a point that is not a word boundary.
\Z : matches end of data.
Documentation: re_syntax