Categories
MySql SqLite

SQLITE – update a column from another table

SQLITE – update a column from another table while concatenating a string

UPDATE table1
SET table1.businessOwner =  table1.prenom1UniteLegale || ' ' || table1.nomUniteLegale, 
BusinessNameDavid = table1.denominationUniteLegale ,
BusinessAddressDavid = table1.numeroVoieEtablissement || ' ' || table1.typeVoieEtablissement || ' ' || table1.libelleVoieEtablissement 
from table2 
WHERE table1.siren = table1.siren 
Categories
Laravel MySql

LARAVEL – auto increment a column with mysql – upsert

see example below of an upsert

Polls::updateOrInsert(['business_id'=> $business_id],
    [
        "$vote_value" => DB::raw('$vote_value + 1'),
        'polls_name' => $theBusiness->BUSINESSNAME,
        'source' => env('APP_CODE'),
        'updated_at' => $lastupdated
    ]);
Categories
Laravel SqLite

SQLITE – Auto-increment a column with Laravel

Example : for SQLITE the double quote is critical to make it work

Polls::updateOrInsert(['business_id'=> $business_id],
    [
        "$vote_value" => DB::raw('"$vote_value" + 1'),
        'polls_name' => $theBusiness->BUSINESSNAME,
        'source' => env('APP_CODE'),
        'updated_at' => $lastupdated
    ]);
Categories
General

SQL Table Creation Concept – Practical

 CREATE TABLE api.m2_track_file_submission_to_windsurfer (
 id serial NOT NULL,
 ...
 ...
 ...
 ...
 created_at timestamp(0) NULL,
 updated_at timestamp(0) NULL,
 deleted_at timestamp(0) NULL
 ); 

Categories
Laravel

Laravel Eloquent SQL query compare insensitive string

'ilike' or 'not ilike'
return $query->where('api_call', 'not ilike', '%TEST%');
Categories
Satori Architect

Error:80040419 Satori (SORTING) STO2=2 Satori (Dosort) output MRE1=54 -2147220455 CallDoProcess() failed. (error 80040419) Satori

Error:80040419 Satori (SORTING) STO2=2 Satori (Dosort) output MRE1=54 -2147220455 CallDoProcess() failed. (error 80040419) Satori

Not enough pieces

Categories
General

Mac Tips

defaults write -g InitiaKeyRepeat -int 10
defaults write -g KeyRepeat -int 1

Categories
Continuous Integration/Development Programming

SENIOR MOTTO

  • Is it going to fix something or make it more performant?
  • Can we afford it breaking what’s already working?
  • Does it require rewriting a lot of tests?
  • Do we really need to make that change?

From Mohamed Said – Laravel Team

Categories
javascript

PHP JSON Merge

This code is used to merge given two JSON objects

<?php
$json1 = '{
	"id": "#001",
    "username": "Tom",
    "type": "admin",
    "status": "active"   
}';

$json2 =  '{
    "id": "#002",
    "username": "Jerry",
    "type": "user",
    "status": "Inactive"
}';
$user[] = json_decode($json1,true);
$user[] = json_decode($json2,true);
$json_merge = json_encode($user);
?>

<h4>Given JSON String:</h4> 
<p>
<div>$json1 = <?php echo $json1; ?></div>
<div>$json2 = <?php echo $json2; ?></div>
</p>
<h4>Output:</h4> 
<div><?php echo $json_merge; ?></div>
Categories
Laravel

Install Css Flag with Laravel

#1 – Install Flag library via NPM

npm install flag-icon-css

#2 – Import css to your library

 import 'flag-icon-css/css/flag-icon.css'

#3 – in your blade

<li >
    <a href="/en"> <i class=" flag-icon flag-icon-us"></i></a>
</li>