LdapDTO Helper

$ucattribute = $entry[$attribute][0];
} else {
for ($j = 0; $j < $entry[$attribute][‘count’]; $j++) { $retEntry[$attribute][] = $entry[$attribute][$j]; } $this->$ucattribute = $retEntry[$attribute];
}
}
}
// undefined attributes are requested here
public function __get($name) {
return null;
}
}

Posted in IT

Build oci for PHP

mount DVD iso

mkdir /media/CentOS

mount /dev/cdrom /media/CentOS -o loop

vi /etc/yum.repos.d/CentOS-Media.repo

add file:///media/xxx   corresponding to the DVD media

download php source

yum –enablerepo=c6-media install libxml-devel

resp. yum –enablerepo=c8-media-AppStream install libxml-devel

yum –enablerepo=c6-media install httpd-devel

yum –enablerepo=c8-media-AppStream install libnsl

(replaces the NIS library that used to be in glibc)

extract php sources

./confgure

make
make test
make install

Download Oracle Client & SDK

vi /etc/ld.so.conf.d/oracle-11g-64.conf
/opt/app/oracle/product/11.2.0

ldconfig -v

export ORACLE_HOME=/opt/app/oracle/product/11.2.0
ln -s libclntsh.so.11.1 libclntsh.so

/usr/sbin/setenforce 0     ??

yum groupinstall “Development tools”

export CFLAGS=-m64
export CPPFLAGS=-m64
export CCASFLAGS=-m64

export CPPFLAGS=”-I/usr/include/oracle/19.5/client64 -m64″

cd php sources
cd ext
cd oci8
phpize
./configure –with-oci8=instantclient,/opt/app/oracle/product/11.2.0,11.2.0.3.0
make
ls modules

cd php sources
cd ext
cd pdo_oci
phpize
./configure –with-pdo-oci=shared,instantclient,/opt/app/oracle/product/11.2.0,11.2.0.3.0
make
ls modules

check with

ldd modules/oci8.so

all links ok?

make install

check which php.ini is used. If /etc/php.d Directory, add 20.oci.ini with

extension=oci8

and run php -v to see if any errors with so

restart Webserver and FPM (if used)

 

