Computing

One of the useful tool for visualization of RDF data is WebVOWL - http://visualdataweb.de/webvowl/. It supports RDF data in XML as well as in Turtle (TTL) formats and allows complex visualization of data.

Technology:

The problem can be solved by using a Nginx reverse proxy. Each application will be exposed through a corresponding sub-domain.

Dockerfile:

FROM nginx:alpine
COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY proxy.conf /etc/nginx/includes/proxy.conf

proxy.conf:

proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_buffering off;
proxy_request_buffering off;
proxy_http_version 1.1;
proxy_intercept_errors off;

nginx.conf:

# pm config.
server {
listen 80;
server_name site1.myproject.com;
location / {
include /etc/nginx/includes/proxy.conf;
proxy_pass http://site1_webserver_1;
}
access_log off;
error_log /var/log/nginx/error.log error;
}
# api config.
server {
listen 80;
server_name site1.myproject.com;
location / {
include /etc/nginx/includes/proxy.conf;
proxy_pass http://site2_webserver_1;
}
access_log off;
error_log /var/log/nginx/error.log error;
}
# Default
server {
listen 80 default_server;
server_name _;
root /var/www/html;
charset UTF-8;
access_log off;
log_not_found off;
error_log /var/log/nginx/error.log error;
}

The proxy_pass is the name of the application's docker container.

Technology:

The idea is to write a trait that adds encryption capabilities to the Eloquent model. The trait has an abstract getEncryptKey() method that returns the encryption key and needs to be implemented by the model class. This way the model can use a single encryption key or some logic to return different keys for different entities.
The getEncryptedFields() method returns an array of fields that need to be encrypted.
Finally the trait overrides the model's performInsert() and performUpdate() methods to implement automatic encryption. Encryption happens at the database level, so a database expression will be injected into Eloquents insert/update query. In this example Postgres pgp_sym_encrypt is used for encryption.

use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Facades\DB;
trait DatabaseEncryption
{
/**
* Initialize global scope for decryption
* @return void
*/
public static function bootDatabaseEncryption()
{
static::addGlobalScope(new DatabaseEncryptionScope());
}
/**
* Returns the encrypted fields
* @return array
*/
public static function getEncryptedFields()
{
return [];
}
/**
* Returns the encrypt key
* @return string
*/
abstract protected function getEncryptKey();
/**
* Perform insert with encryption
* @param Builder $query
* @return bool
*/
protected function performInsert(Builder $query)
{
$encryptedFields = static::getEncryptedFields();
if (count($encryptedFields) && !$this->getEncryptKey()) {
throw new \RuntimeException("No encryption key specified");
}
foreach ($encryptedFields as $encryptedField) {
$quotedText = DB::connection()->getPdo()->quote($this->attributes[$encryptedField]);
$quotedEncryptKey = DB::connection()->getPdo()->quote(static::getEncryptKey());
$this->attributes[$encryptedField] = DB::raw("pgp_sym_encrypt($quotedText, $quotedEncryptKey)");
}
return parent::performInsert($query);
}
/**
* Perform update with encryption
* @param Builder $query
* @return bool
*/
protected function performUpdate(Builder $query)
{
$encryptedFields = static::getEncryptedFields();
if (count($encryptedFields) && !$this->getEncryptKey()) {
throw new \RuntimeException("No encryption key specified");
}
foreach ($encryptedFields as $encryptedField) {
$quotedText = DB::connection()->getPdo()->quote($this->attributes[$encryptedField]);
$quotedEncryptKey = DB::connection()->getPdo()->quote(static::getEncryptKey());
$this->attributes[$encryptedField] = DB::raw("pgp_sym_encrypt($quotedText, $quotedEncryptKey)");
}
return parent::performUpdate($query);
}
}

A Eloquent query scope is used for automatic decryption. The class injects the decryption expression into all built queries.

