9 Aralık 2011 Cuma

Manage OpenDS LDAP Accounts

Some opends commands to manage accounts : ( execute commands in directory OPENDS_HOME/bin )

<X> defines a variable and replace your own value in the command.
For example cn=<DIR_ADM> will be (or may be) cn=Directory Manager in your command

<DIR_ADM> : Directory admin user name i.e. Directory Manager
<DIR_ADM_PAWD> : Directory admin user paswword i.e. 123456
<TARGET_USER> : dn of the user to operate on i.e. uid=olcay,ou=People,dc=codeflt,dc=blogspot,dc=com



Disable an account :

./manage-account set-account-is-disabled \
                -h localhost -p 4444 -D "cn=
<DIR_ADM>" \
                --bindPassword <DIR_ADM_PAWD> \
                -X --targetDN "
<TARGET_USER>" --operationValue true


Enable an disabled account

./manage-account clear-account-is-disabled \
                --hostname localhost --port 4444 --bindDN "cn=<DIR_ADM>" \

                --bindPassword <DIR_ADM_PAWD> \
                --targetDN "<TARGET_USER>"




Check if an account is disabled

./manage-account get-account-is-disabled \
                -h localhost -p 4444 -D "cn=<DIR_ADM>" \

               --bindPassword <DIR_ADM_PAWD> \
                -X --targetDN "<TARGET_USER>"



List password history of an account

./manage-account get-password-history \
                --hostname localhost --port 4444 --bindDN "cn=<DIR_ADM>" \

                --bindPassword <DIR_ADM_PAWD> \
                --targetDN "uid=<TARGET_USER>"



Get failed login attempts of an account

./manage-account get-authentication-failure-times \
                -h localhost -p 4444 -D "cn=<DIR_ADM>" \

                --bindPassword <DIR_ADM_PAWD> \
                -X --targetDN "<TARGET_USER>"



Get remaining failed login attempts before account is locked

./manage-account get-remaining-authentication-failure-count \
                -h localhost -p 4444 -D "cn=<DIR_ADM>"-w password -
<DIR_ADM_PAWD> \
                --targetDN "<TARGET_USER>"






5 Aralık 2011 Pazartesi

Jboss Start-up Error : invalid console appender config detected, console stream is looping

If your application has its own log4j.properties, it may conflict with the one jboss uses. This will cause jboss to raise the following error:

"ERROR: invalid console appender config detected, console stream is looping."

To overcome this error   

  • Edit jboss-service.xml configuration file to include CatchSystemOut=false configuration. For example
<mbean code="org.jboss.logging.Log4jService" name="jboss.system:type=Log4jService,service=Logging">
<attribute name="ConfigurationURL">resource:log4j.xml</attribute>
<attribute name="CatchSystemOut">false</attribute>
<attribute name="Log4jQuietMode">true</attribute>
</mbean>


      or
  • Edit run.sh or run.conf (or run.bat on windows) to override JAVA_OPTS settings as 
 set JAVA_OPTS= %JAVA_OPTS% -Dorg.jboss.logging.Log4jService.catchSystemOut=false

Delete .svn Directories Recursively

Unix Systems:

Just run the following command

rm -rf `find . -type d -name .svn`

Windows:

You need to create a batch file containing following commands and execute it

FOR /F "tokens=*" %%G IN ('DIR /B /AD /S *.svn*') DO RMDIR /S /Q "%%G"



1 Aralık 2011 Perşembe

Javascript toUppercase - Fixed Turkish Characters

Here is the  javascript String prototype function extended to support Turkish characters.

            String.prototype.toTRUppercase = function() {
                var str = [];
                for(var i = 0; i < this.length; i++) {
                    var code = this.charCodeAt(i);
                    var c = this.charAt(i);

                    if(code == 305) //ı
                        str.push(String.fromCharCode(73));
                    else if(code == 105)  // i
                        str.push(String.fromCharCode(304));
                    else if(code == 287)  // ğ
                        str.push(String.fromCharCode(286));
                    else if(code == 252)  // ü
                        str.push(String.fromCharCode(220));
                    else if(code == 351)  // ş
                        str.push(String.fromCharCode(350));
                    else if(code == 246)  // ö
                        str.push(String.fromCharCode(214));
                    else if(code == 231)  // ç
                        str.push(String.fromCharCode(199));
                    else if(code >= 97 && code <= 122)
                        str.push(c.toUpperCase());
                    else
                        str.push(c);
                }
                return str.join('');
            }

Sample Usage

<html>
    <head>

        <title></title>
        <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
       
        <script type="text/javascript">

            String.prototype.toTRUppercase = function() {
                var str = [];
                for(var i = 0; i < this.length; i++) {
                    var code = this.charCodeAt(i);
                    var c = this.charAt(i);

                    if(code == 305) //ı
                        str.push(String.fromCharCode(73));
                    else if(code == 105)  // i
                        str.push(String.fromCharCode(304));
                    else if(code == 287)  // ğ
                        str.push(String.fromCharCode(286));
                    else if(code == 252)  // ü
                        str.push(String.fromCharCode(220));
                    else if(code == 351)  // ş
                        str.push(String.fromCharCode(350));
                    else if(code == 246)  // ö
                        str.push(String.fromCharCode(214));
                    else if(code == 231)  // ç
                        str.push(String.fromCharCode(199));
                    else if(code >= 97 && code <= 122)
                        str.push(c.toUpperCase());
                    else
                        str.push(c);
                }
                return str.join('');
            }
       
        </script>
    </head>
   
    <body>
   
        <form>
   
            <input type="text" onblur="this.value=this.value.toTRUppercase();"/>
   
        </form>
   
    </body>
   
</html>