Update for CentOS 8, Minimal Installation (command history):

   16  less /etc/yum.repos.d/CentOS-Media.repo 
   17  mkdir /media/CentOS
   19  mount /dev/cdrom /media/CentOS -o loop
   41  yum --enablerepo=c8-media-BaseOS install mailcap
   49  rpm -ql mailcap
   50  yum --enablerepo=c8-media-AppStream install httpd
   51  yum --enablerepo=c8-media-AppStream install php.x86_64
   56  yum --enablerepo=c8-media-BaseOS install net-tools
   57  rpm -ql net-tools
   58  rpm -q net-tools
   59  find /media -name "net*.rpm"
   60  rpm -qlp /media/CentOS/BaseOS/Packages/net-tools-2.0-0.51.20160912git.el8.x86_64.rpm 
   61  rpm -qlp /media/CentOS/BaseOS/Packages/net-tools-2.0-0.51.20160912git.el8.x86_64.rpm | less
   62  yum --enablerepo=c8-media-BaseOS install net-tools
   66  apachectl configtest
   67  apachectl start
   69  telnet localhost 80
   73  yum --enablerepo=c8-media-AppStream install telnet
   77  ifconfig
   78  dhclient
   79  ifconfig
   90  firewall-cmd --get-default-zone
   91  ip link show
   93  firewall-cmd --list-all --zone=public
   94  systemctl enable firewalld
   95  firewall-cmd --state
   97  firewall-cmd --get-zones
   98  firewall-cmd --get-services
  103  firewall-cmd --get-active-zones
  105  firewall-cmd --zone=public
  106  firewall-cmd --zone=public --list-services
  107  firewall-cmd --zone=public --permanent --add-service=https
  108  firewall-cmd --zone=public --permanent --add-service=http
  109  firewall-cmd --zone=public --list-services
  110  firewall-cmd --reload
  111  firewall-cmd --zone=public --list-services
  112  firewall-cmd --get-active-zones
  122  less /etc/httpd/conf/httpd.conf 
  115  cd /var/www
  129  cd html
  133  vi test.php
  137  mount /dev/cdrom /media/CentOS -o loop
  140  yum --enablerepo=c8-media-AppStream install wget
  143  wget https://download.oracle.com/otn_software/linux/instantclient/195000/oracle-instantclient19.5-basic-19.5.0.0.0-1.x86_64.rpm
  144  wget https://download.oracle.com/otn_software/linux/instantclient/195000/oracle-instantclient19.5-devel-19.5.0.0.0-1.x86_64.rpm
  149  cksum oracle-instantclient19.5-basic-19.5.0.0.0-1.x86_64.rpm 
  150  cksum oracle-instantclient19.5-devel-19.5.0.0.0-1.x86_64.rpm 
  157  rpm -iv oracle-instantclient19.5-basic-19.5.0.0.0-1.x86_64.rpm 
  158  rpm -iv oracle-instantclient19.5-devel-19.5.0.0.0-1.x86_64.rpm 
  159  find / -name "oci.h"
  160  echo $ORACLE_HOME
  161  find / -name "libclntsh.so"
  163  grep -r oracle /etc/* | less
  164  ldconfig -v
  168  wget https://www.php.net/distributions/php-7.2.11.tar.bz2
  177  yum --enablerepo=c8-media-BaseOS install bzip
  179  mkdir php
  180  mv php-7.2.11.tar.bz2 php/
  181  cd php/
  183  bunzip2 php-7.2.11.tar.bz2 
  188  yum --enablerepo=c8-media-BaseOS install tar
  189  tar xvf php-7.2.11.tar 
  190  cd php-7.2.11/ext/oci8/
  194  yum --enablerepo=c8-media-AppStream install php-devel
  196  yum --enablerepo=c8-media-AppStream install libxml2-devel
  197  phpize
  202  rpm -qlp /root/oracle-instantclient19.5-basic-19.5.0.0.0-1.x86_64.rpm 
  203  export ORACLE_HOME=/usr/lib/oracle/19.5/client64
  208  yum groupinstall "Development tools"
  211  find / -name "oci.h"
  210  echo $CPPFLAGS
  222  export CPPFLAGS="-I/usr/include/oracle/19.5/client64 -m64"
  228  ./configure --with-oci8=shared,$ORACLE_HOME
  229  make
  230  ls modules
  231  ldd modules/oci8.so 
  233  yum --enablerepo=c8-media-AppStream install libnsl
  234  ldd modules/oci8.so 
  235  make install
  236  cd /etc/php.d
  241  vi 20.oci.ini 
  248  systemctl restart httpd
  249  systemctl restart php-fpm

 

RHEL

Upgrading from PHP 5.4 to 7.3

php –modules | tee /tmp/54
scl enable rh-php73 ‘php –modules’ | tee /tmp/73
diff /tmp/54 /tmp/73

systemctl stop php-fpm
systemctl start rh-php73-php-fpm
TODO: enable / disable…

scl enable rh-php73 ‘php -v’

yum install rh-php73-php-7.3.11-1.el7.x86_64 rh-php73-php-cli-7.3.11-1.el7.x86_64 rh-php73-php-common-7.3.11-1.el7.x86_64 rh-php73-php-devel-7.3.11-1.el7.x86_64 rh-php73-php-fpm-7.3.11-1.el7.x86_64 rh-php73-php-gd-7.3.11-1.el7.x86_64 rh-php73-php-gmp-7.3.11-1.el7.x86_64 rh-php73-php-intl-7.3.11-1.el7.x86_64 rh-php73-php-ldap-7.3.11-1.el7.x86_64 rh-php73-php-pdo-7.3.11-1.el7.x86_64 rh-php73-php-pecl-apcu-5.1.17-1.el7.x86_64

yum install libxml2-devel

yum remove php-devel.x86_64

tar xvzf php-7.3.11.tar.gz

./configure
make

cd ext/oci8

phpize

echo $ORACLE_HOME
export ORACLE_HOME=/usr/lib/oracle/12.1/client64
export CPPFLAGS=”-I/usr/include/oracle/12.1/client64 -m64″

scl enable rh-php73 ‘./configure -with-oci8=instantclient’
scl enable rh-php73 ‘make’
cp modules/oci8.so /opt/rh/rh-php73/root/usr/lib64/php/modules/

vi /etc/opt/rh/rh-php73/php.d/30-oci.ini

yum install rh-php73-php-soap-7.3.11-1.el7.x86_64

systemctl restart rh-php73-php-fpm

 

Posted in IT

Siedler 3 Gold Edition 1.60 Windows 10

Siedler 3 liess sich eigentlich ohne Probleme installieren (mit Kompatibilitätsmodus für  Windows 95 und Admin-Rechten für die Setup und Installer…
Allerdings zeigte sich beim Hauptfenster oben ein dicker weisser oder schwarzer Rand. Habe die S3.exe mal analysiert und die Stelle gefunden, wo der Fenster-Stil abgelegt ist.

Um den schwarzen Rand in Windows 10 wegzubekommen, kann man die Hex Zeichen 00 00 C8 90 ersetzen mit 00 00 00 94.

Gepatchte s3.exe als ZIP

Posted in IT

Praktische queryString Funktionen


else {
// nothing to remove, carry on.
urlParams = (null == queryString) ? “” : “?” + queryString;
}
urlParams+= urlParams.length()==0 ? “?” : “&”; urlParams+= “sso=false”;

Posted in IT

d3: keep first option in select

html:

<select id=”userMenu”><option value=””>– Please select –</option></select>

js:

d3.select(“select#userMenu”)
.on(‘change’, function() {
updateCheckboxes();
})
.selectAll(“option:not(:first-child)”)
.data(data)
.enter()
.append(“option”)
.attr(“value”, function(d) {return d.id; } )
.html( function(d) {return d.firstName + ‘ ‘ + d.lastName + ‘(‘ + d.id + ‘)’; } );

Posted in IT

Oracle 11g on localhost for dev

In case you cannot access console due to ssl_error_weak_server_cert_key,
you could switch it to unsecure:

set ORACLE_UNQNAME=orcl
set ORACLE_HOSTNAME=localhost
emctl unsecure dbconsole

 

Posted in IT

Attribute userAccountControl

Const ADS_UF_ACCOUNT_DISABLE = 2
Const ADS_UF_PASSWD_NOTREQD = 32
Const ADS_UF_DONT_EXPIRE_PASSWD = 65536

'Alle Accounts, die deaktiviert sind:
' => ADS_UF_ACCOUNT_DISABLE = 2
' => 
ldapFilter = "(userAccountControl:1.2.840.113556.1.4.803:=2)"

'Alle Accounts, die nicht deaktiviert sind:
' => ADS_UF_ACCOUNT_DISABLE = 2
' => 
ldapFilter = "(!(userAccountControl:1.2.840.113556.1.4.803:=2))"

'Alle Accounts, die kein Passwort benötigen ODER deren Passwort nie abläuft:
' => ADS_UF_PASSWD_NOTREQD And ADS_UF_DONT_EXPIRE_PASSWD = 32 + 65536 = 65568
' => 
ldapFilter = "(userAccountControl:1.2.840.113556.1.4.804:=65568)"

'Alle Accounts, die deaktiviert sind UND die kein Passwort benötigen:
' => ADS_UF_PASSWD_NOTREQD And ADS_UF_ACCOUNT_DISABLE = 32 + 2 = 34
' => 
ldapFilter = "(userAccountControl:1.2.840.113556.1.4.803:=34)"

mehr: http://www.selfadsi.de/ads-attributes/user-userAccountControl.htm

Posted in IT

MinifyFilter

package com.ofrick.filters;

import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.regex.*;

public class MinifyFilter implements Filter {

private Pattern regex = null;
 
 // This method is called once on server startup
 public void init(FilterConfig filterConfig) 
 {
 regex = Pattern.compile("^\\s*$\\n|\\t", Pattern.MULTILINE);
 }
 
 // This method is called for every request and needs to be thread safe.
 public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) 
 throws java.io.IOException, javax.servlet.ServletException 
 {
 HttpServletResponse resp = (HttpServletResponse) response;
 ResponseWrapper wrapper = new ResponseWrapper(resp);
 chain.doFilter(request, wrapper);
 
 String html = wrapper.toString();

html = regex.matcher(html).replaceAll("");
 //html = multipleSpaces.matcher(html).replaceAll(" ");
 resp.setContentLength(html.getBytes().length);
 PrintWriter out = resp.getWriter();
 out.write(html);
 out.flush();
 out.close();
 }
 
 // This method is called once on server shut down
 public void destroy() 
 {
 //
 }
 
 static class ResponseWrapper extends HttpServletResponseWrapper {
 private CharArrayWriter output;

public ResponseWrapper(HttpServletResponse response) {
 super(response);
 this.output = new CharArrayWriter();
 }

public String toString() {
 return output.toString();
 }

public PrintWriter getWriter() {
 return new PrintWriter(output);
 }
 }
 
}
Posted in IT