Coding For A Life Time
23 Şubat 2012 Perşembe
Clear Windows Saved / Cached Passwords
Any stored user password can be cleared using the key manager. In order to access key manager run following command (without quotes) in the command line :
‘rundll32.exe keymgr.dll, KRShowKeyMgr’
This tool will display saved passwords and you can just select and click remove to delete a cached password.
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>"
<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
<attribute name="ConfigurationURL">resource:log4j.xml</attribute>
<attribute name="CatchSystemOut">false</attribute>
<attribute name="Log4jQuietMode">true</attribute>
</mbean>
or
To overcome this error
- Edit jboss-service.xml configuration file to include CatchSystemOut=false configuration. For example
<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
Delete .svn Directories Recursively
Unix Systems:
Just run the following command
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"
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>
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>
7 Aralık 2010 Salı
Yet Another Turkish Character Issue - MySQL Backup / Restore
mysqldump command is the mostly preferred way to backup a database (or a collection of databases). After restoring database from the dumped file you may encounter with distorted unicode characters.
Using UTF8 option while backing up and restoring database will prevent this problem.
So use following command to back the database :
mysqldump -u <user> -p --default-character-set=utf8 <dbname> -r <dump_file>
and use following command to restore from dump file
mysql --default-character-set=utf8 -u <user> -p <dbname> -e "<dump_file>"
(yes fıle name is in quotes)
Using UTF8 option while backing up and restoring database will prevent this problem.
So use following command to back the database :
mysqldump -u <user> -p --default-character-set=utf8 <dbname> -r <dump_file>
and use following command to restore from dump file
mysql --default-character-set=utf8 -u <user> -p <dbname> -e "<dump_file>"
(yes fıle name is in quotes)
Liferay 6.0.5 Turkish Character Problem
You decided to upgrade your liferay portal application to version 6.0.5, worked hard and managed to migrate your custom implementation. You run brand new application and surprise. Turkish portlet titles, Turkish labels in jsp ( you code these labels to get from properties files right? ) are all problematic. You tried to googling but nothing. At least, that was what happened to me.
Here is the recipe: Liferay is no more using ANSI encoded properties file. What you did for previous version was (what was recommended) writing your properties file in native language, saving it as UTF8 encoded. Let say you populated your properties file Language-ext_tr.properties.native. Later, liferay recommends generating Language-ext.properties file using native2ascii tool. This tool simply replaces non-ascii characters with corresponding unicode encoding. For example character ı (i without a dot above) is converted to \u0131.
Liferay 6.0.5 now reads properties files in UTF8 (without BOM), so no more you need to use native2ascii tool. Just rename your Language-ext_tr.properties.native as Language-ext_tr.properties, and leave the native characters as they are.
Here is the recipe: Liferay is no more using ANSI encoded properties file. What you did for previous version was (what was recommended) writing your properties file in native language, saving it as UTF8 encoded. Let say you populated your properties file Language-ext_tr.properties.native. Later, liferay recommends generating Language-ext.properties file using native2ascii tool. This tool simply replaces non-ascii characters with corresponding unicode encoding. For example character ı (i without a dot above) is converted to \u0131.
Liferay 6.0.5 now reads properties files in UTF8 (without BOM), so no more you need to use native2ascii tool. Just rename your Language-ext_tr.properties.native as Language-ext_tr.properties, and leave the native characters as they are.
Kaydol:
Yorumlar (Atom)