Linux Disable Hardware Beep Sound For Terminal
- If you are using xterm, open ~/.xsession file
$ cdAppend the following line:
$ vi .xession
xset b offSave and close the file.
- If you are using bash shell, open ~/.inputrc file
$ cdAppend following line:
$ vi .inputrc
set bell-style noneSave and close the file.
- If you want to turn off beep for VIM text editor, open vim config file ~/.vimrc
$ cdAppend following line
$ vi .vimrc
set vbSave and close the file.
Remove .svn folders
In order to clean up the SVN checkout, you can do
#deletes all .svn files/folders
find . -name ".svn" -exec rm -rf {} \;
OR
#deletes all .svn folders
find . -name ".svn" -type d -exec rm -rf {} \;
Oracle connection with JDBC – JNDI
- Using JNDI
javax.naming.Context context = newjavax.naming.InitialContext();
javax.sql.DataSource ds = (javax.sql.DataSource) context.lookup("java:comp/env/jdbc/XXXJNDINAMEXXX");
java.sql.Connection con = ds.getConnection();
TOP 25 Most Dangerous Programming Errors
- CWE-20:Improper Input Validation
- CWE-116:Improper Encoding or Escaping of Output
- CWE-89:Failure to Preserve SQL Query Structure
- CWE-79:Failure to Preserve Web Page Structure
- CWE-78:Failure to Preserve OS Command Structure
- CWE-319:Cleartext Transmission of Sensitive Information
- CWE-352:Cross-Site Request Forgery
- CWE-362:Race Condition
- CWE-209:Error Message Information Leak
- CWE-119:Failure to Constrain Operations within the Bounds of a Memory Buffer
- CWE-642:External Control of Critical State Data
- CWE-73:External Control of File Name or Path
- CWE-426:Untrusted Search Path
- CWE-94:Failure to Control Generation of Code
- CWE-494:Download of Code Without Integrity Check
- CWE-404:Improper Resource Shutdown or Release
- CWE-665:Improper Initialization
- CWE-682:Incorrect Calculation
- CWE-285:Improper Access Control
- CWE-327:Use of a Broken or Risky Cryptographic Algorithm
- CWE-259:Hard-Coded Password
- CWE-732:Insecure Permission Assignment for Critical Resource
- CWE-330:Use of Insufficiently Random Values
- CWE-250:Execution with Unnecessary Privileges
- CWE-602:Client-Side Enforcement of Server-Side Security
oracle XE “cannot access http://127.0.0.1:8080/apex”
I had installed oracle XE on CentOS and was not able to connect to web admin for past two days. Finally after a long two days of search, found this.
Thanks!
Recover MySQL root password
You can recover MySQL database server password with following five easy steps.
Step # 1: Stop the MySQL server process.
Step # 2: Start the MySQL (mysqld) server/daemon process with the –skip-grant-tables option so that it will not prompt for password
Step # 3: Connect to mysql server as the root user
Step # 4: Setup new root password
Step # 5: Exit and restart MySQL server
Here are commands you need to type for each step (login as the root user):
Step # 1 : Stop mysql service
# /etc/init.d/mysql stop
Output:
Stopping MySQL database server: mysqld.
Step # 2: Start to MySQL server w/o password:
# mysqld_safe --skip-grant-tables &
Output:
[1] 5988
Starting mysqld daemon with databases from /var/lib/mysql
mysqld_safe[6025]: started
Step # 3: Connect to mysql server using mysql client:
# mysql -u root
Output:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 4.1.15-Debian_1-log
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.
mysql>
Step # 4: Setup new MySQL root user password
mysql> use mysql;
mysql> update user set password=PASSWORD("NEW-ROOT-PASSWORD") where User='root';
mysql> flush privileges;
mysql> quit
Step # 5: Stop MySQL Server:
# /etc/init.d/mysql stop
Output:
Stopping MySQL database server: mysqld
STOPPING server from pid file /var/run/mysqld/mysqld.pid
mysqld_safe[6186]: ended
[1]+ Done mysqld_safe –skip-grant-tables
Step # 6: Start MySQL server and test it
# /etc/init.d/mysql start
# mysql -u root -p
Oracle XE Tuning
In order to use Oracle XE under normal load, database sessions and processes need to be increased. This could be some as follows:
SQL> show parameters sessions
SQL> alter system set sessions=250 scope=spfile;
SQL> show parameters processes
SQL> alter system set processes=200 scope=spfile;
In case you are unable to access apex website remotely, run the following command as sys
exec dbms_xdb.setListenerLocalAccess(false);
Access parent window from modalDialog
When you call showModalDialog() you need to pass “self”, without the quotes, as the second argument.
You can then access the parent(opener) with:
var opener = window.dialogArguments;
You can then access any function declared in parent window with:
opener.myFunction();
Resize image in PHP
Uploaded images from user can be of any size. If you need to use these images, they need to be resized upon upload. Here is a helper class to manage resizing of the images.
Let me know if you find any bugs.
Enable register_global through .htaccess
I would not recommend to enable register_globals, but if you need to enable the register_globals for a particular web folder, you can edit the .htaccess file and append the following to it
php_flag register_globals on
Restart apache and you are on your way.
