library(gpuR)
# vclMatrix objects
X <- vclMatrix(rnorm(100), 10, 10)
Y <- vclMatrix(rnorm(100), 10, 10)
# data always on GPU
# no data transfer
Z <- X %*% Y
TRACE and DEBUG log levels are there to be able to convey high detail about the operation of the given code at runtime. Setting the log level above these is usually recommended, however some care must be taken for these statements to not affect performance even when seemingly "turned off"....
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ /$1/ [L,R=301]
The first RewriteCond helps exclude the files. The second RewriteCond checks if there is already a trailing slash. If the case is so RewriteRule is not applied.
If you have any URL that s...
Download the Apache Felix Framework Distribution and extract it into a directory:
$ tar xf org.apache.felix.main.distribution-5.4.0.tar.gz
$ cd felix-framework-5.4.0
And then start the framework with the following command:
$ java -jar bin/felix.jar
____________________________
Welcome to...
Consider writing a "hello world!" program in c. Lets say our source code is in a file called source.c, now in order to run our program we need to compile it, typically on Linux (using gcc) we would need to type $> gcc source.c -o output where output is the name of the executable to be g...
This example will call the windows calculator. It's important to notice that the exit code will vary accordingly to the program/script that is being called.
package process.example;
import java.io.IOException;
public class App {
public static void main(String[] args) {
try {
...
The ProcessBuilder class makes it easy to send a command through the command line. All it requires is a List of Strings that make up the commands to be entered. You simply call the start() method on your ProcessBuilder instance to execute the command.
If you have a program called Add.exe which take...
In general when making a call to the command line, the program will send the command and then continue its execution.
However you may want to wait for the called program to finish before continuing your own execution (ex. The called program will write data to a file and your program needs that to a...
This proxy simply appends the string " went through proxy" to every string property set on the target object.
let object = {};
let handler = {
set(target, prop, value){ // Note that ES6 object syntax is used
if('string' === typeof value){
target[prop] = valu...
Laravel's events allows to implement the Observer pattern. This can be used to send a welcome email to a user whenever they register on your application.
New events and listeners can be generated using the artisan command line utility after registering the event and their particular listener in App...
Here's a way to show a GIF preloader while an AJAX call is executing.
We need to prepare our add and remove preloader functions:
function addPreloader() {
// if the preloader doesn't already exist, add one to the page
if(!document.querySelector('#preloader')) {
var preloaderHTML = '<...
DATA: <TABLE NAME> TYPE <SORTED|STANDARD|HASHED> TABLE OF <TYPE NAME>
WITH <UNIQUE|NON-UNIQUE> KEY <FIELDS FOR KEY>.
Standard Table
This table has all of the entries stored in a linear fashion and records are accessed in a linear way. For large table sizes, ...
Notice, this is only for angular-cli up to 1.0.0-beta.10 version !
Some libraries or plugins may not have typings. Without these, TypeScript can't type check them and therefore causes compilation errors. These libraries can still be used but differently than imported modules.
Include a scr...
For example:
ActiveRecord::Base.transaction do
david.withdrawal(100)
mary.deposit(100)
end
This example will only take money from David and give it to Mary if neither withdrawal nor deposit raise an exception. Exceptions will force a ROLLBACK that returns the database to the state before ...
Though the transaction class method is called on some ActiveRecord class, the objects within the transaction block need not all be instances of that class. This is because transactions are per-database connection, not per-model.
In this example a balance record is transactionally saved even though ...
A transaction acts on a single database connection. If you have multiple class-specific databases, the transaction will not protect interaction among them. One workaround is to begin a transaction on each class whose models you alter:
Student.transaction do
Course.transaction do
course.enro...
Both #save and #destroy come wrapped in a transaction that ensures that whatever you do in validations or callbacks will happen under its protected cover. So you can use validations to check for values that the transaction depends on or you can raise exceptions in the callbacks to rollback, includin...
There are two types of callbacks associated with committing and rolling back transactions: after_commit and after_rollback.
after_commit callbacks are called on every record saved or destroyed within a transaction immediately after the transaction is committed. after_rollback callbacks are called o...
ActiveRecord::Base.transaction uses the ActiveRecord::Rollback exception to distinguish a deliberate rollback from other exceptional situations. Normally, raising an exception will cause the .transaction method to rollback the database transaction and pass on the exception. But if you raise an Activ...