Posts

Solved - $(...).select2 is not a function

 Some time we face a common problem with select2  if select2 library added to all pages and js function too but selection did not exist or was not loaded. So we can fix that issue using below method: Make sure $("#selector") is exists or not. if ( $("#selector").length > 0 ){     //Check selection      $("#selector").select2();     // Call select 2 }

Creating Protected routes in ReactJS

Protected routes are very important for any web application. Below are the code to create authenticated routes that only certain users can access based on their authentication roles. import   React , {  Component  }  from   'react' ; import  {  BrowserRouter   as   Router ,  Route ,  Switch ,  Redirect  }  from   'react-router-dom' ; import   commonService   from   './core/services/commonService' ; import   './App.css' ; import   Loader   from   './views/Loader/Loader' ; // Containers const   FrontEndLayout  =  React . lazy (()  =>   import ( './containers/FrontEndLayout/FrontEndLayout' )); const   UserLayout  =  React . lazy (()  =>   import ( './containers/UserLayout/UserLayout' )); const   loading  = ()  =>   < Loader   /> ; class   App ...

Render a multi-line text string in ReactJS

Sometimes we face a problem to display multiline string in separate line instead of online while rendering ReactJs view. Here are the solution: Add a new class in css file .multi-line-break {   white-space: pre-line; } Add css class with you div or p tag render() {   const textString = 'First Line \n Second Line \n Third Line';   return (      <div className="multi-line-break">         {textString}      </div>   ); } You will get output like this: First Line Second Line Third Line

Multiple Like clauses with where condition in CodeIgniter

Many time we stuck in some situation if we want add multiple like queries with where condition, So for this, you should use Grouping where clause, see below example: $this->db->where('status','1'); $this -> db -> group_start (); //group start $this->db->like('contact_name',$filter_key); $this->db->or_like('contact_email',$filter_key); $this->db->or_like('contact_number',$filter_key); $this->db->or_like('company_name',$filter_key); $this->db->group_end(); //group end $query = $this->db->get('contacts');

Solved - MySQL server has gone away in wammp

Hi Guys, MySQL server has gone away error occurs when you passed max allowed packets may be your query will be crossed max number of line.   Follow below steps to fix:  Go to MySQL installed folder C:\wamp64\bin\mysql\mysql5.7.23 Open my.ini and find max_allowed_packet   Increase  max_allowed_packet  variable Restart wammp or MySQL server 

Solved - How To Disable "Connect Jetpack to activate WooCommerce Services"

Hello Guys, You can fix "Connect Jetpack to activate WooCommerce Services" notification message from wordpress admin area, just copy and paste below code into you theme's functions.php. add_filter( "woocommerce_helper_suppress_admin_notices","'__return_true );

Fixed: Sorry, this file type is not permitted for security reasons

The main reason behind this error in WordPress is more straightforward than it might seem. We can not know it, but WordPress has restrictions on the some types of files we can upload. The error "Sorry, this file type is not permitted for security reasons."  appears when we try to upload a prohibited file type like .svg, .svgz, .docs etc. We can fix this issue using following methods: 1. Modify file types using a Plugin: There are several plugins capable of enabling you to upload prohibited file types, such as File Manager and Enhanced Media Library . 2. Use the upload_mimes filter by editing theme's functions.php file and paste below code: function av_custom_mime_types( $mimes ) { // Add new new allowed mime types $mimes['doc'] = 'application/msword'; $mimes['svg'] = 'image/svg+xml'; $mimes['svgz'] = 'image/svg+xml'; // You can remove any particular mime type (Optional) unset( $mimes['exe'] ); ...