The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 2,422 other followers

Archive for July 6th, 2021

Diagrams om task states and transitions

Posted by jpluimers on 2021/07/06

For my link archive, a bunch of task state diagrams that include transitions between the states.

The diagrams are in no particular order.

–jeroen

Read the rest of this entry »

Posted in Development, Software Development | Leave a Comment »

Where my tweet about testing in production gained me knowledge about the Covid QR code systems

Posted by jpluimers on 2021/07/06

Even though RIVM twitter-care did not respond at all on my raised issue that the production environment leaded an acceptation environment URL, it did gain me some knowledge on their systems and the (then upcoming) European QR code systems.

[Archive.is] Jeroen Wiert Pluimers on Twitter: “Onhandig op de #CoronaCheck site van het @rivm de link hier (1) wijst nog naar de acceptatie omgeving en daar heb je authorisatie voor nodig. Zonder “.acc” werkt het ook niet: (2) Dit werkt wel: (3) CC @locuta… “

  1. web.acc.coronacheck.nl/nl/faq/1-6-welke-informatie-staat-in-mijn-qr-code/
  2. web.coronacheck.nl/nl/faq/1-6-welke-informatie-staat-in-mijn-qr-code/
  3. coronacheck.nl/nl/faq/1-6-welke-informatie-staat-in-mijn-qr-code/

The problem digging into it was that it only reproduces when inside the [Archive.is] Coronacheck Print Portaal after you have logged on via DigiD, so you cannot save it in the WayBack machine nor Archive.is.

This print portal isn’t a straightforward hierarchy of web-pages, but an actual Vue.js app that injects itself into [Wayback/Archive.is] nl-covid19-coronacheck-website/index.html at main · minvws/nl-covid19-coronacheck-website and dynamically changes the URL depending on the application state.

It also means that you cannot archive pages like coronacheck.nl/nl/print/vaccinatie-ophalen or coronacheck.nl/nl/print/keuze-papieren-bewijs as the Vue.js app will not understand state from those sub-URLs and go back to coronacheck.nl/nl/print/

The only other results of [Wayback] “acc.coronacheck.nl” – Google Search were:

Acceptance URLs in production

I had a hunch the CoronaCheck code would be open source, though finding it through the most obvious [Wayback] open source coronacheck app – Google Search failed. Since the web-site and app look very similar to the CoronaMelder web-site and app, I tried [Wayback] open source coronamelder app – Google Search and found the page with links: [Wayback] Colophon – Stop the spread of the coronavirus, download CoronaMelder.

Note that [Wayback] Open-Source Project Corona-Warn-App is a different beast. Though internationally available and released way earlier than the Dutch apps, the Dutch government has a huge ego (maybe even abbreviatable to Hugo) resulting in severe “not invented here” syndrome despite having had to be bailed out when “code black” happened in hospitals.

One thing that I learned is that there is one version of the code behind coronacheck.nl/nl/print/print-vaccinatie in the main branch of github.com/minvws/nl-covid19-coronacheck-website that has only acceptance URLs. They are in these locations:

Apparently, replacing these with production URLs is done during deployment, but I could not find the code that does it in the main repositories at [Wayback] github.com/minvws

European Corona/COVID-19 Green Pass QR certificate

One answer to my tweet was [Archive.is] Joel Haasnoot on Twitter: “gir.st/blog/greenpass.html… “ which provides more information on the European

These are the links I thought were interesting:

–jeroen

Read the rest of this entry »

Posted in Development, JavaScript/ECMAScript, Scripting, Software Development, Vue.js, Web Development | Leave a Comment »

SQL Server, [] brackets, keywords and special characters

Posted by jpluimers on 2021/07/06

