Thursday, August 21, 2014

Java Method to Generate OTP

      private static String getOTP(int length) {            
           Random r = new Random();            
           char[] dArray = "0123456789".toCharArray();  
           String ret = "" + dArray[ 1 + r.nextInt(8) ];                                
           for(int i=1; i < length; i++) {  
                ret += dArray[ r.nextInt(9) ];  
           return ret;  

Monday, August 18, 2014

Technical notes to self

iManager does not like you setting an attribute value to blank. A small LDIF like below will do the trick:
dn: cn=tomjones,ou=users,o=data
change type: modify
add: telephoneNumber

 The following will strip blank attributes from an IDM Driver. Normally add to output transform.

        <description>Strip Empty Values [Add]</description>
                <if-operation mode="case" op="equal">add</if-operation>
            <do-strip-xpath expression="add-attr[value='']"/>
            <do-strip-xpath expression="add-attr[not(*)]"/>
        <description>Strip Empty Values [Modify]</description>
                <if-operation mode="case" op="equal">modify</if-operation>
                <if-operation mode="case" op="equal">sync</if-operation>
            <do-strip-xpath expression="modify-attr/add-value[value='']"/>
            <do-strip-xpath expression="modify-attr[not(*)]"/>

Communication is Key

The older I get the more I realise how import clear communication is. Communication does not come naturally to all people, espically people in the more technical sectors. I must say I really enjoying working with technology. Things are normally always black and white or zeros and ones. When it comes to people that are a number of soft skills that in my case needed to be learnt and did not come natually and I have to admit I'm still learning new things every day about working with people.

Leason for today:

Talk to people, not about people.

One thing I need to start doing is after key meetings send out my own 'minutes'. This way I communicate my understanding of what was communicated in the meeting and what decisions where made. Also I need to make clear statements in my 'minutes' about assigned roles and responsbilities. Never assume someone has commited to doing something unless it's in black and white!

Friday, August 8, 2014

Database Table Names

Learnt this the hard way when I found out MySQL tables are case sensitive.

A bit of background information:
The (ANSI) SQL standard requires that non-quoted identifiers are stored in all uppercase in the system catalogs and that non-quoted identifiers are case-insensitive.
According to the standard the following non-quoted identifiers reference the same object (e.g. a table): FOOBAR, foobar, FooBar (and all would have been stored as FOOBAR in the system catalogs).
The following quoted identifiers reference 3 different objects: "FOOBAR", "foobar", "FooBar".
Nearly all DBMS comply at least with the requirement that non-quoted identifiers are case insensitive. Except for MySQL and SQL Server as far as I know - both can be configured to be case-sensitive even for non-quoted identifiers. I'm not sure what the default behaviour of SQL Server is though (as Damien pointed out in his comment, this depends on the collation being used for SQL Server).
MySQL is even more confusing as its behaviour depends on the combination of several configuration settings, the storage engine and the filesystem. All other DBMS I know are consistent regarding their behaviour across all platforms and installations.
PostgreSQL complies with the case-sensitivity but it folds everything to lowercase.
So given these rules, I think that the "traditional" naming convention using underscores stems from the fact that object names are stored in uppercase. The only way to get "readable" names is to separate important parts of the name with underscores.
SQL Server is even more non-standard as it is case-preserving (similar to the way NTFS under Windows works) so it does not fold the names to anything. So it does not change the case of the name when it's stored in the system catalog (but it is by default case insensitive). For that reason you will find people working in a Microsoft environment using CamelCase more often then e.g. in an Oracle environment.