use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Scope;
use Illuminate\Support\Facades\DB;
class DatabaseEncryptionScope implements Scope
{
/**
* All of the extensions to be added to the builder.
*
* @var array
*/
protected $extensions = ['WithDecryptKey'];
/**
* Apply the scope to a given Eloquent query builder.
*
* @param \Illuminate\Database\Eloquent\Builder $builder
* @param \Illuminate\Database\Eloquent\Model $model
* @return void
*/
public function apply(Builder $builder, Model $model)
{
foreach ($model::getEncryptedFields() as $encryptedField) {
$builder->addSelect(DB::raw("$encryptedField as {$encryptedField}_encrypted"));
}
}
/**
* Extend the query builder with the needed functions.
*
* @param \Illuminate\Database\Eloquent\Builder $builder
* @return void
*/
public function extend(Builder $builder)
{
foreach ($this->extensions as $extension) {
$this->{"add{$extension}"}($builder);
}
}
/**
* Add the with-decrypt-key extension to the builder.
*
* @param \Illuminate\Database\Eloquent\Builder $builder
* @return void
*/
protected function addWithDecryptKey(Builder $builder)
{
$builder->macro('withDecryptKey', function (Builder $builder, $decryptKey) {
$model = $builder->getModel();
/** @var DatabaseEncryptionServiceInterface $encryptionService */
$encryptionService = $model::getEncryptionService();
foreach ($model::getEncryptedFields() as $encryptedField) {
$decryptStmt = $encryptionService->getDecryptExpression($encryptedField, $decryptKey);
$builder->addSelect(DB::raw("$decryptStmt as $encryptedField"));
}
return $builder;
});
}
}

An example model class can look like this:

namespace App;
use Anexia\EloquentEncryption\DatabaseEncryption;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable
{
use Notifiable, DatabaseEncryption;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'name', 'email', 'password',
];
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
'password', 'remember_token',
];
/**
* @return array
*/
protected static function getEncryptedFields()
{
return [
'password'
];
}
/**
* @return string
*/
protected function getEncryptKey()
{
return 'dasisteinlangerencryptkey';
}
}

The user class can then be used like this:

/* Insert a new user like always. The password field will be encrypted automatically */
$user = new User([
'name' => 'name',
'email' => 'email',
'password' => 'Password'
]);
$user->save();
/* Retrieve the user */
$user = User::withDecryptKey('dasisteinlangerencryptkey')->find(1);

Technology:

Geb provides access to JavaScript variables and also allows to run JavaScript on the page. With help of that feature properties can be accessed and actions can be performed (click, etc.)

Syntax: js.exec()

In that case make sure you only remove the staged version, and add the file to your .gitignore to avoid making the same mistake a second time:
git reset filename # or git remove --cached filename
echo filename >> .gitingore # add it to .gitignore to avoid re-adding it

Taggings:

If Hyper-V was manually uninstalled or virtualization was disabled, Docker for Windows will not start.
A solution is to enable the virtualization on your machine. In order to do that you have to access the BIOS, select the Intel Virtual Technology and enable the virtualization.
Save the changes and restart the computer, then Docker can be started and used for deploying.

I first installed cytoscape.js via npm. In the typescript-file (for Angular) I imported it by “import * as Cytoscape from 'cytoscape';”. And finally to use a Cytoscape instance I could store it in a variable by initializing it via “this.cy = Cytoscape({container: document.getElementById('cy'), … });”.

You can do your searches and shopping in the anonymous window of your Web browser or after your search you need to clean the browser's cookie storage. The steps vary by browser and you can google them.

Using VPN can maybe prohibited in certain countries. There are also free VPN solutions. Althrough they are slow, they allow access restricted information. Examples could be VPN Gate or HideMyAss.

Technology:

The solution to this problem is:

1.Open chrome in your computer
2.In the top right click more
3. Click on settings
4.At the bottom, click advance settings
5.In the "Privacy and security" section, click on Content settings.
6.Click on Pop-up windows.
7. Disable the Allowed option.

Pages

Subscribe to Computing