Here are a few tips to using JSON from Delphi (using Devart’s PgDAC libraries)
Listing Key values from a JSON field
SELECT jsonb_object_keys(data) AS key
FROM bulkdata
WHERE idimport=29
GROUP BY key;
Here are a few tips to using JSON from Delphi (using Devart’s PgDAC libraries)
SELECT jsonb_object_keys(data) AS key
FROM bulkdata
WHERE idimport=29
GROUP BY key;
Pour lancer un script au démarrage du système “proprement” (en utilisant systemd) :
1. créer un script et le placer dans /usr/local/bin
.
2. créer un fichier de configuration dans /etc/systemd/system/xxx.service
3. Y placer le contenu suivant :
[Unit] Description=Bypass Dell fan control Before=i8kmon.service [Service] ExecStart=/usr/local/bin/dell-bios-fan-control enable=1 Type=oneshot RemainAfterExit=yes [Install] WantedBy=multi-user.target
4. Lancer systemctl daemon-reload
5. Activer le service avec systemctl enable xxx.service
La doc : https://www.freedesktop.org/software/systemd/man/systemd.unit.html#Before=
Il y a parfois des sites qui valent le détour tant le n’importe quoi est poussé à son paroxysme. Florilège.
Okinaha – Le charlatanisme 2.0 – Ne vous contentez pas de cette page d’introduction, le site regorge d’attrape-nigauds pour personnes électrosensibles.
https://okinaha.com/collections/hygiene-electromagnetique/products/genatome-gtc-369-bouclier-electromagnetique-1
Everyone seems to discourage the use of raw SQL in Ruby applications and while ActiveRecord seems a good solution for general purpose CRUD operations, we have a strong expertise in SQL and we want to use it as much as possible. Here are the bits we have collected so far on the subject. We are new to Ruby/Rails so these might be obvious for some of you. We primarily write this for ourselves.
We are perfectly aware of the “limitations”. We love PostgreSQL and have no intention of being RDBMS-agnostic. At all.
We want named parameters because, despite the overhead, it’s the cleanest way to pass parameters (we don’t have to preserve a strict order which can lead to problems when enhancing the query, counting the “?”, etc). Also, when we use the same parameter several times in the same query, we don’t have to repeat it.
class ClientsController < ApplicationController
def index
@clients = Client.find_by_sql(
<<-SQL
SELECT idclient,name,email,contacts
FROM clients
ORDER BY nom
SQL
)
end
def show
@client = Client.find_by_sql(["
SELECT idclient,name,email,contacts
FROM clients
WHERE idclient = :idclient",
{ :idclient => params[:id] }
])[0]
end
For the show
method, we have to grab the first element in the array (thus the [0]
at the end.
procedure TForm1.b1Click(Sender: TObject);
Var xls:TdxSpreadSheet;
sh: TdxSpreadSheetTableView;
begin
xls:=TdxSpreadSheet.Create(Self);
Try
xls.BeginUpdate;
xls.ClearAll;
sh:=TdxSpreadSheetTableView(xls.AddSheet('Bénéficiaires'));
// row,col
if Cells[1,1]=Nil then
CreateCell(1,1);
Cells[Row,Col].AsString:='test';
sh.cells[1,1].Style.Borders[bLeft].Style:=sscbsDouble;
sh.cells[1,1].Style.Borders[bRight].Color:=clred;
sh.Cells[1,1].Style.Brush.BackgroundColor:=clcxLightGray;
sh.Cells[1,1].Style.AlignHorz:=ssahCenter;
sh.Cells[1,1].Style.DataFormat.FormatCode:='dd/mm/yyyy';
sh.Cells[1,1].Style.DataFormat.FormatCode:='# ##0.00';
sh.Cells[1,1].Style.Font.Style:=[fsBold];
// Formula
CreateCell(2,1); // B3
sh.Cells[2,1].SetText('=SUM(B2:B2)',true);
xls.EndUpdate;
xls.SaveToFile('C:\Users\gosane\Desktop\text.xlsx');
Finally
xls.Free;
End;
end;
function xlscolname(i:integer):string;
var a,b:integer;
begin
if i<0 then
result:='?'
else if i<26 then
result:=chr(65+i)
else begin
a:=i div 26;
b:=i mod 26;
result:=chr(64+a)+chr(65+b);
end;
end;
interface uses DALoader,PgLoader;
Type TMyForm = Class(TForm)
// ...
private
procedure PgLoader1PutData(Sender: TDALoader);
End;
{...}
procedure TFxxx.PgLoader1PutData(Sender: TDALoader);
var i:Integer;
begin
for i:=1 to 10 do
Sender.PutColumnData('fieldname',i,Value);
end;
procedure TFxxx.Import;
Var pgl:TPgLoader;
begin
pgl:=TPgLoader.Create(Application);
Try
pgl.Connection:=DM.PgConnection1;
pgl.TableName:='MyTableName';
pgl.Options.BufferSize:=65536;
// pgl.OnProgress:=LoaderProgress;
pgl.OnPutData:=PgLoader1PutData;
pgl.CreateColumns;
// Remove primary key from PgLoader
for I := 0 to pgl.Columns.Count-1 do
if pgl.Columns[i].Name='idprimarykey' then begin
pgl.Columns.Delete(i);
break;
end;
pgl.Load;
Finally
pgl.Free;
End;
end;
Plasma can autostart applications and run scripts on startup and shutdown. To autostart an application, navigate to System Settings > Startup and Shutdown > Autostart and add the program or shell script of your choice. For applications, a .desktop file will be created, for shell scripts, a symlink will be created.
Note:
Programs can be autostarted on login only, whilst shell scripts can also be run on shutdown or even before Plasma itself starts.
Shell scripts will only be run if they are marked executable.
Place Desktop entries (i.e. .desktop files) here:
~/.config/autostart
: for starting applications at login.
Place or symlink shell scripts in one of the following directories:
~/.config/plasma-workspace/env
: for executing scripts at login before launching Plasma.
~/.config/autostart-scripts
: for executing scripts at login.
~/.config/plasma-workspace/shutdown
: for executing scripts on shutdown.
Source : https://wiki.archlinux.org/index.php/KDE#Autostarting_applications
Un résumé utile :
openssl x509 -noout -dates -subject -in moncertif.crt
La totale :
openssl x509 -noout -text -in moncertif.crt
cat moncert.crt intermediaire.crt moncert.key >/etc/courier/moncert.pem
daemon
mail.log
et pas seulement mail.err
courier-mta-ssl
procedure TFMain.FormShow(Sender: TObject);
begin
PostMessage(Button1.Handle,WM_LBUTTONDOWN,0,0);
PostMessage(Button1.Handle,WM_LBUTTONUP,0,0);
end;
uses Contnrs;
Dans l’interface :
TSQLColumn = Class
name : string;
typ : string;
// ...autres champs...
End;
TSqlColumnList = class(TObjectList)
private
function GetItem(Index: Integer): TSQLColumn;
procedure SetItem(Index: Integer; const Value: TSQLColumn);
public
property Items[Index: Integer]: TSQLColumn read GetItem write SetItem; default;
end;
Dans l’implémentation :
{ TSqlColumnList }
function TSqlColumnList.GetItem(Index: Integer): TSQLColumn;
begin
Result:=TSqlColumn(inherited GetItem(Index));
end;
procedure TSqlColumnList.SetItem(Index: Integer; const Value: TSQLColumn);
begin
inherited setItem(index, value);
end;
Utilisation :
TMyClass = Class
FColumns : TSqlColumnList;
Constructor Create;
Destructor Destroy; reintroduce;
End;
{ TcatRequete }
constructor TcatRequete.Create;
begin
FColumns := TSqlColumnList.Create;
end;
destructor TcatRequete.Destroy;
begin
FColumns.Free;
end;
Et pour remplir la liste :
Var column : TSqlColumn;
begin
FColumns.Clear;
// Ajouter un élément
column:=TSqlColumn.Create;
FColumns.Add(Column);
With column do begin
name := 'xxx';
end;
end;
Plutôt que de les garder dans mes onglets ouverts, autant qu’ils servent à tout le monde