Skip to main content

Posts

How to login to MySql db using username and password

$ mysql --host=localhost --user=myname --password=password mydb $ mysql -h localhost -u myname -ppassword mydb
Recent posts

How to get URL query string parameters in JS

           function   GetParameterValues ( param ) {                    var   url  =  window . location . href . slice ( window . location . href . indexOf ( '?' ) +  1 ). split ( '&' );                    for  ( var   i  =  0 ;  i  <  url . length ;  i ++) {                        var   urlparam  =  url [ i ]. split ( '=' );                        if  ( urlparam [ 0 ] ==  param ) {           ...

How to include Composer packages in CI

download CI Openup compser.js Add the package name udner 'required' Goto project folder in CMD Type composer install Let cmd download all package files After that goto ci config file Find where Composer auto-loading is mentiond Make $config .. =True And then add $config['composer_autoload'] = './vendor/autoload.php'; Make sure vendor folder align with what you type here. and thats it. To check if its working do a test on cotroller

How to download image file using cURL function and save it in local drive

  Following code shows how to get an image file by providing an URL and to save it in the local drive.   function file_get_contents_curl($url) {                     $file_data=array('data'=>null,'info'=>array('http_code'=>null));         $ch = curl_init();              curl_setopt($ch, CURLOPT_HEADER, 0);         curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);         curl_setopt($ch, CURLOPT_URL, $url);              $file_data['data'] = curl_exec($ch);         if (!curl_errno($ch)) {             $info = curl_getinfo($ch);             $file_data['info'] = $info;         ...

How to rename bulk files in a folder

Following CI framework function does bulk rename of a given folder.       public function rename_id_names_of_images(){         $dir_path = 'C:\xampp\htdocs\myprojects\image_downloader\images\by_external_id';         if ($handle = opendir($dir_path)) {             $i=0;             while (false !== ($fileName = readdir($handle))){                         // Get extension                     $ext = pathinfo($fileName, PATHINFO_EXTENSION);                     $new_id = "name-$i";                     $new_file_name = "$new_i...