After creating an API wrapper, it's likely that you may want to create an Atmosphere package to redistribute it and share it between applications. The files of your package will probably look something like this.
packages/foo-api-wrapper/package.js
packages/foo-api-wrapper/readme.md
packages/foo-...
To scale things, we have to stop using local storage on our server, and start using either a dedicated file storage service or implement a horizontal storage layer. The easiest way to get started with scalable file storage is to use a solution like Filepicker.io, which supports S3, Azure, Rackspace,...
However, if you're really serious about storage, and you want to store millions of images, you're going to need to leverage Mongo's GridFS infrastructure, and create yourself a storage layer. For that, you're going to need the excellent CollectionFS subsystem.
Start by adding the necessary packages...
$ cat ip.txt
address
range
substitution
pattern
sample
Nth line
$ sed -n '2p' ip.txt
range
$ sed '3d' ip.txt
address
range
pattern
sample
Last line
$ sed -n '$p' ip.txt
sample
We can also use macros for making code easier to read and write. For example we can implement macros for implementing the foreach construct in C for some data structures like singly- and doubly-linked lists, queues, etc.
Here is a small example.
#include <stdio.h>
#include <stdlib.h>...
Given two types T and U, &T will coerce (implicitly convert) to &U if and only if T implements Deref<Target=U>
This allows us to do things like this:
fn foo(a: &[i32]) {
// code
}
fn bar(s: &str) {
// code
}
let v = vec![1, 2, 3];
foo(&v); // &Vec&l...
As well as being able to create an array by filtering out nil from the transformed elements of a sequence, there is also a version of flatMap(_:) that expects the transformation closure to return a sequence S.
extension SequenceType {
public func flatMap<S : SequenceType>(transform: (Sel...
You can retrieve the implementation defined name of a type in runtime by using the .name() member function of the std::type_info object returned by typeid.
#include <iostream>
#include <typeinfo>
int main()
{
int speed = 110;
std::cout << typeid(speed).name() <...
Dart functions may also be declared anonymously or nested.
For example, to create a nested function, just open a new function block within an existing function block
void outerFunction() {
bool innerFunction() {
/// Does stuff
}
}
The function innerFunction may now be us...
4.0
Instead of the ForEach-Object cmdlet, the here is also the possibility to use a ForEach method directly on object arrays like so
(1..10).ForEach({$_ * $_})
or - if desired - the parentheses around the script block can be omitted
(1..10).ForEach{$_ * $_}
Both will result in the output ...
There are hundreds of settings that can be placed in my.cnf. For the 'lite' user of MySQL, they won't matter as much.
Once your database becomes non-trivial, it is advisable to set the following parameters:
innodb_buffer_pool_size
This should be set to about 70% of available RAM (if you have a...
section .data
msg db "Hello world!",10 ; 10 is the ASCII code for a new line (LF)
section .text
global _start
_start:
mov rax, 1
mov rdi, 1
mov rsi, msg
mov rdx, 13
syscall
mov rax, 60
mov rdi, 0
syscall
If you want to e...
Strings are immutable. You just cannot change existing string. Any operation on the string crates a new instance of the string having new value. It means that if you need to replace a single character in a very long string, memory will be allocated for a new value.
string veryLongString = ...
// m...
Using GNU grep
grep -r 'pattern' <directory path>
To also list line numbers of matches use -n option
grep -rn 'pattern' <directory path>
To search only files with particular glob pattern
grep --include='*.txt' -r 'pattern' <directory path>
Exclude file patterns or direc...
Variables declared inside a function only exist (unless passed) inside that function.
x <- 1
foo <- function(x) {
y <- 3
z <- x + y
return(z)
}
y
Error: object 'y' not found
Variables passed into a function and then reassigned are overwritten, but only insi...
Functions called within a function (ie subfunctions) must be defined within that function to access any variables defined in the local environment without being passed.
This fails:
bar <- function() {
z <- x + y
return(z)
}
foo <- function() {
y <- 3
z <-...
Environments in R can be explicitly call and named. Variables can be explicitly assigned and call to or from those environments.
A commonly created environment is one which encloses package:base or a subenvironment within package:base.
e1 <- new.env(parent = baseenv())
e2 <- new.env(parent ...
The on.exit() function is handy for variable clean up if global variables must be assigned.
Some parameters, especially those for graphics, can only be set globally. This small function is common when creating more specialized plots.
new_plot <- function(...) {
old_pars <- par(m...