Skip to main content

Posts

Configure MySQL to handle camel case (or case sensitive) table names and column names

The default settings provided of MySQL enforce a strict lowercase conversion for all the table and database names. To allow camel case in mysql we need to made following changes in mysql configuration file.   lower_case_table_names It can easily be added to the MySQL my.ini file, usually found in the following folder: C:\xampp\mysql\bin The easiest way to take care of this is to add the following to your my.ini file under the [mysqld] section. [mysqld] ... lower_case_table_names = 2 And Restart Xampp.
Recent posts

Ionic Cordova FCM Execution failed for task ':app:processDebugGoogleServices' Error

I am new to Ionic framework version1 and working on an ionic app. I am trying to make push notifications work through FCM(Firebase Cloud Messaging ), with cordova-plugin-fcm-with-dependecy-updated  plugin in ionic. When I run ionic cordova build android , it gives build failure error: Execution failed for task ':app:processDebugGoogleServices'. > No matching client found for package name 'io.ionic.starter'  I am sharing it because if anyone has the same problem, Please check the widget id in config.xml and package_name in google-services.json are the same.

Inserting and updating multiple rows by using INSERT and SELECT subqueries

How to insert data from one table to another table efficiently? How to insert data from one table using where condition to another table? Let's have a look on it:- SELECT subquery in the INSERT statement can be used to add values into a table from one or more other tables or views. Using a SELECT subquery also lets more than one row be inserted at the same time. INSERT INTO `table1`  (`id`, `user_id`, `name`, `is_default`,  `entity_status`) SELECT NULL, table2.id, 'General', 1, 'Active' FROM table2; Above example will retrieve the all the id from table2 and insert it into table1 with the other data. UPDATE ` table1 `  JOIN table2 on  table2 .academic_session_id =  table1 .academic_session_id SET  table1 .fee_structure_master_id=  table2 .id WHERE  table2 .is_default = 1; Above example will retrieve the all the id from table2 and update it into table1

Filter Array by a condition in PHP

PHP array_filter() function filters elements of an array using a callback function and returns the filtered array. Here we’ll provide a PHP code to filter elements of an array that contain a specific value. It will help you to filter an array based on particular condition. The following example code will filter the elements of a multidimensional array by value using array_filter() functions in PHP. $newArr = array( array( 'name' => 'Fine', 'amount' => 1000 ) , array( 'name' => 'Transport Fee', 'amount' => 0 ) , array( 'name' => 'Cheque Bounce', 'amount' => 50 ) , array( 'name' => 'TC', 'amount' => 100 ) ); $filterArray = array_filter($newArr, function ($var) { return ($var['amount'] != 0); }); // Output the filtered array print_r($filterArray); //OUTPUT Array( [0] => Array( [name] => Fine [amount] => 1000 ...

Upload files to AWS S3 using laravel

Today, I am going to share with you How to file upload in AWS s3 using Laravel 5. Laravel 5 introduce new feature in FileSystem that makes easy to upload file or image or docs etc in S3 server. When we use s3 driver for Storage FileSystem we require to install "league/flysystem-aws-s3-v3" composer package for amazon api. So you have to just follow few step to do this from scratch. First we need to install flysystem-aws-s3-v3 Package. Run below command in CMD/Terminal composer require league/flysystem-aws-s3-v3 Now you have to add following details on your config/filesystems.php file. 's3' => [             'driver' => 's3',             'key' => 'aws-access-key',             'secret' => 'aws-secret-key',             'region' => 'aws-region',             'bucket' => 'bucket-name,      ...

Currency converter with php using Yahoo Api

Hi, Here is a simple PHP code, using which you can get the live currency. API Provider - ( http://finance.yahoo.com/ ) In this example i am getting the value of USD to INR. <?php $from   = 'USD'; $to     = 'INR'; $url = 'http://finance.yahoo.com/d/quotes.csv?e=.csv&f=sl1d1t1&s='. $from . $to .'=X'; $filehandler = @fopen($url, 'r'); if ($filehandler) { $data = fgets($filehandler, 4096);   fclose($filehandler); } $InfoData = explode(',',$data); $convertedValue= $InfoData[1]; echo $convertedValue; ?>