#include <linux/init.h>
#include <linux/module.h>
/**
* This function is called when the module is first loaded.
*/
static int __init hello_kernel_init(void)
{
printk("Hello, World!\n");
return 0;
}
/**
* This function is called when is called if a...
In order to compile the driver, it is necessary to have the Linux Kernel source tree.
Assuming the sources are at /lib/modules/<kernel-version>, the following Makefile will compile the file driver.c into the driver.ko Kernel Object
obj-m := driver.o
KDIR := /lib/modules/$(shell uname -r)/bu...
We initialize the data we want to interpolate:
x = 0:0.5:10;
y = sin(x/2);
This means the underlying function for the data in the interval [0,10] is sinusoidal. Now the coefficients of the approximating polynómials are being calculated:
p1 = polyfit(x,y,1);
p2 = polyfit(x,y,2);
p3 = polyfit(...
Func<int, int> add1 = i => i + 1;
Func<int, int, int> add = (i, j) => i + j;
// Behaviourally equivalent to:
int Add1(int i)
{
return i + 1;
}
int Add(int i, int j)
{
return i + j;
}
...
Console.WriteLine(add1(42)); //43
Console.WriteLine(Add1(42));...
See remarks for discussion of closures. Suppose we have an interface:
public interface IMachine<TState, TInput>
{
TState State { get; }
public void Input(TInput input);
}
and then the following is executed:
IMachine<int, int> machine = ...;
Func<int, int> machineC...
Introduction
Texas Instruments' (TI) CC26XX series SoCs are readily available wireless MCUs targeting Bluetooth Low Energy (BLE) applications. Along with the MCUs, TI offers a full-fledged software stack that provides necessary API and sample codes to help quickly get developers started with the to...
To install/update MVC version, follow these steps:
In visual studio, open the Package Manager console (use CTRL + Q, and type package manager console)
In the console appearing, enter the following after the console cursor showing PM>:
Install-Package Microsoft.AspNet.Mvc -Version 5.2.3...
CloudFormer template translates the existing AWS entities to a generate new CloudFormation template to accelerate the time to recreate the environment. The CloudFormer launches in a default VPC which might not be suitable in the cases where the default VPC is deleted. This code base is fork from the...
See Swift 3 example for usage information and notes
func pbkdf2SHA1Calibrate(password:String, salt:[UInt8], msec:Int) -> UInt32 {
let actualRoundCount: UInt32 = CCCalibratePBKDF(
CCPBKDFAlgorithm(kCCPBKDF2),
password.utf8.count,
salt.count,
CCPseudoRandom...
Determine the number of PRF rounds to use for a specific delay on the current platform.
Several parameters are defaulted to representative values that should not materially affect the round count.
password Sample password.
salt Sample salt.
msec Targeted duration we want to achieve f...
SVN
FreeBSD project use SVN as default SCM. Source could be download with svnlite software.
Get Current
cd /usr/src
svnlite checkout https://svn.freebsd.org/base/head .
Get Releases
cd /usr/src
svnlite checkout https://web.freebsd.org/base/release/11.0.0 .
Tarball (http & ftp)
You c...
Go to the directory with the source code:
cd freebsdsrc
Go to the directory with the kernel's configuration code:
# If your system is 32-bit.
cd sys/i386/conf/
# If your system is 64-bit.
cd sys/amd64/conf/
Get a copy of the GENERIC kernel (let's call it MODEDKERNEL). It will ...
Build the world
Go to the freebsdsrc/ (the root directory of the FreeBSD source tree you've already downloaded) and build the world:
sudo make -j${NUMBER_OF_PROCESSORS} buildworld KERNCONF=MODEDKERNEL -DNO_CLEAN
Estimated time
Estimated time on Hasee Q540S running on a one processor: 8 hours...
Let's configure the destination directory for the root filesystem of
your new FreeBSD (for example /usr/home/beastie/MODEDKERNEL).
Add the following lines to /etc/src.conf to set it up:
.if ${KERNCONF} == "MODEDKERNEL"
DESTDIR?=/usr/home/beastie/MODEDKERNEL
MODULES_OVERRID...
Install the world
sudo make installworld KERNCONF=MODEDKERNEL
Estimated time on Hasee Q540S: 5 minutes.
Install the kernel
sudo make installkernel KERNCONF=MODEDKERNEL
Estimated time on Hasee Q540S: a few seconds.
The preserveAspectRatio attribute has an optional parameter: meet | slice. The default behavior is meet which stretches the content in both the x and y dimension until it fills either the width or height of the viewBox. The alternative - slice preserves the aspect ratio of the content but scales up ...