Tuesday, July 10, 2018

Tomcat - removing server info

Below are the steps to remove Tomcat Server Information

1. Make sure Tomcat is not running
2. Navigate to "Tomcat Installation"/lib
3. Backup catalina.jar
4. vi catalina.jar
5. select "org/apache/catalina/util/ServerInfo.properties" and remove the server info
6. Then, save the file and restart Tomcat

Sunday, June 3, 2018

Boostrap Validator - Reset validated field

If you work with Boostrap Validator (http://1000hz.github.io/bootstrap-validator/), sometime, you may 
want to reset validated field.

If you have added





You will need to remove has-error, has-danger and has-success.

For example

$('#from_group').removeClass('has-error has-danger has-success');

If you have added







You will need to remove glyphicon-remove and glyphicon-ok class

For example,

$('#glyphicon_span').removeClass('glyphicon-remove glyphicon-ok');

If you have added










You will need to empty the inner html

For example,

$('#error_div').html("");

Sunday, May 20, 2018

Bootstrap Validator - Submit button remain disabled even when form is valid



If you work with Boostrap Validator (http://1000hz.github.io/bootstrap-validator/), you may experience an issue when your entire form is valid, however, the submit button remains disabled. Furthermore, if you check the form feedback div via console, e.g.


console.log("danger: " + $('#submit-form').find('.has-danger').length);
console.log("error: " + $('#submit-form').find('.has-error').length);
console.log("success: " + $('#submit-form').find('.has-success').length);


all danger, error and success class could not be found.

The reason: You have disabled but required fields in your form.

To workaround it, you could set

data-validate="false"


in your field and only enable validation as required, e.g


create.click(function(event){
//enable the field
document.getElementById("name").disabled = false;
//enable data validation
$("#name").attr('data-validate', true);
// Tell validator there's a change - update and validate
form.validator('update').validator('validate');
// print data validation attribute
console.log( $("#name").attr('data-validate') );
});

Thursday, April 19, 2018

Oracle - ORA-01502: index XXX.YYYY or partition of such index is in unusable state

If you encounter an Oracle error

ORA-01502: index XXX.YYYY or partition of such index is in unusable state

You could apply the following fix at the database

1. Log into the database, for example

sqlplus sys as sysdba

2. Run the following SQL

SELECT 'ALTER INDEX '||OWNER||'.'||INDEX_NAME||' REBUILD;' FROM DBA_INDEXES WHERE STATUS = 'UNUSABLE';

3. The above SQL will return multiple Alter statement which the index has to be rebuild. For example

'ALTERINDEX'||OWNER||'.'||INDEX_NAME||'REBUILD;'
--------------------------------------------------------------------------------
ALTER INDEX MYUSER.TABLE1 REBUILD;
ALTER INDEX MYUSER.TABLE2 REBUILD;

4. Run all of the alter statement to make the index usable again and it should fix the issue.

Reference:

1. http://dba.stackexchange.com/questions/3754/ora-01502-index-or-partition-of-such-index-is-in-usable-state-problem

Friday, March 16, 2018

Windows 7 - How to reset Windows 7 password

This is just a post of what I had found in the Internet and it works for me (See reference for the actual post). While I knew that there are other ways to reset Administrator password, this is very easy.

Below is a simplified steps.

1. Use a Windows 7 boot disk and boot into repair mode so that you could launch the command line utility

2. Run

 copy c:\windows\system32\sethc.exe c:\

3. Run

copy c:\windows\system32\cmd.exe c:\windows\system32\sethc.exe
4. Reboot the machine

5. Once the machine startup and reach the login page, hit the Shift key 5 times and it will launch an administrator command prompt

6. Use net user command to change the password

net user YourUserName YourNewPassword

7. You should be able to log in now. And of course, you should copying the c:\sethc.exe file back to c:\windows\system32\sethc.exe.

Reference:

1. http://www.howtogeek.com/96630/how-to-reset-your-forgotten-windows-password-the-easy-way/

Thursday, February 1, 2018

Windows 7 - STOP 0x0000007B (0xFFFFF880009A97E8 0xFFFFFFFFC0000034 0x0000000000 0x0000000000)

If you encounter STOP 0x0000007B (0xFFFFF880009A97E8 0xFFFFFFFFC0000034 0x0000000000 0x0000000000) blue screen of death. This is very likely a hard disk driver issue.




In my case, it is a valid error in the sense that I had just move one hard disk (with pre-configured Windows 7 in IDE SATA disk mode) from one machine to another newer machine (With BIOS in AHCI SATA disk mode).

The detail of this error can be found at Microsoft Knowledge Based 922976. In summary, a generate example, assume that you install Windows Vista or Windows 7 on a computer that contains a controller that uses the Pciide.sys driver. Later, you change the SATA mode to AHCI. Therefore, the drive must now load the Msahci.sys driver. However, you must enable the Msahci.sys driver before you make this change.


And the fix is to locate

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Msahci
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\IastorV


and fixed them


Below is what I had done to fix the issue.

1. Find a Windows 7 bootable disk and boot into Windows7 (remembered, I have a blue screen of dealth whenever I start up the machine and all options in F8 does not work)

2. Follow the wizard and select Repair when you are prompted to select Install or Repair

3. On the Recovery Tools menu, choose Command Line Console

4. In the Command Line Console, type regedit

5. It will open the regedit program. Now, highlight HKEY_LOCAL_MACHINE

6. Then, navigate to File -> Load Hive

7. Locate the Windows partition and look for \Windows\System32\config\system (Backup this first if possible)

8. Enter a key name when Regedit prompt for it (Any value will do, for this example, use tmp)

9. Located HKEY_LOCAL_MACHINE/tmp/

10. Search for Msahci and replace and Start key with Value 0.

11. Repeat step 10 for IastorV

12. Once step 10 and 11 is done, highlight "tmp"

13. Next, navigate to File -> Unload Hive to load it back to the Windows 7 Installation

14. Once done, restart the machine

15. Windows 7 should be able to start with AHCI SATA Disk Mode now.

References:

1 https://support.microsoft.com/en-us/kb/922976

Monday, December 4, 2017

Oracle - Reclaim disk space

Oracle does not release disk space even if you had delete the data or tablespace. If you have enterprise manager, you should use it to reclaim waste space.

You could do it manually but it will be troublesome. Below is a very simple steps to reclaim disk space used by Oracle if

1. You had added a continuous chunk of data

2. You had deleted the same continuous chunk of data added in point 1 and you had not added any data in between.

The reason being is you cannot shink and release space if free space are in between data.

If you are sure that you had met the above condition, do the following with sqlplus

1. Set column format so that the print is nice

COLUMN name FORMAT A50
2. Find the datafile and it used space


SELECT name, bytes/1024/1024 AS size_mb FROM v$datafile;

NAME                                                  SIZE_MB
-------------------------------------------------- ----------
/u01/app/oracle/oradata/users.dbf        10000

3. Shink the data file.

ALTER DATABASE DATAFILE '/u01/app/oracle/oradata/XE/users.dbf' RESIZE 1000M;

The final command is the trick and is pretty safe. If you try to shink a size which contain used data, it will throw an error

ORA-03297: file contains used data beyond requested RESIZE value


Reference:

1. https://oracle-base.com/articles/misc/reclaiming-unused-space#manual_tablespace_reorganization

Tomcat - removing server info

Below are the steps to remove Tomcat Server Information 1. Make sure Tomcat is not running 2. Navigate to "Tomcat Installation"...