Skip to content

Programming by Design

If you're not prepared to be wrong, you'll never come up with anything original. – Sir Ken Robinson

  • About
  • Java-PbD
  • C-PbD
  • ASM-PbD
  • Algorithms
  • Other

Example using columns

Posted on November 30, 2018January 11, 2021 By William Jojo
Uncategorized
public class CharEx {
   
  public static void main(String[] args) {
     
    char c;
     
    c = 'a';
     
    System.out.println(c);
     
    if ( c >= '0' && c <= '9' )
      System.out.println (c + " is a digit.");
     
    if ( (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') )
      System.out.println (c + " is a letter.");
     
  }
   
}
#
# Check lock
#
[[ -f $lockfile ]] && cleanup 10
touch $lockfile

#
# Stop slapd
#
echo "Stopping LDAP..."
date
service slapd stop
date

#
# setup vars
#
today=$(date +"%y%m%d%H%M%S")
ldiffile=/hvcc/ldap/export/export-$today.ldif
backuppath=/hvcc/ldap/backup
bdbbackupfile=$backuppath/hvcc.edu.$(date +"%y%m%d").backup
logbackupfile=$backuppath/hvcc.edu.logs.$(date +"%y%m%d").backup
bdbpath=/var/lib/ldap
logpath=/var/lib/ldap

import sys, os, fcntl, time
import hvcc_gen_lib as hgl
import hvcc_ldap_lib as hll

if len(sys.argv) != 3:
  print "args: %d" % (len(sys.argv))
  print '\nUsage:\t%s "listname" "dl|mm"\n' % (sys.argv[0])
  print 'dl for distribution list, mm for mailing list (Mailman)\n'
  sys.exit(1)

lname = sys.argv[1]
dl = sys.argv[2]

#
# Open a rootdn connection
#
conn = hll.get_ldap_conn('ldap://127.0.0.1')
dn = 'cn=root,dc=hvcc,dc=edu'
pw = hll.get_rootdnpw()
hll.ldap_bind_conn(conn, dn, pw)

#
# Add list
#
if ( dl == 'mm' ):
  hll.list_add(conn, lname, False)
else:
  hll.list_add(conn, lname, True)

Post navigation

❮ Previous Post: Security Settings for Apache, Tomcat, NGINX and IIS.
Next Post: CISS-150 Project 1 – Planning! ❯

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Copyright © 2018 – 2025 Programming by Design.