Posts

Migrate all blogger(blogspot) posts to wordpress.

Image
This video shows how to migrate from blogger to wordpress. There are lots of plugins that can be used for greater blogging experience using wordpress.

Oracle/PLSQL: Execute an SQL script file in SQLPlus

Question: How do I execute an SQL script file in SQLPlus? Answer: To execute a script file in SQLPlus, type @ and then the file name. SQL > @{file} For example, if your file was called script.sql, you'd type the following command at the SQL prompt: SQL > @script.sql The above command assumes that the file is in the current directory. (ie: the current directory is usually the directory that you were located in before you launched SQLPlus.) If you need to execute a script file that is not in the current directory, you would type: SQL > @{path}{file} For example: SQL > @/oracle/scripts/script.sql This command would run a script file called script.sql that was located in the /oracle/scripts directory.

Change Oracle password after installation.

To change a password after installation: Start SQL*Plus: C:\> sqlplus /NOLOG Connect as SYSDBA : SQL> CONNECT / AS SYSDBA   Action SQL Statement Unlock a password ALTER USER username ACCOUNT UNLOCK; Lock a password ALTER USER username ACCOUNT LOCK; Change password of an unlocked account ALTER USER username IDENTIFIED BY password ; Change password of a locked account ALTER USER username IDENTIFIED BY password ACCOUNT UNLOCK;  

Resolving ORACLE ERROR:ORA-20000: the account is locked

From your command prompt, type sqlplus "/ as sysdba" Once logged in as SYSDBA, you need to unlock the hr account SQL> alter user hr account unlock; SQL> grant connect, resource to hr;

Check remote file size in php using PHP5 and cUrl.

To check file size you need PHP5 and Curl. It first try checking headers. But if file size is not specified in headers, it use cUrl to download the file and checks the size. File is saved in memory temporarily. <?php echo get_remote_size("http://www.google.com/"); function get_remote_size($url) {     $headers = get_headers($url, 1);     if (isset($headers['Content-Length'])) return $headers['Content-Length'];     if (isset($headers['Content-length'])) return $headers['Content-length'];     $c = curl_init();     curl_setopt_array($c, array(         CURLOPT_URL => $url,         CURLOPT_RETURNTRANSFER => true,         CURLOPT_HTTPHEADER => array('User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3'),         ));     curl_exec($c);     return curl_getinfo($c,...

Check whether url is valid with php

Use Filter Validator  to validate url. filter_var($url, FILTER_VALIDATE_URL); Example using that, if (filter_var($url, FILTER_VALIDATE_URL) === FALSE) {     die('Not a valid URL'); }

How to add custom javascript to backend(admin) and frontend of wordpress cms?

Image
Here I'm going to show how to add custom javascript to your backend(admin panel) and frontend of your wordpress website inside <head> tag. I am not talking about wordpress.com(pre hosted) blogging system. Here I'm demonstrating how to do it in self-hosted blog/website. First you need to go to Theme Editor(Appearance -> Editor). And find functions.php file from right panel. To find it easily click Ctrl + F (In Windows machine) and type functions.php. After you found it click on it and it will open up online editor. You will see something like following. Coding may differ in your system. And add following code to the end of functions.php file. function custom_js() { echo '<script type="text/javascript"> YOUR CODE HERE </script>'; } // Add hook for admin <head></head> add_action('admin_head', 'custom_js'); // Add hook for front-end <head></head> add_action('wp_head', 'cust...