A few links for my archive:

  • [WayBack] sql server – What is the use of the square brackets [] in sql statements? – Stack Overflow answer by Michael Haren:

    The brackets are required if you use keywords or special chars in the column names or identifiers. You could name a column [First Name] (with a space)–but then you’d need to use brackets every time you referred to that column.

    The newer tools add them everywhere just in case or for consistency.

     

  • [WayBack] tsql – What characters are valid in an SQL Server database name? – Stack Overflow answer by Scott Munro:

    Delimited names – surrounded by square brackets or double quotes (if QUOTED_IDENTIFIER is set to ON) – can contain basically anything other than the delimiters themselves. It is even possible to use the delimiters within the name with some escape logic. Note though that it is only the closing escape character that must be escaped. In the first example below, the single instance of the opening escape character in the name does not need to be escaped whereas the closing escape character does have to be escaped (by replacing the single instance with two). I guess the logic here is that whatever code that is parsing these statements is looking for a closing escape character and has is not interested in nested opening escape characters.

    • [Test[Test] -> Test[Test
    • [Test]]Test] -> Test]Test

    The following is a description of the rules surrounding non delimited (nonquoted) identifier names in SQL Server 2012. It is an extract from the document Guide to Migrating from MySQL to SQL Server 2012.

    Schema Object Names

    In SQL Server 2012, an object name can be up to 128 characters long.

    Nonquoted identifier names must follow these rules:

    • The first character must be alphanumeric, an underscore (_), an at sign (@), or a number sign (#).
    • Subsequent characters can include alphanumeric characters, an underscore, an at (@) sign, a number sign, or a dollar sign.
    • The identifier must not be a Transact-SQL reserved word. Guide to Migrating from MySQL to SQL Server 2012 8
    • Embedded spaces or special characters are not allowed.

    Identifiers that start with @ or a number sign have special meanings. Identifiers starting with @ are local variable names. Those that start with a number sign are temporary table names.

    To quote an identifier name in Transact-SQL, you must use square brackets ([]).

  • [WayBack] Database Identifiers – SQL Server | Microsoft Docs:
    1. Classes of Identifiers
    2. Rules for Regular Identifiers
    3. See Also

–jeroen

 

 

Posted in Database Development, Development, SQL Server | Leave a Comment »

Delphi: bumped into System.Classes.TLoginCredentialService while doing a “DefaultUsrPwDm” – Google Search

Posted by jpluimers on 2021/07/06

Doing a  “DefaultUsrPwDm” – Google Search, I bumped into the System.Classes.TLoginCredentialService class.

There is hardly any documentation.

It was introduced as [WayBack] System.Classes.TLoginCredentialService – XE2 API Documentation with the standard TObject template:

TObject is the ultimate ancestor of all objects and components.

System.Classes.TLoginCredentialService inherits from System.TObject. All content below this line refers to System.TObject.

TObject is the ultimate ancestor of all objects and components.

Although TObject is the based object of a component framework, not all objects are components. All component classes descend from TComponent.

Note: TObject is never directly instantiated. Although it does not use programming language features that prevent instantiation, TObject is an abstract class.

The documentation was updated in Delphi XE4 to [WayBack] System.Classes.TLoginCredentialService – RAD Studio API Documentation

TLoginCredentialService provides functionality for login action, regardless of framework.

TLoginCredentialService represents an extensible, framework agnostic, login credential service with support for callbacks (success, failure). It includes methods for:

  • Getting user credentials: DomainUsername and Password.
  • Registering and unregistering credentials from handlers.

See Also

That version also added [WayBack] System.Classes.ELoginCredendialError – RAD Studio API Documentation

ELoginCredendialError is the exception class for handling invalid login credentials.

ELoginCredendialError is raised when an application attempts to get specified, but unexisting, login credentials.

Nothing ever got added, no examples, no documentation, just look at for instance the Delphi Rio documentation:

Luckily, I found this for my research list (code at [WayBack] tlogincredentialservice.zip) : [WayBack] delphi – TLoginCredentialService usage example – Stack Overflow which uses globals, but that’s not the point of the demo (you can use different storage in your actual code)

I’ve just created a small demo of how to use it

Click here to download the code

In the following I’ll show some of the code:

First I need a record to hold Credentials, and a list of them :

Type
  TCredential = record
    Username, Password, Domain: string;
    constructor Create(const aUsername, aPassword, aDomain: string);
    function AreEqual(const aUsername, aPassword, aDomain: string): Boolean;
  end;

  TCredentialList = class(TList<TCredential>)
  public
    function IsValidCredential(const aUsername, aPassword, aDomain: string): Boolean;
  end;

then we need to define a context in wich we are calling this. Thats just a application unique string wich identifyes each Loginfunction

const
  Context = 'TForm1';

In Form create I create my list and add dummy data to it

procedure TForm1.FormCreate(Sender: TObject);
begin
  CredentialList := TCredentialList.Create;
  //Add Dummy data
  CredentialList.Add(TCredential.Create('AA', 'AA', 'DomainAA'));
  CredentialList.Add(TCredential.Create('BB', 'BB', 'DomainAA'));
  CredentialList.Add(TCredential.Create('CC', 'CC', 'DomainAA'));

  // Register your Login handler in a context.
  // This method is called when you try to login
  // by caling TLoginCredentialService.GetLoginCredentials();
  TLoginCredentialService.RegisterLoginHandler(Context, LoginCredentialEvent);
end;

I have placed a button on my form from wich I make my call to login :

procedure TForm1.Button1Click(Sender: TObject);
begin
  // The actual call to login
  // First param is the context
  // Second Parameres is a callback function given to the event handler.
  TLoginCredentialService.GetLoginCredentials(Context,
    function { LoginFunc } (const Username, Password, Domain: string): Boolean
    begin
      //The actual user validation
      Result := CredentialList.IsValidCredential(Username, Password, Domain);
    end);
end;

Finally I just need to implement my loginhandler:

//This is the "onLogin" event handler.
//This is called durring a login attempt
//The purpose of this event handler are to call tha callBack function with correct information
//and handle the result
procedure TForm1.LoginCredentialEvent(Sender: TObject; Callback: TLoginCredentialService.TLoginEvent; var Success: Boolean);
begin
  //Call the callback
  Callback(Sender, LabeledEdit1.Text, LabeledEdit2.Text, LabeledEdit3.Text, Success);

  //Handle the success.
  if Success then
    Label1.Caption := 'Yes'
  else
    Label1.Caption := 'No';
end;

Hope this answers the question.Dont forget to download the complete code here

–jeroen

Posted in Delphi, Development, Software Development | Leave a Comment »

 
%d bloggers like this: