challenge Nov 2020 with #Prolog

Below my #prolog solution for “Calculator with Two Buttons” proposed by challenge Nov 2020 swipl ?- shortest_path(0,5034,Path), length(Path,Len), findall(Op,member([_,Op,_], Path), Ops). Path = [[0,+,1],[1,+,2],[2,+,3],[3,+,4],[4,+,5],[5,*,50],[50,*,500],[500,+,501],[501,+,502],[502,+,503],[503,*,5030],[5030,+,5031],[5031,+,5032],[5032,+,5033],[5033,+,5034]], Len = 15, Ops = [+,+,+,+,+,*,*,+,+,+,*,+,+,+,+]. Below my script :- use_module(library(clpfd)). shortest_path(From, To, Path):- From #>= 0, shortest_path(From, To, 0, Path). shortest_path(From, To, MaxDepth, Path):- path(From, To, MaxDepth, Path),! . shortest_path(From, To, MaxDepth, Path):- MaxDepth1 #= MaxDepth + 1, shortest_path(From, To, MaxDepth1, Path). path(From, To, _MaxDepth, [[From, Op, To]]):- step(From, Op, To)....

November 14, 2020 · 1 min · 119 words · Matteo Redaelli

Active Directory authentication for PostgreSQL users

It is easy, you just need to add to the configuration file /var/lib/postgresql/data/pg_hba.conf host all all ldap ldapserver="myldapserver" ldapbasedn="OU=USERS,DC=group,DC=redaelli,DC=org" ldapbinddn="CN=matteo,OU=USERS,DC=group,DC=redaelli,DC=org" ldapbindpasswd="MySillyPwd" ldapsearchattribute="sAMAccountName" ldapscheme="ldaps" And inside your database yu need to create a role for the Active director users and then grant them to the required databases.

October 12, 2020 · 1 min · 47 words · Matteo Redaelli

LDAP search examples from command line

setup In these examples I use kerberos authentication but you could also use basic authentication with -D and -w options For semplicity I put common options into the environment and I have created an alias export LDAP_OPTS="-h -LLL -Y GSSAPI -b dc=group,dc=example,dc=com -o ldif-wrap=no " alias adsearch="/usr/bin/ldapsearch ${LDAP_OPTS}" Extract locked users adsearch “(&(objectCategory=Person)(objectClass=User)(lockoutTime>=1))” dn Expired passwords date -d “1601/1/1+$(expr 132469210596077795 / 10000000 )Seconds” “(&(objectclass=user)(objectcategory=person)(!pwdlastset=0)(pwdlastset<={date})(!userAccountControl:1.2.840.113556.1.4.803:=65536))” Extracting the flat list of members of a group How to recursively retreiving teh list of members of a group...

October 12, 2020 · 1 min · 87 words · Matteo Redaelli

Using a GraphQL gateway for backend services (Active Directory, AWS and Qliksense Api samples)

Complex web sites read and write data from/to several backend systems using different interfaces (sql, soap , rest, rpc,..). But it could be simpler and useful to create a single endpoint and interface for all the backends. With GraphQL the frontend applications get from the backends only the list of fields they need and do not receive the static list of the fields provided by the soap/rest services. I played with graphql and Walmart lacinia implementing one GraphQL backend for LDAP/Active Directory and one for Qliksense Repository rest api....

October 11, 2020 · 2 min · 253 words · Matteo Redaelli

Using chrome/firefox programmatically for navigating a (Qliksense) website and taking screenshots

How do you know if the user interface (UI) of a website you’re developing works as it should and the site as a whole delivers the optimal user experience (UX)? Headless browsers give you a fast, lightweight way to automate high-level actions and get an idea of how well your site operates in common scenarios. Links to Headless browers: Chrome Firefox Phantomjs Safari I found the nice clojure library etaoin for using a browser programmatically....

September 8, 2020 · 1 min · 150 words · Matteo Redaelli