Minimum cost of AWS


Here is the cost of running a minimum AWS server, total of $77 /year (39 + 26 + 10 + 2)
based on price of region us-west-1 North California.
ec2: $39, t3a.nano 2 vcpu, 500M RAM
ebs: $26, for 18G
root device 8G, which is minimum, adding block device 10G, which should be reasonable
total 18G, $1.4/GB-year * 18 = $26
snapshot: $10. $0.6/GB-year, for 18G. $0.6*18=$10/year.
bandwidth: $2. assuming 1G/month, $0.15/GB * 12G
Elastic IP: $0
notes: newer instance type offers higher performance and lower price,
but snapshots of older system don’t have the option to run on new instance types.

Flash memory


Flash memory types:
NOR: replacement of EPROM, random access, slow write, usually less than 100M size
XIP, eXecute In Place
NAND: no random access, for files, cheaper, many G in size. half form factor, fewer pins

	SLC: Single-Level Cell, lasts long, expensive, not error prone, low power, fast
	MLC: Multi-Level Cell, <10k writes, cheaper
	TLC: Trinary-Level Cell, 1k writes, cheapest.
	  Most PNY low end USB 2.0 memory sticks are in this category.

eMMC: NAND + controller, also protocol name

MTD Memory Technology Devices is a kernel layer on top of flash to access the memory

Function Hiding


If there is a functions in base class and one in subclass that has the same name,
the one in subclass always hides the one in base class, regardless of the parameter list and virtual function or not.
Access base class function through sub class object with a different parameter is a compiling error.
Consider this code snippet:

struct CBase
{
	void funcNonVirtual(int i)
	{
		printf("CBase::funcNonVirtual\n");
	}
};
struct CSub: CBase
{
	void funcNonVirtual(char * string)
	{
		printf("CSub::funcNonVirtual\n");
	}
};
void TestHide()
{
	CSub Sub;
	Sub.funcNonVirtual(2); //comiling error
}

Variadic templates


A function can take any number any type of arguments in in cpp11

template <class T>
void VariadicPrint(T tail)
{
	cout << tail << endl;
}

template <class T, class ...Args>
void VariadicPrint(T head, Args... rest)
{
	cout << head << " ";
	VariadicPrint(rest...);
}

void TestVariadic()
{
	VariadicPrint(1, "a"); //output: 1 a
}

VariadicPrint(1, “a”) outputs “1 a”